@coasys/ad4m-connect 0.11.2-dev-sdna-only-prolog → 0.11.2-dev-sdna-only-prolog-2

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,33 +1,33 @@
1
- var dm=Object.defineProperty;var hm=Object.getOwnPropertyDescriptor;var te=(r,e,t,i)=>{for(var n=i>1?void 0:i?hm(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&dm(e,t,n),n};var re=(r,e,t)=>new Promise((i,n)=>{var a=c=>{try{s(t.next(c))}catch(l){n(l)}},o=c=>{try{s(t.throw(c))}catch(l){n(l)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});import{ZBarSymbolType as me,ZBarConfigType as Op,scanRGBABuffer as mm,getDefaultScanner as gm}from"https://cdn.jsdelivr.net/npm/@undecaf/zbar-wasm@0.9.15/dist/main.js";function ym(r,e,t,i){return new(t||(t=Promise))(function(n,a){function o(l){try{c(i.next(l))}catch(u){a(u)}}function s(l){try{c(i.throw(l))}catch(u){a(u)}}function c(l){var u;l.done?n(l.value):(u=l.value,u instanceof t?u:new t(function(d){d(u)})).then(o,s)}c((i=i.apply(r,e||[])).next())})}var M=class{constructor(e,t=Op.ZBAR_CFG_ENABLE,i=1){this.symbolType=e,this.configType=t,this.number=i,this.configSteps=[this]}static register(e,t,i=t.symbolType){return M.formatsToConfigs[e]=t,M.typesToFormats[i]=M.typesToFormats[i]||e,t}static formats(){return Object.keys(M.formatsToConfigs)}static toFormat(e){return M.typesToFormats[e]}static configure(e,t){var i;(i=M.formatsToConfigs[t])===null||i===void 0||i.configSteps.forEach(n=>e.setConfig(n.symbolType,n.configType,n.number))}add(e){return this.configSteps.push(e),this}},Ip;M.formatsToConfigs={},M.typesToFormats={},M.register("codabar",new M(me.ZBAR_CODABAR)),M.register("code_39",new M(me.ZBAR_CODE39)),M.register("code_93",new M(me.ZBAR_CODE93)),M.register("code_128",new M(me.ZBAR_CODE128)),M.register("databar",new M(me.ZBAR_DATABAR)),M.register("databar_exp",new M(me.ZBAR_DATABAR_EXP)),M.register("ean_2",new M(me.ZBAR_EAN2)),M.register("ean_5",new M(me.ZBAR_EAN5)),M.register("ean_8",new M(me.ZBAR_EAN8)),M.register("ean_13",new M(me.ZBAR_EAN13)),M.register("ean_13+2",new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN2)),M.register("ean_13+5",new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN5)),M.register("isbn_10",new M(me.ZBAR_ISBN10)).add(new M(me.ZBAR_EAN13)),M.register("isbn_13",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)),M.register("isbn_13+2",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN2)),M.register("isbn_13+5",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN5)),M.register("itf",new M(me.ZBAR_I25)),M.register("qr_code",new M(me.ZBAR_QRCODE)),M.register("sq_code",new M(me.ZBAR_SQCODE)),M.register("upc_a",new M(me.ZBAR_UPCA)).add(new M(me.ZBAR_EAN13)),M.register("upc_e",new M(me.ZBAR_UPCE)).add(new M(me.ZBAR_EAN13)),function(r){r[r.UNKNOWN=-1]="UNKNOWN",r[r.UPRIGHT=0]="UPRIGHT",r[r.ROTATED_RIGHT=1]="ROTATED_RIGHT",r[r.UPSIDE_DOWN=2]="UPSIDE_DOWN",r[r.ROTATED_LEFT=3]="ROTATED_LEFT"}(Ip||(Ip={}));var Ac=class{},vm=(()=>{try{return new OffscreenCanvas(1,1).getContext("2d")instanceof OffscreenCanvasRenderingContext2D}catch{return!1}})(),Or=class{constructor(e={}){if(e.formats!==void 0){if(!Array.isArray(e.formats)||!e.formats.length)throw new TypeError(`Barcode formats should be a non-empty array of strings but are: ${JSON.stringify(e)}`);let t=e.formats.filter(i=>!M.formats().includes(i));if(t.length)throw new TypeError(`Unsupported barcode format(s): ${t.join(", ")}`)}this.formats=e.formats||M.formats(),this.zbarConfig=e.zbar||new Ac}static getSupportedFormats(){return Promise.resolve(M.formats())}detect(e){if(!Or.isImageBitmapSource(e))throw new TypeError("BarcodeDetector.detect() argument is not an ImageBitmapSource");let t=Or.intrinsicDimensions(e);if(t.width===0||t.height===0)return Promise.resolve([]);try{return Promise.all([this.toImageData(e),this.getScanner()]).then(i=>{let n=i[0],a=i[1];return this.zbarConfig.enableCache!==void 0&&a.enableCache(this.zbarConfig.enableCache),mm(n.data,n.width,n.height,a)}).then(i=>i.map(n=>this.toBarcodeDetectorResult(n)))}catch(i){return Promise.reject(i)}}getScanner(){return new Promise((e,t)=>ym(this,void 0,void 0,function*(){if(!this.scanner){let i=yield gm();this.formats.length>0&&(i.setConfig(me.ZBAR_NONE,Op.ZBAR_CFG_ENABLE,0),this.formats.forEach(n=>M.configure(i,n))),this.scanner=i}e(this.scanner)}))}toImageData(e){let t=i=>{let n=Or.intrinsicDimensions(i);this.canvas&&this.canvas.width===n.width&&this.canvas.height===n.height||(this.canvas=function(s,c){if(vm)return new OffscreenCanvas(s,c);{let l=document.createElement("canvas");return l.width=s,l.height=c,l}}(n.width,n.height));let a=this.canvas,o=a.getContext("2d");return o.drawImage(i,0,0),o.getImageData(0,0,a.width,a.height)};if(e instanceof ImageData)return Promise.resolve(e);if(e instanceof Blob){let i=document.createElement("img");return i.src=URL.createObjectURL(e),i.decode().then(()=>t(i)).finally(()=>URL.revokeObjectURL(i.src))}return e instanceof CanvasRenderingContext2D?Promise.resolve(e.getImageData(0,0,e.canvas.width,e.canvas.height)):Promise.resolve(t(e))}toBarcodeDetectorResult(e){let t={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0};return e.points.forEach(i=>{t.minX=Math.min(t.minX,i.x),t.maxX=Math.max(t.maxX,i.x),t.minY=Math.min(t.minY,i.y),t.maxY=Math.max(t.maxY,i.y)}),{format:M.toFormat(e.type),rawValue:e.decode(this.zbarConfig.encoding),orientation:e.orientation,quality:e.quality,boundingBox:DOMRectReadOnly.fromRect({x:t.minX,y:t.minY,width:t.maxX-t.minX,height:t.maxY-t.minY}),cornerPoints:[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]}}static isImageBitmapSource(e){return e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof Blob||e instanceof ImageData||e instanceof CanvasRenderingContext2D||e instanceof ImageBitmap||e&&e.width==0||e&&e.height==0}static intrinsicDimensions(e){return{width:Number(e.naturalWidth||e.videoWidth||e.width),height:Number(e.naturalHeight||e.videoHeight||e.height)}}};var Io=window,Oo=Io.ShadowRoot&&(Io.ShadyCSS===void 0||Io.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,kc=Symbol(),Dp=new WeakMap,ia=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==kc)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(Oo&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Dp.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Dp.set(t,e))}return e}toString(){return this.cssText}},Np=r=>new ia(typeof r=="string"?r:r+"",void 0,kc),Tc=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new ia(t,r,kc)},Ic=(r,e)=>{Oo?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),n=Io.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},Do=Oo?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Np(t)})(r):r;var Oc,No=window,Rp=No.trustedTypes,bm=Rp?Rp.emptyScript:"",$p=No.reactiveElementPolyfillSupport,Nc={toAttribute(r,e){switch(e){case Boolean:r=r?bm:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Pp=(r,e)=>e!==r&&(e==e||r==r),Dc={attribute:!0,type:String,converter:Nc,reflect:!1,hasChanged:Pp},Rc="finalized",mr=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,i)=>{let n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=Dc){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Dc}static finalize(){if(this.hasOwnProperty(Rc))return!1;this[Rc]=!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,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)t.unshift(Do(n))}else e!==void 0&&t.push(Do(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i: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,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.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 Ic(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 i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=Dc){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:Nc).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:Nc;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Pp)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):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,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(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(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),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,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};mr[Rc]=!0,mr.elementProperties=new Map,mr.elementStyles=[],mr.shadowRootOptions={mode:"open"},$p?.({ReactiveElement:mr}),((Oc=No.reactiveElementVersions)!==null&&Oc!==void 0?Oc:No.reactiveElementVersions=[]).push("1.6.3");var $c,Ro=window,fn=Ro.trustedTypes,Lp=fn?fn.createPolicy("lit-html",{createHTML:r=>r}):void 0,Lc="$lit$",Dr=`lit$${(Math.random()+"").slice(9)}$`,Vp="?"+Dr,_m=`<${Vp}>`,hi=document,aa=()=>hi.createComment(""),oa=r=>r===null||typeof r!="object"&&typeof r!="function",Qp=Array.isArray,Sm=r=>Qp(r)||typeof r?.[Symbol.iterator]=="function",Pc=`[
2
- \f\r]`,na=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Fp=/-->/g,Mp=/>/g,fi=RegExp(`>|${Pc}(?:([^\\s"'>=/]+)(${Pc}*=${Pc}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Up=/'/g,jp=/"/g,zp=/^(?:script|style|textarea|title)$/i,Wp=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),F=Wp(1),Y3=Wp(2),mi=Symbol.for("lit-noChange"),He=Symbol.for("lit-nothing"),qp=new WeakMap,di=hi.createTreeWalker(hi,129,null,!1);function Hp(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Lp!==void 0?Lp.createHTML(e):e}var wm=(r,e)=>{let t=r.length-1,i=[],n,a=e===2?"<svg>":"",o=na;for(let s=0;s<t;s++){let c=r[s],l,u,d=-1,f=0;for(;f<c.length&&(o.lastIndex=f,u=o.exec(c),u!==null);)f=o.lastIndex,o===na?u[1]==="!--"?o=Fp:u[1]!==void 0?o=Mp:u[2]!==void 0?(zp.test(u[2])&&(n=RegExp("</"+u[2],"g")),o=fi):u[3]!==void 0&&(o=fi):o===fi?u[0]===">"?(o=n??na,d=-1):u[1]===void 0?d=-2:(d=o.lastIndex-u[2].length,l=u[1],o=u[3]===void 0?fi:u[3]==='"'?jp:Up):o===jp||o===Up?o=fi:o===Fp||o===Mp?o=na:(o=fi,n=void 0);let p=o===fi&&r[s+1].startsWith("/>")?" ":"";a+=o===na?c+_m:d>=0?(i.push(l),c.slice(0,d)+Lc+c.slice(d)+Dr+p):c+Dr+(d===-2?(i.push(void 0),s):p)}return[Hp(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),i]},gi=class{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let a=0,o=0,s=e.length-1,c=this.parts,[l,u]=wm(e,t);if(this.el=gi.createElement(l,i),di.currentNode=this.el.content,t===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(n=di.nextNode())!==null&&c.length<s;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let f of n.getAttributeNames())if(f.endsWith(Lc)||f.startsWith(Dr)){let p=u[o++];if(d.push(f),p!==void 0){let h=n.getAttribute(p.toLowerCase()+Lc).split(Dr),m=/([.?@])?(.*)/.exec(p);c.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?Mc:m[1]==="?"?Uc:m[1]==="@"?jc:hn})}else c.push({type:6,index:a})}for(let f of d)n.removeAttribute(f)}if(zp.test(n.tagName)){let d=n.textContent.split(Dr),f=d.length-1;if(f>0){n.textContent=fn?fn.emptyScript:"";for(let p=0;p<f;p++)n.append(d[p],aa()),di.nextNode(),c.push({type:2,index:++a});n.append(d[f],aa())}}}else if(n.nodeType===8)if(n.data===Vp)c.push({type:2,index:a});else{let d=-1;for(;(d=n.data.indexOf(Dr,d+1))!==-1;)c.push({type:7,index:a}),d+=Dr.length-1}a++}}static createElement(e,t){let i=hi.createElement("template");return i.innerHTML=e,i}};function dn(r,e,t=r,i){var n,a,o,s;if(e===mi)return e;let c=i!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[i]:t._$Cl,l=oa(e)?void 0:e._$litDirective$;return c?.constructor!==l&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),l===void 0?c=void 0:(c=new l(r),c._$AT(r,t,i)),i!==void 0?((o=(s=t)._$Co)!==null&&o!==void 0?o:s._$Co=[])[i]=c:t._$Cl=c),c!==void 0&&(e=dn(r,c._$AS(r,e.values),c,i)),e}var Fc=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:i},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:hi).importNode(i,!0);di.currentNode=a;let o=di.nextNode(),s=0,c=0,l=n[0];for(;l!==void 0;){if(s===l.index){let u;l.type===2?u=new yi(o,o.nextSibling,this,e):l.type===1?u=new l.ctor(o,l.name,l.strings,this,e):l.type===6&&(u=new qc(o,this,e)),this._$AV.push(u),l=n[++c]}s!==l?.index&&(o=di.nextNode(),s++)}return di.currentNode=hi,a}v(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},yi=class{constructor(e,t,i,n){var a;this.type=2,this._$AH=He,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,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=dn(this,e,t),oa(e)?e===He||e==null||e===""?(this._$AH!==He&&this._$AR(),this._$AH=He):e!==this._$AH&&e!==mi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):Sm(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!==He&&oa(this._$AH)?this._$AA.nextSibling.data=e:this.$(hi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:i,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=gi.createElement(Hp(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(i);else{let o=new Fc(a,this),s=o.u(this.options);o.v(i),this.$(s),this._$AH=o}}_$AC(e){let t=qp.get(e.strings);return t===void 0&&qp.set(e.strings,t=new gi(e)),t}T(e){Qp(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,n=0;for(let a of e)n===t.length?t.push(i=new yi(this.k(aa()),this.k(aa()),this,this.options)):i=t[n],i._$AI(a),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.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))}},hn=class{constructor(e,t,i,n,a){this.type=1,this._$AH=He,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=He}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){let a=this.strings,o=!1;if(a===void 0)e=dn(this,e,t,0),o=!oa(e)||e!==this._$AH&&e!==mi,o&&(this._$AH=e);else{let s=e,c,l;for(e=a[0],c=0;c<a.length-1;c++)l=dn(this,s[i+c],t,c),l===mi&&(l=this._$AH[c]),o||(o=!oa(l)||l!==this._$AH[c]),l===He?e=He:e!==He&&(e+=(l??"")+a[c+1]),this._$AH[c]=l}o&&!n&&this.j(e)}j(e){e===He?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Mc=class extends hn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===He?void 0:e}},Cm=fn?fn.emptyScript:"",Uc=class extends hn{constructor(){super(...arguments),this.type=4}j(e){e&&e!==He?this.element.setAttribute(this.name,Cm):this.element.removeAttribute(this.name)}},jc=class extends hn{constructor(e,t,i,n,a){super(e,t,i,n,a),this.type=5}_$AI(e,t=this){var i;if((e=(i=dn(this,e,t,0))!==null&&i!==void 0?i:He)===mi)return;let n=this._$AH,a=e===He&&n!==He||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==He&&(n===He||a);a&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}},qc=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){dn(this,e)}};var Bp=Ro.litHtmlPolyfillSupport;Bp?.(gi,yi),(($c=Ro.litHtmlVersions)!==null&&$c!==void 0?$c:Ro.litHtmlVersions=[]).push("2.8.0");var Gp=(r,e,t)=>{var i,n;let a=(i=t?.renderBefore)!==null&&i!==void 0?i:e,o=a._$litPart$;if(o===void 0){let s=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=o=new yi(e.insertBefore(aa(),s),s,void 0,t??{})}return o._$AI(r),o};var Bc,Vc;var Nr=class extends mr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Gp(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 mi}};Nr.finalized=!0,Nr._$litElement$=!0,(Bc=globalThis.litElementHydrateSupport)===null||Bc===void 0||Bc.call(globalThis,{LitElement:Nr});var Kp=globalThis.litElementPolyfillSupport;Kp?.({LitElement:Nr});((Vc=globalThis.litElementVersions)!==null&&Vc!==void 0?Vc:globalThis.litElementVersions=[]).push("3.3.3");var Zp=r=>e=>typeof e=="function"?((t,i)=>(customElements.define(t,i),i))(r,e):((t,i)=>{let{kind:n,elements:a}=i;return{kind:n,elements:a,finisher(o){customElements.define(t,o)}}})(r,e);var Em=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},xm=(r,e,t)=>{e.constructor.createProperty(t,r)};function pt(r){return(e,t)=>t!==void 0?xm(r,e,t):Em(r,e)}function xe(r){return pt({...r,state:!0})}var Qc,xb=((Qc=window.HTMLSlotElement)===null||Qc===void 0?void 0:Qc.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var zc=function(r,e){return zc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},zc(r,e)};function Re(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");zc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var C=function(){return C=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},C.apply(this,arguments)};function Yt(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function Bt(r,e,t,i){function n(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(u){try{l(i.next(u))}catch(d){o(d)}}function c(u){try{l(i.throw(u))}catch(d){o(d)}}function l(u){u.done?a(u.value):n(u.value).then(s,c)}l((i=i.apply(r,e||[])).next())})}function Vt(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(l){return function(u){return c([l,u])}}function c(l){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,l[0]&&(t=0)),t;)try{if(i=1,n&&(a=l[0]&2?n.return:l[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,l[1])).done)return a;switch(n=0,a&&(l=[l[0]&2,a.value]),l[0]){case 0:case 1:a=l;break;case 4:return t.label++,{value:l[1],done:!1};case 5:t.label++,n=l[1],l=[0];continue;case 7:l=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(l[0]===6||l[0]===2)){t=0;continue}if(l[0]===3&&(!a||l[1]>a[0]&&l[1]<a[3])){t.label=l[1];break}if(l[0]===6&&t.label<a[1]){t.label=a[1],a=l;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(l);break}a[2]&&t.ops.pop(),t.trys.pop();continue}l=e.call(r,t)}catch(u){l=[6,u],n=0}finally{i=a=0}if(l[0]&5)throw l[1];return{value:l[0]?l[1]:void 0,done:!0}}}function Rr(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,a;i<n;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return r.concat(a||Array.prototype.slice.call(e))}var Wc="Invariant Violation",Jp=Object.setPrototypeOf,Am=Jp===void 0?function(r,e){return r.__proto__=e,r}:Jp,J=function(r){Re(e,r);function e(t){t===void 0&&(t=Wc);var i=r.call(this,typeof t=="number"?Wc+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return i.framesToPop=1,i.name=Wc,Am(i,e.prototype),i}return e}(Error);function $(r,e){if(!r)throw new J(e)}var Po=["debug","log","warn","error","silent"],Hc=Po.indexOf("log");function $o(r){return function(){if(Po.indexOf(r)>=Hc){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=$o("debug"),r.log=$o("log"),r.warn=$o("warn"),r.error=$o("error")})($||($={}));function Yp(r){var e=Po[Hc];return Hc=Math.max(0,Po.indexOf(r)),e}function Ge(r){try{return r()}catch{}}var Lo=Ge(function(){return globalThis})||Ge(function(){return window})||Ge(function(){return self})||Ge(function(){return global})||Ge(function(){return Ge.constructor("return this")()});var Xp="__",ef=[Xp,Xp].join("DEV");function km(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Lo,ef,{value:Ge(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Lo[ef]}}var vi=km();function $r(r){try{return r()}catch{}}var Gc=$r(function(){return globalThis})||$r(function(){return window})||$r(function(){return self})||$r(function(){return global})||$r(function(){return $r.constructor("return this")()}),Kc=!1;function Tm(){Gc&&!$r(function(){return"production"})&&!$r(function(){return process})&&(Object.defineProperty(Gc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Kc=!0)}Tm();function Zc(){Kc&&(delete Gc.process,Kc=!1)}var Jb=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",Yb=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",tf=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Me=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 Jc(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Im=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ca=Im;function Fo(r){var e=r.prototype.toJSON;typeof e=="function"||Jc(0),r.prototype.inspect=e,ca&&(r.prototype[ca]=e)}var rf=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();Fo(rf);var nf=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();Fo(nf);function Yc(r){return r!=null&&typeof r.kind=="string"}function Mo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Mo=function(t){return typeof t}:Mo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Mo(r)}var Om=10,af=2;function la(r){return Uo(r,[])}function Uo(r,e){switch(Mo(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Dm(r,e);default:return String(r)}}function Dm(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=$m(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:Uo(n,t)}else if(Array.isArray(r))return Rm(r,t);return Nm(r,t)}function Nm(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>af)return"["+Pm(r)+"]";var i=t.map(function(n){var a=Uo(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function Rm(r,e){if(r.length===0)return"[]";if(e.length>af)return"[Array]";for(var t=Math.min(Om,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(Uo(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function $m(r){var e=r[String(ca)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Pm(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ua(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function of(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Lm(r,e,t){return e&&of(r.prototype,e),t&&of(r,t),r}var jo=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ua(0,"Body must be a string. Received: ".concat(la(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||ua(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ua(0,"column in locationOffset is 1-indexed and must be positive.")}return Lm(r,[{key:tf,get:function(){return"Source"}}]),r}();function sf(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=r.indexOf(`
1
+ var hm=Object.defineProperty;var mm=Object.getOwnPropertyDescriptor;var te=(r,e,t,i)=>{for(var n=i>1?void 0:i?mm(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&hm(e,t,n),n};var re=(r,e,t)=>new Promise((i,n)=>{var a=c=>{try{s(t.next(c))}catch(u){n(u)}},o=c=>{try{s(t.throw(c))}catch(u){n(u)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});import{ZBarSymbolType as me,ZBarConfigType as Dp,scanRGBABuffer as gm,getDefaultScanner as ym}from"https://cdn.jsdelivr.net/npm/@undecaf/zbar-wasm@0.9.15/dist/main.js";function vm(r,e,t,i){return new(t||(t=Promise))(function(n,a){function o(u){try{c(i.next(u))}catch(l){a(l)}}function s(u){try{c(i.throw(u))}catch(l){a(l)}}function c(u){var l;u.done?n(u.value):(l=u.value,l instanceof t?l:new t(function(d){d(l)})).then(o,s)}c((i=i.apply(r,e||[])).next())})}var M=class{constructor(e,t=Dp.ZBAR_CFG_ENABLE,i=1){this.symbolType=e,this.configType=t,this.number=i,this.configSteps=[this]}static register(e,t,i=t.symbolType){return M.formatsToConfigs[e]=t,M.typesToFormats[i]=M.typesToFormats[i]||e,t}static formats(){return Object.keys(M.formatsToConfigs)}static toFormat(e){return M.typesToFormats[e]}static configure(e,t){var i;(i=M.formatsToConfigs[t])===null||i===void 0||i.configSteps.forEach(n=>e.setConfig(n.symbolType,n.configType,n.number))}add(e){return this.configSteps.push(e),this}},Op;M.formatsToConfigs={},M.typesToFormats={},M.register("codabar",new M(me.ZBAR_CODABAR)),M.register("code_39",new M(me.ZBAR_CODE39)),M.register("code_93",new M(me.ZBAR_CODE93)),M.register("code_128",new M(me.ZBAR_CODE128)),M.register("databar",new M(me.ZBAR_DATABAR)),M.register("databar_exp",new M(me.ZBAR_DATABAR_EXP)),M.register("ean_2",new M(me.ZBAR_EAN2)),M.register("ean_5",new M(me.ZBAR_EAN5)),M.register("ean_8",new M(me.ZBAR_EAN8)),M.register("ean_13",new M(me.ZBAR_EAN13)),M.register("ean_13+2",new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN2)),M.register("ean_13+5",new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN5)),M.register("isbn_10",new M(me.ZBAR_ISBN10)).add(new M(me.ZBAR_EAN13)),M.register("isbn_13",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)),M.register("isbn_13+2",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN2)),M.register("isbn_13+5",new M(me.ZBAR_ISBN13)).add(new M(me.ZBAR_EAN13)).add(new M(me.ZBAR_EAN5)),M.register("itf",new M(me.ZBAR_I25)),M.register("qr_code",new M(me.ZBAR_QRCODE)),M.register("sq_code",new M(me.ZBAR_SQCODE)),M.register("upc_a",new M(me.ZBAR_UPCA)).add(new M(me.ZBAR_EAN13)),M.register("upc_e",new M(me.ZBAR_UPCE)).add(new M(me.ZBAR_EAN13)),function(r){r[r.UNKNOWN=-1]="UNKNOWN",r[r.UPRIGHT=0]="UPRIGHT",r[r.ROTATED_RIGHT=1]="ROTATED_RIGHT",r[r.UPSIDE_DOWN=2]="UPSIDE_DOWN",r[r.ROTATED_LEFT=3]="ROTATED_LEFT"}(Op||(Op={}));var kc=class{},bm=(()=>{try{return new OffscreenCanvas(1,1).getContext("2d")instanceof OffscreenCanvasRenderingContext2D}catch{return!1}})(),Dr=class{constructor(e={}){if(e.formats!==void 0){if(!Array.isArray(e.formats)||!e.formats.length)throw new TypeError(`Barcode formats should be a non-empty array of strings but are: ${JSON.stringify(e)}`);let t=e.formats.filter(i=>!M.formats().includes(i));if(t.length)throw new TypeError(`Unsupported barcode format(s): ${t.join(", ")}`)}this.formats=e.formats||M.formats(),this.zbarConfig=e.zbar||new kc}static getSupportedFormats(){return Promise.resolve(M.formats())}detect(e){if(!Dr.isImageBitmapSource(e))throw new TypeError("BarcodeDetector.detect() argument is not an ImageBitmapSource");let t=Dr.intrinsicDimensions(e);if(t.width===0||t.height===0)return Promise.resolve([]);try{return Promise.all([this.toImageData(e),this.getScanner()]).then(i=>{let n=i[0],a=i[1];return this.zbarConfig.enableCache!==void 0&&a.enableCache(this.zbarConfig.enableCache),gm(n.data,n.width,n.height,a)}).then(i=>i.map(n=>this.toBarcodeDetectorResult(n)))}catch(i){return Promise.reject(i)}}getScanner(){return new Promise((e,t)=>vm(this,void 0,void 0,function*(){if(!this.scanner){let i=yield ym();this.formats.length>0&&(i.setConfig(me.ZBAR_NONE,Dp.ZBAR_CFG_ENABLE,0),this.formats.forEach(n=>M.configure(i,n))),this.scanner=i}e(this.scanner)}))}toImageData(e){let t=i=>{let n=Dr.intrinsicDimensions(i);this.canvas&&this.canvas.width===n.width&&this.canvas.height===n.height||(this.canvas=function(s,c){if(bm)return new OffscreenCanvas(s,c);{let u=document.createElement("canvas");return u.width=s,u.height=c,u}}(n.width,n.height));let a=this.canvas,o=a.getContext("2d");return o.drawImage(i,0,0),o.getImageData(0,0,a.width,a.height)};if(e instanceof ImageData)return Promise.resolve(e);if(e instanceof Blob){let i=document.createElement("img");return i.src=URL.createObjectURL(e),i.decode().then(()=>t(i)).finally(()=>URL.revokeObjectURL(i.src))}return e instanceof CanvasRenderingContext2D?Promise.resolve(e.getImageData(0,0,e.canvas.width,e.canvas.height)):Promise.resolve(t(e))}toBarcodeDetectorResult(e){let t={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0};return e.points.forEach(i=>{t.minX=Math.min(t.minX,i.x),t.maxX=Math.max(t.maxX,i.x),t.minY=Math.min(t.minY,i.y),t.maxY=Math.max(t.maxY,i.y)}),{format:M.toFormat(e.type),rawValue:e.decode(this.zbarConfig.encoding),orientation:e.orientation,quality:e.quality,boundingBox:DOMRectReadOnly.fromRect({x:t.minX,y:t.minY,width:t.maxX-t.minX,height:t.maxY-t.minY}),cornerPoints:[{x:t.minX,y:t.minY},{x:t.maxX,y:t.minY},{x:t.maxX,y:t.maxY},{x:t.minX,y:t.maxY}]}}static isImageBitmapSource(e){return e instanceof HTMLImageElement||e instanceof HTMLVideoElement||e instanceof HTMLCanvasElement||e instanceof Blob||e instanceof ImageData||e instanceof CanvasRenderingContext2D||e instanceof ImageBitmap||e&&e.width==0||e&&e.height==0}static intrinsicDimensions(e){return{width:Number(e.naturalWidth||e.videoWidth||e.width),height:Number(e.naturalHeight||e.videoHeight||e.height)}}};var Oo=window,Do=Oo.ShadowRoot&&(Oo.ShadyCSS===void 0||Oo.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Tc=Symbol(),Np=new WeakMap,aa=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==Tc)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(Do&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Np.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Np.set(t,e))}return e}toString(){return this.cssText}},Rp=r=>new aa(typeof r=="string"?r:r+"",void 0,Tc),Ic=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new aa(t,r,Tc)},Oc=(r,e)=>{Do?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),n=Oo.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},No=Do?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Rp(t)})(r):r;var Dc,Ro=window,Pp=Ro.trustedTypes,_m=Pp?Pp.emptyScript:"",$p=Ro.reactiveElementPolyfillSupport,Rc={toAttribute(r,e){switch(e){case Boolean:r=r?_m:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Lp=(r,e)=>e!==r&&(e==e||r==r),Nc={attribute:!0,type:String,converter:Rc,reflect:!1,hasChanged:Lp},Pc="finalized",gr=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,i)=>{let n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=Nc){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Nc}static finalize(){if(this.hasOwnProperty(Pc))return!1;this[Pc]=!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,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)t.unshift(No(n))}else e!==void 0&&t.push(No(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i: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,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.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 Oc(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 i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=Nc){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:Rc).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:Rc;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Lp)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):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,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(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(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),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,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};gr[Pc]=!0,gr.elementProperties=new Map,gr.elementStyles=[],gr.shadowRootOptions={mode:"open"},$p?.({ReactiveElement:gr}),((Dc=Ro.reactiveElementVersions)!==null&&Dc!==void 0?Dc:Ro.reactiveElementVersions=[]).push("1.6.3");var $c,Po=window,dn=Po.trustedTypes,Fp=dn?dn.createPolicy("lit-html",{createHTML:r=>r}):void 0,Fc="$lit$",Nr=`lit$${(Math.random()+"").slice(9)}$`,Qp="?"+Nr,Sm=`<${Qp}>`,mi=document,sa=()=>mi.createComment(""),ca=r=>r===null||typeof r!="object"&&typeof r!="function",zp=Array.isArray,wm=r=>zp(r)||typeof r?.[Symbol.iterator]=="function",Lc=`[
2
+ \f\r]`,oa=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Mp=/-->/g,Up=/>/g,di=RegExp(`>|${Lc}(?:([^\\s"'>=/]+)(${Lc}*=${Lc}*(?:[^
3
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),jp=/'/g,qp=/"/g,Wp=/^(?:script|style|textarea|title)$/i,Hp=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),F=Hp(1),X3=Hp(2),gi=Symbol.for("lit-noChange"),Ge=Symbol.for("lit-nothing"),Bp=new WeakMap,hi=mi.createTreeWalker(mi,129,null,!1);function Gp(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Fp!==void 0?Fp.createHTML(e):e}var Em=(r,e)=>{let t=r.length-1,i=[],n,a=e===2?"<svg>":"",o=oa;for(let s=0;s<t;s++){let c=r[s],u,l,d=-1,f=0;for(;f<c.length&&(o.lastIndex=f,l=o.exec(c),l!==null);)f=o.lastIndex,o===oa?l[1]==="!--"?o=Mp:l[1]!==void 0?o=Up:l[2]!==void 0?(Wp.test(l[2])&&(n=RegExp("</"+l[2],"g")),o=di):l[3]!==void 0&&(o=di):o===di?l[0]===">"?(o=n??oa,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,u=l[1],o=l[3]===void 0?di:l[3]==='"'?qp:jp):o===qp||o===jp?o=di:o===Mp||o===Up?o=oa:(o=di,n=void 0);let p=o===di&&r[s+1].startsWith("/>")?" ":"";a+=o===oa?c+Sm:d>=0?(i.push(u),c.slice(0,d)+Fc+c.slice(d)+Nr+p):c+Nr+(d===-2?(i.push(void 0),s):p)}return[Gp(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),i]},yi=class{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let a=0,o=0,s=e.length-1,c=this.parts,[u,l]=Em(e,t);if(this.el=yi.createElement(u,i),hi.currentNode=this.el.content,t===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(n=hi.nextNode())!==null&&c.length<s;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let f of n.getAttributeNames())if(f.endsWith(Fc)||f.startsWith(Nr)){let p=l[o++];if(d.push(f),p!==void 0){let h=n.getAttribute(p.toLowerCase()+Fc).split(Nr),m=/([.?@])?(.*)/.exec(p);c.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?Uc:m[1]==="?"?jc:m[1]==="@"?qc:mn})}else c.push({type:6,index:a})}for(let f of d)n.removeAttribute(f)}if(Wp.test(n.tagName)){let d=n.textContent.split(Nr),f=d.length-1;if(f>0){n.textContent=dn?dn.emptyScript:"";for(let p=0;p<f;p++)n.append(d[p],sa()),hi.nextNode(),c.push({type:2,index:++a});n.append(d[f],sa())}}}else if(n.nodeType===8)if(n.data===Qp)c.push({type:2,index:a});else{let d=-1;for(;(d=n.data.indexOf(Nr,d+1))!==-1;)c.push({type:7,index:a}),d+=Nr.length-1}a++}}static createElement(e,t){let i=mi.createElement("template");return i.innerHTML=e,i}};function hn(r,e,t=r,i){var n,a,o,s;if(e===gi)return e;let c=i!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[i]:t._$Cl,u=ca(e)?void 0:e._$litDirective$;return c?.constructor!==u&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),u===void 0?c=void 0:(c=new u(r),c._$AT(r,t,i)),i!==void 0?((o=(s=t)._$Co)!==null&&o!==void 0?o:s._$Co=[])[i]=c:t._$Cl=c),c!==void 0&&(e=hn(r,c._$AS(r,e.values),c,i)),e}var Mc=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:i},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:mi).importNode(i,!0);hi.currentNode=a;let o=hi.nextNode(),s=0,c=0,u=n[0];for(;u!==void 0;){if(s===u.index){let l;u.type===2?l=new vi(o,o.nextSibling,this,e):u.type===1?l=new u.ctor(o,u.name,u.strings,this,e):u.type===6&&(l=new Bc(o,this,e)),this._$AV.push(l),u=n[++c]}s!==u?.index&&(o=hi.nextNode(),s++)}return hi.currentNode=mi,a}v(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},vi=class{constructor(e,t,i,n){var a;this.type=2,this._$AH=Ge,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,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=hn(this,e,t),ca(e)?e===Ge||e==null||e===""?(this._$AH!==Ge&&this._$AR(),this._$AH=Ge):e!==this._$AH&&e!==gi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):wm(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!==Ge&&ca(this._$AH)?this._$AA.nextSibling.data=e:this.$(mi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:i,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=yi.createElement(Gp(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(i);else{let o=new Mc(a,this),s=o.u(this.options);o.v(i),this.$(s),this._$AH=o}}_$AC(e){let t=Bp.get(e.strings);return t===void 0&&Bp.set(e.strings,t=new yi(e)),t}T(e){zp(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,n=0;for(let a of e)n===t.length?t.push(i=new vi(this.k(sa()),this.k(sa()),this,this.options)):i=t[n],i._$AI(a),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.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))}},mn=class{constructor(e,t,i,n,a){this.type=1,this._$AH=Ge,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Ge}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){let a=this.strings,o=!1;if(a===void 0)e=hn(this,e,t,0),o=!ca(e)||e!==this._$AH&&e!==gi,o&&(this._$AH=e);else{let s=e,c,u;for(e=a[0],c=0;c<a.length-1;c++)u=hn(this,s[i+c],t,c),u===gi&&(u=this._$AH[c]),o||(o=!ca(u)||u!==this._$AH[c]),u===Ge?e=Ge:e!==Ge&&(e+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!n&&this.j(e)}j(e){e===Ge?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Uc=class extends mn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ge?void 0:e}},Cm=dn?dn.emptyScript:"",jc=class extends mn{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ge?this.element.setAttribute(this.name,Cm):this.element.removeAttribute(this.name)}},qc=class extends mn{constructor(e,t,i,n,a){super(e,t,i,n,a),this.type=5}_$AI(e,t=this){var i;if((e=(i=hn(this,e,t,0))!==null&&i!==void 0?i:Ge)===gi)return;let n=this._$AH,a=e===Ge&&n!==Ge||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==Ge&&(n===Ge||a);a&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}},Bc=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){hn(this,e)}};var Vp=Po.litHtmlPolyfillSupport;Vp?.(yi,vi),(($c=Po.litHtmlVersions)!==null&&$c!==void 0?$c:Po.litHtmlVersions=[]).push("2.8.0");var Kp=(r,e,t)=>{var i,n;let a=(i=t?.renderBefore)!==null&&i!==void 0?i:e,o=a._$litPart$;if(o===void 0){let s=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=o=new vi(e.insertBefore(sa(),s),s,void 0,t??{})}return o._$AI(r),o};var Vc,Qc;var Rr=class extends gr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Kp(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 gi}};Rr.finalized=!0,Rr._$litElement$=!0,(Vc=globalThis.litElementHydrateSupport)===null||Vc===void 0||Vc.call(globalThis,{LitElement:Rr});var Zp=globalThis.litElementPolyfillSupport;Zp?.({LitElement:Rr});((Qc=globalThis.litElementVersions)!==null&&Qc!==void 0?Qc:globalThis.litElementVersions=[]).push("3.3.3");var Jp=r=>e=>typeof e=="function"?((t,i)=>(customElements.define(t,i),i))(r,e):((t,i)=>{let{kind:n,elements:a}=i;return{kind:n,elements:a,finisher(o){customElements.define(t,o)}}})(r,e);var xm=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},Am=(r,e,t)=>{e.constructor.createProperty(t,r)};function ft(r){return(e,t)=>t!==void 0?Am(r,e,t):xm(r,e)}function xe(r){return ft({...r,state:!0})}var zc,Ab=((zc=window.HTMLSlotElement)===null||zc===void 0?void 0:zc.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);var Wc=function(r,e){return Wc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},Wc(r,e)};function Pe(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Wc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var E=function(){return E=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},E.apply(this,arguments)};function Xt(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function Vt(r,e,t,i){function n(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{u(i.next(l))}catch(d){o(d)}}function c(l){try{u(i.throw(l))}catch(d){o(d)}}function u(l){l.done?a(l.value):n(l.value).then(s,c)}u((i=i.apply(r,e||[])).next())})}function Qt(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(t=0)),t;)try{if(i=1,n&&(a=u[0]&2?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(l){u=[6,l],n=0}finally{i=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Pr(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,a;i<n;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return r.concat(a||Array.prototype.slice.call(e))}var Hc="Invariant Violation",Yp=Object.setPrototypeOf,km=Yp===void 0?function(r,e){return r.__proto__=e,r}:Yp,J=function(r){Pe(e,r);function e(t){t===void 0&&(t=Hc);var i=r.call(this,typeof t=="number"?Hc+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return i.framesToPop=1,i.name=Hc,km(i,e.prototype),i}return e}(Error);function P(r,e){if(!r)throw new J(e)}var Lo=["debug","log","warn","error","silent"],Gc=Lo.indexOf("log");function $o(r){return function(){if(Lo.indexOf(r)>=Gc){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=$o("debug"),r.log=$o("log"),r.warn=$o("warn"),r.error=$o("error")})(P||(P={}));function Xp(r){var e=Lo[Gc];return Gc=Math.max(0,Lo.indexOf(r)),e}function Ke(r){try{return r()}catch{}}var Fo=Ke(function(){return globalThis})||Ke(function(){return window})||Ke(function(){return self})||Ke(function(){return global})||Ke(function(){return Ke.constructor("return this")()});var ef="__",tf=[ef,ef].join("DEV");function Tm(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Fo,tf,{value:Ke(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Fo[tf]}}var bi=Tm();function $r(r){try{return r()}catch{}}var Kc=$r(function(){return globalThis})||$r(function(){return window})||$r(function(){return self})||$r(function(){return global})||$r(function(){return $r.constructor("return this")()}),Zc=!1;function Im(){Kc&&!$r(function(){return"production"})&&!$r(function(){return process})&&(Object.defineProperty(Kc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Zc=!0)}Im();function Jc(){Zc&&(delete Kc.process,Zc=!1)}var Yb=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",Xb=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",rf=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Ue=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 Yc(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Om=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,la=Om;function Mo(r){var e=r.prototype.toJSON;typeof e=="function"||Yc(0),r.prototype.inspect=e,la&&(r.prototype[la]=e)}var nf=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();Mo(nf);var af=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();Mo(af);function Xc(r){return r!=null&&typeof r.kind=="string"}function Uo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Uo=function(t){return typeof t}:Uo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Uo(r)}var Dm=10,of=2;function pa(r){return jo(r,[])}function jo(r,e){switch(Uo(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Nm(r,e);default:return String(r)}}function Nm(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=$m(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:jo(n,t)}else if(Array.isArray(r))return Pm(r,t);return Rm(r,t)}function Rm(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>of)return"["+Lm(r)+"]";var i=t.map(function(n){var a=jo(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function Pm(r,e){if(r.length===0)return"[]";if(e.length>of)return"[Array]";for(var t=Math.min(Dm,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(jo(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function $m(r){var e=r[String(la)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Lm(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function fa(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function sf(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Fm(r,e,t){return e&&sf(r.prototype,e),t&&sf(r,t),r}var qo=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||fa(0,"Body must be a string. Received: ".concat(pa(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||fa(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||fa(0,"column in locationOffset is 1-indexed and must be positive.")}return Fm(r,[{key:rf,get:function(){return"Source"}}]),r}();function cf(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=r.indexOf(`
4
4
  `)===-1,n=r[0]===" "||r[0]===" ",a=r[r.length-1]==='"',o=r[r.length-1]==="\\",s=!i||a||o||t,c="";return s&&!(i&&n)&&(c+=`
5
5
  `+e),c+=e?r.replace(/\n/g,`
6
6
  `+e):r,s&&(c+=`
7
- `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var Fm={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},bi=Object.freeze({});function ct(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Fm,i=void 0,n=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,l=void 0,u=void 0,d=[],f=[],p=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(l=f.length===0?void 0:d[d.length-1],c=u,u=f.pop(),m){if(n)c=c.slice();else{for(var v={},w=0,b=Object.keys(c);w<b.length;w++){var S=b[w];v[S]=c[S]}c=v}for(var _=0,T=0;T<s.length;T++){var R=s[T][0],A=s[T][1];n&&(R-=_),n&&A===null?(c.splice(R,1),_++):c[R]=A}}o=i.index,a=i.keys,s=i.edits,n=i.inArray,i=i.prev}else{if(l=u?n?o:a[o]:void 0,c=u?u[l]:p,c==null)continue;u&&d.push(l)}var N=void 0;if(!Array.isArray(c)){if(!Yc(c))throw new Error("Invalid AST Node: ".concat(la(c),"."));var L=Xc(e,c.kind,h);if(L){if(N=L.call(e,c,l,u,d,f),N===bi)break;if(N===!1){if(!h){d.pop();continue}}else if(N!==void 0&&(s.push([l,N]),!h))if(Yc(N))c=N;else{d.pop();continue}}}if(N===void 0&&m&&s.push([l,c]),h)d.pop();else{var P;i={inArray:n,index:o,keys:a,edits:s,prev:i},n=Array.isArray(c),a=n?c:(P=t[c.kind])!==null&&P!==void 0?P:[],o=-1,s=[],u&&f.push(u),u=c}}while(i!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function Xc(r,e,t){var i=r[e];if(i){if(!t&&typeof i=="function")return i;var n=t?i.leave:i.enter;if(typeof n=="function")return n}else{var a=t?r.leave:r.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function mn(r){return ct(r,{leave:Um})}var Mm=80,Um={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return U(e.definitions,`
7
+ `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var Mm={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},_i=Object.freeze({});function lt(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Mm,i=void 0,n=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,d=[],f=[],p=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=f.length===0?void 0:d[d.length-1],c=l,l=f.pop(),m){if(n)c=c.slice();else{for(var y={},w=0,b=Object.keys(c);w<b.length;w++){var S=b[w];y[S]=c[S]}c=y}for(var _=0,T=0;T<s.length;T++){var R=s[T][0],A=s[T][1];n&&(R-=_),n&&A===null?(c.splice(R,1),_++):c[R]=A}}o=i.index,a=i.keys,s=i.edits,n=i.inArray,i=i.prev}else{if(u=l?n?o:a[o]:void 0,c=l?l[u]:p,c==null)continue;l&&d.push(u)}var N=void 0;if(!Array.isArray(c)){if(!Xc(c))throw new Error("Invalid AST Node: ".concat(pa(c),"."));var L=eu(e,c.kind,h);if(L){if(N=L.call(e,c,u,l,d,f),N===_i)break;if(N===!1){if(!h){d.pop();continue}}else if(N!==void 0&&(s.push([u,N]),!h))if(Xc(N))c=N;else{d.pop();continue}}}if(N===void 0&&m&&s.push([u,c]),h)d.pop();else{var $;i={inArray:n,index:o,keys:a,edits:s,prev:i},n=Array.isArray(c),a=n?c:($=t[c.kind])!==null&&$!==void 0?$:[],o=-1,s=[],l&&f.push(l),l=c}}while(i!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function eu(r,e,t){var i=r[e];if(i){if(!t&&typeof i=="function")return i;var n=t?i.leave:i.enter;if(typeof n=="function")return n}else{var a=t?r.leave:r.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function gn(r){return lt(r,{leave:jm})}var Um=80,jm={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return U(e.definitions,`
8
8
 
9
9
  `)+`
10
- `},OperationDefinition:function(e){var t=e.operation,i=e.name,n=Ne("(",U(e.variableDefinitions,", "),")"),a=U(e.directives," "),o=e.selectionSet;return!i&&!a&&!n&&t==="query"?o:U([t,U([i,n]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,i=e.type,n=e.defaultValue,a=e.directives;return t+": "+i+Ne(" = ",n)+Ne(" ",U(a," "))},SelectionSet:function(e){var t=e.selections;return zt(t)},Field:function(e){var t=e.alias,i=e.name,n=e.arguments,a=e.directives,o=e.selectionSet,s=Ne("",t,": ")+i,c=s+Ne("(",U(n,", "),")");return c.length>Mm&&(c=s+Ne(`(
11
- `,qo(U(n,`
10
+ `},OperationDefinition:function(e){var t=e.operation,i=e.name,n=Re("(",U(e.variableDefinitions,", "),")"),a=U(e.directives," "),o=e.selectionSet;return!i&&!a&&!n&&t==="query"?o:U([t,U([i,n]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,i=e.type,n=e.defaultValue,a=e.directives;return t+": "+i+Re(" = ",n)+Re(" ",U(a," "))},SelectionSet:function(e){var t=e.selections;return Wt(t)},Field:function(e){var t=e.alias,i=e.name,n=e.arguments,a=e.directives,o=e.selectionSet,s=Re("",t,": ")+i,c=s+Re("(",U(n,", "),")");return c.length>Um&&(c=s+Re(`(
11
+ `,Bo(U(n,`
12
12
  `)),`
13
- )`)),U([c,U(a," "),o]," ")},Argument:function(e){var t=e.name,i=e.value;return t+": "+i},FragmentSpread:function(e){var t=e.name,i=e.directives;return"..."+t+Ne(" ",U(i," "))},InlineFragment:function(e){var t=e.typeCondition,i=e.directives,n=e.selectionSet;return U(["...",Ne("on ",t),U(i," "),n]," ")},FragmentDefinition:function(e){var t=e.name,i=e.typeCondition,n=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Ne("(",U(n,", "),")")," ")+"on ".concat(i," ").concat(Ne("",U(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var i=e.value,n=e.block;return n?sf(i,t==="description"?"":" "):JSON.stringify(i)},BooleanValue:function(e){var t=e.value;return t?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var t=e.value;return t},ListValue:function(e){var t=e.values;return"["+U(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+U(t,", ")+"}"},ObjectField:function(e){var t=e.name,i=e.value;return t+": "+i},Directive:function(e){var t=e.name,i=e.arguments;return"@"+t+Ne("(",U(i,", "),")")},NamedType:function(e){var t=e.name;return t},ListType:function(e){var t=e.type;return"["+t+"]"},NonNullType:function(e){var t=e.type;return t+"!"},SchemaDefinition:Qt(function(r){var e=r.directives,t=r.operationTypes;return U(["schema",U(e," "),zt(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,i=e.type;return t+": "+i},ScalarTypeDefinition:Qt(function(r){var e=r.name,t=r.directives;return U(["scalar",e,U(t," ")]," ")}),ObjectTypeDefinition:Qt(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return U(["type",e,Ne("implements ",U(t," & ")),U(i," "),zt(n)]," ")}),FieldDefinition:Qt(function(r){var e=r.name,t=r.arguments,i=r.type,n=r.directives;return e+(cf(t)?Ne(`(
14
- `,qo(U(t,`
13
+ )`)),U([c,U(a," "),o]," ")},Argument:function(e){var t=e.name,i=e.value;return t+": "+i},FragmentSpread:function(e){var t=e.name,i=e.directives;return"..."+t+Re(" ",U(i," "))},InlineFragment:function(e){var t=e.typeCondition,i=e.directives,n=e.selectionSet;return U(["...",Re("on ",t),U(i," "),n]," ")},FragmentDefinition:function(e){var t=e.name,i=e.typeCondition,n=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Re("(",U(n,", "),")")," ")+"on ".concat(i," ").concat(Re("",U(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var i=e.value,n=e.block;return n?cf(i,t==="description"?"":" "):JSON.stringify(i)},BooleanValue:function(e){var t=e.value;return t?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var t=e.value;return t},ListValue:function(e){var t=e.values;return"["+U(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+U(t,", ")+"}"},ObjectField:function(e){var t=e.name,i=e.value;return t+": "+i},Directive:function(e){var t=e.name,i=e.arguments;return"@"+t+Re("(",U(i,", "),")")},NamedType:function(e){var t=e.name;return t},ListType:function(e){var t=e.type;return"["+t+"]"},NonNullType:function(e){var t=e.type;return t+"!"},SchemaDefinition:zt(function(r){var e=r.directives,t=r.operationTypes;return U(["schema",U(e," "),Wt(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,i=e.type;return t+": "+i},ScalarTypeDefinition:zt(function(r){var e=r.name,t=r.directives;return U(["scalar",e,U(t," ")]," ")}),ObjectTypeDefinition:zt(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return U(["type",e,Re("implements ",U(t," & ")),U(i," "),Wt(n)]," ")}),FieldDefinition:zt(function(r){var e=r.name,t=r.arguments,i=r.type,n=r.directives;return e+(uf(t)?Re(`(
14
+ `,Bo(U(t,`
15
15
  `)),`
16
- )`):Ne("(",U(t,", "),")"))+": "+i+Ne(" ",U(n," "))}),InputValueDefinition:Qt(function(r){var e=r.name,t=r.type,i=r.defaultValue,n=r.directives;return U([e+": "+t,Ne("= ",i),U(n," ")]," ")}),InterfaceTypeDefinition:Qt(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return U(["interface",e,Ne("implements ",U(t," & ")),U(i," "),zt(n)]," ")}),UnionTypeDefinition:Qt(function(r){var e=r.name,t=r.directives,i=r.types;return U(["union",e,U(t," "),i&&i.length!==0?"= "+U(i," | "):""]," ")}),EnumTypeDefinition:Qt(function(r){var e=r.name,t=r.directives,i=r.values;return U(["enum",e,U(t," "),zt(i)]," ")}),EnumValueDefinition:Qt(function(r){var e=r.name,t=r.directives;return U([e,U(t," ")]," ")}),InputObjectTypeDefinition:Qt(function(r){var e=r.name,t=r.directives,i=r.fields;return U(["input",e,U(t," "),zt(i)]," ")}),DirectiveDefinition:Qt(function(r){var e=r.name,t=r.arguments,i=r.repeatable,n=r.locations;return"directive @"+e+(cf(t)?Ne(`(
17
- `,qo(U(t,`
16
+ )`):Re("(",U(t,", "),")"))+": "+i+Re(" ",U(n," "))}),InputValueDefinition:zt(function(r){var e=r.name,t=r.type,i=r.defaultValue,n=r.directives;return U([e+": "+t,Re("= ",i),U(n," ")]," ")}),InterfaceTypeDefinition:zt(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return U(["interface",e,Re("implements ",U(t," & ")),U(i," "),Wt(n)]," ")}),UnionTypeDefinition:zt(function(r){var e=r.name,t=r.directives,i=r.types;return U(["union",e,U(t," "),i&&i.length!==0?"= "+U(i," | "):""]," ")}),EnumTypeDefinition:zt(function(r){var e=r.name,t=r.directives,i=r.values;return U(["enum",e,U(t," "),Wt(i)]," ")}),EnumValueDefinition:zt(function(r){var e=r.name,t=r.directives;return U([e,U(t," ")]," ")}),InputObjectTypeDefinition:zt(function(r){var e=r.name,t=r.directives,i=r.fields;return U(["input",e,U(t," "),Wt(i)]," ")}),DirectiveDefinition:zt(function(r){var e=r.name,t=r.arguments,i=r.repeatable,n=r.locations;return"directive @"+e+(uf(t)?Re(`(
17
+ `,Bo(U(t,`
18
18
  `)),`
19
- )`):Ne("(",U(t,", "),")"))+(i?" repeatable":"")+" on "+U(n," | ")}),SchemaExtension:function(e){var t=e.directives,i=e.operationTypes;return U(["extend schema",U(t," "),zt(i)]," ")},ScalarTypeExtension:function(e){var t=e.name,i=e.directives;return U(["extend scalar",t,U(i," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return U(["extend type",t,Ne("implements ",U(i," & ")),U(n," "),zt(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return U(["extend interface",t,Ne("implements ",U(i," & ")),U(n," "),zt(a)]," ")},UnionTypeExtension:function(e){var t=e.name,i=e.directives,n=e.types;return U(["extend union",t,U(i," "),n&&n.length!==0?"= "+U(n," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,i=e.directives,n=e.values;return U(["extend enum",t,U(i," "),zt(n)]," ")},InputObjectTypeExtension:function(e){var t=e.name,i=e.directives,n=e.fields;return U(["extend input",t,U(i," "),zt(n)]," ")}};function Qt(r){return function(e){return U([e.description,r(e)],`
20
- `)}}function U(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(i){return i}).join(t))!==null&&e!==void 0?e:""}function zt(r){return Ne(`{
21
- `,qo(U(r,`
19
+ )`):Re("(",U(t,", "),")"))+(i?" repeatable":"")+" on "+U(n," | ")}),SchemaExtension:function(e){var t=e.directives,i=e.operationTypes;return U(["extend schema",U(t," "),Wt(i)]," ")},ScalarTypeExtension:function(e){var t=e.name,i=e.directives;return U(["extend scalar",t,U(i," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return U(["extend type",t,Re("implements ",U(i," & ")),U(n," "),Wt(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return U(["extend interface",t,Re("implements ",U(i," & ")),U(n," "),Wt(a)]," ")},UnionTypeExtension:function(e){var t=e.name,i=e.directives,n=e.types;return U(["extend union",t,U(i," "),n&&n.length!==0?"= "+U(n," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,i=e.directives,n=e.values;return U(["extend enum",t,U(i," "),Wt(n)]," ")},InputObjectTypeExtension:function(e){var t=e.name,i=e.directives,n=e.fields;return U(["extend input",t,U(i," "),Wt(n)]," ")}};function zt(r){return function(e){return U([e.description,r(e)],`
20
+ `)}}function U(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(i){return i}).join(t))!==null&&e!==void 0?e:""}function Wt(r){return Re(`{
21
+ `,Bo(U(r,`
22
22
  `)),`
23
- }`)}function Ne(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function qo(r){return Ne(" ",r.replace(/\n/g,`
24
- `))}function jm(r){return r.indexOf(`
25
- `)!==-1}function cf(r){return r!=null&&r.some(jm)}function pa(r){return r.kind===Me.FIELD||r.kind===Me.FRAGMENT_SPREAD||r.kind===Me.INLINE_FRAGMENT}function lf(){return typeof jo=="function"?Zc():Zc()}function Zm(){__DEV__?$(typeof vi=="boolean",vi):$(typeof vi=="boolean",39)}lf();Zm();function gr(r,e){var t=r.directives;return!t||!t.length?!0:uf(t).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?$(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):$(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function gn(r,e,t){var i=new Set(r),n=i.size;return ct(e,{Directive:function(a){if(i.delete(a.name.value)&&(!t||!i.size))return bi}}),t?!i.size:i.size<n}function el(r){return r&&gn(["client","export"],r,!0)}function Jm(r){var e=r.name.value;return e==="skip"||e==="include"}function uf(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Jm(t)){var i=t.arguments,n=t.name.value;__DEV__?$(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):$(i&&i.length===1,41);var a=i[0];__DEV__?$(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," directive.")):$(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?$(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(n," directive must be a variable or a boolean value.")):$(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function tl(r,e){var t=e,i=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new J("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new J(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof t>"u"&&(__DEV__?$(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):$(i.length===1,45),t=i[0].name.value);var n=C(C({},r),{definitions:Rr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return n}function _i(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function Si(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var i=e&&e[t];return __DEV__?$(i,"No fragment named ".concat(t)):$(i,46),i||null}default:return null}}function pe(r){return r!==null&&typeof r=="object"}function Xt(r){return{__ref:String(r)}}function oe(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function rl(r){return pe(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Ym(r){return r.kind==="StringValue"}function Xm(r){return r.kind==="BooleanValue"}function eg(r){return r.kind==="IntValue"}function tg(r){return r.kind==="FloatValue"}function rg(r){return r.kind==="Variable"}function ig(r){return r.kind==="ObjectValue"}function ng(r){return r.kind==="ListValue"}function ag(r){return r.kind==="EnumValue"}function og(r){return r.kind==="NullValue"}function Pr(r,e,t,i){if(eg(t)||tg(t))r[e.value]=Number(t.value);else if(Xm(t)||Ym(t))r[e.value]=t.value;else if(ig(t)){var n={};t.fields.map(function(o){return Pr(n,o.name,o.value,i)}),r[e.value]=n}else if(rg(t)){var a=(i||{})[t.name.value];r[e.value]=a}else if(ng(t))r[e.value]=t.values.map(function(o){var s={};return Pr(s,e,o,i),s[e.value]});else if(ag(t))r[e.value]=t.value;else if(og(t))r[e.value]=null;else throw __DEV__?new J('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new J(55)}function il(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(n){t[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Pr(t[n.name.value],o,s,e)})}));var i=null;return r.arguments&&r.arguments.length&&(i={},r.arguments.forEach(function(n){var a=n.name,o=n.value;return Pr(i,a,o,e)})),da(r.name.value,i,t)}var sg=["connection","include","skip","client","rest","export"],da=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(t.connection.key,"(").concat(fa(n),")")}else return t.connection.key;var a=r;if(e){var o=fa(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){sg.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(fa(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=fa;return fa=r,e}}),fa=function(e){return JSON.stringify(e,cg)};function cg(r,e){return pe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})),e}function yr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(i){var n=i.name,a=i.value;return Pr(t,n,a,e)}),t}return null}function Rt(r){return r.alias?r.alias.value:r.name.value}function ha(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(Et(a)){if(a.name.value==="__typename")return r[Rt(a)]}else{var o=ha(r,Si(a,t).selectionSet,t);if(typeof o=="string")return o}}}function Et(r){return r.kind==="Field"}function nl(r){return r.kind==="InlineFragment"}function yn(r){__DEV__?$(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):$(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new J('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new J(48);return t});return __DEV__?$(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):$(e.length<=1,49),r}function er(r){return yn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function vn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function wi(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function ma(r){var e=er(r);return __DEV__?$(e&&e.operation==="query","Must contain a query definition."):$(e&&e.operation==="query",50),e}function al(r){__DEV__?$(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):$(r.kind==="Document",51),__DEV__?$(r.definitions.length<=1,"Fragment must have exactly one definition."):$(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?$(e.kind==="FragmentDefinition","Must be a fragment definition."):$(e.kind==="FragmentDefinition",53),e}function Ci(r){yn(r);for(var e,t=0,i=r.definitions;t<i.length;t++){var n=i[t];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new J("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new J(54)}function Ei(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(i){i.defaultValue&&Pr(e,i.variable.name,i.defaultValue)}),e}var we=Array.isArray;function qe(r){return Array.isArray(r)&&r.length>0}var pf={kind:Me.FIELD,name:{kind:Me.NAME,value:"__typename"}};function df(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Me.FRAGMENT_SPREAD&&df(e[t.name.value],e)})}function lg(r){return df(er(r)||al(r),_i(wi(r)))?null:r}function ug(r){var e=new Set,t=[];return r.forEach(function(i){i.name?e.add(i.name):i.test&&t.push(i.test)}),function(i){return e.has(i.name.value)||t.some(function(n){return n(i)})}}function ff(r){var e=new Map;return function(i){i===void 0&&(i=r);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function ol(r,e){for(var t=ff(""),i=ff(""),n=function(b){for(var S=0,_=void 0;S<b.length&&(_=b[S]);++S)if(!we(_)){if(_.kind===Me.OPERATION_DEFINITION)return t(_.name&&_.name.value);if(_.kind===Me.FRAGMENT_DEFINITION)return i(_.name.value)}return __DEV__&&$.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Me.OPERATION_DEFINITION&&++a;var s=ug(r),c=r.some(function(b){return b.remove}),l=function(b){return c&&b&&b.some(s)},u=new Map,d=!1,f={enter:function(b){if(l(b.directives))return d=!0,null}},p=ct(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(b,S,_,T,R){var A=n(R);A&&A.variables.add(b.name.value)}},FragmentSpread:{enter:function(b,S,_,T,R){if(l(b.directives))return d=!0,null;var A=n(R);A&&A.fragmentSpreads.add(b.name.value)}},FragmentDefinition:{enter:function(b,S,_,T){u.set(JSON.stringify(T),b)},leave:function(b,S,_,T){var R=u.get(JSON.stringify(T));if(b===R)return b;if(a>0&&b.selectionSet.selections.every(function(A){return A.kind===Me.FIELD&&A.name.value==="__typename"}))return i(b.name.value).removed=!0,d=!0,null}},Directive:{leave:function(b){if(s(b))return d=!0,null}}});if(!d)return e;var h=function(b){return b.transitiveVars||(b.transitiveVars=new Set(b.variables),b.removed||b.fragmentSpreads.forEach(function(S){h(i(S)).transitiveVars.forEach(function(_){b.transitiveVars.add(_)})})),b},m=new Set;p.definitions.forEach(function(b){b.kind===Me.OPERATION_DEFINITION?h(t(b.name&&b.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):b.kind===Me.FRAGMENT_DEFINITION&&a===0&&!i(b.name.value).removed&&m.add(b.name.value)}),m.forEach(function(b){h(i(b)).fragmentSpreads.forEach(function(S){m.add(S)})});var v=function(b){return!!(!m.has(b)||i(b).removed)},w={enter:function(b){if(v(b.name.value))return null}};return lg(ct(p,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(b){if(b.variableDefinitions){var S=h(t(b.name&&b.name.value)).transitiveVars;if(S.size<b.variableDefinitions.length)return C(C({},b),{variableDefinitions:b.variableDefinitions.filter(function(_){return S.has(_.variable.name.value)})})}}}}))}var xi=Object.assign(function(r){return ct(r,{SelectionSet:{enter:function(e,t,i){if(!(i&&i.kind===Me.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return Et(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(Et(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return C(C({},e),{selections:Rr(Rr([],n,!0),[pf],!1)})}}}}}})},{added:function(r){return r===pf}}),pg={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&$.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function sl(r){return ol([pg],yn(r))}function cl(r){var e=Ci(r),t=e.operation;if(t==="query")return r;var i=ct(r,{OperationDefinition:{enter:function(n){return C(C({},n),{operation:"query"})}}});return i}function ll(r){yn(r);var e=ol([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var fg=Object.prototype.hasOwnProperty;function ul(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ga(r)}function ga(r){var e=r[0]||{},t=r.length;if(t>1)for(var i=new yt,n=1;n<t;++n)e=i.merge(e,r[n]);return e}var dg=function(r,e,t){return this.merge(r[t],e[t])},yt=function(){function r(e){e===void 0&&(e=dg),this.reconciler=e,this.isObject=pe,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return pe(t)&&pe(e)?(Object.keys(t).forEach(function(o){if(fg.call(e,o)){var s=e[o];if(t[o]!==s){var c=i.reconciler.apply(i,Rr([e,t,o],n,!1));c!==s&&(e=i.shallowCopyForMerge(e),e[o]=c)}}else e=i.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return pe(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=C({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function hg(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=mg(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
26
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function mg(r,e){if(!!r){if(typeof r=="string")return hf(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return hf(r,e)}}function hf(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function mf(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function hl(r,e,t){return e&&mf(r.prototype,e),t&&mf(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var ml=function(){return typeof Symbol=="function"},gl=function(r){return ml()&&Boolean(Symbol[r])},yl=function(r){return gl(r)?Symbol[r]:"@@"+r};ml()&&!gl("observable")&&(Symbol.observable=Symbol("observable"));var gg=yl("iterator"),fl=yl("observable"),gf=yl("species");function Vo(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function ya(r){var e=r.constructor;return e!==void 0&&(e=e[gf],e===null&&(e=void 0)),e!==void 0?e:ae}function yg(r){return r instanceof ae}function bn(r){bn.log?bn.log(r):setTimeout(function(){throw r})}function Bo(r){Promise.resolve().then(function(){try{r()}catch(e){bn(e)}})}function yf(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Vo(e,"unsubscribe");t&&t.call(e)}}catch(i){bn(i)}}function dl(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function vg(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(vf(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function vf(r,e,t){r._state="running";var i=r._observer;try{var n=Vo(i,e);switch(e){case"next":n&&n.call(i,t);break;case"error":if(dl(r),n)n.call(i,t);else throw t;break;case"complete":dl(r),n&&n.call(i);break}}catch(a){bn(a)}r._state==="closed"?yf(r):r._state==="running"&&(r._state="ready")}function pl(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],Bo(function(){return vg(r)});return}vf(r,e,t)}}var bg=function(){function r(t,i){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var n=new _g(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(dl(this),yf(this))},hl(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),_g=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(i){pl(this._subscription,"next",i)},e.error=function(i){pl(this._subscription,"error",i)},e.complete=function(){pl(this._subscription,"complete")},hl(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ae=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new bg(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=n.subscribe({next:function(l){try{i(l,s)}catch(u){o(u),c.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this),o=arguments.length>1,s=!1,c=arguments[1],l=c;return new a(function(u){return n.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{l=i(l,d)}catch(p){return u.error(p)}else l=d},error:function(d){u.error(d)},complete:function(){if(!s&&!o)return u.error(new TypeError("Cannot reduce an empty sequence"));u.next(l),u.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=ya(this);return new s(function(c){var l,u=0;function d(f){l=f.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){u===a.length?(l=void 0,c.complete()):d(s.from(a[u++]))}})}return d(i),function(){l&&(l.unsubscribe(),l=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ya(this);return new a(function(o){var s=[],c=n.subscribe({next:function(u){if(i)try{u=i(u)}catch(f){return o.error(f)}var d=a.from(u).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),l()}});s.push(d)},error:function(u){o.error(u)},complete:function(){l()}});function l(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(u){return u.unsubscribe()}),c.unsubscribe()}})},e[fl]=function(){return this},r.from=function(i){var n=typeof this=="function"?this:r;if(i==null)throw new TypeError(i+" is not an object");var a=Vo(i,fl);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return yg(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(gl("iterator")&&(a=Vo(i,gg),a))return new n(function(s){Bo(function(){if(!s.closed){for(var c=hg(a.call(i)),l;!(l=c()).done;){var u=l.value;if(s.next(u),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){Bo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},r.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){Bo(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})})},hl(r,null,[{key:gf,get:function(){return this}}]),r}();ml()&&Object.defineProperty(ae,Symbol("extensions"),{value:{symbol:fl,hostReportError:bn},configurable:!0});function vl(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var _n;typeof self<"u"?_n=self:typeof window<"u"?_n=window:typeof global<"u"?_n=global:typeof module<"u"?_n=module:_n=Function("return this")();var x4=vl(_n);var bf=ae.prototype,_f="@@observable";bf[_f]||(bf[_f]=function(){return this});var Sg=Object.prototype.toString;function Qo(r){return bl(r)}function bl(r,e){switch(Sg.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(n,a){t[a]=bl(n,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var i=Object.create(Object.getPrototypeOf(r));return e.set(r,i),Object.keys(r).forEach(function(n){i[n]=bl(r[n],e)}),i}default:return r}}function wg(r){var e=new Set([r]);return e.forEach(function(t){pe(t)&&Cg(t)===t&&Object.getOwnPropertyNames(t).forEach(function(i){pe(t[i])&&e.add(t[i])})}),r}function Cg(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function va(r){return __DEV__&&wg(r),r}function Ai(r,e,t){var i=[];r.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](t)})}function zo(r,e,t){return new ae(function(i){var n=i.next,a=i.error,o=i.complete,s=0,c=!1,l={then:function(p){return new Promise(function(h){return h(p())})}};function u(p,h){return p?function(m){++s;var v=function(){return p(m)};l=l.then(v,v).then(function(w){--s,n&&n.call(i,w),c&&d.complete()},function(w){throw--s,w}).catch(function(w){a&&a.call(i,w)})}:function(m){return h&&h.call(i,m)}}var d={next:u(e,n),error:u(t,a),complete:function(){c=!0,s||o&&o.call(i)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var $t=typeof WeakMap=="function"&&Ge(function(){return navigator.product})!=="ReactNative",Sf=typeof WeakSet=="function",_l=typeof Symbol=="function"&&typeof Symbol.for=="function",Lr=_l&&Symbol.asyncIterator,M4=typeof Ge(function(){return window.document.createElement})=="function",U4=Ge(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Wo(r){function e(t){Object.defineProperty(r,t,{value:ae})}return _l&&Symbol.species&&e(Symbol.species),e("@@species"),r}function wf(r){return r&&typeof r.then=="function"}var Sn=function(r){Re(e,r);function e(t){var i=r.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),Ai(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),Ai(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?wf(c)?c.then(function(l){return i.sub=l.subscribe(i.handlers)}):i.sub=c.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),Ai(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof t=="function"&&(t=[new ae(t)]),wf(t)?t.then(function(n){return i.start(n)},i.handlers.error):i.start(t),i}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var i=this.latest[0],n=t[i];n&&n.call(t,this.latest[1]),this.sub===null&&i==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(t,i)}))},e.prototype.beforeNext=function(t){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,t(n,a))})},e}(ae);Wo(Sn);function Fr(r){return"incremental"in r}function Eg(r){return"hasNext"in r&&"data"in r}function Cf(r){return Fr(r)||Eg(r)}function Ho(r,e){var t=r,i=new yt;return Fr(e)&&qe(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var c=o[s],l=!isNaN(+c),u=l?[]:{};u[c]=a,a=u}t=i.merge(t,a)}),t}function wn(r){var e=Go(r);return qe(e)}function Go(r){var e=qe(r.errors)?r.errors.slice(0):[];return Fr(r)&&qe(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Mr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(t[n]=a)})}),t}var Ef=new Map;function ba(r){var e=Ef.get(r)||1;return Ef.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function xf(r){var e=ba("stringifyForDisplay");return JSON.stringify(r,function(t,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function _a(r,e){return Mr(r,e,e.variables&&{variables:C(C({},r&&r.variables),e.variables)})}function Ko(r){return new ae(function(e){e.error(r)})}var Sa=function(r,e,t){var i=new Error(t);throw i.name="ServerError",i.response=r,i.statusCode=r.status,i.result=e,i};function Sl(r){for(var e=["query","operationName","variables","extensions","context"],t=0,i=Object.keys(r);t<i.length;t++){var n=i[t];if(e.indexOf(n)<0)throw __DEV__?new J("illegal argument: ".concat(n)):new J(27)}return r}function wl(r,e){var t=C({},r),i=function(a){typeof a=="function"?t=C(C({},t),a(t)):t=C(C({},t),a)},n=function(){return C({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function Cl(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?vn(e.query)||void 0:""),e}function Af(r,e){return e?e(r):ae.of()}function wa(r){return typeof r=="function"?new Pt(r):r}function Zo(r){return r.request.length<=1}var xg=function(r){Re(e,r);function e(t,i){var n=r.call(this,t)||this;return n.link=i,n}return e}(Error),Pt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return ae.of()})},r.from=function(e){return e.length===0?r.empty():e.map(wa).reduce(function(t,i){return t.concat(i)})},r.split=function(e,t,i){var n=wa(t),a=wa(i||new r(Af));return Zo(n)&&Zo(a)?new r(function(o){return e(o)?n.request(o)||ae.of():a.request(o)||ae.of()}):new r(function(o,s){return e(o)?n.request(o,s)||ae.of():a.request(o,s)||ae.of()})},r.execute=function(e,t){return e.request(wl(t.context,Cl(Sl(t))))||ae.of()},r.concat=function(e,t){var i=wa(e);if(Zo(i))return __DEV__&&$.warn(new xg("You are calling concat on a terminating link, which will have no effect",i)),i;var n=wa(t);return Zo(n)?new r(function(a){return i.request(a,function(o){return n.request(o)||ae.of()})||ae.of()}):new r(function(a,o){return i.request(a,function(s){return n.request(s,o)||ae.of()})||ae.of()})},r.prototype.split=function(e,t,i){return this.concat(r.split(e,t,i||new r(Af)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new J("request is not implemented"):new J(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var Cn=Pt.execute;var kf="3.7.10";function Tf(r){return!!r.body}function If(r){return!!r.getReader}function Of(r){return!!(Lr&&r[Symbol.asyncIterator])}function Df(r){return!!r.stream}function Nf(r){return!!r.arrayBuffer}function Rf(r){return!!r.pipe}function El(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function xl(r){var e=null,t=null,i=!1,n=[],a=[];function o(d){if(!t){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}n.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){i=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function l(){return new Promise(function(d,f){if(t)return f(t);if(n.length)return d({value:n.shift(),done:!1});if(i)return d({value:void 0,done:!0});a.push([d,f])})}var u={next:function(){return l()}};return Lr&&(u[Symbol.asyncIterator]=function(){return this}),u}function Al(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){r.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return Lr&&(t[Symbol.asyncIterator]=function(){return this}),t}function Jo(r){var e={next:function(){return r.read()}};return Lr&&(e[Symbol.asyncIterator]=function(){return this}),e}function $f(r){var e=r;if(Tf(r)&&(e=r.body),Of(e))return El(e);if(If(e))return Jo(e.getReader());if(Df(e))return Jo(e.stream().getReader());if(Nf(e))return Al(e.arrayBuffer());if(Rf(e))return xl(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Pf=Object.prototype.hasOwnProperty;function Lf(r,e){var t,i,n;return Bt(this,void 0,void 0,function(){var a,o,s,c,l,u,d,f,p,h,m,v,w,b,S,_,T,R,A,N;return Vt(this,function(L){switch(L.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",l="--".concat(c),u="",d=$f(r),f=!0,L.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=L.sent(),h=p.value,m=p.done,v=typeof h=="string"?h:a.decode(h),f=!m,u+=v,w=u.indexOf(l);w>-1;){if(b=void 0,N=[u.slice(0,w),u.slice(w+l.length)],b=N[0],u=N[1],b.trim()){if(S=b.indexOf(`\r
23
+ }`)}function Re(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function Bo(r){return Re(" ",r.replace(/\n/g,`
24
+ `))}function qm(r){return r.indexOf(`
25
+ `)!==-1}function uf(r){return r!=null&&r.some(qm)}function da(r){return r.kind===Ue.FIELD||r.kind===Ue.FRAGMENT_SPREAD||r.kind===Ue.INLINE_FRAGMENT}function lf(){return typeof qo=="function"?Jc():Jc()}function Jm(){__DEV__?P(typeof bi=="boolean",bi):P(typeof bi=="boolean",39)}lf();Jm();function yr(r,e){var t=r.directives;return!t||!t.length?!0:pf(t).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?P(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):P(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function yn(r,e,t){var i=new Set(r),n=i.size;return lt(e,{Directive:function(a){if(i.delete(a.name.value)&&(!t||!i.size))return _i}}),t?!i.size:i.size<n}function tu(r){return r&&yn(["client","export"],r,!0)}function Ym(r){var e=r.name.value;return e==="skip"||e==="include"}function pf(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Ym(t)){var i=t.arguments,n=t.name.value;__DEV__?P(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):P(i&&i.length===1,41);var a=i[0];__DEV__?P(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," directive.")):P(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?P(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(n," directive must be a variable or a boolean value.")):P(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function ru(r,e){var t=e,i=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new J("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new J(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof t>"u"&&(__DEV__?P(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):P(i.length===1,45),t=i[0].name.value);var n=E(E({},r),{definitions:Pr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return n}function Si(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function wi(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var i=e&&e[t];return __DEV__?P(i,"No fragment named ".concat(t)):P(i,46),i||null}default:return null}}function pe(r){return r!==null&&typeof r=="object"}function er(r){return{__ref:String(r)}}function oe(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function iu(r){return pe(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Xm(r){return r.kind==="StringValue"}function eg(r){return r.kind==="BooleanValue"}function tg(r){return r.kind==="IntValue"}function rg(r){return r.kind==="FloatValue"}function ig(r){return r.kind==="Variable"}function ng(r){return r.kind==="ObjectValue"}function ag(r){return r.kind==="ListValue"}function og(r){return r.kind==="EnumValue"}function sg(r){return r.kind==="NullValue"}function Lr(r,e,t,i){if(tg(t)||rg(t))r[e.value]=Number(t.value);else if(eg(t)||Xm(t))r[e.value]=t.value;else if(ng(t)){var n={};t.fields.map(function(o){return Lr(n,o.name,o.value,i)}),r[e.value]=n}else if(ig(t)){var a=(i||{})[t.name.value];r[e.value]=a}else if(ag(t))r[e.value]=t.values.map(function(o){var s={};return Lr(s,e,o,i),s[e.value]});else if(og(t))r[e.value]=t.value;else if(sg(t))r[e.value]=null;else throw __DEV__?new J('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new J(55)}function nu(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(n){t[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Lr(t[n.name.value],o,s,e)})}));var i=null;return r.arguments&&r.arguments.length&&(i={},r.arguments.forEach(function(n){var a=n.name,o=n.value;return Lr(i,a,o,e)})),ma(r.name.value,i,t)}var cg=["connection","include","skip","client","rest","export"],ma=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(t.connection.key,"(").concat(ha(n),")")}else return t.connection.key;var a=r;if(e){var o=ha(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){cg.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(ha(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=ha;return ha=r,e}}),ha=function(e){return JSON.stringify(e,ug)};function ug(r,e){return pe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})),e}function vr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(i){var n=i.name,a=i.value;return Lr(t,n,a,e)}),t}return null}function Pt(r){return r.alias?r.alias.value:r.name.value}function ga(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(xt(a)){if(a.name.value==="__typename")return r[Pt(a)]}else{var o=ga(r,wi(a,t).selectionSet,t);if(typeof o=="string")return o}}}function xt(r){return r.kind==="Field"}function au(r){return r.kind==="InlineFragment"}function vn(r){__DEV__?P(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):P(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new J('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new J(48);return t});return __DEV__?P(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):P(e.length<=1,49),r}function tr(r){return vn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function bn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Ei(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function ya(r){var e=tr(r);return __DEV__?P(e&&e.operation==="query","Must contain a query definition."):P(e&&e.operation==="query",50),e}function ou(r){__DEV__?P(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):P(r.kind==="Document",51),__DEV__?P(r.definitions.length<=1,"Fragment must have exactly one definition."):P(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?P(e.kind==="FragmentDefinition","Must be a fragment definition."):P(e.kind==="FragmentDefinition",53),e}function Ci(r){vn(r);for(var e,t=0,i=r.definitions;t<i.length;t++){var n=i[t];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new J("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new J(54)}function xi(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(i){i.defaultValue&&Lr(e,i.variable.name,i.defaultValue)}),e}var we=Array.isArray;function Be(r){return Array.isArray(r)&&r.length>0}var ff={kind:Ue.FIELD,name:{kind:Ue.NAME,value:"__typename"}};function hf(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Ue.FRAGMENT_SPREAD&&hf(e[t.name.value],e)})}function lg(r){return hf(tr(r)||ou(r),Si(Ei(r)))?null:r}function pg(r){var e=new Set,t=[];return r.forEach(function(i){i.name?e.add(i.name):i.test&&t.push(i.test)}),function(i){return e.has(i.name.value)||t.some(function(n){return n(i)})}}function df(r){var e=new Map;return function(i){i===void 0&&(i=r);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function su(r,e){for(var t=df(""),i=df(""),n=function(b){for(var S=0,_=void 0;S<b.length&&(_=b[S]);++S)if(!we(_)){if(_.kind===Ue.OPERATION_DEFINITION)return t(_.name&&_.name.value);if(_.kind===Ue.FRAGMENT_DEFINITION)return i(_.name.value)}return __DEV__&&P.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Ue.OPERATION_DEFINITION&&++a;var s=pg(r),c=r.some(function(b){return b.remove}),u=function(b){return c&&b&&b.some(s)},l=new Map,d=!1,f={enter:function(b){if(u(b.directives))return d=!0,null}},p=lt(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(b,S,_,T,R){var A=n(R);A&&A.variables.add(b.name.value)}},FragmentSpread:{enter:function(b,S,_,T,R){if(u(b.directives))return d=!0,null;var A=n(R);A&&A.fragmentSpreads.add(b.name.value)}},FragmentDefinition:{enter:function(b,S,_,T){l.set(JSON.stringify(T),b)},leave:function(b,S,_,T){var R=l.get(JSON.stringify(T));if(b===R)return b;if(a>0&&b.selectionSet.selections.every(function(A){return A.kind===Ue.FIELD&&A.name.value==="__typename"}))return i(b.name.value).removed=!0,d=!0,null}},Directive:{leave:function(b){if(s(b))return d=!0,null}}});if(!d)return e;var h=function(b){return b.transitiveVars||(b.transitiveVars=new Set(b.variables),b.removed||b.fragmentSpreads.forEach(function(S){h(i(S)).transitiveVars.forEach(function(_){b.transitiveVars.add(_)})})),b},m=new Set;p.definitions.forEach(function(b){b.kind===Ue.OPERATION_DEFINITION?h(t(b.name&&b.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):b.kind===Ue.FRAGMENT_DEFINITION&&a===0&&!i(b.name.value).removed&&m.add(b.name.value)}),m.forEach(function(b){h(i(b)).fragmentSpreads.forEach(function(S){m.add(S)})});var y=function(b){return!!(!m.has(b)||i(b).removed)},w={enter:function(b){if(y(b.name.value))return null}};return lg(lt(p,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(b){if(b.variableDefinitions){var S=h(t(b.name&&b.name.value)).transitiveVars;if(S.size<b.variableDefinitions.length)return E(E({},b),{variableDefinitions:b.variableDefinitions.filter(function(_){return S.has(_.variable.name.value)})})}}}}))}var Ai=Object.assign(function(r){return lt(r,{SelectionSet:{enter:function(e,t,i){if(!(i&&i.kind===Ue.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return xt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(xt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return E(E({},e),{selections:Pr(Pr([],n,!0),[ff],!1)})}}}}}})},{added:function(r){return r===ff}}),fg={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&P.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function cu(r){return su([fg],vn(r))}function uu(r){var e=Ci(r),t=e.operation;if(t==="query")return r;var i=lt(r,{OperationDefinition:{enter:function(n){return E(E({},n),{operation:"query"})}}});return i}function lu(r){vn(r);var e=su([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var dg=Object.prototype.hasOwnProperty;function pu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return va(r)}function va(r){var e=r[0]||{},t=r.length;if(t>1)for(var i=new vt,n=1;n<t;++n)e=i.merge(e,r[n]);return e}var hg=function(r,e,t){return this.merge(r[t],e[t])},vt=function(){function r(e){e===void 0&&(e=hg),this.reconciler=e,this.isObject=pe,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return pe(t)&&pe(e)?(Object.keys(t).forEach(function(o){if(dg.call(e,o)){var s=e[o];if(t[o]!==s){var c=i.reconciler.apply(i,Pr([e,t,o],n,!1));c!==s&&(e=i.shallowCopyForMerge(e),e[o]=c)}}else e=i.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return pe(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=E({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function mg(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=gg(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
26
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gg(r,e){if(!!r){if(typeof r=="string")return mf(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return mf(r,e)}}function mf(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function gf(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function mu(r,e,t){return e&&gf(r.prototype,e),t&&gf(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var gu=function(){return typeof Symbol=="function"},yu=function(r){return gu()&&Boolean(Symbol[r])},vu=function(r){return yu(r)?Symbol[r]:"@@"+r};gu()&&!yu("observable")&&(Symbol.observable=Symbol("observable"));var yg=vu("iterator"),du=vu("observable"),yf=vu("species");function Qo(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function ba(r){var e=r.constructor;return e!==void 0&&(e=e[yf],e===null&&(e=void 0)),e!==void 0?e:ae}function vg(r){return r instanceof ae}function _n(r){_n.log?_n.log(r):setTimeout(function(){throw r})}function Vo(r){Promise.resolve().then(function(){try{r()}catch(e){_n(e)}})}function vf(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Qo(e,"unsubscribe");t&&t.call(e)}}catch(i){_n(i)}}function hu(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function bg(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(bf(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function bf(r,e,t){r._state="running";var i=r._observer;try{var n=Qo(i,e);switch(e){case"next":n&&n.call(i,t);break;case"error":if(hu(r),n)n.call(i,t);else throw t;break;case"complete":hu(r),n&&n.call(i);break}}catch(a){_n(a)}r._state==="closed"?vf(r):r._state==="running"&&(r._state="ready")}function fu(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],Vo(function(){return bg(r)});return}bf(r,e,t)}}var _g=function(){function r(t,i){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var n=new Sg(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(hu(this),vf(this))},mu(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),Sg=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(i){fu(this._subscription,"next",i)},e.error=function(i){fu(this._subscription,"error",i)},e.complete=function(){fu(this._subscription,"complete")},mu(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ae=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new _g(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=n.subscribe({next:function(u){try{i(u,s)}catch(l){o(l),c.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ba(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ba(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ba(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return n.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{u=i(u,d)}catch(p){return l.error(p)}else u=d},error:function(d){l.error(d)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(u),l.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=ba(this);return new s(function(c){var u,l=0;function d(f){u=f.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){l===a.length?(u=void 0,c.complete()):d(s.from(a[l++]))}})}return d(i),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=ba(this);return new a(function(o){var s=[],c=n.subscribe({next:function(l){if(i)try{l=i(l)}catch(f){return o.error(f)}var d=a.from(l).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),u()}});s.push(d)},error:function(l){o.error(l)},complete:function(){u()}});function u(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),c.unsubscribe()}})},e[du]=function(){return this},r.from=function(i){var n=typeof this=="function"?this:r;if(i==null)throw new TypeError(i+" is not an object");var a=Qo(i,du);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return vg(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(yu("iterator")&&(a=Qo(i,yg),a))return new n(function(s){Vo(function(){if(!s.closed){for(var c=mg(a.call(i)),u;!(u=c()).done;){var l=u.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){Vo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},r.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){Vo(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})})},mu(r,null,[{key:yf,get:function(){return this}}]),r}();gu()&&Object.defineProperty(ae,Symbol("extensions"),{value:{symbol:du,hostReportError:_n},configurable:!0});function bu(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var Sn;typeof self<"u"?Sn=self:typeof window<"u"?Sn=window:typeof global<"u"?Sn=global:typeof module<"u"?Sn=module:Sn=Function("return this")();var A4=bu(Sn);var _f=ae.prototype,Sf="@@observable";_f[Sf]||(_f[Sf]=function(){return this});var wg=Object.prototype.toString;function zo(r){return _u(r)}function _u(r,e){switch(wg.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(n,a){t[a]=_u(n,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var i=Object.create(Object.getPrototypeOf(r));return e.set(r,i),Object.keys(r).forEach(function(n){i[n]=_u(r[n],e)}),i}default:return r}}function Eg(r){var e=new Set([r]);return e.forEach(function(t){pe(t)&&Cg(t)===t&&Object.getOwnPropertyNames(t).forEach(function(i){pe(t[i])&&e.add(t[i])})}),r}function Cg(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function _a(r){return __DEV__&&Eg(r),r}function ki(r,e,t){var i=[];r.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](t)})}function Wo(r,e,t){return new ae(function(i){var n=i.next,a=i.error,o=i.complete,s=0,c=!1,u={then:function(p){return new Promise(function(h){return h(p())})}};function l(p,h){return p?function(m){++s;var y=function(){return p(m)};u=u.then(y,y).then(function(w){--s,n&&n.call(i,w),c&&d.complete()},function(w){throw--s,w}).catch(function(w){a&&a.call(i,w)})}:function(m){return h&&h.call(i,m)}}var d={next:l(e,n),error:l(t,a),complete:function(){c=!0,s||o&&o.call(i)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var $t=typeof WeakMap=="function"&&Ke(function(){return navigator.product})!=="ReactNative",wf=typeof WeakSet=="function",Su=typeof Symbol=="function"&&typeof Symbol.for=="function",Fr=Su&&Symbol.asyncIterator,U4=typeof Ke(function(){return window.document.createElement})=="function",j4=Ke(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Ho(r){function e(t){Object.defineProperty(r,t,{value:ae})}return Su&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Ef(r){return r&&typeof r.then=="function"}var wn=function(r){Pe(e,r);function e(t){var i=r.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),ki(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),ki(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?Ef(c)?c.then(function(u){return i.sub=u.subscribe(i.handlers)}):i.sub=c.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),ki(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof t=="function"&&(t=[new ae(t)]),Ef(t)?t.then(function(n){return i.start(n)},i.handlers.error):i.start(t),i}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var i=this.latest[0],n=t[i];n&&n.call(t,this.latest[1]),this.sub===null&&i==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(t,i)}))},e.prototype.beforeNext=function(t){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,t(n,a))})},e}(ae);Ho(wn);function Mr(r){return"incremental"in r}function xg(r){return"hasNext"in r&&"data"in r}function Cf(r){return Mr(r)||xg(r)}function Go(r,e){var t=r,i=new vt;return Mr(e)&&Be(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}t=i.merge(t,a)}),t}function En(r){var e=Ko(r);return Be(e)}function Ko(r){var e=Be(r.errors)?r.errors.slice(0):[];return Mr(r)&&Be(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Ur(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(t[n]=a)})}),t}var xf=new Map;function Sa(r){var e=xf.get(r)||1;return xf.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Af(r){var e=Sa("stringifyForDisplay");return JSON.stringify(r,function(t,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function wa(r,e){return Ur(r,e,e.variables&&{variables:E(E({},r&&r.variables),e.variables)})}function Zo(r){return new ae(function(e){e.error(r)})}var Ea=function(r,e,t){var i=new Error(t);throw i.name="ServerError",i.response=r,i.statusCode=r.status,i.result=e,i};function wu(r){for(var e=["query","operationName","variables","extensions","context"],t=0,i=Object.keys(r);t<i.length;t++){var n=i[t];if(e.indexOf(n)<0)throw __DEV__?new J("illegal argument: ".concat(n)):new J(27)}return r}function Eu(r,e){var t=E({},r),i=function(a){typeof a=="function"?t=E(E({},t),a(t)):t=E(E({},t),a)},n=function(){return E({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function Cu(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?bn(e.query)||void 0:""),e}function kf(r,e){return e?e(r):ae.of()}function Ca(r){return typeof r=="function"?new Lt(r):r}function Jo(r){return r.request.length<=1}var Ag=function(r){Pe(e,r);function e(t,i){var n=r.call(this,t)||this;return n.link=i,n}return e}(Error),Lt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return ae.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Ca).reduce(function(t,i){return t.concat(i)})},r.split=function(e,t,i){var n=Ca(t),a=Ca(i||new r(kf));return Jo(n)&&Jo(a)?new r(function(o){return e(o)?n.request(o)||ae.of():a.request(o)||ae.of()}):new r(function(o,s){return e(o)?n.request(o,s)||ae.of():a.request(o,s)||ae.of()})},r.execute=function(e,t){return e.request(Eu(t.context,Cu(wu(t))))||ae.of()},r.concat=function(e,t){var i=Ca(e);if(Jo(i))return __DEV__&&P.warn(new Ag("You are calling concat on a terminating link, which will have no effect",i)),i;var n=Ca(t);return Jo(n)?new r(function(a){return i.request(a,function(o){return n.request(o)||ae.of()})||ae.of()}):new r(function(a,o){return i.request(a,function(s){return n.request(s,o)||ae.of()})||ae.of()})},r.prototype.split=function(e,t,i){return this.concat(r.split(e,t,i||new r(kf)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new J("request is not implemented"):new J(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var Cn=Lt.execute;var Tf="3.7.10";function If(r){return!!r.body}function Of(r){return!!r.getReader}function Df(r){return!!(Fr&&r[Symbol.asyncIterator])}function Nf(r){return!!r.stream}function Rf(r){return!!r.arrayBuffer}function Pf(r){return!!r.pipe}function xu(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Au(r){var e=null,t=null,i=!1,n=[],a=[];function o(d){if(!t){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}n.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){i=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(d,f){if(t)return f(t);if(n.length)return d({value:n.shift(),done:!1});if(i)return d({value:void 0,done:!0});a.push([d,f])})}var l={next:function(){return u()}};return Fr&&(l[Symbol.asyncIterator]=function(){return this}),l}function ku(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){r.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return Fr&&(t[Symbol.asyncIterator]=function(){return this}),t}function Yo(r){var e={next:function(){return r.read()}};return Fr&&(e[Symbol.asyncIterator]=function(){return this}),e}function $f(r){var e=r;if(If(r)&&(e=r.body),Df(e))return xu(e);if(Of(e))return Yo(e.getReader());if(Nf(e))return Yo(e.stream().getReader());if(Rf(e))return ku(e.arrayBuffer());if(Pf(e))return Au(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Lf=Object.prototype.hasOwnProperty;function Ff(r,e){var t,i,n;return Vt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h,m,y,w,b,S,_,T,R,A,N;return Qt(this,function(L){switch(L.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=$f(r),f=!0,L.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=L.sent(),h=p.value,m=p.done,y=typeof h=="string"?h:a.decode(h),f=!m,l+=y,w=l.indexOf(u);w>-1;){if(b=void 0,N=[l.slice(0,w),l.slice(w+u.length)],b=N[0],l=N[1],b.trim()){if(S=b.indexOf(`\r
27
27
  \r
28
- `),_=Ag(b.slice(0,S)),T=_["content-type"],T&&T.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");R=b.slice(S);try{A=Ff(r,R.replace(`\r
29
- `,"")),(Object.keys(A).length>1||"data"in A||"incremental"in A||"errors"in A)&&((i=e.next)===null||i===void 0||i.call(e,A))}catch(P){Yo(P,e)}}w=u.indexOf(l)}return[3,1];case 3:return(n=e.complete)===null||n===void 0||n.call(e),[2]}})})}function Ag(r){var e={};return r.split(`
30
- `).forEach(function(t){var i=t.indexOf(":");if(i>-1){var n=t.slice(0,i).trim().toLowerCase(),a=t.slice(i+1).trim();e[n]=a}}),e}function Ff(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Sa(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(n){var i=n;throw i.name="ServerParseError",i.response=r,i.statusCode=r.status,i.bodyText=e,i}}function Yo(r,e){var t,i;r.name!=="AbortError"&&(r.result&&r.result.errors&&r.result.data&&((t=e.next)===null||t===void 0||t.call(e,r.result)),(i=e.error)===null||i===void 0||i.call(e,r))}function Mf(r,e,t){kg(e)(r).then(function(i){var n,a;(n=t.next)===null||n===void 0||n.call(t,i),(a=t.complete)===null||a===void 0||a.call(t)}).catch(function(i){return Yo(i,t)})}function kg(r){return function(e){return e.text().then(function(t){return Ff(e,t)}).then(function(t){return e.status>=300&&Sa(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!Pf.call(t,"data")&&!Pf.call(t,"errors")&&Sa(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(i){return i.operationName}):r.operationName,"'.")),t})}}var Ca=function(r,e){var t;try{t=JSON.stringify(r)}catch(n){var i=__DEV__?new J("Network request failed. ".concat(e," is not serializable: ").concat(n.message)):new J(24);throw i.parseError=n,i}return t};var Tg={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Ig={accept:"*/*","content-type":"application/json"},Og={method:"POST"},Uf={http:Tg,headers:Ig,options:Og},jf=function(r,e){return e(r)};function qf(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];var n={},a={};t.forEach(function(d){n=C(C(C({},n),d.options),{headers:C(C({},n.headers),d.headers)}),d.credentials&&(n.credentials=d.credentials),a=C(C({},a),d.http)}),n.headers&&(n.headers=Dg(n.headers,a.preserveHeaderCase));var o=r.operationName,s=r.extensions,c=r.variables,l=r.query,u={operationName:o,variables:c};return a.includeExtensions&&(u.extensions=s),a.includeQuery&&(u.query=e(l,mn)),{options:n,body:u}}function Dg(r,e){if(!e){var t=Object.create(null);return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var i=Object.create(null);Object.keys(Object(r)).forEach(function(a){i[a.toLowerCase()]={originalName:a,value:r[a]}});var n=Object.create(null);return Object.keys(i).forEach(function(a){n[i[a].originalName]=i[a].value}),n}var Bf=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new J(`
28
+ `),_=kg(b.slice(0,S)),T=_["content-type"],T&&T.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");R=b.slice(S);try{A=Mf(r,R.replace(`\r
29
+ `,"")),(Object.keys(A).length>1||"data"in A||"incremental"in A||"errors"in A)&&((i=e.next)===null||i===void 0||i.call(e,A))}catch($){Xo($,e)}}w=l.indexOf(u)}return[3,1];case 3:return(n=e.complete)===null||n===void 0||n.call(e),[2]}})})}function kg(r){var e={};return r.split(`
30
+ `).forEach(function(t){var i=t.indexOf(":");if(i>-1){var n=t.slice(0,i).trim().toLowerCase(),a=t.slice(i+1).trim();e[n]=a}}),e}function Mf(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Ea(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(n){var i=n;throw i.name="ServerParseError",i.response=r,i.statusCode=r.status,i.bodyText=e,i}}function Xo(r,e){var t,i;r.name!=="AbortError"&&(r.result&&r.result.errors&&r.result.data&&((t=e.next)===null||t===void 0||t.call(e,r.result)),(i=e.error)===null||i===void 0||i.call(e,r))}function Uf(r,e,t){Tg(e)(r).then(function(i){var n,a;(n=t.next)===null||n===void 0||n.call(t,i),(a=t.complete)===null||a===void 0||a.call(t)}).catch(function(i){return Xo(i,t)})}function Tg(r){return function(e){return e.text().then(function(t){return Mf(e,t)}).then(function(t){return e.status>=300&&Ea(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!Lf.call(t,"data")&&!Lf.call(t,"errors")&&Ea(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(i){return i.operationName}):r.operationName,"'.")),t})}}var xa=function(r,e){var t;try{t=JSON.stringify(r)}catch(n){var i=__DEV__?new J("Network request failed. ".concat(e," is not serializable: ").concat(n.message)):new J(24);throw i.parseError=n,i}return t};var Ig={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Og={accept:"*/*","content-type":"application/json"},Dg={method:"POST"},jf={http:Ig,headers:Og,options:Dg},qf=function(r,e){return e(r)};function Bf(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];var n={},a={};t.forEach(function(d){n=E(E(E({},n),d.options),{headers:E(E({},n.headers),d.headers)}),d.credentials&&(n.credentials=d.credentials),a=E(E({},a),d.http)}),n.headers&&(n.headers=Ng(n.headers,a.preserveHeaderCase));var o=r.operationName,s=r.extensions,c=r.variables,u=r.query,l={operationName:o,variables:c};return a.includeExtensions&&(l.extensions=s),a.includeQuery&&(l.query=e(u,gn)),{options:n,body:l}}function Ng(r,e){if(!e){var t=Object.create(null);return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var i=Object.create(null);Object.keys(Object(r)).forEach(function(a){i[a.toLowerCase()]={originalName:a,value:r[a]}});var n=Object.create(null);return Object.keys(i).forEach(function(a){n[i[a].originalName]=i[a].value}),n}var Vf=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new J(`
31
31
  "fetch" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:
32
32
 
33
33
  import fetch from 'cross-fetch';
@@ -35,9 +35,9 @@ import { ApolloClient, HttpLink } from '@apollo/client';
35
35
  const client = new ApolloClient({
36
36
  link: new HttpLink({ uri: '/graphql', fetch })
37
37
  });
38
- `):new J(23)};var Vf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var Qf=function(r,e){var t=r.getContext(),i=t.uri;return i||(typeof e=="function"?e(r):e||"/graphql")};function zf(r,e){var t=[],i=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=Ca(e.variables,"Variables map")}catch(d){return{parseError:d}}i("variables",n)}if(e.extensions){var a=void 0;try{a=Ca(e.extensions,"Extensions map")}catch(d){return{parseError:d}}i("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var l=s.indexOf("?")===-1?"?":"&",u=s+l+t.join("&")+o;return{newURI:u}}var Wf=Ge(function(){return fetch}),Hf=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,i=r.fetch,n=r.print,a=n===void 0?jf:n,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,l=r.includeUnusedVariables,u=l===void 0?!1:l,d=Yt(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&Bf(i||Wf);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Pt(function(p){var h=Qf(p,t),m=p.getContext(),v={};if(m.clientAwareness){var w=m.clientAwareness,b=w.name,S=w.version;b&&(v["apollographql-client-name"]=b),S&&(v["apollographql-client-version"]=S)}var _=C(C({},v),m.headers),T={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:_},R=qf(p,a,Uf,f,T),A=R.options,N=R.body;if(N.variables&&!u){var L=new Set(Object.keys(N.variables));ct(p.query,{Variable:function(ue,Zt,ne){ne&&ne.kind!=="VariableDefinition"&&L.delete(ue.name.value)}}),L.size&&(N.variables=C({},N.variables),L.forEach(function(ue){delete N.variables[ue]}))}var P;if(!A.signal){var j=Vf(),ye=j.controller,je=j.signal;P=ye,P&&(A.signal=je)}var G=function(ue){return ue.kind==="OperationDefinition"&&ue.operation==="mutation"};if(c&&!p.query.definitions.some(G)&&(A.method="GET"),gn(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var Ce=zf(h,N),Ee=Ce.newURI,le=Ce.parseError;if(le)return Ko(le);h=Ee}else try{A.body=Ca(N,"Payload")}catch(ue){return Ko(ue)}return new ae(function(ue){var Zt=i||Ge(function(){return fetch})||Wf;return Zt(h,A).then(function(ne){var Jt;p.setContext({response:ne});var Ir=(Jt=ne.headers)===null||Jt===void 0?void 0:Jt.get("content-type");return Ir!==null&&/^multipart\/mixed/i.test(Ir)?Lf(ne,ue):Mf(ne,p,ue)}).catch(function(ne){return Yo(ne,ue)}),function(){P&&P.abort()}})})};var kl=function(r){Re(e,r);function e(t){t===void 0&&(t={});var i=r.call(this,Hf(t).request)||this;return i.options=t,i}return e}(Pt);var{toString:Gf,hasOwnProperty:Ng}=Object.prototype,Kf=Function.prototype.toString,Tl=new Map;function Te(r,e){try{return Il(r,e)}finally{Tl.clear()}}function Il(r,e){if(r===e)return!0;let t=Gf.call(r),i=Gf.call(e);if(t!==i)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Jf(r,e))return!0;let n=Zf(r),a=Zf(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Ng.call(e,n[s]))return!1;for(let s=0;s<o;++s){let c=n[s];if(!Il(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(Jf(r,e))return!0;let n=r.entries(),a=t==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Il(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let n=r.byteLength;if(n===e.byteLength)for(;n--&&r[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Kf.call(r);return n!==Kf.call(e)?!1:!Pg(n,$g)}}return!1}function Zf(r){return Object.keys(r).filter(Rg,r)}function Rg(r){return this[r]!==void 0}var $g="{ [native code] }";function Pg(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Jf(r,e){let t=Tl.get(r);if(t){if(t.has(e))return!0}else Tl.set(r,t=new Set);return t.add(e),!1}var Lg=function(){return Object.create(null)},Yf=Array.prototype,Fg=Yf.forEach,Mg=Yf.slice,tr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Lg),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return Fg.call(e,function(i){return t=t.getChildTrie(i)}),t.data||(t.data=this.makeData(Mg.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Ug(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=t.get(e);return i||t.set(e,i=new r(this.weakness,this.makeData)),i},r}();function Ug(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var et=null,Xf={},jg=1,qg=()=>class{constructor(){this.id=["slot",jg++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=et;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===Xf)break;return e!==et&&(et.slots[this.id]=t),!0}return et&&(et.slots[this.id]=Xf),!1}getValue(){if(this.hasValue())return et.slots[this.id]}withValue(e,t,i,n){let a={__proto__:null,[this.id]:e},o=et;et={parent:o,slots:a};try{return t.apply(n,i)}finally{et=o}}static bind(e){let t=et;return function(){let i=et;try{return et=t,e.apply(this,arguments)}finally{et=i}}}static noContext(e,t,i){if(et){let n=et;try{return et=null,e.apply(i,t)}finally{et=n}}else return e.apply(i,t)}};function ed(r){try{return r()}catch{}}var Ol="@wry/context:Slot",Bg=ed(()=>globalThis)||ed(()=>global)||Object.create(null),td=Bg,En=td[Ol]||Array[Ol]||function(r){try{Object.defineProperty(td,Ol,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(qg());var{bind:Vg,noContext:Qg}=En;function zg(){}var Wg=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=zg),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var i=t.older,n=t.newer;n&&(n.older=i),i&&(i.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},r.prototype.set=function(e,t){var i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),es=new En,Dl,Hg=Object.prototype.hasOwnProperty,Rl=(Dl=Array.from,Dl===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Dl);function Xo(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Ea=[],Gg=100;function xn(r,e){if(!r)throw new Error(e||"assertion failure")}function Kg(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function id(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Zg(r){return r.slice(0)}var Jg=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Ur(this))return rd(this),this.value[0]},r.prototype.recompute=function(e){return xn(!this.recomputing,"already recomputing"),rd(this),Ur(this)?Yg(this,e):id(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,nd(this),Xo(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),ld(this),$l(this,function(t,i){t.setDirty(),ud(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Ea.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Rl(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Ea.push(this.deps),this.deps=null)},r.count=0,r}();function rd(r){var e=es.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Ur(r)?od(e,r):sd(e,r),e}function Yg(r,e){return ld(r),es.withValue(r,Xg,[r,e]),ty(r,e)&&ey(r),id(r.value)}function Xg(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Ur(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function ey(r){r.dirty=!1,!Ur(r)&&ad(r)}function nd(r){$l(r,od)}function ad(r){$l(r,sd)}function $l(r,e){var t=r.parents.size;if(t)for(var i=Rl(r.parents),n=0;n<t;++n)e(i[n],r)}function od(r,e){xn(r.childValues.has(e)),xn(Ur(e));var t=!Ur(r);if(!r.dirtyChildren)r.dirtyChildren=Ea.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&nd(r)}function sd(r,e){xn(r.childValues.has(e)),xn(!Ur(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Zg(e.value)):Kg(t,e.value)||r.setDirty(),cd(r,e),!Ur(r)&&ad(r)}function cd(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ea.length<Gg&&Ea.push(t),r.dirtyChildren=null))}function ld(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){ud(r,t)}),r.forgetDeps(),xn(r.dirtyChildren===null)}function ud(r,e){e.parents.delete(r),r.childValues.delete(e),cd(r,e)}function ty(r,e){if(typeof r.subscribe=="function")try{Xo(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var ry={setDirty:!0,dispose:!0,forget:!0};function ts(r){var e=new Map,t=r&&r.subscribe;function i(n){var a=es.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof t=="function"&&(Xo(o),o.unsubscribe=t(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Hg.call(ry,o)?o:"setDirty";Rl(s).forEach(function(l){return l[c]()}),e.delete(a),Xo(s)}},i}function pd(){var r=new tr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var _w=pd(),Nl=new Set;function ki(r,e){e===void 0&&(e=Object.create(null));var t=new Wg(e.max||Math.pow(2,16),function(l){return l.dispose()}),i=e.keyArgs,n=e.makeCacheKey||pd(),a=function(){var l=n.apply(null,i?i.apply(null,arguments):arguments);if(l===void 0)return r.apply(null,arguments);var u=t.get(l);u||(t.set(l,u=new Jg(r)),u.subscribe=e.subscribe,u.forget=function(){return t.delete(l)});var d=u.recompute(Array.prototype.slice.call(arguments));return t.set(l,u),Nl.add(t),es.hasValue()||(Nl.forEach(function(f){return f.clean()}),Nl.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(l){var u=t.get(l);u&&u.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(l){var u=t.get(l);if(u)return u.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function c(l){return t.delete(l)}return a.forgetKey=c,a.forget=function(){return c(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Pl=function(){function r(){this.getFragmentDoc=ki(tl)}return r.prototype.batch=function(e){var t=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(t)},i),n},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(C(C({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(C(C({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,i=e.data,n=Yt(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:i}))},r.prototype.writeFragment=function(e){var t=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=Yt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:t,result:i}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var n=i.readQuery(e),a=t(n);return a==null?n:(i.writeQuery(C(C({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var n=i.readFragment(e),a=t(n);return a==null?n:(i.writeFragment(C(C({},e),{data:a})),a)}})},r}();var xa=function(r){Re(e,r);function e(t,i,n,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=i,s.query=n,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var $e=Object.prototype.hasOwnProperty;function Aa(r){return r==null}function is(r,e){var t=r.__typename,i=r.id,n=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Aa(i)?Aa(n)?void 0:{_id:n}:{id:i}),Aa(i)&&!Aa(n)&&(i=n),!Aa(i)))return"".concat(t,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var fd={dataIdFromObject:is,addTypename:!0,resultCaching:!0,canonizeResults:!1};function dd(r){return Mr(fd,r)}function ns(r){var e=r.canonizeResults;return e===void 0?fd.canonizeResults:e}function hd(r,e){return oe(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Ll=/^[_a-z][_0-9a-z]*/i;function Wt(r){var e=r.match(Ll);return e?e[0]:r}function rs(r,e,t){return pe(e)?we(e)?e.every(function(i){return rs(r,i,t)}):r.selections.every(function(i){if(Et(i)&&gr(i,t)){var n=Rt(i);return $e.call(e,n)&&(!i.selectionSet||rs(i.selectionSet,e[n],t))}return!0}):!1}function jr(r){return pe(r)&&!oe(r)&&!we(r)}function md(){return new yt}function as(r,e){var t=_i(wi(r));return{fragmentMap:t,lookupFragment:function(i){var n=t[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var os=Object.create(null),Fl=function(){return os},gd=Object.create(null),An=function(){function r(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return va(oe(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return oe(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return Xt(n);if(oe(n))return n;var o=i.policies.identify(n)[0];if(o){var s=Xt(o);return a&&i.merge(o,n),s}}}return r.prototype.toObject=function(){return C({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),$e.call(this.data,e)){var i=this.data[e];if(i&&$e.call(i,t))return i[t]}if(t==="__typename"&&$e.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof qr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),$e.call(this.data,e))return this.data[e];if(this instanceof qr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var i=this,n;oe(e)&&(e=e.__ref),oe(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof t=="string"?this.lookup(n=t):t;if(!!o){__DEV__?$(typeof n=="string","store.merge expects a string ID"):$(typeof n=="string",1);var s=new yt(ny).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(l){if(!a||a[l]!==s[l]){c[l]=1;var u=Wt(l);u!==l&&!i.policies.hasKeyArgs(s.__typename,u)&&(c[u]=1),s[l]===void 0&&!(i instanceof qr)&&delete s[l]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(l){return i.group.dirty(n,l)})}}},r.prototype.modify=function(e,t){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,c={DELETE:os,INVALIDATE:gd,isReference:oe,toReference:this.toReference,canRead:this.canRead,readField:function(l,u){return i.policies.readField(typeof l=="string"?{fieldName:l,from:u||Xt(e)}:l,{store:i})}};if(Object.keys(n).forEach(function(l){var u=Wt(l),d=n[l];if(d!==void 0){var f=typeof t=="function"?t:t[l]||t[u];if(f){var p=f===Fl?os:f(va(d),C(C({},c),{fieldName:u,storeFieldName:l,storage:i.getStorage(e,l)}));p===gd?i.group.dirty(e,l):(p===os&&(p=void 0),p!==d&&(a[l]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof qr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&i?this.policies.getStoreFieldName({typename:o,fieldName:t,args:i}):t;return this.modify(e,s?(n={},n[s]=Fl,n):Fl)}return!1},r.prototype.evict=function(e,t){var i=!1;return e.id&&($e.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof qr&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){$e.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(t.__META={extraRootIds:i.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&$e.call(e,a)||t.delete(a)}),e){var i=e.__META,n=Yt(e,["__META"]);Object.keys(n).forEach(function(a){t.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof qr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach(function(o){$e.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof qr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},r.prototype.findChildRefIds=function(e){if(!$e.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var n=new Set([i]);n.forEach(function(a){oe(a)&&(t[a.__ref]=!0),pe(a)&&Object.keys(a).forEach(function(o){var s=a[o];pe(s)&&n.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var yd=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?ts():null,this.keyMaker=new tr($t)},r.prototype.depend=function(e,t){if(this.d){this.d(Ml(e,t));var i=Wt(t);i!==t&&this.d(Ml(e,i)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Ml(e,t),t==="__exists"?"forget":"setDirty")},r}();function Ml(r,e){return e+"#"+r}function Ul(r,e){Ti(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Re(i,t);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,c=n.seed,l=t.call(this,a,new yd(s))||this;return l.stump=new iy(l),l.storageTrie=new tr($t),c&&l.replace(c),l}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(r);r.Root=e})(An||(An={}));var qr=function(r){Re(e,r);function e(t,i,n,a){var o=r.call(this,i.policies,a)||this;return o.id=t,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(t,i){return new e(t,this,i,this.group)},e.prototype.removeLayer=function(t){var i=this,n=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Te(o[c],s[c])||i.group.dirty(a,c)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){i.group.dirty(a,c)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return C(C({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return $e.call(this.data,t)?C(C({},i),r.prototype.findChildRefIds.call(this,t)):i},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(An),iy=function(r){Re(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new yd(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(qr);function ny(r,e,t){var i=r[t],n=e[t];return Te(i,n)?i:n}function Ti(r){return!!(r instanceof An&&r.group.caching)}function ay(r){return pe(r)?we(r)?r.slice(0):C({__proto__:Object.getPrototypeOf(r)},r):r}var ss=function(){function r(){this.known=new(Sf?WeakSet:Set),this.pool=new tr($t),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return pe(e)&&this.known.has(e)},r.prototype.pass=function(e){if(pe(e)){var t=ay(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(pe(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],l=this.sortedKeys(e);c.push(l.json);var u=c.length;l.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),l.sorted.forEach(function(p,h){d[p]=c[u+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var n=JSON.stringify(t);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:t,json:n})}return i.keys},r}();var xt=Object.assign(function(r){if(pe(r)){jl===void 0&&vd();var e=jl.admit(r),t=ql.get(e);return t===void 0&&ql.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:vd}),jl,ql;function vd(){jl=new ss,ql=new($t?WeakMap:Map)}function bd(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var _d=function(){function r(e){var t=this;this.knownResults=new($t?WeakMap:Map),this.config=Mr(e,{addTypename:e.addTypename!==!1,canonizeResults:ns(e)}),this.canon=e.canon||new ss,this.executeSelectionSet=ki(function(i){var n,a=i.context.canonizeResults,o=bd(i);o[3]=!a;var s=(n=t.executeSelectionSet).peek.apply(n,o);return s?a?C(C({},s),{result:t.canon.admit(s.result)}):s:(Ul(i.context.store,i.enclosingRef.__ref),t.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:bd,makeCacheKey:function(i,n,a,o){if(Ti(a.store))return a.store.makeCacheKey(i,oe(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=ki(function(i){return Ul(i.context.store,i.enclosingRef.__ref),t.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(Ti(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new ss},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,l=e.canonizeResults,u=l===void 0?this.config.canonizeResults:l,d=this.config.cache.policies;o=C(C({},Ei(ma(i))),o);var f=Xt(a),p=this.executeSelectionSet({selectionSet:Ci(i).selectionSet,objectOrReference:f,enclosingRef:f,context:C({store:t,query:i,policies:d,variables:o,varString:xt(o),canonizeResults:u},as(i,this.config.fragments))}),h;if(p.missing&&(h=[new xa(oy(p.missing),p.missing,i,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,i,n){if(Ti(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,t,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(oe(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,c=o.policies,l=o.store,u=l.getFieldValue(n,"__typename"),d=[],f,p=new yt;this.config.addTypename&&typeof u=="string"&&!c.rootIdsByTypename[u]&&d.push({__typename:u});function h(S,_){var T;return S.missing&&(f=p.merge(f,(T={},T[_]=S.missing,T))),S.result}var m=new Set(i.selections);m.forEach(function(S){var _,T;if(!!gr(S,s))if(Et(S)){var R=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:n},o),A=Rt(S);R===void 0?xi.added(S)||(f=p.merge(f,(_={},_[A]="Can't find field '".concat(S.name.value,"' on ").concat(oe(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),_))):we(R)?R=h(t.executeSubSelectedArray({field:S,array:R,enclosingRef:a,context:o}),A):S.selectionSet?R!=null&&(R=h(t.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:R,enclosingRef:oe(R)?R:a,context:o}),A)):o.canonizeResults&&(R=t.canon.pass(R)),R!==void 0&&d.push((T={},T[A]=R,T))}else{var N=Si(S,o.lookupFragment);if(!N&&S.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(S.name.value)):new J(5);N&&c.fragmentMatches(N,u)&&N.selectionSet.selections.forEach(m.add,m)}});var v=ga(d),w={result:v,missing:f},b=o.canonizeResults?this.canon.admit(w):va(w);return b.result&&this.knownResults.set(b.result,i),b},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,c=new yt;function l(u,d){var f;return u.missing&&(s=c.merge(s,(f={},f[d]=u.missing,f))),u.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(u,d){return u===null?null:we(u)?l(t.executeSubSelectedArray({field:i,array:u,enclosingRef:a,context:o}),d):i.selectionSet?l(t.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:u,enclosingRef:oe(u)?u:a,context:o}),d):(__DEV__&&sy(o.store,i,u),u)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},r}();function oy(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function sy(r,e,t){if(!e.selectionSet){var i=new Set([t]);i.forEach(function(n){pe(n)&&(__DEV__?$(!oe(n),"Missing selection set for object of type ".concat(hd(r,n)," returned for query field ").concat(e.name.value)):$(!oe(n),6),Object.values(n).forEach(i.add,i))})}}var kn=new En,Sd=new WeakMap;function ka(r){var e=Sd.get(r);return e||Sd.set(r,e={vars:new Set,dep:ts()}),e}function Bl(r){ka(r).vars.forEach(function(e){return e.forgetCache(r)})}function wd(r){ka(r).vars.forEach(function(e){return e.attachCache(r)})}function cs(r){var e=new Set,t=new Set,i=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){ka(c).dep.dirty(i),cy(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=kn.getValue();s&&(n(s),ka(s).dep(i))}return r};i.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var n=i.attachCache=function(a){return e.add(a),ka(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function cy(r){r.broadcastWatches&&r.broadcastWatches()}var Cd=Object.create(null);function Vl(r){var e=JSON.stringify(r);return Cd[e]||(Cd[e]=Object.create(null))}function Ql(r){var e=Vl(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=Wl(r,function(o){var s=Tn(i.storeObject,o,n);return s===void 0&&t!==i.storeObject&&$e.call(t,o[0])&&(s=Tn(t,o,xd)),__DEV__?$(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):$(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function zl(r){var e=Vl(r);return e.keyArgsFn||(e.keyArgsFn=function(t,i){var n=i.field,a=i.variables,o=i.fieldName,s=Wl(r,function(l){var u=l[0],d=u.charAt(0);if(d==="@"){if(n&&qe(n.directives)){var f=u.slice(1),p=n.directives.find(function(w){return w.name.value===f}),h=p&&yr(p,a);return h&&Tn(h,l.slice(1))}return}if(d==="$"){var m=u.slice(1);if(a&&$e.call(a,m)){var v=l.slice(0);return v[0]=m,Tn(a,v)}return}if(t)return Tn(t,l)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Wl(r,e){var t=new yt;return Ed(r).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=t.merge(i,o)}return i},Object.create(null))}function Ed(r){var e=Vl(r);if(!e.paths){var t=e.paths=[],i=[];r.forEach(function(n,a){we(n)?(Ed(n).forEach(function(o){return t.push(i.concat(o))}),i.length=0):(i.push(n),we(r[a+1])||(t.push(i.slice(0)),i.length=0))})}return e.paths}function xd(r,e){return r[e]}function Tn(r,e,t){return t=t||xd,Ad(e.reduce(function i(n,a){return we(n)?n.map(function(o){return i(o,a)}):n&&t(n,a)},r))}function Ad(r){return pe(r)?we(r)?r.map(Ad):Wl(Object.keys(r).sort(),function(e){return Tn(r,e)}):r}da.setStringify(xt);function Hl(r){return r.args!==void 0?r.args:r.field?yr(r.field,r.variables):null}var ly=function(){},kd=function(r,e){return e.fieldName},Td=function(r,e,t){var i=t.mergeObjects;return i(r,e)},Id=function(r,e){return e},Dd=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=C({dataIdFromObject:is},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var i,n=this,a=t&&(t.typename||((i=t.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=C(C({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=ls(arguments,o);return n.readField(f,{store:n.cache.data,variables:f.variables})}}),c,l=a&&this.getTypePolicy(a),u=l&&l.keyFn||this.config.dataIdFromObject;u;){var d=u(e,s);if(we(d))u=Ql(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,c=Yt(n,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",i),o&&t.setRootTypename("Mutation",i),s&&t.setRootTypename("Subscription",i),$e.call(t.toBeAdded,i)?t.toBeAdded[i].push(c):t.toBeAdded[i]=[c]})},r.prototype.updateTypePolicy=function(e,t){var i=this,n=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,l){c.merge=typeof l=="function"?l:l===!0?Td:l===!1?Id:c.merge}s(n,t.merge),n.keyFn=a===!1?ly:we(a)?Ql(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(c){var l=i.getFieldPolicy(e,c,!0),u=o[c];if(typeof u=="function")l.read=u;else{var d=u.keyArgs,f=u.read,p=u.merge;l.keyFn=d===!1?kd:we(d)?zl(d):typeof d=="function"?d:l.keyFn,typeof f=="function"&&(l.read=f),s(l,p)}l.read&&l.merge&&(l.keyFn=l.keyFn||kd)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];t!==n&&(__DEV__?$(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):$(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){t.getSupertypeSet(i,!0),e[i].forEach(function(n){t.getSupertypeSet(n,!0).add(i);var a=n.match(Ll);(!a||a[0]!==n)&&t.fuzzySubtypes.set(n,new RegExp(n))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!$e.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,l=Yt(s,["fields"]);Object.assign(i,l),Object.assign(i.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,i){if(e){var n=this.getTypePolicy(e).fields;return n[t]||i&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},r.prototype.fragmentMatches=function(e,t,i,n){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],l=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},u=!!(i&&this.fuzzySubtypes.size),d=!1,f=0;f<c.length;++f){var p=c[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&$.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(l),u&&f===c.length-1&&rs(e.selectionSet,i,n)&&(u=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var v=t.match(h);v&&v[0]===t&&l(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!!(i&&i.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,i=e.fieldName,n=this.getFieldPolicy(t,i,!1),a,o=n&&n.keyFn;if(o&&t)for(var s={typename:t,fieldName:i,field:e.field||null,variables:e.variables},c=Hl(e);o;){var l=o(c,s);if(we(l))o=zl(l);else{a=l||i;break}}return a===void 0&&(a=e.field?il(e.field,e.variables):da(i,Hl(e))),a===!1?i:i===Wt(a)?a:i+":"+a},r.prototype.readField=function(e,t){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=t.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Wt(o),c=t.store.getFieldValue(i,o),l=this.getFieldPolicy(e.typename,s,!1),u=l&&l.read;if(u){var d=Od(this,i,e,t,t.store.getStorage(oe(i)?i.__ref:i,o));return kn.withValue(this.cache,u,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},r.prototype.getMergeFunction=function(e,t,i){var n=this.getFieldPolicy(e,t,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},r.prototype.runMergeFunction=function(e,t,i,n,a){var o=i.field,s=i.typename,c=i.merge;return c===Td?Nd(n.store)(e,t):c===Id?t:(n.overwrite&&(e=void 0),c(e,t,Od(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},r}();function Od(r,e,t,i,n){var a=r.getStoreFieldName(t),o=Wt(a),s=t.variables||i.variables,c=i.store,l=c.toReference,u=c.canRead;return{args:Hl(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:oe,toReference:l,storage:n,cache:r.cache,canRead:u,readField:function(){return r.readField(ls(arguments,e,s),i)},mergeObjects:Nd(i.store)}}function ls(r,e,t){var i=r[0],n=r[1],a=r.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=C({},i),$e.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&$.warn("Undefined 'from' passed to readField with arguments ".concat(xf(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function Nd(r){return function(t,i){if(we(t)||we(i))throw __DEV__?new J("Cannot automatically merge arrays"):new J(4);if(pe(t)&&pe(i)){var n=r.getFieldValue(t,"__typename"),a=r.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(oe(t)&&jr(i))return r.merge(t.__ref,i),t;if(jr(t)&&oe(i))return r.merge(t,i.__ref),i;if(jr(t)&&jr(i))return C(C({},t),i)}return i}}function Gl(r,e,t){var i="".concat(e).concat(t),n=r.flavors.get(i);return n||r.flavors.set(i,n=r.clientOnly===e&&r.deferred===t?r:C(C({},r),{clientOnly:e,deferred:t})),n}var Ld=function(){function r(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return r.prototype.writeToStore=function(e,t){var i=this,n=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,l=er(n),u=md();s=C(C({},Ei(l)),s);var d=C(C({store:e,written:Object.create(null),merge:function(p,h){return u.merge(p,h)},variables:s,varString:xt(s)},as(n,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:l.selectionSet,mergeTree:{map:new Map},context:d});if(!oe(f))throw __DEV__?new J("Could not identify object ".concat(JSON.stringify(a))):new J(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,v=p.mergeTree,w=p.fieldNodeSet,b=Xt(h);if(v&&v.map.size){var S=i.applyMerges(v,b,m,d);if(oe(S))return;m=S}if(__DEV__&&!d.overwrite){var _=Object.create(null);w.forEach(function(A){A.selectionSet&&(_[A.name.value]=!0)});var T=function(A){return _[Wt(A)]===!0},R=function(A){var N=v&&v.map.get(A);return Boolean(N&&N.info&&N.info.merge)};Object.keys(m).forEach(function(A){T(A)&&!R(A)&&uy(b,m,A,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,l=Object.create(null),u=i&&c.rootTypenamesById[i]||ha(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof u=="string"&&(l.__typename=u);var d=function(){var S=ls(arguments,l,o.variables);if(oe(S.from)){var _=o.incomingById.get(S.from.__ref);if(_){var T=c.readField(C(C({},S),{from:_.storeObject}),o);if(T!==void 0)return T}}return c.readField(S,o)},f=new Set;this.flattenFields(a,n,o,u).forEach(function(S,_){var T,R=Rt(_),A=n[R];if(f.add(_),A!==void 0){var N=c.getStoreFieldName({typename:u,fieldName:_.name.value,field:_,variables:S.variables}),L=Rd(s,N),P=t.processFieldValue(A,_,_.selectionSet?Gl(S,!1,!1):S,L),j=void 0;_.selectionSet&&(oe(P)||jr(P))&&(j=d("__typename",P));var ye=c.getMergeFunction(u,_.name.value,j);ye?L.info={field:_,typename:u,merge:ye}:$d(s,N),l=S.merge(l,(T={},T[N]=P,T))}else __DEV__&&!S.clientOnly&&!S.deferred&&!xi.added(_)&&!c.getReadFunction(u,_.name.value)&&__DEV__&&$.error("Missing field '".concat(Rt(_),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=c.identify(n,{typename:u,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:l,readField:d}),h=p[0],m=p[1];i=i||h,m&&(l=o.merge(l,m))}catch(S){if(!i)throw S}if(typeof i=="string"){var v=Xt(i),w=o.written[i]||(o.written[i]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(n,v,a,o)))return v;var b=o.incomingById.get(i);return b?(b.storeObject=o.merge(b.storeObject,l),b.mergeTree=Kl(b.mergeTree,s),f.forEach(function(S){return b.fieldNodeSet.add(S)})):o.incomingById.set(i,{storeObject:l,mergeTree:us(s)?void 0:s,fieldNodeSet:f}),v}return l},r.prototype.processFieldValue=function(e,t,i,n){var a=this;return!t.selectionSet||e===null?__DEV__?Qo(e):e:we(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,i,Rd(n,s));return $d(n,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:n})},r.prototype.flattenFields=function(e,t,i,n){n===void 0&&(n=ha(t,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new tr(!1);return function c(l,u){var d=s.lookup(l,u.clientOnly,u.deferred);d.visited||(d.visited=!0,l.selections.forEach(function(f){if(!!gr(f,i.variables)){var p=u.clientOnly,h=u.deferred;if(!(p&&h)&&qe(f.directives)&&f.directives.forEach(function(w){var b=w.name.value;if(b==="client"&&(p=!0),b==="defer"){var S=yr(w,i.variables);(!S||S.if!==!1)&&(h=!0)}}),Et(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Gl(i,p,h))}else{var v=Si(f,i.lookupFragment);if(!v&&f.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(f.name.value)):new J(8);v&&o.fragmentMatches(v,n,t,i.variables)&&c(v.selectionSet,Gl(i,p,h))}}}))}(e,i),a},r.prototype.applyMerges=function(e,t,i,n,a){var o,s=this;if(e.map.size&&!oe(i)){var c=!we(i)&&(oe(t)||jr(t))?t:void 0,l=i;c&&!a&&(a=[oe(c)?c.__ref:c]);var u,d=function(f,p){return we(f)?typeof p=="number"?f[p]:void 0:n.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(c,p),m=d(l,p);if(m!==void 0){a&&a.push(p);var v=s.applyMerges(f,h,m,n,a);v!==m&&(u=u||new Map,u.set(p,v)),a&&$(a.pop()===p)}}),u&&(i=we(l)?l.slice(0):C({},l),u.forEach(function(f,p){i[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},r}();var Fd=[];function Rd(r,e){var t=r.map;return t.has(e)||t.set(e,Fd.pop()||{map:new Map}),t.get(e)}function Kl(r,e){if(r===e||!e||us(e))return r;if(!r||us(r))return e;var t=r.info&&e.info?C(C({},r.info),e.info):r.info||e.info,i=r.map.size&&e.map.size,n=i?new Map:r.map.size?r.map:e.map,a={info:t,map:n};if(i){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Kl(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Kl(e.map.get(s),r.map.get(s)))})}return a}function us(r){return!r||!(r.info||r.map.size)}function $d(r,e){var t=r.map,i=t.get(e);i&&us(i)&&(Fd.push(i),t.delete(e))}var Pd=new Set;function uy(r,e,t,i){var n=function(d){var f=i.getFieldValue(d,t);return typeof f=="object"&&f},a=n(r);if(!!a){var o=n(e);if(!!o&&!oe(a)&&!Te(a,o)&&!Object.keys(a).every(function(d){return i.getFieldValue(o,d)!==void 0})){var s=i.getFieldValue(r,"__typename")||i.getFieldValue(e,"__typename"),c=Wt(t),l="".concat(s,".").concat(c);if(!Pd.has(l)){Pd.add(l);var u=[];!we(a)&&!we(o)&&[a,o].forEach(function(d){var f=i.getFieldValue(d,"__typename");typeof f=="string"&&!u.includes(f)&&u.push(f)}),__DEV__&&$.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
38
+ `):new J(23)};var Qf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var zf=function(r,e){var t=r.getContext(),i=t.uri;return i||(typeof e=="function"?e(r):e||"/graphql")};function Wf(r,e){var t=[],i=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=xa(e.variables,"Variables map")}catch(d){return{parseError:d}}i("variables",n)}if(e.extensions){var a=void 0;try{a=xa(e.extensions,"Extensions map")}catch(d){return{parseError:d}}i("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+t.join("&")+o;return{newURI:l}}var Hf=Ke(function(){return fetch}),Gf=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,i=r.fetch,n=r.print,a=n===void 0?qf:n,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,d=Xt(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&Vf(i||Hf);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Lt(function(p){var h=zf(p,t),m=p.getContext(),y={};if(m.clientAwareness){var w=m.clientAwareness,b=w.name,S=w.version;b&&(y["apollographql-client-name"]=b),S&&(y["apollographql-client-version"]=S)}var _=E(E({},y),m.headers),T={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:_},R=Bf(p,a,jf,f,T),A=R.options,N=R.body;if(N.variables&&!l){var L=new Set(Object.keys(N.variables));lt(p.query,{Variable:function(le,Jt,ne){ne&&ne.kind!=="VariableDefinition"&&L.delete(le.name.value)}}),L.size&&(N.variables=E({},N.variables),L.forEach(function(le){delete N.variables[le]}))}var $;if(!A.signal){var j=Qf(),ye=j.controller,qe=j.signal;$=ye,$&&(A.signal=qe)}var G=function(le){return le.kind==="OperationDefinition"&&le.operation==="mutation"};if(c&&!p.query.definitions.some(G)&&(A.method="GET"),yn(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var Ee=Wf(h,N),Ce=Ee.newURI,ue=Ee.parseError;if(ue)return Zo(ue);h=Ce}else try{A.body=xa(N,"Payload")}catch(le){return Zo(le)}return new ae(function(le){var Jt=i||Ke(function(){return fetch})||Hf;return Jt(h,A).then(function(ne){var Yt;p.setContext({response:ne});var Or=(Yt=ne.headers)===null||Yt===void 0?void 0:Yt.get("content-type");return Or!==null&&/^multipart\/mixed/i.test(Or)?Ff(ne,le):Uf(ne,p,le)}).catch(function(ne){return Xo(ne,le)}),function(){$&&$.abort()}})})};var Tu=function(r){Pe(e,r);function e(t){t===void 0&&(t={});var i=r.call(this,Gf(t).request)||this;return i.options=t,i}return e}(Lt);var{toString:Kf,hasOwnProperty:Rg}=Object.prototype,Zf=Function.prototype.toString,Iu=new Map;function Ie(r,e){try{return Ou(r,e)}finally{Iu.clear()}}function Ou(r,e){if(r===e)return!0;let t=Kf.call(r),i=Kf.call(e);if(t!==i)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Yf(r,e))return!0;let n=Jf(r),a=Jf(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Rg.call(e,n[s]))return!1;for(let s=0;s<o;++s){let c=n[s];if(!Ou(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(Yf(r,e))return!0;let n=r.entries(),a=t==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Ou(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let n=r.byteLength;if(n===e.byteLength)for(;n--&&r[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Zf.call(r);return n!==Zf.call(e)?!1:!Lg(n,$g)}}return!1}function Jf(r){return Object.keys(r).filter(Pg,r)}function Pg(r){return this[r]!==void 0}var $g="{ [native code] }";function Lg(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Yf(r,e){let t=Iu.get(r);if(t){if(t.has(e))return!0}else Iu.set(r,t=new Set);return t.add(e),!1}var Fg=function(){return Object.create(null)},Xf=Array.prototype,Mg=Xf.forEach,Ug=Xf.slice,rr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Fg),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return Mg.call(e,function(i){return t=t.getChildTrie(i)}),t.data||(t.data=this.makeData(Ug.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&jg(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=t.get(e);return i||t.set(e,i=new r(this.weakness,this.makeData)),i},r}();function jg(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var tt=null,ed={},qg=1,Bg=()=>class{constructor(){this.id=["slot",qg++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=tt;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===ed)break;return e!==tt&&(tt.slots[this.id]=t),!0}return tt&&(tt.slots[this.id]=ed),!1}getValue(){if(this.hasValue())return tt.slots[this.id]}withValue(e,t,i,n){let a={__proto__:null,[this.id]:e},o=tt;tt={parent:o,slots:a};try{return t.apply(n,i)}finally{tt=o}}static bind(e){let t=tt;return function(){let i=tt;try{return tt=t,e.apply(this,arguments)}finally{tt=i}}}static noContext(e,t,i){if(tt){let n=tt;try{return tt=null,e.apply(i,t)}finally{tt=n}}else return e.apply(i,t)}};function td(r){try{return r()}catch{}}var Du="@wry/context:Slot",Vg=td(()=>globalThis)||td(()=>global)||Object.create(null),rd=Vg,xn=rd[Du]||Array[Du]||function(r){try{Object.defineProperty(rd,Du,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(Bg());var{bind:Qg,noContext:zg}=xn;function Wg(){}var Hg=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=Wg),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var i=t.older,n=t.newer;n&&(n.older=i),i&&(i.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},r.prototype.set=function(e,t){var i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),ts=new xn,Nu,Gg=Object.prototype.hasOwnProperty,Pu=(Nu=Array.from,Nu===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Nu);function es(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Aa=[],Kg=100;function An(r,e){if(!r)throw new Error(e||"assertion failure")}function Zg(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function nd(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Jg(r){return r.slice(0)}var Yg=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!jr(this))return id(this),this.value[0]},r.prototype.recompute=function(e){return An(!this.recomputing,"already recomputing"),id(this),jr(this)?Xg(this,e):nd(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,ad(this),es(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),ld(this),$u(this,function(t,i){t.setDirty(),pd(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Aa.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Pu(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Aa.push(this.deps),this.deps=null)},r.count=0,r}();function id(r){var e=ts.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),jr(r)?sd(e,r):cd(e,r),e}function Xg(r,e){return ld(r),ts.withValue(r,ey,[r,e]),ry(r,e)&&ty(r),nd(r.value)}function ey(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function jr(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function ty(r){r.dirty=!1,!jr(r)&&od(r)}function ad(r){$u(r,sd)}function od(r){$u(r,cd)}function $u(r,e){var t=r.parents.size;if(t)for(var i=Pu(r.parents),n=0;n<t;++n)e(i[n],r)}function sd(r,e){An(r.childValues.has(e)),An(jr(e));var t=!jr(r);if(!r.dirtyChildren)r.dirtyChildren=Aa.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&ad(r)}function cd(r,e){An(r.childValues.has(e)),An(!jr(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Jg(e.value)):Zg(t,e.value)||r.setDirty(),ud(r,e),!jr(r)&&od(r)}function ud(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Aa.length<Kg&&Aa.push(t),r.dirtyChildren=null))}function ld(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){pd(r,t)}),r.forgetDeps(),An(r.dirtyChildren===null)}function pd(r,e){e.parents.delete(r),r.childValues.delete(e),ud(r,e)}function ry(r,e){if(typeof r.subscribe=="function")try{es(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var iy={setDirty:!0,dispose:!0,forget:!0};function rs(r){var e=new Map,t=r&&r.subscribe;function i(n){var a=ts.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof t=="function"&&(es(o),o.unsubscribe=t(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Gg.call(iy,o)?o:"setDirty";Pu(s).forEach(function(u){return u[c]()}),e.delete(a),es(s)}},i}function fd(){var r=new rr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var Sw=fd(),Ru=new Set;function Ti(r,e){e===void 0&&(e=Object.create(null));var t=new Hg(e.max||Math.pow(2,16),function(u){return u.dispose()}),i=e.keyArgs,n=e.makeCacheKey||fd(),a=function(){var u=n.apply(null,i?i.apply(null,arguments):arguments);if(u===void 0)return r.apply(null,arguments);var l=t.get(u);l||(t.set(u,l=new Yg(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Ru.add(t),ts.hasValue()||(Ru.forEach(function(f){return f.clean()}),Ru.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(u){var l=t.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Lu=function(){function r(){this.getFragmentDoc=Ti(ru)}return r.prototype.batch=function(e){var t=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(t)},i),n},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,i=e.data,n=Xt(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:i}))},r.prototype.writeFragment=function(e){var t=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=Xt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:t,result:i}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var n=i.readQuery(e),a=t(n);return a==null?n:(i.writeQuery(E(E({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var n=i.readFragment(e),a=t(n);return a==null?n:(i.writeFragment(E(E({},e),{data:a})),a)}})},r}();var ka=function(r){Pe(e,r);function e(t,i,n,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=i,s.query=n,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var $e=Object.prototype.hasOwnProperty;function Ta(r){return r==null}function ns(r,e){var t=r.__typename,i=r.id,n=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Ta(i)?Ta(n)?void 0:{_id:n}:{id:i}),Ta(i)&&!Ta(n)&&(i=n),!Ta(i)))return"".concat(t,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var dd={dataIdFromObject:ns,addTypename:!0,resultCaching:!0,canonizeResults:!1};function hd(r){return Ur(dd,r)}function as(r){var e=r.canonizeResults;return e===void 0?dd.canonizeResults:e}function md(r,e){return oe(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Fu=/^[_a-z][_0-9a-z]*/i;function Ht(r){var e=r.match(Fu);return e?e[0]:r}function is(r,e,t){return pe(e)?we(e)?e.every(function(i){return is(r,i,t)}):r.selections.every(function(i){if(xt(i)&&yr(i,t)){var n=Pt(i);return $e.call(e,n)&&(!i.selectionSet||is(i.selectionSet,e[n],t))}return!0}):!1}function qr(r){return pe(r)&&!oe(r)&&!we(r)}function gd(){return new vt}function os(r,e){var t=Si(Ei(r));return{fragmentMap:t,lookupFragment:function(i){var n=t[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var ss=Object.create(null),Mu=function(){return ss},yd=Object.create(null),kn=function(){function r(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return _a(oe(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return oe(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return er(n);if(oe(n))return n;var o=i.policies.identify(n)[0];if(o){var s=er(o);return a&&i.merge(o,n),s}}}return r.prototype.toObject=function(){return E({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),$e.call(this.data,e)){var i=this.data[e];if(i&&$e.call(i,t))return i[t]}if(t==="__typename"&&$e.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Br)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),$e.call(this.data,e))return this.data[e];if(this instanceof Br)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var i=this,n;oe(e)&&(e=e.__ref),oe(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof t=="string"?this.lookup(n=t):t;if(!!o){__DEV__?P(typeof n=="string","store.merge expects a string ID"):P(typeof n=="string",1);var s=new vt(ay).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(u){if(!a||a[u]!==s[u]){c[u]=1;var l=Ht(u);l!==u&&!i.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(i instanceof Br)&&delete s[u]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(u){return i.group.dirty(n,u)})}}},r.prototype.modify=function(e,t){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,c={DELETE:ss,INVALIDATE:yd,isReference:oe,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return i.policies.readField(typeof u=="string"?{fieldName:u,from:l||er(e)}:u,{store:i})}};if(Object.keys(n).forEach(function(u){var l=Ht(u),d=n[u];if(d!==void 0){var f=typeof t=="function"?t:t[u]||t[l];if(f){var p=f===Mu?ss:f(_a(d),E(E({},c),{fieldName:l,storeFieldName:u,storage:i.getStorage(e,u)}));p===yd?i.group.dirty(e,u):(p===ss&&(p=void 0),p!==d&&(a[u]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Br?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&i?this.policies.getStoreFieldName({typename:o,fieldName:t,args:i}):t;return this.modify(e,s?(n={},n[s]=Mu,n):Mu)}return!1},r.prototype.evict=function(e,t){var i=!1;return e.id&&($e.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof Br&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){$e.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(t.__META={extraRootIds:i.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&$e.call(e,a)||t.delete(a)}),e){var i=e.__META,n=Xt(e,["__META"]);Object.keys(n).forEach(function(a){t.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Br?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach(function(o){$e.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof Br;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},r.prototype.findChildRefIds=function(e){if(!$e.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var n=new Set([i]);n.forEach(function(a){oe(a)&&(t[a.__ref]=!0),pe(a)&&Object.keys(a).forEach(function(o){var s=a[o];pe(s)&&n.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var vd=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?rs():null,this.keyMaker=new rr($t)},r.prototype.depend=function(e,t){if(this.d){this.d(Uu(e,t));var i=Ht(t);i!==t&&this.d(Uu(e,i)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Uu(e,t),t==="__exists"?"forget":"setDirty")},r}();function Uu(r,e){return e+"#"+r}function ju(r,e){Ii(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Pe(i,t);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,c=n.seed,u=t.call(this,a,new vd(s))||this;return u.stump=new ny(u),u.storageTrie=new rr($t),c&&u.replace(c),u}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(r);r.Root=e})(kn||(kn={}));var Br=function(r){Pe(e,r);function e(t,i,n,a){var o=r.call(this,i.policies,a)||this;return o.id=t,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(t,i){return new e(t,this,i,this.group)},e.prototype.removeLayer=function(t){var i=this,n=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Ie(o[c],s[c])||i.group.dirty(a,c)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){i.group.dirty(a,c)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return E(E({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return $e.call(this.data,t)?E(E({},i),r.prototype.findChildRefIds.call(this,t)):i},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(kn),ny=function(r){Pe(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new vd(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Br);function ay(r,e,t){var i=r[t],n=e[t];return Ie(i,n)?i:n}function Ii(r){return!!(r instanceof kn&&r.group.caching)}function oy(r){return pe(r)?we(r)?r.slice(0):E({__proto__:Object.getPrototypeOf(r)},r):r}var cs=function(){function r(){this.known=new(wf?WeakSet:Set),this.pool=new rr($t),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return pe(e)&&this.known.has(e)},r.prototype.pass=function(e){if(pe(e)){var t=oy(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(pe(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),u.sorted.forEach(function(p,h){d[p]=c[l+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var n=JSON.stringify(t);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:t,json:n})}return i.keys},r}();var At=Object.assign(function(r){if(pe(r)){qu===void 0&&bd();var e=qu.admit(r),t=Bu.get(e);return t===void 0&&Bu.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:bd}),qu,Bu;function bd(){qu=new cs,Bu=new($t?WeakMap:Map)}function _d(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Sd=function(){function r(e){var t=this;this.knownResults=new($t?WeakMap:Map),this.config=Ur(e,{addTypename:e.addTypename!==!1,canonizeResults:as(e)}),this.canon=e.canon||new cs,this.executeSelectionSet=Ti(function(i){var n,a=i.context.canonizeResults,o=_d(i);o[3]=!a;var s=(n=t.executeSelectionSet).peek.apply(n,o);return s?a?E(E({},s),{result:t.canon.admit(s.result)}):s:(ju(i.context.store,i.enclosingRef.__ref),t.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:_d,makeCacheKey:function(i,n,a,o){if(Ii(a.store))return a.store.makeCacheKey(i,oe(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=Ti(function(i){return ju(i.context.store,i.enclosingRef.__ref),t.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(Ii(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new cs},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,d=this.config.cache.policies;o=E(E({},xi(ya(i))),o);var f=er(a),p=this.executeSelectionSet({selectionSet:Ci(i).selectionSet,objectOrReference:f,enclosingRef:f,context:E({store:t,query:i,policies:d,variables:o,varString:At(o),canonizeResults:l},os(i,this.config.fragments))}),h;if(p.missing&&(h=[new ka(sy(p.missing),p.missing,i,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,i,n){if(Ii(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,t,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(oe(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(n,"__typename"),d=[],f,p=new vt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(S,_){var T;return S.missing&&(f=p.merge(f,(T={},T[_]=S.missing,T))),S.result}var m=new Set(i.selections);m.forEach(function(S){var _,T;if(!!yr(S,s))if(xt(S)){var R=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:n},o),A=Pt(S);R===void 0?Ai.added(S)||(f=p.merge(f,(_={},_[A]="Can't find field '".concat(S.name.value,"' on ").concat(oe(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),_))):we(R)?R=h(t.executeSubSelectedArray({field:S,array:R,enclosingRef:a,context:o}),A):S.selectionSet?R!=null&&(R=h(t.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:R,enclosingRef:oe(R)?R:a,context:o}),A)):o.canonizeResults&&(R=t.canon.pass(R)),R!==void 0&&d.push((T={},T[A]=R,T))}else{var N=wi(S,o.lookupFragment);if(!N&&S.kind===Ue.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(S.name.value)):new J(5);N&&c.fragmentMatches(N,l)&&N.selectionSet.selections.forEach(m.add,m)}});var y=va(d),w={result:y,missing:f},b=o.canonizeResults?this.canon.admit(w):_a(w);return b.result&&this.knownResults.set(b.result,i),b},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,c=new vt;function u(l,d){var f;return l.missing&&(s=c.merge(s,(f={},f[d]=l.missing,f))),l.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(l,d){return l===null?null:we(l)?u(t.executeSubSelectedArray({field:i,array:l,enclosingRef:a,context:o}),d):i.selectionSet?u(t.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:l,enclosingRef:oe(l)?l:a,context:o}),d):(__DEV__&&cy(o.store,i,l),l)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},r}();function sy(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function cy(r,e,t){if(!e.selectionSet){var i=new Set([t]);i.forEach(function(n){pe(n)&&(__DEV__?P(!oe(n),"Missing selection set for object of type ".concat(md(r,n)," returned for query field ").concat(e.name.value)):P(!oe(n),6),Object.values(n).forEach(i.add,i))})}}var Tn=new xn,wd=new WeakMap;function Ia(r){var e=wd.get(r);return e||wd.set(r,e={vars:new Set,dep:rs()}),e}function Vu(r){Ia(r).vars.forEach(function(e){return e.forgetCache(r)})}function Ed(r){Ia(r).vars.forEach(function(e){return e.attachCache(r)})}function us(r){var e=new Set,t=new Set,i=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){Ia(c).dep.dirty(i),uy(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=Tn.getValue();s&&(n(s),Ia(s).dep(i))}return r};i.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var n=i.attachCache=function(a){return e.add(a),Ia(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function uy(r){r.broadcastWatches&&r.broadcastWatches()}var Cd=Object.create(null);function Qu(r){var e=JSON.stringify(r);return Cd[e]||(Cd[e]=Object.create(null))}function zu(r){var e=Qu(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=Hu(r,function(o){var s=In(i.storeObject,o,n);return s===void 0&&t!==i.storeObject&&$e.call(t,o[0])&&(s=In(t,o,Ad)),__DEV__?P(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):P(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function Wu(r){var e=Qu(r);return e.keyArgsFn||(e.keyArgsFn=function(t,i){var n=i.field,a=i.variables,o=i.fieldName,s=Hu(r,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(n&&Be(n.directives)){var f=l.slice(1),p=n.directives.find(function(w){return w.name.value===f}),h=p&&vr(p,a);return h&&In(h,u.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&$e.call(a,m)){var y=u.slice(0);return y[0]=m,In(a,y)}return}if(t)return In(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Hu(r,e){var t=new vt;return xd(r).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=t.merge(i,o)}return i},Object.create(null))}function xd(r){var e=Qu(r);if(!e.paths){var t=e.paths=[],i=[];r.forEach(function(n,a){we(n)?(xd(n).forEach(function(o){return t.push(i.concat(o))}),i.length=0):(i.push(n),we(r[a+1])||(t.push(i.slice(0)),i.length=0))})}return e.paths}function Ad(r,e){return r[e]}function In(r,e,t){return t=t||Ad,kd(e.reduce(function i(n,a){return we(n)?n.map(function(o){return i(o,a)}):n&&t(n,a)},r))}function kd(r){return pe(r)?we(r)?r.map(kd):Hu(Object.keys(r).sort(),function(e){return In(r,e)}):r}ma.setStringify(At);function Gu(r){return r.args!==void 0?r.args:r.field?vr(r.field,r.variables):null}var ly=function(){},Td=function(r,e){return e.fieldName},Id=function(r,e,t){var i=t.mergeObjects;return i(r,e)},Od=function(r,e){return e},Nd=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=E({dataIdFromObject:ns},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var i,n=this,a=t&&(t.typename||((i=t.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=E(E({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=ls(arguments,o);return n.readField(f,{store:n.cache.data,variables:f.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(we(d))l=zu(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,c=Xt(n,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",i),o&&t.setRootTypename("Mutation",i),s&&t.setRootTypename("Subscription",i),$e.call(t.toBeAdded,i)?t.toBeAdded[i].push(c):t.toBeAdded[i]=[c]})},r.prototype.updateTypePolicy=function(e,t){var i=this,n=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?Id:u===!1?Od:c.merge}s(n,t.merge),n.keyFn=a===!1?ly:we(a)?zu(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(c){var u=i.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var d=l.keyArgs,f=l.read,p=l.merge;u.keyFn=d===!1?Td:we(d)?Wu(d):typeof d=="function"?d:u.keyFn,typeof f=="function"&&(u.read=f),s(u,p)}u.read&&u.merge&&(u.keyFn=u.keyFn||Td)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];t!==n&&(__DEV__?P(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):P(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){t.getSupertypeSet(i,!0),e[i].forEach(function(n){t.getSupertypeSet(n,!0).add(i);var a=n.match(Fu);(!a||a[0]!==n)&&t.fuzzySubtypes.set(n,new RegExp(n))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!$e.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,u=Xt(s,["fields"]);Object.assign(i,u),Object.assign(i.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,i){if(e){var n=this.getTypePolicy(e).fields;return n[t]||i&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},r.prototype.fragmentMatches=function(e,t,i,n){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],u=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},l=!!(i&&this.fuzzySubtypes.size),d=!1,f=0;f<c.length;++f){var p=c[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&P.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(u),l&&f===c.length-1&&is(e.selectionSet,i,n)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var y=t.match(h);y&&y[0]===t&&u(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!!(i&&i.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,i=e.fieldName,n=this.getFieldPolicy(t,i,!1),a,o=n&&n.keyFn;if(o&&t)for(var s={typename:t,fieldName:i,field:e.field||null,variables:e.variables},c=Gu(e);o;){var u=o(c,s);if(we(u))o=Wu(u);else{a=u||i;break}}return a===void 0&&(a=e.field?nu(e.field,e.variables):ma(i,Gu(e))),a===!1?i:i===Ht(a)?a:i+":"+a},r.prototype.readField=function(e,t){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=t.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Ht(o),c=t.store.getFieldValue(i,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=Dd(this,i,e,t,t.store.getStorage(oe(i)?i.__ref:i,o));return Tn.withValue(this.cache,l,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},r.prototype.getMergeFunction=function(e,t,i){var n=this.getFieldPolicy(e,t,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},r.prototype.runMergeFunction=function(e,t,i,n,a){var o=i.field,s=i.typename,c=i.merge;return c===Id?Rd(n.store)(e,t):c===Od?t:(n.overwrite&&(e=void 0),c(e,t,Dd(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},r}();function Dd(r,e,t,i,n){var a=r.getStoreFieldName(t),o=Ht(a),s=t.variables||i.variables,c=i.store,u=c.toReference,l=c.canRead;return{args:Gu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:oe,toReference:u,storage:n,cache:r.cache,canRead:l,readField:function(){return r.readField(ls(arguments,e,s),i)},mergeObjects:Rd(i.store)}}function ls(r,e,t){var i=r[0],n=r[1],a=r.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=E({},i),$e.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&P.warn("Undefined 'from' passed to readField with arguments ".concat(Af(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function Rd(r){return function(t,i){if(we(t)||we(i))throw __DEV__?new J("Cannot automatically merge arrays"):new J(4);if(pe(t)&&pe(i)){var n=r.getFieldValue(t,"__typename"),a=r.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(oe(t)&&qr(i))return r.merge(t.__ref,i),t;if(qr(t)&&oe(i))return r.merge(t,i.__ref),i;if(qr(t)&&qr(i))return E(E({},t),i)}return i}}function Ku(r,e,t){var i="".concat(e).concat(t),n=r.flavors.get(i);return n||r.flavors.set(i,n=r.clientOnly===e&&r.deferred===t?r:E(E({},r),{clientOnly:e,deferred:t})),n}var Fd=function(){function r(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return r.prototype.writeToStore=function(e,t){var i=this,n=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,u=tr(n),l=gd();s=E(E({},xi(u)),s);var d=E(E({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:At(s)},os(n,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:d});if(!oe(f))throw __DEV__?new J("Could not identify object ".concat(JSON.stringify(a))):new J(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,y=p.mergeTree,w=p.fieldNodeSet,b=er(h);if(y&&y.map.size){var S=i.applyMerges(y,b,m,d);if(oe(S))return;m=S}if(__DEV__&&!d.overwrite){var _=Object.create(null);w.forEach(function(A){A.selectionSet&&(_[A.name.value]=!0)});var T=function(A){return _[Ht(A)]===!0},R=function(A){var N=y&&y.map.get(A);return Boolean(N&&N.info&&N.info.merge)};Object.keys(m).forEach(function(A){T(A)&&!R(A)&&py(b,m,A,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=i&&c.rootTypenamesById[i]||ga(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof l=="string"&&(u.__typename=l);var d=function(){var S=ls(arguments,u,o.variables);if(oe(S.from)){var _=o.incomingById.get(S.from.__ref);if(_){var T=c.readField(E(E({},S),{from:_.storeObject}),o);if(T!==void 0)return T}}return c.readField(S,o)},f=new Set;this.flattenFields(a,n,o,l).forEach(function(S,_){var T,R=Pt(_),A=n[R];if(f.add(_),A!==void 0){var N=c.getStoreFieldName({typename:l,fieldName:_.name.value,field:_,variables:S.variables}),L=Pd(s,N),$=t.processFieldValue(A,_,_.selectionSet?Ku(S,!1,!1):S,L),j=void 0;_.selectionSet&&(oe($)||qr($))&&(j=d("__typename",$));var ye=c.getMergeFunction(l,_.name.value,j);ye?L.info={field:_,typename:l,merge:ye}:$d(s,N),u=S.merge(u,(T={},T[N]=$,T))}else __DEV__&&!S.clientOnly&&!S.deferred&&!Ai.added(_)&&!c.getReadFunction(l,_.name.value)&&__DEV__&&P.error("Missing field '".concat(Pt(_),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=c.identify(n,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:d}),h=p[0],m=p[1];i=i||h,m&&(u=o.merge(u,m))}catch(S){if(!i)throw S}if(typeof i=="string"){var y=er(i),w=o.written[i]||(o.written[i]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(n,y,a,o)))return y;var b=o.incomingById.get(i);return b?(b.storeObject=o.merge(b.storeObject,u),b.mergeTree=Zu(b.mergeTree,s),f.forEach(function(S){return b.fieldNodeSet.add(S)})):o.incomingById.set(i,{storeObject:u,mergeTree:ps(s)?void 0:s,fieldNodeSet:f}),y}return u},r.prototype.processFieldValue=function(e,t,i,n){var a=this;return!t.selectionSet||e===null?__DEV__?zo(e):e:we(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,i,Pd(n,s));return $d(n,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:n})},r.prototype.flattenFields=function(e,t,i,n){n===void 0&&(n=ga(t,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new rr(!1);return function c(u,l){var d=s.lookup(u,l.clientOnly,l.deferred);d.visited||(d.visited=!0,u.selections.forEach(function(f){if(!!yr(f,i.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&Be(f.directives)&&f.directives.forEach(function(w){var b=w.name.value;if(b==="client"&&(p=!0),b==="defer"){var S=vr(w,i.variables);(!S||S.if!==!1)&&(h=!0)}}),xt(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Ku(i,p,h))}else{var y=wi(f,i.lookupFragment);if(!y&&f.kind===Ue.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(f.name.value)):new J(8);y&&o.fragmentMatches(y,n,t,i.variables)&&c(y.selectionSet,Ku(i,p,h))}}}))}(e,i),a},r.prototype.applyMerges=function(e,t,i,n,a){var o,s=this;if(e.map.size&&!oe(i)){var c=!we(i)&&(oe(t)||qr(t))?t:void 0,u=i;c&&!a&&(a=[oe(c)?c.__ref:c]);var l,d=function(f,p){return we(f)?typeof p=="number"?f[p]:void 0:n.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(c,p),m=d(u,p);if(m!==void 0){a&&a.push(p);var y=s.applyMerges(f,h,m,n,a);y!==m&&(l=l||new Map,l.set(p,y)),a&&P(a.pop()===p)}}),l&&(i=we(u)?u.slice(0):E({},u),l.forEach(function(f,p){i[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},r}();var Md=[];function Pd(r,e){var t=r.map;return t.has(e)||t.set(e,Md.pop()||{map:new Map}),t.get(e)}function Zu(r,e){if(r===e||!e||ps(e))return r;if(!r||ps(r))return e;var t=r.info&&e.info?E(E({},r.info),e.info):r.info||e.info,i=r.map.size&&e.map.size,n=i?new Map:r.map.size?r.map:e.map,a={info:t,map:n};if(i){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Zu(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Zu(e.map.get(s),r.map.get(s)))})}return a}function ps(r){return!r||!(r.info||r.map.size)}function $d(r,e){var t=r.map,i=t.get(e);i&&ps(i)&&(Md.push(i),t.delete(e))}var Ld=new Set;function py(r,e,t,i){var n=function(d){var f=i.getFieldValue(d,t);return typeof f=="object"&&f},a=n(r);if(!!a){var o=n(e);if(!!o&&!oe(a)&&!Ie(a,o)&&!Object.keys(a).every(function(d){return i.getFieldValue(o,d)!==void 0})){var s=i.getFieldValue(r,"__typename")||i.getFieldValue(e,"__typename"),c=Ht(t),u="".concat(s,".").concat(c);if(!Ld.has(u)){Ld.add(u);var l=[];!we(a)&&!we(o)&&[a,o].forEach(function(d){var f=i.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&P.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
39
39
 
40
- To address this problem (which is not a bug in Apollo Client), `).concat(u.length?"either ensure all objects of type "+u.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(l,` field, so InMemoryCache can safely merge these objects:
40
+ To address this problem (which is not a bug in Apollo Client), `).concat(l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(u,` field, so InMemoryCache can safely merge these objects:
41
41
 
42
42
  existing: `).concat(JSON.stringify(a).slice(0,1e3),`
43
43
  incoming: `).concat(JSON.stringify(o).slice(0,1e3),`
@@ -46,27 +46,27 @@ For more information about these options, please refer to the documentation:
46
46
 
47
47
  * Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers
48
48
  * Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects
49
- `))}}}}var Ta=function(r){Re(e,r);function e(t){t===void 0&&(t={});var i=r.call(this)||this;return i.watches=new Set,i.typenameDocumentCache=new Map,i.makeVar=cs,i.txCount=0,i.config=dd(t),i.addTypename=!!i.config.addTypename,i.policies=new Dd({cache:i,dataIdFromObject:i.config.dataIdFromObject,possibleTypes:i.config.possibleTypes,typePolicies:i.config.typePolicies}),i.init(),i}return e.prototype.init=function(){var t=this.data=new An.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var i=this,n=this.storeReader,a=this.config.fragments;this.storeWriter=new Ld(this,this.storeReader=new _d({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:ns(this.config),canon:t?void 0:n&&n.canon,fragments:a}),a),this.maybeBroadcastWatch=ki(function(o,s){return i.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?i.optimisticData:i.data;if(Ti(s)){var c=o.optimistic,l=o.id,u=o.variables;return s.makeCacheKey(o.query,o.callback,xt({optimistic:c,id:l,variables:u}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var i=t.returnPartialData,n=i===void 0?!1:i;try{return this.storeReader.diffQueryAgainstStore(C(C({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:n})).result||null}catch(a){if(a instanceof xa)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if($e.call(t,"id")&&!t.id)return!1;var i=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,i.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(C(C({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var i=this;return this.watches.size||wd(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){i.watches.delete(t)&&!i.watches.size&&Bl(i),i.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){xt.reset();var i=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(t,i){return(i?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,i){return(i?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(oe(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(i){__DEV__&&$.warn(i)}},e.prototype.evict=function(t){if(!t.id){if($e.call(t,"id"))return!1;t=C(C({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var i=this;return this.init(),xt.reset(),t&&t.discardWatches?(this.watches.forEach(function(n){return i.maybeBroadcastWatch.forget(n)}),this.watches.clear(),Bl(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var i=this.optimisticData.removeLayer(t);i!==this.optimisticData&&(this.optimisticData=i,this.broadcastWatches())},e.prototype.batch=function(t){var i=this,n=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,l,u=function(f){var p=i,h=p.data,m=p.optimisticData;++i.txCount,f&&(i.data=i.optimisticData=f);try{return l=n(i)}finally{--i.txCount,i.data=h,i.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(C(C({},t),{onWatchUpdated:function(f){return d.add(f),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,u):o===!1?u(this.data):u(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&d.size?(this.broadcastWatches(C(C({},t),{onWatchUpdated:function(f,p){var h=c.call(this,f,p);return h!==!1&&d.delete(f),h}})),d.size&&d.forEach(function(f){return i.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(t),l},e.prototype.performTransaction=function(t,i){return this.batch({update:t,optimistic:i||i!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var i=this.typenameDocumentCache.get(t);return i||(i=xi(t),this.typenameDocumentCache.set(t,i),this.typenameDocumentCache.set(i,i)),i}return t},e.prototype.transformForLink=function(t){var i=this.config.fragments;return i?i.transform(t):t},e.prototype.broadcastWatches=function(t){var i=this;this.txCount||this.watches.forEach(function(n){return i.maybeBroadcastWatch(n,t)})},e.prototype.broadcastWatch=function(t,i){var n=t.lastDiff,a=this.diff(t);i&&(t.optimistic&&typeof i.optimistic=="string"&&(a.fromOptimisticTransaction=!0),i.onWatchUpdated&&i.onWatchUpdated.call(this,t,a,n)===!1)||(!n||!Te(n.result,a.result))&&t.callback(t.lastDiff=a,n)},e}(Pl);function Md(r){return r.hasOwnProperty("graphQLErrors")}var py=function(r){var e="";if(qe(r.graphQLErrors)||qe(r.clientErrors)){var t=(r.graphQLErrors||[]).concat(r.clientErrors||[]);t.forEach(function(i){var n=i?i.message:"Error message not found.";e+="".concat(n,`
49
+ `))}}}}var Oa=function(r){Pe(e,r);function e(t){t===void 0&&(t={});var i=r.call(this)||this;return i.watches=new Set,i.typenameDocumentCache=new Map,i.makeVar=us,i.txCount=0,i.config=hd(t),i.addTypename=!!i.config.addTypename,i.policies=new Nd({cache:i,dataIdFromObject:i.config.dataIdFromObject,possibleTypes:i.config.possibleTypes,typePolicies:i.config.typePolicies}),i.init(),i}return e.prototype.init=function(){var t=this.data=new kn.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var i=this,n=this.storeReader,a=this.config.fragments;this.storeWriter=new Fd(this,this.storeReader=new Sd({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:as(this.config),canon:t?void 0:n&&n.canon,fragments:a}),a),this.maybeBroadcastWatch=Ti(function(o,s){return i.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?i.optimisticData:i.data;if(Ii(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,At({optimistic:c,id:u,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var i=t.returnPartialData,n=i===void 0?!1:i;try{return this.storeReader.diffQueryAgainstStore(E(E({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:n})).result||null}catch(a){if(a instanceof ka)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if($e.call(t,"id")&&!t.id)return!1;var i=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,i.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(E(E({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var i=this;return this.watches.size||Ed(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){i.watches.delete(t)&&!i.watches.size&&Vu(i),i.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){At.reset();var i=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(t,i){return(i?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,i){return(i?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(oe(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(i){__DEV__&&P.warn(i)}},e.prototype.evict=function(t){if(!t.id){if($e.call(t,"id"))return!1;t=E(E({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var i=this;return this.init(),At.reset(),t&&t.discardWatches?(this.watches.forEach(function(n){return i.maybeBroadcastWatch.forget(n)}),this.watches.clear(),Vu(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var i=this.optimisticData.removeLayer(t);i!==this.optimisticData&&(this.optimisticData=i,this.broadcastWatches())},e.prototype.batch=function(t){var i=this,n=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,u,l=function(f){var p=i,h=p.data,m=p.optimisticData;++i.txCount,f&&(i.data=i.optimisticData=f);try{return u=n(i)}finally{--i.txCount,i.data=h,i.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(E(E({},t),{onWatchUpdated:function(f){return d.add(f),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&d.size?(this.broadcastWatches(E(E({},t),{onWatchUpdated:function(f,p){var h=c.call(this,f,p);return h!==!1&&d.delete(f),h}})),d.size&&d.forEach(function(f){return i.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(t),u},e.prototype.performTransaction=function(t,i){return this.batch({update:t,optimistic:i||i!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var i=this.typenameDocumentCache.get(t);return i||(i=Ai(t),this.typenameDocumentCache.set(t,i),this.typenameDocumentCache.set(i,i)),i}return t},e.prototype.transformForLink=function(t){var i=this.config.fragments;return i?i.transform(t):t},e.prototype.broadcastWatches=function(t){var i=this;this.txCount||this.watches.forEach(function(n){return i.maybeBroadcastWatch(n,t)})},e.prototype.broadcastWatch=function(t,i){var n=t.lastDiff,a=this.diff(t);i&&(t.optimistic&&typeof i.optimistic=="string"&&(a.fromOptimisticTransaction=!0),i.onWatchUpdated&&i.onWatchUpdated.call(this,t,a,n)===!1)||(!n||!Ie(n.result,a.result))&&t.callback(t.lastDiff=a,n)},e}(Lu);function Ud(r){return r.hasOwnProperty("graphQLErrors")}var fy=function(r){var e="";if(Be(r.graphQLErrors)||Be(r.clientErrors)){var t=(r.graphQLErrors||[]).concat(r.clientErrors||[]);t.forEach(function(i){var n=i?i.message:"Error message not found.";e+="".concat(n,`
50
50
  `)})}return r.networkError&&(e+="".concat(r.networkError.message,`
51
- `)),e=e.replace(/\n$/,""),e},vr=function(r){Re(e,r);function e(t){var i=t.graphQLErrors,n=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=i||[],c.clientErrors=n||[],c.networkError=a||null,c.message=o||py(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var ve;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(ve||(ve={}));function Br(r){return r?r<7:!1}var fy=Object.assign,dy=Object.hasOwnProperty,ps=function(r){Re(e,r);function e(t){var i=t.queryManager,n=t.queryInfo,a=t.options,o=r.call(this,function(v){try{var w=v._subscription._observer;w&&!w.error&&(w.error=hy)}catch{}var b=!o.observers.size;o.observers.add(v);var S=o.last;return S&&S.error?v.error&&v.error(S.error):S&&S.result&&v.next&&v.next(S.result),b&&o.reobserve().catch(function(){}),function(){o.observers.delete(v)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=n,o.queryManager=i,o.isTornDown=!1;var s=i.defaultOptions.watchQuery,c=s===void 0?{}:s,l=c.fetchPolicy,u=l===void 0?"cache-first":l,d=a.fetchPolicy,f=d===void 0?u:d,p=a.initialFetchPolicy,h=p===void 0?f==="standby"?u:f:p;o.options=C(C({},a),{initialFetchPolicy:h,fetchPolicy:f}),o.queryId=n.queryId||i.generateQueryId();var m=er(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(i,n){var a={next:function(s){i(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:n},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var i=this.getLastResult(!0),n=this.queryInfo.networkStatus||i&&i.networkStatus||ve.ready,a=C(C({},i),{loading:Br(n),networkStatus:n}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(a.data=c.result),Te(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===ve.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=ve.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Jl(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,i){return!this.last||!Te(this.last.result,t)||i&&!Te(this.last.variables,i)},e.prototype.getLast=function(t,i){var n=this.last;if(n&&n[t]&&(!i||Te(n.variables,this.variables)))return n[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var i,n={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?n.fetchPolicy=a:a==="no-cache"?n.fetchPolicy="no-cache":n.fetchPolicy="network-only",__DEV__&&t&&dy.call(t,"variables")){var o=ma(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&$.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((i=o.name)===null||i===void 0?void 0:i.value)||JSON.stringify(o),`, which does not declare a $variables variable.
52
- Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Te(this.options.variables,t)&&(n.variables=this.options.variables=C(C({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,ve.refetch)},e.prototype.fetchMore=function(t){var i=this,n=C(C({},t.query?t:C(C(C(C({},this.options),{query:this.query}),t),{variables:C(C({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=ve.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,ve.fetchMore).then(function(l){return i.queryManager.removeQuery(a),o.networkStatus===ve.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(u){var d=t.updateQuery;d?u.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:l.data,variables:n.variables})}):u.writeQuery({query:n.query,variables:n.variables,data:l.data})},onWatchUpdated:function(u){c.add(u.query)}}),l}).finally(function(){c.has(i.query)||Zl(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var l=c.variables;return o(s,{subscriptionData:a,variables:l})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&$.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Te(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},ve.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?$(a,"Attempted to start a polling query without a polling interval."):$(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Br(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ve.poll).then(c,c))},c=function(){var l=t.pollingInfo;l&&(clearTimeout(l.timeout),l.timeout=setTimeout(s,l.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=C(C({},this.last),{result:this.queryManager.assumeImmutableResults?t:Qo(t),variables:i}),qe(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===ve.refetch||i===ve.fetchMore||i===ve.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Mr(this.options,t||{}),l=a?c:fy(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Te(t.variables,o)&&l.fetchPolicy!=="standby"&&l.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",l),i===void 0&&(i=ve.setVariables)));var u=l.variables&&C({},l.variables),d=this.fetch(l,i),f={next:function(p){n.reportResult(p,u)},error:function(p){n.reportError(p,u)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),Ai(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=C(C({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:ve.error,loading:!1});this.updateLastResult(n,i),Ai(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ae);Wo(ps);function Zl(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function hy(r){__DEV__&&$.error("Unhandled error",r.message,r.stack)}function Jl(r){__DEV__&&r&&__DEV__&&$.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var fs=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=ul(t.resolvers,i)}):this.resolvers=ul(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Bt(this,void 0,void 0,function(){return Vt(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(l){return C(C({},i),{data:l.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return gn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return ll(e)},r.prototype.prepareContext=function(e){var t=this.cache;return C(C({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),Bt(this,void 0,void 0,function(){return Vt(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return C(C({},t),a.exportedVariables)})]:[2,C({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return ct(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return bi}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:cl(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Bt(this,void 0,void 0,function(){var s,c,l,u,d,f,p,h,m,v,w;return Vt(this,function(b){return s=Ci(e),c=wi(e),l=_i(c),u=this.collectSelectionsToResolve(s,l),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,v={fragmentMap:l,context:C(C({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:u,onlyRunForcedResolvers:o},w=!1,[2,this.resolveSelectionSet(s.selectionSet,w,t,v).then(function(S){return{result:S,exportedVariables:v.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return Bt(this,void 0,void 0,function(){var a,o,s,c,l,u=this;return Vt(this,function(d){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],l=function(f){return Bt(u,void 0,void 0,function(){var p,h;return Vt(this,function(m){return!t&&!n.selectionsToResolve.has(f)?[2]:gr(f,s)?Et(f)?[2,this.resolveField(f,t,i,n).then(function(v){var w;typeof v<"u"&&c.push((w={},w[Rt(f)]=v,w))})]:(nl(f)?p=f:(p=a[f.name.value],__DEV__?$(p,"No fragment named ".concat(f.name.value)):$(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(v){c.push(v)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(l)).then(function(){return ga(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return Bt(this,void 0,void 0,function(){var a,o,s,c,l,u,d,f,p,h=this;return Vt(this,function(m){return i?(a=n.variables,o=e.name.value,s=Rt(e),c=o!==s,l=i[s]||i[o],u=Promise.resolve(l),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=i.__typename||n.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(u=Promise.resolve(kn.withValue(this.cache,p,[i,yr(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,u.then(function(v){var w,b;if(v===void 0&&(v=l),e.directives&&e.directives.forEach(function(_){_.name.value==="export"&&_.arguments&&_.arguments.forEach(function(T){T.name.value==="as"&&T.value.kind==="StringValue"&&(n.exportedVariables[T.value.value]=v)})}),!e.selectionSet||v==null)return v;var S=(b=(w=e.directives)===null||w===void 0?void 0:w.some(function(_){return _.name.value==="client"}))!==null&&b!==void 0?b:!1;if(Array.isArray(v))return h.resolveSubSelectedArray(e,t||S,v,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||S,v,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),ct(o,{Directive:function(c,l,u,d,f){c.name.value==="client"&&f.forEach(function(p){i(p)&&pa(p)&&s.add(p)})},FragmentSpread:function(c,l,u,d,f){var p=t[c.name.value];__DEV__?$(p,"No fragment named ".concat(c.name.value)):$(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){i(m)&&pa(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var In=new($t?WeakMap:Map);function Yl(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return In.set(r,(In.get(r)+1)%1e15),t.apply(this,arguments)})}function Ud(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var ds=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;In.has(i)||(In.set(i,0),Yl(i,"evict"),Yl(i,"modify"),Yl(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||ve.loading;return this.variables&&this.networkStatus!==ve.loading&&!Te(this.variables,e.variables)&&(t=ve.setVariables),Te(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){Ud(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Te(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Te(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():Zl(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;Ud(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Br(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=C(C({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Te(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===In.get(this.cache)&&Te(t,i.variables)&&Te(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new yt,s=qe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&qe(e.incremental)){var c=Ho(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var l=this.getDiff();e.data=o.merge(l.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(hs(e,i.errorPolicy)?this.cache.performTransaction(function(u){if(a.shouldWrite(e,i.variables))u.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:In.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(i.variables),f=u.diff(d);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ve.ready},r.prototype.markError=function(e){return this.networkStatus=ve.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function hs(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!wn(r);return!i&&t&&r.data&&(i=!0),i}var my=Object.prototype.hasOwnProperty,jd=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,l=c===void 0?!1:c,u=e.clientAwareness,d=u===void 0?{}:u,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new($t?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new fs({cache:t}),this.ssrMode=l,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new J("QueryManager stopped while query was in flight"):new J(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,l=c===void 0?[]:c,u=e.awaitRefetchQueries,d=u===void 0?!1:u,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,v=e.errorPolicy,w=v===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":v,b=e.keepRootFields,S=e.context;return Bt(this,void 0,void 0,function(){var _,T,R,A,N,L;return Vt(this,function(P){switch(P.label){case 0:return __DEV__?$(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):$(n,15),__DEV__?$(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):$(m==="network-only"||m==="no-cache",16),_=this.generateMutationId(),T=this.transform(n),R=T.document,A=T.hasClientExports,n=this.cache.transformForLink(R),a=this.getVariables(n,a),A?[4,this.localState.addExportedVariables(n,a,S)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return N=this.mutationStore&&(this.mutationStore[_]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:_,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,updateQueries:s,update:f,keepRootFields:b}),this.broadcastQueries(),L=this,[2,new Promise(function(j,ye){return zo(L.getObservableFromLink(n,C(C({},S),{optimisticResponse:o}),a,!1),function(je){if(wn(je)&&w==="none")throw new vr({graphQLErrors:Go(je)});N&&(N.loading=!1,N.error=null);var G=C({},je);return typeof l=="function"&&(l=l(G)),w==="ignore"&&wn(G)&&delete G.errors,L.markMutationResult({mutationId:_,result:G,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:l,removeOptimistic:o?_:void 0,onQueryUpdated:p,keepRootFields:b})}).subscribe({next:function(je){L.broadcastQueries(),(!("hasNext"in je)||je.hasNext===!1)&&j(je)},error:function(je){N&&(N.loading=!1,N.error=je),o&&L.cache.removeOptimistic(_),L.broadcastQueries(),ye(je instanceof vr?je:new vr({networkError:je}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&hs(n,e.errorPolicy)){if(Fr(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Fr(n)&&qe(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=Ho(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var l=e.updateQueries;l&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!my.call(l,h))){var m=l[h],v=i.queries.get(f),w=v.document,b=v.variables,S=t.diff({query:w,variables:b,returnPartialData:!0,optimistic:!1}),_=S.result,T=S.complete;if(T&&_){var R=m(_,{mutationResult:n,queryName:w&&vn(w)||void 0,queryVariables:b});R&&a.push({result:R,dataId:"ROOT_QUERY",query:w,variables:b})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var u=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!Cf(n)||Fr(n)&&!n.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=C(C({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&f(d,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,v){var w=v.fieldName,b=v.DELETE;return w==="__typename"?m:b}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return u.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(u).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(C(C({},t),{result:{data:n}}),a)}catch(o){__DEV__&&$.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=sl(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:el(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:Ei(er(i)),asQuery:C(C({},i),{definitions:i.definitions.map(function(l){return l.kind==="OperationDefinition"&&l.operation!=="query"?C(C({},l),{operation:"query"}):l})})},c=function(l){l&&!t.has(l)&&t.set(l,s)};c(e),c(i),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return C(C({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=C(C({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new ds(this),i=new ps({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?$(e.query,"query option is required. You must specify your GraphQL document in the query option."):$(e.query,17),__DEV__?$(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):$(e.query.kind==="Document",18),__DEV__?$(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):$(!e.returnPartialData,19),__DEV__?$(!e.pollInterval,"pollInterval option only supported on watchQuery."):$(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new J("Store reset while query was in flight (not completed in link chain)"):new J(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=ve.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):rl(o)?n.set(t.transform(o).document,!1):pe(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,l=o.document;if(c){if(e==="all"){i.set(s,c);return}var u=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||u&&n.has(u)||l&&n.has(l))&&(i.set(s,c),u&&n.set(u,!0),l&&n.set(l,!0))}}),a.size&&a.forEach(function(o){var s=ba("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),l=new ps({queryManager:t,queryInfo:c,options:C(C({},o),{fetchPolicy:"network-only"})});$(l.queryId===s),c.setObservableQuery(l),i.set(s,l)}),__DEV__&&n.size&&n.forEach(function(o,s){o||__DEV__&&$.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var l=function(d){return t.getObservableFromLink(i,c,d).map(function(f){if(n!=="no-cache"&&(hs(f,a)&&t.cache.write({query:i,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),wn(f))throw new vr({graphQLErrors:f.errors});return f})};if(this.transform(i).hasClientExports){var u=this.localState.addExportedVariables(i,o,c).then(l);return new ae(function(d){var f=null;return u.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return l(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var l=this,u=l.inFlightLinkObservables,d=l.link,f={query:c,variables:i,operationName:vn(c)||void 0,context:this.prepareContext(C(C({},t),{forceFetch:!n}))};if(t=f.context,n){var p=u.get(c)||new Map;u.set(c,p);var h=xt(i);if(s=p.get(h),!s){var m=new Sn([Cn(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&u.delete(c)})}}else s=new Sn([Cn(d,f)])}else s=new Sn([ae.of({data:{}})]),t=this.prepareContext(t);var v=this.transform(e).clientQuery;return v&&(s=zo(s,function(w){return a.localState.runResolvers({document:v,remoteResult:w,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return zo(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Go(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new vr({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var l={data:o.data,loading:!1,networkStatus:ve.ready};return c&&i.errorPolicy!=="ignore"&&(l.errors=s,l.networkStatus=ve.error),l},function(o){var s=Md(o)?o:new vr({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=ve.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,l=t.fetchPolicy,u=l===void 0?c&&c.fetchPolicy||"cache-first":l,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,v=m===void 0?!1:m,w=t.context,b=w===void 0?{}:w,S=Object.assign({},t,{query:a,variables:o,fetchPolicy:u,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:v,context:b}),_=function(A){S.variables=A;var N=n.fetchQueryByPolicy(s,S,i);return S.fetchPolicy!=="standby"&&N.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),N},T=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){T(),setTimeout(function(){return R.cancel(A)})});var R=new Sn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(_):_(S.variables));return R.promise.then(T,T),R},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?ba("refetchQueries"):void 0:s,l=e.onQueryUpdated,u=new Map;n&&this.getObservableQueries(n).forEach(function(f,p){u.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof ds&&f.watcher.observableQuery;if(m){if(l){u.delete(m.queryId);var v=l(m,p,h);return v===!0&&(v=m.refetch()),v!==!1&&d.set(m,v),v}l!==null&&u.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),u.size&&u.forEach(function(f,p){var h=f.oq,m=f.lastDiff,v=f.diff,w;if(l){if(!v){var b=h.queryInfo;b.reset(),v=b.getDiff()}w=l(h,v,m)}(!l||w===!0)&&(w=h.refetch()),w!==!1&&d.set(h,w),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,l=t.errorPolicy,u=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(_,T){T===void 0&&(T=e.networkStatus||ve.loading);var R=_.result;__DEV__&&!u&&!Te(R,{})&&Jl(_.missing);var A=function(N){return ae.of(C({data:N,loading:Br(T),networkStatus:T},_.complete?null:{partial:!0}))};return R&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:R},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(N){return A(N.data||void 0)}):l==="none"&&T===ve.refetch&&Array.isArray(_.missing)?A(void 0):A(R)},v=s==="no-cache"?0:i===ve.refetch&&c!=="merge"?1:2,w=function(){return n.getResultsFromLink(e,v,{variables:o,context:d,fetchPolicy:s,errorPolicy:l})},b=f&&typeof p=="number"&&p!==i&&Br(i);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:u||b?[m(S),w()]:[w()]}case"cache-and-network":{var S=h();return S.complete||u||b?[m(S),w()]:[w()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return b?[m(h()),w()]:[w()];case"no-cache":return b?[m(e.getDiff()),w()]:[w()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new ds(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return C(C({},t),{clientAwareness:this.clientAwareness})},r}();var qd=!1;var ms=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,l=e.ssrForceFetchDelay,u=l===void 0?0:l,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,v=e.assumeImmutableResults,w=v===void 0?!1:v,b=e.resolvers,S=e.typeDefs,_=e.fragmentMatcher,T=e.name,R=e.version,A=e.link;if(A||(A=i?new kl({uri:i,credentials:n,headers:a}):Pt.empty()),!o)throw __DEV__?new J(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
53
- For more information, please visit: https://go.apollo.dev/c/docs`):new J(9);if(this.link=A,this.cache=o,this.disableNetworkFetches=c||u>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,u&&setTimeout(function(){return t.disableNetworkFetches=!1},u),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!qd&&f&&__DEV__&&(qd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var N=window.navigator,L=N&&N.userAgent,P=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&$.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=kf,this.localState=new fs({cache:o,client:this,resolvers:b,fragmentMatcher:_}),this.queryManager=new jd({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:T,version:R},localState:this.localState,assumeImmutableResults:w,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=_a(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=C(C({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=_a(this.defaultOptions.query,e)),__DEV__?$(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):$(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=C(C({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=_a(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Cn(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&$.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Yp(vi?"log":"silent");function ft(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function br(r){return ft(r)==="object"}function Bd(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Xl(r,e){return r.length<124?r:e}var Vd="graphql-transport-ws";var vt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(vt||(vt={}));var Pe;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Pe||(Pe={}));function Qd(r){if(!br(r))throw new Error(`Message is expected to be an object, but got ${ft(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ft(r.type)}`);switch(r.type){case Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(r.payload!=null&&!br(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Pe.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ft(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!br(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${ft(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${ft(r.payload.query)}`);if(r.payload.variables!=null&&!br(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ft(r.payload.variables)}`);if(r.payload.operationName!=null&&ft(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ft(r.payload.operationName)}`);if(r.payload.extensions!=null&&!br(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ft(r.payload.extensions)}`);break}case Pe.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ft(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!br(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${ft(r.payload)}`);break}case Pe.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ft(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Bd(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Pe.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ft(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function zd(r,e){return Qd(typeof r=="string"?JSON.parse(r,e):r)}function On(r,e){return Qd(r),JSON.stringify(r,e)}function eu(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:l=5,retryWait:u=async function(Ce){let Ee=1e3;for(let le=0;le<Ce;le++)Ee*=2;await new Promise(le=>setTimeout(le,Ee+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=gs,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Ce=>{let Ee=Math.random()*16|0;return(Ce=="x"?Ee:Ee&3|8).toString(16)})},jsonMessageReplacer:v,jsonMessageReviver:w}=r,b;if(h){if(!yy(h))throw new Error("Invalid WebSocket implementation provided");b=h}else typeof WebSocket<"u"?b=WebSocket:typeof global<"u"?b=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(b=window.WebSocket||window.MozWebSocket);if(!b)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=b,_=(()=>{let G=(()=>{let Ee={};return{on(le,ue){return Ee[le]=ue,()=>{delete Ee[le]}},emit(le){var ue;"id"in le&&((ue=Ee[le.id])===null||ue===void 0||ue.call(Ee,le))}}})(),Ce={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[G.emit,p.message]:[G.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:G.on,on(Ee,le){let ue=Ce[Ee];return ue.push(le),()=>{ue.splice(ue.indexOf(le),1)}},emit(Ee,...le){for(let ue of[...Ce[Ee]])ue(...le)}}})();function T(G){let Ce=[_.on("error",Ee=>{Ce.forEach(le=>le()),G(Ee)}),_.on("closed",Ee=>{Ce.forEach(le=>le()),G(Ee)})]}let R,A=0,N,L=!1,P=0,j=!1;async function ye(){clearTimeout(N);let[G,Ce]=await(R??(R=new Promise((ue,Zt)=>(async()=>{if(L){if(await u(P),!A)return R=void 0,Zt({code:1e3,reason:"All Subscriptions Gone"});P++}_.emit("connecting");let ne=new S(typeof e=="function"?await e():e,Vd),Jt,Ir;function To(){isFinite(o)&&o>0&&(clearTimeout(Ir),Ir=setTimeout(()=>{ne.readyState===S.OPEN&&(ne.send(On({type:Pe.Ping})),_.emit("ping",!1,void 0))},o))}T(Ye=>{R=void 0,clearTimeout(Jt),clearTimeout(Ir),Zt(Ye),gs(Ye)&&Ye.code===4499&&(ne.close(4499,"Terminated"),ne.onerror=null,ne.onclose=null)}),ne.onerror=Ye=>_.emit("error",Ye),ne.onclose=Ye=>_.emit("closed",Ye),ne.onopen=async()=>{try{_.emit("opened",ne);let Ye=typeof t=="function"?await t():t;if(ne.readyState!==S.OPEN)return;ne.send(On(Ye?{type:Pe.ConnectionInit,payload:Ye}:{type:Pe.ConnectionInit},v)),isFinite(c)&&c>0&&(Jt=setTimeout(()=>{ne.close(vt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),To()}catch(Ye){_.emit("error",Ye),ne.close(vt.InternalClientError,Xl(Ye instanceof Error?Ye.message:new Error(Ye).message,"Internal client error"))}};let pn=!1;ne.onmessage=({data:Ye})=>{try{let Xe=zd(Ye,w);if(_.emit("message",Xe),Xe.type==="ping"||Xe.type==="pong"){_.emit(Xe.type,!0,Xe.payload),Xe.type==="pong"?To():s||(ne.send(On(Xe.payload?{type:Pe.Pong,payload:Xe.payload}:{type:Pe.Pong})),_.emit("pong",!1,Xe.payload));return}if(pn)return;if(Xe.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Xe.type}`);clearTimeout(Jt),pn=!0,_.emit("connected",ne,Xe.payload),L=!1,P=0,ue([ne,new Promise((Q3,fm)=>T(fm))])}catch(Xe){ne.onmessage=null,_.emit("error",Xe),ne.close(vt.BadResponse,Xl(Xe instanceof Error?Xe.message:new Error(Xe).message,"Bad response"))}}})())));G.readyState===S.CLOSING&&await Ce;let Ee=()=>{},le=new Promise(ue=>Ee=ue);return[G,Ee,Promise.race([le.then(()=>{if(!A){let ue=()=>G.close(1e3,"Normal Closure");isFinite(a)&&a>0?N=setTimeout(()=>{G.readyState===S.OPEN&&ue()},a):ue()}}),Ce])]}function je(G){if(gs(G)&&(gy(G.code)||[vt.InternalServerError,vt.InternalClientError,vt.BadRequest,vt.BadResponse,vt.Unauthorized,vt.SubprotocolNotAcceptable,vt.SubscriberAlreadyExists,vt.TooManyInitialisationRequests].includes(G.code)))throw G;if(j)return!1;if(gs(G)&&G.code===1e3)return A>0;if(!l||P>=l||!d(G)||f?.(G))throw G;return L=!0}return i||(async()=>{for(A++;;)try{let[,,G]=await ye();await G}catch(G){try{if(!je(G))return}catch(Ce){return n?.(Ce)}}})(),{on:_.on,subscribe(G,Ce){let Ee=m(G),le=!1,ue=!1,Zt=()=>{A--,le=!0};return(async()=>{for(A++;;)try{let[ne,Jt,Ir]=await ye();if(le)return Jt();let To=_.onMessage(Ee,pn=>{switch(pn.type){case Pe.Next:{Ce.next(pn.payload);return}case Pe.Error:{ue=!0,le=!0,Ce.error(pn.payload),Zt();return}case Pe.Complete:{le=!0,Zt();return}}});ne.send(On({id:Ee,type:Pe.Subscribe,payload:G},v)),Zt=()=>{!le&&ne.readyState===S.OPEN&&ne.send(On({id:Ee,type:Pe.Complete},v)),A--,le=!0,Jt()},await Ir.finally(To);return}catch(ne){if(!je(ne))return}})().then(()=>{ue||Ce.complete()}).catch(ne=>{Ce.error(ne)}),()=>{le||Zt()}},async dispose(){if(j=!0,R){let[G]=await R;G.close(1e3,"Normal Closure")}},terminate(){R&&_.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function gs(r){return br(r)&&"code"in r&&"reason"in r}function gy(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function yy(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function vy(r){return pe(r)&&"code"in r&&"reason"in r}var tu=function(r){Re(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new ae(function(n){return i.client.subscribe(C(C({},t),{query:mn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):vy(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new vr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Pt);var Gs=function(){return Gs=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Gs.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Os(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Os=function(t){return typeof t}:Os=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Os(r)}function by(r){return Os(r)=="object"&&r!==null}var u1=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function wu(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function _y(r){return p1(r.source,wu(r.source,r.start))}function p1(r,e){var t=r.locationOffset.column-1,i=Ds(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,l="".concat(r.name,":").concat(o,":").concat(c,`
54
- `),u=i.split(/\r\n|[\n\r]/g),d=u[n];if(d.length>120){for(var f=Math.floor(c/80),p=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return l+Wd([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(v){return["",v]}),[[" ",Ds(p-1)+"^"],["",h[f+1]]]))}return l+Wd([["".concat(o-1),u[n-1]],["".concat(o),d],["",Ds(c-1)+"^"],["".concat(o+1),u[n+1]]])}function Wd(r){var e=r.filter(function(i){i[0];var n=i[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(i){var n=i[0];return n.length}));return e.map(function(i){var n=i[0],a=i[1];return Sy(t,n)+(a?" | "+a:" |")}).join(`
55
- `)}function Ds(r){return Array(r+1).join(" ")}function Sy(r,e){return Ds(r-e.length)+e}function Ns(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ns=function(t){return typeof t}:Ns=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ns(r)}function Hd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function wy(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Hd(Object(t),!0).forEach(function(i){Cy(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Hd(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function Cy(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Ey(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Gd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function xy(r,e,t){return e&&Gd(r.prototype,e),t&&Gd(r,t),r}function Ay(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&ro(r,e)}function ky(r){var e=d1();return function(){var i=io(r),n;if(e){var a=io(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return f1(this,n)}}function f1(r,e){return e&&(Ns(e)==="object"||typeof e=="function")?e:Ra(r)}function Ra(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Cu(r){var e=typeof Map=="function"?new Map:void 0;return Cu=function(i){if(i===null||!Ty(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return Rs(i,arguments,io(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),ro(n,i)},Cu(r)}function Rs(r,e,t){return d1()?Rs=Reflect.construct:Rs=function(n,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(n,s),l=new c;return o&&ro(l,o.prototype),l},Rs.apply(null,arguments)}function d1(){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 Ty(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function ro(r,e){return ro=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},ro(r,e)}function io(r){return io=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},io(r)}var Iy=function(r){Ay(t,r);var e=ky(t);function t(i,n,a,o,s,c,l){var u,d,f,p;Ey(this,t),p=e.call(this,i),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=Kd(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],m=0,v=(w=p.nodes)!==null&&w!==void 0?w:[];m<v.length;m++){var w,b=v[m],S=b.loc;S!=null&&h.push(S)}h=Kd(h),p.source=a??((u=h)===null||u===void 0?void 0:u[0].source),p.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(T){return T.start})),p.locations=o&&a?o.map(function(T){return wu(a,T)}):(f=h)===null||f===void 0?void 0:f.map(function(T){return wu(T.source,T.start)}),p.path=s??void 0;var _=c?.extensions;return l==null&&by(_)?p.extensions=wy({},_):p.extensions=l??{},Object.defineProperties(Ra(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(Ra(p),"stack",{value:c.stack,writable:!0,configurable:!0}),f1(p)):(Error.captureStackTrace?Error.captureStackTrace(Ra(p),t):Object.defineProperty(Ra(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return xy(t,[{key:"toString",value:function(){return Oy(this)}},{key:u1,get:function(){return"Object"}}]),t}(Cu(Error));function Kd(r){return r===void 0||r.length===0?void 0:r}function Oy(r){var e=r.message;if(r.nodes)for(var t=0,i=r.nodes;t<i.length;t++){var n=i[t];n.loc&&(e+=`
51
+ `)),e=e.replace(/\n$/,""),e},br=function(r){Pe(e,r);function e(t){var i=t.graphQLErrors,n=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=i||[],c.clientErrors=n||[],c.networkError=a||null,c.message=o||fy(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var ve;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(ve||(ve={}));function Vr(r){return r?r<7:!1}var dy=Object.assign,hy=Object.hasOwnProperty,fs=function(r){Pe(e,r);function e(t){var i=t.queryManager,n=t.queryInfo,a=t.options,o=r.call(this,function(y){try{var w=y._subscription._observer;w&&!w.error&&(w.error=my)}catch{}var b=!o.observers.size;o.observers.add(y);var S=o.last;return S&&S.error?y.error&&y.error(S.error):S&&S.result&&y.next&&y.next(S.result),b&&o.reobserve().catch(function(){}),function(){o.observers.delete(y)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=n,o.queryManager=i,o.isTornDown=!1;var s=i.defaultOptions.watchQuery,c=s===void 0?{}:s,u=c.fetchPolicy,l=u===void 0?"cache-first":u,d=a.fetchPolicy,f=d===void 0?l:d,p=a.initialFetchPolicy,h=p===void 0?f==="standby"?l:f:p;o.options=E(E({},a),{initialFetchPolicy:h,fetchPolicy:f}),o.queryId=n.queryId||i.generateQueryId();var m=tr(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(i,n){var a={next:function(s){i(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:n},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var i=this.getLastResult(!0),n=this.queryInfo.networkStatus||i&&i.networkStatus||ve.ready,a=E(E({},i),{loading:Vr(n),networkStatus:n}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(a.data=c.result),Ie(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===ve.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=ve.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Yu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,i){return!this.last||!Ie(this.last.result,t)||i&&!Ie(this.last.variables,i)},e.prototype.getLast=function(t,i){var n=this.last;if(n&&n[t]&&(!i||Ie(n.variables,this.variables)))return n[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var i,n={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?n.fetchPolicy=a:a==="no-cache"?n.fetchPolicy="no-cache":n.fetchPolicy="network-only",__DEV__&&t&&hy.call(t,"variables")){var o=ya(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&P.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((i=o.name)===null||i===void 0?void 0:i.value)||JSON.stringify(o),`, which does not declare a $variables variable.
52
+ Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Ie(this.options.variables,t)&&(n.variables=this.options.variables=E(E({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,ve.refetch)},e.prototype.fetchMore=function(t){var i=this,n=E(E({},t.query?t:E(E(E(E({},this.options),{query:this.query}),t),{variables:E(E({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=ve.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,ve.fetchMore).then(function(u){return i.queryManager.removeQuery(a),o.networkStatus===ve.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(l){var d=t.updateQuery;d?l.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:u.data,variables:n.variables})}):l.writeQuery({query:n.query,variables:n.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(i.query)||Ju(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&P.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Ie(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},ve.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?P(a,"Attempted to start a polling query without a polling interval."):P(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Vr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ve.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=E(E({},this.last),{result:this.queryManager.assumeImmutableResults?t:zo(t),variables:i}),Be(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===ve.refetch||i===ve.fetchMore||i===ve.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Ur(this.options,t||{}),u=a?c:dy(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ie(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),i===void 0&&(i=ve.setVariables)));var l=u.variables&&E({},u.variables),d=this.fetch(u,i),f={next:function(p){n.reportResult(p,l)},error:function(p){n.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),ki(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=E(E({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:ve.error,loading:!1});this.updateLastResult(n,i),ki(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ae);Ho(fs);function Ju(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function my(r){__DEV__&&P.error("Unhandled error",r.message,r.stack)}function Yu(r){__DEV__&&r&&__DEV__&&P.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var ds=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=pu(t.resolvers,i)}):this.resolvers=pu(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Vt(this,void 0,void 0,function(){return Qt(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(u){return E(E({},i),{data:u.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return yn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return lu(e)},r.prototype.prepareContext=function(e){var t=this.cache;return E(E({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),Vt(this,void 0,void 0,function(){return Qt(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return E(E({},t),a.exportedVariables)})]:[2,E({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return lt(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return _i}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:uu(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Vt(this,void 0,void 0,function(){var s,c,u,l,d,f,p,h,m,y,w;return Qt(this,function(b){return s=Ci(e),c=Ei(e),u=Si(c),l=this.collectSelectionsToResolve(s,u),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,y={fragmentMap:u,context:E(E({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},w=!1,[2,this.resolveSelectionSet(s.selectionSet,w,t,y).then(function(S){return{result:S,exportedVariables:y.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return Vt(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Qt(this,function(d){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],u=function(f){return Vt(l,void 0,void 0,function(){var p,h;return Qt(this,function(m){return!t&&!n.selectionsToResolve.has(f)?[2]:yr(f,s)?xt(f)?[2,this.resolveField(f,t,i,n).then(function(y){var w;typeof y<"u"&&c.push((w={},w[Pt(f)]=y,w))})]:(au(f)?p=f:(p=a[f.name.value],__DEV__?P(p,"No fragment named ".concat(f.name.value)):P(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(y){c.push(y)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return va(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return Vt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h=this;return Qt(this,function(m){return i?(a=n.variables,o=e.name.value,s=Pt(e),c=o!==s,u=i[s]||i[o],l=Promise.resolve(u),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=i.__typename||n.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(l=Promise.resolve(Tn.withValue(this.cache,p,[i,vr(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,l.then(function(y){var w,b;if(y===void 0&&(y=u),e.directives&&e.directives.forEach(function(_){_.name.value==="export"&&_.arguments&&_.arguments.forEach(function(T){T.name.value==="as"&&T.value.kind==="StringValue"&&(n.exportedVariables[T.value.value]=y)})}),!e.selectionSet||y==null)return y;var S=(b=(w=e.directives)===null||w===void 0?void 0:w.some(function(_){return _.name.value==="client"}))!==null&&b!==void 0?b:!1;if(Array.isArray(y))return h.resolveSubSelectedArray(e,t||S,y,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||S,y,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),lt(o,{Directive:function(c,u,l,d,f){c.name.value==="client"&&f.forEach(function(p){i(p)&&da(p)&&s.add(p)})},FragmentSpread:function(c,u,l,d,f){var p=t[c.name.value];__DEV__?P(p,"No fragment named ".concat(c.name.value)):P(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){i(m)&&da(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var On=new($t?WeakMap:Map);function Xu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return On.set(r,(On.get(r)+1)%1e15),t.apply(this,arguments)})}function jd(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var hs=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;On.has(i)||(On.set(i,0),Xu(i,"evict"),Xu(i,"modify"),Xu(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||ve.loading;return this.variables&&this.networkStatus!==ve.loading&&!Ie(this.variables,e.variables)&&(t=ve.setVariables),Ie(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){jd(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ie(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Ie(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():Ju(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;jd(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Vr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=E(E({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ie(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===On.get(this.cache)&&Ie(t,i.variables)&&Ie(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new vt,s=Be(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Be(e.incremental)){var c=Go(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(ms(e,i.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,i.variables))l.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:On.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(i.variables),f=l.diff(d);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ve.ready},r.prototype.markError=function(e){return this.networkStatus=ve.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function ms(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!En(r);return!i&&t&&r.data&&(i=!0),i}var gy=Object.prototype.hasOwnProperty,qd=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,d=l===void 0?{}:l,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new($t?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new ds({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new J("QueryManager stopped while query was in flight"):new J(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,d=l===void 0?!1:l,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,y=e.errorPolicy,w=y===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":y,b=e.keepRootFields,S=e.context;return Vt(this,void 0,void 0,function(){var _,T,R,A,N,L;return Qt(this,function($){switch($.label){case 0:return __DEV__?P(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):P(n,15),__DEV__?P(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):P(m==="network-only"||m==="no-cache",16),_=this.generateMutationId(),T=this.transform(n),R=T.document,A=T.hasClientExports,n=this.cache.transformForLink(R),a=this.getVariables(n,a),A?[4,this.localState.addExportedVariables(n,a,S)]:[3,2];case 1:a=$.sent(),$.label=2;case 2:return N=this.mutationStore&&(this.mutationStore[_]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:_,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,updateQueries:s,update:f,keepRootFields:b}),this.broadcastQueries(),L=this,[2,new Promise(function(j,ye){return Wo(L.getObservableFromLink(n,E(E({},S),{optimisticResponse:o}),a,!1),function(qe){if(En(qe)&&w==="none")throw new br({graphQLErrors:Ko(qe)});N&&(N.loading=!1,N.error=null);var G=E({},qe);return typeof u=="function"&&(u=u(G)),w==="ignore"&&En(G)&&delete G.errors,L.markMutationResult({mutationId:_,result:G,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?_:void 0,onQueryUpdated:p,keepRootFields:b})}).subscribe({next:function(qe){L.broadcastQueries(),(!("hasNext"in qe)||qe.hasNext===!1)&&j(qe)},error:function(qe){N&&(N.loading=!1,N.error=qe),o&&L.cache.removeOptimistic(_),L.broadcastQueries(),ye(qe instanceof br?qe:new br({networkError:qe}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&ms(n,e.errorPolicy)){if(Mr(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Mr(n)&&Be(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=Go(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!gy.call(u,h))){var m=u[h],y=i.queries.get(f),w=y.document,b=y.variables,S=t.diff({query:w,variables:b,returnPartialData:!0,optimistic:!1}),_=S.result,T=S.complete;if(T&&_){var R=m(_,{mutationResult:n,queryName:w&&bn(w)||void 0,queryVariables:b});R&&a.push({result:R,dataId:"ROOT_QUERY",query:w,variables:b})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!Cf(n)||Mr(n)&&!n.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=E(E({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&f(d,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,y){var w=y.fieldName,b=y.DELETE;return w==="__typename"?m:b}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(E(E({},t),{result:{data:n}}),a)}catch(o){__DEV__&&P.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=cu(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:tu(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:xi(tr(i)),asQuery:E(E({},i),{definitions:i.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?E(E({},u),{operation:"query"}):u})})},c=function(u){u&&!t.has(u)&&t.set(u,s)};c(e),c(i),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return E(E({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=E(E({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new hs(this),i=new fs({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?P(e.query,"query option is required. You must specify your GraphQL document in the query option."):P(e.query,17),__DEV__?P(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):P(e.query.kind==="Document",18),__DEV__?P(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):P(!e.returnPartialData,19),__DEV__?P(!e.pollInterval,"pollInterval option only supported on watchQuery."):P(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new J("Store reset while query was in flight (not completed in link chain)"):new J(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=ve.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):iu(o)?n.set(t.transform(o).document,!1):pe(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){i.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&n.has(l)||u&&n.has(u))&&(i.set(s,c),l&&n.set(l,!0),u&&n.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Sa("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new fs({queryManager:t,queryInfo:c,options:E(E({},o),{fetchPolicy:"network-only"})});P(u.queryId===s),c.setObservableQuery(u),i.set(s,u)}),__DEV__&&n.size&&n.forEach(function(o,s){o||__DEV__&&P.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var u=function(d){return t.getObservableFromLink(i,c,d).map(function(f){if(n!=="no-cache"&&(ms(f,a)&&t.cache.write({query:i,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),En(f))throw new br({graphQLErrors:f.errors});return f})};if(this.transform(i).hasClientExports){var l=this.localState.addExportedVariables(i,o,c).then(u);return new ae(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,d=u.link,f={query:c,variables:i,operationName:bn(c)||void 0,context:this.prepareContext(E(E({},t),{forceFetch:!n}))};if(t=f.context,n){var p=l.get(c)||new Map;l.set(c,p);var h=At(i);if(s=p.get(h),!s){var m=new wn([Cn(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new wn([Cn(d,f)])}else s=new wn([ae.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=Wo(s,function(w){return a.localState.runResolvers({document:y,remoteResult:w,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Wo(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Ko(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new br({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:ve.ready};return c&&i.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=ve.error),u},function(o){var s=Ud(o)?o:new br({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=ve.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,y=m===void 0?!1:m,w=t.context,b=w===void 0?{}:w,S=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:y,context:b}),_=function(A){S.variables=A;var N=n.fetchQueryByPolicy(s,S,i);return S.fetchPolicy!=="standby"&&N.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),N},T=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){T(),setTimeout(function(){return R.cancel(A)})});var R=new wn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(_):_(S.variables));return R.promise.then(T,T),R},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Sa("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;n&&this.getObservableQueries(n).forEach(function(f,p){l.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof hs&&f.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var y=u(m,p,h);return y===!0&&(y=m.refetch()),y!==!1&&d.set(m,y),y}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(f,p){var h=f.oq,m=f.lastDiff,y=f.diff,w;if(u){if(!y){var b=h.queryInfo;b.reset(),y=b.getDiff()}w=u(h,y,m)}(!u||w===!0)&&(w=h.refetch()),w!==!1&&d.set(h,w),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(_,T){T===void 0&&(T=e.networkStatus||ve.loading);var R=_.result;__DEV__&&!l&&!Ie(R,{})&&Yu(_.missing);var A=function(N){return ae.of(E({data:N,loading:Vr(T),networkStatus:T},_.complete?null:{partial:!0}))};return R&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:R},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(N){return A(N.data||void 0)}):u==="none"&&T===ve.refetch&&Array.isArray(_.missing)?A(void 0):A(R)},y=s==="no-cache"?0:i===ve.refetch&&c!=="merge"?1:2,w=function(){return n.getResultsFromLink(e,y,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},b=f&&typeof p=="number"&&p!==i&&Vr(i);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:l||b?[m(S),w()]:[w()]}case"cache-and-network":{var S=h();return S.complete||l||b?[m(S),w()]:[w()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return b?[m(h()),w()]:[w()];case"no-cache":return b?[m(e.getDiff()),w()]:[w()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new hs(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return E(E({},t),{clientAwareness:this.clientAwareness})},r}();var Bd=!1;var gs=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,y=e.assumeImmutableResults,w=y===void 0?!1:y,b=e.resolvers,S=e.typeDefs,_=e.fragmentMatcher,T=e.name,R=e.version,A=e.link;if(A||(A=i?new Tu({uri:i,credentials:n,headers:a}):Lt.empty()),!o)throw __DEV__?new J(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
53
+ For more information, please visit: https://go.apollo.dev/c/docs`):new J(9);if(this.link=A,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!Bd&&f&&__DEV__&&(Bd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var N=window.navigator,L=N&&N.userAgent,$=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?$="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&($="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),$&&__DEV__&&P.log("Download the Apollo DevTools for a better development experience: "+$)}this.version=Tf,this.localState=new ds({cache:o,client:this,resolvers:b,fragmentMatcher:_}),this.queryManager=new qd({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:T,version:R},localState:this.localState,assumeImmutableResults:w,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=wa(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=wa(this.defaultOptions.query,e)),__DEV__?P(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):P(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=wa(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Cn(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&P.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Xp(bi?"log":"silent");function dt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function _r(r){return dt(r)==="object"}function Vd(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function el(r,e){return r.length<124?r:e}var Qd="graphql-transport-ws";var bt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(bt||(bt={}));var Le;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Le||(Le={}));function zd(r){if(!_r(r))throw new Error(`Message is expected to be an object, but got ${dt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${dt(r.type)}`);switch(r.type){case Le.ConnectionInit:case Le.ConnectionAck:case Le.Ping:case Le.Pong:{if(r.payload!=null&&!_r(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Le.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${dt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!_r(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${dt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${dt(r.payload.query)}`);if(r.payload.variables!=null&&!_r(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${dt(r.payload.variables)}`);if(r.payload.operationName!=null&&dt(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${dt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!_r(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${dt(r.payload.extensions)}`);break}case Le.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${dt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!_r(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${dt(r.payload)}`);break}case Le.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${dt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Vd(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Le.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${dt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function Wd(r,e){return zd(typeof r=="string"?JSON.parse(r,e):r)}function Dn(r,e){return zd(r),JSON.stringify(r,e)}function tl(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(Ee){let Ce=1e3;for(let ue=0;ue<Ee;ue++)Ce*=2;await new Promise(ue=>setTimeout(ue,Ce+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=ys,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Ee=>{let Ce=Math.random()*16|0;return(Ee=="x"?Ce:Ce&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:w}=r,b;if(h){if(!vy(h))throw new Error("Invalid WebSocket implementation provided");b=h}else typeof WebSocket<"u"?b=WebSocket:typeof global<"u"?b=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(b=window.WebSocket||window.MozWebSocket);if(!b)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=b,_=(()=>{let G=(()=>{let Ce={};return{on(ue,le){return Ce[ue]=le,()=>{delete Ce[ue]}},emit(ue){var le;"id"in ue&&((le=Ce[ue.id])===null||le===void 0||le.call(Ce,ue))}}})(),Ee={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[G.emit,p.message]:[G.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:G.on,on(Ce,ue){let le=Ee[Ce];return le.push(ue),()=>{le.splice(le.indexOf(ue),1)}},emit(Ce,...ue){for(let le of[...Ee[Ce]])le(...ue)}}})();function T(G){let Ee=[_.on("error",Ce=>{Ee.forEach(ue=>ue()),G(Ce)}),_.on("closed",Ce=>{Ee.forEach(ue=>ue()),G(Ce)})]}let R,A=0,N,L=!1,$=0,j=!1;async function ye(){clearTimeout(N);let[G,Ee]=await(R??(R=new Promise((le,Jt)=>(async()=>{if(L){if(await l($),!A)return R=void 0,Jt({code:1e3,reason:"All Subscriptions Gone"});$++}_.emit("connecting");let ne=new S(typeof e=="function"?await e():e,Qd),Yt,Or;function Io(){isFinite(o)&&o>0&&(clearTimeout(Or),Or=setTimeout(()=>{ne.readyState===S.OPEN&&(ne.send(Dn({type:Le.Ping})),_.emit("ping",!1,void 0))},o))}T(Xe=>{R=void 0,clearTimeout(Yt),clearTimeout(Or),Jt(Xe),ys(Xe)&&Xe.code===4499&&(ne.close(4499,"Terminated"),ne.onerror=null,ne.onclose=null)}),ne.onerror=Xe=>_.emit("error",Xe),ne.onclose=Xe=>_.emit("closed",Xe),ne.onopen=async()=>{try{_.emit("opened",ne);let Xe=typeof t=="function"?await t():t;if(ne.readyState!==S.OPEN)return;ne.send(Dn(Xe?{type:Le.ConnectionInit,payload:Xe}:{type:Le.ConnectionInit},y)),isFinite(c)&&c>0&&(Yt=setTimeout(()=>{ne.close(bt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Io()}catch(Xe){_.emit("error",Xe),ne.close(bt.InternalClientError,el(Xe instanceof Error?Xe.message:new Error(Xe).message,"Internal client error"))}};let fn=!1;ne.onmessage=({data:Xe})=>{try{let et=Wd(Xe,w);if(_.emit("message",et),et.type==="ping"||et.type==="pong"){_.emit(et.type,!0,et.payload),et.type==="pong"?Io():s||(ne.send(Dn(et.payload?{type:Le.Pong,payload:et.payload}:{type:Le.Pong})),_.emit("pong",!1,et.payload));return}if(fn)return;if(et.type!==Le.ConnectionAck)throw new Error(`First message cannot be of type ${et.type}`);clearTimeout(Yt),fn=!0,_.emit("connected",ne,et.payload),L=!1,$=0,le([ne,new Promise((z3,dm)=>T(dm))])}catch(et){ne.onmessage=null,_.emit("error",et),ne.close(bt.BadResponse,el(et instanceof Error?et.message:new Error(et).message,"Bad response"))}}})())));G.readyState===S.CLOSING&&await Ee;let Ce=()=>{},ue=new Promise(le=>Ce=le);return[G,Ce,Promise.race([ue.then(()=>{if(!A){let le=()=>G.close(1e3,"Normal Closure");isFinite(a)&&a>0?N=setTimeout(()=>{G.readyState===S.OPEN&&le()},a):le()}}),Ee])]}function qe(G){if(ys(G)&&(yy(G.code)||[bt.InternalServerError,bt.InternalClientError,bt.BadRequest,bt.BadResponse,bt.Unauthorized,bt.SubprotocolNotAcceptable,bt.SubscriberAlreadyExists,bt.TooManyInitialisationRequests].includes(G.code)))throw G;if(j)return!1;if(ys(G)&&G.code===1e3)return A>0;if(!u||$>=u||!d(G)||f?.(G))throw G;return L=!0}return i||(async()=>{for(A++;;)try{let[,,G]=await ye();await G}catch(G){try{if(!qe(G))return}catch(Ee){return n?.(Ee)}}})(),{on:_.on,subscribe(G,Ee){let Ce=m(G),ue=!1,le=!1,Jt=()=>{A--,ue=!0};return(async()=>{for(A++;;)try{let[ne,Yt,Or]=await ye();if(ue)return Yt();let Io=_.onMessage(Ce,fn=>{switch(fn.type){case Le.Next:{Ee.next(fn.payload);return}case Le.Error:{le=!0,ue=!0,Ee.error(fn.payload),Jt();return}case Le.Complete:{ue=!0,Jt();return}}});ne.send(Dn({id:Ce,type:Le.Subscribe,payload:G},y)),Jt=()=>{!ue&&ne.readyState===S.OPEN&&ne.send(Dn({id:Ce,type:Le.Complete},y)),A--,ue=!0,Yt()},await Or.finally(Io);return}catch(ne){if(!qe(ne))return}})().then(()=>{le||Ee.complete()}).catch(ne=>{Ee.error(ne)}),()=>{ue||Jt()}},async dispose(){if(j=!0,R){let[G]=await R;G.close(1e3,"Normal Closure")}},terminate(){R&&_.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function ys(r){return _r(r)&&"code"in r&&"reason"in r}function yy(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function vy(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function by(r){return pe(r)&&"code"in r&&"reason"in r}var rl=function(r){Pe(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new ae(function(n){return i.client.subscribe(E(E({},t),{query:gn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):by(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new br({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Lt);var Ks=function(){return Ks=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},Ks.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ds(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ds=function(t){return typeof t}:Ds=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ds(r)}function _y(r){return Ds(r)=="object"&&r!==null}var p1=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function El(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function Sy(r){return f1(r.source,El(r.source,r.start))}function f1(r,e){var t=r.locationOffset.column-1,i=Ns(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
54
+ `),l=i.split(/\r\n|[\n\r]/g),d=l[n];if(d.length>120){for(var f=Math.floor(c/80),p=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return u+Hd([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(y){return["",y]}),[[" ",Ns(p-1)+"^"],["",h[f+1]]]))}return u+Hd([["".concat(o-1),l[n-1]],["".concat(o),d],["",Ns(c-1)+"^"],["".concat(o+1),l[n+1]]])}function Hd(r){var e=r.filter(function(i){i[0];var n=i[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(i){var n=i[0];return n.length}));return e.map(function(i){var n=i[0],a=i[1];return wy(t,n)+(a?" | "+a:" |")}).join(`
55
+ `)}function Ns(r){return Array(r+1).join(" ")}function wy(r,e){return Ns(r-e.length)+e}function Rs(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Rs=function(t){return typeof t}:Rs=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Rs(r)}function Gd(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function Ey(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Gd(Object(t),!0).forEach(function(i){Cy(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Gd(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function Cy(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xy(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Kd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Ay(r,e,t){return e&&Kd(r.prototype,e),t&&Kd(r,t),r}function ky(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&no(r,e)}function Ty(r){var e=h1();return function(){var i=ao(r),n;if(e){var a=ao(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return d1(this,n)}}function d1(r,e){return e&&(Rs(e)==="object"||typeof e=="function")?e:$a(r)}function $a(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Cl(r){var e=typeof Map=="function"?new Map:void 0;return Cl=function(i){if(i===null||!Iy(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return Ps(i,arguments,ao(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),no(n,i)},Cl(r)}function Ps(r,e,t){return h1()?Ps=Reflect.construct:Ps=function(n,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(n,s),u=new c;return o&&no(u,o.prototype),u},Ps.apply(null,arguments)}function h1(){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 Iy(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function no(r,e){return no=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},no(r,e)}function ao(r){return ao=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},ao(r)}var Oy=function(r){ky(t,r);var e=Ty(t);function t(i,n,a,o,s,c,u){var l,d,f,p;xy(this,t),p=e.call(this,i),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=Zd(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],m=0,y=(w=p.nodes)!==null&&w!==void 0?w:[];m<y.length;m++){var w,b=y[m],S=b.loc;S!=null&&h.push(S)}h=Zd(h),p.source=a??((l=h)===null||l===void 0?void 0:l[0].source),p.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(T){return T.start})),p.locations=o&&a?o.map(function(T){return El(a,T)}):(f=h)===null||f===void 0?void 0:f.map(function(T){return El(T.source,T.start)}),p.path=s??void 0;var _=c?.extensions;return u==null&&_y(_)?p.extensions=Ey({},_):p.extensions=u??{},Object.defineProperties($a(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty($a(p),"stack",{value:c.stack,writable:!0,configurable:!0}),d1(p)):(Error.captureStackTrace?Error.captureStackTrace($a(p),t):Object.defineProperty($a(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return Ay(t,[{key:"toString",value:function(){return Dy(this)}},{key:p1,get:function(){return"Object"}}]),t}(Cl(Error));function Zd(r){return r===void 0||r.length===0?void 0:r}function Dy(r){var e=r.message;if(r.nodes)for(var t=0,i=r.nodes;t<i.length;t++){var n=i[t];n.loc&&(e+=`
56
56
 
57
- `+_y(n.loc))}else if(r.source&&r.locations)for(var a=0,o=r.locations;a<o.length;a++){var s=o[a];e+=`
57
+ `+Sy(n.loc))}else if(r.source&&r.locations)for(var a=0,o=r.locations;a<o.length;a++){var s=o[a];e+=`
58
58
 
59
- `+p1(r.source,s)}return e}function kt(r,e,t){return new Iy("Syntax Error: ".concat(t),void 0,r,[e])}var H=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 Dy(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ny=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Eu=Ny;function h1(r){var e=r.prototype.toJSON;typeof e=="function"||Dy(0),r.prototype.inspect=e,Eu&&(r.prototype[Eu]=e)}var m1=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();h1(m1);var Fe=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();h1(Fe);var O=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 $s(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$s=function(t){return typeof t}:$s=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$s(r)}var Ry=10,g1=2;function $y(r){return yc(r,[])}function yc(r,e){switch($s(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Py(r,e);default:return String(r)}}function Py(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=My(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:yc(n,t)}else if(Array.isArray(r))return Fy(r,t);return Ly(r,t)}function Ly(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>g1)return"["+Uy(r)+"]";var i=t.map(function(n){var a=yc(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function Fy(r,e){if(r.length===0)return"[]";if(e.length>g1)return"[Array]";for(var t=Math.min(Ry,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(yc(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function My(r){var e=r[String(Eu)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Uy(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ru(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var jy=function(e,t){return e instanceof t};function Zd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function qy(r,e,t){return e&&Zd(r.prototype,e),t&&Zd(r,t),r}var y1=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ru(0,"Body must be a string. Received: ".concat($y(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||ru(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ru(0,"column in locationOffset is 1-indexed and must be positive.")}return qy(r,[{key:u1,get:function(){return"Source"}}]),r}();function By(r){return jy(r,y1)}var Vy=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 Qy(r){var e=r.split(/\r\n|[\n\r]/g),t=zy(r);if(t!==0)for(var i=1;i<e.length;i++)e[i]=e[i].slice(t);for(var n=0;n<e.length&&Jd(e[n]);)++n;for(var a=e.length;a>n&&Jd(e[a-1]);)--a;return e.slice(n,a).join(`
60
- `)}function Jd(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function zy(r){for(var e,t=!0,i=!0,n=0,a=null,o=0;o<r.length;++o)switch(r.charCodeAt(o)){case 13:r.charCodeAt(o+1)===10&&++o;case 10:t=!1,i=!0,n=0;break;case 9:case 32:++n;break;default:i&&!t&&(a===null||n<a)&&(a=n),i=!1}return(e=a)!==null&&e!==void 0?e:0}var Wy=function(){function r(t){var i=new Fe(O.SOF,0,0,0,0,null);this.source=t,this.lastToken=i,this.token=i,this.line=1,this.lineStart=0}var e=r.prototype;return e.advance=function(){this.lastToken=this.token;var i=this.token=this.lookahead();return i},e.lookahead=function(){var i=this.token;if(i.kind!==O.EOF)do{var n;i=(n=i.next)!==null&&n!==void 0?n:i.next=Gy(this,i)}while(i.kind===O.COMMENT);return i},r}();function Hy(r){return r===O.BANG||r===O.DOLLAR||r===O.AMP||r===O.PAREN_L||r===O.PAREN_R||r===O.SPREAD||r===O.COLON||r===O.EQUALS||r===O.AT||r===O.BRACKET_L||r===O.BRACKET_R||r===O.BRACE_L||r===O.PIPE||r===O.BRACE_R}function Qi(r){return isNaN(r)?O.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function Gy(r,e){for(var t=r.source,i=t.body,n=i.length,a=e.end;a<n;){var o=i.charCodeAt(a),s=r.line,c=1+a-r.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++r.line,r.lineStart=a;continue;case 13:i.charCodeAt(a+1)===10?a+=2:++a,++r.line,r.lineStart=a;continue;case 33:return new Fe(O.BANG,a,a+1,s,c,e);case 35:return Zy(t,a,s,c,e);case 36:return new Fe(O.DOLLAR,a,a+1,s,c,e);case 38:return new Fe(O.AMP,a,a+1,s,c,e);case 40:return new Fe(O.PAREN_L,a,a+1,s,c,e);case 41:return new Fe(O.PAREN_R,a,a+1,s,c,e);case 46:if(i.charCodeAt(a+1)===46&&i.charCodeAt(a+2)===46)return new Fe(O.SPREAD,a,a+3,s,c,e);break;case 58:return new Fe(O.COLON,a,a+1,s,c,e);case 61:return new Fe(O.EQUALS,a,a+1,s,c,e);case 64:return new Fe(O.AT,a,a+1,s,c,e);case 91:return new Fe(O.BRACKET_L,a,a+1,s,c,e);case 93:return new Fe(O.BRACKET_R,a,a+1,s,c,e);case 123:return new Fe(O.BRACE_L,a,a+1,s,c,e);case 124:return new Fe(O.PIPE,a,a+1,s,c,e);case 125:return new Fe(O.BRACE_R,a,a+1,s,c,e);case 34:return i.charCodeAt(a+1)===34&&i.charCodeAt(a+2)===34?Xy(t,a,s,c,e,r):Yy(t,a,s,c,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Jy(t,a,o,s,c,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 t0(t,a,s,c,e)}throw kt(t,a,Ky(o))}var l=r.line,u=1+a-r.lineStart;return new Fe(O.EOF,n,n,l,u,e)}function Ky(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(Qi(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Qi(r),".")}function Zy(r,e,t,i,n){var a=r.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Fe(O.COMMENT,e,s,t,i,n,a.slice(e+1,s))}function Jy(r,e,t,i,n,a){var o=r.body,s=t,c=e,l=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw kt(r,c,"Invalid number, unexpected digit after 0: ".concat(Qi(s),"."))}else c=iu(r,c,s),s=o.charCodeAt(c);if(s===46&&(l=!0,s=o.charCodeAt(++c),c=iu(r,c,s),s=o.charCodeAt(c)),(s===69||s===101)&&(l=!0,s=o.charCodeAt(++c),(s===43||s===45)&&(s=o.charCodeAt(++c)),c=iu(r,c,s),s=o.charCodeAt(c)),s===46||r0(s))throw kt(r,c,"Invalid number, expected digit but got: ".concat(Qi(s),"."));return new Fe(l?O.FLOAT:O.INT,e,c,i,n,a,o.slice(e,c))}function iu(r,e,t){var i=r.body,n=e,a=t;if(a>=48&&a<=57){do a=i.charCodeAt(++n);while(a>=48&&a<=57);return n}throw kt(r,n,"Invalid number, expected digit but got: ".concat(Qi(a),"."))}function Yy(r,e,t,i,n){for(var a=r.body,o=e+1,s=o,c=0,l="";o<a.length&&!isNaN(c=a.charCodeAt(o))&&c!==10&&c!==13;){if(c===34)return l+=a.slice(s,o),new Fe(O.STRING,e,o+1,t,i,n,l);if(c<32&&c!==9)throw kt(r,o,"Invalid character within String: ".concat(Qi(c),"."));if(++o,c===92){switch(l+=a.slice(s,o-1),c=a.charCodeAt(o),c){case 34:l+='"';break;case 47:l+="/";break;case 92:l+="\\";break;case 98:l+="\b";break;case 102:l+="\f";break;case 110:l+=`
61
- `;break;case 114:l+="\r";break;case 116:l+=" ";break;case 117:{var u=e0(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(u<0){var d=a.slice(o+1,o+5);throw kt(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}l+=String.fromCharCode(u),o+=4;break}default:throw kt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw kt(r,o,"Unterminated string.")}function Xy(r,e,t,i,n,a){for(var o=r.body,s=e+3,c=s,l=0,u="";s<o.length&&!isNaN(l=o.charCodeAt(s));){if(l===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return u+=o.slice(c,s),new Fe(O.BLOCK_STRING,e,s+3,t,i,n,Qy(u));if(l<32&&l!==9&&l!==10&&l!==13)throw kt(r,s,"Invalid character within String: ".concat(Qi(l),"."));l===10?(++s,++a.line,a.lineStart=s):l===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):l===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(u+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw kt(r,s,"Unterminated string.")}function e0(r,e,t,i){return ys(r)<<12|ys(e)<<8|ys(t)<<4|ys(i)}function ys(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function t0(r,e,t,i,n){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Fe(O.NAME,e,s,t,i,n,a.slice(e,s))}function r0(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function i0(r,e){var t=new n0(r,e);return t.parseDocument()}var n0=function(){function r(t,i){var n=By(t)?t:new y1(t);this._lexer=new Wy(n),this._options=i}var e=r.prototype;return e.parseName=function(){var i=this.expectToken(O.NAME);return{kind:H.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:H.DOCUMENT,definitions:this.many(O.SOF,this.parseDefinition,O.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(O.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(O.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(O.BRACE_L))return{kind:H.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(O.NAME)&&(a=this.parseName()),{kind:H.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(O.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(O.PAREN_L,this.parseVariableDefinition,O.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:H.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(O.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(O.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(O.DOLLAR),{kind:H.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:H.SELECTION_SET,selections:this.many(O.BRACE_L,this.parseSelection,O.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(O.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(O.COLON)?(a=n,o=this.parseName()):o=n,{kind:H.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(O.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(O.PAREN_L,n,O.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(O.COLON),{kind:H.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:H.ARGUMENT,name:this.parseName(),value:(this.expectToken(O.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(O.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(O.NAME)?{kind:H.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:H.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind:H.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:H.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(i){var n=this._lexer.token;switch(n.kind){case O.BRACKET_L:return this.parseList(i);case O.BRACE_L:return this.parseObject(i);case O.INT:return this._lexer.advance(),{kind:H.INT,value:n.value,loc:this.loc(n)};case O.FLOAT:return this._lexer.advance(),{kind:H.FLOAT,value:n.value,loc:this.loc(n)};case O.STRING:case O.BLOCK_STRING:return this.parseStringLiteral();case O.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:H.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:H.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:H.NULL,loc:this.loc(n)};default:return{kind:H.ENUM,value:n.value,loc:this.loc(n)}}case O.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:H.STRING,value:i.value,block:i.kind===O.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:H.LIST,values:this.any(O.BRACKET_L,o,O.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:H.OBJECT,fields:this.any(O.BRACE_L,o,O.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(O.COLON),{kind:H.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(O.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(O.AT),{kind:H.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(O.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(O.BRACKET_R),n={kind:H.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(O.BANG)?{kind:H.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:H.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===O.NAME)switch(i.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(i)},e.peekDescription=function(){return this.peek(O.STRING)||this.peek(O.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(O.BRACE_L,this.parseOperationTypeDefinition,O.BRACE_R);return{kind:H.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(O.COLON);var a=this.parseNamedType();return{kind:H.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:H.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:H.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(O.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(O.AMP)||this.peek(O.NAME));return n}return this.delimitedMany(O.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(O.BRACE_L)&&this._lexer.lookahead().kind===O.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(O.BRACE_L,this.parseFieldDefinition,O.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(O.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:H.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:c,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(O.PAREN_L,this.parseInputValueDef,O.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(O.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(O.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:H.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:H.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:H.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(O.EQUALS)?this.delimitedMany(O.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:H.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(O.BRACE_L,this.parseEnumValueDefinition,O.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:H.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:H.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(O.BRACE_L,this.parseInputValueDef,O.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===O.NAME)switch(i.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(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(O.BRACE_L,this.parseOperationTypeDefinition,O.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:H.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=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:H.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:H.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:H.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.UNION_TYPE_EXTENSION,name:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.ENUM_TYPE_EXTENSION,name:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(O.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:H.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(O.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(Vy[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new m1(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw kt(this._lexer.source,n.start,"Expected ".concat(v1(i),", found ").concat(nu(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===O.NAME&&n.value===i)this._lexer.advance();else throw kt(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(nu(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===O.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return kt(this._lexer.source,n.start,"Unexpected ".concat(nu(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},r}();function nu(r){var e=r.value;return v1(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function v1(r){return Hy(r)?'"'.concat(r,'"'):r}var Ps=new Map,xu=new Map,b1=!0,Ks=!1;function _1(r){return r.replace(/[\s,]+/g," ").trim()}function a0(r){return _1(r.source.body.substring(r.start,r.end))}function o0(r){var e=new Set,t=[];return r.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=a0(i.loc),o=xu.get(n);o&&!o.has(a)?b1&&console.warn("Warning: fragment with name "+n+` already exists.
59
+ `+f1(r.source,s)}return e}function Tt(r,e,t){return new Oy("Syntax Error: ".concat(t),void 0,r,[e])}var H=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 Ny(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ry=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,xl=Ry;function m1(r){var e=r.prototype.toJSON;typeof e=="function"||Ny(0),r.prototype.inspect=e,xl&&(r.prototype[xl]=e)}var g1=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();m1(g1);var Me=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();m1(Me);var O=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 $s(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?$s=function(t){return typeof t}:$s=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},$s(r)}var Py=10,y1=2;function $y(r){return vc(r,[])}function vc(r,e){switch($s(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Ly(r,e);default:return String(r)}}function Ly(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=Uy(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:vc(n,t)}else if(Array.isArray(r))return My(r,t);return Fy(r,t)}function Fy(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>y1)return"["+jy(r)+"]";var i=t.map(function(n){var a=vc(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function My(r,e){if(r.length===0)return"[]";if(e.length>y1)return"[Array]";for(var t=Math.min(Py,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(vc(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function Uy(r){var e=r[String(xl)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function jy(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function il(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var qy=function(e,t){return e instanceof t};function Jd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function By(r,e,t){return e&&Jd(r.prototype,e),t&&Jd(r,t),r}var v1=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||il(0,"Body must be a string. Received: ".concat($y(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||il(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||il(0,"column in locationOffset is 1-indexed and must be positive.")}return By(r,[{key:p1,get:function(){return"Source"}}]),r}();function Vy(r){return qy(r,v1)}var Qy=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 zy(r){var e=r.split(/\r\n|[\n\r]/g),t=Wy(r);if(t!==0)for(var i=1;i<e.length;i++)e[i]=e[i].slice(t);for(var n=0;n<e.length&&Yd(e[n]);)++n;for(var a=e.length;a>n&&Yd(e[a-1]);)--a;return e.slice(n,a).join(`
60
+ `)}function Yd(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function Wy(r){for(var e,t=!0,i=!0,n=0,a=null,o=0;o<r.length;++o)switch(r.charCodeAt(o)){case 13:r.charCodeAt(o+1)===10&&++o;case 10:t=!1,i=!0,n=0;break;case 9:case 32:++n;break;default:i&&!t&&(a===null||n<a)&&(a=n),i=!1}return(e=a)!==null&&e!==void 0?e:0}var Hy=function(){function r(t){var i=new Me(O.SOF,0,0,0,0,null);this.source=t,this.lastToken=i,this.token=i,this.line=1,this.lineStart=0}var e=r.prototype;return e.advance=function(){this.lastToken=this.token;var i=this.token=this.lookahead();return i},e.lookahead=function(){var i=this.token;if(i.kind!==O.EOF)do{var n;i=(n=i.next)!==null&&n!==void 0?n:i.next=Ky(this,i)}while(i.kind===O.COMMENT);return i},r}();function Gy(r){return r===O.BANG||r===O.DOLLAR||r===O.AMP||r===O.PAREN_L||r===O.PAREN_R||r===O.SPREAD||r===O.COLON||r===O.EQUALS||r===O.AT||r===O.BRACKET_L||r===O.BRACKET_R||r===O.BRACE_L||r===O.PIPE||r===O.BRACE_R}function zi(r){return isNaN(r)?O.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function Ky(r,e){for(var t=r.source,i=t.body,n=i.length,a=e.end;a<n;){var o=i.charCodeAt(a),s=r.line,c=1+a-r.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++r.line,r.lineStart=a;continue;case 13:i.charCodeAt(a+1)===10?a+=2:++a,++r.line,r.lineStart=a;continue;case 33:return new Me(O.BANG,a,a+1,s,c,e);case 35:return Jy(t,a,s,c,e);case 36:return new Me(O.DOLLAR,a,a+1,s,c,e);case 38:return new Me(O.AMP,a,a+1,s,c,e);case 40:return new Me(O.PAREN_L,a,a+1,s,c,e);case 41:return new Me(O.PAREN_R,a,a+1,s,c,e);case 46:if(i.charCodeAt(a+1)===46&&i.charCodeAt(a+2)===46)return new Me(O.SPREAD,a,a+3,s,c,e);break;case 58:return new Me(O.COLON,a,a+1,s,c,e);case 61:return new Me(O.EQUALS,a,a+1,s,c,e);case 64:return new Me(O.AT,a,a+1,s,c,e);case 91:return new Me(O.BRACKET_L,a,a+1,s,c,e);case 93:return new Me(O.BRACKET_R,a,a+1,s,c,e);case 123:return new Me(O.BRACE_L,a,a+1,s,c,e);case 124:return new Me(O.PIPE,a,a+1,s,c,e);case 125:return new Me(O.BRACE_R,a,a+1,s,c,e);case 34:return i.charCodeAt(a+1)===34&&i.charCodeAt(a+2)===34?e0(t,a,s,c,e,r):Xy(t,a,s,c,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Yy(t,a,o,s,c,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 r0(t,a,s,c,e)}throw Tt(t,a,Zy(o))}var u=r.line,l=1+a-r.lineStart;return new Me(O.EOF,n,n,u,l,e)}function Zy(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(zi(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(zi(r),".")}function Jy(r,e,t,i,n){var a=r.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Me(O.COMMENT,e,s,t,i,n,a.slice(e+1,s))}function Yy(r,e,t,i,n,a){var o=r.body,s=t,c=e,u=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw Tt(r,c,"Invalid number, unexpected digit after 0: ".concat(zi(s),"."))}else c=nl(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=nl(r,c,s),s=o.charCodeAt(c)),(s===69||s===101)&&(u=!0,s=o.charCodeAt(++c),(s===43||s===45)&&(s=o.charCodeAt(++c)),c=nl(r,c,s),s=o.charCodeAt(c)),s===46||i0(s))throw Tt(r,c,"Invalid number, expected digit but got: ".concat(zi(s),"."));return new Me(u?O.FLOAT:O.INT,e,c,i,n,a,o.slice(e,c))}function nl(r,e,t){var i=r.body,n=e,a=t;if(a>=48&&a<=57){do a=i.charCodeAt(++n);while(a>=48&&a<=57);return n}throw Tt(r,n,"Invalid number, expected digit but got: ".concat(zi(a),"."))}function Xy(r,e,t,i,n){for(var a=r.body,o=e+1,s=o,c=0,u="";o<a.length&&!isNaN(c=a.charCodeAt(o))&&c!==10&&c!==13;){if(c===34)return u+=a.slice(s,o),new Me(O.STRING,e,o+1,t,i,n,u);if(c<32&&c!==9)throw Tt(r,o,"Invalid character within String: ".concat(zi(c),"."));if(++o,c===92){switch(u+=a.slice(s,o-1),c=a.charCodeAt(o),c){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
61
+ `;break;case 114:u+="\r";break;case 116:u+=" ";break;case 117:{var l=t0(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var d=a.slice(o+1,o+5);throw Tt(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw Tt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw Tt(r,o,"Unterminated string.")}function e0(r,e,t,i,n,a){for(var o=r.body,s=e+3,c=s,u=0,l="";s<o.length&&!isNaN(u=o.charCodeAt(s));){if(u===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(c,s),new Me(O.BLOCK_STRING,e,s+3,t,i,n,zy(l));if(u<32&&u!==9&&u!==10&&u!==13)throw Tt(r,s,"Invalid character within String: ".concat(zi(u),"."));u===10?(++s,++a.line,a.lineStart=s):u===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):u===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw Tt(r,s,"Unterminated string.")}function t0(r,e,t,i){return vs(r)<<12|vs(e)<<8|vs(t)<<4|vs(i)}function vs(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function r0(r,e,t,i,n){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Me(O.NAME,e,s,t,i,n,a.slice(e,s))}function i0(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function n0(r,e){var t=new a0(r,e);return t.parseDocument()}var a0=function(){function r(t,i){var n=Vy(t)?t:new v1(t);this._lexer=new Hy(n),this._options=i}var e=r.prototype;return e.parseName=function(){var i=this.expectToken(O.NAME);return{kind:H.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:H.DOCUMENT,definitions:this.many(O.SOF,this.parseDefinition,O.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(O.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(O.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(O.BRACE_L))return{kind:H.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(O.NAME)&&(a=this.parseName()),{kind:H.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(O.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(O.PAREN_L,this.parseVariableDefinition,O.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:H.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(O.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(O.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(O.DOLLAR),{kind:H.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:H.SELECTION_SET,selections:this.many(O.BRACE_L,this.parseSelection,O.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(O.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(O.COLON)?(a=n,o=this.parseName()):o=n,{kind:H.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(O.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(O.PAREN_L,n,O.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(O.COLON),{kind:H.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:H.ARGUMENT,name:this.parseName(),value:(this.expectToken(O.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(O.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(O.NAME)?{kind:H.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:H.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind:H.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:H.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(i){var n=this._lexer.token;switch(n.kind){case O.BRACKET_L:return this.parseList(i);case O.BRACE_L:return this.parseObject(i);case O.INT:return this._lexer.advance(),{kind:H.INT,value:n.value,loc:this.loc(n)};case O.FLOAT:return this._lexer.advance(),{kind:H.FLOAT,value:n.value,loc:this.loc(n)};case O.STRING:case O.BLOCK_STRING:return this.parseStringLiteral();case O.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:H.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:H.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:H.NULL,loc:this.loc(n)};default:return{kind:H.ENUM,value:n.value,loc:this.loc(n)}}case O.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:H.STRING,value:i.value,block:i.kind===O.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:H.LIST,values:this.any(O.BRACKET_L,o,O.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:H.OBJECT,fields:this.any(O.BRACE_L,o,O.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(O.COLON),{kind:H.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(O.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(O.AT),{kind:H.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(O.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(O.BRACKET_R),n={kind:H.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(O.BANG)?{kind:H.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:H.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===O.NAME)switch(i.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(i)},e.peekDescription=function(){return this.peek(O.STRING)||this.peek(O.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(O.BRACE_L,this.parseOperationTypeDefinition,O.BRACE_R);return{kind:H.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(O.COLON);var a=this.parseNamedType();return{kind:H.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:H.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:H.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(O.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(O.AMP)||this.peek(O.NAME));return n}return this.delimitedMany(O.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(O.BRACE_L)&&this._lexer.lookahead().kind===O.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(O.BRACE_L,this.parseFieldDefinition,O.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(O.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:H.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:c,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(O.PAREN_L,this.parseInputValueDef,O.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(O.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(O.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:H.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:H.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:H.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(O.EQUALS)?this.delimitedMany(O.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:H.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(O.BRACE_L,this.parseEnumValueDefinition,O.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:H.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:H.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(O.BRACE_L,this.parseInputValueDef,O.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===O.NAME)switch(i.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(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(O.BRACE_L,this.parseOperationTypeDefinition,O.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:H.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=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:H.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:H.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:H.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.UNION_TYPE_EXTENSION,name:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.ENUM_TYPE_EXTENSION,name:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(O.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:H.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(O.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(Qy[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new g1(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw Tt(this._lexer.source,n.start,"Expected ".concat(b1(i),", found ").concat(al(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===O.NAME&&n.value===i)this._lexer.advance();else throw Tt(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(al(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===O.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return Tt(this._lexer.source,n.start,"Unexpected ".concat(al(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},r}();function al(r){var e=r.value;return b1(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function b1(r){return Gy(r)?'"'.concat(r,'"'):r}var Ls=new Map,Al=new Map,_1=!0,Zs=!1;function S1(r){return r.replace(/[\s,]+/g," ").trim()}function o0(r){return S1(r.source.body.substring(r.start,r.end))}function s0(r){var e=new Set,t=[];return r.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=o0(i.loc),o=Al.get(n);o&&!o.has(a)?_1&&console.warn("Warning: fragment with name "+n+` already exists.
62
62
  graphql-tag enforces all fragment names across your application to be unique; read more about
63
- this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||xu.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(i))}else t.push(i)}),Gs(Gs({},r),{definitions:t})}function s0(r){var e=new Set(r.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function c0(r){var e=_1(r);if(!Ps.has(e)){var t=i0(r,{experimentalFragmentVariables:Ks,allowLegacyFragmentVariables:Ks});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Ps.set(e,s0(o0(t)))}return Ps.get(e)}function E(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var i=r[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=r[a+1]}),c0(i)}function l0(){Ps.clear(),xu.clear()}function u0(){b1=!1}function p0(){Ks=!0}function f0(){Ks=!1}var Ia={gql:E,resetCaches:l0,disableFragmentWarnings:u0,enableExperimentalFragmentVariables:p0,disableExperimentalFragmentVariables:f0};(function(r){r.gql=Ia.gql,r.resetCaches=Ia.resetCaches,r.disableFragmentWarnings=Ia.disableFragmentWarnings,r.enableExperimentalFragmentVariables=Ia.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=Ia.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function k(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function d0(){}function li(){return d0}var Y=li,g=li,Je=li,Se=li,K=li,Dt=li,h0=li,Ku=li,S1=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},w1=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},zi=class{constructor(e){this.code=e}};S1([g(),w1("design:type",String)],zi.prototype,"code",void 0);zi=S1([K(),w1("design:paramtypes",[String])],zi);var Zu=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ju=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},cr=class{constructor(e,t){this.address=e,this.name=t}};Zu([g(),Ju("design:type",String)],cr.prototype,"address",void 0);Zu([g(),Ju("design:type",String)],cr.prototype,"name",void 0);cr=Zu([K(),Ju("design:paramtypes",[String,String])],cr);var De=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ze=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ar=class{constructor(e,t){this.key=t,this.signature=e}};De([g(),ze("design:type",String)],Ar.prototype,"signature",void 0);De([g(),ze("design:type",String)],Ar.prototype,"key",void 0);De([g(),ze("design:type",Boolean)],Ar.prototype,"valid",void 0);De([g(),ze("design:type",Boolean)],Ar.prototype,"invalid",void 0);Ar=De([K(),Je(),ze("design:paramtypes",[String,String])],Ar);var Wi=class{};De([g(),ze("design:type",String)],Wi.prototype,"signature",void 0);De([g(),ze("design:type",String)],Wi.prototype,"key",void 0);De([g(),ze("design:type",Boolean)],Wi.prototype,"valid",void 0);De([g(),ze("design:type",Boolean)],Wi.prototype,"invalid",void 0);Wi=De([Je()],Wi);function ui(r){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return De([g(),ze("design:type",String)],e.prototype,"author",void 0),De([g(),ze("design:type",String)],e.prototype,"timestamp",void 0),De([g(),ze("design:type",Object)],e.prototype,"data",void 0),De([g(),ze("design:type",Ar)],e.prototype,"proof",void 0),e=De([K(),ze("design:paramtypes",[String,String,Object,Ar])],e),e}function m0(r){let e=class{};return De([g(),ze("design:type",String)],e.prototype,"author",void 0),De([g(),ze("design:type",String)],e.prototype,"timestamp",void 0),De([g(),ze("design:type",Object)],e.prototype,"data",void 0),De([g(),ze("design:type",Wi)],e.prototype,"proof",void 0),e=De([Je()],e),e}var Yd=class extends ui(){};Yd=De([K()],Yd);var Zs=class extends ui(){};De([g(),ze("design:type",cr)],Zs.prototype,"language",void 0);De([g(),ze("design:type",zi)],Zs.prototype,"icon",void 0);Zs=De([K()],Zs);function b8(r){return r&&r.author&&r.timestamp&&r.data}var Ue=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},st=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hi=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Ue([g(),st("design:type",String)],Hi.prototype,"source",void 0);Ue([g(),st("design:type",String)],Hi.prototype,"target",void 0);Ue([g(),st("design:type",String)],Hi.prototype,"predicate",void 0);Hi=Ue([K(),st("design:paramtypes",[Object])],Hi);var Js=class{};Ue([g(),st("design:type",Array)],Js.prototype,"additions",void 0);Ue([g(),st("design:type",Array)],Js.prototype,"removals",void 0);Js=Ue([Je()],Js);var Ys=class{constructor(e,t){this.additions=e,this.removals=t}};Ue([g(),st("design:type",Array)],Ys.prototype,"additions",void 0);Ue([g(),st("design:type",Array)],Ys.prototype,"removals",void 0);Ys=Ue([K(),st("design:paramtypes",[Array,Array])],Ys);var no=class{};Ue([g(),st("design:type",String)],no.prototype,"source",void 0);Ue([g(),st("design:type",String)],no.prototype,"target",void 0);Ue([g(),st("design:type",String)],no.prototype,"predicate",void 0);no=Ue([Je()],no);var ii=class extends ui(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),t=(t<<5)-t+n,t|=0;return t}};Ue([g(),st("design:type",String)],ii.prototype,"status",void 0);ii=Ue([K()],ii);var Au=class extends m0(){};Ue([g(),st("design:type",String)],Au.prototype,"status",void 0);Au=Ue([Je()],Au);function A8(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function k8(r){return r&&r.source&&r.target}var Xs=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Ue([g(),st("design:type",ii)],Xs.prototype,"oldLink",void 0);Ue([g(),st("design:type",ii)],Xs.prototype,"newLink",void 0);Xs=Ue([K(),st("design:paramtypes",[ii,ii])],Xs);var rn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},bo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ku,pr=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 i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(i=>i.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}};rn([g(),bo("design:type",Array)],pr.prototype,"links",void 0);pr=rn([K(),bo("design:paramtypes",[Array])],pr);var ec=class{};rn([g(),bo("design:type",Array)],ec.prototype,"links",void 0);ec=rn([Je()],ec);var Tu=ku=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new ku;return t.links.push(e),t}};rn([g(),bo("design:type",Array)],Tu.prototype,"links",void 0);Tu=ku=rn([Je(),bo("design:paramtypes",[Array])],Tu);var Gi=class extends ui(){};Gi=rn([K()],Gi);var q=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},B=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Yr=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new pr}};q([g(),B("design:type",String)],Yr.prototype,"did",void 0);q([g(),B("design:type",pr)],Yr.prototype,"perspective",void 0);q([g(),B("design:type",String)],Yr.prototype,"directMessageLanguage",void 0);Yr=q([K(),B("design:paramtypes",[String,pr])],Yr);var Xd=class extends ui(){};Xd=q([K()],Xd);var ni=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],ni.prototype,"did",void 0);q([g(),B("design:type",String)],ni.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],ni.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],ni.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],ni.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],ni.prototype,"didSignedByDeviceKey",void 0);ni=q([K(),B("design:paramtypes",[String,String,String,String,String,String])],ni);var ai=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],ai.prototype,"did",void 0);q([g(),B("design:type",String)],ai.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],ai.prototype,"didSignedByDeviceKey",void 0);ai=q([Je(),B("design:paramtypes",[String,String,String,String,String,String])],ai);var tc=class{constructor(e,t){this.signature=e,this.publicKey=t}};q([g(),B("design:type",String)],tc.prototype,"signature",void 0);q([g(),B("design:type",String)],tc.prototype,"publicKey",void 0);tc=q([K(),B("design:paramtypes",[String,String])],tc);var Bn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([g(),B("design:type",String)],Bn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Bn.prototype,"pointers",void 0);Bn=q([K(),B("design:paramtypes",[String,Array])],Bn);var rc=class{constructor(e,t){this.with=e,this.can=t}};q([g(),B("design:type",Bn)],rc.prototype,"with",void 0);q([g(),B("design:type",Array)],rc.prototype,"can",void 0);rc=q([K(),B("design:paramtypes",[Bn,Array])],rc);var kr=class{constructor(e,t,i,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};q([g(),B("design:type",String)],kr.prototype,"appName",void 0);q([g(),B("design:type",String)],kr.prototype,"appDesc",void 0);q([g(),B("design:type",String)],kr.prototype,"appUrl",void 0);q([g(),B("design:type",String)],kr.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],kr.prototype,"capabilities",void 0);kr=q([K(),B("design:paramtypes",[String,String,String,Array,String])],kr);var Vn=class{constructor(e,t,i,n){this.requestId=e,this.auth=t,this.token=i,this.revoked=n}};q([g(),B("design:type",String)],Vn.prototype,"requestId",void 0);q([g(),B("design:type",String)],Vn.prototype,"token",void 0);q([g(),B("design:type",Boolean)],Vn.prototype,"revoked",void 0);q([g(),B("design:type",kr)],Vn.prototype,"auth",void 0);Vn=q([K(),B("design:paramtypes",[String,kr,String,Boolean])],Vn);var Qn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([g(),B("design:type",String)],Qn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Qn.prototype,"pointers",void 0);Qn=q([Je(),B("design:paramtypes",[String,Array])],Qn);var ic=class{constructor(e,t){this.with=e,this.can=t}};q([g(),B("design:type",Qn)],ic.prototype,"with",void 0);q([g(),B("design:type",Array)],ic.prototype,"can",void 0);ic=q([Je(),B("design:paramtypes",[Qn,Array])],ic);var fr=class{constructor(e,t,i,n,a,o){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};q([g(),B("design:type",String)],fr.prototype,"appName",void 0);q([g(),B("design:type",String)],fr.prototype,"appDesc",void 0);q([g(),B("design:type",String)],fr.prototype,"appDomain",void 0);q([g(),B("design:type",String)],fr.prototype,"appUrl",void 0);q([g(),B("design:type",String)],fr.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],fr.prototype,"capabilities",void 0);fr=q([Je(),B("design:paramtypes",[String,String,String,String,String,Array])],fr);var Ki=class{constructor(e,t,i){this.did=e,this.success=t,this.error=i}};q([g(),B("design:type",String)],Ki.prototype,"did",void 0);q([g(),B("design:type",Boolean)],Ki.prototype,"success",void 0);q([g(),B("design:type",String)],Ki.prototype,"error",void 0);Ki=q([K(),B("design:paramtypes",[String,Boolean,String])],Ki);var Jn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Yn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Mt=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)}};Jn([g(),Yn("design:type",Boolean)],Mt.prototype,"isInitialized",void 0);Jn([g(),Yn("design:type",Boolean)],Mt.prototype,"isUnlocked",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"did",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"didDocument",void 0);Jn([g(),Yn("design:type",String)],Mt.prototype,"error",void 0);Mt=Jn([K(),Yn("design:paramtypes",[Object])],Mt);var eh=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Le=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},bt,_t,Iu=class{constructor(e,t){bt.set(this,void 0),_t.set(this,void 0),eh(this,bt,e,"f"),eh(this,_t,t,"f")}async otherAgents(){return await Le(this,bt,"f").otherAgents(Le(this,_t,"f"))}async hasTelepresenceAdapter(){return await Le(this,bt,"f").hasTelepresenceAdapter(Le(this,_t,"f"))}async onlineAgents(){return await Le(this,bt,"f").onlineAgents(Le(this,_t,"f"))}async setOnlineStatus(e){return await Le(this,bt,"f").setOnlineStatus(Le(this,_t,"f"),e)}async setOnlineStatusU(e){return await Le(this,bt,"f").setOnlineStatusU(Le(this,_t,"f"),e)}async sendSignal(e,t){return await Le(this,bt,"f").sendSignal(Le(this,_t,"f"),e,t)}async sendSignalU(e,t){return await Le(this,bt,"f").sendSignalU(Le(this,_t,"f"),e,t)}async sendBroadcast(e,t=!1){return await Le(this,bt,"f").sendBroadcast(Le(this,_t,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Le(this,bt,"f").sendBroadcastU(Le(this,_t,"f"),e,t)}async addSignalHandler(e){await Le(this,bt,"f").addSignalHandler(Le(this,_t,"f"),e)}removeSignalHandler(e){Le(this,bt,"f").removeSignalHandler(Le(this,_t,"f"),e)}};bt=new WeakMap,_t=new WeakMap;var nn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},an=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ot=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)}};nn([g(),an("design:type",String)],ot.prototype,"source",void 0);nn([g(),an("design:type",String)],ot.prototype,"target",void 0);nn([g(),an("design:type",String)],ot.prototype,"predicate",void 0);nn([g(),an("design:type",Date)],ot.prototype,"fromDate",void 0);nn([g(),an("design:type",Date)],ot.prototype,"untilDate",void 0);nn([g(),an("design:type",Number)],ot.prototype,"limit",void 0);ot=nn([K(),Je(),an("design:paramtypes",[Object])],ot);var th=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},tt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},St,Sr;function vs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ut=class{constructor(){St.set(this,void 0),Sr.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 ut;return th(t,Sr,e,"f"),t}static from(e){let t=new ut;return th(t,St,e,"f"),t}toUrl(){if(tt(this,Sr,"f")&&!tt(this,St,"f"))return tt(this,Sr,"f");if(!tt(this,Sr,"f")&&(tt(this,St,"f")===void 0||tt(this,St,"f")===""||tt(this,St,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof tt(this,St,"f")){case"string":e=`string:${vs(tt(this,St,"f"))}`;break;case"number":e=`number:${vs(tt(this,St,"f"))}`;break;case"boolean":e=`boolean:${vs(tt(this,St,"f"))}`;break;case"object":e=`json:${vs(JSON.stringify(tt(this,St,"f")))}`;break}return`literal://${e}`}get(){if(tt(this,St,"f"))return tt(this,St,"f");if(!tt(this,Sr,"f"))throw new Error("Can't render empty Literal");if(!tt(this,Sr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=tt(this,Sr,"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}`)}};St=new WeakMap,Sr=new WeakMap;function Xr(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Yu(r){return`set${Xr(r)}`}function jn(r){return r.endsWith("y")?r.slice(0,-1)+"ies":r+"s"}function Xu(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function g0(r){return`add${Xr(Xu(r))}`}function y0(r){let e=r.substring(3),t=jn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function v0(r){return`remove${Xr(Xu(r))}`}function b0(r){let e=r.substring(6),t=jn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function _0(r){let e=r.substring(13),t=jn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function S0(r){return`setCollection${Xr(Xu(r))}`}function Oi(r){if(Array.isArray(r))return`[${r.map(Oi).join(", ")}]`;let e=Object.keys(r),t=[];for(let i of e){let n=JSON.stringify(r[i]),a=`${i}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var au=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},V=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},rt,it,Ie,ao=class{constructor(r,e,t){rt.set(this,void 0),it.set(this,void 0),Ie.set(this,void 0),au(this,rt,e,"f"),au(this,it,t,"f"),au(this,Ie,r,"f")}get baseExpression(){return V(this,rt,"f")}async init(){let isInstance=await V(this,Ie,"f").isSubjectInstance(V(this,rt,"f"),V(this,it,"f"));if(!isInstance)throw`Not a valid subject instance of ${V(this,it,"f")} for ${V(this,rt,"f")}`;let results=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties){let e=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property_resolve(C, "${r}")`);Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{let t=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property_getter(C, "${V(this,rt,"f")}", "${r}", Value)`);if(t&&t.length>0&&t[0].Value!==void 0&&t[0].Value!==null&&t[0].Value!==""){let i=t[0].Value;if(e)try{if(i){let n=await V(this,Ie,"f").getExpression(i);try{return JSON.parse(n.data)}catch{return n.data}}else return i}catch{return i}else return i}}catch{}try{return await V(this,Ie,"f").getPropertyValueViaSurreal(V(this,rt,"f"),V(this,it,"f"),r)}catch(t){console.warn(`Failed to get property ${r} via SurrealDB:`,t);return}}})}let setters=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Yu(property)]=async r=>{resolveLanguage&&(r=await V(this,Ie,"f").createExpression(r,resolveLanguage)),await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:r}])}}let results2=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(r=>r.Collection);for(let r of collections)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{let e=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection_getter(C, "${V(this,rt,"f")}", "${r}", Value)`);if(e&&e.length>0&&e[0].Value&&Array.isArray(e[0].Value)&&e[0].Value.length>0){let t=e[0].Value.filter(i=>i!==""&&i!=="");if(t.length>0)return t}}catch{}try{return await V(this,Ie,"f").getCollectionValuesViaSurreal(V(this,rt,"f"),V(this,it,"f"),r)}catch(e){return console.warn(`Failed to get collection ${r} via SurrealDB:`,e),[]}}});let adders=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[g0(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:e}]))):await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:r}])}}let removers=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[v0(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:e}]))):await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:r}])}}let collectionSetters=await V(this,Ie,"f").infer(`subject_class("${V(this,it,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[S0(collection)]=async r=>{Array.isArray(r)?await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),r.map(e=>({name:"value",value:e}))):await V(this,Ie,"f").executeAction(actions,V(this,rt,"f"),[{name:"value",value:r}])}}}};rt=new WeakMap,it=new WeakMap,Ie=new WeakMap;var _e=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},I=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ls,wr,ir,nr,Ui,Wr,Hr,Di,$a,Fs,Ni,Ri,Lt,Fn,Ou,de,ge,$i,Pi,Li,Pa,nc=class{constructor(e,t,i){Ls.add(this),wr.set(this,void 0),ir.set(this,void 0),nr.set(this,void 0),Ui.set(this,void 0),Wr.set(this,void 0),Hr.set(this,void 0),Di.set(this,void 0),$a.set(this,!1),Fs.set(this,void 0),Ni.set(this,void 0),Ri.set(this,void 0),Lt.set(this,void 0),Fn.set(this,void 0),this.isSurrealDB=!1,_e(this,wr,e,"f"),_e(this,Fn,t,"f"),_e(this,nr,i,"f"),_e(this,Ui,new Set,"f"),_e(this,Di,null,"f"),_e(this,Fs,new Promise((n,a)=>{_e(this,Ni,n,"f"),_e(this,Ri,a,"f")}),"f")}async subscribe(){I(this,Hr,"f")&&(I(this,Hr,"f").call(this),_e(this,Hr,void 0,"f")),I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),_e(this,Lt,void 0,"f")),I(this,Wr,"f")&&(clearTimeout(I(this,Wr,"f")),_e(this,Wr,void 0,"f"));try{let t;this.isSurrealDB?t=await I(this,nr,"f").perspectiveSubscribeSurrealQuery(I(this,wr,"f"),I(this,Fn,"f")):t=await I(this,nr,"f").subscribeQuery(I(this,wr,"f"),I(this,Fn,"f")),_e(this,ir,t.subscriptionId,"f"),t.result?(_e(this,Di,t.result,"f"),I(this,Ls,"m",Ou).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),_e(this,Lt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),_e(this,Hr,I(this,nr,"f").subscribeToQueryUpdates(I(this,ir,"f"),i=>{I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),_e(this,Lt,void 0,"f")),I(this,Ni,"f")&&(I(this,Ni,"f").call(this,!0),_e(this,Ni,void 0,"f"),_e(this,Ri,void 0,"f")),!(i.isInit&&I(this,Di,"f"))&&(_e(this,Di,i,"f"),I(this,Ls,"m",Ou).call(this,i))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),I(this,Ri,"f")&&(I(this,Ri,"f").call(this,t),_e(this,Ni,void 0,"f"),_e(this,Ri,void 0,"f")),t}let e=async()=>{if(!I(this,$a,"f")){try{this.isSurrealDB?await I(this,nr,"f").perspectiveKeepAliveSurrealQuery(I(this,wr,"f"),I(this,ir,"f")):await I(this,nr,"f").keepAliveQuery(I(this,wr,"f"),I(this,ir,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",I(this,Fn,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}I(this,$a,"f")||_e(this,Wr,setTimeout(e,3e4),"f")}};_e(this,Wr,setTimeout(e,3e4),"f")}get id(){return I(this,ir,"f")}get initialized(){return I(this,Fs,"f")}get result(){return I(this,Di,"f")}onResult(e){return I(this,Ui,"f").add(e),()=>I(this,Ui,"f").delete(e)}dispose(){_e(this,$a,!0,"f"),clearTimeout(I(this,Wr,"f")),I(this,Hr,"f")&&I(this,Hr,"f").call(this),I(this,Ui,"f").clear(),I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),_e(this,Lt,void 0,"f")),I(this,ir,"f")&&(this.isSurrealDB?I(this,nr,"f").perspectiveDisposeSurrealQuerySubscription(I(this,wr,"f"),I(this,ir,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):I(this,nr,"f").disposeQuerySubscription(I(this,wr,"f"),I(this,ir,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};wr=new WeakMap,ir=new WeakMap,nr=new WeakMap,Ui=new WeakMap,Wr=new WeakMap,Hr=new WeakMap,Di=new WeakMap,$a=new WeakMap,Fs=new WeakMap,Ni=new WeakMap,Ri=new WeakMap,Lt=new WeakMap,Fn=new WeakMap,Ls=new WeakSet,Ou=function r(e){for(let t of I(this,Ui,"f"))try{t(e)}catch(i){console.error("Error in query subscription callback:",i)}};var Un=class{constructor(r,e){de.set(this,void 0),ge.set(this,void 0),$i.set(this,void 0),Pi.set(this,void 0),Li.set(this,void 0),Pa.set(this,void 0),_e(this,$i,[],"f"),_e(this,Pi,[],"f"),_e(this,Li,[],"f"),_e(this,Pa,[],"f"),_e(this,de,r,"f"),_e(this,ge,e,"f"),this.uuid=I(this,de,"f").uuid,this.name=I(this,de,"f").name,this.owners=I(this,de,"f").owners,this.sharedUrl=I(this,de,"f").sharedUrl,this.neighbourhood=I(this,de,"f").neighbourhood,this.state=I(this,de,"f").state,I(this,ge,"f").addPerspectiveLinkAddedListener(I(this,de,"f").uuid,I(this,$i,"f")),I(this,ge,"f").addPerspectiveLinkRemovedListener(I(this,de,"f").uuid,I(this,Pi,"f")),I(this,ge,"f").addPerspectiveLinkUpdatedListener(I(this,de,"f").uuid,I(this,Li,"f")),I(this,ge,"f").addPerspectiveSyncStateChangeListener(I(this,de,"f").uuid,I(this,Pa,"f"))}async executeAction(r,e,t,i){return await I(this,ge,"f").executeCommands(I(this,de,"f").uuid,JSON.stringify(r),e,JSON.stringify(t),i)}async get(r){return await I(this,ge,"f").queryLinks(I(this,de,"f").uuid,r)}async infer(r){return await I(this,ge,"f").queryProlog(I(this,de,"f").uuid,r)}async querySurrealDB(r){return await I(this,ge,"f").querySurrealDB(I(this,de,"f").uuid,r)}async add(r,e="shared",t){return await I(this,ge,"f").addLink(I(this,de,"f").uuid,r,e,t)}async addLinks(r,e="shared",t){return await I(this,ge,"f").addLinks(I(this,de,"f").uuid,r,e,t)}async removeLinks(r,e){return await I(this,ge,"f").removeLinks(I(this,de,"f").uuid,r,e)}async linkMutations(r,e="shared"){return await I(this,ge,"f").linkMutations(I(this,de,"f").uuid,r,e)}async addLinkExpression(r,e="shared",t){return await I(this,ge,"f").addLinkExpression(I(this,de,"f").uuid,r,e,t)}async update(r,e,t){return await I(this,ge,"f").updateLink(I(this,de,"f").uuid,r,e,t)}async remove(r,e){return await I(this,ge,"f").removeLink(I(this,de,"f").uuid,r,e)}async createBatch(){return await I(this,ge,"f").createBatch(I(this,de,"f").uuid)}async commitBatch(r){return await I(this,ge,"f").commitBatch(I(this,de,"f").uuid,r)}async getExpression(r){return await I(this,ge,"f").getExpression(r)}async createExpression(r,e){return await I(this,ge,"f").createExpression(r,e)}async addListener(r,e){r==="link-added"?I(this,$i,"f").push(e):r==="link-removed"?I(this,Pi,"f").push(e):r==="link-updated"&&I(this,Li,"f").push(e)}async addSyncStateChangeListener(r){I(this,Pa,"f").push(r)}async removeListener(r,e){if(r==="link-added"){let t=I(this,$i,"f").indexOf(e);I(this,$i,"f").splice(t,1)}else if(r==="link-removed"){let t=I(this,Pi,"f").indexOf(e);I(this,Pi,"f").splice(t,1)}else if(r==="link-updated"){let t=I(this,Li,"f").indexOf(e);I(this,Li,"f").splice(t,1)}}async snapshot(){return I(this,ge,"f").snapshotByUUID(I(this,de,"f").uuid)}async loadSnapshot(r){let e=JSON.parse(JSON.stringify(r));delete e.__typename,e.links.forEach(t=>{delete t.data.__typename});for(let t of e.links)await this.addLinkExpression(t)}async getSingleTarget(r){delete r.target;let e=await this.get(r);return e.length?e[0].data.target:null}async setSingleTarget(r,e="shared"){let t=new ot({source:r.source,predicate:r.predicate}),i=await this.get(t),n=[];for(let o of i)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,n.push(o);let a=[r];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(r){return(await this.infer(`flowable("${r}", F), register_sdna_flow(X, F)`)).map(t=>t.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state(X, ${e}, F)`)).map(i=>i.X)}async flowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(r,e){return(await this.infer(`register_sdna_flow("${r}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(i=>i.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let r=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let t of r){let i=await this.get(new ot({source:"ad4m://self",predicate:t}));for(let n of i){let a=n.data.target,o=await this.get(new ot({source:a,predicate:"ad4m://sdna"}));for(let s of o){let c=ut.fromUrl(s.data.target).get();typeof c=="string"&&e.push(c)}}}return e}async getSdnaForClass(r){let e=ut.from(r);if((await this.get(new ot({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new ot({source:e.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let n=ut.fromUrl(i[0].data.target).get();return typeof n=="string"?n:null}async addSdna(r,e,t){return I(this,ge,"f").addSdna(I(this,de,"f").uuid,r,e,t)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(r=>r.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(r){if(typeof r=="string")return r;{let e=await this.subjectClassesByTemplate(r);return e[0]?e[0]:r.className}}async createSubject(r,e,t,i){let n;if(typeof r=="string")n=r,await I(this,ge,"f").createSubject(I(this,de,"f").uuid,JSON.stringify({className:n,initialValues:t}),e,t?JSON.stringify(t):void 0,i);else{let a=this.buildQueryFromTemplate(r);await I(this,ge,"f").createSubject(I(this,de,"f").uuid,JSON.stringify({query:a,initialValues:t}),e,t?JSON.stringify(t):void 0,i)}return i?e:this.getSubjectProxy(e,r)}async getSubjectData(r,e){if(typeof r=="string")return JSON.parse(await I(this,ge,"f").getSubjectData(I(this,de,"f").uuid,JSON.stringify({className:r}),e));let t=this.buildQueryFromTemplate(r);return JSON.parse(await I(this,ge,"f").getSubjectData(I(this,de,"f").uuid,JSON.stringify({query:t}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(r,e){let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return!1;if(i.requiredTriples.length===0){console.log("no required triples, checking surrealDB");let n=`SELECT count() AS count FROM link WHERE in.uri = '${r}'`;console.log("checkQuery",n);let a=await this.querySurrealDB(n);console.log("result",a);let o=a[0]?.count??0;return(typeof o=="object"&&o?.Int!==void 0?o.Int:o)>0}for(let n of i.requiredTriples){console.log("checking triple",n);let a;n.target?a=`SELECT count() AS count FROM link WHERE in.uri = '${r}' AND predicate = '${n.predicate}' AND out.uri = '${n.target}'`:a=`SELECT count() AS count FROM link WHERE in.uri = '${r}' AND predicate = '${n.predicate}'`,console.log("checkQuery",a);let o=await this.querySurrealDB(a);if(console.log("result",o),!o||o.length===0)return!1;let s=o[0]?.count??0;if((typeof s=="object"&&s?.Int!==void 0?s.Int:s)===0)return!1}return!0}async getSubjectProxy(r,e){if(!await this.isSubjectInstance(r,e))throw`Expression ${r} is not a subject instance of given class: ${JSON.stringify(e)}`;let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=new ao(this,r,t);return await i.init(),i}async getSubjectClassMetadataFromSDNA(r){try{let e=await this.get(new ot({source:`literal://string:${r}`,predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${r}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${r} has no target:`,e[0]),null;let t=ut.fromUrl(e[0].data.target).get(),i=[],n=t.match(/instance\([^,]+,\s*\w+\)\s*:-\s*(.+?)\./s);if(n){let u=n[1];console.log("instance rule body:",u);let d=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,f;for(;(f=d.exec(u))!==null;){let p=f[1],h=f[2];i.push({predicate:p,target:h}),console.log(`Extracted triple: predicate="${p}", target="${h}"`)}}else console.warn(`No instance rule found in SDNA for ${r}`);let a=i.map(u=>u.predicate);console.log("extracted requiredTriples:",i);let o=new Map,s=await this.infer(`subject_class("${r}", C), property(C, P)`);if(s)for(let u of s){let d=u.P,f=null,p=await this.infer(`subject_class("${r}", C), property_setter(C, "${d}", Setter)`);if(p&&p.length>0){let m=p[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);m&&(f=m[1]||m[2])}if(!f){let h=t.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${d}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));h&&(f=h[1])}if(f){let h=await this.infer(`subject_class("${r}", C), property_resolve_language(C, "${d}", Lang)`),m=h&&h.length>0?h[0].Lang:void 0;o.set(d,{predicate:f,resolveLanguage:m})}}let c=new Map,l=await this.infer(`subject_class("${r}", C), collection(C, Coll)`);if(l)for(let u of l){let d=u.Coll,f=null,p,h=await this.infer(`subject_class("${r}", C), collection_adder(C, "${d}", Adder)`);if(h&&h.length>0){let b=h[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);b&&(f=b[1]||b[2])}let m=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${d}"[^)]*\\)\\s*:-[^.]+\\.`),v=t.match(m);if(v){let w=v[0],b=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,S=w.match(b);if(S){let _=S[1];if(_.startsWith("(")&&_.endsWith(")")&&(_=_.substring(1,_.length-1)),console.log(`Collection "${d}" getter body:`,_),!f){let R=_.match(/triple\([^,]+,\s*"([^"]+)"/);R&&(f=R[1])}let T=_.match(/subject_class\("([^"]+)"/);T&&(p=T[1],console.log(`Collection "${d}" has instanceFilter: ${p}`))}}f&&c.set(d,{predicate:f,instanceFilter:p})}return{requiredPredicates:a,requiredTriples:i,properties:o,collections:c}}catch(e){return console.error(`Error getting metadata for ${r}:`,e),null}}generateSurrealInstanceQuery(r){if(console.log("generateSurrealInstanceQuery called with requiredTriples:",r.requiredTriples),r.requiredTriples.length===0){let i="SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0";return console.log("Generated query (no required triples):",i),i}let t=`SELECT uri AS base FROM node WHERE ${r.requiredTriples.map(i=>i.target?`count(->link[WHERE predicate = '${i.predicate}' AND out.uri = '${i.target}']) > 0`:`count(->link[WHERE predicate = '${i.predicate}']) > 0`).join(" AND ")}`;return console.log("Generated query:",t),t}async getPropertyValueViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return;let n=i.properties.get(t);if(!n)return;let a=`SELECT out.uri AS value FROM link WHERE in.uri = '${r}' AND predicate = '${n.predicate}' LIMIT 1`,o=await this.querySurrealDB(a);if(!o||o.length===0)return;let s=o[0].value;if(n.resolveLanguage&&s)try{let c=await this.getExpression(s);try{return JSON.parse(c.data)}catch{return c.data}}catch{return s}return s}async getCollectionValuesViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return[];let n=i.collections.get(t);if(!n)return[];let a=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${r}' AND predicate = '${n.predicate}' ORDER BY timestamp ASC`,o=await this.querySurrealDB(a);if(!o||o.length===0)return[];let s=o.map(c=>c.value).filter(c=>c!==""&&c!=="");if(console.log(`getCollectionValuesViaSurreal: base="${r}", collection="${t}", predicate="${n.predicate}", found ${s.length} values:`,s),n.instanceFilter){console.log(` Applying instance filter "${n.instanceFilter}" to collection "${t}"`);let c=[];for(let l of s){let u=await this.isSubjectInstance(l,n.instanceFilter);console.log(` Checking if "${l}" is instance of "${n.instanceFilter}": ${u}`),u&&c.push(l)}return console.log(` After filtering: ${c.length} values`),c}return s}async getAllSubjectInstances(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new ao(this,s.base,i);await c.init(),t.push(c)}catch{}}}return t}async getAllSubjectProxies(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n);console.log("surrealQuery",a);let o=await this.querySurrealDB(a);console.log(`getAllSubjectProxies: SurrealDB returned ${o?.length||0} results`);let s=o.map(c=>({X:c.base}));console.log("newInstance",s),t=t.concat(s)}else console.warn(`getAllSubjectProxies: No metadata found for ${i}`)}return t}buildQueryFromTemplate(r){let e;return function(t){let i=[],n=[];Object.getPrototypeOf(t).__properties?Object.keys(Object.getPrototypeOf(t).__properties).forEach(u=>i.push(u)):i.push(...Object.keys(t).filter(u=>!Array.isArray(t[u]))),Object.getPrototypeOf(t).__collections?Object.keys(Object.getPrototypeOf(t).__collections).filter(u=>u!=="isSubjectInstance").forEach(u=>{n.includes(u)||n.push(u)}):n.push(...Object.keys(t).filter(u=>Array.isArray(t[u])).filter(u=>u!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(t).filter(u=>typeof t[u]=="function"&&u.startsWith("set")&&!u.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return d&&typeof d.value=="function"&&u.startsWith("set")&&!u.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return d&&typeof d.value=="function"&&u.startsWith("add")}));let s=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return d&&typeof d.value=="function"&&u.startsWith("remove")}));let c=Object.getOwnPropertyNames(t).filter(u=>Object.prototype.hasOwnProperty.call(t,u)&&typeof t[u]=="function"&&u.startsWith("setCollection"));c=c.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(u=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),u);return d&&typeof d.value=="function"&&u.startsWith("setCollection")}));let l="subject_class(Class, C)";for(let u of i)l+=`, property(C, "${u}")`;for(let u of n)l+=`, collection(C, "${u}")`;for(let u of a){let d=u.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),l+=`, property_setter(C, "${d}", _)`}for(let u of o)l+=`, collection_adder(C, "${y0(u)}", _)`;for(let u of s)l+=`, collection_remover(C, "${b0(u)}", _)`;for(let u of c)l+=`, collection_setter(C, "${_0(u)}", _)`;l+=".",e=l}(r),e}async subjectClassesByTemplate(r){let e=this.buildQueryFromTemplate(r),t=await this.infer(e);return t?t.map(i=>i.Class):[]}async ensureSDNASubjectClass(r){if((await this.subjectClassesByTemplate(new r)).length>0)return;let{name:t,sdna:i}=r.generateSDNA();await this.addSdna(t,i,"subject_class")}getNeighbourhoodProxy(){return I(this,ge,"f").getNeighbourhoodProxy(I(this,de,"f").uuid)}get ai(){return I(this,ge,"f").aiClient}async subscribeInfer(r){let e=new nc(this.uuid,r,I(this,ge,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(r){let e=new nc(this.uuid,r,I(this,ge,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};de=new WeakMap,ge=new WeakMap,$i=new WeakMap,Pi=new WeakMap,Li=new WeakMap,Pa=new WeakMap;var Vr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},z=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ie,La,Fa,Ma,Ms,Ua,Us,js,dt=`
63
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Al.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(i))}else t.push(i)}),Ks(Ks({},r),{definitions:t})}function c0(r){var e=new Set(r.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function u0(r){var e=S1(r);if(!Ls.has(e)){var t=n0(r,{experimentalFragmentVariables:Zs,allowLegacyFragmentVariables:Zs});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Ls.set(e,c0(s0(t)))}return Ls.get(e)}function C(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var i=r[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=r[a+1]}),u0(i)}function l0(){Ls.clear(),Al.clear()}function p0(){_1=!1}function f0(){Zs=!0}function d0(){Zs=!1}var Da={gql:C,resetCaches:l0,disableFragmentWarnings:p0,enableExperimentalFragmentVariables:f0,disableExperimentalFragmentVariables:d0};(function(r){r.gql=Da.gql,r.resetCaches=Da.resetCaches,r.disableFragmentWarnings=Da.disableFragmentWarnings,r.enableExperimentalFragmentVariables=Da.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=Da.disableExperimentalFragmentVariables})(C||(C={}));C.default=C;function k(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function h0(){}function li(){return h0}var Y=li,g=li,Ye=li,Se=li,K=li,Nt=li,m0=li,Zl=li,w1=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},E1=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Wi=class{constructor(e){this.code=e}};w1([g(),E1("design:type",String)],Wi.prototype,"code",void 0);Wi=w1([K(),E1("design:paramtypes",[String])],Wi);var Jl=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Yl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ur=class{constructor(e,t){this.address=e,this.name=t}};Jl([g(),Yl("design:type",String)],ur.prototype,"address",void 0);Jl([g(),Yl("design:type",String)],ur.prototype,"name",void 0);ur=Jl([K(),Yl("design:paramtypes",[String,String])],ur);var Ne=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},We=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},kr=class{constructor(e,t){this.key=t,this.signature=e}};Ne([g(),We("design:type",String)],kr.prototype,"signature",void 0);Ne([g(),We("design:type",String)],kr.prototype,"key",void 0);Ne([g(),We("design:type",Boolean)],kr.prototype,"valid",void 0);Ne([g(),We("design:type",Boolean)],kr.prototype,"invalid",void 0);kr=Ne([K(),Ye(),We("design:paramtypes",[String,String])],kr);var Hi=class{};Ne([g(),We("design:type",String)],Hi.prototype,"signature",void 0);Ne([g(),We("design:type",String)],Hi.prototype,"key",void 0);Ne([g(),We("design:type",Boolean)],Hi.prototype,"valid",void 0);Ne([g(),We("design:type",Boolean)],Hi.prototype,"invalid",void 0);Hi=Ne([Ye()],Hi);function pi(r){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return Ne([g(),We("design:type",String)],e.prototype,"author",void 0),Ne([g(),We("design:type",String)],e.prototype,"timestamp",void 0),Ne([g(),We("design:type",Object)],e.prototype,"data",void 0),Ne([g(),We("design:type",kr)],e.prototype,"proof",void 0),e=Ne([K(),We("design:paramtypes",[String,String,Object,kr])],e),e}function g0(r){let e=class{};return Ne([g(),We("design:type",String)],e.prototype,"author",void 0),Ne([g(),We("design:type",String)],e.prototype,"timestamp",void 0),Ne([g(),We("design:type",Object)],e.prototype,"data",void 0),Ne([g(),We("design:type",Hi)],e.prototype,"proof",void 0),e=Ne([Ye()],e),e}var Xd=class extends pi(){};Xd=Ne([K()],Xd);var Js=class extends pi(){};Ne([g(),We("design:type",ur)],Js.prototype,"language",void 0);Ne([g(),We("design:type",Wi)],Js.prototype,"icon",void 0);Js=Ne([K()],Js);function _8(r){return r&&r.author&&r.timestamp&&r.data}var je=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ut=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Gi=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};je([g(),ut("design:type",String)],Gi.prototype,"source",void 0);je([g(),ut("design:type",String)],Gi.prototype,"target",void 0);je([g(),ut("design:type",String)],Gi.prototype,"predicate",void 0);Gi=je([K(),ut("design:paramtypes",[Object])],Gi);var Ys=class{};je([g(),ut("design:type",Array)],Ys.prototype,"additions",void 0);je([g(),ut("design:type",Array)],Ys.prototype,"removals",void 0);Ys=je([Ye()],Ys);var Xs=class{constructor(e,t){this.additions=e,this.removals=t}};je([g(),ut("design:type",Array)],Xs.prototype,"additions",void 0);je([g(),ut("design:type",Array)],Xs.prototype,"removals",void 0);Xs=je([K(),ut("design:paramtypes",[Array,Array])],Xs);var oo=class{};je([g(),ut("design:type",String)],oo.prototype,"source",void 0);je([g(),ut("design:type",String)],oo.prototype,"target",void 0);je([g(),ut("design:type",String)],oo.prototype,"predicate",void 0);oo=je([Ye()],oo);var ni=class extends pi(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),t=(t<<5)-t+n,t|=0;return t}};je([g(),ut("design:type",String)],ni.prototype,"status",void 0);ni=je([K()],ni);var kl=class extends g0(){};je([g(),ut("design:type",String)],kl.prototype,"status",void 0);kl=je([Ye()],kl);function k8(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function T8(r){return r&&r.source&&r.target}var ec=class{constructor(e,t){this.oldLink=e,this.newLink=t}};je([g(),ut("design:type",ni)],ec.prototype,"oldLink",void 0);je([g(),ut("design:type",ni)],ec.prototype,"newLink",void 0);ec=je([K(),ut("design:paramtypes",[ni,ni])],ec);var nn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},_o=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Tl,fr=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 i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(i=>i.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}};nn([g(),_o("design:type",Array)],fr.prototype,"links",void 0);fr=nn([K(),_o("design:paramtypes",[Array])],fr);var tc=class{};nn([g(),_o("design:type",Array)],tc.prototype,"links",void 0);tc=nn([Ye()],tc);var Il=Tl=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Tl;return t.links.push(e),t}};nn([g(),_o("design:type",Array)],Il.prototype,"links",void 0);Il=Tl=nn([Ye(),_o("design:paramtypes",[Array])],Il);var Ki=class extends pi(){};Ki=nn([K()],Ki);var q=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},B=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Xr=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new fr}};q([g(),B("design:type",String)],Xr.prototype,"did",void 0);q([g(),B("design:type",fr)],Xr.prototype,"perspective",void 0);q([g(),B("design:type",String)],Xr.prototype,"directMessageLanguage",void 0);Xr=q([K(),B("design:paramtypes",[String,fr])],Xr);var eh=class extends pi(){};eh=q([K()],eh);var ai=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],ai.prototype,"did",void 0);q([g(),B("design:type",String)],ai.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],ai.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],ai.prototype,"didSignedByDeviceKey",void 0);ai=q([K(),B("design:paramtypes",[String,String,String,String,String,String])],ai);var oi=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],oi.prototype,"did",void 0);q([g(),B("design:type",String)],oi.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],oi.prototype,"didSignedByDeviceKey",void 0);oi=q([Ye(),B("design:paramtypes",[String,String,String,String,String,String])],oi);var rc=class{constructor(e,t){this.signature=e,this.publicKey=t}};q([g(),B("design:type",String)],rc.prototype,"signature",void 0);q([g(),B("design:type",String)],rc.prototype,"publicKey",void 0);rc=q([K(),B("design:paramtypes",[String,String])],rc);var Qn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([g(),B("design:type",String)],Qn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Qn.prototype,"pointers",void 0);Qn=q([K(),B("design:paramtypes",[String,Array])],Qn);var ic=class{constructor(e,t){this.with=e,this.can=t}};q([g(),B("design:type",Qn)],ic.prototype,"with",void 0);q([g(),B("design:type",Array)],ic.prototype,"can",void 0);ic=q([K(),B("design:paramtypes",[Qn,Array])],ic);var Tr=class{constructor(e,t,i,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};q([g(),B("design:type",String)],Tr.prototype,"appName",void 0);q([g(),B("design:type",String)],Tr.prototype,"appDesc",void 0);q([g(),B("design:type",String)],Tr.prototype,"appUrl",void 0);q([g(),B("design:type",String)],Tr.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],Tr.prototype,"capabilities",void 0);Tr=q([K(),B("design:paramtypes",[String,String,String,Array,String])],Tr);var zn=class{constructor(e,t,i,n){this.requestId=e,this.auth=t,this.token=i,this.revoked=n}};q([g(),B("design:type",String)],zn.prototype,"requestId",void 0);q([g(),B("design:type",String)],zn.prototype,"token",void 0);q([g(),B("design:type",Boolean)],zn.prototype,"revoked",void 0);q([g(),B("design:type",Tr)],zn.prototype,"auth",void 0);zn=q([K(),B("design:paramtypes",[String,Tr,String,Boolean])],zn);var Wn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([g(),B("design:type",String)],Wn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Wn.prototype,"pointers",void 0);Wn=q([Ye(),B("design:paramtypes",[String,Array])],Wn);var nc=class{constructor(e,t){this.with=e,this.can=t}};q([g(),B("design:type",Wn)],nc.prototype,"with",void 0);q([g(),B("design:type",Array)],nc.prototype,"can",void 0);nc=q([Ye(),B("design:paramtypes",[Wn,Array])],nc);var dr=class{constructor(e,t,i,n,a,o){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};q([g(),B("design:type",String)],dr.prototype,"appName",void 0);q([g(),B("design:type",String)],dr.prototype,"appDesc",void 0);q([g(),B("design:type",String)],dr.prototype,"appDomain",void 0);q([g(),B("design:type",String)],dr.prototype,"appUrl",void 0);q([g(),B("design:type",String)],dr.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],dr.prototype,"capabilities",void 0);dr=q([Ye(),B("design:paramtypes",[String,String,String,String,String,Array])],dr);var Zi=class{constructor(e,t,i){this.did=e,this.success=t,this.error=i}};q([g(),B("design:type",String)],Zi.prototype,"did",void 0);q([g(),B("design:type",Boolean)],Zi.prototype,"success",void 0);q([g(),B("design:type",String)],Zi.prototype,"error",void 0);Zi=q([K(),B("design:paramtypes",[String,Boolean,String])],Zi);var Xn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ea=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ut=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)}};Xn([g(),ea("design:type",Boolean)],Ut.prototype,"isInitialized",void 0);Xn([g(),ea("design:type",Boolean)],Ut.prototype,"isUnlocked",void 0);Xn([g(),ea("design:type",String)],Ut.prototype,"did",void 0);Xn([g(),ea("design:type",String)],Ut.prototype,"didDocument",void 0);Xn([g(),ea("design:type",String)],Ut.prototype,"error",void 0);Ut=Xn([K(),ea("design:paramtypes",[Object])],Ut);var th=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Fe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_t,St,Ol=class{constructor(e,t){_t.set(this,void 0),St.set(this,void 0),th(this,_t,e,"f"),th(this,St,t,"f")}async otherAgents(){return await Fe(this,_t,"f").otherAgents(Fe(this,St,"f"))}async hasTelepresenceAdapter(){return await Fe(this,_t,"f").hasTelepresenceAdapter(Fe(this,St,"f"))}async onlineAgents(){return await Fe(this,_t,"f").onlineAgents(Fe(this,St,"f"))}async setOnlineStatus(e){return await Fe(this,_t,"f").setOnlineStatus(Fe(this,St,"f"),e)}async setOnlineStatusU(e){return await Fe(this,_t,"f").setOnlineStatusU(Fe(this,St,"f"),e)}async sendSignal(e,t){return await Fe(this,_t,"f").sendSignal(Fe(this,St,"f"),e,t)}async sendSignalU(e,t){return await Fe(this,_t,"f").sendSignalU(Fe(this,St,"f"),e,t)}async sendBroadcast(e,t=!1){return await Fe(this,_t,"f").sendBroadcast(Fe(this,St,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Fe(this,_t,"f").sendBroadcastU(Fe(this,St,"f"),e,t)}async addSignalHandler(e){await Fe(this,_t,"f").addSignalHandler(Fe(this,St,"f"),e)}removeSignalHandler(e){Fe(this,_t,"f").removeSignalHandler(Fe(this,St,"f"),e)}};_t=new WeakMap,St=new WeakMap;var an=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},on=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},st=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)}};an([g(),on("design:type",String)],st.prototype,"source",void 0);an([g(),on("design:type",String)],st.prototype,"target",void 0);an([g(),on("design:type",String)],st.prototype,"predicate",void 0);an([g(),on("design:type",Date)],st.prototype,"fromDate",void 0);an([g(),on("design:type",Date)],st.prototype,"untilDate",void 0);an([g(),on("design:type",Number)],st.prototype,"limit",void 0);st=an([K(),Ye(),on("design:paramtypes",[Object])],st);var rh=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},rt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},wt,wr;function bs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ct=class{constructor(){wt.set(this,void 0),wr.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 ct;return rh(t,wr,e,"f"),t}static from(e){let t=new ct;return rh(t,wt,e,"f"),t}toUrl(){if(rt(this,wr,"f")&&!rt(this,wt,"f"))return rt(this,wr,"f");if(!rt(this,wr,"f")&&(rt(this,wt,"f")===void 0||rt(this,wt,"f")===""||rt(this,wt,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof rt(this,wt,"f")){case"string":e=`string:${bs(rt(this,wt,"f"))}`;break;case"number":e=`number:${bs(rt(this,wt,"f"))}`;break;case"boolean":e=`boolean:${bs(rt(this,wt,"f"))}`;break;case"object":e=`json:${bs(JSON.stringify(rt(this,wt,"f")))}`;break}return`literal://${e}`}get(){if(rt(this,wt,"f"))return rt(this,wt,"f");if(!rt(this,wr,"f"))throw new Error("Can't render empty Literal");if(!rt(this,wr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=rt(this,wr,"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}`)}};wt=new WeakMap,wr=new WeakMap;function ei(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Xl(r){return`set${ei(r)}`}function qn(r){return r.endsWith("y")?r.slice(0,-1)+"ies":r+"s"}function ep(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function y0(r){return`add${ei(ep(r))}`}function v0(r){let e=r.substring(3),t=qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function b0(r){return`remove${ei(ep(r))}`}function _0(r){let e=r.substring(6),t=qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function S0(r){let e=r.substring(13),t=qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function w0(r){return`setCollection${ei(ep(r))}`}function Di(r){if(Array.isArray(r))return`[${r.map(Di).join(", ")}]`;let e=Object.keys(r),t=[];for(let i of e){let n=JSON.stringify(r[i]),a=`${i}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var ol=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},V=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},it,nt,Oe,Bn=class{constructor(r,e,t){it.set(this,void 0),nt.set(this,void 0),Oe.set(this,void 0),ol(this,it,e,"f"),ol(this,nt,t,"f"),ol(this,Oe,r,"f")}get baseExpression(){return V(this,it,"f")}async init(){let isInstance=await V(this,Oe,"f").isSubjectInstance(V(this,it,"f"),V(this,nt,"f"));if(!isInstance)throw`Not a valid subject instance of ${V(this,nt,"f")} for ${V(this,it,"f")}`;let results=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties){let e=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), property_resolve(C, "${r}")`);Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{let t=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), property_getter(C, "${V(this,it,"f")}", "${r}", Value)`);if(t&&t.length>0&&t[0].Value!==void 0&&t[0].Value!==null&&t[0].Value!==""){let i=t[0].Value;if(e)try{if(i){let n=await V(this,Oe,"f").getExpression(i);try{return JSON.parse(n.data)}catch{return n.data}}else return i}catch{return i}else return i}}catch{}try{return await V(this,Oe,"f").getPropertyValueViaSurreal(V(this,it,"f"),V(this,nt,"f"),r)}catch(t){console.warn(`Failed to get property ${r} via SurrealDB:`,t);return}}})}let setters=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Xl(property)]=async r=>{resolveLanguage&&(r=await V(this,Oe,"f").createExpression(r,resolveLanguage)),await V(this,Oe,"f").executeAction(actions,V(this,it,"f"),[{name:"value",value:r}])}}let results2=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(r=>r.Collection);for(let r of collections)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{let e=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), collection_getter(C, "${V(this,it,"f")}", "${r}", Value)`);if(e&&e.length>0&&e[0].Value&&Array.isArray(e[0].Value)&&e[0].Value.length>0){let t=e[0].Value.filter(i=>i!==""&&i!=="");if(t.length>0)return t}}catch{}try{return await V(this,Oe,"f").getCollectionValuesViaSurreal(V(this,it,"f"),V(this,nt,"f"),r)}catch(e){return console.warn(`Failed to get collection ${r} via SurrealDB:`,e),[]}}});let adders=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[y0(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>V(this,Oe,"f").executeAction(actions,V(this,it,"f"),[{name:"value",value:e}]))):await V(this,Oe,"f").executeAction(actions,V(this,it,"f"),[{name:"value",value:r}])}}let removers=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[b0(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>V(this,Oe,"f").executeAction(actions,V(this,it,"f"),[{name:"value",value:e}]))):await V(this,Oe,"f").executeAction(actions,V(this,it,"f"),[{name:"value",value:r}])}}let collectionSetters=await V(this,Oe,"f").infer(`subject_class("${V(this,nt,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[w0(collection)]=async r=>{Array.isArray(r)?await V(this,Oe,"f").executeAction(actions,V(this,it,"f"),r.map(e=>({name:"value",value:e}))):await V(this,Oe,"f").executeAction(actions,V(this,it,"f"),[{name:"value",value:r}])}}}};it=new WeakMap,nt=new WeakMap,Oe=new WeakMap;function ih(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function C1(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,i=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${ih(e)} your ${t} actions, with access to ${ih(i)}`}function Te(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var _e=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},I=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Fs,Er,nr,ar,ji,Hr,Gr,Ni,La,Ms,Ri,Pi,Ft,Mn,Dl,de,ge,$i,Li,Fi,Fa,ac=class{constructor(e,t,i){Fs.add(this),Er.set(this,void 0),nr.set(this,void 0),ar.set(this,void 0),ji.set(this,void 0),Hr.set(this,void 0),Gr.set(this,void 0),Ni.set(this,void 0),La.set(this,!1),Ms.set(this,void 0),Ri.set(this,void 0),Pi.set(this,void 0),Ft.set(this,void 0),Mn.set(this,void 0),this.isSurrealDB=!1,_e(this,Er,e,"f"),_e(this,Mn,t,"f"),_e(this,ar,i,"f"),_e(this,ji,new Set,"f"),_e(this,Ni,null,"f"),_e(this,Ms,new Promise((n,a)=>{_e(this,Ri,n,"f"),_e(this,Pi,a,"f")}),"f")}async subscribe(){I(this,Gr,"f")&&(I(this,Gr,"f").call(this),_e(this,Gr,void 0,"f")),I(this,Ft,"f")&&(clearTimeout(I(this,Ft,"f")),_e(this,Ft,void 0,"f")),I(this,Hr,"f")&&(clearTimeout(I(this,Hr,"f")),_e(this,Hr,void 0,"f"));try{let t;this.isSurrealDB?t=await I(this,ar,"f").perspectiveSubscribeSurrealQuery(I(this,Er,"f"),I(this,Mn,"f")):t=await I(this,ar,"f").subscribeQuery(I(this,Er,"f"),I(this,Mn,"f")),_e(this,nr,t.subscriptionId,"f"),t.result?(_e(this,Ni,t.result,"f"),I(this,Fs,"m",Dl).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),_e(this,Ft,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),_e(this,Gr,I(this,ar,"f").subscribeToQueryUpdates(I(this,nr,"f"),i=>{I(this,Ft,"f")&&(clearTimeout(I(this,Ft,"f")),_e(this,Ft,void 0,"f")),I(this,Ri,"f")&&(I(this,Ri,"f").call(this,!0),_e(this,Ri,void 0,"f"),_e(this,Pi,void 0,"f")),!(i.isInit&&I(this,Ni,"f"))&&(_e(this,Ni,i,"f"),I(this,Fs,"m",Dl).call(this,i))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),I(this,Pi,"f")&&(I(this,Pi,"f").call(this,t),_e(this,Ri,void 0,"f"),_e(this,Pi,void 0,"f")),t}let e=async()=>{if(!I(this,La,"f")){try{this.isSurrealDB?await I(this,ar,"f").perspectiveKeepAliveSurrealQuery(I(this,Er,"f"),I(this,nr,"f")):await I(this,ar,"f").keepAliveQuery(I(this,Er,"f"),I(this,nr,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",I(this,Mn,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}I(this,La,"f")||_e(this,Hr,setTimeout(e,3e4),"f")}};_e(this,Hr,setTimeout(e,3e4),"f")}get id(){return I(this,nr,"f")}get initialized(){return I(this,Ms,"f")}get result(){return I(this,Ni,"f")}onResult(e){return I(this,ji,"f").add(e),()=>I(this,ji,"f").delete(e)}dispose(){_e(this,La,!0,"f"),clearTimeout(I(this,Hr,"f")),I(this,Gr,"f")&&I(this,Gr,"f").call(this),I(this,ji,"f").clear(),I(this,Ft,"f")&&(clearTimeout(I(this,Ft,"f")),_e(this,Ft,void 0,"f")),I(this,nr,"f")&&(this.isSurrealDB?I(this,ar,"f").perspectiveDisposeSurrealQuerySubscription(I(this,Er,"f"),I(this,nr,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):I(this,ar,"f").disposeQuerySubscription(I(this,Er,"f"),I(this,nr,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Er=new WeakMap,nr=new WeakMap,ar=new WeakMap,ji=new WeakMap,Hr=new WeakMap,Gr=new WeakMap,Ni=new WeakMap,La=new WeakMap,Ms=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Ft=new WeakMap,Mn=new WeakMap,Fs=new WeakSet,Dl=function r(e){for(let t of I(this,ji,"f"))try{t(e)}catch(i){console.error("Error in query subscription callback:",i)}};var jn=class{constructor(r,e){de.set(this,void 0),ge.set(this,void 0),$i.set(this,void 0),Li.set(this,void 0),Fi.set(this,void 0),Fa.set(this,void 0),_e(this,$i,[],"f"),_e(this,Li,[],"f"),_e(this,Fi,[],"f"),_e(this,Fa,[],"f"),_e(this,de,r,"f"),_e(this,ge,e,"f"),this.uuid=I(this,de,"f").uuid,this.name=I(this,de,"f").name,this.owners=I(this,de,"f").owners,this.sharedUrl=I(this,de,"f").sharedUrl,this.neighbourhood=I(this,de,"f").neighbourhood,this.state=I(this,de,"f").state,I(this,ge,"f").addPerspectiveLinkAddedListener(I(this,de,"f").uuid,I(this,$i,"f")),I(this,ge,"f").addPerspectiveLinkRemovedListener(I(this,de,"f").uuid,I(this,Li,"f")),I(this,ge,"f").addPerspectiveLinkUpdatedListener(I(this,de,"f").uuid,I(this,Fi,"f")),I(this,ge,"f").addPerspectiveSyncStateChangeListener(I(this,de,"f").uuid,I(this,Fa,"f"))}escapeRegExp(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(r,e,t,i){return await I(this,ge,"f").executeCommands(I(this,de,"f").uuid,JSON.stringify(r),e,JSON.stringify(t),i)}async get(r){return await I(this,ge,"f").queryLinks(I(this,de,"f").uuid,r)}async infer(r){return await I(this,ge,"f").queryProlog(I(this,de,"f").uuid,r)}async querySurrealDB(r){return await I(this,ge,"f").querySurrealDB(I(this,de,"f").uuid,r)}async add(r,e="shared",t){return await I(this,ge,"f").addLink(I(this,de,"f").uuid,r,e,t)}async addLinks(r,e="shared",t){return await I(this,ge,"f").addLinks(I(this,de,"f").uuid,r,e,t)}async removeLinks(r,e){return await I(this,ge,"f").removeLinks(I(this,de,"f").uuid,r,e)}async linkMutations(r,e="shared"){return await I(this,ge,"f").linkMutations(I(this,de,"f").uuid,r,e)}async addLinkExpression(r,e="shared",t){return await I(this,ge,"f").addLinkExpression(I(this,de,"f").uuid,r,e,t)}async update(r,e,t){return await I(this,ge,"f").updateLink(I(this,de,"f").uuid,r,e,t)}async remove(r,e){return await I(this,ge,"f").removeLink(I(this,de,"f").uuid,r,e)}async createBatch(){return await I(this,ge,"f").createBatch(I(this,de,"f").uuid)}async commitBatch(r){return await I(this,ge,"f").commitBatch(I(this,de,"f").uuid,r)}async getExpression(r){return await I(this,ge,"f").getExpression(r)}async createExpression(r,e){return await I(this,ge,"f").createExpression(r,e)}async addListener(r,e){r==="link-added"?I(this,$i,"f").push(e):r==="link-removed"?I(this,Li,"f").push(e):r==="link-updated"&&I(this,Fi,"f").push(e)}async addSyncStateChangeListener(r){I(this,Fa,"f").push(r)}async removeListener(r,e){if(r==="link-added"){let t=I(this,$i,"f").indexOf(e);I(this,$i,"f").splice(t,1)}else if(r==="link-removed"){let t=I(this,Li,"f").indexOf(e);I(this,Li,"f").splice(t,1)}else if(r==="link-updated"){let t=I(this,Fi,"f").indexOf(e);I(this,Fi,"f").splice(t,1)}}async snapshot(){return I(this,ge,"f").snapshotByUUID(I(this,de,"f").uuid)}async loadSnapshot(r){let e=JSON.parse(JSON.stringify(r));delete e.__typename,e.links.forEach(t=>{delete t.data.__typename});for(let t of e.links)await this.addLinkExpression(t)}async getSingleTarget(r){delete r.target;let e=await this.get(r);return e.length?e[0].data.target:null}async setSingleTarget(r,e="shared"){let t=new st({source:r.source,predicate:r.predicate}),i=await this.get(t),n=[];for(let o of i)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,n.push(o);let a=[r];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(r){return(await this.infer(`flowable("${r}", F), register_sdna_flow(X, F)`)).map(t=>t.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state(X, ${e}, F)`)).map(i=>i.X)}async flowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(r,e){return(await this.infer(`register_sdna_flow("${r}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(i=>i.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let r=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let t of r){let i=await this.get(new st({source:"ad4m://self",predicate:t}));for(let n of i){let a=n.data.target,o=await this.get(new st({source:a,predicate:"ad4m://sdna"}));for(let s of o){let c=ct.fromUrl(s.data.target).get();typeof c=="string"&&e.push(c)}}}return e}async getSdnaForClass(r){let e=ct.from(r);if((await this.get(new st({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new st({source:e.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let n=ct.fromUrl(i[0].data.target).get();return typeof n=="string"?n:null}async addSdna(r,e,t){return I(this,ge,"f").addSdna(I(this,de,"f").uuid,r,e,t)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(r=>r.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(r){if(typeof r=="string")return r;{let e=await this.subjectClassesByTemplate(r);return e[0]?e[0]:r.className}}async createSubject(r,e,t,i){let n;if(typeof r=="string")n=r,await I(this,ge,"f").createSubject(I(this,de,"f").uuid,JSON.stringify({className:n,initialValues:t}),e,t?JSON.stringify(t):void 0,i);else{let a=this.buildQueryFromTemplate(r);await I(this,ge,"f").createSubject(I(this,de,"f").uuid,JSON.stringify({query:a,initialValues:t}),e,t?JSON.stringify(t):void 0,i)}return i?e:this.getSubjectProxy(e,r)}async getSubjectData(r,e){if(typeof r=="string")return JSON.parse(await I(this,ge,"f").getSubjectData(I(this,de,"f").uuid,JSON.stringify({className:r}),e));let t=this.buildQueryFromTemplate(r);return JSON.parse(await I(this,ge,"f").getSubjectData(I(this,de,"f").uuid,JSON.stringify({query:t}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(r,e){let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)try{let n=t.replace(/"/g,'\\"'),a=r.replace(/"/g,'\\"'),o=await this.infer(`subject_class("${n}", C), instance(C, "${a}")`);return o&&o.length>0}catch(n){return console.warn(`Failed to check instance via Prolog for class ${t}:`,n),!1}if(i.requiredTriples.length===0){let a=`SELECT count() AS count FROM link WHERE in.uri = '${Te(r)}'`,s=(await this.querySurrealDB(a))[0]?.count??0;return(typeof s=="object"&&s?.Int!==void 0?s.Int:s)>0}for(let n of i.requiredTriples){let a=Te(r),o=Te(n.predicate),s;if(n.target){let d=Te(n.target);s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}' AND out.uri = '${d}'`}else s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}'`;let c=await this.querySurrealDB(s);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(r,e){if(!await this.isSubjectInstance(r,e))throw`Expression ${r} is not a subject instance of given class: ${JSON.stringify(e)}`;let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=new Bn(this,r,t);return await i.init(),i}async getSubjectClassMetadataFromSDNA(r){try{let e=await this.get(new st({source:ct.from(r).toUrl(),predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${r}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${r} has no target:`,e[0]),null;let t=ct.fromUrl(e[0].data.target).get(),i=[],n=/instance\([^)]+\)\s*:-\s*([^.]+)\./g,a,o=!1;for(;(a=n.exec(t))!==null;){o=!0;let f=a[1],p=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,h;for(;(h=p.exec(f))!==null;){let m=h[1],y=h[2];i.push({predicate:m,target:y})}}o||console.warn(`No instance rule found in SDNA for ${r}`);let s=i.map(f=>f.predicate),c=new Map,u=await this.infer(`subject_class("${r}", C), property(C, P)`);if(u)for(let f of u){let p=f.P,h=null,m=await this.infer(`subject_class("${r}", C), property_setter(C, "${p}", Setter)`);if(m&&m.length>0){let w=m[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);w&&(h=w[1]||w[2])}if(!h){let y=this.escapeRegExp(p),w=t.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${y}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));w&&(h=w[1])}if(h){let y=await this.infer(`subject_class("${r}", C), property_resolve_language(C, "${p}", Lang)`),w=y&&y.length>0?y[0].Lang:void 0;c.set(p,{predicate:h,resolveLanguage:w})}}let l=new Map,d=await this.infer(`subject_class("${r}", C), collection(C, Coll)`);if(d)for(let f of d){let p=f.Coll,h=null,m,y=await this.infer(`subject_class("${r}", C), collection_adder(C, "${p}", Adder)`);if(y&&y.length>0){let T=y[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);T&&(h=T[1]||T[2])}let w=this.escapeRegExp(p),b=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${w}"[^)]*\\)\\s*:-[^.]+\\.`),S=t.match(b);if(S){let _=S[0],T=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,R=_.match(T);if(R){let A=R[1];if(A.startsWith("(")&&A.endsWith(")")&&(A=A.substring(1,A.length-1)),!h){let L=A.match(/triple\([^,]+,\s*"([^"]+)"/);L&&(h=L[1])}let N=A.match(/subject_class\("([^"]+)"/);N&&(m=N[1])}}h&&l.set(p,{predicate:h,instanceFilter:m})}return{requiredPredicates:s,requiredTriples:i,properties:c,collections:l}}catch(e){return console.error(`Error getting metadata for ${r}:`,e),null}}generateSurrealInstanceQuery(r){return r.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${r.requiredTriples.map(t=>{let i=Te(t.predicate);if(t.target){let n=Te(t.target);return`count(->link[WHERE predicate = '${i}' AND out.uri = '${n}']) > 0`}else return`count(->link[WHERE predicate = '${i}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return;let n=i.properties.get(t);if(!n)return;let a=Te(r),o=Te(n.predicate),s=`SELECT out.uri AS value FROM link WHERE in.uri = '${a}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(s);if(!c||c.length===0)return;let u=c[0].value;if(n.resolveLanguage&&u)try{let l=await this.getExpression(u);try{return JSON.parse(l.data)}catch{return l.data}}catch{return u}return u}async getCollectionValuesViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return[];let n=i.collections.get(t);if(!n)return[];let a=Te(r),o=Te(n.predicate),s=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${a}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(s);if(!c||c.length===0)return[];let u=c.map(l=>l.value).filter(l=>l!==""&&l!=="");if(n.instanceFilter)try{let l=await this.getSubjectClassMetadataFromSDNA(n.instanceFilter);return l?await this.batchCheckSubjectInstances(u,l):this.filterInstancesSequential(u,n.instanceFilter)}catch{return this.filterInstancesSequential(u,n.instanceFilter)}return u}async batchCheckSubjectInstances(r,e){if(r.length===0)return[];if(e.requiredTriples.length===0){let a=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${r.map(s=>`'${Te(s)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(a)).map(s=>s.uri)}let t=[];for(let n of e.requiredTriples){let a=r.map(u=>`'${Te(u)}'`).join(", "),o=Te(n.predicate),s;if(n.target){let u=Te(n.target);s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' AND out.uri = '${u}' GROUP BY in.uri`}else s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' GROUP BY in.uri`;let c=await this.querySurrealDB(s);t.push(new Set(c.map(u=>u.uri)))}return t.length===0?r:r.filter(n=>t.every(a=>a.has(n)))}async filterInstancesSequential(r,e){let t=[];for(let i of r)try{await this.isSubjectInstance(i,e)&&t.push(i)}catch{continue}return t}async getAllSubjectInstances(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new Bn(this,s.base,i);await c.init(),t.push(c)}catch{}}}return t}async getAllSubjectProxies(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new Bn(this,s.base,i);await c.init(),t.push(c)}catch{}}}return t}buildQueryFromTemplate(r){let e;return function(t){let i=[],n=[];Object.getPrototypeOf(t).__properties?Object.keys(Object.getPrototypeOf(t).__properties).forEach(l=>i.push(l)):i.push(...Object.keys(t).filter(l=>!Array.isArray(t[l]))),Object.getPrototypeOf(t).__collections?Object.keys(Object.getPrototypeOf(t).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>{n.includes(l)||n.push(l)}):n.push(...Object.keys(t).filter(l=>Array.isArray(t[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(t).filter(l=>typeof t[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let c=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("setCollection"));c=c.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let u="subject_class(Class, C)";for(let l of i)u+=`, property(C, "${l}")`;for(let l of n)u+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),u+=`, property_setter(C, "${d}", _)`}for(let l of o)u+=`, collection_adder(C, "${v0(l)}", _)`;for(let l of s)u+=`, collection_remover(C, "${_0(l)}", _)`;for(let l of c)u+=`, collection_setter(C, "${S0(l)}", _)`;u+=".",e=u}(r),e}async subjectClassesByTemplate(r){let e=this.buildQueryFromTemplate(r),t=await this.infer(e);return t?t.map(i=>i.Class):[]}async ensureSDNASubjectClass(r){if((await this.subjectClassesByTemplate(new r)).length>0)return;let{name:t,sdna:i}=r.generateSDNA();await this.addSdna(t,i,"subject_class")}getNeighbourhoodProxy(){return I(this,ge,"f").getNeighbourhoodProxy(I(this,de,"f").uuid)}get ai(){return I(this,ge,"f").aiClient}async subscribeInfer(r){let e=new ac(this.uuid,r,I(this,ge,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(r){let e=new ac(this.uuid,r,I(this,ge,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};de=new WeakMap,ge=new WeakMap,$i=new WeakMap,Li=new WeakMap,Fi=new WeakMap,Fa=new WeakMap;var Qr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},z=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ie,Ma,Ua,ja,Us,qa,js,qs,ht=`
64
64
  author
65
65
  timestamp
66
66
  status
67
67
  data { source, predicate, target }
68
68
  proof { valid, invalid, signature, key }
69
- `,Dn=`
69
+ `,Nn=`
70
70
  uuid
71
71
  name
72
72
  sharedUrl
@@ -87,139 +87,139 @@ neighbourhood {
87
87
  }
88
88
  author
89
89
  }
90
- `,ac=class{constructor(e,t=!0){ie.set(this,void 0),La.set(this,void 0),Fa.set(this,void 0),Ma.set(this,void 0),Ms.set(this,void 0),Ua.set(this,void 0),Us.set(this,void 0),js.set(this,void 0),Vr(this,ie,e,"f"),Vr(this,La,[],"f"),Vr(this,Fa,[],"f"),Vr(this,Ma,[],"f"),Vr(this,Ms,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Vr(this,Ua,e,"f")}setNeighbourhoodClient(e){Vr(this,Us,e,"f")}setAIClient(e){Vr(this,js,e,"f")}get aiClient(){return z(this,js,"f")}async all(){let{perspectives:e}=k(await z(this,ie,"f").query({query:E`query perspectives {
90
+ `,oc=class{constructor(e,t=!0){ie.set(this,void 0),Ma.set(this,void 0),Ua.set(this,void 0),ja.set(this,void 0),Us.set(this,void 0),qa.set(this,void 0),js.set(this,void 0),qs.set(this,void 0),Qr(this,ie,e,"f"),Qr(this,Ma,[],"f"),Qr(this,Ua,[],"f"),Qr(this,ja,[],"f"),Qr(this,Us,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Qr(this,qa,e,"f")}setNeighbourhoodClient(e){Qr(this,js,e,"f")}setAIClient(e){Qr(this,qs,e,"f")}get aiClient(){return z(this,qs,"f")}async all(){let{perspectives:e}=k(await z(this,ie,"f").query({query:C`query perspectives {
91
91
  perspectives {
92
- ${Dn}
92
+ ${Nn}
93
93
  }
94
- }`}));return e.map(t=>new Un(t,this))}async byUUID(e){let{perspective:t}=k(await z(this,ie,"f").query({query:E`query perspective($uuid: String!) {
94
+ }`}));return e.map(t=>new jn(t,this))}async byUUID(e){let{perspective:t}=k(await z(this,ie,"f").query({query:C`query perspective($uuid: String!) {
95
95
  perspective(uuid: $uuid) {
96
- ${Dn}
96
+ ${Nn}
97
97
  }
98
- }`,variables:{uuid:e}}));return t?new Un(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=k(await z(this,ie,"f").query({query:E`query perspectiveSnapshot($uuid: String!) {
98
+ }`,variables:{uuid:e}}));return t?new jn(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=k(await z(this,ie,"f").query({query:C`query perspectiveSnapshot($uuid: String!) {
99
99
  perspectiveSnapshot(uuid: $uuid) {
100
- links { ${dt} }
100
+ links { ${ht} }
101
101
  }
102
- }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectivePublishSnapshot($uuid: String!) {
102
+ }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectivePublishSnapshot($uuid: String!) {
103
103
  perspectivePublishSnapshot(uuid: $uuid)
104
- }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:i}=k(await z(this,ie,"f").query({query:E`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
104
+ }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:i}=k(await z(this,ie,"f").query({query:C`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
105
105
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
106
- ${dt}
106
+ ${ht}
107
107
  }
108
- }`,variables:{uuid:e,query:t}}));return i}async queryProlog(e,t){let{perspectiveQueryProlog:i}=k(await z(this,ie,"f").query({query:E`query perspectiveQueryProlog($uuid: String!, $query: String!) {
108
+ }`,variables:{uuid:e,query:t}}));return i}async queryProlog(e,t){let{perspectiveQueryProlog:i}=k(await z(this,ie,"f").query({query:C`query perspectiveQueryProlog($uuid: String!, $query: String!) {
109
109
  perspectiveQueryProlog(uuid: $uuid, query: $query)
110
- }`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:i}=k(await z(this,ie,"f").query({query:E`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
110
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:i}=k(await z(this,ie,"f").query({query:C`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
111
111
  perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
112
- }`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
112
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(i)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:i}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
113
113
  perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
114
114
  subscriptionId
115
115
  result
116
116
  }
117
- }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=i,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:n,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
117
+ }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=i,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:n,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:i}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
118
118
  perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
119
119
  subscriptionId
120
120
  result
121
121
  }
122
- }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=i,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:n,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
122
+ }`,variables:{uuid:e,query:t}})),{subscriptionId:n,result:a}=i,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:n,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:i}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
123
123
  perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
124
- }`,variables:{uuid:e,subscriptionId:t}}));return i}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
124
+ }`,variables:{uuid:e,subscriptionId:t}}));return i}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:i}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
125
125
  perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
126
- }`,variables:{uuid:e,subscriptionId:t}}));return i}subscribeToQueryUpdates(e,t){let i=z(this,ie,"f").subscribe({query:E`
126
+ }`,variables:{uuid:e,subscriptionId:t}}));return i}subscribeToQueryUpdates(e,t){let i=z(this,ie,"f").subscribe({query:C`
127
127
  subscription perspectiveQuerySubscription($subscriptionId: String!) {
128
128
  perspectiveQuerySubscription(subscriptionId: $subscriptionId)
129
129
  }
130
- `,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>i.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
130
+ `,variables:{subscriptionId:e}}).subscribe({next:n=>{if(n.data&&n.data.perspectiveQuerySubscription){let a=n.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>i.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:i}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
131
131
  perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
132
- }`,variables:{uuid:e,subscriptionId:t}}));return i}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
132
+ }`,variables:{uuid:e,subscriptionId:t}}));return i}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:i}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
133
133
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
134
- }`,variables:{uuid:e,subscriptionId:t}}));return i}async add(e){let{perspectiveAdd:t}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAdd($name: String!) {
134
+ }`,variables:{uuid:e,subscriptionId:t}}));return i}async add(e){let{perspectiveAdd:t}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveAdd($name: String!) {
135
135
  perspectiveAdd(name: $name) {
136
- ${Dn}
136
+ ${Nn}
137
137
  }
138
- }`,variables:{name:e}}));return new Un(t,this)}async update(e,t){let{perspectiveUpdate:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveUpdate($uuid: String!, $name: String!) {
138
+ }`,variables:{name:e}}));return new jn(t,this)}async update(e,t){let{perspectiveUpdate:i}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveUpdate($uuid: String!, $name: String!) {
139
139
  perspectiveUpdate(uuid: $uuid, name: $name) {
140
- ${Dn}
140
+ ${Nn}
141
141
  }
142
- }`,variables:{uuid:e,name:t}}));return new Un(i,this)}async remove(e){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveRemove($uuid: String!) {
142
+ }`,variables:{uuid:e,name:t}}));return new jn(i,this)}async remove(e){return k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveRemove($uuid: String!) {
143
143
  perspectiveRemove(uuid: $uuid)
144
- }`,variables:{uuid:e}}))}async addLink(e,t,i="shared",n){let{perspectiveAddLink:a}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
144
+ }`,variables:{uuid:e}}))}async addLink(e,t,i="shared",n){let{perspectiveAddLink:a}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
145
145
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
146
- ${dt}
146
+ ${ht}
147
147
  }
148
- }`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async addLinks(e,t,i="shared",n){let{perspectiveAddLinks:a}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
148
+ }`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async addLinks(e,t,i="shared",n){let{perspectiveAddLinks:a}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
149
149
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
150
- ${dt}
150
+ ${ht}
151
151
  }
152
- }`,variables:{uuid:e,links:t,status:i,batchId:n}}));return a}async removeLinks(e,t,i){let{perspectiveRemoveLinks:n}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
152
+ }`,variables:{uuid:e,links:t,status:i,batchId:n}}));return a}async removeLinks(e,t,i){let{perspectiveRemoveLinks:n}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
153
153
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
154
- ${dt}
154
+ ${ht}
155
155
  }
156
- }`,variables:{uuid:e,links:t,batchId:i}}));return n}async linkMutations(e,t,i){let{perspectiveLinkMutations:n}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
156
+ }`,variables:{uuid:e,links:t,batchId:i}}));return n}async linkMutations(e,t,i){let{perspectiveLinkMutations:n}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
157
157
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
158
158
  additions {
159
- ${dt}
159
+ ${ht}
160
160
  }
161
161
  removals {
162
- ${dt}
162
+ ${ht}
163
163
  }
164
164
  }
165
- }`,variables:{uuid:e,mutations:t,status:i}}));return n}async addLinkExpression(e,t,i="shared",n){let{perspectiveAddLinkExpression:a}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
165
+ }`,variables:{uuid:e,mutations:t,status:i}}));return n}async addLinkExpression(e,t,i="shared",n){let{perspectiveAddLinkExpression:a}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
166
166
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
167
- ${dt}
167
+ ${ht}
168
168
  }
169
- }`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async updateLink(e,t,i,n){let{perspectiveUpdateLink:a}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
169
+ }`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async updateLink(e,t,i,n){let{perspectiveUpdateLink:a}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
170
170
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
171
- ${dt}
171
+ ${ht}
172
172
  }
173
- }`,variables:{uuid:e,oldLink:t,newLink:i,batchId:n}}));return a}async removeLink(e,t,i){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
173
+ }`,variables:{uuid:e,oldLink:t,newLink:i,batchId:n}}));return a}async removeLink(e,t,i){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
174
174
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
175
- }`,variables:{uuid:e,link:t,batchId:i}}));return n}async addSdna(e,t,i,n){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
175
+ }`,variables:{uuid:e,link:t,batchId:i}}));return n}async addSdna(e,t,i,n){return k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
176
176
  perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType)
177
- }`,variables:{uuid:e,name:t,sdnaCode:i,sdnaType:n}})).perspectiveAddSdna}async executeCommands(e,t,i,n,a){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
177
+ }`,variables:{uuid:e,name:t,sdnaCode:i,sdnaType:n}})).perspectiveAddSdna}async executeCommands(e,t,i,n,a){return k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
178
178
  perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
179
- }`,variables:{uuid:e,commands:t,expression:i,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,i,n,a){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
179
+ }`,variables:{uuid:e,commands:t,expression:i,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,i,n,a){return k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
180
180
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
181
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:i,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,i){return k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
181
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:i,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,i){return k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
182
182
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
183
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:i}})).perspectiveGetSubjectData}async getExpression(e){return await z(this,Ua,"f").get(e)}async createExpression(e,t){return await z(this,Ua,"f").create(e,t)}addPerspectiveAddedListener(e){z(this,La,"f").push(e)}subscribePerspectiveAdded(){z(this,ie,"f").subscribe({query:E` subscription {
184
- perspectiveAdded { ${Dn} }
183
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:i}})).perspectiveGetSubjectData}async getExpression(e){return await z(this,qa,"f").get(e)}async createExpression(e,t){return await z(this,qa,"f").create(e,t)}addPerspectiveAddedListener(e){z(this,Ma,"f").push(e)}subscribePerspectiveAdded(){z(this,ie,"f").subscribe({query:C` subscription {
184
+ perspectiveAdded { ${Nn} }
185
185
  }
186
- `}).subscribe({next:e=>{z(this,La,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){z(this,Fa,"f").push(e)}subscribePerspectiveUpdated(){z(this,ie,"f").subscribe({query:E` subscription {
187
- perspectiveUpdated { ${Dn} }
186
+ `}).subscribe({next:e=>{z(this,Ma,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){z(this,Ua,"f").push(e)}subscribePerspectiveUpdated(){z(this,ie,"f").subscribe({query:C` subscription {
187
+ perspectiveUpdated { ${Nn} }
188
188
  }
189
- `}).subscribe({next:e=>{z(this,Fa,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){z(this,Ms,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){z(this,ie,"f").subscribe({query:E` subscription {
189
+ `}).subscribe({next:e=>{z(this,Ua,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){z(this,Us,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){z(this,ie,"f").subscribe({query:C` subscription {
190
190
  perspectiveSyncStateChange(uuid: "${e}")
191
191
  }
192
- `}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveSyncStateChange)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}addPerspectiveRemovedListener(e){z(this,Ma,"f").push(e)}subscribePerspectiveRemoved(){z(this,ie,"f").subscribe({query:E` subscription {
192
+ `}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveSyncStateChange)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}addPerspectiveRemovedListener(e){z(this,ja,"f").push(e)}subscribePerspectiveRemoved(){z(this,ie,"f").subscribe({query:C` subscription {
193
193
  perspectiveRemoved
194
194
  }
195
- `}).subscribe({next:e=>{z(this,Ma,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){z(this,ie,"f").subscribe({query:E` subscription {
196
- perspectiveLinkAdded(uuid: "${e}") { ${dt} }
195
+ `}).subscribe({next:e=>{z(this,ja,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){z(this,ie,"f").subscribe({query:C` subscription {
196
+ perspectiveLinkAdded(uuid: "${e}") { ${ht} }
197
197
  }
198
- `}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveLinkAdded)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkRemovedListener(e,t){z(this,ie,"f").subscribe({query:E` subscription {
199
- perspectiveLinkRemoved(uuid: "${e}") { ${dt} }
198
+ `}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveLinkAdded)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkRemovedListener(e,t){z(this,ie,"f").subscribe({query:C` subscription {
199
+ perspectiveLinkRemoved(uuid: "${e}") { ${ht} }
200
200
  }
201
- `}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkRemoved.status||delete i.data.perspectiveLinkRemoved.status,n(i.data.perspectiveLinkRemoved)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkUpdatedListener(e,t){z(this,ie,"f").subscribe({query:E` subscription {
201
+ `}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkRemoved.status||delete i.data.perspectiveLinkRemoved.status,n(i.data.perspectiveLinkRemoved)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkUpdatedListener(e,t){z(this,ie,"f").subscribe({query:C` subscription {
202
202
  perspectiveLinkUpdated(uuid: "${e}") {
203
203
  oldLink {
204
- ${dt}
204
+ ${ht}
205
205
  }
206
206
  newLink {
207
- ${dt}
207
+ ${ht}
208
208
  }
209
209
  }
210
210
  }
211
- `}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkUpdated.newLink.status||delete i.data.perspectiveLinkUpdated.newLink.status,i.data.perspectiveLinkUpdated.oldLink.status||delete i.data.perspectiveLinkUpdated.oldLink.status,n(i.data.perspectiveLinkUpdated)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}getNeighbourhoodProxy(e){return new Iu(z(this,Us,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveCreateBatch($uuid: String!) {
211
+ `}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkUpdated.newLink.status||delete i.data.perspectiveLinkUpdated.newLink.status,i.data.perspectiveLinkUpdated.oldLink.status||delete i.data.perspectiveLinkUpdated.oldLink.status,n(i.data.perspectiveLinkUpdated)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}getNeighbourhoodProxy(e){return new Ol(z(this,js,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveCreateBatch($uuid: String!) {
212
212
  perspectiveCreateBatch(uuid: $uuid)
213
- }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:i}=k(await z(this,ie,"f").mutate({mutation:E`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
213
+ }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:i}=k(await z(this,ie,"f").mutate({mutation:C`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
214
214
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
215
215
  additions {
216
- ${dt}
216
+ ${ht}
217
217
  }
218
218
  removals {
219
- ${dt}
219
+ ${ht}
220
220
  }
221
221
  }
222
- }`,variables:{uuid:e,batchId:t}}));return i}};ie=new WeakMap,La=new WeakMap,Fa=new WeakMap,Ma=new WeakMap,Ms=new WeakMap,Ua=new WeakMap,Us=new WeakMap,js=new WeakMap;var bs=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},se=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},he,ja,qa,Ba,Oa=`
222
+ }`,variables:{uuid:e,batchId:t}}));return i}};ie=new WeakMap,Ma=new WeakMap,Ua=new WeakMap,ja=new WeakMap,Us=new WeakMap,qa=new WeakMap,js=new WeakMap,qs=new WeakMap;var _s=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},se=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},he,Ba,Va,Qa,Na=`
223
223
  did
224
224
  directMessageLanguage
225
225
  perspective {
@@ -233,7 +233,7 @@ neighbourhood {
233
233
  }
234
234
  }
235
235
  }
236
- `,_s=`
236
+ `,Ss=`
237
237
  requestId
238
238
  revoked
239
239
  auth {
@@ -249,145 +249,145 @@ neighbourhood {
249
249
  can
250
250
  }
251
251
  }
252
- `,Nn=`
252
+ `,Rn=`
253
253
  isInitialized
254
254
  isUnlocked
255
255
  did
256
256
  didDocument
257
257
  error
258
- `,Ss=`
258
+ `,ws=`
259
259
  did
260
260
  didSigningKeyId
261
261
  deviceKeyType
262
262
  deviceKey
263
263
  deviceKeySignedByDid
264
264
  didSignedByDeviceKey
265
- `,w0=`
265
+ `,E0=`
266
266
  signature
267
267
  publicKey
268
- `,oo=class{constructor(e,t=!0){he.set(this,void 0),ja.set(this,void 0),qa.set(this,void 0),Ba.set(this,void 0),bs(this,he,e,"f"),bs(this,qa,[],"f"),bs(this,Ba,[],"f"),bs(this,ja,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await se(this,he,"f").query({query:E`query agent { agent { ${Oa} } }`})),t=new Yr(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=k(await se(this,he,"f").query({query:E`query agentStatus {
268
+ `,so=class{constructor(e,t=!0){he.set(this,void 0),Ba.set(this,void 0),Va.set(this,void 0),Qa.set(this,void 0),_s(this,he,e,"f"),_s(this,Va,[],"f"),_s(this,Qa,[],"f"),_s(this,Ba,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await se(this,he,"f").query({query:C`query agent { agent { ${Na} } }`})),t=new Xr(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=k(await se(this,he,"f").query({query:C`query agentStatus {
269
269
  agentStatus {
270
- ${Nn}
270
+ ${Rn}
271
271
  }
272
- }`}));return new Mt(e)}async generate(e){let{agentGenerate:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentGenerate(
272
+ }`}));return new Ut(e)}async generate(e){let{agentGenerate:t}=k(await se(this,he,"f").mutate({mutation:C`mutation agentGenerate(
273
273
  $passphrase: String!
274
274
  ) {
275
275
  agentGenerate(passphrase: $passphrase) {
276
- ${Nn}
276
+ ${Rn}
277
277
  }
278
- }`,variables:{passphrase:e}}));return new Mt(t)}async import(e){let{did:t,didDocument:i,keystore:n,passphrase:a}=e,{agentImport:o}=k(await se(this,he,"f").mutate({mutation:E`mutation agentImport(
278
+ }`,variables:{passphrase:e}}));return new Ut(t)}async import(e){let{did:t,didDocument:i,keystore:n,passphrase:a}=e,{agentImport:o}=k(await se(this,he,"f").mutate({mutation:C`mutation agentImport(
279
279
  $did: String!,
280
280
  $didDocument: String!,
281
281
  $keystore: String!,
282
282
  $passphrase: String!
283
283
  ) {
284
284
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
285
- ${Nn}
285
+ ${Rn}
286
286
  }
287
- }`,variables:{did:t,didDocument:i,keystore:n,passphrase:a}}));return new Mt(o)}async lock(e){let{agentLock:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentLock($passphrase: String!) {
287
+ }`,variables:{did:t,didDocument:i,keystore:n,passphrase:a}}));return new Ut(o)}async lock(e){let{agentLock:t}=k(await se(this,he,"f").mutate({mutation:C`mutation agentLock($passphrase: String!) {
288
288
  agentLock(passphrase: $passphrase) {
289
- ${Nn}
289
+ ${Rn}
290
290
  }
291
- }`,variables:{passphrase:e}}));return new Mt(t)}async unlock(e,t=!0){let{agentUnlock:i}=k(await se(this,he,"f").mutate({mutation:E`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
291
+ }`,variables:{passphrase:e}}));return new Ut(t)}async unlock(e,t=!0){let{agentUnlock:i}=k(await se(this,he,"f").mutate({mutation:C`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
292
292
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
293
- ${Nn}
293
+ ${Rn}
294
294
  }
295
- }`,variables:{passphrase:e,holochain:t}}));return new Mt(i)}async byDID(e){let{agentByDID:t}=k(await se(this,he,"f").query({query:E`query agentByDID($did: String!) {
295
+ }`,variables:{passphrase:e,holochain:t}}));return new Ut(i)}async byDID(e){let{agentByDID:t}=k(await se(this,he,"f").query({query:C`query agentByDID($did: String!) {
296
296
  agentByDID(did: $did) {
297
- ${Oa}
297
+ ${Na}
298
298
  }
299
- }`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:i}=k(await se(this,he,"f").mutate({mutation:E`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
299
+ }`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:i}=k(await se(this,he,"f").mutate({mutation:C`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
300
300
  agentUpdatePublicPerspective(perspective: $perspective) {
301
- ${Oa}
301
+ ${Na}
302
302
  }
303
- }`,variables:{perspective:t}})),n=i,a=new Yr(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new ac(se(this,he,"f")),i=new oo(se(this,he,"f")),n=await t.add("Agent Perspective Proxy"),a=await i.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let c of e.additions)await n.add(c);for(let c of e.removals)await n.remove(c);let o=await n.snapshot(),s=await this.updatePublicPerspective(o);return await t.remove(n.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
303
+ }`,variables:{perspective:t}})),n=i,a=new Xr(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new oc(se(this,he,"f")),i=new so(se(this,he,"f")),n=await t.add("Agent Perspective Proxy"),a=await i.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let c of e.additions)await n.add(c);for(let c of e.removals)await n.remove(c);let o=await n.snapshot(),s=await this.updatePublicPerspective(o);return await t.remove(n.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=k(await se(this,he,"f").mutate({mutation:C`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
304
304
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
305
- ${Oa}
305
+ ${Na}
306
306
  }
307
- }`,variables:{directMessageLanguage:e}})),i=t,n=new Yr(i.did,i.perspective);return n.directMessageLanguage=i.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
307
+ }`,variables:{directMessageLanguage:e}})),i=t,n=new Xr(i.did,i.perspective);return n.directMessageLanguage=i.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=k(await se(this,he,"f").mutate({mutation:C`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
308
308
  agentAddEntanglementProofs(proofs: $proofs) {
309
- ${Ss}
309
+ ${ws}
310
310
  }
311
- }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
311
+ }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=k(await se(this,he,"f").mutate({mutation:C`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
312
312
  agentDeleteEntanglementProofs(proofs: $proofs) {
313
- ${Ss}
313
+ ${ws}
314
314
  }
315
- }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await se(this,he,"f").query({query:E`query agentGetEntanglementProofs {
315
+ }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await se(this,he,"f").query({query:C`query agentGetEntanglementProofs {
316
316
  agentGetEntanglementProofs {
317
- ${Ss}
317
+ ${ws}
318
318
  }
319
- }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:i}=k(await se(this,he,"f").mutate({mutation:E`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
319
+ }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:i}=k(await se(this,he,"f").mutate({mutation:C`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
320
320
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
321
- ${Ss}
321
+ ${ws}
322
322
  }
323
- }`,variables:{deviceKey:e,deviceKeyType:t}}));return i}addUpdatedListener(e){se(this,qa,"f").push(e)}addAppChangedListener(e){se(this,ja,"f").push(e)}subscribeAgentUpdated(){se(this,he,"f").subscribe({query:E` subscription {
324
- agentUpdated { ${Oa} }
323
+ }`,variables:{deviceKey:e,deviceKeyType:t}}));return i}addUpdatedListener(e){se(this,Va,"f").push(e)}addAppChangedListener(e){se(this,Ba,"f").push(e)}subscribeAgentUpdated(){se(this,he,"f").subscribe({query:C` subscription {
324
+ agentUpdated { ${Na} }
325
325
  }
326
- `}).subscribe({next:e=>{let t=e.data.agentUpdated;se(this,qa,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){se(this,he,"f").subscribe({query:E` subscription {
326
+ `}).subscribe({next:e=>{let t=e.data.agentUpdated;se(this,Va,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){se(this,he,"f").subscribe({query:C` subscription {
327
327
  agentAppsChanged {
328
- ${_s}
328
+ ${Ss}
329
329
  }
330
330
  }
331
- `}).subscribe({next:e=>{se(this,ja,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){se(this,Ba,"f").push(e)}subscribeAgentStatusChanged(){se(this,he,"f").subscribe({query:E` subscription {
332
- agentStatusChanged { ${Nn} }
331
+ `}).subscribe({next:e=>{se(this,Ba,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){se(this,Qa,"f").push(e)}subscribeAgentStatusChanged(){se(this,he,"f").subscribe({query:C` subscription {
332
+ agentStatusChanged { ${Rn} }
333
333
  }
334
- `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;se(this,Ba,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=k(await se(this,he,"f").mutate({mutation:E`
334
+ `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;se(this,Qa,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=k(await se(this,he,"f").mutate({mutation:C`
335
335
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
336
336
  agentRequestCapability(authInfo: $authInfo)
337
337
  }
338
- `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=k(await se(this,he,"f").mutate({mutation:E`
338
+ `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=k(await se(this,he,"f").mutate({mutation:C`
339
339
  mutation agentPermitCapability($auth: String!) {
340
340
  agentPermitCapability(auth: $auth)
341
341
  }
342
- `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:i}=k(await se(this,he,"f").mutate({mutation:E`
342
+ `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:i}=k(await se(this,he,"f").mutate({mutation:C`
343
343
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
344
344
  agentGenerateJwt(requestId: $requestId, rand: $rand)
345
345
  }
346
- `,variables:{requestId:e,rand:t}}));return i}async getApps(){let{agentGetApps:e}=k(await se(this,he,"f").mutate({mutation:E`query agentGetApps {
346
+ `,variables:{requestId:e,rand:t}}));return i}async getApps(){let{agentGetApps:e}=k(await se(this,he,"f").mutate({mutation:C`query agentGetApps {
347
347
  agentGetApps {
348
- ${_s}
348
+ ${Ss}
349
349
  }
350
- }`}));return e}async removeApp(e){let{agentRemoveApp:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentRemoveApp($requestId: String!) {
350
+ }`}));return e}async removeApp(e){let{agentRemoveApp:t}=k(await se(this,he,"f").mutate({mutation:C`mutation agentRemoveApp($requestId: String!) {
351
351
  agentRemoveApp(requestId: $requestId) {
352
- ${_s}
352
+ ${Ss}
353
353
  }
354
- }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentRevokeToken($requestId: String!) {
354
+ }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=k(await se(this,he,"f").mutate({mutation:C`mutation agentRevokeToken($requestId: String!) {
355
355
  agentRevokeToken(requestId: $requestId) {
356
- ${_s}
356
+ ${Ss}
357
357
  }
358
- }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=k(await se(this,he,"f").mutate({mutation:E`
358
+ }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=k(await se(this,he,"f").mutate({mutation:C`
359
359
  query agentIsLocked {
360
360
  agentIsLocked
361
361
  }
362
- `}));return e}async signMessage(e){let{agentSignMessage:t}=k(await se(this,he,"f").mutate({mutation:E`mutation agentSignMessage($message: String!) {
362
+ `}));return e}async signMessage(e){let{agentSignMessage:t}=k(await se(this,he,"f").mutate({mutation:C`mutation agentSignMessage($message: String!) {
363
363
  agentSignMessage(message: $message) {
364
- ${w0}
364
+ ${E0}
365
365
  }
366
- }`,variables:{message:e}}));return t}async createUser(e,t,i){let{runtimeCreateUser:n}=k(await se(this,he,"f").mutate({mutation:E`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
366
+ }`,variables:{message:e}}));return t}async createUser(e,t,i){let{runtimeCreateUser:n}=k(await se(this,he,"f").mutate({mutation:C`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
367
367
  runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
368
368
  did
369
369
  success
370
370
  error
371
371
  }
372
- }`,variables:{email:e,password:t,appInfo:i}}));return n}async loginUser(e,t){let{runtimeLoginUser:i}=k(await se(this,he,"f").mutate({mutation:E`mutation runtimeLoginUser($email: String!, $password: String!) {
372
+ }`,variables:{email:e,password:t,appInfo:i}}));return n}async loginUser(e,t){let{runtimeLoginUser:i}=k(await se(this,he,"f").mutate({mutation:C`mutation runtimeLoginUser($email: String!, $password: String!) {
373
373
  runtimeLoginUser(email: $email, password: $password)
374
- }`,variables:{email:e,password:t}}));return i}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:i}=k(await se(this,he,"f").mutate({mutation:E`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
374
+ }`,variables:{email:e,password:t}}));return i}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:i}=k(await se(this,he,"f").mutate({mutation:C`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
375
375
  runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
376
376
  success
377
377
  message
378
378
  requiresPassword
379
379
  isExistingUser
380
380
  }
381
- }`,variables:{email:e,appInfo:t}}));return i}async verifyEmailCode(e,t,i){let{runtimeVerifyEmailCode:n}=k(await se(this,he,"f").mutate({mutation:E`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
381
+ }`,variables:{email:e,appInfo:t}}));return i}async verifyEmailCode(e,t,i){let{runtimeVerifyEmailCode:n}=k(await se(this,he,"f").mutate({mutation:C`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
382
382
  runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
383
- }`,variables:{email:e,code:t,verificationType:i}}));return n}};he=new WeakMap,ja=new WeakMap,qa=new WeakMap,Ba=new WeakMap;var C0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Qr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ht,rh=`
383
+ }`,variables:{email:e,code:t,verificationType:i}}));return n}};he=new WeakMap,Ba=new WeakMap,Va=new WeakMap,Qa=new WeakMap;var C0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},zr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Gt,nh=`
384
384
  name
385
385
  address
386
386
  settings
387
387
  icon { code }
388
388
  constructorIcon { code }
389
389
  settingsIcon { code }
390
- `,ih=`
390
+ `,ah=`
391
391
  name
392
392
  address
393
393
  description
@@ -397,45 +397,45 @@ neighbourhood {
397
397
  templateAppliedParams
398
398
  possibleTemplateParams
399
399
  sourceCodeLink
400
- `,Du=class{constructor(e){Ht.set(this,void 0),C0(this,Ht,e,"f")}async byAddress(e){let{language:t}=k(await Qr(this,Ht,"f").query({query:E`query byAddress($address: String!) {
400
+ `,Nl=class{constructor(e){Gt.set(this,void 0),C0(this,Gt,e,"f")}async byAddress(e){let{language:t}=k(await zr(this,Gt,"f").query({query:C`query byAddress($address: String!) {
401
401
  language(address: $address) {
402
- ${rh}
402
+ ${nh}
403
403
  }
404
- }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=k(await Qr(this,Ht,"f").query({query:E`query byFilter($filter: String!) {
404
+ }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=k(await zr(this,Gt,"f").query({query:C`query byFilter($filter: String!) {
405
405
  languages(filter: $filter) {
406
- ${rh}
406
+ ${nh}
407
407
  }
408
- }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:i}=k(await Qr(this,Ht,"f").mutate({mutation:E`mutation writeSettings($languageAddress: String!, $settings: String!) {
408
+ }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:i}=k(await zr(this,Gt,"f").mutate({mutation:C`mutation writeSettings($languageAddress: String!, $settings: String!) {
409
409
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
410
- }`,variables:{languageAddress:e,settings:t}}));return i}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:i}=k(await Qr(this,Ht,"f").mutate({mutation:E`mutation languageApplyTemplateAndPublish(
410
+ }`,variables:{languageAddress:e,settings:t}}));return i}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:i}=k(await zr(this,Gt,"f").mutate({mutation:C`mutation languageApplyTemplateAndPublish(
411
411
  $sourceLanguageHash: String!,
412
412
  $templateData: String!,
413
413
  ) {
414
414
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
415
415
  name, address
416
416
  }
417
- }`,variables:{sourceLanguageHash:e,templateData:t}}));return i}async publish(e,t){let{languagePublish:i}=k(await Qr(this,Ht,"f").mutate({mutation:E`mutation languagePublish(
417
+ }`,variables:{sourceLanguageHash:e,templateData:t}}));return i}async publish(e,t){let{languagePublish:i}=k(await zr(this,Gt,"f").mutate({mutation:C`mutation languagePublish(
418
418
  $languagePath: String!,
419
419
  $languageMeta: LanguageMetaInput!,
420
420
  ) {
421
421
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
422
- ${ih}
422
+ ${ah}
423
423
  }
424
- }`,variables:{languagePath:e,languageMeta:t}}));return i}async meta(e){let{languageMeta:t}=k(await Qr(this,Ht,"f").query({query:E`query languageMeta(
424
+ }`,variables:{languagePath:e,languageMeta:t}}));return i}async meta(e){let{languageMeta:t}=k(await zr(this,Gt,"f").query({query:C`query languageMeta(
425
425
  $address: String!,
426
426
  ) {
427
427
  languageMeta(address: $address) {
428
- ${ih}
428
+ ${ah}
429
429
  }
430
- }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=k(await Qr(this,Ht,"f").query({query:E`query languageSource(
430
+ }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=k(await zr(this,Gt,"f").query({query:C`query languageSource(
431
431
  $address: String!,
432
432
  ) {
433
433
  languageSource(address: $address)
434
- }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=k(await Qr(this,Ht,"f").mutate({mutation:E`mutation languageRemove(
434
+ }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=k(await zr(this,Gt,"f").mutate({mutation:C`mutation languageRemove(
435
435
  $address: String!,
436
436
  ) {
437
437
  languageRemove(address: $address)
438
- }`,variables:{address:e}}));return t}};Ht=new WeakMap;var E0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},lt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ht,Mn,Nu=class{constructor(e){ht.set(this,void 0),Mn.set(this,new Map),E0(this,ht,e,"f")}async publishFromPerspective(e,t,i){let{neighbourhoodPublishFromPerspective:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodPublishFromPerspective(
438
+ }`,variables:{address:e}}));return t}};Gt=new WeakMap;var x0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},pt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},mt,Un,Rl=class{constructor(e){mt.set(this,void 0),Un.set(this,new Map),x0(this,mt,e,"f")}async publishFromPerspective(e,t,i){let{neighbourhoodPublishFromPerspective:n}=k(await pt(this,mt,"f").mutate({mutation:C`mutation neighbourhoodPublishFromPerspective(
439
439
  $linkLanguage: String!,
440
440
  $meta: PerspectiveInput!,
441
441
  $perspectiveUUID: String!
@@ -445,7 +445,7 @@ neighbourhood {
445
445
  meta: $meta,
446
446
  perspectiveUUID: $perspectiveUUID
447
447
  )
448
- }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:i}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodJoinFromUrl($url: String!) {
448
+ }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:i}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=k(await pt(this,mt,"f").mutate({mutation:C`mutation neighbourhoodJoinFromUrl($url: String!) {
449
449
  neighbourhoodJoinFromUrl(url: $url) {
450
450
  uuid
451
451
  name
@@ -467,11 +467,11 @@ neighbourhood {
467
467
  author
468
468
  }
469
469
  }
470
- }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=k(await lt(this,ht,"f").query({query:E`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
470
+ }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=k(await pt(this,mt,"f").query({query:C`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
471
471
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
472
- }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=k(await lt(this,ht,"f").query({query:E`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
472
+ }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=k(await pt(this,mt,"f").query({query:C`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
473
473
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
474
- }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=k(await lt(this,ht,"f").query({query:E`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
474
+ }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=k(await pt(this,mt,"f").query({query:C`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
475
475
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
476
476
  did
477
477
  status {
@@ -488,7 +488,7 @@ neighbourhood {
488
488
  proof { valid, invalid, signature, key }
489
489
  }
490
490
  }
491
- }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:i}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatus(
491
+ }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:i}=k(await pt(this,mt,"f").mutate({mutation:C`mutation neighbourhoodSetOnlineStatus(
492
492
  $perspectiveUUID: String!,
493
493
  $status: PerspectiveInput!
494
494
  ) {
@@ -496,7 +496,7 @@ neighbourhood {
496
496
  perspectiveUUID: $perspectiveUUID,
497
497
  status: $status
498
498
  )
499
- }`,variables:{perspectiveUUID:e,status:t}}));return i}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:i}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatusU(
499
+ }`,variables:{perspectiveUUID:e,status:t}}));return i}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:i}=k(await pt(this,mt,"f").mutate({mutation:C`mutation neighbourhoodSetOnlineStatusU(
500
500
  $perspectiveUUID: String!,
501
501
  $status: PerspectiveUnsignedInput!
502
502
  ) {
@@ -504,7 +504,7 @@ neighbourhood {
504
504
  perspectiveUUID: $perspectiveUUID,
505
505
  status: $status
506
506
  )
507
- }`,variables:{perspectiveUUID:e,status:t}}));return i}async sendSignal(e,t,i){let{neighbourhoodSendSignal:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSendSignal(
507
+ }`,variables:{perspectiveUUID:e,status:t}}));return i}async sendSignal(e,t,i){let{neighbourhoodSendSignal:n}=k(await pt(this,mt,"f").mutate({mutation:C`mutation neighbourhoodSendSignal(
508
508
  $perspectiveUUID: String!,
509
509
  $remoteAgentDid: String!,
510
510
  $payload: PerspectiveInput!
@@ -514,7 +514,7 @@ neighbourhood {
514
514
  remoteAgentDid: $remoteAgentDid,
515
515
  payload: $payload
516
516
  )
517
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendSignalU(e,t,i){let{neighbourhoodSendSignalU:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSendSignalU(
517
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendSignalU(e,t,i){let{neighbourhoodSendSignalU:n}=k(await pt(this,mt,"f").mutate({mutation:C`mutation neighbourhoodSendSignalU(
518
518
  $perspectiveUUID: String!,
519
519
  $remoteAgentDid: String!,
520
520
  $payload: PerspectiveUnsignedInput!
@@ -524,7 +524,7 @@ neighbourhood {
524
524
  remoteAgentDid: $remoteAgentDid,
525
525
  payload: $payload
526
526
  )
527
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendBroadcast(e,t,i=!1){let{neighbourhoodSendBroadcast:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
527
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendBroadcast(e,t,i=!1){let{neighbourhoodSendBroadcast:n}=k(await pt(this,mt,"f").mutate({mutation:C`mutation neighbourhoodSendBroadcast(
528
528
  $perspectiveUUID: String!,
529
529
  $payload: PerspectiveInput!,
530
530
  $loopback: Boolean
@@ -534,7 +534,7 @@ neighbourhood {
534
534
  payload: $payload,
535
535
  loopback: $loopback
536
536
  )
537
- }`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}async sendBroadcastU(e,t,i=!1){let{neighbourhoodSendBroadcastU:n}=k(await lt(this,ht,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
537
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}async sendBroadcastU(e,t,i=!1){let{neighbourhoodSendBroadcastU:n}=k(await pt(this,mt,"f").mutate({mutation:C`mutation neighbourhoodSendBroadcastU(
538
538
  $perspectiveUUID: String!,
539
539
  $payload: PerspectiveUnsignedInput!,
540
540
  $loopback: Boolean
@@ -544,7 +544,7 @@ neighbourhood {
544
544
  payload: $payload,
545
545
  loopback: $loopback
546
546
  )
547
- }`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}dispatchSignal(e,t){let i=lt(this,Mn,"f").get(e);i&&i.forEach(n=>n(t))}async subscribeToSignals(e){let t=this;await lt(this,ht,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
547
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}dispatchSignal(e,t){let i=pt(this,Un,"f").get(e);i&&i.forEach(n=>n(t))}async subscribeToSignals(e){let t=this;await pt(this,mt,"f").subscribe({query:C`subscription neighbourhoodSignal($perspectiveUUID: String!) {
548
548
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
549
549
  author
550
550
  timestamp
@@ -559,7 +559,7 @@ neighbourhood {
559
559
  }
560
560
  proof { valid, invalid, signature, key }
561
561
  }
562
- }`,variables:{perspectiveUUID:e}}).subscribe({next:i=>{let{neighbourhoodSignal:n}=k(i);t.dispatchSignal(e,n)}})}async addSignalHandler(e,t){let i=lt(this,Mn,"f").get(e);i||(i=[],lt(this,Mn,"f").set(e,i),await this.subscribeToSignals(e)),i.push(t)}removeSignalHandler(e,t){let i=lt(this,Mn,"f").get(e);if(i){let n=i.indexOf(t);n>-1&&i.splice(n,1)}}};ht=new WeakMap,Mn=new WeakMap;var ws=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},W=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Z,Va,Qa,za,C1,Cs=`
562
+ }`,variables:{perspectiveUUID:e}}).subscribe({next:i=>{let{neighbourhoodSignal:n}=k(i);t.dispatchSignal(e,n)}})}async addSignalHandler(e,t){let i=pt(this,Un,"f").get(e);i||(i=[],pt(this,Un,"f").set(e,i),await this.subscribeToSignals(e)),i.push(t)}removeSignalHandler(e,t){let i=pt(this,Un,"f").get(e);if(i){let n=i.indexOf(t);n>-1&&i.splice(n,1)}}};mt=new WeakMap,Un=new WeakMap;var Es=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},W=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Z,za,Wa,Ha,x1,Cs=`
563
563
  author
564
564
  timestamp
565
565
  data {
@@ -571,7 +571,7 @@ data {
571
571
  }
572
572
  }
573
573
  proof { valid, invalid, signature, key }
574
- `,x0=`
574
+ `,A0=`
575
575
  description
576
576
  appName
577
577
  appUrl
@@ -580,72 +580,72 @@ trigger
580
580
  perspectiveIds
581
581
  webhookUrl
582
582
  webhookAuth
583
- `,E1=`
583
+ `,A1=`
584
584
  id
585
585
  granted
586
- ${x0}
587
- `,A0=`
588
- notification { ${E1} }
586
+ ${A0}
587
+ `,k0=`
588
+ notification { ${A1} }
589
589
  perspectiveId
590
590
  triggerMatch
591
- `,Ru=class{constructor(e,t=!0){Z.set(this,void 0),Va.set(this,void 0),Qa.set(this,void 0),za.set(this,void 0),C1.set(this,void 0),ws(this,Z,e,"f"),ws(this,Va,[],"f"),ws(this,Qa,[],"f"),ws(this,za,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await W(this,Z,"f").query({query:E`query runtimeInfo {
591
+ `,Pl=class{constructor(e,t=!0){Z.set(this,void 0),za.set(this,void 0),Wa.set(this,void 0),Ha.set(this,void 0),x1.set(this,void 0),Es(this,Z,e,"f"),Es(this,za,[],"f"),Es(this,Wa,[],"f"),Es(this,Ha,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await W(this,Z,"f").query({query:C`query runtimeInfo {
592
592
  runtimeInfo {
593
593
  ad4mExecutorVersion,
594
594
  isInitialized,
595
595
  isUnlocked
596
596
  }
597
- }`}));return e}async quit(){return k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeOpenLink($url: String!) {
597
+ }`}));return e}async quit(){return k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeOpenLink($url: String!) {
598
598
  runtimeOpenLink(url: $url)
599
- }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation addTrustedAgents($agents: [String!]!) {
599
+ }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation addTrustedAgents($agents: [String!]!) {
600
600
  addTrustedAgents(agents: $agents)
601
- }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation deleteTrustedAgents($agents: [String!]!) {
601
+ }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation deleteTrustedAgents($agents: [String!]!) {
602
602
  deleteTrustedAgents(agents: $agents)
603
- }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=k(await W(this,Z,"f").query({query:E`query getTrustedAgents {
603
+ }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=k(await W(this,Z,"f").query({query:C`query getTrustedAgents {
604
604
  getTrustedAgents
605
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
605
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
606
606
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
607
- }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
607
+ }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
608
608
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
609
- }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await W(this,Z,"f").query({query:E`query runtimeKnownLinkLanguageTemplates {
609
+ }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await W(this,Z,"f").query({query:C`query runtimeKnownLinkLanguageTemplates {
610
610
  runtimeKnownLinkLanguageTemplates
611
- }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeAddFriends($dids: [String!]!) {
611
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeAddFriends($dids: [String!]!) {
612
612
  runtimeAddFriends(dids: $dids)
613
- }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRemoveFriends($dids: [String!]!) {
613
+ }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeRemoveFriends($dids: [String!]!) {
614
614
  runtimeRemoveFriends(dids: $dids)
615
- }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=k(await W(this,Z,"f").query({query:E`query runtimeFriends {
615
+ }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=k(await W(this,Z,"f").query({query:C`query runtimeFriends {
616
616
  runtimeFriends
617
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await W(this,Z,"f").query({query:E`query runtimeHcAgentInfos {
617
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await W(this,Z,"f").query({query:C`query runtimeHcAgentInfos {
618
618
  runtimeHcAgentInfos
619
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await W(this,Z,"f").query({query:E`query runtimeGetNetworkMetrics {
619
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await W(this,Z,"f").query({query:C`query runtimeGetNetworkMetrics {
620
620
  runtimeGetNetworkMetrics
621
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRestartHolochain {
621
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeRestartHolochain {
622
622
  runtimeRestartHolochain
623
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
623
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
624
624
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
625
- }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,i,n){let{runtimeVerifyStringSignedByDid:a}=k(await W(this,Z,"f").mutate({mutation:E`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
625
+ }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,i,n){let{runtimeVerifyStringSignedByDid:a}=k(await W(this,Z,"f").mutate({mutation:C`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
626
626
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
627
- }`,variables:{did:e,didSigningKeyId:t,data:i,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeSetStatus($status: PerspectiveInput!) {
627
+ }`,variables:{did:e,didSigningKeyId:t,data:i,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeSetStatus($status: PerspectiveInput!) {
628
628
  runtimeSetStatus(status: $status)
629
- }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=k(await W(this,Z,"f").query({query:E`query runtimeFriendStatus($did: String!) {
629
+ }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=k(await W(this,Z,"f").query({query:C`query runtimeFriendStatus($did: String!) {
630
630
  runtimeFriendStatus(did: $did) { ${Cs} }
631
- }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:i}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
631
+ }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:i}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
632
632
  runtimeFriendSendMessage(did: $did, message: $message)
633
- }`,variables:{did:e,message:t}}));return i}async messageInbox(e){let{runtimeMessageInbox:t}=k(await W(this,Z,"f").query({query:E`query runtimeMessageInbox($filter: String) {
633
+ }`,variables:{did:e,message:t}}));return i}async messageInbox(e){let{runtimeMessageInbox:t}=k(await W(this,Z,"f").query({query:C`query runtimeMessageInbox($filter: String) {
634
634
  runtimeMessageInbox(filter: $filter) { ${Cs} }
635
- }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=k(await W(this,Z,"f").query({query:E`query runtimeMessageOutbox($filter: String) {
635
+ }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=k(await W(this,Z,"f").query({query:C`query runtimeMessageOutbox($filter: String) {
636
636
  runtimeMessageOutbox(filter: $filter) {
637
637
  recipient,
638
638
  message {
639
639
  ${Cs}
640
640
  }
641
641
  }
642
- }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
642
+ }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
643
643
  runtimeRequestInstallNotification(notification: $notification)
644
- }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeGrantNotification($id: String!) {
644
+ }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeGrantNotification($id: String!) {
645
645
  runtimeGrantNotification(id: $id)
646
- }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeExportDb($filePath: String!) {
646
+ }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeExportDb($filePath: String!) {
647
647
  runtimeExportDb(filePath: $filePath)
648
- }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeImportDb($filePath: String!) {
648
+ }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeImportDb($filePath: String!) {
649
649
  runtimeImportDb(filePath: $filePath) {
650
650
  perspectives { total imported failed omitted errors }
651
651
  links { total imported failed omitted errors }
@@ -659,51 +659,51 @@ triggerMatch
659
659
  trustedAgents { total imported failed omitted errors }
660
660
  knownLinkLanguages { total imported failed omitted errors }
661
661
  }
662
- }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=k(await W(this,Z,"f").query({query:E`query runtimeNotifications {
663
- runtimeNotifications { ${E1} }
664
- }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:i}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
662
+ }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=k(await W(this,Z,"f").query({query:C`query runtimeNotifications {
663
+ runtimeNotifications { ${A1} }
664
+ }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:i}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
665
665
  runtimeUpdateNotification(id: $id, notification: $notification)
666
- }`,variables:{id:e,notification:t}}));return i}async removeNotification(e){let{runtimeRemoveNotification:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeRemoveNotification($id: String!) {
666
+ }`,variables:{id:e,notification:t}}));return i}async removeNotification(e){let{runtimeRemoveNotification:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeRemoveNotification($id: String!) {
667
667
  runtimeRemoveNotification(id: $id)
668
- }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:i}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
668
+ }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:i}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
669
669
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
670
- }`,variables:{perspectiveUuid:e,filePath:t}}));return i}async importPerspective(e){let{runtimeImportPerspective:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeImportPerspective($filePath: String!) {
670
+ }`,variables:{perspectiveUuid:e,filePath:t}}));return i}async importPerspective(e){let{runtimeImportPerspective:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeImportPerspective($filePath: String!) {
671
671
  runtimeImportPerspective(filePath: $filePath)
672
- }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await W(this,Z,"f").query({query:E`query runtimeMultiUserEnabled {
672
+ }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await W(this,Z,"f").query({query:C`query runtimeMultiUserEnabled {
673
673
  runtimeMultiUserEnabled
674
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
674
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
675
675
  runtimeSetMultiUserEnabled(enabled: $enabled)
676
- }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=k(await W(this,Z,"f").query({query:E`query runtimeListUsers {
676
+ }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=k(await W(this,Z,"f").query({query:C`query runtimeListUsers {
677
677
  runtimeListUsers {
678
678
  email
679
679
  did
680
680
  lastSeen
681
681
  perspectiveCount
682
682
  }
683
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestModeEnable {
683
+ }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeEmailTestModeEnable {
684
684
  runtimeEmailTestModeEnable
685
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestModeDisable {
685
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeEmailTestModeDisable {
686
686
  runtimeEmailTestModeDisable
687
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestGetCode($email: String!) {
687
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeEmailTestGetCode($email: String!) {
688
688
  runtimeEmailTestGetCode(email: $email)
689
- }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestClearCodes {
689
+ }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeEmailTestClearCodes {
690
690
  runtimeEmailTestClearCodes
691
- }`}));return e}async emailTestSetExpiry(e,t,i){let{runtimeEmailTestSetExpiry:n}=k(await W(this,Z,"f").mutate({mutation:E`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
691
+ }`}));return e}async emailTestSetExpiry(e,t,i){let{runtimeEmailTestSetExpiry:n}=k(await W(this,Z,"f").mutate({mutation:C`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
692
692
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
693
- }`,variables:{email:e,verificationType:t,expiresAt:i}}));return n}addNotificationTriggeredCallback(e){W(this,za,"f").push(e)}subscribeNotificationTriggered(){W(this,Z,"f").subscribe({query:E` subscription {
694
- runtimeNotificationTriggered { ${A0} }
693
+ }`,variables:{email:e,verificationType:t,expiresAt:i}}));return n}addNotificationTriggeredCallback(e){W(this,Ha,"f").push(e)}subscribeNotificationTriggered(){W(this,Z,"f").subscribe({query:C` subscription {
694
+ runtimeNotificationTriggered { ${k0} }
695
695
  }
696
- `}).subscribe({next:e=>{W(this,za,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){W(this,Va,"f").push(e)}subscribeMessageReceived(){W(this,Z,"f").subscribe({query:E` subscription {
696
+ `}).subscribe({next:e=>{W(this,Ha,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){W(this,za,"f").push(e)}subscribeMessageReceived(){W(this,Z,"f").subscribe({query:C` subscription {
697
697
  runtimeMessageReceived { ${Cs} }
698
698
  }
699
- `}).subscribe({next:e=>{W(this,Va,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){W(this,Qa,"f").push(e)}subscribeExceptionOccurred(){W(this,Z,"f").subscribe({query:E` subscription {
699
+ `}).subscribe({next:e=>{W(this,za,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){W(this,Wa,"f").push(e)}subscribeExceptionOccurred(){W(this,Z,"f").subscribe({query:C` subscription {
700
700
  exceptionOccurred {
701
701
  title
702
702
  message
703
703
  type
704
704
  addon
705
705
  }
706
- }`}).subscribe({next:e=>{W(this,Qa,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};Z=new WeakMap,Va=new WeakMap,Qa=new WeakMap,za=new WeakMap,C1=new WeakMap;var k0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Rn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Cr,$u=class{constructor(e){Cr.set(this,void 0),k0(this,Cr,e,"f")}async get(e,t=!1){if(!t)try{let n=ut.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:i}=k(await Rn(this,Cr,"f").query({query:E`query expression($url: String!) {
706
+ }`}).subscribe({next:e=>{W(this,Wa,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};Z=new WeakMap,za=new WeakMap,Wa=new WeakMap,Ha=new WeakMap,x1=new WeakMap;var T0=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Pn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Cr,$l=class{constructor(e){Cr.set(this,void 0),T0(this,Cr,e,"f")}async get(e,t=!1){if(!t)try{let n=ct.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:i}=k(await Pn(this,Cr,"f").query({query:C`query expression($url: String!) {
707
707
  expression(url: $url) {
708
708
  author
709
709
  timestamp
@@ -716,7 +716,7 @@ triggerMatch
716
716
  invalid
717
717
  }
718
718
  }
719
- }`,variables:{url:e}}));return i}async getMany(e){let{expressionMany:t}=k(await Rn(this,Cr,"f").query({query:E`query expressionMany($urls: [String!]!) {
719
+ }`,variables:{url:e}}));return i}async getMany(e){let{expressionMany:t}=k(await Pn(this,Cr,"f").query({query:C`query expressionMany($urls: [String!]!) {
720
720
  expressionMany(urls: $urls) {
721
721
  author
722
722
  timestamp
@@ -729,19 +729,19 @@ triggerMatch
729
729
  invalid
730
730
  }
731
731
  }
732
- }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=k(await Rn(this,Cr,"f").query({query:E`query expressionRaw($url: String!) {
732
+ }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=k(await Pn(this,Cr,"f").query({query:C`query expressionRaw($url: String!) {
733
733
  expressionRaw(url: $url)
734
- }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:i}=k(await Rn(this,Cr,"f").mutate({mutation:E`mutation expressionCreate($content: String!, $languageAddress: String!){
734
+ }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:i}=k(await Pn(this,Cr,"f").mutate({mutation:C`mutation expressionCreate($content: String!, $languageAddress: String!){
735
735
  expressionCreate(content: $content, languageAddress: $languageAddress)
736
- }`,variables:{content:e,languageAddress:t}}));return i}async interactions(e){let{expressionInteractions:t}=k(await Rn(this,Cr,"f").query({query:E`query expressionInteractions($url: String!) {
736
+ }`,variables:{content:e,languageAddress:t}}));return i}async interactions(e){let{expressionInteractions:t}=k(await Pn(this,Cr,"f").query({query:C`query expressionInteractions($url: String!) {
737
737
  expressionInteractions(url: $url) {
738
738
  label
739
739
  name
740
740
  parameters { name, type }
741
741
  }
742
- }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:i}=k(await Rn(this,Cr,"f").mutate({mutation:E`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
742
+ }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:i}=k(await Pn(this,Cr,"f").mutate({mutation:C`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
743
743
  expressionInteract(url: $url, interactionCall: $interactionCall)
744
- }`,variables:{url:e,interactionCall:t}}));return i}};Cr=new WeakMap;var vc={};vc.byteLength=I0;vc.toByteArray=D0;vc.fromByteArray=$0;var or=[],Ft=[],T0=typeof Uint8Array<"u"?Uint8Array:Array,ou="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ii=0,nh=ou.length;Ii<nh;++Ii)or[Ii]=ou[Ii],Ft[ou.charCodeAt(Ii)]=Ii;var Ii,nh;Ft["-".charCodeAt(0)]=62;Ft["_".charCodeAt(0)]=63;function x1(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function I0(r){var e=x1(r),t=e[0],i=e[1];return(t+i)*3/4-i}function O0(r,e,t){return(e+t)*3/4-t}function D0(r){var e,t=x1(r),i=t[0],n=t[1],a=new T0(O0(r,i,n)),o=0,s=n>0?i-4:i,c;for(c=0;c<s;c+=4)e=Ft[r.charCodeAt(c)]<<18|Ft[r.charCodeAt(c+1)]<<12|Ft[r.charCodeAt(c+2)]<<6|Ft[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Ft[r.charCodeAt(c)]<<2|Ft[r.charCodeAt(c+1)]>>4,a[o++]=e&255),n===1&&(e=Ft[r.charCodeAt(c)]<<10|Ft[r.charCodeAt(c+1)]<<4|Ft[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function N0(r){return or[r>>18&63]+or[r>>12&63]+or[r>>6&63]+or[r&63]}function R0(r,e,t){for(var i,n=[],a=e;a<t;a+=3)i=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),n.push(N0(i));return n.join("")}function $0(r){for(var e,t=r.length,i=t%3,n=[],a=16383,o=0,s=t-i;o<s;o+=a)n.push(R0(r,o,o+a>s?s:o+a));return i===1?(e=r[t-1],n.push(or[e>>2]+or[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(or[e>>10]+or[e>>4&63]+or[e<<2&63]+"=")),n.join("")}var P0=4,ah=0,oh=1,L0=2;function Xn(r){let e=r.length;for(;--e>=0;)r[e]=0}var F0=0,A1=1,M0=2,U0=3,j0=258,ep=29,_o=256,so=_o+1+ep,qn=30,tp=19,k1=2*so+1,ji=15,su=16,q0=7,rp=256,T1=16,I1=17,O1=18,Pu=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]),qs=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]),B0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),D1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),V0=512,Er=new Array((so+2)*2);Xn(Er);var Xa=new Array(qn*2);Xn(Xa);var co=new Array(V0);Xn(co);var lo=new Array(j0-U0+1);Xn(lo);var ip=new Array(ep);Xn(ip);var oc=new Array(qn);Xn(oc);function cu(r,e,t,i,n){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=n,this.has_stree=r&&r.length}var N1,R1,$1;function lu(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var P1=r=>r<256?co[r]:co[256+(r>>>7)],uo=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},wt=(r,e,t)=>{r.bi_valid>su-t?(r.bi_buf|=e<<r.bi_valid&65535,uo(r,r.bi_buf),r.bi_buf=e>>su-r.bi_valid,r.bi_valid+=t-su):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},sr=(r,e,t)=>{wt(r,t[e*2],t[e*2+1])},L1=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},Q0=r=>{r.bi_valid===16?(uo(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},z0=(r,e)=>{let t=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,l,u,d,f,p,h,m=0;for(f=0;f<=ji;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,l=r.heap_max+1;l<k1;l++)u=r.heap[l],f=t[t[u*2+1]*2+1]+1,f>c&&(f=c,m++),t[u*2+1]=f,!(u>i)&&(r.bl_count[f]++,p=0,u>=s&&(p=o[u-s]),h=t[u*2],r.opt_len+=h*(f+p),a&&(r.static_len+=h*(n[u*2+1]+p)));if(m!==0){do{for(f=c-1;r.bl_count[f]===0;)f--;r.bl_count[f]--,r.bl_count[f+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(f=c;f!==0;f--)for(u=r.bl_count[f];u!==0;)d=r.heap[--l],!(d>i)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),u--)}},F1=(r,e,t)=>{let i=new Array(ji+1),n=0,a,o;for(a=1;a<=ji;a++)n=n+t[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=L1(i[s]++,s))}},W0=()=>{let r,e,t,i,n,a=new Array(ji+1);for(t=0,i=0;i<ep-1;i++)for(ip[i]=t,r=0;r<1<<Pu[i];r++)lo[t++]=i;for(lo[t-1]=i,n=0,i=0;i<16;i++)for(oc[i]=n,r=0;r<1<<qs[i];r++)co[n++]=i;for(n>>=7;i<qn;i++)for(oc[i]=n<<7,r=0;r<1<<qs[i]-7;r++)co[256+n++]=i;for(e=0;e<=ji;e++)a[e]=0;for(r=0;r<=143;)Er[r*2+1]=8,r++,a[8]++;for(;r<=255;)Er[r*2+1]=9,r++,a[9]++;for(;r<=279;)Er[r*2+1]=7,r++,a[7]++;for(;r<=287;)Er[r*2+1]=8,r++,a[8]++;for(F1(Er,so+1,a),r=0;r<qn;r++)Xa[r*2+1]=5,Xa[r*2]=L1(r,5);N1=new cu(Er,Pu,_o+1,so,ji),R1=new cu(Xa,qs,0,qn,ji),$1=new cu(new Array(0),B0,0,tp,q0)},M1=r=>{let e;for(e=0;e<so;e++)r.dyn_ltree[e*2]=0;for(e=0;e<qn;e++)r.dyn_dtree[e*2]=0;for(e=0;e<tp;e++)r.bl_tree[e*2]=0;r.dyn_ltree[rp*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},U1=r=>{r.bi_valid>8?uo(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},sh=(r,e,t,i)=>{let n=e*2,a=t*2;return r[n]<r[a]||r[n]===r[a]&&i[e]<=i[t]},uu=(r,e,t)=>{let i=r.heap[t],n=t<<1;for(;n<=r.heap_len&&(n<r.heap_len&&sh(e,r.heap[n+1],r.heap[n],r.depth)&&n++,!sh(e,i,r.heap[n],r.depth));)r.heap[t]=r.heap[n],t=n,n<<=1;r.heap[t]=i},ch=(r,e,t)=>{let i,n,a=0,o,s;if(r.sym_next!==0)do i=r.pending_buf[r.sym_buf+a++]&255,i+=(r.pending_buf[r.sym_buf+a++]&255)<<8,n=r.pending_buf[r.sym_buf+a++],i===0?sr(r,n,e):(o=lo[n],sr(r,o+_o+1,e),s=Pu[o],s!==0&&(n-=ip[o],wt(r,n,s)),i--,o=P1(i),sr(r,o,t),s=qs[o],s!==0&&(i-=oc[o],wt(r,i,s)));while(a<r.sym_next);sr(r,rp,e)},Lu=(r,e)=>{let t=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,l;for(r.heap_len=0,r.heap_max=k1,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)l=r.heap[++r.heap_len]=c<2?++c:0,t[l*2]=1,r.depth[l]=0,r.opt_len--,n&&(r.static_len-=i[l*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)uu(r,t,o);l=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],uu(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[l*2]=t[o*2]+t[s*2],r.depth[l]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=l,r.heap[1]=l++,uu(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],z0(r,e),F1(t,c,r.bl_count)},lh=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)&&(s<l?r.bl_tree[a*2]+=s:a!==0?(a!==n&&r.bl_tree[a*2]++,r.bl_tree[T1*2]++):s<=10?r.bl_tree[I1*2]++:r.bl_tree[O1*2]++,s=0,n=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4))},uh=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,l=4;for(o===0&&(c=138,l=3),i=0;i<=t;i++)if(a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)){if(s<l)do sr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==n&&(sr(r,a,r.bl_tree),s--),sr(r,T1,r.bl_tree),wt(r,s-3,2)):s<=10?(sr(r,I1,r.bl_tree),wt(r,s-3,3)):(sr(r,O1,r.bl_tree),wt(r,s-11,7));s=0,n=a,o===0?(c=138,l=3):a===o?(c=6,l=3):(c=7,l=4)}},H0=r=>{let e;for(lh(r,r.dyn_ltree,r.l_desc.max_code),lh(r,r.dyn_dtree,r.d_desc.max_code),Lu(r,r.bl_desc),e=tp-1;e>=3&&r.bl_tree[D1[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},G0=(r,e,t,i)=>{let n;for(wt(r,e-257,5),wt(r,t-1,5),wt(r,i-4,4),n=0;n<i;n++)wt(r,r.bl_tree[D1[n]*2+1],3);uh(r,r.dyn_ltree,e-1),uh(r,r.dyn_dtree,t-1)},K0=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return ah;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return oh;for(t=32;t<_o;t++)if(r.dyn_ltree[t*2]!==0)return oh;return ah},ph=!1,Z0=r=>{ph||(W0(),ph=!0),r.l_desc=new lu(r.dyn_ltree,N1),r.d_desc=new lu(r.dyn_dtree,R1),r.bl_desc=new lu(r.bl_tree,$1),r.bi_buf=0,r.bi_valid=0,M1(r)},j1=(r,e,t,i)=>{wt(r,(F0<<1)+(i?1:0),3),U1(r),uo(r,t),uo(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},J0=r=>{wt(r,A1<<1,3),sr(r,rp,Er),Q0(r)},Y0=(r,e,t,i)=>{let n,a,o=0;r.level>0?(r.strm.data_type===L0&&(r.strm.data_type=K0(r)),Lu(r,r.l_desc),Lu(r,r.d_desc),o=H0(r),n=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?j1(r,e,t,i):r.strategy===P0||a===n?(wt(r,(A1<<1)+(i?1:0),3),ch(r,Er,Xa)):(wt(r,(M0<<1)+(i?1:0),3),G0(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),ch(r,r.dyn_ltree,r.dyn_dtree)),M1(r),i&&U1(r)},X0=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(lo[t]+_o+1)*2]++,r.dyn_dtree[P1(e)*2]++),r.sym_next===r.sym_end),ev=Z0,tv=j1,rv=Y0,iv=X0,nv=J0,av={_tr_init:ev,_tr_stored_block:tv,_tr_flush_block:rv,_tr_tally:iv,_tr_align:nv},ov=(r,e,t,i)=>{let n=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},po=ov,sv=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var i=0;i<8;i++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},cv=new Uint32Array(sv()),lv=(r,e,t,i)=>{let n=cv,a=i+t;r^=-1;for(let o=i;o<a;o++)r=r>>>8^n[(r^e[o])&255];return r^-1},Ke=lv,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"},on={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:uv,_tr_stored_block:Fu,_tr_flush_block:pv,_tr_tally:ei,_tr_align:fv}=av,{Z_NO_FLUSH:ti,Z_PARTIAL_FLUSH:dv,Z_FULL_FLUSH:hv,Z_FINISH:Ut,Z_BLOCK:fh,Z_OK:at,Z_STREAM_END:dh,Z_STREAM_ERROR:lr,Z_DATA_ERROR:mv,Z_BUF_ERROR:pu,Z_DEFAULT_COMPRESSION:gv,Z_FILTERED:yv,Z_HUFFMAN_ONLY:Es,Z_RLE:vv,Z_FIXED:bv,Z_DEFAULT_STRATEGY:_v,Z_UNKNOWN:Sv,Z_DEFLATED:bc}=on,wv=9,Cv=15,Ev=8,xv=29,Av=256,Mu=Av+1+xv,kv=30,Tv=19,Iv=2*Mu+1,Ov=15,ce=3,Kr=258,ur=Kr+ce+1,Dv=32,zn=42,np=57,Uu=69,ju=73,qu=91,Bu=103,qi=113,Wa=666,mt=1,ea=2,Ji=3,ta=4,Nv=3,Bi=(r,e)=>(r.msg=Zi[e],e),hh=r=>r*2-(r>4?9:0),Gr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},Rv=r=>{let e,t,i,n=r.w_size;e=r.hash_size,i=e;do t=r.head[--i],r.head[i]=t>=n?t-n:0;while(--e);e=n,i=e;do t=r.prev[--i],r.prev[i]=t>=n?t-n:0;while(--e)},$v=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,ri=$v,At=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Tt=(r,e)=>{pv(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,At(r.strm)},be=(r,e)=>{r.pending_buf[r.pending++]=e},Da=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Vu=(r,e,t,i)=>{let n=r.avail_in;return n>i&&(n=i),n===0?0:(r.avail_in-=n,e.set(r.input.subarray(r.next_in,r.next_in+n),t),r.state.wrap===1?r.adler=po(r.adler,e,n,t):r.state.wrap===2&&(r.adler=Ke(r.adler,e,n,t)),r.next_in+=n,r.total_in+=n,n)},q1=(r,e)=>{let t=r.max_chain_length,i=r.strstart,n,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-ur?r.strstart-(r.w_size-ur):0,l=r.window,u=r.w_mask,d=r.prev,f=r.strstart+Kr,p=l[i+o-1],h=l[i+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(n=e,!(l[n+o]!==h||l[n+o-1]!==p||l[n]!==l[i]||l[++n]!==l[i+1])){i+=2,n++;do;while(l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&l[++i]===l[++n]&&i<f);if(a=Kr-(f-i),i=f-Kr,a>o){if(r.match_start=e,o=a,a>=s)break;p=l[i+o-1],h=l[i+o]}}while((e=d[e&u])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Wn=r=>{let e=r.w_size,t,i,n;do{if(i=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-ur)&&(r.window.set(r.window.subarray(e,e+e-i),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),Rv(r),i+=e),r.strm.avail_in===0)break;if(t=Vu(r.strm,r.window,r.strstart+r.lookahead,i),r.lookahead+=t,r.lookahead+r.insert>=ce)for(n=r.strstart-r.insert,r.ins_h=r.window[n],r.ins_h=ri(r,r.ins_h,r.window[n+1]);r.insert&&(r.ins_h=ri(r,r.ins_h,r.window[n+ce-1]),r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,r.insert--,!(r.lookahead+r.insert<ce)););}while(r.lookahead<ur&&r.strm.avail_in!==0)},B1=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,i,n,a,o=0,s=r.strm.avail_in;do{if(i=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,n=r.strstart-r.block_start,i>n+r.strm.avail_in&&(i=n+r.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==Ut||e===ti||i!==n+r.strm.avail_in)))break;o=e===Ut&&i===n+r.strm.avail_in?1:0,Fu(r,0,0,o),r.pending_buf[r.pending-4]=i,r.pending_buf[r.pending-3]=i>>8,r.pending_buf[r.pending-2]=~i,r.pending_buf[r.pending-1]=~i>>8,At(r.strm),n&&(n>i&&(n=i),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,i-=n),i&&(Vu(r.strm,r.strm.output,r.strm.next_out,i),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?ta:e!==ti&&e!==Ut&&r.strm.avail_in===0&&r.strstart===r.block_start?ea:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(Vu(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,n=r.strstart-r.block_start,(n>=t||(n||e===Ut)&&e!==ti&&r.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Ut&&r.strm.avail_in===0&&i===n?1:0,Fu(r,r.block_start,i,o),r.block_start+=i,At(r.strm)),o?Ji:mt)},fu=(r,e)=>{let t,i;for(;;){if(r.lookahead<ur){if(Wn(r),r.lookahead<ur&&e===ti)return mt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ce&&(r.ins_h=ri(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-ur&&(r.match_length=q1(r,t)),r.match_length>=ce)if(i=ei(r,r.strstart-r.match_start,r.match_length-ce),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ce){r.match_length--;do r.strstart++,r.ins_h=ri(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=ri(r,r.ins_h,r.window[r.strstart+1]);else i=ei(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(i&&(Tt(r,!1),r.strm.avail_out===0))return mt}return r.insert=r.strstart<ce-1?r.strstart:ce-1,e===Ut?(Tt(r,!0),r.strm.avail_out===0?Ji:ta):r.sym_next&&(Tt(r,!1),r.strm.avail_out===0)?mt:ea},$n=(r,e)=>{let t,i,n;for(;;){if(r.lookahead<ur){if(Wn(r),r.lookahead<ur&&e===ti)return mt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ce&&(r.ins_h=ri(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=ce-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-ur&&(r.match_length=q1(r,t),r.match_length<=5&&(r.strategy===yv||r.match_length===ce&&r.strstart-r.match_start>4096)&&(r.match_length=ce-1)),r.prev_length>=ce&&r.match_length<=r.prev_length){n=r.strstart+r.lookahead-ce,i=ei(r,r.strstart-1-r.prev_match,r.prev_length-ce),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=n&&(r.ins_h=ri(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=ce-1,r.strstart++,i&&(Tt(r,!1),r.strm.avail_out===0))return mt}else if(r.match_available){if(i=ei(r,0,r.window[r.strstart-1]),i&&Tt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return mt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(i=ei(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ce-1?r.strstart:ce-1,e===Ut?(Tt(r,!0),r.strm.avail_out===0?Ji:ta):r.sym_next&&(Tt(r,!1),r.strm.avail_out===0)?mt:ea},Pv=(r,e)=>{let t,i,n,a,o=r.window;for(;;){if(r.lookahead<=Kr){if(Wn(r),r.lookahead<=Kr&&e===ti)return mt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ce&&r.strstart>0&&(n=r.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=r.strstart+Kr;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);r.match_length=Kr-(a-n),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ce?(t=ei(r,1,r.match_length-ce),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=ei(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(Tt(r,!1),r.strm.avail_out===0))return mt}return r.insert=0,e===Ut?(Tt(r,!0),r.strm.avail_out===0?Ji:ta):r.sym_next&&(Tt(r,!1),r.strm.avail_out===0)?mt:ea},Lv=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Wn(r),r.lookahead===0)){if(e===ti)return mt;break}if(r.match_length=0,t=ei(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(Tt(r,!1),r.strm.avail_out===0))return mt}return r.insert=0,e===Ut?(Tt(r,!0),r.strm.avail_out===0?Ji:ta):r.sym_next&&(Tt(r,!1),r.strm.avail_out===0)?mt:ea};function rr(r,e,t,i,n){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=n}var Ha=[new rr(0,0,0,0,B1),new rr(4,4,8,4,fu),new rr(4,5,16,8,fu),new rr(4,6,32,32,fu),new rr(4,4,16,16,$n),new rr(8,16,32,32,$n),new rr(8,16,128,128,$n),new rr(8,32,128,256,$n),new rr(32,128,258,1024,$n),new rr(32,258,258,4096,$n)],Fv=r=>{r.window_size=2*r.w_size,Gr(r.head),r.max_lazy_match=Ha[r.level].max_lazy,r.good_match=Ha[r.level].good_length,r.nice_match=Ha[r.level].nice_length,r.max_chain_length=Ha[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ce-1,r.match_available=0,r.ins_h=0};function Mv(){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=bc,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(Iv*2),this.dyn_dtree=new Uint16Array((2*kv+1)*2),this.bl_tree=new Uint16Array((2*Tv+1)*2),Gr(this.dyn_ltree),Gr(this.dyn_dtree),Gr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Ov+1),this.heap=new Uint16Array(2*Mu+1),Gr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Mu+1),Gr(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 So=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==zn&&e.status!==np&&e.status!==Uu&&e.status!==ju&&e.status!==qu&&e.status!==Bu&&e.status!==qi&&e.status!==Wa?1:0},V1=r=>{if(So(r))return Bi(r,lr);r.total_in=r.total_out=0,r.data_type=Sv;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?np:e.wrap?zn:qi,r.adler=e.wrap===2?0:1,e.last_flush=-2,uv(e),at},Q1=r=>{let e=V1(r);return e===at&&Fv(r.state),e},Uv=(r,e)=>So(r)||r.state.wrap!==2?lr:(r.state.gzhead=e,at),z1=(r,e,t,i,n,a)=>{if(!r)return lr;let o=1;if(e===gv&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>wv||t!==bc||i<8||i>15||e<0||e>9||a<0||a>bv||i===8&&o!==1)return Bi(r,lr);i===8&&(i=9);let s=new Mv;return r.state=s,s.strm=r,s.status=zn,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ce-1)/ce),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,Q1(r)},jv=(r,e)=>z1(r,e,bc,Cv,Ev,_v),qv=(r,e)=>{if(So(r)||e>fh||e<0)return r?Bi(r,lr):lr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Wa&&e!==Ut)return Bi(r,r.avail_out===0?pu:lr);let i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(At(r),r.avail_out===0)return t.last_flush=-1,at}else if(r.avail_in===0&&hh(e)<=hh(i)&&e!==Ut)return Bi(r,pu);if(t.status===Wa&&r.avail_in!==0)return Bi(r,pu);if(t.status===zn&&t.wrap===0&&(t.status=qi),t.status===zn){let n=bc+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Es||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Dv),n+=31-n%31,Da(t,n),t.strstart!==0&&(Da(t,r.adler>>>16),Da(t,r.adler&65535)),r.adler=1,t.status=qi,At(r),t.pending!==0)return t.last_flush=-1,at}if(t.status===np){if(r.adler=0,be(t,31),be(t,139),be(t,8),t.gzhead)be(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)),be(t,t.gzhead.time&255),be(t,t.gzhead.time>>8&255),be(t,t.gzhead.time>>16&255),be(t,t.gzhead.time>>24&255),be(t,t.level===9?2:t.strategy>=Es||t.level<2?4:0),be(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(be(t,t.gzhead.extra.length&255),be(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ke(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Uu;else if(be(t,0),be(t,0),be(t,0),be(t,0),be(t,0),be(t,t.level===9?2:t.strategy>=Es||t.level<2?4:0),be(t,Nv),t.status=qi,At(r),t.pending!==0)return t.last_flush=-1,at}if(t.status===Uu){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 s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=s,At(r),t.pending!==0)return t.last_flush=-1,at;n=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=ju}if(t.status===ju){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),At(r),t.pending!==0)return t.last_flush=-1,at;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,be(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=qu}if(t.status===qu){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n)),At(r),t.pending!==0)return t.last_flush=-1,at;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,be(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ke(r.adler,t.pending_buf,t.pending-n,n))}t.status=Bu}if(t.status===Bu){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(At(r),t.pending!==0))return t.last_flush=-1,at;be(t,r.adler&255),be(t,r.adler>>8&255),r.adler=0}if(t.status=qi,At(r),t.pending!==0)return t.last_flush=-1,at}if(r.avail_in!==0||t.lookahead!==0||e!==ti&&t.status!==Wa){let n=t.level===0?B1(t,e):t.strategy===Es?Lv(t,e):t.strategy===vv?Pv(t,e):Ha[t.level].func(t,e);if((n===Ji||n===ta)&&(t.status=Wa),n===mt||n===Ji)return r.avail_out===0&&(t.last_flush=-1),at;if(n===ea&&(e===dv?fv(t):e!==fh&&(Fu(t,0,0,!1),e===hv&&(Gr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),At(r),r.avail_out===0))return t.last_flush=-1,at}return e!==Ut?at:t.wrap<=0?dh:(t.wrap===2?(be(t,r.adler&255),be(t,r.adler>>8&255),be(t,r.adler>>16&255),be(t,r.adler>>24&255),be(t,r.total_in&255),be(t,r.total_in>>8&255),be(t,r.total_in>>16&255),be(t,r.total_in>>24&255)):(Da(t,r.adler>>>16),Da(t,r.adler&65535)),At(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?at:dh)},Bv=r=>{if(So(r))return lr;let e=r.state.status;return r.state=null,e===qi?Bi(r,mv):at},Vv=(r,e)=>{let t=e.length;if(So(r))return lr;let i=r.state,n=i.wrap;if(n===2||n===1&&i.status!==zn||i.lookahead)return lr;if(n===1&&(r.adler=po(r.adler,e,t,0)),i.wrap=0,t>=i.w_size){n===0&&(Gr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(t-i.w_size,t),0),e=c,t=i.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,Wn(i);i.lookahead>=ce;){let c=i.strstart,l=i.lookahead-(ce-1);do i.ins_h=ri(i,i.ins_h,i.window[c+ce-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--l);i.strstart=c,i.lookahead=ce-1,Wn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=ce-1,i.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,i.wrap=n,at},Qv=jv,zv=z1,Wv=Q1,Hv=V1,Gv=Uv,Kv=qv,Zv=Bv,Jv=Vv,Yv="pako deflate (from Nodeca project)",eo={deflateInit:Qv,deflateInit2:zv,deflateReset:Wv,deflateResetKeep:Hv,deflateSetHeader:Gv,deflate:Kv,deflateEnd:Zv,deflateSetDictionary:Jv,deflateInfo:Yv},Xv=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),e2=function(r){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 i in t)Xv(t,i)&&(r[i]=t[i])}}return r},t2=r=>{let e=0;for(let i=0,n=r.length;i<n;i++)e+=r[i].length;let t=new Uint8Array(e);for(let i=0,n=0,a=r.length;i<a;i++){let o=r[i];t.set(o,n),n+=o.length}return t},_c={assign:e2,flattenChunks:t2},W1=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){W1=!1}var fo=new Uint8Array(256);for(let r=0;r<256;r++)fo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;fo[254]=fo[254]=1;var r2=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,i,n,a,o=r.length,s=0;for(n=0;n<o;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-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},i2=(r,e)=>{if(e<65534&&r.subarray&&W1)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(r[i]);return t},n2=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let i,n,a=new Array(t*2);for(n=0,i=0;i<t;){let o=r[i++];if(o<128){a[n++]=o;continue}let s=fo[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<t;)o=o<<6|r[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return i2(a,n)},a2=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+fo[r[t]]>e?t:e},ho={string2buf:r2,buf2string:n2,utf8border:a2};function o2(){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 H1=o2,G1=Object.prototype.toString,{Z_NO_FLUSH:s2,Z_SYNC_FLUSH:c2,Z_FULL_FLUSH:l2,Z_FINISH:u2,Z_OK:sc,Z_STREAM_END:p2,Z_DEFAULT_COMPRESSION:f2,Z_DEFAULT_STRATEGY:d2,Z_DEFLATED:h2}=on;function wo(r){this.options=_c.assign({level:f2,method:h2,chunkSize:16384,windowBits:15,memLevel:8,strategy:d2},r||{});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 H1,this.strm.avail_out=0;let t=eo.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==sc)throw new Error(Zi[t]);if(e.header&&eo.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=ho.string2buf(e.dictionary):G1.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=eo.deflateSetDictionary(this.strm,i),t!==sc)throw new Error(Zi[t]);this._dict_set=!0}}wo.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?u2:s2,typeof r=="string"?t.input=ho.string2buf(r):G1.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===c2||a===l2)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=eo.deflate(t,a),n===p2)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=eo.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===sc;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};wo.prototype.onData=function(r){this.chunks.push(r)};wo.prototype.onEnd=function(r){r===sc&&(this.result=_c.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ap(r,e){let t=new wo(e);if(t.push(r,!0),t.err)throw t.msg||Zi[t.err];return t.result}function m2(r,e){return e=e||{},e.raw=!0,ap(r,e)}function g2(r,e){return e=e||{},e.gzip=!0,ap(r,e)}var y2=wo,v2=ap,b2=m2,_2=g2,S2=on,w2={Deflate:y2,deflate:v2,deflateRaw:b2,gzip:_2,constants:S2},xs=16209,C2=16191,E2=function r(e,t){let i,n,a,o,s,c,l,u,d,f,p,h,m,v,w,b,S,_,T,R,A,N,L,P,j=e.state;i=e.next_in,L=e.input,n=i+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=j.dmax,l=j.wsize,u=j.whave,d=j.wnext,f=j.window,p=j.hold,h=j.bits,m=j.lencode,v=j.distcode,w=(1<<j.lenbits)-1,b=(1<<j.distbits)-1;e:do{h<15&&(p+=L[i++]<<h,h+=8,p+=L[i++]<<h,h+=8),S=m[p&w];t:for(;;){if(_=S>>>24,p>>>=_,h-=_,_=S>>>16&255,_===0)P[a++]=S&65535;else if(_&16){T=S&65535,_&=15,_&&(h<_&&(p+=L[i++]<<h,h+=8),T+=p&(1<<_)-1,p>>>=_,h-=_),h<15&&(p+=L[i++]<<h,h+=8,p+=L[i++]<<h,h+=8),S=v[p&b];r:for(;;){if(_=S>>>24,p>>>=_,h-=_,_=S>>>16&255,_&16){if(R=S&65535,_&=15,h<_&&(p+=L[i++]<<h,h+=8,h<_&&(p+=L[i++]<<h,h+=8)),R+=p&(1<<_)-1,R>c){e.msg="invalid distance too far back",j.mode=xs;break e}if(p>>>=_,h-=_,_=a-o,R>_){if(_=R-_,_>u&&j.sane){e.msg="invalid distance too far back",j.mode=xs;break e}if(A=0,N=f,d===0){if(A+=l-_,_<T){T-=_;do P[a++]=f[A++];while(--_);A=a-R,N=P}}else if(d<_){if(A+=l+d-_,_-=d,_<T){T-=_;do P[a++]=f[A++];while(--_);if(A=0,d<T){_=d,T-=_;do P[a++]=f[A++];while(--_);A=a-R,N=P}}}else if(A+=d-_,_<T){T-=_;do P[a++]=f[A++];while(--_);A=a-R,N=P}for(;T>2;)P[a++]=N[A++],P[a++]=N[A++],P[a++]=N[A++],T-=3;T&&(P[a++]=N[A++],T>1&&(P[a++]=N[A++]))}else{A=a-R;do P[a++]=P[A++],P[a++]=P[A++],P[a++]=P[A++],T-=3;while(T>2);T&&(P[a++]=P[A++],T>1&&(P[a++]=P[A++]))}}else if((_&64)===0){S=v[(S&65535)+(p&(1<<_)-1)];continue r}else{e.msg="invalid distance code",j.mode=xs;break e}break}}else if((_&64)===0){S=m[(S&65535)+(p&(1<<_)-1)];continue t}else if(_&32){j.mode=C2;break e}else{e.msg="invalid literal/length code",j.mode=xs;break e}break}}while(i<n&&a<s);T=h>>3,i-=T,h-=T<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),j.hold=p,j.bits=h},Pn=15,mh=852,gh=592,yh=0,du=1,vh=2,x2=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]),A2=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]),k2=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]),T2=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]),I2=(r,e,t,i,n,a,o,s)=>{let c=s.bits,l=0,u=0,d=0,f=0,p=0,h=0,m=0,v=0,w=0,b=0,S,_,T,R,A,N=null,L,P=new Uint16Array(Pn+1),j=new Uint16Array(Pn+1),ye=null,je,G,Ce;for(l=0;l<=Pn;l++)P[l]=0;for(u=0;u<i;u++)P[e[t+u]]++;for(p=c,f=Pn;f>=1&&P[f]===0;f--);if(p>f&&(p=f),f===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&P[d]===0;d++);for(p<d&&(p=d),v=1,l=1;l<=Pn;l++)if(v<<=1,v-=P[l],v<0)return-1;if(v>0&&(r===yh||f!==1))return-1;for(j[1]=0,l=1;l<Pn;l++)j[l+1]=j[l]+P[l];for(u=0;u<i;u++)e[t+u]!==0&&(o[j[e[t+u]]++]=u);if(r===yh?(N=ye=o,L=20):r===du?(N=x2,ye=A2,L=257):(N=k2,ye=T2,L=0),b=0,u=0,l=d,A=a,h=p,m=0,T=-1,w=1<<p,R=w-1,r===du&&w>mh||r===vh&&w>gh)return 1;for(;;){je=l-m,o[u]+1<L?(G=0,Ce=o[u]):o[u]>=L?(G=ye[o[u]-L],Ce=N[o[u]-L]):(G=32+64,Ce=0),S=1<<l-m,_=1<<h,d=_;do _-=S,n[A+(b>>m)+_]=je<<24|G<<16|Ce|0;while(_!==0);for(S=1<<l-1;b&S;)S>>=1;if(S!==0?(b&=S-1,b+=S):b=0,u++,--P[l]===0){if(l===f)break;l=e[t+o[u]]}if(l>p&&(b&R)!==T){for(m===0&&(m=p),A+=d,h=l-m,v=1<<h;h+m<f&&(v-=P[h+m],!(v<=0));)h++,v<<=1;if(w+=1<<h,r===du&&w>mh||r===vh&&w>gh)return 1;T=b&R,n[T]=p<<24|h<<16|A-a|0}}return b!==0&&(n[A+b]=l-m<<24|64<<16|0),s.bits=p,0},to=I2,O2=0,K1=1,Z1=2,{Z_FINISH:bh,Z_BLOCK:D2,Z_TREES:As,Z_OK:Yi,Z_STREAM_END:N2,Z_NEED_DICT:R2,Z_STREAM_ERROR:jt,Z_DATA_ERROR:J1,Z_MEM_ERROR:Y1,Z_BUF_ERROR:$2,Z_DEFLATED:_h}=on,Sc=16180,Sh=16181,wh=16182,Ch=16183,Eh=16184,xh=16185,Ah=16186,kh=16187,Th=16188,Ih=16189,cc=16190,_r=16191,hu=16192,Oh=16193,mu=16194,Dh=16195,Nh=16196,Rh=16197,$h=16198,ks=16199,Ts=16200,Ph=16201,Lh=16202,Fh=16203,Mh=16204,Uh=16205,gu=16206,jh=16207,qh=16208,Oe=16209,X1=16210,em=16211,P2=852,L2=592,F2=15,M2=F2,Bh=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function U2(){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 sn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Sc||e.mode>em?1:0},tm=r=>{if(sn(r))return jt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=Sc,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(P2),e.distcode=e.distdyn=new Int32Array(L2),e.sane=1,e.back=-1,Yi},rm=r=>{if(sn(r))return jt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,tm(r)},im=(r,e)=>{let t;if(sn(r))return jt;let i=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?jt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,rm(r))},nm=(r,e)=>{if(!r)return jt;let t=new U2;r.state=t,t.strm=r,t.window=null,t.mode=Sc;let i=im(r,e);return i!==Yi&&(r.state=null),i},j2=r=>nm(r,M2),Vh=!0,yu,vu,q2=r=>{if(Vh){yu=new Int32Array(512),vu=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(to(K1,r.lens,0,288,yu,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;to(Z1,r.lens,0,32,vu,0,r.work,{bits:5}),Vh=!1}r.lencode=yu,r.lenbits=9,r.distcode=vu,r.distbits=5},am=(r,e,t,i)=>{let n,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=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>i&&(n=i),a.window.set(e.subarray(t-i,t-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},B2=(r,e)=>{let t,i,n,a,o,s,c,l,u,d,f,p,h,m,v=0,w,b,S,_,T,R,A,N,L=new Uint8Array(4),P,j,ye=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(sn(r)||!r.output||!r.input&&r.avail_in!==0)return jt;t=r.state,t.mode===_r&&(t.mode=hu),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,l=t.hold,u=t.bits,d=s,f=c,N=Yi;e:for(;;)switch(t.mode){case Sc:if(t.wrap===0){t.mode=hu;break}for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&2&&l===35615){t.wbits===0&&(t.wbits=15),t.check=0,L[0]=l&255,L[1]=l>>>8&255,t.check=Ke(t.check,L,2,0),l=0,u=0,t.mode=Sh;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((l&255)<<8)+(l>>8))%31){r.msg="incorrect header check",t.mode=Oe;break}if((l&15)!==_h){r.msg="unknown compression method",t.mode=Oe;break}if(l>>>=4,u-=4,A=(l&15)+8,t.wbits===0&&(t.wbits=A),A>15||A>t.wbits){r.msg="invalid window size",t.mode=Oe;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=l&512?Ih:_r,l=0,u=0;break;case Sh:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.flags=l,(t.flags&255)!==_h){r.msg="unknown compression method",t.mode=Oe;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=Oe;break}t.head&&(t.head.text=l>>8&1),t.flags&512&&t.wrap&4&&(L[0]=l&255,L[1]=l>>>8&255,t.check=Ke(t.check,L,2,0)),l=0,u=0,t.mode=wh;case wh:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.head&&(t.head.time=l),t.flags&512&&t.wrap&4&&(L[0]=l&255,L[1]=l>>>8&255,L[2]=l>>>16&255,L[3]=l>>>24&255,t.check=Ke(t.check,L,4,0)),l=0,u=0,t.mode=Ch;case Ch:for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.head&&(t.head.xflags=l&255,t.head.os=l>>8),t.flags&512&&t.wrap&4&&(L[0]=l&255,L[1]=l>>>8&255,t.check=Ke(t.check,L,2,0)),l=0,u=0,t.mode=Eh;case Eh:if(t.flags&1024){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.length=l,t.head&&(t.head.extra_len=l),t.flags&512&&t.wrap&4&&(L[0]=l&255,L[1]=l>>>8&255,t.check=Ke(t.check,L,2,0)),l=0,u=0}else t.head&&(t.head.extra=null);t.mode=xh;case xh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(A=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+p),A)),t.flags&512&&t.wrap&4&&(t.check=Ke(t.check,i,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=Ah;case Ah:if(t.flags&2048){if(s===0)break e;p=0;do A=i[a+p++],t.head&&A&&t.length<65536&&(t.head.name+=String.fromCharCode(A));while(A&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ke(t.check,i,p,a)),s-=p,a+=p,A)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=kh;case kh:if(t.flags&4096){if(s===0)break e;p=0;do A=i[a+p++],t.head&&A&&t.length<65536&&(t.head.comment+=String.fromCharCode(A));while(A&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ke(t.check,i,p,a)),s-=p,a+=p,A)break e}else t.head&&(t.head.comment=null);t.mode=Th;case Th:if(t.flags&512){for(;u<16;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.check&65535)){r.msg="header crc mismatch",t.mode=Oe;break}l=0,u=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=_r;break;case Ih:for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}r.adler=t.check=Bh(l),l=0,u=0,t.mode=cc;case cc:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,R2;r.adler=t.check=1,t.mode=_r;case _r:if(e===D2||e===As)break e;case hu:if(t.last){l>>>=u&7,u-=u&7,t.mode=gu;break}for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}switch(t.last=l&1,l>>>=1,u-=1,l&3){case 0:t.mode=Oh;break;case 1:if(q2(t),t.mode=ks,e===As){l>>>=2,u-=2;break e}break;case 2:t.mode=Nh;break;case 3:r.msg="invalid block type",t.mode=Oe}l>>>=2,u-=2;break;case Oh:for(l>>>=u&7,u-=u&7;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((l&65535)!==(l>>>16^65535)){r.msg="invalid stored block lengths",t.mode=Oe;break}if(t.length=l&65535,l=0,u=0,t.mode=mu,e===As)break e;case mu:t.mode=Dh;case Dh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=_r;break;case Nh:for(;u<14;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.nlen=(l&31)+257,l>>>=5,u-=5,t.ndist=(l&31)+1,l>>>=5,u-=5,t.ncode=(l&15)+4,l>>>=4,u-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=Oe;break}t.have=0,t.mode=Rh;case Rh:for(;t.have<t.ncode;){for(;u<3;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.lens[ye[t.have++]]=l&7,l>>>=3,u-=3}for(;t.have<19;)t.lens[ye[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,P={bits:t.lenbits},N=to(O2,t.lens,0,19,t.lencode,0,t.work,P),t.lenbits=P.bits,N){r.msg="invalid code lengths set",t.mode=Oe;break}t.have=0,t.mode=$h;case $h:for(;t.have<t.nlen+t.ndist;){for(;v=t.lencode[l&(1<<t.lenbits)-1],w=v>>>24,b=v>>>16&255,S=v&65535,!(w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(S<16)l>>>=w,u-=w,t.lens[t.have++]=S;else{if(S===16){for(j=w+2;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(l>>>=w,u-=w,t.have===0){r.msg="invalid bit length repeat",t.mode=Oe;break}A=t.lens[t.have-1],p=3+(l&3),l>>>=2,u-=2}else if(S===17){for(j=w+3;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=w,u-=w,A=0,p=3+(l&7),l>>>=3,u-=3}else{for(j=w+7;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=w,u-=w,A=0,p=11+(l&127),l>>>=7,u-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Oe;break}for(;p--;)t.lens[t.have++]=A}}if(t.mode===Oe)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=Oe;break}if(t.lenbits=9,P={bits:t.lenbits},N=to(K1,t.lens,0,t.nlen,t.lencode,0,t.work,P),t.lenbits=P.bits,N){r.msg="invalid literal/lengths set",t.mode=Oe;break}if(t.distbits=6,t.distcode=t.distdyn,P={bits:t.distbits},N=to(Z1,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,P),t.distbits=P.bits,N){r.msg="invalid distances set",t.mode=Oe;break}if(t.mode=ks,e===As)break e;case ks:t.mode=Ts;case Ts:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,E2(r,f),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,l=t.hold,u=t.bits,t.mode===_r&&(t.back=-1);break}for(t.back=0;v=t.lencode[l&(1<<t.lenbits)-1],w=v>>>24,b=v>>>16&255,S=v&65535,!(w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(b&&(b&240)===0){for(_=w,T=b,R=S;v=t.lencode[R+((l&(1<<_+T)-1)>>_)],w=v>>>24,b=v>>>16&255,S=v&65535,!(_+w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=_,u-=_,t.back+=_}if(l>>>=w,u-=w,t.back+=w,t.length=S,b===0){t.mode=Uh;break}if(b&32){t.back=-1,t.mode=_r;break}if(b&64){r.msg="invalid literal/length code",t.mode=Oe;break}t.extra=b&15,t.mode=Ph;case Ph:if(t.extra){for(j=t.extra;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.length+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Lh;case Lh:for(;v=t.distcode[l&(1<<t.distbits)-1],w=v>>>24,b=v>>>16&255,S=v&65535,!(w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if((b&240)===0){for(_=w,T=b,R=S;v=t.distcode[R+((l&(1<<_+T)-1)>>_)],w=v>>>24,b=v>>>16&255,S=v&65535,!(_+w<=u);){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}l>>>=_,u-=_,t.back+=_}if(l>>>=w,u-=w,t.back+=w,b&64){r.msg="invalid distance code",t.mode=Oe;break}t.offset=S,t.extra=b&15,t.mode=Fh;case Fh:if(t.extra){for(j=t.extra;u<j;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}t.offset+=l&(1<<t.extra)-1,l>>>=t.extra,u-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=Oe;break}t.mode=Mh;case Mh:if(c===0)break e;if(p=f-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Oe;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=n,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do n[o++]=m[h++];while(--p);t.length===0&&(t.mode=Ts);break;case Uh:if(c===0)break e;n[o++]=t.length,c--,t.mode=Ts;break;case gu:if(t.wrap){for(;u<32;){if(s===0)break e;s--,l|=i[a++]<<u,u+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ke(t.check,n,f,o-f):po(t.check,n,f,o-f)),f=c,t.wrap&4&&(t.flags?l:Bh(l))!==t.check){r.msg="incorrect data check",t.mode=Oe;break}l=0,u=0}t.mode=jh;case jh:if(t.wrap&&t.flags){for(;u<32;){if(s===0)break e;s--,l+=i[a++]<<u,u+=8}if(t.wrap&4&&l!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=Oe;break}l=0,u=0}t.mode=qh;case qh:N=N2;break e;case Oe:N=J1;break e;case X1:return Y1;case em:default:return jt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=l,t.bits=u,(t.wsize||f!==r.avail_out&&t.mode<Oe&&(t.mode<gu||e!==bh))&&am(r,r.output,r.next_out,f-r.avail_out),d-=r.avail_in,f-=r.avail_out,r.total_in+=d,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ke(t.check,n,f,r.next_out-f):po(t.check,n,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===_r?128:0)+(t.mode===ks||t.mode===mu?256:0),(d===0&&f===0||e===bh)&&N===Yi&&(N=$2),N},V2=r=>{if(sn(r))return jt;let e=r.state;return e.window&&(e.window=null),r.state=null,Yi},Q2=(r,e)=>{if(sn(r))return jt;let t=r.state;return(t.wrap&2)===0?jt:(t.head=e,e.done=!1,Yi)},z2=(r,e)=>{let t=e.length,i,n,a;return sn(r)||(i=r.state,i.wrap!==0&&i.mode!==cc)?jt:i.mode===cc&&(n=1,n=po(n,e,t,0),n!==i.check)?J1:(a=am(r,e,t,t),a?(i.mode=X1,Y1):(i.havedict=1,Yi))},W2=rm,H2=im,G2=tm,K2=j2,Z2=nm,J2=B2,Y2=V2,X2=Q2,e3=z2,t3="pako inflate (from Nodeca project)",xr={inflateReset:W2,inflateReset2:H2,inflateResetKeep:G2,inflateInit:K2,inflateInit2:Z2,inflate:J2,inflateEnd:Y2,inflateGetHeader:X2,inflateSetDictionary:e3,inflateInfo:t3};function r3(){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 i3=r3,om=Object.prototype.toString,{Z_NO_FLUSH:n3,Z_FINISH:a3,Z_OK:mo,Z_STREAM_END:bu,Z_NEED_DICT:_u,Z_STREAM_ERROR:o3,Z_DATA_ERROR:Qh,Z_MEM_ERROR:s3}=on;function Co(r){this.options=_c.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});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&&!(r&&r.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 H1,this.strm.avail_out=0;let t=xr.inflateInit2(this.strm,e.windowBits);if(t!==mo)throw new Error(Zi[t]);if(this.header=new i3,xr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=ho.string2buf(e.dictionary):om.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=xr.inflateSetDictionary(this.strm,e.dictionary),t!==mo)))throw new Error(Zi[t])}Co.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?a3:n3,om.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=xr.inflate(t,o),a===_u&&n&&(a=xr.inflateSetDictionary(t,n),a===mo?a=xr.inflate(t,o):a===Qh&&(a=_u));t.avail_in>0&&a===bu&&t.state.wrap>0&&r[t.next_in]!==0;)xr.inflateReset(t),a=xr.inflate(t,o);switch(a){case o3:case Qh:case _u:case s3:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===bu))if(this.options.to==="string"){let c=ho.utf8border(t.output,t.next_out),l=t.next_out-c,u=ho.buf2string(t.output,c);t.next_out=l,t.avail_out=i-l,l&&t.output.set(t.output.subarray(c,c+l),0),this.onData(u)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===mo&&s===0)){if(a===bu)return a=xr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Co.prototype.onData=function(r){this.chunks.push(r)};Co.prototype.onEnd=function(r){r===mo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=_c.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function op(r,e){let t=new Co(e);if(t.push(r),t.err)throw t.msg||Zi[t.err];return t.result}function c3(r,e){return e=e||{},e.raw=!0,op(r,e)}var l3=Co,u3=op,p3=c3,f3=op,d3=on,h3={Inflate:l3,inflate:u3,inflateRaw:p3,ungzip:f3,constants:d3},{Deflate:m3,deflate:g3,deflateRaw:y3,gzip:v3}=w2,{Inflate:b3,inflate:_3,inflateRaw:S3,ungzip:w3}=h3,C3=m3,E3=g3,x3=y3,A3=v3,k3=b3,T3=_3,I3=S3,O3=w3,D3=on,N3={Deflate:C3,deflate:E3,deflateRaw:x3,gzip:A3,Inflate:k3,inflate:T3,inflateRaw:I3,ungzip:O3,constants:D3},Ae=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ke=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},lc=class{constructor(e,t){this.input=e,this.output=t}};Ae([g(),ke("design:type",String)],lc.prototype,"input",void 0);Ae([g(),ke("design:type",String)],lc.prototype,"output",void 0);lc=Ae([Je(),ke("design:paramtypes",[String,String])],lc);var uc=class{constructor(e,t){this.input=e,this.output=t}};Ae([g(),ke("design:type",String)],uc.prototype,"input",void 0);Ae([g(),ke("design:type",String)],uc.prototype,"output",void 0);uc=Ae([K(),ke("design:paramtypes",[String,String])],uc);var oi=class{constructor(e,t,i,n,a){this.name=e,this.modelId=t,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};Ae([g(),ke("design:type",String)],oi.prototype,"name",void 0);Ae([g(),ke("design:type",String)],oi.prototype,"modelId",void 0);Ae([g(),ke("design:type",String)],oi.prototype,"systemPrompt",void 0);Ae([g(),ke("design:type",Array)],oi.prototype,"promptExamples",void 0);Ae([g(),ke("design:type",String)],oi.prototype,"metaData",void 0);oi=Ae([Je(),ke("design:paramtypes",[String,String,String,Array,String])],oi);var dr=class{constructor(e,t,i,n,a,o,s,c){this.name=e,this.modelId=t,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};Ae([g(),ke("design:type",String)],dr.prototype,"name",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"modelId",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"taskId",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"systemPrompt",void 0);Ae([g(),ke("design:type",Array)],dr.prototype,"promptExamples",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"metaData",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"createdAt",void 0);Ae([g(),ke("design:type",String)],dr.prototype,"updatedAt",void 0);dr=Ae([K(),ke("design:paramtypes",[String,String,String,String,Array,String,String,String])],dr);var Xi=class{constructor(e,t,i,n,a){this.model=e,this.status=t,this.progress=i,this.downloaded=n,this.loaded=a}};Ae([g(),ke("design:type",String)],Xi.prototype,"model",void 0);Ae([g(),ke("design:type",String)],Xi.prototype,"status",void 0);Ae([g(),ke("design:type",Number)],Xi.prototype,"progress",void 0);Ae([g(),ke("design:type",Boolean)],Xi.prototype,"downloaded",void 0);Ae([g(),ke("design:type",Boolean)],Xi.prototype,"loaded",void 0);Xi=Ae([K(),ke("design:paramtypes",[String,String,Number,Boolean,Boolean])],Xi);var R3=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},We=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ve,Bs,Qu=class{constructor(e,t=!0){Ve.set(this,void 0),Bs.set(this,new Map),R3(this,Ve,e,"f")}async getModels(){let e=await We(this,Ve,"f").query({query:E`
744
+ }`,variables:{url:e,interactionCall:t}}));return i}};Cr=new WeakMap;var bc={};bc.byteLength=O0;bc.toByteArray=N0;bc.fromByteArray=$0;var sr=[],Mt=[],I0=typeof Uint8Array<"u"?Uint8Array:Array,sl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Oi=0,oh=sl.length;Oi<oh;++Oi)sr[Oi]=sl[Oi],Mt[sl.charCodeAt(Oi)]=Oi;var Oi,oh;Mt["-".charCodeAt(0)]=62;Mt["_".charCodeAt(0)]=63;function k1(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function O0(r){var e=k1(r),t=e[0],i=e[1];return(t+i)*3/4-i}function D0(r,e,t){return(e+t)*3/4-t}function N0(r){var e,t=k1(r),i=t[0],n=t[1],a=new I0(D0(r,i,n)),o=0,s=n>0?i-4:i,c;for(c=0;c<s;c+=4)e=Mt[r.charCodeAt(c)]<<18|Mt[r.charCodeAt(c+1)]<<12|Mt[r.charCodeAt(c+2)]<<6|Mt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Mt[r.charCodeAt(c)]<<2|Mt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),n===1&&(e=Mt[r.charCodeAt(c)]<<10|Mt[r.charCodeAt(c+1)]<<4|Mt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function R0(r){return sr[r>>18&63]+sr[r>>12&63]+sr[r>>6&63]+sr[r&63]}function P0(r,e,t){for(var i,n=[],a=e;a<t;a+=3)i=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),n.push(R0(i));return n.join("")}function $0(r){for(var e,t=r.length,i=t%3,n=[],a=16383,o=0,s=t-i;o<s;o+=a)n.push(P0(r,o,o+a>s?s:o+a));return i===1?(e=r[t-1],n.push(sr[e>>2]+sr[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(sr[e>>10]+sr[e>>4&63]+sr[e<<2&63]+"=")),n.join("")}var L0=4,sh=0,ch=1,F0=2;function ta(r){let e=r.length;for(;--e>=0;)r[e]=0}var M0=0,T1=1,U0=2,j0=3,q0=258,tp=29,So=256,co=So+1+tp,Vn=30,rp=19,I1=2*co+1,qi=15,cl=16,B0=7,ip=256,O1=16,D1=17,N1=18,Ll=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]),Bs=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]),V0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),R1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Q0=512,xr=new Array((co+2)*2);ta(xr);var to=new Array(Vn*2);ta(to);var uo=new Array(Q0);ta(uo);var lo=new Array(q0-j0+1);ta(lo);var np=new Array(tp);ta(np);var sc=new Array(Vn);ta(sc);function ul(r,e,t,i,n){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=n,this.has_stree=r&&r.length}var P1,$1,L1;function ll(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var F1=r=>r<256?uo[r]:uo[256+(r>>>7)],po=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},Et=(r,e,t)=>{r.bi_valid>cl-t?(r.bi_buf|=e<<r.bi_valid&65535,po(r,r.bi_buf),r.bi_buf=e>>cl-r.bi_valid,r.bi_valid+=t-cl):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},cr=(r,e,t)=>{Et(r,t[e*2],t[e*2+1])},M1=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},z0=r=>{r.bi_valid===16?(po(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},W0=(r,e)=>{let t=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,d,f,p,h,m=0;for(f=0;f<=qi;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<I1;u++)l=r.heap[u],f=t[t[l*2+1]*2+1]+1,f>c&&(f=c,m++),t[l*2+1]=f,!(l>i)&&(r.bl_count[f]++,p=0,l>=s&&(p=o[l-s]),h=t[l*2],r.opt_len+=h*(f+p),a&&(r.static_len+=h*(n[l*2+1]+p)));if(m!==0){do{for(f=c-1;r.bl_count[f]===0;)f--;r.bl_count[f]--,r.bl_count[f+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(f=c;f!==0;f--)for(l=r.bl_count[f];l!==0;)d=r.heap[--u],!(d>i)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),l--)}},U1=(r,e,t)=>{let i=new Array(qi+1),n=0,a,o;for(a=1;a<=qi;a++)n=n+t[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=M1(i[s]++,s))}},H0=()=>{let r,e,t,i,n,a=new Array(qi+1);for(t=0,i=0;i<tp-1;i++)for(np[i]=t,r=0;r<1<<Ll[i];r++)lo[t++]=i;for(lo[t-1]=i,n=0,i=0;i<16;i++)for(sc[i]=n,r=0;r<1<<Bs[i];r++)uo[n++]=i;for(n>>=7;i<Vn;i++)for(sc[i]=n<<7,r=0;r<1<<Bs[i]-7;r++)uo[256+n++]=i;for(e=0;e<=qi;e++)a[e]=0;for(r=0;r<=143;)xr[r*2+1]=8,r++,a[8]++;for(;r<=255;)xr[r*2+1]=9,r++,a[9]++;for(;r<=279;)xr[r*2+1]=7,r++,a[7]++;for(;r<=287;)xr[r*2+1]=8,r++,a[8]++;for(U1(xr,co+1,a),r=0;r<Vn;r++)to[r*2+1]=5,to[r*2]=M1(r,5);P1=new ul(xr,Ll,So+1,co,qi),$1=new ul(to,Bs,0,Vn,qi),L1=new ul(new Array(0),V0,0,rp,B0)},j1=r=>{let e;for(e=0;e<co;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Vn;e++)r.dyn_dtree[e*2]=0;for(e=0;e<rp;e++)r.bl_tree[e*2]=0;r.dyn_ltree[ip*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},q1=r=>{r.bi_valid>8?po(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},uh=(r,e,t,i)=>{let n=e*2,a=t*2;return r[n]<r[a]||r[n]===r[a]&&i[e]<=i[t]},pl=(r,e,t)=>{let i=r.heap[t],n=t<<1;for(;n<=r.heap_len&&(n<r.heap_len&&uh(e,r.heap[n+1],r.heap[n],r.depth)&&n++,!uh(e,i,r.heap[n],r.depth));)r.heap[t]=r.heap[n],t=n,n<<=1;r.heap[t]=i},lh=(r,e,t)=>{let i,n,a=0,o,s;if(r.sym_next!==0)do i=r.pending_buf[r.sym_buf+a++]&255,i+=(r.pending_buf[r.sym_buf+a++]&255)<<8,n=r.pending_buf[r.sym_buf+a++],i===0?cr(r,n,e):(o=lo[n],cr(r,o+So+1,e),s=Ll[o],s!==0&&(n-=np[o],Et(r,n,s)),i--,o=F1(i),cr(r,o,t),s=Bs[o],s!==0&&(i-=sc[o],Et(r,i,s)));while(a<r.sym_next);cr(r,ip,e)},Fl=(r,e)=>{let t=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,u;for(r.heap_len=0,r.heap_max=I1,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)u=r.heap[++r.heap_len]=c<2?++c:0,t[u*2]=1,r.depth[u]=0,r.opt_len--,n&&(r.static_len-=i[u*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)pl(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],pl(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[u*2]=t[o*2]+t[s*2],r.depth[u]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=u,r.heap[1]=u++,pl(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],W0(r,e),U1(t,c,r.bl_count)},ph=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)&&(s<u?r.bl_tree[a*2]+=s:a!==0?(a!==n&&r.bl_tree[a*2]++,r.bl_tree[O1*2]++):s<=10?r.bl_tree[D1*2]++:r.bl_tree[N1*2]++,s=0,n=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},fh=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),i=0;i<=t;i++)if(a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)){if(s<u)do cr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==n&&(cr(r,a,r.bl_tree),s--),cr(r,O1,r.bl_tree),Et(r,s-3,2)):s<=10?(cr(r,D1,r.bl_tree),Et(r,s-3,3)):(cr(r,N1,r.bl_tree),Et(r,s-11,7));s=0,n=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},G0=r=>{let e;for(ph(r,r.dyn_ltree,r.l_desc.max_code),ph(r,r.dyn_dtree,r.d_desc.max_code),Fl(r,r.bl_desc),e=rp-1;e>=3&&r.bl_tree[R1[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},K0=(r,e,t,i)=>{let n;for(Et(r,e-257,5),Et(r,t-1,5),Et(r,i-4,4),n=0;n<i;n++)Et(r,r.bl_tree[R1[n]*2+1],3);fh(r,r.dyn_ltree,e-1),fh(r,r.dyn_dtree,t-1)},Z0=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return sh;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return ch;for(t=32;t<So;t++)if(r.dyn_ltree[t*2]!==0)return ch;return sh},dh=!1,J0=r=>{dh||(H0(),dh=!0),r.l_desc=new ll(r.dyn_ltree,P1),r.d_desc=new ll(r.dyn_dtree,$1),r.bl_desc=new ll(r.bl_tree,L1),r.bi_buf=0,r.bi_valid=0,j1(r)},B1=(r,e,t,i)=>{Et(r,(M0<<1)+(i?1:0),3),q1(r),po(r,t),po(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},Y0=r=>{Et(r,T1<<1,3),cr(r,ip,xr),z0(r)},X0=(r,e,t,i)=>{let n,a,o=0;r.level>0?(r.strm.data_type===F0&&(r.strm.data_type=Z0(r)),Fl(r,r.l_desc),Fl(r,r.d_desc),o=G0(r),n=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?B1(r,e,t,i):r.strategy===L0||a===n?(Et(r,(T1<<1)+(i?1:0),3),lh(r,xr,to)):(Et(r,(U0<<1)+(i?1:0),3),K0(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),lh(r,r.dyn_ltree,r.dyn_dtree)),j1(r),i&&q1(r)},ev=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(lo[t]+So+1)*2]++,r.dyn_dtree[F1(e)*2]++),r.sym_next===r.sym_end),tv=J0,rv=B1,iv=X0,nv=ev,av=Y0,ov={_tr_init:tv,_tr_stored_block:rv,_tr_flush_block:iv,_tr_tally:nv,_tr_align:av},sv=(r,e,t,i)=>{let n=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},fo=sv,cv=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var i=0;i<8;i++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},uv=new Uint32Array(cv()),lv=(r,e,t,i)=>{let n=uv,a=i+t;r^=-1;for(let o=i;o<a;o++)r=r>>>8^n[(r^e[o])&255];return r^-1},Ze=lv,Ji={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"},sn={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:pv,_tr_stored_block:Ml,_tr_flush_block:fv,_tr_tally:ti,_tr_align:dv}=ov,{Z_NO_FLUSH:ri,Z_PARTIAL_FLUSH:hv,Z_FULL_FLUSH:mv,Z_FINISH:jt,Z_BLOCK:hh,Z_OK:ot,Z_STREAM_END:mh,Z_STREAM_ERROR:lr,Z_DATA_ERROR:gv,Z_BUF_ERROR:fl,Z_DEFAULT_COMPRESSION:yv,Z_FILTERED:vv,Z_HUFFMAN_ONLY:xs,Z_RLE:bv,Z_FIXED:_v,Z_DEFAULT_STRATEGY:Sv,Z_UNKNOWN:wv,Z_DEFLATED:_c}=sn,Ev=9,Cv=15,xv=8,Av=29,kv=256,Ul=kv+1+Av,Tv=30,Iv=19,Ov=2*Ul+1,Dv=15,ce=3,Zr=258,pr=Zr+ce+1,Nv=32,Hn=42,ap=57,jl=69,ql=73,Bl=91,Vl=103,Bi=113,Ga=666,gt=1,ra=2,Yi=3,ia=4,Rv=3,Vi=(r,e)=>(r.msg=Ji[e],e),gh=r=>r*2-(r>4?9:0),Kr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},Pv=r=>{let e,t,i,n=r.w_size;e=r.hash_size,i=e;do t=r.head[--i],r.head[i]=t>=n?t-n:0;while(--e);e=n,i=e;do t=r.prev[--i],r.prev[i]=t>=n?t-n:0;while(--e)},$v=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,ii=$v,kt=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},It=(r,e)=>{fv(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,kt(r.strm)},be=(r,e)=>{r.pending_buf[r.pending++]=e},Ra=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Ql=(r,e,t,i)=>{let n=r.avail_in;return n>i&&(n=i),n===0?0:(r.avail_in-=n,e.set(r.input.subarray(r.next_in,r.next_in+n),t),r.state.wrap===1?r.adler=fo(r.adler,e,n,t):r.state.wrap===2&&(r.adler=Ze(r.adler,e,n,t)),r.next_in+=n,r.total_in+=n,n)},V1=(r,e)=>{let t=r.max_chain_length,i=r.strstart,n,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-pr?r.strstart-(r.w_size-pr):0,u=r.window,l=r.w_mask,d=r.prev,f=r.strstart+Zr,p=u[i+o-1],h=u[i+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(n=e,!(u[n+o]!==h||u[n+o-1]!==p||u[n]!==u[i]||u[++n]!==u[i+1])){i+=2,n++;do;while(u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&i<f);if(a=Zr-(f-i),i=f-Zr,a>o){if(r.match_start=e,o=a,a>=s)break;p=u[i+o-1],h=u[i+o]}}while((e=d[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Gn=r=>{let e=r.w_size,t,i,n;do{if(i=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-pr)&&(r.window.set(r.window.subarray(e,e+e-i),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),Pv(r),i+=e),r.strm.avail_in===0)break;if(t=Ql(r.strm,r.window,r.strstart+r.lookahead,i),r.lookahead+=t,r.lookahead+r.insert>=ce)for(n=r.strstart-r.insert,r.ins_h=r.window[n],r.ins_h=ii(r,r.ins_h,r.window[n+1]);r.insert&&(r.ins_h=ii(r,r.ins_h,r.window[n+ce-1]),r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,r.insert--,!(r.lookahead+r.insert<ce)););}while(r.lookahead<pr&&r.strm.avail_in!==0)},Q1=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,i,n,a,o=0,s=r.strm.avail_in;do{if(i=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,n=r.strstart-r.block_start,i>n+r.strm.avail_in&&(i=n+r.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==jt||e===ri||i!==n+r.strm.avail_in)))break;o=e===jt&&i===n+r.strm.avail_in?1:0,Ml(r,0,0,o),r.pending_buf[r.pending-4]=i,r.pending_buf[r.pending-3]=i>>8,r.pending_buf[r.pending-2]=~i,r.pending_buf[r.pending-1]=~i>>8,kt(r.strm),n&&(n>i&&(n=i),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,i-=n),i&&(Ql(r.strm,r.strm.output,r.strm.next_out,i),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?ia:e!==ri&&e!==jt&&r.strm.avail_in===0&&r.strstart===r.block_start?ra:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(Ql(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,n=r.strstart-r.block_start,(n>=t||(n||e===jt)&&e!==ri&&r.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===jt&&r.strm.avail_in===0&&i===n?1:0,Ml(r,r.block_start,i,o),r.block_start+=i,kt(r.strm)),o?Yi:gt)},dl=(r,e)=>{let t,i;for(;;){if(r.lookahead<pr){if(Gn(r),r.lookahead<pr&&e===ri)return gt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ce&&(r.ins_h=ii(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-pr&&(r.match_length=V1(r,t)),r.match_length>=ce)if(i=ti(r,r.strstart-r.match_start,r.match_length-ce),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ce){r.match_length--;do r.strstart++,r.ins_h=ii(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=ii(r,r.ins_h,r.window[r.strstart+1]);else i=ti(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(i&&(It(r,!1),r.strm.avail_out===0))return gt}return r.insert=r.strstart<ce-1?r.strstart:ce-1,e===jt?(It(r,!0),r.strm.avail_out===0?Yi:ia):r.sym_next&&(It(r,!1),r.strm.avail_out===0)?gt:ra},$n=(r,e)=>{let t,i,n;for(;;){if(r.lookahead<pr){if(Gn(r),r.lookahead<pr&&e===ri)return gt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ce&&(r.ins_h=ii(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=ce-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-pr&&(r.match_length=V1(r,t),r.match_length<=5&&(r.strategy===vv||r.match_length===ce&&r.strstart-r.match_start>4096)&&(r.match_length=ce-1)),r.prev_length>=ce&&r.match_length<=r.prev_length){n=r.strstart+r.lookahead-ce,i=ti(r,r.strstart-1-r.prev_match,r.prev_length-ce),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=n&&(r.ins_h=ii(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=ce-1,r.strstart++,i&&(It(r,!1),r.strm.avail_out===0))return gt}else if(r.match_available){if(i=ti(r,0,r.window[r.strstart-1]),i&&It(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return gt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(i=ti(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ce-1?r.strstart:ce-1,e===jt?(It(r,!0),r.strm.avail_out===0?Yi:ia):r.sym_next&&(It(r,!1),r.strm.avail_out===0)?gt:ra},Lv=(r,e)=>{let t,i,n,a,o=r.window;for(;;){if(r.lookahead<=Zr){if(Gn(r),r.lookahead<=Zr&&e===ri)return gt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ce&&r.strstart>0&&(n=r.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=r.strstart+Zr;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);r.match_length=Zr-(a-n),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ce?(t=ti(r,1,r.match_length-ce),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=ti(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(It(r,!1),r.strm.avail_out===0))return gt}return r.insert=0,e===jt?(It(r,!0),r.strm.avail_out===0?Yi:ia):r.sym_next&&(It(r,!1),r.strm.avail_out===0)?gt:ra},Fv=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Gn(r),r.lookahead===0)){if(e===ri)return gt;break}if(r.match_length=0,t=ti(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(It(r,!1),r.strm.avail_out===0))return gt}return r.insert=0,e===jt?(It(r,!0),r.strm.avail_out===0?Yi:ia):r.sym_next&&(It(r,!1),r.strm.avail_out===0)?gt:ra};function ir(r,e,t,i,n){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=n}var Ka=[new ir(0,0,0,0,Q1),new ir(4,4,8,4,dl),new ir(4,5,16,8,dl),new ir(4,6,32,32,dl),new ir(4,4,16,16,$n),new ir(8,16,32,32,$n),new ir(8,16,128,128,$n),new ir(8,32,128,256,$n),new ir(32,128,258,1024,$n),new ir(32,258,258,4096,$n)],Mv=r=>{r.window_size=2*r.w_size,Kr(r.head),r.max_lazy_match=Ka[r.level].max_lazy,r.good_match=Ka[r.level].good_length,r.nice_match=Ka[r.level].nice_length,r.max_chain_length=Ka[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ce-1,r.match_available=0,r.ins_h=0};function Uv(){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=_c,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(Ov*2),this.dyn_dtree=new Uint16Array((2*Tv+1)*2),this.bl_tree=new Uint16Array((2*Iv+1)*2),Kr(this.dyn_ltree),Kr(this.dyn_dtree),Kr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Dv+1),this.heap=new Uint16Array(2*Ul+1),Kr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Ul+1),Kr(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 wo=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Hn&&e.status!==ap&&e.status!==jl&&e.status!==ql&&e.status!==Bl&&e.status!==Vl&&e.status!==Bi&&e.status!==Ga?1:0},z1=r=>{if(wo(r))return Vi(r,lr);r.total_in=r.total_out=0,r.data_type=wv;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?ap:e.wrap?Hn:Bi,r.adler=e.wrap===2?0:1,e.last_flush=-2,pv(e),ot},W1=r=>{let e=z1(r);return e===ot&&Mv(r.state),e},jv=(r,e)=>wo(r)||r.state.wrap!==2?lr:(r.state.gzhead=e,ot),H1=(r,e,t,i,n,a)=>{if(!r)return lr;let o=1;if(e===yv&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>Ev||t!==_c||i<8||i>15||e<0||e>9||a<0||a>_v||i===8&&o!==1)return Vi(r,lr);i===8&&(i=9);let s=new Uv;return r.state=s,s.strm=r,s.status=Hn,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ce-1)/ce),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,W1(r)},qv=(r,e)=>H1(r,e,_c,Cv,xv,Sv),Bv=(r,e)=>{if(wo(r)||e>hh||e<0)return r?Vi(r,lr):lr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Ga&&e!==jt)return Vi(r,r.avail_out===0?fl:lr);let i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(kt(r),r.avail_out===0)return t.last_flush=-1,ot}else if(r.avail_in===0&&gh(e)<=gh(i)&&e!==jt)return Vi(r,fl);if(t.status===Ga&&r.avail_in!==0)return Vi(r,fl);if(t.status===Hn&&t.wrap===0&&(t.status=Bi),t.status===Hn){let n=_c+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=xs||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=Nv),n+=31-n%31,Ra(t,n),t.strstart!==0&&(Ra(t,r.adler>>>16),Ra(t,r.adler&65535)),r.adler=1,t.status=Bi,kt(r),t.pending!==0)return t.last_flush=-1,ot}if(t.status===ap){if(r.adler=0,be(t,31),be(t,139),be(t,8),t.gzhead)be(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)),be(t,t.gzhead.time&255),be(t,t.gzhead.time>>8&255),be(t,t.gzhead.time>>16&255),be(t,t.gzhead.time>>24&255),be(t,t.level===9?2:t.strategy>=xs||t.level<2?4:0),be(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(be(t,t.gzhead.extra.length&255),be(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ze(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=jl;else if(be(t,0),be(t,0),be(t,0),be(t,0),be(t,0),be(t,t.level===9?2:t.strategy>=xs||t.level<2?4:0),be(t,Rv),t.status=Bi,kt(r),t.pending!==0)return t.last_flush=-1,ot}if(t.status===jl){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 s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=s,kt(r),t.pending!==0)return t.last_flush=-1,ot;n=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=ql}if(t.status===ql){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),kt(r),t.pending!==0)return t.last_flush=-1,ot;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,be(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Bl}if(t.status===Bl){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n)),kt(r),t.pending!==0)return t.last_flush=-1,ot;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,be(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ze(r.adler,t.pending_buf,t.pending-n,n))}t.status=Vl}if(t.status===Vl){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(kt(r),t.pending!==0))return t.last_flush=-1,ot;be(t,r.adler&255),be(t,r.adler>>8&255),r.adler=0}if(t.status=Bi,kt(r),t.pending!==0)return t.last_flush=-1,ot}if(r.avail_in!==0||t.lookahead!==0||e!==ri&&t.status!==Ga){let n=t.level===0?Q1(t,e):t.strategy===xs?Fv(t,e):t.strategy===bv?Lv(t,e):Ka[t.level].func(t,e);if((n===Yi||n===ia)&&(t.status=Ga),n===gt||n===Yi)return r.avail_out===0&&(t.last_flush=-1),ot;if(n===ra&&(e===hv?dv(t):e!==hh&&(Ml(t,0,0,!1),e===mv&&(Kr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),kt(r),r.avail_out===0))return t.last_flush=-1,ot}return e!==jt?ot:t.wrap<=0?mh:(t.wrap===2?(be(t,r.adler&255),be(t,r.adler>>8&255),be(t,r.adler>>16&255),be(t,r.adler>>24&255),be(t,r.total_in&255),be(t,r.total_in>>8&255),be(t,r.total_in>>16&255),be(t,r.total_in>>24&255)):(Ra(t,r.adler>>>16),Ra(t,r.adler&65535)),kt(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?ot:mh)},Vv=r=>{if(wo(r))return lr;let e=r.state.status;return r.state=null,e===Bi?Vi(r,gv):ot},Qv=(r,e)=>{let t=e.length;if(wo(r))return lr;let i=r.state,n=i.wrap;if(n===2||n===1&&i.status!==Hn||i.lookahead)return lr;if(n===1&&(r.adler=fo(r.adler,e,t,0)),i.wrap=0,t>=i.w_size){n===0&&(Kr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(t-i.w_size,t),0),e=c,t=i.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,Gn(i);i.lookahead>=ce;){let c=i.strstart,u=i.lookahead-(ce-1);do i.ins_h=ii(i,i.ins_h,i.window[c+ce-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--u);i.strstart=c,i.lookahead=ce-1,Gn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=ce-1,i.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,i.wrap=n,ot},zv=qv,Wv=H1,Hv=W1,Gv=z1,Kv=jv,Zv=Bv,Jv=Vv,Yv=Qv,Xv="pako deflate (from Nodeca project)",ro={deflateInit:zv,deflateInit2:Wv,deflateReset:Hv,deflateResetKeep:Gv,deflateSetHeader:Kv,deflate:Zv,deflateEnd:Jv,deflateSetDictionary:Yv,deflateInfo:Xv},e2=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),t2=function(r){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 i in t)e2(t,i)&&(r[i]=t[i])}}return r},r2=r=>{let e=0;for(let i=0,n=r.length;i<n;i++)e+=r[i].length;let t=new Uint8Array(e);for(let i=0,n=0,a=r.length;i<a;i++){let o=r[i];t.set(o,n),n+=o.length}return t},Sc={assign:t2,flattenChunks:r2},G1=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){G1=!1}var ho=new Uint8Array(256);for(let r=0;r<256;r++)ho[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;ho[254]=ho[254]=1;var i2=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,i,n,a,o=r.length,s=0;for(n=0;n<o;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-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},n2=(r,e)=>{if(e<65534&&r.subarray&&G1)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(r[i]);return t},a2=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let i,n,a=new Array(t*2);for(n=0,i=0;i<t;){let o=r[i++];if(o<128){a[n++]=o;continue}let s=ho[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<t;)o=o<<6|r[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return n2(a,n)},o2=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+ho[r[t]]>e?t:e},mo={string2buf:i2,buf2string:a2,utf8border:o2};function s2(){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 K1=s2,Z1=Object.prototype.toString,{Z_NO_FLUSH:c2,Z_SYNC_FLUSH:u2,Z_FULL_FLUSH:l2,Z_FINISH:p2,Z_OK:cc,Z_STREAM_END:f2,Z_DEFAULT_COMPRESSION:d2,Z_DEFAULT_STRATEGY:h2,Z_DEFLATED:m2}=sn;function Eo(r){this.options=Sc.assign({level:d2,method:m2,chunkSize:16384,windowBits:15,memLevel:8,strategy:h2},r||{});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 K1,this.strm.avail_out=0;let t=ro.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==cc)throw new Error(Ji[t]);if(e.header&&ro.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=mo.string2buf(e.dictionary):Z1.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=ro.deflateSetDictionary(this.strm,i),t!==cc)throw new Error(Ji[t]);this._dict_set=!0}}Eo.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?p2:c2,typeof r=="string"?t.input=mo.string2buf(r):Z1.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===u2||a===l2)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=ro.deflate(t,a),n===f2)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=ro.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===cc;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};Eo.prototype.onData=function(r){this.chunks.push(r)};Eo.prototype.onEnd=function(r){r===cc&&(this.result=Sc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function op(r,e){let t=new Eo(e);if(t.push(r,!0),t.err)throw t.msg||Ji[t.err];return t.result}function g2(r,e){return e=e||{},e.raw=!0,op(r,e)}function y2(r,e){return e=e||{},e.gzip=!0,op(r,e)}var v2=Eo,b2=op,_2=g2,S2=y2,w2=sn,E2={Deflate:v2,deflate:b2,deflateRaw:_2,gzip:S2,constants:w2},As=16209,C2=16191,x2=function r(e,t){let i,n,a,o,s,c,u,l,d,f,p,h,m,y,w,b,S,_,T,R,A,N,L,$,j=e.state;i=e.next_in,L=e.input,n=i+(e.avail_in-5),a=e.next_out,$=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=j.dmax,u=j.wsize,l=j.whave,d=j.wnext,f=j.window,p=j.hold,h=j.bits,m=j.lencode,y=j.distcode,w=(1<<j.lenbits)-1,b=(1<<j.distbits)-1;e:do{h<15&&(p+=L[i++]<<h,h+=8,p+=L[i++]<<h,h+=8),S=m[p&w];t:for(;;){if(_=S>>>24,p>>>=_,h-=_,_=S>>>16&255,_===0)$[a++]=S&65535;else if(_&16){T=S&65535,_&=15,_&&(h<_&&(p+=L[i++]<<h,h+=8),T+=p&(1<<_)-1,p>>>=_,h-=_),h<15&&(p+=L[i++]<<h,h+=8,p+=L[i++]<<h,h+=8),S=y[p&b];r:for(;;){if(_=S>>>24,p>>>=_,h-=_,_=S>>>16&255,_&16){if(R=S&65535,_&=15,h<_&&(p+=L[i++]<<h,h+=8,h<_&&(p+=L[i++]<<h,h+=8)),R+=p&(1<<_)-1,R>c){e.msg="invalid distance too far back",j.mode=As;break e}if(p>>>=_,h-=_,_=a-o,R>_){if(_=R-_,_>l&&j.sane){e.msg="invalid distance too far back",j.mode=As;break e}if(A=0,N=f,d===0){if(A+=u-_,_<T){T-=_;do $[a++]=f[A++];while(--_);A=a-R,N=$}}else if(d<_){if(A+=u+d-_,_-=d,_<T){T-=_;do $[a++]=f[A++];while(--_);if(A=0,d<T){_=d,T-=_;do $[a++]=f[A++];while(--_);A=a-R,N=$}}}else if(A+=d-_,_<T){T-=_;do $[a++]=f[A++];while(--_);A=a-R,N=$}for(;T>2;)$[a++]=N[A++],$[a++]=N[A++],$[a++]=N[A++],T-=3;T&&($[a++]=N[A++],T>1&&($[a++]=N[A++]))}else{A=a-R;do $[a++]=$[A++],$[a++]=$[A++],$[a++]=$[A++],T-=3;while(T>2);T&&($[a++]=$[A++],T>1&&($[a++]=$[A++]))}}else if((_&64)===0){S=y[(S&65535)+(p&(1<<_)-1)];continue r}else{e.msg="invalid distance code",j.mode=As;break e}break}}else if((_&64)===0){S=m[(S&65535)+(p&(1<<_)-1)];continue t}else if(_&32){j.mode=C2;break e}else{e.msg="invalid literal/length code",j.mode=As;break e}break}}while(i<n&&a<s);T=h>>3,i-=T,h-=T<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),j.hold=p,j.bits=h},Ln=15,yh=852,vh=592,bh=0,hl=1,_h=2,A2=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]),k2=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]),T2=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]),I2=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]),O2=(r,e,t,i,n,a,o,s)=>{let c=s.bits,u=0,l=0,d=0,f=0,p=0,h=0,m=0,y=0,w=0,b=0,S,_,T,R,A,N=null,L,$=new Uint16Array(Ln+1),j=new Uint16Array(Ln+1),ye=null,qe,G,Ee;for(u=0;u<=Ln;u++)$[u]=0;for(l=0;l<i;l++)$[e[t+l]]++;for(p=c,f=Ln;f>=1&&$[f]===0;f--);if(p>f&&(p=f),f===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&$[d]===0;d++);for(p<d&&(p=d),y=1,u=1;u<=Ln;u++)if(y<<=1,y-=$[u],y<0)return-1;if(y>0&&(r===bh||f!==1))return-1;for(j[1]=0,u=1;u<Ln;u++)j[u+1]=j[u]+$[u];for(l=0;l<i;l++)e[t+l]!==0&&(o[j[e[t+l]]++]=l);if(r===bh?(N=ye=o,L=20):r===hl?(N=A2,ye=k2,L=257):(N=T2,ye=I2,L=0),b=0,l=0,u=d,A=a,h=p,m=0,T=-1,w=1<<p,R=w-1,r===hl&&w>yh||r===_h&&w>vh)return 1;for(;;){qe=u-m,o[l]+1<L?(G=0,Ee=o[l]):o[l]>=L?(G=ye[o[l]-L],Ee=N[o[l]-L]):(G=32+64,Ee=0),S=1<<u-m,_=1<<h,d=_;do _-=S,n[A+(b>>m)+_]=qe<<24|G<<16|Ee|0;while(_!==0);for(S=1<<u-1;b&S;)S>>=1;if(S!==0?(b&=S-1,b+=S):b=0,l++,--$[u]===0){if(u===f)break;u=e[t+o[l]]}if(u>p&&(b&R)!==T){for(m===0&&(m=p),A+=d,h=u-m,y=1<<h;h+m<f&&(y-=$[h+m],!(y<=0));)h++,y<<=1;if(w+=1<<h,r===hl&&w>yh||r===_h&&w>vh)return 1;T=b&R,n[T]=p<<24|h<<16|A-a|0}}return b!==0&&(n[A+b]=u-m<<24|64<<16|0),s.bits=p,0},io=O2,D2=0,J1=1,Y1=2,{Z_FINISH:Sh,Z_BLOCK:N2,Z_TREES:ks,Z_OK:Xi,Z_STREAM_END:R2,Z_NEED_DICT:P2,Z_STREAM_ERROR:qt,Z_DATA_ERROR:X1,Z_MEM_ERROR:em,Z_BUF_ERROR:$2,Z_DEFLATED:wh}=sn,wc=16180,Eh=16181,Ch=16182,xh=16183,Ah=16184,kh=16185,Th=16186,Ih=16187,Oh=16188,Dh=16189,uc=16190,Sr=16191,ml=16192,Nh=16193,gl=16194,Rh=16195,Ph=16196,$h=16197,Lh=16198,Ts=16199,Is=16200,Fh=16201,Mh=16202,Uh=16203,jh=16204,qh=16205,yl=16206,Bh=16207,Vh=16208,De=16209,tm=16210,rm=16211,L2=852,F2=592,M2=15,U2=M2,Qh=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function j2(){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 cn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<wc||e.mode>rm?1:0},im=r=>{if(cn(r))return qt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=wc,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(L2),e.distcode=e.distdyn=new Int32Array(F2),e.sane=1,e.back=-1,Xi},nm=r=>{if(cn(r))return qt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,im(r)},am=(r,e)=>{let t;if(cn(r))return qt;let i=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?qt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,nm(r))},om=(r,e)=>{if(!r)return qt;let t=new j2;r.state=t,t.strm=r,t.window=null,t.mode=wc;let i=am(r,e);return i!==Xi&&(r.state=null),i},q2=r=>om(r,U2),zh=!0,vl,bl,B2=r=>{if(zh){vl=new Int32Array(512),bl=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(io(J1,r.lens,0,288,vl,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;io(Y1,r.lens,0,32,bl,0,r.work,{bits:5}),zh=!1}r.lencode=vl,r.lenbits=9,r.distcode=bl,r.distbits=5},sm=(r,e,t,i)=>{let n,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=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>i&&(n=i),a.window.set(e.subarray(t-i,t-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},V2=(r,e)=>{let t,i,n,a,o,s,c,u,l,d,f,p,h,m,y=0,w,b,S,_,T,R,A,N,L=new Uint8Array(4),$,j,ye=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cn(r)||!r.output||!r.input&&r.avail_in!==0)return qt;t=r.state,t.mode===Sr&&(t.mode=ml),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,u=t.hold,l=t.bits,d=s,f=c,N=Xi;e:for(;;)switch(t.mode){case wc:if(t.wrap===0){t.mode=ml;break}for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&2&&u===35615){t.wbits===0&&(t.wbits=15),t.check=0,L[0]=u&255,L[1]=u>>>8&255,t.check=Ze(t.check,L,2,0),u=0,l=0,t.mode=Eh;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((u&255)<<8)+(u>>8))%31){r.msg="incorrect header check",t.mode=De;break}if((u&15)!==wh){r.msg="unknown compression method",t.mode=De;break}if(u>>>=4,l-=4,A=(u&15)+8,t.wbits===0&&(t.wbits=A),A>15||A>t.wbits){r.msg="invalid window size",t.mode=De;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=u&512?Dh:Sr,u=0,l=0;break;case Eh:for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==wh){r.msg="unknown compression method",t.mode=De;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=De;break}t.head&&(t.head.text=u>>8&1),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=Ze(t.check,L,2,0)),u=0,l=0,t.mode=Ch;case Ch:for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.head&&(t.head.time=u),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,L[2]=u>>>16&255,L[3]=u>>>24&255,t.check=Ze(t.check,L,4,0)),u=0,l=0,t.mode=xh;case xh:for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=Ze(t.check,L,2,0)),u=0,l=0,t.mode=Ah;case Ah:if(t.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=Ze(t.check,L,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=kh;case kh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(A=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+p),A)),t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=Th;case Th:if(t.flags&2048){if(s===0)break e;p=0;do A=i[a+p++],t.head&&A&&t.length<65536&&(t.head.name+=String.fromCharCode(A));while(A&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,A)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Ih;case Ih:if(t.flags&4096){if(s===0)break e;p=0;do A=i[a+p++],t.head&&A&&t.length<65536&&(t.head.comment+=String.fromCharCode(A));while(A&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ze(t.check,i,p,a)),s-=p,a+=p,A)break e}else t.head&&(t.head.comment=null);t.mode=Oh;case Oh:if(t.flags&512){for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.check&65535)){r.msg="header crc mismatch",t.mode=De;break}u=0,l=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=Sr;break;case Dh:for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}r.adler=t.check=Qh(u),u=0,l=0,t.mode=uc;case uc:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,P2;r.adler=t.check=1,t.mode=Sr;case Sr:if(e===N2||e===ks)break e;case ml:if(t.last){u>>>=l&7,l-=l&7,t.mode=yl;break}for(;l<3;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}switch(t.last=u&1,u>>>=1,l-=1,u&3){case 0:t.mode=Nh;break;case 1:if(B2(t),t.mode=Ts,e===ks){u>>>=2,l-=2;break e}break;case 2:t.mode=Ph;break;case 3:r.msg="invalid block type",t.mode=De}u>>>=2,l-=2;break;case Nh:for(u>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if((u&65535)!==(u>>>16^65535)){r.msg="invalid stored block lengths",t.mode=De;break}if(t.length=u&65535,u=0,l=0,t.mode=gl,e===ks)break e;case gl:t.mode=Rh;case Rh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=Sr;break;case Ph:for(;l<14;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.nlen=(u&31)+257,u>>>=5,l-=5,t.ndist=(u&31)+1,u>>>=5,l-=5,t.ncode=(u&15)+4,u>>>=4,l-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=De;break}t.have=0,t.mode=$h;case $h:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.lens[ye[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[ye[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,$={bits:t.lenbits},N=io(D2,t.lens,0,19,t.lencode,0,t.work,$),t.lenbits=$.bits,N){r.msg="invalid code lengths set",t.mode=De;break}t.have=0,t.mode=Lh;case Lh:for(;t.have<t.nlen+t.ndist;){for(;y=t.lencode[u&(1<<t.lenbits)-1],w=y>>>24,b=y>>>16&255,S=y&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(S<16)u>>>=w,l-=w,t.lens[t.have++]=S;else{if(S===16){for(j=w+2;l<j;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(u>>>=w,l-=w,t.have===0){r.msg="invalid bit length repeat",t.mode=De;break}A=t.lens[t.have-1],p=3+(u&3),u>>>=2,l-=2}else if(S===17){for(j=w+3;l<j;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=w,l-=w,A=0,p=3+(u&7),u>>>=3,l-=3}else{for(j=w+7;l<j;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=w,l-=w,A=0,p=11+(u&127),u>>>=7,l-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=De;break}for(;p--;)t.lens[t.have++]=A}}if(t.mode===De)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=De;break}if(t.lenbits=9,$={bits:t.lenbits},N=io(J1,t.lens,0,t.nlen,t.lencode,0,t.work,$),t.lenbits=$.bits,N){r.msg="invalid literal/lengths set",t.mode=De;break}if(t.distbits=6,t.distcode=t.distdyn,$={bits:t.distbits},N=io(Y1,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,$),t.distbits=$.bits,N){r.msg="invalid distances set",t.mode=De;break}if(t.mode=Ts,e===ks)break e;case Ts:t.mode=Is;case Is:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,x2(r,f),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===Sr&&(t.back=-1);break}for(t.back=0;y=t.lencode[u&(1<<t.lenbits)-1],w=y>>>24,b=y>>>16&255,S=y&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(b&&(b&240)===0){for(_=w,T=b,R=S;y=t.lencode[R+((u&(1<<_+T)-1)>>_)],w=y>>>24,b=y>>>16&255,S=y&65535,!(_+w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=_,l-=_,t.back+=_}if(u>>>=w,l-=w,t.back+=w,t.length=S,b===0){t.mode=qh;break}if(b&32){t.back=-1,t.mode=Sr;break}if(b&64){r.msg="invalid literal/length code",t.mode=De;break}t.extra=b&15,t.mode=Fh;case Fh:if(t.extra){for(j=t.extra;l<j;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.length+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=Mh;case Mh:for(;y=t.distcode[u&(1<<t.distbits)-1],w=y>>>24,b=y>>>16&255,S=y&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if((b&240)===0){for(_=w,T=b,R=S;y=t.distcode[R+((u&(1<<_+T)-1)>>_)],w=y>>>24,b=y>>>16&255,S=y&65535,!(_+w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=_,l-=_,t.back+=_}if(u>>>=w,l-=w,t.back+=w,b&64){r.msg="invalid distance code",t.mode=De;break}t.offset=S,t.extra=b&15,t.mode=Uh;case Uh:if(t.extra){for(j=t.extra;l<j;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.offset+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=De;break}t.mode=jh;case jh:if(c===0)break e;if(p=f-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=De;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=n,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do n[o++]=m[h++];while(--p);t.length===0&&(t.mode=Is);break;case qh:if(c===0)break e;n[o++]=t.length,c--,t.mode=Is;break;case yl:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=i[a++]<<l,l+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ze(t.check,n,f,o-f):fo(t.check,n,f,o-f)),f=c,t.wrap&4&&(t.flags?u:Qh(u))!==t.check){r.msg="incorrect data check",t.mode=De;break}u=0,l=0}t.mode=Bh;case Bh:if(t.wrap&&t.flags){for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=De;break}u=0,l=0}t.mode=Vh;case Vh:N=R2;break e;case De:N=X1;break e;case tm:return em;case rm:default:return qt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,(t.wsize||f!==r.avail_out&&t.mode<De&&(t.mode<yl||e!==Sh))&&sm(r,r.output,r.next_out,f-r.avail_out),d-=r.avail_in,f-=r.avail_out,r.total_in+=d,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ze(t.check,n,f,r.next_out-f):fo(t.check,n,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Sr?128:0)+(t.mode===Ts||t.mode===gl?256:0),(d===0&&f===0||e===Sh)&&N===Xi&&(N=$2),N},Q2=r=>{if(cn(r))return qt;let e=r.state;return e.window&&(e.window=null),r.state=null,Xi},z2=(r,e)=>{if(cn(r))return qt;let t=r.state;return(t.wrap&2)===0?qt:(t.head=e,e.done=!1,Xi)},W2=(r,e)=>{let t=e.length,i,n,a;return cn(r)||(i=r.state,i.wrap!==0&&i.mode!==uc)?qt:i.mode===uc&&(n=1,n=fo(n,e,t,0),n!==i.check)?X1:(a=sm(r,e,t,t),a?(i.mode=tm,em):(i.havedict=1,Xi))},H2=nm,G2=am,K2=im,Z2=q2,J2=om,Y2=V2,X2=Q2,e3=z2,t3=W2,r3="pako inflate (from Nodeca project)",Ar={inflateReset:H2,inflateReset2:G2,inflateResetKeep:K2,inflateInit:Z2,inflateInit2:J2,inflate:Y2,inflateEnd:X2,inflateGetHeader:e3,inflateSetDictionary:t3,inflateInfo:r3};function i3(){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 n3=i3,cm=Object.prototype.toString,{Z_NO_FLUSH:a3,Z_FINISH:o3,Z_OK:go,Z_STREAM_END:_l,Z_NEED_DICT:Sl,Z_STREAM_ERROR:s3,Z_DATA_ERROR:Wh,Z_MEM_ERROR:c3}=sn;function Co(r){this.options=Sc.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});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&&!(r&&r.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 K1,this.strm.avail_out=0;let t=Ar.inflateInit2(this.strm,e.windowBits);if(t!==go)throw new Error(Ji[t]);if(this.header=new n3,Ar.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=mo.string2buf(e.dictionary):cm.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Ar.inflateSetDictionary(this.strm,e.dictionary),t!==go)))throw new Error(Ji[t])}Co.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?o3:a3,cm.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=Ar.inflate(t,o),a===Sl&&n&&(a=Ar.inflateSetDictionary(t,n),a===go?a=Ar.inflate(t,o):a===Wh&&(a=Sl));t.avail_in>0&&a===_l&&t.state.wrap>0&&r[t.next_in]!==0;)Ar.inflateReset(t),a=Ar.inflate(t,o);switch(a){case s3:case Wh:case Sl:case c3:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===_l))if(this.options.to==="string"){let c=mo.utf8border(t.output,t.next_out),u=t.next_out-c,l=mo.buf2string(t.output,c);t.next_out=u,t.avail_out=i-u,u&&t.output.set(t.output.subarray(c,c+u),0),this.onData(l)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===go&&s===0)){if(a===_l)return a=Ar.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Co.prototype.onData=function(r){this.chunks.push(r)};Co.prototype.onEnd=function(r){r===go&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Sc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function sp(r,e){let t=new Co(e);if(t.push(r),t.err)throw t.msg||Ji[t.err];return t.result}function u3(r,e){return e=e||{},e.raw=!0,sp(r,e)}var l3=Co,p3=sp,f3=u3,d3=sp,h3=sn,m3={Inflate:l3,inflate:p3,inflateRaw:f3,ungzip:d3,constants:h3},{Deflate:g3,deflate:y3,deflateRaw:v3,gzip:b3}=E2,{Inflate:_3,inflate:S3,inflateRaw:w3,ungzip:E3}=m3,C3=g3,x3=y3,A3=v3,k3=b3,T3=_3,I3=S3,O3=w3,D3=E3,N3=sn,R3={Deflate:C3,deflate:x3,deflateRaw:A3,gzip:k3,Inflate:T3,inflate:I3,inflateRaw:O3,ungzip:D3,constants:N3},Ae=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ke=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},lc=class{constructor(e,t){this.input=e,this.output=t}};Ae([g(),ke("design:type",String)],lc.prototype,"input",void 0);Ae([g(),ke("design:type",String)],lc.prototype,"output",void 0);lc=Ae([Ye(),ke("design:paramtypes",[String,String])],lc);var pc=class{constructor(e,t){this.input=e,this.output=t}};Ae([g(),ke("design:type",String)],pc.prototype,"input",void 0);Ae([g(),ke("design:type",String)],pc.prototype,"output",void 0);pc=Ae([K(),ke("design:paramtypes",[String,String])],pc);var si=class{constructor(e,t,i,n,a){this.name=e,this.modelId=t,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};Ae([g(),ke("design:type",String)],si.prototype,"name",void 0);Ae([g(),ke("design:type",String)],si.prototype,"modelId",void 0);Ae([g(),ke("design:type",String)],si.prototype,"systemPrompt",void 0);Ae([g(),ke("design:type",Array)],si.prototype,"promptExamples",void 0);Ae([g(),ke("design:type",String)],si.prototype,"metaData",void 0);si=Ae([Ye(),ke("design:paramtypes",[String,String,String,Array,String])],si);var hr=class{constructor(e,t,i,n,a,o,s,c){this.name=e,this.modelId=t,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};Ae([g(),ke("design:type",String)],hr.prototype,"name",void 0);Ae([g(),ke("design:type",String)],hr.prototype,"modelId",void 0);Ae([g(),ke("design:type",String)],hr.prototype,"taskId",void 0);Ae([g(),ke("design:type",String)],hr.prototype,"systemPrompt",void 0);Ae([g(),ke("design:type",Array)],hr.prototype,"promptExamples",void 0);Ae([g(),ke("design:type",String)],hr.prototype,"metaData",void 0);Ae([g(),ke("design:type",String)],hr.prototype,"createdAt",void 0);Ae([g(),ke("design:type",String)],hr.prototype,"updatedAt",void 0);hr=Ae([K(),ke("design:paramtypes",[String,String,String,String,Array,String,String,String])],hr);var en=class{constructor(e,t,i,n,a){this.model=e,this.status=t,this.progress=i,this.downloaded=n,this.loaded=a}};Ae([g(),ke("design:type",String)],en.prototype,"model",void 0);Ae([g(),ke("design:type",String)],en.prototype,"status",void 0);Ae([g(),ke("design:type",Number)],en.prototype,"progress",void 0);Ae([g(),ke("design:type",Boolean)],en.prototype,"downloaded",void 0);Ae([g(),ke("design:type",Boolean)],en.prototype,"loaded",void 0);en=Ae([K(),ke("design:paramtypes",[String,String,Number,Boolean,Boolean])],en);var P3=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},He=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Qe,Vs,zl=class{constructor(e,t=!0){Qe.set(this,void 0),Vs.set(this,new Map),P3(this,Qe,e,"f")}async getModels(){let e=await He(this,Qe,"f").query({query:C`
745
745
  query {
746
746
  aiGetModels {
747
747
  id
@@ -765,23 +765,23 @@ triggerMatch
765
765
  modelType
766
766
  }
767
767
  }
768
- `});return k(e).aiGetModels}async addModel(e){let t=await We(this,Ve,"f").mutate({mutation:E`
768
+ `});return k(e).aiGetModels}async addModel(e){let t=await He(this,Qe,"f").mutate({mutation:C`
769
769
  mutation($model: ModelInput!) {
770
770
  aiAddModel(model: $model)
771
771
  }
772
- `,variables:{model:e}});return k(t).aiAddModel}async updateModel(e,t){let i=await We(this,Ve,"f").mutate({mutation:E`
772
+ `,variables:{model:e}});return k(t).aiAddModel}async updateModel(e,t){let i=await He(this,Qe,"f").mutate({mutation:C`
773
773
  mutation($modelId: String!, $model: ModelInput!) {
774
774
  aiUpdateModel(modelId: $modelId, model: $model)
775
775
  }
776
- `,variables:{modelId:e,model:t}});return k(i).aiUpdateModel}async removeModel(e){let t=await We(this,Ve,"f").mutate({mutation:E`
776
+ `,variables:{modelId:e,model:t}});return k(i).aiUpdateModel}async removeModel(e){let t=await He(this,Qe,"f").mutate({mutation:C`
777
777
  mutation($modelId: String!) {
778
778
  aiRemoveModel(modelId: $modelId)
779
779
  }
780
- `,variables:{modelId:e}});return k(t).aiRemoveModel}async setDefaultModel(e,t){let i=await We(this,Ve,"f").mutate({mutation:E`
780
+ `,variables:{modelId:e}});return k(t).aiRemoveModel}async setDefaultModel(e,t){let i=await He(this,Qe,"f").mutate({mutation:C`
781
781
  mutation($modelType: ModelType!, $modelId: String!) {
782
782
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
783
783
  }
784
- `,variables:{modelId:t,modelType:e}});return k(i).aiSetDefaultModel}async getDefaultModel(e){let t=await We(this,Ve,"f").query({query:E`
784
+ `,variables:{modelId:t,modelType:e}});return k(i).aiSetDefaultModel}async getDefaultModel(e){let t=await He(this,Qe,"f").query({query:C`
785
785
  query($modelType: ModelType!) {
786
786
  aiGetDefaultModel(modelType: $modelType) {
787
787
  id
@@ -805,7 +805,7 @@ triggerMatch
805
805
  modelType
806
806
  }
807
807
  }
808
- `,variables:{modelType:e}});return k(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await We(this,Ve,"f").query({query:E`
808
+ `,variables:{modelType:e}});return k(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await He(this,Qe,"f").query({query:C`
809
809
  query {
810
810
  aiTasks {
811
811
  name
@@ -821,7 +821,7 @@ triggerMatch
821
821
  updatedAt
822
822
  }
823
823
  }
824
- `}));return e}async addTask(e,t,i,n,a){let o=new oi(e,t,i,n,a),{aiAddTask:s}=k(await We(this,Ve,"f").mutate({mutation:E`
824
+ `}));return e}async addTask(e,t,i,n,a){let o=new si(e,t,i,n,a),{aiAddTask:s}=k(await He(this,Qe,"f").mutate({mutation:C`
825
825
  mutation AiAddTask($task: AITaskInput!) {
826
826
  aiAddTask(task: $task) {
827
827
  name
@@ -837,7 +837,7 @@ triggerMatch
837
837
  updatedAt
838
838
  }
839
839
  }
840
- `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=k(await We(this,Ve,"f").mutate({mutation:E`
840
+ `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=k(await He(this,Qe,"f").mutate({mutation:C`
841
841
  mutation AiRemoveTask($taskId: String!) {
842
842
  aiRemoveTask(taskId: $taskId) {
843
843
  name
@@ -853,7 +853,7 @@ triggerMatch
853
853
  updatedAt
854
854
  }
855
855
  }
856
- `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:i}=k(await We(this,Ve,"f").mutate({mutation:E`
856
+ `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:i}=k(await He(this,Qe,"f").mutate({mutation:C`
857
857
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
858
858
  aiUpdateTask(taskId: $taskId, task: $task) {
859
859
  name
@@ -869,7 +869,7 @@ triggerMatch
869
869
  updatedAt
870
870
  }
871
871
  }
872
- `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return i}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=k(await We(this,Ve,"f").query({query:E`
872
+ `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return i}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=k(await He(this,Qe,"f").query({query:C`
873
873
  query AiModelLoadingStatus($model: String!) {
874
874
  aiModelLoadingStatus(model: $model) {
875
875
  model
@@ -879,51 +879,51 @@ triggerMatch
879
879
  downloaded
880
880
  }
881
881
  }
882
- `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:i}=k(await We(this,Ve,"f").mutate({mutation:E`
882
+ `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:i}=k(await He(this,Qe,"f").mutate({mutation:C`
883
883
  mutation AiPrompt($taskId: String!, $prompt: String!) {
884
884
  aiPrompt(taskId: $taskId, prompt: $prompt)
885
885
  }
886
- `,variables:{taskId:e,prompt:t}}));return i}async embed(e,t){let{aiEmbed:i}=k(await We(this,Ve,"f").mutate({mutation:E`
886
+ `,variables:{taskId:e,prompt:t}}));return i}async embed(e,t){let{aiEmbed:i}=k(await He(this,Qe,"f").mutate({mutation:C`
887
887
  mutation aiEmbed($modelId: String!, $text: String!) {
888
888
  aiEmbed(modelId: $modelId, text: $text)
889
889
  }
890
- `,variables:{modelId:e,text:t}})),n=vc.toByteArray(i);return JSON.parse(N3.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,i){let{aiOpenTranscriptionStream:n}=k(await We(this,Ve,"f").mutate({mutation:E`
890
+ `,variables:{modelId:e,text:t}})),n=bc.toByteArray(i);return JSON.parse(R3.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,i){let{aiOpenTranscriptionStream:n}=k(await He(this,Qe,"f").mutate({mutation:C`
891
891
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
892
892
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
893
893
  }
894
- `,variables:{modelId:e,params:i}})),a=We(this,Ve,"f").subscribe({query:E` subscription {
894
+ `,variables:{modelId:e,params:i}})),a=He(this,Qe,"f").subscribe({query:C` subscription {
895
895
  aiTranscriptionText(streamId: "${n}")
896
- }`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return We(this,Bs,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=k(await We(this,Ve,"f").mutate({mutation:E`
896
+ }`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return He(this,Vs,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=k(await He(this,Qe,"f").mutate({mutation:C`
897
897
  mutation aiCloseTranscriptionStream($streamId: String!) {
898
898
  aiCloseTranscriptionStream(streamId: $streamId)
899
899
  }
900
- `,variables:{streamId:e}})),i=We(this,Bs,"f").get(e);return i.closed||i.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:i}=k(await We(this,Ve,"f").mutate({mutation:E`
900
+ `,variables:{streamId:e}})),i=He(this,Vs,"f").get(e);return i.closed||i.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:i}=k(await He(this,Qe,"f").mutate({mutation:C`
901
901
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
902
902
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
903
903
  }
904
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return i}};Ve=new WeakMap,Bs=new WeakMap;var zr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Be=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ar,Vs,Ga,Qs,Ka,Fi,zs,Za,go=class{constructor(e,t=!0){ar.set(this,void 0),Vs.set(this,void 0),Ga.set(this,void 0),Qs.set(this,void 0),Ka.set(this,void 0),Fi.set(this,void 0),zs.set(this,void 0),Za.set(this,void 0),zr(this,ar,e,"f"),zr(this,Vs,new oo(Be(this,ar,"f"),t),"f"),zr(this,Ga,new $u(Be(this,ar,"f")),"f"),zr(this,Qs,new Du(Be(this,ar,"f")),"f"),zr(this,Ka,new Nu(Be(this,ar,"f")),"f"),zr(this,Za,new Qu(Be(this,ar,"f"),t),"f"),zr(this,Fi,new ac(Be(this,ar,"f"),t),"f"),Be(this,Fi,"f").setExpressionClient(Be(this,Ga,"f")),Be(this,Fi,"f").setNeighbourhoodClient(Be(this,Ka,"f")),Be(this,Fi,"f").setAIClient(Be(this,Za,"f")),zr(this,zs,new Ru(Be(this,ar,"f"),t),"f")}get agent(){return Be(this,Vs,"f")}get expression(){return Be(this,Ga,"f")}get languages(){return Be(this,Qs,"f")}get neighbourhood(){return Be(this,Ka,"f")}get perspective(){return Be(this,Fi,"f")}get runtime(){return Be(this,zs,"f")}get ai(){return Be(this,Za,"f")}};ar=new WeakMap,Vs=new WeakMap,Ga=new WeakMap,Qs=new WeakMap,Ka=new WeakMap,Fi=new WeakMap,zs=new WeakMap,Za=new WeakMap;var zu;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(zu||(zu={}));var sp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},cp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Vi=class{constructor(e,t){this.language=e,this.expression=t}};sp([g(),cp("design:type",cr)],Vi.prototype,"language",void 0);sp([g(),cp("design:type",String)],Vi.prototype,"expression",void 0);Vi=sp([K(),cp("design:paramtypes",[cr,String])],Vi);function e7(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function t7(r){if(r.startsWith("literal://")){let a=new cr;a.address="literal",a.name="literal";let o=r.substring(10);return new Vi(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new cr;return s.address=a,new Vi(s,o)}let n=/^did:([^\s]+)$/.exec(r);if(n&&n.length==2){let a=new cr;return a.address="did",new Vi(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Nt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},hr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},pc=class{};Nt([g(),hr("design:type",String)],pc.prototype,"name",void 0);Nt([g(),hr("design:type",String)],pc.prototype,"type",void 0);pc=Nt([K()],pc);var yo=class{};Nt([g(),hr("design:type",String)],yo.prototype,"label",void 0);Nt([g(),hr("design:type",String)],yo.prototype,"name",void 0);Nt([g(),hr("design:type",Array)],yo.prototype,"parameters",void 0);yo=Nt([K()],yo);var fc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Nt([g(),hr("design:type",String)],fc.prototype,"name",void 0);Nt([g(),hr("design:type",String)],fc.prototype,"parametersStringified",void 0);fc=Nt([Je(),hr("design:paramtypes",[String,Object])],fc);var dc=class{};Nt([g(),hr("design:type",String)],dc.prototype,"did",void 0);Nt([g(),hr("design:type",Gi)],dc.prototype,"status",void 0);dc=Nt([K()],dc);var zh=class{},cn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ra=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},si=class{};cn([g(),ra("design:type",String)],si.prototype,"name",void 0);cn([g(),ra("design:type",String)],si.prototype,"address",void 0);cn([g(),ra("design:type",String)],si.prototype,"settings",void 0);cn([g(),ra("design:type",zi)],si.prototype,"icon",void 0);cn([g(),ra("design:type",zi)],si.prototype,"constructorIcon",void 0);cn([g(),ra("design:type",zi)],si.prototype,"settingsIcon",void 0);si=cn([K()],si);var gt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ct=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Gt=class{};gt([g(),Ct("design:type",String)],Gt.prototype,"name",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"address",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"description",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"author",void 0);gt([g(),Ct("design:type",Boolean)],Gt.prototype,"templated",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"templateSourceLanguageAddress",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"templateAppliedParams",void 0);gt([g(),Ct("design:type",Array)],Gt.prototype,"possibleTemplateParams",void 0);gt([g(),Ct("design:type",String)],Gt.prototype,"sourceCodeLink",void 0);Gt=gt([K()],Gt);var Hn=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};gt([g(),Ct("design:type",String)],Hn.prototype,"name",void 0);gt([g(),Ct("design:type",String)],Hn.prototype,"description",void 0);gt([g(),Ct("design:type",Array)],Hn.prototype,"possibleTemplateParams",void 0);gt([g(),Ct("design:type",String)],Hn.prototype,"sourceCodeLink",void 0);Hn=gt([Je(),Ct("design:paramtypes",[String,String])],Hn);var Wh=class{},Hh=class extends ui(){},Gh=class{},wc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},lp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},hc=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};wc([g(),lp("design:type",String)],hc.prototype,"linkLanguage",void 0);wc([g(),lp("design:type",pr)],hc.prototype,"meta",void 0);hc=wc([K(),lp("design:paramtypes",[String,pr])],hc);var Wu=class extends ui(){};Wu=wc([K()],Wu);var ln=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},un=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hu;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(Hu||(Hu={}));var ci=class{constructor(e,t,i){this.uuid=e,this.name=t,i?this.state=i:this.state=Hu.Private}};ln([g(),un("design:type",String)],ci.prototype,"uuid",void 0);ln([g(),un("design:type",String)],ci.prototype,"name",void 0);ln([g(),un("design:type",String)],ci.prototype,"state",void 0);ln([g(),un("design:type",String)],ci.prototype,"sharedUrl",void 0);ln([g(),un("design:type",Wu)],ci.prototype,"neighbourhood",void 0);ln([g(),un("design:type",Array)],ci.prototype,"owners",void 0);ci=ln([K(),un("design:paramtypes",[String,String,String])],ci);var Cc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},sm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},mc=class{};Cc([g(),sm("design:type",Array)],mc.prototype,"additions",void 0);Cc([g(),sm("design:type",Array)],mc.prototype,"removals",void 0);mc=Cc([K()],mc);var Kh=class extends ui(){};Kh=Cc([K()],Kh);var Zh=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ln=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ja,Mi,Is="smart_literal://content";function $3(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}var vo=class{constructor(e,t){Ja.set(this,void 0),Mi.set(this,void 0),Zh(this,Ja,e,"f"),Zh(this,Mi,t,"f")}get base(){return Ln(this,Mi,"f")}static async create(e,t){let i=ut.from($3(10)).toUrl(),n=new vo(e,i);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new ot({source:t,predicate:Is}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new ot({predicate:Is}))).map(i=>new vo(e,i.data.source))}async get(){let e=await Ln(this,Ja,"f").getSingleTarget(new ot({source:Ln(this,Mi,"f"),predicate:Is}));if(!e)throw`No content for smart literal ${Ln(this,Mi,"f")}`;return ut.fromUrl(e).get()}async set(e){let t=ut.from(e);await Ln(this,Ja,"f").setSingleTarget(new Hi({source:Ln(this,Mi,"f"),predicate:Is,target:t.toUrl()}))}};Ja=new WeakMap,Mi=new WeakMap;var Jh=class{};function h7(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function m7(r){return`triple(this, "${r}", _)`}function g7(r){return function(e,t,i){if(typeof i.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");i.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(r&&r.where)for(let u in r.where){let d=r.where[u];c+=`, property_getter(C, Instance, "${u}", "${d}")`}r&&r.condition&&(c+=", "+r.condition);try{let u=await a.infer(c);if(u&&u!==!1&&typeof u!="string"&&u.length>0){for(let d of u){let f=d.Instance,p=new ao(a,f,s);await p.init(),o.push(p)}return o}}catch{}let l=await a.getAllSubjectInstances(s);if(r&&r.where){let u=[];for(let d of l){let f=!0;for(let p in r.where){let h=r.where[p];if(await d[p]!==h){f=!1;break}}f&&u.push(d)}return u}return l}}}function cm(r){return function(e,t){if(typeof r.writable>"u"&&r.through&&(r.writable=!0),r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...r},r.writable){let i=t;e[`set${Xr(i)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function y7(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],through:r.through,required:!0,initial:r.value,flag:!0},e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function v7(r){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=r;let i=t;e[`add${Xr(i)}`]=()=>{},e[`remove${Xr(i)}`]=()=>{},e[`setCollection${Xr(i)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function lm(r){let e="",t="abcdefghijklmnopqrstuvwxyz",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function P3(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",i=r.name,n=e.prototype,a=lm(8);t+=`subject_class("${i}", ${a}).
905
- `;let o=[],s=[];n.subjectConstructor&&n.subjectConstructor.length&&(s=s.concat(n.subjectConstructor));let c=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(c=c.concat(n.isSubjectInstance));let l=[],u=n.__properties||{};for(let h in u){let m=`property(${a}, "${h}").
906
- `,{through:v,initial:w,required:b,resolveLanguage:S,writable:_,flag:T,getter:R,setter:A,local:N}=u[h];if(S&&(m+=`property_resolve(${a}, "${h}").
904
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return i}};Qe=new WeakMap,Vs=new WeakMap;var Wr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ve=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},or,Qs,Za,zs,Ja,Mi,Ws,Ya,yo=class{constructor(e,t=!0){or.set(this,void 0),Qs.set(this,void 0),Za.set(this,void 0),zs.set(this,void 0),Ja.set(this,void 0),Mi.set(this,void 0),Ws.set(this,void 0),Ya.set(this,void 0),Wr(this,or,e,"f"),Wr(this,Qs,new so(Ve(this,or,"f"),t),"f"),Wr(this,Za,new $l(Ve(this,or,"f")),"f"),Wr(this,zs,new Nl(Ve(this,or,"f")),"f"),Wr(this,Ja,new Rl(Ve(this,or,"f")),"f"),Wr(this,Ya,new zl(Ve(this,or,"f"),t),"f"),Wr(this,Mi,new oc(Ve(this,or,"f"),t),"f"),Ve(this,Mi,"f").setExpressionClient(Ve(this,Za,"f")),Ve(this,Mi,"f").setNeighbourhoodClient(Ve(this,Ja,"f")),Ve(this,Mi,"f").setAIClient(Ve(this,Ya,"f")),Wr(this,Ws,new Pl(Ve(this,or,"f"),t),"f")}get agent(){return Ve(this,Qs,"f")}get expression(){return Ve(this,Za,"f")}get languages(){return Ve(this,zs,"f")}get neighbourhood(){return Ve(this,Ja,"f")}get perspective(){return Ve(this,Mi,"f")}get runtime(){return Ve(this,Ws,"f")}get ai(){return Ve(this,Ya,"f")}};or=new WeakMap,Qs=new WeakMap,Za=new WeakMap,zs=new WeakMap,Ja=new WeakMap,Mi=new WeakMap,Ws=new WeakMap,Ya=new WeakMap;var Wl;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(Wl||(Wl={}));var cp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},up=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Qi=class{constructor(e,t){this.language=e,this.expression=t}};cp([g(),up("design:type",ur)],Qi.prototype,"language",void 0);cp([g(),up("design:type",String)],Qi.prototype,"expression",void 0);Qi=cp([K(),up("design:paramtypes",[ur,String])],Qi);function t7(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function r7(r){if(r.startsWith("literal://")){let a=new ur;a.address="literal",a.name="literal";let o=r.substring(10);return new Qi(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new ur;return s.address=a,new Qi(s,o)}let n=/^did:([^\s]+)$/.exec(r);if(n&&n.length==2){let a=new ur;return a.address="did",new Qi(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Rt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},mr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},fc=class{};Rt([g(),mr("design:type",String)],fc.prototype,"name",void 0);Rt([g(),mr("design:type",String)],fc.prototype,"type",void 0);fc=Rt([K()],fc);var vo=class{};Rt([g(),mr("design:type",String)],vo.prototype,"label",void 0);Rt([g(),mr("design:type",String)],vo.prototype,"name",void 0);Rt([g(),mr("design:type",Array)],vo.prototype,"parameters",void 0);vo=Rt([K()],vo);var dc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Rt([g(),mr("design:type",String)],dc.prototype,"name",void 0);Rt([g(),mr("design:type",String)],dc.prototype,"parametersStringified",void 0);dc=Rt([Ye(),mr("design:paramtypes",[String,Object])],dc);var hc=class{};Rt([g(),mr("design:type",String)],hc.prototype,"did",void 0);Rt([g(),mr("design:type",Ki)],hc.prototype,"status",void 0);hc=Rt([K()],hc);var Hh=class{},un=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},na=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ci=class{};un([g(),na("design:type",String)],ci.prototype,"name",void 0);un([g(),na("design:type",String)],ci.prototype,"address",void 0);un([g(),na("design:type",String)],ci.prototype,"settings",void 0);un([g(),na("design:type",Wi)],ci.prototype,"icon",void 0);un([g(),na("design:type",Wi)],ci.prototype,"constructorIcon",void 0);un([g(),na("design:type",Wi)],ci.prototype,"settingsIcon",void 0);ci=un([K()],ci);var yt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ct=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Kt=class{};yt([g(),Ct("design:type",String)],Kt.prototype,"name",void 0);yt([g(),Ct("design:type",String)],Kt.prototype,"address",void 0);yt([g(),Ct("design:type",String)],Kt.prototype,"description",void 0);yt([g(),Ct("design:type",String)],Kt.prototype,"author",void 0);yt([g(),Ct("design:type",Boolean)],Kt.prototype,"templated",void 0);yt([g(),Ct("design:type",String)],Kt.prototype,"templateSourceLanguageAddress",void 0);yt([g(),Ct("design:type",String)],Kt.prototype,"templateAppliedParams",void 0);yt([g(),Ct("design:type",Array)],Kt.prototype,"possibleTemplateParams",void 0);yt([g(),Ct("design:type",String)],Kt.prototype,"sourceCodeLink",void 0);Kt=yt([K()],Kt);var Kn=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};yt([g(),Ct("design:type",String)],Kn.prototype,"name",void 0);yt([g(),Ct("design:type",String)],Kn.prototype,"description",void 0);yt([g(),Ct("design:type",Array)],Kn.prototype,"possibleTemplateParams",void 0);yt([g(),Ct("design:type",String)],Kn.prototype,"sourceCodeLink",void 0);Kn=yt([Ye(),Ct("design:paramtypes",[String,String])],Kn);var Gh=class{},Kh=class extends pi(){},Zh=class{},Ec=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},lp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},mc=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Ec([g(),lp("design:type",String)],mc.prototype,"linkLanguage",void 0);Ec([g(),lp("design:type",fr)],mc.prototype,"meta",void 0);mc=Ec([K(),lp("design:paramtypes",[String,fr])],mc);var Hl=class extends pi(){};Hl=Ec([K()],Hl);var ln=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},pn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Gl;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(Gl||(Gl={}));var ui=class{constructor(e,t,i){this.uuid=e,this.name=t,i?this.state=i:this.state=Gl.Private}};ln([g(),pn("design:type",String)],ui.prototype,"uuid",void 0);ln([g(),pn("design:type",String)],ui.prototype,"name",void 0);ln([g(),pn("design:type",String)],ui.prototype,"state",void 0);ln([g(),pn("design:type",String)],ui.prototype,"sharedUrl",void 0);ln([g(),pn("design:type",Hl)],ui.prototype,"neighbourhood",void 0);ln([g(),pn("design:type",Array)],ui.prototype,"owners",void 0);ui=ln([K(),pn("design:paramtypes",[String,String,String])],ui);var Cc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},um=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},gc=class{};Cc([g(),um("design:type",Array)],gc.prototype,"additions",void 0);Cc([g(),um("design:type",Array)],gc.prototype,"removals",void 0);gc=Cc([K()],gc);var Jh=class extends pi(){};Jh=Cc([K()],Jh);var Yh=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Fn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Xa,Ui,Os="smart_literal://content";function $3(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}var bo=class{constructor(e,t){Xa.set(this,void 0),Ui.set(this,void 0),Yh(this,Xa,e,"f"),Yh(this,Ui,t,"f")}get base(){return Fn(this,Ui,"f")}static async create(e,t){let i=ct.from($3(10)).toUrl(),n=new bo(e,i);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new st({source:t,predicate:Os}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new st({predicate:Os}))).map(i=>new bo(e,i.data.source))}async get(){let e=await Fn(this,Xa,"f").getSingleTarget(new st({source:Fn(this,Ui,"f"),predicate:Os}));if(!e)throw`No content for smart literal ${Fn(this,Ui,"f")}`;return ct.fromUrl(e).get()}async set(e){let t=ct.from(e);await Fn(this,Xa,"f").setSingleTarget(new Gi({source:Fn(this,Ui,"f"),predicate:Os,target:t.toUrl()}))}};Xa=new WeakMap,Ui=new WeakMap;var Xh=class{};function m7(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function g7(r){return`triple(this, "${r}", _)`}function y7(r){return function(e,t,i){if(typeof i.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");i.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(r&&r.where)for(let l in r.where){let d=r.where[l];c+=`, property_getter(C, Instance, "${l}", "${d}")`}r&&r.condition&&(c+=", "+r.condition);try{let l=await a.infer(c);if(l&&l!==!1&&typeof l!="string"&&l.length>0){for(let d of l){let f=d.Instance,p=new Bn(a,f,s);await p.init(),o.push(p)}return o}}catch{}let u=await a.getAllSubjectInstances(s);if(r&&r.where){let l=[];for(let d of u){let f=!0;for(let p in r.where){let h=r.where[p];if(await d[p]!==h){f=!1;break}}f&&l.push(d)}return l}return u}}}function lm(r){return function(e,t){if(typeof r.writable>"u"&&r.through&&(r.writable=!0),r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...r},r.writable){let i=t;e[`set${ei(i)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function v7(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],through:r.through,required:!0,initial:r.value,flag:!0},e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function b7(r){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=r;let i=t;e[`add${ei(i)}`]=()=>{},e[`remove${ei(i)}`]=()=>{},e[`setCollection${ei(i)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function pm(r){let e="",t="abcdefghijklmnopqrstuvwxyz",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function L3(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",i=r.name,n=e.prototype,a=pm(8);t+=`subject_class("${i}", ${a}).
905
+ `;let o=[],s=[];n.subjectConstructor&&n.subjectConstructor.length&&(s=s.concat(n.subjectConstructor));let c=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(c=c.concat(n.isSubjectInstance));let u=[],l=n.__properties||{};for(let h in l){let m=`property(${a}, "${h}").
906
+ `,{through:y,initial:w,required:b,resolveLanguage:S,writable:_,flag:T,getter:R,setter:A,local:N}=l[h];if(S&&(m+=`property_resolve(${a}, "${h}").
907
907
  `,m+=`property_resolve_language(${a}, "${h}", "${S}").
908
908
  `),R?m+=`property_getter(${a}, Base, "${h}", Value) :- ${R}.
909
- `:v&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${v}", Value).
910
- `,b&&(T?c.push(`triple(Base, "${v}", "${w}")`):c.push(`triple(Base, "${v}", _)`))),A)m+=`property_setter(${a}, "${h}", Actions) :- ${A}.
911
- `;else if(_&&v&&typeof n[Yu(h)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:v,target:"value",...N&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${Oi(P)}').
912
- `}l.push(m),w&&(s.push({action:"addLink",source:"this",predicate:v,target:w}),o.push({action:"removeLink",source:"this",predicate:v,target:"*"}))}let d=[],f=n.__collections||{};for(let h in f){let m=`collection(${a}, "${h}").
913
- `,{through:v,where:w,local:b}=f[h];if(v){if(w){if(!w.isInstance&&!w.condition)throw"'where' needs one of 'isInstance' or 'condition'";let R=[];if(w.isInstance){let N;w.isInstance.name?N=w.isInstance.name:N=w.isInstance,R.push(`instance(OtherClass, Target), subject_class("${N}", OtherClass)`)}w.condition&&R.push(w.condition);let A=R.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${v}", Target), ${A}), List).
914
- `}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${v}", C), List).
915
- `;let S=[{action:"addLink",source:"this",predicate:v,target:"value",...b&&{local:!0}}],_=[{action:"removeLink",source:"this",predicate:v,target:"value"}],T=[{action:"collectionSetter",source:"this",predicate:v,target:"value",...b&&{local:!0}}];m+=`collection_adder(${a}, "${jn(h)}", '${Oi(S)}').
916
- `,m+=`collection_remover(${a}, "${jn(h)}", '${Oi(_)}').
917
- `,m+=`collection_setter(${a}, "${jn(h)}", '${Oi(T)}').
918
- `}d.push(m)}let p=Oi(s);if(t+=`constructor(${a}, '${p}').
909
+ `:y&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${y}", Value).
910
+ `,b&&(T?c.push(`triple(Base, "${y}", "${w}")`):c.push(`triple(Base, "${y}", _)`))),A)m+=`property_setter(${a}, "${h}", Actions) :- ${A}.
911
+ `;else if(_&&y&&typeof n[Xl(h)]=="function"){let $=[{action:"setSingleTarget",source:"this",predicate:y,target:"value",...N&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${Di($)}').
912
+ `}u.push(m),w&&(s.push({action:"addLink",source:"this",predicate:y,target:w}),o.push({action:"removeLink",source:"this",predicate:y,target:"*"}))}let d=[],f=n.__collections||{};for(let h in f){let m=`collection(${a}, "${h}").
913
+ `,{through:y,where:w,local:b}=f[h];if(y){if(w){if(!w.isInstance&&!w.condition)throw"'where' needs one of 'isInstance' or 'condition'";let R=[];if(w.isInstance){let N;w.isInstance.name?N=w.isInstance.name:N=w.isInstance,R.push(`instance(OtherClass, Target), subject_class("${N}", OtherClass)`)}w.condition&&R.push(w.condition);let A=R.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${y}", Target), ${A}), List).
914
+ `}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${y}", C), List).
915
+ `;let S=[{action:"addLink",source:"this",predicate:y,target:"value",...b&&{local:!0}}],_=[{action:"removeLink",source:"this",predicate:y,target:"value"}],T=[{action:"collectionSetter",source:"this",predicate:y,target:"value",...b&&{local:!0}}];m+=`collection_adder(${a}, "${qn(h)}", '${Di(S)}').
916
+ `,m+=`collection_remover(${a}, "${qn(h)}", '${Di(_)}').
917
+ `,m+=`collection_setter(${a}, "${qn(h)}", '${Di(T)}').
918
+ `}d.push(m)}let p=Di(s);if(t+=`constructor(${a}, '${p}').
919
919
  `,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
920
920
  `,t+=`
921
- `}return t+=`destructor(${a}, '${Oi(o)}').
921
+ `}return t+=`destructor(${a}, '${Di(o)}').
922
922
  `,t+=`
923
- `,t+=l.join(`
923
+ `,t+=u.join(`
924
924
  `),t+=`
925
925
  `,t+=d.join(`
926
- `),{sdna:t,name:i}},Object.defineProperty(e,"type",{configurable:!0})}}function b7(r){return cm({...r,required:!0,writable:!0,initial:r.initial||"literal://string:uninitialized"})}function _7(r){return cm({...r,writable:!1})}var S7=`
926
+ `),{sdna:t,name:i}},Object.defineProperty(e,"type",{configurable:!0})}}function _7(r){return lm({...r,required:!0,writable:!0,initial:r.initial||"literal://string:uninitialized"})}function S7(r){return lm({...r,writable:!1})}var w7=`
927
927
  type AIModelLoadingStatus {
928
928
  downloaded: Boolean!
929
929
  loaded: Boolean!
@@ -1509,7 +1509,7 @@ input VoiceActivityParamsInput {
1509
1509
  startWindow: Float
1510
1510
  timeBeforeSpeech: Float
1511
1511
  }
1512
- `;function Yh(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function um(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,i=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${Yh(e)} your ${t} actions, with access to ${Yh(i)}`}var D=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},y=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},X=function(r,e){return function(t,i){e(t,i,r)}},Eo=new ii;Eo.author="did:ad4m:test";Eo.timestamp=Date.now();Eo.data={source:"root",target:"neighbourhood://Qm12345"};Eo.proof={signature:"",key:"",valid:!0};var Zr=new Gi;Zr.author="did:ad4m:test";Zr.timestamp=Date.now().toString();Zr.proof=new Ar("","");Zr.data=new pr([Eo]);var gc=class{};D([g(),y("design:type",String)],gc.prototype,"recipient",void 0);D([g(),y("design:type",Gi)],gc.prototype,"message",void 0);gc=D([K()],gc);var Gn=class{};D([g(),y("design:type",String)],Gn.prototype,"ad4mExecutorVersion",void 0);D([g(),y("design:type",Boolean)],Gn.prototype,"isInitialized",void 0);D([g(),y("design:type",Boolean)],Gn.prototype,"isUnlocked",void 0);Gn=D([K()],Gn);var en=class{};D([g(),y("design:type",String)],en.prototype,"title",void 0);D([g(),y("design:type",String)],en.prototype,"message",void 0);D([g(),y("design:type",String)],en.prototype,"type",void 0);D([g(),y("design:type",String)],en.prototype,"addon",void 0);en=D([K()],en);var qt=class{};D([g(),y("design:type",String)],qt.prototype,"description",void 0);D([g(),y("design:type",String)],qt.prototype,"appName",void 0);D([g(),y("design:type",String)],qt.prototype,"appUrl",void 0);D([g(),y("design:type",String)],qt.prototype,"appIconPath",void 0);D([g(),y("design:type",String)],qt.prototype,"trigger",void 0);D([g(),y("design:type",Array)],qt.prototype,"perspectiveIds",void 0);D([g(),y("design:type",String)],qt.prototype,"webhookUrl",void 0);D([g(),y("design:type",String)],qt.prototype,"webhookAuth",void 0);qt=D([Je()],qt);var It=class{};D([g(),y("design:type",String)],It.prototype,"id",void 0);D([g(),y("design:type",Boolean)],It.prototype,"granted",void 0);D([g(),y("design:type",String)],It.prototype,"description",void 0);D([g(),y("design:type",String)],It.prototype,"appName",void 0);D([g(),y("design:type",String)],It.prototype,"appUrl",void 0);D([g(),y("design:type",String)],It.prototype,"appIconPath",void 0);D([g(),y("design:type",String)],It.prototype,"trigger",void 0);D([g(),y("design:type",Array)],It.prototype,"perspectiveIds",void 0);D([g(),y("design:type",String)],It.prototype,"webhookUrl",void 0);D([g(),y("design:type",String)],It.prototype,"webhookAuth",void 0);It=D([K()],It);var Kn=class{};D([g(),y("design:type",It)],Kn.prototype,"notification",void 0);D([g(),y("design:type",String)],Kn.prototype,"perspectiveId",void 0);D([g(),y("design:type",String)],Kn.prototype,"triggerMatch",void 0);Kn=D([K()],Kn);var Ze=class{};D([g(),y("design:type",Number)],Ze.prototype,"total",void 0);D([g(),y("design:type",Number)],Ze.prototype,"imported",void 0);D([g(),y("design:type",Number)],Ze.prototype,"failed",void 0);D([g(),y("design:type",Number)],Ze.prototype,"omitted",void 0);D([g(),y("design:type",Array)],Ze.prototype,"errors",void 0);Ze=D([K()],Ze);var Ot=class{};D([g(),y("design:type",Ze)],Ot.prototype,"perspectives",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"links",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"expressions",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"perspectiveDiffs",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"notifications",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"models",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"defaultModels",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"tasks",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"friends",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"trustedAgents",void 0);D([g(),y("design:type",Ze)],Ot.prototype,"knownLinkLanguages",void 0);Ot=D([K()],Ot);var Zn=class{};D([g(),y("design:type",String)],Zn.prototype,"email",void 0);D([g(),y("design:type",String)],Zn.prototype,"did",void 0);D([g(),y("design:type",String)],Zn.prototype,"lastSeen",void 0);D([g(),y("design:type",Number)],Zn.prototype,"perspectiveCount",void 0);Zn=D([K()],Zn);var tn=class{};D([g(),y("design:type",Boolean)],tn.prototype,"success",void 0);D([g(),y("design:type",String)],tn.prototype,"message",void 0);D([g(),y("design:type",Boolean)],tn.prototype,"requiresPassword",void 0);D([g(),y("design:type",Boolean)],tn.prototype,"isExistingUser",void 0);tn=D([K()],tn);var Q=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,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Zr}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Zr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Zr}]}runtimeMessageReceived(){return Zr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:zu.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,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,i){return new Ki("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,i){return!0}};D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeQuit",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeOpenLink",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Gn)],Q.prototype,"runtimeInfo",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"addTrustedAgents",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"deleteTrustedAgents",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"getTrustedAgents",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"runtimeKnownLinkLanguageTemplates",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"runtimeAddKnownLinkLanguageTemplates",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"runtimeFriends",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"runtimeAddFriends",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],Q.prototype,"runtimeRemoveFriends",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",String)],Q.prototype,"runtimeHcAgentInfos",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",String)],Q.prototype,"runtimeGetNetworkMetrics",null);D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeRestartHolochain",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Object]),y("design:returntype",Boolean)],Q.prototype,"runtimeHcAddAgentInfos",null);D([Dt(),X(0,Y()),X(1,Y()),X(2,Y()),X(3,Y()),y("design:type",Function),y("design:paramtypes",[String,String,String,String]),y("design:returntype",void 0)],Q.prototype,"runtimeVerifyStringSignedByDid",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[pr]),y("design:returntype",Boolean)],Q.prototype,"runtimeSetStatus",null);D([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Gi)],Q.prototype,"runtimeFriendStatus",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,ec]),y("design:returntype",Boolean)],Q.prototype,"runtimeFriendSendMessage",null);D([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Array)],Q.prototype,"runtimeMessageInbox",null);D([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Array)],Q.prototype,"runtimeMessageOutbox",null);D([Ku(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Gi)],Q.prototype,"runtimeMessageReceived",null);D([Ku(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",en)],Q.prototype,"exceptionOccurred",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[qt]),y("design:returntype",String)],Q.prototype,"runtimeRequestInstallNotification",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"runtimeNotifications",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,qt]),y("design:returntype",Boolean)],Q.prototype,"runtimeUpdateNotification",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeRemoveNotification",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeGrantNotification",null);D([Ku(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Kn)],Q.prototype,"runtimeNotificationTriggered",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeExportDb",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeImportDb",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",Boolean)],Q.prototype,"runtimeExportPerspective",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeImportPerspective",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeMultiUserEnabled",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Boolean]),y("design:returntype",Boolean)],Q.prototype,"runtimeSetMultiUserEnabled",null);D([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],Q.prototype,"runtimeListUsers",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,fr]),y("design:returntype",tn)],Q.prototype,"runtimeRequestLoginVerification",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,String]),y("design:returntype",String)],Q.prototype,"runtimeVerifyEmailCode",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],Q.prototype,"runtimeTestEmail",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,fr]),y("design:returntype",Ki)],Q.prototype,"runtimeCreateUser",null);D([Se(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",String)],Q.prototype,"runtimeLoginUser",null);D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestModeEnable",null);D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestModeDisable",null);D([Se(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",String)],Q.prototype,"runtimeEmailTestGetCode",null);D([Se(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestClearCodes",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,Number]),y("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestSetExpiry",null);Q=D([h0()],Q);var Na=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},fe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},nt,Ya,Ws,Qe;function Hs(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Xh(r){return r?`triple("${r}", "ad4m://has_child", Base)`:""}function Su(){return`
1512
+ `,D=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},v=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},X=function(r,e){return function(t,i){e(t,i,r)}},xo=new ni;xo.author="did:ad4m:test";xo.timestamp=Date.now();xo.data={source:"root",target:"neighbourhood://Qm12345"};xo.proof={signature:"",key:"",valid:!0};var Jr=new Ki;Jr.author="did:ad4m:test";Jr.timestamp=Date.now().toString();Jr.proof=new kr("","");Jr.data=new fr([xo]);var yc=class{};D([g(),v("design:type",String)],yc.prototype,"recipient",void 0);D([g(),v("design:type",Ki)],yc.prototype,"message",void 0);yc=D([K()],yc);var Zn=class{};D([g(),v("design:type",String)],Zn.prototype,"ad4mExecutorVersion",void 0);D([g(),v("design:type",Boolean)],Zn.prototype,"isInitialized",void 0);D([g(),v("design:type",Boolean)],Zn.prototype,"isUnlocked",void 0);Zn=D([K()],Zn);var tn=class{};D([g(),v("design:type",String)],tn.prototype,"title",void 0);D([g(),v("design:type",String)],tn.prototype,"message",void 0);D([g(),v("design:type",String)],tn.prototype,"type",void 0);D([g(),v("design:type",String)],tn.prototype,"addon",void 0);tn=D([K()],tn);var Bt=class{};D([g(),v("design:type",String)],Bt.prototype,"description",void 0);D([g(),v("design:type",String)],Bt.prototype,"appName",void 0);D([g(),v("design:type",String)],Bt.prototype,"appUrl",void 0);D([g(),v("design:type",String)],Bt.prototype,"appIconPath",void 0);D([g(),v("design:type",String)],Bt.prototype,"trigger",void 0);D([g(),v("design:type",Array)],Bt.prototype,"perspectiveIds",void 0);D([g(),v("design:type",String)],Bt.prototype,"webhookUrl",void 0);D([g(),v("design:type",String)],Bt.prototype,"webhookAuth",void 0);Bt=D([Ye()],Bt);var Ot=class{};D([g(),v("design:type",String)],Ot.prototype,"id",void 0);D([g(),v("design:type",Boolean)],Ot.prototype,"granted",void 0);D([g(),v("design:type",String)],Ot.prototype,"description",void 0);D([g(),v("design:type",String)],Ot.prototype,"appName",void 0);D([g(),v("design:type",String)],Ot.prototype,"appUrl",void 0);D([g(),v("design:type",String)],Ot.prototype,"appIconPath",void 0);D([g(),v("design:type",String)],Ot.prototype,"trigger",void 0);D([g(),v("design:type",Array)],Ot.prototype,"perspectiveIds",void 0);D([g(),v("design:type",String)],Ot.prototype,"webhookUrl",void 0);D([g(),v("design:type",String)],Ot.prototype,"webhookAuth",void 0);Ot=D([K()],Ot);var Jn=class{};D([g(),v("design:type",Ot)],Jn.prototype,"notification",void 0);D([g(),v("design:type",String)],Jn.prototype,"perspectiveId",void 0);D([g(),v("design:type",String)],Jn.prototype,"triggerMatch",void 0);Jn=D([K()],Jn);var Je=class{};D([g(),v("design:type",Number)],Je.prototype,"total",void 0);D([g(),v("design:type",Number)],Je.prototype,"imported",void 0);D([g(),v("design:type",Number)],Je.prototype,"failed",void 0);D([g(),v("design:type",Number)],Je.prototype,"omitted",void 0);D([g(),v("design:type",Array)],Je.prototype,"errors",void 0);Je=D([K()],Je);var Dt=class{};D([g(),v("design:type",Je)],Dt.prototype,"perspectives",void 0);D([g(),v("design:type",Je)],Dt.prototype,"links",void 0);D([g(),v("design:type",Je)],Dt.prototype,"expressions",void 0);D([g(),v("design:type",Je)],Dt.prototype,"perspectiveDiffs",void 0);D([g(),v("design:type",Je)],Dt.prototype,"notifications",void 0);D([g(),v("design:type",Je)],Dt.prototype,"models",void 0);D([g(),v("design:type",Je)],Dt.prototype,"defaultModels",void 0);D([g(),v("design:type",Je)],Dt.prototype,"tasks",void 0);D([g(),v("design:type",Je)],Dt.prototype,"friends",void 0);D([g(),v("design:type",Je)],Dt.prototype,"trustedAgents",void 0);D([g(),v("design:type",Je)],Dt.prototype,"knownLinkLanguages",void 0);Dt=D([K()],Dt);var Yn=class{};D([g(),v("design:type",String)],Yn.prototype,"email",void 0);D([g(),v("design:type",String)],Yn.prototype,"did",void 0);D([g(),v("design:type",String)],Yn.prototype,"lastSeen",void 0);D([g(),v("design:type",Number)],Yn.prototype,"perspectiveCount",void 0);Yn=D([K()],Yn);var rn=class{};D([g(),v("design:type",Boolean)],rn.prototype,"success",void 0);D([g(),v("design:type",String)],rn.prototype,"message",void 0);D([g(),v("design:type",Boolean)],rn.prototype,"requiresPassword",void 0);D([g(),v("design:type",Boolean)],rn.prototype,"isExistingUser",void 0);rn=D([K()],rn);var Q=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,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Jr}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Jr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Jr}]}runtimeMessageReceived(){return Jr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Wl.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,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,i){return new Zi("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,i){return!0}};D([Se(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],Q.prototype,"runtimeQuit",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],Q.prototype,"runtimeOpenLink",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Zn)],Q.prototype,"runtimeInfo",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],Q.prototype,"addTrustedAgents",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],Q.prototype,"deleteTrustedAgents",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],Q.prototype,"getTrustedAgents",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],Q.prototype,"runtimeKnownLinkLanguageTemplates",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],Q.prototype,"runtimeAddKnownLinkLanguageTemplates",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],Q.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],Q.prototype,"runtimeFriends",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],Q.prototype,"runtimeAddFriends",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],Q.prototype,"runtimeRemoveFriends",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],Q.prototype,"runtimeHcAgentInfos",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],Q.prototype,"runtimeGetNetworkMetrics",null);D([Se(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],Q.prototype,"runtimeRestartHolochain",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Object]),v("design:returntype",Boolean)],Q.prototype,"runtimeHcAddAgentInfos",null);D([Nt(),X(0,Y()),X(1,Y()),X(2,Y()),X(3,Y()),v("design:type",Function),v("design:paramtypes",[String,String,String,String]),v("design:returntype",void 0)],Q.prototype,"runtimeVerifyStringSignedByDid",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[fr]),v("design:returntype",Boolean)],Q.prototype,"runtimeSetStatus",null);D([Nt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Ki)],Q.prototype,"runtimeFriendStatus",null);D([Se(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,tc]),v("design:returntype",Boolean)],Q.prototype,"runtimeFriendSendMessage",null);D([Nt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],Q.prototype,"runtimeMessageInbox",null);D([Nt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],Q.prototype,"runtimeMessageOutbox",null);D([Zl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Ki)],Q.prototype,"runtimeMessageReceived",null);D([Zl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",tn)],Q.prototype,"exceptionOccurred",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Bt]),v("design:returntype",String)],Q.prototype,"runtimeRequestInstallNotification",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],Q.prototype,"runtimeNotifications",null);D([Se(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,Bt]),v("design:returntype",Boolean)],Q.prototype,"runtimeUpdateNotification",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],Q.prototype,"runtimeRemoveNotification",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],Q.prototype,"runtimeGrantNotification",null);D([Zl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Jn)],Q.prototype,"runtimeNotificationTriggered",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],Q.prototype,"runtimeExportDb",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],Q.prototype,"runtimeImportDb",null);D([Se(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",Boolean)],Q.prototype,"runtimeExportPerspective",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],Q.prototype,"runtimeImportPerspective",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],Q.prototype,"runtimeMultiUserEnabled",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",Boolean)],Q.prototype,"runtimeSetMultiUserEnabled",null);D([Nt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],Q.prototype,"runtimeListUsers",null);D([Se(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,dr]),v("design:returntype",rn)],Q.prototype,"runtimeRequestLoginVerification",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,String]),v("design:returntype",String)],Q.prototype,"runtimeVerifyEmailCode",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],Q.prototype,"runtimeTestEmail",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,dr]),v("design:returntype",Zi)],Q.prototype,"runtimeCreateUser",null);D([Se(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",String)],Q.prototype,"runtimeLoginUser",null);D([Se(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestModeEnable",null);D([Se(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestModeDisable",null);D([Se(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",String)],Q.prototype,"runtimeEmailTestGetCode",null);D([Se(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestClearCodes",null);D([Se(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,Number]),v("design:returntype",Boolean)],Q.prototype,"runtimeEmailTestSetExpiry",null);Q=D([m0()],Q);var Pa=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},fe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},at,eo,Hs,ze;function Gs(r){return r.charAt(0).toUpperCase()+r.slice(1)}function e1(r){return r?`triple("${r}", "ad4m://has_child", Base)`:""}function wl(){return`
1513
1513
  findall(
1514
1514
  [T, A],
1515
1515
  link(Base, _, _, T, A),
@@ -1517,13 +1517,13 @@ input VoiceActivityParamsInput {
1517
1517
  ),
1518
1518
  sort(AllLinks, SortedLinks),
1519
1519
  SortedLinks = [[Timestamp, Author]|_]
1520
- `}function e1(r){return`
1520
+ `}function t1(r){return`
1521
1521
  findall([PropertyName, PropertyValue, Resolve], (
1522
1522
  % Constrain to specified properties if provided
1523
1523
  ${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
1524
1524
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1525
1525
  ), Properties)
1526
- `}function t1(r){return`
1526
+ `}function r1(r){return`
1527
1527
  findall([CollectionName, CollectionValues], (
1528
1528
  % Constrain to specified collections if provided
1529
1529
  ${r?`member(CollectionName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
@@ -1531,43 +1531,43 @@ input VoiceActivityParamsInput {
1531
1531
  collection(SubjectClass, CollectionName),
1532
1532
  collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
1533
1533
  ), Collections)
1534
- `}function r1(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,i])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=Hs(t);if(Array.isArray(i)){let s=i.map(c=>e(c)).join(", ");return n?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof i=="object"&&i!==null){let{not:s,between:c,lt:l,lte:u,gt:d,gte:f}=i;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return n?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return n?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:l,symbol:"<"},{value:u,symbol:"=<"},{value:d,symbol:">"},{value:f,symbol:">="}];for(let{value:h,symbol:m}of p)if(h!==void 0)return n?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return n?`${o} = ${e(i)}`:`${a}, Value${t} = ${e(i)}`}).join(", ")}function i1(r){return r?"length(UnsortedInstances, TotalCount)":""}function n1(r){if(!r)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(r)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function a1(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function o1(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function s1(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),i=(t||"").replace(/\/+$/,"");return`${e}://${i}`}else return r.replace(/\/+$/,"")}function up(r){if(!!r){if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r.find(t=>t!=="null")||r[0]}}function pm(r,e){return up(r.type)===e}function c1(r){return pm(r,"array")}function l1(r){return pm(r,"object")}function L3(r){let e=up(r.type);return e==="number"||e==="integer"}var Jr=class{static async getClassName(e){if(this===Jr)return await e.stringOrTemplateObjectToSubjectClassName(this);let i=this.classNamesByClass.get(this);i||(i={},this.classNamesByClass.set(this,i));let n=e.uuid;return i[n]||(i[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),i[n]}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let t=e.className,i={},n=e.__properties||{};for(let[u,d]of Object.entries(n)){let f=d;i[u]={name:u,predicate:f.through||"",required:f.required||!1,writable:f.writable||!1,...f.initial!==void 0&&{initial:f.initial},...f.resolveLanguage!==void 0&&{resolveLanguage:f.resolveLanguage},...f.getter!==void 0&&{getter:f.getter},...f.setter!==void 0&&{setter:f.setter},...f.local!==void 0&&{local:f.local},...f.transform!==void 0&&{transform:f.transform},...f.flag!==void 0&&{flag:f.flag}}}let a={},o=e.__collections||{};for(let[u,d]of Object.entries(o)){let f=d;a[u]={name:u,predicate:f.through||"",...f.where!==void 0&&{where:f.where},...f.local!==void 0&&{local:f.local}}}let s=Object.keys(i).length>0,c=Object.keys(a).length>0;if(!(s||c)&&e.__jsonSchema){let u=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(u.properties)for(let[f,p]of Object.entries(u.properties)){let h=c1(p),m=this.determinePredicate(u,f,p,this.determineNamespace(u,d),d);if(h)a[f]={name:f,predicate:m,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let v=u.required?.includes(f)||!1;i[f]={name:f,predicate:m,required:v,writable: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:i,collections:a}}constructor(e,t,i){nt.set(this,void 0),Ya.set(this,void 0),Ws.set(this,void 0),Qe.set(this,void 0),Na(this,nt,t||ut.from(lm(24)).toUrl(),"f"),Na(this,Qe,e,"f"),Na(this,Ws,i||"ad4m://self","f")}get baseExpression(){return fe(this,nt,"f")}get perspective(){return fe(this,Qe,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,t){if(t.setter)throw new Error(`Custom setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateCollectionAction(e,t){let i=this.getCollectionMetadata(e);if(!i)throw new Error(`Collection "${e}" has no metadata defined`);if(!i.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:i.through,target:"value",...i.local&&{local:!0}}]}static async assignValuesToInstance(e,t,i){let n=Object.fromEntries(await Promise.all(i.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let u=Array.from(o,p=>p.codePointAt(0)),d=u.every(p=>p<=255),f=u.some(p=>p>=128);if(d&&f)try{let p=Uint8Array.from(u),h=new TextDecoder("utf-8",{fatal:!0}).decode(p);h!==o&&(c=h)}catch(p){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:p})}}if(s){let u=await e.getExpression(o);if(u)try{c=JSON.parse(u.data)}catch{c=u.data}}let l=t.__properties?.[a]?.transform;return l&&typeof l=="function"&&(c=l(c)),[a,c]})));Object.assign(t,n)}async getData(){let e=[Su(),e1(),t1()],t=`
1535
- Base = "${fe(this,nt,"f")}",
1536
- subject_class("${fe(this,Ya,"f")}", SubjectClass),
1534
+ `}function i1(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,i])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=Gs(t);if(Array.isArray(i)){let s=i.map(c=>e(c)).join(", ");return n?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof i=="object"&&i!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:f}=i;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return n?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return n?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:f,symbol:">="}];for(let{value:h,symbol:m}of p)if(h!==void 0)return n?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return n?`${o} = ${e(i)}`:`${a}, Value${t} = ${e(i)}`}).join(", ")}function n1(r){return r?"length(UnsortedInstances, TotalCount)":""}function a1(r){if(!r)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(r)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function o1(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function s1(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function c1(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),i=(t||"").replace(/\/+$/,"");return`${e}://${i}`}else return r.replace(/\/+$/,"")}function pp(r){if(!!r){if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r.find(t=>t!=="null")||r[0]}}function fm(r,e){return pp(r.type)===e}function u1(r){return fm(r,"array")}function l1(r){return fm(r,"object")}function F3(r){let e=pp(r.type);return e==="number"||e==="integer"}var Yr=class{static async getClassName(e){if(this===Yr)return await e.stringOrTemplateObjectToSubjectClassName(this);let i=this.classNamesByClass.get(this);i||(i={},this.classNamesByClass.set(this,i));let n=e.uuid;return i[n]||(i[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),i[n]}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let t=e.className,i={},n=e.__properties||{};for(let[l,d]of Object.entries(n)){let f=d;i[l]={name:l,predicate:f.through||"",required:f.required||!1,writable:f.writable||!1,...f.initial!==void 0&&{initial:f.initial},...f.resolveLanguage!==void 0&&{resolveLanguage:f.resolveLanguage},...f.getter!==void 0&&{getter:f.getter},...f.setter!==void 0&&{setter:f.setter},...f.local!==void 0&&{local:f.local},...f.transform!==void 0&&{transform:f.transform},...f.flag!==void 0&&{flag:f.flag}}}let a={},o=e.__collections||{};for(let[l,d]of Object.entries(o)){let f=d;a[l]={name:l,predicate:f.through||"",...f.where!==void 0&&{where:f.where},...f.local!==void 0&&{local:f.local}}}let s=Object.keys(i).length>0,c=Object.keys(a).length>0;if(!(s||c)&&e.__jsonSchema){let l=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(l.properties)for(let[f,p]of Object.entries(l.properties)){let h=u1(p),m=this.determinePredicate(l,f,p,this.determineNamespace(l,d),d);if(h)a[f]={name:f,predicate:m,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let y=l.required?.includes(f)||!1;i[f]={name:f,predicate:m,required:y,writable: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:i,collections:a}}constructor(e,t,i){at.set(this,void 0),eo.set(this,void 0),Hs.set(this,void 0),ze.set(this,void 0),Pa(this,at,t||ct.from(pm(24)).toUrl(),"f"),Pa(this,ze,e,"f"),Pa(this,Hs,i||"ad4m://self","f")}get baseExpression(){return fe(this,at,"f")}get perspective(){return fe(this,ze,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,t){if(t.setter)throw new Error(`Custom setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateCollectionAction(e,t){let i=this.getCollectionMetadata(e);if(!i)throw new Error(`Collection "${e}" has no metadata defined`);if(!i.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:i.through,target:"value",...i.local&&{local:!0}}]}static async assignValuesToInstance(e,t,i){let n=Object.fromEntries(await Promise.all(i.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let l=Array.from(o,p=>p.codePointAt(0)),d=l.every(p=>p<=255),f=l.some(p=>p>=128);if(d&&f)try{let p=Uint8Array.from(l),h=new TextDecoder("utf-8",{fatal:!0}).decode(p);h!==o&&(c=h)}catch(p){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:p})}}if(s){let l=await e.getExpression(o);if(l)try{c=JSON.parse(l.data)}catch{c=l.data}}let u=t.__properties?.[a]?.transform;return u&&typeof u=="function"&&(c=u(c)),[a,c]})));Object.assign(t,n)}async getData(){let e=[wl(),t1(),r1()],t=`
1535
+ Base = "${fe(this,at,"f")}",
1536
+ subject_class("${fe(this,eo,"f")}", SubjectClass),
1537
1537
  ${e.join(", ")}
1538
- `;try{let i=await fe(this,Qe,"f").infer(t);if(i?.[0]&&i[0].Properties&&i[0].Properties.length>0){let{Properties:n,Collections:a,Timestamp:o,Author:s}=i[0],c=[...n,...a,["timestamp",o],["author",s]];return await Jr.assignValuesToInstance(fe(this,Qe,"f"),this,c),this}}catch{console.log(`Prolog getData failed for ${fe(this,nt,"f")}, falling back to SurrealDB`)}try{let n=this.constructor.getModelMetadata(),a=`
1538
+ `;try{let i=await fe(this,ze,"f").infer(t);if(i?.[0]&&i[0].Properties&&i[0].Properties.length>0){let{Properties:n,Collections:a,Timestamp:o,Author:s}=i[0],c=[...n,...a,["timestamp",o],["author",s]];return await Yr.assignValuesToInstance(fe(this,ze,"f"),this,c),this}}catch{console.log(`Prolog getData failed for ${fe(this,at,"f")}, falling back to SurrealDB`)}try{let i=this.constructor,n=i.getModelMetadata(),o=`
1539
1539
  SELECT id, predicate, out.uri AS target, author, timestamp
1540
1540
  FROM link
1541
- WHERE in.uri = '${fe(this,nt,"f")}'
1541
+ WHERE in.uri = ${i.formatSurrealValue(fe(this,at,"f"))}
1542
1542
  ORDER BY timestamp ASC
1543
- `,o=await fe(this,Qe,"f").querySurrealDB(a);if(o&&o.length>0){let s=null,c=null;for(let[l,u]of Object.entries(n.properties)){let d=o.filter(f=>f.predicate===u.predicate);if(d.length>0){let f=d[0],p=f.target;if(f.timestamp&&(!s||f.timestamp>s)&&(s=f.timestamp,c=f.author),u.resolveLanguage&&u.resolveLanguage!=="literal")try{let h=await fe(this,Qe,"f").getExpression(p);if(h)try{p=JSON.parse(h.data)}catch{p=h.data}}catch(h){console.warn(`Failed to resolve expression for ${l}:`,h)}else if(typeof p=="string"&&p.startsWith("literal://"))try{let h=ut.fromUrl(p).get();p=h.data!==void 0?h.data:h}catch{}u.transform&&typeof u.transform=="function"&&(p=u.transform(p)),this[l]=p}}for(let[l,u]of Object.entries(n.collections)){let d=o.filter(f=>f.predicate===u.predicate);this[l]=d.map(f=>f.target)}c&&(this.author=c),s&&(this.timestamp=s)}}catch(i){console.error(`SurrealDB getData also failed for ${fe(this,nt,"f")}:`,i)}return this}static async queryToProlog(e,t,i){let{source:n,properties:a,collections:o,where:s,order:c,offset:l,limit:u,count:d}=t,f=i||await this.getClassName(e),p=[Su(),Xh(n),e1(a),t1(o),r1(s)],h=[i1(d),n1(c),a1(l),o1(u)];return`
1543
+ `,s=await fe(this,ze,"f").querySurrealDB(o);if(s&&s.length>0){let c=null,u=null;for(let[l,d]of Object.entries(n.properties)){let f=s.filter(p=>p.predicate===d.predicate);if(f.length>0){let p=f[0],h=p.target;if(p.timestamp&&(!c||p.timestamp>c)&&(c=p.timestamp,u=p.author),d.resolveLanguage&&d.resolveLanguage!=="literal")try{let m=await fe(this,ze,"f").getExpression(h);if(m)try{h=JSON.parse(m.data)}catch{h=m.data}}catch(m){console.warn(`Failed to resolve expression for ${l}:`,m)}else if(typeof h=="string"&&h.startsWith("literal://"))try{let m=ct.fromUrl(h).get();h=m.data!==void 0?m.data:m}catch{}d.transform&&typeof d.transform=="function"&&(h=d.transform(h)),this[l]=h}}for(let[l,d]of Object.entries(n.collections)){let f=s.filter(p=>p.predicate===d.predicate);this[l]=f.map(p=>p.target)}u&&(this.author=u),c&&(this.timestamp=c)}}catch(i){console.error(`SurrealDB getData also failed for ${fe(this,at,"f")}:`,i)}return this}static async queryToProlog(e,t,i){let{source:n,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:d}=t,f=i||await this.getClassName(e),p=[wl(),e1(n),t1(a),r1(o),i1(s)],h=[n1(d),a1(c),o1(u),s1(l)];return`
1544
1544
  findall([Base, Properties, Collections, Timestamp, Author], (
1545
1545
  subject_class("${f}", SubjectClass),
1546
1546
  instance(SubjectClass, Base),
1547
- ${p.filter(v=>v).join(", ")}
1547
+ ${p.filter(y=>y).join(", ")}
1548
1548
  ), UnsortedInstances),
1549
- ${h.filter(v=>v).join(", ")}
1550
- `}static async queryToSurrealQL(e,t){let i=this.getModelMetadata(),{source:n,where:a,order:o,offset:s,limit:c}=t,l=[];n&&l.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(n)} AND predicate = 'ad4m://has_child']) > 0`);for(let[p,h]of Object.entries(i.properties))h.required&&(h.flag&&h.initial?l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${h.predicate}' AND out.uri = '${h.initial}']) > 0`):l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${h.predicate}']) > 0`));if(l.length===0){for(let[p,h]of Object.entries(i.properties))if(h.initial){h.flag?l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${h.predicate}' AND out.uri = '${h.initial}']) > 0`):l.push(`count(->link[WHERE perspective = $perspective AND predicate = '${h.predicate}']) > 0`);break}}let u=this.buildGraphTraversalWhereClause(i,a),d=[];return d.push(...l),u&&d.push(u),d.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1549
+ ${h.filter(y=>y).join(", ")}
1550
+ `}static async queryToSurrealQL(e,t){let i=this.getModelMetadata(),{source:n,where:a,order:o,offset:s,limit:c}=t,u=[];n&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(n)} AND predicate = 'ad4m://has_child']) > 0`);for(let[p,h]of Object.entries(i.properties))h.required&&(h.flag&&h.initial?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${Te(h.predicate)}' AND out.uri = '${Te(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${Te(h.predicate)}']) > 0`));if(u.length===0){for(let[p,h]of Object.entries(i.properties))if(h.initial){h.flag?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${Te(h.predicate)}' AND out.uri = '${Te(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${Te(h.predicate)}']) > 0`);break}}let l=this.buildGraphTraversalWhereClause(i,a),d=[];return d.push(...u),l&&d.push(l),d.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1551
1551
  SELECT
1552
1552
  id AS source,
1553
1553
  uri AS source_uri,
1554
1554
  ->link[WHERE perspective = $perspective] AS links
1555
1555
  FROM node
1556
1556
  WHERE ${d.join(" AND ")}
1557
- `.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let i=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");i.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let l=c.not.map(u=>this.formatSurrealValue(u)).join(", ");i.push(`${s} NOT IN [${l}]`)}else i.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&i.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&i.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&i.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&i.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&i.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&i.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else i.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[n];if(!s)continue;let c=s.predicate,l=s.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let u=a.map(d=>this.formatSurrealValue(d)).join(", ");i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} IN [${u}]]) > 0`)}else if(typeof a=="object"&&a!==null){let u=a;if(u.not!==void 0)if(Array.isArray(u.not)){let f=u.not.map(p=>this.formatSurrealValue(p)).join(", ");i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} IN [${f}]]) = 0`)}else i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} = ${this.formatSurrealValue(u.not)}]) = 0`);(u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${l} = ${this.formatSurrealValue(a)}]) > 0`)}return i.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let i=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let s="source";if(Array.isArray(a)){let c=a.map(l=>this.formatSurrealValue(l)).join(", ");i.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let l=c.not.map(u=>this.formatSurrealValue(u)).join(", ");i.push(`${s} NOT IN [${l}]`)}else i.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&i.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&i.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&i.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&i.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&i.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&i.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else i.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[n];if(!s)continue;let c=s.predicate,l=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let u=a.map(d=>this.formatSurrealValue(d)).join(", ");i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} IN [${u}])`)}else if(typeof a=="object"&&a!==null){let u=a;if(u.not!==void 0)if(Array.isArray(u.not)){let f=u.not.map(p=>this.formatSurrealValue(p)).join(", ");i.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} IN [${f}])`)}else i.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} = ${this.formatSurrealValue(u.not)})`);(u.gt!==void 0||u.gte!==void 0||u.lt!==void 0||u.lte!==void 0||u.between!==void 0||u.contains!==void 0)&&i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${l} = ${this.formatSurrealValue(a)})`)}return i.join(" AND ")}static buildSurrealSelectFields(e,t,i){let n=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];!c||n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${c.predicate}' LIMIT 1) AS ${s}`)}let o=i||Object.keys(e.collections);for(let s of o){let c=e.collections[s];!c||n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${c.predicate}') AS ${s}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source LIMIT 1) AS timestamp"),n.join(`,
1558
- `)}static buildSurrealSelectFieldsWithAggregation(e,t,i){let n=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];!c||n.push(`array::first(target[WHERE predicate = '${c.predicate}']) AS ${s}`)}let o=i||Object.keys(e.collections);for(let s of o){let c=e.collections[s];!c||n.push(`target[WHERE predicate = '${c.predicate}'] AS ${s}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS timestamp"),n.join(`,
1559
- `)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>this.formatSurrealValue(t)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,t,i){if(!i?.[0]?.AllInstances)return{results:[],totalCount:0};let n=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(i[0].AllInstances.map(async([o,s,c,l,u])=>{try{let d=new this(e,o);n.length&&Object.keys(d).forEach(p=>{n.includes(p)||delete d[p]});let f=[...s,...c,["timestamp",l],["author",u]];return await Jr.assignValuesToInstance(e,d,f),d}catch(d){return console.error(`Failed to process instance ${o}:`,d),null}}))).filter(o=>o!==null),totalCount:i[0].TotalCount}}static async instancesFromSurrealResult(e,t,i){if(!i||i.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],o=t?.collections||[],s=[];for(let f of i){let p;try{if(p=f.source_uri,!p)continue;let h=f.links||[],m=new this(e,p),v=null,w=null;for(let b=0;b<h.length;b++){let S=h[b],_=S.predicate,T=S.target;if(T==="None")continue;S.timestamp&&(!v||S.timestamp>v)&&(v=S.timestamp,w=S.author);let R=!1;for(let[A,N]of Object.entries(n.properties))if(N.predicate===_){let L=m[A],P=typeof L=="object"&&L!==null&&!Array.isArray(L)&&Object.keys(L).length===0;if(!L||L===""||L===0||P){let j=T;if(T!=null&&T!==""){if(N.resolveLanguage!=null&&N.resolveLanguage!=="literal"&&typeof T=="string")try{let ye=await e.getExpression(T);if(ye)try{j=JSON.parse(ye.data)}catch{j=ye.data}}catch(ye){console.warn(`Failed to resolve expression for ${A} with target "${T}":`,ye),console.warn("Falling back to raw value"),j=T}else if(typeof T=="string"&&T.startsWith("literal://"))try{let ye=ut.fromUrl(T).get();ye.data!==void 0?j=ye.data:j=ye}catch{j=T}else if(typeof T=="string"){let ye=typeof m[A];ye==="number"?j=Number(T):ye==="boolean"&&(j=T==="true"||T==="1")}}N.transform&&typeof N.transform=="function"&&(j=N.transform(j)),m[A]=j}R=!0;break}if(!R){for(let[A,N]of Object.entries(n.collections))if(N.predicate===_){m[A]||(m[A]=[]);let L=`__${A}_timestamps`,P=`__${A}_indices`;m[L]||(m[L]=[]),m[P]||(m[P]=[]),m[A].includes(T)||(m[A].push(T),m[L].push(S.timestamp||""),m[P].push(b));break}}}if(w&&v)if(m.author=w,typeof v=="string"&&v.includes("T"))m.timestamp=new Date(v).getTime();else if(typeof v=="string"){let b=parseInt(v,10);m.timestamp=isNaN(b)?v:b}else m.timestamp=v;for(let[b,S]of Object.entries(n.collections)){let _=`__${b}_timestamps`,T=`__${b}_indices`;if(m[b]&&m[_]){let R=m[b].map((A,N)=>({value:A,timestamp:m[_][N]||"",originalIndex:m[T]?.[N]??N}));R.sort((A,N)=>{let L=String(A.timestamp||""),P=String(N.timestamp||""),j=L.localeCompare(P);return j!==0?j:A.originalIndex-N.originalIndex}),m[b]=R.map(A=>A.value),delete m[_],delete m[T]}}if(a.length>0||o.length>0){let b=[...a,...o];Object.keys(m).forEach(S=>{!b.includes(S)&&S!=="timestamp"&&S!=="author"&&S!=="baseExpression"&&delete m[S]})}s.push(m)}catch(h){console.error(`Failed to process SurrealDB instance ${p}:`,h)}}let c=s;t.where&&(c=s.filter(f=>{for(let[p,h]of Object.entries(t.where))if(p!=="base"){if(p==="author"||p==="timestamp"){if(!this.matchesCondition(f[p],h))return!1;continue}if(typeof h=="object"&&h!==null&&!Array.isArray(h)){let m=h;if((m.gt!==void 0||m.gte!==void 0||m.lt!==void 0||m.lte!==void 0||m.between!==void 0||m.contains!==void 0)&&!this.matchesCondition(f[p],h))return!1}}return!0}));let l=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(l){let f=Object.keys(l)[0],p=Object.values(l)[0];c.sort((h,m)=>{let v=h[f],w=m[f];if(v===void 0&&w===void 0)return 0;if(v===void 0)return p==="ASC"?1:-1;if(w===void 0)return p==="ASC"?-1:1;let b=0;return typeof v=="number"&&typeof w=="number"?b=v-w:typeof v=="string"&&typeof w=="string"?b=v.localeCompare(w):b=String(v).localeCompare(String(w)),p==="DESC"?-b:b})}let u=c.length,d=c;if(t.offset!==void 0||t.limit!==void 0){let f=t.offset||0,p=t.limit?f+t.limit:void 0;d=c.slice(f,p)}return{results:d,totalCount:u}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let i=t;if(i.not!==void 0)return Array.isArray(i.not)?!i.not.includes(e):e!==i.not;if(i.between!==void 0&&Array.isArray(i.between)&&i.between.length===2)return e>=i.between[0]&&e<=i.between[1];let n=!0;return i.gt!==void 0&&(n=n&&e>i.gt),i.gte!==void 0&&(n=n&&e>=i.gte),i.lt!==void 0&&(n=n&&e<i.lt),i.lte!==void 0&&(n=n&&e<=i.lte),i.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(i.contains)):Array.isArray(e)?n=n&&e.includes(i.contains):n=!1),n}return e===t}static async findAll(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:o}=await this.instancesFromSurrealResult(e,t,a);return o}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:o}=await this.instancesFromPrologResult(e,t,a);return o}}static async findAllAndCount(e,t={},i=!0){if(i){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,i,n,a=!0){let o={...n||{},limit:t,offset:t*(i-1),count:!0};if(a){let s=await this.queryToSurrealQL(e,o),c=await e.querySurrealDB(s),{results:l,totalCount:u}=await this.instancesFromSurrealResult(e,o,c);return{results:l,totalCount:u,pageSize:t,pageNumber:i}}else{let s=await this.queryToProlog(e,o),c=await e.infer(s),{results:l,totalCount:u}=await this.instancesFromPrologResult(e,o,c);return{results:l,totalCount:u,pageSize:t,pageNumber:i}}}static async countQueryToProlog(e,t={},i){let{source:n,where:a}=t,o=i||await this.getClassName(e),s=[Su(),Xh(n),r1(a)],c=[i1(!0),n1(),a1(),o1()];return`
1557
+ `.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let i=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");i.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");i.push(`${s} NOT IN [${u}]`)}else i.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&i.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&i.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&i.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&i.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&i.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&i.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else i.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[n];if(!s)continue;let c=Te(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${l}]]) > 0`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let f=l.not.map(p=>this.formatSurrealValue(p)).join(", ");i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${f}]]) = 0`)}else i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(l.not)}]) = 0`);(l.gt!==void 0||l.gte!==void 0||l.lt!==void 0||l.lte!==void 0||l.between!==void 0||l.contains!==void 0)&&i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)}]) > 0`)}return i.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let i=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let s="source";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");i.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");i.push(`${s} NOT IN [${u}]`)}else i.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&i.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&i.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&i.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&i.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&i.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&i.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else i.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[n];if(!s)continue;let c=Te(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${l}])`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let f=l.not.map(p=>this.formatSurrealValue(p)).join(", ");i.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${f}])`)}else i.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(l.not)})`);(l.gt!==void 0||l.gte!==void 0||l.lt!==void 0||l.lte!==void 0||l.between!==void 0||l.contains!==void 0)&&i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)})`)}return i.join(" AND ")}static buildSurrealSelectFields(e,t,i){let n=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=Te(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}' LIMIT 1) AS ${s}`)}let o=i||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=Te(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}') AS ${s}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source LIMIT 1) AS timestamp"),n.join(`,
1558
+ `)}static buildSurrealSelectFieldsWithAggregation(e,t,i){let n=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=Te(c.predicate);n.push(`array::first(target[WHERE predicate = '${u}']) AS ${s}`)}let o=i||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=Te(c.predicate);n.push(`target[WHERE predicate = '${u}'] AS ${s}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS timestamp"),n.join(`,
1559
+ `)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>this.formatSurrealValue(t)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,t,i){if(!i?.[0]?.AllInstances)return{results:[],totalCount:0};let n=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(i[0].AllInstances.map(async([o,s,c,u,l])=>{try{let d=new this(e,o);n.length&&Object.keys(d).forEach(p=>{n.includes(p)||delete d[p]});let f=[...s,...c,["timestamp",u],["author",l]];return await Yr.assignValuesToInstance(e,d,f),d}catch(d){return console.error(`Failed to process instance ${o}:`,d),null}}))).filter(o=>o!==null),totalCount:i[0].TotalCount}}static async instancesFromSurrealResult(e,t,i){if(!i||i.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],o=t?.collections||[],s=[];for(let f of i){let p;try{if(p=f.source_uri,!p)continue;let h=f.links||[],m=new this(e,p),y=null,w=null;for(let b=0;b<h.length;b++){let S=h[b],_=S.predicate,T=S.target;if(T==="None")continue;S.timestamp&&(!y||S.timestamp>y)&&(y=S.timestamp,w=S.author);let R=!1;for(let[A,N]of Object.entries(n.properties))if(N.predicate===_){let L=m[A],$=typeof L=="object"&&L!==null&&!Array.isArray(L)&&Object.keys(L).length===0;if(!L||L===""||L===0||$){let j=T;if(T!=null&&T!==""){if(N.resolveLanguage!=null&&N.resolveLanguage!=="literal"&&typeof T=="string")try{let ye=await e.getExpression(T);if(ye)try{j=JSON.parse(ye.data)}catch{j=ye.data}}catch(ye){console.warn(`Failed to resolve expression for ${A} with target "${T}":`,ye),console.warn("Falling back to raw value"),j=T}else if(typeof T=="string"&&T.startsWith("literal://"))try{let ye=ct.fromUrl(T).get();ye.data!==void 0?j=ye.data:j=ye}catch{j=T}else if(typeof T=="string"){let ye=typeof m[A];ye==="number"?j=Number(T):ye==="boolean"&&(j=T==="true"||T==="1")}}N.transform&&typeof N.transform=="function"&&(j=N.transform(j)),m[A]=j}R=!0;break}if(!R){for(let[A,N]of Object.entries(n.collections))if(N.predicate===_){m[A]||(m[A]=[]);let L=`__${A}_timestamps`,$=`__${A}_indices`;m[L]||(m[L]=[]),m[$]||(m[$]=[]),m[A].includes(T)||(m[A].push(T),m[L].push(S.timestamp||""),m[$].push(b));break}}}if(w&&y)if(m.author=w,typeof y=="string"&&y.includes("T"))m.timestamp=new Date(y).getTime();else if(typeof y=="string"){let b=parseInt(y,10);m.timestamp=isNaN(b)?y:b}else m.timestamp=y;for(let[b,S]of Object.entries(n.collections)){let _=`__${b}_timestamps`,T=`__${b}_indices`;if(m[b]&&m[_]){let R=m[b].map((A,N)=>({value:A,timestamp:m[_][N]||"",originalIndex:m[T]?.[N]??N}));R.sort((A,N)=>{let L=String(A.timestamp||""),$=String(N.timestamp||""),j=L.localeCompare($);return j!==0?j:A.originalIndex-N.originalIndex}),m[b]=R.map(A=>A.value),delete m[_],delete m[T]}}if(a.length>0||o.length>0){let b=[...a,...o];Object.keys(m).forEach(S=>{!b.includes(S)&&S!=="timestamp"&&S!=="author"&&S!=="baseExpression"&&delete m[S]})}s.push(m)}catch(h){console.error(`Failed to process SurrealDB instance ${p}:`,h)}}let c=s;t.where&&(c=s.filter(f=>{for(let[p,h]of Object.entries(t.where))if(p!=="base"){if(p==="author"||p==="timestamp"){if(!this.matchesCondition(f[p],h))return!1;continue}if(typeof h=="object"&&h!==null&&!Array.isArray(h)){let m=h;if((m.gt!==void 0||m.gte!==void 0||m.lt!==void 0||m.lte!==void 0||m.between!==void 0||m.contains!==void 0)&&!this.matchesCondition(f[p],h))return!1}}return!0}));let u=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(u){let f=Object.keys(u)[0],p=Object.values(u)[0];c.sort((h,m)=>{let y=h[f],w=m[f];if(y===void 0&&w===void 0)return 0;if(y===void 0)return p==="ASC"?1:-1;if(w===void 0)return p==="ASC"?-1:1;let b=0;return typeof y=="number"&&typeof w=="number"?b=y-w:typeof y=="string"&&typeof w=="string"?b=y.localeCompare(w):b=String(y).localeCompare(String(w)),p==="DESC"?-b:b})}let l=c.length,d=c;if(t.offset!==void 0||t.limit!==void 0){let f=t.offset||0,p=t.limit?f+t.limit:void 0;d=c.slice(f,p)}return{results:d,totalCount:l}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let i=t;if(i.not!==void 0)return Array.isArray(i.not)?!i.not.includes(e):e!==i.not;if(i.between!==void 0&&Array.isArray(i.between)&&i.between.length===2)return e>=i.between[0]&&e<=i.between[1];let n=!0;return i.gt!==void 0&&(n=n&&e>i.gt),i.gte!==void 0&&(n=n&&e>=i.gte),i.lt!==void 0&&(n=n&&e<i.lt),i.lte!==void 0&&(n=n&&e<=i.lte),i.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(i.contains)):Array.isArray(e)?n=n&&e.includes(i.contains):n=!1),n}return e===t}static async findAll(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:o}=await this.instancesFromSurrealResult(e,t,a);return o}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:o}=await this.instancesFromPrologResult(e,t,a);return o}}static async findAllAndCount(e,t={},i=!0){if(i){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,i,n,a=!0){let o={...n||{},limit:t,offset:t*(i-1),count:!0};if(a){let s=await this.queryToSurrealQL(e,o),c=await e.querySurrealDB(s),{results:u,totalCount:l}=await this.instancesFromSurrealResult(e,o,c);return{results:u,totalCount:l,pageSize:t,pageNumber:i}}else{let s=await this.queryToProlog(e,o),c=await e.infer(s),{results:u,totalCount:l}=await this.instancesFromPrologResult(e,o,c);return{results:u,totalCount:l,pageSize:t,pageNumber:i}}}static async countQueryToProlog(e,t={},i){let{source:n,where:a}=t,o=i||await this.getClassName(e),s=[wl(),e1(n),i1(a)],c=[n1(!0),a1(),o1(),s1()];return`
1560
1560
  findall([Base, Properties, Collections, Timestamp, Author], (
1561
1561
  subject_class("${o}", SubjectClass),
1562
1562
  instance(SubjectClass, Base),
1563
- ${s.filter(u=>u).join(", ")}
1563
+ ${s.filter(l=>l).join(", ")}
1564
1564
  ), UnsortedInstances),
1565
- ${c.filter(u=>u).join(", ")}
1566
- `}static async countQueryToSurrealQL(e,t){let i={...t};return delete i.limit,delete i.offset,await this.queryToSurrealQL(e,i)}static async count(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:o}=await this.instancesFromSurrealResult(e,t,a);return o}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,i){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),o=n.resolveLanguage;o&&(t=await fe(this,Qe,"f").createExpression(t,o)),await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:t}],i)}async setCollectionSetter(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");t&&(Array.isArray(t)?await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),t.map(o=>({name:"value",value:o})),i):await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:t}],i))}async setCollectionAdder(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");t&&(Array.isArray(t)?await Promise.all(t.map(o=>fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:o}],i))):await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:t}],i))}async setCollectionRemover(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");t&&(Array.isArray(t)?await Promise.all(t.map(o=>fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:o}],i))):await fe(this,Qe,"f").executeAction(a,fe(this,nt,"f"),[{name:"value",value:t}],i))}async save(e){let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let i={};for(let[n,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(i[n]=a);await this.perspective.createSubject(this,fe(this,nt,"f"),i,e),await fe(this,Qe,"f").add(new Hi({source:fe(this,Ws,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),t&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},t=Object.entries(this);for(let[i,n]of t)n!=null&&i!=="author"&&i!=="timestamp"&&(e[i]=n);return e}async innerUpdate(e=!0,t){Na(this,Ya,await fe(this,Qe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let i=Object.entries(this);for(let[n,a]of i)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(n,a.value,t);break;case"adder":await this.setCollectionAdder(n,a.value,t);break;case"remover":await this.setCollectionRemover(n,a.value,t);break;default:await this.setCollectionSetter(n,a.value,t);break}else if(Array.isArray(a))a.length>0&&await this.setCollectionSetter(n,a,t);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(n))continue;await this.setProperty(n,a,t)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return Na(this,Ya,await fe(this,Qe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await fe(this,Qe,"f").removeSubject(this,fe(this,nt,"f"),e)}static query(e,t){return new Gu(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let i=this.determineNamespace(e,t),n=class extends Jr{};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={},o={};if(e.properties)for(let[l,u]of Object.entries(e.properties)){let d=this.determinePredicate(e,l,u,i,t),f=e.required?.includes(l)||!1,p=up(u.type);if(c1(u)){o[l]={through:d,local:this.getPropertyOption(l,u,t,"local")},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:[]});let m=`add${Hs(l)}`,v=`remove${Hs(l)}`,w=`setCollection${Hs(l)}`;n.prototype[m]=function(){},n.prototype[v]=function(){},n.prototype[w]=function(){}}else{let m=this.getPropertyOption(l,u,t,"resolveLanguage");!m&&t.resolveLanguage&&(m=t.resolveLanguage);let v=this.getPropertyOption(l,u,t,"local"),w=this.getPropertyOption(l,u,t,"writable",!0),b=this.getPropertyOption(l,u,t,"initial");if(l1(u)&&!m&&(m="literal",console.warn(`Property "${l}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),m==null&&L3(u)&&(m="literal"),f&&!b&&(l1(u)?b="literal://json:{}":b="ad4m://undefined"),a[l]={through:d,required:f,writable:w,...m&&{resolveLanguage:m},...v!==void 0&&{local:v},...b&&{initial:b}},Object.defineProperty(n.prototype,l,{configurable:!0,writable:!0,value:this.getDefaultValueForType(p)}),w){let S=Yu(l);n.prototype[S]=function(){}}}}if(!Object.values(a).some(l=>l.initial)){let l="ad4m://type",u;if(i.includes("://")){let[d,f]=i.split("://"),p=(f||"").replace(/\/+$/,"");p?u=`${d}://${p}/instance`:u=`${d}://instance`}else u=`${i.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:l,required:!0,writable:!1,initial:u,flag:!0},Object.defineProperty(n.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:u}),console.warn(`No properties with initial values found. Added automatic type flag: ${l} = ${u}`)}return n.prototype.__properties=a,n.prototype.__collections=o,n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,P3({name:t.name})(n),n}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let n=new URL(e.$id).pathname.split("/").filter(a=>a);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1565
+ ${c.filter(l=>l).join(", ")}
1566
+ `}static async countQueryToSurrealQL(e,t){let i={...t};return delete i.limit,delete i.offset,await this.queryToSurrealQL(e,i)}static async count(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:o}=await this.instancesFromSurrealResult(e,t,a);return o}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,i){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),o=n.resolveLanguage;o&&(t=await fe(this,ze,"f").createExpression(t,o)),await fe(this,ze,"f").executeAction(a,fe(this,at,"f"),[{name:"value",value:t}],i)}async setCollectionSetter(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");t&&(Array.isArray(t)?await fe(this,ze,"f").executeAction(a,fe(this,at,"f"),t.map(o=>({name:"value",value:o})),i):await fe(this,ze,"f").executeAction(a,fe(this,at,"f"),[{name:"value",value:t}],i))}async setCollectionAdder(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");t&&(Array.isArray(t)?await Promise.all(t.map(o=>fe(this,ze,"f").executeAction(a,fe(this,at,"f"),[{name:"value",value:o}],i))):await fe(this,ze,"f").executeAction(a,fe(this,at,"f"),[{name:"value",value:t}],i))}async setCollectionRemover(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");t&&(Array.isArray(t)?await Promise.all(t.map(o=>fe(this,ze,"f").executeAction(a,fe(this,at,"f"),[{name:"value",value:o}],i))):await fe(this,ze,"f").executeAction(a,fe(this,at,"f"),[{name:"value",value:t}],i))}async save(e){let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let i={};for(let[n,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(i[n]=a);await this.perspective.createSubject(this,fe(this,at,"f"),i,e),await fe(this,ze,"f").add(new Gi({source:fe(this,Hs,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),t&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},t=Object.entries(this);for(let[i,n]of t)n!=null&&i!=="author"&&i!=="timestamp"&&(e[i]=n);return e}async innerUpdate(e=!0,t){Pa(this,eo,await fe(this,ze,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let i=Object.entries(this);for(let[n,a]of i)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(n,a.value,t);break;case"adder":await this.setCollectionAdder(n,a.value,t);break;case"remover":await this.setCollectionRemover(n,a.value,t);break;default:await this.setCollectionSetter(n,a.value,t);break}else if(Array.isArray(a))a.length>0&&await this.setCollectionSetter(n,a,t);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(n))continue;await this.setProperty(n,a,t)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return Pa(this,eo,await fe(this,ze,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await fe(this,ze,"f").removeSubject(this,fe(this,at,"f"),e)}static query(e,t){return new Kl(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let i=this.determineNamespace(e,t),n=class extends Yr{};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={},o={};if(e.properties)for(let[u,l]of Object.entries(e.properties)){let d=this.determinePredicate(e,u,l,i,t),f=e.required?.includes(u)||!1,p=pp(l.type);if(u1(l)){o[u]={through:d,local:this.getPropertyOption(u,l,t,"local")},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:[]});let m=`add${Gs(u)}`,y=`remove${Gs(u)}`,w=`setCollection${Gs(u)}`;n.prototype[m]=function(){},n.prototype[y]=function(){},n.prototype[w]=function(){}}else{let m=this.getPropertyOption(u,l,t,"resolveLanguage");!m&&t.resolveLanguage&&(m=t.resolveLanguage);let y=this.getPropertyOption(u,l,t,"local"),w=this.getPropertyOption(u,l,t,"writable",!0),b=this.getPropertyOption(u,l,t,"initial");if(l1(l)&&!m&&(m="literal",console.warn(`Property "${u}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),m==null&&F3(l)&&(m="literal"),f&&!b&&(l1(l)?b="literal://json:{}":b="ad4m://undefined"),a[u]={through:d,required:f,writable:w,...m&&{resolveLanguage:m},...y!==void 0&&{local:y},...b&&{initial:b}},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(p)}),w){let S=Xl(u);n.prototype[S]=function(){}}}}if(!Object.values(a).some(u=>u.initial)){let u="ad4m://type",l;if(i.includes("://")){let[d,f]=i.split("://"),p=(f||"").replace(/\/+$/,"");p?l=`${d}://${p}/instance`:l=`${d}://instance`}else l=`${i.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:u,required:!0,writable:!1,initial:l,flag:!0},Object.defineProperty(n.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:l}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${l}`)}return n.prototype.__properties=a,n.prototype.__collections=o,n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,L3({name:t.name})(n),n}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let n=new URL(e.$id).pathname.split("/").filter(a=>a);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1567
1567
  - options.namespace
1568
1568
  - schema["x-ad4m"].namespace
1569
1569
  - schema.title
1570
- - valid schema.$id`)}static determinePredicate(e,t,i,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(i["x-ad4m"]?.through)return i["x-ad4m"].through;if(a.predicateTemplate){let s=s1(n),[c,l]=s.includes("://")?s.split("://"):["",s],u=l||"";return a.predicateTemplate.replace("${namespace}",u).replace("${scheme}",c).replace("${ns}",u).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let o=s1(n);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,i,n,a){return i.propertyOptions?.[e]?.[n]!==void 0?i.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:i[n]!==void 0?i[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};nt=new WeakMap,Ya=new WeakMap,Ws=new WeakMap,Qe=new WeakMap;Jr.classNamesByClass=new WeakMap;var Gu=class{constructor(e,t,i){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return i}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}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 i=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,i),a=await this.perspective.querySurrealDB(n),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,i){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 o=async l=>{let{results:u,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,n,l);i({results:u,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async l=>{let{results:u,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);i({results:u,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}};var Ec="0.11.2-dev-sdna-only-prolog";var Tr=12e3;function M3(){let r=new AbortController;return setTimeout(()=>r.abort(),20),r}function pi(r,e=1e4){return re(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}function pp(r){return re(this,null,function*(){try{let e=yield fetch(`http://localhost:${r}/graphql/`,{signal:M3().signal,mode:"cors"});if(e.status===400||e.status===0||e.status===200)return r;throw new Error(`Could not connect to port ${r}`)}catch(e){throw new Error(`Could not connect to port ${r}`)}})}function U3(){return new Promise((r,e)=>{let t=document.querySelector("ad4m-connect"),i=t==null?void 0:t.getAd4mClient();i?r(i):e("No Ad4mClient found")})}function fp(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function xc(r,e){fp()&&localStorage.setItem(`${Ec}/${r}`,e)}function Kt(r){return fp()?localStorage.getItem(`${Ec}/${r}`):null}function dp(r){fp()&&localStorage.removeItem(`${Ec}/${r}`)}var j3=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function xo(r,{include:e,exclude:t}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of j3(r.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var Ao=class{constructor(e){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=Tr;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};xo(this);this.options=e,this.appName=e.appName,this.appDesc=e.appDesc,this.appDomain=e.appDomain,this.appUrl=e.appUrl,this.appIconPath=e.appIconPath,this.capabilities=e.capabilities,this.port=e.port||this.port,this.url=e.url||`ws://localhost:${this.port}/graphql`,this.token=e.token||this.token,this.isHosting=e.hosting||!1}notifyConfigChange(e,t){this.listeners.configstatechange.forEach(i=>{i(e,t)})}notifyConnectionChange(e){this.connectionState!==e&&(this.connectionState=e,this.listeners.connectionstatechange.forEach(t=>{t(e)}))}notifyAuthChange(e){this.authState!==e&&(this.authState=e,this.listeners.authstatechange.forEach(t=>{t(e)}))}setPort(e){this.port!==e&&(this.port=e,this.setUrl(`ws://localhost:${this.port}/graphql`),this.notifyConfigChange("port",e))}setUrl(e){this.url!==e&&(this.url=e,this.notifyConfigChange("url",e))}setToken(e){this.token!==e&&(this.token=e,this.notifyConfigChange("token",e))}on(e,t){this.listeners[e].push(t)}buildTempClient(e){let t=eu({url:e,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:""}}})}),i=new ms({link:new tu(t),cache:new Ta({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"}}});return new go(i)}connect(e){return re(this,null,function*(){try{if(e){yield pi(e),this.setUrl(e);let t=this.buildClient();return yield this.checkAuth(),t}else{let t=`ws://localhost:${this.port}/graphql`;yield pi(t),this.setUrl(t);let i=this.buildClient();return yield this.checkAuth(),i}}catch(t){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}connectMultiUser(){return re(this,null,function*(){console.warn("[Ad4m Connect] connectMultiUser() is deprecated. The new email verification flow is handled automatically by the UI.");try{let e=this.options.backendUrl;console.debug("[Ad4m Connect] Connecting to backend:",e),yield pi(e),this.setUrl(e);let t=this.buildClient();console.debug("[Ad4m Connect] Built client:",t);let i;try{console.debug("[Ad4m Connect] Logging in user:",this.options.userEmail),i=yield t.agent.loginUser(this.options.userEmail,this.options.userPassword),console.debug("[Ad4m Connect] Login successful")}catch(a){console.debug("[Ad4m Connect] Login error:",a),console.debug("[Ad4m Connect] User does not exist, trying to create user:",this.options.userEmail);try{console.debug("[Ad4m Connect] Creating user:",this.options.userEmail);let o=yield t.agent.createUser(this.options.userEmail,this.options.userPassword);if(console.debug("[Ad4m Connect] Create result:",o),!o.success)throw new Error(o.error||"Failed to create user. Server may require email verification.");console.debug("[Ad4m Connect] Logging in user after creation:",this.options.userEmail),i=yield t.agent.loginUser(this.options.userEmail,this.options.userPassword),console.log("[Ad4m Connect] Successfully created and logged in user")}catch(o){throw new Error(`Failed to create/login user: ${o.message}. If email verification is enabled, please use the UI-driven flow instead.`)}}this.setToken(i);let n=this.buildClient();return yield n.agent.status(),this.ad4mClient=n,this.notifyAuthChange("authenticated"),this.notifyConnectionChange("connected"),n}catch(e){throw this.notifyConnectionChange("error"),this.notifyAuthChange("unauthenticated"),e}})}loginToHosting(e,t){return re(this,null,function*(){try{let i=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t})});if(i.status===200){let n=yield i.json();localStorage.setItem("hosting_token",n.token);let a=localStorage.getItem("hosting_token"),o=yield fetch("https://hosting.ad4m.dev/api/service/info",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+a}});if(o.status===200){let s=yield o.json();if(s.serviceId)if(this.setPort(s.port),this.setUrl(s.url),this.isHosting=!0,xc("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield i.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(i){throw console.log(i),new Error(`Error logging in ${i}`)}})}checkEmail(e){return re(this,null,function*(){try{return(yield fetch(`https://hosting.ad4m.dev/api/auth/check-email?email=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).status===200}catch(t){console.log(t)}})}connectToPort(e){return re(this,null,function*(){try{if(e){let t=yield pp(e);return this.setPort(t),this.buildClient()}else if(this.url.includes("localhost")){let t=yield this.findPort();return this.setPort(t),this.buildClient()}}catch(t){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return re(this,null,function*(){var t,i;if(((t=this.activeSocket)==null?void 0:t.readyState)===WebSocket.OPEN&&((i=this.activeSocket)==null?void 0:i.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield pi(this.url),this.buildClient()}catch(n){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return re(this,null,function*(){let e=[...Array(10).keys()].map((n,a)=>pp(Tr+a)),i=(yield Promise.allSettled(e)).find(n=>n.status==="fulfilled");if(i)return i.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let e=new WebSocket(this.url,"graphql-transport-ws")}catch(e){this.notifyConnectionChange("not_connected");return}return this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=eu({url:this.url,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:e=>{this.activeSocket=e},error:e=>{this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")},connected:()=>{this.notifyConnectionChange("connected"),this.checkAuth()},closed:e=>re(this,null,function*(){if(!e.wasClean&&!this.requestedRestart)if(!this.token)this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1;else{let t=yield this.connect();t?this.ad4mClient=t:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new ms({link:new tu(this.wsClient),cache:new Ta({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new go(this.apolloClient),this.ad4mClient}checkAuth(){return re(this,null,function*(){try{return(yield this.ad4mClient.agent.isLocked())?this.notifyAuthChange("locked"):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(e){return e.message==="Socket closed with event 4500 Cannot extractByTags from a ciphered wallet. You must unlock first."?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}requestCapability(e=!1){return re(this,null,function*(){var t;if(e&&this.setToken(null),this.isHosting){let i=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+i}})).status!==200&&console.error("Looks like the client is not running you might not recieve the mail with the code, please check your dashboard logs.")}return this.requestId=yield(t=this.ad4mClient)==null?void 0:t.agent.requestCapability({appName:this.appName,appDesc:this.appDesc,appUrl:this.appUrl,appIconPath:this.appIconPath,appDomain:this.appDomain,capabilities:this.capabilities}),this.requestId})}verifyCode(e){return re(this,null,function*(){var t;try{let i=yield(t=this.ad4mClient)==null?void 0:t.agent.generateJwt(this.requestId,e);return this.setToken(i),yield this.buildClient(),yield this.checkAuth(),this.token}catch(i){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(Tr),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function hp({unlockAgent:r,reconnect:e}){return F`
1570
+ - valid schema.$id`)}static determinePredicate(e,t,i,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(i["x-ad4m"]?.through)return i["x-ad4m"].through;if(a.predicateTemplate){let s=c1(n),[c,u]=s.includes("://")?s.split("://"):["",s],l=u||"";return a.predicateTemplate.replace("${namespace}",l).replace("${scheme}",c).replace("${ns}",l).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let o=c1(n);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,i,n,a){return i.propertyOptions?.[e]?.[n]!==void 0?i.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:i[n]!==void 0?i[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};at=new WeakMap,eo=new WeakMap,Hs=new WeakMap,ze=new WeakMap;Yr.classNamesByClass=new WeakMap;var Kl=class{constructor(e,t,i){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return i}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}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 i=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,i),a=await this.perspective.querySurrealDB(n),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,i){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 o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);i({results:l,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);i({results:l,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}};var xc="0.11.2-dev-sdna-only-prolog-2";var Ir=12e3;function U3(){let r=new AbortController;return setTimeout(()=>r.abort(),20),r}function fi(r,e=1e4){return re(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}function fp(r){return re(this,null,function*(){try{let e=yield fetch(`http://localhost:${r}/graphql/`,{signal:U3().signal,mode:"cors"});if(e.status===400||e.status===0||e.status===200)return r;throw new Error(`Could not connect to port ${r}`)}catch(e){throw new Error(`Could not connect to port ${r}`)}})}function j3(){return new Promise((r,e)=>{let t=document.querySelector("ad4m-connect"),i=t==null?void 0:t.getAd4mClient();i?r(i):e("No Ad4mClient found")})}function dp(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function Ac(r,e){dp()&&localStorage.setItem(`${xc}/${r}`,e)}function Zt(r){return dp()?localStorage.getItem(`${xc}/${r}`):null}function hp(r){dp()&&localStorage.removeItem(`${xc}/${r}`)}var q3=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function Ao(r,{include:e,exclude:t}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of q3(r.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var ko=class{constructor(e){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=Ir;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};Ao(this);this.options=e,this.appName=e.appName,this.appDesc=e.appDesc,this.appDomain=e.appDomain,this.appUrl=e.appUrl,this.appIconPath=e.appIconPath,this.capabilities=e.capabilities,this.port=e.port||this.port,this.url=e.url||`ws://localhost:${this.port}/graphql`,this.token=e.token||this.token,this.isHosting=e.hosting||!1}notifyConfigChange(e,t){this.listeners.configstatechange.forEach(i=>{i(e,t)})}notifyConnectionChange(e){this.connectionState!==e&&(this.connectionState=e,this.listeners.connectionstatechange.forEach(t=>{t(e)}))}notifyAuthChange(e){this.authState!==e&&(this.authState=e,this.listeners.authstatechange.forEach(t=>{t(e)}))}setPort(e){this.port!==e&&(this.port=e,this.setUrl(`ws://localhost:${this.port}/graphql`),this.notifyConfigChange("port",e))}setUrl(e){this.url!==e&&(this.url=e,this.notifyConfigChange("url",e))}setToken(e){this.token!==e&&(this.token=e,this.notifyConfigChange("token",e))}on(e,t){this.listeners[e].push(t)}buildTempClient(e){let t=tl({url:e,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:""}}})}),i=new gs({link:new rl(t),cache:new Oa({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"}}});return new yo(i)}connect(e){return re(this,null,function*(){try{if(e){yield fi(e),this.setUrl(e);let t=this.buildClient();return yield this.checkAuth(),t}else{let t=`ws://localhost:${this.port}/graphql`;yield fi(t),this.setUrl(t);let i=this.buildClient();return yield this.checkAuth(),i}}catch(t){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}connectMultiUser(){return re(this,null,function*(){console.warn("[Ad4m Connect] connectMultiUser() is deprecated. The new email verification flow is handled automatically by the UI.");try{let e=this.options.backendUrl;console.debug("[Ad4m Connect] Connecting to backend:",e),yield fi(e),this.setUrl(e);let t=this.buildClient();console.debug("[Ad4m Connect] Built client:",t);let i;try{console.debug("[Ad4m Connect] Logging in user:",this.options.userEmail),i=yield t.agent.loginUser(this.options.userEmail,this.options.userPassword),console.debug("[Ad4m Connect] Login successful")}catch(a){console.debug("[Ad4m Connect] Login error:",a),console.debug("[Ad4m Connect] User does not exist, trying to create user:",this.options.userEmail);try{console.debug("[Ad4m Connect] Creating user:",this.options.userEmail);let o=yield t.agent.createUser(this.options.userEmail,this.options.userPassword);if(console.debug("[Ad4m Connect] Create result:",o),!o.success)throw new Error(o.error||"Failed to create user. Server may require email verification.");console.debug("[Ad4m Connect] Logging in user after creation:",this.options.userEmail),i=yield t.agent.loginUser(this.options.userEmail,this.options.userPassword),console.log("[Ad4m Connect] Successfully created and logged in user")}catch(o){throw new Error(`Failed to create/login user: ${o.message}. If email verification is enabled, please use the UI-driven flow instead.`)}}this.setToken(i);let n=this.buildClient();return yield n.agent.status(),this.ad4mClient=n,this.notifyAuthChange("authenticated"),this.notifyConnectionChange("connected"),n}catch(e){throw this.notifyConnectionChange("error"),this.notifyAuthChange("unauthenticated"),e}})}loginToHosting(e,t){return re(this,null,function*(){try{let i=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:t})});if(i.status===200){let n=yield i.json();localStorage.setItem("hosting_token",n.token);let a=localStorage.getItem("hosting_token"),o=yield fetch("https://hosting.ad4m.dev/api/service/info",{method:"GET",headers:{"Content-Type":"application/json",Authorization:"Bearer "+a}});if(o.status===200){let s=yield o.json();if(s.serviceId)if(this.setPort(s.port),this.setUrl(s.url),this.isHosting=!0,Ac("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield i.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(i){throw console.log(i),new Error(`Error logging in ${i}`)}})}checkEmail(e){return re(this,null,function*(){try{return(yield fetch(`https://hosting.ad4m.dev/api/auth/check-email?email=${e}`,{method:"GET",headers:{"Content-Type":"application/json"}})).status===200}catch(t){console.log(t)}})}connectToPort(e){return re(this,null,function*(){try{if(e){let t=yield fp(e);return this.setPort(t),this.buildClient()}else if(this.url.includes("localhost")){let t=yield this.findPort();return this.setPort(t),this.buildClient()}}catch(t){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return re(this,null,function*(){var t,i;if(((t=this.activeSocket)==null?void 0:t.readyState)===WebSocket.OPEN&&((i=this.activeSocket)==null?void 0:i.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield fi(this.url),this.buildClient()}catch(n){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return re(this,null,function*(){let e=[...Array(10).keys()].map((n,a)=>fp(Ir+a)),i=(yield Promise.allSettled(e)).find(n=>n.status==="fulfilled");if(i)return i.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let e=new WebSocket(this.url,"graphql-transport-ws")}catch(e){this.notifyConnectionChange("not_connected");return}return this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=tl({url:this.url,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:e=>{this.activeSocket=e},error:e=>{this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")},connected:()=>{this.notifyConnectionChange("connected"),this.checkAuth()},closed:e=>re(this,null,function*(){if(!e.wasClean&&!this.requestedRestart)if(!this.token)this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1;else{let t=yield this.connect();t?this.ad4mClient=t:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new gs({link:new rl(this.wsClient),cache:new Oa({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new yo(this.apolloClient),this.ad4mClient}checkAuth(){return re(this,null,function*(){try{return(yield this.ad4mClient.agent.isLocked())?this.notifyAuthChange("locked"):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(e){return e.message==="Socket closed with event 4500 Cannot extractByTags from a ciphered wallet. You must unlock first."?(this.notifyAuthChange("locked"),!0):(this.notifyAuthChange("unauthenticated"),!1)}})}requestCapability(e=!1){return re(this,null,function*(){var t;if(e&&this.setToken(null),this.isHosting){let i=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+i}})).status!==200&&console.error("Looks like the client is not running you might not recieve the mail with the code, please check your dashboard logs.")}return this.requestId=yield(t=this.ad4mClient)==null?void 0:t.agent.requestCapability({appName:this.appName,appDesc:this.appDesc,appUrl:this.appUrl,appIconPath:this.appIconPath,appDomain:this.appDomain,capabilities:this.capabilities}),this.requestId})}verifyCode(e){return re(this,null,function*(){var t;try{let i=yield(t=this.ad4mClient)==null?void 0:t.agent.generateJwt(this.requestId,e);return this.setToken(i),yield this.buildClient(),yield this.checkAuth(),this.token}catch(i){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(Ir),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function mp({unlockAgent:r,reconnect:e}){return F`
1571
1571
  <div class="text-center">
1572
1572
  <div class="items">
1573
1573
  <div>
@@ -1579,7 +1579,7 @@ WHERE ${d.join(" AND ")}
1579
1579
  <button class="button" @click=${e}>Reconnect</button>
1580
1580
  </div>
1581
1581
  </div>
1582
- `}function mp({localDetected:r,multiUserConfigured:e,backendUrl:t,configuredUrl:i,isMobile:n,onConnectLocal:a,onConnectRemote:o,onScanQR:s,onDownloadAd4m:c}){let l=!n&&r,u=!0,d=n,f=!r&&!e,p=t||i;return F`
1582
+ `}function gp({localDetected:r,multiUserConfigured:e,backendUrl:t,configuredUrl:i,isMobile:n,onConnectLocal:a,onConnectRemote:o,onScanQR:s,onDownloadAd4m:c}){let u=!n&&r,l=!0,d=n,f=!r&&!e,p=t||i;return F`
1583
1583
  <div class="items">
1584
1584
  <div class="text-center">
1585
1585
  <h3 class="heading">Connect to AD4M</h3>
@@ -1594,7 +1594,7 @@ WHERE ${d.join(" AND ")}
1594
1594
  </div>
1595
1595
 
1596
1596
  <div class="items items--small">
1597
- ${l?F`
1597
+ ${u?F`
1598
1598
  <div class="connection-option connection-option--primary">
1599
1599
  <div class="connection-option__header">
1600
1600
  <svg
@@ -1621,9 +1621,9 @@ WHERE ${d.join(" AND ")}
1621
1621
  </div>
1622
1622
  `:""}
1623
1623
 
1624
- ${u?F`
1624
+ ${l?F`
1625
1625
  <div
1626
- class="connection-option ${l?"":"connection-option--primary"}"
1626
+ class="connection-option ${u?"":"connection-option--primary"}"
1627
1627
  >
1628
1628
  <div class="connection-option__header">
1629
1629
  <svg
@@ -1665,7 +1665,7 @@ WHERE ${d.join(" AND ")}
1665
1665
  </p>
1666
1666
  `}
1667
1667
  <button
1668
- class="button ${l?"button--secondary":""} button--full"
1668
+ class="button ${u?"button--secondary":""} button--full"
1669
1669
  @click=${o}
1670
1670
  >
1671
1671
  ${p?"Connect to Configured Node":"Enter Remote URL"}
@@ -1777,7 +1777,7 @@ WHERE ${d.join(" AND ")}
1777
1777
  opacity: 1;
1778
1778
  }
1779
1779
  </style>
1780
- `}function gp(){return F`
1780
+ `}function yp(){return F`
1781
1781
  <div class="items">
1782
1782
  <div class="text-center">
1783
1783
  <h1 class="heading">Request to AD4M blocked</h1>
@@ -1798,7 +1798,7 @@ WHERE ${d.join(" AND ")}
1798
1798
  </button>
1799
1799
  </div>
1800
1800
  </div>
1801
- `}function yp({reconnect:r}){return F`
1801
+ `}function vp({reconnect:r}){return F`
1802
1802
  <div class="items items--small">
1803
1803
  <div class="text-center">
1804
1804
  <h1 class="heading">Could not connect to AD4M</h1>
@@ -1807,7 +1807,7 @@ WHERE ${d.join(" AND ")}
1807
1807
  <button class="button" @click=${()=>r()}>Try again</button>
1808
1808
  </div>
1809
1809
  </div>
1810
- `}function vp(){return F`<header class="dialog__header">
1810
+ `}function bp(){return F`<header class="dialog__header">
1811
1811
  <div class="dialog__logo">
1812
1812
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 37" fill="none">
1813
1813
  <path
@@ -1816,7 +1816,7 @@ WHERE ${d.join(" AND ")}
1816
1816
  />
1817
1817
  </svg>
1818
1818
  </div>
1819
- </header>`}function bp({step:r,email:e,changeEmail:t,changeState:i,password:n,changePassword:a,login:o,checkEmail:s,passwordError:c,setHostingStep:l,isHostingRunning:u,setIsHostingRunning:d}){if(u)return F`
1819
+ </header>`}function _p({step:r,email:e,changeEmail:t,changeState:i,password:n,changePassword:a,login:o,checkEmail:s,passwordError:c,setHostingStep:u,isHostingRunning:l,setIsHostingRunning:d}){if(l)return F`
1820
1820
  <div class="text-center">
1821
1821
  <p>
1822
1822
  Hosted executor does not seem to be running. Please check the logs in your <a href="https://hosting.ad4m.dev/dashboard">ADAM hosting dashboard</a> and potentially restart your executor there.
@@ -1886,12 +1886,12 @@ WHERE ${d.join(" AND ")}
1886
1886
  </p>
1887
1887
  <button
1888
1888
  class="button button--full button-secondary"
1889
- @click=${()=>{l(0),i("start")}}
1889
+ @click=${()=>{u(0),i("start")}}
1890
1890
  >
1891
1891
  Back
1892
1892
  </button>
1893
1893
  </div>
1894
- `}function _p(){return F`
1894
+ `}function Sp(){return F`
1895
1895
  <div>
1896
1896
  <div class="lds-ring">
1897
1897
  <div></div>
@@ -1900,15 +1900,15 @@ WHERE ${d.join(" AND ")}
1900
1900
  <div></div>
1901
1901
  </div>
1902
1902
  </div>
1903
- `}function ko(){return F`
1903
+ `}function To(){return F`
1904
1904
  <svg width="44" height="40" viewBox="0 0 70 60" fill="none" xmlns="http://www.w3.org/2000/svg">
1905
1905
  <path 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" fill="#91E3FD"/>
1906
1906
  </svg>
1907
- `}function Sp({openModal:r}){return F`
1907
+ `}function wp({openModal:r}){return F`
1908
1908
  <div class="mainlogo" @click=${r}>
1909
- ${ko()}
1909
+ ${To()}
1910
1910
  </div>
1911
- `}function wp({email:r,password:e,verificationCode:t,error:i,isLoading:n,backendUrl:a,step:o,verificationType:s,changeEmail:c,changePassword:l,changeVerificationCode:u,onEmailSubmit:d,onPasswordSubmit:f,onCodeSubmit:p,onBackToEmail:h}){return o==="email"?F`
1911
+ `}function Ep({email:r,password:e,verificationCode:t,error:i,isLoading:n,backendUrl:a,step:o,verificationType:s,changeEmail:c,changePassword:u,changeVerificationCode:l,onEmailSubmit:d,onPasswordSubmit:f,onCodeSubmit:p,onBackToEmail:h}){return o==="email"?F`
1912
1912
  <div class="items">
1913
1913
  <div class="text-center">
1914
1914
  <h3 class="heading">Sign in or Sign up</h3>
@@ -1996,7 +1996,7 @@ WHERE ${d.join(" AND ")}
1996
1996
  class="input__field"
1997
1997
  placeholder="${s==="signup"?"Enter a strong password":"Enter your password"}"
1998
1998
  .value=${e}
1999
- @input=${m=>l(m.target.value)}
1999
+ @input=${m=>u(m.target.value)}
2000
2000
  @keypress=${m=>{m.key==="Enter"&&e&&!n&&f()}}
2001
2001
  ?disabled=${n}
2002
2002
  autofocus
@@ -2071,7 +2071,7 @@ WHERE ${d.join(" AND ")}
2071
2071
  class="input__field code-input"
2072
2072
  placeholder="000000"
2073
2073
  .value=${t}
2074
- @input=${m=>{let w=m.target.value.replace(/\D/g,"");u(w)}}
2074
+ @input=${m=>{let w=m.target.value.replace(/\D/g,"");l(w)}}
2075
2075
  ?disabled=${n}
2076
2076
  autofocus
2077
2077
  />
@@ -2128,14 +2128,14 @@ WHERE ${d.join(" AND ")}
2128
2128
  opacity: 0.8;
2129
2129
  }
2130
2130
  </style>
2131
- `:F``}function Cp({initialUrl:r,detecting:e,multiUserDetected:t,error:i,onBack:n,onUrlChange:a,onConnect:o,onMultiUserAuth:s,onRequestCapability:c}){let l=t!==null&&!e,u=r||"";return F`
2131
+ `:F``}function Cp({initialUrl:r,detecting:e,multiUserDetected:t,error:i,onBack:n,onUrlChange:a,onConnect:o,onMultiUserAuth:s,onRequestCapability:c}){let u=t!==null&&!e,l=r||"";return F`
2132
2132
  <div class="items">
2133
2133
  <div class="text-center">
2134
2134
  <h3 class="heading">Connect to Remote AD4M</h3>
2135
2135
  <p class="body">Enter the URL of a remote AD4M executor</p>
2136
2136
  </div>
2137
2137
 
2138
- ${l?F`
2138
+ ${u?F`
2139
2139
  <div class="items items--small">
2140
2140
  <div class="remote-info">
2141
2141
  <p class="body" style="margin: 0 0 5px 0; font-size: 13px;">
@@ -2145,7 +2145,7 @@ WHERE ${d.join(" AND ")}
2145
2145
  class="body"
2146
2146
  style="margin: 0; font-family: monospace; font-size: 12px; opacity: 0.8;"
2147
2147
  >
2148
- ${u}
2148
+ ${l}
2149
2149
  </p>
2150
2150
  </div>
2151
2151
 
@@ -2280,7 +2280,7 @@ WHERE ${d.join(" AND ")}
2280
2280
  type="text"
2281
2281
  class="input__field"
2282
2282
  placeholder="wss://your-server.com/graphql"
2283
- .value=${u}
2283
+ .value=${l}
2284
2284
  @input=${d=>a(d.target.value)}
2285
2285
  ?disabled=${e}
2286
2286
  />
@@ -2303,7 +2303,7 @@ WHERE ${d.join(" AND ")}
2303
2303
  <button
2304
2304
  class="button"
2305
2305
  @click=${o}
2306
- ?disabled=${e||!u}
2306
+ ?disabled=${e||!l}
2307
2307
  >
2308
2308
  ${e?"Detecting...":"Connect"}
2309
2309
  </button>
@@ -2372,7 +2372,7 @@ WHERE ${d.join(" AND ")}
2372
2372
  margin: 0;
2373
2373
  }
2374
2374
  </style>
2375
- `}function Ep({capabilities:r,appname:e,appiconpath:t,changeState:i,setOpen:n,requestCapability:a}){return F`
2375
+ `}function xp({capabilities:r,appname:e,appiconpath:t,changeState:i,setOpen:n,requestCapability:a}){return F`
2376
2376
  <div class="items">
2377
2377
  <div class="text-center">
2378
2378
  <p class="body">An external application</p>
@@ -2382,7 +2382,7 @@ WHERE ${d.join(" AND ")}
2382
2382
  ${t&&F`<div class="dialog__connect">
2383
2383
  <img class="dialog__connect-app" src=${t} alt="Logo" />
2384
2384
  <div class="dialog__connect-check"></div>
2385
- <div class="dialog__connect-ad4m">${ko()}</div>
2385
+ <div class="dialog__connect-ad4m">${To()}</div>
2386
2386
  </div>`}
2387
2387
  <div>
2388
2388
  <p class="text-center"><b>This will allow the developer to:</b></p>
@@ -2401,7 +2401,7 @@ WHERE ${d.join(" AND ")}
2401
2401
  />
2402
2402
  </svg>
2403
2403
  </span>
2404
- <span>${um(o)}</span>
2404
+ <span>${C1(o)}</span>
2405
2405
  </li>`)}
2406
2406
  </ul>
2407
2407
  </div>
@@ -2426,7 +2426,7 @@ WHERE ${d.join(" AND ")}
2426
2426
  Connection settings
2427
2427
  </button>
2428
2428
  </div>
2429
- `}function xp({changeState:r,onSuccess:e,uiState:t}){function i(n){let a=new BarcodeDetector,o=n.currentTarget,s=()=>re(this,null,function*(){try{if(t!=="qr")return;let l=(yield a.detect(o)).find(u=>u.format==="qr_code");if(l!=null&&l.rawValue){r("requestcap"),e(l.rawValue);return}else requestAnimationFrame(s)}catch(c){console.error(c)}});s()}return F`
2429
+ `}function Ap({changeState:r,onSuccess:e,uiState:t}){function i(n){let a=new BarcodeDetector,o=n.currentTarget,s=()=>re(this,null,function*(){try{if(t!=="qr")return;let u=(yield a.detect(o)).find(l=>l.format==="qr_code");if(u!=null&&u.rawValue){r("requestcap"),e(u.rawValue);return}else requestAnimationFrame(s)}catch(c){console.error(c)}});s()}return F`
2430
2430
  <div class="qr-scanner">
2431
2431
  <div class="qr-content">
2432
2432
  <button
@@ -2445,7 +2445,7 @@ WHERE ${d.join(" AND ")}
2445
2445
  ></video>
2446
2446
  </div>
2447
2447
  </div>
2448
- `}function Ap({port:r,url:e,isRemote:t,connectToPort:i,changeIsRemote:n,connectRemote:a,changeState:o,changeUrl:s,changePort:c,clearState:l}){return F`
2448
+ `}function kp({port:r,url:e,isRemote:t,connectToPort:i,changeIsRemote:n,connectRemote:a,changeState:o,changeUrl:s,changePort:c,clearState:u}){return F`
2449
2449
  <div class="items items--small">
2450
2450
  <div class="text-center">
2451
2451
  <h1 class="heading">Connection Settings</h1>
@@ -2506,13 +2506,13 @@ WHERE ${d.join(" AND ")}
2506
2506
  </button>
2507
2507
  <button
2508
2508
  class="button button--full button--secondary"
2509
- @click=${l}
2509
+ @click=${u}
2510
2510
  >
2511
2511
  Clear state
2512
2512
  </button>
2513
2513
  </div
2514
2514
  </div>
2515
- `}function kp({connect:r,isMobile:e,hasClickedDownload:t,changeState:i,onDownloaded:n,scanQrcode:a,hosting:o}){let c=(Kt("ad4murl")||`http://localhost:${Tr}`).includes("localhost");function l(u){u.preventDefault();let d=u.currentTarget;window.open(d.href,"_blank"),this.onDownloaded()}return F`
2515
+ `}function Tp({connect:r,isMobile:e,hasClickedDownload:t,changeState:i,onDownloaded:n,scanQrcode:a,hosting:o}){let c=(Zt("ad4murl")||`http://localhost:${Ir}`).includes("localhost");function u(l){l.preventDefault();let d=l.currentTarget;window.open(d.href,"_blank"),this.onDownloaded()}return F`
2516
2516
  <div class="items">
2517
2517
  ${t?F`
2518
2518
  <div class="text-center">
@@ -2547,7 +2547,7 @@ WHERE ${d.join(" AND ")}
2547
2547
  </button>`:F`<a
2548
2548
  class="button"
2549
2549
  target="_blank"
2550
- @click=${l}
2550
+ @click=${u}
2551
2551
  href="https://github.com/coasys/ad4m/releases"
2552
2552
  >
2553
2553
  Download AD4M
@@ -2578,7 +2578,7 @@ WHERE ${d.join(" AND ")}
2578
2578
  </a>
2579
2579
  </div>
2580
2580
  </div>
2581
- `}function Tp({code:r,changeState:e,verifyCode:t,changeCode:i,isHosting:n,verifyCodeError:a}){return F`
2581
+ `}function Ip({code:r,changeState:e,verifyCode:t,changeCode:i,isHosting:n,verifyCodeError:a}){return F`
2582
2582
  <div class="items">
2583
2583
  <div class="text-center">
2584
2584
  <div class="heading">${n?"Please check your emails for the 2FA security code that was sent from the ADAM hosting service":"Please check your ADAM Launcher"}</div>
@@ -2610,7 +2610,7 @@ WHERE ${d.join(" AND ")}
2610
2610
  </button>
2611
2611
  </div>
2612
2612
  </div>
2613
- `}function q3(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(e=>navigator.userAgent.match(e))}var B3=Tc`
2613
+ `}function B3(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(e=>navigator.userAgent.match(e))}var V3=Ic`
2614
2614
  :host {
2615
2615
  --primary-color: #fff;
2616
2616
  --heading-color: #fff;
@@ -3011,16 +3011,16 @@ WHERE ${d.join(" AND ")}
3011
3011
  width: 100vw;
3012
3012
  object-fit: cover;
3013
3013
  }
3014
- `,ee=class extends Nr{constructor(){super(...arguments);this._code=null;this._isMobile=null;this._hasClickedDownload=null;this._isRemote=!1;this._isOpen=!1;this._hostingStep=0;this._email="";this._passowrd="";this._passwordError=null;this._hostingNotRunningError=null;this._verifyCodeError=null;this._isHostingLoading=!1;this._multiUserEmail="";this._multiUserPassword="";this._multiUserVerificationCode="";this._multiUserError=null;this._multiUserLoading=!1;this._codeSubmitTimeout=null;this._multiUserStep="email";this._multiUserVerificationType="login";this._localDetected=!1;this._remoteUrl="";this._remoteMultiUserDetected=null;this._remoteDetecting=!1;this._remoteError=null;this.uiState="connection_overview";this.appName=null;this.appDesc=null;this.appDomain=null;this.appIconPath=null;this.mobile=null;this.capabilities=[];this.hosting=Kt("ad4mhosting")==="true"||!1;this.token=Kt("ad4mToken")||"";this.port=parseInt(Kt("ad4mport"))||Tr;this.url=Kt("ad4murl")||"";this.multiUser=!1;this.backendUrl=""}get authState(){return this._client.authState}get connectionState(){return this._client.connectionState}injectFont(){let t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href","https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap"),document.head.appendChild(t)}connectedCallback(){super.connectedCallback(),xo(this),this.injectFont(),this._isMobile=q3(),this._client=new Ao({appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath,capabilities:Array.isArray(this.capabilities)?this.capabilities:JSON.parse(this.capabilities),port:this.port||parseInt(Kt("ad4mport"))||Tr,token:this.token||Kt("ad4mtoken"),url:this.url||Kt("ad4murl"),hosting:this.hosting}),this._client.on("configstatechange",this.handleConfigChange),this._client.on("authstatechange",this.handleAuthChange),this._client.on("connectionstatechange",this.handleConnectionChange),this.loadFont(),this.token||Kt("ad4mtoken")?this.multiUser&&this.backendUrl?this._client.connect(this.backendUrl):this._client.connect():(this.detectLocal(),this.changeUIState("connection_overview"),this._isOpen=!0)}checkEmail(){return re(this,null,function*(){try{(yield this._client.checkEmail(this._email))?this._hostingStep=1:this._hostingStep=2}catch(t){console.log(t)}})}handleMultiUserEmailSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let t=this._client.buildTempClient(this.backendUrl),i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield t.agent.requestLoginVerification(this._multiUserEmail,i);n.success&&!n.requiresPassword?(this._multiUserStep="code",this._multiUserVerificationType="login"):n.requiresPassword?(this._multiUserStep="password",this._multiUserVerificationType=n.isExistingUser?"login":"signup"):this._multiUserError=n.message||"Failed to send verification email"}catch(t){this._multiUserError=t.message||"Failed to process email. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserPasswordSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let t=this._client.buildTempClient(this.backendUrl);if(this._multiUserVerificationType==="login")try{let i=yield t.agent.loginUser(this._multiUserEmail,this._multiUserPassword);this._client.setToken(i),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(i){this._multiUserError=i.message||"Invalid email or password. Please try again."}else{let i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield t.agent.createUser(this._multiUserEmail,this._multiUserPassword,i);if(n.success)if(n.error&&n.error.includes("SMTP is not configured"))try{let a=yield t.agent.loginUser(this._multiUserEmail,this._multiUserPassword);this._client.setToken(a),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(a){this._multiUserError=a.message||"Account created but login failed. Please try logging in."}else n.error?this._multiUserError=n.error+" You can try logging in with your password.":(this._multiUserStep="code",this._multiUserVerificationType="signup");else this._multiUserError=n.error||"Failed to create account. Please try again."}}catch(t){this._multiUserError=t.message||"Failed to process request. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserCodeSubmit(){return re(this,null,function*(){if(!this._multiUserLoading){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null);try{this._multiUserLoading=!0,this._multiUserError=null;let i=yield this._client.buildTempClient(this.backendUrl).agent.verifyEmailCode(this._multiUserEmail,this._multiUserVerificationCode,this._multiUserVerificationType);this._client.setToken(i),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(t){this._multiUserError="Invalid or expired code. Please try again.",this._multiUserVerificationCode=""}finally{this._multiUserLoading=!1}}})}handleMultiUserBackToEmail(){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserStep="email",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserError=null}changeMultiUserEmail(t){this._multiUserEmail=t,this._multiUserError=null}changeMultiUserPassword(t){this._multiUserPassword=t,this._multiUserError=null}changeMultiUserVerificationCode(t){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserVerificationCode=t,this._multiUserError=null,t.length===6&&!this._multiUserLoading&&(this._codeSubmitTimeout=setTimeout(()=>{this._codeSubmitTimeout=null,this._multiUserVerificationCode.length===6&&!this._multiUserLoading&&this.handleMultiUserCodeSubmit()},100))}detectLocal(){return re(this,null,function*(){try{yield pi(`ws://localhost:${this.port}/graphql`,3e3),this._localDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this._localDetected=!1}})}verifyAd4mApi(t){return re(this,null,function*(){console.log("[Ad4m Connect] Verifying AD4M API at URL:",t);let i=this._client.buildTempClient(t);try{yield i.runtime.info(),console.log("[Ad4m Connect] AD4M API verified")}catch(n){throw console.error("[Ad4m Connect] Failed to verify AD4M API:",n),new Error("Server is reachable but doesn't appear to be an AD4M executor. Make sure the URL includes '/graphql'.")}})}detectRemoteMultiUser(t){return re(this,null,function*(){console.log("[Ad4m Connect] Detecting multi-user mode for URL:",t);let i=this._client.buildTempClient(t);try{let n=yield i.runtime.multiUserEnabled();return console.log("[Ad4m Connect] Multi-user detection result:",n),n}catch(n){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",n),console.error("[Ad4m Connect] Error details:",n.message,n.stack),!1}})}handleConnectLocal(){return re(this,null,function*(){try{this.changeUIState("requestcap"),yield this._client.connect()}catch(t){console.error("Failed to connect to local AD4M:",t),this.changeUIState("connection_overview")}})}handleShowRemoteConnection(){this._remoteUrl=this.backendUrl||this.url||"",this._remoteMultiUserDetected=null,this._remoteError=null,this.changeUIState("remote_connection")}handleRemoteUrlChange(t){this._remoteUrl=t,this._remoteError=null}handleRemoteConnect(){return re(this,null,function*(){if(!this._remoteUrl){this._remoteError="Please enter a URL";return}this._remoteDetecting=!0,this._remoteError=null,this._remoteMultiUserDetected=null;try{console.log("[Ad4m Connect] Checking if server is reachable:",this._remoteUrl),yield pi(this._remoteUrl,5e3),console.log("[Ad4m Connect] Server is reachable"),yield this.verifyAd4mApi(this._remoteUrl);let t=yield this.detectRemoteMultiUser(this._remoteUrl);this._remoteMultiUserDetected=t,this._remoteDetecting=!1}catch(t){console.error("[Ad4m Connect] Connection/detection failed:",t),this._remoteError=t.message||"Cannot reach server at this URL. Please check the URL and try again.",this._remoteMultiUserDetected=null,this._remoteDetecting=!1}})}handleRemoteMultiUserAuth(){return re(this,null,function*(){this.backendUrl=this._remoteUrl,this.changeUIState("multiuser_auth")})}handleRemoteRequestCapability(){return re(this,null,function*(){try{this.changeUIState("requestcap"),yield this._client.connect(this._remoteUrl)}catch(t){this._remoteError=t.message||"Failed to connect",this.changeUIState("remote_connection")}})}loginToHosting(){return re(this,null,function*(){try{yield this._client.loginToHosting(this._email,this._passowrd),this.changeUIState("connected")}catch(t){t.message.includes("Passwords did not match")?this._passwordError="Passwords did not match":this._hostingNotRunningError="Hosting is not running"}})}changeEmail(t){this._email=t}changePassword(t){this._passowrd=t}unlockAgent(t,i=!0){return re(this,null,function*(){yield this._client.ad4mClient.agent.unlock(t,i)})}verifyCode(t){return re(this,null,function*(){try{yield this._client.verifyCode(t)}catch(i){this._verifyCodeError="Invalid code"}})}changeUrl(t){t!==this._client.url&&(dp("ad4mtoken"),this._client.setToken(null)),this._client.setUrl(t)}changePort(t){this._client.setPort(t)}changeUIState(t){this.uiState=t}setIsHostingRunning(t){this._hostingNotRunningError=t}changeIsRemote(t){this._isRemote=t}changeCode(t){this._code=t}onDownloaded(){this._hasClickedDownload=!0}handleAuthChange(t){let i=new CustomEvent("authstatechange",{detail:t});t==="locked"&&(this._isOpen=!0),t==="authenticated"&&(this._isOpen=!1),this.dispatchEvent(i),this.requestUpdate()}handleConfigChange(t,i){this[t]=i,i?xc("ad4m"+t,i):dp("ad4m"+t),this.requestUpdate()}handleConnectionChange(t){if(t==="checking_local"){this._isOpen=!1;return}t==="connected"&&(this.authState!=="authenticated"?(this.changeUIState("requestcap"),this._isOpen=!0):(this.changeUIState("connected"),this._isOpen=!1)),t==="disconnected"&&(this._isOpen=!0),t==="not_connected"&&(this._isOpen=!0,this.multiUser&&this.backendUrl?this.changeUIState("multiuser_auth"):this.changeUIState("start"));let i=new CustomEvent("connectionstatechange",{detail:t});this.dispatchEvent(i),this.requestUpdate()}loadFont(){let t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.crossOrigin="anonymous",t.href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap",document.head.appendChild(t)}startCamera(t){return re(this,null,function*(){try{window.BarcodeDetector.getSupportedFormats()}catch(i){window.BarcodeDetector=Or}yield this.changeUIState("qr"),setTimeout(()=>re(this,null,function*(){let i=this.shadowRoot.querySelector("video");if(!i)return;let n=yield navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:"environment"}});i.srcObject=n,i.autoplay=!0}),100)})}connect(){return re(this,null,function*(){this._isOpen=!0,this.requestUpdate();let t=yield this._client.connect();try{let i=yield t.agent.status();i.isUnlocked&&i.isInitialized&&window.location.reload()}catch(i){console.warn(i)}return t})}getAd4mClient(){return this._client.ad4mClient}connectRemote(t){return re(this,null,function*(){try{this.changeUrl(t);let i=yield this._client.connect(t),n=yield i.agent.status();return n.isUnlocked&&n.isInitialized||this.changeUIState("requestcap"),i}catch(i){this.changeUIState("requestcap"),this._isOpen=!0}})}requestCapability(t){return re(this,null,function*(){try{yield this._client.requestCapability(t),this.changeUIState("verifycode")}catch(i){console.warn(i)}})}isAuthenticated(){return re(this,null,function*(){return this._client.checkAuth()})}setOpen(t){this._isOpen=t}setHostingStep(t){this._hostingStep=t}clearState(){this.handleConfigChange("port",null),this.handleConfigChange("url",null),this.handleConfigChange("token",null),this.handleConnectionChange("not_connected"),this.handleAuthChange("unauthenticated"),this.changeUIState("start"),this._client.clearState()}renderViews(){if(this.connectionState==="connecting")return _p();if(this.uiState==="connection_overview")return mp({localDetected:this._localDetected,multiUserConfigured:this.multiUser&&!!this.backendUrl,backendUrl:this.backendUrl,configuredUrl:this.url,isMobile:this._isMobile,onConnectLocal:this.handleConnectLocal,onConnectRemote:this.handleShowRemoteConnection,onScanQR:()=>{this.startCamera(null)},onDownloadAd4m:()=>{window.open("https://github.com/coasys/ad4m/releases")}});if(this.uiState==="remote_connection")return Cp({initialUrl:this._remoteUrl,detecting:this._remoteDetecting,multiUserDetected:this._remoteMultiUserDetected,error:this._remoteError,onBack:()=>this.changeUIState("connection_overview"),onUrlChange:this.handleRemoteUrlChange,onConnect:this.handleRemoteConnect,onMultiUserAuth:this.handleRemoteMultiUserAuth,onRequestCapability:this.handleRemoteRequestCapability});if(this.uiState==="multiuser_auth")return wp({email:this._multiUserEmail,password:this._multiUserPassword,verificationCode:this._multiUserVerificationCode,error:this._multiUserError,isLoading:this._multiUserLoading,backendUrl:this.backendUrl,step:this._multiUserStep,verificationType:this._multiUserVerificationType,changeEmail:this.changeMultiUserEmail,changePassword:this.changeMultiUserPassword,changeVerificationCode:this.changeMultiUserVerificationCode,onEmailSubmit:this.handleMultiUserEmailSubmit,onPasswordSubmit:this.handleMultiUserPasswordSubmit,onCodeSubmit:this.handleMultiUserCodeSubmit,onBackToEmail:this.handleMultiUserBackToEmail});if(this.uiState==="hosting")return bp({email:this._email,password:this._passowrd,changeEmail:this.changeEmail,changePassword:this.changePassword,changeState:this.changeUIState,step:this._hostingStep,setHostingStep:this.setHostingStep,login:this.loginToHosting,checkEmail:this.checkEmail,passwordError:this._passwordError,isHostingRunning:this._hostingNotRunningError,setIsHostingRunning:this.setIsHostingRunning});if(this.uiState==="qr")return xp({changeState:this.changeUIState,onSuccess:t=>{this.changeUrl(t),this._client.connect(t)},uiState:this.uiState});if(this.authState==="locked")return hp({unlockAgent:this.unlockAgent,reconnect:this.connect});if(this.uiState==="settings")return Ap({port:this.port,changePort:this.changePort,isRemote:this._isRemote,changeIsRemote:this.changeIsRemote,url:this.url,changeState:this.changeUIState,changeUrl:this.changeUrl,connectToPort:this._client.connectToPort,connectRemote:this.connectRemote,clearState:this.clearState});if(this.connectionState==="not_connected")return kp({scanQrcode:this.startCamera,connect:this.connect,isMobile:this._isMobile,hasClickedDownload:this._hasClickedDownload,onDownloaded:this.onDownloaded,changeState:this.changeUIState,hosting:this.hosting});if(this.connectionState==="connected")return this.uiState==="verifycode"?Tp({code:this._code,changeCode:this.changeCode,changeState:this.changeUIState,verifyCode:this.verifyCode,isHosting:this._client.isHosting,verifyCodeError:this._verifyCodeError}):Ep({changeState:this.changeUIState,requestCapability:this.requestCapability,capabilities:this.capabilities,appname:this.appName,setOpen:this.setOpen,appiconpath:this.appIconPath});if(this.connectionState==="disconnected")return yp({reconnect:this.connect});if(this.connectionState==="port_not_found")return gp()}mobileView(){return this.mobile?Sp({openModal:()=>{this.changeUIState("settings"),this._isOpen=!this._isOpen}}):null}render(){return console.log(this.authState,this.connectionState,this.uiState,this._isOpen),this._isOpen===!1?this.authState==="authenticated"?this.mobileView():null:F`
3014
+ `,ee=class extends Rr{constructor(){super(...arguments);this._code=null;this._isMobile=null;this._hasClickedDownload=null;this._isRemote=!1;this._isOpen=!1;this._hostingStep=0;this._email="";this._passowrd="";this._passwordError=null;this._hostingNotRunningError=null;this._verifyCodeError=null;this._isHostingLoading=!1;this._multiUserEmail="";this._multiUserPassword="";this._multiUserVerificationCode="";this._multiUserError=null;this._multiUserLoading=!1;this._codeSubmitTimeout=null;this._multiUserStep="email";this._multiUserVerificationType="login";this._localDetected=!1;this._remoteUrl="";this._remoteMultiUserDetected=null;this._remoteDetecting=!1;this._remoteError=null;this.uiState="connection_overview";this.appName=null;this.appDesc=null;this.appDomain=null;this.appIconPath=null;this.mobile=null;this.capabilities=[];this.hosting=Zt("ad4mhosting")==="true"||!1;this.token=Zt("ad4mToken")||"";this.port=parseInt(Zt("ad4mport"))||Ir;this.url=Zt("ad4murl")||"";this.multiUser=!1;this.backendUrl=""}get authState(){return this._client.authState}get connectionState(){return this._client.connectionState}injectFont(){let t=document.createElement("link");t.setAttribute("rel","stylesheet"),t.setAttribute("href","https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap"),document.head.appendChild(t)}connectedCallback(){super.connectedCallback(),Ao(this),this.injectFont(),this._isMobile=B3(),this._client=new ko({appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath,capabilities:Array.isArray(this.capabilities)?this.capabilities:JSON.parse(this.capabilities),port:this.port||parseInt(Zt("ad4mport"))||Ir,token:this.token||Zt("ad4mtoken"),url:this.url||Zt("ad4murl"),hosting:this.hosting}),this._client.on("configstatechange",this.handleConfigChange),this._client.on("authstatechange",this.handleAuthChange),this._client.on("connectionstatechange",this.handleConnectionChange),this.loadFont(),this.token||Zt("ad4mtoken")?this.multiUser&&this.backendUrl?this._client.connect(this.backendUrl):this._client.connect():(this.detectLocal(),this.changeUIState("connection_overview"),this._isOpen=!0)}checkEmail(){return re(this,null,function*(){try{(yield this._client.checkEmail(this._email))?this._hostingStep=1:this._hostingStep=2}catch(t){console.log(t)}})}handleMultiUserEmailSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let t=this._client.buildTempClient(this.backendUrl),i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield t.agent.requestLoginVerification(this._multiUserEmail,i);n.success&&!n.requiresPassword?(this._multiUserStep="code",this._multiUserVerificationType="login"):n.requiresPassword?(this._multiUserStep="password",this._multiUserVerificationType=n.isExistingUser?"login":"signup"):this._multiUserError=n.message||"Failed to send verification email"}catch(t){this._multiUserError=t.message||"Failed to process email. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserPasswordSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let t=this._client.buildTempClient(this.backendUrl);if(this._multiUserVerificationType==="login")try{let i=yield t.agent.loginUser(this._multiUserEmail,this._multiUserPassword);this._client.setToken(i),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(i){this._multiUserError=i.message||"Invalid email or password. Please try again."}else{let i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield t.agent.createUser(this._multiUserEmail,this._multiUserPassword,i);if(n.success)if(n.error&&n.error.includes("SMTP is not configured"))try{let a=yield t.agent.loginUser(this._multiUserEmail,this._multiUserPassword);this._client.setToken(a),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(a){this._multiUserError=a.message||"Account created but login failed. Please try logging in."}else n.error?this._multiUserError=n.error+" You can try logging in with your password.":(this._multiUserStep="code",this._multiUserVerificationType="signup");else this._multiUserError=n.error||"Failed to create account. Please try again."}}catch(t){this._multiUserError=t.message||"Failed to process request. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserCodeSubmit(){return re(this,null,function*(){if(!this._multiUserLoading){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null);try{this._multiUserLoading=!0,this._multiUserError=null;let i=yield this._client.buildTempClient(this.backendUrl).agent.verifyEmailCode(this._multiUserEmail,this._multiUserVerificationCode,this._multiUserVerificationType);this._client.setToken(i),this._client.setUrl(this.backendUrl),yield this._client.buildClient(),yield this._client.checkAuth(),this._multiUserEmail="",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserStep="email",this._isOpen=!1,this.changeUIState("connected"),this.handleAuthChange("authenticated")}catch(t){this._multiUserError="Invalid or expired code. Please try again.",this._multiUserVerificationCode=""}finally{this._multiUserLoading=!1}}})}handleMultiUserBackToEmail(){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserStep="email",this._multiUserPassword="",this._multiUserVerificationCode="",this._multiUserError=null}changeMultiUserEmail(t){this._multiUserEmail=t,this._multiUserError=null}changeMultiUserPassword(t){this._multiUserPassword=t,this._multiUserError=null}changeMultiUserVerificationCode(t){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserVerificationCode=t,this._multiUserError=null,t.length===6&&!this._multiUserLoading&&(this._codeSubmitTimeout=setTimeout(()=>{this._codeSubmitTimeout=null,this._multiUserVerificationCode.length===6&&!this._multiUserLoading&&this.handleMultiUserCodeSubmit()},100))}detectLocal(){return re(this,null,function*(){try{yield fi(`ws://localhost:${this.port}/graphql`,3e3),this._localDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this._localDetected=!1}})}verifyAd4mApi(t){return re(this,null,function*(){console.log("[Ad4m Connect] Verifying AD4M API at URL:",t);let i=this._client.buildTempClient(t);try{yield i.runtime.info(),console.log("[Ad4m Connect] AD4M API verified")}catch(n){throw console.error("[Ad4m Connect] Failed to verify AD4M API:",n),new Error("Server is reachable but doesn't appear to be an AD4M executor. Make sure the URL includes '/graphql'.")}})}detectRemoteMultiUser(t){return re(this,null,function*(){console.log("[Ad4m Connect] Detecting multi-user mode for URL:",t);let i=this._client.buildTempClient(t);try{let n=yield i.runtime.multiUserEnabled();return console.log("[Ad4m Connect] Multi-user detection result:",n),n}catch(n){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",n),console.error("[Ad4m Connect] Error details:",n.message,n.stack),!1}})}handleConnectLocal(){return re(this,null,function*(){try{this.changeUIState("requestcap"),yield this._client.connect()}catch(t){console.error("Failed to connect to local AD4M:",t),this.changeUIState("connection_overview")}})}handleShowRemoteConnection(){this._remoteUrl=this.backendUrl||this.url||"",this._remoteMultiUserDetected=null,this._remoteError=null,this.changeUIState("remote_connection")}handleRemoteUrlChange(t){this._remoteUrl=t,this._remoteError=null}handleRemoteConnect(){return re(this,null,function*(){if(!this._remoteUrl){this._remoteError="Please enter a URL";return}this._remoteDetecting=!0,this._remoteError=null,this._remoteMultiUserDetected=null;try{console.log("[Ad4m Connect] Checking if server is reachable:",this._remoteUrl),yield fi(this._remoteUrl,5e3),console.log("[Ad4m Connect] Server is reachable"),yield this.verifyAd4mApi(this._remoteUrl);let t=yield this.detectRemoteMultiUser(this._remoteUrl);this._remoteMultiUserDetected=t,this._remoteDetecting=!1}catch(t){console.error("[Ad4m Connect] Connection/detection failed:",t),this._remoteError=t.message||"Cannot reach server at this URL. Please check the URL and try again.",this._remoteMultiUserDetected=null,this._remoteDetecting=!1}})}handleRemoteMultiUserAuth(){return re(this,null,function*(){this.backendUrl=this._remoteUrl,this.changeUIState("multiuser_auth")})}handleRemoteRequestCapability(){return re(this,null,function*(){try{this.changeUIState("requestcap"),yield this._client.connect(this._remoteUrl)}catch(t){this._remoteError=t.message||"Failed to connect",this.changeUIState("remote_connection")}})}loginToHosting(){return re(this,null,function*(){try{yield this._client.loginToHosting(this._email,this._passowrd),this.changeUIState("connected")}catch(t){t.message.includes("Passwords did not match")?this._passwordError="Passwords did not match":this._hostingNotRunningError="Hosting is not running"}})}changeEmail(t){this._email=t}changePassword(t){this._passowrd=t}unlockAgent(t,i=!0){return re(this,null,function*(){yield this._client.ad4mClient.agent.unlock(t,i)})}verifyCode(t){return re(this,null,function*(){try{yield this._client.verifyCode(t)}catch(i){this._verifyCodeError="Invalid code"}})}changeUrl(t){t!==this._client.url&&(hp("ad4mtoken"),this._client.setToken(null)),this._client.setUrl(t)}changePort(t){this._client.setPort(t)}changeUIState(t){this.uiState=t}setIsHostingRunning(t){this._hostingNotRunningError=t}changeIsRemote(t){this._isRemote=t}changeCode(t){this._code=t}onDownloaded(){this._hasClickedDownload=!0}handleAuthChange(t){let i=new CustomEvent("authstatechange",{detail:t});t==="locked"&&(this._isOpen=!0),t==="authenticated"&&(this._isOpen=!1),this.dispatchEvent(i),this.requestUpdate()}handleConfigChange(t,i){this[t]=i,i?Ac("ad4m"+t,i):hp("ad4m"+t),this.requestUpdate()}handleConnectionChange(t){if(t==="checking_local"){this._isOpen=!1;return}t==="connected"&&(this.authState!=="authenticated"?(this.changeUIState("requestcap"),this._isOpen=!0):(this.changeUIState("connected"),this._isOpen=!1)),t==="disconnected"&&(this._isOpen=!0),t==="not_connected"&&(this._isOpen=!0,this.multiUser&&this.backendUrl?this.changeUIState("multiuser_auth"):this.changeUIState("start"));let i=new CustomEvent("connectionstatechange",{detail:t});this.dispatchEvent(i),this.requestUpdate()}loadFont(){let t=document.createElement("link");t.rel="stylesheet",t.type="text/css",t.crossOrigin="anonymous",t.href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap",document.head.appendChild(t)}startCamera(t){return re(this,null,function*(){try{window.BarcodeDetector.getSupportedFormats()}catch(i){window.BarcodeDetector=Dr}yield this.changeUIState("qr"),setTimeout(()=>re(this,null,function*(){let i=this.shadowRoot.querySelector("video");if(!i)return;let n=yield navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:"environment"}});i.srcObject=n,i.autoplay=!0}),100)})}connect(){return re(this,null,function*(){this._isOpen=!0,this.requestUpdate();let t=yield this._client.connect();try{let i=yield t.agent.status();i.isUnlocked&&i.isInitialized&&window.location.reload()}catch(i){console.warn(i)}return t})}getAd4mClient(){return this._client.ad4mClient}connectRemote(t){return re(this,null,function*(){try{this.changeUrl(t);let i=yield this._client.connect(t),n=yield i.agent.status();return n.isUnlocked&&n.isInitialized||this.changeUIState("requestcap"),i}catch(i){this.changeUIState("requestcap"),this._isOpen=!0}})}requestCapability(t){return re(this,null,function*(){try{yield this._client.requestCapability(t),this.changeUIState("verifycode")}catch(i){console.warn(i)}})}isAuthenticated(){return re(this,null,function*(){return this._client.checkAuth()})}setOpen(t){this._isOpen=t}setHostingStep(t){this._hostingStep=t}clearState(){this.handleConfigChange("port",null),this.handleConfigChange("url",null),this.handleConfigChange("token",null),this.handleConnectionChange("not_connected"),this.handleAuthChange("unauthenticated"),this.changeUIState("start"),this._client.clearState()}renderViews(){if(this.connectionState==="connecting")return Sp();if(this.uiState==="connection_overview")return gp({localDetected:this._localDetected,multiUserConfigured:this.multiUser&&!!this.backendUrl,backendUrl:this.backendUrl,configuredUrl:this.url,isMobile:this._isMobile,onConnectLocal:this.handleConnectLocal,onConnectRemote:this.handleShowRemoteConnection,onScanQR:()=>{this.startCamera(null)},onDownloadAd4m:()=>{window.open("https://github.com/coasys/ad4m/releases")}});if(this.uiState==="remote_connection")return Cp({initialUrl:this._remoteUrl,detecting:this._remoteDetecting,multiUserDetected:this._remoteMultiUserDetected,error:this._remoteError,onBack:()=>this.changeUIState("connection_overview"),onUrlChange:this.handleRemoteUrlChange,onConnect:this.handleRemoteConnect,onMultiUserAuth:this.handleRemoteMultiUserAuth,onRequestCapability:this.handleRemoteRequestCapability});if(this.uiState==="multiuser_auth")return Ep({email:this._multiUserEmail,password:this._multiUserPassword,verificationCode:this._multiUserVerificationCode,error:this._multiUserError,isLoading:this._multiUserLoading,backendUrl:this.backendUrl,step:this._multiUserStep,verificationType:this._multiUserVerificationType,changeEmail:this.changeMultiUserEmail,changePassword:this.changeMultiUserPassword,changeVerificationCode:this.changeMultiUserVerificationCode,onEmailSubmit:this.handleMultiUserEmailSubmit,onPasswordSubmit:this.handleMultiUserPasswordSubmit,onCodeSubmit:this.handleMultiUserCodeSubmit,onBackToEmail:this.handleMultiUserBackToEmail});if(this.uiState==="hosting")return _p({email:this._email,password:this._passowrd,changeEmail:this.changeEmail,changePassword:this.changePassword,changeState:this.changeUIState,step:this._hostingStep,setHostingStep:this.setHostingStep,login:this.loginToHosting,checkEmail:this.checkEmail,passwordError:this._passwordError,isHostingRunning:this._hostingNotRunningError,setIsHostingRunning:this.setIsHostingRunning});if(this.uiState==="qr")return Ap({changeState:this.changeUIState,onSuccess:t=>{this.changeUrl(t),this._client.connect(t)},uiState:this.uiState});if(this.authState==="locked")return mp({unlockAgent:this.unlockAgent,reconnect:this.connect});if(this.uiState==="settings")return kp({port:this.port,changePort:this.changePort,isRemote:this._isRemote,changeIsRemote:this.changeIsRemote,url:this.url,changeState:this.changeUIState,changeUrl:this.changeUrl,connectToPort:this._client.connectToPort,connectRemote:this.connectRemote,clearState:this.clearState});if(this.connectionState==="not_connected")return Tp({scanQrcode:this.startCamera,connect:this.connect,isMobile:this._isMobile,hasClickedDownload:this._hasClickedDownload,onDownloaded:this.onDownloaded,changeState:this.changeUIState,hosting:this.hosting});if(this.connectionState==="connected")return this.uiState==="verifycode"?Ip({code:this._code,changeCode:this.changeCode,changeState:this.changeUIState,verifyCode:this.verifyCode,isHosting:this._client.isHosting,verifyCodeError:this._verifyCodeError}):xp({changeState:this.changeUIState,requestCapability:this.requestCapability,capabilities:this.capabilities,appname:this.appName,setOpen:this.setOpen,appiconpath:this.appIconPath});if(this.connectionState==="disconnected")return vp({reconnect:this.connect});if(this.connectionState==="port_not_found")return yp()}mobileView(){return this.mobile?wp({openModal:()=>{this.changeUIState("settings"),this._isOpen=!this._isOpen}}):null}render(){return console.log(this.authState,this.connectionState,this.uiState,this._isOpen),this._isOpen===!1?this.authState==="authenticated"?this.mobileView():null:F`
3015
3015
  <div class="wrapper">
3016
3016
  <div class="dialog">
3017
- ${vp()}
3017
+ ${bp()}
3018
3018
  <main class="dialog__content">${this.renderViews()}</main>
3019
3019
  ${this.mobileView()}
3020
3020
  </div>
3021
3021
  <div class="ad4mConnect__backdrop" />
3022
3022
  </div>
3023
- `}};ee.styles=[B3],te([xe()],ee.prototype,"_code",2),te([xe()],ee.prototype,"_isMobile",2),te([xe()],ee.prototype,"_hasClickedDownload",2),te([xe()],ee.prototype,"_isRemote",2),te([xe()],ee.prototype,"_client",2),te([xe()],ee.prototype,"_isOpen",2),te([xe()],ee.prototype,"_hostingStep",2),te([xe()],ee.prototype,"_email",2),te([xe()],ee.prototype,"_passowrd",2),te([xe()],ee.prototype,"_passwordError",2),te([xe()],ee.prototype,"_hostingNotRunningError",2),te([xe()],ee.prototype,"_verifyCodeError",2),te([xe()],ee.prototype,"_isHostingLoading",2),te([xe()],ee.prototype,"_multiUserEmail",2),te([xe()],ee.prototype,"_multiUserPassword",2),te([xe()],ee.prototype,"_multiUserVerificationCode",2),te([xe()],ee.prototype,"_multiUserError",2),te([xe()],ee.prototype,"_multiUserLoading",2),te([xe()],ee.prototype,"_multiUserStep",2),te([xe()],ee.prototype,"_multiUserVerificationType",2),te([xe()],ee.prototype,"_localDetected",2),te([xe()],ee.prototype,"_remoteUrl",2),te([xe()],ee.prototype,"_remoteMultiUserDetected",2),te([xe()],ee.prototype,"_remoteDetecting",2),te([xe()],ee.prototype,"_remoteError",2),te([xe()],ee.prototype,"uiState",2),te([pt({type:String,reflect:!0})],ee.prototype,"appName",2),te([pt({type:String,reflect:!0})],ee.prototype,"appDesc",2),te([pt({type:String,reflect:!0})],ee.prototype,"appDomain",2),te([pt({type:String,reflect:!0})],ee.prototype,"appIconPath",2),te([pt({type:Boolean,reflect:!0})],ee.prototype,"mobile",2),te([pt({type:String,reflect:!0})],ee.prototype,"capabilities",2),te([pt({type:Boolean,reflect:!0})],ee.prototype,"hosting",2),te([pt({type:String})],ee.prototype,"token",2),te([pt({type:String,reflect:!0})],ee.prototype,"port",2),te([pt({type:String,reflect:!0})],ee.prototype,"url",2),te([pt({type:Boolean,reflect:!0})],ee.prototype,"multiUser",2),te([pt({type:String,reflect:!0})],ee.prototype,"backendUrl",2),ee=te([Zp("ad4m-connect")],ee);function V3(r){let e=new ee;return Object.entries(r).forEach(([t,i])=>{e[t]=i}),document.body.appendChild(e),e}export{ee as Ad4mConnectElement,V3 as default,U3 as getAd4mClient};
3023
+ `}};ee.styles=[V3],te([xe()],ee.prototype,"_code",2),te([xe()],ee.prototype,"_isMobile",2),te([xe()],ee.prototype,"_hasClickedDownload",2),te([xe()],ee.prototype,"_isRemote",2),te([xe()],ee.prototype,"_client",2),te([xe()],ee.prototype,"_isOpen",2),te([xe()],ee.prototype,"_hostingStep",2),te([xe()],ee.prototype,"_email",2),te([xe()],ee.prototype,"_passowrd",2),te([xe()],ee.prototype,"_passwordError",2),te([xe()],ee.prototype,"_hostingNotRunningError",2),te([xe()],ee.prototype,"_verifyCodeError",2),te([xe()],ee.prototype,"_isHostingLoading",2),te([xe()],ee.prototype,"_multiUserEmail",2),te([xe()],ee.prototype,"_multiUserPassword",2),te([xe()],ee.prototype,"_multiUserVerificationCode",2),te([xe()],ee.prototype,"_multiUserError",2),te([xe()],ee.prototype,"_multiUserLoading",2),te([xe()],ee.prototype,"_multiUserStep",2),te([xe()],ee.prototype,"_multiUserVerificationType",2),te([xe()],ee.prototype,"_localDetected",2),te([xe()],ee.prototype,"_remoteUrl",2),te([xe()],ee.prototype,"_remoteMultiUserDetected",2),te([xe()],ee.prototype,"_remoteDetecting",2),te([xe()],ee.prototype,"_remoteError",2),te([xe()],ee.prototype,"uiState",2),te([ft({type:String,reflect:!0})],ee.prototype,"appName",2),te([ft({type:String,reflect:!0})],ee.prototype,"appDesc",2),te([ft({type:String,reflect:!0})],ee.prototype,"appDomain",2),te([ft({type:String,reflect:!0})],ee.prototype,"appIconPath",2),te([ft({type:Boolean,reflect:!0})],ee.prototype,"mobile",2),te([ft({type:String,reflect:!0})],ee.prototype,"capabilities",2),te([ft({type:Boolean,reflect:!0})],ee.prototype,"hosting",2),te([ft({type:String})],ee.prototype,"token",2),te([ft({type:String,reflect:!0})],ee.prototype,"port",2),te([ft({type:String,reflect:!0})],ee.prototype,"url",2),te([ft({type:Boolean,reflect:!0})],ee.prototype,"multiUser",2),te([ft({type:String,reflect:!0})],ee.prototype,"backendUrl",2),ee=te([Jp("ad4m-connect")],ee);function Q3(r){let e=new ee;return Object.entries(r).forEach(([t,i])=>{e[t]=i}),document.body.appendChild(e),e}export{ee as Ad4mConnectElement,Q3 as default,j3 as getAd4mClient};
3024
3024
  /*!
3025
3025
  * @undecaf/barcode-detector-polyfill v0.9.20
3026
3026
  * A WebAssembly polyfill for the Barcode Detection API