@coasys/ad4m-connect 0.12.0 → 0.12.1-dev

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,67 @@
1
- var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Object.getPrototypeOf;var ku=Reflect.get;var j=(i,e,t,r)=>{for(var n=r>1?void 0:r?$u(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&&xu(e,t,n),n};var ko=(i,e,t)=>ku(Au(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 Dn=window,Mn=Dn.ShadowRoot&&(Dn.ShadyCSS===void 0||Dn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ts=Symbol(),Io=new WeakMap,Pr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==ts)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(Mn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Io.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Io.set(t,e))}return e}toString(){return this.cssText}},To=i=>new Pr(typeof i=="string"?i:i+"",void 0,ts),Je=(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 Pr(t,i,ts)},is=(i,e)=>{Mn?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=Dn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Un=Mn?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return To(t)})(i):i;var rs,Fn=window,Co=Fn.trustedTypes,Iu=Co?Co.emptyScript:"",Lo=Fn.reactiveElementPolyfillSupport,as={toAttribute(i,e){switch(e){case Boolean:i=i?Iu: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}},No=(i,e)=>e!==i&&(e==e||i==i),ns={attribute:!0,type:String,converter:as,reflect:!1,hasChanged:No},ss="finalized",Lt=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=ns){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)||ns}static finalize(){if(this.hasOwnProperty(ss))return!1;this[ss]=!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(Un(n))}else e!==void 0&&t.push(Un(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 is(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=ns){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:as).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:as;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||No)(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){}};Lt[ss]=!0,Lt.elementProperties=new Map,Lt.elementStyles=[],Lt.shadowRootOptions={mode:"open"},Lo?.({ReactiveElement:Lt}),((rs=Fn.reactiveElementVersions)!==null&&rs!==void 0?rs:Fn.reactiveElementVersions=[]).push("1.6.3");var os,jn=window,Xi=jn.trustedTypes,Ro=Xi?Xi.createPolicy("lit-html",{createHTML:i=>i}):void 0,ls="$lit$",jt=`lit$${(Math.random()+"").slice(9)}$`,jo="?"+jt,Tu=`<${jo}>`,pi=document,Dr=()=>pi.createComment(""),Mr=i=>i===null||typeof i!="object"&&typeof i!="function",Bo=Array.isArray,Cu=i=>Bo(i)||typeof i?.[Symbol.iterator]=="function",cs=`[
2
- \f\r]`,Or=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Po=/-->/g,Oo=/>/g,ui=RegExp(`>|${cs}(?:([^\\s"'>=/]+)(${cs}*=${cs}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Do=/'/g,Mo=/"/g,qo=/^(?:script|style|textarea|title)$/i,Ho=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),N=Ho(1),xg=Ho(2),fi=Symbol.for("lit-noChange"),Ee=Symbol.for("lit-nothing"),Uo=new WeakMap,di=pi.createTreeWalker(pi,129,null,!1);function Vo(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Ro!==void 0?Ro.createHTML(e):e}var Lu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Or;for(let o=0;o<t;o++){let l=i[o],c,u,m=-1,y=0;for(;y<l.length&&(s.lastIndex=y,u=s.exec(l),u!==null);)y=s.lastIndex,s===Or?u[1]==="!--"?s=Po:u[1]!==void 0?s=Oo:u[2]!==void 0?(qo.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=ui):u[3]!==void 0&&(s=ui):s===ui?u[0]===">"?(s=n??Or,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?ui:u[3]==='"'?Mo:Do):s===Mo||s===Do?s=ui:s===Po||s===Oo?s=Or:(s=ui,n=void 0);let d=s===ui&&i[o+1].startsWith("/>")?" ":"";a+=s===Or?l+Tu:m>=0?(r.push(c),l.slice(0,m)+ls+l.slice(m)+jt+d):l+jt+(m===-2?(r.push(void 0),o):d)}return[Vo(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},hi=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]=Lu(e,t);if(this.el=hi.createElement(c,r),di.currentNode=this.el.content,t===2){let m=this.el.content,y=m.firstChild;y.remove(),m.append(...y.childNodes)}for(;(n=di.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let y of n.getAttributeNames())if(y.endsWith(ls)||y.startsWith(jt)){let d=u[s++];if(m.push(y),d!==void 0){let p=n.getAttribute(d.toLowerCase()+ls).split(jt),f=/([.?@])?(.*)/.exec(d);l.push({type:1,index:a,name:f[2],strings:p,ctor:f[1]==="."?ds:f[1]==="?"?ps:f[1]==="@"?fs:tr})}else l.push({type:6,index:a})}for(let y of m)n.removeAttribute(y)}if(qo.test(n.tagName)){let m=n.textContent.split(jt),y=m.length-1;if(y>0){n.textContent=Xi?Xi.emptyScript:"";for(let d=0;d<y;d++)n.append(m[d],Dr()),di.nextNode(),l.push({type:2,index:++a});n.append(m[y],Dr())}}}else if(n.nodeType===8)if(n.data===jo)l.push({type:2,index:a});else{let m=-1;for(;(m=n.data.indexOf(jt,m+1))!==-1;)l.push({type:7,index:a}),m+=jt.length-1}a++}}static createElement(e,t){let r=pi.createElement("template");return r.innerHTML=e,r}};function er(i,e,t=i,r){var n,a,s,o;if(e===fi)return e;let l=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,c=Mr(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=er(i,l._$AS(i,e.values),l,r)),e}var us=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:pi).importNode(r,!0);di.currentNode=a;let s=di.nextNode(),o=0,l=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new gi(s,s.nextSibling,this,e):c.type===1?u=new c.ctor(s,c.name,c.strings,this,e):c.type===6&&(u=new hs(s,this,e)),this._$AV.push(u),c=n[++l]}o!==c?.index&&(s=di.nextNode(),o++)}return di.currentNode=pi,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++}},gi=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=Ee,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=er(this,e,t),Mr(e)?e===Ee||e==null||e===""?(this._$AH!==Ee&&this._$AR(),this._$AH=Ee):e!==this._$AH&&e!==fi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Cu(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!==Ee&&Mr(this._$AH)?this._$AA.nextSibling.data=e:this.$(pi.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=hi.createElement(Vo(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 us(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Uo.get(e.strings);return t===void 0&&Uo.set(e.strings,t=new hi(e)),t}T(e){Bo(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 gi(this.k(Dr()),this.k(Dr()),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))}},tr=class{constructor(e,t,r,n,a){this.type=1,this._$AH=Ee,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=Ee}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=er(this,e,t,0),s=!Mr(e)||e!==this._$AH&&e!==fi,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=er(this,o[r+l],t,l),c===fi&&(c=this._$AH[l]),s||(s=!Mr(c)||c!==this._$AH[l]),c===Ee?e=Ee:e!==Ee&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!n&&this.j(e)}j(e){e===Ee?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},ds=class extends tr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ee?void 0:e}},Nu=Xi?Xi.emptyScript:"",ps=class extends tr{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ee?this.element.setAttribute(this.name,Nu):this.element.removeAttribute(this.name)}},fs=class extends tr{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=er(this,e,t,0))!==null&&r!==void 0?r:Ee)===fi)return;let n=this._$AH,a=e===Ee&&n!==Ee||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ee&&(n===Ee||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)}},hs=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){er(this,e)}};var Fo=jn.litHtmlPolyfillSupport;Fo?.(hi,gi),((os=jn.litHtmlVersions)!==null&&os!==void 0?os:jn.litHtmlVersions=[]).push("2.8.0");var zo=(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 gi(e.insertBefore(Dr(),o),o,void 0,t??{})}return s._$AI(i),s};var gs,ms;var Le=class extends Lt{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=zo(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 fi}};Le.finalized=!0,Le._$litElement$=!0,(gs=globalThis.litElementHydrateSupport)===null||gs===void 0||gs.call(globalThis,{LitElement:Le});var Wo=globalThis.litElementPolyfillSupport;Wo?.({LitElement:Le});((ms=globalThis.litElementVersions)!==null&&ms!==void 0?ms:globalThis.litElementVersions=[]).push("3.3.3");var gt=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 Ru=(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)}},Pu=(i,e,t)=>{e.constructor.createProperty(t,i)};function fe(i){return(e,t)=>t!==void 0?Pu(i,e,t):Ru(i,e)}function ue(i){return fe({...i,state:!0})}var ys,Jg=((ys=window.HTMLSlotElement)===null||ys===void 0?void 0:ys.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var Ou=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 vs(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 Ou(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 Ko="0.12.0";function Mu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Bn(i,e){Mu()&&localStorage.setItem(`${Ko}/${i}`,e)}function qn(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)})])})}function mi(){return N`
1
+ var Uo=Object.defineProperty,Fu=Object.defineProperties,ju=Object.getOwnPropertyDescriptor,Bu=Object.getOwnPropertyDescriptors;var Oo=Object.getOwnPropertySymbols,qu=Object.getPrototypeOf,Hu=Object.prototype.hasOwnProperty,zu=Object.prototype.propertyIsEnumerable,Vu=Reflect.get;var Do=(i,e,t)=>e in i?Uo(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,Mo=(i,e)=>{for(var t in e||={})Hu.call(e,t)&&Do(i,t,e[t]);if(Oo)for(var t of Oo(e))zu.call(e,t)&&Do(i,t,e[t]);return i},Fo=(i,e)=>Fu(i,Bu(e));var L=(i,e,t,r)=>{for(var n=r>1?void 0:r?ju(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&&Uo(e,t,n),n};var jo=(i,e,t)=>Vu(qu(i),t,e);var pe=(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 Bn=window,qn=Bn.ShadowRoot&&(Bn.ShadyCSS===void 0||Bn.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,cs=Symbol(),Bo=new WeakMap,Dr=class{constructor(e,t,r){if(this._$cssResult$=!0,r!==cs)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(qn&&e===void 0){let r=t!==void 0&&t.length===1;r&&(e=Bo.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&Bo.set(t,e))}return e}toString(){return this.cssText}},qo=i=>new Dr(typeof i=="string"?i:i+"",void 0,cs),Ee=(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 Dr(t,i,cs)},ls=(i,e)=>{qn?i.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let r=document.createElement("style"),n=Bn.litNonce;n!==void 0&&r.setAttribute("nonce",n),r.textContent=t.cssText,i.appendChild(r)})},Hn=qn?i=>i:i=>i instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return qo(t)})(i):i;var us,zn=window,Ho=zn.trustedTypes,Wu=Ho?Ho.emptyScript:"",zo=zn.reactiveElementPolyfillSupport,ps={toAttribute(i,e){switch(e){case Boolean:i=i?Wu: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}},Vo=(i,e)=>e!==i&&(e==e||i==i),ds={attribute:!0,type:String,converter:ps,reflect:!1,hasChanged:Vo},fs="finalized",Dt=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=ds){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)||ds}static finalize(){if(this.hasOwnProperty(fs))return!1;this[fs]=!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(Hn(n))}else e!==void 0&&t.push(Hn(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 ls(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=ds){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:ps).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:ps;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||Vo)(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){}};Dt[fs]=!0,Dt.elementProperties=new Map,Dt.elementStyles=[],Dt.shadowRootOptions={mode:"open"},zo?.({ReactiveElement:Dt}),((us=zn.reactiveElementVersions)!==null&&us!==void 0?us:zn.reactiveElementVersions=[]).push("1.6.3");var hs,Vn=window,nr=Vn.trustedTypes,Wo=nr?nr.createPolicy("lit-html",{createHTML:i=>i}):void 0,ms="$lit$",Wt=`lit$${(Math.random()+"").slice(9)}$`,Xo="?"+Wt,Ku=`<${Xo}>`,vi=document,Mr=()=>vi.createComment(""),Fr=i=>i===null||typeof i!="object"&&typeof i!="function",ec=Array.isArray,Qu=i=>ec(i)||typeof i?.[Symbol.iterator]=="function",gs=`[
2
+ \f\r]`,Ur=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ko=/-->/g,Qo=/>/g,mi=RegExp(`>|${gs}(?:([^\\s"'>=/]+)(${gs}*=${gs}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),Go=/'/g,Zo=/"/g,tc=/^(?:script|style|textarea|title)$/i,ic=i=>(e,...t)=>({_$litType$:i,strings:e,values:t}),I=ic(1),zg=ic(2),bi=Symbol.for("lit-noChange"),Ae=Symbol.for("lit-nothing"),Jo=new WeakMap,yi=vi.createTreeWalker(vi,129,null,!1);function rc(i,e){if(!Array.isArray(i)||!i.hasOwnProperty("raw"))throw Error("invalid template strings array");return Wo!==void 0?Wo.createHTML(e):e}var Gu=(i,e)=>{let t=i.length-1,r=[],n,a=e===2?"<svg>":"",s=Ur;for(let o=0;o<t;o++){let l=i[o],c,u,m=-1,y=0;for(;y<l.length&&(s.lastIndex=y,u=s.exec(l),u!==null);)y=s.lastIndex,s===Ur?u[1]==="!--"?s=Ko:u[1]!==void 0?s=Qo:u[2]!==void 0?(tc.test(u[2])&&(n=RegExp("</"+u[2],"g")),s=mi):u[3]!==void 0&&(s=mi):s===mi?u[0]===">"?(s=n??Ur,m=-1):u[1]===void 0?m=-2:(m=s.lastIndex-u[2].length,c=u[1],s=u[3]===void 0?mi:u[3]==='"'?Zo:Go):s===Zo||s===Go?s=mi:s===Ko||s===Qo?s=Ur:(s=mi,n=void 0);let d=s===mi&&i[o+1].startsWith("/>")?" ":"";a+=s===Ur?l+Ku:m>=0?(r.push(c),l.slice(0,m)+ms+l.slice(m)+Wt+d):l+Wt+(m===-2?(r.push(void 0),o):d)}return[rc(i,a+(i[t]||"<?>")+(e===2?"</svg>":"")),r]},wi=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=wi.createElement(c,r),yi.currentNode=this.el.content,t===2){let m=this.el.content,y=m.firstChild;y.remove(),m.append(...y.childNodes)}for(;(n=yi.nextNode())!==null&&l.length<o;){if(n.nodeType===1){if(n.hasAttributes()){let m=[];for(let y of n.getAttributeNames())if(y.endsWith(ms)||y.startsWith(Wt)){let d=u[s++];if(m.push(y),d!==void 0){let f=n.getAttribute(d.toLowerCase()+ms).split(Wt),g=/([.?@])?(.*)/.exec(d);l.push({type:1,index:a,name:g[2],strings:f,ctor:g[1]==="."?vs:g[1]==="?"?bs:g[1]==="@"?ws:sr})}else l.push({type:6,index:a})}for(let y of m)n.removeAttribute(y)}if(tc.test(n.tagName)){let m=n.textContent.split(Wt),y=m.length-1;if(y>0){n.textContent=nr?nr.emptyScript:"";for(let d=0;d<y;d++)n.append(m[d],Mr()),yi.nextNode(),l.push({type:2,index:++a});n.append(m[y],Mr())}}}else if(n.nodeType===8)if(n.data===Xo)l.push({type:2,index:a});else{let m=-1;for(;(m=n.data.indexOf(Wt,m+1))!==-1;)l.push({type:7,index:a}),m+=Wt.length-1}a++}}static createElement(e,t){let r=vi.createElement("template");return r.innerHTML=e,r}};function ar(i,e,t=i,r){var n,a,s,o;if(e===bi)return e;let l=r!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[r]:t._$Cl,c=Fr(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=ar(i,l._$AS(i,e.values),l,r)),e}var ys=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:vi).importNode(r,!0);yi.currentNode=a;let s=yi.nextNode(),o=0,l=0,c=n[0];for(;c!==void 0;){if(o===c.index){let u;c.type===2?u=new Si(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=yi.nextNode(),o++)}return yi.currentNode=vi,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++}},Si=class{constructor(e,t,r,n){var a;this.type=2,this._$AH=Ae,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=ar(this,e,t),Fr(e)?e===Ae||e==null||e===""?(this._$AH!==Ae&&this._$AR(),this._$AH=Ae):e!==this._$AH&&e!==bi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Qu(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!==Ae&&Fr(this._$AH)?this._$AA.nextSibling.data=e:this.$(vi.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=wi.createElement(rc(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 ys(a,this),o=s.u(this.options);s.v(r),this.$(o),this._$AH=s}}_$AC(e){let t=Jo.get(e.strings);return t===void 0&&Jo.set(e.strings,t=new wi(e)),t}T(e){ec(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 Si(this.k(Mr()),this.k(Mr()),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))}},sr=class{constructor(e,t,r,n,a){this.type=1,this._$AH=Ae,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=Ae}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=ar(this,e,t,0),s=!Fr(e)||e!==this._$AH&&e!==bi,s&&(this._$AH=e);else{let o=e,l,c;for(e=a[0],l=0;l<a.length-1;l++)c=ar(this,o[r+l],t,l),c===bi&&(c=this._$AH[l]),s||(s=!Fr(c)||c!==this._$AH[l]),c===Ae?e=Ae:e!==Ae&&(e+=(c??"")+a[l+1]),this._$AH[l]=c}s&&!n&&this.j(e)}j(e){e===Ae?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},vs=class extends sr{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ae?void 0:e}},Zu=nr?nr.emptyScript:"",bs=class extends sr{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ae?this.element.setAttribute(this.name,Zu):this.element.removeAttribute(this.name)}},ws=class extends sr{constructor(e,t,r,n,a){super(e,t,r,n,a),this.type=5}_$AI(e,t=this){var r;if((e=(r=ar(this,e,t,0))!==null&&r!==void 0?r:Ae)===bi)return;let n=this._$AH,a=e===Ae&&n!==Ae||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,s=e!==Ae&&(n===Ae||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){ar(this,e)}};var Yo=Vn.litHtmlPolyfillSupport;Yo?.(wi,Si),((hs=Vn.litHtmlVersions)!==null&&hs!==void 0?hs:Vn.litHtmlVersions=[]).push("2.8.0");var nc=(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 Si(e.insertBefore(Mr(),o),o,void 0,t??{})}return s._$AI(i),s};var _s,xs;var ge=class extends Dt{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=nc(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 bi}};ge.finalized=!0,ge._$litElement$=!0,(_s=globalThis.litElementHydrateSupport)===null||_s===void 0||_s.call(globalThis,{LitElement:ge});var ac=globalThis.litElementPolyfillSupport;ac?.({LitElement:ge});((xs=globalThis.litElementVersions)!==null&&xs!==void 0?xs:globalThis.litElementVersions=[]).push("3.3.3");var Ne=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 Ju=(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 ie(i){return(e,t)=>t!==void 0?Yu(i,e,t):Ju(i,e)}function Y(i){return ie({...i,state:!0})}var Es,ym=((Es=window.HTMLSlotElement)===null||Es===void 0?void 0:Es.prototype.assignedElements)!=null?(i,e)=>i.assignedElements(e):(i,e)=>i.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var Xu=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 $s(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 Xu(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 sc="0.12.1-dev";function td(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(i){return!1}return!0}function Br(i,e){td()&&localStorage.setItem(`${sc}/${i}`,e)}function qr(i,e=1e4){return pe(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 oc(i){let e=i.trim();if(!e)return"";let t=e.split(/\s+/);return t.length>=2?(t[0][0]+t[1][0]).toUpperCase():e.slice(0,2).toUpperCase()}function cc(i){let e=0;for(let t=0;t<i.length;t++)e=i.charCodeAt(t)+((e<<5)-e);return(e%360+360)%360}function _i(){return I`
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 ir(){return N`
7
+ `}function or(){return I`
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 rr(){return N`
12
+ `}function Wn(){return I`
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 Hn(){return N`
18
+ `}function Kn(){return I`
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 dt(){return N`
24
+ `}function mt(){return I`
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 Oe(){return N`
29
+ `}function Ue(){return I`
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 Vn(){return N`
33
+ `}function Qn(){return I`
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 zn(){return N`
38
+ `}function Gn(){return I`
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 nr(){return N`
42
+ `}function wt(){return I`
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 Bt=Je`
46
+ `}function Zn(){return I`
47
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
48
+ <circle cx="12" cy="12" r="10"></circle>
49
+ <path d="M2 12h20"></path>
50
+ <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>
51
+ </svg>
52
+ `}function Hr(){return I`
53
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
54
+ <circle cx="12" cy="12" r="10"></circle>
55
+ <path d="M12 6v12"></path>
56
+ <path d="M15.5 9.5a3 3 0 0 0-3-2.5H11a3 3 0 0 0 0 6h2a3 3 0 0 1 0 6h-1.5a3 3 0 0 1-3-2.5"></path>
57
+ </svg>
58
+ `}function Jn(){return I`
59
+ <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
60
+ <rect x="2" y="6" width="20" height="14" rx="2"></rect>
61
+ <path d="M2 10h20"></path>
62
+ <circle cx="16" cy="14" r="1" fill="currentColor"></circle>
63
+ </svg>
64
+ `}var id="https://hosting.ad4m.dev";function rd(i){try{return new URL(i),!0}catch(e){return!1}}function As(i){return pe(this,null,function*(){let e=i||id,t=yield fetch(`${e}/hosts`);if(!t.ok)throw new Error(`Failed to fetch hosts: ${t.status}`);let r=yield t.json();for(let n of r)n.profilePicUrl&&!rd(n.profilePicUrl)&&(n.profilePicUrl=new URL(n.profilePicUrl,e).toString());return r})}var Ke=Ee`
47
65
  * {
48
66
  box-sizing: border-box;
49
67
  }
@@ -242,6 +260,7 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
242
260
  display: flex;
243
261
  flex-direction: column;
244
262
  gap: 30px;
263
+ padding: 2px;
245
264
  }
246
265
 
247
266
  .box {
@@ -305,7 +324,7 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
305
324
  .state.danger svg {
306
325
  color: var(--ac-danger-color);
307
326
  }
308
- `;var ke=class extends Le{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.showMultiUserOption=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl="";this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}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 qn(`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*(){ko(ke.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:N`
327
+ `;var et=class extends ge{constructor(){super(...arguments);this.showHosting=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return pe(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return pe(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}browseHosts(){this.dispatchEvent(new CustomEvent("browse-hosts",{bubbles:!0,composed:!0}))}detectLocalNode(){return pe(this,null,function*(){try{yield qr(`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 pe(this,null,function*(){jo(et.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port)}render(){return this.loading?null:I`
309
328
  <div class="container">
310
329
  <div class="header">
311
330
  <h1>Connect AD4M</h1>
@@ -313,31 +332,31 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
313
332
  </div>
314
333
 
315
334
  <div class="options">
316
- ${this.isMobile?"":N`
335
+ ${!this.isMobile||!this.showHosting?I`
317
336
  <div class="box">
318
337
  <div class="box-header">
319
- ${ir()}
338
+ ${or()}
320
339
  <h3>Local Node</h3>
321
340
  </div>
322
341
 
323
- ${this.localNodeDetected?N`
342
+ ${this.localNodeDetected?I`
324
343
  <div class="state success">
325
- ${dt()}
344
+ ${mt()}
326
345
  <p>Local node detected on port ${this.port}</p>
327
346
  </div>
328
347
 
329
348
  <button class="primary" @click=${this.connectLocalNode}>
330
349
  Connect to Local Node
331
350
  </button>
332
- `:N`
351
+ `:I`
333
352
  <div class="state danger">
334
- ${Oe()}
353
+ ${Ue()}
335
354
  <p>No local node detected on port ${this.port}</p>
336
355
  </div>
337
356
 
338
357
  <p style="margin-bottom: -12px">Download and install AD4M</p>
339
358
  <button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
340
- ${Hn()} Download AD4M
359
+ ${Kn()} Download AD4M
341
360
  </button>
342
361
  `}
343
362
 
@@ -351,54 +370,29 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
351
370
  @keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
352
371
  />
353
372
  <button class="primary" @click=${this.refreshPort}>
354
- ${Vn()}
373
+ ${Qn()}
355
374
  </button>
356
375
  </div>
357
376
  </div>
358
- `}
377
+ `:""}
359
378
 
360
- ${this.showMultiUserOption?N`
379
+ ${this.showHosting?I`
361
380
  <div class="box">
362
381
  <div class="box-header">
363
- ${rr()}
382
+ ${Zn()}
364
383
  <h3>Remote Node</h3>
365
384
  </div>
366
385
 
367
- ${this.remoteUrl?N`
368
- <div class="state success">
369
- ${dt()}
370
- <p>Remote configuration detected</p>
371
- </div>
372
- `:N`<p style="margin-bottom: -12px">Enter the URL of a remote AD4M node</p>`}
373
-
374
- <input
375
- type="text"
376
- placeholder="https://ad4m-node:12000/graphql"
377
- .value=${this.newRemoteUrl}
378
- @input=${t=>{let r=t.target;this.newRemoteUrl=r.value,this.remoteNodeError&&this.clearRemoteNodeError()}}
379
- @keydown=${t=>{t.key==="Enter"&&!this.connectingToRemoteNode&&this.newRemoteUrl.trim().length&&this.connectRemoteNode()}}
380
- style= "font-size: 16px;"
381
- />
386
+ <p>Browse hosted AD4M nodes or enter a URL</p>
382
387
 
383
- ${this.remoteNodeError?N`
384
- <div class="state danger">
385
- ${Oe()}
386
- <p>Unable to connect to remote node</p>
387
- </div>
388
- `:""}
389
-
390
- <button
391
- class="primary"
392
- ?disabled=${this.connectingToRemoteNode||this.newRemoteUrl.trim().length===0}
393
- @click=${this.connectRemoteNode}
394
- >
395
- ${this.connectingToRemoteNode?"Connecting...":"Connect to Remote Node"}
388
+ <button class="primary" @click=${this.browseHosts}>
389
+ Connect to Remote Node
396
390
  </button>
397
391
  </div>
398
392
  `:""}
399
393
  </div>
400
394
  </div>
401
- `}};ke.styles=[Bt,Je`
395
+ `}};et.styles=[Ke,Ee`
402
396
  .options {
403
397
  display: flex;
404
398
  flex-direction: column;
@@ -427,38 +421,38 @@ var xu=Object.defineProperty;var $u=Object.getOwnPropertyDescriptor;var Au=Objec
427
421
  button {
428
422
  width: 100%;
429
423
  }
430
- `],j([fe({type:Number})],ke.prototype,"port",2),j([fe({type:String})],ke.prototype,"remoteUrl",2),j([fe({type:Boolean})],ke.prototype,"connectingToRemoteNode",2),j([fe({type:Boolean})],ke.prototype,"remoteNodeError",2),j([fe({type:Boolean})],ke.prototype,"showMultiUserOption",2),j([ue()],ke.prototype,"loading",2),j([ue()],ke.prototype,"localNodeDetected",2),j([ue()],ke.prototype,"newPort",2),j([ue()],ke.prototype,"newRemoteUrl",2),j([ue()],ke.prototype,"isMobile",2),ke=j([gt("connection-options")],ke);var _a=function(){return _a=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},_a.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function sa(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?sa=function(t){return typeof t}:sa=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},sa(i)}function Uu(i){return sa(i)=="object"&&i!==null}var yl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Us(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 Fu(i){return vl(i.source,Us(i.source,i.start))}function vl(i,e){var t=i.locationOffset.column-1,r=oa(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,`
431
- `),u=r.split(/\r\n|[\n\r]/g),m=u[n];if(m.length>120){for(var y=Math.floor(l/80),d=l%80,p=[],f=0;f<m.length;f+=80)p.push(m.slice(f,f+80));return c+Qo([["".concat(s),p[0]]].concat(p.slice(1,y+1).map(function(S){return["",S]}),[[" ",oa(d-1)+"^"],["",p[y+1]]]))}return c+Qo([["".concat(s-1),u[n-1]],["".concat(s),m],["",oa(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 ju(t,n)+(a?" | "+a:" |")}).join(`
432
- `)}function oa(i){return Array(i+1).join(" ")}function ju(i,e){return oa(i-e.length)+e}function ca(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ca=function(t){return typeof t}:ca=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ca(i)}function Go(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 Bu(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Go(Object(t),!0).forEach(function(r){qu(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):Go(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function qu(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function Hu(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 Vu(i,e,t){return e&&Zo(i.prototype,e),t&&Zo(i,t),i}function zu(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&&gn(i,e)}function Wu(i){var e=wl();return function(){var r=mn(i),n;if(e){var a=mn(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return bl(this,n)}}function bl(i,e){return e&&(ca(e)==="object"||typeof e=="function")?e:Hr(i)}function Hr(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Fs(i){var e=typeof Map=="function"?new Map:void 0;return Fs=function(r){if(r===null||!Ku(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 la(r,arguments,mn(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),gn(n,r)},Fs(i)}function la(i,e,t){return wl()?la=Reflect.construct:la=function(n,a,s){var o=[null];o.push.apply(o,a);var l=Function.bind.apply(n,o),c=new l;return s&&gn(c,s.prototype),c},la.apply(null,arguments)}function wl(){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 Ku(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function gn(i,e){return gn=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},gn(i,e)}function mn(i){return mn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},mn(i)}var Qu=function(i){zu(t,i);var e=Wu(t);function t(r,n,a,s,o,l,c){var u,m,y,d;Hu(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=l??void 0,d.nodes=Jo(Array.isArray(n)?n:n?[n]:void 0);for(var p=[],f=0,S=(E=d.nodes)!==null&&E!==void 0?E:[];f<S.length;f++){var E,A=S[f],k=A.loc;k!=null&&p.push(k)}p=Jo(p),d.source=a??((u=p)===null||u===void 0?void 0:u[0].source),d.positions=s??((m=p)===null||m===void 0?void 0:m.map(function(T){return T.start})),d.locations=s&&a?s.map(function(T){return Us(a,T)}):(y=p)===null||y===void 0?void 0:y.map(function(T){return Us(T.source,T.start)}),d.path=o??void 0;var b=l?.extensions;return c==null&&Uu(b)?d.extensions=Bu({},b):d.extensions=c??{},Object.defineProperties(Hr(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(Hr(d),"stack",{value:l.stack,writable:!0,configurable:!0}),bl(d)):(Error.captureStackTrace?Error.captureStackTrace(Hr(d),t):Object.defineProperty(Hr(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return Vu(t,[{key:"toString",value:function(){return Gu(this)}},{key:yl,get:function(){return"Object"}}]),t}(Fs(Error));function Jo(i){return i===void 0||i.length===0?void 0:i}function Gu(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+=`
424
+ `],L([ie({type:Number})],et.prototype,"port",2),L([ie({type:Boolean})],et.prototype,"showHosting",2),L([Y()],et.prototype,"loading",2),L([Y()],et.prototype,"localNodeDetected",2),L([Y()],et.prototype,"newPort",2),L([Y()],et.prototype,"isMobile",2),et=L([Ne("connection-options")],et);var Ia=function(){return Ia=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},Ia.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function pa(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?pa=function(t){return typeof t}:pa=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},pa(i)}function nd(i){return pa(i)=="object"&&i!==null}var Pl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Ws(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 ad(i){return Rl(i.source,Ws(i.source,i.start))}function Rl(i,e){var t=i.locationOffset.column-1,r=fa(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,`
425
+ `),u=r.split(/\r\n|[\n\r]/g),m=u[n];if(m.length>120){for(var y=Math.floor(l/80),d=l%80,f=[],g=0;g<m.length;g+=80)f.push(m.slice(g,g+80));return c+lc([["".concat(s),f[0]]].concat(f.slice(1,y+1).map(function(_){return["",_]}),[[" ",fa(d-1)+"^"],["",f[y+1]]]))}return c+lc([["".concat(s-1),u[n-1]],["".concat(s),m],["",fa(l-1)+"^"],["".concat(s+1),u[n+1]]])}function lc(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 sd(t,n)+(a?" | "+a:" |")}).join(`
426
+ `)}function fa(i){return Array(i+1).join(" ")}function sd(i,e){return fa(i-e.length)+e}function ha(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ha=function(t){return typeof t}:ha=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ha(i)}function uc(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 od(i){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?uc(Object(t),!0).forEach(function(r){cd(i,r,t[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(i,Object.getOwnPropertyDescriptors(t)):uc(Object(t)).forEach(function(r){Object.defineProperty(i,r,Object.getOwnPropertyDescriptor(t,r))})}return i}function cd(i,e,t){return e in i?Object.defineProperty(i,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):i[e]=t,i}function ld(i,e){if(!(i instanceof e))throw new TypeError("Cannot call a class as a function")}function dc(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 ud(i,e,t){return e&&dc(i.prototype,e),t&&dc(i,t),i}function dd(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&&wn(i,e)}function pd(i){var e=Ol();return function(){var r=Sn(i),n;if(e){var a=Sn(this).constructor;n=Reflect.construct(r,arguments,a)}else n=r.apply(this,arguments);return Nl(this,n)}}function Nl(i,e){return e&&(ha(e)==="object"||typeof e=="function")?e:Qr(i)}function Qr(i){if(i===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return i}function Ks(i){var e=typeof Map=="function"?new Map:void 0;return Ks=function(r){if(r===null||!fd(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 ga(r,arguments,Sn(this).constructor)}return n.prototype=Object.create(r.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),wn(n,r)},Ks(i)}function ga(i,e,t){return Ol()?ga=Reflect.construct:ga=function(n,a,s){var o=[null];o.push.apply(o,a);var l=Function.bind.apply(n,o),c=new l;return s&&wn(c,s.prototype),c},ga.apply(null,arguments)}function Ol(){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 fd(i){return Function.toString.call(i).indexOf("[native code]")!==-1}function wn(i,e){return wn=Object.setPrototypeOf||function(r,n){return r.__proto__=n,r},wn(i,e)}function Sn(i){return Sn=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Sn(i)}var hd=function(i){dd(t,i);var e=pd(t);function t(r,n,a,s,o,l,c){var u,m,y,d;ld(this,t),d=e.call(this,r),d.name="GraphQLError",d.originalError=l??void 0,d.nodes=pc(Array.isArray(n)?n:n?[n]:void 0);for(var f=[],g=0,_=(E=d.nodes)!==null&&E!==void 0?E:[];g<_.length;g++){var E,A=_[g],k=A.loc;k!=null&&f.push(k)}f=pc(f),d.source=a??((u=f)===null||u===void 0?void 0:u[0].source),d.positions=s??((m=f)===null||m===void 0?void 0:m.map(function(C){return C.start})),d.locations=s&&a?s.map(function(C){return Ws(a,C)}):(y=f)===null||y===void 0?void 0:y.map(function(C){return Ws(C.source,C.start)}),d.path=o??void 0;var w=l?.extensions;return c==null&&nd(w)?d.extensions=od({},w):d.extensions=c??{},Object.defineProperties(Qr(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(Qr(d),"stack",{value:l.stack,writable:!0,configurable:!0}),Nl(d)):(Error.captureStackTrace?Error.captureStackTrace(Qr(d),t):Object.defineProperty(Qr(d),"stack",{value:Error().stack,writable:!0,configurable:!0}),d)}return ud(t,[{key:"toString",value:function(){return gd(this)}},{key:Pl,get:function(){return"Object"}}]),t}(Ks(Error));function pc(i){return i===void 0||i.length===0?void 0:i}function gd(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+=`
433
427
 
434
- `+Fu(n.loc))}else if(i.source&&i.locations)for(var a=0,s=i.locations;a<s.length;a++){var o=s[a];e+=`
428
+ `+ad(n.loc))}else if(i.source&&i.locations)for(var a=0,s=i.locations;a<s.length;a++){var o=s[a];e+=`
435
429
 
436
- `+vl(i.source,o)}return e}function Xe(i,e,t){return new Qu("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 Zu(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ju=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,js=Ju;function Sl(i){var e=i.prototype.toJSON;typeof e=="function"||Zu(0),i.prototype.inspect=e,js&&(i.prototype[js]=e)}var _l=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}();Sl(_l);var me=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}();Sl(me);var $=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 ua(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ua=function(t){return typeof t}:ua=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ua(i)}var Yu=10,El=2;function Xu(i){return za(i,[])}function za(i,e){switch(ua(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":ed(i,e);default:return String(i)}}function ed(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=rd(i);if(r!==void 0){var n=r.call(i);if(n!==i)return typeof n=="string"?n:za(n,t)}else if(Array.isArray(i))return id(i,t);return td(i,t)}function td(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>El)return"["+nd(i)+"]";var r=t.map(function(n){var a=za(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function id(i,e){if(i.length===0)return"[]";if(e.length>El)return"[Array]";for(var t=Math.min(Yu,i.length),r=i.length-t,n=[],a=0;a<t;++a)n.push(za(i[a],e));return r===1?n.push("... 1 more item"):r>1&&n.push("... ".concat(r," more items")),"["+n.join(", ")+"]"}function rd(i){var e=i[String(js)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function nd(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 bs(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var ad=function(e,t){return e instanceof t};function Yo(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 sd(i,e,t){return e&&Yo(i.prototype,e),t&&Yo(i,t),i}var xl=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"||bs(0,"Body must be a string. Received: ".concat(Xu(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||bs(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||bs(0,"column in locationOffset is 1-indexed and must be positive.")}return sd(i,[{key:yl,get:function(){return"Source"}}]),i}();function od(i){return ad(i,xl)}var cd=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 ld(i){var e=i.split(/\r\n|[\n\r]/g),t=ud(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&&Xo(e[n]);)++n;for(var a=e.length;a>n&&Xo(e[a-1]);)--a;return e.slice(n,a).join(`
437
- `)}function Xo(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function ud(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 dd=function(){function i(t){var r=new me($.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!==$.EOF)do{var n;r=(n=r.next)!==null&&n!==void 0?n:r.next=fd(this,r)}while(r.kind===$.COMMENT);return r},i}();function pd(i){return i===$.BANG||i===$.DOLLAR||i===$.AMP||i===$.PAREN_L||i===$.PAREN_R||i===$.SPREAD||i===$.COLON||i===$.EQUALS||i===$.AT||i===$.BRACKET_L||i===$.BRACKET_R||i===$.BRACE_L||i===$.PIPE||i===$.BRACE_R}function Ni(i){return isNaN(i)?$.EOF:i<127?JSON.stringify(String.fromCharCode(i)):'"\\u'.concat(("00"+i.toString(16).toUpperCase()).slice(-4),'"')}function fd(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 me($.BANG,a,a+1,o,l,e);case 35:return gd(t,a,o,l,e);case 36:return new me($.DOLLAR,a,a+1,o,l,e);case 38:return new me($.AMP,a,a+1,o,l,e);case 40:return new me($.PAREN_L,a,a+1,o,l,e);case 41:return new me($.PAREN_R,a,a+1,o,l,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new me($.SPREAD,a,a+3,o,l,e);break;case 58:return new me($.COLON,a,a+1,o,l,e);case 61:return new me($.EQUALS,a,a+1,o,l,e);case 64:return new me($.AT,a,a+1,o,l,e);case 91:return new me($.BRACKET_L,a,a+1,o,l,e);case 93:return new me($.BRACKET_R,a,a+1,o,l,e);case 123:return new me($.BRACE_L,a,a+1,o,l,e);case 124:return new me($.PIPE,a,a+1,o,l,e);case 125:return new me($.BRACE_R,a,a+1,o,l,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?vd(t,a,o,l,e,i):yd(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 md(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 wd(t,a,o,l,e)}throw Xe(t,a,hd(s))}var c=i.line,u=1+a-i.lineStart;return new me($.EOF,n,n,c,u,e)}function hd(i){return i<32&&i!==9&&i!==10&&i!==13?"Cannot contain the invalid character ".concat(Ni(i),"."):i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Ni(i),".")}function gd(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 me($.COMMENT,e,o,t,r,n,a.slice(e+1,o))}function md(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 Xe(i,l,"Invalid number, unexpected digit after 0: ".concat(Ni(o),"."))}else l=ws(i,l,o),o=s.charCodeAt(l);if(o===46&&(c=!0,o=s.charCodeAt(++l),l=ws(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=ws(i,l,o),o=s.charCodeAt(l)),o===46||Sd(o))throw Xe(i,l,"Invalid number, expected digit but got: ".concat(Ni(o),"."));return new me(c?$.FLOAT:$.INT,e,l,r,n,a,s.slice(e,l))}function ws(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 Xe(i,n,"Invalid number, expected digit but got: ".concat(Ni(a),"."))}function yd(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 me($.STRING,e,s+1,t,r,n,c);if(l<32&&l!==9)throw Xe(i,s,"Invalid character within String: ".concat(Ni(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+=`
438
- `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var u=bd(a.charCodeAt(s+1),a.charCodeAt(s+2),a.charCodeAt(s+3),a.charCodeAt(s+4));if(u<0){var m=a.slice(s+1,s+5);throw Xe(i,s,"Invalid character escape sequence: \\u".concat(m,"."))}c+=String.fromCharCode(u),s+=4;break}default:throw Xe(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}++s,o=s}}throw Xe(i,s,"Unterminated string.")}function vd(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 me($.BLOCK_STRING,e,o+3,t,r,n,ld(u));if(c<32&&c!==9&&c!==10&&c!==13)throw Xe(i,o,"Invalid character within String: ".concat(Ni(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 Xe(i,o,"Unterminated string.")}function bd(i,e,t,r){return Wn(i)<<12|Wn(e)<<8|Wn(t)<<4|Wn(r)}function Wn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function wd(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 me($.NAME,e,o,t,r,n,a.slice(e,o))}function Sd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function _d(i,e){var t=new Ed(i,e);return t.parseDocument()}var Ed=function(){function i(t,r){var n=od(t)?t:new xl(t);this._lexer=new dd(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken($.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($.SOF,this.parseDefinition,$.EOF),loc:this.loc(r)}},e.parseDefinition=function(){if(this.peek($.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($.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($.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($.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($.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($.PAREN_L,this.parseVariableDefinition,$.PAREN_R)},e.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:B.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken($.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken($.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($.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($.BRACE_L,this.parseSelection,$.BRACE_R),loc:this.loc(r)}},e.parseSelection=function(){return this.peek($.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var r=this._lexer.token,n=this.parseName(),a,s;return this.expectOptionalToken($.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($.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},e.parseArguments=function(r){var n=r?this.parseConstArgument:this.parseArgument;return this.optionalMany($.PAREN_L,n,$.PAREN_R)},e.parseArgument=function(){var r=this._lexer.token,n=this.parseName();return this.expectToken($.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($.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},e.parseFragment=function(){var r=this._lexer.token;this.expectToken($.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek($.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 $.BRACKET_L:return this.parseList(r);case $.BRACE_L:return this.parseObject(r);case $.INT:return this._lexer.advance(),{kind:B.INT,value:n.value,loc:this.loc(n)};case $.FLOAT:return this._lexer.advance(),{kind:B.FLOAT,value:n.value,loc:this.loc(n)};case $.STRING:case $.BLOCK_STRING:return this.parseStringLiteral();case $.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 $.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===$.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($.BRACKET_L,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($.BRACE_L,s,$.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(r){var n=this._lexer.token,a=this.parseName();return this.expectToken($.COLON),{kind:B.OBJECT_FIELD,name:a,value:this.parseValueLiteral(r),loc:this.loc(n)}},e.parseDirectives=function(r){for(var n=[];this.peek($.AT);)n.push(this.parseDirective(r));return n},e.parseDirective=function(r){var n=this._lexer.token;return this.expectToken($.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($.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken($.BRACKET_R),n={kind:B.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken($.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===$.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($.STRING)||this.peek($.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($.BRACE_L,this.parseOperationTypeDefinition,$.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($.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($.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken($.AMP)||this.peek($.NAME));return n}return this.delimitedMany($.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek($.BRACE_L)&&this._lexer.lookahead().kind===$.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany($.BRACE_L,this.parseFieldDefinition,$.BRACE_R)},e.parseFieldDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseArgumentDefs();this.expectToken($.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($.PAREN_L,this.parseInputValueDef,$.PAREN_R)},e.parseInputValueDef=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken($.COLON);var s=this.parseTypeReference(),o;this.expectOptionalToken($.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($.EQUALS)?this.delimitedMany($.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($.BRACE_L,this.parseEnumValueDefinition,$.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($.BRACE_L,this.parseInputValueDef,$.BRACE_R)},e.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===$.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($.BRACE_L,this.parseOperationTypeDefinition,$.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($.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($.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var r=this._lexer.token,n=this.parseName();if(cd[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 _l(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 Xe(this._lexer.source,n.start,"Expected ".concat($l(r),", found ").concat(Ss(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===$.NAME&&n.value===r)this._lexer.advance();else throw Xe(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(Ss(n),"."))},e.expectOptionalKeyword=function(r){var n=this._lexer.token;return n.kind===$.NAME&&n.value===r?(this._lexer.advance(),!0):!1},e.unexpected=function(r){var n=r??this._lexer.token;return Xe(this._lexer.source,n.start,"Unexpected ".concat(Ss(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 Ss(i){var e=i.value;return $l(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function $l(i){return pd(i)?'"'.concat(i,'"'):i}var da=new Map,Bs=new Map,Al=!0,Ea=!1;function kl(i){return i.replace(/[\s,]+/g," ").trim()}function xd(i){return kl(i.source.body.substring(i.start,i.end))}function $d(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=xd(r.loc),s=Bs.get(n);s&&!s.has(a)?Al&&console.warn("Warning: fragment with name "+n+` already exists.
430
+ `+Rl(i.source,o)}return e}function it(i,e,t){return new hd("Syntax Error: ".concat(t),void 0,i,[e])}var z=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 md(i,e){var t=Boolean(i);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var yd=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Qs=yd;function Dl(i){var e=i.prototype.toJSON;typeof e=="function"||md(0),i.prototype.inspect=e,Qs&&(i.prototype[Qs]=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}();Dl(Ul);var ve=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}();Dl(ve);var $=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 ma(i){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ma=function(t){return typeof t}:ma=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ma(i)}var vd=10,Ml=2;function bd(i){return Ja(i,[])}function Ja(i,e){switch(ma(i)){case"string":return JSON.stringify(i);case"function":return i.name?"[function ".concat(i.name,"]"):"[function]";case"object":return i===null?"null":wd(i,e);default:return String(i)}}function wd(i,e){if(e.indexOf(i)!==-1)return"[Circular]";var t=[].concat(e,[i]),r=xd(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 _d(i,t);return Sd(i,t)}function Sd(i,e){var t=Object.keys(i);if(t.length===0)return"{}";if(e.length>Ml)return"["+Ed(i)+"]";var r=t.map(function(n){var a=Ja(i[n],e);return n+": "+a});return"{ "+r.join(", ")+" }"}function _d(i,e){if(i.length===0)return"[]";if(e.length>Ml)return"[Array]";for(var t=Math.min(vd,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 xd(i){var e=i[String(Qs)];if(typeof e=="function")return e;if(typeof i.inspect=="function")return i.inspect}function Ed(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 ks(i,e){var t=Boolean(i);if(!t)throw new Error(e)}var $d=function(e,t){return e instanceof t};function fc(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 Ad(i,e,t){return e&&fc(i.prototype,e),t&&fc(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"||ks(0,"Body must be a string. Received: ".concat(bd(e),".")),this.body=e,this.name=t,this.locationOffset=r,this.locationOffset.line>0||ks(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ks(0,"column in locationOffset is 1-indexed and must be positive.")}return Ad(i,[{key:Pl,get:function(){return"Source"}}]),i}();function kd(i){return $d(i,Fl)}var Id=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 Td(i){var e=i.split(/\r\n|[\n\r]/g),t=Cd(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&&hc(e[n]);)++n;for(var a=e.length;a>n&&hc(e[a-1]);)--a;return e.slice(n,a).join(`
431
+ `)}function hc(i){for(var e=0;e<i.length;++e)if(i[e]!==" "&&i[e]!==" ")return!1;return!0}function Cd(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 Ld=function(){function i(t){var r=new ve($.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!==$.EOF)do{var n;r=(n=r.next)!==null&&n!==void 0?n:r.next=Rd(this,r)}while(r.kind===$.COMMENT);return r},i}();function Pd(i){return i===$.BANG||i===$.DOLLAR||i===$.AMP||i===$.PAREN_L||i===$.PAREN_R||i===$.SPREAD||i===$.COLON||i===$.EQUALS||i===$.AT||i===$.BRACKET_L||i===$.BRACKET_R||i===$.BRACE_L||i===$.PIPE||i===$.BRACE_R}function Mi(i){return isNaN(i)?$.EOF:i<127?JSON.stringify(String.fromCharCode(i)):'"\\u'.concat(("00"+i.toString(16).toUpperCase()).slice(-4),'"')}function Rd(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 ve($.BANG,a,a+1,o,l,e);case 35:return Od(t,a,o,l,e);case 36:return new ve($.DOLLAR,a,a+1,o,l,e);case 38:return new ve($.AMP,a,a+1,o,l,e);case 40:return new ve($.PAREN_L,a,a+1,o,l,e);case 41:return new ve($.PAREN_R,a,a+1,o,l,e);case 46:if(r.charCodeAt(a+1)===46&&r.charCodeAt(a+2)===46)return new ve($.SPREAD,a,a+3,o,l,e);break;case 58:return new ve($.COLON,a,a+1,o,l,e);case 61:return new ve($.EQUALS,a,a+1,o,l,e);case 64:return new ve($.AT,a,a+1,o,l,e);case 91:return new ve($.BRACKET_L,a,a+1,o,l,e);case 93:return new ve($.BRACKET_R,a,a+1,o,l,e);case 123:return new ve($.BRACE_L,a,a+1,o,l,e);case 124:return new ve($.PIPE,a,a+1,o,l,e);case 125:return new ve($.BRACE_R,a,a+1,o,l,e);case 34:return r.charCodeAt(a+1)===34&&r.charCodeAt(a+2)===34?Md(t,a,o,l,e,i):Ud(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 Dd(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 jd(t,a,o,l,e)}throw it(t,a,Nd(s))}var c=i.line,u=1+a-i.lineStart;return new ve($.EOF,n,n,c,u,e)}function Nd(i){return i<32&&i!==9&&i!==10&&i!==13?"Cannot contain the invalid character ".concat(Mi(i),"."):i===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Mi(i),".")}function Od(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 ve($.COMMENT,e,o,t,r,n,a.slice(e+1,o))}function Dd(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 it(i,l,"Invalid number, unexpected digit after 0: ".concat(Mi(o),"."))}else l=Is(i,l,o),o=s.charCodeAt(l);if(o===46&&(c=!0,o=s.charCodeAt(++l),l=Is(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=Is(i,l,o),o=s.charCodeAt(l)),o===46||Bd(o))throw it(i,l,"Invalid number, expected digit but got: ".concat(Mi(o),"."));return new ve(c?$.FLOAT:$.INT,e,l,r,n,a,s.slice(e,l))}function Is(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 it(i,n,"Invalid number, expected digit but got: ".concat(Mi(a),"."))}function Ud(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 ve($.STRING,e,s+1,t,r,n,c);if(l<32&&l!==9)throw it(i,s,"Invalid character within String: ".concat(Mi(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+=`
432
+ `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var u=Fd(a.charCodeAt(s+1),a.charCodeAt(s+2),a.charCodeAt(s+3),a.charCodeAt(s+4));if(u<0){var m=a.slice(s+1,s+5);throw it(i,s,"Invalid character escape sequence: \\u".concat(m,"."))}c+=String.fromCharCode(u),s+=4;break}default:throw it(i,s,"Invalid character escape sequence: \\".concat(String.fromCharCode(l),"."))}++s,o=s}}throw it(i,s,"Unterminated string.")}function Md(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 ve($.BLOCK_STRING,e,o+3,t,r,n,Td(u));if(c<32&&c!==9&&c!==10&&c!==13)throw it(i,o,"Invalid character within String: ".concat(Mi(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 it(i,o,"Unterminated string.")}function Fd(i,e,t,r){return Yn(i)<<12|Yn(e)<<8|Yn(t)<<4|Yn(r)}function Yn(i){return i>=48&&i<=57?i-48:i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:-1}function jd(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 ve($.NAME,e,o,t,r,n,a.slice(e,o))}function Bd(i){return i===95||i>=65&&i<=90||i>=97&&i<=122}function qd(i,e){var t=new Hd(i,e);return t.parseDocument()}var Hd=function(){function i(t,r){var n=kd(t)?t:new Fl(t);this._lexer=new Ld(n),this._options=r}var e=i.prototype;return e.parseName=function(){var r=this.expectToken($.NAME);return{kind:z.NAME,value:r.value,loc:this.loc(r)}},e.parseDocument=function(){var r=this._lexer.token;return{kind:z.DOCUMENT,definitions:this.many($.SOF,this.parseDefinition,$.EOF),loc:this.loc(r)}},e.parseDefinition=function(){if(this.peek($.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($.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($.BRACE_L))return{kind:z.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(r)};var n=this.parseOperationType(),a;return this.peek($.NAME)&&(a=this.parseName()),{kind:z.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($.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($.PAREN_L,this.parseVariableDefinition,$.PAREN_R)},e.parseVariableDefinition=function(){var r=this._lexer.token;return{kind:z.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken($.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken($.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($.DOLLAR),{kind:z.VARIABLE,name:this.parseName(),loc:this.loc(r)}},e.parseSelectionSet=function(){var r=this._lexer.token;return{kind:z.SELECTION_SET,selections:this.many($.BRACE_L,this.parseSelection,$.BRACE_R),loc:this.loc(r)}},e.parseSelection=function(){return this.peek($.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var r=this._lexer.token,n=this.parseName(),a,s;return this.expectOptionalToken($.COLON)?(a=n,s=this.parseName()):s=n,{kind:z.FIELD,alias:a,name:s,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek($.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(r)}},e.parseArguments=function(r){var n=r?this.parseConstArgument:this.parseArgument;return this.optionalMany($.PAREN_L,n,$.PAREN_R)},e.parseArgument=function(){var r=this._lexer.token,n=this.parseName();return this.expectToken($.COLON),{kind:z.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(r)}},e.parseConstArgument=function(){var r=this._lexer.token;return{kind:z.ARGUMENT,name:this.parseName(),value:(this.expectToken($.COLON),this.parseValueLiteral(!0)),loc:this.loc(r)}},e.parseFragment=function(){var r=this._lexer.token;this.expectToken($.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek($.NAME)?{kind:z.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(r)}:{kind:z.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:z.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:z.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 $.BRACKET_L:return this.parseList(r);case $.BRACE_L:return this.parseObject(r);case $.INT:return this._lexer.advance(),{kind:z.INT,value:n.value,loc:this.loc(n)};case $.FLOAT:return this._lexer.advance(),{kind:z.FLOAT,value:n.value,loc:this.loc(n)};case $.STRING:case $.BLOCK_STRING:return this.parseStringLiteral();case $.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:z.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:z.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:z.NULL,loc:this.loc(n)};default:return{kind:z.ENUM,value:n.value,loc:this.loc(n)}}case $.DOLLAR:if(!r)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var r=this._lexer.token;return this._lexer.advance(),{kind:z.STRING,value:r.value,block:r.kind===$.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:z.LIST,values:this.any($.BRACKET_L,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:z.OBJECT,fields:this.any($.BRACE_L,s,$.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(r){var n=this._lexer.token,a=this.parseName();return this.expectToken($.COLON),{kind:z.OBJECT_FIELD,name:a,value:this.parseValueLiteral(r),loc:this.loc(n)}},e.parseDirectives=function(r){for(var n=[];this.peek($.AT);)n.push(this.parseDirective(r));return n},e.parseDirective=function(r){var n=this._lexer.token;return this.expectToken($.AT),{kind:z.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(r),loc:this.loc(n)}},e.parseTypeReference=function(){var r=this._lexer.token,n;return this.expectOptionalToken($.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken($.BRACKET_R),n={kind:z.LIST_TYPE,type:n,loc:this.loc(r)}):n=this.parseNamedType(),this.expectOptionalToken($.BANG)?{kind:z.NON_NULL_TYPE,type:n,loc:this.loc(r)}:n},e.parseNamedType=function(){var r=this._lexer.token;return{kind:z.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===$.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($.STRING)||this.peek($.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($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);return{kind:z.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($.COLON);var a=this.parseNamedType();return{kind:z.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:z.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:z.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($.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken($.AMP)||this.peek($.NAME));return n}return this.delimitedMany($.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var r;return((r=this._options)===null||r===void 0?void 0:r.allowLegacySDLEmptyFields)===!0&&this.peek($.BRACE_L)&&this._lexer.lookahead().kind===$.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany($.BRACE_L,this.parseFieldDefinition,$.BRACE_R)},e.parseFieldDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseArgumentDefs();this.expectToken($.COLON);var o=this.parseTypeReference(),l=this.parseDirectives(!0);return{kind:z.FIELD_DEFINITION,description:n,name:a,arguments:s,type:o,directives:l,loc:this.loc(r)}},e.parseArgumentDefs=function(){return this.optionalMany($.PAREN_L,this.parseInputValueDef,$.PAREN_R)},e.parseInputValueDef=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken($.COLON);var s=this.parseTypeReference(),o;this.expectOptionalToken($.EQUALS)&&(o=this.parseValueLiteral(!0));var l=this.parseDirectives(!0);return{kind:z.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:z.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:z.UNION_TYPE_DEFINITION,description:n,name:a,directives:s,types:o,loc:this.loc(r)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken($.EQUALS)?this.delimitedMany($.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:z.ENUM_TYPE_DEFINITION,description:n,name:a,directives:s,values:o,loc:this.loc(r)}},e.parseEnumValuesDefinition=function(){return this.optionalMany($.BRACE_L,this.parseEnumValueDefinition,$.BRACE_R)},e.parseEnumValueDefinition=function(){var r=this._lexer.token,n=this.parseDescription(),a=this.parseName(),s=this.parseDirectives(!0);return{kind:z.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:z.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:s,fields:o,loc:this.loc(r)}},e.parseInputFieldsDefinition=function(){return this.optionalMany($.BRACE_L,this.parseInputValueDef,$.BRACE_R)},e.parseTypeSystemExtension=function(){var r=this._lexer.lookahead();if(r.kind===$.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($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:z.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:z.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:z.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:z.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:z.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:z.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:z.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($.AT);var a=this.parseName(),s=this.parseArgumentDefs(),o=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var l=this.parseDirectiveLocations();return{kind:z.DIRECTIVE_DEFINITION,description:n,name:a,arguments:s,repeatable:o,locations:l,loc:this.loc(r)}},e.parseDirectiveLocations=function(){return this.delimitedMany($.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var r=this._lexer.token,n=this.parseName();if(Id[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 it(this._lexer.source,n.start,"Expected ".concat(jl(r),", found ").concat(Ts(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===$.NAME&&n.value===r)this._lexer.advance();else throw it(this._lexer.source,n.start,'Expected "'.concat(r,'", found ').concat(Ts(n),"."))},e.expectOptionalKeyword=function(r){var n=this._lexer.token;return n.kind===$.NAME&&n.value===r?(this._lexer.advance(),!0):!1},e.unexpected=function(r){var n=r??this._lexer.token;return it(this._lexer.source,n.start,"Unexpected ".concat(Ts(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 Ts(i){var e=i.value;return jl(i.kind)+(e!=null?' "'.concat(e,'"'):"")}function jl(i){return Pd(i)?'"'.concat(i,'"'):i}var ya=new Map,Gs=new Map,Bl=!0,Ta=!1;function ql(i){return i.replace(/[\s,]+/g," ").trim()}function zd(i){return ql(i.source.body.substring(i.start,i.end))}function Vd(i){var e=new Set,t=[];return i.definitions.forEach(function(r){if(r.kind==="FragmentDefinition"){var n=r.name.value,a=zd(r.loc),s=Gs.get(n);s&&!s.has(a)?Bl&&console.warn("Warning: fragment with name "+n+` already exists.
439
433
  graphql-tag enforces all fragment names across your application to be unique; read more about
440
- this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Bs.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),_a(_a({},i),{definitions:t})}function Ad(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 kd(i){var e=kl(i);if(!da.has(e)){var t=_d(i,{experimentalFragmentVariables:Ea,allowLegacyFragmentVariables:Ea});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");da.set(e,Ad($d(t)))}return da.get(e)}function v(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]}),kd(r)}function Id(){da.clear(),Bs.clear()}function Td(){Al=!1}function Cd(){Ea=!0}function Ld(){Ea=!1}var Fr={gql:v,resetCaches:Id,disableFragmentWarnings:Td,enableExperimentalFragmentVariables:Cd,disableExperimentalFragmentVariables:Ld};(function(i){i.gql=Fr.gql,i.resetCaches=Fr.resetCaches,i.disableFragmentWarnings=Fr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=Fr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=Fr.disableExperimentalFragmentVariables})(v||(v={}));v.default=v;function w(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 Nd(){}function oi(){return Nd}var q=oi,h=oi,Ae=oi,te=oi,F=oi,Ge=oi,Rd=oi,po=oi,Il=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},Tl=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ri=class{constructor(e){this.code=e}};Il([h(),Tl("design:type",String)],Ri.prototype,"code",void 0);Ri=Il([F(),Tl("design:paramtypes",[String])],Ri);var fo=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},ho=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Et=class{constructor(e,t){this.address=e,this.name=t}};fo([h(),ho("design:type",String)],Et.prototype,"address",void 0);fo([h(),ho("design:type",String)],Et.prototype,"name",void 0);Et=fo([F(),ho("design:paramtypes",[String,String])],Et);var pe=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)},Ut=class{constructor(e,t){this.key=t,this.signature=e}};pe([h(),we("design:type",String)],Ut.prototype,"signature",void 0);pe([h(),we("design:type",String)],Ut.prototype,"key",void 0);pe([h(),we("design:type",Boolean)],Ut.prototype,"valid",void 0);pe([h(),we("design:type",Boolean)],Ut.prototype,"invalid",void 0);Ut=pe([F(),Ae(),we("design:paramtypes",[String,String])],Ut);var Pi=class{};pe([h(),we("design:type",String)],Pi.prototype,"signature",void 0);pe([h(),we("design:type",String)],Pi.prototype,"key",void 0);pe([h(),we("design:type",Boolean)],Pi.prototype,"valid",void 0);pe([h(),we("design:type",Boolean)],Pi.prototype,"invalid",void 0);Pi=pe([Ae()],Pi);function ci(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return pe([h(),we("design:type",String)],e.prototype,"author",void 0),pe([h(),we("design:type",String)],e.prototype,"timestamp",void 0),pe([h(),we("design:type",Object)],e.prototype,"data",void 0),pe([h(),we("design:type",Ut)],e.prototype,"proof",void 0),e=pe([F(),we("design:paramtypes",[String,String,Object,Ut])],e),e}function Pd(i){let e=class{};return pe([h(),we("design:type",String)],e.prototype,"author",void 0),pe([h(),we("design:type",String)],e.prototype,"timestamp",void 0),pe([h(),we("design:type",Object)],e.prototype,"data",void 0),pe([h(),we("design:type",Pi)],e.prototype,"proof",void 0),e=pe([Ae()],e),e}var ec=class extends ci(){};ec=pe([F()],ec);var xa=class extends ci(){};pe([h(),we("design:type",Et)],xa.prototype,"language",void 0);pe([h(),we("design:type",Ri)],xa.prototype,"icon",void 0);xa=pe([F()],xa);function gy(i){return i&&i.author&&i.timestamp&&i.data}var ye=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},Ce=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ke=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};ye([h(),Ce("design:type",String)],Ke.prototype,"source",void 0);ye([h(),Ce("design:type",String)],Ke.prototype,"target",void 0);ye([h(),Ce("design:type",String)],Ke.prototype,"predicate",void 0);Ke=ye([F(),Ce("design:paramtypes",[Object])],Ke);var $a=class{};ye([h(),Ce("design:type",Array)],$a.prototype,"additions",void 0);ye([h(),Ce("design:type",Array)],$a.prototype,"removals",void 0);$a=ye([Ae()],$a);var Aa=class{constructor(e,t){this.additions=e,this.removals=t}};ye([h(),Ce("design:type",Array)],Aa.prototype,"additions",void 0);ye([h(),Ce("design:type",Array)],Aa.prototype,"removals",void 0);Aa=ye([F(),Ce("design:paramtypes",[Array,Array])],Aa);var yn=class{};ye([h(),Ce("design:type",String)],yn.prototype,"source",void 0);ye([h(),Ce("design:type",String)],yn.prototype,"target",void 0);ye([h(),Ce("design:type",String)],yn.prototype,"predicate",void 0);yn=ye([Ae()],yn);var ti=class extends ci(){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}};ye([h(),Ce("design:type",String)],ti.prototype,"status",void 0);ti=ye([F()],ti);var qs=class extends Pd(){};ye([h(),Ce("design:type",String)],qs.prototype,"status",void 0);qs=ye([Ae()],qs);function _y(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 Ey(i){return i&&i.source&&i.target}var ka=class{constructor(e,t){this.oldLink=e,this.newLink=t}};ye([h(),Ce("design:type",ti)],ka.prototype,"oldLink",void 0);ye([h(),Ce("design:type",ti)],ka.prototype,"newLink",void 0);ka=ye([F(),Ce("design:paramtypes",[ti,ti])],ka);var zi=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},Tn=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Hs,kt=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}};zi([h(),Tn("design:type",Array)],kt.prototype,"links",void 0);kt=zi([F(),Tn("design:paramtypes",[Array])],kt);var Ia=class{};zi([h(),Tn("design:type",Array)],Ia.prototype,"links",void 0);Ia=zi([Ae()],Ia);var Vs=Hs=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Hs;return t.links.push(e),t}};zi([h(),Tn("design:type",Array)],Vs.prototype,"links",void 0);Vs=Hs=zi([Ae(),Tn("design:paramtypes",[Array])],Vs);var Oi=class extends ci(){};Oi=zi([F()],Oi);var P=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},O=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Zt=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new kt}};P([h(),O("design:type",String)],Zt.prototype,"did",void 0);P([h(),O("design:type",kt)],Zt.prototype,"perspective",void 0);P([h(),O("design:type",String)],Zt.prototype,"directMessageLanguage",void 0);Zt=P([F(),O("design:paramtypes",[String,kt])],Zt);var tc=class extends ci(){};tc=P([F()],tc);var ii=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}};P([h(),O("design:type",String)],ii.prototype,"did",void 0);P([h(),O("design:type",String)],ii.prototype,"didSigningKeyId",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKeyType",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKey",void 0);P([h(),O("design:type",String)],ii.prototype,"deviceKeySignedByDid",void 0);P([h(),O("design:type",String)],ii.prototype,"didSignedByDeviceKey",void 0);ii=P([F(),O("design:paramtypes",[String,String,String,String,String,String])],ii);var ri=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}};P([h(),O("design:type",String)],ri.prototype,"did",void 0);P([h(),O("design:type",String)],ri.prototype,"didSigningKeyId",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKeyType",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKey",void 0);P([h(),O("design:type",String)],ri.prototype,"deviceKeySignedByDid",void 0);P([h(),O("design:type",String)],ri.prototype,"didSignedByDeviceKey",void 0);ri=P([Ae(),O("design:paramtypes",[String,String,String,String,String,String])],ri);var Ta=class{constructor(e,t){this.signature=e,this.publicKey=t}};P([h(),O("design:type",String)],Ta.prototype,"signature",void 0);P([h(),O("design:type",String)],Ta.prototype,"publicKey",void 0);Ta=P([F(),O("design:paramtypes",[String,String])],Ta);var gr=class{constructor(e,t){this.domain=e,this.pointers=t}};P([h(),O("design:type",String)],gr.prototype,"domain",void 0);P([h(),O("design:type",Array)],gr.prototype,"pointers",void 0);gr=P([F(),O("design:paramtypes",[String,Array])],gr);var Ca=class{constructor(e,t){this.with=e,this.can=t}};P([h(),O("design:type",gr)],Ca.prototype,"with",void 0);P([h(),O("design:type",Array)],Ca.prototype,"can",void 0);Ca=P([F(),O("design:paramtypes",[gr,Array])],Ca);var Ft=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};P([h(),O("design:type",String)],Ft.prototype,"appName",void 0);P([h(),O("design:type",String)],Ft.prototype,"appDesc",void 0);P([h(),O("design:type",String)],Ft.prototype,"appUrl",void 0);P([h(),O("design:type",String)],Ft.prototype,"appIconPath",void 0);P([h(),O("design:type",Array)],Ft.prototype,"capabilities",void 0);Ft=P([F(),O("design:paramtypes",[String,String,String,Array,String])],Ft);var mr=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};P([h(),O("design:type",String)],mr.prototype,"requestId",void 0);P([h(),O("design:type",String)],mr.prototype,"token",void 0);P([h(),O("design:type",Boolean)],mr.prototype,"revoked",void 0);P([h(),O("design:type",Ft)],mr.prototype,"auth",void 0);mr=P([F(),O("design:paramtypes",[String,Ft,String,Boolean])],mr);var yr=class{constructor(e,t){this.domain=e,this.pointers=t}};P([h(),O("design:type",String)],yr.prototype,"domain",void 0);P([h(),O("design:type",Array)],yr.prototype,"pointers",void 0);yr=P([Ae(),O("design:paramtypes",[String,Array])],yr);var La=class{constructor(e,t){this.with=e,this.can=t}};P([h(),O("design:type",yr)],La.prototype,"with",void 0);P([h(),O("design:type",Array)],La.prototype,"can",void 0);La=P([Ae(),O("design:paramtypes",[yr,Array])],La);var It=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}};P([h(),O("design:type",String)],It.prototype,"appName",void 0);P([h(),O("design:type",String)],It.prototype,"appDesc",void 0);P([h(),O("design:type",String)],It.prototype,"appDomain",void 0);P([h(),O("design:type",String)],It.prototype,"appUrl",void 0);P([h(),O("design:type",String)],It.prototype,"appIconPath",void 0);P([h(),O("design:type",Array)],It.prototype,"capabilities",void 0);It=P([Ae(),O("design:paramtypes",[String,String,String,String,String,Array])],It);var Di=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};P([h(),O("design:type",String)],Di.prototype,"did",void 0);P([h(),O("design:type",Boolean)],Di.prototype,"success",void 0);P([h(),O("design:type",String)],Di.prototype,"error",void 0);Di=P([F(),O("design:paramtypes",[String,Boolean,String])],Di);var kr=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},Ir=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ot=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)}};kr([h(),Ir("design:type",Boolean)],ot.prototype,"isInitialized",void 0);kr([h(),Ir("design:type",Boolean)],ot.prototype,"isUnlocked",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"did",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"didDocument",void 0);kr([h(),Ir("design:type",String)],ot.prototype,"error",void 0);ot=kr([F(),Ir("design:paramtypes",[Object])],ot);var ic=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},he=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,zs=class{constructor(e,t){Ve.set(this,void 0),ze.set(this,void 0),ic(this,Ve,e,"f"),ic(this,ze,t,"f")}async otherAgents(){return await he(this,Ve,"f").otherAgents(he(this,ze,"f"))}async hasTelepresenceAdapter(){return await he(this,Ve,"f").hasTelepresenceAdapter(he(this,ze,"f"))}async onlineAgents(){return await he(this,Ve,"f").onlineAgents(he(this,ze,"f"))}async setOnlineStatus(e){return await he(this,Ve,"f").setOnlineStatus(he(this,ze,"f"),e)}async setOnlineStatusU(e){return await he(this,Ve,"f").setOnlineStatusU(he(this,ze,"f"),e)}async sendSignal(e,t){return await he(this,Ve,"f").sendSignal(he(this,ze,"f"),e,t)}async sendSignalU(e,t){return await he(this,Ve,"f").sendSignalU(he(this,ze,"f"),e,t)}async sendBroadcast(e,t=!1){return await he(this,Ve,"f").sendBroadcast(he(this,ze,"f"),e,t)}async sendBroadcastU(e,t=!1){return await he(this,Ve,"f").sendBroadcastU(he(this,ze,"f"),e,t)}async addSignalHandler(e){await he(this,Ve,"f").addSignalHandler(he(this,ze,"f"),e)}removeSignalHandler(e){he(this,Ve,"f").removeSignalHandler(he(this,ze,"f"),e)}};Ve=new WeakMap,ze=new WeakMap;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},Ki=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},re=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)}};Wi([h(),Ki("design:type",String)],re.prototype,"source",void 0);Wi([h(),Ki("design:type",String)],re.prototype,"target",void 0);Wi([h(),Ki("design:type",String)],re.prototype,"predicate",void 0);Wi([h(),Ki("design:type",Date)],re.prototype,"fromDate",void 0);Wi([h(),Ki("design:type",Date)],re.prototype,"untilDate",void 0);Wi([h(),Ki("design:type",Number)],re.prototype,"limit",void 0);re=Wi([F(),Ae(),Ki("design:paramtypes",[Object])],re);var rc=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)},We,Rt;function Kn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var oe=class{constructor(){We.set(this,void 0),Rt.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 oe;return rc(t,Rt,e,"f"),t}static from(e){let t=new oe;return rc(t,We,e,"f"),t}toUrl(){if(Ie(this,Rt,"f")&&!Ie(this,We,"f"))return Ie(this,Rt,"f");if(!Ie(this,Rt,"f")&&(Ie(this,We,"f")===void 0||Ie(this,We,"f")===""||Ie(this,We,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ie(this,We,"f")){case"string":e=`string:${Kn(Ie(this,We,"f"))}`;break;case"number":e=`number:${Kn(Ie(this,We,"f"))}`;break;case"boolean":e=`boolean:${Kn(Ie(this,We,"f"))}`;break;case"object":e=`json:${Kn(JSON.stringify(Ie(this,We,"f")))}`;break}return`literal://${e}`}get(){if(Ie(this,We,"f"))return Ie(this,We,"f");if(!Ie(this,Rt,"f"))throw new Error("Can't render empty Literal");if(!Ie(this,Rt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ie(this,Rt,"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}`)}};We=new WeakMap,Rt=new WeakMap;function Be(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Wa(i){return`set${Be(i)}`}function Cl(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function Od(i){return`add${Be(Cl(i))}`}function Dd(i){return`remove${Be(Cl(i))}`}function Md(i){return`set${Be(i)}`}function Ll(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 vi(i){if(Array.isArray(i))return`[${i.map(vi).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 _s=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)},Me,Ue,ge,un=class{constructor(i,e,t){Me.set(this,void 0),Ue.set(this,void 0),ge.set(this,void 0),_s(this,Me,e,"f"),_s(this,Ue,t,"f"),_s(this,ge,i,"f")}get baseExpression(){return K(this,Me,"f")}async init(){let isInstance=await K(this,ge,"f").isSubjectInstance(K(this,Me,"f"),K(this,Ue,"f"));if(!isInstance)throw`Not a valid subject instance of ${K(this,Ue,"f")} for ${K(this,Me,"f")}`;let results=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), property(C, Property)`),properties=results.map(i=>i.Property);for(let i of properties)await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ge,"f").getPropertyValueViaSurreal(K(this,Me,"f"),K(this,Ue,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"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,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Wa(property)]=async i=>{resolveLanguage&&(i=await K(this,ge,"f").createExpression(i,resolveLanguage)),await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let results2=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(i=>i.Collection);for(let i of relations)Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ge,"f").getRelationValuesViaSurreal(K(this,Me,"f"),K(this,Ue,"f"),i)}catch(e){return console.warn(`Failed to get relation ${i} via SurrealDB:`,e),[]}}});let adders=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[Od(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:e}]))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let removers=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[Dd(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:e}]))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}let relationSetters=await K(this,ge,"f").infer(`subject_class("${K(this,Ue,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[Md(relation)]=async i=>{Array.isArray(i)?await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),i.map(e=>({name:"value",value:e}))):await K(this,ge,"f").executeAction(actions,K(this,Me,"f"),[{name:"value",value:i}])}}}};Me=new WeakMap,Ue=new WeakMap,ge=new WeakMap;function Ud(i,e,t,r){let n="",a=Ll(8);n+=`subject_class("${i}", ${a}).
441
- `;let s=[],o=[];e.subjectConstructor&&e.subjectConstructor.length&&(o=o.concat(e.subjectConstructor));let l=[];e.isSubjectInstance&&e.isSubjectInstance.length&&(l=l.concat(e.isSubjectInstance));let c=[];for(let d in t){let p=`property(${a}, "${d}").
442
- `,{through:f,initial:S,required:E,resolveLanguage:A,writable:k,flag:b,prologGetter:T,prologSetter:R,local:C}=t[d];if(A&&(p+=`property_resolve(${a}, "${d}").
443
- `,p+=`property_resolve_language(${a}, "${d}", "${A}").
444
- `),T?p+=`property_getter(${a}, Base, "${d}", Value) :- ${T}.
445
- `:f&&(p+=`property_getter(${a}, Base, "${d}", Value) :- triple(Base, "${f}", Value).
446
- `,E&&(b?l.push(`triple(Base, "${f}", "${S}")`):l.push(`triple(Base, "${f}", _)`))),R)p+=`property_setter(${a}, "${d}", Actions) :- ${R}.
447
- `;else if(k&&f&&typeof e[Wa(d)]=="function"){let L=[{action:"setSingleTarget",source:"this",predicate:f,target:"value",...C&&{local:!0}}];p+=`property_setter(${a}, "${d}", '${vi(L)}').
448
- `}c.push(p);let Q=S??(E&&k&&!b&&f?"literal://string:":void 0);Q&&(o.push({action:"addLink",source:"this",predicate:f,target:Q}),s.push({action:"removeLink",source:"this",predicate:f,target:"*"}))}let u=[],m=Object.fromEntries(Object.entries(r).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany"));for(let d in m){let p=`collection(${a}, "${d}").
449
- `,{predicate:f,local:S}=m[d];if(f){p+=`collection_getter(${a}, Base, "${d}", List) :- findall(C, triple(Base, "${f}", C), List).
450
- `;let E=[{action:"addLink",source:"this",predicate:f,target:"value",...S&&{local:!0}}],A=[{action:"removeLink",source:"this",predicate:f,target:"value"}],k=[{action:"collectionSetter",source:"this",predicate:f,target:"value",...S&&{local:!0}}];p+=`collection_adder(${a}, "${d}", '${vi(E)}').
451
- `,p+=`collection_remover(${a}, "${d}", '${vi(A)}').
452
- `,p+=`collection_setter(${a}, "${d}", '${vi(k)}').
453
- `}u.push(p)}let y=vi(o);if(n+=`constructor(${a}, '${y}').
434
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s||Gs.set(n,s=new Set),s.add(a),e.has(a)||(e.add(a),t.push(r))}else t.push(r)}),Ia(Ia({},i),{definitions:t})}function Wd(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 Kd(i){var e=ql(i);if(!ya.has(e)){var t=qd(i,{experimentalFragmentVariables:Ta,allowLegacyFragmentVariables:Ta});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");ya.set(e,Wd(Vd(t)))}return ya.get(e)}function v(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]}),Kd(r)}function Qd(){ya.clear(),Gs.clear()}function Gd(){Bl=!1}function Zd(){Ta=!0}function Jd(){Ta=!1}var zr={gql:v,resetCaches:Qd,disableFragmentWarnings:Gd,enableExperimentalFragmentVariables:Zd,disableExperimentalFragmentVariables:Jd};(function(i){i.gql=zr.gql,i.resetCaches=zr.resetCaches,i.disableFragmentWarnings=zr.disableFragmentWarnings,i.enableExperimentalFragmentVariables=zr.enableExperimentalFragmentVariables,i.disableExperimentalFragmentVariables=zr.disableExperimentalFragmentVariables})(v||(v={}));v.default=v;function b(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 Yd(){}function fi(){return Yd}var F=fi,h=fi,Te=fi,J=fi,H=fi,Ce=fi,Xd=fi,wo=fi,Hl=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},zl=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fi=class{constructor(e){this.code=e}};Hl([h(),zl("design:type",String)],Fi.prototype,"code",void 0);Fi=Hl([H(),zl("design:paramtypes",[String])],Fi);var So=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},_o=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},It=class{constructor(e,t){this.address=e,this.name=t}};So([h(),_o("design:type",String)],It.prototype,"address",void 0);So([h(),_o("design:type",String)],It.prototype,"name",void 0);It=So([H(),_o("design:paramtypes",[String,String])],It);var he=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},xe=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ht=class{constructor(e,t){this.key=t,this.signature=e}};he([h(),xe("design:type",String)],Ht.prototype,"signature",void 0);he([h(),xe("design:type",String)],Ht.prototype,"key",void 0);he([h(),xe("design:type",Boolean)],Ht.prototype,"valid",void 0);he([h(),xe("design:type",Boolean)],Ht.prototype,"invalid",void 0);Ht=he([H(),Te(),xe("design:paramtypes",[String,String])],Ht);var ji=class{};he([h(),xe("design:type",String)],ji.prototype,"signature",void 0);he([h(),xe("design:type",String)],ji.prototype,"key",void 0);he([h(),xe("design:type",Boolean)],ji.prototype,"valid",void 0);he([h(),xe("design:type",Boolean)],ji.prototype,"invalid",void 0);ji=he([Te()],ji);function hi(i){let e=class{constructor(r,n,a,s){this.author=r,this.timestamp=n,this.data=a,this.proof=s}};return he([h(),xe("design:type",String)],e.prototype,"author",void 0),he([h(),xe("design:type",String)],e.prototype,"timestamp",void 0),he([h(),xe("design:type",Object)],e.prototype,"data",void 0),he([h(),xe("design:type",Ht)],e.prototype,"proof",void 0),e=he([H(),xe("design:paramtypes",[String,String,Object,Ht])],e),e}function ep(i){let e=class{};return he([h(),xe("design:type",String)],e.prototype,"author",void 0),he([h(),xe("design:type",String)],e.prototype,"timestamp",void 0),he([h(),xe("design:type",Object)],e.prototype,"data",void 0),he([h(),xe("design:type",ji)],e.prototype,"proof",void 0),e=he([Te()],e),e}var gc=class extends hi(){};gc=he([H()],gc);var Ca=class extends hi(){};he([h(),xe("design:type",It)],Ca.prototype,"language",void 0);he([h(),xe("design:type",Fi)],Ca.prototype,"icon",void 0);Ca=he([H()],Ca);function Wy(i){return i&&i.author&&i.timestamp&&i.data}var we=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},Re=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Je=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};we([h(),Re("design:type",String)],Je.prototype,"source",void 0);we([h(),Re("design:type",String)],Je.prototype,"target",void 0);we([h(),Re("design:type",String)],Je.prototype,"predicate",void 0);Je=we([H(),Re("design:paramtypes",[Object])],Je);var La=class{};we([h(),Re("design:type",Array)],La.prototype,"additions",void 0);we([h(),Re("design:type",Array)],La.prototype,"removals",void 0);La=we([Te()],La);var Pa=class{constructor(e,t){this.additions=e,this.removals=t}};we([h(),Re("design:type",Array)],Pa.prototype,"additions",void 0);we([h(),Re("design:type",Array)],Pa.prototype,"removals",void 0);Pa=we([H(),Re("design:paramtypes",[Array,Array])],Pa);var _n=class{};we([h(),Re("design:type",String)],_n.prototype,"source",void 0);we([h(),Re("design:type",String)],_n.prototype,"target",void 0);we([h(),Re("design:type",String)],_n.prototype,"predicate",void 0);_n=we([Te()],_n);var si=class extends hi(){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}};we([h(),Re("design:type",String)],si.prototype,"status",void 0);si=we([H()],si);var Zs=class extends ep(){};we([h(),Re("design:type",String)],Zs.prototype,"status",void 0);Zs=we([Te()],Zs);function Xy(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 e0(i){return i&&i.source&&i.target}var Ra=class{constructor(e,t){this.oldLink=e,this.newLink=t}};we([h(),Re("design:type",si)],Ra.prototype,"oldLink",void 0);we([h(),Re("design:type",si)],Ra.prototype,"newLink",void 0);Ra=we([H(),Re("design:paramtypes",[si,si])],Ra);var Zi=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},Nn=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Js,Pt=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}};Zi([h(),Nn("design:type",Array)],Pt.prototype,"links",void 0);Pt=Zi([H(),Nn("design:paramtypes",[Array])],Pt);var Na=class{};Zi([h(),Nn("design:type",Array)],Na.prototype,"links",void 0);Na=Zi([Te()],Na);var Ys=Js=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Js;return t.links.push(e),t}};Zi([h(),Nn("design:type",Array)],Ys.prototype,"links",void 0);Ys=Js=Zi([Te(),Nn("design:paramtypes",[Array])],Ys);var Bi=class extends hi(){};Bi=Zi([H()],Bi);var M=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},B=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ti=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new Pt}};M([h(),B("design:type",String)],ti.prototype,"did",void 0);M([h(),B("design:type",Pt)],ti.prototype,"perspective",void 0);M([h(),B("design:type",String)],ti.prototype,"directMessageLanguage",void 0);ti=M([H(),B("design:paramtypes",[String,Pt])],ti);var mc=class extends hi(){};mc=M([H()],mc);var oi=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}};M([h(),B("design:type",String)],oi.prototype,"did",void 0);M([h(),B("design:type",String)],oi.prototype,"didSigningKeyId",void 0);M([h(),B("design:type",String)],oi.prototype,"deviceKeyType",void 0);M([h(),B("design:type",String)],oi.prototype,"deviceKey",void 0);M([h(),B("design:type",String)],oi.prototype,"deviceKeySignedByDid",void 0);M([h(),B("design:type",String)],oi.prototype,"didSignedByDeviceKey",void 0);oi=M([H(),B("design:paramtypes",[String,String,String,String,String,String])],oi);var ci=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}};M([h(),B("design:type",String)],ci.prototype,"did",void 0);M([h(),B("design:type",String)],ci.prototype,"didSigningKeyId",void 0);M([h(),B("design:type",String)],ci.prototype,"deviceKeyType",void 0);M([h(),B("design:type",String)],ci.prototype,"deviceKey",void 0);M([h(),B("design:type",String)],ci.prototype,"deviceKeySignedByDid",void 0);M([h(),B("design:type",String)],ci.prototype,"didSignedByDeviceKey",void 0);ci=M([Te(),B("design:paramtypes",[String,String,String,String,String,String])],ci);var Oa=class{constructor(e,t){this.signature=e,this.publicKey=t}};M([h(),B("design:type",String)],Oa.prototype,"signature",void 0);M([h(),B("design:type",String)],Oa.prototype,"publicKey",void 0);Oa=M([H(),B("design:paramtypes",[String,String])],Oa);var vr=class{constructor(e,t){this.domain=e,this.pointers=t}};M([h(),B("design:type",String)],vr.prototype,"domain",void 0);M([h(),B("design:type",Array)],vr.prototype,"pointers",void 0);vr=M([H(),B("design:paramtypes",[String,Array])],vr);var Da=class{constructor(e,t){this.with=e,this.can=t}};M([h(),B("design:type",vr)],Da.prototype,"with",void 0);M([h(),B("design:type",Array)],Da.prototype,"can",void 0);Da=M([H(),B("design:paramtypes",[vr,Array])],Da);var zt=class{constructor(e,t,r,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=r,this.capabilities=n}};M([h(),B("design:type",String)],zt.prototype,"appName",void 0);M([h(),B("design:type",String)],zt.prototype,"appDesc",void 0);M([h(),B("design:type",String)],zt.prototype,"appUrl",void 0);M([h(),B("design:type",String)],zt.prototype,"appIconPath",void 0);M([h(),B("design:type",Array)],zt.prototype,"capabilities",void 0);zt=M([H(),B("design:paramtypes",[String,String,String,Array,String])],zt);var br=class{constructor(e,t,r,n){this.requestId=e,this.auth=t,this.token=r,this.revoked=n}};M([h(),B("design:type",String)],br.prototype,"requestId",void 0);M([h(),B("design:type",String)],br.prototype,"token",void 0);M([h(),B("design:type",Boolean)],br.prototype,"revoked",void 0);M([h(),B("design:type",zt)],br.prototype,"auth",void 0);br=M([H(),B("design:paramtypes",[String,zt,String,Boolean])],br);var wr=class{constructor(e,t){this.domain=e,this.pointers=t}};M([h(),B("design:type",String)],wr.prototype,"domain",void 0);M([h(),B("design:type",Array)],wr.prototype,"pointers",void 0);wr=M([Te(),B("design:paramtypes",[String,Array])],wr);var Ua=class{constructor(e,t){this.with=e,this.can=t}};M([h(),B("design:type",wr)],Ua.prototype,"with",void 0);M([h(),B("design:type",Array)],Ua.prototype,"can",void 0);Ua=M([Te(),B("design:paramtypes",[wr,Array])],Ua);var Rt=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}};M([h(),B("design:type",String)],Rt.prototype,"appName",void 0);M([h(),B("design:type",String)],Rt.prototype,"appDesc",void 0);M([h(),B("design:type",String)],Rt.prototype,"appDomain",void 0);M([h(),B("design:type",String)],Rt.prototype,"appUrl",void 0);M([h(),B("design:type",String)],Rt.prototype,"appIconPath",void 0);M([h(),B("design:type",Array)],Rt.prototype,"capabilities",void 0);Rt=M([Te(),B("design:paramtypes",[String,String,String,String,String,Array])],Rt);var qi=class{constructor(e,t,r){this.did=e,this.success=t,this.error=r}};M([h(),B("design:type",String)],qi.prototype,"did",void 0);M([h(),B("design:type",Boolean)],qi.prototype,"success",void 0);M([h(),B("design:type",String)],qi.prototype,"error",void 0);qi=M([H(),B("design:paramtypes",[String,Boolean,String])],qi);var Ir=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},Tr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},lt=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)}};Ir([h(),Tr("design:type",Boolean)],lt.prototype,"isInitialized",void 0);Ir([h(),Tr("design:type",Boolean)],lt.prototype,"isUnlocked",void 0);Ir([h(),Tr("design:type",String)],lt.prototype,"did",void 0);Ir([h(),Tr("design:type",String)],lt.prototype,"didDocument",void 0);Ir([h(),Tr("design:type",String)],lt.prototype,"error",void 0);lt=Ir([H(),Tr("design:paramtypes",[Object])],lt);var yc=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)},Qe,Ge,Xs=class{constructor(e,t){Qe.set(this,void 0),Ge.set(this,void 0),yc(this,Qe,e,"f"),yc(this,Ge,t,"f")}async otherAgents(){return await me(this,Qe,"f").otherAgents(me(this,Ge,"f"))}async hasTelepresenceAdapter(){return await me(this,Qe,"f").hasTelepresenceAdapter(me(this,Ge,"f"))}async onlineAgents(){return await me(this,Qe,"f").onlineAgents(me(this,Ge,"f"))}async setOnlineStatus(e){return await me(this,Qe,"f").setOnlineStatus(me(this,Ge,"f"),e)}async setOnlineStatusU(e){return await me(this,Qe,"f").setOnlineStatusU(me(this,Ge,"f"),e)}async sendSignal(e,t){return await me(this,Qe,"f").sendSignal(me(this,Ge,"f"),e,t)}async sendSignalU(e,t){return await me(this,Qe,"f").sendSignalU(me(this,Ge,"f"),e,t)}async sendBroadcast(e,t=!1){return await me(this,Qe,"f").sendBroadcast(me(this,Ge,"f"),e,t)}async sendBroadcastU(e,t=!1){return await me(this,Qe,"f").sendBroadcastU(me(this,Ge,"f"),e,t)}async addSignalHandler(e){await me(this,Qe,"f").addSignalHandler(me(this,Ge,"f"),e)}removeSignalHandler(e){me(this,Qe,"f").removeSignalHandler(me(this,Ge,"f"),e)}};Qe=new WeakMap,Ge=new WeakMap;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},Yi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ae=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)}};Ji([h(),Yi("design:type",String)],ae.prototype,"source",void 0);Ji([h(),Yi("design:type",String)],ae.prototype,"target",void 0);Ji([h(),Yi("design:type",String)],ae.prototype,"predicate",void 0);Ji([h(),Yi("design:type",Date)],ae.prototype,"fromDate",void 0);Ji([h(),Yi("design:type",Date)],ae.prototype,"untilDate",void 0);Ji([h(),Yi("design:type",Number)],ae.prototype,"limit",void 0);ae=Ji([H(),Te(),Yi("design:paramtypes",[Object])],ae);var vc=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)},Ze,Mt;function Xn(i){return encodeURIComponent(i).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var le=class{constructor(){Ze.set(this,void 0),Mt.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 le;return vc(t,Mt,e,"f"),t}static from(e){let t=new le;return vc(t,Ze,e,"f"),t}toUrl(){if(Le(this,Mt,"f")&&!Le(this,Ze,"f"))return Le(this,Mt,"f");if(!Le(this,Mt,"f")&&(Le(this,Ze,"f")===void 0||Le(this,Ze,"f")===""||Le(this,Ze,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Le(this,Ze,"f")){case"string":e=`string:${Xn(Le(this,Ze,"f"))}`;break;case"number":e=`number:${Xn(Le(this,Ze,"f"))}`;break;case"boolean":e=`boolean:${Xn(Le(this,Ze,"f"))}`;break;case"object":e=`json:${Xn(JSON.stringify(Le(this,Ze,"f")))}`;break}return`literal://${e}`}get(){if(Le(this,Ze,"f"))return Le(this,Ze,"f");if(!Le(this,Mt,"f"))throw new Error("Can't render empty Literal");if(!Le(this,Mt,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Le(this,Mt,"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}`)}};Ze=new WeakMap,Mt=new WeakMap;function He(i){return i.charAt(0).toUpperCase()+i.slice(1)}function Ya(i){return`set${He(i)}`}function Vl(i){return i.endsWith("ies")?i.slice(0,-3)+"y":i.endsWith("s")?i.slice(0,-1):i}function tp(i){return`add${He(Vl(i))}`}function ip(i){return`remove${He(Vl(i))}`}function rp(i){return`set${He(i)}`}function Wl(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 Ei(i){if(Array.isArray(i))return`[${i.map(Ei).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 Cs=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)},Fe,je,ye,gn=class{constructor(i,e,t){Fe.set(this,void 0),je.set(this,void 0),ye.set(this,void 0),Cs(this,Fe,e,"f"),Cs(this,je,t,"f"),Cs(this,ye,i,"f")}get baseExpression(){return K(this,Fe,"f")}async init(){let isInstance=await K(this,ye,"f").isSubjectInstance(K(this,Fe,"f"),K(this,je,"f"));if(!isInstance)throw`Not a valid subject instance of ${K(this,je,"f")} for ${K(this,Fe,"f")}`;let results=await K(this,ye,"f").infer(`subject_class("${K(this,je,"f")}", C), property(C, Property)`),properties=results.map(i=>i.Property);for(let i of properties)await K(this,ye,"f").infer(`subject_class("${K(this,je,"f")}", C), property_resolve(C, "${i}")`),Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ye,"f").getPropertyValueViaSurreal(K(this,Fe,"f"),K(this,je,"f"),i)}catch(e){console.warn(`Failed to get property ${i} via SurrealDB:`,e);return}}});let setters=await K(this,ye,"f").infer(`subject_class("${K(this,je,"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,ye,"f").infer(`subject_class("${K(this,je,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Ya(property)]=async i=>{resolveLanguage&&(i=await K(this,ye,"f").createExpression(i,resolveLanguage)),await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:i}])}}let results2=await K(this,ye,"f").infer(`subject_class("${K(this,je,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(i=>i.Collection);for(let i of relations)Object.defineProperty(this,i,{configurable:!0,get:async()=>{try{return await K(this,ye,"f").getRelationValuesViaSurreal(K(this,Fe,"f"),K(this,je,"f"),i)}catch(e){return console.warn(`Failed to get relation ${i} via SurrealDB:`,e),[]}}});let adders=await K(this,ye,"f").infer(`subject_class("${K(this,je,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[tp(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:e}]))):await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:i}])}}let removers=await K(this,ye,"f").infer(`subject_class("${K(this,je,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[ip(relation)]=async i=>{Array.isArray(i)?await Promise.all(i.map(e=>K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:e}]))):await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:i}])}}let relationSetters=await K(this,ye,"f").infer(`subject_class("${K(this,je,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[rp(relation)]=async i=>{Array.isArray(i)?await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),i.map(e=>({name:"value",value:e}))):await K(this,ye,"f").executeAction(actions,K(this,Fe,"f"),[{name:"value",value:i}])}}}};Fe=new WeakMap,je=new WeakMap,ye=new WeakMap;function np(i,e,t,r){let n="",a=Wl(8);n+=`subject_class("${i}", ${a}).
435
+ `;let s=[],o=[];e.subjectConstructor&&e.subjectConstructor.length&&(o=o.concat(e.subjectConstructor));let l=[];e.isSubjectInstance&&e.isSubjectInstance.length&&(l=l.concat(e.isSubjectInstance));let c=[];for(let d in t){let f=`property(${a}, "${d}").
436
+ `,{through:g,initial:_,required:E,resolveLanguage:A,writable:k,flag:w,prologGetter:C,prologSetter:U,local:P}=t[d];if(A&&(f+=`property_resolve(${a}, "${d}").
437
+ `,f+=`property_resolve_language(${a}, "${d}", "${A}").
438
+ `),C?f+=`property_getter(${a}, Base, "${d}", Value) :- ${C}.
439
+ `:g&&(f+=`property_getter(${a}, Base, "${d}", Value) :- triple(Base, "${g}", Value).
440
+ `,E&&(w?l.push(`triple(Base, "${g}", "${_}")`):l.push(`triple(Base, "${g}", _)`))),U)f+=`property_setter(${a}, "${d}", Actions) :- ${U}.
441
+ `;else if(k&&g&&typeof e[Ya(d)]=="function"){let R=[{action:"setSingleTarget",source:"this",predicate:g,target:"value",...P&&{local:!0}}];f+=`property_setter(${a}, "${d}", '${Ei(R)}').
442
+ `}c.push(f);let Q=_??(E&&k&&!w&&g?"literal://string:":void 0);Q&&(o.push({action:"addLink",source:"this",predicate:g,target:Q}),s.push({action:"removeLink",source:"this",predicate:g,target:"*"}))}let u=[],m=Object.fromEntries(Object.entries(r).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany"));for(let d in m){let f=`collection(${a}, "${d}").
443
+ `,{predicate:g,local:_}=m[d];if(g){f+=`collection_getter(${a}, Base, "${d}", List) :- findall(C, triple(Base, "${g}", C), List).
444
+ `;let E=[{action:"addLink",source:"this",predicate:g,target:"value",..._&&{local:!0}}],A=[{action:"removeLink",source:"this",predicate:g,target:"value"}],k=[{action:"collectionSetter",source:"this",predicate:g,target:"value",..._&&{local:!0}}];f+=`collection_adder(${a}, "${d}", '${Ei(E)}').
445
+ `,f+=`collection_remover(${a}, "${d}", '${Ei(A)}').
446
+ `,f+=`collection_setter(${a}, "${d}", '${Ei(k)}').
447
+ `}u.push(f)}let y=Ei(o);if(n+=`constructor(${a}, '${y}').
454
448
  `,l.length>0){let d=l.join(", ");n+=`instance(${a}, Base) :- ${d}.
455
449
  `,n+=`
456
- `}return n+=`destructor(${a}, '${vi(s)}').
450
+ `}return n+=`destructor(${a}, '${Ei(s)}').
457
451
  `,n+=`
458
452
  `,n+=c.join(`
459
453
  `),n+=`
460
454
  `,n+=u.join(`
461
- `),{sdna:n,name:i}}function nc(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(0,e+1);let t=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let n=t[2],a=n.lastIndexOf("/");return a!==-1?t[1]+n.substring(0,a+1):t[1]}let r=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return r?r[1]:""}function ac(i){return i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\b/g,"\\b").replace(/\f/g,"\\f")}function sc(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(e+1);let t=i.lastIndexOf("/");if(t!==-1&&t<i.length-1)return i.substring(t+1);let r=i.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return r?r[1]:i}var Jt=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let r=nc(e),n=sc(e);this.nodeShapeUri=`${r}${n}Shape`}this.properties=[],this.parentShapes=[]}addParentShape(e){this.parentShapes.includes(e)||this.parentShapes.push(e)}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
455
+ `),{sdna:n,name:i}}function bc(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(0,e+1);let t=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let n=t[2],a=n.lastIndexOf("/");return a!==-1?t[1]+n.substring(0,a+1):t[1]}let r=i.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return r?r[1]:""}function wc(i){return i.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\b/g,"\\b").replace(/\f/g,"\\f")}function Sc(i){let e=i.lastIndexOf("#");if(e!==-1)return i.substring(e+1);let t=i.lastIndexOf("/");if(t!==-1&&t<i.length-1)return i.substring(t+1);let r=i.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return r?r[1]:i}var ii=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let r=bc(e),n=Sc(e);this.nodeShapeUri=`${r}${n}Shape`}this.properties=[],this.parentShapes=[]}addParentShape(e){this.parentShapes.includes(e)||this.parentShapes.push(e)}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
462
456
  `;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
463
457
  `,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
464
458
  `,e+=`@prefix ad4m: <ad4m://> .
@@ -473,27 +467,27 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):s
473
467
  `),r.nodeKind&&(e+=` sh:nodeKind sh:${r.nodeKind} ;
474
468
  `),r.minCount!==void 0&&(e+=` sh:minCount ${r.minCount} ;
475
469
  `),r.maxCount!==void 0&&(e+=` sh:maxCount ${r.maxCount} ;
476
- `),r.pattern&&(e+=` sh:pattern "${ac(r.pattern)}" ;
470
+ `),r.pattern&&(e+=` sh:pattern "${wc(r.pattern)}" ;
477
471
  `),r.minInclusive!==void 0&&(e+=` sh:minInclusive ${r.minInclusive} ;
478
472
  `),r.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${r.maxInclusive} ;
479
- `),r.hasValue&&(e+=` sh:hasValue "${ac(r.hasValue)}" ;
473
+ `),r.hasValue&&(e+=` sh:hasValue "${wc(r.hasValue)}" ;
480
474
  `),r.local!==void 0&&(e+=` ad4m:local ${r.local} ;
481
475
  `),r.writable!==void 0&&(e+=` ad4m:writable ${r.writable} ;
482
476
  `),e=e.slice(0,-2)+`
483
477
  `,e+=n?` ] .
484
478
  `:` ] ;
485
- `}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal://string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let r=this.properties[t],n;if(r.name&&this.targetClass){let a=nc(this.targetClass),s=sc(this.targetClass);n=`${a}${s}.${r.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:r.path}),r.datatype&&e.push({source:n,predicate:"sh://datatype",target:r.datatype}),r.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${r.nodeKind}`}),r.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal://${r.minCount}^^xsd:integer`}),r.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal://${r.maxCount}^^xsd:integer`}),r.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal://${r.pattern}`}),r.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal://${r.minInclusive}`}),r.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal://${r.maxInclusive}`}),r.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal://${r.hasValue}`}),r.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal://${r.local}`}),r.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal://${r.writable}`}),r.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal://string:${r.resolveLanguage}`}),r.setter&&r.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(r.setter)}`}),r.adder&&r.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(r.adder)}`}),r.remover&&r.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(r.remover)}`}),r.getter&&e.push({source:n,predicate:"ad4m://getter",target:`literal://string:${r.getter}`}),r.conformanceConditions&&r.conformanceConditions.length>0&&e.push({source:n,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(r.conformanceConditions)}`}),r.class&&e.push({source:n,predicate:"sh://class",target:r.class})}return e}static fromLinks(e,t){let r=e.find(l=>l.source===t&&l.predicate==="sh://targetClass"),n=new Jt(t,r?.target),a=e.find(l=>l.source===t&&l.predicate==="ad4m://constructor");if(a)try{let l=a.target.replace("literal://string:","");n.constructor_actions=JSON.parse(l)}catch{}let s=e.find(l=>l.source===t&&l.predicate==="ad4m://destructor");if(s)try{let l=s.target.replace("literal://string:","");n.destructor_actions=JSON.parse(l)}catch{}let o=e.filter(l=>l.source===t&&l.predicate==="sh://property");for(let l of o){let c=l.target,u=e.find(I=>I.source===c&&I.predicate==="sh://path");if(!u)continue;let m;if(!c.startsWith("_:")){let I=c.lastIndexOf(".");I!==-1&&(m=c.substring(I+1))}let y={name:m,path:u.target},d=e.find(I=>I.source===c&&I.predicate==="sh://datatype");d&&(y.datatype=d.target);let p=e.find(I=>I.source===c&&I.predicate==="sh://nodeKind");p&&(y.nodeKind=p.target.replace("sh://",""));let f=e.find(I=>I.source===c&&I.predicate==="sh://minCount");if(f){let I=f.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),y.minCount=parseInt(I)}let S=e.find(I=>I.source===c&&I.predicate==="sh://maxCount");if(S){let I=S.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),y.maxCount=parseInt(I)}let E=e.find(I=>I.source===c&&I.predicate==="sh://pattern");E&&(y.pattern=E.target.replace("literal://",""));let A=e.find(I=>I.source===c&&I.predicate==="sh://minInclusive");if(A){let I=A.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),y.minInclusive=parseFloat(I)}let k=e.find(I=>I.source===c&&I.predicate==="sh://maxInclusive");if(k){let I=k.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),y.maxInclusive=parseFloat(I)}let b=e.find(I=>I.source===c&&I.predicate==="sh://hasValue");b&&(y.hasValue=b.target.replace("literal://",""));let T=e.find(I=>I.source===c&&I.predicate==="ad4m://local");if(T){let I=T.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),y.local=I==="true"}let R=e.find(I=>I.source===c&&I.predicate==="ad4m://writable");if(R){let I=R.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),y.writable=I==="true"}let C=e.find(I=>I.source===c&&I.predicate==="ad4m://resolveLanguage");C&&(y.resolveLanguage=C.target.replace("literal://string:",""));let Q=e.find(I=>I.source===c&&I.predicate==="ad4m://setter");if(Q)try{let I=Q.target.replace("literal://string:","");y.setter=JSON.parse(I)}catch{}let V=e.find(I=>I.source===c&&I.predicate==="ad4m://adder");if(V)try{let I=V.target.replace("literal://string:","");y.adder=JSON.parse(I)}catch{}let L=e.find(I=>I.source===c&&I.predicate==="ad4m://remover");if(L)try{let I=L.target.replace("literal://string:","");y.remover=JSON.parse(I)}catch{}let W=e.find(I=>I.source===c&&I.predicate==="ad4m://getter");W&&(y.getter=W.target.replace("literal://string:",""));let He=e.find(I=>I.source===c&&I.predicate==="ad4m://conformanceConditions");if(He)try{let I=He.target.replace("literal://string:","");y.conformanceConditions=JSON.parse(I)}catch{}let Rr=e.find(I=>I.source===c&&I.predicate==="sh://class");Rr&&(y.class=Rr.target),n.addProperty(y)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new Jt(e.node_shape_uri,e.target_class):new Jt(e.target_class);for(let r of e.properties||[])t.addProperty({path:r.path,name:r.name,datatype:r.datatype,nodeKind:r.node_kind,minCount:r.min_count,maxCount:r.max_count,minInclusive:r.min_inclusive,maxInclusive:r.max_inclusive,pattern:r.pattern,hasValue:r.has_value,local:r.local,writable:r.writable,resolveLanguage:r.resolve_language,setter:r.setter,adder:r.adder,remover:r.remover,getter:r.getter,conformanceConditions:r.conformance_conditions,class:r.class});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let r of e.parent_shapes)t.addParentShape(r);return t}};function oc(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 Nl(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`${oc(e)} your ${t} actions, with access to ${oc(r)}`}function Y(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function se(i){return typeof i=="string"?`'${i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof i=="number"||typeof i=="boolean"?String(i):Array.isArray(i)?`[${i.map(e=>se(e)).join(", ")}]`:String(i)}function Fd(i,e,t){let r=Y(i),n=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(s=>se(s)).join(", ");return`count(->link[WHERE predicate = '${r}' AND ${n} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,s=[];if(a.not!==void 0)if(Array.isArray(a.not)){let l=a.not.map(c=>se(c)).join(", ");s.push(`count(->link[WHERE predicate = '${r}' AND ${n} IN [${l}]]) = 0`)}else s.push(`count(->link[WHERE predicate = '${r}' AND ${n} = ${se(a.not)}]) = 0`);return(a.gt!==void 0||a.gte!==void 0||a.lt!==void 0||a.lte!==void 0||a.between!==void 0||a.contains!==void 0)&&s.push(`count(->link[WHERE predicate = '${r}']) > 0`),s.join(" AND ")}else return`count(->link[WHERE predicate = '${r}' AND ${n} = ${se(e)}]) > 0`}function Rl(i,e){let t=[];for(let[r,n]of Object.entries(i)){if(["id","author","timestamp"].includes(r))continue;let a,s;if(e){let l=e.properties[r];l?(a=l.predicate,s=l.resolveLanguage):a=r}else a=r;let o=Fd(a,n,{resolveLanguage:s});o&&t.push(o)}return t}function jd(i,e,t,r,n){let a=e.prototype,s="ad4m://",o=Object.fromEntries(Object.entries(r).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));if(Object.keys(t).length>0){let p=t[Object.keys(t)[0]];if(p.through){let f=p.through.match(/^([^:]+:\/\/)/);f&&(s=f[1])}}else if(Object.keys(o).length>0){let p=o[Object.keys(o)[0]];if(p.predicate){let f=p.predicate.match(/^([^:]+:\/\/)/);f&&(s=f[1])}}let l=`${s}${i}Shape`,c=`${s}${i}`,u=new Jt(l,c),m=Object.getPrototypeOf(e);if(m&&typeof m.generateSHACL=="function"){let p=m.generateSHACL();p?.shape?.nodeShapeUri&&u.addParentShape(p.shape.nodeShapeUri)}let y=[];a.subjectConstructor&&a.subjectConstructor.length&&(y=y.concat(a.subjectConstructor));let d=[];for(let p in t){let f=t[p];if(!f.through)continue;let S={name:p,path:f.through};if(f.resolveLanguage==="literal")S.datatype="xsd://string";else if(f.initial){let A=typeof a[p];A==="number"?S.datatype="xsd://integer":A==="boolean"?S.datatype="xsd://boolean":A==="string"&&(S.datatype="xsd://string")}f.required&&(S.minCount=1),S.maxCount=1,f.flag&&f.initial&&(S.hasValue=f.initial),f.local!==void 0&&(S.local=f.local),f.writable!==void 0&&(S.writable=f.writable),f.resolveLanguage&&(S.resolveLanguage=f.resolveLanguage),f.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${p}' in class '${i}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):f.writable&&f.through&&typeof a[Wa(p)]=="function"&&(S.setter=[{action:"setSingleTarget",source:"this",predicate:f.through,target:"value",...f.local&&{local:!0}}]);let E=f.initial??(f.required&&f.writable&&!f.flag&&f.through?"literal://string:":void 0);E&&(y.push({action:"addLink",source:"this",predicate:f.through,target:E}),d.push({action:"removeLink",source:"this",predicate:f.through,target:"*"})),u.addProperty(S)}for(let p in o){let f=o[p];if(!f.predicate)continue;let S={name:p,path:f.predicate};if(S.nodeKind="IRI",f.local!==void 0&&(S.local=f.local),S.adder=[{action:"addLink",source:"this",predicate:f.predicate,target:"value",...f.local&&{local:!0}}],S.remover=[{action:"removeLink",source:"this",predicate:f.predicate,target:"value",...f.local&&{local:!0}}],f.getter)S.getter=f.getter;else if(f.where)try{let E=f.target?.(),A=E?E.getModelMetadata?.()??null:null,k=Rl(f.where,A);if(k.length>0){let b=Y(f.predicate);S.getter=`(->link[WHERE predicate = '${b}'].out[WHERE ${k.join(" AND ")}].uri)`}}catch{}else if(f.target&&f.filter!==!1)try{let E=f.target(),A=n(f.predicate,E);A&&(S.getter=A.getter,S.conformanceConditions=A.conformanceConditions)}catch{}if(f.target)try{let A=f.target().generateSHACL?.();A?.shape?.nodeShapeUri&&(S.class=A.shape.nodeShapeUri)}catch{}u.addProperty(S)}return u.setConstructorActions(y),u.setDestructorActions(d),{shape:u,name:i}}var xt=new WeakMap,Re=new WeakMap;function Mi(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=xt.get(n);a&&Object.assign(e,a)}return e}function wt(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=Re.get(n);a&&Object.assign(e,a)}return e}function Bd(i,e,t){xt.has(i)||xt.set(i,{}),xt.get(i)[e]=t}function qd(i,e,t){Re.has(i)||Re.set(i,{}),Re.get(i)[e]=t}function Pl(i,e){try{let t=Mi(e),r=[],n=[];for(let[o,l]of Object.entries(t))l.flag&&l.initial&&l.through&&(r.push({type:"flag",predicate:l.through,value:l.initial}),n.push(`count(->link[WHERE predicate = '${Y(l.through)}' AND out.uri = '${Y(l.initial)}']) > 0`));for(let[o,l]of Object.entries(t))l.required&&!l.flag&&!l.getter&&l.through&&(r.push({type:"required",predicate:l.through}),n.push(`count(->link[WHERE predicate = '${Y(l.through)}']) > 0`));return r.length===0?void 0:{getter:`(->link[WHERE predicate = '${Y(i)}'].out[WHERE ${n.join(" AND ")}].uri)`,conformanceConditions:r}}catch{return}}function Ka(i){return function(e,t){let r=i.readOnly?!1:!!i.through;if(i.required&&!i.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!i.through&&!i.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");let n=e.constructor;if(xt.has(n)||xt.set(n,{}),xt.get(n)[t]={...i,writable:r},r){let a=t;e[`set${Be(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Vy(i){return Ka({...i,required:i.required??!1,readOnly:i.readOnly??!1})}function zy(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");let r={through:i.through,required:!0,initial:i.value,flag:!0,readOnly:!0,writable:!1},n=e.constructor;xt.has(n)||xt.set(n,{}),xt.get(n)[t]=r,e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Hd(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){return Ud(i.name,e.prototype,Mi(e),wt(e))},e.generateSHACL=function(){return jd(i.name,e,Mi(e),wt(e),Pl)},Object.defineProperty(e,"type",{configurable:!0})}}function Vd(i){let e=i.required??!1;return Ka({...i,required:e,readOnly:i.readOnly??!1,resolveLanguage:i.resolveLanguage??"literal",initial:i.initial??(e?"literal://string:uninitialized":void 0)})}function Wy(i){return Vd({...i,readOnly:!0})}function Qa(i,e){let t=typeof i=="function"?{...e||{},target:i}:i;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw SurrealQL.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function Ky(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through&&(r[`add${Be(o)}`]=async function(l,c){return this.addRelationValue(o,l,c)},r[`remove${Be(o)}`]=async function(l,c){return this.removeRelationValue(o,l,c)},r[`set${Be(o)}`]=async function(l,c){return this.setRelationValues(o,l,c)}),Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Qy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through?(Ka({through:t.through,readOnly:!1,local:t.local})(r,n),r[`add${Be(o)}`]=async function(l){return this.addRelationValue(o,l)},r[`remove${Be(o)}`]=async function(l){return this.removeRelationValue(o,l)},r[`set${Be(o)}`]=async function(l){return this.setRelationValues(o,l)}):Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function Gy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?Ka({through:t.through,readOnly:!0,local:t.local})(r,n):Object.defineProperty(r,n,{configurable:!0,writable:!0})}}function Zy(i,e){let t=Qa(i,e);return function(r,n){let a=r.constructor;Re.has(a)||Re.set(a,{});let s=Re.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(r,n,{configurable:!0,writable:!0})}}var vr=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:oe.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal://string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal://string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let r of this._states){let n=this.stateUri(r.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:oe.from(r.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:oe.from(r.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(r.stateCheck))}`})}for(let r of this._transitions){let n=this.transitionUri(r.fromState,r.toState),a=this.stateUri(r.fromState),s=this.stateUri(r.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:oe.from(r.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:s}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(r.actions))}`})}return e}static fromLinks(e,t){let r="Flow";if(!t.endsWith(r))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-r.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),s=n.slice(0,a+1),o=n.slice(a+1),l=new vr(o,s),c=e.find(p=>p.source===t&&p.predicate==="ad4m://flowable");if(c)if(c.target==="ad4m://any")l.flowable="any";else try{let p=c.target.replace("literal://string:","");l.flowable=JSON.parse(decodeURIComponent(p))}catch{l.flowable="any"}let u=e.find(p=>p.source===t&&p.predicate==="ad4m://startAction");if(u)try{let p=u.target.replace("literal://string:","");l.startAction=JSON.parse(decodeURIComponent(p))}catch{}let m=e.filter(p=>p.source===t&&p.predicate==="ad4m://hasState"),y=new Map;for(let p of m){let f=p.target,S=e.find(R=>R.source===f&&R.predicate==="ad4m://stateName"),E=S?oe.fromUrl(S.target).get():"";y.set(f,E);let A=e.find(R=>R.source===f&&R.predicate==="ad4m://stateValue"),k=A?oe.fromUrl(A.target).get():0,b=e.find(R=>R.source===f&&R.predicate==="ad4m://stateCheck"),T={predicate:"",target:""};if(b)try{let R=b.target.replace("literal://string:","");T=JSON.parse(decodeURIComponent(R))}catch{}l.addState({name:E,value:k,stateCheck:T})}let d=e.filter(p=>p.source===t&&p.predicate==="ad4m://hasTransition");for(let p of d){let f=p.target,S=e.find(L=>L.source===f&&L.predicate==="ad4m://actionName"),E=S?oe.fromUrl(S.target).get():"",k=e.find(L=>L.source===f&&L.predicate==="ad4m://fromState")?.target||"",b=y.get(k)||"",R=e.find(L=>L.source===f&&L.predicate==="ad4m://toState")?.target||"",C=y.get(R)||"",Q=e.find(L=>L.source===f&&L.predicate==="ad4m://transitionActions"),V=[];if(Q)try{let L=Q.target.replace("literal://string:","");V=JSON.parse(decodeURIComponent(L))}catch{}l.addTransition({actionName:E,fromState:b,toState:C,actions:V})}return l}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new vr(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let r of e.states||[])t.addState(r);for(let r of e.transitions||[])t.addTransition(r);return t}},ae=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},_=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)},pa,Pt,yt,vt,ki,zt,Wt,bi,Vr,fa,wi,Si,at,dr,Ws,ee,ie,_i,Ei,xi,zr,Na=class{constructor(e,t,r){pa.add(this),Pt.set(this,void 0),yt.set(this,void 0),vt.set(this,void 0),ki.set(this,void 0),zt.set(this,void 0),Wt.set(this,void 0),bi.set(this,void 0),Vr.set(this,!1),fa.set(this,void 0),wi.set(this,void 0),Si.set(this,void 0),at.set(this,void 0),dr.set(this,void 0),this.isSurrealDB=!1,ae(this,Pt,e,"f"),ae(this,dr,t,"f"),ae(this,vt,r,"f"),ae(this,ki,new Set,"f"),ae(this,bi,null,"f"),ae(this,fa,new Promise((n,a)=>{ae(this,wi,n,"f"),ae(this,Si,a,"f")}),"f")}async subscribe(){_(this,Wt,"f")&&(_(this,Wt,"f").call(this),ae(this,Wt,void 0,"f")),_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,zt,"f")&&(clearTimeout(_(this,zt,"f")),ae(this,zt,void 0,"f"));try{let t;this.isSurrealDB?t=await _(this,vt,"f").perspectiveSubscribeSurrealQuery(_(this,Pt,"f"),_(this,dr,"f")):t=await _(this,vt,"f").subscribeQuery(_(this,Pt,"f"),_(this,dr,"f")),ae(this,yt,t.subscriptionId,"f"),t.result?(ae(this,bi,t.result,"f"),_(this,pa,"m",Ws).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ae(this,at,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"),ae(this,Wt,_(this,vt,"f").subscribeToQueryUpdates(_(this,yt,"f"),r=>{_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,wi,"f")&&(_(this,wi,"f").call(this,!0),ae(this,wi,void 0,"f"),ae(this,Si,void 0,"f")),!(r.isInit&&_(this,bi,"f"))&&(ae(this,bi,r,"f"),_(this,pa,"m",Ws).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),_(this,Si,"f")&&(_(this,Si,"f").call(this,t),ae(this,wi,void 0,"f"),ae(this,Si,void 0,"f")),t}let e=async()=>{if(!_(this,Vr,"f")){try{this.isSurrealDB?await _(this,vt,"f").perspectiveKeepAliveSurrealQuery(_(this,Pt,"f"),_(this,yt,"f")):await _(this,vt,"f").keepAliveQuery(_(this,Pt,"f"),_(this,yt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",_(this,dr,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}_(this,Vr,"f")||ae(this,zt,setTimeout(e,3e4),"f")}};ae(this,zt,setTimeout(e,3e4),"f")}get id(){return _(this,yt,"f")}get initialized(){return _(this,fa,"f")}get result(){return _(this,bi,"f")}onResult(e){return _(this,ki,"f").add(e),()=>_(this,ki,"f").delete(e)}dispose(){ae(this,Vr,!0,"f"),clearTimeout(_(this,zt,"f")),_(this,Wt,"f")&&_(this,Wt,"f").call(this),_(this,ki,"f").clear(),_(this,at,"f")&&(clearTimeout(_(this,at,"f")),ae(this,at,void 0,"f")),_(this,yt,"f")&&(this.isSurrealDB?_(this,vt,"f").perspectiveDisposeSurrealQuerySubscription(_(this,Pt,"f"),_(this,yt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):_(this,vt,"f").disposeQuerySubscription(_(this,Pt,"f"),_(this,yt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Pt=new WeakMap,yt=new WeakMap,vt=new WeakMap,ki=new WeakMap,zt=new WeakMap,Wt=new WeakMap,bi=new WeakMap,Vr=new WeakMap,fa=new WeakMap,wi=new WeakMap,Si=new WeakMap,at=new WeakMap,dr=new WeakMap,pa=new WeakSet,Ws=function i(e){for(let t of _(this,ki,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var fr=class{constructor(e,t){ee.set(this,void 0),ie.set(this,void 0),_i.set(this,void 0),Ei.set(this,void 0),xi.set(this,void 0),zr.set(this,void 0),ae(this,_i,[],"f"),ae(this,Ei,[],"f"),ae(this,xi,[],"f"),ae(this,zr,[],"f"),ae(this,ee,e,"f"),ae(this,ie,t,"f"),this.uuid=_(this,ee,"f").uuid,this.name=_(this,ee,"f").name,this.owners=_(this,ee,"f").owners,this.sharedUrl=_(this,ee,"f").sharedUrl,this.neighbourhood=_(this,ee,"f").neighbourhood,this.state=_(this,ee,"f").state,_(this,ie,"f").addPerspectiveLinkAddedListener(_(this,ee,"f").uuid,_(this,_i,"f")),_(this,ie,"f").addPerspectiveLinkRemovedListener(_(this,ee,"f").uuid,_(this,Ei,"f")),_(this,ie,"f").addPerspectiveLinkUpdatedListener(_(this,ee,"f").uuid,_(this,xi,"f")),_(this,ie,"f").addPerspectiveSyncStateChangeListener(_(this,ee,"f").uuid,_(this,zr,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,r,n){return await _(this,ie,"f").executeCommands(_(this,ee,"f").uuid,JSON.stringify(e),t,JSON.stringify(r),n)}async get(e){return await _(this,ie,"f").queryLinks(_(this,ee,"f").uuid,e)}async infer(e){return await _(this,ie,"f").queryProlog(_(this,ee,"f").uuid,e)}async querySurrealDB(e){return await _(this,ie,"f").querySurrealDB(_(this,ee,"f").uuid,e)}async add(e,t="shared",r){return await _(this,ie,"f").addLink(_(this,ee,"f").uuid,e,t,r)}async addLinks(e,t="shared",r){return await _(this,ie,"f").addLinks(_(this,ee,"f").uuid,e,t,r)}async removeLinks(e,t){return await _(this,ie,"f").removeLinks(_(this,ee,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await _(this,ie,"f").linkMutations(_(this,ee,"f").uuid,e,t)}async addLinkExpression(e,t="shared",r){return await _(this,ie,"f").addLinkExpression(_(this,ee,"f").uuid,e,t,r)}async update(e,t,r){return await _(this,ie,"f").updateLink(_(this,ee,"f").uuid,e,t,r)}async remove(e,t){return await _(this,ie,"f").removeLink(_(this,ee,"f").uuid,e,t)}async createBatch(){return await _(this,ie,"f").createBatch(_(this,ee,"f").uuid)}async commitBatch(e){return await _(this,ie,"f").commitBatch(_(this,ee,"f").uuid,e)}async getExpression(e){return await _(this,ie,"f").getExpression(e)}async createExpression(e,t){return await _(this,ie,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?_(this,_i,"f").push(t):e==="link-removed"?_(this,Ei,"f").push(t):e==="link-updated"&&_(this,xi,"f").push(t)}async addSyncStateChangeListener(e){_(this,zr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=_(this,_i,"f").indexOf(t);_(this,_i,"f").splice(r,1)}else if(e==="link-removed"){let r=_(this,Ei,"f").indexOf(t);_(this,Ei,"f").splice(r,1)}else if(e==="link-updated"){let r=_(this,xi,"f").indexOf(t);_(this,xi,"f").splice(r,1)}}async snapshot(){return _(this,ie,"f").snapshotByUUID(_(this,ee,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(r=>{delete r.data.__typename});for(let r of t.links)await this.addLinkExpression(r)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let r=new re({source:e.source,predicate:e.predicate}),n=await this.get(r),a=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,a.push(o);let s=[e];await this.linkMutations({additions:s,removals:a},t)}async sdnaFlows(){return(await this.get(new re({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return oe.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),r=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")r.push(n);else{let s=a.flowable,o=s.source||e;(await this.get(new re({source:o,predicate:s.predicate,target:s.target}))).length>0&&r.push(n)}}return r}async startFlow(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;if(r.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(r.startAction,t,void 0)}async expressionsInFlowState(e,t){let r=await this.getFlow(e);if(!r)return[];let n=r.states.find(o=>o.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new re({predicate:a.predicate,target:a.target}))).map(o=>a.source?o.data.target:o.data.source)}async flowState(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;for(let n of r.states){let a=n.stateCheck,s=a.source||t;if((await this.get(new re({source:s,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let r=await this.getFlow(e);if(!r)return[];let n=null;for(let a of r.states){let s=a.stateCheck,o=s.source||t;if((await this.get(new re({source:o,predicate:s.predicate,target:s.target}))).length>0){n=a.name;break}}return n?r.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,r){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(s=>s.actionName===r);if(!a)throw`Action "${r}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let r of e){let n=await this.get(new re({source:"ad4m://self",predicate:r}));for(let a of n){let s=a.data.target,o=await this.get(new re({source:s,predicate:"ad4m://sdna"}));for(let l of o){let c=oe.fromUrl(l.data.target).get();typeof c=="string"&&t.push(c)}}}return t}async getSdnaForClass(e){let t=oe.from(e);if((await this.get(new re({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new re({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=oe.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,r,n){return _(this,ie,"f").addSdna(_(this,ee,"f").uuid,e,t,r,n)}async addShacl(e,t){let r=t.toLinks(),n=oe.fromUrl(`literal://string:shacl://${e}`),a=[...r.map(s=>new Ke({source:s.source,predicate:s.predicate,target:s.target})),new Ke({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Ke({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=oe.fromUrl(`literal://string:shacl://${e}`),r=await this.get(new re({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(r.length===0)return null;let n=r[0].data.target;Y(n);let a=await this.get(new re({source:n,predicate:"sh://property"})),l=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[n,...a.map(m=>m.data.target)].map(m=>`'${Y(m)}'`).join(", ")}]`,u=(await this.querySurrealDB(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return Jt.fromLinks(u,n)}async getAllShacl(){let e=await this.get(new re({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let r of e){let n=r.data.target,s=oe.fromUrl(n).get().replace("shacl://",""),o=await this.getShacl(s);o&&t.push({name:s,shape:o})}return t}async addFlow(e,t){let r=t.toLinks(),n=oe.from(e).toUrl(),a=[...r.map(s=>new Ke({source:s.source,predicate:s.predicate,target:s.target})),new Ke({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Ke({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=oe.from(e).toUrl(),r=await this.get(new re({source:t,predicate:"ad4m://flow_uri"}));if(r.length===0)return null;let n=r[0].data.target,a=Y(n),s=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=Y(s),l=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${o}')`,u=(await this.querySurrealDB(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return vr.fromLinks(u,n)}async subjectClasses(){try{let t=(await this.get(new re({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(r=>{let a=r.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(r=>r.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,r,n){let a;if(typeof e=="string")a=e,await _(this,ie,"f").createSubject(_(this,ee,"f").uuid,JSON.stringify({className:a,initialValues:r}),t,r?JSON.stringify(r):void 0,n);else{let s=e,o=s.className||s.constructor?.className||s.constructor?.prototype?.className||await this.findClassByProperties(s);if(!o)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await _(this,ie,"f").createSubject(_(this,ee,"f").uuid,JSON.stringify({className:o,initialValues:r}),t,r?JSON.stringify(r):void 0,n)}return n?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await _(this,ie,"f").getSubjectData(_(this,ee,"f").uuid,JSON.stringify({className:e}),t));let r=e,n=r.className||r.constructor?.className||r.constructor?.prototype?.className||await this.findClassByProperties(r);if(!n)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await _(this,ie,"f").getSubjectData(_(this,ee,"f").uuid,JSON.stringify({className:n}),t))}async getActionsFromSHACL(e,t){let r=this.escapeRegExp(e),n=new RegExp(`[/:#]${r}Shape$`),a=await this.get(new re({predicate:t}));for(let s of a)if(n.test(s.data.source)){let o="literal://string:";if(s.data.target.startsWith(o)){let l=s.data.target.slice(o.length),c=l;try{c=decodeURIComponent(l)}catch{}try{return JSON.parse(c)}catch(u){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,u),null}}}return null}async removeSubject(e,t,r){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,r)}async isSubjectInstance(e,t){let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${r}`),!1;if(n.requiredTriples.length===0){let s=`SELECT count() AS count FROM link WHERE in.uri = '${Y(e)}'`,l=(await this.querySurrealDB(s))[0]?.count??0;return(typeof l=="object"&&l?.Int!==void 0?l.Int:l)>0}for(let a of n.requiredTriples){let s=Y(e),o=Y(a.predicate),l;if(a.target){let y=Y(a.target);l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}' AND out.uri = '${y}'`}else l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}'`;let c=await this.querySurrealDB(l);if(!c||c.length===0)return!1;let u=c[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=new un(this,e,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let r=[],n=[],a=new Map,s=new Map,o=new Set;for(let l of t.properties){if(!l.path||!l.name)continue;l.writable&&o.add(l.path),l.adder&&l.adder.length>0?s.set(l.name,{predicate:l.path}):a.set(l.name,{predicate:l.path,resolveLanguage:l.resolveLanguage})}if(t.constructor_actions){for(let l of t.constructor_actions)if(l.predicate){r.push(l.predicate);let c=o.has(l.predicate);l.target&&l.target!=="value"&&!c?n.push({predicate:l.predicate,target:l.target}):n.push({predicate:l.predicate})}}return{requiredPredicates:r,requiredTriples:n,properties:a,relations:s}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}generateSurrealInstanceQuery(e){return e.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${e.requiredTriples.map(r=>{let n=Y(r.predicate);if(r.target){let a=Y(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(r);if(!a)return;let s=Y(e),o=Y(a.predicate),l=`SELECT out.uri AS value FROM link WHERE in.uri = '${s}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(l);if(!c||c.length===0)return;let u=c[0].value;if(a.resolveLanguage&&u)try{let m=await this.getExpression(u);try{return JSON.parse(m.data)}catch{return m.data}}catch{return u}return u}async getRelationValuesViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(r);if(!a)return[];let s=Y(e),o=Y(a.predicate),l=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${s}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(l);if(!c||c.length===0)return[];let u=c.map(m=>m.value).filter(m=>m!==""&&m!=="");if(a.condition&&u.length>0)try{let m=[];for(let y of u){let d=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${y.replace(/'/g,"\\'")}'`);d.trim().startsWith("WHERE")&&(d=`array::len(SELECT * FROM link ${d}) > 0`);let p=await this.querySurrealDB(`RETURN ${d}`);(p===!0||Array.isArray(p)&&p.length>0&&p[0]===!0)&&m.push(y)}u=m}catch(m){console.warn(`Failed to apply condition filter for ${r}:`,m)}if(a.instanceFilter)try{let m=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return m?await this.batchCheckSubjectInstances(u,m):this.filterInstancesSequential(u,a.instanceFilter)}catch{return this.filterInstancesSequential(u,a.instanceFilter)}return u}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(l=>`'${Y(l)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(s)).map(l=>l.uri)}let r=[];for(let a of t.requiredTriples){let s=e.map(u=>`'${Y(u)}'`).join(", "),o=Y(a.predicate),l;if(a.target){let u=Y(a.target);l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}' AND out.uri = '${u}'`}else l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}'`;let c=await this.querySurrealDB(l);r.push(new Set(c.map(u=>u.uri)))}return r.length===0?e:e.filter(a=>r.every(s=>s.has(a)))}async filterInstancesSequential(e,t){let r=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(e){let t=[],r=typeof e=="function";typeof e=="string"?t=[e]:r?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];for(let a of t){let s=await this.getSubjectClassMetadataFromSDNA(a);if(s){let o=this.generateSurrealInstanceQuery(s),l=await this.querySurrealDB(o);for(let c of l||[])try{let u;r?(u=new e(this,c.base),await u.get()):(u=new un(this,c.base,a),await u.init()),n.push(u)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let s=this.generateSurrealInstanceQuery(a),o=await this.querySurrealDB(s);for(let l of o||[])try{let c=new un(this,l.base,n);await c.init(),r.push(c)}catch{}}}return r}async findClassByProperties(e){let t=[],r=[],a=Object.getPrototypeOf(e)?.constructor,s=a?Mi(a):{};Object.keys(s).length>0?t=Object.keys(s):t=Object.keys(e).filter(m=>!Array.isArray(e[m]));let o=a?Object.fromEntries(Object.entries(wt(a)).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany")):{};if(Object.keys(o).length>0?r=Object.keys(o).filter(m=>m!=="isSubjectInstance"):r=Object.keys(e).filter(m=>Array.isArray(e[m])&&m!=="isSubjectInstance"),t.length===0&&r.length===0)return null;let l=`SELECT
479
+ `}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal://string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let r=this.properties[t],n;if(r.name&&this.targetClass){let a=bc(this.targetClass),s=Sc(this.targetClass);n=`${a}${s}.${r.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:r.path}),r.datatype&&e.push({source:n,predicate:"sh://datatype",target:r.datatype}),r.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${r.nodeKind}`}),r.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal://${r.minCount}^^xsd:integer`}),r.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal://${r.maxCount}^^xsd:integer`}),r.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal://${r.pattern}`}),r.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal://${r.minInclusive}`}),r.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal://${r.maxInclusive}`}),r.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal://${r.hasValue}`}),r.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal://${r.local}`}),r.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal://${r.writable}`}),r.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal://string:${r.resolveLanguage}`}),r.setter&&r.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(r.setter)}`}),r.adder&&r.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(r.adder)}`}),r.remover&&r.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(r.remover)}`}),r.getter&&e.push({source:n,predicate:"ad4m://getter",target:`literal://string:${r.getter}`}),r.conformanceConditions&&r.conformanceConditions.length>0&&e.push({source:n,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(r.conformanceConditions)}`}),r.class&&e.push({source:n,predicate:"sh://class",target:r.class})}return e}static fromLinks(e,t){let r=e.find(l=>l.source===t&&l.predicate==="sh://targetClass"),n=new ii(t,r?.target),a=e.find(l=>l.source===t&&l.predicate==="ad4m://constructor");if(a)try{let l=a.target.replace("literal://string:","");n.constructor_actions=JSON.parse(l)}catch{}let s=e.find(l=>l.source===t&&l.predicate==="ad4m://destructor");if(s)try{let l=s.target.replace("literal://string:","");n.destructor_actions=JSON.parse(l)}catch{}let o=e.filter(l=>l.source===t&&l.predicate==="sh://property");for(let l of o){let c=l.target,u=e.find(T=>T.source===c&&T.predicate==="sh://path");if(!u)continue;let m;if(!c.startsWith("_:")){let T=c.lastIndexOf(".");T!==-1&&(m=c.substring(T+1))}let y={name:m,path:u.target},d=e.find(T=>T.source===c&&T.predicate==="sh://datatype");d&&(y.datatype=d.target);let f=e.find(T=>T.source===c&&T.predicate==="sh://nodeKind");f&&(y.nodeKind=f.target.replace("sh://",""));let g=e.find(T=>T.source===c&&T.predicate==="sh://minCount");if(g){let T=g.target.replace("literal://","").replace(/\^\^.*$/,"");T.startsWith("number:")&&(T=T.substring(7)),y.minCount=parseInt(T)}let _=e.find(T=>T.source===c&&T.predicate==="sh://maxCount");if(_){let T=_.target.replace("literal://","").replace(/\^\^.*$/,"");T.startsWith("number:")&&(T=T.substring(7)),y.maxCount=parseInt(T)}let E=e.find(T=>T.source===c&&T.predicate==="sh://pattern");E&&(y.pattern=E.target.replace("literal://",""));let A=e.find(T=>T.source===c&&T.predicate==="sh://minInclusive");if(A){let T=A.target.replace("literal://","");T.startsWith("number:")&&(T=T.substring(7)),y.minInclusive=parseFloat(T)}let k=e.find(T=>T.source===c&&T.predicate==="sh://maxInclusive");if(k){let T=k.target.replace("literal://","");T.startsWith("number:")&&(T=T.substring(7)),y.maxInclusive=parseFloat(T)}let w=e.find(T=>T.source===c&&T.predicate==="sh://hasValue");w&&(y.hasValue=w.target.replace("literal://",""));let C=e.find(T=>T.source===c&&T.predicate==="ad4m://local");if(C){let T=C.target.replace("literal://","");T.startsWith("boolean:")&&(T=T.substring(8)),y.local=T==="true"}let U=e.find(T=>T.source===c&&T.predicate==="ad4m://writable");if(U){let T=U.target.replace("literal://","");T.startsWith("boolean:")&&(T=T.substring(8)),y.writable=T==="true"}let P=e.find(T=>T.source===c&&T.predicate==="ad4m://resolveLanguage");P&&(y.resolveLanguage=P.target.replace("literal://string:",""));let Q=e.find(T=>T.source===c&&T.predicate==="ad4m://setter");if(Q)try{let T=Q.target.replace("literal://string:","");y.setter=JSON.parse(T)}catch{}let V=e.find(T=>T.source===c&&T.predicate==="ad4m://adder");if(V)try{let T=V.target.replace("literal://string:","");y.adder=JSON.parse(T)}catch{}let R=e.find(T=>T.source===c&&T.predicate==="ad4m://remover");if(R)try{let T=R.target.replace("literal://string:","");y.remover=JSON.parse(T)}catch{}let W=e.find(T=>T.source===c&&T.predicate==="ad4m://getter");W&&(y.getter=W.target.replace("literal://string:",""));let We=e.find(T=>T.source===c&&T.predicate==="ad4m://conformanceConditions");if(We)try{let T=We.target.replace("literal://string:","");y.conformanceConditions=JSON.parse(T)}catch{}let Or=e.find(T=>T.source===c&&T.predicate==="sh://class");Or&&(y.class=Or.target),n.addProperty(y)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new ii(e.node_shape_uri,e.target_class):new ii(e.target_class);for(let r of e.properties||[])t.addProperty({path:r.path,name:r.name,datatype:r.datatype,nodeKind:r.node_kind,minCount:r.min_count,maxCount:r.max_count,minInclusive:r.min_inclusive,maxInclusive:r.max_inclusive,pattern:r.pattern,hasValue:r.has_value,local:r.local,writable:r.writable,resolveLanguage:r.resolve_language,setter:r.setter,adder:r.adder,remover:r.remover,getter:r.getter,conformanceConditions:r.conformance_conditions,class:r.class});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let r of e.parent_shapes)t.addParentShape(r);return t}};function _c(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 Kl(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`${_c(e)} your ${t} actions, with access to ${_c(r)}`}function ee(i){return i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function ce(i){return typeof i=="string"?`'${i.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof i=="number"||typeof i=="boolean"?String(i):Array.isArray(i)?`[${i.map(e=>ce(e)).join(", ")}]`:String(i)}function ap(i,e,t){let r=ee(i),n=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(s=>ce(s)).join(", ");return`count(->link[WHERE predicate = '${r}' AND ${n} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,s=[];if(a.not!==void 0)if(Array.isArray(a.not)){let l=a.not.map(c=>ce(c)).join(", ");s.push(`count(->link[WHERE predicate = '${r}' AND ${n} IN [${l}]]) = 0`)}else s.push(`count(->link[WHERE predicate = '${r}' AND ${n} = ${ce(a.not)}]) = 0`);return(a.gt!==void 0||a.gte!==void 0||a.lt!==void 0||a.lte!==void 0||a.between!==void 0||a.contains!==void 0)&&s.push(`count(->link[WHERE predicate = '${r}']) > 0`),s.join(" AND ")}else return`count(->link[WHERE predicate = '${r}' AND ${n} = ${ce(e)}]) > 0`}function Ql(i,e){let t=[];for(let[r,n]of Object.entries(i)){if(["id","author","timestamp"].includes(r))continue;let a,s;if(e){let l=e.properties[r];l?(a=l.predicate,s=l.resolveLanguage):a=r}else a=r;let o=ap(a,n,{resolveLanguage:s});o&&t.push(o)}return t}function sp(i,e,t,r,n){let a=e.prototype,s="ad4m://",o=Object.fromEntries(Object.entries(r).filter(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany"));if(Object.keys(t).length>0){let f=t[Object.keys(t)[0]];if(f.through){let g=f.through.match(/^([^:]+:\/\/)/);g&&(s=g[1])}}else if(Object.keys(o).length>0){let f=o[Object.keys(o)[0]];if(f.predicate){let g=f.predicate.match(/^([^:]+:\/\/)/);g&&(s=g[1])}}let l=`${s}${i}Shape`,c=`${s}${i}`,u=new ii(l,c),m=Object.getPrototypeOf(e);if(m&&typeof m.generateSHACL=="function"){let f=m.generateSHACL();f?.shape?.nodeShapeUri&&u.addParentShape(f.shape.nodeShapeUri)}let y=[];a.subjectConstructor&&a.subjectConstructor.length&&(y=y.concat(a.subjectConstructor));let d=[];for(let f in t){let g=t[f];if(!g.through)continue;let _={name:f,path:g.through};if(g.resolveLanguage==="literal")_.datatype="xsd://string";else if(g.initial){let A=typeof a[f];A==="number"?_.datatype="xsd://integer":A==="boolean"?_.datatype="xsd://boolean":A==="string"&&(_.datatype="xsd://string")}g.required&&(_.minCount=1),_.maxCount=1,g.flag&&g.initial&&(_.hasValue=g.initial),g.local!==void 0&&(_.local=g.local),g.writable!==void 0&&(_.writable=g.writable),g.resolveLanguage&&(_.resolveLanguage=g.resolveLanguage),g.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${f}' in class '${i}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):g.writable&&g.through&&typeof a[Ya(f)]=="function"&&(_.setter=[{action:"setSingleTarget",source:"this",predicate:g.through,target:"value",...g.local&&{local:!0}}]);let E=g.initial??(g.required&&g.writable&&!g.flag&&g.through?"literal://string:":void 0);E&&(y.push({action:"addLink",source:"this",predicate:g.through,target:E}),d.push({action:"removeLink",source:"this",predicate:g.through,target:"*"})),u.addProperty(_)}for(let f in o){let g=o[f];if(!g.predicate)continue;let _={name:f,path:g.predicate};if(_.nodeKind="IRI",g.local!==void 0&&(_.local=g.local),_.adder=[{action:"addLink",source:"this",predicate:g.predicate,target:"value",...g.local&&{local:!0}}],_.remover=[{action:"removeLink",source:"this",predicate:g.predicate,target:"value",...g.local&&{local:!0}}],g.getter)_.getter=g.getter;else if(g.where)try{let E=g.target?.(),A=E?E.getModelMetadata?.()??null:null,k=Ql(g.where,A);if(k.length>0){let w=ee(g.predicate);_.getter=`(->link[WHERE predicate = '${w}'].out[WHERE ${k.join(" AND ")}].uri)`}}catch{}else if(g.target&&g.filter!==!1)try{let E=g.target(),A=n(g.predicate,E);A&&(_.getter=A.getter,_.conformanceConditions=A.conformanceConditions)}catch{}if(g.target)try{let A=g.target().generateSHACL?.();A?.shape?.nodeShapeUri&&(_.class=A.shape.nodeShapeUri)}catch{}u.addProperty(_)}return u.setConstructorActions(y),u.setDestructorActions(d),{shape:u,name:i}}var Tt=new WeakMap,De=new WeakMap;function Hi(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=Tt.get(n);a&&Object.assign(e,a)}return e}function $t(i){let e={},t=[],r=i;for(;r&&r!==Object;)t.unshift(r),r=Object.getPrototypeOf(r);for(let n of t){let a=De.get(n);a&&Object.assign(e,a)}return e}function op(i,e,t){Tt.has(i)||Tt.set(i,{}),Tt.get(i)[e]=t}function cp(i,e,t){De.has(i)||De.set(i,{}),De.get(i)[e]=t}function Gl(i,e){try{let t=Hi(e),r=[],n=[];for(let[o,l]of Object.entries(t))l.flag&&l.initial&&l.through&&(r.push({type:"flag",predicate:l.through,value:l.initial}),n.push(`count(->link[WHERE predicate = '${ee(l.through)}' AND out.uri = '${ee(l.initial)}']) > 0`));for(let[o,l]of Object.entries(t))l.required&&!l.flag&&!l.getter&&l.through&&(r.push({type:"required",predicate:l.through}),n.push(`count(->link[WHERE predicate = '${ee(l.through)}']) > 0`));return r.length===0?void 0:{getter:`(->link[WHERE predicate = '${ee(i)}'].out[WHERE ${n.join(" AND ")}].uri)`,conformanceConditions:r}}catch{return}}function Xa(i){return function(e,t){let r=i.readOnly?!1:!!i.through;if(i.required&&!i.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!i.through&&!i.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");let n=e.constructor;if(Tt.has(n)||Tt.set(n,{}),Tt.get(n)[t]={...i,writable:r},r){let a=t;e[`set${He(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function S0(i){return Xa({...i,required:i.required??!1,readOnly:i.readOnly??!1})}function _0(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");let r={through:i.through,required:!0,initial:i.value,flag:!0,readOnly:!0,writable:!1},n=e.constructor;Tt.has(n)||Tt.set(n,{}),Tt.get(n)[t]=r,e[t]=i.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function lp(i){return function(e){e.prototype.className=i.name,e.className=i.name,e.generateSDNA=function(){return np(i.name,e.prototype,Hi(e),$t(e))},e.generateSHACL=function(){return sp(i.name,e,Hi(e),$t(e),Gl)},Object.defineProperty(e,"type",{configurable:!0})}}function up(i){let e=i.required??!1;return Xa({...i,required:e,readOnly:i.readOnly??!1,resolveLanguage:i.resolveLanguage??"literal",initial:i.initial??(e?"literal://string:uninitialized":void 0)})}function x0(i){return up({...i,readOnly:!0})}function es(i,e){let t=typeof i=="function"?{...e||{},target:i}:i;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw SurrealQL.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function E0(i,e){let t=es(i,e);return function(r,n){let a=r.constructor;De.has(a)||De.set(a,{});let s=De.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through&&(r[`add${He(o)}`]=async function(l,c){return this.addRelationValue(o,l,c)},r[`remove${He(o)}`]=async function(l,c){return this.removeRelationValue(o,l,c)},r[`set${He(o)}`]=async function(l,c){return this.setRelationValues(o,l,c)}),Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function $0(i,e){let t=es(i,e);return function(r,n){let a=r.constructor;De.has(a)||De.set(a,{});let s=De.get(a);s[n]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let o=n;t.through?(Xa({through:t.through,readOnly:!1,local:t.local})(r,n),r[`add${He(o)}`]=async function(l){return this.addRelationValue(o,l)},r[`remove${He(o)}`]=async function(l){return this.removeRelationValue(o,l)},r[`set${He(o)}`]=async function(l){return this.setRelationValues(o,l)}):Object.defineProperty(r,o,{configurable:!0,writable:!0})}}function A0(i,e){let t=es(i,e);return function(r,n){let a=r.constructor;De.has(a)||De.set(a,{});let s=De.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?Xa({through:t.through,readOnly:!0,local:t.local})(r,n):Object.defineProperty(r,n,{configurable:!0,writable:!0})}}function k0(i,e){let t=es(i,e);return function(r,n){let a=r.constructor;De.has(a)||De.set(a,{});let s=De.get(a);s[n]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(r,n,{configurable:!0,writable:!0})}}var Sr=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:le.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal://string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal://string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let r of this._states){let n=this.stateUri(r.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:le.from(r.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:le.from(r.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(r.stateCheck))}`})}for(let r of this._transitions){let n=this.transitionUri(r.fromState,r.toState),a=this.stateUri(r.fromState),s=this.stateUri(r.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:le.from(r.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:s}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(r.actions))}`})}return e}static fromLinks(e,t){let r="Flow";if(!t.endsWith(r))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-r.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),s=n.slice(0,a+1),o=n.slice(a+1),l=new Sr(o,s),c=e.find(f=>f.source===t&&f.predicate==="ad4m://flowable");if(c)if(c.target==="ad4m://any")l.flowable="any";else try{let f=c.target.replace("literal://string:","");l.flowable=JSON.parse(decodeURIComponent(f))}catch{l.flowable="any"}let u=e.find(f=>f.source===t&&f.predicate==="ad4m://startAction");if(u)try{let f=u.target.replace("literal://string:","");l.startAction=JSON.parse(decodeURIComponent(f))}catch{}let m=e.filter(f=>f.source===t&&f.predicate==="ad4m://hasState"),y=new Map;for(let f of m){let g=f.target,_=e.find(U=>U.source===g&&U.predicate==="ad4m://stateName"),E=_?le.fromUrl(_.target).get():"";y.set(g,E);let A=e.find(U=>U.source===g&&U.predicate==="ad4m://stateValue"),k=A?le.fromUrl(A.target).get():0,w=e.find(U=>U.source===g&&U.predicate==="ad4m://stateCheck"),C={predicate:"",target:""};if(w)try{let U=w.target.replace("literal://string:","");C=JSON.parse(decodeURIComponent(U))}catch{}l.addState({name:E,value:k,stateCheck:C})}let d=e.filter(f=>f.source===t&&f.predicate==="ad4m://hasTransition");for(let f of d){let g=f.target,_=e.find(R=>R.source===g&&R.predicate==="ad4m://actionName"),E=_?le.fromUrl(_.target).get():"",k=e.find(R=>R.source===g&&R.predicate==="ad4m://fromState")?.target||"",w=y.get(k)||"",U=e.find(R=>R.source===g&&R.predicate==="ad4m://toState")?.target||"",P=y.get(U)||"",Q=e.find(R=>R.source===g&&R.predicate==="ad4m://transitionActions"),V=[];if(Q)try{let R=Q.target.replace("literal://string:","");V=JSON.parse(decodeURIComponent(R))}catch{}l.addTransition({actionName:E,fromState:w,toState:P,actions:V})}return l}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new Sr(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let r of e.states||[])t.addState(r);for(let r of e.transitions||[])t.addTransition(r);return t}},oe=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},x=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)},va,Ft,_t,xt,Ri,Zt,Jt,$i,Gr,ba,Ai,ki,ot,hr,eo,re,ne,Ii,Ti,Ci,Zr,Ma=class{constructor(e,t,r){va.add(this),Ft.set(this,void 0),_t.set(this,void 0),xt.set(this,void 0),Ri.set(this,void 0),Zt.set(this,void 0),Jt.set(this,void 0),$i.set(this,void 0),Gr.set(this,!1),ba.set(this,void 0),Ai.set(this,void 0),ki.set(this,void 0),ot.set(this,void 0),hr.set(this,void 0),this.isSurrealDB=!1,oe(this,Ft,e,"f"),oe(this,hr,t,"f"),oe(this,xt,r,"f"),oe(this,Ri,new Set,"f"),oe(this,$i,null,"f"),oe(this,ba,new Promise((n,a)=>{oe(this,Ai,n,"f"),oe(this,ki,a,"f")}),"f")}async subscribe(){x(this,Jt,"f")&&(x(this,Jt,"f").call(this),oe(this,Jt,void 0,"f")),x(this,ot,"f")&&(clearTimeout(x(this,ot,"f")),oe(this,ot,void 0,"f")),x(this,Zt,"f")&&(clearTimeout(x(this,Zt,"f")),oe(this,Zt,void 0,"f"));try{let t;this.isSurrealDB?t=await x(this,xt,"f").perspectiveSubscribeSurrealQuery(x(this,Ft,"f"),x(this,hr,"f")):t=await x(this,xt,"f").subscribeQuery(x(this,Ft,"f"),x(this,hr,"f")),oe(this,_t,t.subscriptionId,"f"),t.result?(oe(this,$i,t.result,"f"),x(this,va,"m",eo).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),oe(this,ot,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"),oe(this,Jt,x(this,xt,"f").subscribeToQueryUpdates(x(this,_t,"f"),r=>{x(this,ot,"f")&&(clearTimeout(x(this,ot,"f")),oe(this,ot,void 0,"f")),x(this,Ai,"f")&&(x(this,Ai,"f").call(this,!0),oe(this,Ai,void 0,"f"),oe(this,ki,void 0,"f")),!(r.isInit&&x(this,$i,"f"))&&(oe(this,$i,r,"f"),x(this,va,"m",eo).call(this,r))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),x(this,ki,"f")&&(x(this,ki,"f").call(this,t),oe(this,Ai,void 0,"f"),oe(this,ki,void 0,"f")),t}let e=async()=>{if(!x(this,Gr,"f")){try{this.isSurrealDB?await x(this,xt,"f").perspectiveKeepAliveSurrealQuery(x(this,Ft,"f"),x(this,_t,"f")):await x(this,xt,"f").keepAliveQuery(x(this,Ft,"f"),x(this,_t,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",x(this,hr,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(r){console.error("Error during resubscription from keepalive:",r);return}}x(this,Gr,"f")||oe(this,Zt,setTimeout(e,3e4),"f")}};oe(this,Zt,setTimeout(e,3e4),"f")}get id(){return x(this,_t,"f")}get initialized(){return x(this,ba,"f")}get result(){return x(this,$i,"f")}onResult(e){return x(this,Ri,"f").add(e),()=>x(this,Ri,"f").delete(e)}dispose(){oe(this,Gr,!0,"f"),clearTimeout(x(this,Zt,"f")),x(this,Jt,"f")&&x(this,Jt,"f").call(this),x(this,Ri,"f").clear(),x(this,ot,"f")&&(clearTimeout(x(this,ot,"f")),oe(this,ot,void 0,"f")),x(this,_t,"f")&&(this.isSurrealDB?x(this,xt,"f").perspectiveDisposeSurrealQuerySubscription(x(this,Ft,"f"),x(this,_t,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):x(this,xt,"f").disposeQuerySubscription(x(this,Ft,"f"),x(this,_t,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Ft=new WeakMap,_t=new WeakMap,xt=new WeakMap,Ri=new WeakMap,Zt=new WeakMap,Jt=new WeakMap,$i=new WeakMap,Gr=new WeakMap,ba=new WeakMap,Ai=new WeakMap,ki=new WeakMap,ot=new WeakMap,hr=new WeakMap,va=new WeakSet,eo=function i(e){for(let t of x(this,Ri,"f"))try{t(e)}catch(r){console.error("Error in query subscription callback:",r)}};var mr=class{constructor(e,t){re.set(this,void 0),ne.set(this,void 0),Ii.set(this,void 0),Ti.set(this,void 0),Ci.set(this,void 0),Zr.set(this,void 0),oe(this,Ii,[],"f"),oe(this,Ti,[],"f"),oe(this,Ci,[],"f"),oe(this,Zr,[],"f"),oe(this,re,e,"f"),oe(this,ne,t,"f"),this.uuid=x(this,re,"f").uuid,this.name=x(this,re,"f").name,this.owners=x(this,re,"f").owners,this.sharedUrl=x(this,re,"f").sharedUrl,this.neighbourhood=x(this,re,"f").neighbourhood,this.state=x(this,re,"f").state,x(this,ne,"f").addPerspectiveLinkAddedListener(x(this,re,"f").uuid,x(this,Ii,"f")),x(this,ne,"f").addPerspectiveLinkRemovedListener(x(this,re,"f").uuid,x(this,Ti,"f")),x(this,ne,"f").addPerspectiveLinkUpdatedListener(x(this,re,"f").uuid,x(this,Ci,"f")),x(this,ne,"f").addPerspectiveSyncStateChangeListener(x(this,re,"f").uuid,x(this,Zr,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,r,n){return await x(this,ne,"f").executeCommands(x(this,re,"f").uuid,JSON.stringify(e),t,JSON.stringify(r),n)}async get(e){return await x(this,ne,"f").queryLinks(x(this,re,"f").uuid,e)}async infer(e){return await x(this,ne,"f").queryProlog(x(this,re,"f").uuid,e)}async querySurrealDB(e){return await x(this,ne,"f").querySurrealDB(x(this,re,"f").uuid,e)}async add(e,t="shared",r){return await x(this,ne,"f").addLink(x(this,re,"f").uuid,e,t,r)}async addLinks(e,t="shared",r){return await x(this,ne,"f").addLinks(x(this,re,"f").uuid,e,t,r)}async removeLinks(e,t){return await x(this,ne,"f").removeLinks(x(this,re,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await x(this,ne,"f").linkMutations(x(this,re,"f").uuid,e,t)}async addLinkExpression(e,t="shared",r){return await x(this,ne,"f").addLinkExpression(x(this,re,"f").uuid,e,t,r)}async update(e,t,r){return await x(this,ne,"f").updateLink(x(this,re,"f").uuid,e,t,r)}async remove(e,t){return await x(this,ne,"f").removeLink(x(this,re,"f").uuid,e,t)}async createBatch(){return await x(this,ne,"f").createBatch(x(this,re,"f").uuid)}async commitBatch(e){return await x(this,ne,"f").commitBatch(x(this,re,"f").uuid,e)}async getExpression(e){return await x(this,ne,"f").getExpression(e)}async createExpression(e,t){return await x(this,ne,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?x(this,Ii,"f").push(t):e==="link-removed"?x(this,Ti,"f").push(t):e==="link-updated"&&x(this,Ci,"f").push(t)}async addSyncStateChangeListener(e){x(this,Zr,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let r=x(this,Ii,"f").indexOf(t);x(this,Ii,"f").splice(r,1)}else if(e==="link-removed"){let r=x(this,Ti,"f").indexOf(t);x(this,Ti,"f").splice(r,1)}else if(e==="link-updated"){let r=x(this,Ci,"f").indexOf(t);x(this,Ci,"f").splice(r,1)}}async snapshot(){return x(this,ne,"f").snapshotByUUID(x(this,re,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(r=>{delete r.data.__typename});for(let r of t.links)await this.addLinkExpression(r)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let r=new ae({source:e.source,predicate:e.predicate}),n=await this.get(r),a=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,a.push(o);let s=[e];await this.linkMutations({additions:s,removals:a},t)}async sdnaFlows(){return(await this.get(new ae({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return le.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),r=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")r.push(n);else{let s=a.flowable,o=s.source||e;(await this.get(new ae({source:o,predicate:s.predicate,target:s.target}))).length>0&&r.push(n)}}return r}async startFlow(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;if(r.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(r.startAction,t,void 0)}async expressionsInFlowState(e,t){let r=await this.getFlow(e);if(!r)return[];let n=r.states.find(o=>o.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new ae({predicate:a.predicate,target:a.target}))).map(o=>a.source?o.data.target:o.data.source)}async flowState(e,t){let r=await this.getFlow(e);if(!r)throw`Flow "${e}" not found`;for(let n of r.states){let a=n.stateCheck,s=a.source||t;if((await this.get(new ae({source:s,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let r=await this.getFlow(e);if(!r)return[];let n=null;for(let a of r.states){let s=a.stateCheck,o=s.source||t;if((await this.get(new ae({source:o,predicate:s.predicate,target:s.target}))).length>0){n=a.name;break}}return n?r.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,r){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(s=>s.actionName===r);if(!a)throw`Action "${r}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let r of e){let n=await this.get(new ae({source:"ad4m://self",predicate:r}));for(let a of n){let s=a.data.target,o=await this.get(new ae({source:s,predicate:"ad4m://sdna"}));for(let l of o){let c=le.fromUrl(l.data.target).get();typeof c=="string"&&t.push(c)}}}return t}async getSdnaForClass(e){let t=le.from(e);if((await this.get(new ae({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new ae({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=le.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,r,n){return x(this,ne,"f").addSdna(x(this,re,"f").uuid,e,t,r,n)}async addShacl(e,t){let r=t.toLinks(),n=le.fromUrl(`literal://string:shacl://${e}`),a=[...r.map(s=>new Je({source:s.source,predicate:s.predicate,target:s.target})),new Je({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Je({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=le.fromUrl(`literal://string:shacl://${e}`),r=await this.get(new ae({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(r.length===0)return null;let n=r[0].data.target;ee(n);let a=await this.get(new ae({source:n,predicate:"sh://property"})),l=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[n,...a.map(m=>m.data.target)].map(m=>`'${ee(m)}'`).join(", ")}]`,u=(await this.querySurrealDB(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return ii.fromLinks(u,n)}async getAllShacl(){let e=await this.get(new ae({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let r of e){let n=r.data.target,s=le.fromUrl(n).get().replace("shacl://",""),o=await this.getShacl(s);o&&t.push({name:s,shape:o})}return t}async addFlow(e,t){let r=t.toLinks(),n=le.from(e).toUrl(),a=[...r.map(s=>new Je({source:s.source,predicate:s.predicate,target:s.target})),new Je({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Je({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=le.from(e).toUrl(),r=await this.get(new ae({source:t,predicate:"ad4m://flow_uri"}));if(r.length===0)return null;let n=r[0].data.target,a=ee(n),s=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",o=ee(s),l=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${o}')`,u=(await this.querySurrealDB(l)||[]).map(m=>({source:m.source,predicate:m.predicate,target:m.target}));return Sr.fromLinks(u,n)}async subjectClasses(){try{let t=(await this.get(new ae({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(r=>{let a=r.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(r=>r.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,r,n){let a;if(typeof e=="string")a=e,await x(this,ne,"f").createSubject(x(this,re,"f").uuid,JSON.stringify({className:a,initialValues:r}),t,r?JSON.stringify(r):void 0,n);else{let s=e,o=s.className||s.constructor?.className||s.constructor?.prototype?.className||await this.findClassByProperties(s);if(!o)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await x(this,ne,"f").createSubject(x(this,re,"f").uuid,JSON.stringify({className:o,initialValues:r}),t,r?JSON.stringify(r):void 0,n)}return n?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await x(this,ne,"f").getSubjectData(x(this,re,"f").uuid,JSON.stringify({className:e}),t));let r=e,n=r.className||r.constructor?.className||r.constructor?.prototype?.className||await this.findClassByProperties(r);if(!n)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await x(this,ne,"f").getSubjectData(x(this,re,"f").uuid,JSON.stringify({className:n}),t))}async getActionsFromSHACL(e,t){let r=this.escapeRegExp(e),n=new RegExp(`[/:#]${r}Shape$`),a=await this.get(new ae({predicate:t}));for(let s of a)if(n.test(s.data.source)){let o="literal://string:";if(s.data.target.startsWith(o)){let l=s.data.target.slice(o.length),c=l;try{c=decodeURIComponent(l)}catch{}try{return JSON.parse(c)}catch(u){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,u),null}}}return null}async removeSubject(e,t,r){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,r)}async isSubjectInstance(e,t){let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${r}`),!1;if(n.requiredTriples.length===0){let s=`SELECT count() AS count FROM link WHERE in.uri = '${ee(e)}'`,l=(await this.querySurrealDB(s))[0]?.count??0;return(typeof l=="object"&&l?.Int!==void 0?l.Int:l)>0}for(let a of n.requiredTriples){let s=ee(e),o=ee(a.predicate),l;if(a.target){let y=ee(a.target);l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}' AND out.uri = '${y}'`}else l=`SELECT count() AS count FROM link WHERE in.uri = '${s}' AND predicate = '${o}'`;let c=await this.querySurrealDB(l);if(!c||c.length===0)return!1;let u=c[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(t),n=new gn(this,e,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let r=[],n=[],a=new Map,s=new Map,o=new Set;for(let l of t.properties){if(!l.path||!l.name)continue;l.writable&&o.add(l.path),l.adder&&l.adder.length>0?s.set(l.name,{predicate:l.path}):a.set(l.name,{predicate:l.path,resolveLanguage:l.resolveLanguage})}if(t.constructor_actions){for(let l of t.constructor_actions)if(l.predicate){r.push(l.predicate);let c=o.has(l.predicate);l.target&&l.target!=="value"&&!c?n.push({predicate:l.predicate,target:l.target}):n.push({predicate:l.predicate})}}return{requiredPredicates:r,requiredTriples:n,properties:a,relations:s}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}generateSurrealInstanceQuery(e){return e.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${e.requiredTriples.map(r=>{let n=ee(r.predicate);if(r.target){let a=ee(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(r);if(!a)return;let s=ee(e),o=ee(a.predicate),l=`SELECT out.uri AS value FROM link WHERE in.uri = '${s}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(l);if(!c||c.length===0)return;let u=c[0].value;if(a.resolveLanguage&&u)try{let m=await this.getExpression(u);try{return JSON.parse(m.data)}catch{return m.data}}catch{return u}return u}async getRelationValuesViaSurreal(e,t,r){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.relations.get(r);if(!a)return[];let s=ee(e),o=ee(a.predicate),l=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${s}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(l);if(!c||c.length===0)return[];let u=c.map(m=>m.value).filter(m=>m!==""&&m!=="");if(a.condition&&u.length>0)try{let m=[];for(let y of u){let d=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${y.replace(/'/g,"\\'")}'`);d.trim().startsWith("WHERE")&&(d=`array::len(SELECT * FROM link ${d}) > 0`);let f=await this.querySurrealDB(`RETURN ${d}`);(f===!0||Array.isArray(f)&&f.length>0&&f[0]===!0)&&m.push(y)}u=m}catch(m){console.warn(`Failed to apply condition filter for ${r}:`,m)}if(a.instanceFilter)try{let m=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return m?await this.batchCheckSubjectInstances(u,m):this.filterInstancesSequential(u,a.instanceFilter)}catch{return this.filterInstancesSequential(u,a.instanceFilter)}return u}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(l=>`'${ee(l)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(s)).map(l=>l.uri)}let r=[];for(let a of t.requiredTriples){let s=e.map(u=>`'${ee(u)}'`).join(", "),o=ee(a.predicate),l;if(a.target){let u=ee(a.target);l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}' AND out.uri = '${u}'`}else l=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${s}] AND predicate = '${o}'`;let c=await this.querySurrealDB(l);r.push(new Set(c.map(u=>u.uri)))}return r.length===0?e:e.filter(a=>r.every(s=>s.has(a)))}async filterInstancesSequential(e,t){let r=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(e){let t=[],r=typeof e=="function";typeof e=="string"?t=[e]:r?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];for(let a of t){let s=await this.getSubjectClassMetadataFromSDNA(a);if(s){let o=this.generateSurrealInstanceQuery(s),l=await this.querySurrealDB(o);for(let c of l||[])try{let u;r?(u=new e(this,c.base),await u.get()):(u=new gn(this,c.base,a),await u.init()),n.push(u)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let r=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let s=this.generateSurrealInstanceQuery(a),o=await this.querySurrealDB(s);for(let l of o||[])try{let c=new gn(this,l.base,n);await c.init(),r.push(c)}catch{}}}return r}async findClassByProperties(e){let t=[],r=[],a=Object.getPrototypeOf(e)?.constructor,s=a?Hi(a):{};Object.keys(s).length>0?t=Object.keys(s):t=Object.keys(e).filter(m=>!Array.isArray(e[m]));let o=a?Object.fromEntries(Object.entries($t(a)).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany")):{};if(Object.keys(o).length>0?r=Object.keys(o).filter(m=>m!=="isSubjectInstance"):r=Object.keys(e).filter(m=>Array.isArray(e[m])&&m!=="isSubjectInstance"),t.length===0&&r.length===0)return null;let l=`SELECT
486
480
  in.uri AS shape_source,
487
481
  predicate,
488
482
  out.uri AS target
489
483
  FROM link
490
- WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,c=await this.querySurrealDB(l);if(!c||c.length===0)return null;let u=new Map;for(let m of c)if(m.predicate==="rdf://type"&&m.target==="ad4m://SubjectClass"){let y=m.shape_source,d=y.indexOf("://");if(d<0)continue;let p=y.substring(d+3).split("/").pop();if(!p)continue;u.set(p,{shapeUri:y,properties:[],relations:[]})}for(let m of c)if(m.predicate==="sh://property"||m.predicate==="sh://collection"){for(let[y,d]of u)if(m.shape_source.endsWith(`${y}Shape`)){let p=m.target.lastIndexOf(".");if(p<0)continue;let f=m.target.substring(p+1);m.predicate==="sh://property"?d.properties.push(f):d.relations.push(f)}}for(let[m,y]of u){let d=t.every(f=>y.properties.includes(f)),p=r.every(f=>y.relations.includes(f));if(d&&p)return m}return null}async subjectClassesByTemplate(e){try{let t=e.className||e.constructor?.className||e.constructor?.prototype?.className;if(t&&(await this.subjectClasses()).includes(t))return[t]}catch(t){console.warn("subjectClassesByTemplate: className lookup failed:",t)}try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching failed:",t)}return[]}async ensureSDNASubjectClass(e){let t=e.className||e.prototype?.className||e.name;if(!e.generateSHACL)throw new Error(`Class ${e.name} must have generateSHACL(). Use @Model decorator.`);let{shape:r}=e.generateSHACL(),n=JSON.stringify(r.toJSON());await this.addSdna(t,"","subject_class",n)}getNeighbourhoodProxy(){return _(this,ie,"f").getNeighbourhoodProxy(_(this,ee,"f").uuid)}get ai(){return _(this,ie,"f").aiClient}async subscribeInfer(e){let t=new Na(this.uuid,e,_(this,ie,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new Na(this.uuid,e,_(this,ie,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};ee=new WeakMap,ie=new WeakMap,_i=new WeakMap,Ei=new WeakMap,xi=new WeakMap,zr=new WeakMap;var qt=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},M=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)},G,Wr,Kr,Qr,ha,Gr,ga,ma,De=`
484
+ WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,c=await this.querySurrealDB(l);if(!c||c.length===0)return null;let u=new Map;for(let m of c)if(m.predicate==="rdf://type"&&m.target==="ad4m://SubjectClass"){let y=m.shape_source,d=y.indexOf("://");if(d<0)continue;let f=y.substring(d+3).split("/").pop();if(!f)continue;u.set(f,{shapeUri:y,properties:[],relations:[]})}for(let m of c)if(m.predicate==="sh://property"||m.predicate==="sh://collection"){for(let[y,d]of u)if(m.shape_source.endsWith(`${y}Shape`)){let f=m.target.lastIndexOf(".");if(f<0)continue;let g=m.target.substring(f+1);m.predicate==="sh://property"?d.properties.push(g):d.relations.push(g)}}for(let[m,y]of u){let d=t.every(g=>y.properties.includes(g)),f=r.every(g=>y.relations.includes(g));if(d&&f)return m}return null}async subjectClassesByTemplate(e){try{let t=e.className||e.constructor?.className||e.constructor?.prototype?.className;if(t&&(await this.subjectClasses()).includes(t))return[t]}catch(t){console.warn("subjectClassesByTemplate: className lookup failed:",t)}try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching failed:",t)}return[]}async ensureSDNASubjectClass(e){let t=e.className||e.prototype?.className||e.name;if(!e.generateSHACL)throw new Error(`Class ${e.name} must have generateSHACL(). Use @Model decorator.`);let{shape:r}=e.generateSHACL(),n=JSON.stringify(r.toJSON());await this.addSdna(t,"","subject_class",n)}getNeighbourhoodProxy(){return x(this,ne,"f").getNeighbourhoodProxy(x(this,re,"f").uuid)}get ai(){return x(this,ne,"f").aiClient}async subscribeInfer(e){let t=new Ma(this.uuid,e,x(this,ne,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new Ma(this.uuid,e,x(this,ne,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};re=new WeakMap,ne=new WeakMap,Ii=new WeakMap,Ti=new WeakMap,Ci=new WeakMap,Zr=new WeakMap;var Kt=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)},G,Jr,Yr,Xr,wa,en,Sa,_a,Me=`
491
485
  author
492
486
  timestamp
493
487
  status
494
488
  data { source, predicate, target }
495
489
  proof { valid, invalid, signature, key }
496
- `,ar=`
490
+ `,cr=`
497
491
  uuid
498
492
  name
499
493
  sharedUrl
@@ -514,139 +508,139 @@ neighbourhood {
514
508
  }
515
509
  author
516
510
  }
517
- `,Ra=class{constructor(e,t=!0){G.set(this,void 0),Wr.set(this,void 0),Kr.set(this,void 0),Qr.set(this,void 0),ha.set(this,void 0),Gr.set(this,void 0),ga.set(this,void 0),ma.set(this,void 0),qt(this,G,e,"f"),qt(this,Wr,[],"f"),qt(this,Kr,[],"f"),qt(this,Qr,[],"f"),qt(this,ha,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){qt(this,Gr,e,"f")}setNeighbourhoodClient(e){qt(this,ga,e,"f")}setAIClient(e){qt(this,ma,e,"f")}get aiClient(){return M(this,ma,"f")}async all(){let{perspectives:e}=w(await M(this,G,"f").query({query:v`query perspectives {
511
+ `,Fa=class{constructor(e,t=!0){G.set(this,void 0),Jr.set(this,void 0),Yr.set(this,void 0),Xr.set(this,void 0),wa.set(this,void 0),en.set(this,void 0),Sa.set(this,void 0),_a.set(this,void 0),Kt(this,G,e,"f"),Kt(this,Jr,[],"f"),Kt(this,Yr,[],"f"),Kt(this,Xr,[],"f"),Kt(this,wa,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Kt(this,en,e,"f")}setNeighbourhoodClient(e){Kt(this,Sa,e,"f")}setAIClient(e){Kt(this,_a,e,"f")}get aiClient(){return q(this,_a,"f")}async all(){let{perspectives:e}=b(await q(this,G,"f").query({query:v`query perspectives {
518
512
  perspectives {
519
- ${ar}
513
+ ${cr}
520
514
  }
521
- }`}));return e.map(t=>new fr(t,this))}async byUUID(e){let{perspective:t}=w(await M(this,G,"f").query({query:v`query perspective($uuid: String!) {
515
+ }`}));return e.map(t=>new mr(t,this))}async byUUID(e){let{perspective:t}=b(await q(this,G,"f").query({query:v`query perspective($uuid: String!) {
522
516
  perspective(uuid: $uuid) {
523
- ${ar}
517
+ ${cr}
524
518
  }
525
- }`,variables:{uuid:e}}));return t?new fr(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=w(await M(this,G,"f").query({query:v`query perspectiveSnapshot($uuid: String!) {
519
+ }`,variables:{uuid:e}}));return t?new mr(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=b(await q(this,G,"f").query({query:v`query perspectiveSnapshot($uuid: String!) {
526
520
  perspectiveSnapshot(uuid: $uuid) {
527
- links { ${De} }
521
+ links { ${Me} }
528
522
  }
529
- }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectivePublishSnapshot($uuid: String!) {
523
+ }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectivePublishSnapshot($uuid: String!) {
530
524
  perspectivePublishSnapshot(uuid: $uuid)
531
- }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=w(await M(this,G,"f").query({query:v`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
525
+ }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:r}=b(await q(this,G,"f").query({query:v`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
532
526
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
533
- ${De}
527
+ ${Me}
534
528
  }
535
- }`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=w(await M(this,G,"f").query({query:v`query perspectiveQueryProlog($uuid: String!, $query: String!) {
529
+ }`,variables:{uuid:e,query:t}}));return r}async queryProlog(e,t){let{perspectiveQueryProlog:r}=b(await q(this,G,"f").query({query:v`query perspectiveQueryProlog($uuid: String!, $query: String!) {
536
530
  perspectiveQueryProlog(uuid: $uuid, query: $query)
537
- }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=w(await M(this,G,"f").query({query:v`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
531
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:r}=b(await q(this,G,"f").query({query:v`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
538
532
  perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
539
- }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
533
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(r)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:r}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
540
534
  perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
541
535
  subscriptionId
542
536
  result
543
537
  }
544
- }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(l){console.error("Error parsing perspectiveSubscribeQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
538
+ }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(l){console.error("Error parsing perspectiveSubscribeQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:r}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
545
539
  perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
546
540
  subscriptionId
547
541
  result
548
542
  }
549
- }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(l){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
543
+ }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=r,s=a,o=!1;s.startsWith("#init#")&&(s=s.substring(6),o=!0);try{s=JSON.parse(s)}catch(l){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",l)}return{subscriptionId:n,result:s,isInit:o}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:r}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
550
544
  perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
551
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
545
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:r}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
552
546
  perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
553
- }`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=M(this,G,"f").subscribe({query:v`
547
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}subscribeToQueryUpdates(e,t){let r=q(this,G,"f").subscribe({query:v`
554
548
  subscription perspectiveQuerySubscription($subscriptionId: String!) {
555
549
  perspectiveQuerySubscription(subscriptionId: $subscriptionId)
556
550
  }
557
- `,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,s=!1;a.startsWith("#init#")&&(a=a.substring(6),s=!0);try{a=JSON.parse(a),s&&typeof a=="object"&&(a.isInit=!0)}catch(o){console.error("Error parsing perspectiveQuerySubscription:",o)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>r.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
551
+ `,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,s=!1;a.startsWith("#init#")&&(a=a.substring(6),s=!0);try{a=JSON.parse(a),s&&typeof a=="object"&&(a.isInit=!0)}catch(o){console.error("Error parsing perspectiveQuerySubscription:",o)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>r.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:r}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
558
552
  perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
559
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
553
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:r}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
560
554
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
561
- }`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAdd($name: String!) {
555
+ }`,variables:{uuid:e,subscriptionId:t}}));return r}async add(e){let{perspectiveAdd:t}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveAdd($name: String!) {
562
556
  perspectiveAdd(name: $name) {
563
- ${ar}
557
+ ${cr}
564
558
  }
565
- }`,variables:{name:e}}));return new fr(t,this)}async update(e,t){let{perspectiveUpdate:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveUpdate($uuid: String!, $name: String!) {
559
+ }`,variables:{name:e}}));return new mr(t,this)}async update(e,t){let{perspectiveUpdate:r}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveUpdate($uuid: String!, $name: String!) {
566
560
  perspectiveUpdate(uuid: $uuid, name: $name) {
567
- ${ar}
561
+ ${cr}
568
562
  }
569
- }`,variables:{uuid:e,name:t}}));return new fr(r,this)}async remove(e){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemove($uuid: String!) {
563
+ }`,variables:{uuid:e,name:t}}));return new mr(r,this)}async remove(e){return b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveRemove($uuid: String!) {
570
564
  perspectiveRemove(uuid: $uuid)
571
- }`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
565
+ }`,variables:{uuid:e}}))}async addLink(e,t,r="shared",n){let{perspectiveAddLink:a}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
572
566
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
573
- ${De}
567
+ ${Me}
574
568
  }
575
- }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
569
+ }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async addLinks(e,t,r="shared",n){let{perspectiveAddLinks:a}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
576
570
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
577
- ${De}
571
+ ${Me}
578
572
  }
579
- }`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
573
+ }`,variables:{uuid:e,links:t,status:r,batchId:n}}));return a}async removeLinks(e,t,r){let{perspectiveRemoveLinks:n}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
580
574
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
581
- ${De}
575
+ ${Me}
582
576
  }
583
- }`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
577
+ }`,variables:{uuid:e,links:t,batchId:r}}));return n}async linkMutations(e,t,r){let{perspectiveLinkMutations:n}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
584
578
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
585
579
  additions {
586
- ${De}
580
+ ${Me}
587
581
  }
588
582
  removals {
589
- ${De}
583
+ ${Me}
590
584
  }
591
585
  }
592
- }`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
586
+ }`,variables:{uuid:e,mutations:t,status:r}}));return n}async addLinkExpression(e,t,r="shared",n){let{perspectiveAddLinkExpression:a}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
593
587
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
594
- ${De}
588
+ ${Me}
595
589
  }
596
- }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
590
+ }`,variables:{uuid:e,link:t,status:r,batchId:n}}));return a}async updateLink(e,t,r,n){let{perspectiveUpdateLink:a}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
597
591
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
598
- ${De}
592
+ ${Me}
599
593
  }
600
- }`,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}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
594
+ }`,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}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
601
595
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
602
- }`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
596
+ }`,variables:{uuid:e,link:t,batchId:r}}));return n}async addSdna(e,t,r,n,a){return b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
603
597
  perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
604
- }`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
598
+ }`,variables:{uuid:e,name:t,sdnaCode:r||"",sdnaType:n,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,r,n,a){return b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
605
599
  perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
606
- }`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
600
+ }`,variables:{uuid:e,commands:t,expression:r,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,r,n,a){return b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
607
601
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
608
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
602
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:r,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,r){return b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
609
603
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
610
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await M(this,Gr,"f").get(e)}async createExpression(e,t){return await M(this,Gr,"f").create(e,t)}addPerspectiveAddedListener(e){M(this,Wr,"f").push(e)}subscribePerspectiveAdded(){M(this,G,"f").subscribe({query:v` subscription {
611
- perspectiveAdded { ${ar} }
604
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:r}})).perspectiveGetSubjectData}async getExpression(e){return await q(this,en,"f").get(e)}async createExpression(e,t){return await q(this,en,"f").create(e,t)}addPerspectiveAddedListener(e){q(this,Jr,"f").push(e)}subscribePerspectiveAdded(){q(this,G,"f").subscribe({query:v` subscription {
605
+ perspectiveAdded { ${cr} }
612
606
  }
613
- `}).subscribe({next:e=>{M(this,Wr,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){M(this,Kr,"f").push(e)}subscribePerspectiveUpdated(){M(this,G,"f").subscribe({query:v` subscription {
614
- perspectiveUpdated { ${ar} }
607
+ `}).subscribe({next:e=>{q(this,Jr,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){q(this,Yr,"f").push(e)}subscribePerspectiveUpdated(){q(this,G,"f").subscribe({query:v` subscription {
608
+ perspectiveUpdated { ${cr} }
615
609
  }
616
- `}).subscribe({next:e=>{M(this,Kr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){M(this,ha,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){M(this,G,"f").subscribe({query:v` subscription {
610
+ `}).subscribe({next:e=>{q(this,Yr,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){q(this,wa,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){q(this,G,"f").subscribe({query:v` subscription {
617
611
  perspectiveSyncStateChange(uuid: "${e}")
618
612
  }
619
- `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){M(this,Qr,"f").push(e)}subscribePerspectiveRemoved(){M(this,G,"f").subscribe({query:v` subscription {
613
+ `}).subscribe({next:r=>{t.forEach(n=>{n(r.data.perspectiveSyncStateChange)})},error:r=>console.error(r)}),await new Promise(r=>setTimeout(r,500))}addPerspectiveRemovedListener(e){q(this,Xr,"f").push(e)}subscribePerspectiveRemoved(){q(this,G,"f").subscribe({query:v` subscription {
620
614
  perspectiveRemoved
621
615
  }
622
- `}).subscribe({next:e=>{M(this,Qr,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){M(this,G,"f").subscribe({query:v` subscription {
623
- perspectiveLinkAdded(uuid: "${e}") { ${De} }
616
+ `}).subscribe({next:e=>{q(this,Xr,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){q(this,G,"f").subscribe({query:v` subscription {
617
+ perspectiveLinkAdded(uuid: "${e}") { ${Me} }
624
618
  }
625
- `}).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){M(this,G,"f").subscribe({query:v` subscription {
626
- perspectiveLinkRemoved(uuid: "${e}") { ${De} }
619
+ `}).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){q(this,G,"f").subscribe({query:v` subscription {
620
+ perspectiveLinkRemoved(uuid: "${e}") { ${Me} }
627
621
  }
628
- `}).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){M(this,G,"f").subscribe({query:v` subscription {
622
+ `}).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){q(this,G,"f").subscribe({query:v` subscription {
629
623
  perspectiveLinkUpdated(uuid: "${e}") {
630
624
  oldLink {
631
- ${De}
625
+ ${Me}
632
626
  }
633
627
  newLink {
634
- ${De}
628
+ ${Me}
635
629
  }
636
630
  }
637
631
  }
638
- `}).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 zs(M(this,ga,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCreateBatch($uuid: String!) {
632
+ `}).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 Xs(q(this,Sa,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveCreateBatch($uuid: String!) {
639
633
  perspectiveCreateBatch(uuid: $uuid)
640
- }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=w(await M(this,G,"f").mutate({mutation:v`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
634
+ }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:r}=b(await q(this,G,"f").mutate({mutation:v`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
641
635
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
642
636
  additions {
643
- ${De}
637
+ ${Me}
644
638
  }
645
639
  removals {
646
- ${De}
640
+ ${Me}
647
641
  }
648
642
  }
649
- }`,variables:{uuid:e,batchId:t}}));return r}};G=new WeakMap,Wr=new WeakMap,Kr=new WeakMap,Qr=new WeakMap,ha=new WeakMap,Gr=new WeakMap,ga=new WeakMap,ma=new WeakMap;var Qn=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},Z=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)},J,Zr,Jr,Yr,jr=`
643
+ }`,variables:{uuid:e,batchId:t}}));return r}};G=new WeakMap,Jr=new WeakMap,Yr=new WeakMap,Xr=new WeakMap,wa=new WeakMap,en=new WeakMap,Sa=new WeakMap,_a=new WeakMap;var ea=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},Z=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,tn,rn,nn,Vr=`
650
644
  did
651
645
  directMessageLanguage
652
646
  perspective {
@@ -660,7 +654,7 @@ neighbourhood {
660
654
  }
661
655
  }
662
656
  }
663
- `,Gn=`
657
+ `,ta=`
664
658
  requestId
665
659
  revoked
666
660
  auth {
@@ -676,158 +670,159 @@ neighbourhood {
676
670
  can
677
671
  }
678
672
  }
679
- `,sr=`
673
+ `,lr=`
680
674
  isInitialized
681
675
  isUnlocked
682
676
  did
683
677
  didDocument
684
678
  error
685
- `,Zn=`
679
+ `,ia=`
686
680
  did
687
681
  didSigningKeyId
688
682
  deviceKeyType
689
683
  deviceKey
690
684
  deviceKeySignedByDid
691
685
  didSignedByDeviceKey
692
- `,zd=`
686
+ `,dp=`
693
687
  signature
694
688
  publicKey
695
- `,vn=class{constructor(e,t=!0){J.set(this,void 0),Zr.set(this,void 0),Jr.set(this,void 0),Yr.set(this,void 0),Qn(this,J,e,"f"),Qn(this,Jr,[],"f"),Qn(this,Yr,[],"f"),Qn(this,Zr,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=w(await Z(this,J,"f").query({query:v`query agent { agent { ${jr} } }`})),t=new Zt(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=w(await Z(this,J,"f").query({query:v`query agentStatus {
689
+ `,xn=class{constructor(e,t=!0){X.set(this,void 0),tn.set(this,void 0),rn.set(this,void 0),nn.set(this,void 0),ea(this,X,e,"f"),ea(this,rn,[],"f"),ea(this,nn,[],"f"),ea(this,tn,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=b(await Z(this,X,"f").query({query:v`query agent { agent { ${Vr} } }`})),t=new ti(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=b(await Z(this,X,"f").query({query:v`query agentStatus {
696
690
  agentStatus {
697
- ${sr}
691
+ ${lr}
698
692
  }
699
- }`}));return new ot(e)}async generate(e){let{agentGenerate:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentGenerate(
693
+ }`}));return new lt(e)}async generate(e){let{agentGenerate:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentGenerate(
700
694
  $passphrase: String!
701
695
  ) {
702
696
  agentGenerate(passphrase: $passphrase) {
703
- ${sr}
697
+ ${lr}
704
698
  }
705
- }`,variables:{passphrase:e}}));return new ot(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentImport(
699
+ }`,variables:{passphrase:e}}));return new lt(t)}async import(e){let{did:t,didDocument:r,keystore:n,passphrase:a}=e,{agentImport:s}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentImport(
706
700
  $did: String!,
707
701
  $didDocument: String!,
708
702
  $keystore: String!,
709
703
  $passphrase: String!
710
704
  ) {
711
705
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
712
- ${sr}
706
+ ${lr}
713
707
  }
714
- }`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new ot(s)}async lock(e){let{agentLock:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentLock($passphrase: String!) {
708
+ }`,variables:{did:t,didDocument:r,keystore:n,passphrase:a}}));return new lt(s)}async lock(e){let{agentLock:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentLock($passphrase: String!) {
715
709
  agentLock(passphrase: $passphrase) {
716
- ${sr}
710
+ ${lr}
717
711
  }
718
- }`,variables:{passphrase:e}}));return new ot(t)}async unlock(e,t=!0){let{agentUnlock:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
712
+ }`,variables:{passphrase:e}}));return new lt(t)}async unlock(e,t=!0){let{agentUnlock:r}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
719
713
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
720
- ${sr}
714
+ ${lr}
721
715
  }
722
- }`,variables:{passphrase:e,holochain:t}}));return new ot(r)}async byDID(e){let{agentByDID:t}=w(await Z(this,J,"f").query({query:v`query agentByDID($did: String!) {
716
+ }`,variables:{passphrase:e,holochain:t}}));return new lt(r)}async byDID(e){let{agentByDID:t}=b(await Z(this,X,"f").query({query:v`query agentByDID($did: String!) {
723
717
  agentByDID(did: $did) {
724
- ${jr}
718
+ ${Vr}
725
719
  }
726
- }`,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}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
720
+ }`,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}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
727
721
  agentUpdatePublicPerspective(perspective: $perspective) {
728
- ${jr}
722
+ ${Vr}
729
723
  }
730
- }`,variables:{perspective:t}})),n=r,a=new Zt(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ra(Z(this,J,"f")),r=new vn(Z(this,J,"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}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
724
+ }`,variables:{perspective:t}})),n=r,a=new ti(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Fa(Z(this,X,"f")),r=new xn(Z(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}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
731
725
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
732
- ${jr}
726
+ ${Vr}
733
727
  }
734
- }`,variables:{directMessageLanguage:e}})),r=t,n=new Zt(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
728
+ }`,variables:{directMessageLanguage:e}})),r=t,n=new ti(r.did,r.perspective);return n.directMessageLanguage=r.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
735
729
  agentAddEntanglementProofs(proofs: $proofs) {
736
- ${Zn}
730
+ ${ia}
737
731
  }
738
- }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
732
+ }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
739
733
  agentDeleteEntanglementProofs(proofs: $proofs) {
740
- ${Zn}
734
+ ${ia}
741
735
  }
742
- }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=w(await Z(this,J,"f").query({query:v`query agentGetEntanglementProofs {
736
+ }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=b(await Z(this,X,"f").query({query:v`query agentGetEntanglementProofs {
743
737
  agentGetEntanglementProofs {
744
- ${Zn}
738
+ ${ia}
745
739
  }
746
- }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
740
+ }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:r}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
747
741
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
748
- ${Zn}
742
+ ${ia}
749
743
  }
750
- }`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){Z(this,Jr,"f").push(e)}addAppChangedListener(e){Z(this,Zr,"f").push(e)}subscribeAgentUpdated(){Z(this,J,"f").subscribe({query:v` subscription {
751
- agentUpdated { ${jr} }
744
+ }`,variables:{deviceKey:e,deviceKeyType:t}}));return r}addUpdatedListener(e){Z(this,rn,"f").push(e)}addAppChangedListener(e){Z(this,tn,"f").push(e)}subscribeAgentUpdated(){Z(this,X,"f").subscribe({query:v` subscription {
745
+ agentUpdated { ${Vr} }
752
746
  }
753
- `}).subscribe({next:e=>{let t=e.data.agentUpdated;Z(this,Jr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){Z(this,J,"f").subscribe({query:v` subscription {
747
+ `}).subscribe({next:e=>{let t=e.data.agentUpdated;Z(this,rn,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){Z(this,X,"f").subscribe({query:v` subscription {
754
748
  agentAppsChanged {
755
- ${Gn}
749
+ ${ta}
756
750
  }
757
751
  }
758
- `}).subscribe({next:e=>{Z(this,Zr,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){Z(this,Yr,"f").push(e)}subscribeAgentStatusChanged(){Z(this,J,"f").subscribe({query:v` subscription {
759
- agentStatusChanged { ${sr} }
752
+ `}).subscribe({next:e=>{Z(this,tn,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){Z(this,nn,"f").push(e)}subscribeAgentStatusChanged(){Z(this,X,"f").subscribe({query:v` subscription {
753
+ agentStatusChanged { ${lr} }
760
754
  }
761
- `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;Z(this,Yr,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=w(await Z(this,J,"f").mutate({mutation:v`
755
+ `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;Z(this,nn,"f").forEach(r=>{r(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=b(await Z(this,X,"f").mutate({mutation:v`
762
756
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
763
757
  agentRequestCapability(authInfo: $authInfo)
764
758
  }
765
- `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=w(await Z(this,J,"f").mutate({mutation:v`
759
+ `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=b(await Z(this,X,"f").mutate({mutation:v`
766
760
  mutation agentPermitCapability($auth: String!) {
767
761
  agentPermitCapability(auth: $auth)
768
762
  }
769
- `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=w(await Z(this,J,"f").mutate({mutation:v`
763
+ `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:r}=b(await Z(this,X,"f").mutate({mutation:v`
770
764
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
771
765
  agentGenerateJwt(requestId: $requestId, rand: $rand)
772
766
  }
773
- `,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=w(await Z(this,J,"f").mutate({mutation:v`query agentGetApps {
767
+ `,variables:{requestId:e,rand:t}}));return r}async getApps(){let{agentGetApps:e}=b(await Z(this,X,"f").mutate({mutation:v`query agentGetApps {
774
768
  agentGetApps {
775
- ${Gn}
769
+ ${ta}
776
770
  }
777
- }`}));return e}async removeApp(e){let{agentRemoveApp:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentRemoveApp($requestId: String!) {
771
+ }`}));return e}async removeApp(e){let{agentRemoveApp:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentRemoveApp($requestId: String!) {
778
772
  agentRemoveApp(requestId: $requestId) {
779
- ${Gn}
773
+ ${ta}
780
774
  }
781
- }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentRevokeToken($requestId: String!) {
775
+ }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentRevokeToken($requestId: String!) {
782
776
  agentRevokeToken(requestId: $requestId) {
783
- ${Gn}
777
+ ${ta}
784
778
  }
785
- }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=w(await Z(this,J,"f").mutate({mutation:v`
779
+ }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=b(await Z(this,X,"f").mutate({mutation:v`
786
780
  query agentIsLocked {
787
781
  agentIsLocked
788
782
  }
789
- `}));return e}async signMessage(e){let{agentSignMessage:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation agentSignMessage($message: String!) {
783
+ `}));return e}async signMessage(e){let{agentSignMessage:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation agentSignMessage($message: String!) {
790
784
  agentSignMessage(message: $message) {
791
- ${zd}
785
+ ${dp}
792
786
  }
793
- }`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
787
+ }`,variables:{message:e}}));return t}async createUser(e,t,r){let{runtimeCreateUser:n}=b(await Z(this,X,"f").mutate({mutation:v`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
794
788
  runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
795
789
  did
796
790
  success
797
791
  error
798
792
  }
799
- }`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeLoginUser($email: String!, $password: String!) {
793
+ }`,variables:{email:e,password:t,appInfo:r}}));return n}async loginUser(e,t){let{runtimeLoginUser:r}=b(await Z(this,X,"f").mutate({mutation:v`mutation runtimeLoginUser($email: String!, $password: String!) {
800
794
  runtimeLoginUser(email: $email, password: $password)
801
- }`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
795
+ }`,variables:{email:e,password:t}}));return r}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:r}=b(await Z(this,X,"f").mutate({mutation:v`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
802
796
  runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
803
797
  success
804
798
  message
805
799
  requiresPassword
806
800
  isExistingUser
807
801
  }
808
- }`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
802
+ }`,variables:{email:e,appInfo:t}}));return r}async verifyEmailCode(e,t,r){let{runtimeVerifyEmailCode:n}=b(await Z(this,X,"f").mutate({mutation:v`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
809
803
  runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
810
- }`,variables:{email:e,code:t,verificationType:r}}));return n}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=w(await Z(this,J,"f").query({query:v`query runtimeHostingUserInfo {
804
+ }`,variables:{email:e,code:t,verificationType:r}}));return n}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=b(await Z(this,X,"f").query({query:v`query runtimeHostingUserInfo {
811
805
  runtimeHostingUserInfo {
812
806
  email
813
807
  remainingCredits
814
808
  hotWalletAddress
809
+ freeAccess
815
810
  }
816
- }`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeSetHotWalletAddress($address: String!) {
811
+ }`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation runtimeSetHotWalletAddress($address: String!) {
817
812
  runtimeSetHotWalletAddress(address: $address)
818
- }`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=w(await Z(this,J,"f").mutate({mutation:v`mutation runtimeRequestPayment($amountHOT: String!) {
813
+ }`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=b(await Z(this,X,"f").mutate({mutation:v`mutation runtimeRequestPayment($amountHOT: String!) {
819
814
  runtimeRequestPayment(amountHOT: $amountHOT) {
820
815
  success
821
816
  message
822
817
  }
823
- }`,variables:{amountHOT:e}}));return t}};J=new WeakMap,Zr=new WeakMap,Jr=new WeakMap,Yr=new WeakMap;var Wd=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},Ht=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)},pt,cc=`
818
+ }`,variables:{amountHOT:e}}));return t}};X=new WeakMap,tn=new WeakMap,rn=new WeakMap,nn=new WeakMap;var pp=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},Qt=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,xc=`
824
819
  name
825
820
  address
826
821
  settings
827
822
  icon { code }
828
823
  constructorIcon { code }
829
824
  settingsIcon { code }
830
- `,lc=`
825
+ `,Ec=`
831
826
  name
832
827
  address
833
828
  description
@@ -837,45 +832,45 @@ neighbourhood {
837
832
  templateAppliedParams
838
833
  possibleTemplateParams
839
834
  sourceCodeLink
840
- `,Ks=class{constructor(e){pt.set(this,void 0),Wd(this,pt,e,"f")}async byAddress(e){let{language:t}=w(await Ht(this,pt,"f").query({query:v`query byAddress($address: String!) {
835
+ `,to=class{constructor(e){yt.set(this,void 0),pp(this,yt,e,"f")}async byAddress(e){let{language:t}=b(await Qt(this,yt,"f").query({query:v`query byAddress($address: String!) {
841
836
  language(address: $address) {
842
- ${cc}
837
+ ${xc}
843
838
  }
844
- }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=w(await Ht(this,pt,"f").query({query:v`query byFilter($filter: String!) {
839
+ }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=b(await Qt(this,yt,"f").query({query:v`query byFilter($filter: String!) {
845
840
  languages(filter: $filter) {
846
- ${cc}
841
+ ${xc}
847
842
  }
848
- }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation writeSettings($languageAddress: String!, $settings: String!) {
843
+ }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:r}=b(await Qt(this,yt,"f").mutate({mutation:v`mutation writeSettings($languageAddress: String!, $settings: String!) {
849
844
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
850
- }`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languageApplyTemplateAndPublish(
845
+ }`,variables:{languageAddress:e,settings:t}}));return r}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:r}=b(await Qt(this,yt,"f").mutate({mutation:v`mutation languageApplyTemplateAndPublish(
851
846
  $sourceLanguageHash: String!,
852
847
  $templateData: String!,
853
848
  ) {
854
849
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
855
850
  name, address
856
851
  }
857
- }`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languagePublish(
852
+ }`,variables:{sourceLanguageHash:e,templateData:t}}));return r}async publish(e,t){let{languagePublish:r}=b(await Qt(this,yt,"f").mutate({mutation:v`mutation languagePublish(
858
853
  $languagePath: String!,
859
854
  $languageMeta: LanguageMetaInput!,
860
855
  ) {
861
856
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
862
- ${lc}
857
+ ${Ec}
863
858
  }
864
- }`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=w(await Ht(this,pt,"f").query({query:v`query languageMeta(
859
+ }`,variables:{languagePath:e,languageMeta:t}}));return r}async meta(e){let{languageMeta:t}=b(await Qt(this,yt,"f").query({query:v`query languageMeta(
865
860
  $address: String!,
866
861
  ) {
867
862
  languageMeta(address: $address) {
868
- ${lc}
863
+ ${Ec}
869
864
  }
870
- }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=w(await Ht(this,pt,"f").query({query:v`query languageSource(
865
+ }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=b(await Qt(this,yt,"f").query({query:v`query languageSource(
871
866
  $address: String!,
872
867
  ) {
873
868
  languageSource(address: $address)
874
- }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=w(await Ht(this,pt,"f").mutate({mutation:v`mutation languageRemove(
869
+ }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=b(await Qt(this,yt,"f").mutate({mutation:v`mutation languageRemove(
875
870
  $address: String!,
876
871
  ) {
877
872
  languageRemove(address: $address)
878
- }`,variables:{address:e}}));return t}};pt=new WeakMap;var Kd=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,pr,Qs=class{constructor(e){Fe.set(this,void 0),pr.set(this,new Map),Kd(this,Fe,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodPublishFromPerspective(
873
+ }`,variables:{address:e}}));return t}};yt=new WeakMap;var fp=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},Oe=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,gr,io=class{constructor(e){Be.set(this,void 0),gr.set(this,new Map),fp(this,Be,e,"f")}async publishFromPerspective(e,t,r){let{neighbourhoodPublishFromPerspective:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodPublishFromPerspective(
879
874
  $linkLanguage: String!,
880
875
  $meta: PerspectiveInput!,
881
876
  $perspectiveUUID: String!
@@ -885,7 +880,7 @@ neighbourhood {
885
880
  meta: $meta,
886
881
  perspectiveUUID: $perspectiveUUID
887
882
  )
888
- }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodJoinFromUrl($url: String!) {
883
+ }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:r}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodJoinFromUrl($url: String!) {
889
884
  neighbourhoodJoinFromUrl(url: $url) {
890
885
  uuid
891
886
  name
@@ -907,11 +902,11 @@ neighbourhood {
907
902
  author
908
903
  }
909
904
  }
910
- }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
905
+ }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=b(await Oe(this,Be,"f").query({query:v`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
911
906
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
912
- }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
907
+ }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=b(await Oe(this,Be,"f").query({query:v`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
913
908
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
914
- }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=w(await Ne(this,Fe,"f").query({query:v`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
909
+ }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=b(await Oe(this,Be,"f").query({query:v`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
915
910
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
916
911
  did
917
912
  status {
@@ -928,7 +923,7 @@ neighbourhood {
928
923
  proof { valid, invalid, signature, key }
929
924
  }
930
925
  }
931
- }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatus(
926
+ }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:r}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatus(
932
927
  $perspectiveUUID: String!,
933
928
  $status: PerspectiveInput!
934
929
  ) {
@@ -936,7 +931,7 @@ neighbourhood {
936
931
  perspectiveUUID: $perspectiveUUID,
937
932
  status: $status
938
933
  )
939
- }`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatusU(
934
+ }`,variables:{perspectiveUUID:e,status:t}}));return r}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:r}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSetOnlineStatusU(
940
935
  $perspectiveUUID: String!,
941
936
  $status: PerspectiveUnsignedInput!
942
937
  ) {
@@ -944,7 +939,7 @@ neighbourhood {
944
939
  perspectiveUUID: $perspectiveUUID,
945
940
  status: $status
946
941
  )
947
- }`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendSignal(
942
+ }`,variables:{perspectiveUUID:e,status:t}}));return r}async sendSignal(e,t,r){let{neighbourhoodSendSignal:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSendSignal(
948
943
  $perspectiveUUID: String!,
949
944
  $remoteAgentDid: String!,
950
945
  $payload: PerspectiveInput!
@@ -954,7 +949,7 @@ neighbourhood {
954
949
  remoteAgentDid: $remoteAgentDid,
955
950
  payload: $payload
956
951
  )
957
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendSignalU(
952
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendSignalU(e,t,r){let{neighbourhoodSendSignalU:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSendSignalU(
958
953
  $perspectiveUUID: String!,
959
954
  $remoteAgentDid: String!,
960
955
  $payload: PerspectiveUnsignedInput!
@@ -964,7 +959,7 @@ neighbourhood {
964
959
  remoteAgentDid: $remoteAgentDid,
965
960
  payload: $payload
966
961
  )
967
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcast(
962
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:r}}));return n}async sendBroadcast(e,t,r=!1){let{neighbourhoodSendBroadcast:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcast(
968
963
  $perspectiveUUID: String!,
969
964
  $payload: PerspectiveInput!,
970
965
  $loopback: Boolean
@@ -974,7 +969,7 @@ neighbourhood {
974
969
  payload: $payload,
975
970
  loopback: $loopback
976
971
  )
977
- }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=w(await Ne(this,Fe,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcastU(
972
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}async sendBroadcastU(e,t,r=!1){let{neighbourhoodSendBroadcastU:n}=b(await Oe(this,Be,"f").mutate({mutation:v`mutation neighbourhoodSendBroadcastU(
978
973
  $perspectiveUUID: String!,
979
974
  $payload: PerspectiveUnsignedInput!,
980
975
  $loopback: Boolean
@@ -984,7 +979,7 @@ neighbourhood {
984
979
  payload: $payload,
985
980
  loopback: $loopback
986
981
  )
987
- }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Ne(this,pr,"f").get(e);if(r)for(let n of r)try{n(t)}catch(a){console.error("Error in signal handler:",a)}}async subscribeToSignals(e){let t=this;Ne(this,Fe,"f").subscribe({query:v`subscription neighbourhoodSignal($perspectiveUUID: String!) {
982
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:r}}));return n}dispatchSignal(e,t){let r=Oe(this,gr,"f").get(e);if(r)for(let n of r)try{n(t)}catch(a){console.error("Error in signal handler:",a)}}async subscribeToSignals(e){let t=this;Oe(this,Be,"f").subscribe({query:v`subscription neighbourhoodSignal($perspectiveUUID: String!) {
988
983
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
989
984
  author
990
985
  timestamp
@@ -999,7 +994,7 @@ neighbourhood {
999
994
  }
1000
995
  proof { valid, invalid, signature, key }
1001
996
  }
1002
- }`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{try{let{neighbourhoodSignal:n}=w(r);t.dispatchSignal(e,n)}catch(n){console.error("Error in signal subscription:",n)}},error:r=>{console.error("Signal subscription error for perspective",e,r)}})}async addSignalHandler(e,t){let r=Ne(this,pr,"f").get(e);r?r.push(t):(r=[],Ne(this,pr,"f").set(e,r),r.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let r=Ne(this,pr,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};Fe=new WeakMap,pr=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},U=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,Xr,en,tn,Ol,Yn=`
997
+ }`,variables:{perspectiveUUID:e}}).subscribe({next:r=>{try{let{neighbourhoodSignal:n}=b(r);t.dispatchSignal(e,n)}catch(n){console.error("Error in signal subscription:",n)}},error:r=>{console.error("Signal subscription error for perspective",e,r)}})}async addSignalHandler(e,t){let r=Oe(this,gr,"f").get(e);r?r.push(t):(r=[],Oe(this,gr,"f").set(e,r),r.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let r=Oe(this,gr,"f").get(e);if(r){let n=r.indexOf(t);n>-1&&r.splice(n,1)}}};Be=new WeakMap,gr=new WeakMap;var ra=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},N=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)},D,an,sn,on,Zl,na=`
1003
998
  author
1004
999
  timestamp
1005
1000
  data {
@@ -1011,7 +1006,7 @@ data {
1011
1006
  }
1012
1007
  }
1013
1008
  proof { valid, invalid, signature, key }
1014
- `,Qd=`
1009
+ `,hp=`
1015
1010
  description
1016
1011
  appName
1017
1012
  appUrl
@@ -1020,72 +1015,74 @@ trigger
1020
1015
  perspectiveIds
1021
1016
  webhookUrl
1022
1017
  webhookAuth
1023
- `,Dl=`
1018
+ `,Jl=`
1024
1019
  id
1025
1020
  granted
1026
- ${Qd}
1027
- `,Gd=`
1028
- notification { ${Dl} }
1021
+ ${hp}
1022
+ `,gp=`
1023
+ notification { ${Jl} }
1029
1024
  perspectiveId
1030
1025
  triggerMatch
1031
- `,Gs=class{constructor(e,t=!0){z.set(this,void 0),Xr.set(this,void 0),en.set(this,void 0),tn.set(this,void 0),Ol.set(this,void 0),Jn(this,z,e,"f"),Jn(this,Xr,[],"f"),Jn(this,en,[],"f"),Jn(this,tn,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=w(await U(this,z,"f").query({query:v`query runtimeInfo {
1026
+ `,ro=class{constructor(e,t=!0){D.set(this,void 0),an.set(this,void 0),sn.set(this,void 0),on.set(this,void 0),Zl.set(this,void 0),ra(this,D,e,"f"),ra(this,an,[],"f"),ra(this,sn,[],"f"),ra(this,on,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=b(await N(this,D,"f").query({query:v`query runtimeInfo {
1032
1027
  runtimeInfo {
1033
1028
  ad4mExecutorVersion,
1034
1029
  isInitialized,
1035
1030
  isUnlocked
1036
1031
  }
1037
- }`}));return e}async quit(){return w(await U(this,z,"f").mutate({mutation:v`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeOpenLink($url: String!) {
1032
+ }`}));return e}async tlsDomain(){let{runtimeTlsDomain:e}=b(await N(this,D,"f").query({query:v`query runtimeTlsDomain {
1033
+ runtimeTlsDomain
1034
+ }`}));return e}async quit(){return b(await N(this,D,"f").mutate({mutation:v`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeOpenLink($url: String!) {
1038
1035
  runtimeOpenLink(url: $url)
1039
- }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=w(await U(this,z,"f").mutate({mutation:v`mutation addTrustedAgents($agents: [String!]!) {
1036
+ }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=b(await N(this,D,"f").mutate({mutation:v`mutation addTrustedAgents($agents: [String!]!) {
1040
1037
  addTrustedAgents(agents: $agents)
1041
- }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=w(await U(this,z,"f").mutate({mutation:v`mutation deleteTrustedAgents($agents: [String!]!) {
1038
+ }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=b(await N(this,D,"f").mutate({mutation:v`mutation deleteTrustedAgents($agents: [String!]!) {
1042
1039
  deleteTrustedAgents(agents: $agents)
1043
- }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=w(await U(this,z,"f").query({query:v`query getTrustedAgents {
1040
+ }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=b(await N(this,D,"f").query({query:v`query getTrustedAgents {
1044
1041
  getTrustedAgents
1045
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
1042
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
1046
1043
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
1047
- }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
1044
+ }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
1048
1045
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
1049
- }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=w(await U(this,z,"f").query({query:v`query runtimeKnownLinkLanguageTemplates {
1046
+ }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=b(await N(this,D,"f").query({query:v`query runtimeKnownLinkLanguageTemplates {
1050
1047
  runtimeKnownLinkLanguageTemplates
1051
- }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeAddFriends($dids: [String!]!) {
1048
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeAddFriends($dids: [String!]!) {
1052
1049
  runtimeAddFriends(dids: $dids)
1053
- }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveFriends($dids: [String!]!) {
1050
+ }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRemoveFriends($dids: [String!]!) {
1054
1051
  runtimeRemoveFriends(dids: $dids)
1055
- }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=w(await U(this,z,"f").query({query:v`query runtimeFriends {
1052
+ }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=b(await N(this,D,"f").query({query:v`query runtimeFriends {
1056
1053
  runtimeFriends
1057
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=w(await U(this,z,"f").query({query:v`query runtimeHcAgentInfos {
1054
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=b(await N(this,D,"f").query({query:v`query runtimeHcAgentInfos {
1058
1055
  runtimeHcAgentInfos
1059
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=w(await U(this,z,"f").query({query:v`query runtimeGetNetworkMetrics {
1056
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=b(await N(this,D,"f").query({query:v`query runtimeGetNetworkMetrics {
1060
1057
  runtimeGetNetworkMetrics
1061
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRestartHolochain {
1058
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRestartHolochain {
1062
1059
  runtimeRestartHolochain
1063
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
1060
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
1064
1061
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
1065
- }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=w(await U(this,z,"f").mutate({mutation:v`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
1062
+ }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,r,n){let{runtimeVerifyStringSignedByDid:a}=b(await N(this,D,"f").mutate({mutation:v`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
1066
1063
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
1067
- }`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeSetStatus($status: PerspectiveInput!) {
1064
+ }`,variables:{did:e,didSigningKeyId:t,data:r,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetStatus($status: PerspectiveInput!) {
1068
1065
  runtimeSetStatus(status: $status)
1069
- }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=w(await U(this,z,"f").query({query:v`query runtimeFriendStatus($did: String!) {
1070
- runtimeFriendStatus(did: $did) { ${Yn} }
1071
- }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
1066
+ }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=b(await N(this,D,"f").query({query:v`query runtimeFriendStatus($did: String!) {
1067
+ runtimeFriendStatus(did: $did) { ${na} }
1068
+ }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
1072
1069
  runtimeFriendSendMessage(did: $did, message: $message)
1073
- }`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=w(await U(this,z,"f").query({query:v`query runtimeMessageInbox($filter: String) {
1074
- runtimeMessageInbox(filter: $filter) { ${Yn} }
1075
- }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=w(await U(this,z,"f").query({query:v`query runtimeMessageOutbox($filter: String) {
1070
+ }`,variables:{did:e,message:t}}));return r}async messageInbox(e){let{runtimeMessageInbox:t}=b(await N(this,D,"f").query({query:v`query runtimeMessageInbox($filter: String) {
1071
+ runtimeMessageInbox(filter: $filter) { ${na} }
1072
+ }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=b(await N(this,D,"f").query({query:v`query runtimeMessageOutbox($filter: String) {
1076
1073
  runtimeMessageOutbox(filter: $filter) {
1077
1074
  recipient,
1078
1075
  message {
1079
- ${Yn}
1076
+ ${na}
1080
1077
  }
1081
1078
  }
1082
- }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
1079
+ }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
1083
1080
  runtimeRequestInstallNotification(notification: $notification)
1084
- }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeGrantNotification($id: String!) {
1081
+ }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeGrantNotification($id: String!) {
1085
1082
  runtimeGrantNotification(id: $id)
1086
- }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeExportDb($filePath: String!) {
1083
+ }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeExportDb($filePath: String!) {
1087
1084
  runtimeExportDb(filePath: $filePath)
1088
- }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeImportDb($filePath: String!) {
1085
+ }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeImportDb($filePath: String!) {
1089
1086
  runtimeImportDb(filePath: $filePath) {
1090
1087
  perspectives { total imported failed omitted errors }
1091
1088
  links { total imported failed omitted errors }
@@ -1099,51 +1096,72 @@ triggerMatch
1099
1096
  trustedAgents { total imported failed omitted errors }
1100
1097
  knownLinkLanguages { total imported failed omitted errors }
1101
1098
  }
1102
- }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=w(await U(this,z,"f").query({query:v`query runtimeNotifications {
1103
- runtimeNotifications { ${Dl} }
1104
- }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
1099
+ }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=b(await N(this,D,"f").query({query:v`query runtimeNotifications {
1100
+ runtimeNotifications { ${Jl} }
1101
+ }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
1105
1102
  runtimeUpdateNotification(id: $id, notification: $notification)
1106
- }`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeRemoveNotification($id: String!) {
1103
+ }`,variables:{id:e,notification:t}}));return r}async removeNotification(e){let{runtimeRemoveNotification:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeRemoveNotification($id: String!) {
1107
1104
  runtimeRemoveNotification(id: $id)
1108
- }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
1105
+ }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
1109
1106
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
1110
- }`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeImportPerspective($filePath: String!) {
1107
+ }`,variables:{perspectiveUuid:e,filePath:t}}));return r}async importPerspective(e){let{runtimeImportPerspective:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeImportPerspective($filePath: String!) {
1111
1108
  runtimeImportPerspective(filePath: $filePath)
1112
- }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=w(await U(this,z,"f").query({query:v`query runtimeMultiUserEnabled {
1109
+ }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=b(await N(this,D,"f").query({query:v`query runtimeMultiUserEnabled {
1113
1110
  runtimeMultiUserEnabled
1114
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
1111
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
1115
1112
  runtimeSetMultiUserEnabled(enabled: $enabled)
1116
- }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=w(await U(this,z,"f").query({query:v`query runtimeListUsers {
1113
+ }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=b(await N(this,D,"f").query({query:v`query runtimeListUsers {
1117
1114
  runtimeListUsers {
1118
1115
  email
1119
1116
  did
1120
1117
  lastSeen
1121
1118
  perspectiveCount
1119
+ remainingCredits
1120
+ freeAccess
1121
+ hotWalletAddress
1122
1122
  }
1123
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestModeEnable {
1123
+ }`}));return e}async userWalletAddress(e){let{runtimeUserWalletAddress:t}=b(await N(this,D,"f").query({query:v`query runtimeUserWalletAddress($email: String!) {
1124
+ runtimeUserWalletAddress(email: $email)
1125
+ }`,variables:{email:e}}));return t}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestModeEnable {
1124
1126
  runtimeEmailTestModeEnable
1125
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestModeDisable {
1127
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestModeDisable {
1126
1128
  runtimeEmailTestModeDisable
1127
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestGetCode($email: String!) {
1129
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestGetCode($email: String!) {
1128
1130
  runtimeEmailTestGetCode(email: $email)
1129
- }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestClearCodes {
1131
+ }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestClearCodes {
1130
1132
  runtimeEmailTestClearCodes
1131
- }`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=w(await U(this,z,"f").mutate({mutation:v`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
1133
+ }`}));return e}async emailTestSetExpiry(e,t,r){let{runtimeEmailTestSetExpiry:n}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
1132
1134
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
1133
- }`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}addNotificationTriggeredCallback(e){U(this,tn,"f").push(e)}subscribeNotificationTriggered(){U(this,z,"f").subscribe({query:v` subscription {
1134
- runtimeNotificationTriggered { ${Gd} }
1135
+ }`,variables:{email:e,verificationType:t,expiresAt:r}}));return n}async unytAgentKey(){let{runtimeUnytAgentKey:e}=b(await N(this,D,"f").query({query:v`query runtimeUnytAgentKey { runtimeUnytAgentKey }`,fetchPolicy:"network-only"}));return e}async unytHotAgentPubkey(){let{runtimeHotAgentPubkey:e}=b(await N(this,D,"f").query({query:v`query runtimeHotAgentPubkey { runtimeHotAgentPubkey }`,fetchPolicy:"network-only"}));return e}async unytWalletBalance(){let{runtimeHotWalletBalance:e}=b(await N(this,D,"f").query({query:v`query runtimeHotWalletBalance { runtimeHotWalletBalance }`,fetchPolicy:"network-only"}));return e}async unytWalletHistory(e,t){let{runtimeHotWalletHistory:r}=b(await N(this,D,"f").query({query:v`query runtimeHotWalletHistory($page: Int, $perPage: Int) {
1136
+ runtimeHotWalletHistory(page: $page, perPage: $perPage)
1137
+ }`,variables:{page:e,perPage:t},fetchPolicy:"network-only"}));return r}async unytVersionInfo(){let{runtimeUnytVersionInfo:e}=b(await N(this,D,"f").query({query:v`query runtimeUnytVersionInfo { runtimeUnytVersionInfo }`,fetchPolicy:"network-only"}));return e}async unytSetMembraneProof(e){let{runtimeSetUnytMembraneProof:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetUnytMembraneProof($proof: String!) {
1138
+ runtimeSetUnytMembraneProof(proof: $proof) { success message }
1139
+ }`,variables:{proof:e}}));return t}async unytReinstallDna(){let{runtimeReinstallUnytDna:e}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeReinstallUnytDna {
1140
+ runtimeReinstallUnytDna { success message }
1141
+ }`}));return e}async unytSendHot(e,t){let{runtimeSendHot:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSendHot($recipient: String!, $amount: String!) {
1142
+ runtimeSendHot(recipient: $recipient, amount: $amount) { success message }
1143
+ }`,variables:{recipient:e,amount:t}}));return r}async setUserCredits(e,t){let{runtimeSetUserCredits:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetUserCredits($email: String!, $amount: Float!) {
1144
+ runtimeSetUserCredits(email: $email, amount: $amount)
1145
+ }`,variables:{email:e,amount:t}}));return r}async setUserFreeAccess(e,t){let{runtimeSetUserFreeAccess:r}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetUserFreeAccess($email: String!, $enabled: Boolean!) {
1146
+ runtimeSetUserFreeAccess(email: $email, enabled: $enabled)
1147
+ }`,variables:{email:e,enabled:t}}));return r}async setHostRates(e){let{runtimeSetHostRates:t}=b(await N(this,D,"f").mutate({mutation:v`mutation runtimeSetHostRates($ratesJson: String!) {
1148
+ runtimeSetHostRates(ratesJson: $ratesJson)
1149
+ }`,variables:{ratesJson:e}}));return t}async getHostRates(){let{runtimeHostRates:e}=b(await N(this,D,"f").query({query:v`query runtimeHostRates {
1150
+ runtimeHostRates
1151
+ }`,fetchPolicy:"network-only"}));try{return JSON.parse(e)}catch{return[]}}addNotificationTriggeredCallback(e){N(this,on,"f").push(e)}subscribeNotificationTriggered(){N(this,D,"f").subscribe({query:v` subscription {
1152
+ runtimeNotificationTriggered { ${gp} }
1135
1153
  }
1136
- `}).subscribe({next:e=>{U(this,tn,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){U(this,Xr,"f").push(e)}subscribeMessageReceived(){U(this,z,"f").subscribe({query:v` subscription {
1137
- runtimeMessageReceived { ${Yn} }
1154
+ `}).subscribe({next:e=>{N(this,on,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){N(this,an,"f").push(e)}subscribeMessageReceived(){N(this,D,"f").subscribe({query:v` subscription {
1155
+ runtimeMessageReceived { ${na} }
1138
1156
  }
1139
- `}).subscribe({next:e=>{U(this,Xr,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){U(this,en,"f").push(e)}subscribeExceptionOccurred(){U(this,z,"f").subscribe({query:v` subscription {
1157
+ `}).subscribe({next:e=>{N(this,an,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){N(this,sn,"f").push(e)}subscribeExceptionOccurred(){N(this,D,"f").subscribe({query:v` subscription {
1140
1158
  exceptionOccurred {
1141
1159
  title
1142
1160
  message
1143
1161
  type
1144
1162
  addon
1145
1163
  }
1146
- }`}).subscribe({next:e=>{U(this,en,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};z=new WeakMap,Xr=new WeakMap,en=new WeakMap,tn=new WeakMap,Ol=new WeakMap;var Zd=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)},Ot,Zs=class{constructor(e){Ot.set(this,void 0),Zd(this,Ot,e,"f")}async get(e,t=!1){if(!t)try{let n=oe.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}=w(await or(this,Ot,"f").query({query:v`query expression($url: String!) {
1164
+ }`}).subscribe({next:e=>{N(this,sn,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};D=new WeakMap,an=new WeakMap,sn=new WeakMap,on=new WeakMap,Zl=new WeakMap;var mp=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},ur=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)},jt,no=class{constructor(e){jt.set(this,void 0),mp(this,jt,e,"f")}async get(e,t=!1){if(!t)try{let n=le.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}=b(await ur(this,jt,"f").query({query:v`query expression($url: String!) {
1147
1165
  expression(url: $url) {
1148
1166
  author
1149
1167
  timestamp
@@ -1156,7 +1174,7 @@ triggerMatch
1156
1174
  invalid
1157
1175
  }
1158
1176
  }
1159
- }`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=w(await or(this,Ot,"f").query({query:v`query expressionMany($urls: [String!]!) {
1177
+ }`,variables:{url:e}}));return r}async getMany(e){let{expressionMany:t}=b(await ur(this,jt,"f").query({query:v`query expressionMany($urls: [String!]!) {
1160
1178
  expressionMany(urls: $urls) {
1161
1179
  author
1162
1180
  timestamp
@@ -1169,19 +1187,19 @@ triggerMatch
1169
1187
  invalid
1170
1188
  }
1171
1189
  }
1172
- }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=w(await or(this,Ot,"f").query({query:v`query expressionRaw($url: String!) {
1190
+ }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=b(await ur(this,jt,"f").query({query:v`query expressionRaw($url: String!) {
1173
1191
  expressionRaw(url: $url)
1174
- }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=w(await or(this,Ot,"f").mutate({mutation:v`mutation expressionCreate($content: String!, $languageAddress: String!){
1192
+ }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:r}=b(await ur(this,jt,"f").mutate({mutation:v`mutation expressionCreate($content: String!, $languageAddress: String!){
1175
1193
  expressionCreate(content: $content, languageAddress: $languageAddress)
1176
- }`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=w(await or(this,Ot,"f").query({query:v`query expressionInteractions($url: String!) {
1194
+ }`,variables:{content:e,languageAddress:t}}));return r}async interactions(e){let{expressionInteractions:t}=b(await ur(this,jt,"f").query({query:v`query expressionInteractions($url: String!) {
1177
1195
  expressionInteractions(url: $url) {
1178
1196
  label
1179
1197
  name
1180
1198
  parameters { name, type }
1181
1199
  }
1182
- }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=w(await or(this,Ot,"f").mutate({mutation:v`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
1200
+ }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:r}=b(await ur(this,jt,"f").mutate({mutation:v`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
1183
1201
  expressionInteract(url: $url, interactionCall: $interactionCall)
1184
- }`,variables:{url:e,interactionCall:t}}));return r}};Ot=new WeakMap;var Ga={};Ga.byteLength=Yd;Ga.toByteArray=ep;Ga.fromByteArray=rp;var St=[],st=[],Jd=typeof Uint8Array<"u"?Uint8Array:Array,Es="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(yi=0,uc=Es.length;yi<uc;++yi)St[yi]=Es[yi],st[Es.charCodeAt(yi)]=yi;var yi,uc;st["-".charCodeAt(0)]=62;st["_".charCodeAt(0)]=63;function Ml(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 Yd(i){var e=Ml(i),t=e[0],r=e[1];return(t+r)*3/4-r}function Xd(i,e,t){return(e+t)*3/4-t}function ep(i){var e,t=Ml(i),r=t[0],n=t[1],a=new Jd(Xd(i,r,n)),s=0,o=n>0?r-4:r,l;for(l=0;l<o;l+=4)e=st[i.charCodeAt(l)]<<18|st[i.charCodeAt(l+1)]<<12|st[i.charCodeAt(l+2)]<<6|st[i.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=st[i.charCodeAt(l)]<<2|st[i.charCodeAt(l+1)]>>4,a[s++]=e&255),n===1&&(e=st[i.charCodeAt(l)]<<10|st[i.charCodeAt(l+1)]<<4|st[i.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function tp(i){return St[i>>18&63]+St[i>>12&63]+St[i>>6&63]+St[i&63]}function ip(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(tp(r));return n.join("")}function rp(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(ip(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(St[e>>2]+St[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(St[e>>10]+St[e>>4&63]+St[e<<2&63]+"=")),n.join("")}var np=4,dc=0,pc=1,ap=2;function Tr(i){let e=i.length;for(;--e>=0;)i[e]=0}var sp=0,Ul=1,op=2,cp=3,lp=258,go=29,Cn=256,bn=Cn+1+go,hr=30,mo=19,Fl=2*bn+1,Ii=15,xs=16,up=7,yo=256,jl=16,Bl=17,ql=18,Js=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]),ya=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]),dp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Hl=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),pp=512,Dt=new Array((bn+2)*2);Tr(Dt);var dn=new Array(hr*2);Tr(dn);var wn=new Array(pp);Tr(wn);var Sn=new Array(lp-cp+1);Tr(Sn);var vo=new Array(go);Tr(vo);var Pa=new Array(hr);Tr(Pa);function $s(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 Vl,zl,Wl;function As(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var Kl=i=>i<256?wn[i]:wn[256+(i>>>7)],_n=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Qe=(i,e,t)=>{i.bi_valid>xs-t?(i.bi_buf|=e<<i.bi_valid&65535,_n(i,i.bi_buf),i.bi_buf=e>>xs-i.bi_valid,i.bi_valid+=t-xs):(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])},Ql=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},fp=i=>{i.bi_valid===16?(_n(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)},hp=(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,m,y,d,p,f=0;for(y=0;y<=Ii;y++)i.bl_count[y]=0;for(t[i.heap[i.heap_max]*2+1]=0,c=i.heap_max+1;c<Fl;c++)u=i.heap[c],y=t[t[u*2+1]*2+1]+1,y>l&&(y=l,f++),t[u*2+1]=y,!(u>r)&&(i.bl_count[y]++,d=0,u>=o&&(d=s[u-o]),p=t[u*2],i.opt_len+=p*(y+d),a&&(i.static_len+=p*(n[u*2+1]+d)));if(f!==0){do{for(y=l-1;i.bl_count[y]===0;)y--;i.bl_count[y]--,i.bl_count[y+1]+=2,i.bl_count[l]--,f-=2}while(f>0);for(y=l;y!==0;y--)for(u=i.bl_count[y];u!==0;)m=i.heap[--c],!(m>r)&&(t[m*2+1]!==y&&(i.opt_len+=(y-t[m*2+1])*t[m*2],t[m*2+1]=y),u--)}},Gl=(i,e,t)=>{let r=new Array(Ii+1),n=0,a,s;for(a=1;a<=Ii;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]=Ql(r[o]++,o))}},gp=()=>{let i,e,t,r,n,a=new Array(Ii+1);for(t=0,r=0;r<go-1;r++)for(vo[r]=t,i=0;i<1<<Js[r];i++)Sn[t++]=r;for(Sn[t-1]=r,n=0,r=0;r<16;r++)for(Pa[r]=n,i=0;i<1<<ya[r];i++)wn[n++]=r;for(n>>=7;r<hr;r++)for(Pa[r]=n<<7,i=0;i<1<<ya[r]-7;i++)wn[256+n++]=r;for(e=0;e<=Ii;e++)a[e]=0;for(i=0;i<=143;)Dt[i*2+1]=8,i++,a[8]++;for(;i<=255;)Dt[i*2+1]=9,i++,a[9]++;for(;i<=279;)Dt[i*2+1]=7,i++,a[7]++;for(;i<=287;)Dt[i*2+1]=8,i++,a[8]++;for(Gl(Dt,bn+1,a),i=0;i<hr;i++)dn[i*2+1]=5,dn[i*2]=Ql(i,5);Vl=new $s(Dt,Js,Cn+1,bn,Ii),zl=new $s(dn,ya,0,hr,Ii),Wl=new $s(new Array(0),dp,0,mo,up)},Zl=i=>{let e;for(e=0;e<bn;e++)i.dyn_ltree[e*2]=0;for(e=0;e<hr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<mo;e++)i.bl_tree[e*2]=0;i.dyn_ltree[yo*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},Jl=i=>{i.bi_valid>8?_n(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},fc=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},ks=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&fc(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!fc(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},hc=(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=Sn[n],_t(i,s+Cn+1,e),o=Js[s],o!==0&&(n-=vo[s],Qe(i,n,o)),r--,s=Kl(r),_t(i,s,t),o=ya[s],o!==0&&(r-=Pa[s],Qe(i,r,o)));while(a<i.sym_next);_t(i,yo,e)},Ys=(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=Fl,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--)ks(i,t,s);c=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],ks(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++,ks(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],hp(i,e),Gl(t,l,i.bl_count)},gc=(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[jl*2]++):o<=10?i.bl_tree[Bl*2]++:i.bl_tree[ql*2]++,o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))},mc=(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,jl,i.bl_tree),Qe(i,o-3,2)):o<=10?(_t(i,Bl,i.bl_tree),Qe(i,o-3,3)):(_t(i,ql,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)}},mp=i=>{let e;for(gc(i,i.dyn_ltree,i.l_desc.max_code),gc(i,i.dyn_dtree,i.d_desc.max_code),Ys(i,i.bl_desc),e=mo-1;e>=3&&i.bl_tree[Hl[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},yp=(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[Hl[n]*2+1],3);mc(i,i.dyn_ltree,e-1),mc(i,i.dyn_dtree,t-1)},vp=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return dc;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return pc;for(t=32;t<Cn;t++)if(i.dyn_ltree[t*2]!==0)return pc;return dc},yc=!1,bp=i=>{yc||(gp(),yc=!0),i.l_desc=new As(i.dyn_ltree,Vl),i.d_desc=new As(i.dyn_dtree,zl),i.bl_desc=new As(i.bl_tree,Wl),i.bi_buf=0,i.bi_valid=0,Zl(i)},Yl=(i,e,t,r)=>{Qe(i,(sp<<1)+(r?1:0),3),Jl(i),_n(i,t),_n(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},wp=i=>{Qe(i,Ul<<1,3),_t(i,yo,Dt),fp(i)},Sp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===ap&&(i.strm.data_type=vp(i)),Ys(i,i.l_desc),Ys(i,i.d_desc),s=mp(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?Yl(i,e,t,r):i.strategy===np||a===n?(Qe(i,(Ul<<1)+(r?1:0),3),hc(i,Dt,dn)):(Qe(i,(op<<1)+(r?1:0),3),yp(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),hc(i,i.dyn_ltree,i.dyn_dtree)),Zl(i),r&&Jl(i)},_p=(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[(Sn[t]+Cn+1)*2]++,i.dyn_dtree[Kl(e)*2]++),i.sym_next===i.sym_end),Ep=bp,xp=Yl,$p=Sp,Ap=_p,kp=wp,Ip={_tr_init:Ep,_tr_stored_block:xp,_tr_flush_block:$p,_tr_tally:Ap,_tr_align:kp},Tp=(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},En=Tp,Cp=()=>{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},Lp=new Uint32Array(Cp()),Np=(i,e,t,r)=>{let n=Lp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},xe=Np,Ui={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"},Qi={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:Rp,_tr_stored_block:Xs,_tr_flush_block:Pp,_tr_tally:Yt,_tr_align:Op}=Ip,{Z_NO_FLUSH:Xt,Z_PARTIAL_FLUSH:Dp,Z_FULL_FLUSH:Mp,Z_FINISH:ct,Z_BLOCK:vc,Z_OK:Te,Z_STREAM_END:bc,Z_STREAM_ERROR:$t,Z_DATA_ERROR:Up,Z_BUF_ERROR:Is,Z_DEFAULT_COMPRESSION:Fp,Z_FILTERED:jp,Z_HUFFMAN_ONLY:Xn,Z_RLE:Bp,Z_FIXED:qp,Z_DEFAULT_STRATEGY:Hp,Z_UNKNOWN:Vp,Z_DEFLATED:Za}=Qi,zp=9,Wp=15,Kp=8,Qp=29,Gp=256,eo=Gp+1+Qp,Zp=30,Jp=19,Yp=2*eo+1,Xp=15,X=3,Qt=258,At=Qt+X+1,ef=32,br=42,bo=57,to=69,io=73,ro=91,no=103,Ti=113,rn=666,je=1,Cr=2,Fi=3,Lr=4,tf=3,Ci=(i,e)=>(i.msg=Ui[e],e),wc=i=>i*2-(i>4?9:0),Kt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},rf=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)},nf=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,ei=nf,Ye=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))},et=(i,e)=>{Pp(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,Ye(i.strm)},ne=(i,e)=>{i.pending_buf[i.pending++]=e},Br=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},ao=(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=En(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)},Xl=(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-At?i.strstart-(i.w_size-At):0,c=i.window,u=i.w_mask,m=i.prev,y=i.strstart+Qt,d=c[r+s-1],p=c[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(c[n+s]!==p||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<y);if(a=Qt-(y-r),r=y-Qt,a>s){if(i.match_start=e,s=a,a>=o)break;d=c[r+s-1],p=c[r+s]}}while((e=m[e&u])>l&&--t!==0);return s<=i.lookahead?s:i.lookahead},wr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-At)&&(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),rf(i),r+=e),i.strm.avail_in===0)break;if(t=ao(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=X)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=ei(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=ei(i,i.ins_h,i.window[n+X-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<X)););}while(i.lookahead<At&&i.strm.avail_in!==0)},eu=(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!==ct||e===Xt||r!==n+i.strm.avail_in)))break;s=e===ct&&r===n+i.strm.avail_in?1:0,Xs(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,Ye(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&&(ao(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?Lr:e!==Xt&&e!==ct&&i.strm.avail_in===0&&i.strstart===i.block_start?Cr:(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&&(ao(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===ct)&&e!==Xt&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===ct&&i.strm.avail_in===0&&r===n?1:0,Xs(i,i.block_start,r,s),i.block_start+=r,Ye(i.strm)),s?Fi:je)},Ts=(i,e)=>{let t,r;for(;;){if(i.lookahead<At){if(wr(i),i.lookahead<At&&e===Xt)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=X&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-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-At&&(i.match_length=Xl(i,t)),i.match_length>=X)if(r=Yt(i,i.strstart-i.match_start,i.match_length-X),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=X){i.match_length--;do i.strstart++,i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-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=ei(i,i.ins_h,i.window[i.strstart+1]);else r=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(et(i,!1),i.strm.avail_out===0))return je}return i.insert=i.strstart<X-1?i.strstart:X-1,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},cr=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<At){if(wr(i),i.lookahead<At&&e===Xt)return je;if(i.lookahead===0)break}if(t=0,i.lookahead>=X&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-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=X-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-At&&(i.match_length=Xl(i,t),i.match_length<=5&&(i.strategy===jp||i.match_length===X&&i.strstart-i.match_start>4096)&&(i.match_length=X-1)),i.prev_length>=X&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-X,r=Yt(i,i.strstart-1-i.prev_match,i.prev_length-X),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=ei(i,i.ins_h,i.window[i.strstart+X-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=X-1,i.strstart++,r&&(et(i,!1),i.strm.avail_out===0))return je}else if(i.match_available){if(r=Yt(i,0,i.window[i.strstart-1]),r&&et(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=Yt(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<X-1?i.strstart:X-1,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},af=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Qt){if(wr(i),i.lookahead<=Qt&&e===Xt)return je;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=X&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+Qt;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=Qt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=X?(t=Yt(i,1,i.match_length-X),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(et(i,!1),i.strm.avail_out===0))return je}return i.insert=0,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr},sf=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(wr(i),i.lookahead===0)){if(e===Xt)return je;break}if(i.match_length=0,t=Yt(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(et(i,!1),i.strm.avail_out===0))return je}return i.insert=0,e===ct?(et(i,!0),i.strm.avail_out===0?Fi:Lr):i.sym_next&&(et(i,!1),i.strm.avail_out===0)?je:Cr};function mt(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 nn=[new mt(0,0,0,0,eu),new mt(4,4,8,4,Ts),new mt(4,5,16,8,Ts),new mt(4,6,32,32,Ts),new mt(4,4,16,16,cr),new mt(8,16,32,32,cr),new mt(8,16,128,128,cr),new mt(8,32,128,256,cr),new mt(32,128,258,1024,cr),new mt(32,258,258,4096,cr)],of=i=>{i.window_size=2*i.w_size,Kt(i.head),i.max_lazy_match=nn[i.level].max_lazy,i.good_match=nn[i.level].good_length,i.nice_match=nn[i.level].nice_length,i.max_chain_length=nn[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=X-1,i.match_available=0,i.ins_h=0};function cf(){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=Za,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(Yp*2),this.dyn_dtree=new Uint16Array((2*Zp+1)*2),this.bl_tree=new Uint16Array((2*Jp+1)*2),Kt(this.dyn_ltree),Kt(this.dyn_dtree),Kt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Xp+1),this.heap=new Uint16Array(2*eo+1),Kt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*eo+1),Kt(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 Ln=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==br&&e.status!==bo&&e.status!==to&&e.status!==io&&e.status!==ro&&e.status!==no&&e.status!==Ti&&e.status!==rn?1:0},tu=i=>{if(Ln(i))return Ci(i,$t);i.total_in=i.total_out=0,i.data_type=Vp;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?bo:e.wrap?br:Ti,i.adler=e.wrap===2?0:1,e.last_flush=-2,Rp(e),Te},iu=i=>{let e=tu(i);return e===Te&&of(i.state),e},lf=(i,e)=>Ln(i)||i.state.wrap!==2?$t:(i.state.gzhead=e,Te),ru=(i,e,t,r,n,a)=>{if(!i)return $t;let s=1;if(e===Fp&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>zp||t!==Za||r<8||r>15||e<0||e>9||a<0||a>qp||r===8&&s!==1)return Ci(i,$t);r===8&&(r=9);let o=new cf;return i.state=o,o.strm=i,o.status=br,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+X-1)/X),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,iu(i)},uf=(i,e)=>ru(i,e,Za,Wp,Kp,Hp),df=(i,e)=>{if(Ln(i)||e>vc||e<0)return i?Ci(i,$t):$t;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===rn&&e!==ct)return Ci(i,i.avail_out===0?Is:$t);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ye(i),i.avail_out===0)return t.last_flush=-1,Te}else if(i.avail_in===0&&wc(e)<=wc(r)&&e!==ct)return Ci(i,Is);if(t.status===rn&&i.avail_in!==0)return Ci(i,Is);if(t.status===br&&t.wrap===0&&(t.status=Ti),t.status===br){let n=Za+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Xn||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=ef),n+=31-n%31,Br(t,n),t.strstart!==0&&(Br(t,i.adler>>>16),Br(t,i.adler&65535)),i.adler=1,t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(t.status===bo){if(i.adler=0,ne(t,31),ne(t,139),ne(t,8),t.gzhead)ne(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)),ne(t,t.gzhead.time&255),ne(t,t.gzhead.time>>8&255),ne(t,t.gzhead.time>>16&255),ne(t,t.gzhead.time>>24&255),ne(t,t.level===9?2:t.strategy>=Xn||t.level<2?4:0),ne(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(ne(t,t.gzhead.extra.length&255),ne(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=to;else if(ne(t,0),ne(t,0),ne(t,0),ne(t,0),ne(t,0),ne(t,t.level===9?2:t.strategy>=Xn||t.level<2?4:0),ne(t,tf),t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(t.status===to){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,Ye(i),t.pending!==0)return t.last_flush=-1,Te;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=io}if(t.status===io){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)),Ye(i),t.pending!==0)return t.last_flush=-1,Te;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,ne(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=ro}if(t.status===ro){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)),Ye(i),t.pending!==0)return t.last_flush=-1,Te;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,ne(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=no}if(t.status===no){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ye(i),t.pending!==0))return t.last_flush=-1,Te;ne(t,i.adler&255),ne(t,i.adler>>8&255),i.adler=0}if(t.status=Ti,Ye(i),t.pending!==0)return t.last_flush=-1,Te}if(i.avail_in!==0||t.lookahead!==0||e!==Xt&&t.status!==rn){let n=t.level===0?eu(t,e):t.strategy===Xn?sf(t,e):t.strategy===Bp?af(t,e):nn[t.level].func(t,e);if((n===Fi||n===Lr)&&(t.status=rn),n===je||n===Fi)return i.avail_out===0&&(t.last_flush=-1),Te;if(n===Cr&&(e===Dp?Op(t):e!==vc&&(Xs(t,0,0,!1),e===Mp&&(Kt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ye(i),i.avail_out===0))return t.last_flush=-1,Te}return e!==ct?Te:t.wrap<=0?bc:(t.wrap===2?(ne(t,i.adler&255),ne(t,i.adler>>8&255),ne(t,i.adler>>16&255),ne(t,i.adler>>24&255),ne(t,i.total_in&255),ne(t,i.total_in>>8&255),ne(t,i.total_in>>16&255),ne(t,i.total_in>>24&255)):(Br(t,i.adler>>>16),Br(t,i.adler&65535)),Ye(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Te:bc)},pf=i=>{if(Ln(i))return $t;let e=i.state.status;return i.state=null,e===Ti?Ci(i,Up):Te},ff=(i,e)=>{let t=e.length;if(Ln(i))return $t;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==br||r.lookahead)return $t;if(n===1&&(i.adler=En(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(Kt(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,wr(r);r.lookahead>=X;){let l=r.strstart,c=r.lookahead-(X-1);do r.ins_h=ei(r,r.ins_h,r.window[l+X-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=X-1,wr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=X-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,Te},hf=uf,gf=ru,mf=iu,yf=tu,vf=lf,bf=df,wf=pf,Sf=ff,_f="pako deflate (from Nodeca project)",pn={deflateInit:hf,deflateInit2:gf,deflateReset:mf,deflateResetKeep:yf,deflateSetHeader:vf,deflate:bf,deflateEnd:wf,deflateSetDictionary:Sf,deflateInfo:_f},Ef=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),xf=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)Ef(t,r)&&(i[r]=t[r])}}return i},$f=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},Ja={assign:xf,flattenChunks:$f},nu=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){nu=!1}var xn=new Uint8Array(256);for(let i=0;i<256;i++)xn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;xn[254]=xn[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},kf=(i,e)=>{if(e<65534&&i.subarray&&nu)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},If=(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=xn[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 kf(a,n)},Tf=(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+xn[i[t]]>e?t:e},$n={string2buf:Af,buf2string:If,utf8border:Tf};function Cf(){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 au=Cf,su=Object.prototype.toString,{Z_NO_FLUSH:Lf,Z_SYNC_FLUSH:Nf,Z_FULL_FLUSH:Rf,Z_FINISH:Pf,Z_OK:Oa,Z_STREAM_END:Of,Z_DEFAULT_COMPRESSION:Df,Z_DEFAULT_STRATEGY:Mf,Z_DEFLATED:Uf}=Qi;function Nn(i){this.options=Ja.assign({level:Df,method:Uf,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 au,this.strm.avail_out=0;let t=pn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Oa)throw new Error(Ui[t]);if(e.header&&pn.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=$n.string2buf(e.dictionary):su.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=pn.deflateSetDictionary(this.strm,r),t!==Oa)throw new Error(Ui[t]);this._dict_set=!0}}Nn.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?Pf:Lf,typeof i=="string"?t.input=$n.string2buf(i):su.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===Nf||a===Rf)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=pn.deflate(t,a),n===Of)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=pn.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Oa;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};Nn.prototype.onData=function(i){this.chunks.push(i)};Nn.prototype.onEnd=function(i){i===Oa&&(this.result=Ja.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function wo(i,e){let t=new Nn(e);if(t.push(i,!0),t.err)throw t.msg||Ui[t.err];return t.result}function Ff(i,e){return e=e||{},e.raw=!0,wo(i,e)}function jf(i,e){return e=e||{},e.gzip=!0,wo(i,e)}var Bf=Nn,qf=wo,Hf=Ff,Vf=jf,zf=Qi,Wf={Deflate:Bf,deflate:qf,deflateRaw:Hf,gzip:Vf,constants:zf},ea=16209,Kf=16191,Qf=function i(e,t){let r,n,a,s,o,l,c,u,m,y,d,p,f,S,E,A,k,b,T,R,C,Q,V,L,W=e.state;r=e.next_in,V=e.input,n=r+(e.avail_in-5),a=e.next_out,L=e.output,s=a-(t-e.avail_out),o=a+(e.avail_out-257),l=W.dmax,c=W.wsize,u=W.whave,m=W.wnext,y=W.window,d=W.hold,p=W.bits,f=W.lencode,S=W.distcode,E=(1<<W.lenbits)-1,A=(1<<W.distbits)-1;e:do{p<15&&(d+=V[r++]<<p,p+=8,d+=V[r++]<<p,p+=8),k=f[d&E];t:for(;;){if(b=k>>>24,d>>>=b,p-=b,b=k>>>16&255,b===0)L[a++]=k&65535;else if(b&16){T=k&65535,b&=15,b&&(p<b&&(d+=V[r++]<<p,p+=8),T+=d&(1<<b)-1,d>>>=b,p-=b),p<15&&(d+=V[r++]<<p,p+=8,d+=V[r++]<<p,p+=8),k=S[d&A];i:for(;;){if(b=k>>>24,d>>>=b,p-=b,b=k>>>16&255,b&16){if(R=k&65535,b&=15,p<b&&(d+=V[r++]<<p,p+=8,p<b&&(d+=V[r++]<<p,p+=8)),R+=d&(1<<b)-1,R>l){e.msg="invalid distance too far back",W.mode=ea;break e}if(d>>>=b,p-=b,b=a-s,R>b){if(b=R-b,b>u&&W.sane){e.msg="invalid distance too far back",W.mode=ea;break e}if(C=0,Q=y,m===0){if(C+=c-b,b<T){T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}}else if(m<b){if(C+=c+m-b,b-=m,b<T){T-=b;do L[a++]=y[C++];while(--b);if(C=0,m<T){b=m,T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}}}else if(C+=m-b,b<T){T-=b;do L[a++]=y[C++];while(--b);C=a-R,Q=L}for(;T>2;)L[a++]=Q[C++],L[a++]=Q[C++],L[a++]=Q[C++],T-=3;T&&(L[a++]=Q[C++],T>1&&(L[a++]=Q[C++]))}else{C=a-R;do L[a++]=L[C++],L[a++]=L[C++],L[a++]=L[C++],T-=3;while(T>2);T&&(L[a++]=L[C++],T>1&&(L[a++]=L[C++]))}}else if((b&64)===0){k=S[(k&65535)+(d&(1<<b)-1)];continue i}else{e.msg="invalid distance code",W.mode=ea;break e}break}}else if((b&64)===0){k=f[(k&65535)+(d&(1<<b)-1)];continue t}else if(b&32){W.mode=Kf;break e}else{e.msg="invalid literal/length code",W.mode=ea;break e}break}}while(r<n&&a<o);T=p>>3,r-=T,p-=T<<3,d&=(1<<p)-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),W.hold=d,W.bits=p},lr=15,Sc=852,_c=592,Ec=0,Cs=1,xc=2,Gf=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]),Zf=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]),Jf=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]),Yf=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]),Xf=(i,e,t,r,n,a,s,o)=>{let l=o.bits,c=0,u=0,m=0,y=0,d=0,p=0,f=0,S=0,E=0,A=0,k,b,T,R,C,Q=null,V,L=new Uint16Array(lr+1),W=new Uint16Array(lr+1),He=null,Rr,I,On;for(c=0;c<=lr;c++)L[c]=0;for(u=0;u<r;u++)L[e[t+u]]++;for(d=l,y=lr;y>=1&&L[y]===0;y--);if(d>y&&(d=y),y===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(m=1;m<y&&L[m]===0;m++);for(d<m&&(d=m),S=1,c=1;c<=lr;c++)if(S<<=1,S-=L[c],S<0)return-1;if(S>0&&(i===Ec||y!==1))return-1;for(W[1]=0,c=1;c<lr;c++)W[c+1]=W[c]+L[c];for(u=0;u<r;u++)e[t+u]!==0&&(s[W[e[t+u]]++]=u);if(i===Ec?(Q=He=s,V=20):i===Cs?(Q=Gf,He=Zf,V=257):(Q=Jf,He=Yf,V=0),A=0,u=0,c=m,C=a,p=d,f=0,T=-1,E=1<<d,R=E-1,i===Cs&&E>Sc||i===xc&&E>_c)return 1;for(;;){Rr=c-f,s[u]+1<V?(I=0,On=s[u]):s[u]>=V?(I=He[s[u]-V],On=Q[s[u]-V]):(I=32+64,On=0),k=1<<c-f,b=1<<p,m=b;do b-=k,n[C+(A>>f)+b]=Rr<<24|I<<16|On|0;while(b!==0);for(k=1<<c-1;A&k;)k>>=1;if(k!==0?(A&=k-1,A+=k):A=0,u++,--L[c]===0){if(c===y)break;c=e[t+s[u]]}if(c>d&&(A&R)!==T){for(f===0&&(f=d),C+=m,p=c-f,S=1<<p;p+f<y&&(S-=L[p+f],!(S<=0));)p++,S<<=1;if(E+=1<<p,i===Cs&&E>Sc||i===xc&&E>_c)return 1;T=A&R,n[T]=d<<24|p<<16|C-a|0}}return A!==0&&(n[C+A]=c-f<<24|64<<16|0),o.bits=d,0},fn=Xf,eh=0,ou=1,cu=2,{Z_FINISH:$c,Z_BLOCK:th,Z_TREES:ta,Z_OK:ji,Z_STREAM_END:ih,Z_NEED_DICT:rh,Z_STREAM_ERROR:lt,Z_DATA_ERROR:lu,Z_MEM_ERROR:uu,Z_BUF_ERROR:nh,Z_DEFLATED:Ac}=Qi,Ya=16180,kc=16181,Ic=16182,Tc=16183,Cc=16184,Lc=16185,Nc=16186,Rc=16187,Pc=16188,Oc=16189,Da=16190,Nt=16191,Ls=16192,Dc=16193,Ns=16194,Mc=16195,Uc=16196,Fc=16197,jc=16198,ia=16199,ra=16200,Bc=16201,qc=16202,Hc=16203,Vc=16204,zc=16205,Rs=16206,Wc=16207,Kc=16208,de=16209,du=16210,pu=16211,ah=852,sh=592,oh=15,ch=oh,Qc=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function lh(){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 Gi=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<Ya||e.mode>pu?1:0},fu=i=>{if(Gi(i))return lt;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=Ya,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(ah),e.distcode=e.distdyn=new Int32Array(sh),e.sane=1,e.back=-1,ji},hu=i=>{if(Gi(i))return lt;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,fu(i)},gu=(i,e)=>{let t;if(Gi(i))return lt;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?lt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,hu(i))},mu=(i,e)=>{if(!i)return lt;let t=new lh;i.state=t,t.strm=i,t.window=null,t.mode=Ya;let r=gu(i,e);return r!==ji&&(i.state=null),r},uh=i=>mu(i,ch),Gc=!0,Ps,Os,dh=i=>{if(Gc){Ps=new Int32Array(512),Os=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(fn(ou,i.lens,0,288,Ps,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;fn(cu,i.lens,0,32,Os,0,i.work,{bits:5}),Gc=!1}i.lencode=Ps,i.lenbits=9,i.distcode=Os,i.distbits=5},yu=(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},ph=(i,e)=>{let t,r,n,a,s,o,l,c,u,m,y,d,p,f,S=0,E,A,k,b,T,R,C,Q,V=new Uint8Array(4),L,W,He=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Gi(i)||!i.output||!i.input&&i.avail_in!==0)return lt;t=i.state,t.mode===Nt&&(t.mode=Ls),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,m=o,y=l,Q=ji;e:for(;;)switch(t.mode){case Ya:if(t.wrap===0){t.mode=Ls;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,V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0),c=0,u=0,t.mode=kc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=de;break}if((c&15)!==Ac){i.msg="unknown compression method",t.mode=de;break}if(c>>>=4,u-=4,C=(c&15)+8,t.wbits===0&&(t.wbits=C),C>15||C>t.wbits){i.msg="invalid window size",t.mode=de;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=c&512?Oc:Nt,c=0,u=0;break;case kc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==Ac){i.msg="unknown compression method",t.mode=de;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=de;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0,t.mode=Ic;case Ic: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&&(V[0]=c&255,V[1]=c>>>8&255,V[2]=c>>>16&255,V[3]=c>>>24&255,t.check=xe(t.check,V,4,0)),c=0,u=0,t.mode=Tc;case Tc: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&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0,t.mode=Cc;case Cc: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&&(V[0]=c&255,V[1]=c>>>8&255,t.check=xe(t.check,V,2,0)),c=0,u=0}else t.head&&(t.head.extra=null);t.mode=Lc;case Lc:if(t.flags&1024&&(d=t.length,d>o&&(d=o),d&&(t.head&&(C=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),C)),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=Nc;case Nc:if(t.flags&2048){if(o===0)break e;d=0;do C=r[a+d++],t.head&&C&&t.length<65536&&(t.head.name+=String.fromCharCode(C));while(C&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=xe(t.check,r,d,a)),o-=d,a+=d,C)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Rc;case Rc:if(t.flags&4096){if(o===0)break e;d=0;do C=r[a+d++],t.head&&C&&t.length<65536&&(t.head.comment+=String.fromCharCode(C));while(C&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=xe(t.check,r,d,a)),o-=d,a+=d,C)break e}else t.head&&(t.head.comment=null);t.mode=Pc;case Pc: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=de;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=Nt;break;case Oc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}i.adler=t.check=Qc(c),c=0,u=0,t.mode=Da;case Da: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,rh;i.adler=t.check=1,t.mode=Nt;case Nt:if(e===th||e===ta)break e;case Ls:if(t.last){c>>>=u&7,u-=u&7,t.mode=Rs;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=Dc;break;case 1:if(dh(t),t.mode=ia,e===ta){c>>>=2,u-=2;break e}break;case 2:t.mode=Uc;break;case 3:i.msg="invalid block type",t.mode=de}c>>>=2,u-=2;break;case Dc: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=de;break}if(t.length=c&65535,c=0,u=0,t.mode=Ns,e===ta)break e;case Ns:t.mode=Mc;case Mc: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=Nt;break;case Uc: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=de;break}t.have=0,t.mode=Fc;case Fc: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,L={bits:t.lenbits},Q=fn(eh,t.lens,0,19,t.lencode,0,t.work,L),t.lenbits=L.bits,Q){i.msg="invalid code lengths set",t.mode=de;break}t.have=0,t.mode=jc;case jc:for(;t.have<t.nlen+t.ndist;){for(;S=t.lencode[c&(1<<t.lenbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(k<16)c>>>=E,u-=E,t.lens[t.have++]=k;else{if(k===16){for(W=E+2;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(c>>>=E,u-=E,t.have===0){i.msg="invalid bit length repeat",t.mode=de;break}C=t.lens[t.have-1],d=3+(c&3),c>>>=2,u-=2}else if(k===17){for(W=E+3;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,C=0,d=3+(c&7),c>>>=3,u-=3}else{for(W=E+7;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,C=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=de;break}for(;d--;)t.lens[t.have++]=C}}if(t.mode===de)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=de;break}if(t.lenbits=9,L={bits:t.lenbits},Q=fn(ou,t.lens,0,t.nlen,t.lencode,0,t.work,L),t.lenbits=L.bits,Q){i.msg="invalid literal/lengths set",t.mode=de;break}if(t.distbits=6,t.distcode=t.distdyn,L={bits:t.distbits},Q=fn(cu,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,L),t.distbits=L.bits,Q){i.msg="invalid distances set",t.mode=de;break}if(t.mode=ia,e===ta)break e;case ia:t.mode=ra;case ra: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,Qf(i,y),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===Nt&&(t.back=-1);break}for(t.back=0;S=t.lencode[c&(1<<t.lenbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(A&&(A&240)===0){for(b=E,T=A,R=k;S=t.lencode[R+((c&(1<<b+T)-1)>>b)],E=S>>>24,A=S>>>16&255,k=S&65535,!(b+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=b,u-=b,t.back+=b}if(c>>>=E,u-=E,t.back+=E,t.length=k,A===0){t.mode=zc;break}if(A&32){t.back=-1,t.mode=Nt;break}if(A&64){i.msg="invalid literal/length code",t.mode=de;break}t.extra=A&15,t.mode=Bc;case Bc:if(t.extra){for(W=t.extra;u<W;){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=qc;case qc:for(;S=t.distcode[c&(1<<t.distbits)-1],E=S>>>24,A=S>>>16&255,k=S&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((A&240)===0){for(b=E,T=A,R=k;S=t.distcode[R+((c&(1<<b+T)-1)>>b)],E=S>>>24,A=S>>>16&255,k=S&65535,!(b+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=b,u-=b,t.back+=b}if(c>>>=E,u-=E,t.back+=E,A&64){i.msg="invalid distance code",t.mode=de;break}t.offset=k,t.extra=A&15,t.mode=Hc;case Hc:if(t.extra){for(W=t.extra;u<W;){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=de;break}t.mode=Vc;case Vc:if(l===0)break e;if(d=y-l,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=de;break}d>t.wnext?(d-=t.wnext,p=t.wsize-d):p=t.wnext-d,d>t.length&&(d=t.length),f=t.window}else f=n,p=s-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do n[s++]=f[p++];while(--d);t.length===0&&(t.mode=ra);break;case zc:if(l===0)break e;n[s++]=t.length,l--,t.mode=ra;break;case Rs:if(t.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<<u,u+=8}if(y-=l,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?xe(t.check,n,y,s-y):En(t.check,n,y,s-y)),y=l,t.wrap&4&&(t.flags?c:Qc(c))!==t.check){i.msg="incorrect data check",t.mode=de;break}c=0,u=0}t.mode=Wc;case Wc: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=de;break}c=0,u=0}t.mode=Kc;case Kc:Q=ih;break e;case de:Q=lu;break e;case du:return uu;case pu:default:return lt}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||y!==i.avail_out&&t.mode<de&&(t.mode<Rs||e!==$c))&&yu(i,i.output,i.next_out,y-i.avail_out),m-=i.avail_in,y-=i.avail_out,i.total_in+=m,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?xe(t.check,n,y,i.next_out-y):En(t.check,n,y,i.next_out-y)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Nt?128:0)+(t.mode===ia||t.mode===Ns?256:0),(m===0&&y===0||e===$c)&&Q===ji&&(Q=nh),Q},fh=i=>{if(Gi(i))return lt;let e=i.state;return e.window&&(e.window=null),i.state=null,ji},hh=(i,e)=>{if(Gi(i))return lt;let t=i.state;return(t.wrap&2)===0?lt:(t.head=e,e.done=!1,ji)},gh=(i,e)=>{let t=e.length,r,n,a;return Gi(i)||(r=i.state,r.wrap!==0&&r.mode!==Da)?lt:r.mode===Da&&(n=1,n=En(n,e,t,0),n!==r.check)?lu:(a=yu(i,e,t,t),a?(r.mode=du,uu):(r.havedict=1,ji))},mh=hu,yh=gu,vh=fu,bh=uh,wh=mu,Sh=ph,_h=fh,Eh=hh,xh=gh,$h="pako inflate (from Nodeca project)",Mt={inflateReset:mh,inflateReset2:yh,inflateResetKeep:vh,inflateInit:bh,inflateInit2:wh,inflate:Sh,inflateEnd:_h,inflateGetHeader:Eh,inflateSetDictionary:xh,inflateInfo:$h};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 kh=Ah,vu=Object.prototype.toString,{Z_NO_FLUSH:Ih,Z_FINISH:Th,Z_OK:An,Z_STREAM_END:Ds,Z_NEED_DICT:Ms,Z_STREAM_ERROR:Ch,Z_DATA_ERROR:Zc,Z_MEM_ERROR:Lh}=Qi;function Rn(i){this.options=Ja.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 au,this.strm.avail_out=0;let t=Mt.inflateInit2(this.strm,e.windowBits);if(t!==An)throw new Error(Ui[t]);if(this.header=new kh,Mt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=$n.string2buf(e.dictionary):vu.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Mt.inflateSetDictionary(this.strm,e.dictionary),t!==An)))throw new Error(Ui[t])}Rn.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?Th:Ih,vu.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=Mt.inflate(t,s),a===Ms&&n&&(a=Mt.inflateSetDictionary(t,n),a===An?a=Mt.inflate(t,s):a===Zc&&(a=Ms));t.avail_in>0&&a===Ds&&t.state.wrap>0&&i[t.next_in]!==0;)Mt.inflateReset(t),a=Mt.inflate(t,s);switch(a){case Ch:case Zc:case Ms:case Lh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===Ds))if(this.options.to==="string"){let l=$n.utf8border(t.output,t.next_out),c=t.next_out-l,u=$n.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===An&&o===0)){if(a===Ds)return a=Mt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Rn.prototype.onData=function(i){this.chunks.push(i)};Rn.prototype.onEnd=function(i){i===An&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ja.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function So(i,e){let t=new Rn(e);if(t.push(i),t.err)throw t.msg||Ui[t.err];return t.result}function Nh(i,e){return e=e||{},e.raw=!0,So(i,e)}var Rh=Rn,Ph=So,Oh=Nh,Dh=So,Mh=Qi,Uh={Inflate:Rh,inflate:Ph,inflateRaw:Oh,ungzip:Dh,constants:Mh},{Deflate:Fh,deflate:jh,deflateRaw:Bh,gzip:qh}=Wf,{Inflate:Hh,inflate:Vh,inflateRaw:zh,ungzip:Wh}=Uh,Kh=Fh,Qh=jh,Gh=Bh,Zh=qh,Jh=Hh,Yh=Vh,Xh=zh,eg=Wh,tg=Qi,ig={Deflate:Kh,deflate:Qh,deflateRaw:Gh,gzip:Zh,Inflate:Jh,inflate:Yh,inflateRaw:Xh,ungzip:eg,constants:tg},ce=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},le=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ma=class{constructor(e,t){this.input=e,this.output=t}};ce([h(),le("design:type",String)],Ma.prototype,"input",void 0);ce([h(),le("design:type",String)],Ma.prototype,"output",void 0);Ma=ce([Ae(),le("design:paramtypes",[String,String])],Ma);var Ua=class{constructor(e,t){this.input=e,this.output=t}};ce([h(),le("design:type",String)],Ua.prototype,"input",void 0);ce([h(),le("design:type",String)],Ua.prototype,"output",void 0);Ua=ce([F(),le("design:paramtypes",[String,String])],Ua);var ni=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};ce([h(),le("design:type",String)],ni.prototype,"name",void 0);ce([h(),le("design:type",String)],ni.prototype,"modelId",void 0);ce([h(),le("design:type",String)],ni.prototype,"systemPrompt",void 0);ce([h(),le("design:type",Array)],ni.prototype,"promptExamples",void 0);ce([h(),le("design:type",String)],ni.prototype,"metaData",void 0);ni=ce([Ae(),le("design:paramtypes",[String,String,String,Array,String])],ni);var Tt=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}};ce([h(),le("design:type",String)],Tt.prototype,"name",void 0);ce([h(),le("design:type",String)],Tt.prototype,"modelId",void 0);ce([h(),le("design:type",String)],Tt.prototype,"taskId",void 0);ce([h(),le("design:type",String)],Tt.prototype,"systemPrompt",void 0);ce([h(),le("design:type",Array)],Tt.prototype,"promptExamples",void 0);ce([h(),le("design:type",String)],Tt.prototype,"metaData",void 0);ce([h(),le("design:type",String)],Tt.prototype,"createdAt",void 0);ce([h(),le("design:type",String)],Tt.prototype,"updatedAt",void 0);Tt=ce([F(),le("design:paramtypes",[String,String,String,String,Array,String,String,String])],Tt);var Bi=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};ce([h(),le("design:type",String)],Bi.prototype,"model",void 0);ce([h(),le("design:type",String)],Bi.prototype,"status",void 0);ce([h(),le("design:type",Number)],Bi.prototype,"progress",void 0);ce([h(),le("design:type",Boolean)],Bi.prototype,"downloaded",void 0);ce([h(),le("design:type",Boolean)],Bi.prototype,"loaded",void 0);Bi=ce([F(),le("design:paramtypes",[String,String,Number,Boolean,Boolean])],Bi);var rg=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},Se=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,va,so=class{constructor(e,t=!0){be.set(this,void 0),va.set(this,new Map),rg(this,be,e,"f")}async getModels(){let e=await Se(this,be,"f").query({query:v`
1202
+ }`,variables:{url:e,interactionCall:t}}));return r}};jt=new WeakMap;var ts={};ts.byteLength=vp;ts.toByteArray=wp;ts.fromByteArray=xp;var At=[],ct=[],yp=typeof Uint8Array<"u"?Uint8Array:Array,Ls="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(xi=0,$c=Ls.length;xi<$c;++xi)At[xi]=Ls[xi],ct[Ls.charCodeAt(xi)]=xi;var xi,$c;ct["-".charCodeAt(0)]=62;ct["_".charCodeAt(0)]=63;function Yl(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 vp(i){var e=Yl(i),t=e[0],r=e[1];return(t+r)*3/4-r}function bp(i,e,t){return(e+t)*3/4-t}function wp(i){var e,t=Yl(i),r=t[0],n=t[1],a=new yp(bp(i,r,n)),s=0,o=n>0?r-4:r,l;for(l=0;l<o;l+=4)e=ct[i.charCodeAt(l)]<<18|ct[i.charCodeAt(l+1)]<<12|ct[i.charCodeAt(l+2)]<<6|ct[i.charCodeAt(l+3)],a[s++]=e>>16&255,a[s++]=e>>8&255,a[s++]=e&255;return n===2&&(e=ct[i.charCodeAt(l)]<<2|ct[i.charCodeAt(l+1)]>>4,a[s++]=e&255),n===1&&(e=ct[i.charCodeAt(l)]<<10|ct[i.charCodeAt(l+1)]<<4|ct[i.charCodeAt(l+2)]>>2,a[s++]=e>>8&255,a[s++]=e&255),a}function Sp(i){return At[i>>18&63]+At[i>>12&63]+At[i>>6&63]+At[i&63]}function _p(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(Sp(r));return n.join("")}function xp(i){for(var e,t=i.length,r=t%3,n=[],a=16383,s=0,o=t-r;s<o;s+=a)n.push(_p(i,s,s+a>o?o:s+a));return r===1?(e=i[t-1],n.push(At[e>>2]+At[e<<4&63]+"==")):r===2&&(e=(i[t-2]<<8)+i[t-1],n.push(At[e>>10]+At[e>>4&63]+At[e<<2&63]+"=")),n.join("")}var Ep=4,Ac=0,kc=1,$p=2;function Cr(i){let e=i.length;for(;--e>=0;)i[e]=0}var Ap=0,Xl=1,kp=2,Ip=3,Tp=258,xo=29,On=256,En=On+1+xo,yr=30,Eo=19,eu=2*En+1,Ni=15,Ps=16,Cp=7,$o=256,tu=16,iu=17,ru=18,ao=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]),xa=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]),Lp=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),nu=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pp=512,Bt=new Array((En+2)*2);Cr(Bt);var mn=new Array(yr*2);Cr(mn);var $n=new Array(Pp);Cr($n);var An=new Array(Tp-Ip+1);Cr(An);var Ao=new Array(xo);Cr(Ao);var ja=new Array(yr);Cr(ja);function Rs(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 au,su,ou;function Ns(i,e){this.dyn_tree=i,this.max_code=0,this.stat_desc=e}var cu=i=>i<256?$n[i]:$n[256+(i>>>7)],kn=(i,e)=>{i.pending_buf[i.pending++]=e&255,i.pending_buf[i.pending++]=e>>>8&255},Ye=(i,e,t)=>{i.bi_valid>Ps-t?(i.bi_buf|=e<<i.bi_valid&65535,kn(i,i.bi_buf),i.bi_buf=e>>Ps-i.bi_valid,i.bi_valid+=t-Ps):(i.bi_buf|=e<<i.bi_valid&65535,i.bi_valid+=t)},kt=(i,e,t)=>{Ye(i,t[e*2],t[e*2+1])},lu=(i,e)=>{let t=0;do t|=i&1,i>>>=1,t<<=1;while(--e>0);return t>>>1},Rp=i=>{i.bi_valid===16?(kn(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)},Np=(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,m,y,d,f,g=0;for(y=0;y<=Ni;y++)i.bl_count[y]=0;for(t[i.heap[i.heap_max]*2+1]=0,c=i.heap_max+1;c<eu;c++)u=i.heap[c],y=t[t[u*2+1]*2+1]+1,y>l&&(y=l,g++),t[u*2+1]=y,!(u>r)&&(i.bl_count[y]++,d=0,u>=o&&(d=s[u-o]),f=t[u*2],i.opt_len+=f*(y+d),a&&(i.static_len+=f*(n[u*2+1]+d)));if(g!==0){do{for(y=l-1;i.bl_count[y]===0;)y--;i.bl_count[y]--,i.bl_count[y+1]+=2,i.bl_count[l]--,g-=2}while(g>0);for(y=l;y!==0;y--)for(u=i.bl_count[y];u!==0;)m=i.heap[--c],!(m>r)&&(t[m*2+1]!==y&&(i.opt_len+=(y-t[m*2+1])*t[m*2],t[m*2+1]=y),u--)}},uu=(i,e,t)=>{let r=new Array(Ni+1),n=0,a,s;for(a=1;a<=Ni;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]=lu(r[o]++,o))}},Op=()=>{let i,e,t,r,n,a=new Array(Ni+1);for(t=0,r=0;r<xo-1;r++)for(Ao[r]=t,i=0;i<1<<ao[r];i++)An[t++]=r;for(An[t-1]=r,n=0,r=0;r<16;r++)for(ja[r]=n,i=0;i<1<<xa[r];i++)$n[n++]=r;for(n>>=7;r<yr;r++)for(ja[r]=n<<7,i=0;i<1<<xa[r]-7;i++)$n[256+n++]=r;for(e=0;e<=Ni;e++)a[e]=0;for(i=0;i<=143;)Bt[i*2+1]=8,i++,a[8]++;for(;i<=255;)Bt[i*2+1]=9,i++,a[9]++;for(;i<=279;)Bt[i*2+1]=7,i++,a[7]++;for(;i<=287;)Bt[i*2+1]=8,i++,a[8]++;for(uu(Bt,En+1,a),i=0;i<yr;i++)mn[i*2+1]=5,mn[i*2]=lu(i,5);au=new Rs(Bt,ao,On+1,En,Ni),su=new Rs(mn,xa,0,yr,Ni),ou=new Rs(new Array(0),Lp,0,Eo,Cp)},du=i=>{let e;for(e=0;e<En;e++)i.dyn_ltree[e*2]=0;for(e=0;e<yr;e++)i.dyn_dtree[e*2]=0;for(e=0;e<Eo;e++)i.bl_tree[e*2]=0;i.dyn_ltree[$o*2]=1,i.opt_len=i.static_len=0,i.sym_next=i.matches=0},pu=i=>{i.bi_valid>8?kn(i,i.bi_buf):i.bi_valid>0&&(i.pending_buf[i.pending++]=i.bi_buf),i.bi_buf=0,i.bi_valid=0},Ic=(i,e,t,r)=>{let n=e*2,a=t*2;return i[n]<i[a]||i[n]===i[a]&&r[e]<=r[t]},Os=(i,e,t)=>{let r=i.heap[t],n=t<<1;for(;n<=i.heap_len&&(n<i.heap_len&&Ic(e,i.heap[n+1],i.heap[n],i.depth)&&n++,!Ic(e,r,i.heap[n],i.depth));)i.heap[t]=i.heap[n],t=n,n<<=1;i.heap[t]=r},Tc=(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?kt(i,n,e):(s=An[n],kt(i,s+On+1,e),o=ao[s],o!==0&&(n-=Ao[s],Ye(i,n,o)),r--,s=cu(r),kt(i,s,t),o=xa[s],o!==0&&(r-=ja[s],Ye(i,r,o)));while(a<i.sym_next);kt(i,$o,e)},so=(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=eu,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--)Os(i,t,s);c=a;do s=i.heap[1],i.heap[1]=i.heap[i.heap_len--],Os(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++,Os(i,t,1);while(i.heap_len>=2);i.heap[--i.heap_max]=i.heap[1],Np(i,e),uu(t,l,i.bl_count)},Cc=(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[tu*2]++):o<=10?i.bl_tree[iu*2]++:i.bl_tree[ru*2]++,o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4))},Lc=(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 kt(i,a,i.bl_tree);while(--o!==0);else a!==0?(a!==n&&(kt(i,a,i.bl_tree),o--),kt(i,tu,i.bl_tree),Ye(i,o-3,2)):o<=10?(kt(i,iu,i.bl_tree),Ye(i,o-3,3)):(kt(i,ru,i.bl_tree),Ye(i,o-11,7));o=0,n=a,s===0?(l=138,c=3):a===s?(l=6,c=3):(l=7,c=4)}},Dp=i=>{let e;for(Cc(i,i.dyn_ltree,i.l_desc.max_code),Cc(i,i.dyn_dtree,i.d_desc.max_code),so(i,i.bl_desc),e=Eo-1;e>=3&&i.bl_tree[nu[e]*2+1]===0;e--);return i.opt_len+=3*(e+1)+5+5+4,e},Up=(i,e,t,r)=>{let n;for(Ye(i,e-257,5),Ye(i,t-1,5),Ye(i,r-4,4),n=0;n<r;n++)Ye(i,i.bl_tree[nu[n]*2+1],3);Lc(i,i.dyn_ltree,e-1),Lc(i,i.dyn_dtree,t-1)},Mp=i=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&i.dyn_ltree[t*2]!==0)return Ac;if(i.dyn_ltree[9*2]!==0||i.dyn_ltree[10*2]!==0||i.dyn_ltree[13*2]!==0)return kc;for(t=32;t<On;t++)if(i.dyn_ltree[t*2]!==0)return kc;return Ac},Pc=!1,Fp=i=>{Pc||(Op(),Pc=!0),i.l_desc=new Ns(i.dyn_ltree,au),i.d_desc=new Ns(i.dyn_dtree,su),i.bl_desc=new Ns(i.bl_tree,ou),i.bi_buf=0,i.bi_valid=0,du(i)},fu=(i,e,t,r)=>{Ye(i,(Ap<<1)+(r?1:0),3),pu(i),kn(i,t),kn(i,~t),t&&i.pending_buf.set(i.window.subarray(e,e+t),i.pending),i.pending+=t},jp=i=>{Ye(i,Xl<<1,3),kt(i,$o,Bt),Rp(i)},Bp=(i,e,t,r)=>{let n,a,s=0;i.level>0?(i.strm.data_type===$p&&(i.strm.data_type=Mp(i)),so(i,i.l_desc),so(i,i.d_desc),s=Dp(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?fu(i,e,t,r):i.strategy===Ep||a===n?(Ye(i,(Xl<<1)+(r?1:0),3),Tc(i,Bt,mn)):(Ye(i,(kp<<1)+(r?1:0),3),Up(i,i.l_desc.max_code+1,i.d_desc.max_code+1,s+1),Tc(i,i.dyn_ltree,i.dyn_dtree)),du(i),r&&pu(i)},qp=(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[(An[t]+On+1)*2]++,i.dyn_dtree[cu(e)*2]++),i.sym_next===i.sym_end),Hp=Fp,zp=fu,Vp=Bp,Wp=qp,Kp=jp,Qp={_tr_init:Hp,_tr_stored_block:zp,_tr_flush_block:Vp,_tr_tally:Wp,_tr_align:Kp},Gp=(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},In=Gp,Zp=()=>{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},Jp=new Uint32Array(Zp()),Yp=(i,e,t,r)=>{let n=Jp,a=r+t;i^=-1;for(let s=r;s<a;s++)i=i>>>8^n[(i^e[s])&255];return i^-1},ke=Yp,zi={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"},Xi={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:Xp,_tr_stored_block:oo,_tr_flush_block:ef,_tr_tally:ri,_tr_align:tf}=Qp,{Z_NO_FLUSH:ni,Z_PARTIAL_FLUSH:rf,Z_FULL_FLUSH:nf,Z_FINISH:ut,Z_BLOCK:Rc,Z_OK:Pe,Z_STREAM_END:Nc,Z_STREAM_ERROR:Ct,Z_DATA_ERROR:af,Z_BUF_ERROR:Ds,Z_DEFAULT_COMPRESSION:sf,Z_FILTERED:of,Z_HUFFMAN_ONLY:aa,Z_RLE:cf,Z_FIXED:lf,Z_DEFAULT_STRATEGY:uf,Z_UNKNOWN:df,Z_DEFLATED:is}=Xi,pf=9,ff=15,hf=8,gf=29,mf=256,co=mf+1+gf,yf=30,vf=19,bf=2*co+1,wf=15,te=3,Xt=258,Lt=Xt+te+1,Sf=32,_r=42,ko=57,lo=69,uo=73,po=91,fo=103,Oi=113,cn=666,qe=1,Lr=2,Vi=3,Pr=4,_f=3,Di=(i,e)=>(i.msg=zi[e],e),Oc=i=>i*2-(i>4?9:0),Yt=i=>{let e=i.length;for(;--e>=0;)i[e]=0},xf=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)},Ef=(i,e,t)=>(e<<i.hash_shift^t)&i.hash_mask,ai=Ef,tt=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))},rt=(i,e)=>{ef(i,i.block_start>=0?i.block_start:-1,i.strstart-i.block_start,e),i.block_start=i.strstart,tt(i.strm)},se=(i,e)=>{i.pending_buf[i.pending++]=e},Wr=(i,e)=>{i.pending_buf[i.pending++]=e>>>8&255,i.pending_buf[i.pending++]=e&255},ho=(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=In(i.adler,e,n,t):i.state.wrap===2&&(i.adler=ke(i.adler,e,n,t)),i.next_in+=n,i.total_in+=n,n)},hu=(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-Lt?i.strstart-(i.w_size-Lt):0,c=i.window,u=i.w_mask,m=i.prev,y=i.strstart+Xt,d=c[r+s-1],f=c[r+s];i.prev_length>=i.good_match&&(t>>=2),o>i.lookahead&&(o=i.lookahead);do if(n=e,!(c[n+s]!==f||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<y);if(a=Xt-(y-r),r=y-Xt,a>s){if(i.match_start=e,s=a,a>=o)break;d=c[r+s-1],f=c[r+s]}}while((e=m[e&u])>l&&--t!==0);return s<=i.lookahead?s:i.lookahead},xr=i=>{let e=i.w_size,t,r,n;do{if(r=i.window_size-i.lookahead-i.strstart,i.strstart>=e+(e-Lt)&&(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),xf(i),r+=e),i.strm.avail_in===0)break;if(t=ho(i.strm,i.window,i.strstart+i.lookahead,r),i.lookahead+=t,i.lookahead+i.insert>=te)for(n=i.strstart-i.insert,i.ins_h=i.window[n],i.ins_h=ai(i,i.ins_h,i.window[n+1]);i.insert&&(i.ins_h=ai(i,i.ins_h,i.window[n+te-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<te)););}while(i.lookahead<Lt&&i.strm.avail_in!==0)},gu=(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!==ut||e===ni||r!==n+i.strm.avail_in)))break;s=e===ut&&r===n+i.strm.avail_in?1:0,oo(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,tt(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&&(ho(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?Pr:e!==ni&&e!==ut&&i.strm.avail_in===0&&i.strstart===i.block_start?Lr:(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&&(ho(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===ut)&&e!==ni&&i.strm.avail_in===0&&n<=a)&&(r=n>a?a:n,s=e===ut&&i.strm.avail_in===0&&r===n?1:0,oo(i,i.block_start,r,s),i.block_start+=r,tt(i.strm)),s?Vi:qe)},Us=(i,e)=>{let t,r;for(;;){if(i.lookahead<Lt){if(xr(i),i.lookahead<Lt&&e===ni)return qe;if(i.lookahead===0)break}if(t=0,i.lookahead>=te&&(i.ins_h=ai(i,i.ins_h,i.window[i.strstart+te-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-Lt&&(i.match_length=hu(i,t)),i.match_length>=te)if(r=ri(i,i.strstart-i.match_start,i.match_length-te),i.lookahead-=i.match_length,i.match_length<=i.max_lazy_match&&i.lookahead>=te){i.match_length--;do i.strstart++,i.ins_h=ai(i,i.ins_h,i.window[i.strstart+te-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=ai(i,i.ins_h,i.window[i.strstart+1]);else r=ri(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++;if(r&&(rt(i,!1),i.strm.avail_out===0))return qe}return i.insert=i.strstart<te-1?i.strstart:te-1,e===ut?(rt(i,!0),i.strm.avail_out===0?Vi:Pr):i.sym_next&&(rt(i,!1),i.strm.avail_out===0)?qe:Lr},dr=(i,e)=>{let t,r,n;for(;;){if(i.lookahead<Lt){if(xr(i),i.lookahead<Lt&&e===ni)return qe;if(i.lookahead===0)break}if(t=0,i.lookahead>=te&&(i.ins_h=ai(i,i.ins_h,i.window[i.strstart+te-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=te-1,t!==0&&i.prev_length<i.max_lazy_match&&i.strstart-t<=i.w_size-Lt&&(i.match_length=hu(i,t),i.match_length<=5&&(i.strategy===of||i.match_length===te&&i.strstart-i.match_start>4096)&&(i.match_length=te-1)),i.prev_length>=te&&i.match_length<=i.prev_length){n=i.strstart+i.lookahead-te,r=ri(i,i.strstart-1-i.prev_match,i.prev_length-te),i.lookahead-=i.prev_length-1,i.prev_length-=2;do++i.strstart<=n&&(i.ins_h=ai(i,i.ins_h,i.window[i.strstart+te-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=te-1,i.strstart++,r&&(rt(i,!1),i.strm.avail_out===0))return qe}else if(i.match_available){if(r=ri(i,0,i.window[i.strstart-1]),r&&rt(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=ri(i,0,i.window[i.strstart-1]),i.match_available=0),i.insert=i.strstart<te-1?i.strstart:te-1,e===ut?(rt(i,!0),i.strm.avail_out===0?Vi:Pr):i.sym_next&&(rt(i,!1),i.strm.avail_out===0)?qe:Lr},$f=(i,e)=>{let t,r,n,a,s=i.window;for(;;){if(i.lookahead<=Xt){if(xr(i),i.lookahead<=Xt&&e===ni)return qe;if(i.lookahead===0)break}if(i.match_length=0,i.lookahead>=te&&i.strstart>0&&(n=i.strstart-1,r=s[n],r===s[++n]&&r===s[++n]&&r===s[++n])){a=i.strstart+Xt;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=Xt-(a-n),i.match_length>i.lookahead&&(i.match_length=i.lookahead)}if(i.match_length>=te?(t=ri(i,1,i.match_length-te),i.lookahead-=i.match_length,i.strstart+=i.match_length,i.match_length=0):(t=ri(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++),t&&(rt(i,!1),i.strm.avail_out===0))return qe}return i.insert=0,e===ut?(rt(i,!0),i.strm.avail_out===0?Vi:Pr):i.sym_next&&(rt(i,!1),i.strm.avail_out===0)?qe:Lr},Af=(i,e)=>{let t;for(;;){if(i.lookahead===0&&(xr(i),i.lookahead===0)){if(e===ni)return qe;break}if(i.match_length=0,t=ri(i,0,i.window[i.strstart]),i.lookahead--,i.strstart++,t&&(rt(i,!1),i.strm.avail_out===0))return qe}return i.insert=0,e===ut?(rt(i,!0),i.strm.avail_out===0?Vi:Pr):i.sym_next&&(rt(i,!1),i.strm.avail_out===0)?qe:Lr};function St(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 ln=[new St(0,0,0,0,gu),new St(4,4,8,4,Us),new St(4,5,16,8,Us),new St(4,6,32,32,Us),new St(4,4,16,16,dr),new St(8,16,32,32,dr),new St(8,16,128,128,dr),new St(8,32,128,256,dr),new St(32,128,258,1024,dr),new St(32,258,258,4096,dr)],kf=i=>{i.window_size=2*i.w_size,Yt(i.head),i.max_lazy_match=ln[i.level].max_lazy,i.good_match=ln[i.level].good_length,i.nice_match=ln[i.level].nice_length,i.max_chain_length=ln[i.level].max_chain,i.strstart=0,i.block_start=0,i.lookahead=0,i.insert=0,i.match_length=i.prev_length=te-1,i.match_available=0,i.ins_h=0};function If(){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=is,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(bf*2),this.dyn_dtree=new Uint16Array((2*yf+1)*2),this.bl_tree=new Uint16Array((2*vf+1)*2),Yt(this.dyn_ltree),Yt(this.dyn_dtree),Yt(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(wf+1),this.heap=new Uint16Array(2*co+1),Yt(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*co+1),Yt(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 Dn=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.status!==_r&&e.status!==ko&&e.status!==lo&&e.status!==uo&&e.status!==po&&e.status!==fo&&e.status!==Oi&&e.status!==cn?1:0},mu=i=>{if(Dn(i))return Di(i,Ct);i.total_in=i.total_out=0,i.data_type=df;let e=i.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?ko:e.wrap?_r:Oi,i.adler=e.wrap===2?0:1,e.last_flush=-2,Xp(e),Pe},yu=i=>{let e=mu(i);return e===Pe&&kf(i.state),e},Tf=(i,e)=>Dn(i)||i.state.wrap!==2?Ct:(i.state.gzhead=e,Pe),vu=(i,e,t,r,n,a)=>{if(!i)return Ct;let s=1;if(e===sf&&(e=6),r<0?(s=0,r=-r):r>15&&(s=2,r-=16),n<1||n>pf||t!==is||r<8||r>15||e<0||e>9||a<0||a>lf||r===8&&s!==1)return Di(i,Ct);r===8&&(r=9);let o=new If;return i.state=o,o.strm=i,o.status=_r,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+te-1)/te),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,yu(i)},Cf=(i,e)=>vu(i,e,is,ff,hf,uf),Lf=(i,e)=>{if(Dn(i)||e>Rc||e<0)return i?Di(i,Ct):Ct;let t=i.state;if(!i.output||i.avail_in!==0&&!i.input||t.status===cn&&e!==ut)return Di(i,i.avail_out===0?Ds:Ct);let r=t.last_flush;if(t.last_flush=e,t.pending!==0){if(tt(i),i.avail_out===0)return t.last_flush=-1,Pe}else if(i.avail_in===0&&Oc(e)<=Oc(r)&&e!==ut)return Di(i,Ds);if(t.status===cn&&i.avail_in!==0)return Di(i,Ds);if(t.status===_r&&t.wrap===0&&(t.status=Oi),t.status===_r){let n=is+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=aa||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Sf),n+=31-n%31,Wr(t,n),t.strstart!==0&&(Wr(t,i.adler>>>16),Wr(t,i.adler&65535)),i.adler=1,t.status=Oi,tt(i),t.pending!==0)return t.last_flush=-1,Pe}if(t.status===ko){if(i.adler=0,se(t,31),se(t,139),se(t,8),t.gzhead)se(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)),se(t,t.gzhead.time&255),se(t,t.gzhead.time>>8&255),se(t,t.gzhead.time>>16&255),se(t,t.gzhead.time>>24&255),se(t,t.level===9?2:t.strategy>=aa||t.level<2?4:0),se(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(se(t,t.gzhead.extra.length&255),se(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(i.adler=ke(i.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=lo;else if(se(t,0),se(t,0),se(t,0),se(t,0),se(t,0),se(t,t.level===9?2:t.strategy>=aa||t.level<2?4:0),se(t,_f),t.status=Oi,tt(i),t.pending!==0)return t.last_flush=-1,Pe}if(t.status===lo){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=ke(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=o,tt(i),t.pending!==0)return t.last_flush=-1,Pe;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=ke(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=uo}if(t.status===uo){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=ke(i.adler,t.pending_buf,t.pending-n,n)),tt(i),t.pending!==0)return t.last_flush=-1,Pe;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,se(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=ke(i.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=po}if(t.status===po){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=ke(i.adler,t.pending_buf,t.pending-n,n)),tt(i),t.pending!==0)return t.last_flush=-1,Pe;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,se(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(i.adler=ke(i.adler,t.pending_buf,t.pending-n,n))}t.status=fo}if(t.status===fo){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(tt(i),t.pending!==0))return t.last_flush=-1,Pe;se(t,i.adler&255),se(t,i.adler>>8&255),i.adler=0}if(t.status=Oi,tt(i),t.pending!==0)return t.last_flush=-1,Pe}if(i.avail_in!==0||t.lookahead!==0||e!==ni&&t.status!==cn){let n=t.level===0?gu(t,e):t.strategy===aa?Af(t,e):t.strategy===cf?$f(t,e):ln[t.level].func(t,e);if((n===Vi||n===Pr)&&(t.status=cn),n===qe||n===Vi)return i.avail_out===0&&(t.last_flush=-1),Pe;if(n===Lr&&(e===rf?tf(t):e!==Rc&&(oo(t,0,0,!1),e===nf&&(Yt(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),tt(i),i.avail_out===0))return t.last_flush=-1,Pe}return e!==ut?Pe:t.wrap<=0?Nc:(t.wrap===2?(se(t,i.adler&255),se(t,i.adler>>8&255),se(t,i.adler>>16&255),se(t,i.adler>>24&255),se(t,i.total_in&255),se(t,i.total_in>>8&255),se(t,i.total_in>>16&255),se(t,i.total_in>>24&255)):(Wr(t,i.adler>>>16),Wr(t,i.adler&65535)),tt(i),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Pe:Nc)},Pf=i=>{if(Dn(i))return Ct;let e=i.state.status;return i.state=null,e===Oi?Di(i,af):Pe},Rf=(i,e)=>{let t=e.length;if(Dn(i))return Ct;let r=i.state,n=r.wrap;if(n===2||n===1&&r.status!==_r||r.lookahead)return Ct;if(n===1&&(i.adler=In(i.adler,e,t,0)),r.wrap=0,t>=r.w_size){n===0&&(Yt(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,xr(r);r.lookahead>=te;){let l=r.strstart,c=r.lookahead-(te-1);do r.ins_h=ai(r,r.ins_h,r.window[l+te-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=te-1,xr(r)}return r.strstart+=r.lookahead,r.block_start=r.strstart,r.insert=r.lookahead,r.lookahead=0,r.match_length=r.prev_length=te-1,r.match_available=0,i.next_in=s,i.input=o,i.avail_in=a,r.wrap=n,Pe},Nf=Cf,Of=vu,Df=yu,Uf=mu,Mf=Tf,Ff=Lf,jf=Pf,Bf=Rf,qf="pako deflate (from Nodeca project)",yn={deflateInit:Nf,deflateInit2:Of,deflateReset:Df,deflateResetKeep:Uf,deflateSetHeader:Mf,deflate:Ff,deflateEnd:jf,deflateSetDictionary:Bf,deflateInfo:qf},Hf=(i,e)=>Object.prototype.hasOwnProperty.call(i,e),zf=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)Hf(t,r)&&(i[r]=t[r])}}return i},Vf=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},rs={assign:zf,flattenChunks:Vf},bu=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(i){bu=!1}var Tn=new Uint8Array(256);for(let i=0;i<256;i++)Tn[i]=i>=252?6:i>=248?5:i>=240?4:i>=224?3:i>=192?2:1;Tn[254]=Tn[254]=1;var Wf=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},Kf=(i,e)=>{if(e<65534&&i.subarray&&bu)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},Qf=(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=Tn[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 Kf(a,n)},Gf=(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+Tn[i[t]]>e?t:e},Cn={string2buf:Wf,buf2string:Qf,utf8border:Gf};function Zf(){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 wu=Zf,Su=Object.prototype.toString,{Z_NO_FLUSH:Jf,Z_SYNC_FLUSH:Yf,Z_FULL_FLUSH:Xf,Z_FINISH:eh,Z_OK:Ba,Z_STREAM_END:th,Z_DEFAULT_COMPRESSION:ih,Z_DEFAULT_STRATEGY:rh,Z_DEFLATED:nh}=Xi;function Un(i){this.options=rs.assign({level:ih,method:nh,chunkSize:16384,windowBits:15,memLevel:8,strategy:rh},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 wu,this.strm.avail_out=0;let t=yn.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Ba)throw new Error(zi[t]);if(e.header&&yn.deflateSetHeader(this.strm,e.header),e.dictionary){let r;if(typeof e.dictionary=="string"?r=Cn.string2buf(e.dictionary):Su.call(e.dictionary)==="[object ArrayBuffer]"?r=new Uint8Array(e.dictionary):r=e.dictionary,t=yn.deflateSetDictionary(this.strm,r),t!==Ba)throw new Error(zi[t]);this._dict_set=!0}}Un.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?eh:Jf,typeof i=="string"?t.input=Cn.string2buf(i):Su.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===Yf||a===Xf)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=yn.deflate(t,a),n===th)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=yn.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===Ba;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};Un.prototype.onData=function(i){this.chunks.push(i)};Un.prototype.onEnd=function(i){i===Ba&&(this.result=rs.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function Io(i,e){let t=new Un(e);if(t.push(i,!0),t.err)throw t.msg||zi[t.err];return t.result}function ah(i,e){return e=e||{},e.raw=!0,Io(i,e)}function sh(i,e){return e=e||{},e.gzip=!0,Io(i,e)}var oh=Un,ch=Io,lh=ah,uh=sh,dh=Xi,ph={Deflate:oh,deflate:ch,deflateRaw:lh,gzip:uh,constants:dh},sa=16209,fh=16191,hh=function i(e,t){let r,n,a,s,o,l,c,u,m,y,d,f,g,_,E,A,k,w,C,U,P,Q,V,R,W=e.state;r=e.next_in,V=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=W.dmax,c=W.wsize,u=W.whave,m=W.wnext,y=W.window,d=W.hold,f=W.bits,g=W.lencode,_=W.distcode,E=(1<<W.lenbits)-1,A=(1<<W.distbits)-1;e:do{f<15&&(d+=V[r++]<<f,f+=8,d+=V[r++]<<f,f+=8),k=g[d&E];t:for(;;){if(w=k>>>24,d>>>=w,f-=w,w=k>>>16&255,w===0)R[a++]=k&65535;else if(w&16){C=k&65535,w&=15,w&&(f<w&&(d+=V[r++]<<f,f+=8),C+=d&(1<<w)-1,d>>>=w,f-=w),f<15&&(d+=V[r++]<<f,f+=8,d+=V[r++]<<f,f+=8),k=_[d&A];i:for(;;){if(w=k>>>24,d>>>=w,f-=w,w=k>>>16&255,w&16){if(U=k&65535,w&=15,f<w&&(d+=V[r++]<<f,f+=8,f<w&&(d+=V[r++]<<f,f+=8)),U+=d&(1<<w)-1,U>l){e.msg="invalid distance too far back",W.mode=sa;break e}if(d>>>=w,f-=w,w=a-s,U>w){if(w=U-w,w>u&&W.sane){e.msg="invalid distance too far back",W.mode=sa;break e}if(P=0,Q=y,m===0){if(P+=c-w,w<C){C-=w;do R[a++]=y[P++];while(--w);P=a-U,Q=R}}else if(m<w){if(P+=c+m-w,w-=m,w<C){C-=w;do R[a++]=y[P++];while(--w);if(P=0,m<C){w=m,C-=w;do R[a++]=y[P++];while(--w);P=a-U,Q=R}}}else if(P+=m-w,w<C){C-=w;do R[a++]=y[P++];while(--w);P=a-U,Q=R}for(;C>2;)R[a++]=Q[P++],R[a++]=Q[P++],R[a++]=Q[P++],C-=3;C&&(R[a++]=Q[P++],C>1&&(R[a++]=Q[P++]))}else{P=a-U;do R[a++]=R[P++],R[a++]=R[P++],R[a++]=R[P++],C-=3;while(C>2);C&&(R[a++]=R[P++],C>1&&(R[a++]=R[P++]))}}else if((w&64)===0){k=_[(k&65535)+(d&(1<<w)-1)];continue i}else{e.msg="invalid distance code",W.mode=sa;break e}break}}else if((w&64)===0){k=g[(k&65535)+(d&(1<<w)-1)];continue t}else if(w&32){W.mode=fh;break e}else{e.msg="invalid literal/length code",W.mode=sa;break e}break}}while(r<n&&a<o);C=f>>3,r-=C,f-=C<<3,d&=(1<<f)-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),W.hold=d,W.bits=f},pr=15,Dc=852,Uc=592,Mc=0,Ms=1,Fc=2,gh=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]),mh=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]),yh=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]),vh=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]),bh=(i,e,t,r,n,a,s,o)=>{let l=o.bits,c=0,u=0,m=0,y=0,d=0,f=0,g=0,_=0,E=0,A=0,k,w,C,U,P,Q=null,V,R=new Uint16Array(pr+1),W=new Uint16Array(pr+1),We=null,Or,T,jn;for(c=0;c<=pr;c++)R[c]=0;for(u=0;u<r;u++)R[e[t+u]]++;for(d=l,y=pr;y>=1&&R[y]===0;y--);if(d>y&&(d=y),y===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,o.bits=1,0;for(m=1;m<y&&R[m]===0;m++);for(d<m&&(d=m),_=1,c=1;c<=pr;c++)if(_<<=1,_-=R[c],_<0)return-1;if(_>0&&(i===Mc||y!==1))return-1;for(W[1]=0,c=1;c<pr;c++)W[c+1]=W[c]+R[c];for(u=0;u<r;u++)e[t+u]!==0&&(s[W[e[t+u]]++]=u);if(i===Mc?(Q=We=s,V=20):i===Ms?(Q=gh,We=mh,V=257):(Q=yh,We=vh,V=0),A=0,u=0,c=m,P=a,f=d,g=0,C=-1,E=1<<d,U=E-1,i===Ms&&E>Dc||i===Fc&&E>Uc)return 1;for(;;){Or=c-g,s[u]+1<V?(T=0,jn=s[u]):s[u]>=V?(T=We[s[u]-V],jn=Q[s[u]-V]):(T=32+64,jn=0),k=1<<c-g,w=1<<f,m=w;do w-=k,n[P+(A>>g)+w]=Or<<24|T<<16|jn|0;while(w!==0);for(k=1<<c-1;A&k;)k>>=1;if(k!==0?(A&=k-1,A+=k):A=0,u++,--R[c]===0){if(c===y)break;c=e[t+s[u]]}if(c>d&&(A&U)!==C){for(g===0&&(g=d),P+=m,f=c-g,_=1<<f;f+g<y&&(_-=R[f+g],!(_<=0));)f++,_<<=1;if(E+=1<<f,i===Ms&&E>Dc||i===Fc&&E>Uc)return 1;C=A&U,n[C]=d<<24|f<<16|P-a|0}}return A!==0&&(n[P+A]=c-g<<24|64<<16|0),o.bits=d,0},vn=bh,wh=0,_u=1,xu=2,{Z_FINISH:jc,Z_BLOCK:Sh,Z_TREES:oa,Z_OK:Wi,Z_STREAM_END:_h,Z_NEED_DICT:xh,Z_STREAM_ERROR:pt,Z_DATA_ERROR:Eu,Z_MEM_ERROR:$u,Z_BUF_ERROR:Eh,Z_DEFLATED:Bc}=Xi,ns=16180,qc=16181,Hc=16182,zc=16183,Vc=16184,Wc=16185,Kc=16186,Qc=16187,Gc=16188,Zc=16189,qa=16190,Ut=16191,Fs=16192,Jc=16193,js=16194,Yc=16195,Xc=16196,el=16197,tl=16198,ca=16199,la=16200,il=16201,rl=16202,nl=16203,al=16204,sl=16205,Bs=16206,ol=16207,cl=16208,fe=16209,Au=16210,ku=16211,$h=852,Ah=592,kh=15,Ih=kh,ll=i=>(i>>>24&255)+(i>>>8&65280)+((i&65280)<<8)+((i&255)<<24);function Th(){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 er=i=>{if(!i)return 1;let e=i.state;return!e||e.strm!==i||e.mode<ns||e.mode>ku?1:0},Iu=i=>{if(er(i))return pt;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=ns,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($h),e.distcode=e.distdyn=new Int32Array(Ah),e.sane=1,e.back=-1,Wi},Tu=i=>{if(er(i))return pt;let e=i.state;return e.wsize=0,e.whave=0,e.wnext=0,Iu(i)},Cu=(i,e)=>{let t;if(er(i))return pt;let r=i.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?pt:(r.window!==null&&r.wbits!==e&&(r.window=null),r.wrap=t,r.wbits=e,Tu(i))},Lu=(i,e)=>{if(!i)return pt;let t=new Th;i.state=t,t.strm=i,t.window=null,t.mode=ns;let r=Cu(i,e);return r!==Wi&&(i.state=null),r},Ch=i=>Lu(i,Ih),ul=!0,qs,Hs,Lh=i=>{if(ul){qs=new Int32Array(512),Hs=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(vn(_u,i.lens,0,288,qs,0,i.work,{bits:9}),e=0;e<32;)i.lens[e++]=5;vn(xu,i.lens,0,32,Hs,0,i.work,{bits:5}),ul=!1}i.lencode=qs,i.lenbits=9,i.distcode=Hs,i.distbits=5},Pu=(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},Ph=(i,e)=>{let t,r,n,a,s,o,l,c,u,m,y,d,f,g,_=0,E,A,k,w,C,U,P,Q,V=new Uint8Array(4),R,W,We=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(er(i)||!i.output||!i.input&&i.avail_in!==0)return pt;t=i.state,t.mode===Ut&&(t.mode=Fs),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,m=o,y=l,Q=Wi;e:for(;;)switch(t.mode){case ns:if(t.wrap===0){t.mode=Fs;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,V[0]=c&255,V[1]=c>>>8&255,t.check=ke(t.check,V,2,0),c=0,u=0,t.mode=qc;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((c&255)<<8)+(c>>8))%31){i.msg="incorrect header check",t.mode=fe;break}if((c&15)!==Bc){i.msg="unknown compression method",t.mode=fe;break}if(c>>>=4,u-=4,P=(c&15)+8,t.wbits===0&&(t.wbits=P),P>15||P>t.wbits){i.msg="invalid window size",t.mode=fe;break}t.dmax=1<<t.wbits,t.flags=0,i.adler=t.check=1,t.mode=c&512?Zc:Ut,c=0,u=0;break;case qc:for(;u<16;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(t.flags=c,(t.flags&255)!==Bc){i.msg="unknown compression method",t.mode=fe;break}if(t.flags&57344){i.msg="unknown header flags set",t.mode=fe;break}t.head&&(t.head.text=c>>8&1),t.flags&512&&t.wrap&4&&(V[0]=c&255,V[1]=c>>>8&255,t.check=ke(t.check,V,2,0)),c=0,u=0,t.mode=Hc;case Hc: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&&(V[0]=c&255,V[1]=c>>>8&255,V[2]=c>>>16&255,V[3]=c>>>24&255,t.check=ke(t.check,V,4,0)),c=0,u=0,t.mode=zc;case zc: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&&(V[0]=c&255,V[1]=c>>>8&255,t.check=ke(t.check,V,2,0)),c=0,u=0,t.mode=Vc;case Vc: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&&(V[0]=c&255,V[1]=c>>>8&255,t.check=ke(t.check,V,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&&(P=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),P)),t.flags&512&&t.wrap&4&&(t.check=ke(t.check,r,d,a)),o-=d,a+=d,t.length-=d),t.length))break e;t.length=0,t.mode=Kc;case Kc:if(t.flags&2048){if(o===0)break e;d=0;do P=r[a+d++],t.head&&P&&t.length<65536&&(t.head.name+=String.fromCharCode(P));while(P&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=ke(t.check,r,d,a)),o-=d,a+=d,P)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Qc;case Qc:if(t.flags&4096){if(o===0)break e;d=0;do P=r[a+d++],t.head&&P&&t.length<65536&&(t.head.comment+=String.fromCharCode(P));while(P&&d<o);if(t.flags&512&&t.wrap&4&&(t.check=ke(t.check,r,d,a)),o-=d,a+=d,P)break e}else t.head&&(t.head.comment=null);t.mode=Gc;case Gc: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=fe;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=Ut;break;case Zc:for(;u<32;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}i.adler=t.check=ll(c),c=0,u=0,t.mode=qa;case qa: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,xh;i.adler=t.check=1,t.mode=Ut;case Ut:if(e===Sh||e===oa)break e;case Fs:if(t.last){c>>>=u&7,u-=u&7,t.mode=Bs;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=Jc;break;case 1:if(Lh(t),t.mode=ca,e===oa){c>>>=2,u-=2;break e}break;case 2:t.mode=Xc;break;case 3:i.msg="invalid block type",t.mode=fe}c>>>=2,u-=2;break;case Jc: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=fe;break}if(t.length=c&65535,c=0,u=0,t.mode=js,e===oa)break e;case js:t.mode=Yc;case Yc: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=Ut;break;case Xc: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=fe;break}t.have=0,t.mode=el;case el:for(;t.have<t.ncode;){for(;u<3;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}t.lens[We[t.have++]]=c&7,c>>>=3,u-=3}for(;t.have<19;)t.lens[We[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,R={bits:t.lenbits},Q=vn(wh,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,Q){i.msg="invalid code lengths set",t.mode=fe;break}t.have=0,t.mode=tl;case tl:for(;t.have<t.nlen+t.ndist;){for(;_=t.lencode[c&(1<<t.lenbits)-1],E=_>>>24,A=_>>>16&255,k=_&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(k<16)c>>>=E,u-=E,t.lens[t.have++]=k;else{if(k===16){for(W=E+2;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(c>>>=E,u-=E,t.have===0){i.msg="invalid bit length repeat",t.mode=fe;break}P=t.lens[t.have-1],d=3+(c&3),c>>>=2,u-=2}else if(k===17){for(W=E+3;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,P=0,d=3+(c&7),c>>>=3,u-=3}else{for(W=E+7;u<W;){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=E,u-=E,P=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=fe;break}for(;d--;)t.lens[t.have++]=P}}if(t.mode===fe)break;if(t.lens[256]===0){i.msg="invalid code -- missing end-of-block",t.mode=fe;break}if(t.lenbits=9,R={bits:t.lenbits},Q=vn(_u,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,Q){i.msg="invalid literal/lengths set",t.mode=fe;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},Q=vn(xu,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,Q){i.msg="invalid distances set",t.mode=fe;break}if(t.mode=ca,e===oa)break e;case ca:t.mode=la;case la: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,hh(i,y),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===Ut&&(t.back=-1);break}for(t.back=0;_=t.lencode[c&(1<<t.lenbits)-1],E=_>>>24,A=_>>>16&255,k=_&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if(A&&(A&240)===0){for(w=E,C=A,U=k;_=t.lencode[U+((c&(1<<w+C)-1)>>w)],E=_>>>24,A=_>>>16&255,k=_&65535,!(w+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=w,u-=w,t.back+=w}if(c>>>=E,u-=E,t.back+=E,t.length=k,A===0){t.mode=sl;break}if(A&32){t.back=-1,t.mode=Ut;break}if(A&64){i.msg="invalid literal/length code",t.mode=fe;break}t.extra=A&15,t.mode=il;case il:if(t.extra){for(W=t.extra;u<W;){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=rl;case rl:for(;_=t.distcode[c&(1<<t.distbits)-1],E=_>>>24,A=_>>>16&255,k=_&65535,!(E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}if((A&240)===0){for(w=E,C=A,U=k;_=t.distcode[U+((c&(1<<w+C)-1)>>w)],E=_>>>24,A=_>>>16&255,k=_&65535,!(w+E<=u);){if(o===0)break e;o--,c+=r[a++]<<u,u+=8}c>>>=w,u-=w,t.back+=w}if(c>>>=E,u-=E,t.back+=E,A&64){i.msg="invalid distance code",t.mode=fe;break}t.offset=k,t.extra=A&15,t.mode=nl;case nl:if(t.extra){for(W=t.extra;u<W;){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=fe;break}t.mode=al;case al:if(l===0)break e;if(d=y-l,t.offset>d){if(d=t.offset-d,d>t.whave&&t.sane){i.msg="invalid distance too far back",t.mode=fe;break}d>t.wnext?(d-=t.wnext,f=t.wsize-d):f=t.wnext-d,d>t.length&&(d=t.length),g=t.window}else g=n,f=s-t.offset,d=t.length;d>l&&(d=l),l-=d,t.length-=d;do n[s++]=g[f++];while(--d);t.length===0&&(t.mode=la);break;case sl:if(l===0)break e;n[s++]=t.length,l--,t.mode=la;break;case Bs:if(t.wrap){for(;u<32;){if(o===0)break e;o--,c|=r[a++]<<u,u+=8}if(y-=l,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?ke(t.check,n,y,s-y):In(t.check,n,y,s-y)),y=l,t.wrap&4&&(t.flags?c:ll(c))!==t.check){i.msg="incorrect data check",t.mode=fe;break}c=0,u=0}t.mode=ol;case ol: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=fe;break}c=0,u=0}t.mode=cl;case cl:Q=_h;break e;case fe:Q=Eu;break e;case Au:return $u;case ku:default:return pt}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||y!==i.avail_out&&t.mode<fe&&(t.mode<Bs||e!==jc))&&Pu(i,i.output,i.next_out,y-i.avail_out),m-=i.avail_in,y-=i.avail_out,i.total_in+=m,i.total_out+=y,t.total+=y,t.wrap&4&&y&&(i.adler=t.check=t.flags?ke(t.check,n,y,i.next_out-y):In(t.check,n,y,i.next_out-y)),i.data_type=t.bits+(t.last?64:0)+(t.mode===Ut?128:0)+(t.mode===ca||t.mode===js?256:0),(m===0&&y===0||e===jc)&&Q===Wi&&(Q=Eh),Q},Rh=i=>{if(er(i))return pt;let e=i.state;return e.window&&(e.window=null),i.state=null,Wi},Nh=(i,e)=>{if(er(i))return pt;let t=i.state;return(t.wrap&2)===0?pt:(t.head=e,e.done=!1,Wi)},Oh=(i,e)=>{let t=e.length,r,n,a;return er(i)||(r=i.state,r.wrap!==0&&r.mode!==qa)?pt:r.mode===qa&&(n=1,n=In(n,e,t,0),n!==r.check)?Eu:(a=Pu(i,e,t,t),a?(r.mode=Au,$u):(r.havedict=1,Wi))},Dh=Tu,Uh=Cu,Mh=Iu,Fh=Ch,jh=Lu,Bh=Ph,qh=Rh,Hh=Nh,zh=Oh,Vh="pako inflate (from Nodeca project)",qt={inflateReset:Dh,inflateReset2:Uh,inflateResetKeep:Mh,inflateInit:Fh,inflateInit2:jh,inflate:Bh,inflateEnd:qh,inflateGetHeader:Hh,inflateSetDictionary:zh,inflateInfo:Vh};function Wh(){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 Kh=Wh,Ru=Object.prototype.toString,{Z_NO_FLUSH:Qh,Z_FINISH:Gh,Z_OK:Ln,Z_STREAM_END:zs,Z_NEED_DICT:Vs,Z_STREAM_ERROR:Zh,Z_DATA_ERROR:dl,Z_MEM_ERROR:Jh}=Xi;function Mn(i){this.options=rs.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 wu,this.strm.avail_out=0;let t=qt.inflateInit2(this.strm,e.windowBits);if(t!==Ln)throw new Error(zi[t]);if(this.header=new Kh,qt.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Cn.string2buf(e.dictionary):Ru.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=qt.inflateSetDictionary(this.strm,e.dictionary),t!==Ln)))throw new Error(zi[t])}Mn.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?Gh:Qh,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=qt.inflate(t,s),a===Vs&&n&&(a=qt.inflateSetDictionary(t,n),a===Ln?a=qt.inflate(t,s):a===dl&&(a=Vs));t.avail_in>0&&a===zs&&t.state.wrap>0&&i[t.next_in]!==0;)qt.inflateReset(t),a=qt.inflate(t,s);switch(a){case Zh:case dl:case Vs:case Jh:return this.onEnd(a),this.ended=!0,!1}if(o=t.avail_out,t.next_out&&(t.avail_out===0||a===zs))if(this.options.to==="string"){let l=Cn.utf8border(t.output,t.next_out),c=t.next_out-l,u=Cn.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===Ln&&o===0)){if(a===zs)return a=qt.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Mn.prototype.onData=function(i){this.chunks.push(i)};Mn.prototype.onEnd=function(i){i===Ln&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=rs.flattenChunks(this.chunks)),this.chunks=[],this.err=i,this.msg=this.strm.msg};function To(i,e){let t=new Mn(e);if(t.push(i),t.err)throw t.msg||zi[t.err];return t.result}function Yh(i,e){return e=e||{},e.raw=!0,To(i,e)}var Xh=Mn,eg=To,tg=Yh,ig=To,rg=Xi,ng={Inflate:Xh,inflate:eg,inflateRaw:tg,ungzip:ig,constants:rg},{Deflate:ag,deflate:sg,deflateRaw:og,gzip:cg}=ph,{Inflate:lg,inflate:ug,inflateRaw:dg,ungzip:pg}=ng,fg=ag,hg=sg,gg=og,mg=cg,yg=lg,vg=ug,bg=dg,wg=pg,Sg=Xi,_g={Deflate:fg,deflate:hg,deflateRaw:gg,gzip:mg,Inflate:yg,inflate:vg,inflateRaw:bg,ungzip:wg,constants:Sg},ue=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},de=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ha=class{constructor(e,t){this.input=e,this.output=t}};ue([h(),de("design:type",String)],Ha.prototype,"input",void 0);ue([h(),de("design:type",String)],Ha.prototype,"output",void 0);Ha=ue([Te(),de("design:paramtypes",[String,String])],Ha);var za=class{constructor(e,t){this.input=e,this.output=t}};ue([h(),de("design:type",String)],za.prototype,"input",void 0);ue([h(),de("design:type",String)],za.prototype,"output",void 0);za=ue([H(),de("design:paramtypes",[String,String])],za);var li=class{constructor(e,t,r,n,a){this.name=e,this.modelId=t,this.systemPrompt=r,this.promptExamples=n,this.metaData=a}};ue([h(),de("design:type",String)],li.prototype,"name",void 0);ue([h(),de("design:type",String)],li.prototype,"modelId",void 0);ue([h(),de("design:type",String)],li.prototype,"systemPrompt",void 0);ue([h(),de("design:type",Array)],li.prototype,"promptExamples",void 0);ue([h(),de("design:type",String)],li.prototype,"metaData",void 0);li=ue([Te(),de("design:paramtypes",[String,String,String,Array,String])],li);var Nt=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}};ue([h(),de("design:type",String)],Nt.prototype,"name",void 0);ue([h(),de("design:type",String)],Nt.prototype,"modelId",void 0);ue([h(),de("design:type",String)],Nt.prototype,"taskId",void 0);ue([h(),de("design:type",String)],Nt.prototype,"systemPrompt",void 0);ue([h(),de("design:type",Array)],Nt.prototype,"promptExamples",void 0);ue([h(),de("design:type",String)],Nt.prototype,"metaData",void 0);ue([h(),de("design:type",String)],Nt.prototype,"createdAt",void 0);ue([h(),de("design:type",String)],Nt.prototype,"updatedAt",void 0);Nt=ue([H(),de("design:paramtypes",[String,String,String,String,Array,String,String,String])],Nt);var Ki=class{constructor(e,t,r,n,a){this.model=e,this.status=t,this.progress=r,this.downloaded=n,this.loaded=a}};ue([h(),de("design:type",String)],Ki.prototype,"model",void 0);ue([h(),de("design:type",String)],Ki.prototype,"status",void 0);ue([h(),de("design:type",Number)],Ki.prototype,"progress",void 0);ue([h(),de("design:type",Boolean)],Ki.prototype,"downloaded",void 0);ue([h(),de("design:type",Boolean)],Ki.prototype,"loaded",void 0);Ki=ue([H(),de("design:paramtypes",[String,String,Number,Boolean,Boolean])],Ki);var xg=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)},_e,Ea,go=class{constructor(e,t=!0){_e.set(this,void 0),Ea.set(this,new Map),xg(this,_e,e,"f")}async getModels(){let e=await $e(this,_e,"f").query({query:v`
1185
1203
  query {
1186
1204
  aiGetModels {
1187
1205
  id
@@ -1205,23 +1223,23 @@ triggerMatch
1205
1223
  modelType
1206
1224
  }
1207
1225
  }
1208
- `});return w(e).aiGetModels}async addModel(e){let t=await Se(this,be,"f").mutate({mutation:v`
1226
+ `});return b(e).aiGetModels}async addModel(e){let t=await $e(this,_e,"f").mutate({mutation:v`
1209
1227
  mutation($model: ModelInput!) {
1210
1228
  aiAddModel(model: $model)
1211
1229
  }
1212
- `,variables:{model:e}});return w(t).aiAddModel}async updateModel(e,t){let r=await Se(this,be,"f").mutate({mutation:v`
1230
+ `,variables:{model:e}});return b(t).aiAddModel}async updateModel(e,t){let r=await $e(this,_e,"f").mutate({mutation:v`
1213
1231
  mutation($modelId: String!, $model: ModelInput!) {
1214
1232
  aiUpdateModel(modelId: $modelId, model: $model)
1215
1233
  }
1216
- `,variables:{modelId:e,model:t}});return w(r).aiUpdateModel}async removeModel(e){let t=await Se(this,be,"f").mutate({mutation:v`
1234
+ `,variables:{modelId:e,model:t}});return b(r).aiUpdateModel}async removeModel(e){let t=await $e(this,_e,"f").mutate({mutation:v`
1217
1235
  mutation($modelId: String!) {
1218
1236
  aiRemoveModel(modelId: $modelId)
1219
1237
  }
1220
- `,variables:{modelId:e}});return w(t).aiRemoveModel}async setDefaultModel(e,t){let r=await Se(this,be,"f").mutate({mutation:v`
1238
+ `,variables:{modelId:e}});return b(t).aiRemoveModel}async setDefaultModel(e,t){let r=await $e(this,_e,"f").mutate({mutation:v`
1221
1239
  mutation($modelType: ModelType!, $modelId: String!) {
1222
1240
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
1223
1241
  }
1224
- `,variables:{modelId:t,modelType:e}});return w(r).aiSetDefaultModel}async getDefaultModel(e){let t=await Se(this,be,"f").query({query:v`
1242
+ `,variables:{modelId:t,modelType:e}});return b(r).aiSetDefaultModel}async getDefaultModel(e){let t=await $e(this,_e,"f").query({query:v`
1225
1243
  query($modelType: ModelType!) {
1226
1244
  aiGetDefaultModel(modelType: $modelType) {
1227
1245
  id
@@ -1245,7 +1263,7 @@ triggerMatch
1245
1263
  modelType
1246
1264
  }
1247
1265
  }
1248
- `,variables:{modelType:e}});return w(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=w(await Se(this,be,"f").query({query:v`
1266
+ `,variables:{modelType:e}});return b(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=b(await $e(this,_e,"f").query({query:v`
1249
1267
  query {
1250
1268
  aiTasks {
1251
1269
  name
@@ -1261,7 +1279,7 @@ triggerMatch
1261
1279
  updatedAt
1262
1280
  }
1263
1281
  }
1264
- `}));return e}async addTask(e,t,r,n,a){let s=new ni(e,t,r,n,a),{aiAddTask:o}=w(await Se(this,be,"f").mutate({mutation:v`
1282
+ `}));return e}async addTask(e,t,r,n,a){let s=new li(e,t,r,n,a),{aiAddTask:o}=b(await $e(this,_e,"f").mutate({mutation:v`
1265
1283
  mutation AiAddTask($task: AITaskInput!) {
1266
1284
  aiAddTask(task: $task) {
1267
1285
  name
@@ -1277,7 +1295,7 @@ triggerMatch
1277
1295
  updatedAt
1278
1296
  }
1279
1297
  }
1280
- `,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=w(await Se(this,be,"f").mutate({mutation:v`
1298
+ `,variables:{task:s}}));return o}async removeTask(e){let{aiRemoveTask:t}=b(await $e(this,_e,"f").mutate({mutation:v`
1281
1299
  mutation AiRemoveTask($taskId: String!) {
1282
1300
  aiRemoveTask(taskId: $taskId) {
1283
1301
  name
@@ -1293,7 +1311,7 @@ triggerMatch
1293
1311
  updatedAt
1294
1312
  }
1295
1313
  }
1296
- `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=w(await Se(this,be,"f").mutate({mutation:v`
1314
+ `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:r}=b(await $e(this,_e,"f").mutate({mutation:v`
1297
1315
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
1298
1316
  aiUpdateTask(taskId: $taskId, task: $task) {
1299
1317
  name
@@ -1309,7 +1327,7 @@ triggerMatch
1309
1327
  updatedAt
1310
1328
  }
1311
1329
  }
1312
- `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=w(await Se(this,be,"f").query({query:v`
1330
+ `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return r}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=b(await $e(this,_e,"f").query({query:v`
1313
1331
  query AiModelLoadingStatus($model: String!) {
1314
1332
  aiModelLoadingStatus(model: $model) {
1315
1333
  model
@@ -1319,30 +1337,30 @@ triggerMatch
1319
1337
  downloaded
1320
1338
  }
1321
1339
  }
1322
- `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=w(await Se(this,be,"f").mutate({mutation:v`
1340
+ `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:r}=b(await $e(this,_e,"f").mutate({mutation:v`
1323
1341
  mutation AiPrompt($taskId: String!, $prompt: String!) {
1324
1342
  aiPrompt(taskId: $taskId, prompt: $prompt)
1325
1343
  }
1326
- `,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=w(await Se(this,be,"f").mutate({mutation:v`
1344
+ `,variables:{taskId:e,prompt:t}}));return r}async embed(e,t){let{aiEmbed:r}=b(await $e(this,_e,"f").mutate({mutation:v`
1327
1345
  mutation aiEmbed($modelId: String!, $text: String!) {
1328
1346
  aiEmbed(modelId: $modelId, text: $text)
1329
1347
  }
1330
- `,variables:{modelId:e,text:t}})),n=Ga.toByteArray(r);return JSON.parse(ig.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=w(await Se(this,be,"f").mutate({mutation:v`
1348
+ `,variables:{modelId:e,text:t}})),n=ts.toByteArray(r);return JSON.parse(_g.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,r){let{aiOpenTranscriptionStream:n}=b(await $e(this,_e,"f").mutate({mutation:v`
1331
1349
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
1332
1350
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
1333
1351
  }
1334
- `,variables:{modelId:e,params:r}})),a=Se(this,be,"f").subscribe({query:v` subscription {
1352
+ `,variables:{modelId:e,params:r}})),a=$e(this,_e,"f").subscribe({query:v` subscription {
1335
1353
  aiTranscriptionText(streamId: "${n}")
1336
- }`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return Se(this,va,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=w(await Se(this,be,"f").mutate({mutation:v`
1354
+ }`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return $e(this,Ea,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=b(await $e(this,_e,"f").mutate({mutation:v`
1337
1355
  mutation aiCloseTranscriptionStream($streamId: String!) {
1338
1356
  aiCloseTranscriptionStream(streamId: $streamId)
1339
1357
  }
1340
- `,variables:{streamId:e}})),r=Se(this,va,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=w(await Se(this,be,"f").mutate({mutation:v`
1358
+ `,variables:{streamId:e}})),r=$e(this,Ea,"f").get(e);return r.closed||r.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:r}=b(await $e(this,_e,"f").mutate({mutation:v`
1341
1359
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
1342
1360
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
1343
1361
  }
1344
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};be=new WeakMap,va=new WeakMap;var Vt=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},ve=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)},bt,ba,an,wa,sn,$i,Sa,on,Jc=class{constructor(e,t=!0){bt.set(this,void 0),ba.set(this,void 0),an.set(this,void 0),wa.set(this,void 0),sn.set(this,void 0),$i.set(this,void 0),Sa.set(this,void 0),on.set(this,void 0),Vt(this,bt,e,"f"),Vt(this,ba,new vn(ve(this,bt,"f"),t),"f"),Vt(this,an,new Zs(ve(this,bt,"f")),"f"),Vt(this,wa,new Ks(ve(this,bt,"f")),"f"),Vt(this,sn,new Qs(ve(this,bt,"f")),"f"),Vt(this,on,new so(ve(this,bt,"f"),t),"f"),Vt(this,$i,new Ra(ve(this,bt,"f"),t),"f"),ve(this,$i,"f").setExpressionClient(ve(this,an,"f")),ve(this,$i,"f").setNeighbourhoodClient(ve(this,sn,"f")),ve(this,$i,"f").setAIClient(ve(this,on,"f")),Vt(this,Sa,new Gs(ve(this,bt,"f"),t),"f")}get agent(){return ve(this,ba,"f")}get expression(){return ve(this,an,"f")}get languages(){return ve(this,wa,"f")}get neighbourhood(){return ve(this,sn,"f")}get perspective(){return ve(this,$i,"f")}get runtime(){return ve(this,Sa,"f")}get ai(){return ve(this,on,"f")}};bt=new WeakMap,ba=new WeakMap,an=new WeakMap,wa=new WeakMap,sn=new WeakMap,$i=new WeakMap,Sa=new WeakMap,on=new WeakMap;var oo;(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"})(oo||(oo={}));var _o=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},Eo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Li=class{constructor(e,t){this.language=e,this.expression=t}};_o([h(),Eo("design:type",Et)],Li.prototype,"language",void 0);_o([h(),Eo("design:type",String)],Li.prototype,"expression",void 0);Li=_o([F(),Eo("design:paramtypes",[Et,String])],Li);function r0(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function n0(i){if(i.startsWith("literal://")){let a=new Et;a.address="literal",a.name="literal";let s=i.substring(10);return new Li(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new Et;return o.address=a,new Li(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new Et;return a.address="did",new Li(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var rt=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},Ct=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Fa=class{};rt([h(),Ct("design:type",String)],Fa.prototype,"name",void 0);rt([h(),Ct("design:type",String)],Fa.prototype,"type",void 0);Fa=rt([F()],Fa);var kn=class{};rt([h(),Ct("design:type",String)],kn.prototype,"label",void 0);rt([h(),Ct("design:type",String)],kn.prototype,"name",void 0);rt([h(),Ct("design:type",Array)],kn.prototype,"parameters",void 0);kn=rt([F()],kn);var ja=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};rt([h(),Ct("design:type",String)],ja.prototype,"name",void 0);rt([h(),Ct("design:type",String)],ja.prototype,"parametersStringified",void 0);ja=rt([Ae(),Ct("design:paramtypes",[String,Object])],ja);var Ba=class{};rt([h(),Ct("design:type",String)],Ba.prototype,"did",void 0);rt([h(),Ct("design:type",Oi)],Ba.prototype,"status",void 0);Ba=rt([F()],Ba);var Yc=class{},Zi=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},Nr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ai=class{};Zi([h(),Nr("design:type",String)],ai.prototype,"name",void 0);Zi([h(),Nr("design:type",String)],ai.prototype,"address",void 0);Zi([h(),Nr("design:type",String)],ai.prototype,"settings",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"icon",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"constructorIcon",void 0);Zi([h(),Nr("design:type",Ri)],ai.prototype,"settingsIcon",void 0);ai=Zi([F()],ai);var qe=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},Ze=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ft=class{};qe([h(),Ze("design:type",String)],ft.prototype,"name",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"address",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"description",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"author",void 0);qe([h(),Ze("design:type",Boolean)],ft.prototype,"templated",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"templateSourceLanguageAddress",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"templateAppliedParams",void 0);qe([h(),Ze("design:type",Array)],ft.prototype,"possibleTemplateParams",void 0);qe([h(),Ze("design:type",String)],ft.prototype,"sourceCodeLink",void 0);ft=qe([F()],ft);var Sr=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};qe([h(),Ze("design:type",String)],Sr.prototype,"name",void 0);qe([h(),Ze("design:type",String)],Sr.prototype,"description",void 0);qe([h(),Ze("design:type",Array)],Sr.prototype,"possibleTemplateParams",void 0);qe([h(),Ze("design:type",String)],Sr.prototype,"sourceCodeLink",void 0);Sr=qe([Ae(),Ze("design:paramtypes",[String,String])],Sr);var Xc=class{},el=class extends ci(){},tl=class{},Xa=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},xo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},qa=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Xa([h(),xo("design:type",String)],qa.prototype,"linkLanguage",void 0);Xa([h(),xo("design:type",kt)],qa.prototype,"meta",void 0);qa=Xa([F(),xo("design:paramtypes",[String,kt])],qa);var co=class extends ci(){};co=Xa([F()],co);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},Yi=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},lo;(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"})(lo||(lo={}));var si=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=lo.Private}};Ji([h(),Yi("design:type",String)],si.prototype,"uuid",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"name",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"state",void 0);Ji([h(),Yi("design:type",String)],si.prototype,"sharedUrl",void 0);Ji([h(),Yi("design:type",co)],si.prototype,"neighbourhood",void 0);Ji([h(),Yi("design:type",Array)],si.prototype,"owners",void 0);si=Ji([F(),Yi("design:paramtypes",[String,String,String])],si);var il=class{constructor(e){this.proxies=new Map,this.activeSubscriptions=new Map,this.debounceTimers=new Map,this.seenMessages=new Map,this.perspectiveClient=e.perspectiveClient,this.logger=e.logger,this.debounceMs=e.debounceMs??2e3,this.onWake=e.onWake,this.onPersist=e.onPersist,this.QuerySubscriptionProxyCtor=e.QuerySubscriptionProxy??null,this.previousSeenMessages=e.previousSeenMessages??{}}async subscribe(e){if(this.dispose(e.id,!1),!this.QuerySubscriptionProxyCtor)throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");let t=this.QuerySubscriptionProxyCtor;this.logger.info(`[waker] ${e.id}: creating subscription (perspective=${e.perspective}, type=${e.type})`),this.logger.info(`[waker] ${e.id}: SurrealQL query:
1345
- ${e.query}`);let r=new t(e.perspective,e.query,this.perspectiveClient);r.isSurrealDB=!0,r.initialized&&typeof r.initialized.catch=="function"&&r.initialized.catch(()=>{});try{await r.subscribe(),await r.initialized}catch(a){let s=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${s}`);try{r.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let n=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,n),n.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${n.size} seen message(s) from persisted state`),r.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let s=this.seenMessages.get(e.id)??new Set,o=[];for(let u of a)u&&u.source&&!s.has(u.source)&&o.push(u.source);if(o.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${o.length} new message(s) out of ${a.length} total`);let l=[];for(let u of o){let m=[];try{let d=`SELECT * FROM link WHERE predicate = 'ad4m://has_child' AND target = '${u.replace(/'/g,"\\'")}'`;this.logger.info(`[waker] ${e.id}: resolving parents for ${u}`);let p=await this.perspectiveClient.querySurrealDB(e.perspective,d);if(Array.isArray(p))for(let f of p)f&&f.source&&m.push(f.source)}catch(y){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${u} \u2014 ${y?.message??y}`)}this.logger.info(`[waker] ${e.id}: message ${u} has ${m.length} parent(s): ${m.join(", ")}`),l.push({address:u,parents:m})}for(let u of o)s.add(u);this.seenMessages.set(e.id,s);let c=this.debounceTimers.get(e.id);c&&clearTimeout(c),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a,l),this.debounceTimers.delete(e.id),this.persist()},this.debounceMs))}else{this.logger.info(`[waker] ${e.id}: channel update (${a.length} items)`);let s=this.debounceTimers.get(e.id);s&&clearTimeout(s),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a),this.debounceTimers.delete(e.id)},this.debounceMs))}}),this.proxies.set(e.id,r),this.activeSubscriptions.set(e.id,e),this.persist(),this.logger.info(`[waker] Subscription ${e.id} active (type=${e.type}, perspective=${e.perspective})`)}dispose(e,t=!0){let r=this.proxies.get(e);if(r){try{r.dispose()}catch{}this.proxies.delete(e)}let n=this.debounceTimers.get(e);n&&(clearTimeout(n),this.debounceTimers.delete(e)),this.activeSubscriptions.delete(e),this.seenMessages.delete(e),t&&this.persist()}disposeAll(){for(let[e]of this.proxies)this.dispose(e,!1)}getActive(){return Array.from(this.activeSubscriptions.values())}has(e){return this.activeSubscriptions.has(e)}persist(){if(this.onPersist){let e={};for(let[t,r]of this.seenMessages)e[t]=Array.from(r);this.onPersist(this.getActive(),e)}}},es=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},bu=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ha=class{};es([h(),bu("design:type",Array)],Ha.prototype,"additions",void 0);es([h(),bu("design:type",Array)],Ha.prototype,"removals",void 0);Ha=es([F()],Ha);var rl=class extends ci(){};rl=es([F()],rl);var nl=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},ur=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)},cn,Ai,na="smart_literal://content";function ng(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 In=class{constructor(e,t){cn.set(this,void 0),Ai.set(this,void 0),nl(this,cn,e,"f"),nl(this,Ai,t,"f")}get base(){return ur(this,Ai,"f")}static async create(e,t){let r=oe.from(ng(10)).toUrl(),n=new In(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new re({source:t,predicate:na}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new re({predicate:na}))).map(r=>new In(e,r.data.source))}async get(){let e=await ur(this,cn,"f").getSingleTarget(new re({source:ur(this,Ai,"f"),predicate:na}));if(!e)throw`No content for smart literal ${ur(this,Ai,"f")}`;return oe.fromUrl(e).get()}async set(e){let t=oe.from(e);await ur(this,cn,"f").setSingleTarget(new Ke({source:ur(this,Ai,"f"),predicate:na,target:t.toUrl()}))}};cn=new WeakMap,Ai=new WeakMap;function ln(i,e){if("predicate"in i)return i.predicate;let{model:t}=i,r=wt(t);if(i.field){let n=r[i.field];if(!n)throw new Error(`parent(): field "${i.field}" is not a registered relation on ${t.name}`);return n.predicate}for(let[,n]of Object.entries(r))if(n.target&&n.target()===e)return n.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function al(i,e){return!i||!e?"":`triple("${i.id}", "${e}", Base)`}function sl(){return`
1362
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return r}};_e=new WeakMap,Ea=new WeakMap;var Gt=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},Se=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)},Et,$a,un,Aa,dn,Li,ka,pn,pl=class{constructor(e,t=!0){Et.set(this,void 0),$a.set(this,void 0),un.set(this,void 0),Aa.set(this,void 0),dn.set(this,void 0),Li.set(this,void 0),ka.set(this,void 0),pn.set(this,void 0),Gt(this,Et,e,"f"),Gt(this,$a,new xn(Se(this,Et,"f"),t),"f"),Gt(this,un,new no(Se(this,Et,"f")),"f"),Gt(this,Aa,new to(Se(this,Et,"f")),"f"),Gt(this,dn,new io(Se(this,Et,"f")),"f"),Gt(this,pn,new go(Se(this,Et,"f"),t),"f"),Gt(this,Li,new Fa(Se(this,Et,"f"),t),"f"),Se(this,Li,"f").setExpressionClient(Se(this,un,"f")),Se(this,Li,"f").setNeighbourhoodClient(Se(this,dn,"f")),Se(this,Li,"f").setAIClient(Se(this,pn,"f")),Gt(this,ka,new ro(Se(this,Et,"f"),t),"f")}get agent(){return Se(this,$a,"f")}get expression(){return Se(this,un,"f")}get languages(){return Se(this,Aa,"f")}get neighbourhood(){return Se(this,dn,"f")}get perspective(){return Se(this,Li,"f")}get runtime(){return Se(this,ka,"f")}get ai(){return Se(this,pn,"f")}};Et=new WeakMap,$a=new WeakMap,un=new WeakMap,Aa=new WeakMap,dn=new WeakMap,Li=new WeakMap,ka=new WeakMap,pn=new WeakMap;var mo;(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"})(mo||(mo={}));var Co=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},Lo=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Ui=class{constructor(e,t){this.language=e,this.expression=t}};Co([h(),Lo("design:type",It)],Ui.prototype,"language",void 0);Co([h(),Lo("design:type",String)],Ui.prototype,"expression",void 0);Ui=Co([H(),Lo("design:paramtypes",[It,String])],Ui);function N0(i){return i.language.address==="did"?i.expression.toString():`${i.language.address}://${i.expression}`}function O0(i){if(i.startsWith("literal://")){let a=new It;a.address="literal",a.name="literal";let s=i.substring(10);return new Ui(a,s)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(i);if(t&&t.length==3){let a=t[1],s=t[2],o=new It;return o.address=a,new Ui(o,s)}let n=/^did:([^\s]+)$/.exec(i);if(n&&n.length==2){let a=new It;return a.address="did",new Ui(a,i)}throw new Error("Couldn't parse string as expression URL or DID: "+i)}var st=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},Ot=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Va=class{};st([h(),Ot("design:type",String)],Va.prototype,"name",void 0);st([h(),Ot("design:type",String)],Va.prototype,"type",void 0);Va=st([H()],Va);var Pn=class{};st([h(),Ot("design:type",String)],Pn.prototype,"label",void 0);st([h(),Ot("design:type",String)],Pn.prototype,"name",void 0);st([h(),Ot("design:type",Array)],Pn.prototype,"parameters",void 0);Pn=st([H()],Pn);var Wa=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};st([h(),Ot("design:type",String)],Wa.prototype,"name",void 0);st([h(),Ot("design:type",String)],Wa.prototype,"parametersStringified",void 0);Wa=st([Te(),Ot("design:paramtypes",[String,Object])],Wa);var Ka=class{};st([h(),Ot("design:type",String)],Ka.prototype,"did",void 0);st([h(),Ot("design:type",Bi)],Ka.prototype,"status",void 0);Ka=st([H()],Ka);var fl=class{},tr=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},Rr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},ui=class{};tr([h(),Rr("design:type",String)],ui.prototype,"name",void 0);tr([h(),Rr("design:type",String)],ui.prototype,"address",void 0);tr([h(),Rr("design:type",String)],ui.prototype,"settings",void 0);tr([h(),Rr("design:type",Fi)],ui.prototype,"icon",void 0);tr([h(),Rr("design:type",Fi)],ui.prototype,"constructorIcon",void 0);tr([h(),Rr("design:type",Fi)],ui.prototype,"settingsIcon",void 0);ui=tr([H()],ui);var ze=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},Xe=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},vt=class{};ze([h(),Xe("design:type",String)],vt.prototype,"name",void 0);ze([h(),Xe("design:type",String)],vt.prototype,"address",void 0);ze([h(),Xe("design:type",String)],vt.prototype,"description",void 0);ze([h(),Xe("design:type",String)],vt.prototype,"author",void 0);ze([h(),Xe("design:type",Boolean)],vt.prototype,"templated",void 0);ze([h(),Xe("design:type",String)],vt.prototype,"templateSourceLanguageAddress",void 0);ze([h(),Xe("design:type",String)],vt.prototype,"templateAppliedParams",void 0);ze([h(),Xe("design:type",Array)],vt.prototype,"possibleTemplateParams",void 0);ze([h(),Xe("design:type",String)],vt.prototype,"sourceCodeLink",void 0);vt=ze([H()],vt);var Er=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ze([h(),Xe("design:type",String)],Er.prototype,"name",void 0);ze([h(),Xe("design:type",String)],Er.prototype,"description",void 0);ze([h(),Xe("design:type",Array)],Er.prototype,"possibleTemplateParams",void 0);ze([h(),Xe("design:type",String)],Er.prototype,"sourceCodeLink",void 0);Er=ze([Te(),Xe("design:paramtypes",[String,String])],Er);var hl=class{},gl=class extends hi(){},ml=class{},as=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},Po=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},Qa=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};as([h(),Po("design:type",String)],Qa.prototype,"linkLanguage",void 0);as([h(),Po("design:type",Pt)],Qa.prototype,"meta",void 0);Qa=as([H(),Po("design:paramtypes",[String,Pt])],Qa);var yo=class extends hi(){};yo=as([H()],yo);var ir=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},rr=function(i,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(i,e)},vo;(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"})(vo||(vo={}));var di=class{constructor(e,t,r){this.uuid=e,this.name=t,r?this.state=r:this.state=vo.Private}};ir([h(),rr("design:type",String)],di.prototype,"uuid",void 0);ir([h(),rr("design:type",String)],di.prototype,"name",void 0);ir([h(),rr("design:type",String)],di.prototype,"state",void 0);ir([h(),rr("design:type",String)],di.prototype,"sharedUrl",void 0);ir([h(),rr("design:type",yo)],di.prototype,"neighbourhood",void 0);ir([h(),rr("design:type",Array)],di.prototype,"owners",void 0);di=ir([H(),rr("design:paramtypes",[String,String,String])],di);var yl=class{constructor(e){this.proxies=new Map,this.activeSubscriptions=new Map,this.debounceTimers=new Map,this.seenMessages=new Map,this.perspectiveClient=e.perspectiveClient,this.logger=e.logger,this.debounceMs=e.debounceMs??2e3,this.onWake=e.onWake,this.onPersist=e.onPersist,this.QuerySubscriptionProxyCtor=e.QuerySubscriptionProxy??null,this.previousSeenMessages=e.previousSeenMessages??{}}async subscribe(e){if(this.dispose(e.id,!1),!this.QuerySubscriptionProxyCtor)throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");let t=this.QuerySubscriptionProxyCtor;this.logger.info(`[waker] ${e.id}: creating subscription (perspective=${e.perspective}, type=${e.type})`),this.logger.info(`[waker] ${e.id}: SurrealQL query:
1363
+ ${e.query}`);let r=new t(e.perspective,e.query,this.perspectiveClient);r.isSurrealDB=!0,r.initialized&&typeof r.initialized.catch=="function"&&r.initialized.catch(()=>{});try{await r.subscribe(),await r.initialized}catch(a){let s=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${s}`);try{r.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let n=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,n),n.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${n.size} seen message(s) from persisted state`),r.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let s=this.seenMessages.get(e.id)??new Set,o=[];for(let u of a)u&&u.source&&!s.has(u.source)&&o.push(u.source);if(o.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${o.length} new message(s) out of ${a.length} total`);let l=[];for(let u of o){let m=[];try{let d=`SELECT * FROM link WHERE predicate = 'ad4m://has_child' AND target = '${u.replace(/'/g,"\\'")}'`;this.logger.info(`[waker] ${e.id}: resolving parents for ${u}`);let f=await this.perspectiveClient.querySurrealDB(e.perspective,d);if(Array.isArray(f))for(let g of f)g&&g.source&&m.push(g.source)}catch(y){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${u} \u2014 ${y?.message??y}`)}this.logger.info(`[waker] ${e.id}: message ${u} has ${m.length} parent(s): ${m.join(", ")}`),l.push({address:u,parents:m})}for(let u of o)s.add(u);this.seenMessages.set(e.id,s);let c=this.debounceTimers.get(e.id);c&&clearTimeout(c),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a,l),this.debounceTimers.delete(e.id),this.persist()},this.debounceMs))}else{this.logger.info(`[waker] ${e.id}: channel update (${a.length} items)`);let s=this.debounceTimers.get(e.id);s&&clearTimeout(s),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a),this.debounceTimers.delete(e.id)},this.debounceMs))}}),this.proxies.set(e.id,r),this.activeSubscriptions.set(e.id,e),this.persist(),this.logger.info(`[waker] Subscription ${e.id} active (type=${e.type}, perspective=${e.perspective})`)}dispose(e,t=!0){let r=this.proxies.get(e);if(r){try{r.dispose()}catch{}this.proxies.delete(e)}let n=this.debounceTimers.get(e);n&&(clearTimeout(n),this.debounceTimers.delete(e)),this.activeSubscriptions.delete(e),this.seenMessages.delete(e),t&&this.persist()}disposeAll(){for(let[e]of this.proxies)this.dispose(e,!1)}getActive(){return Array.from(this.activeSubscriptions.values())}has(e){return this.activeSubscriptions.has(e)}persist(){if(this.onPersist){let e={};for(let[t,r]of this.seenMessages)e[t]=Array.from(r);this.onPersist(this.getActive(),e)}}},ss=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)},Ga=class{};ss([h(),Nu("design:type",Array)],Ga.prototype,"additions",void 0);ss([h(),Nu("design:type",Array)],Ga.prototype,"removals",void 0);Ga=ss([H()],Ga);var vl=class extends hi(){};vl=ss([H()],vl);var bl=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},fr=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)},fn,Pi,ua="smart_literal://content";function Eg(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 Rn=class{constructor(e,t){fn.set(this,void 0),Pi.set(this,void 0),bl(this,fn,e,"f"),bl(this,Pi,t,"f")}get base(){return fr(this,Pi,"f")}static async create(e,t){let r=le.from(Eg(10)).toUrl(),n=new Rn(e,r);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new ae({source:t,predicate:ua}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new ae({predicate:ua}))).map(r=>new Rn(e,r.data.source))}async get(){let e=await fr(this,fn,"f").getSingleTarget(new ae({source:fr(this,Pi,"f"),predicate:ua}));if(!e)throw`No content for smart literal ${fr(this,Pi,"f")}`;return le.fromUrl(e).get()}async set(e){let t=le.from(e);await fr(this,fn,"f").setSingleTarget(new Je({source:fr(this,Pi,"f"),predicate:ua,target:t.toUrl()}))}};fn=new WeakMap,Pi=new WeakMap;function hn(i,e){if("predicate"in i)return i.predicate;let{model:t}=i,r=$t(t);if(i.field){let n=r[i.field];if(!n)throw new Error(`parent(): field "${i.field}" is not a registered relation on ${t.name}`);return n.predicate}for(let[,n]of Object.entries(r))if(n.target&&n.target()===e)return n.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function wl(i,e){return!i||!e?"":`triple("${i.id}", "${e}", Base)`}function Sl(){return`
1346
1364
  findall(
1347
1365
  [T, A],
1348
1366
  link(Base, _, _, T, A),
@@ -1350,18 +1368,18 @@ ${e.query}`);let r=new t(e.perspective,e.query,this.perspectiveClient);r.isSurre
1350
1368
  ),
1351
1369
  sort(AllLinks, SortedLinks),
1352
1370
  SortedLinks = [[Timestamp, Author]|_]
1353
- `}function ag(i){return`
1371
+ `}function $g(i){return`
1354
1372
  findall([PropertyName, PropertyValue, Resolve], (
1355
1373
  % Constrain to specified properties if provided
1356
1374
  ${i?`member(PropertyName, [${i.map(e=>`"${e}"`).join(", ")}]),`:""}
1357
1375
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1358
1376
  ), Properties)
1359
- `}function ol(i={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(i).map(([t,r])=>{let n=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,s=t==="id"?"Base":Be(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:m,gte:y}=r;if(o!==void 0)if(Array.isArray(o)){let p=o.map(f=>e(f)).join(", ");return n?`\\+ member(${s}, [${p}])`:`${a}, \\+ member(Value${t}, [${p}])`}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:m,symbol:">"},{value:y,symbol:">="}];for(let{value:p,symbol:f}of d)if(p!==void 0)return n?`${s} ${f} ${p}`:`${a}, Value${t} ${f} ${p}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function cl(i){return i?"length(UnsortedInstances, TotalCount)":""}function ll(i){if(!i)return"SortedInstances = UnsortedInstances";let e=Object.entries(i);if(e.length===1){let[r,n]=e[0];return`sort_instances(UnsortedInstances, "${r}", "${n}", SortedInstances)`}let t=[];for(let r=e.length-1;r>=0;r--){let[n,a]=e[r],s=r===e.length-1?"UnsortedInstances":`MultiSortIntermediate${r+1}`,o=r===0?"SortedInstances":`MultiSortIntermediate${r}`;t.push(`sort_instances(${s}, "${n}", "${a}", ${o})`)}return t.join(`,
1360
- `)}function ul(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function dl(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function pl(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function $o(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 wu(i,e){return $o(i.type)===e}function Su(i){return wu(i,"array")}function fl(i){return wu(i,"object")}function sg(i){let e=$o(i.type);return e==="number"||e==="integer"}function _u(i,e){if(e.namespace)return e.namespace;if(i["x-ad4m"]?.namespace)return i["x-ad4m"].namespace;if(i.title)return`${i.title.toLowerCase()}://`;if(i.$id)try{let r=new URL(i.$id).pathname.split("/").filter(n=>n);if(r.length>0)return`${r[r.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1377
+ `}function _l(i={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(i).map(([t,r])=>{let n=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,s=t==="id"?"Base":He(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:m,gte:y}=r;if(o!==void 0)if(Array.isArray(o)){let f=o.map(g=>e(g)).join(", ");return n?`\\+ member(${s}, [${f}])`:`${a}, \\+ member(Value${t}, [${f}])`}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:m,symbol:">"},{value:y,symbol:">="}];for(let{value:f,symbol:g}of d)if(f!==void 0)return n?`${s} ${g} ${f}`:`${a}, Value${t} ${g} ${f}`}return n?`${s} = ${e(r)}`:`${a}, Value${t} = ${e(r)}`}).join(", ")}function xl(i){return i?"length(UnsortedInstances, TotalCount)":""}function El(i){if(!i)return"SortedInstances = UnsortedInstances";let e=Object.entries(i);if(e.length===1){let[r,n]=e[0];return`sort_instances(UnsortedInstances, "${r}", "${n}", SortedInstances)`}let t=[];for(let r=e.length-1;r>=0;r--){let[n,a]=e[r],s=r===e.length-1?"UnsortedInstances":`MultiSortIntermediate${r+1}`,o=r===0?"SortedInstances":`MultiSortIntermediate${r}`;t.push(`sort_instances(${s}, "${n}", "${a}", ${o})`)}return t.join(`,
1378
+ `)}function $l(i){return!i||i<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${i}, InstancesWithOffset)`}function Al(i){return!i||i<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${i}, AllInstances)`}function kl(i){if(!i)return"";if(i.includes("://")){let[e,t]=i.split("://"),r=(t||"").replace(/\/+$/,"");return`${e}://${r}`}else return i.replace(/\/+$/,"")}function Ro(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 Ro(i.type)===e}function Du(i){return Ou(i,"array")}function Il(i){return Ou(i,"object")}function Ag(i){let e=Ro(i.type);return e==="number"||e==="integer"}function Uu(i,e){if(e.namespace)return e.namespace;if(i["x-ad4m"]?.namespace)return i["x-ad4m"].namespace;if(i.title)return`${i.title.toLowerCase()}://`;if(i.$id)try{let r=new URL(i.$id).pathname.split("/").filter(n=>n);if(r.length>0)return`${r[r.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1361
1379
  - options.namespace
1362
1380
  - schema["x-ad4m"].namespace
1363
1381
  - schema.title
1364
- - valid schema.$id`)}function Eu(i,e,t,r,n){if(n.propertyMapping?.[e])return n.propertyMapping[e];if(t["x-ad4m"]?.through)return t["x-ad4m"].through;if(n.predicateTemplate){let s=pl(r),[o,l]=s.includes("://")?s.split("://"):["",s],c=l||"";return n.predicateTemplate.replace("${namespace}",c).replace("${scheme}",o).replace("${ns}",c).replace("${title}",i.title||"").replace("${property}",e)}if(n.predicateGenerator)return n.predicateGenerator(i.title||"",e);let a=pl(r);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function qr(i,e,t,r,n){return t.propertyOptions?.[i]?.[r]!==void 0?t.propertyOptions[i][r]:e["x-ad4m"]?.[r]!==void 0?e["x-ad4m"][r]:t[r]!==void 0?t[r]:n}function og(i){switch(i){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function cg(i,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=_u(e,t),n=class extends i{};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[l,c]of Object.entries(e.properties)){let u=Eu(e,l,c,r,t),m=e.required?.includes(l)||!1,y=$o(c.type);if(Su(c)){s[l]={through:u,local:qr(l,c,t,"local")},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:[]});let p=`add${Be(l)}`,f=`remove${Be(l)}`,S=`set${Be(l)}`;n.prototype[p]=function(){},n.prototype[f]=function(){},n.prototype[S]=function(){}}else{let p=qr(l,c,t,"resolveLanguage");!p&&t.resolveLanguage&&(p=t.resolveLanguage);let f=qr(l,c,t,"local"),S=qr(l,c,t,"readOnly");if(S===void 0){let k=c["x-ad4m"]?.writable;S=k!==void 0?!k:!1}let E=!S,A=qr(l,c,t,"initial");if(fl(c)&&!p&&(p="literal",console.warn(`Property "${l}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),p==null&&sg(c)&&(p="literal"),p==null&&(p="literal"),m&&!A&&(fl(c)?A="literal://json:{}":A="ad4m://undefined"),a[l]={through:u,required:m,writable:E,...p&&{resolveLanguage:p},...f!==void 0&&{local:f},...A&&{initial:A}},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:og(y)}),E){let k=Wa(l);n.prototype[k]=function(){}}}}for(let[l,c]of Object.entries(a))Bd(n,l,c);for(let[l,c]of Object.entries(s))qd(n,l,{predicate:c.through||"",kind:"hasMany",...c.getter!==void 0&&{getter:c.getter},...c.local!==void 0&&{local:c.local}});return n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,Hd({name:t.name})(n),n}function lg(i,e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["id","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(a)){let l=a.map(c=>se(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=>se(u)).join(", ");r.push(`${o} NOT IN [${c}]`)}else r.push(`${o} != ${se(l.not)}`);l.between!==void 0&&Array.isArray(l.between)&&l.between.length===2&&r.push(`${o} >= ${se(l.between[0])} AND ${o} <= ${se(l.between[1])}`),l.gt!==void 0&&r.push(`${o} > ${se(l.gt)}`),l.gte!==void 0&&r.push(`${o} >= ${se(l.gte)}`),l.lt!==void 0&&r.push(`${o} < ${se(l.lt)}`),l.lte!==void 0&&r.push(`${o} <= ${se(l.lte)}`),l.contains!==void 0&&r.push(`${o} CONTAINS ${se(l.contains)}`)}else r.push(`${o} = ${se(a)}`)}else{let o=e[n],l=o?.kind==="belongsToOne"||o?.kind==="belongsToMany";if(o){let y=Y(o.predicate);if(Array.isArray(a)){let d=a.map(p=>se(p)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${d}]]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${d}]]) > 0`)}else if(typeof a=="object"&&a!==null){let d=a;if(d.not!==void 0)if(Array.isArray(d.not)){let p=d.not.map(f=>se(f)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${p}]]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${p}]]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${se(d.not)}]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${se(d.not)}]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${se(a)}]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${se(a)}]) > 0`);continue}let c=i.properties[n];if(!c)continue;let u=Y(c.predicate),m=c.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let y=a.map(d=>se(d)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${y}]]) > 0`)}else if(typeof a=="object"&&a!==null){let y=a;if(y.not!==void 0)if(Array.isArray(y.not)){let p=y.not.map(f=>se(f)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${p}]]) = 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${se(y.not)}]) = 0`);(y.gt!==void 0||y.gte!==void 0||y.lt!==void 0||y.lte!==void 0||y.between!==void 0||y.contains!==void 0)&&r.push(`count(->link[WHERE predicate = '${u}']) > 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${se(a)}]) > 0`)}return r.join(" AND ")}function ug(i,e,t,r){let{where:n}=t,a=[];if(t.parent){let c=ln(t.parent,r);a.push(`count(<-link[WHERE in.uri = ${se(t.parent.id)} AND predicate = '${Y(c)}']) > 0`)}for(let[,c]of Object.entries(i.properties))if(c.required){if(c.getter)continue;c.flag&&c.initial?a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}' AND out.uri = '${Y(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}']) > 0`)}if(a.length===0){for(let[,c]of Object.entries(i.properties))if(c.initial){c.flag?a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}' AND out.uri = '${Y(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${Y(c.predicate)}']) > 0`);break}}if(a.length===0){let c=[];for(let[,u]of Object.entries(i.properties))u.predicate&&c.push(`predicate = '${Y(u.predicate)}'`);if(i.relations)for(let[,u]of Object.entries(i.relations))u.predicate&&c.push(`predicate = '${Y(u.predicate)}'`);c.length>0&&a.push(`count(->link[WHERE (${c.join(" OR ")})]) > 0`)}let s=lg(i,e,n),o=[];return o.push(...a),s&&o.push(s),o.push("count(->link) > 0"),`
1382
+ - valid schema.$id`)}function Mu(i,e,t,r,n){if(n.propertyMapping?.[e])return n.propertyMapping[e];if(t["x-ad4m"]?.through)return t["x-ad4m"].through;if(n.predicateTemplate){let s=kl(r),[o,l]=s.includes("://")?s.split("://"):["",s],c=l||"";return n.predicateTemplate.replace("${namespace}",c).replace("${scheme}",o).replace("${ns}",c).replace("${title}",i.title||"").replace("${property}",e)}if(n.predicateGenerator)return n.predicateGenerator(i.title||"",e);let a=kl(r);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function Kr(i,e,t,r,n){return t.propertyOptions?.[i]?.[r]!==void 0?t.propertyOptions[i][r]:e["x-ad4m"]?.[r]!==void 0?e["x-ad4m"][r]:t[r]!==void 0?t[r]:n}function kg(i){switch(i){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function Ig(i,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=Uu(e,t),n=class extends i{};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[l,c]of Object.entries(e.properties)){let u=Mu(e,l,c,r,t),m=e.required?.includes(l)||!1,y=Ro(c.type);if(Du(c)){s[l]={through:u,local:Kr(l,c,t,"local")},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:[]});let f=`add${He(l)}`,g=`remove${He(l)}`,_=`set${He(l)}`;n.prototype[f]=function(){},n.prototype[g]=function(){},n.prototype[_]=function(){}}else{let f=Kr(l,c,t,"resolveLanguage");!f&&t.resolveLanguage&&(f=t.resolveLanguage);let g=Kr(l,c,t,"local"),_=Kr(l,c,t,"readOnly");if(_===void 0){let k=c["x-ad4m"]?.writable;_=k!==void 0?!k:!1}let E=!_,A=Kr(l,c,t,"initial");if(Il(c)&&!f&&(f="literal",console.warn(`Property "${l}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),f==null&&Ag(c)&&(f="literal"),f==null&&(f="literal"),m&&!A&&(Il(c)?A="literal://json:{}":A="ad4m://undefined"),a[l]={through:u,required:m,writable:E,...f&&{resolveLanguage:f},...g!==void 0&&{local:g},...A&&{initial:A}},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:kg(y)}),E){let k=Ya(l);n.prototype[k]=function(){}}}}for(let[l,c]of Object.entries(a))op(n,l,c);for(let[l,c]of Object.entries(s))cp(n,l,{predicate:c.through||"",kind:"hasMany",...c.getter!==void 0&&{getter:c.getter},...c.local!==void 0&&{local:c.local}});return n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,lp({name:t.name})(n),n}function Tg(i,e,t){if(!t)return"";let r=[];for(let[n,a]of Object.entries(t))if(["id","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(a)){let l=a.map(c=>ce(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=>ce(u)).join(", ");r.push(`${o} NOT IN [${c}]`)}else r.push(`${o} != ${ce(l.not)}`);l.between!==void 0&&Array.isArray(l.between)&&l.between.length===2&&r.push(`${o} >= ${ce(l.between[0])} AND ${o} <= ${ce(l.between[1])}`),l.gt!==void 0&&r.push(`${o} > ${ce(l.gt)}`),l.gte!==void 0&&r.push(`${o} >= ${ce(l.gte)}`),l.lt!==void 0&&r.push(`${o} < ${ce(l.lt)}`),l.lte!==void 0&&r.push(`${o} <= ${ce(l.lte)}`),l.contains!==void 0&&r.push(`${o} CONTAINS ${ce(l.contains)}`)}else r.push(`${o} = ${ce(a)}`)}else{let o=e[n],l=o?.kind==="belongsToOne"||o?.kind==="belongsToMany";if(o){let y=ee(o.predicate);if(Array.isArray(a)){let d=a.map(f=>ce(f)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${d}]]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${d}]]) > 0`)}else if(typeof a=="object"&&a!==null){let d=a;if(d.not!==void 0)if(Array.isArray(d.not)){let f=d.not.map(g=>ce(g)).join(", ");l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri IN [${f}]]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri IN [${f}]]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${ce(d.not)}]) = 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${ce(d.not)}]) = 0`)}else l?r.push(`count(<-link[WHERE predicate = '${y}' AND in.uri = ${ce(a)}]) > 0`):r.push(`count(->link[WHERE predicate = '${y}' AND out.uri = ${ce(a)}]) > 0`);continue}let c=i.properties[n];if(!c)continue;let u=ee(c.predicate),m=c.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let y=a.map(d=>ce(d)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${y}]]) > 0`)}else if(typeof a=="object"&&a!==null){let y=a;if(y.not!==void 0)if(Array.isArray(y.not)){let f=y.not.map(g=>ce(g)).join(", ");r.push(`count(->link[WHERE predicate = '${u}' AND ${m} IN [${f}]]) = 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${ce(y.not)}]) = 0`);(y.gt!==void 0||y.gte!==void 0||y.lt!==void 0||y.lte!==void 0||y.between!==void 0||y.contains!==void 0)&&r.push(`count(->link[WHERE predicate = '${u}']) > 0`)}else r.push(`count(->link[WHERE predicate = '${u}' AND ${m} = ${ce(a)}]) > 0`)}return r.join(" AND ")}function Cg(i,e,t,r){let{where:n}=t,a=[];if(t.parent){let c=hn(t.parent,r);a.push(`count(<-link[WHERE in.uri = ${ce(t.parent.id)} AND predicate = '${ee(c)}']) > 0`)}for(let[,c]of Object.entries(i.properties))if(c.required){if(c.getter)continue;c.flag&&c.initial?a.push(`count(->link[WHERE predicate = '${ee(c.predicate)}' AND out.uri = '${ee(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${ee(c.predicate)}']) > 0`)}if(a.length===0){for(let[,c]of Object.entries(i.properties))if(c.initial){c.flag?a.push(`count(->link[WHERE predicate = '${ee(c.predicate)}' AND out.uri = '${ee(c.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${ee(c.predicate)}']) > 0`);break}}if(a.length===0){let c=[];for(let[,u]of Object.entries(i.properties))u.predicate&&c.push(`predicate = '${ee(u.predicate)}'`);if(i.relations)for(let[,u]of Object.entries(i.relations))u.predicate&&c.push(`predicate = '${ee(u.predicate)}'`);c.length>0&&a.push(`count(->link[WHERE (${c.join(" OR ")})]) > 0`)}let s=Tg(i,e,n),o=[];return o.push(...a),s&&o.push(s),o.push("count(->link) > 0"),`
1365
1383
  SELECT
1366
1384
  id AS source,
1367
1385
  uri AS source_uri,
@@ -1369,33 +1387,33 @@ SELECT
1369
1387
  FROM node
1370
1388
  WHERE ${o.join(" AND ")}
1371
1389
  FETCH links
1372
- `.trim()}var uo=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}parent(e,t,r){let n=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let s=e.constructor;return this.queryParams.parent={id:n,model:s,field:t.field},this}let a=r?.field;if(typeof t=="string")this.queryParams.parent={id:n,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:n,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:n,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){let e;if(this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(t);({results:e}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r))}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r))}return e}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.useSurrealDBFlag){let r=await t.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async s=>{let{results:o}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}else{let r=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async s=>{let{results:o}=await t.instancesFromPrologResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}}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 e(n),n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async a=>{let s=a?.[0]?.TotalCount||0;e(s)};this.currentSubscription.onResult(r);let n=this.currentSubscription.result?.[0]?.TotalCount||0;return e(n),n}}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 u=>{let{results:m,totalCount:y}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let s=async u=>{let{results:m,totalCount:y}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}}};function aa(i){return Array.isArray(i)?i.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):i}function hl(i,e){if(Array.isArray(e))return e.includes(i);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(i):i!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return i>=t.between[0]&&i<=t.between[1];let r=!0;return t.gt!==void 0&&(r=r&&i>t.gt),t.gte!==void 0&&(r=r&&i>=t.gte),t.lt!==void 0&&(r=r&&i<t.lt),t.lte!==void 0&&(r=r&&i<=t.lte),t.contains!==void 0&&(typeof i=="string"?r=r&&i.includes(String(t.contains)):Array.isArray(i)?r=r&&i.includes(t.contains):r=!1),r}return i===e}async function dg(i,e,t,r){let n=i;if(i!=null&&i!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof i=="string"&&!i.startsWith("literal://"))try{let a=await t.getExpression(i);if(a)try{n=JSON.parse(a.data)}catch{n=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof i=="string"&&i.startsWith("literal://"))try{let a=oe.fromUrl(i).get();n=a.data!==void 0?a.data:a}catch{}else typeof i=="string"&&r&&(r==="number"?n=Number(i):r==="boolean"&&(n=i==="true"||i==="1"));return e.transform&&typeof e.transform=="function"&&(n=e.transform(n)),n}async function gl(i,e,t,r,n){if(!e||e.length===0)return;let a=null,s=null,o=null,l=n&&n.length>0?new Set(n):null,c=new Map;for(let[p,f]of Object.entries(t.properties))f.getter||l&&!l.has(p)||c.set(f.predicate,[p,f]);let u=new Map,m=[];for(let[p,f]of Object.entries(t.relations))if(!f.getter){if(f.target&&f.filter!==!1){m.push([p,f]);continue}u.set(f.predicate,[p,f])}for(let[p,f]of m)u.has(f.predicate)||u.set(f.predicate,[p,f]);let y=new Map,d=new Map;for(let p=0;p<e.length;p++){let f=e[p],{predicate:S,target:E,author:A,timestamp:k}=f;if(E==="None"||E===void 0||E===null)continue;k!=null&&((a==null||k<a)&&(a=k,o=A??null),(s==null||k>s)&&(s=k));let b=c.get(S);if(b){y.get(b[0]),y.set(b[0],{target:E,timestamp:k});continue}let T=u.get(S);if(T){let[R]=T,C=d.get(R);C||(C=[],d.set(R,C)),C.push({target:E,timestamp:k??"",index:p})}}for(let[p,{target:f}]of y){let[,S]=c.get(t.properties[p].predicate),E=typeof i[p];i[p]=await dg(f,S,r,E!=="undefined"?E:void 0)}for(let[p,f]of d)f.sort((S,E)=>{let A=String(S.timestamp).localeCompare(String(E.timestamp));return A!==0?A:S.index-E.index}),i[p]=f.map(S=>S.target).filter(S=>S!=null&&S!==""&&S!=="None");o&&(i.author=o),a!=null&&(i.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),s!=null&&(i.updatedAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s)}async function pg(i,e,t){let r=Object.fromEntries(await Promise.all(t.map(async([a,s,o])=>{let l=s;if(!o&&typeof s=="string"){let m=Array.from(s,p=>p.codePointAt(0)),y=m.every(p=>p<=255),d=m.some(p=>p>=128);if(y&&d)try{let p=Uint8Array.from(m),f=new TextDecoder("utf-8",{fatal:!0}).decode(p);f!==s&&(l=f)}catch(p){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:s,error:p})}}if(o){let m=await i.getExpression(s);if(m)try{l=JSON.parse(m.data)}catch{l=m.data}}let u=Mi(e.constructor)[a]?.transform;return u&&typeof u=="function"&&(l=u(l)),[a,l]}))),n=Object.fromEntries(Object.entries(r).filter(([a])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(e,n)}function fg(i,e){let t=Pl(i,e);if(!t){let r=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${r}".`);return}return t.getter}async function ml(i,e,t,r){let n=se(i.id),s=r?.requestedProperties&&r.requestedProperties.length>0?new Set(r.requestedProperties):null;for(let[o,l]of Object.entries(t.properties))if(!(s&&!s.has(o))&&l.getter)try{let c=l.getter.replace(/Base/g,n),u=await e.querySurrealDB(`SELECT (${c}) AS value FROM node WHERE uri = ${n}`);u&&u.length>0&&u[0].value!==void 0&&u[0].value!==null&&u[0].value!=="None"&&u[0].value!==""&&(i[o]=u[0].value)}catch(c){console.warn(`Failed to evaluate getter for ${o}:`,c)}for(let[o,l]of Object.entries(t.relations)){if(s&&!s.has(o)&&!(r?.include&&o in r.include))continue;let c=l,u=c.getter;if(!u&&c.where&&c.direction!=="reverse")try{let m=c.target?.(),y=m?m.getModelMetadata?.()??null:null,d=Rl(c.where,y);d.length>0&&(u=`(->link[WHERE predicate = '${Y(c.predicate)}'].out[WHERE ${d.join(" AND ")}].uri)`)}catch{}if(!u&&c.target&&c.filter!==!1&&c.direction!=="reverse")try{let m=c.target();u=fg(c.predicate,m),u||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${o}" (predicate: "${c.predicate}")`)}catch(m){console.warn(`[Ad4mModel] auto-generation failed for relation "${o}":`,m)}if(u)try{let y=`SELECT (${u.replace(/Base/g,n)}) AS value FROM node WHERE uri = ${n}`,d=await e.querySurrealDB(y);if(d&&d.length>0&&d[0].value!==void 0&&d[0].value!==null){let p=d[0].value;i[o]=Array.isArray(p)?p.filter(f=>f!=null&&f!==""&&f!=="None"):p}}catch(m){console.warn(`Failed to evaluate getter for ${o}:`,m)}}}async function hn(i,e,t,r){if(!r||Object.keys(r).length===0)return;let n=wt(i);for(let[a,s]of Object.entries(r)){let o=n[a];if(!o){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let l=o.target(),c=typeof s=="object"&&s!==null?s:void 0,u=c?.include;if(o.kind==="belongsToOne"||o.kind==="belongsToMany"){for(let E of e){let k=(await t.get(new re({predicate:o.predicate,target:E.id}))).filter(b=>b.data.target===E.id).map(b=>b.data.source);if(o.kind==="belongsToOne"){if(k.length===0){E[a]=null;continue}let b=k[k.length-1];try{let T=new l(t,b);await T.get(),E[a]=T}catch{E[a]=null}}else{let b=[];if(c&&(c.where||c.order||c.properties)){let T={id:k,...c.where??{}};b=await l.findAll(t,{where:T,...c.order&&{order:c.order},...c.properties&&{properties:c.properties}})}else await Promise.all(k.map(async T=>{try{let R=new l(t,T);await R.get(c?.properties?{properties:c.properties}:void 0),b.push(R)}catch{}}));if(c?.order&&!(c.where||c.properties)){let T=Object.entries(c.order);b=b.sort((R,C)=>{for(let[Q,V]of T){let L=String(R[Q]??""),W=String(C[Q]??""),He=L.localeCompare(W);if(He!==0)return V==="DESC"?-He:He}return 0})}if(c?.offset!=null||c?.limit!=null){let T=c.offset??0,R=c.limit!=null?T+c.limit:void 0;b=b.slice(T,R)}E[a]=b,u&&b.length>0&&await hn(l,b,t,u)}}continue}let m=new Set,y=new Map;for(let E of e){let A=E[a];if(y.set(E,Array.isArray(A)?[...A]:A),A!=null)if(Array.isArray(A))for(let k of A)typeof k=="string"?m.add(k):k&&typeof k=="object"&&typeof k.id=="string"&&m.add(k.id);else typeof A=="string"?m.add(A):A&&typeof A=="object"&&typeof A.id=="string"&&m.add(A.id)}if(m.size===0)continue;let d=new Map,f={where:{id:Array.from(m),...c?.where??{}},...c?.order&&{order:c.order},...c?.properties&&{properties:c.properties}},S=await l.findAll(t,f);for(let E of S)d.set(E.id,E);for(let E of e){let A=y.get(E);if(A!=null)if(Array.isArray(A)){let k=A.map(b=>typeof b=="string"?d.has(b)?d.get(b):null:b&&typeof b=="object"&&typeof b.id=="string"?d.has(b.id)?d.get(b.id):b:null).filter(b=>b!==null);if(c?.order){let b=Object.entries(c.order);k=k.sort((T,R)=>{for(let[C,Q]of b){let V=String(T[C]??""),L=String(R[C]??""),W=V.localeCompare(L);if(W!==0)return Q==="DESC"?-W:W}return 0})}if(c?.offset!=null||c?.limit!=null){let b=c.offset??0,T=c.limit!=null?b+c.limit:void 0;k=k.slice(b,T)}o.maxCount===1?(k.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${k.length} values found; keeping the last`),E[a]=k.length>0?k[k.length-1]:null):E[a]=k}else typeof A=="string"&&d.has(A)?E[a]=d.get(A):A&&typeof A=="object"&&typeof A.id=="string"&&(E[a]=d.has(A.id)?d.get(A.id):A)}if(u){let E=Array.from(d.values());await hn(l,E,t,u)}}}var _r=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===_r)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]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @Model");let t=e.className,r={},n=Mi(this);for(let[m,y]of Object.entries(n)){let d=y;r[m]={name:m,predicate:d.through||"",required:d.required||!1,readOnly:!(d.writable??!1),...d.initial!==void 0&&{initial:d.initial},...d.resolveLanguage!==void 0&&{resolveLanguage:d.resolveLanguage},...d.prologGetter!==void 0&&{prologGetter:d.prologGetter},...d.getter!==void 0&&{getter:d.getter},...d.prologSetter!==void 0&&{prologSetter:d.prologSetter},...d.local!==void 0&&{local:d.local},...d.transform!==void 0&&{transform:d.transform},...d.flag!==void 0&&{flag:d.flag}}}let a={},s=wt(this),o=Object.fromEntries(Object.entries(s).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany"));for(let[m,y]of Object.entries(o)){let d=y;a[m]={name:m,predicate:d.predicate||"",...d.local!==void 0&&{local:d.local},...d.getter!==void 0&&{getter:d.getter},direction:d.kind==="belongsToMany"||d.kind==="belongsToOne"?"reverse":"forward",...d.target!==void 0&&{target:d.target},...d.filter!==void 0&&{filter:d.filter},...d.where!==void 0&&{where:d.where}}}let l=Object.keys(r).length>0,c=Object.keys(a).length>0;if(!(l||c)&&e.__jsonSchema){let m=e.__jsonSchema,y=e.__jsonSchemaOptions||{};if(m.properties)for(let[d,p]of Object.entries(m.properties)){let f=Su(p),S=Eu(m,d,p,_u(m,y),y);if(f)a[d]={name:d,predicate:S,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let E=m.required?.includes(d)||!1;r[d]={name:d,predicate:S,required:E,readOnly:p["x-ad4m"]?.writable===!1,...p["x-ad4m"]?.resolveLanguage&&{resolveLanguage:p["x-ad4m"].resolveLanguage},...p["x-ad4m"]?.initial&&{initial:p["x-ad4m"].initial},...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}}}}}return{className:t,properties:r,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||oe.from(Ll(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return Mi(t)[e]}getRelationOptions(e){let t=this.constructor;return wt(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog 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}}]}generateRelationAction(e,t){let r=this.getRelationOptions(e);if(!r)throw new Error(`Relation "${e}" has no metadata defined`);if(!r.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:r.predicate,target:"value",...r.local&&{local:!0}}]}static async assignValuesToInstance(e,t,r){return pg(e,t,r)}takeSnapshot(e){let r=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(r.properties)){let s=this[a];n[a]=aa(Array.isArray(s)?[...s]:s)}if(e===void 0)for(let a of Object.keys(r.relations)){let s=this[a];n[a]=aa(Array.isArray(s)?[...s]:s)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in r.relations){let s=this[a];n[a]=aa(Array.isArray(s)?[...s]:s)}}this._snapshot=n}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let r=[],n=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of n){if(!(a in this._snapshot))continue;let s=aa(this[a]),o=this._snapshot[a];if(Array.isArray(s)||Array.isArray(o)){let l=Array.isArray(s)?[...s].sort():[],c=Array.isArray(o)?[...o].sort():[];(l.length!==c.length||l.some((u,m)=>u!==c[m]))&&r.push(a)}else s!==o&&r.push(a)}return r}async getData(e){try{let t=this.constructor,r=t.getModelMetadata(),a=`
1390
+ `.trim()}var bo=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}parent(e,t,r){let n=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let s=e.constructor;return this.queryParams.parent={id:n,model:s,field:t.field},this}let a=r?.field;if(typeof t=="string")this.queryParams.parent={id:n,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:n,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:n,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){let e;if(this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(t);({results:e}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r))}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r))}return e}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.useSurrealDBFlag){let r=await t.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async s=>{let{results:o}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}else{let r=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async s=>{let{results:o}=await t.instancesFromPrologResult(this.perspective,this.queryParams,s);e(o)};this.currentSubscription.onResult(n);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}}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 e(n),n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let r=async a=>{let s=a?.[0]?.TotalCount||0;e(s)};this.currentSubscription.onResult(r);let n=this.currentSubscription.result?.[0]?.TotalCount||0;return e(n),n}}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 u=>{let{results:m,totalCount:y}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let s=async u=>{let{results:m,totalCount:y}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);r({results:m,totalCount:y,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(s);let{results:o,totalCount:l}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result),c={results:o,totalCount:l,pageSize:e,pageNumber:t};return r(c),c}}};function da(i){return Array.isArray(i)?i.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):i}function Tl(i,e){if(Array.isArray(e))return e.includes(i);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(i):i!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return i>=t.between[0]&&i<=t.between[1];let r=!0;return t.gt!==void 0&&(r=r&&i>t.gt),t.gte!==void 0&&(r=r&&i>=t.gte),t.lt!==void 0&&(r=r&&i<t.lt),t.lte!==void 0&&(r=r&&i<=t.lte),t.contains!==void 0&&(typeof i=="string"?r=r&&i.includes(String(t.contains)):Array.isArray(i)?r=r&&i.includes(t.contains):r=!1),r}return i===e}async function Lg(i,e,t,r){let n=i;if(i!=null&&i!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof i=="string"&&!i.startsWith("literal://"))try{let a=await t.getExpression(i);if(a)try{n=JSON.parse(a.data)}catch{n=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof i=="string"&&i.startsWith("literal://"))try{let a=le.fromUrl(i).get();n=a.data!==void 0?a.data:a}catch{}else typeof i=="string"&&r&&(r==="number"?n=Number(i):r==="boolean"&&(n=i==="true"||i==="1"));return e.transform&&typeof e.transform=="function"&&(n=e.transform(n)),n}async function Cl(i,e,t,r,n){if(!e||e.length===0)return;let a=null,s=null,o=null,l=n&&n.length>0?new Set(n):null,c=new Map;for(let[f,g]of Object.entries(t.properties))g.getter||l&&!l.has(f)||c.set(g.predicate,[f,g]);let u=new Map,m=[];for(let[f,g]of Object.entries(t.relations))if(!g.getter){if(g.target&&g.filter!==!1){m.push([f,g]);continue}u.set(g.predicate,[f,g])}for(let[f,g]of m)u.has(g.predicate)||u.set(g.predicate,[f,g]);let y=new Map,d=new Map;for(let f=0;f<e.length;f++){let g=e[f],{predicate:_,target:E,author:A,timestamp:k}=g;if(E==="None"||E===void 0||E===null)continue;k!=null&&((a==null||k<a)&&(a=k,o=A??null),(s==null||k>s)&&(s=k));let w=c.get(_);if(w){y.get(w[0]),y.set(w[0],{target:E,timestamp:k});continue}let C=u.get(_);if(C){let[U]=C,P=d.get(U);P||(P=[],d.set(U,P)),P.push({target:E,timestamp:k??"",index:f})}}for(let[f,{target:g}]of y){let[,_]=c.get(t.properties[f].predicate),E=typeof i[f];i[f]=await Lg(g,_,r,E!=="undefined"?E:void 0)}for(let[f,g]of d)g.sort((_,E)=>{let A=String(_.timestamp).localeCompare(String(E.timestamp));return A!==0?A:_.index-E.index}),i[f]=g.map(_=>_.target).filter(_=>_!=null&&_!==""&&_!=="None");o&&(i.author=o),a!=null&&(i.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),s!=null&&(i.updatedAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s)}async function Pg(i,e,t){let r=Object.fromEntries(await Promise.all(t.map(async([a,s,o])=>{let l=s;if(!o&&typeof s=="string"){let m=Array.from(s,f=>f.codePointAt(0)),y=m.every(f=>f<=255),d=m.some(f=>f>=128);if(y&&d)try{let f=Uint8Array.from(m),g=new TextDecoder("utf-8",{fatal:!0}).decode(f);g!==s&&(l=g)}catch(f){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:s,error:f})}}if(o){let m=await i.getExpression(s);if(m)try{l=JSON.parse(m.data)}catch{l=m.data}}let u=Hi(e.constructor)[a]?.transform;return u&&typeof u=="function"&&(l=u(l)),[a,l]}))),n=Object.fromEntries(Object.entries(r).filter(([a])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(e,n)}function Rg(i,e){let t=Gl(i,e);if(!t){let r=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${r}".`);return}return t.getter}async function Ll(i,e,t,r){let n=ce(i.id),s=r?.requestedProperties&&r.requestedProperties.length>0?new Set(r.requestedProperties):null;for(let[o,l]of Object.entries(t.properties))if(!(s&&!s.has(o))&&l.getter)try{let c=l.getter.replace(/Base/g,n),u=await e.querySurrealDB(`SELECT (${c}) AS value FROM node WHERE uri = ${n}`);u&&u.length>0&&u[0].value!==void 0&&u[0].value!==null&&u[0].value!=="None"&&u[0].value!==""&&(i[o]=u[0].value)}catch(c){console.warn(`Failed to evaluate getter for ${o}:`,c)}for(let[o,l]of Object.entries(t.relations)){if(s&&!s.has(o)&&!(r?.include&&o in r.include))continue;let c=l,u=c.getter;if(!u&&c.where&&c.direction!=="reverse")try{let m=c.target?.(),y=m?m.getModelMetadata?.()??null:null,d=Ql(c.where,y);d.length>0&&(u=`(->link[WHERE predicate = '${ee(c.predicate)}'].out[WHERE ${d.join(" AND ")}].uri)`)}catch{}if(!u&&c.target&&c.filter!==!1&&c.direction!=="reverse")try{let m=c.target();u=Rg(c.predicate,m),u||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${o}" (predicate: "${c.predicate}")`)}catch(m){console.warn(`[Ad4mModel] auto-generation failed for relation "${o}":`,m)}if(u)try{let y=`SELECT (${u.replace(/Base/g,n)}) AS value FROM node WHERE uri = ${n}`,d=await e.querySurrealDB(y);if(d&&d.length>0&&d[0].value!==void 0&&d[0].value!==null){let f=d[0].value;i[o]=Array.isArray(f)?f.filter(g=>g!=null&&g!==""&&g!=="None"):f}}catch(m){console.warn(`Failed to evaluate getter for ${o}:`,m)}}}async function bn(i,e,t,r){if(!r||Object.keys(r).length===0)return;let n=$t(i);for(let[a,s]of Object.entries(r)){let o=n[a];if(!o){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let l=o.target(),c=typeof s=="object"&&s!==null?s:void 0,u=c?.include;if(o.kind==="belongsToOne"||o.kind==="belongsToMany"){for(let E of e){let k=(await t.get(new ae({predicate:o.predicate,target:E.id}))).filter(w=>w.data.target===E.id).map(w=>w.data.source);if(o.kind==="belongsToOne"){if(k.length===0){E[a]=null;continue}let w=k[k.length-1];try{let C=new l(t,w);await C.get(),E[a]=C}catch{E[a]=null}}else{let w=[];if(c&&(c.where||c.order||c.properties)){let C={id:k,...c.where??{}};w=await l.findAll(t,{where:C,...c.order&&{order:c.order},...c.properties&&{properties:c.properties}})}else await Promise.all(k.map(async C=>{try{let U=new l(t,C);await U.get(c?.properties?{properties:c.properties}:void 0),w.push(U)}catch{}}));if(c?.order&&!(c.where||c.properties)){let C=Object.entries(c.order);w=w.sort((U,P)=>{for(let[Q,V]of C){let R=String(U[Q]??""),W=String(P[Q]??""),We=R.localeCompare(W);if(We!==0)return V==="DESC"?-We:We}return 0})}if(c?.offset!=null||c?.limit!=null){let C=c.offset??0,U=c.limit!=null?C+c.limit:void 0;w=w.slice(C,U)}E[a]=w,u&&w.length>0&&await bn(l,w,t,u)}}continue}let m=new Set,y=new Map;for(let E of e){let A=E[a];if(y.set(E,Array.isArray(A)?[...A]:A),A!=null)if(Array.isArray(A))for(let k of A)typeof k=="string"?m.add(k):k&&typeof k=="object"&&typeof k.id=="string"&&m.add(k.id);else typeof A=="string"?m.add(A):A&&typeof A=="object"&&typeof A.id=="string"&&m.add(A.id)}if(m.size===0)continue;let d=new Map,g={where:{id:Array.from(m),...c?.where??{}},...c?.order&&{order:c.order},...c?.properties&&{properties:c.properties}},_=await l.findAll(t,g);for(let E of _)d.set(E.id,E);for(let E of e){let A=y.get(E);if(A!=null)if(Array.isArray(A)){let k=A.map(w=>typeof w=="string"?d.has(w)?d.get(w):null:w&&typeof w=="object"&&typeof w.id=="string"?d.has(w.id)?d.get(w.id):w:null).filter(w=>w!==null);if(c?.order){let w=Object.entries(c.order);k=k.sort((C,U)=>{for(let[P,Q]of w){let V=String(C[P]??""),R=String(U[P]??""),W=V.localeCompare(R);if(W!==0)return Q==="DESC"?-W:W}return 0})}if(c?.offset!=null||c?.limit!=null){let w=c.offset??0,C=c.limit!=null?w+c.limit:void 0;k=k.slice(w,C)}o.maxCount===1?(k.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${k.length} values found; keeping the last`),E[a]=k.length>0?k[k.length-1]:null):E[a]=k}else typeof A=="string"&&d.has(A)?E[a]=d.get(A):A&&typeof A=="object"&&typeof A.id=="string"&&(E[a]=d.has(A.id)?d.get(A.id):A)}if(u){let E=Array.from(d.values());await bn(l,E,t,u)}}}var $r=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===$r)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]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @Model");let t=e.className,r={},n=Hi(this);for(let[m,y]of Object.entries(n)){let d=y;r[m]={name:m,predicate:d.through||"",required:d.required||!1,readOnly:!(d.writable??!1),...d.initial!==void 0&&{initial:d.initial},...d.resolveLanguage!==void 0&&{resolveLanguage:d.resolveLanguage},...d.prologGetter!==void 0&&{prologGetter:d.prologGetter},...d.getter!==void 0&&{getter:d.getter},...d.prologSetter!==void 0&&{prologSetter:d.prologSetter},...d.local!==void 0&&{local:d.local},...d.transform!==void 0&&{transform:d.transform},...d.flag!==void 0&&{flag:d.flag}}}let a={},s=$t(this),o=Object.fromEntries(Object.entries(s).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany"));for(let[m,y]of Object.entries(o)){let d=y;a[m]={name:m,predicate:d.predicate||"",...d.local!==void 0&&{local:d.local},...d.getter!==void 0&&{getter:d.getter},direction:d.kind==="belongsToMany"||d.kind==="belongsToOne"?"reverse":"forward",...d.target!==void 0&&{target:d.target},...d.filter!==void 0&&{filter:d.filter},...d.where!==void 0&&{where:d.where}}}let l=Object.keys(r).length>0,c=Object.keys(a).length>0;if(!(l||c)&&e.__jsonSchema){let m=e.__jsonSchema,y=e.__jsonSchemaOptions||{};if(m.properties)for(let[d,f]of Object.entries(m.properties)){let g=Du(f),_=Mu(m,d,f,Uu(m,y),y);if(g)a[d]={name:d,predicate:_,...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}};else{let E=m.required?.includes(d)||!1;r[d]={name:d,predicate:_,required:E,readOnly:f["x-ad4m"]?.writable===!1,...f["x-ad4m"]?.resolveLanguage&&{resolveLanguage:f["x-ad4m"].resolveLanguage},...f["x-ad4m"]?.initial&&{initial:f["x-ad4m"].initial},...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}}}}}return{className:t,properties:r,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||le.from(Wl(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return Hi(t)[e]}getRelationOptions(e){let t=this.constructor;return $t(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog 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}}]}generateRelationAction(e,t){let r=this.getRelationOptions(e);if(!r)throw new Error(`Relation "${e}" has no metadata defined`);if(!r.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:r.predicate,target:"value",...r.local&&{local:!0}}]}static async assignValuesToInstance(e,t,r){return Pg(e,t,r)}takeSnapshot(e){let r=this.constructor.getModelMetadata(),n={};for(let a of Object.keys(r.properties)){let s=this[a];n[a]=da(Array.isArray(s)?[...s]:s)}if(e===void 0)for(let a of Object.keys(r.relations)){let s=this[a];n[a]=da(Array.isArray(s)?[...s]:s)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in r.relations){let s=this[a];n[a]=da(Array.isArray(s)?[...s]:s)}}this._snapshot=n}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let r=[],n=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of n){if(!(a in this._snapshot))continue;let s=da(this[a]),o=this._snapshot[a];if(Array.isArray(s)||Array.isArray(o)){let l=Array.isArray(s)?[...s].sort():[],c=Array.isArray(o)?[...o].sort():[];(l.length!==c.length||l.some((u,m)=>u!==c[m]))&&r.push(a)}else s!==o&&r.push(a)}return r}async getData(e){try{let t=this.constructor,r=t.getModelMetadata(),a=`
1373
1391
  SELECT id, predicate, out.uri AS target, author, timestamp
1374
1392
  FROM link
1375
- WHERE in.uri = ${se(this._baseExpression)}
1393
+ WHERE in.uri = ${ce(this._baseExpression)}
1376
1394
  ORDER BY timestamp ASC
1377
- `,s=await this._perspective.querySurrealDB(a);if(s&&s.length>0){let u=e?.properties&&e.properties.length>0?e.properties:void 0;await gl(this,s,r,this._perspective,u)}let o=wt(t),l=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[u,m]of Object.entries(o)){if(m.kind!=="belongsToOne"&&m.kind!=="belongsToMany"||l&&!l.has(u))continue;let d=(await this._perspective.get(new re({predicate:m.predicate,target:this._baseExpression}))).filter(p=>p.data.target===this._baseExpression).map(p=>p.data.source);m.kind==="belongsToOne"?this[u]=d.length>0?d[d.length-1]:null:this[u]=d}let c=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await ml(this,this._perspective,r,c),e?.include&&await hn(t,[this],this._perspective,e.include)}catch(t){console.error(`SurrealDB getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,r){let{properties:n,where:a,order:s,offset:o,limit:l,count:c}=t,u=r||await this.getClassName(e),m=t.parent?ln(t.parent,this):void 0,y=[sl(),al(t.parent,m),ag(n),ol(a)],d=[cl(c),ll(s),ul(o),dl(l)];return`
1395
+ `,s=await this._perspective.querySurrealDB(a);if(s&&s.length>0){let u=e?.properties&&e.properties.length>0?e.properties:void 0;await Cl(this,s,r,this._perspective,u)}let o=$t(t),l=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[u,m]of Object.entries(o)){if(m.kind!=="belongsToOne"&&m.kind!=="belongsToMany"||l&&!l.has(u))continue;let d=(await this._perspective.get(new ae({predicate:m.predicate,target:this._baseExpression}))).filter(f=>f.data.target===this._baseExpression).map(f=>f.data.source);m.kind==="belongsToOne"?this[u]=d.length>0?d[d.length-1]:null:this[u]=d}let c=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await Ll(this,this._perspective,r,c),e?.include&&await bn(t,[this],this._perspective,e.include)}catch(t){console.error(`SurrealDB getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,r){let{properties:n,where:a,order:s,offset:o,limit:l,count:c}=t,u=r||await this.getClassName(e),m=t.parent?hn(t.parent,this):void 0,y=[Sl(),wl(t.parent,m),$g(n),_l(a)],d=[xl(c),El(s),$l(o),Al(l)];return`
1378
1396
  findall([Base, Properties, Collections, Timestamp, Author], (
1379
1397
  subject_class("${u}", SubjectClass),
1380
1398
  instance(SubjectClass, Base),
1381
- ${y.filter(f=>f).join(", ")}
1399
+ ${y.filter(g=>g).join(", ")}
1382
1400
  ), UnsortedInstances),
1383
- ${d.filter(f=>f).join(", ")}
1384
- `}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),n=wt(this);return ug(r,n,t,this)}static async instancesFromPrologResult(e,t,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let n=t?.properties||[],s=(await Promise.all(r[0].AllInstances.map(async([l,c,u,m,y])=>{try{let d=new this(e,l);n.length&&Object.keys(d).forEach(f=>{!n.includes(f)&&f!=="createdAt"&&f!=="updatedAt"&&f!=="author"&&f!=="id"&&f!=="baseExpression"&&delete d[f]});let p=[...c,...u,["createdAt",m],["author",y]];return await _r.assignValuesToInstance(e,d,p),d}catch(d){return console.error(`Failed to process instance ${l}:`,d),null}}))).filter(l=>l!==null);t.include&&s.length>0&&await hn(this,s,e,t.include);let o=t.include;for(let l of s)l.takeSnapshot(o);return{results:s,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=[];for(let f of r){let S;try{if(S=f.source_uri,!S)continue;let E=f.links||[],A=new this(e,S);if(await gl(A,E,n,e,a.length>0?a:void 0),a.length>0){let k=new Set(a);for(let b of Object.keys(n.properties))k.has(b)||delete A[b];for(let b of Object.keys(n.relations))!k.has(b)&&!(t.include&&b in t.include)&&delete A[b];for(let b of["author","createdAt","updatedAt"])k.has(b)||delete A[b]}s.push(A)}catch(E){console.error(`Failed to process SurrealDB instance ${S}:`,E)}}let o=wt(this),l=Object.entries(o).filter(([f,S])=>(S.kind==="belongsToOne"||S.kind==="belongsToMany")&&(a.length===0||a.includes(f)));l.length>0&&s.length>0&&await Promise.all(s.map(async f=>{for(let[S,E]of l){let k=(await e.get(new re({predicate:E.predicate,target:f.id}))).filter(b=>b.data.target===f.id).map(b=>b.data.source);E.kind==="belongsToOne"?f[S]=k.length>0?k[k.length-1]:null:f[S]=k}}));let c=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let f of s)await ml(f,e,n,c);let u=s;t.where&&(u=s.filter(f=>{for(let[S,E]of Object.entries(t.where))if(S!=="base"){if(S==="author"||S==="timestamp"){if(!hl(f[S],E))return!1;continue}if(typeof E=="object"&&E!==null&&!Array.isArray(E)){let A=E;if((A.gt!==void 0||A.gte!==void 0||A.lt!==void 0||A.lte!==void 0||A.between!==void 0||A.contains!==void 0)&&!hl(f[S],E))return!1}}return!0}));let m=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(m){let f=Object.entries(m);u.sort((S,E)=>{for(let[A,k]of f){let b=S[A],T=E[A];if(b===void 0&&T===void 0)continue;if(b===void 0)return k==="ASC"?1:-1;if(T===void 0)return k==="ASC"?-1:1;let R=0;if(typeof b=="number"&&typeof T=="number"?R=b-T:typeof b=="string"&&typeof T=="string"?R=b.localeCompare(T):R=String(b).localeCompare(String(T)),R!==0)return k==="DESC"?-R:R}return 0})}let y=u.length,d=u;if(t.offset!==void 0||t.limit!==void 0){let f=t.offset||0,S=t.limit?f+t.limit:void 0;d=u.slice(f,S)}t.include&&d.length>0&&await hn(this,d,e,t.include);let p=t.include;for(let f of d)f.takeSnapshot(p);return{results:d,totalCount:y}}static async findAll(e,t={},r=!0){if(t.properties&&t.properties.length===0)throw new Error("properties[] must not be empty \u2014 omit the field to return all properties, or specify at least one field name");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 findOne(e,t={},r=!0){let n={...t,limit:1};return(await this.findAll(e,n,r))[0]??null}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{where:n}=t,a=r||await this.getClassName(e),s=t.parent?ln(t.parent,this):void 0,o=[sl(),al(t.parent,s),ol(n)],l=[cl(!0),ll(),ul(),dl()];return`
1401
+ ${d.filter(g=>g).join(", ")}
1402
+ `}static async queryToSurrealQL(e,t){let r=this.getModelMetadata(),n=$t(this);return Cg(r,n,t,this)}static async instancesFromPrologResult(e,t,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let n=t?.properties||[],s=(await Promise.all(r[0].AllInstances.map(async([l,c,u,m,y])=>{try{let d=new this(e,l);n.length&&Object.keys(d).forEach(g=>{!n.includes(g)&&g!=="createdAt"&&g!=="updatedAt"&&g!=="author"&&g!=="id"&&g!=="baseExpression"&&delete d[g]});let f=[...c,...u,["createdAt",m],["author",y]];return await $r.assignValuesToInstance(e,d,f),d}catch(d){return console.error(`Failed to process instance ${l}:`,d),null}}))).filter(l=>l!==null);t.include&&s.length>0&&await bn(this,s,e,t.include);let o=t.include;for(let l of s)l.takeSnapshot(o);return{results:s,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=[];for(let g of r){let _;try{if(_=g.source_uri,!_)continue;let E=g.links||[],A=new this(e,_);if(await Cl(A,E,n,e,a.length>0?a:void 0),a.length>0){let k=new Set(a);for(let w of Object.keys(n.properties))k.has(w)||delete A[w];for(let w of Object.keys(n.relations))!k.has(w)&&!(t.include&&w in t.include)&&delete A[w];for(let w of["author","createdAt","updatedAt"])k.has(w)||delete A[w]}s.push(A)}catch(E){console.error(`Failed to process SurrealDB instance ${_}:`,E)}}let o=$t(this),l=Object.entries(o).filter(([g,_])=>(_.kind==="belongsToOne"||_.kind==="belongsToMany")&&(a.length===0||a.includes(g)));l.length>0&&s.length>0&&await Promise.all(s.map(async g=>{for(let[_,E]of l){let k=(await e.get(new ae({predicate:E.predicate,target:g.id}))).filter(w=>w.data.target===g.id).map(w=>w.data.source);E.kind==="belongsToOne"?g[_]=k.length>0?k[k.length-1]:null:g[_]=k}}));let c=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let g of s)await Ll(g,e,n,c);let u=s;t.where&&(u=s.filter(g=>{for(let[_,E]of Object.entries(t.where))if(_!=="base"){if(_==="author"||_==="timestamp"){if(!Tl(g[_],E))return!1;continue}if(typeof E=="object"&&E!==null&&!Array.isArray(E)){let A=E;if((A.gt!==void 0||A.gte!==void 0||A.lt!==void 0||A.lte!==void 0||A.between!==void 0||A.contains!==void 0)&&!Tl(g[_],E))return!1}}return!0}));let m=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(m){let g=Object.entries(m);u.sort((_,E)=>{for(let[A,k]of g){let w=_[A],C=E[A];if(w===void 0&&C===void 0)continue;if(w===void 0)return k==="ASC"?1:-1;if(C===void 0)return k==="ASC"?-1:1;let U=0;if(typeof w=="number"&&typeof C=="number"?U=w-C:typeof w=="string"&&typeof C=="string"?U=w.localeCompare(C):U=String(w).localeCompare(String(C)),U!==0)return k==="DESC"?-U:U}return 0})}let y=u.length,d=u;if(t.offset!==void 0||t.limit!==void 0){let g=t.offset||0,_=t.limit?g+t.limit:void 0;d=u.slice(g,_)}t.include&&d.length>0&&await bn(this,d,e,t.include);let f=t.include;for(let g of d)g.takeSnapshot(f);return{results:d,totalCount:y}}static async findAll(e,t={},r=!0){if(t.properties&&t.properties.length===0)throw new Error("properties[] must not be empty \u2014 omit the field to return all properties, or specify at least one field name");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 findOne(e,t={},r=!0){let n={...t,limit:1};return(await this.findAll(e,n,r))[0]??null}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{where:n}=t,a=r||await this.getClassName(e),s=t.parent?hn(t.parent,this):void 0,o=[Sl(),wl(t.parent,s),_l(n)],l=[xl(!0),El(),$l(),Al()];return`
1385
1403
  findall([Base, Properties, Collections, Timestamp, Author], (
1386
1404
  subject_class("${a}", SubjectClass),
1387
1405
  instance(SubjectClass, Base),
1388
1406
  ${o.filter(u=>u).join(", ")}
1389
1407
  ), UnsortedInstances),
1390
1408
  ${l.filter(u=>u).join(", ")}
1391
- `}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;t==null||t===""||(s&&(t=await this._perspective.createExpression(t,s)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],r))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"setter");t!=null&&(Array.isArray(t)?await this._perspective.executeAction(a,this._baseExpression,t.map(s=>({name:"value",value:this.resolveRelationId(s)})),r):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async addRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async removeRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async save(e){if(this._snapshot){await this.innerUpdate(!0,e),e?this.takeSnapshot():await this.getData();return}let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let r=this.constructor.getModelMetadata(),n=Object.values(r.properties).some(s=>s.required||s.flag||s.initial!==void 0),a=[];if(n){let s={};for(let[l,c]of Object.entries(this))if(c!=null&&!(Array.isArray(c)&&c.length>0)&&!c?.action){let u=r.properties[l];if(u?.resolveLanguage&&u.resolveLanguage!=="literal"&&typeof c=="object"){a.push(l);continue}s[l]=c}let o=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(o,this._baseExpression,s,e)}await this.innerUpdate(!n,e);for(let s of a){let o=this[s];o!=null&&await this.setProperty(s,o,e)}t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),r={},n=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of n){let s=this[a];s!=null&&a!=="author"&&a!=="timestamp"&&(r[a]=s)}return r}async innerUpdate(e=!0,t){let r=this.constructor,n=this._snapshot?new Set(this.changedFields()):null,a=r.getModelMetadata(),s=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),o=Object.entries(this);for(let[l,c]of o){if(!s.has(l)||n&&!n.has(l))continue;let u=a.relations[l];if(!(u&&(u.getter||u.target&&u.filter!==!1&&Object.entries(a.relations).some(([y,d])=>y!==l&&d.predicate===u.predicate)))&&c!=null){if(c?.action)switch(c.action){case"setter":await this.setRelationValues(l,c.value,t);break;case"adder":await this.addRelationValue(l,c.value,t);break;case"remover":await this.removeRelationValue(l,c.value,t);break;default:await this.setRelationValues(l,c.value,t);break}else if(Array.isArray(c))await this.setRelationValues(l,c,t);else if(c!=null&&c!==""&&e){if(this.getRelationOptions(l)||this.getPropertyMetadata(l)?.flag)continue;await this.setProperty(l,c,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(n=>n.required||n.flag||n.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let n=new Set;for(let o of Object.values(t.properties))o.predicate&&n.add(o.predicate);for(let o of Object.values(t.relations))o.predicate&&n.add(o.predicate);let s=(await this._perspective.get(new re({source:this._baseExpression}))).filter(o=>o.data.predicate&&n.has(o.data.predicate));s.length>0&&await this._perspective.removeLinks(s,e)}catch(n){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,n)}try{let n=await this._perspective.get(new re({target:this._baseExpression}));n.length>0&&await this._perspective.removeLinks(n,e)}catch(n){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,n)}}static async create(e,t={},r){let n=new this(e);if(Object.assign(n,t),r?.parent&&!r?.batchId){let a=await e.createBatch();await n.save(a);let s=ln(r.parent,this),o=new Ke({source:r.parent.id,predicate:s,target:n.id});return await e.add(o,"shared",a),await e.commitBatch(a),await n.get(),n}if(await n.save(r?.batchId),r?.parent){let a=ln(r.parent,this),s=new Ke({source:r.parent.id,predicate:a,target:n.id});await e.add(s,"shared",r?.batchId)}return n}static async update(e,t,r){let n=new this(e,t);return await n.get(),Object.assign(n,r),await n.save(),n}static async remove(e,t){return this.delete(e,t)}static async delete(e,t){await new this(e,t).delete()}static async register(e){await e.ensureSDNASubjectClass(this)}static async transaction(e,t){let r=await e.createBatch(),n=await t({batchId:r});return await e.commitBatch(r),n}static query(e,t){return new uo(e,this,t)}static fromJSONSchema(e,t){return cg(this,e,t)}};_r.classNamesByClass=new WeakMap;function Ao(i){return i.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function hg(i,e){let t=e.properties,r=Object.values(t).filter(s=>s.flag&&s.predicate&&s.initial);if(r.length>0){let s=r.map(o=>`triple(X, '${o.predicate}', '${o.initial}')`).join(`,
1409
+ `}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;t==null||t===""||(s&&(t=await this._perspective.createExpression(t,s)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],r))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"setter");t!=null&&(Array.isArray(t)?await this._perspective.executeAction(a,this._baseExpression,t.map(s=>({name:"value",value:this.resolveRelationId(s)})),r):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async addRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async removeRelationValue(e,t,r){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(s=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(s)}],r))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],r))}async save(e){if(this._snapshot){await this.innerUpdate(!0,e),e?this.takeSnapshot():await this.getData();return}let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let r=this.constructor.getModelMetadata(),n=Object.values(r.properties).some(s=>s.required||s.flag||s.initial!==void 0),a=[];if(n){let s={};for(let[l,c]of Object.entries(this))if(c!=null&&!(Array.isArray(c)&&c.length>0)&&!c?.action){let u=r.properties[l];if(u?.resolveLanguage&&u.resolveLanguage!=="literal"&&typeof c=="object"){a.push(l);continue}s[l]=c}let o=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(o,this._baseExpression,s,e)}await this.innerUpdate(!n,e);for(let s of a){let o=this[s];o!=null&&await this.setProperty(s,o,e)}t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),r={},n=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of n){let s=this[a];s!=null&&a!=="author"&&a!=="timestamp"&&(r[a]=s)}return r}async innerUpdate(e=!0,t){let r=this.constructor,n=this._snapshot?new Set(this.changedFields()):null,a=r.getModelMetadata(),s=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),o=Object.entries(this);for(let[l,c]of o){if(!s.has(l)||n&&!n.has(l))continue;let u=a.relations[l];if(!(u&&(u.getter||u.target&&u.filter!==!1&&Object.entries(a.relations).some(([y,d])=>y!==l&&d.predicate===u.predicate)))&&c!=null){if(c?.action)switch(c.action){case"setter":await this.setRelationValues(l,c.value,t);break;case"adder":await this.addRelationValue(l,c.value,t);break;case"remover":await this.removeRelationValue(l,c.value,t);break;default:await this.setRelationValues(l,c.value,t);break}else if(Array.isArray(c))await this.setRelationValues(l,c,t);else if(c!=null&&c!==""&&e){if(this.getRelationOptions(l)||this.getPropertyMetadata(l)?.flag)continue;await this.setProperty(l,c,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(n=>n.required||n.flag||n.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let n=new Set;for(let o of Object.values(t.properties))o.predicate&&n.add(o.predicate);for(let o of Object.values(t.relations))o.predicate&&n.add(o.predicate);let s=(await this._perspective.get(new ae({source:this._baseExpression}))).filter(o=>o.data.predicate&&n.has(o.data.predicate));s.length>0&&await this._perspective.removeLinks(s,e)}catch(n){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,n)}try{let n=await this._perspective.get(new ae({target:this._baseExpression}));n.length>0&&await this._perspective.removeLinks(n,e)}catch(n){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,n)}}static async create(e,t={},r){let n=new this(e);if(Object.assign(n,t),r?.parent&&!r?.batchId){let a=await e.createBatch();await n.save(a);let s=hn(r.parent,this),o=new Je({source:r.parent.id,predicate:s,target:n.id});return await e.add(o,"shared",a),await e.commitBatch(a),await n.get(),n}if(await n.save(r?.batchId),r?.parent){let a=hn(r.parent,this),s=new Je({source:r.parent.id,predicate:a,target:n.id});await e.add(s,"shared",r?.batchId)}return n}static async update(e,t,r){let n=new this(e,t);return await n.get(),Object.assign(n,r),await n.save(),n}static async remove(e,t){return this.delete(e,t)}static async delete(e,t){await new this(e,t).delete()}static async register(e){await e.ensureSDNASubjectClass(this)}static async transaction(e,t){let r=await e.createBatch(),n=await t({batchId:r});return await e.commitBatch(r),n}static query(e,t){return new bo(e,this,t)}static fromJSONSchema(e,t){return Ig(this,e,t)}};$r.classNamesByClass=new WeakMap;function No(i){return i.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function Ng(i,e){let t=e.properties,r=Object.values(t).filter(s=>s.flag&&s.predicate&&s.initial);if(r.length>0){let s=r.map(o=>`triple(X, '${o.predicate}', '${o.initial}')`).join(`,
1392
1410
  `);return`${i}(X) :-
1393
1411
  ${s}.`}let n=Object.values(t).filter(s=>s.required&&s.predicate&&!s.flag);if(n.length>0){let s=n.map(o=>`triple(X, '${o.predicate}', _)`).join(`,
1394
1412
  `);return`${i}(X) :-
1395
1413
  ${s}.`}let a=Object.values(t).filter(s=>s.predicate).map(s=>s.predicate);if(e.relations)for(let s of Object.values(e.relations))s.predicate&&a.push(s.predicate);if(a.length>0){let s=a.map(o=>`triple(X, '${o}', _)`).join(` ;
1396
1414
  `);return`${i}(X) :-
1397
- (${s}).`}return null}function gg(i,e){return e.flag||!e.predicate?null:`${`${i}_${Ao(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function mg(i,e){if(!e.predicate)return null;let t=`${i}_${Ao(e.name)}`;return e.direction==="reverse"?`${t}(X, Values) :- findall(V, triple(V, '${e.predicate}', X), Values).`:`${t}(X, Values) :- findall(V, triple(X, '${e.predicate}', V), Values).`}function y0(i){let e=i.getModelMetadata(),t=Ao(e.className),r=[];r.push(`% ${e.className} \u2014 generated Prolog facts`);let n=hg(t,e);n&&(r.push(""),r.push("% Instance recognizer"),r.push(n));let a=Object.values(e.properties).map(o=>gg(t,o)).filter(o=>o!==null);a.length>0&&(r.push(""),r.push("% Field getters"),r.push(...a));let s=Object.values(e.relations).map(o=>mg(t,o)).filter(o=>o!==null);return s.length>0&&(r.push(""),r.push("% Relation getters"),r.push(...s)),r.join(`
1398
- `)}var v0=`
1415
+ (${s}).`}return null}function Og(i,e){return e.flag||!e.predicate?null:`${`${i}_${No(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function Dg(i,e){if(!e.predicate)return null;let t=`${i}_${No(e.name)}`;return e.direction==="reverse"?`${t}(X, Values) :- findall(V, triple(V, '${e.predicate}', X), Values).`:`${t}(X, Values) :- findall(V, triple(X, '${e.predicate}', V), Values).`}function Q0(i){let e=i.getModelMetadata(),t=No(e.className),r=[];r.push(`% ${e.className} \u2014 generated Prolog facts`);let n=Ng(t,e);n&&(r.push(""),r.push("% Instance recognizer"),r.push(n));let a=Object.values(e.properties).map(o=>Og(t,o)).filter(o=>o!==null);a.length>0&&(r.push(""),r.push("% Field getters"),r.push(...a));let s=Object.values(e.relations).map(o=>Dg(t,o)).filter(o=>o!==null);return s.length>0&&(r.push(""),r.push("% Relation getters"),r.push(...s)),r.join(`
1416
+ `)}var G0=`
1399
1417
  type AIModelLoadingStatus {
1400
1418
  downloaded: Boolean!
1401
1419
  loaded: Boolean!
@@ -1538,6 +1556,7 @@ type ExpressionRendered {
1538
1556
 
1539
1557
  type HostingUserInfo {
1540
1558
  email: String!
1559
+ freeAccess: Boolean!
1541
1560
  hotWalletAddress: String
1542
1561
  remainingCredits: String!
1543
1562
  }
@@ -1772,6 +1791,7 @@ type Mutation {
1772
1791
  runtimeLoginUser(email: String!, password: String!): String!
1773
1792
  runtimeOpenLink(url: String!): Boolean!
1774
1793
  runtimeQuit: Boolean!
1794
+ runtimeReinstallUnytDna: PaymentRequestResult!
1775
1795
  runtimeRemoveFriends(dids: [String!]!): [String!]!
1776
1796
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
1777
1797
  runtimeRemoveNotification(id: String!): Boolean!
@@ -1779,9 +1799,13 @@ type Mutation {
1779
1799
  runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
1780
1800
  runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
1781
1801
  runtimeRestartHolochain: Boolean!
1802
+ runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
1782
1803
  runtimeSetHotWalletAddress(address: String!): Boolean!
1783
1804
  runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
1784
1805
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
1806
+ runtimeSetUnytMembraneProof(proof: String!): PaymentRequestResult!
1807
+ runtimeSetUserCredits(amount: Float!, email: String!): Boolean!
1808
+ runtimeSetUserFreeAccess(email: String!, enabled: Boolean!): Boolean!
1785
1809
  runtimeTestEmail(to: String!): Boolean!
1786
1810
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
1787
1811
  runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
@@ -1895,6 +1919,9 @@ type Query {
1895
1919
  runtimeGetNetworkMetrics: String!
1896
1920
  runtimeHcAgentInfos: String!
1897
1921
  runtimeHostingUserInfo: HostingUserInfo!
1922
+ runtimeHotAgentPubkey: String!
1923
+ runtimeHotWalletBalance: String!
1924
+ runtimeHotWalletHistory(page: Float, perPage: Float): String!
1898
1925
  runtimeInfo: RuntimeInfo!
1899
1926
  runtimeKnownLinkLanguageTemplates: [String!]!
1900
1927
  runtimeListUsers: [UserStatistics!]!
@@ -1902,6 +1929,7 @@ type Query {
1902
1929
  runtimeMessageOutbox(filter: String): [SentMessage!]!
1903
1930
  runtimeMultiUserEnabled: Boolean!
1904
1931
  runtimeNotifications: [Notification!]!
1932
+ runtimeUnytVersionInfo: String!
1905
1933
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
1906
1934
  }
1907
1935
 
@@ -1977,8 +2005,11 @@ type UserCreationResult {
1977
2005
  type UserStatistics {
1978
2006
  did: String!
1979
2007
  email: String!
2008
+ freeAccess: Boolean!
2009
+ hotWalletAddress: String
1980
2010
  lastSeen: String
1981
2011
  perspectiveCount: Int!
2012
+ remainingCredits: String!
1982
2013
  }
1983
2014
 
1984
2015
  type VerificationRequestResult {
@@ -1995,10 +2026,10 @@ input VoiceActivityParamsInput {
1995
2026
  startWindow: Float
1996
2027
  timeBeforeSpeech: Float
1997
2028
  }
1998
- `,x=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},g=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)}},Pn=new ti;Pn.author="did:ad4m:test";Pn.timestamp=Date.now();Pn.data={source:"root",target:"neighbourhood://Qm12345"};Pn.proof={signature:"",key:"",valid:!0};var Gt=new Oi;Gt.author="did:ad4m:test";Gt.timestamp=Date.now().toString();Gt.proof=new Ut("","");Gt.data=new kt([Pn]);var Va=class{};x([h(),g("design:type",String)],Va.prototype,"recipient",void 0);x([h(),g("design:type",Oi)],Va.prototype,"message",void 0);Va=x([F()],Va);var Er=class{};x([h(),g("design:type",String)],Er.prototype,"ad4mExecutorVersion",void 0);x([h(),g("design:type",Boolean)],Er.prototype,"isInitialized",void 0);x([h(),g("design:type",Boolean)],Er.prototype,"isUnlocked",void 0);Er=x([F()],Er);var qi=class{};x([h(),g("design:type",String)],qi.prototype,"title",void 0);x([h(),g("design:type",String)],qi.prototype,"message",void 0);x([h(),g("design:type",String)],qi.prototype,"type",void 0);x([h(),g("design:type",String)],qi.prototype,"addon",void 0);qi=x([F()],qi);var ut=class{};x([h(),g("design:type",String)],ut.prototype,"description",void 0);x([h(),g("design:type",String)],ut.prototype,"appName",void 0);x([h(),g("design:type",String)],ut.prototype,"appUrl",void 0);x([h(),g("design:type",String)],ut.prototype,"appIconPath",void 0);x([h(),g("design:type",String)],ut.prototype,"trigger",void 0);x([h(),g("design:type",Array)],ut.prototype,"perspectiveIds",void 0);x([h(),g("design:type",String)],ut.prototype,"webhookUrl",void 0);x([h(),g("design:type",String)],ut.prototype,"webhookAuth",void 0);ut=x([Ae()],ut);var tt=class{};x([h(),g("design:type",String)],tt.prototype,"id",void 0);x([h(),g("design:type",Boolean)],tt.prototype,"granted",void 0);x([h(),g("design:type",String)],tt.prototype,"description",void 0);x([h(),g("design:type",String)],tt.prototype,"appName",void 0);x([h(),g("design:type",String)],tt.prototype,"appUrl",void 0);x([h(),g("design:type",String)],tt.prototype,"appIconPath",void 0);x([h(),g("design:type",String)],tt.prototype,"trigger",void 0);x([h(),g("design:type",Array)],tt.prototype,"perspectiveIds",void 0);x([h(),g("design:type",String)],tt.prototype,"webhookUrl",void 0);x([h(),g("design:type",String)],tt.prototype,"webhookAuth",void 0);tt=x([F()],tt);var xr=class{};x([h(),g("design:type",tt)],xr.prototype,"notification",void 0);x([h(),g("design:type",String)],xr.prototype,"perspectiveId",void 0);x([h(),g("design:type",String)],xr.prototype,"triggerMatch",void 0);xr=x([F()],xr);var $e=class{};x([h(),g("design:type",Number)],$e.prototype,"total",void 0);x([h(),g("design:type",Number)],$e.prototype,"imported",void 0);x([h(),g("design:type",Number)],$e.prototype,"failed",void 0);x([h(),g("design:type",Number)],$e.prototype,"omitted",void 0);x([h(),g("design:type",Array)],$e.prototype,"errors",void 0);$e=x([F()],$e);var it=class{};x([h(),g("design:type",$e)],it.prototype,"perspectives",void 0);x([h(),g("design:type",$e)],it.prototype,"links",void 0);x([h(),g("design:type",$e)],it.prototype,"expressions",void 0);x([h(),g("design:type",$e)],it.prototype,"perspectiveDiffs",void 0);x([h(),g("design:type",$e)],it.prototype,"notifications",void 0);x([h(),g("design:type",$e)],it.prototype,"models",void 0);x([h(),g("design:type",$e)],it.prototype,"defaultModels",void 0);x([h(),g("design:type",$e)],it.prototype,"tasks",void 0);x([h(),g("design:type",$e)],it.prototype,"friends",void 0);x([h(),g("design:type",$e)],it.prototype,"trustedAgents",void 0);x([h(),g("design:type",$e)],it.prototype,"knownLinkLanguages",void 0);it=x([F()],it);var $r=class{};x([h(),g("design:type",String)],$r.prototype,"email",void 0);x([h(),g("design:type",String)],$r.prototype,"did",void 0);x([h(),g("design:type",String)],$r.prototype,"lastSeen",void 0);x([h(),g("design:type",Number)],$r.prototype,"perspectiveCount",void 0);$r=x([F()],$r);var Hi=class{};x([h(),g("design:type",Boolean)],Hi.prototype,"success",void 0);x([h(),g("design:type",String)],Hi.prototype,"message",void 0);x([h(),g("design:type",Boolean)],Hi.prototype,"requiresPassword",void 0);x([h(),g("design:type",Boolean)],Hi.prototype,"isExistingUser",void 0);Hi=x([F()],Hi);var Vi=class{constructor(e,t,r){this.email=e,this.remainingCredits=t,this.hotWalletAddress=r}};x([h(),g("design:type",String)],Vi.prototype,"email",void 0);x([h(),g("design:type",String)],Vi.prototype,"remainingCredits",void 0);x([h(),g("design:type",String)],Vi.prototype,"hotWalletAddress",void 0);Vi=x([F(),g("design:paramtypes",[String,String,String])],Vi);var Ar=class{constructor(e,t){this.success=e,this.message=t}};x([h(),g("design:type",Boolean)],Ar.prototype,"success",void 0);x([h(),g("design:type",String)],Ar.prototype,"message",void 0);Ar=x([F(),g("design:paramtypes",[Boolean,String])],Ar);var D=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 Gt}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Gt]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Gt}]}runtimeMessageReceived(){return Gt}exceptionOccurred(){return{title:"Test title",message:"Test message",type:oo.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 Di("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}runtimeHostingUserInfo(){return new Vi("test@example.com","100000000",null)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new Ar(!0,"Mock payment of "+e+" base units credited")}};x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeQuit",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeOpenLink",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Er)],D.prototype,"runtimeInfo",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"addTrustedAgents",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"deleteTrustedAgents",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"getTrustedAgents",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeKnownLinkLanguageTemplates",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeAddKnownLinkLanguageTemplates",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeFriends",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeAddFriends",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],D.prototype,"runtimeRemoveFriends",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],D.prototype,"runtimeHcAgentInfos",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],D.prototype,"runtimeGetNetworkMetrics",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeRestartHolochain",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Object]),g("design:returntype",Boolean)],D.prototype,"runtimeHcAddAgentInfos",null);x([Ge(),H(0,q()),H(1,q()),H(2,q()),H(3,q()),g("design:type",Function),g("design:paramtypes",[String,String,String,String]),g("design:returntype",void 0)],D.prototype,"runtimeVerifyStringSignedByDid",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[kt]),g("design:returntype",Boolean)],D.prototype,"runtimeSetStatus",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Oi)],D.prototype,"runtimeFriendStatus",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,Ia]),g("design:returntype",Boolean)],D.prototype,"runtimeFriendSendMessage",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],D.prototype,"runtimeMessageInbox",null);x([Ge(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],D.prototype,"runtimeMessageOutbox",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Oi)],D.prototype,"runtimeMessageReceived",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",qi)],D.prototype,"exceptionOccurred",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[ut]),g("design:returntype",String)],D.prototype,"runtimeRequestInstallNotification",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeNotifications",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,ut]),g("design:returntype",Boolean)],D.prototype,"runtimeUpdateNotification",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeRemoveNotification",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeGrantNotification",null);x([po(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",xr)],D.prototype,"runtimeNotificationTriggered",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeExportDb",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeImportDb",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Boolean)],D.prototype,"runtimeExportPerspective",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeImportPerspective",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeMultiUserEnabled",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[Boolean]),g("design:returntype",Boolean)],D.prototype,"runtimeSetMultiUserEnabled",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],D.prototype,"runtimeListUsers",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,It]),g("design:returntype",Hi)],D.prototype,"runtimeRequestLoginVerification",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,String]),g("design:returntype",String)],D.prototype,"runtimeVerifyEmailCode",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeTestEmail",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,It]),g("design:returntype",Di)],D.prototype,"runtimeCreateUser",null);x([te(),H(0,q()),H(1,q()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",String)],D.prototype,"runtimeLoginUser",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeEnable",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestModeDisable",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",String)],D.prototype,"runtimeEmailTestGetCode",null);x([te(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestClearCodes",null);x([te(),H(0,q()),H(1,q()),H(2,q()),g("design:type",Function),g("design:paramtypes",[String,String,Number]),g("design:returntype",Boolean)],D.prototype,"runtimeEmailTestSetExpiry",null);x([Ge(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Vi)],D.prototype,"runtimeHostingUserInfo",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],D.prototype,"runtimeSetHotWalletAddress",null);x([te(),H(0,q()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Ar)],D.prototype,"runtimeRequestPayment",null);D=x([Rd()],D);var ht=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 N`
2029
+ `,S=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)},j=function(i,e){return function(t,r){e(t,r,i)}},Fn=new si;Fn.author="did:ad4m:test";Fn.timestamp=Date.now();Fn.data={source:"root",target:"neighbourhood://Qm12345"};Fn.proof={signature:"",key:"",valid:!0};var ei=new Bi;ei.author="did:ad4m:test";ei.timestamp=Date.now().toString();ei.proof=new Ht("","");ei.data=new Pt([Fn]);var Za=class{};S([h(),p("design:type",String)],Za.prototype,"recipient",void 0);S([h(),p("design:type",Bi)],Za.prototype,"message",void 0);Za=S([H()],Za);var Ar=class{};S([h(),p("design:type",String)],Ar.prototype,"ad4mExecutorVersion",void 0);S([h(),p("design:type",Boolean)],Ar.prototype,"isInitialized",void 0);S([h(),p("design:type",Boolean)],Ar.prototype,"isUnlocked",void 0);Ar=S([H()],Ar);var Qi=class{};S([h(),p("design:type",String)],Qi.prototype,"title",void 0);S([h(),p("design:type",String)],Qi.prototype,"message",void 0);S([h(),p("design:type",String)],Qi.prototype,"type",void 0);S([h(),p("design:type",String)],Qi.prototype,"addon",void 0);Qi=S([H()],Qi);var ft=class{};S([h(),p("design:type",String)],ft.prototype,"description",void 0);S([h(),p("design:type",String)],ft.prototype,"appName",void 0);S([h(),p("design:type",String)],ft.prototype,"appUrl",void 0);S([h(),p("design:type",String)],ft.prototype,"appIconPath",void 0);S([h(),p("design:type",String)],ft.prototype,"trigger",void 0);S([h(),p("design:type",Array)],ft.prototype,"perspectiveIds",void 0);S([h(),p("design:type",String)],ft.prototype,"webhookUrl",void 0);S([h(),p("design:type",String)],ft.prototype,"webhookAuth",void 0);ft=S([Te()],ft);var nt=class{};S([h(),p("design:type",String)],nt.prototype,"id",void 0);S([h(),p("design:type",Boolean)],nt.prototype,"granted",void 0);S([h(),p("design:type",String)],nt.prototype,"description",void 0);S([h(),p("design:type",String)],nt.prototype,"appName",void 0);S([h(),p("design:type",String)],nt.prototype,"appUrl",void 0);S([h(),p("design:type",String)],nt.prototype,"appIconPath",void 0);S([h(),p("design:type",String)],nt.prototype,"trigger",void 0);S([h(),p("design:type",Array)],nt.prototype,"perspectiveIds",void 0);S([h(),p("design:type",String)],nt.prototype,"webhookUrl",void 0);S([h(),p("design:type",String)],nt.prototype,"webhookAuth",void 0);nt=S([H()],nt);var kr=class{};S([h(),p("design:type",nt)],kr.prototype,"notification",void 0);S([h(),p("design:type",String)],kr.prototype,"perspectiveId",void 0);S([h(),p("design:type",String)],kr.prototype,"triggerMatch",void 0);kr=S([H()],kr);var Ie=class{};S([h(),p("design:type",Number)],Ie.prototype,"total",void 0);S([h(),p("design:type",Number)],Ie.prototype,"imported",void 0);S([h(),p("design:type",Number)],Ie.prototype,"failed",void 0);S([h(),p("design:type",Number)],Ie.prototype,"omitted",void 0);S([h(),p("design:type",Array)],Ie.prototype,"errors",void 0);Ie=S([H()],Ie);var at=class{};S([h(),p("design:type",Ie)],at.prototype,"perspectives",void 0);S([h(),p("design:type",Ie)],at.prototype,"links",void 0);S([h(),p("design:type",Ie)],at.prototype,"expressions",void 0);S([h(),p("design:type",Ie)],at.prototype,"perspectiveDiffs",void 0);S([h(),p("design:type",Ie)],at.prototype,"notifications",void 0);S([h(),p("design:type",Ie)],at.prototype,"models",void 0);S([h(),p("design:type",Ie)],at.prototype,"defaultModels",void 0);S([h(),p("design:type",Ie)],at.prototype,"tasks",void 0);S([h(),p("design:type",Ie)],at.prototype,"friends",void 0);S([h(),p("design:type",Ie)],at.prototype,"trustedAgents",void 0);S([h(),p("design:type",Ie)],at.prototype,"knownLinkLanguages",void 0);at=S([H()],at);var Vt=class{};S([h(),p("design:type",String)],Vt.prototype,"email",void 0);S([h(),p("design:type",String)],Vt.prototype,"did",void 0);S([h(),p("design:type",String)],Vt.prototype,"lastSeen",void 0);S([h(),p("design:type",Number)],Vt.prototype,"perspectiveCount",void 0);S([h(),p("design:type",String)],Vt.prototype,"remainingCredits",void 0);S([h(),p("design:type",Boolean)],Vt.prototype,"freeAccess",void 0);S([h(),p("design:type",String)],Vt.prototype,"hotWalletAddress",void 0);Vt=S([H()],Vt);var Gi=class{};S([h(),p("design:type",Boolean)],Gi.prototype,"success",void 0);S([h(),p("design:type",String)],Gi.prototype,"message",void 0);S([h(),p("design:type",Boolean)],Gi.prototype,"requiresPassword",void 0);S([h(),p("design:type",Boolean)],Gi.prototype,"isExistingUser",void 0);Gi=S([H()],Gi);var pi=class{constructor(e,t,r,n=!1){this.email=e,this.remainingCredits=t,this.hotWalletAddress=r,this.freeAccess=n}};S([h(),p("design:type",String)],pi.prototype,"email",void 0);S([h(),p("design:type",String)],pi.prototype,"remainingCredits",void 0);S([h(),p("design:type",String)],pi.prototype,"hotWalletAddress",void 0);S([h(),p("design:type",Boolean)],pi.prototype,"freeAccess",void 0);pi=S([H(),p("design:paramtypes",[String,String,String,Boolean])],pi);var dt=class{constructor(e,t){this.success=e,this.message=t}};S([h(),p("design:type",Boolean)],dt.prototype,"success",void 0);S([h(),p("design:type",String)],dt.prototype,"message",void 0);dt=S([H(),p("design:paramtypes",[Boolean,String])],dt);var O=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 ei}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[ei]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:ei}]}runtimeMessageReceived(){return ei}exceptionOccurred(){return{title:"Test title",message:"Test message",type:mo.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,remainingCredits:"0",freeAccess:!1}]}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 qi("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}runtimeHostingUserInfo(){return new pi("test@example.com","100000000",null,!1)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new dt(!0,"Mock payment of "+e+" base units credited")}runtimeSetUserCredits(e,t){return!0}runtimeSetUserFreeAccess(e,t){return!0}runtimeReinstallUnytDna(){return new dt(!0,"")}runtimeSendHot(e,t){return new dt(!0,"")}runtimeSetUnytMembraneProof(e){return new dt(!0,"")}runtimeHotWalletBalance(){return""}runtimeHotWalletHistory(e,t){return""}runtimeHotAgentPubkey(){return""}runtimeUnytVersionInfo(){return""}};S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeQuit",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeOpenLink",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Ar)],O.prototype,"runtimeInfo",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"addTrustedAgents",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"deleteTrustedAgents",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"getTrustedAgents",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeKnownLinkLanguageTemplates",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeAddKnownLinkLanguageTemplates",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeFriends",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeAddFriends",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Array]),p("design:returntype",Array)],O.prototype,"runtimeRemoveFriends",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHcAgentInfos",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeGetNetworkMetrics",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeRestartHolochain",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Object]),p("design:returntype",Boolean)],O.prototype,"runtimeHcAddAgentInfos",null);S([Ce(),j(0,F()),j(1,F()),j(2,F()),j(3,F()),p("design:type",Function),p("design:paramtypes",[String,String,String,String]),p("design:returntype",void 0)],O.prototype,"runtimeVerifyStringSignedByDid",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Pt]),p("design:returntype",Boolean)],O.prototype,"runtimeSetStatus",null);S([Ce(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Bi)],O.prototype,"runtimeFriendStatus",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,Na]),p("design:returntype",Boolean)],O.prototype,"runtimeFriendSendMessage",null);S([Ce(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Array)],O.prototype,"runtimeMessageInbox",null);S([Ce(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Array)],O.prototype,"runtimeMessageOutbox",null);S([wo(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Bi)],O.prototype,"runtimeMessageReceived",null);S([wo(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Qi)],O.prototype,"exceptionOccurred",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[ft]),p("design:returntype",String)],O.prototype,"runtimeRequestInstallNotification",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeNotifications",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,ft]),p("design:returntype",Boolean)],O.prototype,"runtimeUpdateNotification",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeRemoveNotification",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeGrantNotification",null);S([wo(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",kr)],O.prototype,"runtimeNotificationTriggered",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeExportDb",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeImportDb",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",Boolean)],O.prototype,"runtimeExportPerspective",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeImportPerspective",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeMultiUserEnabled",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[Boolean]),p("design:returntype",Boolean)],O.prototype,"runtimeSetMultiUserEnabled",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Array)],O.prototype,"runtimeListUsers",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,Rt]),p("design:returntype",Gi)],O.prototype,"runtimeRequestLoginVerification",null);S([J(),j(0,F()),j(1,F()),j(2,F()),p("design:type",Function),p("design:paramtypes",[String,String,String]),p("design:returntype",String)],O.prototype,"runtimeVerifyEmailCode",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeTestEmail",null);S([J(),j(0,F()),j(1,F()),j(2,F()),p("design:type",Function),p("design:paramtypes",[String,String,Rt]),p("design:returntype",qi)],O.prototype,"runtimeCreateUser",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",String)],O.prototype,"runtimeLoginUser",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestModeEnable",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestModeDisable",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",String)],O.prototype,"runtimeEmailTestGetCode",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestClearCodes",null);S([J(),j(0,F()),j(1,F()),j(2,F()),p("design:type",Function),p("design:paramtypes",[String,String,Number]),p("design:returntype",Boolean)],O.prototype,"runtimeEmailTestSetExpiry",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",pi)],O.prototype,"runtimeHostingUserInfo",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",Boolean)],O.prototype,"runtimeSetHotWalletAddress",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",dt)],O.prototype,"runtimeRequestPayment",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,Number]),p("design:returntype",Boolean)],O.prototype,"runtimeSetUserCredits",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,Boolean]),p("design:returntype",Boolean)],O.prototype,"runtimeSetUserFreeAccess",null);S([J(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",dt)],O.prototype,"runtimeReinstallUnytDna",null);S([J(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[String,String]),p("design:returntype",dt)],O.prototype,"runtimeSendHot",null);S([J(),j(0,F()),p("design:type",Function),p("design:paramtypes",[String]),p("design:returntype",dt)],O.prototype,"runtimeSetUnytMembraneProof",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHotWalletBalance",null);S([Ce(),j(0,F()),j(1,F()),p("design:type",Function),p("design:paramtypes",[Number,Number]),p("design:returntype",String)],O.prototype,"runtimeHotWalletHistory",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeHotAgentPubkey",null);S([Ce(),p("design:type",Function),p("design:paramtypes",[]),p("design:returntype",String)],O.prototype,"runtimeUnytVersionInfo",null);O=S([Xd()],O);var bt=class extends ge{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 I`
1999
2030
  <div class="container">
2000
2031
  <div class="back-button" @click=${this.back}>
2001
- ${nr()}
2032
+ ${wt()}
2002
2033
  </div>
2003
2034
 
2004
2035
  <div class="header">
@@ -2007,14 +2038,14 @@ input VoiceActivityParamsInput {
2007
2038
  </div>
2008
2039
 
2009
2040
  <div class="connection-icons">
2010
- ${this.appiconpath?N`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:N`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
2011
- <div class="arrow-icon">${zn()}</div>
2012
- <div class="ad4m-logo">${mi()}</div>
2041
+ ${this.appiconpath?I`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:I`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
2042
+ <div class="arrow-icon">${Gn()}</div>
2043
+ <div class="ad4m-logo">${_i()}</div>
2013
2044
  </div>
2014
2045
 
2015
- ${this.requestSent?N`
2046
+ ${this.requestSent?I`
2016
2047
  <div class="state success" style="margin-bottom: -12px">
2017
- ${dt()}
2048
+ ${mt()}
2018
2049
  <p>Auth request sent to local AD4M node</p>
2019
2050
  </div>
2020
2051
 
@@ -2032,17 +2063,17 @@ input VoiceActivityParamsInput {
2032
2063
  />
2033
2064
  </div>
2034
2065
 
2035
- ${this.verificationError?N`
2066
+ ${this.verificationError?I`
2036
2067
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2037
- ${Oe()}
2068
+ ${Ue()}
2038
2069
  <p>Verification failed. Please try again.</p>
2039
2070
  </div>
2040
2071
  `:""}
2041
- `:N`
2072
+ `:I`
2042
2073
  <p>This will allow ${this.appname} to</p>
2043
2074
 
2044
2075
  <ul class="box">
2045
- ${this.capabilities.map(t=>N`<li>${dt()}<p>${Nl(t)}</p></li>`)}
2076
+ ${this.capabilities.map(t=>I`<li>${mt()}<p>${Kl(t)}</p></li>`)}
2046
2077
  </ul>
2047
2078
 
2048
2079
  <div class="row center">
@@ -2052,7 +2083,7 @@ input VoiceActivityParamsInput {
2052
2083
  </div>
2053
2084
  `}
2054
2085
  </div>
2055
- `}};ht.styles=[Bt,Je`
2086
+ `}};bt.styles=[Ke,Ee`
2056
2087
  h1 {
2057
2088
  font-size: 34px;
2058
2089
  }
@@ -2134,18 +2165,19 @@ input VoiceActivityParamsInput {
2134
2165
  .state {
2135
2166
  justify-content: center;
2136
2167
  }
2137
- `],j([fe({type:Array})],ht.prototype,"capabilities",2),j([fe({type:String})],ht.prototype,"appname",2),j([fe({type:String})],ht.prototype,"appiconpath",2),j([fe({type:Boolean})],ht.prototype,"verificationError",2),j([ue()],ht.prototype,"requestSent",2),j([ue()],ht.prototype,"securityCode",2),ht=j([gt("local-authentication")],ht);var nt=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 N`
2168
+ `],L([ie({type:Array})],bt.prototype,"capabilities",2),L([ie({type:String})],bt.prototype,"appname",2),L([ie({type:String})],bt.prototype,"appiconpath",2),L([ie({type:Boolean})],bt.prototype,"verificationError",2),L([Y()],bt.prototype,"requestSent",2),L([Y()],bt.prototype,"securityCode",2),bt=L([Ne("local-authentication")],bt);var Ve=class extends ge{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.host=null;this.email="";this.password="";this.emailSecurityCode="";this.confirmPassword=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.confirmPassword="",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()}get passwordsMatch(){return this.password.length>0&&this.password===this.confirmPassword}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 I`
2138
2169
  <div class="container">
2139
2170
  <div class="back-button" @click=${this.back}>
2140
- ${nr()}
2171
+ ${wt()}
2141
2172
  </div>
2142
2173
 
2143
2174
  <div class="header">
2144
- <h1>Login</h1>
2175
+ <h1>Login or Register</h1>
2176
+ ${this.host?I`<p style="font-size: 13px; color: rgba(255,255,255,0.4); margin-top: 4px;">${this.host.url}</p>`:""}
2145
2177
  </div>
2146
2178
 
2147
- ${t?N`
2148
- <h3>Enter your email to login to the remote node</h3>
2179
+ ${t?I`
2180
+ <h3>Enter your email to login to ${this.host?I`<strong>${this.host.name}</strong>`:"the remote node"}</h3>
2149
2181
 
2150
2182
  <div class="input-row">
2151
2183
  <input
@@ -2164,9 +2196,9 @@ input VoiceActivityParamsInput {
2164
2196
  </div>
2165
2197
  `:""}
2166
2198
 
2167
- ${s?N`
2199
+ ${s?I`
2168
2200
  <div class="state danger">
2169
- ${Oe()}
2201
+ ${Ue()}
2170
2202
  <p>${this.remoteAuthState.message||"Failed to process email. Please try again."}</p>
2171
2203
  </div>
2172
2204
 
@@ -2177,9 +2209,9 @@ input VoiceActivityParamsInput {
2177
2209
  </div>
2178
2210
  `:""}
2179
2211
 
2180
- ${r?N`
2212
+ ${r?I`
2181
2213
  <div class="state success" style="margin-bottom: -12px">
2182
- ${dt()}
2214
+ ${mt()}
2183
2215
  <p>Email verification code sent</p>
2184
2216
  </div>
2185
2217
 
@@ -2197,17 +2229,17 @@ input VoiceActivityParamsInput {
2197
2229
  />
2198
2230
  </div>
2199
2231
 
2200
- ${this.emailCodeError?N`
2232
+ ${this.emailCodeError?I`
2201
2233
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2202
- ${Oe()}
2234
+ ${Ue()}
2203
2235
  <p>Verification failed. Please try again.</p>
2204
2236
  </div>
2205
2237
  `:""}
2206
2238
  `:""}
2207
2239
 
2208
- ${n?N`
2240
+ ${n?I`
2209
2241
  <div class="state success" style="margin-bottom: -12px">
2210
- ${dt()}
2242
+ ${mt()}
2211
2243
  <p>Account found</p>
2212
2244
  </div>
2213
2245
 
@@ -2229,21 +2261,21 @@ input VoiceActivityParamsInput {
2229
2261
  </button>
2230
2262
  </div>
2231
2263
 
2232
- ${this.passwordError?N`
2264
+ ${this.passwordError?I`
2233
2265
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2234
- ${Oe()}
2266
+ ${Ue()}
2235
2267
  <p>Incorrect password. Please try again.</p>
2236
2268
  </div>
2237
2269
  `:""}
2238
2270
  `:""}
2239
2271
 
2240
- ${a?N`
2241
- <div class="state danger">
2242
- ${Oe()}
2243
- <p>Email not found</p>
2272
+ ${a?I`
2273
+ <div class="state success">
2274
+ ${mt()}
2275
+ <p>Creating a new account for <strong>${this.email}</strong></p>
2244
2276
  </div>
2245
2277
 
2246
- <h3>Enter a password to create a new account</h3>
2278
+ <h3>Choose a password</h3>
2247
2279
 
2248
2280
  <div class="input-row">
2249
2281
  <input
@@ -2251,26 +2283,37 @@ input VoiceActivityParamsInput {
2251
2283
  placeholder="Password..."
2252
2284
  .value=${this.password||""}
2253
2285
  @input=${o=>{let l=o.target;this.password=l.value}}
2254
- @keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.password.length&&this.createAccount()}}
2255
2286
  />
2256
2287
  </div>
2257
2288
 
2289
+ <div class="input-row" style="margin-top: 8px;">
2290
+ <input
2291
+ type="password"
2292
+ placeholder="Confirm password..."
2293
+ .value=${this.confirmPassword||""}
2294
+ @input=${o=>{let l=o.target;this.confirmPassword=l.value}}
2295
+ @keydown=${o=>{o.key==="Enter"&&!this.remoteAuthLoading&&this.passwordsMatch&&this.createAccount()}}
2296
+ />
2297
+ </div>
2298
+
2299
+ ${this.confirmPassword.length>0&&!this.passwordsMatch?I`<p style="font-size: 13px; color: var(--ac-danger-color); text-align: center;">Passwords do not match</p>`:""}
2300
+
2258
2301
  <div class="login-button">
2259
- <button class="primary" @click=${this.createAccount} .disabled=${this.remoteAuthLoading||!this.password.length}>
2302
+ <button class="primary" @click=${this.createAccount} .disabled=${this.remoteAuthLoading||!this.passwordsMatch}>
2260
2303
  ${this.remoteAuthLoading?"Loading...":"Create Account"}
2261
2304
  </button>
2262
2305
  </div>
2263
2306
 
2264
- ${this.accountCreationError?N`
2307
+ ${this.accountCreationError?I`
2265
2308
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2266
- ${Oe()}
2309
+ ${Ue()}
2267
2310
  <p>Failed to create account. Please try again.</p>
2268
2311
  </div>
2269
2312
  `:""}
2270
2313
  `:""}
2271
2314
 
2272
2315
  </div>
2273
- `}};nt.styles=[Bt,Je`
2316
+ `}};Ve.styles=[Ke,Ee`
2274
2317
  .header h1 {
2275
2318
  font-size: 32px;
2276
2319
  margin-bottom: 0;
@@ -2316,10 +2359,10 @@ input VoiceActivityParamsInput {
2316
2359
  .state {
2317
2360
  justify-content: center;
2318
2361
  }
2319
- `],j([fe({type:Object})],nt.prototype,"remoteAuthState",2),j([fe({type:Boolean})],nt.prototype,"remoteAuthLoading",2),j([fe({type:Boolean})],nt.prototype,"emailCodeError",2),j([fe({type:Boolean})],nt.prototype,"passwordError",2),j([fe({type:Boolean})],nt.prototype,"accountCreationError",2),j([ue()],nt.prototype,"email",2),j([ue()],nt.prototype,"password",2),j([ue()],nt.prototype,"emailSecurityCode",2),nt=j([gt("remote-authentication")],nt);var li=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 N`
2362
+ `],L([ie({type:Object})],Ve.prototype,"remoteAuthState",2),L([ie({type:Boolean})],Ve.prototype,"remoteAuthLoading",2),L([ie({type:Boolean})],Ve.prototype,"emailCodeError",2),L([ie({type:Boolean})],Ve.prototype,"passwordError",2),L([ie({type:Boolean})],Ve.prototype,"accountCreationError",2),L([ie({type:Object})],Ve.prototype,"host",2),L([Y()],Ve.prototype,"email",2),L([Y()],Ve.prototype,"password",2),L([Y()],Ve.prototype,"emailSecurityCode",2),L([Y()],Ve.prototype,"confirmPassword",2),Ve=L([Ne("remote-authentication")],Ve);var gi=class extends ge{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 I`
2320
2363
  <div class="container">
2321
2364
  <div class="close-button" @click=${this.close}>
2322
- ${Oe()}
2365
+ ${Ue()}
2323
2366
  </div>
2324
2367
 
2325
2368
  <div class="header">
@@ -2329,11 +2372,11 @@ input VoiceActivityParamsInput {
2329
2372
 
2330
2373
  <div class="box">
2331
2374
  <div class="box-header">
2332
- ${t?ir():rr()}
2375
+ ${t?or():Wn()}
2333
2376
  <h3>${t?"Local Node":"Remote Node"}</h3>
2334
2377
  </div>
2335
2378
 
2336
- ${t?N`
2379
+ ${t?I`
2337
2380
  <div class="row">
2338
2381
  <span>Port:</span>
2339
2382
  <span class="detail-value">${this.port}</span>
@@ -2342,7 +2385,7 @@ input VoiceActivityParamsInput {
2342
2385
  <span>URL:</span>
2343
2386
  <span class="detail-value">${this.url}</span>
2344
2387
  </div>
2345
- `:N`
2388
+ `:I`
2346
2389
  <div class="row">
2347
2390
  <span>URL:</span>
2348
2391
  <span class="detail-value">${this.url}</span>
@@ -2361,7 +2404,7 @@ input VoiceActivityParamsInput {
2361
2404
  </button>
2362
2405
  </div>
2363
2406
  </div>
2364
- `}};li.styles=[Bt,Je`
2407
+ `}};gi.styles=[Ke,Ee`
2365
2408
  .box {
2366
2409
  gap: 15px;
2367
2410
  }
@@ -2396,10 +2439,701 @@ input VoiceActivityParamsInput {
2396
2439
  background: rgba(244, 54, 127, 0.2);
2397
2440
  color: var(--ac-danger-color);
2398
2441
  }
2399
- `],j([fe({type:String})],li.prototype,"url",2),j([fe({type:Number})],li.prototype,"port",2),j([fe({type:String})],li.prototype,"authState",2),li=j([gt("current-state")],li);var yg=Je`
2442
+ `],L([ie({type:String})],gi.prototype,"url",2),L([ie({type:Number})],gi.prototype,"port",2),L([ie({type:String})],gi.prototype,"authState",2),gi=L([Ne("current-state")],gi);function os(i,e){let t=cc(i.id||i.name),r=oc(i.name);if(i.profilePicUrl){let n=a=>{let s=a.target,o=document.createElement("div");o.className=`${e} fallback`,o.style.background=`hsl(${t},60%,35%)`,o.textContent=r,s.replaceWith(o)};return I`<img class=${e} src=${i.profilePicUrl} alt="" @error=${n} />`}return I`<div class="${e} fallback" style="background:hsl(${t},60%,35%)">${r}</div>`}var ht=class extends ge{constructor(){super(...arguments);this.hosts=[];this.loading=!1;this.error=null;this.lastHostId=null;this.defaultUrl="";this.manualUrl="";this.manualUrlError=null;this.defaultApplied=!1}willUpdate(t){t.has("defaultUrl")&&this.defaultUrl&&!this.defaultApplied&&(this.manualUrl=this.defaultUrl,this.defaultApplied=!0)}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0}))}selectHost(t){this.dispatchEvent(new CustomEvent("select-host",{detail:{host:t},bubbles:!0,composed:!0}))}connectManualUrl(){let t=this.manualUrl.trim();if(!t)return;let r;try{r=new URL(t)}catch(a){this.manualUrlError="Invalid URL format";return}if(r.protocol!=="ws:"&&r.protocol!=="wss:"){this.manualUrlError="URL must use ws:// or wss:// protocol";return}this.manualUrlError=null;let n={id:`manual-${Date.now()}`,name:r.hostname,profilePicUrl:"",location:"Custom URL",url:t,rates:[],aiModels:[]};this.selectHost(n)}renderAvatar(t){return os(t,"host-avatar")}retry(){this.dispatchEvent(new CustomEvent("retry",{bubbles:!0,composed:!0}))}formatPrice(t){return t>=.01?t.toFixed(2):t>=1e-4?t.toFixed(4):t>=1e-6?t.toFixed(6):t.toExponential(2)}getLinkPrice(t){let r=t.find(n=>n.description==="link write");return r?r.priceInHOT:null}getAvgTokenPrice(t){let r=t.filter(n=>n.description.endsWith("per token"));return r.length===0?null:r.reduce((n,a)=>n+a.priceInHOT,0)/r.length}getSortedHosts(){if(!this.lastHostId)return this.hosts;let t=this.hosts.filter(n=>n.id===this.lastHostId),r=this.hosts.filter(n=>n.id!==this.lastHostId);return[...t,...r]}render(){return I`
2443
+ <div class="container">
2444
+ <button class="back-button" @click=${this.back} aria-label="Go back">
2445
+ ${wt()}
2446
+ </button>
2447
+
2448
+ <div class="header">
2449
+ <h1>Remote Node</h1>
2450
+ <h3>Choose a host or enter a URL</h3>
2451
+ </div>
2452
+
2453
+ ${this.loading?I`
2454
+ <div class="spinner"></div>
2455
+ `:this.error?I`
2456
+ <div class="box">
2457
+ <p style="color: var(--ac-danger-color)">${this.error}</p>
2458
+ <button class="primary" @click=${this.retry}>Retry</button>
2459
+ </div>
2460
+ `:I`
2461
+ <div class="host-list">
2462
+ ${this.getSortedHosts().map(t=>I`
2463
+ <div
2464
+ class="host-card ${t.id===this.lastHostId?"pinned":""}"
2465
+ tabindex="0"
2466
+ role="button"
2467
+ aria-label="Connect to ${t.name}"
2468
+ @click=${()=>this.selectHost(t)}
2469
+ @keydown=${r=>{(r.key==="Enter"||r.key===" ")&&(r.preventDefault(),this.selectHost(t))}}
2470
+ >
2471
+ ${this.renderAvatar(t)}
2472
+ <div class="host-info">
2473
+ <div style="display:flex;align-items:center;gap:8px;">
2474
+ <p class="host-name">${t.name}</p>
2475
+ ${t.id===this.lastHostId?I`<span class="pinned-label">Last used</span>`:""}
2476
+ </div>
2477
+ <p class="host-location">${t.location}</p>
2478
+ <div class="host-meta">
2479
+ ${t.aiModels.map(r=>I`<span class="model-chip">${r}</span>`)}
2480
+ </div>
2481
+ ${t.rates.length>0?I`
2482
+ <p class="rates-preview">
2483
+ ${this.getLinkPrice(t.rates)!=null?I`Link: ${this.formatPrice(this.getLinkPrice(t.rates))} HOT`:""}${this.getLinkPrice(t.rates)!=null&&this.getAvgTokenPrice(t.rates)!=null?" \xB7 ":""}${this.getAvgTokenPrice(t.rates)!=null?I`Token: ~${this.formatPrice(this.getAvgTokenPrice(t.rates))} HOT`:""}
2484
+ </p>
2485
+ `:""}
2486
+ </div>
2487
+ </div>
2488
+ `)}
2489
+ </div>
2490
+ `}
2491
+
2492
+ <div class="divider"><span>or enter URL directly</span></div>
2493
+
2494
+ <div class="manual-entry">
2495
+ <input
2496
+ type="text"
2497
+ placeholder="wss://your-host.example/graphql"
2498
+ .value=${this.manualUrl}
2499
+ @input=${t=>{this.manualUrl=t.target.value,this.manualUrlError=null}}
2500
+ @keydown=${t=>{t.key==="Enter"&&this.connectManualUrl()}}
2501
+ style="font-size: 14px;"
2502
+ />
2503
+ <button
2504
+ class="primary"
2505
+ ?disabled=${!this.manualUrl.trim()}
2506
+ @click=${this.connectManualUrl}
2507
+ >
2508
+ Connect
2509
+ </button>
2510
+ </div>
2511
+ ${this.manualUrlError?I`<p class="state danger" style="margin-top: 6px; font-size: 13px;">${this.manualUrlError}</p>`:""}
2512
+ </div>
2513
+ `}};ht.styles=[Ke,Ee`
2514
+ :host {
2515
+ display: flex;
2516
+ flex-direction: column;
2517
+ min-height: 0;
2518
+ flex: 1 1 auto;
2519
+ }
2520
+
2521
+ .container {
2522
+ flex: 1 1 auto;
2523
+ min-height: 0;
2524
+ overflow: hidden;
2525
+ }
2526
+
2527
+ .host-list {
2528
+ display: flex;
2529
+ flex-direction: column;
2530
+ gap: 12px;
2531
+ max-height: min(500px, calc(100vh - 380px));
2532
+ overflow-y: auto;
2533
+ padding: 2px;
2534
+ }
2535
+
2536
+ .host-card {
2537
+ display: flex;
2538
+ align-items: center;
2539
+ gap: 12px;
2540
+ padding: 14px;
2541
+ border-radius: 8px;
2542
+ background: rgba(128, 178, 201, 0.10);
2543
+ box-shadow: 0 0 0 1px var(--ac-border-color-light);
2544
+ cursor: pointer;
2545
+ transition: all 0.2s ease;
2546
+ }
2547
+
2548
+ .host-card:hover,
2549
+ .host-card:focus-visible {
2550
+ background: rgba(128, 178, 201, 0.20);
2551
+ box-shadow: 0 0 0 1px var(--ac-primary-color);
2552
+ outline: none;
2553
+ }
2554
+
2555
+ .host-card.pinned {
2556
+ box-shadow: 0 0 0 1px var(--ac-primary-color);
2557
+ background: rgba(128, 178, 201, 0.16);
2558
+ }
2559
+
2560
+ .host-avatar {
2561
+ width: 40px;
2562
+ height: 40px;
2563
+ border-radius: 50%;
2564
+ flex-shrink: 0;
2565
+ object-fit: cover;
2566
+ background: rgba(128, 178, 201, 0.2);
2567
+ }
2568
+
2569
+ .host-avatar.fallback {
2570
+ display: flex;
2571
+ align-items: center;
2572
+ justify-content: center;
2573
+ font-size: 16px;
2574
+ font-weight: 600;
2575
+ color: #fff;
2576
+ }
2577
+
2578
+ .host-info {
2579
+ flex: 1;
2580
+ min-width: 0;
2581
+ }
2582
+
2583
+ .host-name {
2584
+ font-size: 15px;
2585
+ font-weight: 600;
2586
+ color: #ffffff;
2587
+ margin: 0;
2588
+ text-align: left;
2589
+ }
2590
+
2591
+ .host-location {
2592
+ font-size: 13px;
2593
+ color: rgba(255, 255, 255, 0.6);
2594
+ margin: 2px 0 0 0;
2595
+ text-align: left;
2596
+ }
2597
+
2598
+ .host-meta {
2599
+ display: flex;
2600
+ flex-wrap: wrap;
2601
+ gap: 4px;
2602
+ margin-top: 6px;
2603
+ }
2604
+
2605
+ .model-chip {
2606
+ font-size: 11px;
2607
+ padding: 2px 8px;
2608
+ border-radius: 10px;
2609
+ background: rgba(145, 227, 253, 0.15);
2610
+ color: var(--ac-primary-color);
2611
+ white-space: nowrap;
2612
+ }
2613
+
2614
+ .rates-preview {
2615
+ font-size: 12px;
2616
+ color: rgba(255, 255, 255, 0.5);
2617
+ margin-top: 4px;
2618
+ text-align: left;
2619
+ }
2620
+
2621
+ .spinner {
2622
+ display: flex;
2623
+ justify-content: center;
2624
+ padding: 40px 0;
2625
+ }
2626
+
2627
+ .spinner::after {
2628
+ content: "";
2629
+ width: 32px;
2630
+ height: 32px;
2631
+ border: 3px solid var(--ac-border-color-light);
2632
+ border-top-color: var(--ac-primary-color);
2633
+ border-radius: 50%;
2634
+ animation: spin 0.8s linear infinite;
2635
+ }
2636
+
2637
+ @keyframes spin {
2638
+ to { transform: rotate(360deg); }
2639
+ }
2640
+
2641
+ .divider {
2642
+ display: flex;
2643
+ align-items: center;
2644
+ gap: 12px;
2645
+ margin: 8px 0;
2646
+ }
2647
+
2648
+ .divider::before,
2649
+ .divider::after {
2650
+ content: "";
2651
+ flex: 1;
2652
+ height: 1px;
2653
+ background: var(--ac-border-color-light);
2654
+ }
2655
+
2656
+ .divider span {
2657
+ font-size: 13px;
2658
+ color: rgba(255, 255, 255, 0.4);
2659
+ white-space: nowrap;
2660
+ }
2661
+
2662
+ .manual-entry {
2663
+ display: flex;
2664
+ gap: 8px;
2665
+ width: 100%;
2666
+ padding: 2px;
2667
+ }
2668
+
2669
+ .manual-entry input {
2670
+ flex: 1;
2671
+ }
2672
+
2673
+ .manual-entry button {
2674
+ width: auto;
2675
+ flex-shrink: 0;
2676
+ }
2677
+
2678
+ .pinned-label {
2679
+ font-size: 11px;
2680
+ color: var(--ac-primary-color);
2681
+ text-transform: uppercase;
2682
+ letter-spacing: 0.5px;
2683
+ font-weight: 600;
2684
+ }
2685
+
2686
+ button.back-button {
2687
+ all: unset;
2688
+ cursor: pointer;
2689
+ }
2690
+ `],L([ie({type:Array})],ht.prototype,"hosts",2),L([ie({type:Boolean})],ht.prototype,"loading",2),L([ie({type:String})],ht.prototype,"error",2),L([ie({type:String})],ht.prototype,"lastHostId",2),L([ie({type:String})],ht.prototype,"defaultUrl",2),L([Y()],ht.prototype,"manualUrl",2),L([Y()],ht.prototype,"manualUrlError",2),ht=L([Ne("host-browser")],ht);var Nr=class extends ge{back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0}))}proceedToAuth(){this.dispatchEvent(new CustomEvent("proceed-to-auth",{detail:{host:this.host},bubbles:!0,composed:!0}))}renderAvatar(){return os(this.host,"profile-pic")}rateLabel(t){return t==="link write"?"Link write":t==="embedding per token"?"Embedding (per token)":t}formatPrice(t){return t===0?"0.00":t>=.01?t.toFixed(2):t>=1e-4?t.toFixed(4):t>=1e-6?t.toFixed(6):t.toExponential(2)}render(){return this.host?I`
2691
+ <div class="container">
2692
+ <button class="back-button" aria-label="Go back" @click=${this.back}>
2693
+ ${wt()}
2694
+ </button>
2695
+
2696
+ <div class="profile">
2697
+ ${this.renderAvatar()}
2698
+ <p class="profile-name">${this.host.name}</p>
2699
+ <p class="profile-location">${this.host.location}</p>
2700
+ ${this.host.description?I`<p class="profile-description">${this.host.description}</p>`:""}
2701
+
2702
+ ${this.host.aiModels.length>0?I`
2703
+ <div class="models">
2704
+ ${this.host.aiModels.map(t=>I`<span class="model-chip">${t}</span>`)}
2705
+ </div>
2706
+ `:""}
2707
+ </div>
2708
+
2709
+ ${this.host.rates.length>0?I`
2710
+ <div class="box">
2711
+ <div class="rates-section">
2712
+ <h3>Pricing</h3>
2713
+ <table class="rates-table">
2714
+ ${this.host.rates.filter(t=>!t.description.endsWith("per token")).map(t=>I`
2715
+ <tr>
2716
+ <td>${this.rateLabel(t.description)}</td>
2717
+ <td>${this.formatPrice(t.priceInHOT)} HOT</td>
2718
+ </tr>
2719
+ `)}
2720
+ ${this.host.rates.filter(t=>t.description.endsWith("per token")).length>0?I`
2721
+ <tr><td colspan="2" style="padding-top:12px;color:rgba(255,255,255,0.5);font-size:12px;text-transform:uppercase;letter-spacing:0.5px;">AI Models (per token)</td></tr>
2722
+ ${this.host.rates.filter(t=>t.description.endsWith("per token")).map(t=>I`
2723
+ <tr>
2724
+ <td>${t.description.replace(" per token","")}</td>
2725
+ <td>${this.formatPrice(t.priceInHOT)} HOT</td>
2726
+ </tr>
2727
+ `)}
2728
+ `:""}
2729
+ </table>
2730
+ </div>
2731
+ </div>
2732
+ `:""}
2733
+
2734
+ ${this.host.computeSpecs?I`
2735
+ <div class="box">
2736
+ <div class="rates-section">
2737
+ <h3>Compute</h3>
2738
+ <p class="compute-specs">${this.host.computeSpecs}</p>
2739
+ </div>
2740
+ </div>
2741
+ `:""}
2742
+
2743
+ <button class="primary connect-button" @click=${this.proceedToAuth}>
2744
+ Connect to ${this.host.name}
2745
+ </button>
2746
+ </div>
2747
+ `:null}};Nr.styles=[Ke,Ee`
2748
+ .profile {
2749
+ display: flex;
2750
+ flex-direction: column;
2751
+ align-items: center;
2752
+ gap: 10px;
2753
+ }
2754
+
2755
+ .profile-pic {
2756
+ width: 72px;
2757
+ height: 72px;
2758
+ border-radius: 50%;
2759
+ object-fit: cover;
2760
+ background: rgba(128, 178, 201, 0.2);
2761
+ }
2762
+
2763
+ .profile-pic.fallback {
2764
+ display: flex;
2765
+ align-items: center;
2766
+ justify-content: center;
2767
+ font-size: 28px;
2768
+ font-weight: 600;
2769
+ color: #fff;
2770
+ }
2771
+
2772
+ .profile-name {
2773
+ font-size: 22px;
2774
+ font-weight: 700;
2775
+ color: #ffffff;
2776
+ margin: 0;
2777
+ }
2778
+
2779
+ .profile-location {
2780
+ font-size: 14px;
2781
+ color: rgba(255, 255, 255, 0.6);
2782
+ margin: 0;
2783
+ }
2784
+
2785
+ .profile-description {
2786
+ font-size: 14px;
2787
+ color: rgba(255, 255, 255, 0.5);
2788
+ margin: 0;
2789
+ text-align: center;
2790
+ line-height: 1.4;
2791
+ }
2792
+
2793
+ .compute-specs {
2794
+ font-size: 14px;
2795
+ color: rgba(255, 255, 255, 0.8);
2796
+ margin: 0;
2797
+ }
2798
+
2799
+ .models {
2800
+ display: flex;
2801
+ flex-wrap: wrap;
2802
+ justify-content: center;
2803
+ gap: 6px;
2804
+ margin-top: 4px;
2805
+ }
2806
+
2807
+ .model-chip {
2808
+ font-size: 13px;
2809
+ padding: 4px 12px;
2810
+ border-radius: 12px;
2811
+ background: rgba(145, 227, 253, 0.15);
2812
+ color: var(--ac-primary-color);
2813
+ }
2814
+
2815
+ .rates-section {
2816
+ width: 100%;
2817
+ }
2818
+
2819
+ .rates-section h3 {
2820
+ text-align: left;
2821
+ font-size: 14px;
2822
+ font-weight: 600;
2823
+ color: rgba(255, 255, 255, 0.6);
2824
+ text-transform: uppercase;
2825
+ letter-spacing: 0.5px;
2826
+ margin-bottom: 10px;
2827
+ }
2828
+
2829
+ .rates-table {
2830
+ width: 100%;
2831
+ border-collapse: collapse;
2832
+ }
2833
+
2834
+ .rates-table tr {
2835
+ border-bottom: 1px solid var(--ac-border-color-dark);
2836
+ }
2837
+
2838
+ .rates-table tr:last-child {
2839
+ border-bottom: none;
2840
+ }
2841
+
2842
+ .rates-table td {
2843
+ padding: 8px 0;
2844
+ font-size: 14px;
2845
+ }
2846
+
2847
+ .rates-table td:first-child {
2848
+ color: rgba(255, 255, 255, 0.8);
2849
+ }
2850
+
2851
+ .rates-table td:last-child {
2852
+ text-align: right;
2853
+ color: var(--ac-primary-color);
2854
+ font-family: monospace;
2855
+ font-size: 13px;
2856
+ }
2857
+
2858
+ button.connect-button {
2859
+ width: 100%;
2860
+ }
2861
+
2862
+ button.back-button {
2863
+ all: unset;
2864
+ cursor: pointer;
2865
+ }
2866
+ `],L([ie({type:Object})],Nr.prototype,"host",2),Nr=L([Ne("host-detail")],Nr);var gt=class extends ge{constructor(){super(...arguments);this.connectedHost=null;this.userInfo=null;this.requestingPayment=!1;this.paymentError=null;this.walletInput="";this.editingWallet=!1;this.paymentSuccess=!1}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}setWalletAddress(){let t=this.walletInput.trim();!t||(this.editingWallet=!1,this.dispatchEvent(new CustomEvent("set-wallet-address",{detail:{address:t},bubbles:!0,composed:!0})))}requestTopUp(t){this.paymentSuccess=!1,this.dispatchEvent(new CustomEvent("request-top-up",{detail:{amountHOT:t},bubbles:!0,composed:!0}))}get hasWallet(){var t;return!!((t=this.userInfo)!=null&&t.hotWalletAddress)}get isFreeAccess(){var t;return!!((t=this.userInfo)!=null&&t.freeAccess)}get isDepleted(){return this.userInfo!=null&&!this.userInfo.freeAccess&&this.userInfo.remainingCredits<=0}updated(t){var r;t.has("requestingPayment")&&!this.requestingPayment&&!this.paymentError&&t.get("requestingPayment")&&(this.paymentSuccess=!0,setTimeout(()=>{this.paymentSuccess=!1},4e3)),t.has("userInfo")&&((r=this.userInfo)==null?void 0:r.hotWalletAddress)&&!this.walletInput&&(this.walletInput=this.userInfo.hotWalletAddress)}render(){var r,n,a;let t=(n=(r=this.userInfo)==null?void 0:r.remainingCredits)!=null?n:0;return I`
2867
+ <div class="container">
2868
+ <div class="close-button" @click=${this.close}>
2869
+ ${Ue()}
2870
+ </div>
2871
+
2872
+ <div class="dashboard-header">
2873
+ <h1>Dashboard</h1>
2874
+ ${this.connectedHost?I`
2875
+ <div class="host-badge">
2876
+ Connected to <strong>${this.connectedHost.name}</strong> · ${this.connectedHost.location}
2877
+ </div>
2878
+ `:""}
2879
+ ${(a=this.userInfo)!=null&&a.email?I`
2880
+ <p class="email-display">${this.userInfo.email}</p>
2881
+ `:""}
2882
+ </div>
2883
+
2884
+ <!-- Credit balance -->
2885
+ ${this.isFreeAccess?I`
2886
+ <div class="credit-display free-access">
2887
+ ${Hr()}
2888
+ <span class="credit-amount">Free Access</span>
2889
+ </div>
2890
+ `:I`
2891
+ <div class="credit-display ${this.isDepleted?"depleted":""}">
2892
+ ${Hr()}
2893
+ <span class="credit-amount">${t.toFixed(2)}</span>
2894
+ <span class="credit-label">HOT</span>
2895
+ </div>
2896
+
2897
+ ${this.isDepleted?I`
2898
+ <div class="depleted-banner">Credits depleted — top up to continue using this host</div>
2899
+ `:""}
2900
+
2901
+ <!-- Wallet address -->
2902
+ <div class="wallet-section">
2903
+ <label>${Jn()} mHOT Wallet Address</label>
2904
+ ${this.hasWallet&&!this.editingWallet?I`
2905
+ <div class="wallet-row">
2906
+ <div class="wallet-display">${this.userInfo.hotWalletAddress}</div>
2907
+ <button class="secondary" @click=${()=>{this.editingWallet=!0,this.walletInput=this.userInfo.hotWalletAddress||""}}>
2908
+ Change
2909
+ </button>
2910
+ </div>
2911
+ `:I`
2912
+ <div class="wallet-row">
2913
+ <input
2914
+ type="text"
2915
+ placeholder="Enter your mHOT wallet address"
2916
+ .value=${this.walletInput}
2917
+ @input=${s=>{this.walletInput=s.target.value}}
2918
+ @keydown=${s=>{s.key==="Enter"&&this.setWalletAddress()}}
2919
+ style="font-size: 14px;"
2920
+ />
2921
+ <button
2922
+ class="primary"
2923
+ ?disabled=${!this.walletInput.trim()}
2924
+ @click=${this.setWalletAddress}
2925
+ >
2926
+ Save
2927
+ </button>
2928
+ </div>
2929
+ `}
2930
+ </div>
2931
+
2932
+ <!-- Top-up buttons -->
2933
+ <div class="topup-buttons">
2934
+ ${[10,50,100].map(s=>I`
2935
+ <button
2936
+ class="secondary"
2937
+ ?disabled=${!this.hasWallet||this.requestingPayment}
2938
+ @click=${()=>this.requestTopUp(s)}
2939
+ >
2940
+ ${this.requestingPayment?"...":`${s} HOT`}
2941
+ </button>
2942
+ `)}
2943
+ </div>
2944
+
2945
+ ${this.hasWallet?"":I`
2946
+ <p style="font-size:13px;color:rgba(255,255,255,0.4);text-align:center;">
2947
+ Set your wallet address above to enable top-ups
2948
+ </p>
2949
+ `}
2950
+
2951
+ ${this.paymentSuccess?I`
2952
+ <div class="success-message">Payment request sent to Unit app</div>
2953
+ `:""}
2954
+
2955
+ ${this.paymentError?I`
2956
+ <div class="error-message">${this.paymentError}</div>
2957
+ `:""}
2958
+ `}
2959
+
2960
+ <button class="danger full" @click=${this.disconnect}>
2961
+ Disconnect
2962
+ </button>
2963
+ </div>
2964
+ `}};gt.styles=[Ke,Ee`
2965
+ .dashboard-header {
2966
+ text-align: center;
2967
+ }
2968
+
2969
+ .host-badge {
2970
+ display: flex;
2971
+ align-items: center;
2972
+ justify-content: center;
2973
+ gap: 8px;
2974
+ font-size: 14px;
2975
+ color: rgba(255, 255, 255, 0.6);
2976
+ margin-top: 4px;
2977
+ }
2978
+
2979
+ .credit-display {
2980
+ display: flex;
2981
+ align-items: center;
2982
+ justify-content: center;
2983
+ gap: 10px;
2984
+ padding: 16px;
2985
+ border-radius: 8px;
2986
+ background: rgba(128, 178, 201, 0.14);
2987
+ box-shadow: 0 0 0 1px var(--ac-border-color-light);
2988
+ }
2989
+
2990
+ .credit-display svg {
2991
+ width: 24px;
2992
+ height: 24px;
2993
+ color: var(--ac-primary-color);
2994
+ flex-shrink: 0;
2995
+ }
2996
+
2997
+ .credit-amount {
2998
+ font-size: 28px;
2999
+ font-weight: 700;
3000
+ color: #ffffff;
3001
+ }
3002
+
3003
+ .credit-label {
3004
+ font-size: 14px;
3005
+ color: rgba(255, 255, 255, 0.5);
3006
+ }
3007
+
3008
+ .credit-display.depleted {
3009
+ background: rgba(244, 54, 127, 0.12);
3010
+ box-shadow: 0 0 0 1px var(--ac-danger-color);
3011
+ }
3012
+
3013
+ .credit-display.depleted .credit-amount {
3014
+ color: var(--ac-danger-color);
3015
+ }
3016
+
3017
+ .credit-display.free-access {
3018
+ background: rgba(93, 210, 125, 0.14);
3019
+ box-shadow: 0 0 0 1px var(--ac-success-color);
3020
+ }
3021
+
3022
+ .credit-display.free-access .credit-amount {
3023
+ color: var(--ac-success-color);
3024
+ font-size: 20px;
3025
+ }
3026
+
3027
+ .depleted-banner {
3028
+ text-align: center;
3029
+ padding: 10px;
3030
+ border-radius: 8px;
3031
+ background: rgba(244, 54, 127, 0.15);
3032
+ color: var(--ac-danger-color);
3033
+ font-size: 14px;
3034
+ font-weight: 600;
3035
+ }
3036
+
3037
+ .wallet-section {
3038
+ display: flex;
3039
+ flex-direction: column;
3040
+ gap: 8px;
3041
+ }
3042
+
3043
+ .wallet-section label {
3044
+ display: flex;
3045
+ align-items: center;
3046
+ gap: 6px;
3047
+ font-size: 13px;
3048
+ color: rgba(255, 255, 255, 0.6);
3049
+ text-transform: uppercase;
3050
+ letter-spacing: 0.5px;
3051
+ font-weight: 600;
3052
+ }
3053
+
3054
+ .wallet-section label svg {
3055
+ width: 16px;
3056
+ height: 16px;
3057
+ color: var(--ac-primary-color);
3058
+ }
3059
+
3060
+ .wallet-row {
3061
+ display: flex;
3062
+ gap: 8px;
3063
+ }
3064
+
3065
+ .wallet-row input {
3066
+ flex: 1;
3067
+ }
3068
+
3069
+ .wallet-row button {
3070
+ width: auto;
3071
+ flex-shrink: 0;
3072
+ }
3073
+
3074
+ .wallet-display {
3075
+ display: flex;
3076
+ align-items: center;
3077
+ gap: 8px;
3078
+ padding: 0 16px;
3079
+ height: 48px;
3080
+ border-radius: 8px;
3081
+ background: #00091e5c;
3082
+ box-shadow: 0 0 0 1px var(--ac-border-color-light);
3083
+ font-size: 14px;
3084
+ color: var(--ac-primary-color);
3085
+ font-family: monospace;
3086
+ overflow: hidden;
3087
+ text-overflow: ellipsis;
3088
+ white-space: nowrap;
3089
+ flex: 1;
3090
+ }
3091
+
3092
+ .topup-buttons {
3093
+ display: flex;
3094
+ gap: 8px;
3095
+ }
3096
+
3097
+ .topup-buttons button {
3098
+ flex: 1;
3099
+ font-size: 14px;
3100
+ padding: 0 12px;
3101
+ height: 42px;
3102
+ }
3103
+
3104
+ .success-message {
3105
+ text-align: center;
3106
+ padding: 10px;
3107
+ border-radius: 8px;
3108
+ background: rgba(93, 210, 125, 0.15);
3109
+ color: var(--ac-success-color);
3110
+ font-size: 14px;
3111
+ font-weight: 600;
3112
+ }
3113
+
3114
+ .error-message {
3115
+ text-align: center;
3116
+ padding: 10px;
3117
+ border-radius: 8px;
3118
+ background: rgba(244, 54, 127, 0.15);
3119
+ color: var(--ac-danger-color);
3120
+ font-size: 14px;
3121
+ }
3122
+
3123
+ .email-display {
3124
+ font-size: 14px;
3125
+ color: rgba(255, 255, 255, 0.5);
3126
+ text-align: center;
3127
+ }
3128
+
3129
+ button.full {
3130
+ width: 100%;
3131
+ }
3132
+ `],L([ie({type:Object})],gt.prototype,"connectedHost",2),L([ie({type:Object})],gt.prototype,"userInfo",2),L([ie({type:Boolean})],gt.prototype,"requestingPayment",2),L([ie({type:String})],gt.prototype,"paymentError",2),L([Y()],gt.prototype,"walletInput",2),L([Y()],gt.prototype,"editingWallet",2),L([Y()],gt.prototype,"paymentSuccess",2),gt=L([Ne("logged-in-dashboard")],gt);var Ug=Ee`
2400
3133
  @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
2401
3134
 
2402
3135
  :host {
3136
+ font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
2403
3137
  --ac-primary-color: #91e3fd;
2404
3138
  --ac-primary-color-light: #acebff;
2405
3139
  --ac-success-color: #5dd27d;
@@ -2440,12 +3174,14 @@ input VoiceActivityParamsInput {
2440
3174
  border: 1px solid var(--ac-border-color-dark);
2441
3175
  border-radius: 12px;
2442
3176
  padding: 30px;
2443
- width: calc(100vw - 10px);
3177
+ width: calc(100vw - 30px);
2444
3178
  max-width: 480px;
2445
- max-height: 90vh;
3179
+ max-height: calc(100vh - 30px);
2446
3180
  overflow-y: auto;
2447
3181
  backdrop-filter: blur(10px);
2448
3182
  -webkit-backdrop-filter: blur(10px); /* Safari */
3183
+ display: flex;
3184
+ flex-direction: column;
2449
3185
  }
2450
3186
 
2451
3187
  .modal-header {
@@ -2465,6 +3201,8 @@ input VoiceActivityParamsInput {
2465
3201
  display: flex;
2466
3202
  flex-direction: column;
2467
3203
  justify-content: center;
3204
+ flex: 1 1 auto;
3205
+ min-height: 0;
2468
3206
  }
2469
3207
 
2470
3208
  .settings-button {
@@ -2481,19 +3219,25 @@ input VoiceActivityParamsInput {
2481
3219
  height: 34px;
2482
3220
  z-index: 99999;
2483
3221
  }
2484
- `,Pe=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(),vs(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 _e(this,null,function*(){this.core.port=t.detail.port,Bn("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return _e(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,Bn("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,Bn("ad4m-url",this.core.url);try{if(yield qn(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}})}disconnect(){return _e(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return N`
3222
+
3223
+ .settings-button.low-credit {
3224
+ color: var(--ac-danger-color);
3225
+ animation: pulse-danger 2s ease-in-out infinite;
3226
+ }
3227
+
3228
+ @keyframes pulse-danger {
3229
+ 0%, 100% { opacity: 1; }
3230
+ 50% { opacity: 0.4; }
3231
+ }
3232
+ `,be=class extends ge{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.hosts=[];this.hostsLoading=!1;this.hostsError=null;this.selectedHost=null;this.userInfo=null;this.lowCredit=!1;this.requestingPayment=!1;this.paymentError=null}connectedCallback(){super.connectedCallback(),$s(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.addEventListener("userinfochange",t=>{var n;let r=t.detail;((n=this.userInfo)==null?void 0:n.hotWalletAddress)&&!r.hotWalletAddress&&(r.hotWalletAddress=this.userInfo.hotWalletAddress),this.userInfo=r,this.lowCredit=this.userInfo.remainingCredits<=10,this.requestUpdate()}),this.core.addEventListener("creditdepleted",()=>{this.lowCredit=!0,this.requestUpdate()}),this.core.token?this.core.connect().then(()=>{this.core.connectedHost&&(this.selectedHost=this.core.connectedHost,this.core.startCreditPolling())}).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 pe(this,null,function*(){this.core.port=t.detail.port,Br("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return pe(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,Br("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 pe(this,null,function*(){let r=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!r,r&&(this.modalOpen=!1)})}browseHosts(){return pe(this,null,function*(){this.hostsLoading=!0,this.hostsError=null,this.currentView="host-browser";try{this.hosts=yield As(this.core.hostIndexUrl)}catch(t){console.error("[Ad4m Connect UI] Failed to fetch hosts:",t),this.hostsError=t instanceof Error?t.message:"Failed to load hosts"}finally{this.hostsLoading=!1}})}retryFetchHosts(){return pe(this,null,function*(){this.hostsLoading=!0,this.hostsError=null;try{this.hosts=yield As(this.core.hostIndexUrl)}catch(t){console.error("[Ad4m Connect UI] Failed to fetch hosts:",t),this.hostsError=t instanceof Error?t.message:"Failed to load hosts"}finally{this.hostsLoading=!1}})}selectHost(t){this.selectedHost=t.detail.host,this.currentView="host-detail"}proceedToAuth(t){return pe(this,null,function*(){let r=t.detail.host;this.selectedHost=r;let n=r.url;try{yield qr(n),console.log("[Ad4m Connect UI] Host connection successful:",r.name);let a=this.core.url;if(this.core.url=n,!(yield this.core.isValidAd4mAPI()))throw this.core.url=a,new Error("Server is reachable but doesn't appear to be an AD4M executor");Br("ad4m-url",n),this.currentView="remote-authentication"}catch(a){console.error("[Ad4m Connect UI] Host connection failed:",a),this.hostsError=a instanceof Error?a.message:"Connection failed",this.currentView="host-browser"}})}handleAuthSuccess(){return pe(this,null,function*(){this.selectedHost?(this.core.setConnectedHost(this.selectedHost),this.core.startCreditPolling(),this.currentView="logged-in-dashboard"):this.modalOpen=!1})}handleRequestTopUp(t){return pe(this,null,function*(){this.requestingPayment=!0,this.paymentError=null;try{let r=yield this.core.requestTopUp(t.detail.amountHOT);r.success||(this.paymentError=r.message)}catch(r){this.paymentError=r instanceof Error?r.message:"Payment request failed"}finally{this.requestingPayment=!1}})}handleSetWalletAddress(t){return pe(this,null,function*(){try{yield this.core.ad4mClient.agent.setHotWalletAddress(t.detail.address),this.userInfo&&(this.userInfo=Fo(Mo({},this.userInfo),{hotWalletAddress:t.detail.address}))}catch(r){console.error("[Ad4m Connect] Failed to set wallet address:",r)}})}connectRemoteNode(t){return pe(this,null,function*(){this.core.url=t.detail.remoteUrl,Br("ad4m-url",this.core.url);try{if(yield qr(t.detail.remoteUrl),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");this.currentView="remote-authentication"}catch(r){console.error("[Ad4m Connect UI] Remote connection failed:",r)}})}emailLogin(t){return pe(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return pe(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!r,r&&(yield this.handleAuthSuccess())}catch(r){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return pe(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!r,r&&(yield this.handleAuthSuccess())}catch(r){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return pe(this,null,function*(){try{this.remoteAuthLoading=!0;let r=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!r,r&&(yield this.handleAuthSuccess())}catch(r){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return pe(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){var t,r,n;if(this.currentView==="connection-options")return I`
2485
3233
  <connection-options
2486
3234
  .port=${this.core.port}
2487
- .remoteUrl=${this.core.options.remoteUrl}
2488
- .connectingToRemoteNode=${this.connectingToRemoteNode}
2489
- .remoteNodeError=${this.remoteNodeError}
2490
- .showMultiUserOption=${this.core.options.multiUser}
3235
+ .showHosting=${!!this.core.options.hosting}
2491
3236
  @change-port=${this.changePort}
2492
3237
  @connect-local-node=${this.connectLocalNode}
2493
- @connect-remote-node=${this.connectRemoteNode}
2494
- @clear-remote-node-error=${()=>{this.remoteNodeError=!1}}
3238
+ @browse-hosts=${this.browseHosts}
2495
3239
  ></connection-options>
2496
- `;if(this.currentView==="local-authentication")return N`
3240
+ `;if(this.currentView==="local-authentication")return I`
2497
3241
  <local-authentication
2498
3242
  .capabilities=${this.core.options.capabilities}
2499
3243
  .appname=${this.core.options.appInfo.name}
@@ -2504,21 +3248,50 @@ input VoiceActivityParamsInput {
2504
3248
  @verify-code=${this.verifyLocalAd4mCode}
2505
3249
  @clear-verification-error=${()=>{this.verificationError=!1}}
2506
3250
  ></local-authentication>
2507
- `;if(this.currentView==="remote-authentication")return N`
3251
+ `;if(this.currentView==="host-browser")return I`
3252
+ <host-browser
3253
+ .hosts=${this.hosts}
3254
+ .loading=${this.hostsLoading}
3255
+ .error=${this.hostsError}
3256
+ .lastHostId=${(r=(t=this.core.connectedHost)==null?void 0:t.id)!=null?r:null}
3257
+ .defaultUrl=${(n=this.core.options.remoteUrl)!=null?n:""}
3258
+ @select-host=${this.selectHost}
3259
+ @back=${()=>{this.currentView="connection-options"}}
3260
+ @retry=${this.retryFetchHosts}
3261
+ ></host-browser>
3262
+ `;if(this.currentView==="host-detail")return I`
3263
+ <host-detail
3264
+ .host=${this.selectedHost}
3265
+ @proceed-to-auth=${this.proceedToAuth}
3266
+ @back=${()=>{this.currentView="host-browser"}}
3267
+ ></host-detail>
3268
+ `;if(this.currentView==="remote-authentication")return I`
2508
3269
  <remote-authentication
3270
+ .host=${this.selectedHost}
2509
3271
  .remoteAuthLoading=${this.remoteAuthLoading}
2510
3272
  .remoteAuthState=${this.remoteAuthState}
2511
3273
  .emailCodeError=${this.emailCodeError}
2512
3274
  .passwordError=${this.passwordError}
2513
3275
  .accountCreationError=${this.accountCreationError}
2514
- @back=${()=>{this.currentView="connection-options"}}
3276
+ @back=${()=>{this.currentView=this.selectedHost?"host-detail":"connection-options"}}
2515
3277
  @email-login=${this.emailLogin}
2516
3278
  @verify-email-code=${this.verifyEmailCode}
2517
3279
  @password-login=${this.passwordLogin}
2518
3280
  @create-account=${this.createAccount}
2519
3281
  @clear-email-code-error=${()=>{this.emailCodeError=!1}}
2520
3282
  ></remote-authentication>
2521
- `;if(this.currentView==="current-state")return N`
3283
+ `;if(this.currentView==="logged-in-dashboard")return I`
3284
+ <logged-in-dashboard
3285
+ .connectedHost=${this.core.connectedHost}
3286
+ .userInfo=${this.userInfo}
3287
+ .requestingPayment=${this.requestingPayment}
3288
+ .paymentError=${this.paymentError}
3289
+ @close=${()=>{this.modalOpen=!1}}
3290
+ @disconnect=${this.disconnect}
3291
+ @request-top-up=${this.handleRequestTopUp}
3292
+ @set-wallet-address=${this.handleSetWalletAddress}
3293
+ ></logged-in-dashboard>
3294
+ `;if(this.currentView==="current-state")return I`
2522
3295
  <current-state
2523
3296
  .url=${this.core.url}
2524
3297
  .port=${this.core.port}
@@ -2526,11 +3299,11 @@ input VoiceActivityParamsInput {
2526
3299
  @close=${()=>{this.modalOpen=!1}}
2527
3300
  @disconnect=${this.disconnect}
2528
3301
  ></current-state>
2529
- `}render(){return this.modalOpen?N`
3302
+ `}render(){return this.modalOpen?I`
2530
3303
  <div class="wrapper">
2531
3304
  <div class="modal">
2532
3305
  <header class="modal-header">
2533
- ${mi()}
3306
+ ${_i()}
2534
3307
  </header>
2535
3308
  <main class="modal-content">
2536
3309
  ${this.renderViews()}
@@ -2538,16 +3311,16 @@ input VoiceActivityParamsInput {
2538
3311
  </div>
2539
3312
  <div class="backdrop" />
2540
3313
  </div>
2541
- `:this.core.authState==="authenticated"?N`
3314
+ `:this.core.authState==="authenticated"?I`
2542
3315
  <button
2543
3316
  type="button"
2544
- class="settings-button"
3317
+ class="settings-button ${this.lowCredit?"low-credit":""}"
2545
3318
  aria-label="Open settings"
2546
- @click=${()=>{this.currentView="current-state",this.modalOpen=!0}}
3319
+ @click=${()=>{this.currentView=this.core.connectedHost?"logged-in-dashboard":"current-state",this.modalOpen=!0}}
2547
3320
  >
2548
- ${mi()}
3321
+ ${_i()}
2549
3322
  </button>
2550
- `:null}};Pe.styles=[yg],j([ue()],Pe.prototype,"modalOpen",2),j([ue()],Pe.prototype,"currentView",2),j([ue()],Pe.prototype,"connectingToRemoteNode",2),j([ue()],Pe.prototype,"remoteNodeError",2),j([ue()],Pe.prototype,"verificationError",2),j([ue()],Pe.prototype,"remoteAuthLoading",2),j([ue()],Pe.prototype,"remoteAuthState",2),j([ue()],Pe.prototype,"emailCodeError",2),j([ue()],Pe.prototype,"passwordError",2),j([ue()],Pe.prototype,"accountCreationError",2),Pe=j([gt("ad4m-connect")],Pe);function vg(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"),document.body.appendChild(e)),e}export{Pe as Ad4mConnectElement,vg as default};
3323
+ `:null}};be.styles=[Ug],L([Y()],be.prototype,"modalOpen",2),L([Y()],be.prototype,"currentView",2),L([Y()],be.prototype,"verificationError",2),L([Y()],be.prototype,"remoteAuthLoading",2),L([Y()],be.prototype,"remoteAuthState",2),L([Y()],be.prototype,"emailCodeError",2),L([Y()],be.prototype,"passwordError",2),L([Y()],be.prototype,"accountCreationError",2),L([Y()],be.prototype,"hosts",2),L([Y()],be.prototype,"hostsLoading",2),L([Y()],be.prototype,"hostsError",2),L([Y()],be.prototype,"selectedHost",2),L([Y()],be.prototype,"userInfo",2),L([Y()],be.prototype,"lowCredit",2),L([Y()],be.prototype,"requestingPayment",2),L([Y()],be.prototype,"paymentError",2),be=L([Ne("ad4m-connect")],be);function Mg(i){let e=new be;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{be as Ad4mConnectElement,Mg as default};
2551
3324
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
2552
3325
  /**
2553
3326
  * @license