@coasys/ad4m-connect 0.11.2-dev.2 → 0.11.2-dev.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/web.js CHANGED
@@ -1,49 +1,49 @@
1
- var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Object.getPrototypeOf;var uu=Reflect.get;var Q=(i,e,t,r)=>{for(var n=r>1?void 0:r?cu(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&ou(e,t,n),n};var _o=(i,e,t)=>uu(lu(i),t,e);var $e=(i,e,t)=>new Promise((r,n)=>{var a=l=>{try{o(t.next(l))}catch(c){n(c)}},s=l=>{try{o(t.throw(l))}catch(c){n(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((t=t.apply(i,e)).next())});var $n=window,In=$n.ShadowRoot&&($n.ShadyCSS===void 0||$n.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ka=Symbol(),So=new WeakMap,$r=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Ka)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(In&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=So.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&So.set(t,e))}return e}toString(){return this.cssText}},wo=i=>new $r(typeof i=="string"?i:i+"",void 0,Ka),lt=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,n,a)=>r+(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.")})(n)+i[a+1],i[0]);return new $r(t,i,Ka)},Qa=(i,e)=>{In?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=$n.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},kn=In?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return wo(t)})(i):i;var Wa,Tn=window,Eo=Tn.trustedTypes,du=Eo?Eo.emptyScript:"",xo=Tn.reactiveElementPolyfillSupport,Za={toAttribute(i,e){switch(e){case Boolean:i=i?du:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},Ao=(i,e)=>e!==i&&(e==e||i==i),Ga={attribute:!0,type:String,converter:Za,reflect:!1,hasChanged:Ao},Ja="finalized",It=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}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,r)=>{let n=this._$Ep(r,t);n!==void 0&&(this._$Ev.set(n,r),e.push(n))}),e}static createProperty(e,t=Ga){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let r=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Ga}static finalize(){if(this.hasOwnProperty(Ja))return!1;this[Ja]=!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,r=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of r)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(kn(n))}else e!==void 0&&t.push(kn(e));return t}static _$Ep(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){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,r;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)===null||r===void 0||r.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 Qa(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 r;return(r=t.hostConnected)===null||r===void 0?void 0:r.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var r;return(r=t.hostDisconnected)===null||r===void 0?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=Ga){var n;let a=this.constructor._$Ep(e,r);if(a!==void 0&&r.reflect===!0){let s=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:Za).toAttribute(t,r.type);this._$El=e,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(e,t){var r;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let s=n.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((r=s.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?s.converter:Za;this._$El=a,this[a]=o.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;e!==void 0&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||Ao)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,r))):n=!1),!this.isUpdatePending&&n&&(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((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(r)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),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,r)=>this._$EO(r,this[r],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};It[Ja]=!0,It.elementProperties=new Map,It.elementStyles=[],It.shadowRootOptions={mode:"open"},xo?.({ReactiveElement:It}),((Wa=Tn.reactiveElementVersions)!==null&&Wa!==void 0?Wa:Tn.reactiveElementVersions=[]).push("1.6.3");var Ya,Cn=window,Wi=Cn.trustedTypes,$o=Wi?Wi.createPolicy("lit-html",{createHTML:i=>i}):void 0,es="$lit$",Dt=`lit$${(Math.random()+"").slice(9)}$`,Po="?"+Dt,pu=`<${Po}>`,oi=document,kr=()=>oi.createComment(""),Tr=i=>i===null||typeof i!="object"&&typeof i!="function",Ro=Array.isArray,fu=i=>Ro(i)||typeof i?.[Symbol.iterator]=="function",Xa=`[
2
- \f\r]`,Ir=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Io=/-->/g,ko=/>/g,ai=RegExp(`>|${Xa}(?:([^\\s"'>=/]+)(${Xa}*=${Xa}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),To=/'/g,Co=/"/g,Oo=/^(?:script|style|textarea|title)$/i,Do=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),M=Do(1),Gh=Do(2),ci=Symbol.for("lit-noChange"),_e=Symbol.for("lit-nothing"),No=new WeakMap,si=oi.createTreeWalker(oi,129,null,!1);function Mo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return $o!==void 0?$o.createHTML(e):e}var hu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Ir;for(let o=0;o<t;o++){let l=i[o],c,u,g=-1,h=0;for(;h<l.length&&(s.lastIndex=h,u=s.exec(l),u!==null);)h=s.lastIndex,s===Ir?u[1]==="!--"?s=Io:u[1]!==void 0?s=ko:u[2]!==void 0?(Oo.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=ai):u[3]!==void 0&&(s=ai):s===ai?u[0]===">"?(s=n??Ir,g=-1):u[1]===void 0?g=-2:(g=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ai:u[3]==='"'?Co:To):s===Co||s===To?s=ai:s===Io||s===ko?s=Ir:(s=ai,n=void 0);let d=s===ai&&i[o+1].startsWith("/>")?" ":"";a+=s===Ir?l+pu:g>=0?(r.push(c),l.slice(0,g)+es+l.slice(g)+Dt+d):l+Dt+(g===-2?(r.push(void 0),o):d)}return[Mo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},li=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,l=this.parts,[c,u]=hu(e,t);if(this.el=li.createElement(c,r),si.currentNode=this.el.content,t===2){let g=this.el.content,h=g.firstChild;h.remove(),g.append(...h.childNodes)}for(;(n=si.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let g=[];for(let h of n.getAttributeNames())if(h.endsWith(es)||h.startsWith(Dt)){let d=u[s++];if(g.push(h),d!==void 0){let y=n.getAttribute(d.toLowerCase()+es).split(Dt),_=/([.?@])?(.*)/.exec(d);l.push({type:1,index:a,name:_[2],strings:y,ctor:_[1]==="."?is:_[1]==="?"?rs:_[1]==="@"?ns:Zi})}else l.push({type:6,index:a})}for(let h of g)n.removeAttribute(h)}if(Oo.test(n.tagName)){let g=n.textContent.split(Dt),h=g.length-1;if(h>0){n.textContent=Wi?Wi.emptyScript:"";for(let d=0;d<h;d++)n.append(g[d],kr()),si.nextNode(),l.push({type:2,index:++a});n.append(g[h],kr())}}}else if(n.nodeType===8)if(n.data===Po)l.push({type:2,index:a});else{let g=-1;for(;(g=n.data.indexOf(Dt,g+1))!==-1;)l.push({type:7,index:a}),g+=Dt.length-1}a++}}static createElement(e,t){let r=oi.createElement("template");return r.innerHTML=e,r}};function Gi(i,e,t=i,r){var n,a,s,o;if(e===ci)return e;let l=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,c=Tr(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((a=l?._$AO)===null||a===void 0||a.call(l,!1),c===void 0?l=void 0:(l=new c(i),l._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=l:t._$Cl=l),l!==void 0&&(e=Gi(i,l._$AS(i,e.values),l,r)),e}var ts=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:r},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:oi).importNode(r,!0);si.currentNode=a;let s=si.nextNode(),o=0,l=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new ui(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new as(s,this,e)),this._$AV.push(u),c=n[++l]}o!==c?.index&&(s=si.nextNode(),o++)}return si.currentNode=oi,a}v(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},ui=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=_e,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}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=Gi(this,e,t),Tr(e)?e===_e||e==null||e===""?(this._$AH!==_e&&this._$AR(),this._$AH=_e):e!==this._$AH&&e!==ci&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):fu(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==_e&&Tr(this._$AH)?this._$AA.nextSibling.data=e:this.$(oi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:r,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=li.createElement(Mo(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(r);else{let s=new ts(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=No.get(e.strings);return t===void 0&&No.set(e.strings,t=new li(e)),t}T(e){Ro(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new ui(this.k(kr()),this.k(kr()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},Zi=class{constructor(e,t,r,n,a){this.type=1,this._$AH=_e,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=_e}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){let a=this.strings,s=!1;if(a===void 0)e=Gi(this,e,t,0),s=!Tr(e)||e!==this._$AH&&e!==ci,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=Gi(this,o[r+l],t,l),c===ci&&(c=this._$AH[l]),s||(s=!Tr(c)||c!==this._$AH[l]),c===_e?e=_e:e!==_e&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!n&&this.j(e)}j(e){e===_e?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},is=class extends Zi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===_e?void 0:e}},gu=Wi?Wi.emptyScript:"",rs=class extends Zi{constructor(){super(...arguments),this.type=4}j(e){e&&e!==_e?this.element.setAttribute(this.name,gu):this.element.removeAttribute(this.name)}},ns=class extends Zi{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=Gi(this,e,t,0))!==null&&r!==void 0?r:_e)===ci)return;let n=this._$AH,a=e===_e&&n!==_e||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==_e&&(n===_e||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:this.element,e):this._$AH.handleEvent(e)}},as=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Gi(this,e)}};var Lo=Cn.litHtmlPolyfillSupport;Lo?.(li,ui),((Ya=Cn.litHtmlVersions)!==null&&Ya!==void 0?Ya:Cn.litHtmlVersions=[]).push("2.8.0");var Uo=(i,e,t)=>{var r,n;let a=(r=t?.renderBefore)!==null&&r!==void 0?r:e,s=a._$litPart$;if(s===void 0){let o=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new ui(e.insertBefore(kr(),o),o,void 0,t??{})}return s._$AI(i),s};var ss,os;var qe=class extends It{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let r=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=r.firstChild),r}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Uo(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 ci}};qe.finalized=!0,qe._$litElement$=!0,(ss=globalThis.litElementHydrateSupport)===null||ss===void 0||ss.call(globalThis,{LitElement:qe});var Fo=globalThis.litElementPolyfillSupport;Fo?.({LitElement:qe});((os=globalThis.litElementVersions)!==null&&os!==void 0?os:globalThis.litElementVersions=[]).push("3.3.3");var Mt=i=>e=>typeof e=="function"?((t,r)=>(customElements.define(t,r),r))(i,e):((t,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(t,s)}}})(i,e);var mu=(i,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,i)}}:{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,i)}},yu=(i,e,t)=>{e.constructor.createProperty(t,i)};function Se(i){return(e,t)=>t!==void 0?yu(i,e,t):mu(i,e)}function ue(i){return Se({...i,state:!0})}var cs,wg=((cs=window.HTMLSlotElement)===null||cs===void 0?void 0:cs.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var vu=i=>{let e=new Set;do for(let t of Reflect.ownKeys(i))e.add([i,t]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return e};function ls(i,{include:e,exclude:t}={}){let r=n=>{let a=s=>typeof s=="string"?n===s:s.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of vu(i.constructor.prototype)){if(a==="constructor"||!r(a))continue;let s=Reflect.getOwnPropertyDescriptor(n,a);s&&typeof s.value=="function"&&(i[a]=i[a].bind(i))}return i}function di(){return M`
1
+ var cu=Object.defineProperty;var lu=Object.getOwnPropertyDescriptor;var uu=Object.getPrototypeOf;var du=Reflect.get;var V=(i,e,t,r)=>{for(var n=r>1?void 0:r?lu(e,t):e,a=i.length-1,s;a>=0;a--)(s=i[a])&&(n=(r?s(e,t,n):s(n))||n);return r&&n&&cu(e,t,n),n};var So=(i,e,t)=>du(uu(i),t,e);var Se=(i,e,t)=>new Promise((r,n)=>{var a=l=>{try{o(t.next(l))}catch(c){n(c)}},s=l=>{try{o(t.throw(l))}catch(c){n(c)}},o=l=>l.done?r(l.value):Promise.resolve(l.value).then(a,s);o((t=t.apply(i,e)).next())});var Tn=window,Cn=Tn.ShadowRoot&&(Tn.ShadyCSS===void 0||Tn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Qa=Symbol(),wo=new WeakMap,Tr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==Qa)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(Cn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=wo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&wo.set(t,e))}return e}toString(){return this.cssText}},Eo=i=>new Tr(typeof i=="string"?i:i+"",void 0,Qa),Ge=(i,...e)=>{let t=i.length===1?i[0]:e.reduce((r,n,a)=>r+(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.")})(n)+i[a+1],i[0]);return new Tr(t,i,Qa)},Wa=(i,e)=>{Cn?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=Tn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Nn=Cn?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return Eo(t)})(i):i;var Ga,Ln=window,xo=Ln.trustedTypes,pu=xo?xo.emptyScript:"",Ao=Ln.reactiveElementPolyfillSupport,Ja={toAttribute(i,e){switch(e){case Boolean:i=i?pu:null;break;case Object:case Array:i=i==null?i:JSON.stringify(i)}return i},fromAttribute(i,e){let t=i;switch(e){case Boolean:t=i!==null;break;case Number:t=i===null?null:Number(i);break;case Object:case Array:try{t=JSON.parse(i)}catch{t=null}}return t}},$o=(i,e)=>e!==i&&(e==e||i==i),Za={attribute:!0,type:String,converter:Ja,reflect:!1,hasChanged:$o},Ya="finalized",kt=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}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,r)=>{let n=this._$Ep(r,t);n!==void 0&&(this._$Ev.set(n,r),e.push(n))}),e}static createProperty(e,t=Za){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let r=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,r,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,r){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Za}static finalize(){if(this.hasOwnProperty(Ya))return!1;this[Ya]=!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,r=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of r)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let r=new Set(e.flat(1/0).reverse());for(let n of r)t.unshift(Nn(n))}else e!==void 0&&t.push(Nn(e));return t}static _$Ep(e,t){let r=t.attribute;return r===!1?void 0:typeof r=="string"?r:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){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,r;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((r=e.hostConnected)===null||r===void 0||r.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 Wa(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 r;return(r=t.hostConnected)===null||r===void 0?void 0:r.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var r;return(r=t.hostDisconnected)===null||r===void 0?void 0:r.call(t)})}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$EO(e,t,r=Za){var n;let a=this.constructor._$Ep(e,r);if(a!==void 0&&r.reflect===!0){let s=(((n=r.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?r.converter:Ja).toAttribute(t,r.type);this._$El=e,s==null?this.removeAttribute(a):this.setAttribute(a,s),this._$El=null}}_$AK(e,t){var r;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let s=n.getPropertyOptions(a),o=typeof s.converter=="function"?{fromAttribute:s.converter}:((r=s.converter)===null||r===void 0?void 0:r.fromAttribute)!==void 0?s.converter:Ja;this._$El=a,this[a]=o.fromAttribute(t,s.type),this._$El=null}}requestUpdate(e,t,r){let n=!0;e!==void 0&&(((r=r||this.constructor.getPropertyOptions(e)).hasChanged||$o)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),r.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,r))):n=!1),!this.isUpdatePending&&n&&(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((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,r=this._$AL;try{t=this.shouldUpdate(r),t?(this.willUpdate(r),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(r)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(r)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostUpdated)===null||n===void 0?void 0:n.call(r)}),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,r)=>this._$EO(r,this[r],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};kt[Ya]=!0,kt.elementProperties=new Map,kt.elementStyles=[],kt.shadowRootOptions={mode:"open"},Ao?.({ReactiveElement:kt}),((Ga=Ln.reactiveElementVersions)!==null&&Ga!==void 0?Ga:Ln.reactiveElementVersions=[]).push("1.6.3");var Xa,Pn=window,Zi=Pn.trustedTypes,Io=Zi?Zi.createPolicy("lit-html",{createHTML:i=>i}):void 0,ts="$lit$",Mt=`lit$${(Math.random()+"").slice(9)}$`,Ro="?"+Mt,fu=`<${Ro}>`,li=document,Nr=()=>li.createComment(""),Lr=i=>i===null||typeof i!="object"&&typeof i!="function",Oo=Array.isArray,hu=i=>Oo(i)||typeof i?.[Symbol.iterator]=="function",es=`[
2
+ \f\r]`,Cr=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,ko=/-->/g,To=/>/g,oi=RegExp(`>|${es}(?:([^\\s"'>=/]+)(${es}*=${es}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Co=/'/g,No=/"/g,Do=/^(?:script|style|textarea|title)$/i,Mo=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),L=Mo(1),Zh=Mo(2),ui=Symbol.for("lit-noChange"),we=Symbol.for("lit-nothing"),Lo=new WeakMap,ci=li.createTreeWalker(li,129,null,!1);function Uo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Io!==void 0?Io.createHTML(e):e}var gu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Cr;for(let o=0;o<t;o++){let l=i[o],c,u,g=-1,h=0;for(;h<l.length&&(s.lastIndex=h,u=s.exec(l),u!==null);)h=s.lastIndex,s===Cr?u[1]==="!--"?s=ko:u[1]!==void 0?s=To:u[2]!==void 0?(Do.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=oi):u[3]!==void 0&&(s=oi):s===oi?u[0]===">"?(s=n??Cr,g=-1):u[1]===void 0?g=-2:(g=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?oi:u[3]==='"'?No:Co):s===No||s===Co?s=oi:s===ko||s===To?s=Cr:(s=oi,n=void 0);let d=s===oi&&i[o+1].startsWith("/>")?" ":"";a+=s===Cr?l+fu:g>=0?(r.push(c),l.slice(0,g)+ts+l.slice(g)+Mt+d):l+Mt+(g===-2?(r.push(void 0),o):d)}return[Uo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},di=class{constructor({strings:e,_$litType$:t},r){let n;this.parts=[];let a=0,s=0,o=e.length-1,l=this.parts,[c,u]=gu(e,t);if(this.el=di.createElement(c,r),ci.currentNode=this.el.content,t===2){let g=this.el.content,h=g.firstChild;h.remove(),g.append(...h.childNodes)}for(;(n=ci.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let g=[];for(let h of n.getAttributeNames())if(h.endsWith(ts)||h.startsWith(Mt)){let d=u[s++];if(g.push(h),d!==void 0){let y=n.getAttribute(d.toLowerCase()+ts).split(Mt),_=/([.?@])?(.*)/.exec(d);l.push({type:1,index:a,name:_[2],strings:y,ctor:_[1]==="."?rs:_[1]==="?"?ns:_[1]==="@"?as:Yi})}else l.push({type:6,index:a})}for(let h of g)n.removeAttribute(h)}if(Do.test(n.tagName)){let g=n.textContent.split(Mt),h=g.length-1;if(h>0){n.textContent=Zi?Zi.emptyScript:"";for(let d=0;d<h;d++)n.append(g[d],Nr()),ci.nextNode(),l.push({type:2,index:++a});n.append(g[h],Nr())}}}else if(n.nodeType===8)if(n.data===Ro)l.push({type:2,index:a});else{let g=-1;for(;(g=n.data.indexOf(Mt,g+1))!==-1;)l.push({type:7,index:a}),g+=Mt.length-1}a++}}static createElement(e,t){let r=li.createElement("template");return r.innerHTML=e,r}};function Ji(i,e,t=i,r){var n,a,s,o;if(e===ui)return e;let l=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,c=Lr(e)?void 0:e._$litDirective$;return l?.constructor!==c&&((a=l?._$AO)===null||a===void 0||a.call(l,!1),c===void 0?l=void 0:(l=new c(i),l._$AT(i,t,r)),r!==void 0?((s=(o=t)._$Co)!==null&&s!==void 0?s:o._$Co=[])[r]=l:t._$Cl=l),l!==void 0&&(e=Ji(i,l._$AS(i,e.values),l,r)),e}var is=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:r},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:li).importNode(r,!0);ci.currentNode=a;let s=ci.nextNode(),o=0,l=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new pi(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new ss(s,this,e)),this._$AV.push(u),c=n[++l]}o!==c?.index&&(s=ci.nextNode(),o++)}return ci.currentNode=li,a}v(e){let t=0;for(let r of this._$AV)r!==void 0&&(r.strings!==void 0?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}},pi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=we,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}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=Ji(this,e,t),Lr(e)?e===we||e==null||e===""?(this._$AH!==we&&this._$AR(),this._$AH=we):e!==this._$AH&&e!==ui&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):hu(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==we&&Lr(this._$AH)?this._$AA.nextSibling.data=e:this.$(li.createTextNode(e)),this._$AH=e}g(e){var t;let{values:r,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=di.createElement(Uo(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(r);else{let s=new is(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Lo.get(e.strings);return t===void 0&&Lo.set(e.strings,t=new di(e)),t}T(e){Oo(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,n=0;for(let a of e)n===t.length?t.push(r=new pi(this.k(Nr()),this.k(Nr()),this,this.options)):r=t[n],r._$AI(a),n++;n<t.length&&(this._$AR(r&&r._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var r;for((r=this._$AP)===null||r===void 0||r.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},Yi=class{constructor(e,t,r,n,a){this.type=1,this._$AH=we,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,r.length>2||r[0]!==""||r[1]!==""?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=we}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,r,n){let a=this.strings,s=!1;if(a===void 0)e=Ji(this,e,t,0),s=!Lr(e)||e!==this._$AH&&e!==ui,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=Ji(this,o[r+l],t,l),c===ui&&(c=this._$AH[l]),s||(s=!Lr(c)||c!==this._$AH[l]),c===we?e=we:e!==we&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!n&&this.j(e)}j(e){e===we?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},rs=class extends Yi{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===we?void 0:e}},mu=Zi?Zi.emptyScript:"",ns=class extends Yi{constructor(){super(...arguments),this.type=4}j(e){e&&e!==we?this.element.setAttribute(this.name,mu):this.element.removeAttribute(this.name)}},as=class extends Yi{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=Ji(this,e,t,0))!==null&&r!==void 0?r:we)===ui)return;let n=this._$AH,a=e===we&&n!==we||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==we&&(n===we||a);a&&this.element.removeEventListener(this.name,this,n),s&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,r;typeof this._$AH=="function"?this._$AH.call((r=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&r!==void 0?r:this.element,e):this._$AH.handleEvent(e)}},ss=class{constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){Ji(this,e)}};var Po=Pn.litHtmlPolyfillSupport;Po?.(di,pi),((Xa=Pn.litHtmlVersions)!==null&&Xa!==void 0?Xa:Pn.litHtmlVersions=[]).push("2.8.0");var Fo=(i,e,t)=>{var r,n;let a=(r=t?.renderBefore)!==null&&r!==void 0?r:e,s=a._$litPart$;if(s===void 0){let o=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=s=new pi(e.insertBefore(Nr(),o),o,void 0,t??{})}return s._$AI(i),s};var os,cs;var Le=class extends kt{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let r=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=r.firstChild),r}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Fo(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 ui}};Le.finalized=!0,Le._$litElement$=!0,(os=globalThis.litElementHydrateSupport)===null||os===void 0||os.call(globalThis,{LitElement:Le});var jo=globalThis.litElementPolyfillSupport;jo?.({LitElement:Le});((cs=globalThis.litElementVersions)!==null&&cs!==void 0?cs:globalThis.litElementVersions=[]).push("3.3.3");var ht=i=>e=>typeof e=="function"?((t,r)=>(customElements.define(t,r),r))(i,e):((t,r)=>{let{kind:n,elements:a}=r;return{kind:n,elements:a,finisher(s){customElements.define(t,s)}}})(i,e);var yu=(i,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,i)}}:{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,i)}},vu=(i,e,t)=>{e.constructor.createProperty(t,i)};function de(i){return(e,t)=>t!==void 0?vu(i,e,t):yu(i,e)}function ue(i){return de({...i,state:!0})}var ls,Eg=((ls=window.HTMLSlotElement)===null||ls===void 0?void 0:ls.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var bu=i=>{let e=new Set;do for(let t of Reflect.ownKeys(i))e.add([i,t]);while((i=Reflect.getPrototypeOf(i))&&i!==Object.prototype);return e};function us(i,{include:e,exclude:t}={}){let r=n=>{let a=s=>typeof s=="string"?n===s:s.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of bu(i.constructor.prototype)){if(a==="constructor"||!r(a))continue;let s=Reflect.getOwnPropertyDescriptor(n,a);s&&typeof s.value=="function"&&(i[a]=i[a].bind(i))}return i}var Bo="0.11.2-dev";function Su(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Rn(i,e){Su()&&localStorage.setItem(`${Bo}/${i}`,e)}function On(i,e=1e4){return Se(this,null,function*(){return Promise.race([new Promise((t,r)=>{let n;try{n=new WebSocket(i,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{r(a)},n.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),r(a)}}),new Promise((t,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},e)})])})}function fi(){return L`
4
4
  <svg viewBox="0 0 63.6 60" fill="none" xmlns="http://www.w3.org/2000/svg">
5
5
  <path fill="currentColor" d="M63.2781 52.9928C62.4038 47.0393 59.8345 41.4763 55.9242 36.935C55.9403 36.5766 55.951 36.2182 55.951 35.8545C55.951 26.6328 50.7373 18.6039 43.0937 14.5333C41.093 9.35009 37.7352 4.72854 33.2402 1.14469L31.7705 0L30.2793 1.10725L30.2096 1.16074C25.7253 4.74458 22.3729 9.36079 20.3775 14.5386C12.7339 18.6039 7.52021 26.6328 7.52021 35.8599C7.52021 36.2236 7.53094 36.582 7.54703 36.9404C3.6421 41.471 1.06742 47.034 0.198465 52.9874L0 54.9131L1.70036 55.5817C5.40683 57.0313 9.32249 57.7695 13.3401 57.7695C15.668 57.7695 17.9369 57.5127 20.1254 57.0366C23.5744 58.9248 27.533 60 31.7383 60C35.9436 60 39.9022 58.9248 43.3512 57.0366C45.5397 57.5127 47.8086 57.7695 50.1365 57.7695C54.1541 57.7695 58.0698 57.0366 61.7762 55.5817L63.5624 54.881L63.2835 52.9874L63.2781 52.9928ZM42.5734 51.8802C40.0792 51.1581 37.7352 50.0829 35.595 48.7189C39.752 44.675 42.8041 39.5079 44.263 33.7202C46.1297 34.6938 47.8891 35.8866 49.4982 37.288C49.9917 37.716 50.4637 38.1653 50.9197 38.6253C50.1258 44.1294 46.9986 48.8954 42.568 51.8855L42.5734 51.8802ZM12.5516 38.62C13.0075 38.1599 13.4849 37.716 13.973 37.288C15.5822 35.8866 17.3415 34.6938 19.2082 33.7202C20.6672 39.5079 23.7192 44.675 27.8763 48.7189C25.7361 50.0829 23.392 51.1527 20.8978 51.8802C16.4672 48.8901 13.3401 44.1241 12.5462 38.62H12.5516ZM40.3957 25.9802C40.3957 26.3332 40.3903 26.6809 40.3742 27.0286C37.585 26.2477 34.6831 25.8411 31.7383 25.8411C28.7935 25.8411 25.8916 26.2477 23.1024 27.0286C23.0917 26.6809 23.0809 26.3279 23.0809 25.9802C23.0809 23.2362 23.494 20.5563 24.2825 18.0102C26.5782 17.0527 29.0993 16.5231 31.7383 16.5231C34.3773 16.5231 36.8984 17.0527 39.1941 18.0102C39.9826 20.5563 40.3957 23.2362 40.3957 25.9802ZM23.73 31.8641C26.3047 31.0671 29.0027 30.6553 31.7383 30.6553C34.4739 30.6553 37.1719 31.0671 39.7466 31.8641C38.5344 37.2827 35.6808 42.0915 31.7383 45.7395C27.7958 42.0861 24.9422 37.2773 23.73 31.8641ZM50.7641 32.1262C48.9887 30.8104 47.0898 29.6817 45.0998 28.7671C45.1803 27.847 45.2232 26.9163 45.2232 25.9802C45.2232 24.536 45.1266 23.1131 44.9335 21.7063C47.8676 24.4343 49.9595 28.0503 50.7641 32.1262ZM31.7383 6.19417C33.6639 7.97005 35.2946 9.99198 36.6087 12.1904C35.0371 11.8695 33.4065 11.6983 31.7383 11.6983C30.0701 11.6983 28.4395 11.8695 26.8679 12.1904C28.182 9.99198 29.8127 7.97005 31.7383 6.19417ZM18.5431 21.701C18.3553 23.1078 18.2534 24.5306 18.2534 25.9749C18.2534 26.9163 18.2963 27.8417 18.3768 28.7617C16.3868 29.6764 14.4879 30.805 12.7125 32.1209C13.5171 28.0449 15.6036 24.429 18.5377 21.701H18.5431ZM5.33173 51.7518C5.9915 48.7938 7.15547 45.9802 8.74855 43.418C9.95007 47.034 11.9776 50.2808 14.622 52.9179C14.1983 52.9393 13.7692 52.95 13.3401 52.95C10.5991 52.95 7.91178 52.5488 5.32637 51.7465L5.33173 51.7518ZM31.7383 55.1859C30.1506 55.1859 28.6058 54.988 27.1307 54.6296C28.7452 53.854 30.29 52.95 31.7383 51.923C33.1866 52.95 34.7314 53.854 36.3459 54.6296C34.8655 54.988 33.326 55.1859 31.7383 55.1859ZM50.1365 52.95C49.7074 52.95 49.2783 52.9339 48.8546 52.9179C51.499 50.2808 53.5265 47.0393 54.728 43.4234C56.3211 45.9802 57.4851 48.7938 58.1449 51.7518C55.5648 52.5488 52.8775 52.95 50.1365 52.95Z" />
6
6
  </svg>
7
- `}function Nn(){return M`
7
+ `}function Xi(){return L`
8
8
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
9
9
  <circle cx="12" cy="12" r="10"></circle>
10
10
  <circle cx="12" cy="12" r="3" fill="currentColor"></circle>
11
11
  </svg>
12
- `}function Ln(){return M`
12
+ `}function er(){return L`
13
13
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
14
14
  <circle cx="12" cy="12" r="10"></circle>
15
15
  <path d="M2 12h20"></path>
16
16
  <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
17
17
  </svg>
18
- `}function Pn(){return M`
18
+ `}function Dn(){return L`
19
19
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
20
20
  <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
21
21
  <polyline points="7 10 12 15 17 10"></polyline>
22
22
  <line x1="12" y1="15" x2="12" y2="3"></line>
23
23
  </svg>
24
- `}function ut(){return M`
24
+ `}function ut(){return L`
25
25
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
26
26
  <rect width="256" height="256" fill="none"/>
27
27
  <polyline points="40 144 96 200 224 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
28
28
  </svg>
29
- `}function We(){return M`
29
+ `}function Oe(){return L`
30
30
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256">
31
31
  <path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
32
32
  </svg>
33
- `}function Rn(){return M`
33
+ `}function Mn(){return L`
34
34
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
35
35
  <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/>
36
36
  <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>
37
37
  </svg>
38
- `}function On(){return M`
38
+ `}function Un(){return L`
39
39
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-right" viewBox="0 0 16 16">
40
40
  <path fill-rule="evenodd" d="M1 11.5a.5.5 0 0 0 .5.5h11.793l-3.147 3.146a.5.5 0 0 0 .708.708l4-4a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 11H1.5a.5.5 0 0 0-.5.5m14-7a.5.5 0 0 1-.5.5H2.707l3.147 3.146a.5.5 0 1 1-.708.708l-4-4a.5.5 0 0 1 0-.708l4-4a.5.5 0 1 1 .708.708L2.707 4H14.5a.5.5 0 0 1 .5.5"/>
41
41
  </svg>
42
- `}function Ji(){return M`
42
+ `}function tr(){return L`
43
43
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
44
44
  <path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
45
45
  </svg>
46
- `}var Yi=lt`
46
+ `}var Ut=Ge`
47
47
  * {
48
48
  box-sizing: border-box;
49
49
  }
@@ -84,12 +84,6 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
84
84
  color: rgba(255, 255, 255, 0.8);
85
85
  }
86
86
 
87
- label {
88
- font-size: 14px;
89
- font-weight: 500;
90
- color: rgba(255, 255, 255, 0.9);
91
- }
92
-
93
87
  /* Buttons */
94
88
  button {
95
89
  display: flex;
@@ -126,12 +120,6 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
126
120
  background: var(--ac-primary-color-light);
127
121
  }
128
122
 
129
- button.primary:focus-visible:not(:disabled) {
130
- outline: 2px solid var(--ac-primary-color-light);
131
- outline-offset: 2px;
132
- box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
133
- }
134
-
135
123
  button.secondary {
136
124
  background: #00091e5c;
137
125
  color: var(--ac-primary-color);
@@ -149,47 +137,50 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
149
137
  box-shadow: 0 0 0 4px rgba(255, 255, 255, 0.2);
150
138
  }
151
139
 
152
- button.ghost {
153
- background: transparent;
154
- color: rgba(255, 255, 255, 0.7);
140
+ button.danger {
141
+ background: var(--ac-danger-color);
155
142
  }
156
143
 
157
- button.ghost:hover:not(:disabled) {
158
- color: #ffffff;
159
- background: rgba(255, 255, 255, 0.05);
144
+ button.danger:hover:not(:disabled) {
145
+ background: #c8165b;
160
146
  }
161
147
 
162
- button.ghost:focus-visible:not(:disabled) {
163
- outline: 2px solid rgba(255, 255, 255, 0.7);
148
+ button.danger:focus-visible:not(:disabled) {
149
+ outline: 2px solid var(--ac-danger-color);
164
150
  outline-offset: 2px;
165
- background: rgba(255, 255, 255, 0.05);
151
+ box-shadow: 0 0 0 4px rgba(244, 54, 127, 0.2);
166
152
  }
167
153
 
168
- button.link {
169
- background: transparent;
170
- color: var(--ac-primary-color);
171
- text-decoration: none;
172
- height: auto;
173
- padding: 12px 24px;
154
+ button:disabled {
155
+ opacity: 0.5;
156
+ cursor: not-allowed;
174
157
  }
175
158
 
176
- button.link:hover {
177
- text-decoration: underline;
159
+ button.full {
160
+ width: 100%;
178
161
  }
179
162
 
180
- button.link:focus-visible {
181
- outline: 2px solid var(--ac-primary-color);
182
- outline-offset: 2px;
183
- text-decoration: underline;
163
+ .back-button,
164
+ .close-button {
165
+ position: absolute;
166
+ top: 20px;
167
+ cursor: pointer;
184
168
  }
185
169
 
186
- button:disabled {
187
- opacity: 0.5;
188
- cursor: not-allowed;
170
+ .back-button {
171
+ left: 20px;
189
172
  }
190
173
 
191
- button.full {
192
- width: 100%;
174
+ .close-button {
175
+ right: 20px;
176
+ }
177
+
178
+ .back-button svg,
179
+ .close-button svg {
180
+ width: 28px;
181
+ height: 28px;
182
+ color: white;
183
+ opacity: 0.5;
193
184
  }
194
185
 
195
186
  /* Inputs */
@@ -237,6 +228,11 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
237
228
  align-items: center;
238
229
  gap: 12px;
239
230
  }
231
+
232
+ .center {
233
+ display: flex;
234
+ justify-content: center;
235
+ }
240
236
 
241
237
  .header {
242
238
  text-align: center;
@@ -260,6 +256,26 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
260
256
  transition: all 0.3s ease;
261
257
  }
262
258
 
259
+ .box-header {
260
+ display: flex;
261
+ align-items: center;
262
+ gap: 10px;
263
+ margin-bottom: -8px;
264
+ }
265
+
266
+ .box-header h3 {
267
+ font-weight: 600;
268
+ }
269
+
270
+ .box-header svg {
271
+ width: 24px;
272
+ height: 24px;
273
+ stroke-width: 2;
274
+ flex-shrink: 0;
275
+ color: var(--ac-primary-color);
276
+ }
277
+
278
+ /* State indicators */
263
279
  .state {
264
280
  display: flex;
265
281
  align-items: center;
@@ -289,54 +305,7 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
289
305
  .state.danger svg {
290
306
  color: var(--ac-danger-color);
291
307
  }
292
-
293
- .back-button {
294
- position: absolute;
295
- top: 20px;
296
- left: 20px;
297
- cursor: pointer;
298
- }
299
-
300
- .back-button svg {
301
- width: 28px;
302
- height: 28px;
303
- color: white;
304
- opacity: 0.5;
305
- }
306
-
307
- .button-row {
308
- display: flex;
309
- gap: 12px;
310
- }
311
-
312
- .center {
313
- display: flex;
314
- justify-content: center;
315
- }
316
-
317
- .form-group {
318
- display: flex;
319
- flex-direction: column;
320
- gap: 8px;
321
- }
322
-
323
- /* Error and info boxes */
324
- .error-box {
325
- padding: 16px;
326
- background: rgba(239, 68, 68, 0.1);
327
- border: 1px solid rgba(239, 68, 68, 0.3);
328
- border-radius: 8px;
329
- color: #fca5a5;
330
- font-size: 14px;
331
- }
332
-
333
- .info-box {
334
- background: rgba(145, 227, 253, 0.05);
335
- border: 1px solid rgba(145, 227, 253, 0.2);
336
- border-radius: 8px;
337
- padding: 20px;
338
- }
339
- `;var jo="0.11.2-dev";function _u(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Dn(i,e){_u()&&localStorage.setItem(`${jo}/${i}`,e)}function Mn(i,e=1e4){return $e(this,null,function*(){return Promise.race([new Promise((t,r)=>{let n;try{n=new WebSocket(i,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{r(a)},n.onclose=a=>{a.code!==1e3&&r(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),r(a)}}),new Promise((t,r)=>{setTimeout(()=>{r(new Error("WebSocket connection timed out"))},e)})])})}var Re=class extends qe{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl=""}changePort(){return $e(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return $e(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return $e(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-remote-node",{detail:{remoteUrl:this.newRemoteUrl},bubbles:!0,composed:!0}))})}clearRemoteNodeError(){this.dispatchEvent(new CustomEvent("clear-remote-node-error",{bubbles:!0,composed:!0}))}detectLocalNode(){return $e(this,null,function*(){try{yield Mn(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return $e(this,null,function*(){_o(Re.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",yield this.detectLocalNode(),this.loading=!1})}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:M`
308
+ `;var De=class extends Le{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl=""}changePort(){return Se(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return Se(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return Se(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-remote-node",{detail:{remoteUrl:this.newRemoteUrl},bubbles:!0,composed:!0}))})}clearRemoteNodeError(){this.dispatchEvent(new CustomEvent("clear-remote-node-error",{bubbles:!0,composed:!0}))}detectLocalNode(){return Se(this,null,function*(){try{yield On(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return Se(this,null,function*(){So(De.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",yield this.detectLocalNode(),this.loading=!1})}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:L`
340
309
  <div class="container">
341
310
  <div class="header">
342
311
  <h1>Connect AD4M</h1>
@@ -345,12 +314,12 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
345
314
 
346
315
  <div class="options">
347
316
  <div class="box">
348
- <div class="option-header">
349
- ${Nn()}
317
+ <div class="box-header">
318
+ ${Xi()}
350
319
  <h3>Local Node</h3>
351
320
  </div>
352
321
 
353
- ${this.localNodeDetected?M`
322
+ ${this.localNodeDetected?L`
354
323
  <div class="state success">
355
324
  ${ut()}
356
325
  <p>Local node detected on port ${this.port}</p>
@@ -359,15 +328,15 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
359
328
  <button class="primary" @click=${this.connectLocalNode}>
360
329
  Connect to Local Node
361
330
  </button>
362
- `:M`
331
+ `:L`
363
332
  <div class="state danger">
364
- ${We()}
333
+ ${Oe()}
365
334
  <p>No local node detected on port ${this.port}</p>
366
335
  </div>
367
336
 
368
337
  <p style="margin-bottom: -12px">Download and install AD4M</p>
369
338
  <button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
370
- ${Pn()} Download AD4M
339
+ ${Dn()} Download AD4M
371
340
  </button>
372
341
  `}
373
342
 
@@ -381,43 +350,43 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
381
350
  @keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
382
351
  />
383
352
  <button class="primary" @click=${this.refreshPort}>
384
- ${Rn()}
353
+ ${Mn()}
385
354
  </button>
386
355
  </div>
387
356
  </div>
388
357
 
389
358
  <div class="box">
390
- <div class="option-header">
391
- ${Ln()}
359
+ <div class="box-header">
360
+ ${er()}
392
361
  <h3>Remote Node</h3>
393
362
  </div>
394
363
 
395
- ${this.remoteUrl?M`
364
+ ${this.remoteUrl?L`
396
365
  <div class="state success">
397
366
  ${ut()}
398
367
  <p>Remote configuration detected</p>
399
368
  </div>
400
- `:M`<p style="margin-bottom: -12px">Enter the URL of a remote AD4M node</p>`}
369
+ `:L`<p style="margin-bottom: -12px">Enter the URL of a remote AD4M node</p>`}
401
370
 
402
371
  <input
403
372
  type="text"
404
373
  placeholder="https://ad4m-node:12000/graphql"
405
374
  .value=${this.newRemoteUrl}
406
375
  @input=${t=>{let r=t.target;this.newRemoteUrl=r.value,this.remoteNodeError&&this.clearRemoteNodeError()}}
407
- @keydown=${t=>{t.key==="Enter"&&this.connectRemoteNode()}}
376
+ @keydown=${t=>{t.key==="Enter"&&!this.connectingToRemoteNode&&this.newRemoteUrl.trim().length&&this.connectRemoteNode()}}
408
377
  style= "font-size: 16px;"
409
378
  />
410
379
 
411
- ${this.remoteNodeError?M`
380
+ ${this.remoteNodeError?L`
412
381
  <div class="state danger">
413
- ${We()}
382
+ ${Oe()}
414
383
  <p>Unable to connect to remote node</p>
415
384
  </div>
416
385
  `:""}
417
386
 
418
387
  <button
419
388
  class="primary"
420
- ?disabled=${this.connectingToRemoteNode}
389
+ ?disabled=${this.connectingToRemoteNode||this.newRemoteUrl.trim().length===0}
421
390
  @click=${this.connectRemoteNode}
422
391
  >
423
392
  ${this.connectingToRemoteNode?"Connecting...":"Connect to Remote Node"}
@@ -425,32 +394,13 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
425
394
  </div>
426
395
  </div>
427
396
  </div>
428
- `}};Re.styles=[Yi,lt`
397
+ `}};De.styles=[Ut,Ge`
429
398
  .options {
430
399
  display: flex;
431
400
  flex-direction: column;
432
401
  gap: 30px;
433
402
  }
434
403
 
435
- .option-header {
436
- display: flex;
437
- align-items: center;
438
- gap: 10px;
439
- margin-bottom: -8px;
440
- }
441
-
442
- .option-header h3 {
443
- font-weight: 600;
444
- }
445
-
446
- .option-header svg {
447
- width: 24px;
448
- height: 24px;
449
- stroke-width: 2;
450
- flex-shrink: 0;
451
- color: var(--ac-primary-color);
452
- }
453
-
454
404
  .port-input {
455
405
  display: flex;
456
406
  justify-content: center;
@@ -473,23 +423,23 @@ var ou=Object.defineProperty;var cu=Object.getOwnPropertyDescriptor;var lu=Objec
473
423
  button {
474
424
  width: 100%;
475
425
  }
476
- `],Q([Se({type:Number})],Re.prototype,"port",2),Q([Se({type:String})],Re.prototype,"remoteUrl",2),Q([Se({type:Boolean})],Re.prototype,"connectingToRemoteNode",2),Q([Se({type:Boolean})],Re.prototype,"remoteNodeError",2),Q([ue()],Re.prototype,"loading",2),Q([ue()],Re.prototype,"localNodeDetected",2),Q([ue()],Re.prototype,"newPort",2),Q([ue()],Re.prototype,"newRemoteUrl",2),Re=Q([Mt("connection-options")],Re);var ma=function(){return ma=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ma.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Jn(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jn=function(t){return typeof t}:Jn=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jn(i)}function Su(i){return Jn(i)=="object"&&i!==null}var al=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Ts(i,e){for(var t=/\r\n|[\n\r]/g,r=1,n=e+1,a;(a=t.exec(i.body))&&a.index<e;)r+=1,n=e+1-(a.index+a[0].length);return{line:r,column:n}}function wu(i){return sl(i.source,Ts(i.source,i.start))}function sl(i,e){var t=i.locationOffset.column-1,r=Yn(t)+i.body,n=e.line-1,a=i.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,l=e.column+o,c="".concat(i.name,":").concat(s,":").concat(l,`
477
- `),u=r.split(/\r\n|[\n\r]/g),g=u[n];if(g.length>120){for(var h=Math.floor(l/80),d=l%80,y=[],_=0;_<g.length;_+=80)y.push(g.slice(_,_+80));return c+Bo([["".concat(s),y[0]]].concat(y.slice(1,h+1).map(function(E){return["",E]}),[[" ",Yn(d-1)+"^"],["",y[h+1]]]))}return c+Bo([["".concat(s-1),u[n-1]],["".concat(s),g],["",Yn(l-1)+"^"],["".concat(s+1),u[n+1]]])}function Bo(i){var e=i.filter(function(r){r[0];var n=r[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(r){var n=r[0];return n.length}));return e.map(function(r){var n=r[0],a=r[1];return Eu(t,n)+(a?" | "+a:" |")}).join(`
478
- `)}function Yn(i){return Array(i+1).join(" ")}function Eu(i,e){return Yn(i-e.length)+e}function Xn(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xn=function(t){return typeof t}:Xn=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Xn(i)}function qo(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,r)}return t}function xu(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?qo(Object(t),!0).forEach(function(r){Au(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):qo(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function Au(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function $u(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function Vo(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function Iu(i,e,t){return e&&Vo(i.prototype,e),t&&Vo(i,t),i}function ku(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&nn(i,e)}function Tu(i){var e=cl();return function(){var r=an(i),n;if(e){var a=an(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return ol(this,n)}}function ol(i,e){return e&&(Xn(e)==="object"||typeof e=="function")?e:Or(i)}function Or(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Cs(i){var e=typeof Map=="function"?new Map:void 0;return Cs=function(r){if(r===null||!Cu(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return ea(r,arguments,an(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),nn(n,r)},Cs(i)}function ea(i,e,t){return cl()?ea=Reflect.construct:ea=function(n,a,s){var o=[null];o.push.apply(o,a);var l=Function.bind.apply(n,o),c=new l;return s&&nn(c,s.prototype),c},ea.apply(null,arguments)}function cl(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Cu(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function nn(i,e){return nn=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},nn(i,e)}function an(i){return an=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},an(i)}var Nu=function(i){ku(t,i);var e=Tu(t);function t(r,n,a,s,o,l,c){var u,g,h,d;$u(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=l??void 0,d.nodes=zo(Array.isArray(n)?n:n?[n]:void 0);for(var y=[],_=0,E=($=d.nodes)!==null&&$!==void 0?$:[];_<E.length;_++){var $,T=E[_],C=T.loc;C!=null&&y.push(C)}y=zo(y),d.source=a??((u=y)===null||u===void 0?void 0:u[0].source),d.positions=s??((g=y)===null||g===void 0?void 0:g.map(function(k){return k.start})),d.locations=s&&a?s.map(function(k){return Ts(a,k)}):(h=y)===null||h===void 0?void 0:h.map(function(k){return Ts(k.source,k.start)}),d.path=o??void 0;var A=l?.extensions;return c==null&&Su(A)?d.extensions=xu({},A):d.extensions=c??{},Object.defineProperties(Or(d),{message:{enumerable:!0},locations:{enumerable:d.locations!=null},path:{enumerable:d.path!=null},extensions:{enumerable:d.extensions!=null&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?(Object.defineProperty(Or(d),"stack",{value:l.stack,writable:!0,configurable:!0}),ol(d)):(Error.captureStackTrace?Error.captureStackTrace(Or(d),t):Object.defineProperty(Or(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return Iu(t,[{key:"toString",value:function(){return Lu(this)}},{key:al,get:function(){return"Object"}}]),t}(Cs(Error));function zo(i){return i===void 0||i.length===0?void 0:i}function Lu(i){var e=i.message;if(i.nodes)for(var t=0,r=i.nodes;t<r.length;t++){var n=r[t];n.loc&&(e+=`
426
+ `],V([de({type:Number})],De.prototype,"port",2),V([de({type:String})],De.prototype,"remoteUrl",2),V([de({type:Boolean})],De.prototype,"connectingToRemoteNode",2),V([de({type:Boolean})],De.prototype,"remoteNodeError",2),V([ue()],De.prototype,"loading",2),V([ue()],De.prototype,"localNodeDetected",2),V([ue()],De.prototype,"newPort",2),V([ue()],De.prototype,"newRemoteUrl",2),De=V([ht("connection-options")],De);var ya=function(){return ya=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++){t=arguments[r];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ya.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Yn(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Yn=function(t){return typeof t}:Yn=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Yn(i)}function wu(i){return Yn(i)=="object"&&i!==null}var sl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Cs(i,e){for(var t=/\r\n|[\n\r]/g,r=1,n=e+1,a;(a=t.exec(i.body))&&a.index<e;)r+=1,n=e+1-(a.index+a[0].length);return{line:r,column:n}}function Eu(i){return ol(i.source,Cs(i.source,i.start))}function ol(i,e){var t=i.locationOffset.column-1,r=Xn(t)+i.body,n=e.line-1,a=i.locationOffset.line-1,s=e.line+a,o=e.line===1?t:0,l=e.column+o,c="".concat(i.name,":").concat(s,":").concat(l,`
427
+ `),u=r.split(/\r\n|[\n\r]/g),g=u[n];if(g.length>120){for(var h=Math.floor(l/80),d=l%80,y=[],_=0;_<g.length;_+=80)y.push(g.slice(_,_+80));return c+qo([["".concat(s),y[0]]].concat(y.slice(1,h+1).map(function(E){return["",E]}),[[" ",Xn(d-1)+"^"],["",y[h+1]]]))}return c+qo([["".concat(s-1),u[n-1]],["".concat(s),g],["",Xn(l-1)+"^"],["".concat(s+1),u[n+1]]])}function qo(i){var e=i.filter(function(r){r[0];var n=r[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(r){var n=r[0];return n.length}));return e.map(function(r){var n=r[0],a=r[1];return xu(t,n)+(a?" | "+a:" |")}).join(`
428
+ `)}function Xn(i){return Array(i+1).join(" ")}function xu(i,e){return Xn(i-e.length)+e}function ea(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ea=function(t){return typeof t}:ea=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ea(i)}function Vo(i,e){var t=Object.keys(i);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(i);e&&(r=r.filter(function(n){return Object.getOwnPropertyDescriptor(i,n).enumerable})),t.push.apply(t,r)}return t}function Au(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Vo(Object(t),!0).forEach(function(r){$u(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Vo(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function $u(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Iu(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function zo(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function ku(i,e,t){return e&&zo(i.prototype,e),t&&zo(i,t),i}function Tu(i,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");i.prototype=Object.create(e&&e.prototype,{constructor:{value:i,writable:!0,configurable:!0}}),e&&on(i,e)}function Cu(i){var e=ll();return function(){var r=cn(i),n;if(e){var a=cn(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return cl(this,n)}}function cl(i,e){return e&&(ea(e)==="object"||typeof e=="function")?e:Ur(i)}function Ur(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Ns(i){var e=typeof Map=="function"?new Map:void 0;return Ns=function(r){if(r===null||!Nu(r))return r;if(typeof r!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(r))return e.get(r);e.set(r,n)}function n(){return ta(r,arguments,cn(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),on(n,r)},Ns(i)}function ta(i,e,t){return ll()?ta=Reflect.construct:ta=function(n,a,s){var o=[null];o.push.apply(o,a);var l=Function.bind.apply(n,o),c=new l;return s&&on(c,s.prototype),c},ta.apply(null,arguments)}function ll(){if(typeof Reflect>"u"||!Reflect.construct||Reflect.construct.sham)return!1;if(typeof Proxy=="function")return!0;try{return Date.prototype.toString.call(Reflect.construct(Date,[],function(){})),!0}catch{return!1}}function Nu(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function on(i,e){return on=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},on(i,e)}function cn(i){return cn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},cn(i)}var Lu=function(i){Tu(t,i);var e=Cu(t);function t(r,n,a,s,o,l,c){var u,g,h,d;Iu(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=l??void 0,d.nodes=Ho(Array.isArray(n)?n:n?[n]:void 0);for(var y=[],_=0,E=($=d.nodes)!==null&&$!==void 0?$:[];_<E.length;_++){var $,T=E[_],C=T.loc;C!=null&&y.push(C)}y=Ho(y),d.source=a??((u=y)===null||u===void 0?void 0:u[0].source),d.positions=s??((g=y)===null||g===void 0?void 0:g.map(function(k){return k.start})),d.locations=s&&a?s.map(function(k){return Cs(a,k)}):(h=y)===null||h===void 0?void 0:h.map(function(k){return Cs(k.source,k.start)}),d.path=o??void 0;var A=l?.extensions;return c==null&&wu(A)?d.extensions=Au({},A):d.extensions=c??{},Object.defineProperties(Ur(d),{message:{enumerable:!0},locations:{enumerable:d.locations!=null},path:{enumerable:d.path!=null},extensions:{enumerable:d.extensions!=null&&Object.keys(d.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),l!=null&&l.stack?(Object.defineProperty(Ur(d),"stack",{value:l.stack,writable:!0,configurable:!0}),cl(d)):(Error.captureStackTrace?Error.captureStackTrace(Ur(d),t):Object.defineProperty(Ur(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return ku(t,[{key:"toString",value:function(){return Pu(this)}},{key:sl,get:function(){return"Object"}}]),t}(Ns(Error));function Ho(i){return i===void 0||i.length===0?void 0:i}function Pu(i){var e=i.message;if(i.nodes)for(var t=0,r=i.nodes;t<r.length;t++){var n=r[t];n.loc&&(e+=`
479
429
 
480
- `+wu(n.loc))}else if(i.source&&i.locations)for(var a=0,s=i.locations;a<s.length;a++){var o=s[a];e+=`
430
+ `+Eu(n.loc))}else if(i.source&&i.locations)for(var a=0,s=i.locations;a<s.length;a++){var o=s[a];e+=`
481
431
 
482
- `+sl(i.source,o)}return e}function Ze(i,e,t){return new Nu("Syntax Error: ".concat(t),void 0,i,[e])}var B=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function Pu(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ru=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Ns=Ru;function ll(i){var e=i.prototype.toJSON;typeof e=="function"||Pu(0),i.prototype.inspect=e,Ns&&(i.prototype[Ns]=e)}var ul=function(){function i(t,r,n){this.start=t.start,this.end=r.end,this.startToken=t,this.endToken=r,this.source=n}var e=i.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},i}();ll(ul);var fe=function(){function i(t,r,n,a,s,o,l){this.kind=t,this.start=r,this.end=n,this.line=a,this.column=s,this.value=l,this.prev=o,this.next=null}var e=i.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},i}();ll(fe);var S=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function ta(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ta=function(t){return typeof t}:ta=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ta(i)}var Ou=10,dl=2;function Du(i){return Fa(i,[])}function Fa(i,e){switch(ta(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":Mu(i,e);default:return String(i)}}function Mu(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=ju(i);if(r!==void 0){var n=r.call(i);if(n!==i)return typeof n=="string"?n:Fa(n,t)}else if(Array.isArray(i))return Fu(i,t);return Uu(i,t)}function Uu(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>dl)return"["+Bu(i)+"]";var r=t.map(function(n){var a=Fa(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function Fu(i,e){if(i.length===0)return"[]";if(e.length>dl)return"[Array]";for(var t=Math.min(Ou,i.length),r=i.length-t,n=[],a=0;a<t;++a)n.push(Fa(i[a],e));return r===1?n.push("... 1 more item"):r>1&&n.push("... ".concat(r," more items")),"["+n.join(", ")+"]"}function ju(i){var e=i[String(Ns)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function Bu(i){var e=Object.prototype.toString.call(i).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof i.constructor=="function"){var t=i.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function us(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var qu=function(e,t){return e instanceof t};function Ho(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function Vu(i,e,t){return e&&Ho(i.prototype,e),t&&Ho(i,t),i}var pl=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||us(0,"Body must be a string. Received: ".concat(Du(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||us(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||us(0,"column in locationOffset is 1-indexed and must be positive.")}return Vu(i,[{key:al,get:function(){return"Source"}}]),i}();function zu(i){return qu(i,pl)}var Hu=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function Ku(i){var e=i.split(/\r\n|[\n\r]/g),t=Qu(i);if(t!==0)for(var r=1;r<e.length;r++)e[r]=e[r].slice(t);for(var n=0;n<e.length&&Ko(e[n]);)++n;for(var a=e.length;a>n&&Ko(e[a-1]);)--a;return e.slice(n,a).join(`
483
- `)}function Ko(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function Qu(i){for(var e,t=!0,r=!0,n=0,a=null,s=0;s<i.length;++s)switch(i.charCodeAt(s)){case 13:i.charCodeAt(s+1)===10&&++s;case 10:t=!1,r=!0,n=0;break;case 9:case 32:++n;break;default:r&&!t&&(a===null||n<a)&&(a=n),r=!1}return(e=a)!==null&&e!==void 0?e:0}var Wu=function(){function i(t){var r=new fe(S.SOF,0,0,0,0,null);this.source=t,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}var e=i.prototype;return e.advance=function(){this.lastToken=this.token;var r=this.token=this.lookahead();return r},e.lookahead=function(){var r=this.token;if(r.kind!==S.EOF)do{var n;r=(n=r.next)!==null&&n!==void 0?n:r.next=Zu(this,r)}while(r.kind===S.COMMENT);return r},i}();function Gu(i){return i===S.BANG||i===S.DOLLAR||i===S.AMP||i===S.PAREN_L||i===S.PAREN_R||i===S.SPREAD||i===S.COLON||i===S.EQUALS||i===S.AT||i===S.BRACKET_L||i===S.BRACKET_R||i===S.BRACE_L||i===S.PIPE||i===S.BRACE_R}function ki(i){return isNaN(i)?S.EOF:i<127?JSON.stringify(String.fromCharCode(i)):'"\\u'.concat(("00"+i.toString(16).toUpperCase()).slice(-4),'"')}function Zu(i,e){for(var t=i.source,r=t.body,n=r.length,a=e.end;a<n;){var s=r.charCodeAt(a),o=i.line,l=1+a-i.lineStart;switch(s){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++i.line,i.lineStart=a;continue;case 13:r.charCodeAt(a+1)===10?a+=2:++a,++i.line,i.lineStart=a;continue;case 33:return new fe(S.BANG,a,a+1,o,l,e);case 35:return Yu(t,a,o,l,e);case 36:return new fe(S.DOLLAR,a,a+1,o,l,e);case 38:return new fe(S.AMP,a,a+1,o,l,e);case 40:return new fe(S.PAREN_L,a,a+1,o,l,e);case 41:return new fe(S.PAREN_R,a,a+1,o,l,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new fe(S.SPREAD,a,a+3,o,l,e);break;case 58:return new fe(S.COLON,a,a+1,o,l,e);case 61:return new fe(S.EQUALS,a,a+1,o,l,e);case 64:return new fe(S.AT,a,a+1,o,l,e);case 91:return new fe(S.BRACKET_L,a,a+1,o,l,e);case 93:return new fe(S.BRACKET_R,a,a+1,o,l,e);case 123:return new fe(S.BRACE_L,a,a+1,o,l,e);case 124:return new fe(S.PIPE,a,a+1,o,l,e);case 125:return new fe(S.BRACE_R,a,a+1,o,l,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?td(t,a,o,l,e,i):ed(t,a,o,l,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Xu(t,a,s,o,l,e);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return rd(t,a,o,l,e)}throw Ze(t,a,Ju(s))}var c=i.line,u=1+a-i.lineStart;return new fe(S.EOF,n,n,c,u,e)}function Ju(i){return i<32&&i!==9&&i!==10&&i!==13?"Cannot contain the invalid character ".concat(ki(i),"."):i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(ki(i),".")}function Yu(i,e,t,r,n){var a=i.body,s,o=e;do s=a.charCodeAt(++o);while(!isNaN(s)&&(s>31||s===9));return new fe(S.COMMENT,e,o,t,r,n,a.slice(e+1,o))}function Xu(i,e,t,r,n,a){var s=i.body,o=t,l=e,c=!1;if(o===45&&(o=s.charCodeAt(++l)),o===48){if(o=s.charCodeAt(++l),o>=48&&o<=57)throw Ze(i,l,"Invalid number, unexpected digit after 0: ".concat(ki(o),"."))}else l=ds(i,l,o),o=s.charCodeAt(l);if(o===46&&(c=!0,o=s.charCodeAt(++l),l=ds(i,l,o),o=s.charCodeAt(l)),(o===69||o===101)&&(c=!0,o=s.charCodeAt(++l),(o===43||o===45)&&(o=s.charCodeAt(++l)),l=ds(i,l,o),o=s.charCodeAt(l)),o===46||nd(o))throw Ze(i,l,"Invalid number, expected digit but got: ".concat(ki(o),"."));return new fe(c?S.FLOAT:S.INT,e,l,r,n,a,s.slice(e,l))}function ds(i,e,t){var r=i.body,n=e,a=t;if(a>=48&&a<=57){do a=r.charCodeAt(++n);while(a>=48&&a<=57);return n}throw Ze(i,n,"Invalid number, expected digit but got: ".concat(ki(a),"."))}function ed(i,e,t,r,n){for(var a=i.body,s=e+1,o=s,l=0,c="";s<a.length&&!isNaN(l=a.charCodeAt(s))&&l!==10&&l!==13;){if(l===34)return c+=a.slice(o,s),new fe(S.STRING,e,s+1,t,r,n,c);if(l<32&&l!==9)throw Ze(i,s,"Invalid character within String: ".concat(ki(l),"."));if(++s,l===92){switch(c+=a.slice(o,s-1),l=a.charCodeAt(s),l){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
484
- `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var u=id(a.charCodeAt(s+1),a.charCodeAt(s+2),a.charCodeAt(s+3),a.charCodeAt(s+4));if(u<0){var g=a.slice(s+1,s+5);throw Ze(i,s,"Invalid character escape sequence: \\u".concat(g,"."))}c+=String.fromCharCode(u),s+=4;break}default:throw Ze(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}++s,o=s}}throw Ze(i,s,"Unterminated string.")}function td(i,e,t,r,n,a){for(var s=i.body,o=e+3,l=o,c=0,u="";o<s.length&&!isNaN(c=s.charCodeAt(o));){if(c===34&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34)return u+=s.slice(l,o),new fe(S.BLOCK_STRING,e,o+3,t,r,n,Ku(u));if(c<32&&c!==9&&c!==10&&c!==13)throw Ze(i,o,"Invalid character within String: ".concat(ki(c),"."));c===10?(++o,++a.line,a.lineStart=o):c===13?(s.charCodeAt(o+1)===10?o+=2:++o,++a.line,a.lineStart=o):c===92&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34&&s.charCodeAt(o+3)===34?(u+=s.slice(l,o)+'"""',o+=4,l=o):++o}throw Ze(i,o,"Unterminated string.")}function id(i,e,t,r){return Un(i)<<12|Un(e)<<8|Un(t)<<4|Un(r)}function Un(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function rd(i,e,t,r,n){for(var a=i.body,s=a.length,o=e+1,l=0;o!==s&&!isNaN(l=a.charCodeAt(o))&&(l===95||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122);)++o;return new fe(S.NAME,e,o,t,r,n,a.slice(e,o))}function nd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function ad(i,e){var t=new sd(i,e);return t.parseDocument()}var sd=function(){function i(t,r){var n=zu(t)?t:new pl(t);this._lexer=new Wu(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken(S.NAME);return{kind:B.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:B.DOCUMENT,definitions:this.many(S.SOF,this.parseDefinition,S.EOF),loc:this.loc(r)}},e.parseDefinition=function(){if(this.peek(S.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(S.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var r=this._lexer.token;if(this.peek(S.BRACE_L))return{kind:B.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(r)};var n=this.parseOperationType(),a;return this.peek(S.NAME)&&(a=this.parseName()),{kind:B.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseOperationType=function(){var r=this.expectToken(S.NAME);switch(r.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(r)},e.parseVariableDefinitions=function(){return this.optionalMany(S.PAREN_L,this.parseVariableDefinition,S.PAREN_R)},e.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:B.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(S.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(S.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(r)}},e.parseVariable=function(){var r=this._lexer.token;return this.expectToken(S.DOLLAR),{kind:B.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:B.SELECTION_SET,selections:this.many(S.BRACE_L,this.parseSelection,S.BRACE_R),loc:this.loc(r)}},e.parseSelection=function(){return this.peek(S.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var r=this._lexer.token,n=this.parseName(),a,s;return this.expectOptionalToken(S.COLON)?(a=n,s=this.parseName()):s=n,{kind:B.FIELD,alias:a,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(S.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},e.parseArguments=function(r){var n=r?this.parseConstArgument:this.parseArgument;return this.optionalMany(S.PAREN_L,n,S.PAREN_R)},e.parseArgument=function(){var r=this._lexer.token,n=this.parseName();return this.expectToken(S.COLON),{kind:B.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:B.ARGUMENT,name:this.parseName(),value:(this.expectToken(S.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},e.parseFragment=function(){var r=this._lexer.token;this.expectToken(S.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(S.NAME)?{kind:B.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:B.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseFragmentDefinition=function(){var r,n=this._lexer.token;return this.expectKeyword("fragment"),((r=this._options)===null||r===void 0?void 0:r.experimentalFragmentVariables)===!0?{kind:B.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:B.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(r){var n=this._lexer.token;switch(n.kind){case S.BRACKET_L:return this.parseList(r);case S.BRACE_L:return this.parseObject(r);case S.INT:return this._lexer.advance(),{kind:B.INT,value:n.value,loc:this.loc(n)};case S.FLOAT:return this._lexer.advance(),{kind:B.FLOAT,value:n.value,loc:this.loc(n)};case S.STRING:case S.BLOCK_STRING:return this.parseStringLiteral();case S.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:B.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:B.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:B.NULL,loc:this.loc(n)};default:return{kind:B.ENUM,value:n.value,loc:this.loc(n)}}case S.DOLLAR:if(!r)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var r=this._lexer.token;return this._lexer.advance(),{kind:B.STRING,value:r.value,block:r.kind===S.BLOCK_STRING,loc:this.loc(r)}},e.parseList=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseValueLiteral(r)};return{kind:B.LIST,values:this.any(S.BRACKET_L,s,S.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseObjectField(r)};return{kind:B.OBJECT,fields:this.any(S.BRACE_L,s,S.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(r){var n=this._lexer.token,a=this.parseName();return this.expectToken(S.COLON),{kind:B.OBJECT_FIELD,name:a,value:this.parseValueLiteral(r),loc:this.loc(n)}},e.parseDirectives=function(r){for(var n=[];this.peek(S.AT);)n.push(this.parseDirective(r));return n},e.parseDirective=function(r){var n=this._lexer.token;return this.expectToken(S.AT),{kind:B.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(r),loc:this.loc(n)}},e.parseTypeReference=function(){var r=this._lexer.token,n;return this.expectOptionalToken(S.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(S.BRACKET_R),n={kind:B.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken(S.BANG)?{kind:B.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:B.NAMED_TYPE,name:this.parseName(),loc:this.loc(r)}},e.parseTypeSystemDefinition=function(){var r=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(r.kind===S.NAME)switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(r)},e.peekDescription=function(){return this.peek(S.STRING)||this.peek(S.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),s=this.many(S.BRACE_L,this.parseOperationTypeDefinition,S.BRACE_R);return{kind:B.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:s,loc:this.loc(r)}},e.parseOperationTypeDefinition=function(){var r=this._lexer.token,n=this.parseOperationType();this.expectToken(S.COLON);var a=this.parseNamedType();return{kind:B.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(r)}},e.parseScalarTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),s=this.parseDirectives(!0);return{kind:B.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),l=this.parseFieldsDefinition();return{kind:B.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,loc:this.loc(r)}},e.parseImplementsInterfaces=function(){var r;if(!this.expectOptionalKeyword("implements"))return[];if(((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(S.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(S.AMP)||this.peek(S.NAME));return n}return this.delimitedMany(S.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek(S.BRACE_L)&&this._lexer.lookahead().kind===S.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(S.BRACE_L,this.parseFieldDefinition,S.BRACE_R)},e.parseFieldDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseArgumentDefs();this.expectToken(S.COLON);var o=this.parseTypeReference(),l=this.parseDirectives(!0);return{kind:B.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:l,loc:this.loc(r)}},e.parseArgumentDefs=function(){return this.optionalMany(S.PAREN_L,this.parseInputValueDef,S.PAREN_R)},e.parseInputValueDef=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(S.COLON);var s=this.parseTypeReference(),o;this.expectOptionalToken(S.EQUALS)&&(o=this.parseValueLiteral(!0));var l=this.parseDirectives(!0);return{kind:B.INPUT_VALUE_DEFINITION,description:n,name:a,type:s,defaultValue:o,directives:l,loc:this.loc(r)}},e.parseInterfaceTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),l=this.parseFieldsDefinition();return{kind:B.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,loc:this.loc(r)}},e.parseUnionTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseUnionMemberTypes();return{kind:B.UNION_TYPE_DEFINITION,description:n,name:a,directives:s,types:o,loc:this.loc(r)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(S.EQUALS)?this.delimitedMany(S.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();return{kind:B.ENUM_TYPE_DEFINITION,description:n,name:a,directives:s,values:o,loc:this.loc(r)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(S.BRACE_L,this.parseEnumValueDefinition,S.BRACE_R)},e.parseEnumValueDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseDirectives(!0);return{kind:B.ENUM_VALUE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseInputObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();return{kind:B.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(S.BRACE_L,this.parseInputValueDef,S.BRACE_R)},e.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===S.NAME)switch(r.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(r)},e.parseSchemaExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(S.BRACE_L,this.parseOperationTypeDefinition,S.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:B.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(r)}},e.parseScalarTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:B.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(r)}},e.parseObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:B.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInterfaceTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:B.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseUnionTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseUnionMemberTypes();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.UNION_TYPE_EXTENSION,name:n,directives:a,types:s,loc:this.loc(r)}},e.parseEnumTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.ENUM_TYPE_EXTENSION,name:n,directives:a,values:s,loc:this.loc(r)}},e.parseInputObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:s,loc:this.loc(r)}},e.parseDirectiveDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(S.AT);var a=this.parseName(),s=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var l=this.parseDirectiveLocations();return{kind:B.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:l,loc:this.loc(r)}},e.parseDirectiveLocations=function(){return this.delimitedMany(S.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var r=this._lexer.token,n=this.parseName();if(Hu[n.value]!==void 0)return n;throw this.unexpected(r)},e.loc=function(r){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new ul(r,this._lexer.lastToken,this._lexer.source)},e.peek=function(r){return this._lexer.token.kind===r},e.expectToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n;throw Ze(this._lexer.source,n.start,"Expected ".concat(fl(r),", found ").concat(ps(n),"."))},e.expectOptionalToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n},e.expectKeyword=function(r){var n=this._lexer.token;if(n.kind===S.NAME&&n.value===r)this._lexer.advance();else throw Ze(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(ps(n),"."))},e.expectOptionalKeyword=function(r){var n=this._lexer.token;return n.kind===S.NAME&&n.value===r?(this._lexer.advance(),!0):!1},e.unexpected=function(r){var n=r??this._lexer.token;return Ze(this._lexer.source,n.start,"Unexpected ".concat(ps(n),"."))},e.any=function(r,n,a){this.expectToken(r);for(var s=[];!this.expectOptionalToken(a);)s.push(n.call(this));return s},e.optionalMany=function(r,n,a){if(this.expectOptionalToken(r)){var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s}return[]},e.many=function(r,n,a){this.expectToken(r);var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s},e.delimitedMany=function(r,n){this.expectOptionalToken(r);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(r));return a},i}();function ps(i){var e=i.value;return fl(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function fl(i){return Gu(i)?'"'.concat(i,'"'):i}var ia=new Map,Ls=new Map,hl=!0,ya=!1;function gl(i){return i.replace(/[\s,]+/g," ").trim()}function od(i){return gl(i.source.body.substring(i.start,i.end))}function cd(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=od(r.loc),s=Ls.get(n);s&&!s.has(a)?hl&&console.warn("Warning: fragment with name "+n+` already exists.
432
+ `+ol(i.source,o)}return e}function Je(i,e,t){return new Lu("Syntax Error: ".concat(t),void 0,i,[e])}var B=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function Ru(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ou=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Ls=Ou;function ul(i){var e=i.prototype.toJSON;typeof e=="function"||Ru(0),i.prototype.inspect=e,Ls&&(i.prototype[Ls]=e)}var dl=function(){function i(t,r,n){this.start=t.start,this.end=r.end,this.startToken=t,this.endToken=r,this.source=n}var e=i.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},i}();ul(dl);var he=function(){function i(t,r,n,a,s,o,l){this.kind=t,this.start=r,this.end=n,this.line=a,this.column=s,this.value=l,this.prev=o,this.next=null}var e=i.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},i}();ul(he);var S=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function ia(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ia=function(t){return typeof t}:ia=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ia(i)}var Du=10,pl=2;function Mu(i){return ja(i,[])}function ja(i,e){switch(ia(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":Uu(i,e);default:return String(i)}}function Uu(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=Bu(i);if(r!==void 0){var n=r.call(i);if(n!==i)return typeof n=="string"?n:ja(n,t)}else if(Array.isArray(i))return ju(i,t);return Fu(i,t)}function Fu(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>pl)return"["+qu(i)+"]";var r=t.map(function(n){var a=ja(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function ju(i,e){if(i.length===0)return"[]";if(e.length>pl)return"[Array]";for(var t=Math.min(Du,i.length),r=i.length-t,n=[],a=0;a<t;++a)n.push(ja(i[a],e));return r===1?n.push("... 1 more item"):r>1&&n.push("... ".concat(r," more items")),"["+n.join(", ")+"]"}function Bu(i){var e=i[String(Ls)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function qu(i){var e=Object.prototype.toString.call(i).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof i.constructor=="function"){var t=i.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ds(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var Vu=function(e,t){return e instanceof t};function Ko(i,e){for(var t=0;t<e.length;t++){var r=e[t];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(i,r.key,r)}}function zu(i,e,t){return e&&Ko(i.prototype,e),t&&Ko(i,t),i}var fl=function(){function i(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ds(0,"Body must be a string. Received: ".concat(Mu(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||ds(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ds(0,"column in locationOffset is 1-indexed and must be positive.")}return zu(i,[{key:sl,get:function(){return"Source"}}]),i}();function Hu(i){return Vu(i,fl)}var Ku=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function Qu(i){var e=i.split(/\r\n|[\n\r]/g),t=Wu(i);if(t!==0)for(var r=1;r<e.length;r++)e[r]=e[r].slice(t);for(var n=0;n<e.length&&Qo(e[n]);)++n;for(var a=e.length;a>n&&Qo(e[a-1]);)--a;return e.slice(n,a).join(`
433
+ `)}function Qo(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function Wu(i){for(var e,t=!0,r=!0,n=0,a=null,s=0;s<i.length;++s)switch(i.charCodeAt(s)){case 13:i.charCodeAt(s+1)===10&&++s;case 10:t=!1,r=!0,n=0;break;case 9:case 32:++n;break;default:r&&!t&&(a===null||n<a)&&(a=n),r=!1}return(e=a)!==null&&e!==void 0?e:0}var Gu=function(){function i(t){var r=new he(S.SOF,0,0,0,0,null);this.source=t,this.lastToken=r,this.token=r,this.line=1,this.lineStart=0}var e=i.prototype;return e.advance=function(){this.lastToken=this.token;var r=this.token=this.lookahead();return r},e.lookahead=function(){var r=this.token;if(r.kind!==S.EOF)do{var n;r=(n=r.next)!==null&&n!==void 0?n:r.next=Ju(this,r)}while(r.kind===S.COMMENT);return r},i}();function Zu(i){return i===S.BANG||i===S.DOLLAR||i===S.AMP||i===S.PAREN_L||i===S.PAREN_R||i===S.SPREAD||i===S.COLON||i===S.EQUALS||i===S.AT||i===S.BRACKET_L||i===S.BRACKET_R||i===S.BRACE_L||i===S.PIPE||i===S.BRACE_R}function Ci(i){return isNaN(i)?S.EOF:i<127?JSON.stringify(String.fromCharCode(i)):'"\\u'.concat(("00"+i.toString(16).toUpperCase()).slice(-4),'"')}function Ju(i,e){for(var t=i.source,r=t.body,n=r.length,a=e.end;a<n;){var s=r.charCodeAt(a),o=i.line,l=1+a-i.lineStart;switch(s){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++i.line,i.lineStart=a;continue;case 13:r.charCodeAt(a+1)===10?a+=2:++a,++i.line,i.lineStart=a;continue;case 33:return new he(S.BANG,a,a+1,o,l,e);case 35:return Xu(t,a,o,l,e);case 36:return new he(S.DOLLAR,a,a+1,o,l,e);case 38:return new he(S.AMP,a,a+1,o,l,e);case 40:return new he(S.PAREN_L,a,a+1,o,l,e);case 41:return new he(S.PAREN_R,a,a+1,o,l,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new he(S.SPREAD,a,a+3,o,l,e);break;case 58:return new he(S.COLON,a,a+1,o,l,e);case 61:return new he(S.EQUALS,a,a+1,o,l,e);case 64:return new he(S.AT,a,a+1,o,l,e);case 91:return new he(S.BRACKET_L,a,a+1,o,l,e);case 93:return new he(S.BRACKET_R,a,a+1,o,l,e);case 123:return new he(S.BRACE_L,a,a+1,o,l,e);case 124:return new he(S.PIPE,a,a+1,o,l,e);case 125:return new he(S.BRACE_R,a,a+1,o,l,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?id(t,a,o,l,e,i):td(t,a,o,l,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return ed(t,a,s,o,l,e);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return nd(t,a,o,l,e)}throw Je(t,a,Yu(s))}var c=i.line,u=1+a-i.lineStart;return new he(S.EOF,n,n,c,u,e)}function Yu(i){return i<32&&i!==9&&i!==10&&i!==13?"Cannot contain the invalid character ".concat(Ci(i),"."):i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Ci(i),".")}function Xu(i,e,t,r,n){var a=i.body,s,o=e;do s=a.charCodeAt(++o);while(!isNaN(s)&&(s>31||s===9));return new he(S.COMMENT,e,o,t,r,n,a.slice(e+1,o))}function ed(i,e,t,r,n,a){var s=i.body,o=t,l=e,c=!1;if(o===45&&(o=s.charCodeAt(++l)),o===48){if(o=s.charCodeAt(++l),o>=48&&o<=57)throw Je(i,l,"Invalid number, unexpected digit after 0: ".concat(Ci(o),"."))}else l=ps(i,l,o),o=s.charCodeAt(l);if(o===46&&(c=!0,o=s.charCodeAt(++l),l=ps(i,l,o),o=s.charCodeAt(l)),(o===69||o===101)&&(c=!0,o=s.charCodeAt(++l),(o===43||o===45)&&(o=s.charCodeAt(++l)),l=ps(i,l,o),o=s.charCodeAt(l)),o===46||ad(o))throw Je(i,l,"Invalid number, expected digit but got: ".concat(Ci(o),"."));return new he(c?S.FLOAT:S.INT,e,l,r,n,a,s.slice(e,l))}function ps(i,e,t){var r=i.body,n=e,a=t;if(a>=48&&a<=57){do a=r.charCodeAt(++n);while(a>=48&&a<=57);return n}throw Je(i,n,"Invalid number, expected digit but got: ".concat(Ci(a),"."))}function td(i,e,t,r,n){for(var a=i.body,s=e+1,o=s,l=0,c="";s<a.length&&!isNaN(l=a.charCodeAt(s))&&l!==10&&l!==13;){if(l===34)return c+=a.slice(o,s),new he(S.STRING,e,s+1,t,r,n,c);if(l<32&&l!==9)throw Je(i,s,"Invalid character within String: ".concat(Ci(l),"."));if(++s,l===92){switch(c+=a.slice(o,s-1),l=a.charCodeAt(s),l){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
434
+ `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var u=rd(a.charCodeAt(s+1),a.charCodeAt(s+2),a.charCodeAt(s+3),a.charCodeAt(s+4));if(u<0){var g=a.slice(s+1,s+5);throw Je(i,s,"Invalid character escape sequence: \\u".concat(g,"."))}c+=String.fromCharCode(u),s+=4;break}default:throw Je(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}++s,o=s}}throw Je(i,s,"Unterminated string.")}function id(i,e,t,r,n,a){for(var s=i.body,o=e+3,l=o,c=0,u="";o<s.length&&!isNaN(c=s.charCodeAt(o));){if(c===34&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34)return u+=s.slice(l,o),new he(S.BLOCK_STRING,e,o+3,t,r,n,Qu(u));if(c<32&&c!==9&&c!==10&&c!==13)throw Je(i,o,"Invalid character within String: ".concat(Ci(c),"."));c===10?(++o,++a.line,a.lineStart=o):c===13?(s.charCodeAt(o+1)===10?o+=2:++o,++a.line,a.lineStart=o):c===92&&s.charCodeAt(o+1)===34&&s.charCodeAt(o+2)===34&&s.charCodeAt(o+3)===34?(u+=s.slice(l,o)+'"""',o+=4,l=o):++o}throw Je(i,o,"Unterminated string.")}function rd(i,e,t,r){return Fn(i)<<12|Fn(e)<<8|Fn(t)<<4|Fn(r)}function Fn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function nd(i,e,t,r,n){for(var a=i.body,s=a.length,o=e+1,l=0;o!==s&&!isNaN(l=a.charCodeAt(o))&&(l===95||l>=48&&l<=57||l>=65&&l<=90||l>=97&&l<=122);)++o;return new he(S.NAME,e,o,t,r,n,a.slice(e,o))}function ad(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function sd(i,e){var t=new od(i,e);return t.parseDocument()}var od=function(){function i(t,r){var n=Hu(t)?t:new fl(t);this._lexer=new Gu(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken(S.NAME);return{kind:B.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:B.DOCUMENT,definitions:this.many(S.SOF,this.parseDefinition,S.EOF),loc:this.loc(r)}},e.parseDefinition=function(){if(this.peek(S.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(S.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var r=this._lexer.token;if(this.peek(S.BRACE_L))return{kind:B.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(r)};var n=this.parseOperationType(),a;return this.peek(S.NAME)&&(a=this.parseName()),{kind:B.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseOperationType=function(){var r=this.expectToken(S.NAME);switch(r.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(r)},e.parseVariableDefinitions=function(){return this.optionalMany(S.PAREN_L,this.parseVariableDefinition,S.PAREN_R)},e.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:B.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(S.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(S.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(r)}},e.parseVariable=function(){var r=this._lexer.token;return this.expectToken(S.DOLLAR),{kind:B.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:B.SELECTION_SET,selections:this.many(S.BRACE_L,this.parseSelection,S.BRACE_R),loc:this.loc(r)}},e.parseSelection=function(){return this.peek(S.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var r=this._lexer.token,n=this.parseName(),a,s;return this.expectOptionalToken(S.COLON)?(a=n,s=this.parseName()):s=n,{kind:B.FIELD,alias:a,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(S.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},e.parseArguments=function(r){var n=r?this.parseConstArgument:this.parseArgument;return this.optionalMany(S.PAREN_L,n,S.PAREN_R)},e.parseArgument=function(){var r=this._lexer.token,n=this.parseName();return this.expectToken(S.COLON),{kind:B.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:B.ARGUMENT,name:this.parseName(),value:(this.expectToken(S.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},e.parseFragment=function(){var r=this._lexer.token;this.expectToken(S.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(S.NAME)?{kind:B.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:B.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(r)}},e.parseFragmentDefinition=function(){var r,n=this._lexer.token;return this.expectKeyword("fragment"),((r=this._options)===null||r===void 0?void 0:r.experimentalFragmentVariables)===!0?{kind:B.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:B.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(r){var n=this._lexer.token;switch(n.kind){case S.BRACKET_L:return this.parseList(r);case S.BRACE_L:return this.parseObject(r);case S.INT:return this._lexer.advance(),{kind:B.INT,value:n.value,loc:this.loc(n)};case S.FLOAT:return this._lexer.advance(),{kind:B.FLOAT,value:n.value,loc:this.loc(n)};case S.STRING:case S.BLOCK_STRING:return this.parseStringLiteral();case S.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:B.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:B.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:B.NULL,loc:this.loc(n)};default:return{kind:B.ENUM,value:n.value,loc:this.loc(n)}}case S.DOLLAR:if(!r)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var r=this._lexer.token;return this._lexer.advance(),{kind:B.STRING,value:r.value,block:r.kind===S.BLOCK_STRING,loc:this.loc(r)}},e.parseList=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseValueLiteral(r)};return{kind:B.LIST,values:this.any(S.BRACKET_L,s,S.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(r){var n=this,a=this._lexer.token,s=function(){return n.parseObjectField(r)};return{kind:B.OBJECT,fields:this.any(S.BRACE_L,s,S.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(r){var n=this._lexer.token,a=this.parseName();return this.expectToken(S.COLON),{kind:B.OBJECT_FIELD,name:a,value:this.parseValueLiteral(r),loc:this.loc(n)}},e.parseDirectives=function(r){for(var n=[];this.peek(S.AT);)n.push(this.parseDirective(r));return n},e.parseDirective=function(r){var n=this._lexer.token;return this.expectToken(S.AT),{kind:B.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(r),loc:this.loc(n)}},e.parseTypeReference=function(){var r=this._lexer.token,n;return this.expectOptionalToken(S.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(S.BRACKET_R),n={kind:B.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken(S.BANG)?{kind:B.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:B.NAMED_TYPE,name:this.parseName(),loc:this.loc(r)}},e.parseTypeSystemDefinition=function(){var r=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(r.kind===S.NAME)switch(r.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(r)},e.peekDescription=function(){return this.peek(S.STRING)||this.peek(S.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),s=this.many(S.BRACE_L,this.parseOperationTypeDefinition,S.BRACE_R);return{kind:B.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:s,loc:this.loc(r)}},e.parseOperationTypeDefinition=function(){var r=this._lexer.token,n=this.parseOperationType();this.expectToken(S.COLON);var a=this.parseNamedType();return{kind:B.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(r)}},e.parseScalarTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),s=this.parseDirectives(!0);return{kind:B.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),l=this.parseFieldsDefinition();return{kind:B.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,loc:this.loc(r)}},e.parseImplementsInterfaces=function(){var r;if(!this.expectOptionalKeyword("implements"))return[];if(((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(S.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(S.AMP)||this.peek(S.NAME));return n}return this.delimitedMany(S.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek(S.BRACE_L)&&this._lexer.lookahead().kind===S.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(S.BRACE_L,this.parseFieldDefinition,S.BRACE_R)},e.parseFieldDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseArgumentDefs();this.expectToken(S.COLON);var o=this.parseTypeReference(),l=this.parseDirectives(!0);return{kind:B.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:l,loc:this.loc(r)}},e.parseArgumentDefs=function(){return this.optionalMany(S.PAREN_L,this.parseInputValueDef,S.PAREN_R)},e.parseInputValueDef=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(S.COLON);var s=this.parseTypeReference(),o;this.expectOptionalToken(S.EQUALS)&&(o=this.parseValueLiteral(!0));var l=this.parseDirectives(!0);return{kind:B.INPUT_VALUE_DEFINITION,description:n,name:a,type:s,defaultValue:o,directives:l,loc:this.loc(r)}},e.parseInterfaceTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),s=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),l=this.parseFieldsDefinition();return{kind:B.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:s,directives:o,fields:l,loc:this.loc(r)}},e.parseUnionTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseUnionMemberTypes();return{kind:B.UNION_TYPE_DEFINITION,description:n,name:a,directives:s,types:o,loc:this.loc(r)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(S.EQUALS)?this.delimitedMany(S.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();return{kind:B.ENUM_TYPE_DEFINITION,description:n,name:a,directives:s,values:o,loc:this.loc(r)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(S.BRACE_L,this.parseEnumValueDefinition,S.BRACE_R)},e.parseEnumValueDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseDirectives(!0);return{kind:B.ENUM_VALUE_DEFINITION,description:n,name:a,directives:s,loc:this.loc(r)}},e.parseInputObjectTypeDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),s=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();return{kind:B.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(S.BRACE_L,this.parseInputValueDef,S.BRACE_R)},e.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===S.NAME)switch(r.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(r)},e.parseSchemaExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(S.BRACE_L,this.parseOperationTypeDefinition,S.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:B.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(r)}},e.parseScalarTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:B.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(r)}},e.parseObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:B.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInterfaceTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),o=this.parseFieldsDefinition();if(a.length===0&&s.length===0&&o.length===0)throw this.unexpected();return{kind:B.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:s,fields:o,loc:this.loc(r)}},e.parseUnionTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseUnionMemberTypes();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.UNION_TYPE_EXTENSION,name:n,directives:a,types:s,loc:this.loc(r)}},e.parseEnumTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.ENUM_TYPE_EXTENSION,name:n,directives:a,values:s,loc:this.loc(r)}},e.parseInputObjectTypeExtension=function(){var r=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();if(a.length===0&&s.length===0)throw this.unexpected();return{kind:B.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:s,loc:this.loc(r)}},e.parseDirectiveDefinition=function(){var r=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(S.AT);var a=this.parseName(),s=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var l=this.parseDirectiveLocations();return{kind:B.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:l,loc:this.loc(r)}},e.parseDirectiveLocations=function(){return this.delimitedMany(S.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var r=this._lexer.token,n=this.parseName();if(Ku[n.value]!==void 0)return n;throw this.unexpected(r)},e.loc=function(r){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new dl(r,this._lexer.lastToken,this._lexer.source)},e.peek=function(r){return this._lexer.token.kind===r},e.expectToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n;throw Je(this._lexer.source,n.start,"Expected ".concat(hl(r),", found ").concat(fs(n),"."))},e.expectOptionalToken=function(r){var n=this._lexer.token;if(n.kind===r)return this._lexer.advance(),n},e.expectKeyword=function(r){var n=this._lexer.token;if(n.kind===S.NAME&&n.value===r)this._lexer.advance();else throw Je(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(fs(n),"."))},e.expectOptionalKeyword=function(r){var n=this._lexer.token;return n.kind===S.NAME&&n.value===r?(this._lexer.advance(),!0):!1},e.unexpected=function(r){var n=r??this._lexer.token;return Je(this._lexer.source,n.start,"Unexpected ".concat(fs(n),"."))},e.any=function(r,n,a){this.expectToken(r);for(var s=[];!this.expectOptionalToken(a);)s.push(n.call(this));return s},e.optionalMany=function(r,n,a){if(this.expectOptionalToken(r)){var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s}return[]},e.many=function(r,n,a){this.expectToken(r);var s=[];do s.push(n.call(this));while(!this.expectOptionalToken(a));return s},e.delimitedMany=function(r,n){this.expectOptionalToken(r);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(r));return a},i}();function fs(i){var e=i.value;return hl(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function hl(i){return Zu(i)?'"'.concat(i,'"'):i}var ra=new Map,Ps=new Map,gl=!0,va=!1;function ml(i){return i.replace(/[\s,]+/g," ").trim()}function cd(i){return ml(i.source.body.substring(i.start,i.end))}function ld(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=cd(r.loc),s=Ps.get(n);s&&!s.has(a)?gl&&console.warn("Warning: fragment with name "+n+` already exists.
485
435
  graphql-tag enforces all fragment names across your application to be unique; read more about
486
- this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Ls.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),ma(ma({},i),{definitions:t})}function ld(i){var e=new Set(i.definitions);e.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(n){var a=r[n];a&&typeof a=="object"&&e.add(a)})});var t=i.loc;return t&&(delete t.startToken,delete t.endToken),i}function ud(i){var e=gl(i);if(!ia.has(e)){var t=ad(i,{experimentalFragmentVariables:ya,allowLegacyFragmentVariables:ya});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");ia.set(e,ld(cd(t)))}return ia.get(e)}function m(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof i=="string"&&(i=[i]);var r=i[0];return e.forEach(function(n,a){n&&n.kind==="Document"?r+=n.loc.source.body:r+=n,r+=i[a+1]}),ud(r)}function dd(){ia.clear(),Ls.clear()}function pd(){hl=!1}function fd(){ya=!0}function hd(){ya=!1}var Nr={gql:m,resetCaches:dd,disableFragmentWarnings:pd,enableExperimentalFragmentVariables:fd,disableExperimentalFragmentVariables:hd};(function(i){i.gql=Nr.gql,i.resetCaches=Nr.resetCaches,i.disableFragmentWarnings=Nr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=Nr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=Nr.disableExperimentalFragmentVariables})(m||(m={}));m.default=m;function v(i){if(!i)throw"Got no result from Apollo";if(i.error)throw i.error;if(i.errors)throw i.errors;return i.data}function gd(){}function ri(){return gd}var z=ri,p=ri,Ae=ri,re=ri,q=ri,et=ri,md=ri,io=ri,ml=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},yl=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ti=class{constructor(e){this.code=e}};ml([p(),yl("design:type",String)],Ti.prototype,"code",void 0);Ti=ml([q(),yl("design:paramtypes",[String])],Ti);var ro=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},no=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},_t=class{constructor(e,t){this.address=e,this.name=t}};ro([p(),no("design:type",String)],_t.prototype,"address",void 0);ro([p(),no("design:type",String)],_t.prototype,"name",void 0);_t=ro([q(),no("design:paramtypes",[String,String])],_t);var le=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ve=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Rt=class{constructor(e,t){this.key=t,this.signature=e}};le([p(),ve("design:type",String)],Rt.prototype,"signature",void 0);le([p(),ve("design:type",String)],Rt.prototype,"key",void 0);le([p(),ve("design:type",Boolean)],Rt.prototype,"valid",void 0);le([p(),ve("design:type",Boolean)],Rt.prototype,"invalid",void 0);Rt=le([q(),Ae(),ve("design:paramtypes",[String,String])],Rt);var Ci=class{};le([p(),ve("design:type",String)],Ci.prototype,"signature",void 0);le([p(),ve("design:type",String)],Ci.prototype,"key",void 0);le([p(),ve("design:type",Boolean)],Ci.prototype,"valid",void 0);le([p(),ve("design:type",Boolean)],Ci.prototype,"invalid",void 0);Ci=le([Ae()],Ci);function ni(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return le([p(),ve("design:type",String)],e.prototype,"author",void 0),le([p(),ve("design:type",String)],e.prototype,"timestamp",void 0),le([p(),ve("design:type",Object)],e.prototype,"data",void 0),le([p(),ve("design:type",Rt)],e.prototype,"proof",void 0),e=le([q(),ve("design:paramtypes",[String,String,Object,Rt])],e),e}function yd(i){let e=class{};return le([p(),ve("design:type",String)],e.prototype,"author",void 0),le([p(),ve("design:type",String)],e.prototype,"timestamp",void 0),le([p(),ve("design:type",Object)],e.prototype,"data",void 0),le([p(),ve("design:type",Ci)],e.prototype,"proof",void 0),e=le([Ae()],e),e}var Qo=class extends ni(){};Qo=le([q()],Qo);var va=class extends ni(){};le([p(),ve("design:type",_t)],va.prototype,"language",void 0);le([p(),ve("design:type",Ti)],va.prototype,"icon",void 0);va=le([q()],va);function jm(i){return i&&i.author&&i.timestamp&&i.data}var ge=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ne=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ni=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};ge([p(),Ne("design:type",String)],Ni.prototype,"source",void 0);ge([p(),Ne("design:type",String)],Ni.prototype,"target",void 0);ge([p(),Ne("design:type",String)],Ni.prototype,"predicate",void 0);Ni=ge([q(),Ne("design:paramtypes",[Object])],Ni);var ba=class{};ge([p(),Ne("design:type",Array)],ba.prototype,"additions",void 0);ge([p(),Ne("design:type",Array)],ba.prototype,"removals",void 0);ba=ge([Ae()],ba);var _a=class{constructor(e,t){this.additions=e,this.removals=t}};ge([p(),Ne("design:type",Array)],_a.prototype,"additions",void 0);ge([p(),Ne("design:type",Array)],_a.prototype,"removals",void 0);_a=ge([q(),Ne("design:paramtypes",[Array,Array])],_a);var sn=class{};ge([p(),Ne("design:type",String)],sn.prototype,"source",void 0);ge([p(),Ne("design:type",String)],sn.prototype,"target",void 0);ge([p(),Ne("design:type",String)],sn.prototype,"predicate",void 0);sn=ge([Ae()],sn);var Jt=class extends ni(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,r,n;for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t}};ge([p(),Ne("design:type",String)],Jt.prototype,"status",void 0);Jt=ge([q()],Jt);var Ps=class extends yd(){};ge([p(),Ne("design:type",String)],Ps.prototype,"status",void 0);Ps=ge([Ae()],Ps);function Qm(i,e){return i.author==e.author&&i.timestamp==e.timestamp&&i.data.source==e.data.source&&i.data.predicate==e.data.predicate&&i.data.target==e.data.target}function Wm(i){return i&&i.source&&i.target}var Sa=class{constructor(e,t){this.oldLink=e,this.newLink=t}};ge([p(),Ne("design:type",Jt)],Sa.prototype,"oldLink",void 0);ge([p(),Ne("design:type",Jt)],Sa.prototype,"newLink",void 0);Sa=ge([q(),Ne("design:paramtypes",[Jt,Jt])],Sa);var ji=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},vn=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Rs,Et=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let r=JSON.parse(JSON.stringify(this.links));return e.target&&(r=r.filter(n=>n.data.target===e.target)),e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}if(e.target){let r=JSON.parse(JSON.stringify(this.links));return e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(r=>r.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};ji([p(),vn("design:type",Array)],Et.prototype,"links",void 0);Et=ji([q(),vn("design:paramtypes",[Array])],Et);var wa=class{};ji([p(),vn("design:type",Array)],wa.prototype,"links",void 0);wa=ji([Ae()],wa);var Os=Rs=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Rs;return t.links.push(e),t}};ji([p(),vn("design:type",Array)],Os.prototype,"links",void 0);Os=Rs=ji([Ae(),vn("design:paramtypes",[Array])],Os);var Li=class extends ni(){};Li=ji([q()],Li);var N=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},L=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Kt=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new Et}};N([p(),L("design:type",String)],Kt.prototype,"did",void 0);N([p(),L("design:type",Et)],Kt.prototype,"perspective",void 0);N([p(),L("design:type",String)],Kt.prototype,"directMessageLanguage",void 0);Kt=N([q(),L("design:paramtypes",[String,Et])],Kt);var Wo=class extends ni(){};Wo=N([q()],Wo);var Yt=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};N([p(),L("design:type",String)],Yt.prototype,"did",void 0);N([p(),L("design:type",String)],Yt.prototype,"didSigningKeyId",void 0);N([p(),L("design:type",String)],Yt.prototype,"deviceKeyType",void 0);N([p(),L("design:type",String)],Yt.prototype,"deviceKey",void 0);N([p(),L("design:type",String)],Yt.prototype,"deviceKeySignedByDid",void 0);N([p(),L("design:type",String)],Yt.prototype,"didSignedByDeviceKey",void 0);Yt=N([q(),L("design:paramtypes",[String,String,String,String,String,String])],Yt);var Xt=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};N([p(),L("design:type",String)],Xt.prototype,"did",void 0);N([p(),L("design:type",String)],Xt.prototype,"didSigningKeyId",void 0);N([p(),L("design:type",String)],Xt.prototype,"deviceKeyType",void 0);N([p(),L("design:type",String)],Xt.prototype,"deviceKey",void 0);N([p(),L("design:type",String)],Xt.prototype,"deviceKeySignedByDid",void 0);N([p(),L("design:type",String)],Xt.prototype,"didSignedByDeviceKey",void 0);Xt=N([Ae(),L("design:paramtypes",[String,String,String,String,String,String])],Xt);var Ea=class{constructor(e,t){this.signature=e,this.publicKey=t}};N([p(),L("design:type",String)],Ea.prototype,"signature",void 0);N([p(),L("design:type",String)],Ea.prototype,"publicKey",void 0);Ea=N([q(),L("design:paramtypes",[String,String])],Ea);var dr=class{constructor(e,t){this.domain=e,this.pointers=t}};N([p(),L("design:type",String)],dr.prototype,"domain",void 0);N([p(),L("design:type",Array)],dr.prototype,"pointers",void 0);dr=N([q(),L("design:paramtypes",[String,Array])],dr);var xa=class{constructor(e,t){this.with=e,this.can=t}};N([p(),L("design:type",dr)],xa.prototype,"with",void 0);N([p(),L("design:type",Array)],xa.prototype,"can",void 0);xa=N([q(),L("design:paramtypes",[dr,Array])],xa);var Ot=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};N([p(),L("design:type",String)],Ot.prototype,"appName",void 0);N([p(),L("design:type",String)],Ot.prototype,"appDesc",void 0);N([p(),L("design:type",String)],Ot.prototype,"appUrl",void 0);N([p(),L("design:type",String)],Ot.prototype,"appIconPath",void 0);N([p(),L("design:type",Array)],Ot.prototype,"capabilities",void 0);Ot=N([q(),L("design:paramtypes",[String,String,String,Array,String])],Ot);var pr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};N([p(),L("design:type",String)],pr.prototype,"requestId",void 0);N([p(),L("design:type",String)],pr.prototype,"token",void 0);N([p(),L("design:type",Boolean)],pr.prototype,"revoked",void 0);N([p(),L("design:type",Ot)],pr.prototype,"auth",void 0);pr=N([q(),L("design:paramtypes",[String,Ot,String,Boolean])],pr);var fr=class{constructor(e,t){this.domain=e,this.pointers=t}};N([p(),L("design:type",String)],fr.prototype,"domain",void 0);N([p(),L("design:type",Array)],fr.prototype,"pointers",void 0);fr=N([Ae(),L("design:paramtypes",[String,Array])],fr);var Aa=class{constructor(e,t){this.with=e,this.can=t}};N([p(),L("design:type",fr)],Aa.prototype,"with",void 0);N([p(),L("design:type",Array)],Aa.prototype,"can",void 0);Aa=N([Ae(),L("design:paramtypes",[fr,Array])],Aa);var xt=class{constructor(e,t,r,n,a,s){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=r,this.capabilities=s,this.appIconPath=a}};N([p(),L("design:type",String)],xt.prototype,"appName",void 0);N([p(),L("design:type",String)],xt.prototype,"appDesc",void 0);N([p(),L("design:type",String)],xt.prototype,"appDomain",void 0);N([p(),L("design:type",String)],xt.prototype,"appUrl",void 0);N([p(),L("design:type",String)],xt.prototype,"appIconPath",void 0);N([p(),L("design:type",Array)],xt.prototype,"capabilities",void 0);xt=N([Ae(),L("design:paramtypes",[String,String,String,String,String,Array])],xt);var Pi=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};N([p(),L("design:type",String)],Pi.prototype,"did",void 0);N([p(),L("design:type",Boolean)],Pi.prototype,"success",void 0);N([p(),L("design:type",String)],Pi.prototype,"error",void 0);Pi=N([q(),L("design:paramtypes",[String,Boolean,String])],Pi);var _r=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Sr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},at=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};_r([p(),Sr("design:type",Boolean)],at.prototype,"isInitialized",void 0);_r([p(),Sr("design:type",Boolean)],at.prototype,"isUnlocked",void 0);_r([p(),Sr("design:type",String)],at.prototype,"did",void 0);_r([p(),Sr("design:type",String)],at.prototype,"didDocument",void 0);_r([p(),Sr("design:type",String)],at.prototype,"error",void 0);at=_r([q(),Sr("design:paramtypes",[Object])],at);var Go=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},de=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Ve,ze,Ds=class{constructor(e,t){Ve.set(this,void 0),ze.set(this,void 0),Go(this,Ve,e,"f"),Go(this,ze,t,"f")}async otherAgents(){return await de(this,Ve,"f").otherAgents(de(this,ze,"f"))}async hasTelepresenceAdapter(){return await de(this,Ve,"f").hasTelepresenceAdapter(de(this,ze,"f"))}async onlineAgents(){return await de(this,Ve,"f").onlineAgents(de(this,ze,"f"))}async setOnlineStatus(e){return await de(this,Ve,"f").setOnlineStatus(de(this,ze,"f"),e)}async setOnlineStatusU(e){return await de(this,Ve,"f").setOnlineStatusU(de(this,ze,"f"),e)}async sendSignal(e,t){return await de(this,Ve,"f").sendSignal(de(this,ze,"f"),e,t)}async sendSignalU(e,t){return await de(this,Ve,"f").sendSignalU(de(this,ze,"f"),e,t)}async sendBroadcast(e,t=!1){return await de(this,Ve,"f").sendBroadcast(de(this,ze,"f"),e,t)}async sendBroadcastU(e,t=!1){return await de(this,Ve,"f").sendBroadcastU(de(this,ze,"f"),e,t)}async addSignalHandler(e){await de(this,Ve,"f").addSignalHandler(de(this,ze,"f"),e)}removeSignalHandler(e){de(this,Ve,"f").removeSignalHandler(de(this,ze,"f"),e)}};Ve=new WeakMap,ze=new WeakMap;var Bi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},qi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Te=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};Bi([p(),qi("design:type",String)],Te.prototype,"source",void 0);Bi([p(),qi("design:type",String)],Te.prototype,"target",void 0);Bi([p(),qi("design:type",String)],Te.prototype,"predicate",void 0);Bi([p(),qi("design:type",Date)],Te.prototype,"fromDate",void 0);Bi([p(),qi("design:type",Date)],Te.prototype,"untilDate",void 0);Bi([p(),qi("design:type",Number)],Te.prototype,"limit",void 0);Te=Bi([q(),Ae(),qi("design:paramtypes",[Object])],Te);var Zo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ie=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},He,Tt;function Fn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Ce=class{constructor(){He.set(this,void 0),Tt.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let t=new Ce;return Zo(t,Tt,e,"f"),t}static from(e){let t=new Ce;return Zo(t,He,e,"f"),t}toUrl(){if(Ie(this,Tt,"f")&&!Ie(this,He,"f"))return Ie(this,Tt,"f");if(!Ie(this,Tt,"f")&&(Ie(this,He,"f")===void 0||Ie(this,He,"f")===""||Ie(this,He,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ie(this,He,"f")){case"string":e=`string:${Fn(Ie(this,He,"f"))}`;break;case"number":e=`number:${Fn(Ie(this,He,"f"))}`;break;case"boolean":e=`boolean:${Fn(Ie(this,He,"f"))}`;break;case"object":e=`json:${Fn(JSON.stringify(Ie(this,He,"f")))}`;break}return`literal://${e}`}get(){if(Ie(this,He,"f"))return Ie(this,He,"f");if(!Ie(this,Tt,"f"))throw new Error("Can't render empty Literal");if(!Ie(this,Tt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ie(this,Tt,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};He=new WeakMap,Tt=new WeakMap;function Qt(i){return i.charAt(0).toUpperCase()+i.slice(1)}function ao(i){return`set${Qt(i)}`}function cr(i){return i.endsWith("y")?i.slice(0,-1)+"ies":i+"s"}function so(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function vd(i){return`add${Qt(so(i))}`}function bd(i){let e=i.substring(3),t=cr(e);return t.charAt(0).toLowerCase()+t.slice(1)}function _d(i){return`remove${Qt(so(i))}`}function Sd(i){let e=i.substring(6),t=cr(e);return t.charAt(0).toLowerCase()+t.slice(1)}function wd(i){let e=i.substring(13),t=cr(e);return t.charAt(0).toLowerCase()+t.slice(1)}function Ed(i){return`setCollection${Qt(so(i))}`}function fi(i){if(Array.isArray(i))return`[${i.map(fi).join(", ")}]`;let e=Object.keys(i),t=[];for(let r of e){let n=JSON.stringify(i[r]),a=`${r}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var fs=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},K=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},De,Me,pe,lr=class{constructor(i,e,t){De.set(this,void 0),Me.set(this,void 0),pe.set(this,void 0),fs(this,De,e,"f"),fs(this,Me,t,"f"),fs(this,pe,i,"f")}get baseExpression(){return K(this,De,"f")}async init(){let isInstance=await K(this,pe,"f").isSubjectInstance(K(this,De,"f"),K(this,Me,"f"));if(!isInstance)throw`Not a valid subject instance of ${K(this,Me,"f")} for ${K(this,De,"f")}`;let results=await K(this,pe,"f").infer(`subject_class("${K(this,Me,"f")}", C), property(C, Property)`),properties=results.map(i=>i.Property);for(let i of properties)await K(this,pe,"f").infer(`subject_class("${K(this,Me,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,pe,"f").getPropertyValueViaSurreal(K(this,De,"f"),K(this,Me,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await K(this,pe,"f").infer(`subject_class("${K(this,Me,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await K(this,pe,"f").infer(`subject_class("${K(this,Me,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[ao(property)]=async i=>{resolveLanguage&&(i=await K(this,pe,"f").createExpression(i,resolveLanguage)),await K(this,pe,"f").executeAction(actions,K(this,De,"f"),[{name:"value",value:i}])}}let results2=await K(this,pe,"f").infer(`subject_class("${K(this,Me,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(i=>i.Collection);for(let i of collections)Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,pe,"f").getCollectionValuesViaSurreal(K(this,De,"f"),K(this,Me,"f"),i)}catch(e){return console.warn(`Failed to get collection ${i} via SurrealDB:`,e),[]}}});let adders=await K(this,pe,"f").infer(`subject_class("${K(this,Me,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[vd(collection)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,pe,"f").executeAction(actions,K(this,De,"f"),[{name:"value",value:e}]))):await K(this,pe,"f").executeAction(actions,K(this,De,"f"),[{name:"value",value:i}])}}let removers=await K(this,pe,"f").infer(`subject_class("${K(this,Me,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[_d(collection)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,pe,"f").executeAction(actions,K(this,De,"f"),[{name:"value",value:e}]))):await K(this,pe,"f").executeAction(actions,K(this,De,"f"),[{name:"value",value:i}])}}let collectionSetters=await K(this,pe,"f").infer(`subject_class("${K(this,Me,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[Ed(collection)]=async i=>{Array.isArray(i)?await K(this,pe,"f").executeAction(actions,K(this,De,"f"),i.map(e=>({name:"value",value:e}))):await K(this,pe,"f").executeAction(actions,K(this,De,"f"),[{name:"value",value:i}])}}}};De=new WeakMap,Me=new WeakMap,pe=new WeakMap;function Jo(i){return i?.length?i.length===1?i.toString():i.length===2?i.join(" and "):i.slice(0,-1).join(", ")+", and "+i.slice(-1):""}function vl(i){let e=i.can.includes("*")?["READ","WRITE","UPDATE"]:i.can,t=i.with.domain==="*"?"":i.with.domain,r=i.with.pointers.includes("*")?["all AD4M data"]:i.with.pointers;return`${Jo(e)} your ${t} actions, with access to ${Jo(r)}`}function oe(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var ie=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},b=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},ra,Ct,gt,mt,wi,Bt,qt,hi,Dr,na,gi,mi,rt,ar,Ms,Y,ee,yi,vi,bi,Mr,$a=class{constructor(e,t,r){ra.add(this),Ct.set(this,void 0),gt.set(this,void 0),mt.set(this,void 0),wi.set(this,void 0),Bt.set(this,void 0),qt.set(this,void 0),hi.set(this,void 0),Dr.set(this,!1),na.set(this,void 0),gi.set(this,void 0),mi.set(this,void 0),rt.set(this,void 0),ar.set(this,void 0),this.isSurrealDB=!1,ie(this,Ct,e,"f"),ie(this,ar,t,"f"),ie(this,mt,r,"f"),ie(this,wi,new Set,"f"),ie(this,hi,null,"f"),ie(this,na,new Promise((n,a)=>{ie(this,gi,n,"f"),ie(this,mi,a,"f")}),"f")}async subscribe(){b(this,qt,"f")&&(b(this,qt,"f").call(this),ie(this,qt,void 0,"f")),b(this,rt,"f")&&(clearTimeout(b(this,rt,"f")),ie(this,rt,void 0,"f")),b(this,Bt,"f")&&(clearTimeout(b(this,Bt,"f")),ie(this,Bt,void 0,"f"));try{let t;this.isSurrealDB?t=await b(this,mt,"f").perspectiveSubscribeSurrealQuery(b(this,Ct,"f"),b(this,ar,"f")):t=await b(this,mt,"f").subscribeQuery(b(this,Ct,"f"),b(this,ar,"f")),ie(this,gt,t.subscriptionId,"f"),t.result?(ie(this,hi,t.result,"f"),b(this,ra,"m",Ms).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ie(this,rt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(r=>{console.error("Error during subscription retry after timeout:",r)})},3e4),"f"),ie(this,qt,b(this,mt,"f").subscribeToQueryUpdates(b(this,gt,"f"),r=>{b(this,rt,"f")&&(clearTimeout(b(this,rt,"f")),ie(this,rt,void 0,"f")),b(this,gi,"f")&&(b(this,gi,"f").call(this,!0),ie(this,gi,void 0,"f"),ie(this,mi,void 0,"f")),!(r.isInit&&b(this,hi,"f"))&&(ie(this,hi,r,"f"),b(this,ra,"m",Ms).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),b(this,mi,"f")&&(b(this,mi,"f").call(this,t),ie(this,gi,void 0,"f"),ie(this,mi,void 0,"f")),t}let e=async()=>{if(!b(this,Dr,"f")){try{this.isSurrealDB?await b(this,mt,"f").perspectiveKeepAliveSurrealQuery(b(this,Ct,"f"),b(this,gt,"f")):await b(this,mt,"f").keepAliveQuery(b(this,Ct,"f"),b(this,gt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",b(this,ar,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}b(this,Dr,"f")||ie(this,Bt,setTimeout(e,3e4),"f")}};ie(this,Bt,setTimeout(e,3e4),"f")}get id(){return b(this,gt,"f")}get initialized(){return b(this,na,"f")}get result(){return b(this,hi,"f")}onResult(e){return b(this,wi,"f").add(e),()=>b(this,wi,"f").delete(e)}dispose(){ie(this,Dr,!0,"f"),clearTimeout(b(this,Bt,"f")),b(this,qt,"f")&&b(this,qt,"f").call(this),b(this,wi,"f").clear(),b(this,rt,"f")&&(clearTimeout(b(this,rt,"f")),ie(this,rt,void 0,"f")),b(this,gt,"f")&&(this.isSurrealDB?b(this,mt,"f").perspectiveDisposeSurrealQuerySubscription(b(this,Ct,"f"),b(this,gt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):b(this,mt,"f").disposeQuerySubscription(b(this,Ct,"f"),b(this,gt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Ct=new WeakMap,gt=new WeakMap,mt=new WeakMap,wi=new WeakMap,Bt=new WeakMap,qt=new WeakMap,hi=new WeakMap,Dr=new WeakMap,na=new WeakMap,gi=new WeakMap,mi=new WeakMap,rt=new WeakMap,ar=new WeakMap,ra=new WeakSet,Ms=function i(e){for(let t of b(this,wi,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var or=class{constructor(i,e){Y.set(this,void 0),ee.set(this,void 0),yi.set(this,void 0),vi.set(this,void 0),bi.set(this,void 0),Mr.set(this,void 0),ie(this,yi,[],"f"),ie(this,vi,[],"f"),ie(this,bi,[],"f"),ie(this,Mr,[],"f"),ie(this,Y,i,"f"),ie(this,ee,e,"f"),this.uuid=b(this,Y,"f").uuid,this.name=b(this,Y,"f").name,this.owners=b(this,Y,"f").owners,this.sharedUrl=b(this,Y,"f").sharedUrl,this.neighbourhood=b(this,Y,"f").neighbourhood,this.state=b(this,Y,"f").state,b(this,ee,"f").addPerspectiveLinkAddedListener(b(this,Y,"f").uuid,b(this,yi,"f")),b(this,ee,"f").addPerspectiveLinkRemovedListener(b(this,Y,"f").uuid,b(this,vi,"f")),b(this,ee,"f").addPerspectiveLinkUpdatedListener(b(this,Y,"f").uuid,b(this,bi,"f")),b(this,ee,"f").addPerspectiveSyncStateChangeListener(b(this,Y,"f").uuid,b(this,Mr,"f"))}escapeRegExp(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(i,e,t,r){return await b(this,ee,"f").executeCommands(b(this,Y,"f").uuid,JSON.stringify(i),e,JSON.stringify(t),r)}async get(i){return await b(this,ee,"f").queryLinks(b(this,Y,"f").uuid,i)}async infer(i){return await b(this,ee,"f").queryProlog(b(this,Y,"f").uuid,i)}async querySurrealDB(i){return await b(this,ee,"f").querySurrealDB(b(this,Y,"f").uuid,i)}async add(i,e="shared",t){return await b(this,ee,"f").addLink(b(this,Y,"f").uuid,i,e,t)}async addLinks(i,e="shared",t){return await b(this,ee,"f").addLinks(b(this,Y,"f").uuid,i,e,t)}async removeLinks(i,e){return await b(this,ee,"f").removeLinks(b(this,Y,"f").uuid,i,e)}async linkMutations(i,e="shared"){return await b(this,ee,"f").linkMutations(b(this,Y,"f").uuid,i,e)}async addLinkExpression(i,e="shared",t){return await b(this,ee,"f").addLinkExpression(b(this,Y,"f").uuid,i,e,t)}async update(i,e,t){return await b(this,ee,"f").updateLink(b(this,Y,"f").uuid,i,e,t)}async remove(i,e){return await b(this,ee,"f").removeLink(b(this,Y,"f").uuid,i,e)}async createBatch(){return await b(this,ee,"f").createBatch(b(this,Y,"f").uuid)}async commitBatch(i){return await b(this,ee,"f").commitBatch(b(this,Y,"f").uuid,i)}async getExpression(i){return await b(this,ee,"f").getExpression(i)}async createExpression(i,e){return await b(this,ee,"f").createExpression(i,e)}async addListener(i,e){i==="link-added"?b(this,yi,"f").push(e):i==="link-removed"?b(this,vi,"f").push(e):i==="link-updated"&&b(this,bi,"f").push(e)}async addSyncStateChangeListener(i){b(this,Mr,"f").push(i)}async removeListener(i,e){if(i==="link-added"){let t=b(this,yi,"f").indexOf(e);b(this,yi,"f").splice(t,1)}else if(i==="link-removed"){let t=b(this,vi,"f").indexOf(e);b(this,vi,"f").splice(t,1)}else if(i==="link-updated"){let t=b(this,bi,"f").indexOf(e);b(this,bi,"f").splice(t,1)}}async snapshot(){return b(this,ee,"f").snapshotByUUID(b(this,Y,"f").uuid)}async loadSnapshot(i){let e=JSON.parse(JSON.stringify(i));delete e.__typename,e.links.forEach(t=>{delete t.data.__typename});for(let t of e.links)await this.addLinkExpression(t)}async getSingleTarget(i){delete i.target;let e=await this.get(i);return e.length?e[0].data.target:null}async setSingleTarget(i,e="shared"){let t=new Te({source:i.source,predicate:i.predicate}),r=await this.get(t),n=[];for(let s of r)delete s.__typename,delete s.data.__typename,delete s.proof.__typename,n.push(s);let a=[i];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(i){return(await this.infer(`flowable("${i}", F), register_sdna_flow(X, F)`)).map(t=>t.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(i,e){return(await this.infer(`register_sdna_flow("${i}", F), flow_state(X, ${e}, F)`)).map(r=>r.X)}async flowState(i,e){return(await this.infer(`register_sdna_flow("${i}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(i,e){return(await this.infer(`register_sdna_flow("${i}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(r=>r.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let i=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let t of i){let r=await this.get(new Te({source:"ad4m://self",predicate:t}));for(let n of r){let a=n.data.target,s=await this.get(new Te({source:a,predicate:"ad4m://sdna"}));for(let o of s){let l=Ce.fromUrl(o.data.target).get();typeof l=="string"&&e.push(l)}}}return e}async getSdnaForClass(i){let e=Ce.from(i);if((await this.get(new Te({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let r=await this.get(new Te({source:e.toUrl(),predicate:"ad4m://sdna"}));if(r.length===0)return null;let n=Ce.fromUrl(r[0].data.target).get();return typeof n=="string"?n:null}async addSdna(i,e,t){return b(this,ee,"f").addSdna(b(this,Y,"f").uuid,i,e,t)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(i=>i.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(i){if(typeof i=="string")return i;{let e=await this.subjectClassesByTemplate(i);return e[0]?e[0]:i.className}}async createSubject(i,e,t,r){let n;if(typeof i=="string")n=i,await b(this,ee,"f").createSubject(b(this,Y,"f").uuid,JSON.stringify({className:n,initialValues:t}),e,t?JSON.stringify(t):void 0,r);else{let a=this.buildQueryFromTemplate(i);await b(this,ee,"f").createSubject(b(this,Y,"f").uuid,JSON.stringify({query:a,initialValues:t}),e,t?JSON.stringify(t):void 0,r)}return r?e:this.getSubjectProxy(e,i)}async getSubjectData(i,e){if(typeof i=="string")return JSON.parse(await b(this,ee,"f").getSubjectData(b(this,Y,"f").uuid,JSON.stringify({className:i}),e));let t=this.buildQueryFromTemplate(i);return JSON.parse(await b(this,ee,"f").getSubjectData(b(this,Y,"f").uuid,JSON.stringify({query:t}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(i,e){let t=await this.stringOrTemplateObjectToSubjectClassName(e),r=await this.getSubjectClassMetadataFromSDNA(t);if(!r)try{let n=t.replace(/"/g,'\\"'),a=i.replace(/"/g,'\\"'),s=await this.infer(`subject_class("${n}", C), instance(C, "${a}")`);return s&&s.length>0}catch(n){return console.warn(`Failed to check instance via Prolog for class ${t}:`,n),!1}if(r.requiredTriples.length===0){let a=`SELECT count() AS count FROM link WHERE in.uri = '${oe(i)}'`,o=(await this.querySurrealDB(a))[0]?.count??0;return(typeof o=="object"&&o?.Int!==void 0?o.Int:o)>0}for(let n of r.requiredTriples){let a=oe(i),s=oe(n.predicate),o;if(n.target){let g=oe(n.target);o=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${s}' AND out.uri = '${g}'`}else o=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${s}'`;let l=await this.querySurrealDB(o);if(!l||l.length===0)return!1;let c=l[0]?.count??0;if((typeof c=="object"&&c?.Int!==void 0?c.Int:c)===0)return!1}return!0}async getSubjectProxy(i,e){if(!await this.isSubjectInstance(i,e))throw`Expression ${i} is not a subject instance of given class: ${JSON.stringify(e)}`;let t=await this.stringOrTemplateObjectToSubjectClassName(e),r=new lr(this,i,t);return await r.init(),r}async getSubjectClassMetadataFromSDNA(i){try{let e=await this.get(new Te({source:Ce.from(i).toUrl(),predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${i}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${i} has no target:`,e[0]),null;let t=Ce.fromUrl(e[0].data.target).get(),r=[],n=/instance\([^)]+\)\s*:-\s*([^.]+)\./g,a,s=!1;for(;(a=n.exec(t))!==null;){s=!0;let h=a[1],d=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,y;for(;(y=d.exec(h))!==null;){let _=y[1],E=y[2];r.push({predicate:_,target:E})}}s||console.warn(`No instance rule found in SDNA for ${i}`);let o=r.map(h=>h.predicate),l=new Map,c=await this.infer(`subject_class("${i}", C), property(C, P)`);if(c)for(let h of c){let d=h.P,y=null,_=await this.infer(`subject_class("${i}", C), property_setter(C, "${d}", Setter)`);if(_&&_.length>0){let $=_[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);$&&(y=$[1]||$[2])}if(!y){let E=this.escapeRegExp(d),$=t.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${E}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));$&&(y=$[1])}if(y){let E=await this.infer(`subject_class("${i}", C), property_resolve_language(C, "${d}", Lang)`),$=E&&E.length>0?E[0].Lang:void 0;l.set(d,{predicate:y,resolveLanguage:$})}}let u=new Map,g=await this.infer(`subject_class("${i}", C), collection(C, Coll)`);if(g)for(let h of g){let d=h.Coll,y=null,_,E=await this.infer(`subject_class("${i}", C), collection_adder(C, "${d}", Adder)`);if(E&&E.length>0){let k=E[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);k&&(y=k[1]||k[2])}let $=this.escapeRegExp(d),T=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${$}"[^)]*\\)\\s*:-[^.]+\\.`),C=t.match(T);if(C){let A=C[0],k=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,J=A.match(k);if(J){let I=J[1];if(I.startsWith("(")&&I.endsWith(")")&&(I=I.substring(1,I.length-1)),!y){let O=I.match(/triple\([^,]+,\s*"([^"]+)"/);O&&(y=O[1])}let R=I.match(/subject_class\("([^"]+)"/);R&&(_=R[1])}}y&&u.set(d,{predicate:y,instanceFilter:_})}return{requiredPredicates:o,requiredTriples:r,properties:l,collections:u}}catch(e){return console.error(`Error getting metadata for ${i}:`,e),null}}generateSurrealInstanceQuery(i){return i.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${i.requiredTriples.map(t=>{let r=oe(t.predicate);if(t.target){let n=oe(t.target);return`count(->link[WHERE predicate = '${r}' AND out.uri = '${n}']) > 0`}else return`count(->link[WHERE predicate = '${r}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(i,e,t){let r=await this.getSubjectClassMetadataFromSDNA(e);if(!r)return;let n=r.properties.get(t);if(!n)return;let a=oe(i),s=oe(n.predicate),o=`SELECT out.uri AS value FROM link WHERE in.uri = '${a}' AND predicate = '${s}' LIMIT 1`,l=await this.querySurrealDB(o);if(!l||l.length===0)return;let c=l[0].value;if(n.resolveLanguage&&c)try{let u=await this.getExpression(c);try{return JSON.parse(u.data)}catch{return u.data}}catch{return c}return c}async getCollectionValuesViaSurreal(i,e,t){let r=await this.getSubjectClassMetadataFromSDNA(e);if(!r)return[];let n=r.collections.get(t);if(!n)return[];let a=oe(i),s=oe(n.predicate),o=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${a}' AND predicate = '${s}' ORDER BY timestamp ASC`,l=await this.querySurrealDB(o);if(!l||l.length===0)return[];let c=l.map(u=>u.value).filter(u=>u!==""&&u!=="");if(n.instanceFilter)try{let u=await this.getSubjectClassMetadataFromSDNA(n.instanceFilter);return u?await this.batchCheckSubjectInstances(c,u):this.filterInstancesSequential(c,n.instanceFilter)}catch{return this.filterInstancesSequential(c,n.instanceFilter)}return c}async batchCheckSubjectInstances(i,e){if(i.length===0)return[];if(e.requiredTriples.length===0){let a=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${i.map(o=>`'${oe(o)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(a)).map(o=>o.uri)}let t=[];for(let n of e.requiredTriples){let a=i.map(c=>`'${oe(c)}'`).join(", "),s=oe(n.predicate),o;if(n.target){let c=oe(n.target);o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${s}' AND out.uri = '${c}' GROUP BY in.uri`}else o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${s}' GROUP BY in.uri`;let l=await this.querySurrealDB(o);t.push(new Set(l.map(c=>c.uri)))}return t.length===0?i:i.filter(n=>t.every(a=>a.has(n)))}async filterInstancesSequential(i,e){let t=[];for(let r of i)try{await this.isSubjectInstance(r,e)&&t.push(r)}catch{continue}return t}async getAllSubjectInstances(i){let e=[];typeof i=="string"?e=[i]:e=await this.subjectClassesByTemplate(i);let t=[];for(let r of e){let n=await this.getSubjectClassMetadataFromSDNA(r);if(n){let a=this.generateSurrealInstanceQuery(n),s=await this.querySurrealDB(a);for(let o of s||[])try{let l=new lr(this,o.base,r);await l.init(),t.push(l)}catch{}}}return t}async getAllSubjectProxies(i){let e=[];typeof i=="string"?e=[i]:e=await this.subjectClassesByTemplate(i);let t=[];for(let r of e){let n=await this.getSubjectClassMetadataFromSDNA(r);if(n){let a=this.generateSurrealInstanceQuery(n),s=await this.querySurrealDB(a);for(let o of s||[])try{let l=new lr(this,o.base,r);await l.init(),t.push(l)}catch{}}}return t}buildQueryFromTemplate(i){let e;return function(t){let r=[],n=[];Object.getPrototypeOf(t).__properties?Object.keys(Object.getPrototypeOf(t).__properties).forEach(u=>r.push(u)):r.push(...Object.keys(t).filter(u=>!Array.isArray(t[u]))),Object.getPrototypeOf(t).__collections?Object.keys(Object.getPrototypeOf(t).__collections).filter(u=>u!=="isSubjectInstance").forEach(u=>{n.includes(u)||n.push(u)}):n.push(...Object.keys(t).filter(u=>Array.isArray(t[u])).filter(u=>u!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(t).filter(u=>typeof t[u]=="function"&&u.startsWith("set")&&!u.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let g=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return g&&typeof g.value=="function"&&u.startsWith("set")&&!u.startsWith("setCollection")}));let s=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("add"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let g=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return g&&typeof g.value=="function"&&u.startsWith("add")}));let o=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("remove"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let g=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return g&&typeof g.value=="function"&&u.startsWith("remove")}));let l=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("setCollection"));l=l.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let g=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return g&&typeof g.value=="function"&&u.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let u of r)c+=`, property(C, "${u}")`;for(let u of n)c+=`, collection(C, "${u}")`;for(let u of a){let g=u.substring(3);g=g.charAt(0).toLowerCase()+g.slice(1),c+=`, property_setter(C, "${g}", _)`}for(let u of s)c+=`, collection_adder(C, "${bd(u)}", _)`;for(let u of o)c+=`, collection_remover(C, "${Sd(u)}", _)`;for(let u of l)c+=`, collection_setter(C, "${wd(u)}", _)`;c+=".",e=c}(i),e}async subjectClassesByTemplate(i){let e=this.buildQueryFromTemplate(i),t=await this.infer(e);return t?t.map(r=>r.Class):[]}async ensureSDNASubjectClass(i){if((await this.subjectClassesByTemplate(new i)).length>0)return;let{name:t,sdna:r}=i.generateSDNA();await this.addSdna(t,r,"subject_class")}getNeighbourhoodProxy(){return b(this,ee,"f").getNeighbourhoodProxy(b(this,Y,"f").uuid)}get ai(){return b(this,ee,"f").aiClient}async subscribeInfer(i){let e=new $a(this.uuid,i,b(this,ee,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(i){let e=new $a(this.uuid,i,b(this,ee,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};Y=new WeakMap,ee=new WeakMap,yi=new WeakMap,vi=new WeakMap,bi=new WeakMap,Mr=new WeakMap;var Ut=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},F=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},W,Ur,Fr,jr,aa,Br,sa,oa,Oe=`
436
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Ps.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),ya(ya({},i),{definitions:t})}function ud(i){var e=new Set(i.definitions);e.forEach(function(r){r.loc&&delete r.loc,Object.keys(r).forEach(function(n){var a=r[n];a&&typeof a=="object"&&e.add(a)})});var t=i.loc;return t&&(delete t.startToken,delete t.endToken),i}function dd(i){var e=ml(i);if(!ra.has(e)){var t=sd(i,{experimentalFragmentVariables:va,allowLegacyFragmentVariables:va});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");ra.set(e,ud(ld(t)))}return ra.get(e)}function m(i){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof i=="string"&&(i=[i]);var r=i[0];return e.forEach(function(n,a){n&&n.kind==="Document"?r+=n.loc.source.body:r+=n,r+=i[a+1]}),dd(r)}function pd(){ra.clear(),Ps.clear()}function fd(){gl=!1}function hd(){va=!0}function gd(){va=!1}var Rr={gql:m,resetCaches:pd,disableFragmentWarnings:fd,enableExperimentalFragmentVariables:hd,disableExperimentalFragmentVariables:gd};(function(i){i.gql=Rr.gql,i.resetCaches=Rr.resetCaches,i.disableFragmentWarnings=Rr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=Rr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=Rr.disableExperimentalFragmentVariables})(m||(m={}));m.default=m;function v(i){if(!i)throw"Got no result from Apollo";if(i.error)throw i.error;if(i.errors)throw i.errors;return i.data}function md(){}function ni(){return md}var H=ni,p=ni,$e=ni,re=ni,q=ni,tt=ni,yd=ni,ro=ni,yl=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},vl=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ni=class{constructor(e){this.code=e}};yl([p(),vl("design:type",String)],Ni.prototype,"code",void 0);Ni=yl([q(),vl("design:paramtypes",[String])],Ni);var no=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ao=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},St=class{constructor(e,t){this.address=e,this.name=t}};no([p(),ao("design:type",String)],St.prototype,"address",void 0);no([p(),ao("design:type",String)],St.prototype,"name",void 0);St=no([q(),ao("design:paramtypes",[String,String])],St);var le=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},be=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ot=class{constructor(e,t){this.key=t,this.signature=e}};le([p(),be("design:type",String)],Ot.prototype,"signature",void 0);le([p(),be("design:type",String)],Ot.prototype,"key",void 0);le([p(),be("design:type",Boolean)],Ot.prototype,"valid",void 0);le([p(),be("design:type",Boolean)],Ot.prototype,"invalid",void 0);Ot=le([q(),$e(),be("design:paramtypes",[String,String])],Ot);var Li=class{};le([p(),be("design:type",String)],Li.prototype,"signature",void 0);le([p(),be("design:type",String)],Li.prototype,"key",void 0);le([p(),be("design:type",Boolean)],Li.prototype,"valid",void 0);le([p(),be("design:type",Boolean)],Li.prototype,"invalid",void 0);Li=le([$e()],Li);function ai(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return le([p(),be("design:type",String)],e.prototype,"author",void 0),le([p(),be("design:type",String)],e.prototype,"timestamp",void 0),le([p(),be("design:type",Object)],e.prototype,"data",void 0),le([p(),be("design:type",Ot)],e.prototype,"proof",void 0),e=le([q(),be("design:paramtypes",[String,String,Object,Ot])],e),e}function vd(i){let e=class{};return le([p(),be("design:type",String)],e.prototype,"author",void 0),le([p(),be("design:type",String)],e.prototype,"timestamp",void 0),le([p(),be("design:type",Object)],e.prototype,"data",void 0),le([p(),be("design:type",Li)],e.prototype,"proof",void 0),e=le([$e()],e),e}var Wo=class extends ai(){};Wo=le([q()],Wo);var ba=class extends ai(){};le([p(),be("design:type",St)],ba.prototype,"language",void 0);le([p(),be("design:type",Ni)],ba.prototype,"icon",void 0);ba=le([q()],ba);function Bm(i){return i&&i.author&&i.timestamp&&i.data}var me=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ne=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Pi=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};me([p(),Ne("design:type",String)],Pi.prototype,"source",void 0);me([p(),Ne("design:type",String)],Pi.prototype,"target",void 0);me([p(),Ne("design:type",String)],Pi.prototype,"predicate",void 0);Pi=me([q(),Ne("design:paramtypes",[Object])],Pi);var _a=class{};me([p(),Ne("design:type",Array)],_a.prototype,"additions",void 0);me([p(),Ne("design:type",Array)],_a.prototype,"removals",void 0);_a=me([$e()],_a);var Sa=class{constructor(e,t){this.additions=e,this.removals=t}};me([p(),Ne("design:type",Array)],Sa.prototype,"additions",void 0);me([p(),Ne("design:type",Array)],Sa.prototype,"removals",void 0);Sa=me([q(),Ne("design:paramtypes",[Array,Array])],Sa);var ln=class{};me([p(),Ne("design:type",String)],ln.prototype,"source",void 0);me([p(),Ne("design:type",String)],ln.prototype,"target",void 0);me([p(),Ne("design:type",String)],ln.prototype,"predicate",void 0);ln=me([$e()],ln);var Yt=class extends ai(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,r,n;for(r=0;r<e.length;r++)n=e.charCodeAt(r),t=(t<<5)-t+n,t|=0;return t}};me([p(),Ne("design:type",String)],Yt.prototype,"status",void 0);Yt=me([q()],Yt);var Rs=class extends vd(){};me([p(),Ne("design:type",String)],Rs.prototype,"status",void 0);Rs=me([$e()],Rs);function Wm(i,e){return i.author==e.author&&i.timestamp==e.timestamp&&i.data.source==e.data.source&&i.data.predicate==e.data.predicate&&i.data.target==e.data.target}function Gm(i){return i&&i.source&&i.target}var wa=class{constructor(e,t){this.oldLink=e,this.newLink=t}};me([p(),Ne("design:type",Yt)],wa.prototype,"oldLink",void 0);me([p(),Ne("design:type",Yt)],wa.prototype,"newLink",void 0);wa=me([q(),Ne("design:paramtypes",[Yt,Yt])],wa);var qi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Sn=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Os,xt=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let r=JSON.parse(JSON.stringify(this.links));return e.target&&(r=r.filter(n=>n.data.target===e.target)),e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}if(e.target){let r=JSON.parse(JSON.stringify(this.links));return e.predicate&&(r=r.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(r=r.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(r=r.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(r=r.slice(0,e.limit)),r}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(r=>r.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};qi([p(),Sn("design:type",Array)],xt.prototype,"links",void 0);xt=qi([q(),Sn("design:paramtypes",[Array])],xt);var Ea=class{};qi([p(),Sn("design:type",Array)],Ea.prototype,"links",void 0);Ea=qi([$e()],Ea);var Ds=Os=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Os;return t.links.push(e),t}};qi([p(),Sn("design:type",Array)],Ds.prototype,"links",void 0);Ds=Os=qi([$e(),Sn("design:paramtypes",[Array])],Ds);var Ri=class extends ai(){};Ri=qi([q()],Ri);var N=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},P=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Qt=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new xt}};N([p(),P("design:type",String)],Qt.prototype,"did",void 0);N([p(),P("design:type",xt)],Qt.prototype,"perspective",void 0);N([p(),P("design:type",String)],Qt.prototype,"directMessageLanguage",void 0);Qt=N([q(),P("design:paramtypes",[String,xt])],Qt);var Go=class extends ai(){};Go=N([q()],Go);var Xt=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};N([p(),P("design:type",String)],Xt.prototype,"did",void 0);N([p(),P("design:type",String)],Xt.prototype,"didSigningKeyId",void 0);N([p(),P("design:type",String)],Xt.prototype,"deviceKeyType",void 0);N([p(),P("design:type",String)],Xt.prototype,"deviceKey",void 0);N([p(),P("design:type",String)],Xt.prototype,"deviceKeySignedByDid",void 0);N([p(),P("design:type",String)],Xt.prototype,"didSignedByDeviceKey",void 0);Xt=N([q(),P("design:paramtypes",[String,String,String,String,String,String])],Xt);var ei=class{constructor(e,t,r,n,a,s){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=r,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=s}};N([p(),P("design:type",String)],ei.prototype,"did",void 0);N([p(),P("design:type",String)],ei.prototype,"didSigningKeyId",void 0);N([p(),P("design:type",String)],ei.prototype,"deviceKeyType",void 0);N([p(),P("design:type",String)],ei.prototype,"deviceKey",void 0);N([p(),P("design:type",String)],ei.prototype,"deviceKeySignedByDid",void 0);N([p(),P("design:type",String)],ei.prototype,"didSignedByDeviceKey",void 0);ei=N([$e(),P("design:paramtypes",[String,String,String,String,String,String])],ei);var xa=class{constructor(e,t){this.signature=e,this.publicKey=t}};N([p(),P("design:type",String)],xa.prototype,"signature",void 0);N([p(),P("design:type",String)],xa.prototype,"publicKey",void 0);xa=N([q(),P("design:paramtypes",[String,String])],xa);var hr=class{constructor(e,t){this.domain=e,this.pointers=t}};N([p(),P("design:type",String)],hr.prototype,"domain",void 0);N([p(),P("design:type",Array)],hr.prototype,"pointers",void 0);hr=N([q(),P("design:paramtypes",[String,Array])],hr);var Aa=class{constructor(e,t){this.with=e,this.can=t}};N([p(),P("design:type",hr)],Aa.prototype,"with",void 0);N([p(),P("design:type",Array)],Aa.prototype,"can",void 0);Aa=N([q(),P("design:paramtypes",[hr,Array])],Aa);var Dt=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};N([p(),P("design:type",String)],Dt.prototype,"appName",void 0);N([p(),P("design:type",String)],Dt.prototype,"appDesc",void 0);N([p(),P("design:type",String)],Dt.prototype,"appUrl",void 0);N([p(),P("design:type",String)],Dt.prototype,"appIconPath",void 0);N([p(),P("design:type",Array)],Dt.prototype,"capabilities",void 0);Dt=N([q(),P("design:paramtypes",[String,String,String,Array,String])],Dt);var gr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};N([p(),P("design:type",String)],gr.prototype,"requestId",void 0);N([p(),P("design:type",String)],gr.prototype,"token",void 0);N([p(),P("design:type",Boolean)],gr.prototype,"revoked",void 0);N([p(),P("design:type",Dt)],gr.prototype,"auth",void 0);gr=N([q(),P("design:paramtypes",[String,Dt,String,Boolean])],gr);var mr=class{constructor(e,t){this.domain=e,this.pointers=t}};N([p(),P("design:type",String)],mr.prototype,"domain",void 0);N([p(),P("design:type",Array)],mr.prototype,"pointers",void 0);mr=N([$e(),P("design:paramtypes",[String,Array])],mr);var $a=class{constructor(e,t){this.with=e,this.can=t}};N([p(),P("design:type",mr)],$a.prototype,"with",void 0);N([p(),P("design:type",Array)],$a.prototype,"can",void 0);$a=N([$e(),P("design:paramtypes",[mr,Array])],$a);var At=class{constructor(e,t,r,n,a,s){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=r,this.capabilities=s,this.appIconPath=a}};N([p(),P("design:type",String)],At.prototype,"appName",void 0);N([p(),P("design:type",String)],At.prototype,"appDesc",void 0);N([p(),P("design:type",String)],At.prototype,"appDomain",void 0);N([p(),P("design:type",String)],At.prototype,"appUrl",void 0);N([p(),P("design:type",String)],At.prototype,"appIconPath",void 0);N([p(),P("design:type",Array)],At.prototype,"capabilities",void 0);At=N([$e(),P("design:paramtypes",[String,String,String,String,String,Array])],At);var Oi=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};N([p(),P("design:type",String)],Oi.prototype,"did",void 0);N([p(),P("design:type",Boolean)],Oi.prototype,"success",void 0);N([p(),P("design:type",String)],Oi.prototype,"error",void 0);Oi=N([q(),P("design:paramtypes",[String,Boolean,String])],Oi);var Er=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},xr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},st=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Er([p(),xr("design:type",Boolean)],st.prototype,"isInitialized",void 0);Er([p(),xr("design:type",Boolean)],st.prototype,"isUnlocked",void 0);Er([p(),xr("design:type",String)],st.prototype,"did",void 0);Er([p(),xr("design:type",String)],st.prototype,"didDocument",void 0);Er([p(),xr("design:type",String)],st.prototype,"error",void 0);st=Er([q(),xr("design:paramtypes",[Object])],st);var Zo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},pe=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},ze,He,Ms=class{constructor(e,t){ze.set(this,void 0),He.set(this,void 0),Zo(this,ze,e,"f"),Zo(this,He,t,"f")}async otherAgents(){return await pe(this,ze,"f").otherAgents(pe(this,He,"f"))}async hasTelepresenceAdapter(){return await pe(this,ze,"f").hasTelepresenceAdapter(pe(this,He,"f"))}async onlineAgents(){return await pe(this,ze,"f").onlineAgents(pe(this,He,"f"))}async setOnlineStatus(e){return await pe(this,ze,"f").setOnlineStatus(pe(this,He,"f"),e)}async setOnlineStatusU(e){return await pe(this,ze,"f").setOnlineStatusU(pe(this,He,"f"),e)}async sendSignal(e,t){return await pe(this,ze,"f").sendSignal(pe(this,He,"f"),e,t)}async sendSignalU(e,t){return await pe(this,ze,"f").sendSignalU(pe(this,He,"f"),e,t)}async sendBroadcast(e,t=!1){return await pe(this,ze,"f").sendBroadcast(pe(this,He,"f"),e,t)}async sendBroadcastU(e,t=!1){return await pe(this,ze,"f").sendBroadcastU(pe(this,He,"f"),e,t)}async addSignalHandler(e){await pe(this,ze,"f").addSignalHandler(pe(this,He,"f"),e)}removeSignalHandler(e){pe(this,ze,"f").removeSignalHandler(pe(this,He,"f"),e)}};ze=new WeakMap,He=new WeakMap;var Vi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},zi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Te=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};Vi([p(),zi("design:type",String)],Te.prototype,"source",void 0);Vi([p(),zi("design:type",String)],Te.prototype,"target",void 0);Vi([p(),zi("design:type",String)],Te.prototype,"predicate",void 0);Vi([p(),zi("design:type",Date)],Te.prototype,"fromDate",void 0);Vi([p(),zi("design:type",Date)],Te.prototype,"untilDate",void 0);Vi([p(),zi("design:type",Number)],Te.prototype,"limit",void 0);Te=Vi([q(),$e(),zi("design:paramtypes",[Object])],Te);var Jo=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ie=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Ke,Ct;function jn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Ce=class{constructor(){Ke.set(this,void 0),Ct.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let t=new Ce;return Jo(t,Ct,e,"f"),t}static from(e){let t=new Ce;return Jo(t,Ke,e,"f"),t}toUrl(){if(Ie(this,Ct,"f")&&!Ie(this,Ke,"f"))return Ie(this,Ct,"f");if(!Ie(this,Ct,"f")&&(Ie(this,Ke,"f")===void 0||Ie(this,Ke,"f")===""||Ie(this,Ke,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ie(this,Ke,"f")){case"string":e=`string:${jn(Ie(this,Ke,"f"))}`;break;case"number":e=`number:${jn(Ie(this,Ke,"f"))}`;break;case"boolean":e=`boolean:${jn(Ie(this,Ke,"f"))}`;break;case"object":e=`json:${jn(JSON.stringify(Ie(this,Ke,"f")))}`;break}return`literal://${e}`}get(){if(Ie(this,Ke,"f"))return Ie(this,Ke,"f");if(!Ie(this,Ct,"f"))throw new Error("Can't render empty Literal");if(!Ie(this,Ct,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ie(this,Ct,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};Ke=new WeakMap,Ct=new WeakMap;function Wt(i){return i.charAt(0).toUpperCase()+i.slice(1)}function so(i){return`set${Wt(i)}`}function dr(i){return i.endsWith("y")?i.slice(0,-1)+"ies":i+"s"}function oo(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function bd(i){return`add${Wt(oo(i))}`}function _d(i){let e=i.substring(3),t=dr(e);return t.charAt(0).toLowerCase()+t.slice(1)}function Sd(i){return`remove${Wt(oo(i))}`}function wd(i){let e=i.substring(6),t=dr(e);return t.charAt(0).toLowerCase()+t.slice(1)}function Ed(i){let e=i.substring(13),t=dr(e);return t.charAt(0).toLowerCase()+t.slice(1)}function xd(i){return`setCollection${Wt(oo(i))}`}function gi(i){if(Array.isArray(i))return`[${i.map(gi).join(", ")}]`;let e=Object.keys(i),t=[];for(let r of e){let n=JSON.stringify(i[r]),a=`${r}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var hs=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Q=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Ue,Fe,fe,pr=class{constructor(i,e,t){Ue.set(this,void 0),Fe.set(this,void 0),fe.set(this,void 0),hs(this,Ue,e,"f"),hs(this,Fe,t,"f"),hs(this,fe,i,"f")}get baseExpression(){return Q(this,Ue,"f")}async init(){let isInstance=await Q(this,fe,"f").isSubjectInstance(Q(this,Ue,"f"),Q(this,Fe,"f"));if(!isInstance)throw`Not a valid subject instance of ${Q(this,Fe,"f")} for ${Q(this,Ue,"f")}`;let results=await Q(this,fe,"f").infer(`subject_class("${Q(this,Fe,"f")}", C), property(C, Property)`),properties=results.map(i=>i.Property);for(let i of properties)await Q(this,fe,"f").infer(`subject_class("${Q(this,Fe,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await Q(this,fe,"f").getPropertyValueViaSurreal(Q(this,Ue,"f"),Q(this,Fe,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await Q(this,fe,"f").infer(`subject_class("${Q(this,Fe,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await Q(this,fe,"f").infer(`subject_class("${Q(this,Fe,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[so(property)]=async i=>{resolveLanguage&&(i=await Q(this,fe,"f").createExpression(i,resolveLanguage)),await Q(this,fe,"f").executeAction(actions,Q(this,Ue,"f"),[{name:"value",value:i}])}}let results2=await Q(this,fe,"f").infer(`subject_class("${Q(this,Fe,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(i=>i.Collection);for(let i of collections)Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await Q(this,fe,"f").getCollectionValuesViaSurreal(Q(this,Ue,"f"),Q(this,Fe,"f"),i)}catch(e){return console.warn(`Failed to get collection ${i} via SurrealDB:`,e),[]}}});let adders=await Q(this,fe,"f").infer(`subject_class("${Q(this,Fe,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[bd(collection)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>Q(this,fe,"f").executeAction(actions,Q(this,Ue,"f"),[{name:"value",value:e}]))):await Q(this,fe,"f").executeAction(actions,Q(this,Ue,"f"),[{name:"value",value:i}])}}let removers=await Q(this,fe,"f").infer(`subject_class("${Q(this,Fe,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[Sd(collection)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>Q(this,fe,"f").executeAction(actions,Q(this,Ue,"f"),[{name:"value",value:e}]))):await Q(this,fe,"f").executeAction(actions,Q(this,Ue,"f"),[{name:"value",value:i}])}}let collectionSetters=await Q(this,fe,"f").infer(`subject_class("${Q(this,Fe,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[xd(collection)]=async i=>{Array.isArray(i)?await Q(this,fe,"f").executeAction(actions,Q(this,Ue,"f"),i.map(e=>({name:"value",value:e}))):await Q(this,fe,"f").executeAction(actions,Q(this,Ue,"f"),[{name:"value",value:i}])}}}};Ue=new WeakMap,Fe=new WeakMap,fe=new WeakMap;function Yo(i){return i?.length?i.length===1?i.toString():i.length===2?i.join(" and "):i.slice(0,-1).join(", ")+", and "+i.slice(-1):""}function bl(i){let e=i.can.includes("*")?["READ","WRITE","UPDATE"]:i.can,t=i.with.domain==="*"?"":i.with.domain,r=i.with.pointers.includes("*")?["all AD4M data"]:i.with.pointers;return`${Yo(e)} your ${t} actions, with access to ${Yo(r)}`}function oe(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var ie=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},b=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},na,Nt,mt,yt,xi,qt,Vt,mi,Fr,aa,yi,vi,nt,cr,Us,Y,ee,bi,_i,Si,jr,Ia=class{constructor(e,t,r){na.add(this),Nt.set(this,void 0),mt.set(this,void 0),yt.set(this,void 0),xi.set(this,void 0),qt.set(this,void 0),Vt.set(this,void 0),mi.set(this,void 0),Fr.set(this,!1),aa.set(this,void 0),yi.set(this,void 0),vi.set(this,void 0),nt.set(this,void 0),cr.set(this,void 0),this.isSurrealDB=!1,ie(this,Nt,e,"f"),ie(this,cr,t,"f"),ie(this,yt,r,"f"),ie(this,xi,new Set,"f"),ie(this,mi,null,"f"),ie(this,aa,new Promise((n,a)=>{ie(this,yi,n,"f"),ie(this,vi,a,"f")}),"f")}async subscribe(){b(this,Vt,"f")&&(b(this,Vt,"f").call(this),ie(this,Vt,void 0,"f")),b(this,nt,"f")&&(clearTimeout(b(this,nt,"f")),ie(this,nt,void 0,"f")),b(this,qt,"f")&&(clearTimeout(b(this,qt,"f")),ie(this,qt,void 0,"f"));try{let t;this.isSurrealDB?t=await b(this,yt,"f").perspectiveSubscribeSurrealQuery(b(this,Nt,"f"),b(this,cr,"f")):t=await b(this,yt,"f").subscribeQuery(b(this,Nt,"f"),b(this,cr,"f")),ie(this,mt,t.subscriptionId,"f"),t.result?(ie(this,mi,t.result,"f"),b(this,na,"m",Us).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ie(this,nt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(r=>{console.error("Error during subscription retry after timeout:",r)})},3e4),"f"),ie(this,Vt,b(this,yt,"f").subscribeToQueryUpdates(b(this,mt,"f"),r=>{b(this,nt,"f")&&(clearTimeout(b(this,nt,"f")),ie(this,nt,void 0,"f")),b(this,yi,"f")&&(b(this,yi,"f").call(this,!0),ie(this,yi,void 0,"f"),ie(this,vi,void 0,"f")),!(r.isInit&&b(this,mi,"f"))&&(ie(this,mi,r,"f"),b(this,na,"m",Us).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),b(this,vi,"f")&&(b(this,vi,"f").call(this,t),ie(this,yi,void 0,"f"),ie(this,vi,void 0,"f")),t}let e=async()=>{if(!b(this,Fr,"f")){try{this.isSurrealDB?await b(this,yt,"f").perspectiveKeepAliveSurrealQuery(b(this,Nt,"f"),b(this,mt,"f")):await b(this,yt,"f").keepAliveQuery(b(this,Nt,"f"),b(this,mt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",b(this,cr,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}b(this,Fr,"f")||ie(this,qt,setTimeout(e,3e4),"f")}};ie(this,qt,setTimeout(e,3e4),"f")}get id(){return b(this,mt,"f")}get initialized(){return b(this,aa,"f")}get result(){return b(this,mi,"f")}onResult(e){return b(this,xi,"f").add(e),()=>b(this,xi,"f").delete(e)}dispose(){ie(this,Fr,!0,"f"),clearTimeout(b(this,qt,"f")),b(this,Vt,"f")&&b(this,Vt,"f").call(this),b(this,xi,"f").clear(),b(this,nt,"f")&&(clearTimeout(b(this,nt,"f")),ie(this,nt,void 0,"f")),b(this,mt,"f")&&(this.isSurrealDB?b(this,yt,"f").perspectiveDisposeSurrealQuerySubscription(b(this,Nt,"f"),b(this,mt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):b(this,yt,"f").disposeQuerySubscription(b(this,Nt,"f"),b(this,mt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Nt=new WeakMap,mt=new WeakMap,yt=new WeakMap,xi=new WeakMap,qt=new WeakMap,Vt=new WeakMap,mi=new WeakMap,Fr=new WeakMap,aa=new WeakMap,yi=new WeakMap,vi=new WeakMap,nt=new WeakMap,cr=new WeakMap,na=new WeakSet,Us=function i(e){for(let t of b(this,xi,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var ur=class{constructor(i,e){Y.set(this,void 0),ee.set(this,void 0),bi.set(this,void 0),_i.set(this,void 0),Si.set(this,void 0),jr.set(this,void 0),ie(this,bi,[],"f"),ie(this,_i,[],"f"),ie(this,Si,[],"f"),ie(this,jr,[],"f"),ie(this,Y,i,"f"),ie(this,ee,e,"f"),this.uuid=b(this,Y,"f").uuid,this.name=b(this,Y,"f").name,this.owners=b(this,Y,"f").owners,this.sharedUrl=b(this,Y,"f").sharedUrl,this.neighbourhood=b(this,Y,"f").neighbourhood,this.state=b(this,Y,"f").state,b(this,ee,"f").addPerspectiveLinkAddedListener(b(this,Y,"f").uuid,b(this,bi,"f")),b(this,ee,"f").addPerspectiveLinkRemovedListener(b(this,Y,"f").uuid,b(this,_i,"f")),b(this,ee,"f").addPerspectiveLinkUpdatedListener(b(this,Y,"f").uuid,b(this,Si,"f")),b(this,ee,"f").addPerspectiveSyncStateChangeListener(b(this,Y,"f").uuid,b(this,jr,"f"))}escapeRegExp(i){return i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(i,e,t,r){return await b(this,ee,"f").executeCommands(b(this,Y,"f").uuid,JSON.stringify(i),e,JSON.stringify(t),r)}async get(i){return await b(this,ee,"f").queryLinks(b(this,Y,"f").uuid,i)}async infer(i){return await b(this,ee,"f").queryProlog(b(this,Y,"f").uuid,i)}async querySurrealDB(i){return await b(this,ee,"f").querySurrealDB(b(this,Y,"f").uuid,i)}async add(i,e="shared",t){return await b(this,ee,"f").addLink(b(this,Y,"f").uuid,i,e,t)}async addLinks(i,e="shared",t){return await b(this,ee,"f").addLinks(b(this,Y,"f").uuid,i,e,t)}async removeLinks(i,e){return await b(this,ee,"f").removeLinks(b(this,Y,"f").uuid,i,e)}async linkMutations(i,e="shared"){return await b(this,ee,"f").linkMutations(b(this,Y,"f").uuid,i,e)}async addLinkExpression(i,e="shared",t){return await b(this,ee,"f").addLinkExpression(b(this,Y,"f").uuid,i,e,t)}async update(i,e,t){return await b(this,ee,"f").updateLink(b(this,Y,"f").uuid,i,e,t)}async remove(i,e){return await b(this,ee,"f").removeLink(b(this,Y,"f").uuid,i,e)}async createBatch(){return await b(this,ee,"f").createBatch(b(this,Y,"f").uuid)}async commitBatch(i){return await b(this,ee,"f").commitBatch(b(this,Y,"f").uuid,i)}async getExpression(i){return await b(this,ee,"f").getExpression(i)}async createExpression(i,e){return await b(this,ee,"f").createExpression(i,e)}async addListener(i,e){i==="link-added"?b(this,bi,"f").push(e):i==="link-removed"?b(this,_i,"f").push(e):i==="link-updated"&&b(this,Si,"f").push(e)}async addSyncStateChangeListener(i){b(this,jr,"f").push(i)}async removeListener(i,e){if(i==="link-added"){let t=b(this,bi,"f").indexOf(e);b(this,bi,"f").splice(t,1)}else if(i==="link-removed"){let t=b(this,_i,"f").indexOf(e);b(this,_i,"f").splice(t,1)}else if(i==="link-updated"){let t=b(this,Si,"f").indexOf(e);b(this,Si,"f").splice(t,1)}}async snapshot(){return b(this,ee,"f").snapshotByUUID(b(this,Y,"f").uuid)}async loadSnapshot(i){let e=JSON.parse(JSON.stringify(i));delete e.__typename,e.links.forEach(t=>{delete t.data.__typename});for(let t of e.links)await this.addLinkExpression(t)}async getSingleTarget(i){delete i.target;let e=await this.get(i);return e.length?e[0].data.target:null}async setSingleTarget(i,e="shared"){let t=new Te({source:i.source,predicate:i.predicate}),r=await this.get(t),n=[];for(let s of r)delete s.__typename,delete s.data.__typename,delete s.proof.__typename,n.push(s);let a=[i];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(i){return(await this.infer(`flowable("${i}", F), register_sdna_flow(X, F)`)).map(t=>t.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(i,e){return(await this.infer(`register_sdna_flow("${i}", F), flow_state(X, ${e}, F)`)).map(r=>r.X)}async flowState(i,e){return(await this.infer(`register_sdna_flow("${i}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(i,e){return(await this.infer(`register_sdna_flow("${i}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(r=>r.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let i=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let t of i){let r=await this.get(new Te({source:"ad4m://self",predicate:t}));for(let n of r){let a=n.data.target,s=await this.get(new Te({source:a,predicate:"ad4m://sdna"}));for(let o of s){let l=Ce.fromUrl(o.data.target).get();typeof l=="string"&&e.push(l)}}}return e}async getSdnaForClass(i){let e=Ce.from(i);if((await this.get(new Te({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let r=await this.get(new Te({source:e.toUrl(),predicate:"ad4m://sdna"}));if(r.length===0)return null;let n=Ce.fromUrl(r[0].data.target).get();return typeof n=="string"?n:null}async addSdna(i,e,t){return b(this,ee,"f").addSdna(b(this,Y,"f").uuid,i,e,t)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(i=>i.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(i){if(typeof i=="string")return i;{let e=await this.subjectClassesByTemplate(i);return e[0]?e[0]:i.className}}async createSubject(i,e,t,r){let n;if(typeof i=="string")n=i,await b(this,ee,"f").createSubject(b(this,Y,"f").uuid,JSON.stringify({className:n,initialValues:t}),e,t?JSON.stringify(t):void 0,r);else{let a=this.buildQueryFromTemplate(i);await b(this,ee,"f").createSubject(b(this,Y,"f").uuid,JSON.stringify({query:a,initialValues:t}),e,t?JSON.stringify(t):void 0,r)}return r?e:this.getSubjectProxy(e,i)}async getSubjectData(i,e){if(typeof i=="string")return JSON.parse(await b(this,ee,"f").getSubjectData(b(this,Y,"f").uuid,JSON.stringify({className:i}),e));let t=this.buildQueryFromTemplate(i);return JSON.parse(await b(this,ee,"f").getSubjectData(b(this,Y,"f").uuid,JSON.stringify({query:t}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(i,e){let t=await this.stringOrTemplateObjectToSubjectClassName(e),r=await this.getSubjectClassMetadataFromSDNA(t);if(!r)try{let n=t.replace(/"/g,'\\"'),a=i.replace(/"/g,'\\"'),s=await this.infer(`subject_class("${n}", C), instance(C, "${a}")`);return s&&s.length>0}catch(n){return console.warn(`Failed to check instance via Prolog for class ${t}:`,n),!1}if(r.requiredTriples.length===0){let a=`SELECT count() AS count FROM link WHERE in.uri = '${oe(i)}'`,o=(await this.querySurrealDB(a))[0]?.count??0;return(typeof o=="object"&&o?.Int!==void 0?o.Int:o)>0}for(let n of r.requiredTriples){let a=oe(i),s=oe(n.predicate),o;if(n.target){let g=oe(n.target);o=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${s}' AND out.uri = '${g}'`}else o=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${s}'`;let l=await this.querySurrealDB(o);if(!l||l.length===0)return!1;let c=l[0]?.count??0;if((typeof c=="object"&&c?.Int!==void 0?c.Int:c)===0)return!1}return!0}async getSubjectProxy(i,e){if(!await this.isSubjectInstance(i,e))throw`Expression ${i} is not a subject instance of given class: ${JSON.stringify(e)}`;let t=await this.stringOrTemplateObjectToSubjectClassName(e),r=new pr(this,i,t);return await r.init(),r}async getSubjectClassMetadataFromSDNA(i){try{let e=await this.get(new Te({source:Ce.from(i).toUrl(),predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${i}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${i} has no target:`,e[0]),null;let t=Ce.fromUrl(e[0].data.target).get(),r=[],n=/instance\([^)]+\)\s*:-\s*([^.]+)\./g,a,s=!1;for(;(a=n.exec(t))!==null;){s=!0;let h=a[1],d=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,y;for(;(y=d.exec(h))!==null;){let _=y[1],E=y[2];r.push({predicate:_,target:E})}}s||console.warn(`No instance rule found in SDNA for ${i}`);let o=r.map(h=>h.predicate),l=new Map,c=await this.infer(`subject_class("${i}", C), property(C, P)`);if(c)for(let h of c){let d=h.P,y=null,_=await this.infer(`subject_class("${i}", C), property_setter(C, "${d}", Setter)`);if(_&&_.length>0){let $=_[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);$&&(y=$[1]||$[2])}if(!y){let E=this.escapeRegExp(d),$=t.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${E}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));$&&(y=$[1])}if(y){let E=await this.infer(`subject_class("${i}", C), property_resolve_language(C, "${d}", Lang)`),$=E&&E.length>0?E[0].Lang:void 0;l.set(d,{predicate:y,resolveLanguage:$})}}let u=new Map,g=await this.infer(`subject_class("${i}", C), collection(C, Coll)`);if(g)for(let h of g){let d=h.Coll,y=null,_,E=await this.infer(`subject_class("${i}", C), collection_adder(C, "${d}", Adder)`);if(E&&E.length>0){let k=E[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);k&&(y=k[1]||k[2])}let $=this.escapeRegExp(d),T=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${$}"[^)]*\\)\\s*:-[^.]+\\.`),C=t.match(T);if(C){let A=C[0],k=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,J=A.match(k);if(J){let I=J[1];if(I.startsWith("(")&&I.endsWith(")")&&(I=I.substring(1,I.length-1)),!y){let D=I.match(/triple\([^,]+,\s*"([^"]+)"/);D&&(y=D[1])}let O=I.match(/subject_class\("([^"]+)"/);O&&(_=O[1])}}y&&u.set(d,{predicate:y,instanceFilter:_})}return{requiredPredicates:o,requiredTriples:r,properties:l,collections:u}}catch(e){return console.error(`Error getting metadata for ${i}:`,e),null}}generateSurrealInstanceQuery(i){return i.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${i.requiredTriples.map(t=>{let r=oe(t.predicate);if(t.target){let n=oe(t.target);return`count(->link[WHERE predicate = '${r}' AND out.uri = '${n}']) > 0`}else return`count(->link[WHERE predicate = '${r}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(i,e,t){let r=await this.getSubjectClassMetadataFromSDNA(e);if(!r)return;let n=r.properties.get(t);if(!n)return;let a=oe(i),s=oe(n.predicate),o=`SELECT out.uri AS value FROM link WHERE in.uri = '${a}' AND predicate = '${s}' LIMIT 1`,l=await this.querySurrealDB(o);if(!l||l.length===0)return;let c=l[0].value;if(n.resolveLanguage&&c)try{let u=await this.getExpression(c);try{return JSON.parse(u.data)}catch{return u.data}}catch{return c}return c}async getCollectionValuesViaSurreal(i,e,t){let r=await this.getSubjectClassMetadataFromSDNA(e);if(!r)return[];let n=r.collections.get(t);if(!n)return[];let a=oe(i),s=oe(n.predicate),o=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${a}' AND predicate = '${s}' ORDER BY timestamp ASC`,l=await this.querySurrealDB(o);if(!l||l.length===0)return[];let c=l.map(u=>u.value).filter(u=>u!==""&&u!=="");if(n.instanceFilter)try{let u=await this.getSubjectClassMetadataFromSDNA(n.instanceFilter);return u?await this.batchCheckSubjectInstances(c,u):this.filterInstancesSequential(c,n.instanceFilter)}catch{return this.filterInstancesSequential(c,n.instanceFilter)}return c}async batchCheckSubjectInstances(i,e){if(i.length===0)return[];if(e.requiredTriples.length===0){let a=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${i.map(o=>`'${oe(o)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(a)).map(o=>o.uri)}let t=[];for(let n of e.requiredTriples){let a=i.map(c=>`'${oe(c)}'`).join(", "),s=oe(n.predicate),o;if(n.target){let c=oe(n.target);o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${s}' AND out.uri = '${c}' GROUP BY in.uri`}else o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${s}' GROUP BY in.uri`;let l=await this.querySurrealDB(o);t.push(new Set(l.map(c=>c.uri)))}return t.length===0?i:i.filter(n=>t.every(a=>a.has(n)))}async filterInstancesSequential(i,e){let t=[];for(let r of i)try{await this.isSubjectInstance(r,e)&&t.push(r)}catch{continue}return t}async getAllSubjectInstances(i){let e=[];typeof i=="string"?e=[i]:e=await this.subjectClassesByTemplate(i);let t=[];for(let r of e){let n=await this.getSubjectClassMetadataFromSDNA(r);if(n){let a=this.generateSurrealInstanceQuery(n),s=await this.querySurrealDB(a);for(let o of s||[])try{let l=new pr(this,o.base,r);await l.init(),t.push(l)}catch{}}}return t}async getAllSubjectProxies(i){let e=[];typeof i=="string"?e=[i]:e=await this.subjectClassesByTemplate(i);let t=[];for(let r of e){let n=await this.getSubjectClassMetadataFromSDNA(r);if(n){let a=this.generateSurrealInstanceQuery(n),s=await this.querySurrealDB(a);for(let o of s||[])try{let l=new pr(this,o.base,r);await l.init(),t.push(l)}catch{}}}return t}buildQueryFromTemplate(i){let e;return function(t){let r=[],n=[];Object.getPrototypeOf(t).__properties?Object.keys(Object.getPrototypeOf(t).__properties).forEach(u=>r.push(u)):r.push(...Object.keys(t).filter(u=>!Array.isArray(t[u]))),Object.getPrototypeOf(t).__collections?Object.keys(Object.getPrototypeOf(t).__collections).filter(u=>u!=="isSubjectInstance").forEach(u=>{n.includes(u)||n.push(u)}):n.push(...Object.keys(t).filter(u=>Array.isArray(t[u])).filter(u=>u!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(t).filter(u=>typeof t[u]=="function"&&u.startsWith("set")&&!u.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let g=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return g&&typeof g.value=="function"&&u.startsWith("set")&&!u.startsWith("setCollection")}));let s=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("add"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let g=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return g&&typeof g.value=="function"&&u.startsWith("add")}));let o=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("remove"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let g=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return g&&typeof g.value=="function"&&u.startsWith("remove")}));let l=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("setCollection"));l=l.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let g=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return g&&typeof g.value=="function"&&u.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let u of r)c+=`, property(C, "${u}")`;for(let u of n)c+=`, collection(C, "${u}")`;for(let u of a){let g=u.substring(3);g=g.charAt(0).toLowerCase()+g.slice(1),c+=`, property_setter(C, "${g}", _)`}for(let u of s)c+=`, collection_adder(C, "${_d(u)}", _)`;for(let u of o)c+=`, collection_remover(C, "${wd(u)}", _)`;for(let u of l)c+=`, collection_setter(C, "${Ed(u)}", _)`;c+=".",e=c}(i),e}async subjectClassesByTemplate(i){let e=this.buildQueryFromTemplate(i),t=await this.infer(e);return t?t.map(r=>r.Class):[]}async ensureSDNASubjectClass(i){if((await this.subjectClassesByTemplate(new i)).length>0)return;let{name:t,sdna:r}=i.generateSDNA();await this.addSdna(t,r,"subject_class")}getNeighbourhoodProxy(){return b(this,ee,"f").getNeighbourhoodProxy(b(this,Y,"f").uuid)}get ai(){return b(this,ee,"f").aiClient}async subscribeInfer(i){let e=new Ia(this.uuid,i,b(this,ee,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(i){let e=new Ia(this.uuid,i,b(this,ee,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};Y=new WeakMap,ee=new WeakMap,bi=new WeakMap,_i=new WeakMap,Si=new WeakMap,jr=new WeakMap;var Ft=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},F=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},W,Br,qr,Vr,sa,zr,oa,ca,Me=`
487
437
  author
488
438
  timestamp
489
439
  status
490
440
  data { source, predicate, target }
491
441
  proof { valid, invalid, signature, key }
492
- `,Xi=`
442
+ `,ir=`
493
443
  uuid
494
444
  name
495
445
  sharedUrl
@@ -510,23 +460,23 @@ neighbourhood {
510
460
  }
511
461
  author
512
462
  }
513
- `,Ia=class{constructor(e,t=!0){W.set(this,void 0),Ur.set(this,void 0),Fr.set(this,void 0),jr.set(this,void 0),aa.set(this,void 0),Br.set(this,void 0),sa.set(this,void 0),oa.set(this,void 0),Ut(this,W,e,"f"),Ut(this,Ur,[],"f"),Ut(this,Fr,[],"f"),Ut(this,jr,[],"f"),Ut(this,aa,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Ut(this,Br,e,"f")}setNeighbourhoodClient(e){Ut(this,sa,e,"f")}setAIClient(e){Ut(this,oa,e,"f")}get aiClient(){return F(this,oa,"f")}async all(){let{perspectives:e}=v(await F(this,W,"f").query({query:m`query perspectives {
463
+ `,ka=class{constructor(e,t=!0){W.set(this,void 0),Br.set(this,void 0),qr.set(this,void 0),Vr.set(this,void 0),sa.set(this,void 0),zr.set(this,void 0),oa.set(this,void 0),ca.set(this,void 0),Ft(this,W,e,"f"),Ft(this,Br,[],"f"),Ft(this,qr,[],"f"),Ft(this,Vr,[],"f"),Ft(this,sa,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Ft(this,zr,e,"f")}setNeighbourhoodClient(e){Ft(this,oa,e,"f")}setAIClient(e){Ft(this,ca,e,"f")}get aiClient(){return F(this,ca,"f")}async all(){let{perspectives:e}=v(await F(this,W,"f").query({query:m`query perspectives {
514
464
  perspectives {
515
- ${Xi}
465
+ ${ir}
516
466
  }
517
- }`}));return e.map(t=>new or(t,this))}async byUUID(e){let{perspective:t}=v(await F(this,W,"f").query({query:m`query perspective($uuid: String!) {
467
+ }`}));return e.map(t=>new ur(t,this))}async byUUID(e){let{perspective:t}=v(await F(this,W,"f").query({query:m`query perspective($uuid: String!) {
518
468
  perspective(uuid: $uuid) {
519
- ${Xi}
469
+ ${ir}
520
470
  }
521
- }`,variables:{uuid:e}}));return t?new or(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=v(await F(this,W,"f").query({query:m`query perspectiveSnapshot($uuid: String!) {
471
+ }`,variables:{uuid:e}}));return t?new ur(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=v(await F(this,W,"f").query({query:m`query perspectiveSnapshot($uuid: String!) {
522
472
  perspectiveSnapshot(uuid: $uuid) {
523
- links { ${Oe} }
473
+ links { ${Me} }
524
474
  }
525
475
  }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectivePublishSnapshot($uuid: String!) {
526
476
  perspectivePublishSnapshot(uuid: $uuid)
527
477
  }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=v(await F(this,W,"f").query({query:m`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
528
478
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
529
- ${Oe}
479
+ ${Me}
530
480
  }
531
481
  }`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=v(await F(this,W,"f").query({query:m`query perspectiveQueryProlog($uuid: String!, $query: String!) {
532
482
  perspectiveQueryProlog(uuid: $uuid, query: $query)
@@ -556,42 +506,42 @@ neighbourhood {
556
506
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
557
507
  }`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveAdd($name: String!) {
558
508
  perspectiveAdd(name: $name) {
559
- ${Xi}
509
+ ${ir}
560
510
  }
561
- }`,variables:{name:e}}));return new or(t,this)}async update(e,t){let{perspectiveUpdate:r}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveUpdate($uuid: String!, $name: String!) {
511
+ }`,variables:{name:e}}));return new ur(t,this)}async update(e,t){let{perspectiveUpdate:r}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveUpdate($uuid: String!, $name: String!) {
562
512
  perspectiveUpdate(uuid: $uuid, name: $name) {
563
- ${Xi}
513
+ ${ir}
564
514
  }
565
- }`,variables:{uuid:e,name:t}}));return new or(r,this)}async remove(e){return v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveRemove($uuid: String!) {
515
+ }`,variables:{uuid:e,name:t}}));return new ur(r,this)}async remove(e){return v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveRemove($uuid: String!) {
566
516
  perspectiveRemove(uuid: $uuid)
567
517
  }`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
568
518
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
569
- ${Oe}
519
+ ${Me}
570
520
  }
571
521
  }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
572
522
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
573
- ${Oe}
523
+ ${Me}
574
524
  }
575
525
  }`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
576
526
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
577
- ${Oe}
527
+ ${Me}
578
528
  }
579
529
  }`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
580
530
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
581
531
  additions {
582
- ${Oe}
532
+ ${Me}
583
533
  }
584
534
  removals {
585
- ${Oe}
535
+ ${Me}
586
536
  }
587
537
  }
588
538
  }`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
589
539
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
590
- ${Oe}
540
+ ${Me}
591
541
  }
592
542
  }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
593
543
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
594
- ${Oe}
544
+ ${Me}
595
545
  }
596
546
  }`,variables:{uuid:e,oldLink:t,newLink:r,batchId:n}}));return a}async removeLink(e,t,r){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
597
547
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
@@ -603,46 +553,46 @@ neighbourhood {
603
553
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
604
554
  }`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
605
555
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
606
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await F(this,Br,"f").get(e)}async createExpression(e,t){return await F(this,Br,"f").create(e,t)}addPerspectiveAddedListener(e){F(this,Ur,"f").push(e)}subscribePerspectiveAdded(){F(this,W,"f").subscribe({query:m` subscription {
607
- perspectiveAdded { ${Xi} }
556
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await F(this,zr,"f").get(e)}async createExpression(e,t){return await F(this,zr,"f").create(e,t)}addPerspectiveAddedListener(e){F(this,Br,"f").push(e)}subscribePerspectiveAdded(){F(this,W,"f").subscribe({query:m` subscription {
557
+ perspectiveAdded { ${ir} }
608
558
  }
609
- `}).subscribe({next:e=>{F(this,Ur,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){F(this,Fr,"f").push(e)}subscribePerspectiveUpdated(){F(this,W,"f").subscribe({query:m` subscription {
610
- perspectiveUpdated { ${Xi} }
559
+ `}).subscribe({next:e=>{F(this,Br,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){F(this,qr,"f").push(e)}subscribePerspectiveUpdated(){F(this,W,"f").subscribe({query:m` subscription {
560
+ perspectiveUpdated { ${ir} }
611
561
  }
612
- `}).subscribe({next:e=>{F(this,Fr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){F(this,aa,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){F(this,W,"f").subscribe({query:m` subscription {
562
+ `}).subscribe({next:e=>{F(this,qr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){F(this,sa,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){F(this,W,"f").subscribe({query:m` subscription {
613
563
  perspectiveSyncStateChange(uuid: "${e}")
614
564
  }
615
- `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){F(this,jr,"f").push(e)}subscribePerspectiveRemoved(){F(this,W,"f").subscribe({query:m` subscription {
565
+ `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){F(this,Vr,"f").push(e)}subscribePerspectiveRemoved(){F(this,W,"f").subscribe({query:m` subscription {
616
566
  perspectiveRemoved
617
567
  }
618
- `}).subscribe({next:e=>{F(this,jr,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){F(this,W,"f").subscribe({query:m` subscription {
619
- perspectiveLinkAdded(uuid: "${e}") { ${Oe} }
568
+ `}).subscribe({next:e=>{F(this,Vr,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){F(this,W,"f").subscribe({query:m` subscription {
569
+ perspectiveLinkAdded(uuid: "${e}") { ${Me} }
620
570
  }
621
571
  `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveLinkAdded)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}async addPerspectiveLinkRemovedListener(e,t){F(this,W,"f").subscribe({query:m` subscription {
622
- perspectiveLinkRemoved(uuid: "${e}") { ${Oe} }
572
+ perspectiveLinkRemoved(uuid: "${e}") { ${Me} }
623
573
  }
624
574
  `}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkRemoved.status||delete r.data.perspectiveLinkRemoved.status,n(r.data.perspectiveLinkRemoved)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}async addPerspectiveLinkUpdatedListener(e,t){F(this,W,"f").subscribe({query:m` subscription {
625
575
  perspectiveLinkUpdated(uuid: "${e}") {
626
576
  oldLink {
627
- ${Oe}
577
+ ${Me}
628
578
  }
629
579
  newLink {
630
- ${Oe}
580
+ ${Me}
631
581
  }
632
582
  }
633
583
  }
634
- `}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkUpdated.newLink.status||delete r.data.perspectiveLinkUpdated.newLink.status,r.data.perspectiveLinkUpdated.oldLink.status||delete r.data.perspectiveLinkUpdated.oldLink.status,n(r.data.perspectiveLinkUpdated)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}getNeighbourhoodProxy(e){return new Ds(F(this,sa,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveCreateBatch($uuid: String!) {
584
+ `}).subscribe({next:r=>{t.forEach(n=>{r.data.perspectiveLinkUpdated.newLink.status||delete r.data.perspectiveLinkUpdated.newLink.status,r.data.perspectiveLinkUpdated.oldLink.status||delete r.data.perspectiveLinkUpdated.oldLink.status,n(r.data.perspectiveLinkUpdated)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}getNeighbourhoodProxy(e){return new Ms(F(this,oa,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveCreateBatch($uuid: String!) {
635
585
  perspectiveCreateBatch(uuid: $uuid)
636
586
  }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=v(await F(this,W,"f").mutate({mutation:m`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
637
587
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
638
588
  additions {
639
- ${Oe}
589
+ ${Me}
640
590
  }
641
591
  removals {
642
- ${Oe}
592
+ ${Me}
643
593
  }
644
594
  }
645
- }`,variables:{uuid:e,batchId:t}}));return r}};W=new WeakMap,Ur=new WeakMap,Fr=new WeakMap,jr=new WeakMap,aa=new WeakMap,Br=new WeakMap,sa=new WeakMap,oa=new WeakMap;var jn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},G=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},X,qr,Vr,zr,Lr=`
595
+ }`,variables:{uuid:e,batchId:t}}));return r}};W=new WeakMap,Br=new WeakMap,qr=new WeakMap,Vr=new WeakMap,sa=new WeakMap,zr=new WeakMap,oa=new WeakMap,ca=new WeakMap;var Bn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},G=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},X,Hr,Kr,Qr,Or=`
646
596
  did
647
597
  directMessageLanguage
648
598
  perspective {
@@ -656,7 +606,7 @@ neighbourhood {
656
606
  }
657
607
  }
658
608
  }
659
- `,Bn=`
609
+ `,qn=`
660
610
  requestId
661
611
  revoked
662
612
  auth {
@@ -672,89 +622,89 @@ neighbourhood {
672
622
  can
673
623
  }
674
624
  }
675
- `,er=`
625
+ `,rr=`
676
626
  isInitialized
677
627
  isUnlocked
678
628
  did
679
629
  didDocument
680
630
  error
681
- `,qn=`
631
+ `,Vn=`
682
632
  did
683
633
  didSigningKeyId
684
634
  deviceKeyType
685
635
  deviceKey
686
636
  deviceKeySignedByDid
687
637
  didSignedByDeviceKey
688
- `,xd=`
638
+ `,Ad=`
689
639
  signature
690
640
  publicKey
691
- `,on=class{constructor(e,t=!0){X.set(this,void 0),qr.set(this,void 0),Vr.set(this,void 0),zr.set(this,void 0),jn(this,X,e,"f"),jn(this,Vr,[],"f"),jn(this,zr,[],"f"),jn(this,qr,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=v(await G(this,X,"f").query({query:m`query agent { agent { ${Lr} } }`})),t=new Kt(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=v(await G(this,X,"f").query({query:m`query agentStatus {
641
+ `,un=class{constructor(e,t=!0){X.set(this,void 0),Hr.set(this,void 0),Kr.set(this,void 0),Qr.set(this,void 0),Bn(this,X,e,"f"),Bn(this,Kr,[],"f"),Bn(this,Qr,[],"f"),Bn(this,Hr,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=v(await G(this,X,"f").query({query:m`query agent { agent { ${Or} } }`})),t=new Qt(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=v(await G(this,X,"f").query({query:m`query agentStatus {
692
642
  agentStatus {
693
- ${er}
643
+ ${rr}
694
644
  }
695
- }`}));return new at(e)}async generate(e){let{agentGenerate:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentGenerate(
645
+ }`}));return new st(e)}async generate(e){let{agentGenerate:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentGenerate(
696
646
  $passphrase: String!
697
647
  ) {
698
648
  agentGenerate(passphrase: $passphrase) {
699
- ${er}
649
+ ${rr}
700
650
  }
701
- }`,variables:{passphrase:e}}));return new at(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=v(await G(this,X,"f").mutate({mutation:m`mutation agentImport(
651
+ }`,variables:{passphrase:e}}));return new st(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=v(await G(this,X,"f").mutate({mutation:m`mutation agentImport(
702
652
  $did: String!,
703
653
  $didDocument: String!,
704
654
  $keystore: String!,
705
655
  $passphrase: String!
706
656
  ) {
707
657
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
708
- ${er}
658
+ ${rr}
709
659
  }
710
- }`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new at(s)}async lock(e){let{agentLock:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentLock($passphrase: String!) {
660
+ }`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new st(s)}async lock(e){let{agentLock:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentLock($passphrase: String!) {
711
661
  agentLock(passphrase: $passphrase) {
712
- ${er}
662
+ ${rr}
713
663
  }
714
- }`,variables:{passphrase:e}}));return new at(t)}async unlock(e,t=!0){let{agentUnlock:r}=v(await G(this,X,"f").mutate({mutation:m`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
664
+ }`,variables:{passphrase:e}}));return new st(t)}async unlock(e,t=!0){let{agentUnlock:r}=v(await G(this,X,"f").mutate({mutation:m`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
715
665
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
716
- ${er}
666
+ ${rr}
717
667
  }
718
- }`,variables:{passphrase:e,holochain:t}}));return new at(r)}async byDID(e){let{agentByDID:t}=v(await G(this,X,"f").query({query:m`query agentByDID($did: String!) {
668
+ }`,variables:{passphrase:e,holochain:t}}));return new st(r)}async byDID(e){let{agentByDID:t}=v(await G(this,X,"f").query({query:m`query agentByDID($did: String!) {
719
669
  agentByDID(did: $did) {
720
- ${Lr}
670
+ ${Or}
721
671
  }
722
672
  }`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(s=>{delete s.__typename,delete s.data.__typename,delete s.proof.__typename,delete s.status});let{agentUpdatePublicPerspective:r}=v(await G(this,X,"f").mutate({mutation:m`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
723
673
  agentUpdatePublicPerspective(perspective: $perspective) {
724
- ${Lr}
674
+ ${Or}
725
675
  }
726
- }`,variables:{perspective:t}})),n=r,a=new Kt(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ia(G(this,X,"f")),r=new on(G(this,X,"f")),n=await t.add("Agent Perspective Proxy"),a=await r.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let l of e.additions)await n.add(l);for(let l of e.removals)await n.remove(l);let s=await n.snapshot(),o=await this.updatePublicPerspective(s);return await t.remove(n.uuid),o}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
676
+ }`,variables:{perspective:t}})),n=r,a=new Qt(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new ka(G(this,X,"f")),r=new un(G(this,X,"f")),n=await t.add("Agent Perspective Proxy"),a=await r.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let l of e.additions)await n.add(l);for(let l of e.removals)await n.remove(l);let s=await n.snapshot(),o=await this.updatePublicPerspective(s);return await t.remove(n.uuid),o}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
727
677
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
728
- ${Lr}
678
+ ${Or}
729
679
  }
730
- }`,variables:{directMessageLanguage:e}})),r=t,n=new Kt(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
680
+ }`,variables:{directMessageLanguage:e}})),r=t,n=new Qt(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
731
681
  agentAddEntanglementProofs(proofs: $proofs) {
732
- ${qn}
682
+ ${Vn}
733
683
  }
734
684
  }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
735
685
  agentDeleteEntanglementProofs(proofs: $proofs) {
736
- ${qn}
686
+ ${Vn}
737
687
  }
738
688
  }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=v(await G(this,X,"f").query({query:m`query agentGetEntanglementProofs {
739
689
  agentGetEntanglementProofs {
740
- ${qn}
690
+ ${Vn}
741
691
  }
742
692
  }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=v(await G(this,X,"f").mutate({mutation:m`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
743
693
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
744
- ${qn}
694
+ ${Vn}
745
695
  }
746
- }`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){G(this,Vr,"f").push(e)}addAppChangedListener(e){G(this,qr,"f").push(e)}subscribeAgentUpdated(){G(this,X,"f").subscribe({query:m` subscription {
747
- agentUpdated { ${Lr} }
696
+ }`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){G(this,Kr,"f").push(e)}addAppChangedListener(e){G(this,Hr,"f").push(e)}subscribeAgentUpdated(){G(this,X,"f").subscribe({query:m` subscription {
697
+ agentUpdated { ${Or} }
748
698
  }
749
- `}).subscribe({next:e=>{let t=e.data.agentUpdated;G(this,Vr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){G(this,X,"f").subscribe({query:m` subscription {
699
+ `}).subscribe({next:e=>{let t=e.data.agentUpdated;G(this,Kr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){G(this,X,"f").subscribe({query:m` subscription {
750
700
  agentAppsChanged {
751
- ${Bn}
701
+ ${qn}
752
702
  }
753
703
  }
754
- `}).subscribe({next:e=>{G(this,qr,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){G(this,zr,"f").push(e)}subscribeAgentStatusChanged(){G(this,X,"f").subscribe({query:m` subscription {
755
- agentStatusChanged { ${er} }
704
+ `}).subscribe({next:e=>{G(this,Hr,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){G(this,Qr,"f").push(e)}subscribeAgentStatusChanged(){G(this,X,"f").subscribe({query:m` subscription {
705
+ agentStatusChanged { ${rr} }
756
706
  }
757
- `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;G(this,zr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=v(await G(this,X,"f").mutate({mutation:m`
707
+ `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;G(this,Qr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=v(await G(this,X,"f").mutate({mutation:m`
758
708
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
759
709
  agentRequestCapability(authInfo: $authInfo)
760
710
  }
@@ -768,15 +718,15 @@ neighbourhood {
768
718
  }
769
719
  `,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=v(await G(this,X,"f").mutate({mutation:m`query agentGetApps {
770
720
  agentGetApps {
771
- ${Bn}
721
+ ${qn}
772
722
  }
773
723
  }`}));return e}async removeApp(e){let{agentRemoveApp:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentRemoveApp($requestId: String!) {
774
724
  agentRemoveApp(requestId: $requestId) {
775
- ${Bn}
725
+ ${qn}
776
726
  }
777
727
  }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentRevokeToken($requestId: String!) {
778
728
  agentRevokeToken(requestId: $requestId) {
779
- ${Bn}
729
+ ${qn}
780
730
  }
781
731
  }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=v(await G(this,X,"f").mutate({mutation:m`
782
732
  query agentIsLocked {
@@ -784,7 +734,7 @@ neighbourhood {
784
734
  }
785
735
  `}));return e}async signMessage(e){let{agentSignMessage:t}=v(await G(this,X,"f").mutate({mutation:m`mutation agentSignMessage($message: String!) {
786
736
  agentSignMessage(message: $message) {
787
- ${xd}
737
+ ${Ad}
788
738
  }
789
739
  }`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=v(await G(this,X,"f").mutate({mutation:m`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
790
740
  runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
@@ -803,14 +753,14 @@ neighbourhood {
803
753
  }
804
754
  }`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=v(await G(this,X,"f").mutate({mutation:m`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
805
755
  runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
806
- }`,variables:{email:e,code:t,verificationType:r}}));return n}};X=new WeakMap,qr=new WeakMap,Vr=new WeakMap,zr=new WeakMap;var Ad=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Ft=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},dt,Yo=`
756
+ }`,variables:{email:e,code:t,verificationType:r}}));return n}};X=new WeakMap,Hr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap;var $d=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},jt=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},dt,Xo=`
807
757
  name
808
758
  address
809
759
  settings
810
760
  icon { code }
811
761
  constructorIcon { code }
812
762
  settingsIcon { code }
813
- `,Xo=`
763
+ `,ec=`
814
764
  name
815
765
  address
816
766
  description
@@ -820,45 +770,45 @@ neighbourhood {
820
770
  templateAppliedParams
821
771
  possibleTemplateParams
822
772
  sourceCodeLink
823
- `,Us=class{constructor(e){dt.set(this,void 0),Ad(this,dt,e,"f")}async byAddress(e){let{language:t}=v(await Ft(this,dt,"f").query({query:m`query byAddress($address: String!) {
773
+ `,Fs=class{constructor(e){dt.set(this,void 0),$d(this,dt,e,"f")}async byAddress(e){let{language:t}=v(await jt(this,dt,"f").query({query:m`query byAddress($address: String!) {
824
774
  language(address: $address) {
825
- ${Yo}
775
+ ${Xo}
826
776
  }
827
- }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=v(await Ft(this,dt,"f").query({query:m`query byFilter($filter: String!) {
777
+ }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=v(await jt(this,dt,"f").query({query:m`query byFilter($filter: String!) {
828
778
  languages(filter: $filter) {
829
- ${Yo}
779
+ ${Xo}
830
780
  }
831
- }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=v(await Ft(this,dt,"f").mutate({mutation:m`mutation writeSettings($languageAddress: String!, $settings: String!) {
781
+ }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=v(await jt(this,dt,"f").mutate({mutation:m`mutation writeSettings($languageAddress: String!, $settings: String!) {
832
782
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
833
- }`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=v(await Ft(this,dt,"f").mutate({mutation:m`mutation languageApplyTemplateAndPublish(
783
+ }`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=v(await jt(this,dt,"f").mutate({mutation:m`mutation languageApplyTemplateAndPublish(
834
784
  $sourceLanguageHash: String!,
835
785
  $templateData: String!,
836
786
  ) {
837
787
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
838
788
  name, address
839
789
  }
840
- }`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=v(await Ft(this,dt,"f").mutate({mutation:m`mutation languagePublish(
790
+ }`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=v(await jt(this,dt,"f").mutate({mutation:m`mutation languagePublish(
841
791
  $languagePath: String!,
842
792
  $languageMeta: LanguageMetaInput!,
843
793
  ) {
844
794
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
845
- ${Xo}
795
+ ${ec}
846
796
  }
847
- }`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=v(await Ft(this,dt,"f").query({query:m`query languageMeta(
797
+ }`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=v(await jt(this,dt,"f").query({query:m`query languageMeta(
848
798
  $address: String!,
849
799
  ) {
850
800
  languageMeta(address: $address) {
851
- ${Xo}
801
+ ${ec}
852
802
  }
853
- }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=v(await Ft(this,dt,"f").query({query:m`query languageSource(
803
+ }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=v(await jt(this,dt,"f").query({query:m`query languageSource(
854
804
  $address: String!,
855
805
  ) {
856
806
  languageSource(address: $address)
857
- }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=v(await Ft(this,dt,"f").mutate({mutation:m`mutation languageRemove(
807
+ }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=v(await jt(this,dt,"f").mutate({mutation:m`mutation languageRemove(
858
808
  $address: String!,
859
809
  ) {
860
810
  languageRemove(address: $address)
861
- }`,variables:{address:e}}));return t}};dt=new WeakMap;var $d=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Le=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Ue,sr,Fs=class{constructor(e){Ue.set(this,void 0),sr.set(this,new Map),$d(this,Ue,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=v(await Le(this,Ue,"f").mutate({mutation:m`mutation neighbourhoodPublishFromPerspective(
811
+ }`,variables:{address:e}}));return t}};dt=new WeakMap;var Id=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},Pe=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},je,lr,js=class{constructor(e){je.set(this,void 0),lr.set(this,new Map),Id(this,je,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=v(await Pe(this,je,"f").mutate({mutation:m`mutation neighbourhoodPublishFromPerspective(
862
812
  $linkLanguage: String!,
863
813
  $meta: PerspectiveInput!,
864
814
  $perspectiveUUID: String!
@@ -868,7 +818,7 @@ neighbourhood {
868
818
  meta: $meta,
869
819
  perspectiveUUID: $perspectiveUUID
870
820
  )
871
- }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=v(await Le(this,Ue,"f").mutate({mutation:m`mutation neighbourhoodJoinFromUrl($url: String!) {
821
+ }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=v(await Pe(this,je,"f").mutate({mutation:m`mutation neighbourhoodJoinFromUrl($url: String!) {
872
822
  neighbourhoodJoinFromUrl(url: $url) {
873
823
  uuid
874
824
  name
@@ -890,11 +840,11 @@ neighbourhood {
890
840
  author
891
841
  }
892
842
  }
893
- }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=v(await Le(this,Ue,"f").query({query:m`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
843
+ }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=v(await Pe(this,je,"f").query({query:m`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
894
844
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
895
- }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=v(await Le(this,Ue,"f").query({query:m`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
845
+ }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=v(await Pe(this,je,"f").query({query:m`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
896
846
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
897
- }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=v(await Le(this,Ue,"f").query({query:m`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
847
+ }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=v(await Pe(this,je,"f").query({query:m`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
898
848
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
899
849
  did
900
850
  status {
@@ -911,7 +861,7 @@ neighbourhood {
911
861
  proof { valid, invalid, signature, key }
912
862
  }
913
863
  }
914
- }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=v(await Le(this,Ue,"f").mutate({mutation:m`mutation neighbourhoodSetOnlineStatus(
864
+ }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=v(await Pe(this,je,"f").mutate({mutation:m`mutation neighbourhoodSetOnlineStatus(
915
865
  $perspectiveUUID: String!,
916
866
  $status: PerspectiveInput!
917
867
  ) {
@@ -919,7 +869,7 @@ neighbourhood {
919
869
  perspectiveUUID: $perspectiveUUID,
920
870
  status: $status
921
871
  )
922
- }`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=v(await Le(this,Ue,"f").mutate({mutation:m`mutation neighbourhoodSetOnlineStatusU(
872
+ }`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=v(await Pe(this,je,"f").mutate({mutation:m`mutation neighbourhoodSetOnlineStatusU(
923
873
  $perspectiveUUID: String!,
924
874
  $status: PerspectiveUnsignedInput!
925
875
  ) {
@@ -927,7 +877,7 @@ neighbourhood {
927
877
  perspectiveUUID: $perspectiveUUID,
928
878
  status: $status
929
879
  )
930
- }`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=v(await Le(this,Ue,"f").mutate({mutation:m`mutation neighbourhoodSendSignal(
880
+ }`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=v(await Pe(this,je,"f").mutate({mutation:m`mutation neighbourhoodSendSignal(
931
881
  $perspectiveUUID: String!,
932
882
  $remoteAgentDid: String!,
933
883
  $payload: PerspectiveInput!
@@ -937,7 +887,7 @@ neighbourhood {
937
887
  remoteAgentDid: $remoteAgentDid,
938
888
  payload: $payload
939
889
  )
940
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=v(await Le(this,Ue,"f").mutate({mutation:m`mutation neighbourhoodSendSignalU(
890
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=v(await Pe(this,je,"f").mutate({mutation:m`mutation neighbourhoodSendSignalU(
941
891
  $perspectiveUUID: String!,
942
892
  $remoteAgentDid: String!,
943
893
  $payload: PerspectiveUnsignedInput!
@@ -947,7 +897,7 @@ neighbourhood {
947
897
  remoteAgentDid: $remoteAgentDid,
948
898
  payload: $payload
949
899
  )
950
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=v(await Le(this,Ue,"f").mutate({mutation:m`mutation neighbourhoodSendBroadcast(
900
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=v(await Pe(this,je,"f").mutate({mutation:m`mutation neighbourhoodSendBroadcast(
951
901
  $perspectiveUUID: String!,
952
902
  $payload: PerspectiveInput!,
953
903
  $loopback: Boolean
@@ -957,7 +907,7 @@ neighbourhood {
957
907
  payload: $payload,
958
908
  loopback: $loopback
959
909
  )
960
- }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=v(await Le(this,Ue,"f").mutate({mutation:m`mutation neighbourhoodSendBroadcastU(
910
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=v(await Pe(this,je,"f").mutate({mutation:m`mutation neighbourhoodSendBroadcastU(
961
911
  $perspectiveUUID: String!,
962
912
  $payload: PerspectiveUnsignedInput!,
963
913
  $loopback: Boolean
@@ -967,7 +917,7 @@ neighbourhood {
967
917
  payload: $payload,
968
918
  loopback: $loopback
969
919
  )
970
- }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Le(this,sr,"f").get(e);r&&r.forEach(n=>n(t))}async subscribeToSignals(e){let t=this;await Le(this,Ue,"f").subscribe({query:m`subscription neighbourhoodSignal($perspectiveUUID: String!) {
920
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Pe(this,lr,"f").get(e);r&&r.forEach(n=>n(t))}async subscribeToSignals(e){let t=this;await Pe(this,je,"f").subscribe({query:m`subscription neighbourhoodSignal($perspectiveUUID: String!) {
971
921
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
972
922
  author
973
923
  timestamp
@@ -982,7 +932,7 @@ neighbourhood {
982
932
  }
983
933
  proof { valid, invalid, signature, key }
984
934
  }
985
- }`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{let{neighbourhoodSignal:n}=v(r);t.dispatchSignal(e,n)}})}async addSignalHandler(e,t){let r=Le(this,sr,"f").get(e);r||(r=[],Le(this,sr,"f").set(e,r),await this.subscribeToSignals(e)),r.push(t)}removeSignalHandler(e,t){let r=Le(this,sr,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};Ue=new WeakMap,sr=new WeakMap;var Vn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},j=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},V,Hr,Kr,Qr,bl,zn=`
935
+ }`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{let{neighbourhoodSignal:n}=v(r);t.dispatchSignal(e,n)}})}async addSignalHandler(e,t){let r=Pe(this,lr,"f").get(e);r||(r=[],Pe(this,lr,"f").set(e,r),await this.subscribeToSignals(e)),r.push(t)}removeSignalHandler(e,t){let r=Pe(this,lr,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};je=new WeakMap,lr=new WeakMap;var zn=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},j=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},z,Wr,Gr,Zr,_l,Hn=`
986
936
  author
987
937
  timestamp
988
938
  data {
@@ -994,7 +944,7 @@ data {
994
944
  }
995
945
  }
996
946
  proof { valid, invalid, signature, key }
997
- `,Id=`
947
+ `,kd=`
998
948
  description
999
949
  appName
1000
950
  appUrl
@@ -1003,72 +953,72 @@ trigger
1003
953
  perspectiveIds
1004
954
  webhookUrl
1005
955
  webhookAuth
1006
- `,_l=`
956
+ `,Sl=`
1007
957
  id
1008
958
  granted
1009
- ${Id}
1010
- `,kd=`
1011
- notification { ${_l} }
959
+ ${kd}
960
+ `,Td=`
961
+ notification { ${Sl} }
1012
962
  perspectiveId
1013
963
  triggerMatch
1014
- `,js=class{constructor(e,t=!0){V.set(this,void 0),Hr.set(this,void 0),Kr.set(this,void 0),Qr.set(this,void 0),bl.set(this,void 0),Vn(this,V,e,"f"),Vn(this,Hr,[],"f"),Vn(this,Kr,[],"f"),Vn(this,Qr,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=v(await j(this,V,"f").query({query:m`query runtimeInfo {
964
+ `,Bs=class{constructor(e,t=!0){z.set(this,void 0),Wr.set(this,void 0),Gr.set(this,void 0),Zr.set(this,void 0),_l.set(this,void 0),zn(this,z,e,"f"),zn(this,Wr,[],"f"),zn(this,Gr,[],"f"),zn(this,Zr,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=v(await j(this,z,"f").query({query:m`query runtimeInfo {
1015
965
  runtimeInfo {
1016
966
  ad4mExecutorVersion,
1017
967
  isInitialized,
1018
968
  isUnlocked
1019
969
  }
1020
- }`}));return e}async quit(){return v(await j(this,V,"f").mutate({mutation:m`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeOpenLink($url: String!) {
970
+ }`}));return e}async quit(){return v(await j(this,z,"f").mutate({mutation:m`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeOpenLink($url: String!) {
1021
971
  runtimeOpenLink(url: $url)
1022
- }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=v(await j(this,V,"f").mutate({mutation:m`mutation addTrustedAgents($agents: [String!]!) {
972
+ }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=v(await j(this,z,"f").mutate({mutation:m`mutation addTrustedAgents($agents: [String!]!) {
1023
973
  addTrustedAgents(agents: $agents)
1024
- }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=v(await j(this,V,"f").mutate({mutation:m`mutation deleteTrustedAgents($agents: [String!]!) {
974
+ }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=v(await j(this,z,"f").mutate({mutation:m`mutation deleteTrustedAgents($agents: [String!]!) {
1025
975
  deleteTrustedAgents(agents: $agents)
1026
- }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=v(await j(this,V,"f").query({query:m`query getTrustedAgents {
976
+ }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=v(await j(this,z,"f").query({query:m`query getTrustedAgents {
1027
977
  getTrustedAgents
1028
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
978
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
1029
979
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
1030
- }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
980
+ }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
1031
981
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
1032
- }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=v(await j(this,V,"f").query({query:m`query runtimeKnownLinkLanguageTemplates {
982
+ }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=v(await j(this,z,"f").query({query:m`query runtimeKnownLinkLanguageTemplates {
1033
983
  runtimeKnownLinkLanguageTemplates
1034
- }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeAddFriends($dids: [String!]!) {
984
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeAddFriends($dids: [String!]!) {
1035
985
  runtimeAddFriends(dids: $dids)
1036
- }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeRemoveFriends($dids: [String!]!) {
986
+ }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeRemoveFriends($dids: [String!]!) {
1037
987
  runtimeRemoveFriends(dids: $dids)
1038
- }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=v(await j(this,V,"f").query({query:m`query runtimeFriends {
988
+ }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=v(await j(this,z,"f").query({query:m`query runtimeFriends {
1039
989
  runtimeFriends
1040
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=v(await j(this,V,"f").query({query:m`query runtimeHcAgentInfos {
990
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=v(await j(this,z,"f").query({query:m`query runtimeHcAgentInfos {
1041
991
  runtimeHcAgentInfos
1042
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=v(await j(this,V,"f").query({query:m`query runtimeGetNetworkMetrics {
992
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=v(await j(this,z,"f").query({query:m`query runtimeGetNetworkMetrics {
1043
993
  runtimeGetNetworkMetrics
1044
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeRestartHolochain {
994
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeRestartHolochain {
1045
995
  runtimeRestartHolochain
1046
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
996
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
1047
997
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
1048
- }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=v(await j(this,V,"f").mutate({mutation:m`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
998
+ }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=v(await j(this,z,"f").mutate({mutation:m`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
1049
999
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
1050
- }`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeSetStatus($status: PerspectiveInput!) {
1000
+ }`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeSetStatus($status: PerspectiveInput!) {
1051
1001
  runtimeSetStatus(status: $status)
1052
- }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=v(await j(this,V,"f").query({query:m`query runtimeFriendStatus($did: String!) {
1053
- runtimeFriendStatus(did: $did) { ${zn} }
1054
- }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
1002
+ }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=v(await j(this,z,"f").query({query:m`query runtimeFriendStatus($did: String!) {
1003
+ runtimeFriendStatus(did: $did) { ${Hn} }
1004
+ }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
1055
1005
  runtimeFriendSendMessage(did: $did, message: $message)
1056
- }`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=v(await j(this,V,"f").query({query:m`query runtimeMessageInbox($filter: String) {
1057
- runtimeMessageInbox(filter: $filter) { ${zn} }
1058
- }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=v(await j(this,V,"f").query({query:m`query runtimeMessageOutbox($filter: String) {
1006
+ }`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=v(await j(this,z,"f").query({query:m`query runtimeMessageInbox($filter: String) {
1007
+ runtimeMessageInbox(filter: $filter) { ${Hn} }
1008
+ }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=v(await j(this,z,"f").query({query:m`query runtimeMessageOutbox($filter: String) {
1059
1009
  runtimeMessageOutbox(filter: $filter) {
1060
1010
  recipient,
1061
1011
  message {
1062
- ${zn}
1012
+ ${Hn}
1063
1013
  }
1064
1014
  }
1065
- }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
1015
+ }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
1066
1016
  runtimeRequestInstallNotification(notification: $notification)
1067
- }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeGrantNotification($id: String!) {
1017
+ }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeGrantNotification($id: String!) {
1068
1018
  runtimeGrantNotification(id: $id)
1069
- }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeExportDb($filePath: String!) {
1019
+ }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeExportDb($filePath: String!) {
1070
1020
  runtimeExportDb(filePath: $filePath)
1071
- }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeImportDb($filePath: String!) {
1021
+ }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeImportDb($filePath: String!) {
1072
1022
  runtimeImportDb(filePath: $filePath) {
1073
1023
  perspectives { total imported failed omitted errors }
1074
1024
  links { total imported failed omitted errors }
@@ -1082,51 +1032,51 @@ triggerMatch
1082
1032
  trustedAgents { total imported failed omitted errors }
1083
1033
  knownLinkLanguages { total imported failed omitted errors }
1084
1034
  }
1085
- }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=v(await j(this,V,"f").query({query:m`query runtimeNotifications {
1086
- runtimeNotifications { ${_l} }
1087
- }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
1035
+ }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=v(await j(this,z,"f").query({query:m`query runtimeNotifications {
1036
+ runtimeNotifications { ${Sl} }
1037
+ }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
1088
1038
  runtimeUpdateNotification(id: $id, notification: $notification)
1089
- }`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeRemoveNotification($id: String!) {
1039
+ }`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeRemoveNotification($id: String!) {
1090
1040
  runtimeRemoveNotification(id: $id)
1091
- }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
1041
+ }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
1092
1042
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
1093
- }`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeImportPerspective($filePath: String!) {
1043
+ }`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeImportPerspective($filePath: String!) {
1094
1044
  runtimeImportPerspective(filePath: $filePath)
1095
- }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=v(await j(this,V,"f").query({query:m`query runtimeMultiUserEnabled {
1045
+ }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=v(await j(this,z,"f").query({query:m`query runtimeMultiUserEnabled {
1096
1046
  runtimeMultiUserEnabled
1097
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
1047
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
1098
1048
  runtimeSetMultiUserEnabled(enabled: $enabled)
1099
- }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=v(await j(this,V,"f").query({query:m`query runtimeListUsers {
1049
+ }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=v(await j(this,z,"f").query({query:m`query runtimeListUsers {
1100
1050
  runtimeListUsers {
1101
1051
  email
1102
1052
  did
1103
1053
  lastSeen
1104
1054
  perspectiveCount
1105
1055
  }
1106
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeEmailTestModeEnable {
1056
+ }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeEmailTestModeEnable {
1107
1057
  runtimeEmailTestModeEnable
1108
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeEmailTestModeDisable {
1058
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeEmailTestModeDisable {
1109
1059
  runtimeEmailTestModeDisable
1110
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeEmailTestGetCode($email: String!) {
1060
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeEmailTestGetCode($email: String!) {
1111
1061
  runtimeEmailTestGetCode(email: $email)
1112
- }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeEmailTestClearCodes {
1062
+ }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeEmailTestClearCodes {
1113
1063
  runtimeEmailTestClearCodes
1114
- }`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=v(await j(this,V,"f").mutate({mutation:m`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
1064
+ }`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=v(await j(this,z,"f").mutate({mutation:m`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
1115
1065
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
1116
- }`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}addNotificationTriggeredCallback(e){j(this,Qr,"f").push(e)}subscribeNotificationTriggered(){j(this,V,"f").subscribe({query:m` subscription {
1117
- runtimeNotificationTriggered { ${kd} }
1066
+ }`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}addNotificationTriggeredCallback(e){j(this,Zr,"f").push(e)}subscribeNotificationTriggered(){j(this,z,"f").subscribe({query:m` subscription {
1067
+ runtimeNotificationTriggered { ${Td} }
1118
1068
  }
1119
- `}).subscribe({next:e=>{j(this,Qr,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){j(this,Hr,"f").push(e)}subscribeMessageReceived(){j(this,V,"f").subscribe({query:m` subscription {
1120
- runtimeMessageReceived { ${zn} }
1069
+ `}).subscribe({next:e=>{j(this,Zr,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){j(this,Wr,"f").push(e)}subscribeMessageReceived(){j(this,z,"f").subscribe({query:m` subscription {
1070
+ runtimeMessageReceived { ${Hn} }
1121
1071
  }
1122
- `}).subscribe({next:e=>{j(this,Hr,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){j(this,Kr,"f").push(e)}subscribeExceptionOccurred(){j(this,V,"f").subscribe({query:m` subscription {
1072
+ `}).subscribe({next:e=>{j(this,Wr,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){j(this,Gr,"f").push(e)}subscribeExceptionOccurred(){j(this,z,"f").subscribe({query:m` subscription {
1123
1073
  exceptionOccurred {
1124
1074
  title
1125
1075
  message
1126
1076
  type
1127
1077
  addon
1128
1078
  }
1129
- }`}).subscribe({next:e=>{j(this,Kr,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};V=new WeakMap,Hr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,bl=new WeakMap;var Td=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},tr=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Nt,Bs=class{constructor(e){Nt.set(this,void 0),Td(this,Nt,e,"f")}async get(e,t=!1){if(!t)try{let n=Ce.fromUrl(e).get();if(typeof n=="object"&&n!==null&&"author"in n&&"timestamp"in n&&"data"in n&&"proof"in n)return n}catch{}let{expression:r}=v(await tr(this,Nt,"f").query({query:m`query expression($url: String!) {
1079
+ }`}).subscribe({next:e=>{j(this,Gr,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};z=new WeakMap,Wr=new WeakMap,Gr=new WeakMap,Zr=new WeakMap,_l=new WeakMap;var Cd=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},nr=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Lt,qs=class{constructor(e){Lt.set(this,void 0),Cd(this,Lt,e,"f")}async get(e,t=!1){if(!t)try{let n=Ce.fromUrl(e).get();if(typeof n=="object"&&n!==null&&"author"in n&&"timestamp"in n&&"data"in n&&"proof"in n)return n}catch{}let{expression:r}=v(await nr(this,Lt,"f").query({query:m`query expression($url: String!) {
1130
1080
  expression(url: $url) {
1131
1081
  author
1132
1082
  timestamp
@@ -1139,7 +1089,7 @@ triggerMatch
1139
1089
  invalid
1140
1090
  }
1141
1091
  }
1142
- }`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=v(await tr(this,Nt,"f").query({query:m`query expressionMany($urls: [String!]!) {
1092
+ }`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=v(await nr(this,Lt,"f").query({query:m`query expressionMany($urls: [String!]!) {
1143
1093
  expressionMany(urls: $urls) {
1144
1094
  author
1145
1095
  timestamp
@@ -1152,19 +1102,19 @@ triggerMatch
1152
1102
  invalid
1153
1103
  }
1154
1104
  }
1155
- }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=v(await tr(this,Nt,"f").query({query:m`query expressionRaw($url: String!) {
1105
+ }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=v(await nr(this,Lt,"f").query({query:m`query expressionRaw($url: String!) {
1156
1106
  expressionRaw(url: $url)
1157
- }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=v(await tr(this,Nt,"f").mutate({mutation:m`mutation expressionCreate($content: String!, $languageAddress: String!){
1107
+ }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=v(await nr(this,Lt,"f").mutate({mutation:m`mutation expressionCreate($content: String!, $languageAddress: String!){
1158
1108
  expressionCreate(content: $content, languageAddress: $languageAddress)
1159
- }`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=v(await tr(this,Nt,"f").query({query:m`query expressionInteractions($url: String!) {
1109
+ }`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=v(await nr(this,Lt,"f").query({query:m`query expressionInteractions($url: String!) {
1160
1110
  expressionInteractions(url: $url) {
1161
1111
  label
1162
1112
  name
1163
1113
  parameters { name, type }
1164
1114
  }
1165
- }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=v(await tr(this,Nt,"f").mutate({mutation:m`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
1115
+ }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=v(await nr(this,Lt,"f").mutate({mutation:m`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
1166
1116
  expressionInteract(url: $url, interactionCall: $interactionCall)
1167
- }`,variables:{url:e,interactionCall:t}}));return r}};Nt=new WeakMap;var ja={};ja.byteLength=Nd;ja.toByteArray=Pd;ja.fromByteArray=Dd;var vt=[],nt=[],Cd=typeof Uint8Array<"u"?Uint8Array:Array,hs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pi=0,ec=hs.length;pi<ec;++pi)vt[pi]=hs[pi],nt[hs.charCodeAt(pi)]=pi;var pi,ec;nt["-".charCodeAt(0)]=62;nt["_".charCodeAt(0)]=63;function Sl(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function Nd(i){var e=Sl(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Ld(i,e,t){return(e+t)*3/4-t}function Pd(i){var e,t=Sl(i),r=t[0],n=t[1],a=new Cd(Ld(i,r,n)),s=0,o=n>0?r-4:r,l;for(l=0;l<o;l+=4)e=nt[i.charCodeAt(l)]<<18|nt[i.charCodeAt(l+1)]<<12|nt[i.charCodeAt(l+2)]<<6|nt[i.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=nt[i.charCodeAt(l)]<<2|nt[i.charCodeAt(l+1)]>>4,a[s++]=e&255),n===1&&(e=nt[i.charCodeAt(l)]<<10|nt[i.charCodeAt(l+1)]<<4|nt[i.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Rd(i){return vt[i>>18&63]+vt[i>>12&63]+vt[i>>6&63]+vt[i&63]}function Od(i,e,t){for(var r,n=[],a=e;a<t;a+=3)r=(i[a]<<16&16711680)+(i[a+1]<<8&65280)+(i[a+2]&255),n.push(Rd(r));return n.join("")}function Dd(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(Od(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(vt[e>>2]+vt[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(vt[e>>10]+vt[e>>4&63]+vt[e<<2&63]+"=")),n.join("")}var Md=4,tc=0,ic=1,Ud=2;function wr(i){let e=i.length;for(;--e>=0;)i[e]=0}var Fd=0,wl=1,jd=2,Bd=3,qd=258,oo=29,bn=256,cn=bn+1+oo,ur=30,co=19,El=2*cn+1,Ei=15,gs=16,Vd=7,lo=256,xl=16,Al=17,$l=18,qs=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),ca=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),zd=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Il=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Hd=512,Lt=new Array((cn+2)*2);wr(Lt);var en=new Array(ur*2);wr(en);var ln=new Array(Hd);wr(ln);var un=new Array(qd-Bd+1);wr(un);var uo=new Array(oo);wr(uo);var ka=new Array(ur);wr(ka);function ms(i,e,t,r,n){this.static_tree=i,this.extra_bits=e,this.extra_base=t,this.elems=r,this.max_length=n,this.has_stree=i&&i.length}var kl,Tl,Cl;function ys(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Nl=i=>i<256?ln[i]:ln[256+(i>>>7)],dn=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Ke=(i,e,t)=>{i.bi_valid>gs-t?(i.bi_buf|=e<<i.bi_valid&65535,dn(i,i.bi_buf),i.bi_buf=e>>gs-i.bi_valid,i.bi_valid+=t-gs):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},bt=(i,e,t)=>{Ke(i,t[e*2],t[e*2+1])},Ll=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},Kd=i=>{i.bi_valid===16?(dn(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},Qd=(i,e)=>{let t=e.dyn_tree,r=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,g,h,d,y,_=0;for(h=0;h<=Ei;h++)i.bl_count[h]=0;for(t[i.heap[i.heap_max]*2+1]=0,c=i.heap_max+1;c<El;c++)u=i.heap[c],h=t[t[u*2+1]*2+1]+1,h>l&&(h=l,_++),t[u*2+1]=h,!(u>r)&&(i.bl_count[h]++,d=0,u>=o&&(d=s[u-o]),y=t[u*2],i.opt_len+=y*(h+d),a&&(i.static_len+=y*(n[u*2+1]+d)));if(_!==0){do{for(h=l-1;i.bl_count[h]===0;)h--;i.bl_count[h]--,i.bl_count[h+1]+=2,i.bl_count[l]--,_-=2}while(_>0);for(h=l;h!==0;h--)for(u=i.bl_count[h];u!==0;)g=i.heap[--c],!(g>r)&&(t[g*2+1]!==h&&(i.opt_len+=(h-t[g*2+1])*t[g*2],t[g*2+1]=h),u--)}},Pl=(i,e,t)=>{let r=new Array(Ei+1),n=0,a,s;for(a=1;a<=Ei;a++)n=n+t[a-1]<<1,r[a]=n;for(s=0;s<=e;s++){let o=i[s*2+1];o!==0&&(i[s*2]=Ll(r[o]++,o))}},Wd=()=>{let i,e,t,r,n,a=new Array(Ei+1);for(t=0,r=0;r<oo-1;r++)for(uo[r]=t,i=0;i<1<<qs[r];i++)un[t++]=r;for(un[t-1]=r,n=0,r=0;r<16;r++)for(ka[r]=n,i=0;i<1<<ca[r];i++)ln[n++]=r;for(n>>=7;r<ur;r++)for(ka[r]=n<<7,i=0;i<1<<ca[r]-7;i++)ln[256+n++]=r;for(e=0;e<=Ei;e++)a[e]=0;for(i=0;i<=143;)Lt[i*2+1]=8,i++,a[8]++;for(;i<=255;)Lt[i*2+1]=9,i++,a[9]++;for(;i<=279;)Lt[i*2+1]=7,i++,a[7]++;for(;i<=287;)Lt[i*2+1]=8,i++,a[8]++;for(Pl(Lt,cn+1,a),i=0;i<ur;i++)en[i*2+1]=5,en[i*2]=Ll(i,5);kl=new ms(Lt,qs,bn+1,cn,Ei),Tl=new ms(en,ca,0,ur,Ei),Cl=new ms(new Array(0),zd,0,co,Vd)},Rl=i=>{let e;for(e=0;e<cn;e++)i.dyn_ltree[e*2]=0;for(e=0;e<ur;e++)i.dyn_dtree[e*2]=0;for(e=0;e<co;e++)i.bl_tree[e*2]=0;i.dyn_ltree[lo*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Ol=i=>{i.bi_valid>8?dn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},rc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},vs=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&rc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!rc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},nc=(i,e,t)=>{let r,n,a=0,s,o;if(i.sym_next!==0)do r=i.pending_buf[i.sym_buf+a++]&255,r+=(i.pending_buf[i.sym_buf+a++]&255)<<8,n=i.pending_buf[i.sym_buf+a++],r===0?bt(i,n,e):(s=un[n],bt(i,s+bn+1,e),o=qs[s],o!==0&&(n-=uo[s],Ke(i,n,o)),r--,s=Nl(r),bt(i,s,t),o=ca[s],o!==0&&(r-=ka[s],Ke(i,r,o)));while(a<i.sym_next);bt(i,lo,e)},Vs=(i,e)=>{let t=e.dyn_tree,r=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,s,o,l=-1,c;for(i.heap_len=0,i.heap_max=El,s=0;s<a;s++)t[s*2]!==0?(i.heap[++i.heap_len]=l=s,i.depth[s]=0):t[s*2+1]=0;for(;i.heap_len<2;)c=i.heap[++i.heap_len]=l<2?++l:0,t[c*2]=1,i.depth[c]=0,i.opt_len--,n&&(i.static_len-=r[c*2+1]);for(e.max_code=l,s=i.heap_len>>1;s>=1;s--)vs(i,t,s);c=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],vs(i,t,1),o=i.heap[1],i.heap[--i.heap_max]=s,i.heap[--i.heap_max]=o,t[c*2]=t[s*2]+t[o*2],i.depth[c]=(i.depth[s]>=i.depth[o]?i.depth[s]:i.depth[o])+1,t[s*2+1]=t[o*2+1]=c,i.heap[1]=c++,vs(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],Qd(i,e),Pl(t,l,i.bl_count)},ac=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(t+1)*2+1]=65535,r=0;r<=t;r++)a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)&&(o<c?i.bl_tree[a*2]+=o:a!==0?(a!==n&&i.bl_tree[a*2]++,i.bl_tree[xl*2]++):o<=10?i.bl_tree[Al*2]++:i.bl_tree[$l*2]++,o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))},sc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),r=0;r<=t;r++)if(a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)){if(o<c)do bt(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(bt(i,a,i.bl_tree),o--),bt(i,xl,i.bl_tree),Ke(i,o-3,2)):o<=10?(bt(i,Al,i.bl_tree),Ke(i,o-3,3)):(bt(i,$l,i.bl_tree),Ke(i,o-11,7));o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}},Gd=i=>{let e;for(ac(i,i.dyn_ltree,i.l_desc.max_code),ac(i,i.dyn_dtree,i.d_desc.max_code),Vs(i,i.bl_desc),e=co-1;e>=3&&i.bl_tree[Il[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},Zd=(i,e,t,r)=>{let n;for(Ke(i,e-257,5),Ke(i,t-1,5),Ke(i,r-4,4),n=0;n<r;n++)Ke(i,i.bl_tree[Il[n]*2+1],3);sc(i,i.dyn_ltree,e-1),sc(i,i.dyn_dtree,t-1)},Jd=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return tc;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return ic;for(t=32;t<bn;t++)if(i.dyn_ltree[t*2]!==0)return ic;return tc},oc=!1,Yd=i=>{oc||(Wd(),oc=!0),i.l_desc=new ys(i.dyn_ltree,kl),i.d_desc=new ys(i.dyn_dtree,Tl),i.bl_desc=new ys(i.bl_tree,Cl),i.bi_buf=0,i.bi_valid=0,Rl(i)},Dl=(i,e,t,r)=>{Ke(i,(Fd<<1)+(r?1:0),3),Ol(i),dn(i,t),dn(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},Xd=i=>{Ke(i,wl<<1,3),bt(i,lo,Lt),Kd(i)},ep=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===Ud&&(i.strm.data_type=Jd(i)),Vs(i,i.l_desc),Vs(i,i.d_desc),s=Gd(i),n=i.opt_len+3+7>>>3,a=i.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?Dl(i,e,t,r):i.strategy===Md||a===n?(Ke(i,(wl<<1)+(r?1:0),3),nc(i,Lt,en)):(Ke(i,(jd<<1)+(r?1:0),3),Zd(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),nc(i,i.dyn_ltree,i.dyn_dtree)),Rl(i),r&&Ol(i)},tp=(i,e,t)=>(i.pending_buf[i.sym_buf+i.sym_next++]=e,i.pending_buf[i.sym_buf+i.sym_next++]=e>>8,i.pending_buf[i.sym_buf+i.sym_next++]=t,e===0?i.dyn_ltree[t*2]++:(i.matches++,e--,i.dyn_ltree[(un[t]+bn+1)*2]++,i.dyn_dtree[Nl(e)*2]++),i.sym_next===i.sym_end),ip=Yd,rp=Dl,np=ep,ap=tp,sp=Xd,op={_tr_init:ip,_tr_stored_block:rp,_tr_flush_block:np,_tr_tally:ap,_tr_align:sp},cp=(i,e,t,r)=>{let n=i&65535|0,a=i>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do n=n+e[r++]|0,a=a+n|0;while(--s);n%=65521,a%=65521}return n|a<<16|0},pn=cp,lp=()=>{let i,e=[];for(var t=0;t<256;t++){i=t;for(var r=0;r<8;r++)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i}return e},up=new Uint32Array(lp()),dp=(i,e,t,r)=>{let n=up,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},Ee=dp,Ri={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Vi={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:pp,_tr_stored_block:zs,_tr_flush_block:fp,_tr_tally:Wt,_tr_align:hp}=op,{Z_NO_FLUSH:Gt,Z_PARTIAL_FLUSH:gp,Z_FULL_FLUSH:mp,Z_FINISH:st,Z_BLOCK:cc,Z_OK:ke,Z_STREAM_END:lc,Z_STREAM_ERROR:St,Z_DATA_ERROR:yp,Z_BUF_ERROR:bs,Z_DEFAULT_COMPRESSION:vp,Z_FILTERED:bp,Z_HUFFMAN_ONLY:Hn,Z_RLE:_p,Z_FIXED:Sp,Z_DEFAULT_STRATEGY:wp,Z_UNKNOWN:Ep,Z_DEFLATED:Ba}=Vi,xp=9,Ap=15,$p=8,Ip=29,kp=256,Hs=kp+1+Ip,Tp=30,Cp=19,Np=2*Hs+1,Lp=15,Z=3,zt=258,wt=zt+Z+1,Pp=32,hr=42,po=57,Ks=69,Qs=73,Ws=91,Gs=103,xi=113,Wr=666,je=1,Er=2,Oi=3,xr=4,Rp=3,Ai=(i,e)=>(i.msg=Ri[e],e),uc=i=>i*2-(i>4?9:0),Vt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},Op=i=>{let e,t,r,n=i.w_size;e=i.hash_size,r=e;do t=i.head[--r],i.head[r]=t>=n?t-n:0;while(--e);e=n,r=e;do t=i.prev[--r],i.prev[r]=t>=n?t-n:0;while(--e)},Dp=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,Zt=Dp,Ge=i=>{let e=i.state,t=e.pending;t>i.avail_out&&(t=i.avail_out),t!==0&&(i.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),i.next_out),i.next_out+=t,e.pending_out+=t,i.total_out+=t,i.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Je=(i,e)=>{fp(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Ge(i.strm)},te=(i,e)=>{i.pending_buf[i.pending++]=e},Pr=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},Zs=(i,e,t,r)=>{let n=i.avail_in;return n>r&&(n=r),n===0?0:(i.avail_in-=n,e.set(i.input.subarray(i.next_in,i.next_in+n),t),i.state.wrap===1?i.adler=pn(i.adler,e,n,t):i.state.wrap===2&&(i.adler=Ee(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},Ml=(i,e)=>{let t=i.max_chain_length,r=i.strstart,n,a,s=i.prev_length,o=i.nice_match,l=i.strstart>i.w_size-wt?i.strstart-(i.w_size-wt):0,c=i.window,u=i.w_mask,g=i.prev,h=i.strstart+zt,d=c[r+s-1],y=c[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(c[n+s]!==y||c[n+s-1]!==d||c[n]!==c[r]||c[++n]!==c[r+1])){r+=2,n++;do;while(c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&r<h);if(a=zt-(h-r),r=h-zt,a>s){if(i.match_start=e,s=a,a>=o)break;d=c[r+s-1],y=c[r+s]}}while((e=g[e&u])>l&&--t!==0);return s<=i.lookahead?s:i.lookahead},gr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-wt)&&(i.window.set(i.window.subarray(e,e+e-r),0),i.match_start-=e,i.strstart-=e,i.block_start-=e,i.insert>i.strstart&&(i.insert=i.strstart),Op(i),r+=e),i.strm.avail_in===0)break;if(t=Zs(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=Z)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=Zt(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=Zt(i,i.ins_h,i.window[n+Z-1]),i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++,i.insert--,!(i.lookahead+i.insert<Z)););}while(i.lookahead<wt&&i.strm.avail_in!==0)},Ul=(i,e)=>{let t=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,r,n,a,s=0,o=i.strm.avail_in;do{if(r=65535,a=i.bi_valid+42>>3,i.strm.avail_out<a||(a=i.strm.avail_out-a,n=i.strstart-i.block_start,r>n+i.strm.avail_in&&(r=n+i.strm.avail_in),r>a&&(r=a),r<t&&(r===0&&e!==st||e===Gt||r!==n+i.strm.avail_in)))break;s=e===st&&r===n+i.strm.avail_in?1:0,zs(i,0,0,s),i.pending_buf[i.pending-4]=r,i.pending_buf[i.pending-3]=r>>8,i.pending_buf[i.pending-2]=~r,i.pending_buf[i.pending-1]=~r>>8,Ge(i.strm),n&&(n>r&&(n=r),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+n),i.strm.next_out),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n,i.block_start+=n,r-=n),r&&(Zs(i.strm,i.strm.output,i.strm.next_out,r),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r)}while(s===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),s?xr:e!==Gt&&e!==st&&i.strm.avail_in===0&&i.strstart===i.block_start?Er:(a=i.window_size-i.strstart,i.strm.avail_in>a&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,a+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),a>i.strm.avail_in&&(a=i.strm.avail_in),a&&(Zs(i.strm,i.window,i.strstart,a),i.strstart+=a,i.insert+=a>i.w_size-i.insert?i.w_size-i.insert:a),i.high_water<i.strstart&&(i.high_water=i.strstart),a=i.bi_valid+42>>3,a=i.pending_buf_size-a>65535?65535:i.pending_buf_size-a,t=a>i.w_size?i.w_size:a,n=i.strstart-i.block_start,(n>=t||(n||e===st)&&e!==Gt&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===st&&i.strm.avail_in===0&&r===n?1:0,zs(i,i.block_start,r,s),i.block_start+=r,Ge(i.strm)),s?Oi:je)},_s=(i,e)=>{let t,r;for(;;){if(i.lookahead<wt){if(gr(i),i.lookahead<wt&&e===Gt)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=Z&&(i.ins_h=Zt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),t!==0&&i.strstart-t<=i.w_size-wt&&(i.match_length=Ml(i,t)),i.match_length>=Z)if(r=Wt(i,i.strstart-i.match_start,i.match_length-Z),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=Z){i.match_length--;do i.strstart++,i.ins_h=Zt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=Zt(i,i.ins_h,i.window[i.strstart+1]);else r=Wt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(Je(i,!1),i.strm.avail_out===0))return je}return i.insert=i.strstart<Z-1?i.strstart:Z-1,e===st?(Je(i,!0),i.strm.avail_out===0?Oi:xr):i.sym_next&&(Je(i,!1),i.strm.avail_out===0)?je:Er},ir=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<wt){if(gr(i),i.lookahead<wt&&e===Gt)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=Z&&(i.ins_h=Zt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=Z-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-wt&&(i.match_length=Ml(i,t),i.match_length<=5&&(i.strategy===bp||i.match_length===Z&&i.strstart-i.match_start>4096)&&(i.match_length=Z-1)),i.prev_length>=Z&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-Z,r=Wt(i,i.strstart-1-i.prev_match,i.prev_length-Z),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=Zt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=Z-1,i.strstart++,r&&(Je(i,!1),i.strm.avail_out===0))return je}else if(i.match_available){if(r=Wt(i,0,i.window[i.strstart-1]),r&&Je(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return je}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(r=Wt(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<Z-1?i.strstart:Z-1,e===st?(Je(i,!0),i.strm.avail_out===0?Oi:xr):i.sym_next&&(Je(i,!1),i.strm.avail_out===0)?je:Er},Mp=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=zt){if(gr(i),i.lookahead<=zt&&e===Gt)return je;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=Z&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+zt;do;while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<a);i.match_length=zt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=Z?(t=Wt(i,1,i.match_length-Z),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=Wt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(Je(i,!1),i.strm.avail_out===0))return je}return i.insert=0,e===st?(Je(i,!0),i.strm.avail_out===0?Oi:xr):i.sym_next&&(Je(i,!1),i.strm.avail_out===0)?je:Er},Up=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(gr(i),i.lookahead===0)){if(e===Gt)return je;break}if(i.match_length=0,t=Wt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(Je(i,!1),i.strm.avail_out===0))return je}return i.insert=0,e===st?(Je(i,!0),i.strm.avail_out===0?Oi:xr):i.sym_next&&(Je(i,!1),i.strm.avail_out===0)?je:Er};function ht(i,e,t,r,n){this.good_length=i,this.max_lazy=e,this.nice_length=t,this.max_chain=r,this.func=n}var Gr=[new ht(0,0,0,0,Ul),new ht(4,4,8,4,_s),new ht(4,5,16,8,_s),new ht(4,6,32,32,_s),new ht(4,4,16,16,ir),new ht(8,16,32,32,ir),new ht(8,16,128,128,ir),new ht(8,32,128,256,ir),new ht(32,128,258,1024,ir),new ht(32,258,258,4096,ir)],Fp=i=>{i.window_size=2*i.w_size,Vt(i.head),i.max_lazy_match=Gr[i.level].max_lazy,i.good_match=Gr[i.level].good_length,i.nice_match=Gr[i.level].nice_length,i.max_chain_length=Gr[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=Z-1,i.match_available=0,i.ins_h=0};function jp(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Ba,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Np*2),this.dyn_dtree=new Uint16Array((2*Tp+1)*2),this.bl_tree=new Uint16Array((2*Cp+1)*2),Vt(this.dyn_ltree),Vt(this.dyn_dtree),Vt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Lp+1),this.heap=new Uint16Array(2*Hs+1),Vt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Hs+1),Vt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var _n=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==hr&&e.status!==po&&e.status!==Ks&&e.status!==Qs&&e.status!==Ws&&e.status!==Gs&&e.status!==xi&&e.status!==Wr?1:0},Fl=i=>{if(_n(i))return Ai(i,St);i.total_in=i.total_out=0,i.data_type=Ep;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?po:e.wrap?hr:xi,i.adler=e.wrap===2?0:1,e.last_flush=-2,pp(e),ke},jl=i=>{let e=Fl(i);return e===ke&&Fp(i.state),e},Bp=(i,e)=>_n(i)||i.state.wrap!==2?St:(i.state.gzhead=e,ke),Bl=(i,e,t,r,n,a)=>{if(!i)return St;let s=1;if(e===vp&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>xp||t!==Ba||r<8||r>15||e<0||e>9||a<0||a>Sp||r===8&&s!==1)return Ai(i,St);r===8&&(r=9);let o=new jp;return i.state=o,o.strm=i,o.status=hr,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Z-1)/Z),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=e,o.strategy=a,o.method=t,jl(i)},qp=(i,e)=>Bl(i,e,Ba,Ap,$p,wp),Vp=(i,e)=>{if(_n(i)||e>cc||e<0)return i?Ai(i,St):St;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===Wr&&e!==st)return Ai(i,i.avail_out===0?bs:St);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ge(i),i.avail_out===0)return t.last_flush=-1,ke}else if(i.avail_in===0&&uc(e)<=uc(r)&&e!==st)return Ai(i,bs);if(t.status===Wr&&i.avail_in!==0)return Ai(i,bs);if(t.status===hr&&t.wrap===0&&(t.status=xi),t.status===hr){let n=Ba+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Hn||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Pp),n+=31-n%31,Pr(t,n),t.strstart!==0&&(Pr(t,i.adler>>>16),Pr(t,i.adler&65535)),i.adler=1,t.status=xi,Ge(i),t.pending!==0)return t.last_flush=-1,ke}if(t.status===po){if(i.adler=0,te(t,31),te(t,139),te(t,8),t.gzhead)te(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),te(t,t.gzhead.time&255),te(t,t.gzhead.time>>8&255),te(t,t.gzhead.time>>16&255),te(t,t.gzhead.time>>24&255),te(t,t.level===9?2:t.strategy>=Hn||t.level<2?4:0),te(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(te(t,t.gzhead.extra.length&255),te(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=Ee(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Ks;else if(te(t,0),te(t,0),te(t,0),te(t,0),te(t,0),te(t,t.level===9?2:t.strategy>=Hn||t.level<2?4:0),te(t,Rp),t.status=xi,Ge(i),t.pending!==0)return t.last_flush=-1,ke}if(t.status===Ks){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,Ge(i),t.pending!==0)return t.last_flush=-1,ke;n=0,a-=o}let s=new Uint8Array(t.gzhead.extra);t.pending_buf.set(s.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Qs}if(t.status===Qs){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),Ge(i),t.pending!==0)return t.last_flush=-1,ke;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,te(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Ws}if(t.status===Ws){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n)),Ge(i),t.pending!==0)return t.last_flush=-1,ke;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,te(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=Ee(i.adler,t.pending_buf,t.pending-n,n))}t.status=Gs}if(t.status===Gs){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ge(i),t.pending!==0))return t.last_flush=-1,ke;te(t,i.adler&255),te(t,i.adler>>8&255),i.adler=0}if(t.status=xi,Ge(i),t.pending!==0)return t.last_flush=-1,ke}if(i.avail_in!==0||t.lookahead!==0||e!==Gt&&t.status!==Wr){let n=t.level===0?Ul(t,e):t.strategy===Hn?Up(t,e):t.strategy===_p?Mp(t,e):Gr[t.level].func(t,e);if((n===Oi||n===xr)&&(t.status=Wr),n===je||n===Oi)return i.avail_out===0&&(t.last_flush=-1),ke;if(n===Er&&(e===gp?hp(t):e!==cc&&(zs(t,0,0,!1),e===mp&&(Vt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ge(i),i.avail_out===0))return t.last_flush=-1,ke}return e!==st?ke:t.wrap<=0?lc:(t.wrap===2?(te(t,i.adler&255),te(t,i.adler>>8&255),te(t,i.adler>>16&255),te(t,i.adler>>24&255),te(t,i.total_in&255),te(t,i.total_in>>8&255),te(t,i.total_in>>16&255),te(t,i.total_in>>24&255)):(Pr(t,i.adler>>>16),Pr(t,i.adler&65535)),Ge(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?ke:lc)},zp=i=>{if(_n(i))return St;let e=i.state.status;return i.state=null,e===xi?Ai(i,yp):ke},Hp=(i,e)=>{let t=e.length;if(_n(i))return St;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==hr||r.lookahead)return St;if(n===1&&(i.adler=pn(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(Vt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(e.subarray(t-r.w_size,t),0),e=l,t=r.w_size}let a=i.avail_in,s=i.next_in,o=i.input;for(i.avail_in=t,i.next_in=0,i.input=e,gr(r);r.lookahead>=Z;){let l=r.strstart,c=r.lookahead-(Z-1);do r.ins_h=Zt(r,r.ins_h,r.window[l+Z-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--c);r.strstart=l,r.lookahead=Z-1,gr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Z-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,ke},Kp=qp,Qp=Bl,Wp=jl,Gp=Fl,Zp=Bp,Jp=Vp,Yp=zp,Xp=Hp,ef="pako deflate (from Nodeca project)",tn={deflateInit:Kp,deflateInit2:Qp,deflateReset:Wp,deflateResetKeep:Gp,deflateSetHeader:Zp,deflate:Jp,deflateEnd:Yp,deflateSetDictionary:Xp,deflateInfo:ef},tf=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),rf=function(i){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let r in t)tf(t,r)&&(i[r]=t[r])}}return i},nf=i=>{let e=0;for(let r=0,n=i.length;r<n;r++)e+=i[r].length;let t=new Uint8Array(e);for(let r=0,n=0,a=i.length;r<a;r++){let s=i[r];t.set(s,n),n+=s.length}return t},qa={assign:rf,flattenChunks:nf},ql=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){ql=!1}var fn=new Uint8Array(256);for(let i=0;i<256;i++)fn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;fn[254]=fn[254]=1;var af=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let e,t,r,n,a,s=i.length,o=0;for(n=0;n<s;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),o+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(o),a=0,n=0;a<o;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},sf=(i,e)=>{if(e<65534&&i.subarray&&ql)return String.fromCharCode.apply(null,i.length===e?i:i.subarray(0,e));let t="";for(let r=0;r<e;r++)t+=String.fromCharCode(i[r]);return t},of=(i,e)=>{let t=e||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,e));let r,n,a=new Array(t*2);for(n=0,r=0;r<t;){let s=i[r++];if(s<128){a[n++]=s;continue}let o=fn[s];if(o>4){a[n++]=65533,r+=o-1;continue}for(s&=o===2?31:o===3?15:7;o>1&&r<t;)s=s<<6|i[r++]&63,o--;if(o>1){a[n++]=65533;continue}s<65536?a[n++]=s:(s-=65536,a[n++]=55296|s>>10&1023,a[n++]=56320|s&1023)}return sf(a,n)},cf=(i,e)=>{e=e||i.length,e>i.length&&(e=i.length);let t=e-1;for(;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+fn[i[t]]>e?t:e},hn={string2buf:af,buf2string:of,utf8border:cf};function lf(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Vl=lf,zl=Object.prototype.toString,{Z_NO_FLUSH:uf,Z_SYNC_FLUSH:df,Z_FULL_FLUSH:pf,Z_FINISH:ff,Z_OK:Ta,Z_STREAM_END:hf,Z_DEFAULT_COMPRESSION:gf,Z_DEFAULT_STRATEGY:mf,Z_DEFLATED:yf}=Vi;function Sn(i){this.options=qa.assign({level:gf,method:yf,chunkSize:16384,windowBits:15,memLevel:8,strategy:mf},i||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Vl,this.strm.avail_out=0;let t=tn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Ta)throw new Error(Ri[t]);if(e.header&&tn.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=hn.string2buf(e.dictionary):zl.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=tn.deflateSetDictionary(this.strm,r),t!==Ta)throw new Error(Ri[t]);this._dict_set=!0}}Sn.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?ff:uf,typeof i=="string"?t.input=hn.string2buf(i):zl.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(a===df||a===pf)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=tn.deflate(t,a),n===hf)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=tn.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Ta;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Sn.prototype.onData=function(i){this.chunks.push(i)};Sn.prototype.onEnd=function(i){i===Ta&&(this.result=qa.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function fo(i,e){let t=new Sn(e);if(t.push(i,!0),t.err)throw t.msg||Ri[t.err];return t.result}function vf(i,e){return e=e||{},e.raw=!0,fo(i,e)}function bf(i,e){return e=e||{},e.gzip=!0,fo(i,e)}var _f=Sn,Sf=fo,wf=vf,Ef=bf,xf=Vi,Af={Deflate:_f,deflate:Sf,deflateRaw:wf,gzip:Ef,constants:xf},Kn=16209,$f=16191,If=function i(e,t){let r,n,a,s,o,l,c,u,g,h,d,y,_,E,$,T,C,A,k,J,I,R,O,P,D=e.state;r=e.next_in,O=e.input,n=r+(e.avail_in-5),a=e.next_out,P=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),l=D.dmax,c=D.wsize,u=D.whave,g=D.wnext,h=D.window,d=D.hold,y=D.bits,_=D.lencode,E=D.distcode,$=(1<<D.lenbits)-1,T=(1<<D.distbits)-1;e:do{y<15&&(d+=O[r++]<<y,y+=8,d+=O[r++]<<y,y+=8),C=_[d&$];t:for(;;){if(A=C>>>24,d>>>=A,y-=A,A=C>>>16&255,A===0)P[a++]=C&65535;else if(A&16){k=C&65535,A&=15,A&&(y<A&&(d+=O[r++]<<y,y+=8),k+=d&(1<<A)-1,d>>>=A,y-=A),y<15&&(d+=O[r++]<<y,y+=8,d+=O[r++]<<y,y+=8),C=E[d&T];i:for(;;){if(A=C>>>24,d>>>=A,y-=A,A=C>>>16&255,A&16){if(J=C&65535,A&=15,y<A&&(d+=O[r++]<<y,y+=8,y<A&&(d+=O[r++]<<y,y+=8)),J+=d&(1<<A)-1,J>l){e.msg="invalid distance too far back",D.mode=Kn;break e}if(d>>>=A,y-=A,A=a-s,J>A){if(A=J-A,A>u&&D.sane){e.msg="invalid distance too far back",D.mode=Kn;break e}if(I=0,R=h,g===0){if(I+=c-A,A<k){k-=A;do P[a++]=h[I++];while(--A);I=a-J,R=P}}else if(g<A){if(I+=c+g-A,A-=g,A<k){k-=A;do P[a++]=h[I++];while(--A);if(I=0,g<k){A=g,k-=A;do P[a++]=h[I++];while(--A);I=a-J,R=P}}}else if(I+=g-A,A<k){k-=A;do P[a++]=h[I++];while(--A);I=a-J,R=P}for(;k>2;)P[a++]=R[I++],P[a++]=R[I++],P[a++]=R[I++],k-=3;k&&(P[a++]=R[I++],k>1&&(P[a++]=R[I++]))}else{I=a-J;do P[a++]=P[I++],P[a++]=P[I++],P[a++]=P[I++],k-=3;while(k>2);k&&(P[a++]=P[I++],k>1&&(P[a++]=P[I++]))}}else if((A&64)===0){C=E[(C&65535)+(d&(1<<A)-1)];continue i}else{e.msg="invalid distance code",D.mode=Kn;break e}break}}else if((A&64)===0){C=_[(C&65535)+(d&(1<<A)-1)];continue t}else if(A&32){D.mode=$f;break e}else{e.msg="invalid literal/length code",D.mode=Kn;break e}break}}while(r<n&&a<o);k=y>>3,r-=k,y-=k<<3,d&=(1<<y)-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?5+(n-r):5-(r-n),e.avail_out=a<o?257+(o-a):257-(a-o),D.hold=d,D.bits=y},rr=15,dc=852,pc=592,fc=0,Ss=1,hc=2,kf=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Tf=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Cf=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Nf=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Lf=(i,e,t,r,n,a,s,o)=>{let l=o.bits,c=0,u=0,g=0,h=0,d=0,y=0,_=0,E=0,$=0,T=0,C,A,k,J,I,R=null,O,P=new Uint16Array(rr+1),D=new Uint16Array(rr+1),he=null,bo,xn,An;for(c=0;c<=rr;c++)P[c]=0;for(u=0;u<r;u++)P[e[t+u]]++;for(d=l,h=rr;h>=1&&P[h]===0;h--);if(d>h&&(d=h),h===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(g=1;g<h&&P[g]===0;g++);for(d<g&&(d=g),E=1,c=1;c<=rr;c++)if(E<<=1,E-=P[c],E<0)return-1;if(E>0&&(i===fc||h!==1))return-1;for(D[1]=0,c=1;c<rr;c++)D[c+1]=D[c]+P[c];for(u=0;u<r;u++)e[t+u]!==0&&(s[D[e[t+u]]++]=u);if(i===fc?(R=he=s,O=20):i===Ss?(R=kf,he=Tf,O=257):(R=Cf,he=Nf,O=0),T=0,u=0,c=g,I=a,y=d,_=0,k=-1,$=1<<d,J=$-1,i===Ss&&$>dc||i===hc&&$>pc)return 1;for(;;){bo=c-_,s[u]+1<O?(xn=0,An=s[u]):s[u]>=O?(xn=he[s[u]-O],An=R[s[u]-O]):(xn=32+64,An=0),C=1<<c-_,A=1<<y,g=A;do A-=C,n[I+(T>>_)+A]=bo<<24|xn<<16|An|0;while(A!==0);for(C=1<<c-1;T&C;)C>>=1;if(C!==0?(T&=C-1,T+=C):T=0,u++,--P[c]===0){if(c===h)break;c=e[t+s[u]]}if(c>d&&(T&J)!==k){for(_===0&&(_=d),I+=g,y=c-_,E=1<<y;y+_<h&&(E-=P[y+_],!(E<=0));)y++,E<<=1;if($+=1<<y,i===Ss&&$>dc||i===hc&&$>pc)return 1;k=T&J,n[k]=d<<24|y<<16|I-a|0}}return T!==0&&(n[I+T]=c-_<<24|64<<16|0),o.bits=d,0},rn=Lf,Pf=0,Hl=1,Kl=2,{Z_FINISH:gc,Z_BLOCK:Rf,Z_TREES:Qn,Z_OK:Di,Z_STREAM_END:Of,Z_NEED_DICT:Df,Z_STREAM_ERROR:ot,Z_DATA_ERROR:Ql,Z_MEM_ERROR:Wl,Z_BUF_ERROR:Mf,Z_DEFLATED:mc}=Vi,Va=16180,yc=16181,vc=16182,bc=16183,_c=16184,Sc=16185,wc=16186,Ec=16187,xc=16188,Ac=16189,Ca=16190,kt=16191,ws=16192,$c=16193,Es=16194,Ic=16195,kc=16196,Tc=16197,Cc=16198,Wn=16199,Gn=16200,Nc=16201,Lc=16202,Pc=16203,Rc=16204,Oc=16205,xs=16206,Dc=16207,Mc=16208,ce=16209,Gl=16210,Zl=16211,Uf=852,Ff=592,jf=15,Bf=jf,Uc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function qf(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var zi=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<Va||e.mode>Zl?1:0},Jl=i=>{if(zi(i))return ot;let e=i.state;return i.total_in=i.total_out=e.total=0,i.msg="",e.wrap&&(i.adler=e.wrap&1),e.mode=Va,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(Uf),e.distcode=e.distdyn=new Int32Array(Ff),e.sane=1,e.back=-1,Di},Yl=i=>{if(zi(i))return ot;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,Jl(i)},Xl=(i,e)=>{let t;if(zi(i))return ot;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?ot:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,Yl(i))},eu=(i,e)=>{if(!i)return ot;let t=new qf;i.state=t,t.strm=i,t.window=null,t.mode=Va;let r=Xl(i,e);return r!==Di&&(i.state=null),r},Vf=i=>eu(i,Bf),Fc=!0,As,$s,zf=i=>{if(Fc){As=new Int32Array(512),$s=new Int32Array(32);let e=0;for(;e<144;)i.lens[e++]=8;for(;e<256;)i.lens[e++]=9;for(;e<280;)i.lens[e++]=7;for(;e<288;)i.lens[e++]=8;for(rn(Hl,i.lens,0,288,As,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;rn(Kl,i.lens,0,32,$s,0,i.work,{bits:5}),Fc=!1}i.lencode=As,i.lenbits=9,i.distcode=$s,i.distbits=5},tu=(i,e,t,r)=>{let n,a=i.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>r&&(n=r),a.window.set(e.subarray(t-r,t-r+n),a.wnext),r-=n,r?(a.window.set(e.subarray(t-r,t),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},Hf=(i,e)=>{let t,r,n,a,s,o,l,c,u,g,h,d,y,_,E=0,$,T,C,A,k,J,I,R,O=new Uint8Array(4),P,D,he=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(zi(i)||!i.output||!i.input&&i.avail_in!==0)return ot;t=i.state,t.mode===kt&&(t.mode=ws),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,g=o,h=l,R=Di;e:for(;;)switch(t.mode){case Va:if(t.wrap===0){t.mode=ws;break}for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&2&&c===35615){t.wbits===0&&(t.wbits=15),t.check=0,O[0]=c&255,O[1]=c>>>8&255,t.check=Ee(t.check,O,2,0),c=0,u=0,t.mode=yc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=ce;break}if((c&15)!==mc){i.msg="unknown compression method",t.mode=ce;break}if(c>>>=4,u-=4,I=(c&15)+8,t.wbits===0&&(t.wbits=I),I>15||I>t.wbits){i.msg="invalid window size",t.mode=ce;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=c&512?Ac:kt,c=0,u=0;break;case yc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==mc){i.msg="unknown compression method",t.mode=ce;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=ce;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&t.wrap&4&&(O[0]=c&255,O[1]=c>>>8&255,t.check=Ee(t.check,O,2,0)),c=0,u=0,t.mode=vc;case vc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.time=c),t.flags&512&&t.wrap&4&&(O[0]=c&255,O[1]=c>>>8&255,O[2]=c>>>16&255,O[3]=c>>>24&255,t.check=Ee(t.check,O,4,0)),c=0,u=0,t.mode=bc;case bc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.xflags=c&255,t.head.os=c>>8),t.flags&512&&t.wrap&4&&(O[0]=c&255,O[1]=c>>>8&255,t.check=Ee(t.check,O,2,0)),c=0,u=0,t.mode=_c;case _c:if(t.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length=c,t.head&&(t.head.extra_len=c),t.flags&512&&t.wrap&4&&(O[0]=c&255,O[1]=c>>>8&255,t.check=Ee(t.check,O,2,0)),c=0,u=0}else t.head&&(t.head.extra=null);t.mode=Sc;case Sc:if(t.flags&1024&&(d=t.length,d>o&&(d=o),d&&(t.head&&(I=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(a,a+d),I)),t.flags&512&&t.wrap&4&&(t.check=Ee(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=wc;case wc:if(t.flags&2048){if(o===0)break e;d=0;do I=r[a+d++],t.head&&I&&t.length<65536&&(t.head.name+=String.fromCharCode(I));while(I&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=Ee(t.check,r,d,a)),o-=d,a+=d,I)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Ec;case Ec:if(t.flags&4096){if(o===0)break e;d=0;do I=r[a+d++],t.head&&I&&t.length<65536&&(t.head.comment+=String.fromCharCode(I));while(I&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=Ee(t.check,r,d,a)),o-=d,a+=d,I)break e}else t.head&&(t.head.comment=null);t.mode=xc;case xc:if(t.flags&512){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.check&65535)){i.msg="header crc mismatch",t.mode=ce;break}c=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=kt;break;case Ac:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}i.adler=t.check=Uc(c),c=0,u=0,t.mode=Ca;case Ca:if(t.havedict===0)return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,Df;i.adler=t.check=1,t.mode=kt;case kt:if(e===Rf||e===Qn)break e;case ws:if(t.last){c>>>=u&7,u-=u&7,t.mode=xs;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}switch(t.last=c&1,c>>>=1,u-=1,c&3){case 0:t.mode=$c;break;case 1:if(zf(t),t.mode=Wn,e===Qn){c>>>=2,u-=2;break e}break;case 2:t.mode=kc;break;case 3:i.msg="invalid block type",t.mode=ce}c>>>=2,u-=2;break;case $c:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){i.msg="invalid stored block lengths",t.mode=ce;break}if(t.length=c&65535,c=0,u=0,t.mode=Es,e===Qn)break e;case Es:t.mode=Ic;case Ic:if(d=t.length,d){if(d>o&&(d=o),d>l&&(d=l),d===0)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,l-=d,s+=d,t.length-=d;break}t.mode=kt;break;case kc:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.nlen=(c&31)+257,c>>>=5,u-=5,t.ndist=(c&31)+1,c>>>=5,u-=5,t.ncode=(c&15)+4,c>>>=4,u-=4,t.nlen>286||t.ndist>30){i.msg="too many length or distance symbols",t.mode=ce;break}t.have=0,t.mode=Tc;case Tc:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.lens[he[t.have++]]=c&7,c>>>=3,u-=3}for(;t.have<19;)t.lens[he[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,P={bits:t.lenbits},R=rn(Pf,t.lens,0,19,t.lencode,0,t.work,P),t.lenbits=P.bits,R){i.msg="invalid code lengths set",t.mode=ce;break}t.have=0,t.mode=Cc;case Cc:for(;t.have<t.nlen+t.ndist;){for(;E=t.lencode[c&(1<<t.lenbits)-1],$=E>>>24,T=E>>>16&255,C=E&65535,!($<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(C<16)c>>>=$,u-=$,t.lens[t.have++]=C;else{if(C===16){for(D=$+2;u<D;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(c>>>=$,u-=$,t.have===0){i.msg="invalid bit length repeat",t.mode=ce;break}I=t.lens[t.have-1],d=3+(c&3),c>>>=2,u-=2}else if(C===17){for(D=$+3;u<D;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=$,u-=$,I=0,d=3+(c&7),c>>>=3,u-=3}else{for(D=$+7;u<D;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=$,u-=$,I=0,d=11+(c&127),c>>>=7,u-=7}if(t.have+d>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=ce;break}for(;d--;)t.lens[t.have++]=I}}if(t.mode===ce)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=ce;break}if(t.lenbits=9,P={bits:t.lenbits},R=rn(Hl,t.lens,0,t.nlen,t.lencode,0,t.work,P),t.lenbits=P.bits,R){i.msg="invalid literal/lengths set",t.mode=ce;break}if(t.distbits=6,t.distcode=t.distdyn,P={bits:t.distbits},R=rn(Kl,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,P),t.distbits=P.bits,R){i.msg="invalid distances set",t.mode=ce;break}if(t.mode=Wn,e===Qn)break e;case Wn:t.mode=Gn;case Gn:if(o>=6&&l>=258){i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,If(i,h),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,t.mode===kt&&(t.back=-1);break}for(t.back=0;E=t.lencode[c&(1<<t.lenbits)-1],$=E>>>24,T=E>>>16&255,C=E&65535,!($<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(T&&(T&240)===0){for(A=$,k=T,J=C;E=t.lencode[J+((c&(1<<A+k)-1)>>A)],$=E>>>24,T=E>>>16&255,C=E&65535,!(A+$<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=A,u-=A,t.back+=A}if(c>>>=$,u-=$,t.back+=$,t.length=C,T===0){t.mode=Oc;break}if(T&32){t.back=-1,t.mode=kt;break}if(T&64){i.msg="invalid literal/length code",t.mode=ce;break}t.extra=T&15,t.mode=Nc;case Nc:if(t.extra){for(D=t.extra;u<D;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Lc;case Lc:for(;E=t.distcode[c&(1<<t.distbits)-1],$=E>>>24,T=E>>>16&255,C=E&65535,!($<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((T&240)===0){for(A=$,k=T,J=C;E=t.distcode[J+((c&(1<<A+k)-1)>>A)],$=E>>>24,T=E>>>16&255,C=E&65535,!(A+$<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=A,u-=A,t.back+=A}if(c>>>=$,u-=$,t.back+=$,T&64){i.msg="invalid distance code",t.mode=ce;break}t.offset=C,t.extra=T&15,t.mode=Pc;case Pc:if(t.extra){for(D=t.extra;u<D;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.offset+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){i.msg="invalid distance too far back",t.mode=ce;break}t.mode=Rc;case Rc:if(l===0)break e;if(d=h-l,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=ce;break}d>t.wnext?(d-=t.wnext,y=t.wsize-d):y=t.wnext-d,d>t.length&&(d=t.length),_=t.window}else _=n,y=s-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do n[s++]=_[y++];while(--d);t.length===0&&(t.mode=Gn);break;case Oc:if(l===0)break e;n[s++]=t.length,l--,t.mode=Gn;break;case xs:if(t.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<<u,u+=8}if(h-=l,i.total_out+=h,t.total+=h,t.wrap&4&&h&&(i.adler=t.check=t.flags?Ee(t.check,n,h,s-h):pn(t.check,n,h,s-h)),h=l,t.wrap&4&&(t.flags?c:Uc(c))!==t.check){i.msg="incorrect data check",t.mode=ce;break}c=0,u=0}t.mode=Dc;case Dc:if(t.wrap&&t.flags){for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=ce;break}c=0,u=0}t.mode=Mc;case Mc:R=Of;break e;case ce:R=Ql;break e;case Gl:return Wl;case Zl:default:return ot}return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,(t.wsize||h!==i.avail_out&&t.mode<ce&&(t.mode<xs||e!==gc))&&tu(i,i.output,i.next_out,h-i.avail_out),g-=i.avail_in,h-=i.avail_out,i.total_in+=g,i.total_out+=h,t.total+=h,t.wrap&4&&h&&(i.adler=t.check=t.flags?Ee(t.check,n,h,i.next_out-h):pn(t.check,n,h,i.next_out-h)),i.data_type=t.bits+(t.last?64:0)+(t.mode===kt?128:0)+(t.mode===Wn||t.mode===Es?256:0),(g===0&&h===0||e===gc)&&R===Di&&(R=Mf),R},Kf=i=>{if(zi(i))return ot;let e=i.state;return e.window&&(e.window=null),i.state=null,Di},Qf=(i,e)=>{if(zi(i))return ot;let t=i.state;return(t.wrap&2)===0?ot:(t.head=e,e.done=!1,Di)},Wf=(i,e)=>{let t=e.length,r,n,a;return zi(i)||(r=i.state,r.wrap!==0&&r.mode!==Ca)?ot:r.mode===Ca&&(n=1,n=pn(n,e,t,0),n!==r.check)?Ql:(a=tu(i,e,t,t),a?(r.mode=Gl,Wl):(r.havedict=1,Di))},Gf=Yl,Zf=Xl,Jf=Jl,Yf=Vf,Xf=eu,eh=Hf,th=Kf,ih=Qf,rh=Wf,nh="pako inflate (from Nodeca project)",Pt={inflateReset:Gf,inflateReset2:Zf,inflateResetKeep:Jf,inflateInit:Yf,inflateInit2:Xf,inflate:eh,inflateEnd:th,inflateGetHeader:ih,inflateSetDictionary:rh,inflateInfo:nh};function ah(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var sh=ah,iu=Object.prototype.toString,{Z_NO_FLUSH:oh,Z_FINISH:ch,Z_OK:gn,Z_STREAM_END:Is,Z_NEED_DICT:ks,Z_STREAM_ERROR:lh,Z_DATA_ERROR:jc,Z_MEM_ERROR:uh}=Vi;function wn(i){this.options=qa.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(i&&i.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new Vl,this.strm.avail_out=0;let t=Pt.inflateInit2(this.strm,e.windowBits);if(t!==gn)throw new Error(Ri[t]);if(this.header=new sh,Pt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=hn.string2buf(e.dictionary):iu.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Pt.inflateSetDictionary(this.strm,e.dictionary),t!==gn)))throw new Error(Ri[t])}wn.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n=this.options.dictionary,a,s,o;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?ch:oh,iu.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),a=Pt.inflate(t,s),a===ks&&n&&(a=Pt.inflateSetDictionary(t,n),a===gn?a=Pt.inflate(t,s):a===jc&&(a=ks));t.avail_in>0&&a===Is&&t.state.wrap>0&&i[t.next_in]!==0;)Pt.inflateReset(t),a=Pt.inflate(t,s);switch(a){case lh:case jc:case ks:case uh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===Is))if(this.options.to==="string"){let l=hn.utf8border(t.output,t.next_out),c=t.next_out-l,u=hn.buf2string(t.output,l);t.next_out=c,t.avail_out=r-c,c&&t.output.set(t.output.subarray(l,l+c),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===gn&&o===0)){if(a===Is)return a=Pt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};wn.prototype.onData=function(i){this.chunks.push(i)};wn.prototype.onEnd=function(i){i===gn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=qa.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function ho(i,e){let t=new wn(e);if(t.push(i),t.err)throw t.msg||Ri[t.err];return t.result}function dh(i,e){return e=e||{},e.raw=!0,ho(i,e)}var ph=wn,fh=ho,hh=dh,gh=ho,mh=Vi,yh={Inflate:ph,inflate:fh,inflateRaw:hh,ungzip:gh,constants:mh},{Deflate:vh,deflate:bh,deflateRaw:_h,gzip:Sh}=Af,{Inflate:wh,inflate:Eh,inflateRaw:xh,ungzip:Ah}=yh,$h=vh,Ih=bh,kh=_h,Th=Sh,Ch=wh,Nh=Eh,Lh=xh,Ph=Ah,Rh=Vi,Oh={Deflate:$h,deflate:Ih,deflateRaw:kh,gzip:Th,Inflate:Ch,inflate:Nh,inflateRaw:Lh,ungzip:Ph,constants:Rh},ae=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},se=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Na=class{constructor(e,t){this.input=e,this.output=t}};ae([p(),se("design:type",String)],Na.prototype,"input",void 0);ae([p(),se("design:type",String)],Na.prototype,"output",void 0);Na=ae([Ae(),se("design:paramtypes",[String,String])],Na);var La=class{constructor(e,t){this.input=e,this.output=t}};ae([p(),se("design:type",String)],La.prototype,"input",void 0);ae([p(),se("design:type",String)],La.prototype,"output",void 0);La=ae([q(),se("design:paramtypes",[String,String])],La);var ei=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};ae([p(),se("design:type",String)],ei.prototype,"name",void 0);ae([p(),se("design:type",String)],ei.prototype,"modelId",void 0);ae([p(),se("design:type",String)],ei.prototype,"systemPrompt",void 0);ae([p(),se("design:type",Array)],ei.prototype,"promptExamples",void 0);ae([p(),se("design:type",String)],ei.prototype,"metaData",void 0);ei=ae([Ae(),se("design:paramtypes",[String,String,String,Array,String])],ei);var At=class{constructor(e,t,r,n,a,s,o,l){this.name=e,this.modelId=t,this.taskId=r,this.systemPrompt=n,this.promptExamples=a,this.metaData=s,this.createdAt=o,this.updatedAt=l}};ae([p(),se("design:type",String)],At.prototype,"name",void 0);ae([p(),se("design:type",String)],At.prototype,"modelId",void 0);ae([p(),se("design:type",String)],At.prototype,"taskId",void 0);ae([p(),se("design:type",String)],At.prototype,"systemPrompt",void 0);ae([p(),se("design:type",Array)],At.prototype,"promptExamples",void 0);ae([p(),se("design:type",String)],At.prototype,"metaData",void 0);ae([p(),se("design:type",String)],At.prototype,"createdAt",void 0);ae([p(),se("design:type",String)],At.prototype,"updatedAt",void 0);At=ae([q(),se("design:paramtypes",[String,String,String,String,Array,String,String,String])],At);var Mi=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};ae([p(),se("design:type",String)],Mi.prototype,"model",void 0);ae([p(),se("design:type",String)],Mi.prototype,"status",void 0);ae([p(),se("design:type",Number)],Mi.prototype,"progress",void 0);ae([p(),se("design:type",Boolean)],Mi.prototype,"downloaded",void 0);ae([p(),se("design:type",Boolean)],Mi.prototype,"loaded",void 0);Mi=ae([q(),se("design:paramtypes",[String,String,Number,Boolean,Boolean])],Mi);var Dh=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},be=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},ye,la,Js=class{constructor(e,t=!0){ye.set(this,void 0),la.set(this,new Map),Dh(this,ye,e,"f")}async getModels(){let e=await be(this,ye,"f").query({query:m`
1117
+ }`,variables:{url:e,interactionCall:t}}));return r}};Lt=new WeakMap;var Ba={};Ba.byteLength=Ld;Ba.toByteArray=Rd;Ba.fromByteArray=Md;var bt=[],at=[],Nd=typeof Uint8Array<"u"?Uint8Array:Array,gs="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(hi=0,tc=gs.length;hi<tc;++hi)bt[hi]=gs[hi],at[gs.charCodeAt(hi)]=hi;var hi,tc;at["-".charCodeAt(0)]=62;at["_".charCodeAt(0)]=63;function wl(i){var e=i.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=i.indexOf("=");t===-1&&(t=e);var r=t===e?0:4-t%4;return[t,r]}function Ld(i){var e=wl(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Pd(i,e,t){return(e+t)*3/4-t}function Rd(i){var e,t=wl(i),r=t[0],n=t[1],a=new Nd(Pd(i,r,n)),s=0,o=n>0?r-4:r,l;for(l=0;l<o;l+=4)e=at[i.charCodeAt(l)]<<18|at[i.charCodeAt(l+1)]<<12|at[i.charCodeAt(l+2)]<<6|at[i.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=at[i.charCodeAt(l)]<<2|at[i.charCodeAt(l+1)]>>4,a[s++]=e&255),n===1&&(e=at[i.charCodeAt(l)]<<10|at[i.charCodeAt(l+1)]<<4|at[i.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Od(i){return bt[i>>18&63]+bt[i>>12&63]+bt[i>>6&63]+bt[i&63]}function Dd(i,e,t){for(var r,n=[],a=e;a<t;a+=3)r=(i[a]<<16&16711680)+(i[a+1]<<8&65280)+(i[a+2]&255),n.push(Od(r));return n.join("")}function Md(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(Dd(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(bt[e>>2]+bt[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(bt[e>>10]+bt[e>>4&63]+bt[e<<2&63]+"=")),n.join("")}var Ud=4,ic=0,rc=1,Fd=2;function Ar(i){let e=i.length;for(;--e>=0;)i[e]=0}var jd=0,El=1,Bd=2,qd=3,Vd=258,co=29,wn=256,dn=wn+1+co,fr=30,lo=19,xl=2*dn+1,Ai=15,ms=16,zd=7,uo=256,Al=16,$l=17,Il=18,Vs=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),la=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Hd=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),kl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Kd=512,Pt=new Array((dn+2)*2);Ar(Pt);var nn=new Array(fr*2);Ar(nn);var pn=new Array(Kd);Ar(pn);var fn=new Array(Vd-qd+1);Ar(fn);var po=new Array(co);Ar(po);var Ta=new Array(fr);Ar(Ta);function ys(i,e,t,r,n){this.static_tree=i,this.extra_bits=e,this.extra_base=t,this.elems=r,this.max_length=n,this.has_stree=i&&i.length}var Tl,Cl,Nl;function vs(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Ll=i=>i<256?pn[i]:pn[256+(i>>>7)],hn=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Qe=(i,e,t)=>{i.bi_valid>ms-t?(i.bi_buf|=e<<i.bi_valid&65535,hn(i,i.bi_buf),i.bi_buf=e>>ms-i.bi_valid,i.bi_valid+=t-ms):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},_t=(i,e,t)=>{Qe(i,t[e*2],t[e*2+1])},Pl=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},Qd=i=>{i.bi_valid===16?(hn(i,i.bi_buf),i.bi_buf=0,i.bi_valid=0):i.bi_valid>=8&&(i.pending_buf[i.pending++]=i.bi_buf&255,i.bi_buf>>=8,i.bi_valid-=8)},Wd=(i,e)=>{let t=e.dyn_tree,r=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,s=e.stat_desc.extra_bits,o=e.stat_desc.extra_base,l=e.stat_desc.max_length,c,u,g,h,d,y,_=0;for(h=0;h<=Ai;h++)i.bl_count[h]=0;for(t[i.heap[i.heap_max]*2+1]=0,c=i.heap_max+1;c<xl;c++)u=i.heap[c],h=t[t[u*2+1]*2+1]+1,h>l&&(h=l,_++),t[u*2+1]=h,!(u>r)&&(i.bl_count[h]++,d=0,u>=o&&(d=s[u-o]),y=t[u*2],i.opt_len+=y*(h+d),a&&(i.static_len+=y*(n[u*2+1]+d)));if(_!==0){do{for(h=l-1;i.bl_count[h]===0;)h--;i.bl_count[h]--,i.bl_count[h+1]+=2,i.bl_count[l]--,_-=2}while(_>0);for(h=l;h!==0;h--)for(u=i.bl_count[h];u!==0;)g=i.heap[--c],!(g>r)&&(t[g*2+1]!==h&&(i.opt_len+=(h-t[g*2+1])*t[g*2],t[g*2+1]=h),u--)}},Rl=(i,e,t)=>{let r=new Array(Ai+1),n=0,a,s;for(a=1;a<=Ai;a++)n=n+t[a-1]<<1,r[a]=n;for(s=0;s<=e;s++){let o=i[s*2+1];o!==0&&(i[s*2]=Pl(r[o]++,o))}},Gd=()=>{let i,e,t,r,n,a=new Array(Ai+1);for(t=0,r=0;r<co-1;r++)for(po[r]=t,i=0;i<1<<Vs[r];i++)fn[t++]=r;for(fn[t-1]=r,n=0,r=0;r<16;r++)for(Ta[r]=n,i=0;i<1<<la[r];i++)pn[n++]=r;for(n>>=7;r<fr;r++)for(Ta[r]=n<<7,i=0;i<1<<la[r]-7;i++)pn[256+n++]=r;for(e=0;e<=Ai;e++)a[e]=0;for(i=0;i<=143;)Pt[i*2+1]=8,i++,a[8]++;for(;i<=255;)Pt[i*2+1]=9,i++,a[9]++;for(;i<=279;)Pt[i*2+1]=7,i++,a[7]++;for(;i<=287;)Pt[i*2+1]=8,i++,a[8]++;for(Rl(Pt,dn+1,a),i=0;i<fr;i++)nn[i*2+1]=5,nn[i*2]=Pl(i,5);Tl=new ys(Pt,Vs,wn+1,dn,Ai),Cl=new ys(nn,la,0,fr,Ai),Nl=new ys(new Array(0),Hd,0,lo,zd)},Ol=i=>{let e;for(e=0;e<dn;e++)i.dyn_ltree[e*2]=0;for(e=0;e<fr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<lo;e++)i.bl_tree[e*2]=0;i.dyn_ltree[uo*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Dl=i=>{i.bi_valid>8?hn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},nc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},bs=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&nc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!nc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},ac=(i,e,t)=>{let r,n,a=0,s,o;if(i.sym_next!==0)do r=i.pending_buf[i.sym_buf+a++]&255,r+=(i.pending_buf[i.sym_buf+a++]&255)<<8,n=i.pending_buf[i.sym_buf+a++],r===0?_t(i,n,e):(s=fn[n],_t(i,s+wn+1,e),o=Vs[s],o!==0&&(n-=po[s],Qe(i,n,o)),r--,s=Ll(r),_t(i,s,t),o=la[s],o!==0&&(r-=Ta[s],Qe(i,r,o)));while(a<i.sym_next);_t(i,uo,e)},zs=(i,e)=>{let t=e.dyn_tree,r=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,s,o,l=-1,c;for(i.heap_len=0,i.heap_max=xl,s=0;s<a;s++)t[s*2]!==0?(i.heap[++i.heap_len]=l=s,i.depth[s]=0):t[s*2+1]=0;for(;i.heap_len<2;)c=i.heap[++i.heap_len]=l<2?++l:0,t[c*2]=1,i.depth[c]=0,i.opt_len--,n&&(i.static_len-=r[c*2+1]);for(e.max_code=l,s=i.heap_len>>1;s>=1;s--)bs(i,t,s);c=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],bs(i,t,1),o=i.heap[1],i.heap[--i.heap_max]=s,i.heap[--i.heap_max]=o,t[c*2]=t[s*2]+t[o*2],i.depth[c]=(i.depth[s]>=i.depth[o]?i.depth[s]:i.depth[o])+1,t[s*2+1]=t[o*2+1]=c,i.heap[1]=c++,bs(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],Wd(i,e),Rl(t,l,i.bl_count)},sc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),e[(t+1)*2+1]=65535,r=0;r<=t;r++)a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)&&(o<c?i.bl_tree[a*2]+=o:a!==0?(a!==n&&i.bl_tree[a*2]++,i.bl_tree[Al*2]++):o<=10?i.bl_tree[$l*2]++:i.bl_tree[Il*2]++,o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))},oc=(i,e,t)=>{let r,n=-1,a,s=e[0*2+1],o=0,l=7,c=4;for(s===0&&(l=138,c=3),r=0;r<=t;r++)if(a=s,s=e[(r+1)*2+1],!(++o<l&&a===s)){if(o<c)do _t(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(_t(i,a,i.bl_tree),o--),_t(i,Al,i.bl_tree),Qe(i,o-3,2)):o<=10?(_t(i,$l,i.bl_tree),Qe(i,o-3,3)):(_t(i,Il,i.bl_tree),Qe(i,o-11,7));o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}},Zd=i=>{let e;for(sc(i,i.dyn_ltree,i.l_desc.max_code),sc(i,i.dyn_dtree,i.d_desc.max_code),zs(i,i.bl_desc),e=lo-1;e>=3&&i.bl_tree[kl[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},Jd=(i,e,t,r)=>{let n;for(Qe(i,e-257,5),Qe(i,t-1,5),Qe(i,r-4,4),n=0;n<r;n++)Qe(i,i.bl_tree[kl[n]*2+1],3);oc(i,i.dyn_ltree,e-1),oc(i,i.dyn_dtree,t-1)},Yd=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return ic;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return rc;for(t=32;t<wn;t++)if(i.dyn_ltree[t*2]!==0)return rc;return ic},cc=!1,Xd=i=>{cc||(Gd(),cc=!0),i.l_desc=new vs(i.dyn_ltree,Tl),i.d_desc=new vs(i.dyn_dtree,Cl),i.bl_desc=new vs(i.bl_tree,Nl),i.bi_buf=0,i.bi_valid=0,Ol(i)},Ml=(i,e,t,r)=>{Qe(i,(jd<<1)+(r?1:0),3),Dl(i),hn(i,t),hn(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},ep=i=>{Qe(i,El<<1,3),_t(i,uo,Pt),Qd(i)},tp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===Fd&&(i.strm.data_type=Yd(i)),zs(i,i.l_desc),zs(i,i.d_desc),s=Zd(i),n=i.opt_len+3+7>>>3,a=i.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?Ml(i,e,t,r):i.strategy===Ud||a===n?(Qe(i,(El<<1)+(r?1:0),3),ac(i,Pt,nn)):(Qe(i,(Bd<<1)+(r?1:0),3),Jd(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),ac(i,i.dyn_ltree,i.dyn_dtree)),Ol(i),r&&Dl(i)},ip=(i,e,t)=>(i.pending_buf[i.sym_buf+i.sym_next++]=e,i.pending_buf[i.sym_buf+i.sym_next++]=e>>8,i.pending_buf[i.sym_buf+i.sym_next++]=t,e===0?i.dyn_ltree[t*2]++:(i.matches++,e--,i.dyn_ltree[(fn[t]+wn+1)*2]++,i.dyn_dtree[Ll(e)*2]++),i.sym_next===i.sym_end),rp=Xd,np=Ml,ap=tp,sp=ip,op=ep,cp={_tr_init:rp,_tr_stored_block:np,_tr_flush_block:ap,_tr_tally:sp,_tr_align:op},lp=(i,e,t,r)=>{let n=i&65535|0,a=i>>>16&65535|0,s=0;for(;t!==0;){s=t>2e3?2e3:t,t-=s;do n=n+e[r++]|0,a=a+n|0;while(--s);n%=65521,a%=65521}return n|a<<16|0},gn=lp,up=()=>{let i,e=[];for(var t=0;t<256;t++){i=t;for(var r=0;r<8;r++)i=i&1?3988292384^i>>>1:i>>>1;e[t]=i}return e},dp=new Uint32Array(up()),pp=(i,e,t,r)=>{let n=dp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},xe=pp,Di={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},Hi={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:fp,_tr_stored_block:Hs,_tr_flush_block:hp,_tr_tally:Gt,_tr_align:gp}=cp,{Z_NO_FLUSH:Zt,Z_PARTIAL_FLUSH:mp,Z_FULL_FLUSH:yp,Z_FINISH:ot,Z_BLOCK:lc,Z_OK:ke,Z_STREAM_END:uc,Z_STREAM_ERROR:wt,Z_DATA_ERROR:vp,Z_BUF_ERROR:_s,Z_DEFAULT_COMPRESSION:bp,Z_FILTERED:_p,Z_HUFFMAN_ONLY:Kn,Z_RLE:Sp,Z_FIXED:wp,Z_DEFAULT_STRATEGY:Ep,Z_UNKNOWN:xp,Z_DEFLATED:qa}=Hi,Ap=9,$p=15,Ip=8,kp=29,Tp=256,Ks=Tp+1+kp,Cp=30,Np=19,Lp=2*Ks+1,Pp=15,Z=3,Ht=258,Et=Ht+Z+1,Rp=32,yr=42,fo=57,Qs=69,Ws=73,Gs=91,Zs=103,$i=113,Jr=666,qe=1,$r=2,Mi=3,Ir=4,Op=3,Ii=(i,e)=>(i.msg=Di[e],e),dc=i=>i*2-(i>4?9:0),zt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},Dp=i=>{let e,t,r,n=i.w_size;e=i.hash_size,r=e;do t=i.head[--r],i.head[r]=t>=n?t-n:0;while(--e);e=n,r=e;do t=i.prev[--r],i.prev[r]=t>=n?t-n:0;while(--e)},Mp=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,Jt=Mp,Ze=i=>{let e=i.state,t=e.pending;t>i.avail_out&&(t=i.avail_out),t!==0&&(i.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),i.next_out),i.next_out+=t,e.pending_out+=t,i.total_out+=t,i.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Ye=(i,e)=>{hp(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Ze(i.strm)},te=(i,e)=>{i.pending_buf[i.pending++]=e},Dr=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},Js=(i,e,t,r)=>{let n=i.avail_in;return n>r&&(n=r),n===0?0:(i.avail_in-=n,e.set(i.input.subarray(i.next_in,i.next_in+n),t),i.state.wrap===1?i.adler=gn(i.adler,e,n,t):i.state.wrap===2&&(i.adler=xe(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},Ul=(i,e)=>{let t=i.max_chain_length,r=i.strstart,n,a,s=i.prev_length,o=i.nice_match,l=i.strstart>i.w_size-Et?i.strstart-(i.w_size-Et):0,c=i.window,u=i.w_mask,g=i.prev,h=i.strstart+Ht,d=c[r+s-1],y=c[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(c[n+s]!==y||c[n+s-1]!==d||c[n]!==c[r]||c[++n]!==c[r+1])){r+=2,n++;do;while(c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&c[++r]===c[++n]&&r<h);if(a=Ht-(h-r),r=h-Ht,a>s){if(i.match_start=e,s=a,a>=o)break;d=c[r+s-1],y=c[r+s]}}while((e=g[e&u])>l&&--t!==0);return s<=i.lookahead?s:i.lookahead},vr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-Et)&&(i.window.set(i.window.subarray(e,e+e-r),0),i.match_start-=e,i.strstart-=e,i.block_start-=e,i.insert>i.strstart&&(i.insert=i.strstart),Dp(i),r+=e),i.strm.avail_in===0)break;if(t=Js(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=Z)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=Jt(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=Jt(i,i.ins_h,i.window[n+Z-1]),i.prev[n&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=n,n++,i.insert--,!(i.lookahead+i.insert<Z)););}while(i.lookahead<Et&&i.strm.avail_in!==0)},Fl=(i,e)=>{let t=i.pending_buf_size-5>i.w_size?i.w_size:i.pending_buf_size-5,r,n,a,s=0,o=i.strm.avail_in;do{if(r=65535,a=i.bi_valid+42>>3,i.strm.avail_out<a||(a=i.strm.avail_out-a,n=i.strstart-i.block_start,r>n+i.strm.avail_in&&(r=n+i.strm.avail_in),r>a&&(r=a),r<t&&(r===0&&e!==ot||e===Zt||r!==n+i.strm.avail_in)))break;s=e===ot&&r===n+i.strm.avail_in?1:0,Hs(i,0,0,s),i.pending_buf[i.pending-4]=r,i.pending_buf[i.pending-3]=r>>8,i.pending_buf[i.pending-2]=~r,i.pending_buf[i.pending-1]=~r>>8,Ze(i.strm),n&&(n>r&&(n=r),i.strm.output.set(i.window.subarray(i.block_start,i.block_start+n),i.strm.next_out),i.strm.next_out+=n,i.strm.avail_out-=n,i.strm.total_out+=n,i.block_start+=n,r-=n),r&&(Js(i.strm,i.strm.output,i.strm.next_out,r),i.strm.next_out+=r,i.strm.avail_out-=r,i.strm.total_out+=r)}while(s===0);return o-=i.strm.avail_in,o&&(o>=i.w_size?(i.matches=2,i.window.set(i.strm.input.subarray(i.strm.next_in-i.w_size,i.strm.next_in),0),i.strstart=i.w_size,i.insert=i.strstart):(i.window_size-i.strstart<=o&&(i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,i.insert>i.strstart&&(i.insert=i.strstart)),i.window.set(i.strm.input.subarray(i.strm.next_in-o,i.strm.next_in),i.strstart),i.strstart+=o,i.insert+=o>i.w_size-i.insert?i.w_size-i.insert:o),i.block_start=i.strstart),i.high_water<i.strstart&&(i.high_water=i.strstart),s?Ir:e!==Zt&&e!==ot&&i.strm.avail_in===0&&i.strstart===i.block_start?$r:(a=i.window_size-i.strstart,i.strm.avail_in>a&&i.block_start>=i.w_size&&(i.block_start-=i.w_size,i.strstart-=i.w_size,i.window.set(i.window.subarray(i.w_size,i.w_size+i.strstart),0),i.matches<2&&i.matches++,a+=i.w_size,i.insert>i.strstart&&(i.insert=i.strstart)),a>i.strm.avail_in&&(a=i.strm.avail_in),a&&(Js(i.strm,i.window,i.strstart,a),i.strstart+=a,i.insert+=a>i.w_size-i.insert?i.w_size-i.insert:a),i.high_water<i.strstart&&(i.high_water=i.strstart),a=i.bi_valid+42>>3,a=i.pending_buf_size-a>65535?65535:i.pending_buf_size-a,t=a>i.w_size?i.w_size:a,n=i.strstart-i.block_start,(n>=t||(n||e===ot)&&e!==Zt&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===ot&&i.strm.avail_in===0&&r===n?1:0,Hs(i,i.block_start,r,s),i.block_start+=r,Ze(i.strm)),s?Mi:qe)},Ss=(i,e)=>{let t,r;for(;;){if(i.lookahead<Et){if(vr(i),i.lookahead<Et&&e===Zt)return qe;if(i.lookahead===0)break}if(t=0,i.lookahead>=Z&&(i.ins_h=Jt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),t!==0&&i.strstart-t<=i.w_size-Et&&(i.match_length=Ul(i,t)),i.match_length>=Z)if(r=Gt(i,i.strstart-i.match_start,i.match_length-Z),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=Z){i.match_length--;do i.strstart++,i.ins_h=Jt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart;while(--i.match_length!==0);i.strstart++}else i.strstart+=i.match_length,i.match_length=0,i.ins_h=i.window[i.strstart],i.ins_h=Jt(i,i.ins_h,i.window[i.strstart+1]);else r=Gt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(Ye(i,!1),i.strm.avail_out===0))return qe}return i.insert=i.strstart<Z-1?i.strstart:Z-1,e===ot?(Ye(i,!0),i.strm.avail_out===0?Mi:Ir):i.sym_next&&(Ye(i,!1),i.strm.avail_out===0)?qe:$r},ar=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<Et){if(vr(i),i.lookahead<Et&&e===Zt)return qe;if(i.lookahead===0)break}if(t=0,i.lookahead>=Z&&(i.ins_h=Jt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart),i.prev_length=i.match_length,i.prev_match=i.match_start,i.match_length=Z-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-Et&&(i.match_length=Ul(i,t),i.match_length<=5&&(i.strategy===_p||i.match_length===Z&&i.strstart-i.match_start>4096)&&(i.match_length=Z-1)),i.prev_length>=Z&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-Z,r=Gt(i,i.strstart-1-i.prev_match,i.prev_length-Z),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=Jt(i,i.ins_h,i.window[i.strstart+Z-1]),t=i.prev[i.strstart&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=i.strstart);while(--i.prev_length!==0);if(i.match_available=0,i.match_length=Z-1,i.strstart++,r&&(Ye(i,!1),i.strm.avail_out===0))return qe}else if(i.match_available){if(r=Gt(i,0,i.window[i.strstart-1]),r&&Ye(i,!1),i.strstart++,i.lookahead--,i.strm.avail_out===0)return qe}else i.match_available=1,i.strstart++,i.lookahead--}return i.match_available&&(r=Gt(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<Z-1?i.strstart:Z-1,e===ot?(Ye(i,!0),i.strm.avail_out===0?Mi:Ir):i.sym_next&&(Ye(i,!1),i.strm.avail_out===0)?qe:$r},Up=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Ht){if(vr(i),i.lookahead<=Ht&&e===Zt)return qe;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=Z&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+Ht;do;while(r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&r===s[++n]&&n<a);i.match_length=Ht-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=Z?(t=Gt(i,1,i.match_length-Z),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=Gt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(Ye(i,!1),i.strm.avail_out===0))return qe}return i.insert=0,e===ot?(Ye(i,!0),i.strm.avail_out===0?Mi:Ir):i.sym_next&&(Ye(i,!1),i.strm.avail_out===0)?qe:$r},Fp=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(vr(i),i.lookahead===0)){if(e===Zt)return qe;break}if(i.match_length=0,t=Gt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(Ye(i,!1),i.strm.avail_out===0))return qe}return i.insert=0,e===ot?(Ye(i,!0),i.strm.avail_out===0?Mi:Ir):i.sym_next&&(Ye(i,!1),i.strm.avail_out===0)?qe:$r};function gt(i,e,t,r,n){this.good_length=i,this.max_lazy=e,this.nice_length=t,this.max_chain=r,this.func=n}var Yr=[new gt(0,0,0,0,Fl),new gt(4,4,8,4,Ss),new gt(4,5,16,8,Ss),new gt(4,6,32,32,Ss),new gt(4,4,16,16,ar),new gt(8,16,32,32,ar),new gt(8,16,128,128,ar),new gt(8,32,128,256,ar),new gt(32,128,258,1024,ar),new gt(32,258,258,4096,ar)],jp=i=>{i.window_size=2*i.w_size,zt(i.head),i.max_lazy_match=Yr[i.level].max_lazy,i.good_match=Yr[i.level].good_length,i.nice_match=Yr[i.level].nice_length,i.max_chain_length=Yr[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=Z-1,i.match_available=0,i.ins_h=0};function Bp(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=qa,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Lp*2),this.dyn_dtree=new Uint16Array((2*Cp+1)*2),this.bl_tree=new Uint16Array((2*Np+1)*2),zt(this.dyn_ltree),zt(this.dyn_dtree),zt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Pp+1),this.heap=new Uint16Array(2*Ks+1),zt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Ks+1),zt(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var En=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==yr&&e.status!==fo&&e.status!==Qs&&e.status!==Ws&&e.status!==Gs&&e.status!==Zs&&e.status!==$i&&e.status!==Jr?1:0},jl=i=>{if(En(i))return Ii(i,wt);i.total_in=i.total_out=0,i.data_type=xp;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?fo:e.wrap?yr:$i,i.adler=e.wrap===2?0:1,e.last_flush=-2,fp(e),ke},Bl=i=>{let e=jl(i);return e===ke&&jp(i.state),e},qp=(i,e)=>En(i)||i.state.wrap!==2?wt:(i.state.gzhead=e,ke),ql=(i,e,t,r,n,a)=>{if(!i)return wt;let s=1;if(e===bp&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>Ap||t!==qa||r<8||r>15||e<0||e>9||a<0||a>wp||r===8&&s!==1)return Ii(i,wt);r===8&&(r=9);let o=new Bp;return i.state=o,o.strm=i,o.status=yr,o.wrap=s,o.gzhead=null,o.w_bits=r,o.w_size=1<<o.w_bits,o.w_mask=o.w_size-1,o.hash_bits=n+7,o.hash_size=1<<o.hash_bits,o.hash_mask=o.hash_size-1,o.hash_shift=~~((o.hash_bits+Z-1)/Z),o.window=new Uint8Array(o.w_size*2),o.head=new Uint16Array(o.hash_size),o.prev=new Uint16Array(o.w_size),o.lit_bufsize=1<<n+6,o.pending_buf_size=o.lit_bufsize*4,o.pending_buf=new Uint8Array(o.pending_buf_size),o.sym_buf=o.lit_bufsize,o.sym_end=(o.lit_bufsize-1)*3,o.level=e,o.strategy=a,o.method=t,Bl(i)},Vp=(i,e)=>ql(i,e,qa,$p,Ip,Ep),zp=(i,e)=>{if(En(i)||e>lc||e<0)return i?Ii(i,wt):wt;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===Jr&&e!==ot)return Ii(i,i.avail_out===0?_s:wt);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ze(i),i.avail_out===0)return t.last_flush=-1,ke}else if(i.avail_in===0&&dc(e)<=dc(r)&&e!==ot)return Ii(i,_s);if(t.status===Jr&&i.avail_in!==0)return Ii(i,_s);if(t.status===yr&&t.wrap===0&&(t.status=$i),t.status===yr){let n=qa+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Kn||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Rp),n+=31-n%31,Dr(t,n),t.strstart!==0&&(Dr(t,i.adler>>>16),Dr(t,i.adler&65535)),i.adler=1,t.status=$i,Ze(i),t.pending!==0)return t.last_flush=-1,ke}if(t.status===fo){if(i.adler=0,te(t,31),te(t,139),te(t,8),t.gzhead)te(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),te(t,t.gzhead.time&255),te(t,t.gzhead.time>>8&255),te(t,t.gzhead.time>>16&255),te(t,t.gzhead.time>>24&255),te(t,t.level===9?2:t.strategy>=Kn||t.level<2?4:0),te(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(te(t,t.gzhead.extra.length&255),te(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=xe(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Qs;else if(te(t,0),te(t,0),te(t,0),te(t,0),te(t,0),te(t,t.level===9?2:t.strategy>=Kn||t.level<2?4:0),te(t,Op),t.status=$i,Ze(i),t.pending!==0)return t.last_flush=-1,ke}if(t.status===Qs){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let o=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+o),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,Ze(i),t.pending!==0)return t.last_flush=-1,ke;n=0,a-=o}let s=new Uint8Array(t.gzhead.extra);t.pending_buf.set(s.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Ws}if(t.status===Ws){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),Ze(i),t.pending!==0)return t.last_flush=-1,ke;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,te(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Gs}if(t.status===Gs){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n)),Ze(i),t.pending!==0)return t.last_flush=-1,ke;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,te(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=xe(i.adler,t.pending_buf,t.pending-n,n))}t.status=Zs}if(t.status===Zs){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ze(i),t.pending!==0))return t.last_flush=-1,ke;te(t,i.adler&255),te(t,i.adler>>8&255),i.adler=0}if(t.status=$i,Ze(i),t.pending!==0)return t.last_flush=-1,ke}if(i.avail_in!==0||t.lookahead!==0||e!==Zt&&t.status!==Jr){let n=t.level===0?Fl(t,e):t.strategy===Kn?Fp(t,e):t.strategy===Sp?Up(t,e):Yr[t.level].func(t,e);if((n===Mi||n===Ir)&&(t.status=Jr),n===qe||n===Mi)return i.avail_out===0&&(t.last_flush=-1),ke;if(n===$r&&(e===mp?gp(t):e!==lc&&(Hs(t,0,0,!1),e===yp&&(zt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ze(i),i.avail_out===0))return t.last_flush=-1,ke}return e!==ot?ke:t.wrap<=0?uc:(t.wrap===2?(te(t,i.adler&255),te(t,i.adler>>8&255),te(t,i.adler>>16&255),te(t,i.adler>>24&255),te(t,i.total_in&255),te(t,i.total_in>>8&255),te(t,i.total_in>>16&255),te(t,i.total_in>>24&255)):(Dr(t,i.adler>>>16),Dr(t,i.adler&65535)),Ze(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?ke:uc)},Hp=i=>{if(En(i))return wt;let e=i.state.status;return i.state=null,e===$i?Ii(i,vp):ke},Kp=(i,e)=>{let t=e.length;if(En(i))return wt;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==yr||r.lookahead)return wt;if(n===1&&(i.adler=gn(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(zt(r.head),r.strstart=0,r.block_start=0,r.insert=0);let l=new Uint8Array(r.w_size);l.set(e.subarray(t-r.w_size,t),0),e=l,t=r.w_size}let a=i.avail_in,s=i.next_in,o=i.input;for(i.avail_in=t,i.next_in=0,i.input=e,vr(r);r.lookahead>=Z;){let l=r.strstart,c=r.lookahead-(Z-1);do r.ins_h=Jt(r,r.ins_h,r.window[l+Z-1]),r.prev[l&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=l,l++;while(--c);r.strstart=l,r.lookahead=Z-1,vr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=Z-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,ke},Qp=Vp,Wp=ql,Gp=Bl,Zp=jl,Jp=qp,Yp=zp,Xp=Hp,ef=Kp,tf="pako deflate (from Nodeca project)",an={deflateInit:Qp,deflateInit2:Wp,deflateReset:Gp,deflateResetKeep:Zp,deflateSetHeader:Jp,deflate:Yp,deflateEnd:Xp,deflateSetDictionary:ef,deflateInfo:tf},rf=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),nf=function(i){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let r in t)rf(t,r)&&(i[r]=t[r])}}return i},af=i=>{let e=0;for(let r=0,n=i.length;r<n;r++)e+=i[r].length;let t=new Uint8Array(e);for(let r=0,n=0,a=i.length;r<a;r++){let s=i[r];t.set(s,n),n+=s.length}return t},Va={assign:nf,flattenChunks:af},Vl=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){Vl=!1}var mn=new Uint8Array(256);for(let i=0;i<256;i++)mn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;mn[254]=mn[254]=1;var sf=i=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(i);let e,t,r,n,a,s=i.length,o=0;for(n=0;n<s;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),o+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(o),a=0,n=0;a<o;n++)t=i.charCodeAt(n),(t&64512)===55296&&n+1<s&&(r=i.charCodeAt(n+1),(r&64512)===56320&&(t=65536+(t-55296<<10)+(r-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},of=(i,e)=>{if(e<65534&&i.subarray&&Vl)return String.fromCharCode.apply(null,i.length===e?i:i.subarray(0,e));let t="";for(let r=0;r<e;r++)t+=String.fromCharCode(i[r]);return t},cf=(i,e)=>{let t=e||i.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(i.subarray(0,e));let r,n,a=new Array(t*2);for(n=0,r=0;r<t;){let s=i[r++];if(s<128){a[n++]=s;continue}let o=mn[s];if(o>4){a[n++]=65533,r+=o-1;continue}for(s&=o===2?31:o===3?15:7;o>1&&r<t;)s=s<<6|i[r++]&63,o--;if(o>1){a[n++]=65533;continue}s<65536?a[n++]=s:(s-=65536,a[n++]=55296|s>>10&1023,a[n++]=56320|s&1023)}return of(a,n)},lf=(i,e)=>{e=e||i.length,e>i.length&&(e=i.length);let t=e-1;for(;t>=0&&(i[t]&192)===128;)t--;return t<0||t===0?e:t+mn[i[t]]>e?t:e},yn={string2buf:sf,buf2string:cf,utf8border:lf};function uf(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var zl=uf,Hl=Object.prototype.toString,{Z_NO_FLUSH:df,Z_SYNC_FLUSH:pf,Z_FULL_FLUSH:ff,Z_FINISH:hf,Z_OK:Ca,Z_STREAM_END:gf,Z_DEFAULT_COMPRESSION:mf,Z_DEFAULT_STRATEGY:yf,Z_DEFLATED:vf}=Hi;function xn(i){this.options=Va.assign({level:mf,method:vf,chunkSize:16384,windowBits:15,memLevel:8,strategy:yf},i||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zl,this.strm.avail_out=0;let t=an.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Ca)throw new Error(Di[t]);if(e.header&&an.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=yn.string2buf(e.dictionary):Hl.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=an.deflateSetDictionary(this.strm,r),t!==Ca)throw new Error(Di[t]);this._dict_set=!0}}xn.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?hf:df,typeof i=="string"?t.input=yn.string2buf(i):Hl.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),(a===pf||a===ff)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=an.deflate(t,a),n===gf)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=an.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Ca;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};xn.prototype.onData=function(i){this.chunks.push(i)};xn.prototype.onEnd=function(i){i===Ca&&(this.result=Va.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function ho(i,e){let t=new xn(e);if(t.push(i,!0),t.err)throw t.msg||Di[t.err];return t.result}function bf(i,e){return e=e||{},e.raw=!0,ho(i,e)}function _f(i,e){return e=e||{},e.gzip=!0,ho(i,e)}var Sf=xn,wf=ho,Ef=bf,xf=_f,Af=Hi,$f={Deflate:Sf,deflate:wf,deflateRaw:Ef,gzip:xf,constants:Af},Qn=16209,If=16191,kf=function i(e,t){let r,n,a,s,o,l,c,u,g,h,d,y,_,E,$,T,C,A,k,J,I,O,D,R,M=e.state;r=e.next_in,D=e.input,n=r+(e.avail_in-5),a=e.next_out,R=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),l=M.dmax,c=M.wsize,u=M.whave,g=M.wnext,h=M.window,d=M.hold,y=M.bits,_=M.lencode,E=M.distcode,$=(1<<M.lenbits)-1,T=(1<<M.distbits)-1;e:do{y<15&&(d+=D[r++]<<y,y+=8,d+=D[r++]<<y,y+=8),C=_[d&$];t:for(;;){if(A=C>>>24,d>>>=A,y-=A,A=C>>>16&255,A===0)R[a++]=C&65535;else if(A&16){k=C&65535,A&=15,A&&(y<A&&(d+=D[r++]<<y,y+=8),k+=d&(1<<A)-1,d>>>=A,y-=A),y<15&&(d+=D[r++]<<y,y+=8,d+=D[r++]<<y,y+=8),C=E[d&T];i:for(;;){if(A=C>>>24,d>>>=A,y-=A,A=C>>>16&255,A&16){if(J=C&65535,A&=15,y<A&&(d+=D[r++]<<y,y+=8,y<A&&(d+=D[r++]<<y,y+=8)),J+=d&(1<<A)-1,J>l){e.msg="invalid distance too far back",M.mode=Qn;break e}if(d>>>=A,y-=A,A=a-s,J>A){if(A=J-A,A>u&&M.sane){e.msg="invalid distance too far back",M.mode=Qn;break e}if(I=0,O=h,g===0){if(I+=c-A,A<k){k-=A;do R[a++]=h[I++];while(--A);I=a-J,O=R}}else if(g<A){if(I+=c+g-A,A-=g,A<k){k-=A;do R[a++]=h[I++];while(--A);if(I=0,g<k){A=g,k-=A;do R[a++]=h[I++];while(--A);I=a-J,O=R}}}else if(I+=g-A,A<k){k-=A;do R[a++]=h[I++];while(--A);I=a-J,O=R}for(;k>2;)R[a++]=O[I++],R[a++]=O[I++],R[a++]=O[I++],k-=3;k&&(R[a++]=O[I++],k>1&&(R[a++]=O[I++]))}else{I=a-J;do R[a++]=R[I++],R[a++]=R[I++],R[a++]=R[I++],k-=3;while(k>2);k&&(R[a++]=R[I++],k>1&&(R[a++]=R[I++]))}}else if((A&64)===0){C=E[(C&65535)+(d&(1<<A)-1)];continue i}else{e.msg="invalid distance code",M.mode=Qn;break e}break}}else if((A&64)===0){C=_[(C&65535)+(d&(1<<A)-1)];continue t}else if(A&32){M.mode=If;break e}else{e.msg="invalid literal/length code",M.mode=Qn;break e}break}}while(r<n&&a<o);k=y>>3,r-=k,y-=k<<3,d&=(1<<y)-1,e.next_in=r,e.next_out=a,e.avail_in=r<n?5+(n-r):5-(r-n),e.avail_out=a<o?257+(o-a):257-(a-o),M.hold=d,M.bits=y},sr=15,pc=852,fc=592,hc=0,ws=1,gc=2,Tf=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),Cf=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),Nf=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),Lf=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Pf=(i,e,t,r,n,a,s,o)=>{let l=o.bits,c=0,u=0,g=0,h=0,d=0,y=0,_=0,E=0,$=0,T=0,C,A,k,J,I,O=null,D,R=new Uint16Array(sr+1),M=new Uint16Array(sr+1),ge=null,_o,In,kn;for(c=0;c<=sr;c++)R[c]=0;for(u=0;u<r;u++)R[e[t+u]]++;for(d=l,h=sr;h>=1&&R[h]===0;h--);if(d>h&&(d=h),h===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(g=1;g<h&&R[g]===0;g++);for(d<g&&(d=g),E=1,c=1;c<=sr;c++)if(E<<=1,E-=R[c],E<0)return-1;if(E>0&&(i===hc||h!==1))return-1;for(M[1]=0,c=1;c<sr;c++)M[c+1]=M[c]+R[c];for(u=0;u<r;u++)e[t+u]!==0&&(s[M[e[t+u]]++]=u);if(i===hc?(O=ge=s,D=20):i===ws?(O=Tf,ge=Cf,D=257):(O=Nf,ge=Lf,D=0),T=0,u=0,c=g,I=a,y=d,_=0,k=-1,$=1<<d,J=$-1,i===ws&&$>pc||i===gc&&$>fc)return 1;for(;;){_o=c-_,s[u]+1<D?(In=0,kn=s[u]):s[u]>=D?(In=ge[s[u]-D],kn=O[s[u]-D]):(In=32+64,kn=0),C=1<<c-_,A=1<<y,g=A;do A-=C,n[I+(T>>_)+A]=_o<<24|In<<16|kn|0;while(A!==0);for(C=1<<c-1;T&C;)C>>=1;if(C!==0?(T&=C-1,T+=C):T=0,u++,--R[c]===0){if(c===h)break;c=e[t+s[u]]}if(c>d&&(T&J)!==k){for(_===0&&(_=d),I+=g,y=c-_,E=1<<y;y+_<h&&(E-=R[y+_],!(E<=0));)y++,E<<=1;if($+=1<<y,i===ws&&$>pc||i===gc&&$>fc)return 1;k=T&J,n[k]=d<<24|y<<16|I-a|0}}return T!==0&&(n[I+T]=c-_<<24|64<<16|0),o.bits=d,0},sn=Pf,Rf=0,Kl=1,Ql=2,{Z_FINISH:mc,Z_BLOCK:Of,Z_TREES:Wn,Z_OK:Ui,Z_STREAM_END:Df,Z_NEED_DICT:Mf,Z_STREAM_ERROR:ct,Z_DATA_ERROR:Wl,Z_MEM_ERROR:Gl,Z_BUF_ERROR:Uf,Z_DEFLATED:yc}=Hi,za=16180,vc=16181,bc=16182,_c=16183,Sc=16184,wc=16185,Ec=16186,xc=16187,Ac=16188,$c=16189,Na=16190,Tt=16191,Es=16192,Ic=16193,xs=16194,kc=16195,Tc=16196,Cc=16197,Nc=16198,Gn=16199,Zn=16200,Lc=16201,Pc=16202,Rc=16203,Oc=16204,Dc=16205,As=16206,Mc=16207,Uc=16208,ce=16209,Zl=16210,Jl=16211,Ff=852,jf=592,Bf=15,qf=Bf,Fc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Vf(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var Ki=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<za||e.mode>Jl?1:0},Yl=i=>{if(Ki(i))return ct;let e=i.state;return i.total_in=i.total_out=e.total=0,i.msg="",e.wrap&&(i.adler=e.wrap&1),e.mode=za,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(Ff),e.distcode=e.distdyn=new Int32Array(jf),e.sane=1,e.back=-1,Ui},Xl=i=>{if(Ki(i))return ct;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,Yl(i)},eu=(i,e)=>{let t;if(Ki(i))return ct;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?ct:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,Xl(i))},tu=(i,e)=>{if(!i)return ct;let t=new Vf;i.state=t,t.strm=i,t.window=null,t.mode=za;let r=eu(i,e);return r!==Ui&&(i.state=null),r},zf=i=>tu(i,qf),jc=!0,$s,Is,Hf=i=>{if(jc){$s=new Int32Array(512),Is=new Int32Array(32);let e=0;for(;e<144;)i.lens[e++]=8;for(;e<256;)i.lens[e++]=9;for(;e<280;)i.lens[e++]=7;for(;e<288;)i.lens[e++]=8;for(sn(Kl,i.lens,0,288,$s,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;sn(Ql,i.lens,0,32,Is,0,i.work,{bits:5}),jc=!1}i.lencode=$s,i.lenbits=9,i.distcode=Is,i.distbits=5},iu=(i,e,t,r)=>{let n,a=i.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),r>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>r&&(n=r),a.window.set(e.subarray(t-r,t-r+n),a.wnext),r-=n,r?(a.window.set(e.subarray(t-r,t),0),a.wnext=r,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},Kf=(i,e)=>{let t,r,n,a,s,o,l,c,u,g,h,d,y,_,E=0,$,T,C,A,k,J,I,O,D=new Uint8Array(4),R,M,ge=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Ki(i)||!i.output||!i.input&&i.avail_in!==0)return ct;t=i.state,t.mode===Tt&&(t.mode=Es),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,g=o,h=l,O=Ui;e:for(;;)switch(t.mode){case za:if(t.wrap===0){t.mode=Es;break}for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&2&&c===35615){t.wbits===0&&(t.wbits=15),t.check=0,D[0]=c&255,D[1]=c>>>8&255,t.check=xe(t.check,D,2,0),c=0,u=0,t.mode=vc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=ce;break}if((c&15)!==yc){i.msg="unknown compression method",t.mode=ce;break}if(c>>>=4,u-=4,I=(c&15)+8,t.wbits===0&&(t.wbits=I),I>15||I>t.wbits){i.msg="invalid window size",t.mode=ce;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=c&512?$c:Tt,c=0,u=0;break;case vc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==yc){i.msg="unknown compression method",t.mode=ce;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=ce;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&t.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,t.check=xe(t.check,D,2,0)),c=0,u=0,t.mode=bc;case bc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.time=c),t.flags&512&&t.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,D[2]=c>>>16&255,D[3]=c>>>24&255,t.check=xe(t.check,D,4,0)),c=0,u=0,t.mode=_c;case _c:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.head&&(t.head.xflags=c&255,t.head.os=c>>8),t.flags&512&&t.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,t.check=xe(t.check,D,2,0)),c=0,u=0,t.mode=Sc;case Sc:if(t.flags&1024){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length=c,t.head&&(t.head.extra_len=c),t.flags&512&&t.wrap&4&&(D[0]=c&255,D[1]=c>>>8&255,t.check=xe(t.check,D,2,0)),c=0,u=0}else t.head&&(t.head.extra=null);t.mode=wc;case wc:if(t.flags&1024&&(d=t.length,d>o&&(d=o),d&&(t.head&&(I=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(r.subarray(a,a+d),I)),t.flags&512&&t.wrap&4&&(t.check=xe(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Ec;case Ec:if(t.flags&2048){if(o===0)break e;d=0;do I=r[a+d++],t.head&&I&&t.length<65536&&(t.head.name+=String.fromCharCode(I));while(I&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=xe(t.check,r,d,a)),o-=d,a+=d,I)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=xc;case xc:if(t.flags&4096){if(o===0)break e;d=0;do I=r[a+d++],t.head&&I&&t.length<65536&&(t.head.comment+=String.fromCharCode(I));while(I&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=xe(t.check,r,d,a)),o-=d,a+=d,I)break e}else t.head&&(t.head.comment=null);t.mode=Ac;case Ac:if(t.flags&512){for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.check&65535)){i.msg="header crc mismatch",t.mode=ce;break}c=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),i.adler=t.check=0,t.mode=Tt;break;case $c:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}i.adler=t.check=Fc(c),c=0,u=0,t.mode=Na;case Na:if(t.havedict===0)return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,Mf;i.adler=t.check=1,t.mode=Tt;case Tt:if(e===Of||e===Wn)break e;case Es:if(t.last){c>>>=u&7,u-=u&7,t.mode=As;break}for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}switch(t.last=c&1,c>>>=1,u-=1,c&3){case 0:t.mode=Ic;break;case 1:if(Hf(t),t.mode=Gn,e===Wn){c>>>=2,u-=2;break e}break;case 2:t.mode=Tc;break;case 3:i.msg="invalid block type",t.mode=ce}c>>>=2,u-=2;break;case Ic:for(c>>>=u&7,u-=u&7;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((c&65535)!==(c>>>16^65535)){i.msg="invalid stored block lengths",t.mode=ce;break}if(t.length=c&65535,c=0,u=0,t.mode=xs,e===Wn)break e;case xs:t.mode=kc;case kc:if(d=t.length,d){if(d>o&&(d=o),d>l&&(d=l),d===0)break e;n.set(r.subarray(a,a+d),s),o-=d,a+=d,l-=d,s+=d,t.length-=d;break}t.mode=Tt;break;case Tc:for(;u<14;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.nlen=(c&31)+257,c>>>=5,u-=5,t.ndist=(c&31)+1,c>>>=5,u-=5,t.ncode=(c&15)+4,c>>>=4,u-=4,t.nlen>286||t.ndist>30){i.msg="too many length or distance symbols",t.mode=ce;break}t.have=0,t.mode=Cc;case Cc:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.lens[ge[t.have++]]=c&7,c>>>=3,u-=3}for(;t.have<19;)t.lens[ge[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,R={bits:t.lenbits},O=sn(Rf,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,O){i.msg="invalid code lengths set",t.mode=ce;break}t.have=0,t.mode=Nc;case Nc:for(;t.have<t.nlen+t.ndist;){for(;E=t.lencode[c&(1<<t.lenbits)-1],$=E>>>24,T=E>>>16&255,C=E&65535,!($<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(C<16)c>>>=$,u-=$,t.lens[t.have++]=C;else{if(C===16){for(M=$+2;u<M;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(c>>>=$,u-=$,t.have===0){i.msg="invalid bit length repeat",t.mode=ce;break}I=t.lens[t.have-1],d=3+(c&3),c>>>=2,u-=2}else if(C===17){for(M=$+3;u<M;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=$,u-=$,I=0,d=3+(c&7),c>>>=3,u-=3}else{for(M=$+7;u<M;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=$,u-=$,I=0,d=11+(c&127),c>>>=7,u-=7}if(t.have+d>t.nlen+t.ndist){i.msg="invalid bit length repeat",t.mode=ce;break}for(;d--;)t.lens[t.have++]=I}}if(t.mode===ce)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=ce;break}if(t.lenbits=9,R={bits:t.lenbits},O=sn(Kl,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,O){i.msg="invalid literal/lengths set",t.mode=ce;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},O=sn(Ql,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,O){i.msg="invalid distances set",t.mode=ce;break}if(t.mode=Gn,e===Wn)break e;case Gn:t.mode=Zn;case Zn:if(o>=6&&l>=258){i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,kf(i,h),s=i.next_out,n=i.output,l=i.avail_out,a=i.next_in,r=i.input,o=i.avail_in,c=t.hold,u=t.bits,t.mode===Tt&&(t.back=-1);break}for(t.back=0;E=t.lencode[c&(1<<t.lenbits)-1],$=E>>>24,T=E>>>16&255,C=E&65535,!($<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(T&&(T&240)===0){for(A=$,k=T,J=C;E=t.lencode[J+((c&(1<<A+k)-1)>>A)],$=E>>>24,T=E>>>16&255,C=E&65535,!(A+$<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=A,u-=A,t.back+=A}if(c>>>=$,u-=$,t.back+=$,t.length=C,T===0){t.mode=Dc;break}if(T&32){t.back=-1,t.mode=Tt;break}if(T&64){i.msg="invalid literal/length code",t.mode=ce;break}t.extra=T&15,t.mode=Lc;case Lc:if(t.extra){for(M=t.extra;u<M;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.length+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Pc;case Pc:for(;E=t.distcode[c&(1<<t.distbits)-1],$=E>>>24,T=E>>>16&255,C=E&65535,!($<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((T&240)===0){for(A=$,k=T,J=C;E=t.distcode[J+((c&(1<<A+k)-1)>>A)],$=E>>>24,T=E>>>16&255,C=E&65535,!(A+$<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=A,u-=A,t.back+=A}if(c>>>=$,u-=$,t.back+=$,T&64){i.msg="invalid distance code",t.mode=ce;break}t.offset=C,t.extra=T&15,t.mode=Rc;case Rc:if(t.extra){for(M=t.extra;u<M;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.offset+=c&(1<<t.extra)-1,c>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){i.msg="invalid distance too far back",t.mode=ce;break}t.mode=Oc;case Oc:if(l===0)break e;if(d=h-l,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=ce;break}d>t.wnext?(d-=t.wnext,y=t.wsize-d):y=t.wnext-d,d>t.length&&(d=t.length),_=t.window}else _=n,y=s-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do n[s++]=_[y++];while(--d);t.length===0&&(t.mode=Zn);break;case Dc:if(l===0)break e;n[s++]=t.length,l--,t.mode=Zn;break;case As:if(t.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<<u,u+=8}if(h-=l,i.total_out+=h,t.total+=h,t.wrap&4&&h&&(i.adler=t.check=t.flags?xe(t.check,n,h,s-h):gn(t.check,n,h,s-h)),h=l,t.wrap&4&&(t.flags?c:Fc(c))!==t.check){i.msg="incorrect data check",t.mode=ce;break}c=0,u=0}t.mode=Mc;case Mc:if(t.wrap&&t.flags){for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.wrap&4&&c!==(t.total&4294967295)){i.msg="incorrect length check",t.mode=ce;break}c=0,u=0}t.mode=Uc;case Uc:O=Df;break e;case ce:O=Wl;break e;case Zl:return Gl;case Jl:default:return ct}return i.next_out=s,i.avail_out=l,i.next_in=a,i.avail_in=o,t.hold=c,t.bits=u,(t.wsize||h!==i.avail_out&&t.mode<ce&&(t.mode<As||e!==mc))&&iu(i,i.output,i.next_out,h-i.avail_out),g-=i.avail_in,h-=i.avail_out,i.total_in+=g,i.total_out+=h,t.total+=h,t.wrap&4&&h&&(i.adler=t.check=t.flags?xe(t.check,n,h,i.next_out-h):gn(t.check,n,h,i.next_out-h)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Tt?128:0)+(t.mode===Gn||t.mode===xs?256:0),(g===0&&h===0||e===mc)&&O===Ui&&(O=Uf),O},Qf=i=>{if(Ki(i))return ct;let e=i.state;return e.window&&(e.window=null),i.state=null,Ui},Wf=(i,e)=>{if(Ki(i))return ct;let t=i.state;return(t.wrap&2)===0?ct:(t.head=e,e.done=!1,Ui)},Gf=(i,e)=>{let t=e.length,r,n,a;return Ki(i)||(r=i.state,r.wrap!==0&&r.mode!==Na)?ct:r.mode===Na&&(n=1,n=gn(n,e,t,0),n!==r.check)?Wl:(a=iu(i,e,t,t),a?(r.mode=Zl,Gl):(r.havedict=1,Ui))},Zf=Xl,Jf=eu,Yf=Yl,Xf=zf,eh=tu,th=Kf,ih=Qf,rh=Wf,nh=Gf,ah="pako inflate (from Nodeca project)",Rt={inflateReset:Zf,inflateReset2:Jf,inflateResetKeep:Yf,inflateInit:Xf,inflateInit2:eh,inflate:th,inflateEnd:ih,inflateGetHeader:rh,inflateSetDictionary:nh,inflateInfo:ah};function sh(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var oh=sh,ru=Object.prototype.toString,{Z_NO_FLUSH:ch,Z_FINISH:lh,Z_OK:vn,Z_STREAM_END:ks,Z_NEED_DICT:Ts,Z_STREAM_ERROR:uh,Z_DATA_ERROR:Bc,Z_MEM_ERROR:dh}=Hi;function An(i){this.options=Va.assign({chunkSize:1024*64,windowBits:15,to:""},i||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(i&&i.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new zl,this.strm.avail_out=0;let t=Rt.inflateInit2(this.strm,e.windowBits);if(t!==vn)throw new Error(Di[t]);if(this.header=new oh,Rt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=yn.string2buf(e.dictionary):ru.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Rt.inflateSetDictionary(this.strm,e.dictionary),t!==vn)))throw new Error(Di[t])}An.prototype.push=function(i,e){let t=this.strm,r=this.options.chunkSize,n=this.options.dictionary,a,s,o;if(this.ended)return!1;for(e===~~e?s=e:s=e===!0?lh:ch,ru.call(i)==="[object ArrayBuffer]"?t.input=new Uint8Array(i):t.input=i,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(r),t.next_out=0,t.avail_out=r),a=Rt.inflate(t,s),a===Ts&&n&&(a=Rt.inflateSetDictionary(t,n),a===vn?a=Rt.inflate(t,s):a===Bc&&(a=Ts));t.avail_in>0&&a===ks&&t.state.wrap>0&&i[t.next_in]!==0;)Rt.inflateReset(t),a=Rt.inflate(t,s);switch(a){case uh:case Bc:case Ts:case dh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===ks))if(this.options.to==="string"){let l=yn.utf8border(t.output,t.next_out),c=t.next_out-l,u=yn.buf2string(t.output,l);t.next_out=c,t.avail_out=r-c,c&&t.output.set(t.output.subarray(l,l+c),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===vn&&o===0)){if(a===ks)return a=Rt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};An.prototype.onData=function(i){this.chunks.push(i)};An.prototype.onEnd=function(i){i===vn&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Va.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function go(i,e){let t=new An(e);if(t.push(i),t.err)throw t.msg||Di[t.err];return t.result}function ph(i,e){return e=e||{},e.raw=!0,go(i,e)}var fh=An,hh=go,gh=ph,mh=go,yh=Hi,vh={Inflate:fh,inflate:hh,inflateRaw:gh,ungzip:mh,constants:yh},{Deflate:bh,deflate:_h,deflateRaw:Sh,gzip:wh}=$f,{Inflate:Eh,inflate:xh,inflateRaw:Ah,ungzip:$h}=vh,Ih=bh,kh=_h,Th=Sh,Ch=wh,Nh=Eh,Lh=xh,Ph=Ah,Rh=$h,Oh=Hi,Dh={Deflate:Ih,deflate:kh,deflateRaw:Th,gzip:Ch,Inflate:Nh,inflate:Lh,inflateRaw:Ph,ungzip:Rh,constants:Oh},ae=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},se=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},La=class{constructor(e,t){this.input=e,this.output=t}};ae([p(),se("design:type",String)],La.prototype,"input",void 0);ae([p(),se("design:type",String)],La.prototype,"output",void 0);La=ae([$e(),se("design:paramtypes",[String,String])],La);var Pa=class{constructor(e,t){this.input=e,this.output=t}};ae([p(),se("design:type",String)],Pa.prototype,"input",void 0);ae([p(),se("design:type",String)],Pa.prototype,"output",void 0);Pa=ae([q(),se("design:paramtypes",[String,String])],Pa);var ti=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};ae([p(),se("design:type",String)],ti.prototype,"name",void 0);ae([p(),se("design:type",String)],ti.prototype,"modelId",void 0);ae([p(),se("design:type",String)],ti.prototype,"systemPrompt",void 0);ae([p(),se("design:type",Array)],ti.prototype,"promptExamples",void 0);ae([p(),se("design:type",String)],ti.prototype,"metaData",void 0);ti=ae([$e(),se("design:paramtypes",[String,String,String,Array,String])],ti);var $t=class{constructor(e,t,r,n,a,s,o,l){this.name=e,this.modelId=t,this.taskId=r,this.systemPrompt=n,this.promptExamples=a,this.metaData=s,this.createdAt=o,this.updatedAt=l}};ae([p(),se("design:type",String)],$t.prototype,"name",void 0);ae([p(),se("design:type",String)],$t.prototype,"modelId",void 0);ae([p(),se("design:type",String)],$t.prototype,"taskId",void 0);ae([p(),se("design:type",String)],$t.prototype,"systemPrompt",void 0);ae([p(),se("design:type",Array)],$t.prototype,"promptExamples",void 0);ae([p(),se("design:type",String)],$t.prototype,"metaData",void 0);ae([p(),se("design:type",String)],$t.prototype,"createdAt",void 0);ae([p(),se("design:type",String)],$t.prototype,"updatedAt",void 0);$t=ae([q(),se("design:paramtypes",[String,String,String,String,Array,String,String,String])],$t);var Fi=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};ae([p(),se("design:type",String)],Fi.prototype,"model",void 0);ae([p(),se("design:type",String)],Fi.prototype,"status",void 0);ae([p(),se("design:type",Number)],Fi.prototype,"progress",void 0);ae([p(),se("design:type",Boolean)],Fi.prototype,"downloaded",void 0);ae([p(),se("design:type",Boolean)],Fi.prototype,"loaded",void 0);Fi=ae([q(),se("design:paramtypes",[String,String,Number,Boolean,Boolean])],Fi);var Mh=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},_e=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},ve,ua,Ys=class{constructor(e,t=!0){ve.set(this,void 0),ua.set(this,new Map),Mh(this,ve,e,"f")}async getModels(){let e=await _e(this,ve,"f").query({query:m`
1168
1118
  query {
1169
1119
  aiGetModels {
1170
1120
  id
@@ -1188,23 +1138,23 @@ triggerMatch
1188
1138
  modelType
1189
1139
  }
1190
1140
  }
1191
- `});return v(e).aiGetModels}async addModel(e){let t=await be(this,ye,"f").mutate({mutation:m`
1141
+ `});return v(e).aiGetModels}async addModel(e){let t=await _e(this,ve,"f").mutate({mutation:m`
1192
1142
  mutation($model: ModelInput!) {
1193
1143
  aiAddModel(model: $model)
1194
1144
  }
1195
- `,variables:{model:e}});return v(t).aiAddModel}async updateModel(e,t){let r=await be(this,ye,"f").mutate({mutation:m`
1145
+ `,variables:{model:e}});return v(t).aiAddModel}async updateModel(e,t){let r=await _e(this,ve,"f").mutate({mutation:m`
1196
1146
  mutation($modelId: String!, $model: ModelInput!) {
1197
1147
  aiUpdateModel(modelId: $modelId, model: $model)
1198
1148
  }
1199
- `,variables:{modelId:e,model:t}});return v(r).aiUpdateModel}async removeModel(e){let t=await be(this,ye,"f").mutate({mutation:m`
1149
+ `,variables:{modelId:e,model:t}});return v(r).aiUpdateModel}async removeModel(e){let t=await _e(this,ve,"f").mutate({mutation:m`
1200
1150
  mutation($modelId: String!) {
1201
1151
  aiRemoveModel(modelId: $modelId)
1202
1152
  }
1203
- `,variables:{modelId:e}});return v(t).aiRemoveModel}async setDefaultModel(e,t){let r=await be(this,ye,"f").mutate({mutation:m`
1153
+ `,variables:{modelId:e}});return v(t).aiRemoveModel}async setDefaultModel(e,t){let r=await _e(this,ve,"f").mutate({mutation:m`
1204
1154
  mutation($modelType: ModelType!, $modelId: String!) {
1205
1155
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
1206
1156
  }
1207
- `,variables:{modelId:t,modelType:e}});return v(r).aiSetDefaultModel}async getDefaultModel(e){let t=await be(this,ye,"f").query({query:m`
1157
+ `,variables:{modelId:t,modelType:e}});return v(r).aiSetDefaultModel}async getDefaultModel(e){let t=await _e(this,ve,"f").query({query:m`
1208
1158
  query($modelType: ModelType!) {
1209
1159
  aiGetDefaultModel(modelType: $modelType) {
1210
1160
  id
@@ -1228,7 +1178,7 @@ triggerMatch
1228
1178
  modelType
1229
1179
  }
1230
1180
  }
1231
- `,variables:{modelType:e}});return v(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=v(await be(this,ye,"f").query({query:m`
1181
+ `,variables:{modelType:e}});return v(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=v(await _e(this,ve,"f").query({query:m`
1232
1182
  query {
1233
1183
  aiTasks {
1234
1184
  name
@@ -1244,7 +1194,7 @@ triggerMatch
1244
1194
  updatedAt
1245
1195
  }
1246
1196
  }
1247
- `}));return e}async addTask(e,t,r,n,a){let s=new ei(e,t,r,n,a),{aiAddTask:o}=v(await be(this,ye,"f").mutate({mutation:m`
1197
+ `}));return e}async addTask(e,t,r,n,a){let s=new ti(e,t,r,n,a),{aiAddTask:o}=v(await _e(this,ve,"f").mutate({mutation:m`
1248
1198
  mutation AiAddTask($task: AITaskInput!) {
1249
1199
  aiAddTask(task: $task) {
1250
1200
  name
@@ -1260,7 +1210,7 @@ triggerMatch
1260
1210
  updatedAt
1261
1211
  }
1262
1212
  }
1263
- `,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=v(await be(this,ye,"f").mutate({mutation:m`
1213
+ `,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=v(await _e(this,ve,"f").mutate({mutation:m`
1264
1214
  mutation AiRemoveTask($taskId: String!) {
1265
1215
  aiRemoveTask(taskId: $taskId) {
1266
1216
  name
@@ -1276,7 +1226,7 @@ triggerMatch
1276
1226
  updatedAt
1277
1227
  }
1278
1228
  }
1279
- `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=v(await be(this,ye,"f").mutate({mutation:m`
1229
+ `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=v(await _e(this,ve,"f").mutate({mutation:m`
1280
1230
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
1281
1231
  aiUpdateTask(taskId: $taskId, task: $task) {
1282
1232
  name
@@ -1292,7 +1242,7 @@ triggerMatch
1292
1242
  updatedAt
1293
1243
  }
1294
1244
  }
1295
- `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=v(await be(this,ye,"f").query({query:m`
1245
+ `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=v(await _e(this,ve,"f").query({query:m`
1296
1246
  query AiModelLoadingStatus($model: String!) {
1297
1247
  aiModelLoadingStatus(model: $model) {
1298
1248
  model
@@ -1302,51 +1252,51 @@ triggerMatch
1302
1252
  downloaded
1303
1253
  }
1304
1254
  }
1305
- `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=v(await be(this,ye,"f").mutate({mutation:m`
1255
+ `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=v(await _e(this,ve,"f").mutate({mutation:m`
1306
1256
  mutation AiPrompt($taskId: String!, $prompt: String!) {
1307
1257
  aiPrompt(taskId: $taskId, prompt: $prompt)
1308
1258
  }
1309
- `,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=v(await be(this,ye,"f").mutate({mutation:m`
1259
+ `,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=v(await _e(this,ve,"f").mutate({mutation:m`
1310
1260
  mutation aiEmbed($modelId: String!, $text: String!) {
1311
1261
  aiEmbed(modelId: $modelId, text: $text)
1312
1262
  }
1313
- `,variables:{modelId:e,text:t}})),n=ja.toByteArray(r);return JSON.parse(Oh.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=v(await be(this,ye,"f").mutate({mutation:m`
1263
+ `,variables:{modelId:e,text:t}})),n=Ba.toByteArray(r);return JSON.parse(Dh.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=v(await _e(this,ve,"f").mutate({mutation:m`
1314
1264
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
1315
1265
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
1316
1266
  }
1317
- `,variables:{modelId:e,params:r}})),a=be(this,ye,"f").subscribe({query:m` subscription {
1267
+ `,variables:{modelId:e,params:r}})),a=_e(this,ve,"f").subscribe({query:m` subscription {
1318
1268
  aiTranscriptionText(streamId: "${n}")
1319
- }`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return be(this,la,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=v(await be(this,ye,"f").mutate({mutation:m`
1269
+ }`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return _e(this,ua,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=v(await _e(this,ve,"f").mutate({mutation:m`
1320
1270
  mutation aiCloseTranscriptionStream($streamId: String!) {
1321
1271
  aiCloseTranscriptionStream(streamId: $streamId)
1322
1272
  }
1323
- `,variables:{streamId:e}})),r=be(this,la,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=v(await be(this,ye,"f").mutate({mutation:m`
1273
+ `,variables:{streamId:e}})),r=_e(this,ua,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=v(await _e(this,ve,"f").mutate({mutation:m`
1324
1274
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
1325
1275
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
1326
1276
  }
1327
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};ye=new WeakMap,la=new WeakMap;var jt=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},me=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},yt,ua,Zr,da,Jr,_i,pa,Yr,Bc=class{constructor(e,t=!0){yt.set(this,void 0),ua.set(this,void 0),Zr.set(this,void 0),da.set(this,void 0),Jr.set(this,void 0),_i.set(this,void 0),pa.set(this,void 0),Yr.set(this,void 0),jt(this,yt,e,"f"),jt(this,ua,new on(me(this,yt,"f"),t),"f"),jt(this,Zr,new Bs(me(this,yt,"f")),"f"),jt(this,da,new Us(me(this,yt,"f")),"f"),jt(this,Jr,new Fs(me(this,yt,"f")),"f"),jt(this,Yr,new Js(me(this,yt,"f"),t),"f"),jt(this,_i,new Ia(me(this,yt,"f"),t),"f"),me(this,_i,"f").setExpressionClient(me(this,Zr,"f")),me(this,_i,"f").setNeighbourhoodClient(me(this,Jr,"f")),me(this,_i,"f").setAIClient(me(this,Yr,"f")),jt(this,pa,new js(me(this,yt,"f"),t),"f")}get agent(){return me(this,ua,"f")}get expression(){return me(this,Zr,"f")}get languages(){return me(this,da,"f")}get neighbourhood(){return me(this,Jr,"f")}get perspective(){return me(this,_i,"f")}get runtime(){return me(this,pa,"f")}get ai(){return me(this,Yr,"f")}};yt=new WeakMap,ua=new WeakMap,Zr=new WeakMap,da=new WeakMap,Jr=new WeakMap,_i=new WeakMap,pa=new WeakMap,Yr=new WeakMap;var Ys;(function(i){i.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",i.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",i.AgentIsUntrusted="AGENT_IS_UNTRUSTED",i.CapabilityRequested="CAPABILITY_REQUESTED",i.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(Ys||(Ys={}));var go=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},mo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},$i=class{constructor(e,t){this.language=e,this.expression=t}};go([p(),mo("design:type",_t)],$i.prototype,"language",void 0);go([p(),mo("design:type",String)],$i.prototype,"expression",void 0);$i=go([q(),mo("design:paramtypes",[_t,String])],$i);function Sy(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function wy(i){if(i.startsWith("literal://")){let a=new _t;a.address="literal",a.name="literal";let s=i.substring(10);return new $i(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new _t;return o.address=a,new $i(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new _t;return a.address="did",new $i(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var tt=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},$t=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Pa=class{};tt([p(),$t("design:type",String)],Pa.prototype,"name",void 0);tt([p(),$t("design:type",String)],Pa.prototype,"type",void 0);Pa=tt([q()],Pa);var mn=class{};tt([p(),$t("design:type",String)],mn.prototype,"label",void 0);tt([p(),$t("design:type",String)],mn.prototype,"name",void 0);tt([p(),$t("design:type",Array)],mn.prototype,"parameters",void 0);mn=tt([q()],mn);var Ra=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};tt([p(),$t("design:type",String)],Ra.prototype,"name",void 0);tt([p(),$t("design:type",String)],Ra.prototype,"parametersStringified",void 0);Ra=tt([Ae(),$t("design:paramtypes",[String,Object])],Ra);var Oa=class{};tt([p(),$t("design:type",String)],Oa.prototype,"did",void 0);tt([p(),$t("design:type",Li)],Oa.prototype,"status",void 0);Oa=tt([q()],Oa);var qc=class{},Hi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ar=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ti=class{};Hi([p(),Ar("design:type",String)],ti.prototype,"name",void 0);Hi([p(),Ar("design:type",String)],ti.prototype,"address",void 0);Hi([p(),Ar("design:type",String)],ti.prototype,"settings",void 0);Hi([p(),Ar("design:type",Ti)],ti.prototype,"icon",void 0);Hi([p(),Ar("design:type",Ti)],ti.prototype,"constructorIcon",void 0);Hi([p(),Ar("design:type",Ti)],ti.prototype,"settingsIcon",void 0);ti=Hi([q()],ti);var Be=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Qe=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},pt=class{};Be([p(),Qe("design:type",String)],pt.prototype,"name",void 0);Be([p(),Qe("design:type",String)],pt.prototype,"address",void 0);Be([p(),Qe("design:type",String)],pt.prototype,"description",void 0);Be([p(),Qe("design:type",String)],pt.prototype,"author",void 0);Be([p(),Qe("design:type",Boolean)],pt.prototype,"templated",void 0);Be([p(),Qe("design:type",String)],pt.prototype,"templateSourceLanguageAddress",void 0);Be([p(),Qe("design:type",String)],pt.prototype,"templateAppliedParams",void 0);Be([p(),Qe("design:type",Array)],pt.prototype,"possibleTemplateParams",void 0);Be([p(),Qe("design:type",String)],pt.prototype,"sourceCodeLink",void 0);pt=Be([q()],pt);var mr=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};Be([p(),Qe("design:type",String)],mr.prototype,"name",void 0);Be([p(),Qe("design:type",String)],mr.prototype,"description",void 0);Be([p(),Qe("design:type",Array)],mr.prototype,"possibleTemplateParams",void 0);Be([p(),Qe("design:type",String)],mr.prototype,"sourceCodeLink",void 0);mr=Be([Ae(),Qe("design:paramtypes",[String,String])],mr);var Vc=class{},zc=class extends ni(){},Hc=class{},za=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},yo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Da=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};za([p(),yo("design:type",String)],Da.prototype,"linkLanguage",void 0);za([p(),yo("design:type",Et)],Da.prototype,"meta",void 0);Da=za([q(),yo("design:paramtypes",[String,Et])],Da);var Xs=class extends ni(){};Xs=za([q()],Xs);var Ki=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Qi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},eo;(function(i){i.Private="PRIVATE",i.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",i.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",i.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",i.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",i.Synced="SYNCED"})(eo||(eo={}));var ii=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=eo.Private}};Ki([p(),Qi("design:type",String)],ii.prototype,"uuid",void 0);Ki([p(),Qi("design:type",String)],ii.prototype,"name",void 0);Ki([p(),Qi("design:type",String)],ii.prototype,"state",void 0);Ki([p(),Qi("design:type",String)],ii.prototype,"sharedUrl",void 0);Ki([p(),Qi("design:type",Xs)],ii.prototype,"neighbourhood",void 0);Ki([p(),Qi("design:type",Array)],ii.prototype,"owners",void 0);ii=Ki([q(),Qi("design:paramtypes",[String,String,String])],ii);var Ha=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ru=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ma=class{};Ha([p(),ru("design:type",Array)],Ma.prototype,"additions",void 0);Ha([p(),ru("design:type",Array)],Ma.prototype,"removals",void 0);Ma=Ha([q()],Ma);var Kc=class extends ni(){};Kc=Ha([q()],Kc);var Qc=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},nr=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Xr,Si,Zn="smart_literal://content";function Mh(i){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}var yn=class{constructor(e,t){Xr.set(this,void 0),Si.set(this,void 0),Qc(this,Xr,e,"f"),Qc(this,Si,t,"f")}get base(){return nr(this,Si,"f")}static async create(e,t){let r=Ce.from(Mh(10)).toUrl(),n=new yn(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new Te({source:t,predicate:Zn}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Te({predicate:Zn}))).map(r=>new yn(e,r.data.source))}async get(){let e=await nr(this,Xr,"f").getSingleTarget(new Te({source:nr(this,Si,"f"),predicate:Zn}));if(!e)throw`No content for smart literal ${nr(this,Si,"f")}`;return Ce.fromUrl(e).get()}async set(e){let t=Ce.from(e);await nr(this,Xr,"f").setSingleTarget(new Ni({source:nr(this,Si,"f"),predicate:Zn,target:t.toUrl()}))}};Xr=new WeakMap,Si=new WeakMap;var Wc=class{};function Oy(i,e,t){return{action:"addLink",source:i,predicate:e,target:t}}function Dy(i){return`triple(this, "${i}", _)`}function My(i){return function(e,t,r){if(typeof r.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");r.value=async function(a){let s=[],o=e.name,l=`subject_class("${o}", C), instance(C, Instance)`;if(i&&i.where)for(let u in i.where){let g=i.where[u];l+=`, property_getter(C, Instance, "${u}", "${g}")`}i&&i.condition&&(l+=", "+i.condition);try{let u=await a.infer(l);if(u&&u!==!1&&typeof u!="string"&&u.length>0){for(let g of u){let h=g.Instance,d=new lr(a,h,o);await d.init(),s.push(d)}return s}}catch{}let c=await a.getAllSubjectInstances(o);if(i&&i.where){let u=[];for(let g of c){let h=!0;for(let d in i.where){let y=i.where[d];if(await g[d]!==y){h=!1;break}}h&&u.push(g)}return u}return c}}}function nu(i){return function(e,t){if(typeof i.writable>"u"&&i.through&&(i.writable=!0),i.required&&!i.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!i.through&&!i.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...i},i.writable){let r=t;e[`set${Qt(r)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Uy(i){return function(e,t){if(!i.through&&!i.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!i.through)throw new Error("SubjectFlag requires a 'through' option");if(!i.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],through:i.through,required:!0,initial:i.value,flag:!0},e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Fy(i){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=i;let r=t;e[`add${Qt(r)}`]=()=>{},e[`remove${Qt(r)}`]=()=>{},e[`setCollection${Qt(r)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function au(i){let e="",t="abcdefghijklmnopqrstuvwxyz",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}function Uh(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){let t="",r=i.name,n=e.prototype,a=au(8);t+=`subject_class("${r}", ${a}).
1277
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};ve=new WeakMap,ua=new WeakMap;var Bt=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ye=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},vt,da,Xr,pa,en,wi,fa,tn,qc=class{constructor(e,t=!0){vt.set(this,void 0),da.set(this,void 0),Xr.set(this,void 0),pa.set(this,void 0),en.set(this,void 0),wi.set(this,void 0),fa.set(this,void 0),tn.set(this,void 0),Bt(this,vt,e,"f"),Bt(this,da,new un(ye(this,vt,"f"),t),"f"),Bt(this,Xr,new qs(ye(this,vt,"f")),"f"),Bt(this,pa,new Fs(ye(this,vt,"f")),"f"),Bt(this,en,new js(ye(this,vt,"f")),"f"),Bt(this,tn,new Ys(ye(this,vt,"f"),t),"f"),Bt(this,wi,new ka(ye(this,vt,"f"),t),"f"),ye(this,wi,"f").setExpressionClient(ye(this,Xr,"f")),ye(this,wi,"f").setNeighbourhoodClient(ye(this,en,"f")),ye(this,wi,"f").setAIClient(ye(this,tn,"f")),Bt(this,fa,new Bs(ye(this,vt,"f"),t),"f")}get agent(){return ye(this,da,"f")}get expression(){return ye(this,Xr,"f")}get languages(){return ye(this,pa,"f")}get neighbourhood(){return ye(this,en,"f")}get perspective(){return ye(this,wi,"f")}get runtime(){return ye(this,fa,"f")}get ai(){return ye(this,tn,"f")}};vt=new WeakMap,da=new WeakMap,Xr=new WeakMap,pa=new WeakMap,en=new WeakMap,wi=new WeakMap,fa=new WeakMap,tn=new WeakMap;var Xs;(function(i){i.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",i.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",i.AgentIsUntrusted="AGENT_IS_UNTRUSTED",i.CapabilityRequested="CAPABILITY_REQUESTED",i.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(Xs||(Xs={}));var mo=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},yo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ki=class{constructor(e,t){this.language=e,this.expression=t}};mo([p(),yo("design:type",St)],ki.prototype,"language",void 0);mo([p(),yo("design:type",String)],ki.prototype,"expression",void 0);ki=mo([q(),yo("design:paramtypes",[St,String])],ki);function wy(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function Ey(i){if(i.startsWith("literal://")){let a=new St;a.address="literal",a.name="literal";let s=i.substring(10);return new ki(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new St;return o.address=a,new ki(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new St;return a.address="did",new ki(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var it=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},It=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ra=class{};it([p(),It("design:type",String)],Ra.prototype,"name",void 0);it([p(),It("design:type",String)],Ra.prototype,"type",void 0);Ra=it([q()],Ra);var bn=class{};it([p(),It("design:type",String)],bn.prototype,"label",void 0);it([p(),It("design:type",String)],bn.prototype,"name",void 0);it([p(),It("design:type",Array)],bn.prototype,"parameters",void 0);bn=it([q()],bn);var Oa=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};it([p(),It("design:type",String)],Oa.prototype,"name",void 0);it([p(),It("design:type",String)],Oa.prototype,"parametersStringified",void 0);Oa=it([$e(),It("design:paramtypes",[String,Object])],Oa);var Da=class{};it([p(),It("design:type",String)],Da.prototype,"did",void 0);it([p(),It("design:type",Ri)],Da.prototype,"status",void 0);Da=it([q()],Da);var Vc=class{},Qi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},kr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ii=class{};Qi([p(),kr("design:type",String)],ii.prototype,"name",void 0);Qi([p(),kr("design:type",String)],ii.prototype,"address",void 0);Qi([p(),kr("design:type",String)],ii.prototype,"settings",void 0);Qi([p(),kr("design:type",Ni)],ii.prototype,"icon",void 0);Qi([p(),kr("design:type",Ni)],ii.prototype,"constructorIcon",void 0);Qi([p(),kr("design:type",Ni)],ii.prototype,"settingsIcon",void 0);ii=Qi([q()],ii);var Ve=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},We=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},pt=class{};Ve([p(),We("design:type",String)],pt.prototype,"name",void 0);Ve([p(),We("design:type",String)],pt.prototype,"address",void 0);Ve([p(),We("design:type",String)],pt.prototype,"description",void 0);Ve([p(),We("design:type",String)],pt.prototype,"author",void 0);Ve([p(),We("design:type",Boolean)],pt.prototype,"templated",void 0);Ve([p(),We("design:type",String)],pt.prototype,"templateSourceLanguageAddress",void 0);Ve([p(),We("design:type",String)],pt.prototype,"templateAppliedParams",void 0);Ve([p(),We("design:type",Array)],pt.prototype,"possibleTemplateParams",void 0);Ve([p(),We("design:type",String)],pt.prototype,"sourceCodeLink",void 0);pt=Ve([q()],pt);var br=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};Ve([p(),We("design:type",String)],br.prototype,"name",void 0);Ve([p(),We("design:type",String)],br.prototype,"description",void 0);Ve([p(),We("design:type",Array)],br.prototype,"possibleTemplateParams",void 0);Ve([p(),We("design:type",String)],br.prototype,"sourceCodeLink",void 0);br=Ve([$e(),We("design:paramtypes",[String,String])],br);var zc=class{},Hc=class extends ai(){},Kc=class{},Ha=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},vo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ma=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Ha([p(),vo("design:type",String)],Ma.prototype,"linkLanguage",void 0);Ha([p(),vo("design:type",xt)],Ma.prototype,"meta",void 0);Ma=Ha([q(),vo("design:paramtypes",[String,xt])],Ma);var eo=class extends ai(){};eo=Ha([q()],eo);var Wi=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Gi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},to;(function(i){i.Private="PRIVATE",i.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",i.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",i.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",i.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",i.Synced="SYNCED"})(to||(to={}));var ri=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=to.Private}};Wi([p(),Gi("design:type",String)],ri.prototype,"uuid",void 0);Wi([p(),Gi("design:type",String)],ri.prototype,"name",void 0);Wi([p(),Gi("design:type",String)],ri.prototype,"state",void 0);Wi([p(),Gi("design:type",String)],ri.prototype,"sharedUrl",void 0);Wi([p(),Gi("design:type",eo)],ri.prototype,"neighbourhood",void 0);Wi([p(),Gi("design:type",Array)],ri.prototype,"owners",void 0);ri=Wi([q(),Gi("design:paramtypes",[String,String,String])],ri);var Ka=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},nu=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ua=class{};Ka([p(),nu("design:type",Array)],Ua.prototype,"additions",void 0);Ka([p(),nu("design:type",Array)],Ua.prototype,"removals",void 0);Ua=Ka([q()],Ua);var Qc=class extends ai(){};Qc=Ka([q()],Qc);var Wc=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},or=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},rn,Ei,Jn="smart_literal://content";function Uh(i){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}var _n=class{constructor(e,t){rn.set(this,void 0),Ei.set(this,void 0),Wc(this,rn,e,"f"),Wc(this,Ei,t,"f")}get base(){return or(this,Ei,"f")}static async create(e,t){let r=Ce.from(Uh(10)).toUrl(),n=new _n(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new Te({source:t,predicate:Jn}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Te({predicate:Jn}))).map(r=>new _n(e,r.data.source))}async get(){let e=await or(this,rn,"f").getSingleTarget(new Te({source:or(this,Ei,"f"),predicate:Jn}));if(!e)throw`No content for smart literal ${or(this,Ei,"f")}`;return Ce.fromUrl(e).get()}async set(e){let t=Ce.from(e);await or(this,rn,"f").setSingleTarget(new Pi({source:or(this,Ei,"f"),predicate:Jn,target:t.toUrl()}))}};rn=new WeakMap,Ei=new WeakMap;var Gc=class{};function Dy(i,e,t){return{action:"addLink",source:i,predicate:e,target:t}}function My(i){return`triple(this, "${i}", _)`}function Uy(i){return function(e,t,r){if(typeof r.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");r.value=async function(a){let s=[],o=e.name,l=`subject_class("${o}", C), instance(C, Instance)`;if(i&&i.where)for(let u in i.where){let g=i.where[u];l+=`, property_getter(C, Instance, "${u}", "${g}")`}i&&i.condition&&(l+=", "+i.condition);try{let u=await a.infer(l);if(u&&u!==!1&&typeof u!="string"&&u.length>0){for(let g of u){let h=g.Instance,d=new pr(a,h,o);await d.init(),s.push(d)}return s}}catch{}let c=await a.getAllSubjectInstances(o);if(i&&i.where){let u=[];for(let g of c){let h=!0;for(let d in i.where){let y=i.where[d];if(await g[d]!==y){h=!1;break}}h&&u.push(g)}return u}return c}}}function au(i){return function(e,t){if(typeof i.writable>"u"&&i.through&&(i.writable=!0),i.required&&!i.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!i.through&&!i.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...i},i.writable){let r=t;e[`set${Wt(r)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Fy(i){return function(e,t){if(!i.through&&!i.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!i.through)throw new Error("SubjectFlag requires a 'through' option");if(!i.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],through:i.through,required:!0,initial:i.value,flag:!0},e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function jy(i){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=i;let r=t;e[`add${Wt(r)}`]=()=>{},e[`remove${Wt(r)}`]=()=>{},e[`setCollection${Wt(r)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function su(i){let e="",t="abcdefghijklmnopqrstuvwxyz",r=t.length;for(let n=0;n<i;n++)e+=t.charAt(Math.floor(Math.random()*r));return e}function Fh(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){let t="",r=i.name,n=e.prototype,a=su(8);t+=`subject_class("${r}", ${a}).
1328
1278
  `;let s=[],o=[];n.subjectConstructor&&n.subjectConstructor.length&&(o=o.concat(n.subjectConstructor));let l=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(l=l.concat(n.isSubjectInstance));let c=[],u=n.__properties||{};for(let y in u){let _=`property(${a}, "${y}").
1329
- `,{through:E,initial:$,required:T,resolveLanguage:C,writable:A,flag:k,getter:J,setter:I,local:R}=u[y];if(C&&(_+=`property_resolve(${a}, "${y}").
1279
+ `,{through:E,initial:$,required:T,resolveLanguage:C,writable:A,flag:k,getter:J,setter:I,local:O}=u[y];if(C&&(_+=`property_resolve(${a}, "${y}").
1330
1280
  `,_+=`property_resolve_language(${a}, "${y}", "${C}").
1331
1281
  `),J?_+=`property_getter(${a}, Base, "${y}", Value) :- ${J}.
1332
1282
  `:E&&(_+=`property_getter(${a}, Base, "${y}", Value) :- triple(Base, "${E}", Value).
1333
1283
  `,T&&(k?l.push(`triple(Base, "${E}", "${$}")`):l.push(`triple(Base, "${E}", _)`))),I)_+=`property_setter(${a}, "${y}", Actions) :- ${I}.
1334
- `;else if(A&&E&&typeof n[ao(y)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:E,target:"value",...R&&{local:!0}}];_+=`property_setter(${a}, "${y}", '${fi(P)}').
1284
+ `;else if(A&&E&&typeof n[so(y)]=="function"){let R=[{action:"setSingleTarget",source:"this",predicate:E,target:"value",...O&&{local:!0}}];_+=`property_setter(${a}, "${y}", '${gi(R)}').
1335
1285
  `}c.push(_),$&&(o.push({action:"addLink",source:"this",predicate:E,target:$}),s.push({action:"removeLink",source:"this",predicate:E,target:"*"}))}let g=[],h=n.__collections||{};for(let y in h){let _=`collection(${a}, "${y}").
1336
- `,{through:E,where:$,local:T}=h[y];if(E){if($){if(!$.isInstance&&!$.condition)throw"'where' needs one of 'isInstance' or 'condition'";let J=[];if($.isInstance){let R;$.isInstance.name?R=$.isInstance.name:R=$.isInstance,J.push(`instance(OtherClass, Target), subject_class("${R}", OtherClass)`)}$.condition&&J.push($.condition);let I=J.join(", ");_+=`collection_getter(${a}, Base, "${y}", List) :- setof(Target, (triple(Base, "${E}", Target), ${I}), List).
1286
+ `,{through:E,where:$,local:T}=h[y];if(E){if($){if(!$.isInstance&&!$.condition)throw"'where' needs one of 'isInstance' or 'condition'";let J=[];if($.isInstance){let O;$.isInstance.name?O=$.isInstance.name:O=$.isInstance,J.push(`instance(OtherClass, Target), subject_class("${O}", OtherClass)`)}$.condition&&J.push($.condition);let I=J.join(", ");_+=`collection_getter(${a}, Base, "${y}", List) :- setof(Target, (triple(Base, "${E}", Target), ${I}), List).
1337
1287
  `}else _+=`collection_getter(${a}, Base, "${y}", List) :- findall(C, triple(Base, "${E}", C), List).
1338
- `;let C=[{action:"addLink",source:"this",predicate:E,target:"value",...T&&{local:!0}}],A=[{action:"removeLink",source:"this",predicate:E,target:"value"}],k=[{action:"collectionSetter",source:"this",predicate:E,target:"value",...T&&{local:!0}}];_+=`collection_adder(${a}, "${cr(y)}", '${fi(C)}').
1339
- `,_+=`collection_remover(${a}, "${cr(y)}", '${fi(A)}').
1340
- `,_+=`collection_setter(${a}, "${cr(y)}", '${fi(k)}').
1341
- `}g.push(_)}let d=fi(o);if(t+=`constructor(${a}, '${d}').
1288
+ `;let C=[{action:"addLink",source:"this",predicate:E,target:"value",...T&&{local:!0}}],A=[{action:"removeLink",source:"this",predicate:E,target:"value"}],k=[{action:"collectionSetter",source:"this",predicate:E,target:"value",...T&&{local:!0}}];_+=`collection_adder(${a}, "${dr(y)}", '${gi(C)}').
1289
+ `,_+=`collection_remover(${a}, "${dr(y)}", '${gi(A)}').
1290
+ `,_+=`collection_setter(${a}, "${dr(y)}", '${gi(k)}').
1291
+ `}g.push(_)}let d=gi(o);if(t+=`constructor(${a}, '${d}').
1342
1292
  `,l.length>0){let y=l.join(", ");t+=`instance(${a}, Base) :- ${y}.
1343
1293
  `,t+=`
1344
- `}return t+=`destructor(${a}, '${fi(s)}').
1294
+ `}return t+=`destructor(${a}, '${gi(s)}').
1345
1295
  `,t+=`
1346
1296
  `,t+=c.join(`
1347
1297
  `),t+=`
1348
1298
  `,t+=g.join(`
1349
- `),{sdna:t,name:r}},Object.defineProperty(e,"type",{configurable:!0})}}function jy(i){return nu({...i,required:!0,writable:!0,initial:i.initial||"literal://string:uninitialized"})}function By(i){return nu({...i,writable:!1})}var qy=`
1299
+ `),{sdna:t,name:r}},Object.defineProperty(e,"type",{configurable:!0})}}function By(i){return au({...i,required:!0,writable:!0,initial:i.initial||"literal://string:uninitialized"})}function qy(i){return au({...i,writable:!1})}var Vy=`
1350
1300
  type AIModelLoadingStatus {
1351
1301
  downloaded: Boolean!
1352
1302
  loaded: Boolean!
@@ -1932,7 +1882,7 @@ input VoiceActivityParamsInput {
1932
1882
  startWindow: Float
1933
1883
  timeBeforeSpeech: Float
1934
1884
  }
1935
- `,w=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},f=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},H=function(i,e){return function(t,r){e(t,r,i)}},En=new Jt;En.author="did:ad4m:test";En.timestamp=Date.now();En.data={source:"root",target:"neighbourhood://Qm12345"};En.proof={signature:"",key:"",valid:!0};var Ht=new Li;Ht.author="did:ad4m:test";Ht.timestamp=Date.now().toString();Ht.proof=new Rt("","");Ht.data=new Et([En]);var Ua=class{};w([p(),f("design:type",String)],Ua.prototype,"recipient",void 0);w([p(),f("design:type",Li)],Ua.prototype,"message",void 0);Ua=w([q()],Ua);var yr=class{};w([p(),f("design:type",String)],yr.prototype,"ad4mExecutorVersion",void 0);w([p(),f("design:type",Boolean)],yr.prototype,"isInitialized",void 0);w([p(),f("design:type",Boolean)],yr.prototype,"isUnlocked",void 0);yr=w([q()],yr);var Ui=class{};w([p(),f("design:type",String)],Ui.prototype,"title",void 0);w([p(),f("design:type",String)],Ui.prototype,"message",void 0);w([p(),f("design:type",String)],Ui.prototype,"type",void 0);w([p(),f("design:type",String)],Ui.prototype,"addon",void 0);Ui=w([q()],Ui);var ct=class{};w([p(),f("design:type",String)],ct.prototype,"description",void 0);w([p(),f("design:type",String)],ct.prototype,"appName",void 0);w([p(),f("design:type",String)],ct.prototype,"appUrl",void 0);w([p(),f("design:type",String)],ct.prototype,"appIconPath",void 0);w([p(),f("design:type",String)],ct.prototype,"trigger",void 0);w([p(),f("design:type",Array)],ct.prototype,"perspectiveIds",void 0);w([p(),f("design:type",String)],ct.prototype,"webhookUrl",void 0);w([p(),f("design:type",String)],ct.prototype,"webhookAuth",void 0);ct=w([Ae()],ct);var Ye=class{};w([p(),f("design:type",String)],Ye.prototype,"id",void 0);w([p(),f("design:type",Boolean)],Ye.prototype,"granted",void 0);w([p(),f("design:type",String)],Ye.prototype,"description",void 0);w([p(),f("design:type",String)],Ye.prototype,"appName",void 0);w([p(),f("design:type",String)],Ye.prototype,"appUrl",void 0);w([p(),f("design:type",String)],Ye.prototype,"appIconPath",void 0);w([p(),f("design:type",String)],Ye.prototype,"trigger",void 0);w([p(),f("design:type",Array)],Ye.prototype,"perspectiveIds",void 0);w([p(),f("design:type",String)],Ye.prototype,"webhookUrl",void 0);w([p(),f("design:type",String)],Ye.prototype,"webhookAuth",void 0);Ye=w([q()],Ye);var vr=class{};w([p(),f("design:type",Ye)],vr.prototype,"notification",void 0);w([p(),f("design:type",String)],vr.prototype,"perspectiveId",void 0);w([p(),f("design:type",String)],vr.prototype,"triggerMatch",void 0);vr=w([q()],vr);var xe=class{};w([p(),f("design:type",Number)],xe.prototype,"total",void 0);w([p(),f("design:type",Number)],xe.prototype,"imported",void 0);w([p(),f("design:type",Number)],xe.prototype,"failed",void 0);w([p(),f("design:type",Number)],xe.prototype,"omitted",void 0);w([p(),f("design:type",Array)],xe.prototype,"errors",void 0);xe=w([q()],xe);var Xe=class{};w([p(),f("design:type",xe)],Xe.prototype,"perspectives",void 0);w([p(),f("design:type",xe)],Xe.prototype,"links",void 0);w([p(),f("design:type",xe)],Xe.prototype,"expressions",void 0);w([p(),f("design:type",xe)],Xe.prototype,"perspectiveDiffs",void 0);w([p(),f("design:type",xe)],Xe.prototype,"notifications",void 0);w([p(),f("design:type",xe)],Xe.prototype,"models",void 0);w([p(),f("design:type",xe)],Xe.prototype,"defaultModels",void 0);w([p(),f("design:type",xe)],Xe.prototype,"tasks",void 0);w([p(),f("design:type",xe)],Xe.prototype,"friends",void 0);w([p(),f("design:type",xe)],Xe.prototype,"trustedAgents",void 0);w([p(),f("design:type",xe)],Xe.prototype,"knownLinkLanguages",void 0);Xe=w([q()],Xe);var br=class{};w([p(),f("design:type",String)],br.prototype,"email",void 0);w([p(),f("design:type",String)],br.prototype,"did",void 0);w([p(),f("design:type",String)],br.prototype,"lastSeen",void 0);w([p(),f("design:type",Number)],br.prototype,"perspectiveCount",void 0);br=w([q()],br);var Fi=class{};w([p(),f("design:type",Boolean)],Fi.prototype,"success",void 0);w([p(),f("design:type",String)],Fi.prototype,"message",void 0);w([p(),f("design:type",Boolean)],Fi.prototype,"requiresPassword",void 0);w([p(),f("design:type",Boolean)],Fi.prototype,"isExistingUser",void 0);Fi=w([q()],Fi);var U=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,r,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Ht}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Ht]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Ht}]}runtimeMessageReceived(){return Ht}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Ys.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,r){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,r){return new Pi("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,r){return!0}};w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeQuit",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeOpenLink",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",yr)],U.prototype,"runtimeInfo",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"addTrustedAgents",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"deleteTrustedAgents",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"getTrustedAgents",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"runtimeKnownLinkLanguageTemplates",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"runtimeAddKnownLinkLanguageTemplates",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"runtimeFriends",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"runtimeAddFriends",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"runtimeRemoveFriends",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",String)],U.prototype,"runtimeHcAgentInfos",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",String)],U.prototype,"runtimeGetNetworkMetrics",null);w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeRestartHolochain",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Object]),f("design:returntype",Boolean)],U.prototype,"runtimeHcAddAgentInfos",null);w([et(),H(0,z()),H(1,z()),H(2,z()),H(3,z()),f("design:type",Function),f("design:paramtypes",[String,String,String,String]),f("design:returntype",void 0)],U.prototype,"runtimeVerifyStringSignedByDid",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Et]),f("design:returntype",Boolean)],U.prototype,"runtimeSetStatus",null);w([et(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Li)],U.prototype,"runtimeFriendStatus",null);w([re(),H(0,z()),H(1,z()),f("design:type",Function),f("design:paramtypes",[String,wa]),f("design:returntype",Boolean)],U.prototype,"runtimeFriendSendMessage",null);w([et(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Array)],U.prototype,"runtimeMessageInbox",null);w([et(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Array)],U.prototype,"runtimeMessageOutbox",null);w([io(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Li)],U.prototype,"runtimeMessageReceived",null);w([io(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Ui)],U.prototype,"exceptionOccurred",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[ct]),f("design:returntype",String)],U.prototype,"runtimeRequestInstallNotification",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"runtimeNotifications",null);w([re(),H(0,z()),H(1,z()),f("design:type",Function),f("design:paramtypes",[String,ct]),f("design:returntype",Boolean)],U.prototype,"runtimeUpdateNotification",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeRemoveNotification",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeGrantNotification",null);w([io(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",vr)],U.prototype,"runtimeNotificationTriggered",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeExportDb",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeImportDb",null);w([re(),H(0,z()),H(1,z()),f("design:type",Function),f("design:paramtypes",[String,String]),f("design:returntype",Boolean)],U.prototype,"runtimeExportPerspective",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeImportPerspective",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeMultiUserEnabled",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[Boolean]),f("design:returntype",Boolean)],U.prototype,"runtimeSetMultiUserEnabled",null);w([et(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"runtimeListUsers",null);w([re(),H(0,z()),H(1,z()),f("design:type",Function),f("design:paramtypes",[String,xt]),f("design:returntype",Fi)],U.prototype,"runtimeRequestLoginVerification",null);w([re(),H(0,z()),H(1,z()),H(2,z()),f("design:type",Function),f("design:paramtypes",[String,String,String]),f("design:returntype",String)],U.prototype,"runtimeVerifyEmailCode",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeTestEmail",null);w([re(),H(0,z()),H(1,z()),H(2,z()),f("design:type",Function),f("design:paramtypes",[String,String,xt]),f("design:returntype",Pi)],U.prototype,"runtimeCreateUser",null);w([re(),H(0,z()),H(1,z()),f("design:type",Function),f("design:paramtypes",[String,String]),f("design:returntype",String)],U.prototype,"runtimeLoginUser",null);w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeEnable",null);w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeDisable",null);w([re(),H(0,z()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",String)],U.prototype,"runtimeEmailTestGetCode",null);w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeEmailTestClearCodes",null);w([re(),H(0,z()),H(1,z()),H(2,z()),f("design:type",Function),f("design:paramtypes",[String,String,Number]),f("design:returntype",Boolean)],U.prototype,"runtimeEmailTestSetExpiry",null);U=w([md()],U);var Rr=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ne=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Fe,fa,ha,we;function ga(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Gc(i){return i?`triple("${i}", "ad4m://has_child", Base)`:""}function Zc(){return`
1885
+ `,w=function(i,e,t,r){var n=arguments.length,a=n<3?e:r===null?r=Object.getOwnPropertyDescriptor(e,t):r,s;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(i,e,t,r);else for(var o=i.length-1;o>=0;o--)(s=i[o])&&(a=(n<3?s(a):n>3?s(e,t,a):s(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},f=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},K=function(i,e){return function(t,r){e(t,r,i)}},$n=new Yt;$n.author="did:ad4m:test";$n.timestamp=Date.now();$n.data={source:"root",target:"neighbourhood://Qm12345"};$n.proof={signature:"",key:"",valid:!0};var Kt=new Ri;Kt.author="did:ad4m:test";Kt.timestamp=Date.now().toString();Kt.proof=new Ot("","");Kt.data=new xt([$n]);var Fa=class{};w([p(),f("design:type",String)],Fa.prototype,"recipient",void 0);w([p(),f("design:type",Ri)],Fa.prototype,"message",void 0);Fa=w([q()],Fa);var _r=class{};w([p(),f("design:type",String)],_r.prototype,"ad4mExecutorVersion",void 0);w([p(),f("design:type",Boolean)],_r.prototype,"isInitialized",void 0);w([p(),f("design:type",Boolean)],_r.prototype,"isUnlocked",void 0);_r=w([q()],_r);var ji=class{};w([p(),f("design:type",String)],ji.prototype,"title",void 0);w([p(),f("design:type",String)],ji.prototype,"message",void 0);w([p(),f("design:type",String)],ji.prototype,"type",void 0);w([p(),f("design:type",String)],ji.prototype,"addon",void 0);ji=w([q()],ji);var lt=class{};w([p(),f("design:type",String)],lt.prototype,"description",void 0);w([p(),f("design:type",String)],lt.prototype,"appName",void 0);w([p(),f("design:type",String)],lt.prototype,"appUrl",void 0);w([p(),f("design:type",String)],lt.prototype,"appIconPath",void 0);w([p(),f("design:type",String)],lt.prototype,"trigger",void 0);w([p(),f("design:type",Array)],lt.prototype,"perspectiveIds",void 0);w([p(),f("design:type",String)],lt.prototype,"webhookUrl",void 0);w([p(),f("design:type",String)],lt.prototype,"webhookAuth",void 0);lt=w([$e()],lt);var Xe=class{};w([p(),f("design:type",String)],Xe.prototype,"id",void 0);w([p(),f("design:type",Boolean)],Xe.prototype,"granted",void 0);w([p(),f("design:type",String)],Xe.prototype,"description",void 0);w([p(),f("design:type",String)],Xe.prototype,"appName",void 0);w([p(),f("design:type",String)],Xe.prototype,"appUrl",void 0);w([p(),f("design:type",String)],Xe.prototype,"appIconPath",void 0);w([p(),f("design:type",String)],Xe.prototype,"trigger",void 0);w([p(),f("design:type",Array)],Xe.prototype,"perspectiveIds",void 0);w([p(),f("design:type",String)],Xe.prototype,"webhookUrl",void 0);w([p(),f("design:type",String)],Xe.prototype,"webhookAuth",void 0);Xe=w([q()],Xe);var Sr=class{};w([p(),f("design:type",Xe)],Sr.prototype,"notification",void 0);w([p(),f("design:type",String)],Sr.prototype,"perspectiveId",void 0);w([p(),f("design:type",String)],Sr.prototype,"triggerMatch",void 0);Sr=w([q()],Sr);var Ae=class{};w([p(),f("design:type",Number)],Ae.prototype,"total",void 0);w([p(),f("design:type",Number)],Ae.prototype,"imported",void 0);w([p(),f("design:type",Number)],Ae.prototype,"failed",void 0);w([p(),f("design:type",Number)],Ae.prototype,"omitted",void 0);w([p(),f("design:type",Array)],Ae.prototype,"errors",void 0);Ae=w([q()],Ae);var et=class{};w([p(),f("design:type",Ae)],et.prototype,"perspectives",void 0);w([p(),f("design:type",Ae)],et.prototype,"links",void 0);w([p(),f("design:type",Ae)],et.prototype,"expressions",void 0);w([p(),f("design:type",Ae)],et.prototype,"perspectiveDiffs",void 0);w([p(),f("design:type",Ae)],et.prototype,"notifications",void 0);w([p(),f("design:type",Ae)],et.prototype,"models",void 0);w([p(),f("design:type",Ae)],et.prototype,"defaultModels",void 0);w([p(),f("design:type",Ae)],et.prototype,"tasks",void 0);w([p(),f("design:type",Ae)],et.prototype,"friends",void 0);w([p(),f("design:type",Ae)],et.prototype,"trustedAgents",void 0);w([p(),f("design:type",Ae)],et.prototype,"knownLinkLanguages",void 0);et=w([q()],et);var wr=class{};w([p(),f("design:type",String)],wr.prototype,"email",void 0);w([p(),f("design:type",String)],wr.prototype,"did",void 0);w([p(),f("design:type",String)],wr.prototype,"lastSeen",void 0);w([p(),f("design:type",Number)],wr.prototype,"perspectiveCount",void 0);wr=w([q()],wr);var Bi=class{};w([p(),f("design:type",Boolean)],Bi.prototype,"success",void 0);w([p(),f("design:type",String)],Bi.prototype,"message",void 0);w([p(),f("design:type",Boolean)],Bi.prototype,"requiresPassword",void 0);w([p(),f("design:type",Boolean)],Bi.prototype,"isExistingUser",void 0);Bi=w([q()],Bi);var U=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,r,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Kt}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Kt]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Kt}]}runtimeMessageReceived(){return Kt}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Xs.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,r){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,r){return new Oi("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,r){return!0}};w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeQuit",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeOpenLink",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",_r)],U.prototype,"runtimeInfo",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"addTrustedAgents",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"deleteTrustedAgents",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"getTrustedAgents",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"runtimeKnownLinkLanguageTemplates",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"runtimeAddKnownLinkLanguageTemplates",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"runtimeFriends",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"runtimeAddFriends",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[Array]),f("design:returntype",Array)],U.prototype,"runtimeRemoveFriends",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",String)],U.prototype,"runtimeHcAgentInfos",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",String)],U.prototype,"runtimeGetNetworkMetrics",null);w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeRestartHolochain",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[Object]),f("design:returntype",Boolean)],U.prototype,"runtimeHcAddAgentInfos",null);w([tt(),K(0,H()),K(1,H()),K(2,H()),K(3,H()),f("design:type",Function),f("design:paramtypes",[String,String,String,String]),f("design:returntype",void 0)],U.prototype,"runtimeVerifyStringSignedByDid",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[xt]),f("design:returntype",Boolean)],U.prototype,"runtimeSetStatus",null);w([tt(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Ri)],U.prototype,"runtimeFriendStatus",null);w([re(),K(0,H()),K(1,H()),f("design:type",Function),f("design:paramtypes",[String,Ea]),f("design:returntype",Boolean)],U.prototype,"runtimeFriendSendMessage",null);w([tt(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Array)],U.prototype,"runtimeMessageInbox",null);w([tt(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Array)],U.prototype,"runtimeMessageOutbox",null);w([ro(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Ri)],U.prototype,"runtimeMessageReceived",null);w([ro(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",ji)],U.prototype,"exceptionOccurred",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[lt]),f("design:returntype",String)],U.prototype,"runtimeRequestInstallNotification",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"runtimeNotifications",null);w([re(),K(0,H()),K(1,H()),f("design:type",Function),f("design:paramtypes",[String,lt]),f("design:returntype",Boolean)],U.prototype,"runtimeUpdateNotification",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeRemoveNotification",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeGrantNotification",null);w([ro(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Sr)],U.prototype,"runtimeNotificationTriggered",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeExportDb",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeImportDb",null);w([re(),K(0,H()),K(1,H()),f("design:type",Function),f("design:paramtypes",[String,String]),f("design:returntype",Boolean)],U.prototype,"runtimeExportPerspective",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeImportPerspective",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeMultiUserEnabled",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[Boolean]),f("design:returntype",Boolean)],U.prototype,"runtimeSetMultiUserEnabled",null);w([tt(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Array)],U.prototype,"runtimeListUsers",null);w([re(),K(0,H()),K(1,H()),f("design:type",Function),f("design:paramtypes",[String,At]),f("design:returntype",Bi)],U.prototype,"runtimeRequestLoginVerification",null);w([re(),K(0,H()),K(1,H()),K(2,H()),f("design:type",Function),f("design:paramtypes",[String,String,String]),f("design:returntype",String)],U.prototype,"runtimeVerifyEmailCode",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",Boolean)],U.prototype,"runtimeTestEmail",null);w([re(),K(0,H()),K(1,H()),K(2,H()),f("design:type",Function),f("design:paramtypes",[String,String,At]),f("design:returntype",Oi)],U.prototype,"runtimeCreateUser",null);w([re(),K(0,H()),K(1,H()),f("design:type",Function),f("design:paramtypes",[String,String]),f("design:returntype",String)],U.prototype,"runtimeLoginUser",null);w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeEnable",null);w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeDisable",null);w([re(),K(0,H()),f("design:type",Function),f("design:paramtypes",[String]),f("design:returntype",String)],U.prototype,"runtimeEmailTestGetCode",null);w([re(),f("design:type",Function),f("design:paramtypes",[]),f("design:returntype",Boolean)],U.prototype,"runtimeEmailTestClearCodes",null);w([re(),K(0,H()),K(1,H()),K(2,H()),f("design:type",Function),f("design:paramtypes",[String,String,Number]),f("design:returntype",Boolean)],U.prototype,"runtimeEmailTestSetExpiry",null);U=w([yd()],U);var Mr=function(i,e,t,r,n){if(r==="m")throw new TypeError("Private method is not writable");if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?i!==e||!n:!e.has(i))throw new TypeError("Cannot write private member to an object whose class did not declare it");return r==="a"?n.call(i,t):n?n.value=t:e.set(i,t),t},ne=function(i,e,t,r){if(t==="a"&&!r)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?i!==e||!r:!e.has(i))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?r:t==="a"?r.call(i):r?r.value:e.get(i)},Be,ha,ga,Ee;function ma(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Zc(i){return i?`triple("${i}", "ad4m://has_child", Base)`:""}function Jc(){return`
1936
1886
  findall(
1937
1887
  [T, A],
1938
1888
  link(Base, _, _, T, A),
@@ -1940,13 +1890,13 @@ input VoiceActivityParamsInput {
1940
1890
  ),
1941
1891
  sort(AllLinks, SortedLinks),
1942
1892
  SortedLinks = [[Timestamp, Author]|_]
1943
- `}function Fh(i){return`
1893
+ `}function jh(i){return`
1944
1894
  findall([PropertyName, PropertyValue, Resolve], (
1945
1895
  % Constrain to specified properties if provided
1946
1896
  ${i?`member(PropertyName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
1947
1897
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1948
1898
  ), Properties)
1949
- `}function jh(i){return`
1899
+ `}function Bh(i){return`
1950
1900
  findall([CollectionName, CollectionValues], (
1951
1901
  % Constrain to specified collections if provided
1952
1902
  ${i?`member(CollectionName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
@@ -1954,12 +1904,12 @@ input VoiceActivityParamsInput {
1954
1904
  collection(SubjectClass, CollectionName),
1955
1905
  collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
1956
1906
  ), Collections)
1957
- `}function Jc(i={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(i).map(([t,r])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,s=ga(t);if(Array.isArray(r)){let o=r.map(l=>e(l)).join(", ");return n?`member(${s}, [${o}])`:`${a}, member(Value${t}, [${o}])`}if(typeof r=="object"&&r!==null){let{not:o,between:l,lt:c,lte:u,gt:g,gte:h}=r;if(o!==void 0)if(Array.isArray(o)){let y=o.map(_=>e(_)).join(", ");return n?`\\+ member(${s}, [${y}])`:`${a}, \\+ member(Value${t}, [${y}])`}else return n?`${s} \\= ${e(o)}`:`${a}, Value${t} \\= ${e(o)}`;if(l!==void 0&&Array.isArray(l)&&l.length===2)return n?`${s} >= ${l[0]}, ${s} =< ${l[1]}`:`${a}, Value${t} >= ${l[0]}, Value${t} =< ${l[1]}`;let d=[{value:c,symbol:"<"},{value:u,symbol:"=<"},{value:g,symbol:">"},{value:h,symbol:">="}];for(let{value:y,symbol:_}of d)if(y!==void 0)return n?`${s} ${_} ${y}`:`${a}, Value${t} ${_} ${y}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function Yc(i){return i?"length(UnsortedInstances, TotalCount)":""}function Xc(i){if(!i)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(i)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function el(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function tl(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function il(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function vo(i){if(!!i){if(typeof i=="string")return i;if(Array.isArray(i)&&i.length>0)return i.find(t=>t!=="null")||i[0]}}function su(i,e){return vo(i.type)===e}function rl(i){return su(i,"array")}function nl(i){return su(i,"object")}function Bh(i){let e=vo(i.type);return e==="number"||e==="integer"}var Ii=class{static async getClassName(e){if(this===Ii)return await e.stringOrTemplateObjectToSubjectClassName(this);let r=this.classNamesByClass.get(this);r||(r={},this.classNamesByClass.set(this,r));let n=e.uuid;return r[n]||(r[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),r[n]}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let t=e.className,r={},n=e.__properties||{};for(let[u,g]of Object.entries(n)){let h=g;r[u]={name:u,predicate:h.through||"",required:h.required||!1,writable:h.writable||!1,...h.initial!==void 0&&{initial:h.initial},...h.resolveLanguage!==void 0&&{resolveLanguage:h.resolveLanguage},...h.getter!==void 0&&{getter:h.getter},...h.setter!==void 0&&{setter:h.setter},...h.local!==void 0&&{local:h.local},...h.transform!==void 0&&{transform:h.transform},...h.flag!==void 0&&{flag:h.flag}}}let a={},s=e.__collections||{};for(let[u,g]of Object.entries(s)){let h=g;a[u]={name:u,predicate:h.through||"",...h.where!==void 0&&{where:h.where},...h.local!==void 0&&{local:h.local}}}let o=Object.keys(r).length>0,l=Object.keys(a).length>0;if(!(o||l)&&e.__jsonSchema){let u=e.__jsonSchema,g=e.__jsonSchemaOptions||{};if(u.properties)for(let[h,d]of Object.entries(u.properties)){let y=rl(d),_=this.determinePredicate(u,h,d,this.determineNamespace(u,g),g);if(y)a[h]={name:h,predicate:_,...d["x-ad4m"]?.local!==void 0&&{local:d["x-ad4m"].local}};else{let E=u.required?.includes(h)||!1;r[h]={name:h,predicate:_,required:E,writable:d["x-ad4m"]?.writable!==!1,...d["x-ad4m"]?.resolveLanguage&&{resolveLanguage:d["x-ad4m"].resolveLanguage},...d["x-ad4m"]?.initial&&{initial:d["x-ad4m"].initial},...d["x-ad4m"]?.local!==void 0&&{local:d["x-ad4m"].local}}}}}return{className:t,properties:r,collections:a}}constructor(e,t,r){Fe.set(this,void 0),fa.set(this,void 0),ha.set(this,void 0),we.set(this,void 0),Rr(this,Fe,t||Ce.from(au(24)).toUrl(),"f"),Rr(this,we,e,"f"),Rr(this,ha,r||"ad4m://self","f")}get baseExpression(){return ne(this,Fe,"f")}get perspective(){return ne(this,we,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,t){if(t.writable===!1)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.setter)throw new Error(`Custom setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateCollectionAction(e,t){let r=this.getCollectionMetadata(e);if(!r)throw new Error(`Collection "${e}" has no metadata defined`);if(!r.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:r.through,target:"value",...r.local&&{local:!0}}]}static async assignValuesToInstance(e,t,r){let n=Object.fromEntries(await Promise.all(r.map(async([a,s,o])=>{let l=s;if(!o&&typeof s=="string"){let u=Array.from(s,d=>d.codePointAt(0)),g=u.every(d=>d<=255),h=u.some(d=>d>=128);if(g&&h)try{let d=Uint8Array.from(u),y=new TextDecoder("utf-8",{fatal:!0}).decode(d);y!==s&&(l=y)}catch(d){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:s,error:d})}}if(o){let u=await e.getExpression(s);if(u)try{l=JSON.parse(u.data)}catch{l=u.data}}let c=t.__properties?.[a]?.transform;return c&&typeof c=="function"&&(l=c(l)),[a,l]})));Object.assign(t,n)}async getData(){try{let e=this.constructor,t=e.getModelMetadata(),n=`
1907
+ `}function Yc(i={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(i).map(([t,r])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,s=ma(t);if(Array.isArray(r)){let o=r.map(l=>e(l)).join(", ");return n?`member(${s}, [${o}])`:`${a}, member(Value${t}, [${o}])`}if(typeof r=="object"&&r!==null){let{not:o,between:l,lt:c,lte:u,gt:g,gte:h}=r;if(o!==void 0)if(Array.isArray(o)){let y=o.map(_=>e(_)).join(", ");return n?`\\+ member(${s}, [${y}])`:`${a}, \\+ member(Value${t}, [${y}])`}else return n?`${s} \\= ${e(o)}`:`${a}, Value${t} \\= ${e(o)}`;if(l!==void 0&&Array.isArray(l)&&l.length===2)return n?`${s} >= ${l[0]}, ${s} =< ${l[1]}`:`${a}, Value${t} >= ${l[0]}, Value${t} =< ${l[1]}`;let d=[{value:c,symbol:"<"},{value:u,symbol:"=<"},{value:g,symbol:">"},{value:h,symbol:">="}];for(let{value:y,symbol:_}of d)if(y!==void 0)return n?`${s} ${_} ${y}`:`${a}, Value${t} ${_} ${y}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function Xc(i){return i?"length(UnsortedInstances, TotalCount)":""}function el(i){if(!i)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(i)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function tl(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function il(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function rl(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function bo(i){if(!!i){if(typeof i=="string")return i;if(Array.isArray(i)&&i.length>0)return i.find(t=>t!=="null")||i[0]}}function ou(i,e){return bo(i.type)===e}function nl(i){return ou(i,"array")}function al(i){return ou(i,"object")}function qh(i){let e=bo(i.type);return e==="number"||e==="integer"}var Ti=class{static async getClassName(e){if(this===Ti)return await e.stringOrTemplateObjectToSubjectClassName(this);let r=this.classNamesByClass.get(this);r||(r={},this.classNamesByClass.set(this,r));let n=e.uuid;return r[n]||(r[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),r[n]}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let t=e.className,r={},n=e.__properties||{};for(let[u,g]of Object.entries(n)){let h=g;r[u]={name:u,predicate:h.through||"",required:h.required||!1,writable:h.writable||!1,...h.initial!==void 0&&{initial:h.initial},...h.resolveLanguage!==void 0&&{resolveLanguage:h.resolveLanguage},...h.getter!==void 0&&{getter:h.getter},...h.setter!==void 0&&{setter:h.setter},...h.local!==void 0&&{local:h.local},...h.transform!==void 0&&{transform:h.transform},...h.flag!==void 0&&{flag:h.flag}}}let a={},s=e.__collections||{};for(let[u,g]of Object.entries(s)){let h=g;a[u]={name:u,predicate:h.through||"",...h.where!==void 0&&{where:h.where},...h.local!==void 0&&{local:h.local}}}let o=Object.keys(r).length>0,l=Object.keys(a).length>0;if(!(o||l)&&e.__jsonSchema){let u=e.__jsonSchema,g=e.__jsonSchemaOptions||{};if(u.properties)for(let[h,d]of Object.entries(u.properties)){let y=nl(d),_=this.determinePredicate(u,h,d,this.determineNamespace(u,g),g);if(y)a[h]={name:h,predicate:_,...d["x-ad4m"]?.local!==void 0&&{local:d["x-ad4m"].local}};else{let E=u.required?.includes(h)||!1;r[h]={name:h,predicate:_,required:E,writable:d["x-ad4m"]?.writable!==!1,...d["x-ad4m"]?.resolveLanguage&&{resolveLanguage:d["x-ad4m"].resolveLanguage},...d["x-ad4m"]?.initial&&{initial:d["x-ad4m"].initial},...d["x-ad4m"]?.local!==void 0&&{local:d["x-ad4m"].local}}}}}return{className:t,properties:r,collections:a}}constructor(e,t,r){Be.set(this,void 0),ha.set(this,void 0),ga.set(this,void 0),Ee.set(this,void 0),Mr(this,Be,t||Ce.from(su(24)).toUrl(),"f"),Mr(this,Ee,e,"f"),Mr(this,ga,r||"ad4m://self","f")}get baseExpression(){return ne(this,Be,"f")}get perspective(){return ne(this,Ee,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,t){if(t.writable===!1)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.setter)throw new Error(`Custom setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateCollectionAction(e,t){let r=this.getCollectionMetadata(e);if(!r)throw new Error(`Collection "${e}" has no metadata defined`);if(!r.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:r.through,target:"value",...r.local&&{local:!0}}]}static async assignValuesToInstance(e,t,r){let n=Object.fromEntries(await Promise.all(r.map(async([a,s,o])=>{let l=s;if(!o&&typeof s=="string"){let u=Array.from(s,d=>d.codePointAt(0)),g=u.every(d=>d<=255),h=u.some(d=>d>=128);if(g&&h)try{let d=Uint8Array.from(u),y=new TextDecoder("utf-8",{fatal:!0}).decode(d);y!==s&&(l=y)}catch(d){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:s,error:d})}}if(o){let u=await e.getExpression(s);if(u)try{l=JSON.parse(u.data)}catch{l=u.data}}let c=t.__properties?.[a]?.transform;return c&&typeof c=="function"&&(l=c(l)),[a,l]})));Object.assign(t,n)}async getData(){try{let e=this.constructor,t=e.getModelMetadata(),n=`
1958
1908
  SELECT id, predicate, out.uri AS target, author, timestamp
1959
1909
  FROM link
1960
- WHERE in.uri = ${e.formatSurrealValue(ne(this,Fe,"f"))}
1910
+ WHERE in.uri = ${e.formatSurrealValue(ne(this,Be,"f"))}
1961
1911
  ORDER BY timestamp ASC
1962
- `,a=await ne(this,we,"f").querySurrealDB(n);if(a&&a.length>0){let s=null,o=null;for(let[l,c]of Object.entries(t.properties)){let u=a.filter(g=>g.predicate===c.predicate);if(u.length>0){let g=u[u.length-1],h=g.target;if(g.timestamp&&(!s||g.timestamp>s)&&(s=g.timestamp,o=g.author),c.resolveLanguage&&c.resolveLanguage!=="literal")try{let d=await ne(this,we,"f").getExpression(h);if(d)try{h=JSON.parse(d.data)}catch{h=d.data}}catch(d){console.warn(`Failed to resolve expression for ${l}:`,d)}else if(typeof h=="string"&&h.startsWith("literal://"))try{let d=Ce.fromUrl(h).get();h=d.data!==void 0?d.data:d}catch{}c.transform&&typeof c.transform=="function"&&(h=c.transform(h)),this[l]=h}}for(let[l,c]of Object.entries(t.collections)){let u=a.filter(g=>g.predicate===c.predicate);this[l]=u.map(g=>g.target)}o&&(this.author=o),s&&(this.timestamp=s)}}catch(e){console.error(`SurrealDB getData also failed for ${ne(this,Fe,"f")}:`,e)}return this}static async queryToProlog(e,t,r){let{source:n,properties:a,collections:s,where:o,order:l,offset:c,limit:u,count:g}=t,h=r||await this.getClassName(e),d=[Zc(),Gc(n),Fh(a),jh(s),Jc(o)],y=[Yc(g),Xc(l),el(c),tl(u)];return`
1912
+ `,a=await ne(this,Ee,"f").querySurrealDB(n);if(a&&a.length>0){let s=null,o=null;for(let[l,c]of Object.entries(t.properties)){let u=a.filter(g=>g.predicate===c.predicate);if(u.length>0){let g=u[u.length-1],h=g.target;if(g.timestamp&&(!s||g.timestamp>s)&&(s=g.timestamp,o=g.author),c.resolveLanguage&&c.resolveLanguage!=="literal")try{let d=await ne(this,Ee,"f").getExpression(h);if(d)try{h=JSON.parse(d.data)}catch{h=d.data}}catch(d){console.warn(`Failed to resolve expression for ${l}:`,d)}else if(typeof h=="string"&&h.startsWith("literal://"))try{let d=Ce.fromUrl(h).get();h=d.data!==void 0?d.data:d}catch{}c.transform&&typeof c.transform=="function"&&(h=c.transform(h)),this[l]=h}}for(let[l,c]of Object.entries(t.collections)){let u=a.filter(g=>g.predicate===c.predicate);this[l]=u.map(g=>g.target)}o&&(this.author=o),s&&(this.timestamp=s)}}catch(e){console.error(`SurrealDB getData also failed for ${ne(this,Be,"f")}:`,e)}return this}static async queryToProlog(e,t,r){let{source:n,properties:a,collections:s,where:o,order:l,offset:c,limit:u,count:g}=t,h=r||await this.getClassName(e),d=[Jc(),Zc(n),jh(a),Bh(s),Yc(o)],y=[Xc(g),el(l),tl(c),il(u)];return`
1963
1913
  findall([Base, Properties, Collections, Timestamp, Author], (
1964
1914
  subject_class("${h}", SubjectClass),
1965
1915
  instance(SubjectClass, Base),
@@ -1975,21 +1925,21 @@ FROM node
1975
1925
  WHERE ${g.join(" AND ")}
1976
1926
  `.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(a)){let l=a.map(c=>this.formatSurrealValue(c)).join(", ");r.push(`${o} IN [${l}]`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let c=l.not.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} NOT IN [${c}]`)}else r.push(`${o} != ${this.formatSurrealValue(l.not)}`);l.between!==void 0&&Array.isArray(l.between)&&l.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(l.between[0])} AND ${o} <= ${this.formatSurrealValue(l.between[1])}`),l.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(l.gt)}`),l.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(l.gte)}`),l.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(l.lt)}`),l.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(l.lte)}`),l.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(l.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(a)}`)}else{let o=e.properties[n];if(!o)continue;let l=oe(o.predicate),c=o.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let u=a.map(g=>this.formatSurrealValue(g)).join(", ");r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${l}' AND ${c} IN [${u}]]) > 0`)}else if(typeof a=="object"&&a!==null){let u=a;if(u.not!==void 0)if(Array.isArray(u.not)){let h=u.not.map(d=>this.formatSurrealValue(d)).join(", ");r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${l}' AND ${c} IN [${h}]]) = 0`)}else r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${l}' AND ${c} = ${this.formatSurrealValue(u.not)}]) = 0`);(u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${l}']) > 0`)}else r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${l}' AND ${c} = ${this.formatSurrealValue(a)}]) > 0`)}return r.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="source";if(Array.isArray(a)){let l=a.map(c=>this.formatSurrealValue(c)).join(", ");r.push(`${o} IN [${l}]`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let c=l.not.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} NOT IN [${c}]`)}else r.push(`${o} != ${this.formatSurrealValue(l.not)}`);l.between!==void 0&&Array.isArray(l.between)&&l.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(l.between[0])} AND ${o} <= ${this.formatSurrealValue(l.between[1])}`),l.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(l.gt)}`),l.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(l.gte)}`),l.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(l.lt)}`),l.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(l.lte)}`),l.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(l.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(a)}`)}else{let o=e.properties[n];if(!o)continue;let l=oe(o.predicate),c=o.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let u=a.map(g=>this.formatSurrealValue(g)).join(", ");r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${l}' AND ${c} IN [${u}])`)}else if(typeof a=="object"&&a!==null){let u=a;if(u.not!==void 0)if(Array.isArray(u.not)){let h=u.not.map(d=>this.formatSurrealValue(d)).join(", ");r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${l}' AND ${c} IN [${h}])`)}else r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${l}' AND ${c} = ${this.formatSurrealValue(u.not)})`);(u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${l}')`)}else r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${l}' AND ${c} = ${this.formatSurrealValue(a)})`)}return r.join(" AND ")}static buildSurrealSelectFields(e,t,r){let n=[],a=t||Object.keys(e.properties);for(let o of a){let l=e.properties[o];if(!l)continue;let c=oe(l.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${c}' LIMIT 1) AS ${o}`)}let s=r||Object.keys(e.collections);for(let o of s){let l=e.collections[o];if(!l)continue;let c=oe(l.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${c}') AS ${o}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source LIMIT 1) AS timestamp"),n.join(`,
1977
1927
  `)}static buildSurrealSelectFieldsWithAggregation(e,t,r){let n=[],a=t||Object.keys(e.properties);for(let o of a){let l=e.properties[o];if(!l)continue;let c=oe(l.predicate);n.push(`array::first(target[WHERE predicate = '${c}']) AS ${o}`)}let s=r||Object.keys(e.collections);for(let o of s){let l=e.collections[o];if(!l)continue;let c=oe(l.predicate);n.push(`target[WHERE predicate = '${c}'] AS ${o}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS timestamp"),n.join(`,
1978
- `)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>this.formatSurrealValue(t)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,t,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let n=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(r[0].AllInstances.map(async([s,o,l,c,u])=>{try{let g=new this(e,s);n.length&&Object.keys(g).forEach(d=>{n.includes(d)||delete g[d]});let h=[...o,...l,["timestamp",c],["author",u]];return await Ii.assignValuesToInstance(e,g,h),g}catch(g){return console.error(`Failed to process instance ${s}:`,g),null}}))).filter(s=>s!==null),totalCount:r[0].TotalCount}}static async instancesFromSurrealResult(e,t,r){if(!r||r.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],s=t?.collections||[],o=[];for(let h of r){let d;try{if(d=h.source_uri,!d)continue;let y=h.links||[],_=new this(e,d),E=null,$=null;for(let T=0;T<y.length;T++){let C=y[T],A=C.predicate,k=C.target;if(k==="None")continue;C.timestamp&&(!E||C.timestamp>E)&&(E=C.timestamp,$=C.author);let J=!1;for(let[I,R]of Object.entries(n.properties))if(R.predicate===A){let O=_[I],P=typeof O=="object"&&O!==null&&!Array.isArray(O)&&Object.keys(O).length===0;if(!O||O===""||O===0||P){let D=k;if(k!=null&&k!==""){if(R.resolveLanguage!=null&&R.resolveLanguage!=="literal"&&typeof k=="string")try{let he=await e.getExpression(k);if(he)try{D=JSON.parse(he.data)}catch{D=he.data}}catch(he){console.warn(`Failed to resolve expression for ${I} with target "${k}":`,he),console.warn("Falling back to raw value"),D=k}else if(typeof k=="string"&&k.startsWith("literal://"))try{let he=Ce.fromUrl(k).get();he.data!==void 0?D=he.data:D=he}catch{D=k}else if(typeof k=="string"){let he=typeof _[I];he==="number"?D=Number(k):he==="boolean"&&(D=k==="true"||k==="1")}}R.transform&&typeof R.transform=="function"&&(D=R.transform(D)),_[I]=D}J=!0;break}if(!J){for(let[I,R]of Object.entries(n.collections))if(R.predicate===A){_[I]||(_[I]=[]);let O=`__${I}_timestamps`,P=`__${I}_indices`;_[O]||(_[O]=[]),_[P]||(_[P]=[]),_[I].includes(k)||(_[I].push(k),_[O].push(C.timestamp||""),_[P].push(T));break}}}if($&&E)if(_.author=$,typeof E=="string"&&E.includes("T"))_.timestamp=new Date(E).getTime();else if(typeof E=="string"){let T=parseInt(E,10);_.timestamp=isNaN(T)?E:T}else _.timestamp=E;for(let[T,C]of Object.entries(n.collections)){let A=`__${T}_timestamps`,k=`__${T}_indices`;if(_[T]&&_[A]){let J=_[T].map((I,R)=>({value:I,timestamp:_[A][R]||"",originalIndex:_[k]?.[R]??R}));J.sort((I,R)=>{let O=String(I.timestamp||""),P=String(R.timestamp||""),D=O.localeCompare(P);return D!==0?D:I.originalIndex-R.originalIndex}),_[T]=J.map(I=>I.value),delete _[A],delete _[k]}}if(a.length>0||s.length>0){let T=[...a,...s];Object.keys(_).forEach(C=>{!T.includes(C)&&C!=="timestamp"&&C!=="author"&&C!=="baseExpression"&&delete _[C]})}o.push(_)}catch(y){console.error(`Failed to process SurrealDB instance ${d}:`,y)}}let l=o;t.where&&(l=o.filter(h=>{for(let[d,y]of Object.entries(t.where))if(d!=="base"){if(d==="author"||d==="timestamp"){if(!this.matchesCondition(h[d],y))return!1;continue}if(typeof y=="object"&&y!==null&&!Array.isArray(y)){let _=y;if((_.gt!==void 0||_.gte!==void 0||_.lt!==void 0||_.lte!==void 0||_.between!==void 0||_.contains!==void 0)&&!this.matchesCondition(h[d],y))return!1}}return!0}));let c=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(c){let h=Object.keys(c)[0],d=Object.values(c)[0];l.sort((y,_)=>{let E=y[h],$=_[h];if(E===void 0&&$===void 0)return 0;if(E===void 0)return d==="ASC"?1:-1;if($===void 0)return d==="ASC"?-1:1;let T=0;return typeof E=="number"&&typeof $=="number"?T=E-$:typeof E=="string"&&typeof $=="string"?T=E.localeCompare($):T=String(E).localeCompare(String($)),d==="DESC"?-T:T})}let u=l.length,g=l;if(t.offset!==void 0||t.limit!==void 0){let h=t.offset||0,d=t.limit?h+t.limit:void 0;g=l.slice(h,d)}return{results:g,totalCount:u}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let r=t;if(r.not!==void 0)return Array.isArray(r.not)?!r.not.includes(e):e!==r.not;if(r.between!==void 0&&Array.isArray(r.between)&&r.between.length===2)return e>=r.between[0]&&e<=r.between[1];let n=!0;return r.gt!==void 0&&(n=n&&e>r.gt),r.gte!==void 0&&(n=n&&e>=r.gte),r.lt!==void 0&&(n=n&&e<r.lt),r.lte!==void 0&&(n=n&&e<=r.lte),r.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(r.contains)):Array.isArray(e)?n=n&&e.includes(r.contains):n=!1),n}return e===t}static async findAll(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:s}=await this.instancesFromSurrealResult(e,t,a);return s}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:s}=await this.instancesFromPrologResult(e,t,a);return s}}static async findAllAndCount(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n);return await this.instancesFromSurrealResult(e,t,a)}else{let n=await this.queryToProlog(e,t),a=await e.infer(n);return await this.instancesFromPrologResult(e,t,a)}}static async paginate(e,t,r,n,a=!0){let s={...n||{},limit:t,offset:t*(r-1),count:!0};if(a){let o=await this.queryToSurrealQL(e,s),l=await e.querySurrealDB(o),{results:c,totalCount:u}=await this.instancesFromSurrealResult(e,s,l);return{results:c,totalCount:u,pageSize:t,pageNumber:r}}else{let o=await this.queryToProlog(e,s),l=await e.infer(o),{results:c,totalCount:u}=await this.instancesFromPrologResult(e,s,l);return{results:c,totalCount:u,pageSize:t,pageNumber:r}}}static async countQueryToProlog(e,t={},r){let{source:n,where:a}=t,s=r||await this.getClassName(e),o=[Zc(),Gc(n),Jc(a)],l=[Yc(!0),Xc(),el(),tl()];return`
1928
+ `)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>this.formatSurrealValue(t)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,t,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let n=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(r[0].AllInstances.map(async([s,o,l,c,u])=>{try{let g=new this(e,s);n.length&&Object.keys(g).forEach(d=>{n.includes(d)||delete g[d]});let h=[...o,...l,["timestamp",c],["author",u]];return await Ti.assignValuesToInstance(e,g,h),g}catch(g){return console.error(`Failed to process instance ${s}:`,g),null}}))).filter(s=>s!==null),totalCount:r[0].TotalCount}}static async instancesFromSurrealResult(e,t,r){if(!r||r.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],s=t?.collections||[],o=[];for(let h of r){let d;try{if(d=h.source_uri,!d)continue;let y=h.links||[],_=new this(e,d),E=null,$=null;for(let T=0;T<y.length;T++){let C=y[T],A=C.predicate,k=C.target;if(k==="None")continue;C.timestamp&&(!E||C.timestamp>E)&&(E=C.timestamp,$=C.author);let J=!1;for(let[I,O]of Object.entries(n.properties))if(O.predicate===A){let D=_[I],R=typeof D=="object"&&D!==null&&!Array.isArray(D)&&Object.keys(D).length===0;if(!D||D===""||D===0||R){let M=k;if(k!=null&&k!==""){if(O.resolveLanguage!=null&&O.resolveLanguage!=="literal"&&typeof k=="string")try{let ge=await e.getExpression(k);if(ge)try{M=JSON.parse(ge.data)}catch{M=ge.data}}catch(ge){console.warn(`Failed to resolve expression for ${I} with target "${k}":`,ge),console.warn("Falling back to raw value"),M=k}else if(typeof k=="string"&&k.startsWith("literal://"))try{let ge=Ce.fromUrl(k).get();ge.data!==void 0?M=ge.data:M=ge}catch{M=k}else if(typeof k=="string"){let ge=typeof _[I];ge==="number"?M=Number(k):ge==="boolean"&&(M=k==="true"||k==="1")}}O.transform&&typeof O.transform=="function"&&(M=O.transform(M)),_[I]=M}J=!0;break}if(!J){for(let[I,O]of Object.entries(n.collections))if(O.predicate===A){_[I]||(_[I]=[]);let D=`__${I}_timestamps`,R=`__${I}_indices`;_[D]||(_[D]=[]),_[R]||(_[R]=[]),_[I].includes(k)||(_[I].push(k),_[D].push(C.timestamp||""),_[R].push(T));break}}}if($&&E)if(_.author=$,typeof E=="string"&&E.includes("T"))_.timestamp=new Date(E).getTime();else if(typeof E=="string"){let T=parseInt(E,10);_.timestamp=isNaN(T)?E:T}else _.timestamp=E;for(let[T,C]of Object.entries(n.collections)){let A=`__${T}_timestamps`,k=`__${T}_indices`;if(_[T]&&_[A]){let J=_[T].map((I,O)=>({value:I,timestamp:_[A][O]||"",originalIndex:_[k]?.[O]??O}));J.sort((I,O)=>{let D=String(I.timestamp||""),R=String(O.timestamp||""),M=D.localeCompare(R);return M!==0?M:I.originalIndex-O.originalIndex}),_[T]=J.map(I=>I.value),delete _[A],delete _[k]}}if(a.length>0||s.length>0){let T=[...a,...s];Object.keys(_).forEach(C=>{!T.includes(C)&&C!=="timestamp"&&C!=="author"&&C!=="baseExpression"&&delete _[C]})}o.push(_)}catch(y){console.error(`Failed to process SurrealDB instance ${d}:`,y)}}let l=o;t.where&&(l=o.filter(h=>{for(let[d,y]of Object.entries(t.where))if(d!=="base"){if(d==="author"||d==="timestamp"){if(!this.matchesCondition(h[d],y))return!1;continue}if(typeof y=="object"&&y!==null&&!Array.isArray(y)){let _=y;if((_.gt!==void 0||_.gte!==void 0||_.lt!==void 0||_.lte!==void 0||_.between!==void 0||_.contains!==void 0)&&!this.matchesCondition(h[d],y))return!1}}return!0}));let c=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(c){let h=Object.keys(c)[0],d=Object.values(c)[0];l.sort((y,_)=>{let E=y[h],$=_[h];if(E===void 0&&$===void 0)return 0;if(E===void 0)return d==="ASC"?1:-1;if($===void 0)return d==="ASC"?-1:1;let T=0;return typeof E=="number"&&typeof $=="number"?T=E-$:typeof E=="string"&&typeof $=="string"?T=E.localeCompare($):T=String(E).localeCompare(String($)),d==="DESC"?-T:T})}let u=l.length,g=l;if(t.offset!==void 0||t.limit!==void 0){let h=t.offset||0,d=t.limit?h+t.limit:void 0;g=l.slice(h,d)}return{results:g,totalCount:u}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let r=t;if(r.not!==void 0)return Array.isArray(r.not)?!r.not.includes(e):e!==r.not;if(r.between!==void 0&&Array.isArray(r.between)&&r.between.length===2)return e>=r.between[0]&&e<=r.between[1];let n=!0;return r.gt!==void 0&&(n=n&&e>r.gt),r.gte!==void 0&&(n=n&&e>=r.gte),r.lt!==void 0&&(n=n&&e<r.lt),r.lte!==void 0&&(n=n&&e<=r.lte),r.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(r.contains)):Array.isArray(e)?n=n&&e.includes(r.contains):n=!1),n}return e===t}static async findAll(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:s}=await this.instancesFromSurrealResult(e,t,a);return s}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:s}=await this.instancesFromPrologResult(e,t,a);return s}}static async findAllAndCount(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n);return await this.instancesFromSurrealResult(e,t,a)}else{let n=await this.queryToProlog(e,t),a=await e.infer(n);return await this.instancesFromPrologResult(e,t,a)}}static async paginate(e,t,r,n,a=!0){let s={...n||{},limit:t,offset:t*(r-1),count:!0};if(a){let o=await this.queryToSurrealQL(e,s),l=await e.querySurrealDB(o),{results:c,totalCount:u}=await this.instancesFromSurrealResult(e,s,l);return{results:c,totalCount:u,pageSize:t,pageNumber:r}}else{let o=await this.queryToProlog(e,s),l=await e.infer(o),{results:c,totalCount:u}=await this.instancesFromPrologResult(e,s,l);return{results:c,totalCount:u,pageSize:t,pageNumber:r}}}static async countQueryToProlog(e,t={},r){let{source:n,where:a}=t,s=r||await this.getClassName(e),o=[Jc(),Zc(n),Yc(a)],l=[Xc(!0),el(),tl(),il()];return`
1979
1929
  findall([Base, Properties, Collections, Timestamp, Author], (
1980
1930
  subject_class("${s}", SubjectClass),
1981
1931
  instance(SubjectClass, Base),
1982
1932
  ${o.filter(u=>u).join(", ")}
1983
1933
  ), UnsortedInstances),
1984
1934
  ${l.filter(u=>u).join(", ")}
1985
- `}static async countQueryToSurrealQL(e,t){let r={...t};return delete r.limit,delete r.offset,await this.queryToSurrealQL(e,r)}static async count(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:s}=await this.instancesFromSurrealResult(e,t,a);return s}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,r){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),s=n.resolveLanguage;s&&(t=await ne(this,we,"f").createExpression(t,s)),await ne(this,we,"f").executeAction(a,ne(this,Fe,"f"),[{name:"value",value:t}],r)}async setCollectionSetter(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");t!=null&&(Array.isArray(t)?await ne(this,we,"f").executeAction(a,ne(this,Fe,"f"),t.map(s=>({name:"value",value:s})),r):await ne(this,we,"f").executeAction(a,ne(this,Fe,"f"),[{name:"value",value:t}],r))}async setCollectionAdder(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>ne(this,we,"f").executeAction(a,ne(this,Fe,"f"),[{name:"value",value:s}],r))):await ne(this,we,"f").executeAction(a,ne(this,Fe,"f"),[{name:"value",value:t}],r))}async setCollectionRemover(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>ne(this,we,"f").executeAction(a,ne(this,Fe,"f"),[{name:"value",value:s}],r))):await ne(this,we,"f").executeAction(a,ne(this,Fe,"f"),[{name:"value",value:t}],r))}async save(e){let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let r={};for(let[n,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(r[n]=a);await this.perspective.createSubject(this,ne(this,Fe,"f"),r,e),await ne(this,we,"f").add(new Ni({source:ne(this,ha,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),t&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},t=Object.entries(this);for(let[r,n]of t)n!=null&&r!=="author"&&r!=="timestamp"&&(e[r]=n);return e}async innerUpdate(e=!0,t){Rr(this,fa,await ne(this,we,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let r=Object.entries(this);for(let[n,a]of r)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(n,a.value,t);break;case"adder":await this.setCollectionAdder(n,a.value,t);break;case"remover":await this.setCollectionRemover(n,a.value,t);break;default:await this.setCollectionSetter(n,a.value,t);break}else if(Array.isArray(a))await this.setCollectionSetter(n,a,t);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(n))continue;await this.setProperty(n,a,t)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return Rr(this,fa,await ne(this,we,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await ne(this,we,"f").removeSubject(this,ne(this,Fe,"f"),e)}static query(e,t){return new to(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let r=this.determineNamespace(e,t),n=class extends Ii{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=t.name,n.prototype.className=t.name;let a={},s={};if(e.properties)for(let[c,u]of Object.entries(e.properties)){let g=this.determinePredicate(e,c,u,r,t),h=e.required?.includes(c)||!1,d=vo(u.type);if(rl(u)){s[c]={through:g,local:this.getPropertyOption(c,u,t,"local")},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:[]});let _=`add${ga(c)}`,E=`remove${ga(c)}`,$=`setCollection${ga(c)}`;n.prototype[_]=function(){},n.prototype[E]=function(){},n.prototype[$]=function(){}}else{let _=this.getPropertyOption(c,u,t,"resolveLanguage");!_&&t.resolveLanguage&&(_=t.resolveLanguage);let E=this.getPropertyOption(c,u,t,"local"),$=this.getPropertyOption(c,u,t,"writable",!0),T=this.getPropertyOption(c,u,t,"initial");if(nl(u)&&!_&&(_="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),_==null&&Bh(u)&&(_="literal"),h&&!T&&(nl(u)?T="literal://json:{}":T="ad4m://undefined"),a[c]={through:g,required:h,writable:$,..._&&{resolveLanguage:_},...E!==void 0&&{local:E},...T&&{initial:T}},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:this.getDefaultValueForType(d)}),$){let C=ao(c);n.prototype[C]=function(){}}}}if(!Object.values(a).some(c=>c.initial)){let c="ad4m://type",u;if(r.includes("://")){let[g,h]=r.split("://"),d=(h||"").replace(/\/+$/,"");d?u=`${g}://${d}/instance`:u=`${g}://instance`}else u=`${r.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:c,required:!0,writable:!1,initial:u,flag:!0},Object.defineProperty(n.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:u}),console.warn(`No properties with initial values found. Added automatic type flag: ${c} = ${u}`)}return n.prototype.__properties=a,n.prototype.__collections=s,n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,Uh({name:t.name})(n),n}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let n=new URL(e.$id).pathname.split("/").filter(a=>a);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1935
+ `}static async countQueryToSurrealQL(e,t){let r={...t};return delete r.limit,delete r.offset,await this.queryToSurrealQL(e,r)}static async count(e,t={},r=!0){if(r){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:s}=await this.instancesFromSurrealResult(e,t,a);return s}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,r){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),s=n.resolveLanguage;s&&(t=await ne(this,Ee,"f").createExpression(t,s)),await ne(this,Ee,"f").executeAction(a,ne(this,Be,"f"),[{name:"value",value:t}],r)}async setCollectionSetter(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");t!=null&&(Array.isArray(t)?await ne(this,Ee,"f").executeAction(a,ne(this,Be,"f"),t.map(s=>({name:"value",value:s})),r):await ne(this,Ee,"f").executeAction(a,ne(this,Be,"f"),[{name:"value",value:t}],r))}async setCollectionAdder(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>ne(this,Ee,"f").executeAction(a,ne(this,Be,"f"),[{name:"value",value:s}],r))):await ne(this,Ee,"f").executeAction(a,ne(this,Be,"f"),[{name:"value",value:t}],r))}async setCollectionRemover(e,t,r){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>ne(this,Ee,"f").executeAction(a,ne(this,Be,"f"),[{name:"value",value:s}],r))):await ne(this,Ee,"f").executeAction(a,ne(this,Be,"f"),[{name:"value",value:t}],r))}async save(e){let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let r={};for(let[n,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(r[n]=a);await this.perspective.createSubject(this,ne(this,Be,"f"),r,e),await ne(this,Ee,"f").add(new Pi({source:ne(this,ga,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),t&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},t=Object.entries(this);for(let[r,n]of t)n!=null&&r!=="author"&&r!=="timestamp"&&(e[r]=n);return e}async innerUpdate(e=!0,t){Mr(this,ha,await ne(this,Ee,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let r=Object.entries(this);for(let[n,a]of r)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(n,a.value,t);break;case"adder":await this.setCollectionAdder(n,a.value,t);break;case"remover":await this.setCollectionRemover(n,a.value,t);break;default:await this.setCollectionSetter(n,a.value,t);break}else if(Array.isArray(a))await this.setCollectionSetter(n,a,t);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(n))continue;await this.setProperty(n,a,t)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return Mr(this,ha,await ne(this,Ee,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await ne(this,Ee,"f").removeSubject(this,ne(this,Be,"f"),e)}static query(e,t){return new io(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let r=this.determineNamespace(e,t),n=class extends Ti{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=t.name,n.prototype.className=t.name;let a={},s={};if(e.properties)for(let[c,u]of Object.entries(e.properties)){let g=this.determinePredicate(e,c,u,r,t),h=e.required?.includes(c)||!1,d=bo(u.type);if(nl(u)){s[c]={through:g,local:this.getPropertyOption(c,u,t,"local")},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:[]});let _=`add${ma(c)}`,E=`remove${ma(c)}`,$=`setCollection${ma(c)}`;n.prototype[_]=function(){},n.prototype[E]=function(){},n.prototype[$]=function(){}}else{let _=this.getPropertyOption(c,u,t,"resolveLanguage");!_&&t.resolveLanguage&&(_=t.resolveLanguage);let E=this.getPropertyOption(c,u,t,"local"),$=this.getPropertyOption(c,u,t,"writable",!0),T=this.getPropertyOption(c,u,t,"initial");if(al(u)&&!_&&(_="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),_==null&&qh(u)&&(_="literal"),h&&!T&&(al(u)?T="literal://json:{}":T="ad4m://undefined"),a[c]={through:g,required:h,writable:$,..._&&{resolveLanguage:_},...E!==void 0&&{local:E},...T&&{initial:T}},Object.defineProperty(n.prototype,c,{configurable:!0,writable:!0,value:this.getDefaultValueForType(d)}),$){let C=so(c);n.prototype[C]=function(){}}}}if(!Object.values(a).some(c=>c.initial)){let c="ad4m://type",u;if(r.includes("://")){let[g,h]=r.split("://"),d=(h||"").replace(/\/+$/,"");d?u=`${g}://${d}/instance`:u=`${g}://instance`}else u=`${r.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:c,required:!0,writable:!1,initial:u,flag:!0},Object.defineProperty(n.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:u}),console.warn(`No properties with initial values found. Added automatic type flag: ${c} = ${u}`)}return n.prototype.__properties=a,n.prototype.__collections=s,n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,Fh({name:t.name})(n),n}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let n=new URL(e.$id).pathname.split("/").filter(a=>a);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1986
1936
  - options.namespace
1987
1937
  - schema["x-ad4m"].namespace
1988
1938
  - schema.title
1989
- - valid schema.$id`)}static determinePredicate(e,t,r,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(a.predicateTemplate){let o=il(n),[l,c]=o.includes("://")?o.split("://"):["",o],u=c||"";return a.predicateTemplate.replace("${namespace}",u).replace("${scheme}",l).replace("${ns}",u).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let s=il(n);return s.includes("://")?`${s}${t}`:`${s}://${t}`}static getPropertyOption(e,t,r,n,a){return r.propertyOptions?.[e]?.[n]!==void 0?r.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:r[n]!==void 0?r[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};Fe=new WeakMap,fa=new WeakMap,ha=new WeakMap,we=new WeakMap;Ii.classNamesByClass=new WeakMap;var to=class{constructor(e,t,r){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,r&&(this.queryParams=r)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:r}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return r}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let r=async a=>{let{results:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async a=>{let{results:s}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let r=async a=>{let{totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(r),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let r={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,r),a=await this.perspective.querySurrealDB(n),{results:s,totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,r,this.modelClassName),a=await this.perspective.infer(n),{results:s,totalCount:o}=await this.ctor.instancesFromPrologResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,r){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let s=async c=>{let{results:u,totalCount:g}=await this.ctor.instancesFromSurrealResult(this.perspective,n,c);r({results:u,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:o,totalCount:l,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let s=async c=>{let{results:u,totalCount:g}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,c);r({results:u,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:o,totalCount:l,pageSize:e,pageNumber:t}}}};var ft=class extends qe{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.securityCode=n,this.securityCode.length===6&&this.verifyCode()}render(){return M`
1939
+ - valid schema.$id`)}static determinePredicate(e,t,r,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(a.predicateTemplate){let o=rl(n),[l,c]=o.includes("://")?o.split("://"):["",o],u=c||"";return a.predicateTemplate.replace("${namespace}",u).replace("${scheme}",l).replace("${ns}",u).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let s=rl(n);return s.includes("://")?`${s}${t}`:`${s}://${t}`}static getPropertyOption(e,t,r,n,a){return r.propertyOptions?.[e]?.[n]!==void 0?r.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:r[n]!==void 0?r[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};Be=new WeakMap,ha=new WeakMap,ga=new WeakMap,Ee=new WeakMap;Ti.classNamesByClass=new WeakMap;var io=class{constructor(e,t,r){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,r&&(this.queryParams=r)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:r}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return r}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let r=async a=>{let{results:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async a=>{let{results:s}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:r}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return r}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let r=async a=>{let{totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(s)};this.currentSubscription.onResult(r);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(r),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let r={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,r),a=await this.perspective.querySurrealDB(n),{results:s,totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,r,this.modelClassName),a=await this.perspective.infer(n),{results:s,totalCount:o}=await this.ctor.instancesFromPrologResult(this.perspective,r,a);return{results:s,totalCount:o,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,r){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let s=async c=>{let{results:u,totalCount:g}=await this.ctor.instancesFromSurrealResult(this.perspective,n,c);r({results:u,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:o,totalCount:l,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let s=async c=>{let{results:u,totalCount:g}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,c);r({results:u,totalCount:g,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:o,totalCount:l,pageSize:e,pageNumber:t}}}};var ft=class extends Le{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.securityCode=n,this.securityCode.length===6&&this.verifyCode()}render(){return L`
1990
1940
  <div class="container">
1991
1941
  <div class="back-button" @click=${this.back}>
1992
- ${Ji()}
1942
+ ${tr()}
1993
1943
  </div>
1994
1944
 
1995
1945
  <div class="header">
@@ -1998,12 +1948,12 @@ WHERE ${g.join(" AND ")}
1998
1948
  </div>
1999
1949
 
2000
1950
  <div class="connection-icons">
2001
- ${this.appiconpath?M`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:M`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
2002
- <div class="arrow-icon">${On()}</div>
2003
- <div class="ad4m-logo">${di()}</div>
1951
+ ${this.appiconpath?L`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:L`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
1952
+ <div class="arrow-icon">${Un()}</div>
1953
+ <div class="ad4m-logo">${fi()}</div>
2004
1954
  </div>
2005
1955
 
2006
- ${this.requestSent?M`
1956
+ ${this.requestSent?L`
2007
1957
  <div class="state success" style="margin-bottom: -12px">
2008
1958
  ${ut()}
2009
1959
  <p>Auth request sent to local AD4M node</p>
@@ -2023,27 +1973,27 @@ WHERE ${g.join(" AND ")}
2023
1973
  />
2024
1974
  </div>
2025
1975
 
2026
- ${this.verificationError?M`
1976
+ ${this.verificationError?L`
2027
1977
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2028
- ${We()}
1978
+ ${Oe()}
2029
1979
  <p>Verification failed. Please try again.</p>
2030
1980
  </div>
2031
1981
  `:""}
2032
- `:M`
1982
+ `:L`
2033
1983
  <p>This will allow ${this.appname} to</p>
2034
1984
 
2035
1985
  <ul class="box">
2036
- ${this.capabilities.map(t=>M`<li>${ut()}<p>${vl(t)}</p></li>`)}
1986
+ ${this.capabilities.map(t=>L`<li>${ut()}<p>${bl(t)}</p></li>`)}
2037
1987
  </ul>
2038
1988
 
2039
- <div class="button-row">
1989
+ <div class="row center">
2040
1990
  <button class="primary" @click=${this.requestCapability}>
2041
1991
  Authorize
2042
1992
  </button>
2043
1993
  </div>
2044
1994
  `}
2045
1995
  </div>
2046
- `}};ft.styles=[Yi,lt`
1996
+ `}};ft.styles=[Ut,Ge`
2047
1997
  h1 {
2048
1998
  font-size: 34px;
2049
1999
  }
@@ -2105,11 +2055,6 @@ WHERE ${g.join(" AND ")}
2105
2055
  flex-shrink: 0;
2106
2056
  }
2107
2057
 
2108
- .button-row {
2109
- display: flex;
2110
- justify-content: center;
2111
- }
2112
-
2113
2058
  .security-code {
2114
2059
  width: 100%;
2115
2060
  display: flex;
@@ -2130,17 +2075,17 @@ WHERE ${g.join(" AND ")}
2130
2075
  .state {
2131
2076
  justify-content: center;
2132
2077
  }
2133
- `],Q([Se({type:Array})],ft.prototype,"capabilities",2),Q([Se({type:String})],ft.prototype,"appname",2),Q([Se({type:String})],ft.prototype,"appiconpath",2),Q([Se({type:Boolean})],ft.prototype,"verificationError",2),Q([ue()],ft.prototype,"requestSent",2),Q([ue()],ft.prototype,"securityCode",2),ft=Q([Mt("local-authentication")],ft);var it=class extends qe{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.email="";this.password="";this.emailSecurityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.emailSecurityCode=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.emailSecurityCode=n,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,r=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,n=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,s=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return M`
2078
+ `],V([de({type:Array})],ft.prototype,"capabilities",2),V([de({type:String})],ft.prototype,"appname",2),V([de({type:String})],ft.prototype,"appiconpath",2),V([de({type:Boolean})],ft.prototype,"verificationError",2),V([ue()],ft.prototype,"requestSent",2),V([ue()],ft.prototype,"securityCode",2),ft=V([ht("local-authentication")],ft);var rt=class extends Le{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.email="";this.password="";this.emailSecurityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.emailSecurityCode=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let r=t.target,n=r.value.replace(/\D/g,"").slice(0,6);r.value=n,this.emailSecurityCode=n,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,r=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,n=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,s=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return L`
2134
2079
  <div class="container">
2135
2080
  <div class="back-button" @click=${this.back}>
2136
- ${Ji()}
2081
+ ${tr()}
2137
2082
  </div>
2138
2083
 
2139
2084
  <div class="header">
2140
2085
  <h1>Login</h1>
2141
2086
  </div>
2142
2087
 
2143
- ${t?M`
2088
+ ${t?L`
2144
2089
  <h3>Enter your email to login to the remote node</h3>
2145
2090
 
2146
2091
  <div class="input-row">
@@ -2149,6 +2094,7 @@ WHERE ${g.join(" AND ")}
2149
2094
  placeholder="email@example.com"
2150
2095
  .value=${this.email||""}
2151
2096
  @input=${o=>{let l=o.target;this.email=l.value}}
2097
+ @keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.isValidEmail()&&this.emailLogin()}}
2152
2098
  />
2153
2099
  </div>
2154
2100
 
@@ -2159,9 +2105,9 @@ WHERE ${g.join(" AND ")}
2159
2105
  </div>
2160
2106
  `:""}
2161
2107
 
2162
- ${s?M`
2108
+ ${s?L`
2163
2109
  <div class="state danger">
2164
- ${We()}
2110
+ ${Oe()}
2165
2111
  <p>${this.remoteAuthState.message||"Failed to process email. Please try again."}</p>
2166
2112
  </div>
2167
2113
 
@@ -2172,7 +2118,7 @@ WHERE ${g.join(" AND ")}
2172
2118
  </div>
2173
2119
  `:""}
2174
2120
 
2175
- ${r?M`
2121
+ ${r?L`
2176
2122
  <div class="state success" style="margin-bottom: -12px">
2177
2123
  ${ut()}
2178
2124
  <p>Email verification code sent</p>
@@ -2192,15 +2138,15 @@ WHERE ${g.join(" AND ")}
2192
2138
  />
2193
2139
  </div>
2194
2140
 
2195
- ${this.emailCodeError?M`
2141
+ ${this.emailCodeError?L`
2196
2142
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2197
- ${We()}
2143
+ ${Oe()}
2198
2144
  <p>Verification failed. Please try again.</p>
2199
2145
  </div>
2200
2146
  `:""}
2201
2147
  `:""}
2202
2148
 
2203
- ${n?M`
2149
+ ${n?L`
2204
2150
  <div class="state success" style="margin-bottom: -12px">
2205
2151
  ${ut()}
2206
2152
  <p>Account found</p>
@@ -2214,6 +2160,7 @@ WHERE ${g.join(" AND ")}
2214
2160
  placeholder="Password..."
2215
2161
  .value=${this.password||""}
2216
2162
  @input=${o=>{let l=o.target;this.password=l.value}}
2163
+ @keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.password.length&&this.passwordLogin()}}
2217
2164
  />
2218
2165
  </div>
2219
2166
 
@@ -2223,17 +2170,17 @@ WHERE ${g.join(" AND ")}
2223
2170
  </button>
2224
2171
  </div>
2225
2172
 
2226
- ${this.passwordError?M`
2173
+ ${this.passwordError?L`
2227
2174
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2228
- ${We()}
2175
+ ${Oe()}
2229
2176
  <p>Incorrect password. Please try again.</p>
2230
2177
  </div>
2231
2178
  `:""}
2232
2179
  `:""}
2233
2180
 
2234
- ${a?M`
2181
+ ${a?L`
2235
2182
  <div class="state danger">
2236
- ${We()}
2183
+ ${Oe()}
2237
2184
  <p>Email not found</p>
2238
2185
  </div>
2239
2186
 
@@ -2245,6 +2192,7 @@ WHERE ${g.join(" AND ")}
2245
2192
  placeholder="Password..."
2246
2193
  .value=${this.password||""}
2247
2194
  @input=${o=>{let l=o.target;this.password=l.value}}
2195
+ @keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.password.length&&this.createAccount()}}
2248
2196
  />
2249
2197
  </div>
2250
2198
 
@@ -2254,16 +2202,16 @@ WHERE ${g.join(" AND ")}
2254
2202
  </button>
2255
2203
  </div>
2256
2204
 
2257
- ${this.accountCreationError?M`
2205
+ ${this.accountCreationError?L`
2258
2206
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2259
- ${We()}
2207
+ ${Oe()}
2260
2208
  <p>Failed to create account. Please try again.</p>
2261
2209
  </div>
2262
2210
  `:""}
2263
2211
  `:""}
2264
2212
 
2265
2213
  </div>
2266
- `}};it.styles=[Yi,lt`
2214
+ `}};rt.styles=[Ut,Ge`
2267
2215
  .header h1 {
2268
2216
  font-size: 32px;
2269
2217
  margin-bottom: 0;
@@ -2309,7 +2257,87 @@ WHERE ${g.join(" AND ")}
2309
2257
  .state {
2310
2258
  justify-content: center;
2311
2259
  }
2312
- `],Q([Se({type:Object})],it.prototype,"remoteAuthState",2),Q([Se({type:Boolean})],it.prototype,"remoteAuthLoading",2),Q([Se({type:Boolean})],it.prototype,"emailCodeError",2),Q([Se({type:Boolean})],it.prototype,"passwordError",2),Q([Se({type:Boolean})],it.prototype,"accountCreationError",2),Q([ue()],it.prototype,"email",2),Q([ue()],it.prototype,"password",2),Q([ue()],it.prototype,"emailSecurityCode",2),it=Q([Mt("remote-authentication")],it);var qh=lt`
2260
+ `],V([de({type:Object})],rt.prototype,"remoteAuthState",2),V([de({type:Boolean})],rt.prototype,"remoteAuthLoading",2),V([de({type:Boolean})],rt.prototype,"emailCodeError",2),V([de({type:Boolean})],rt.prototype,"passwordError",2),V([de({type:Boolean})],rt.prototype,"accountCreationError",2),V([ue()],rt.prototype,"email",2),V([ue()],rt.prototype,"password",2),V([ue()],rt.prototype,"emailSecurityCode",2),rt=V([ht("remote-authentication")],rt);var si=class extends Le{constructor(){super(...arguments);this.url="";this.port=12e3;this.authState="unauthenticated"}get connectionType(){return this.url.includes("localhost")||this.url.includes("127.0.0.1")?"local":"remote"}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}render(){let t=this.connectionType==="local";return L`
2261
+ <div class="container">
2262
+ <div class="close-button" @click=${this.close}>
2263
+ ${Oe()}
2264
+ </div>
2265
+
2266
+ <div class="header">
2267
+ <h1>AD4M Connected</h1>
2268
+ <h3>Your current connection details:</h3>
2269
+ </div>
2270
+
2271
+ <div class="box">
2272
+ <div class="box-header">
2273
+ ${t?Xi():er()}
2274
+ <h3>${t?"Local Node":"Remote Node"}</h3>
2275
+ </div>
2276
+
2277
+ ${t?L`
2278
+ <div class="row">
2279
+ <span>Port:</span>
2280
+ <span class="detail-value">${this.port}</span>
2281
+ </div>
2282
+ <div class="row">
2283
+ <span>URL:</span>
2284
+ <span class="detail-value">${this.url}</span>
2285
+ </div>
2286
+ `:L`
2287
+ <div class="row">
2288
+ <span>URL:</span>
2289
+ <span class="detail-value">${this.url}</span>
2290
+ </div>
2291
+ `}
2292
+
2293
+ <div class="row">
2294
+ <span>Status:</span>
2295
+ <span class="auth-status ${this.authState}">${this.authState}</span>
2296
+ </div>
2297
+ </div>
2298
+
2299
+ <div class="row center">
2300
+ <button class="danger" @click=${this.disconnect}>
2301
+ Disconnect
2302
+ </button>
2303
+ </div>
2304
+ </div>
2305
+ `}};si.styles=[Ut,Ge`
2306
+ .box {
2307
+ gap: 15px;
2308
+ }
2309
+
2310
+ .box-header {
2311
+ margin-bottom: 6px;
2312
+ }
2313
+
2314
+ .detail-value {
2315
+ color: var(--ac-primary-color);
2316
+ }
2317
+
2318
+ .auth-status {
2319
+ padding: 6px 10px;
2320
+ border-radius: 8px;
2321
+ font-size: 14px;
2322
+ font-weight: 600;
2323
+ text-transform: uppercase;
2324
+ }
2325
+
2326
+ .auth-status.authenticated {
2327
+ background: rgba(93, 210, 125, 0.2);
2328
+ color: var(--ac-success-color);
2329
+ }
2330
+
2331
+ .auth-status.locked {
2332
+ background: rgba(255, 193, 7, 0.2);
2333
+ color: #ffc107;
2334
+ }
2335
+
2336
+ .auth-status.unauthenticated {
2337
+ background: rgba(244, 54, 127, 0.2);
2338
+ color: var(--ac-danger-color);
2339
+ }
2340
+ `],V([de({type:String})],si.prototype,"url",2),V([de({type:Number})],si.prototype,"port",2),V([de({type:String})],si.prototype,"authState",2),si=V([ht("current-state")],si);var Vh=Ge`
2313
2341
  @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
2314
2342
 
2315
2343
  :host {
@@ -2390,8 +2418,10 @@ WHERE ${g.join(" AND ")}
2390
2418
  bottom: 20px;
2391
2419
  right: 20px;
2392
2420
  color: var(--ac-primary-color);
2421
+ width: 40px;
2422
+ height: 40px;
2393
2423
  }
2394
- `,Pe=class extends qe{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),ls(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0,this.style.display="")}),this.core.token?this.core.connect().catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0,this.style.display=""}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return $e(this,null,function*(){this.core.port=t.detail.port,Dn("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return $e(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,Dn("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return $e(this,null,function*(){let r=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!r,r&&(this.modalOpen=!1)})}connectRemoteNode(t){return $e(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,Dn("ad4m-url",this.core.url);try{if(yield Mn(t.detail.remoteUrl),console.log("[Ad4m Connect UI] Remote connection successful"),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");console.log("[Ad4m Connect UI] Remote AD4M API verified");let n=yield this.core.isMultiUser();console.log("[Ad4m Connect UI] Remote multi-user detected:",n),this.currentView="remote-authentication"}catch(r){console.error("[Ad4m Connect UI] Remote connection failed:",r),this.remoteNodeError=!0}finally{this.connectingToRemoteNode=!1}})}emailLogin(t){return $e(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return $e(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!r,r&&(this.modalOpen=!1)}catch(r){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return $e(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!r,r&&(this.modalOpen=!1)}catch(r){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return $e(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!r,r&&(this.modalOpen=!1)}catch(r){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}renderViews(){if(this.currentView==="connection-options")return M`
2424
+ `,Re=class extends Le{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),us(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.token?this.core.connect().catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return Se(this,null,function*(){this.core.port=t.detail.port,Rn("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return Se(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,Rn("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return Se(this,null,function*(){let r=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!r,r&&(this.modalOpen=!1)})}connectRemoteNode(t){return Se(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,Rn("ad4m-url",this.core.url);try{if(yield On(t.detail.remoteUrl),console.log("[Ad4m Connect UI] Remote connection successful"),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");console.log("[Ad4m Connect UI] Remote AD4M API verified");let n=yield this.core.isMultiUser();console.log("[Ad4m Connect UI] Remote multi-user detected:",n),this.currentView="remote-authentication"}catch(r){console.error("[Ad4m Connect UI] Remote connection failed:",r),this.remoteNodeError=!0}finally{this.connectingToRemoteNode=!1}})}emailLogin(t){return Se(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return Se(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!r,r&&(this.modalOpen=!1)}catch(r){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return Se(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!r,r&&(this.modalOpen=!1)}catch(r){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return Se(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!r,r&&(this.modalOpen=!1)}catch(r){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return Se(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return L`
2395
2425
  <connection-options
2396
2426
  .port=${this.core.port}
2397
2427
  .remoteUrl=${this.core.options.remoteUrl}
@@ -2402,7 +2432,7 @@ WHERE ${g.join(" AND ")}
2402
2432
  @connect-remote-node=${this.connectRemoteNode}
2403
2433
  @clear-remote-node-error=${()=>{this.remoteNodeError=!1}}
2404
2434
  ></connection-options>
2405
- `;if(this.currentView==="local-authentication")return M`
2435
+ `;if(this.currentView==="local-authentication")return L`
2406
2436
  <local-authentication
2407
2437
  .capabilities=${this.core.options.capabilities}
2408
2438
  .appname=${this.core.options.appInfo.name}
@@ -2413,7 +2443,7 @@ WHERE ${g.join(" AND ")}
2413
2443
  @verify-code=${this.verifyLocalAd4mCode}
2414
2444
  @clear-verification-error=${()=>{this.verificationError=!1}}
2415
2445
  ></local-authentication>
2416
- `;if(this.currentView==="remote-authentication")return M`
2446
+ `;if(this.currentView==="remote-authentication")return L`
2417
2447
  <remote-authentication
2418
2448
  .remoteAuthLoading=${this.remoteAuthLoading}
2419
2449
  .remoteAuthState=${this.remoteAuthState}
@@ -2427,28 +2457,36 @@ WHERE ${g.join(" AND ")}
2427
2457
  @create-account=${this.createAccount}
2428
2458
  @clear-email-code-error=${()=>{this.emailCodeError=!1}}
2429
2459
  ></remote-authentication>
2430
- `}render(){return!this.modalOpen&&this.core.authState==="authenticated"?M`
2460
+ `;if(this.currentView==="current-state")return L`
2461
+ <current-state
2462
+ .url=${this.core.url}
2463
+ .port=${this.core.port}
2464
+ .authState=${this.core.authState}
2465
+ @close=${()=>{this.modalOpen=!1}}
2466
+ @disconnect=${this.disconnect}
2467
+ ></current-state>
2468
+ `}render(){return this.modalOpen?L`
2469
+ <div class="wrapper">
2470
+ <div class="modal">
2471
+ <header class="modal-header">
2472
+ ${fi()}
2473
+ </header>
2474
+ <main class="modal-content">
2475
+ ${this.renderViews()}
2476
+ </main>
2477
+ </div>
2478
+ <div class="backdrop" />
2479
+ </div>
2480
+ `:this.core.authState==="authenticated"?L`
2431
2481
  <button
2432
2482
  type="button"
2433
2483
  class="settings-button"
2434
2484
  aria-label="Open settings"
2435
- @click=${()=>{this.currentView="connection-options",this.modalOpen=!0}}
2485
+ @click=${()=>{this.currentView="current-state",this.modalOpen=!0}}
2436
2486
  >
2437
- ${di()}
2487
+ ${fi()}
2438
2488
  </button>
2439
- `:M`
2440
- <div class="wrapper">
2441
- <div class="modal">
2442
- <header class="modal-header">
2443
- ${di()}
2444
- </header>
2445
- <main class="modal-content">
2446
- ${this.renderViews()}
2447
- </main>
2448
- </div>
2449
- <div class="backdrop" />
2450
- </div>
2451
- `}};Pe.styles=[qh],Q([ue()],Pe.prototype,"modalOpen",2),Q([ue()],Pe.prototype,"currentView",2),Q([ue()],Pe.prototype,"connectingToRemoteNode",2),Q([ue()],Pe.prototype,"remoteNodeError",2),Q([ue()],Pe.prototype,"verificationError",2),Q([ue()],Pe.prototype,"remoteAuthLoading",2),Q([ue()],Pe.prototype,"remoteAuthState",2),Q([ue()],Pe.prototype,"emailCodeError",2),Q([ue()],Pe.prototype,"passwordError",2),Q([ue()],Pe.prototype,"accountCreationError",2),Pe=Q([Mt("ad4m-connect")],Pe);function Vh(i){let e=new Pe;return e.core=i,i.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),i.token&&(e.style.display="none"),document.body.appendChild(e)),e}export{Pe as Ad4mConnectElement,Vh as default};
2489
+ `:null}};Re.styles=[Vh],V([ue()],Re.prototype,"modalOpen",2),V([ue()],Re.prototype,"currentView",2),V([ue()],Re.prototype,"connectingToRemoteNode",2),V([ue()],Re.prototype,"remoteNodeError",2),V([ue()],Re.prototype,"verificationError",2),V([ue()],Re.prototype,"remoteAuthLoading",2),V([ue()],Re.prototype,"remoteAuthState",2),V([ue()],Re.prototype,"emailCodeError",2),V([ue()],Re.prototype,"passwordError",2),V([ue()],Re.prototype,"accountCreationError",2),Re=V([ht("ad4m-connect")],Re);function zh(i){let e=new Re;return e.core=i,i.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),document.body.appendChild(e)),e}export{Re as Ad4mConnectElement,zh as default};
2452
2490
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
2453
2491
  /**
2454
2492
  * @license