@coasys/ad4m-connect 0.11.2-dev-multi-user-email-2 → 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 fm=Object.defineProperty;var dm=Object.getOwnPropertyDescriptor;var te=(t,e,r,i)=>{for(var n=i>1?void 0:i?dm(e,r):e,a=t.length-1,o;a>=0;a--)(o=t[a])&&(n=(i?o(e,r,n):o(n))||n);return i&&n&&fm(e,r,n),n};var re=(t,e,r)=>new Promise((i,n)=>{var a=u=>{try{s(r.next(u))}catch(c){n(c)}},o=u=>{try{s(r.throw(u))}catch(c){n(c)}},s=u=>u.done?i(u.value):Promise.resolve(u.value).then(a,o);s((r=r.apply(t,e)).next())});import{ZBarSymbolType as me,ZBarConfigType as Ip,scanRGBABuffer as hm,getDefaultScanner as mm}from"https://cdn.jsdelivr.net/npm/@undecaf/zbar-wasm@0.9.15/dist/main.js";function gm(t,e,r,i){return new(r||(r=Promise))(function(n,a){function o(c){try{u(i.next(c))}catch(l){a(l)}}function s(c){try{u(i.throw(c))}catch(l){a(l)}}function u(c){var l;c.done?n(c.value):(l=c.value,l instanceof r?l:new r(function(d){d(l)})).then(o,s)}u((i=i.apply(t,e||[])).next())})}var M=class{constructor(e,r=Ip.ZBAR_CFG_ENABLE,i=1){this.symbolType=e,this.configType=r,this.number=i,this.configSteps=[this]}static register(e,r,i=r.symbolType){return M.formatsToConfigs[e]=r,M.typesToFormats[i]=M.typesToFormats[i]||e,r}static formats(){return Object.keys(M.formatsToConfigs)}static toFormat(e){return M.typesToFormats[e]}static configure(e,r){var i;(i=M.formatsToConfigs[r])===null||i===void 0||i.configSteps.forEach(n=>e.setConfig(n.symbolType,n.configType,n.number))}add(e){return this.configSteps.push(e),this}},Tp;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(t){t[t.UNKNOWN=-1]="UNKNOWN",t[t.UPRIGHT=0]="UPRIGHT",t[t.ROTATED_RIGHT=1]="ROTATED_RIGHT",t[t.UPSIDE_DOWN=2]="UPSIDE_DOWN",t[t.ROTATED_LEFT=3]="ROTATED_LEFT"}(Tp||(Tp={}));var xc=class{},ym=(()=>{try{return new OffscreenCanvas(1,1).getContext("2d")instanceof OffscreenCanvasRenderingContext2D}catch{return!1}})(),Nr=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 r=e.formats.filter(i=>!M.formats().includes(i));if(r.length)throw new TypeError(`Unsupported barcode format(s): ${r.join(", ")}`)}this.formats=e.formats||M.formats(),this.zbarConfig=e.zbar||new xc}static getSupportedFormats(){return Promise.resolve(M.formats())}detect(e){if(!Nr.isImageBitmapSource(e))throw new TypeError("BarcodeDetector.detect() argument is not an ImageBitmapSource");let r=Nr.intrinsicDimensions(e);if(r.width===0||r.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),hm(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,r)=>gm(this,void 0,void 0,function*(){if(!this.scanner){let i=yield mm();this.formats.length>0&&(i.setConfig(me.ZBAR_NONE,Ip.ZBAR_CFG_ENABLE,0),this.formats.forEach(n=>M.configure(i,n))),this.scanner=i}e(this.scanner)}))}toImageData(e){let r=i=>{let n=Nr.intrinsicDimensions(i);this.canvas&&this.canvas.width===n.width&&this.canvas.height===n.height||(this.canvas=function(s,u){if(ym)return new OffscreenCanvas(s,u);{let c=document.createElement("canvas");return c.width=s,c.height=u,c}}(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(()=>r(i)).finally(()=>URL.revokeObjectURL(i.src))}return e instanceof CanvasRenderingContext2D?Promise.resolve(e.getImageData(0,0,e.canvas.width,e.canvas.height)):Promise.resolve(r(e))}toBarcodeDetectorResult(e){let r={minX:1/0,maxX:-1/0,minY:1/0,maxY:-1/0};return e.points.forEach(i=>{r.minX=Math.min(r.minX,i.x),r.maxX=Math.max(r.maxX,i.x),r.minY=Math.min(r.minY,i.y),r.maxY=Math.max(r.maxY,i.y)}),{format:M.toFormat(e.type),rawValue:e.decode(this.zbarConfig.encoding),orientation:e.orientation,quality:e.quality,boundingBox:DOMRectReadOnly.fromRect({x:r.minX,y:r.minY,width:r.maxX-r.minX,height:r.maxY-r.minY}),cornerPoints:[{x:r.minX,y:r.minY},{x:r.maxX,y:r.minY},{x:r.maxX,y:r.maxY},{x:r.minX,y:r.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 ko=window,To=ko.ShadowRoot&&(ko.ShadyCSS===void 0||ko.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ac=Symbol(),Op=new WeakMap,ia=class{constructor(e,r,i){if(this._$cssResult$=!0,i!==Ac)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=r}get styleSheet(){let e=this.o,r=this.t;if(To&&e===void 0){let i=r!==void 0&&r.length===1;i&&(e=Op.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Op.set(r,e))}return e}toString(){return this.cssText}},Dp=t=>new ia(typeof t=="string"?t:t+"",void 0,Ac),kc=(t,...e)=>{let r=t.length===1?t[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)+t[a+1],t[0]);return new ia(r,t,Ac)},Tc=(t,e)=>{To?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{let i=document.createElement("style"),n=ko.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=r.cssText,t.appendChild(i)})},Io=To?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(let i of e.cssRules)r+=i.cssText;return Dp(r)})(t):t;var Ic,Oo=window,Np=Oo.trustedTypes,vm=Np?Np.emptyScript:"",Rp=Oo.reactiveElementPolyfillSupport,Dc={toAttribute(t,e){switch(e){case Boolean:t=t?vm:null;break;case Object:case Array:t=t==null?t:JSON.stringify(t)}return t},fromAttribute(t,e){let r=t;switch(e){case Boolean:r=t!==null;break;case Number:r=t===null?null:Number(t);break;case Object:case Array:try{r=JSON.parse(t)}catch{r=null}}return r}},Pp=(t,e)=>e!==t&&(e==e||t==t),Oc={attribute:!0,type:String,converter:Dc,reflect:!1,hasChanged:Pp},Nc="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 r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((r,i)=>{let n=this._$Ep(i,r);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,r=Oc){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(e,r),!r.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,r);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,r,i){return{get(){return this[r]},set(n){let a=this[e];this[r]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Oc}static finalize(){if(this.hasOwnProperty(Nc))return!1;this[Nc]=!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 r=this.properties,i=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(let n of i)this.createProperty(n,r[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let r=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)r.unshift(Io(n))}else e!==void 0&&r.push(Io(e));return r}static _$Ep(e,r){let i=r.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(r=>r(this))}addController(e){var r,i;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var e;let r=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return Tc(r,this.constructor.elementStyles),r}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(r=>{var i;return(i=r.hostConnected)===null||i===void 0?void 0:i.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var i;return(i=r.hostDisconnected)===null||i===void 0?void 0:i.call(r)})}attributeChangedCallback(e,r,i){this._$AK(e,i)}_$EO(e,r,i=Oc){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:Dc).toAttribute(r,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,r){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:Dc;this._$El=a,this[a]=s.fromAttribute(r,o.type),this._$El=null}}requestUpdate(e,r,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Pp)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),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(r){Promise.reject(r)}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 r=!1,i=this._$AL;try{r=this.shouldUpdate(i),r?(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 r=!1,this._$Ek(),n}r&&this._$AE(i)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.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((r,i)=>this._$EO(i,this[i],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};gr[Nc]=!0,gr.elementProperties=new Map,gr.elementStyles=[],gr.shadowRootOptions={mode:"open"},Rp?.({ReactiveElement:gr}),((Ic=Oo.reactiveElementVersions)!==null&&Ic!==void 0?Ic:Oo.reactiveElementVersions=[]).push("1.6.3");var Rc,Do=window,dn=Do.trustedTypes,$p=dn?dn.createPolicy("lit-html",{createHTML:t=>t}):void 0,$c="$lit$",Rr=`lit$${(Math.random()+"").slice(9)}$`,Bp="?"+Rr,bm=`<${Bp}>`,mi=document,aa=()=>mi.createComment(""),oa=t=>t===null||typeof t!="object"&&typeof t!="function",Vp=Array.isArray,_m=t=>Vp(t)||typeof t?.[Symbol.iterator]=="function",Pc=`[
2
- \f\r]`,na=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lp=/-->/g,Fp=/>/g,di=RegExp(`>|${Pc}(?:([^\\s"'>=/]+)(${Pc}*=${Pc}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Mp=/'/g,Up=/"/g,Qp=/^(?:script|style|textarea|title)$/i,zp=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),L=zp(1),J3=zp(2),gi=Symbol.for("lit-noChange"),We=Symbol.for("lit-nothing"),jp=new WeakMap,hi=mi.createTreeWalker(mi,129,null,!1);function Wp(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return $p!==void 0?$p.createHTML(e):e}var Sm=(t,e)=>{let r=t.length-1,i=[],n,a=e===2?"<svg>":"",o=na;for(let s=0;s<r;s++){let u=t[s],c,l,d=-1,f=0;for(;f<u.length&&(o.lastIndex=f,l=o.exec(u),l!==null);)f=o.lastIndex,o===na?l[1]==="!--"?o=Lp:l[1]!==void 0?o=Fp:l[2]!==void 0?(Qp.test(l[2])&&(n=RegExp("</"+l[2],"g")),o=di):l[3]!==void 0&&(o=di):o===di?l[0]===">"?(o=n??na,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,c=l[1],o=l[3]===void 0?di:l[3]==='"'?Up:Mp):o===Up||o===Mp?o=di:o===Lp||o===Fp?o=na:(o=di,n=void 0);let p=o===di&&t[s+1].startsWith("/>")?" ":"";a+=o===na?u+bm:d>=0?(i.push(c),u.slice(0,d)+$c+u.slice(d)+Rr+p):u+Rr+(d===-2?(i.push(void 0),s):p)}return[Wp(t,a+(t[r]||"<?>")+(e===2?"</svg>":"")),i]},yi=class{constructor({strings:e,_$litType$:r},i){let n;this.parts=[];let a=0,o=0,s=e.length-1,u=this.parts,[c,l]=Sm(e,r);if(this.el=yi.createElement(c,i),hi.currentNode=this.el.content,r===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(n=hi.nextNode())!==null&&u.length<s;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let f of n.getAttributeNames())if(f.endsWith($c)||f.startsWith(Rr)){let p=l[o++];if(d.push(f),p!==void 0){let h=n.getAttribute(p.toLowerCase()+$c).split(Rr),m=/([.?@])?(.*)/.exec(p);u.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?Fc:m[1]==="?"?Mc:m[1]==="@"?Uc:mn})}else u.push({type:6,index:a})}for(let f of d)n.removeAttribute(f)}if(Qp.test(n.tagName)){let d=n.textContent.split(Rr),f=d.length-1;if(f>0){n.textContent=dn?dn.emptyScript:"";for(let p=0;p<f;p++)n.append(d[p],aa()),hi.nextNode(),u.push({type:2,index:++a});n.append(d[f],aa())}}}else if(n.nodeType===8)if(n.data===Bp)u.push({type:2,index:a});else{let d=-1;for(;(d=n.data.indexOf(Rr,d+1))!==-1;)u.push({type:7,index:a}),d+=Rr.length-1}a++}}static createElement(e,r){let i=mi.createElement("template");return i.innerHTML=e,i}};function hn(t,e,r=t,i){var n,a,o,s;if(e===gi)return e;let u=i!==void 0?(n=r._$Co)===null||n===void 0?void 0:n[i]:r._$Cl,c=oa(e)?void 0:e._$litDirective$;return u?.constructor!==c&&((a=u?._$AO)===null||a===void 0||a.call(u,!1),c===void 0?u=void 0:(u=new c(t),u._$AT(t,r,i)),i!==void 0?((o=(s=r)._$Co)!==null&&o!==void 0?o:s._$Co=[])[i]=u:r._$Cl=u),u!==void 0&&(e=hn(t,u._$AS(t,e.values),u,i)),e}var Lc=class{constructor(e,r){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=r}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var r;let{el:{content:i},parts:n}=this._$AD,a=((r=e?.creationScope)!==null&&r!==void 0?r:mi).importNode(i,!0);hi.currentNode=a;let o=hi.nextNode(),s=0,u=0,c=n[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new vi(o,o.nextSibling,this,e):c.type===1?l=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(l=new jc(o,this,e)),this._$AV.push(l),c=n[++u]}s!==c?.index&&(o=hi.nextNode(),s++)}return hi.currentNode=mi,a}v(e){let r=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,r),r+=i.strings.length-2):i._$AI(e[r])),r++}},vi=class{constructor(e,r,i,n){var a;this.type=2,this._$AH=We,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=i,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,r;return(r=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&r!==void 0?r:this._$Cp}get parentNode(){let e=this._$AA.parentNode,r=this._$AM;return r!==void 0&&e?.nodeType===11&&(e=r.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,r=this){e=hn(this,e,r),oa(e)?e===We||e==null||e===""?(this._$AH!==We&&this._$AR(),this._$AH=We):e!==this._$AH&&e!==gi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):_m(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==We&&oa(this._$AH)?this._$AA.nextSibling.data=e:this.$(mi.createTextNode(e)),this._$AH=e}g(e){var r;let{values:i,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=yi.createElement(Wp(n.h,n.h[0]),this.options)),n);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===a)this._$AH.v(i);else{let o=new Lc(a,this),s=o.u(this.options);o.v(i),this.$(s),this._$AH=o}}_$AC(e){let r=jp.get(e.strings);return r===void 0&&jp.set(e.strings,r=new yi(e)),r}T(e){Vp(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,i,n=0;for(let a of e)n===r.length?r.push(i=new vi(this.k(aa()),this.k(aa()),this,this.options)):i=r[n],i._$AI(a),n++;n<r.length&&(this._$AR(i&&i._$AB.nextSibling,n),r.length=n)}_$AR(e=this._$AA.nextSibling,r){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,r);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}},mn=class{constructor(e,r,i,n,a){this.type=1,this._$AH=We,this._$AN=void 0,this.element=e,this.name=r,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=We}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,r=this,i,n){let a=this.strings,o=!1;if(a===void 0)e=hn(this,e,r,0),o=!oa(e)||e!==this._$AH&&e!==gi,o&&(this._$AH=e);else{let s=e,u,c;for(e=a[0],u=0;u<a.length-1;u++)c=hn(this,s[i+u],r,u),c===gi&&(c=this._$AH[u]),o||(o=!oa(c)||c!==this._$AH[u]),c===We?e=We:e!==We&&(e+=(c??"")+a[u+1]),this._$AH[u]=c}o&&!n&&this.j(e)}j(e){e===We?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Fc=class extends mn{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===We?void 0:e}},wm=dn?dn.emptyScript:"",Mc=class extends mn{constructor(){super(...arguments),this.type=4}j(e){e&&e!==We?this.element.setAttribute(this.name,wm):this.element.removeAttribute(this.name)}},Uc=class extends mn{constructor(e,r,i,n,a){super(e,r,i,n,a),this.type=5}_$AI(e,r=this){var i;if((e=(i=hn(this,e,r,0))!==null&&i!==void 0?i:We)===gi)return;let n=this._$AH,a=e===We&&n!==We||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==We&&(n===We||a);a&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var r,i;typeof this._$AH=="function"?this._$AH.call((i=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}},jc=class{constructor(e,r,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){hn(this,e)}};var qp=Do.litHtmlPolyfillSupport;qp?.(yi,vi),((Rc=Do.litHtmlVersions)!==null&&Rc!==void 0?Rc:Do.litHtmlVersions=[]).push("2.8.0");var Hp=(t,e,r)=>{var i,n;let a=(i=r?.renderBefore)!==null&&i!==void 0?i:e,o=a._$litPart$;if(o===void 0){let s=(n=r?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=o=new vi(e.insertBefore(aa(),s),s,void 0,r??{})}return o._$AI(t),o};var qc,Bc;var Pr=class extends gr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let i=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=i.firstChild),i}update(e){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=Hp(r,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}};Pr.finalized=!0,Pr._$litElement$=!0,(qc=globalThis.litElementHydrateSupport)===null||qc===void 0||qc.call(globalThis,{LitElement:Pr});var Gp=globalThis.litElementPolyfillSupport;Gp?.({LitElement:Pr});((Bc=globalThis.litElementVersions)!==null&&Bc!==void 0?Bc:globalThis.litElementVersions=[]).push("3.3.3");var Kp=t=>e=>typeof e=="function"?((r,i)=>(customElements.define(r,i),i))(t,e):((r,i)=>{let{kind:n,elements:a}=i;return{kind:n,elements:a,finisher(o){customElements.define(r,o)}}})(t,e);var Cm=(t,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(r){r.createProperty(e.key,t)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(r){r.createProperty(e.key,t)}},Em=(t,e,r)=>{e.constructor.createProperty(r,t)};function st(t){return(e,r)=>r!==void 0?Em(t,e,r):Cm(t,e)}function Ee(t){return st({...t,state:!0})}var Vc,Eb=((Vc=window.HTMLSlotElement)===null||Vc===void 0?void 0:Vc.prototype.assignedElements)!=null?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter(r=>r.nodeType===Node.ELEMENT_NODE);var Qc=function(t,e){return Qc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,i){r.__proto__=i}||function(r,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(r[n]=i[n])},Qc(t,e)};function Re(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Qc(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var C=function(){return C=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},C.apply(this,arguments)};function Yt(t,e){var r={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&e.indexOf(i)<0&&(r[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(t);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(t,i[n])&&(r[i[n]]=t[i[n]]);return r}function Bt(t,e,r,i){function n(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{c(i.next(l))}catch(d){o(d)}}function u(l){try{c(i.throw(l))}catch(d){o(d)}}function c(l){l.done?a(l.value):n(l.value).then(s,u)}c((i=i.apply(t,e||[])).next())})}function Vt(t,e){var r={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(c){return function(l){return u([c,l])}}function u(c){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(i=1,n&&(a=c[0]&2?n.return:c[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,c[1])).done)return a;switch(n=0,a&&(c=[c[0]&2,a.value]),c[0]){case 0:case 1:a=c;break;case 4:return r.label++,{value:c[1],done:!1};case 5:r.label++,n=c[1],c=[0];continue;case 7:c=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!a||c[1]>a[0]&&c[1]<a[3])){r.label=c[1];break}if(c[0]===6&&r.label<a[1]){r.label=a[1],a=c;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(c);break}a[2]&&r.ops.pop(),r.trys.pop();continue}c=e.call(t,r)}catch(l){c=[6,l],n=0}finally{i=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function $r(t,e,r){if(r||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 t.concat(a||Array.prototype.slice.call(e))}var zc="Invariant Violation",Zp=Object.setPrototypeOf,xm=Zp===void 0?function(t,e){return t.__proto__=e,t}:Zp,Z=function(t){Re(e,t);function e(r){r===void 0&&(r=zc);var i=t.call(this,typeof r=="number"?zc+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return i.framesToPop=1,i.name=zc,xm(i,e.prototype),i}return e}(Error);function $(t,e){if(!t)throw new Z(e)}var Ro=["debug","log","warn","error","silent"],Wc=Ro.indexOf("log");function No(t){return function(){if(Ro.indexOf(t)>=Wc){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=No("debug"),t.log=No("log"),t.warn=No("warn"),t.error=No("error")})($||($={}));function Jp(t){var e=Ro[Wc];return Wc=Math.max(0,Ro.indexOf(t)),e}function He(t){try{return t()}catch{}}var Po=He(function(){return globalThis})||He(function(){return window})||He(function(){return self})||He(function(){return global})||He(function(){return He.constructor("return this")()});var Yp="__",Xp=[Yp,Yp].join("DEV");function Am(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Po,Xp,{value:He(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Po[Xp]}}var bi=Am();function Lr(t){try{return t()}catch{}}var Hc=Lr(function(){return globalThis})||Lr(function(){return window})||Lr(function(){return self})||Lr(function(){return global})||Lr(function(){return Lr.constructor("return this")()}),Gc=!1;function km(){Hc&&!Lr(function(){return"production"})&&!Lr(function(){return process})&&(Object.defineProperty(Hc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Gc=!0)}km();function Kc(){Gc&&(delete Hc.process,Gc=!1)}var Zb=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",Jb=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",ef=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 Zc(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Tm=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ca=Tm;function $o(t){var e=t.prototype.toJSON;typeof e=="function"||Zc(0),t.prototype.inspect=e,ca&&(t.prototype[ca]=e)}var tf=function(){function t(r,i,n){this.start=r.start,this.end=i.end,this.startToken=r,this.endToken=i,this.source=n}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();$o(tf);var rf=function(){function t(r,i,n,a,o,s,u){this.kind=r,this.start=i,this.end=n,this.line=a,this.column=o,this.value=u,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();$o(rf);function Jc(t){return t!=null&&typeof t.kind=="string"}function Lo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Lo=function(r){return typeof r}:Lo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Lo(t)}var Im=10,nf=2;function ua(t){return Fo(t,[])}function Fo(t,e){switch(Lo(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Om(t,e);default:return String(t)}}function Om(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),i=Rm(t);if(i!==void 0){var n=i.call(t);if(n!==t)return typeof n=="string"?n:Fo(n,r)}else if(Array.isArray(t))return Nm(t,r);return Dm(t,r)}function Dm(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>nf)return"["+Pm(t)+"]";var i=r.map(function(n){var a=Fo(t[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function Nm(t,e){if(t.length===0)return"[]";if(e.length>nf)return"[Array]";for(var r=Math.min(Im,t.length),i=t.length-r,n=[],a=0;a<r;++a)n.push(Fo(t[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function Rm(t){var e=t[String(ca)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Pm(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function la(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function af(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function $m(t,e,r){return e&&af(t.prototype,e),r&&af(t,r),t}var Mo=function(){function t(e){var r=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"||la(0,"Body must be a string. Received: ".concat(ua(e),".")),this.body=e,this.name=r,this.locationOffset=i,this.locationOffset.line>0||la(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||la(0,"column in locationOffset is 1-indexed and must be positive.")}return $m(t,[{key:ef,get:function(){return"Source"}}]),t}();function of(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=t.indexOf(`
4
- `)===-1,n=t[0]===" "||t[0]===" ",a=t[t.length-1]==='"',o=t[t.length-1]==="\\",s=!i||a||o||r,u="";return s&&!(i&&n)&&(u+=`
5
- `+e),u+=e?t.replace(/\n/g,`
6
- `+e):t,s&&(u+=`
7
- `),'"""'+u.replace(/"""/g,'\\"""')+'"""'}var Lm={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 nt(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Lm,i=void 0,n=Array.isArray(t),a=[t],o=-1,s=[],u=void 0,c=void 0,l=void 0,d=[],f=[],p=t;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(c=f.length===0?void 0:d[d.length-1],u=l,l=f.pop(),m){if(n)u=u.slice();else{for(var b={},_=0,S=Object.keys(u);_<S.length;_++){var w=S[_];b[w]=u[w]}u=b}for(var v=0,D=0;D<s.length;D++){var N=s[D][0],A=s[D][1];n&&(N-=v),n&&A===null?(u.splice(N,1),v++):u[N]=A}}o=i.index,a=i.keys,s=i.edits,n=i.inArray,i=i.prev}else{if(c=l?n?o:a[o]:void 0,u=l?l[c]:p,u==null)continue;l&&d.push(c)}var R=void 0;if(!Array.isArray(u)){if(!Jc(u))throw new Error("Invalid AST Node: ".concat(ua(u),"."));var F=Yc(e,u.kind,h);if(F){if(R=F.call(e,u,c,l,d,f),R===_i)break;if(R===!1){if(!h){d.pop();continue}}else if(R!==void 0&&(s.push([c,R]),!h))if(Jc(R))u=R;else{d.pop();continue}}}if(R===void 0&&m&&s.push([c,u]),h)d.pop();else{var P;i={inArray:n,index:o,keys:a,edits:s,prev:i},n=Array.isArray(u),a=n?u:(P=r[u.kind])!==null&&P!==void 0?P:[],o=-1,s=[],l&&f.push(l),l=u}}while(i!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function Yc(t,e,r){var i=t[e];if(i){if(!r&&typeof i=="function")return i;var n=r?i.leave:i.enter;if(typeof n=="function")return n}else{var a=r?t.leave:t.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function gn(t){return nt(t,{leave:Mm})}var Fm=80,Mm={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return U(e.definitions,`
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
+ `)===-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
+ `+e),c+=e?r.replace(/\n/g,`
6
+ `+e):r,s&&(c+=`
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 r=e.operation,i=e.name,n=Oe("(",U(e.variableDefinitions,", "),")"),a=U(e.directives," "),o=e.selectionSet;return!i&&!a&&!n&&r==="query"?o:U([r,U([i,n]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,i=e.type,n=e.defaultValue,a=e.directives;return r+": "+i+Oe(" = ",n)+Oe(" ",U(a," "))},SelectionSet:function(e){var r=e.selections;return zt(r)},Field:function(e){var r=e.alias,i=e.name,n=e.arguments,a=e.directives,o=e.selectionSet,s=Oe("",r,": ")+i,u=s+Oe("(",U(n,", "),")");return u.length>Fm&&(u=s+Oe(`(
11
- `,Uo(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([u,U(a," "),o]," ")},Argument:function(e){var r=e.name,i=e.value;return r+": "+i},FragmentSpread:function(e){var r=e.name,i=e.directives;return"..."+r+Oe(" ",U(i," "))},InlineFragment:function(e){var r=e.typeCondition,i=e.directives,n=e.selectionSet;return U(["...",Oe("on ",r),U(i," "),n]," ")},FragmentDefinition:function(e){var r=e.name,i=e.typeCondition,n=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(r).concat(Oe("(",U(n,", "),")")," ")+"on ".concat(i," ").concat(Oe("",U(a," ")," "))+o},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var i=e.value,n=e.block;return n?of(i,r==="description"?"":" "):JSON.stringify(i)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+U(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+U(r,", ")+"}"},ObjectField:function(e){var r=e.name,i=e.value;return r+": "+i},Directive:function(e){var r=e.name,i=e.arguments;return"@"+r+Oe("(",U(i,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:Qt(function(t){var e=t.directives,r=t.operationTypes;return U(["schema",U(e," "),zt(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,i=e.type;return r+": "+i},ScalarTypeDefinition:Qt(function(t){var e=t.name,r=t.directives;return U(["scalar",e,U(r," ")]," ")}),ObjectTypeDefinition:Qt(function(t){var e=t.name,r=t.interfaces,i=t.directives,n=t.fields;return U(["type",e,Oe("implements ",U(r," & ")),U(i," "),zt(n)]," ")}),FieldDefinition:Qt(function(t){var e=t.name,r=t.arguments,i=t.type,n=t.directives;return e+(sf(r)?Oe(`(
14
- `,Uo(U(r,`
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
- )`):Oe("(",U(r,", "),")"))+": "+i+Oe(" ",U(n," "))}),InputValueDefinition:Qt(function(t){var e=t.name,r=t.type,i=t.defaultValue,n=t.directives;return U([e+": "+r,Oe("= ",i),U(n," ")]," ")}),InterfaceTypeDefinition:Qt(function(t){var e=t.name,r=t.interfaces,i=t.directives,n=t.fields;return U(["interface",e,Oe("implements ",U(r," & ")),U(i," "),zt(n)]," ")}),UnionTypeDefinition:Qt(function(t){var e=t.name,r=t.directives,i=t.types;return U(["union",e,U(r," "),i&&i.length!==0?"= "+U(i," | "):""]," ")}),EnumTypeDefinition:Qt(function(t){var e=t.name,r=t.directives,i=t.values;return U(["enum",e,U(r," "),zt(i)]," ")}),EnumValueDefinition:Qt(function(t){var e=t.name,r=t.directives;return U([e,U(r," ")]," ")}),InputObjectTypeDefinition:Qt(function(t){var e=t.name,r=t.directives,i=t.fields;return U(["input",e,U(r," "),zt(i)]," ")}),DirectiveDefinition:Qt(function(t){var e=t.name,r=t.arguments,i=t.repeatable,n=t.locations;return"directive @"+e+(sf(r)?Oe(`(
17
- `,Uo(U(r,`
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
- )`):Oe("(",U(r,", "),")"))+(i?" repeatable":"")+" on "+U(n," | ")}),SchemaExtension:function(e){var r=e.directives,i=e.operationTypes;return U(["extend schema",U(r," "),zt(i)]," ")},ScalarTypeExtension:function(e){var r=e.name,i=e.directives;return U(["extend scalar",r,U(i," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,i=e.interfaces,n=e.directives,a=e.fields;return U(["extend type",r,Oe("implements ",U(i," & ")),U(n," "),zt(a)]," ")},InterfaceTypeExtension:function(e){var r=e.name,i=e.interfaces,n=e.directives,a=e.fields;return U(["extend interface",r,Oe("implements ",U(i," & ")),U(n," "),zt(a)]," ")},UnionTypeExtension:function(e){var r=e.name,i=e.directives,n=e.types;return U(["extend union",r,U(i," "),n&&n.length!==0?"= "+U(n," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,i=e.directives,n=e.values;return U(["extend enum",r,U(i," "),zt(n)]," ")},InputObjectTypeExtension:function(e){var r=e.name,i=e.directives,n=e.fields;return U(["extend input",r,U(i," "),zt(n)]," ")}};function Qt(t){return function(e){return U([e.description,t(e)],`
20
- `)}}function U(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t?.filter(function(i){return i}).join(r))!==null&&e!==void 0?e:""}function zt(t){return Oe(`{
21
- `,Uo(U(t,`
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 Oe(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function Uo(t){return Oe(" ",t.replace(/\n/g,`
24
- `))}function Um(t){return t.indexOf(`
25
- `)!==-1}function sf(t){return t!=null&&t.some(Um)}function pa(t){return t.kind===Me.FIELD||t.kind===Me.FRAGMENT_SPREAD||t.kind===Me.INLINE_FRAGMENT}function cf(){return typeof Mo=="function"?Kc():Kc()}function Km(){__DEV__?$(typeof bi=="boolean",bi):$(typeof bi=="boolean",39)}cf();Km();function yr(t,e){var r=t.directives;return!r||!r.length?!0:uf(r).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 yn(t,e,r){var i=new Set(t),n=i.size;return nt(e,{Directive:function(a){if(i.delete(a.name.value)&&(!r||!i.size))return _i}}),r?!i.size:i.size<n}function Xc(t){return t&&yn(["client","export"],t,!0)}function Zm(t){var e=t.name.value;return e==="skip"||e==="include"}function uf(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!Zm(r)){var i=r.arguments,n=r.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:r,ifArgument:a})}}),e}function eu(t,e){var r=e,i=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new Z("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 Z(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof r>"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),r=i[0].name.value);var n=C(C({},t),{definitions:$r([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return n}function Si(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function wi(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=t.name.value;if(typeof e=="function")return e(r);var i=e&&e[r];return __DEV__?$(i,"No fragment named ".concat(r)):$(i,46),i||null}default:return null}}function fe(t){return t!==null&&typeof t=="object"}function Xt(t){return{__ref:String(t)}}function se(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function tu(t){return fe(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function Jm(t){return t.kind==="StringValue"}function Ym(t){return t.kind==="BooleanValue"}function Xm(t){return t.kind==="IntValue"}function eg(t){return t.kind==="FloatValue"}function tg(t){return t.kind==="Variable"}function rg(t){return t.kind==="ObjectValue"}function ig(t){return t.kind==="ListValue"}function ng(t){return t.kind==="EnumValue"}function ag(t){return t.kind==="NullValue"}function Fr(t,e,r,i){if(Xm(r)||eg(r))t[e.value]=Number(r.value);else if(Ym(r)||Jm(r))t[e.value]=r.value;else if(rg(r)){var n={};r.fields.map(function(o){return Fr(n,o.name,o.value,i)}),t[e.value]=n}else if(tg(r)){var a=(i||{})[r.name.value];t[e.value]=a}else if(ig(r))t[e.value]=r.values.map(function(o){var s={};return Fr(s,e,o,i),s[e.value]});else if(ng(r))t[e.value]=r.value;else if(ag(r))t[e.value]=null;else throw __DEV__?new Z('The inline argument "'.concat(e.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new Z(55)}function ru(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(n){r[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Fr(r[n.name.value],o,s,e)})}));var i=null;return t.arguments&&t.arguments.length&&(i={},t.arguments.forEach(function(n){var a=n.name,o=n.value;return Fr(i,a,o,e)})),da(t.name.value,i,r)}var og=["connection","include","skip","client","rest","export"],da=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var i=r.connection.filter?r.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(r.connection.key,"(").concat(fa(n),")")}else return r.connection.key;var a=t;if(e){var o=fa(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){og.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(fa(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=fa;return fa=t,e}}),fa=function(e){return JSON.stringify(e,sg)};function sg(t,e){return fe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,i){return r[i]=e[i],r},{})),e}function vr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(i){var n=i.name,a=i.value;return Fr(r,n,a,e)}),r}return null}function Rt(t){return t.alias?t.alias.value:t.name.value}function ha(t,e,r){if(typeof t.__typename=="string")return t.__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 t[Rt(a)]}else{var o=ha(t,wi(a,r).selectionSet,r);if(typeof o=="string")return o}}}function Et(t){return t.kind==="Field"}function iu(t){return t.kind==="InlineFragment"}function vn(t){__DEV__?$(t&&t.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'):$(t&&t.kind==="Document",47);var e=t.definitions.filter(function(r){return r.kind!=="FragmentDefinition"}).map(function(r){if(r.kind!=="OperationDefinition")throw __DEV__?new Z('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new Z(48);return r});return __DEV__?$(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):$(e.length<=1,49),t}function er(t){return vn(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function bn(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Ci(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function ma(t){var e=er(t);return __DEV__?$(e&&e.operation==="query","Must contain a query definition."):$(e&&e.operation==="query",50),e}function nu(t){__DEV__?$(t.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'):$(t.kind==="Document",51),__DEV__?$(t.definitions.length<=1,"Fragment must have exactly one definition."):$(t.definitions.length<=1,52);var e=t.definitions[0];return __DEV__?$(e.kind==="FragmentDefinition","Must be a fragment definition."):$(e.kind==="FragmentDefinition",53),e}function Ei(t){vn(t);for(var e,r=0,i=t.definitions;r<i.length;r++){var n=i[r];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 Z("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new Z(54)}function xi(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(i){i.defaultValue&&Fr(e,i.variable.name,i.defaultValue)}),e}var Se=Array.isArray;function qe(t){return Array.isArray(t)&&t.length>0}var lf={kind:Me.FIELD,name:{kind:Me.NAME,value:"__typename"}};function ff(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===Me.FRAGMENT_SPREAD&&ff(e[r.name.value],e)})}function cg(t){return ff(er(t)||nu(t),Si(Ci(t)))?null:t}function ug(t){var e=new Set,r=[];return t.forEach(function(i){i.name?e.add(i.name):i.test&&r.push(i.test)}),function(i){return e.has(i.name.value)||r.some(function(n){return n(i)})}}function pf(t){var e=new Map;return function(i){i===void 0&&(i=t);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function au(t,e){for(var r=pf(""),i=pf(""),n=function(S){for(var w=0,v=void 0;w<S.length&&(v=S[w]);++w)if(!Se(v)){if(v.kind===Me.OPERATION_DEFINITION)return r(v.name&&v.name.value);if(v.kind===Me.FRAGMENT_DEFINITION)return i(v.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(t),u=t.some(function(S){return S.remove}),c=function(S){return u&&S&&S.some(s)},l=new Map,d=!1,f={enter:function(S){if(c(S.directives))return d=!0,null}},p=nt(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(S,w,v,D,N){var A=n(N);A&&A.variables.add(S.name.value)}},FragmentSpread:{enter:function(S,w,v,D,N){if(c(S.directives))return d=!0,null;var A=n(N);A&&A.fragmentSpreads.add(S.name.value)}},FragmentDefinition:{enter:function(S,w,v,D){l.set(JSON.stringify(D),S)},leave:function(S,w,v,D){var N=l.get(JSON.stringify(D));if(S===N)return S;if(a>0&&S.selectionSet.selections.every(function(A){return A.kind===Me.FIELD&&A.name.value==="__typename"}))return i(S.name.value).removed=!0,d=!0,null}},Directive:{leave:function(S){if(s(S))return d=!0,null}}});if(!d)return e;var h=function(S){return S.transitiveVars||(S.transitiveVars=new Set(S.variables),S.removed||S.fragmentSpreads.forEach(function(w){h(i(w)).transitiveVars.forEach(function(v){S.transitiveVars.add(v)})})),S},m=new Set;p.definitions.forEach(function(S){S.kind===Me.OPERATION_DEFINITION?h(r(S.name&&S.name.value)).fragmentSpreads.forEach(function(w){m.add(w)}):S.kind===Me.FRAGMENT_DEFINITION&&a===0&&!i(S.name.value).removed&&m.add(S.name.value)}),m.forEach(function(S){h(i(S)).fragmentSpreads.forEach(function(w){m.add(w)})});var b=function(S){return!!(!m.has(S)||i(S).removed)},_={enter:function(S){if(b(S.name.value))return null}};return cg(nt(p,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(S){if(S.variableDefinitions){var w=h(r(S.name&&S.name.value)).transitiveVars;if(w.size<S.variableDefinitions.length)return C(C({},S),{variableDefinitions:S.variableDefinitions.filter(function(v){return w.has(v.variable.name.value)})})}}}}))}var Ai=Object.assign(function(t){return nt(t,{SelectionSet:{enter:function(e,r,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:$r($r([],n,!0),[lf],!1)})}}}}}})},{added:function(t){return t===lf}}),lg={test:function(t){var e=t.name.value==="connection";return e&&(!t.arguments||!t.arguments.some(function(r){return r.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 ou(t){return au([lg],vn(t))}function su(t){var e=Ei(t),r=e.operation;if(r==="query")return t;var i=nt(t,{OperationDefinition:{enter:function(n){return C(C({},n),{operation:"query"})}}});return i}function cu(t){vn(t);var e=au([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}var pg=Object.prototype.hasOwnProperty;function uu(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ga(t)}function ga(t){var e=t[0]||{},r=t.length;if(r>1)for(var i=new mt,n=1;n<r;++n)e=i.merge(e,t[n]);return e}var fg=function(t,e,r){return this.merge(t[r],e[r])},mt=function(){function t(e){e===void 0&&(e=fg),this.reconciler=e,this.isObject=fe,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return fe(r)&&fe(e)?(Object.keys(r).forEach(function(o){if(pg.call(e,o)){var s=e[o];if(r[o]!==s){var u=i.reconciler.apply(i,$r([e,r,o],n,!1));u!==s&&(e=i.shallowCopyForMerge(e),e[o]=u)}}else e=i.shallowCopyForMerge(e),e[o]=r[o]}),e):r},t.prototype.shallowCopyForMerge=function(e){return fe(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=C({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},t}();function dg(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=hg(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var i=0;return function(){return i>=t.length?{done:!0}:{done:!1,value:t[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 hg(t,e){if(!!t){if(typeof t=="string")return df(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return df(t,e)}}function df(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,i=new Array(e);r<e;r++)i[r]=t[r];return i}function hf(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function du(t,e,r){return e&&hf(t.prototype,e),r&&hf(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var hu=function(){return typeof Symbol=="function"},mu=function(t){return hu()&&Boolean(Symbol[t])},gu=function(t){return mu(t)?Symbol[t]:"@@"+t};hu()&&!mu("observable")&&(Symbol.observable=Symbol("observable"));var mg=gu("iterator"),pu=gu("observable"),mf=gu("species");function qo(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function ya(t){var e=t.constructor;return e!==void 0&&(e=e[mf],e===null&&(e=void 0)),e!==void 0?e:oe}function gg(t){return t instanceof oe}function _n(t){_n.log?_n.log(t):setTimeout(function(){throw t})}function jo(t){Promise.resolve().then(function(){try{t()}catch(e){_n(e)}})}function gf(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=qo(e,"unsubscribe");r&&r.call(e)}}catch(i){_n(i)}}function fu(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function yg(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(yf(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function yf(t,e,r){t._state="running";var i=t._observer;try{var n=qo(i,e);switch(e){case"next":n&&n.call(i,r);break;case"error":if(fu(t),n)n.call(i,r);else throw r;break;case"complete":fu(t),n&&n.call(i);break}}catch(a){_n(a)}t._state==="closed"?gf(t):t._state==="running"&&(t._state="ready")}function lu(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],jo(function(){return yg(t)});return}yf(t,e,r)}}var vg=function(){function t(r,i){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var n=new bg(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(fu(this),gf(this))},du(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),bg=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(i){lu(this._subscription,"next",i)},e.error=function(i){lu(this._subscription,"error",i)},e.complete=function(){lu(this._subscription,"complete")},du(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),oe=function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new vg(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(){u.unsubscribe(),a()}var u=n.subscribe({next:function(c){try{i(c,s)}catch(l){o(l),u.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(u){return o.error(u)}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(u){return o.error(u)}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,u=arguments[1],c=u;return new a(function(l){return n.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{c=i(c,d)}catch(p){return l.error(p)}else c=d},error:function(d){l.error(d)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(c),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=ya(this);return new s(function(u){var c,l=0;function d(f){c=f.subscribe({next:function(p){u.next(p)},error:function(p){u.error(p)},complete:function(){l===a.length?(c=void 0,u.complete()):d(s.from(a[l++]))}})}return d(i),function(){c&&(c.unsubscribe(),c=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=[],u=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),c()}});s.push(d)},error:function(l){o.error(l)},complete:function(){c()}});function c(){u.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),u.unsubscribe()}})},e[pu]=function(){return this},t.from=function(i){var n=typeof this=="function"?this:t;if(i==null)throw new TypeError(i+" is not an object");var a=qo(i,pu);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return gg(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(mu("iterator")&&(a=qo(i,mg),a))return new n(function(s){jo(function(){if(!s.closed){for(var u=dg(a.call(i)),c;!(c=u()).done;){var l=c.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){jo(function(){if(!s.closed){for(var u=0;u<i.length;++u)if(s.next(i[u]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},t.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:t;return new o(function(s){jo(function(){if(!s.closed){for(var u=0;u<n.length;++u)if(s.next(n[u]),s.closed)return;s.complete()}})})},du(t,null,[{key:mf,get:function(){return this}}]),t}();hu()&&Object.defineProperty(oe,Symbol("extensions"),{value:{symbol:pu,hostReportError:_n},configurable:!0});function yu(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.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 E4=yu(Sn);var vf=oe.prototype,bf="@@observable";vf[bf]||(vf[bf]=function(){return this});var _g=Object.prototype.toString;function Bo(t){return vu(t)}function vu(t,e){switch(_g.call(t)){case"[object Array]":{if(e=e||new Map,e.has(t))return e.get(t);var r=t.slice(0);return e.set(t,r),r.forEach(function(n,a){r[a]=vu(n,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var i=Object.create(Object.getPrototypeOf(t));return e.set(t,i),Object.keys(t).forEach(function(n){i[n]=vu(t[n],e)}),i}default:return t}}function Sg(t){var e=new Set([t]);return e.forEach(function(r){fe(r)&&wg(r)===r&&Object.getOwnPropertyNames(r).forEach(function(i){fe(r[i])&&e.add(r[i])})}),t}function wg(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function va(t){return __DEV__&&Sg(t),t}function ki(t,e,r){var i=[];t.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](r)})}function Vo(t,e,r){return new oe(function(i){var n=i.next,a=i.error,o=i.complete,s=0,u=!1,c={then:function(p){return new Promise(function(h){return h(p())})}};function l(p,h){return p?function(m){++s;var b=function(){return p(m)};c=c.then(b,b).then(function(_){--s,n&&n.call(i,_),u&&d.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(i,_)})}:function(m){return h&&h.call(i,m)}}var d={next:l(e,n),error:l(r,a),complete:function(){u=!0,s||o&&o.call(i)}},f=t.subscribe(d);return function(){return f.unsubscribe()}})}var Pt=typeof WeakMap=="function"&&He(function(){return navigator.product})!=="ReactNative",_f=typeof WeakSet=="function",bu=typeof Symbol=="function"&&typeof Symbol.for=="function",Mr=bu&&Symbol.asyncIterator,F4=typeof He(function(){return window.document.createElement})=="function",M4=He(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Qo(t){function e(r){Object.defineProperty(t,r,{value:oe})}return bu&&Symbol.species&&e(Symbol.species),e("@@species"),t}function Sf(t){return t&&typeof t.then=="function"}var wn=function(t){Re(e,t);function e(r){var i=t.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 u=s.shift();u?Sf(u)?u.then(function(c){return i.sub=c.subscribe(i.handlers)}):i.sub=u.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 r=="function"&&(r=[new oe(r)]),Sf(r)?r.then(function(n){return i.start(n)},i.handlers.error):i.start(r),i}return e.prototype.start=function(r){this.sub===void 0&&(this.sources=Array.from(r),this.handlers.complete())},e.prototype.deliverLastMessage=function(r){if(this.latest){var i=this.latest[0],n=r[i];n&&n.call(r,this.latest[1]),this.sub===null&&i==="next"&&r.complete&&r.complete()}},e.prototype.addObserver=function(r){this.observers.has(r)||(this.deliverLastMessage(r),this.observers.add(r))},e.prototype.removeObserver=function(r){this.observers.delete(r)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(r,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(r,i)}))},e.prototype.beforeNext=function(r){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,r(n,a))})},e}(oe);Qo(wn);function Ur(t){return"incremental"in t}function Cg(t){return"hasNext"in t&&"data"in t}function wf(t){return Ur(t)||Cg(t)}function zo(t,e){var r=t,i=new mt;return Ur(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 u=o[s],c=!isNaN(+u),l=c?[]:{};l[u]=a,a=l}r=i.merge(r,a)}),r}function Cn(t){var e=Wo(t);return qe(e)}function Wo(t){var e=qe(t.errors)?t.errors.slice(0):[];return Ur(t)&&qe(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function jr(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(r[n]=a)})}),r}var Cf=new Map;function ba(t){var e=Cf.get(t)||1;return Cf.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ef(t){var e=ba("stringifyForDisplay");return JSON.stringify(t,function(r,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function _a(t,e){return jr(t,e,e.variables&&{variables:C(C({},t&&t.variables),e.variables)})}function Ho(t){return new oe(function(e){e.error(t)})}var Sa=function(t,e,r){var i=new Error(r);throw i.name="ServerError",i.response=t,i.statusCode=t.status,i.result=e,i};function _u(t){for(var e=["query","operationName","variables","extensions","context"],r=0,i=Object.keys(t);r<i.length;r++){var n=i[r];if(e.indexOf(n)<0)throw __DEV__?new Z("illegal argument: ".concat(n)):new Z(27)}return t}function Su(t,e){var r=C({},t),i=function(a){typeof a=="function"?r=C(C({},r),a(r)):r=C(C({},r),a)},n=function(){return C({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function wu(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?bn(e.query)||void 0:""),e}function xf(t,e){return e?e(t):oe.of()}function wa(t){return typeof t=="function"?new $t(t):t}function Go(t){return t.request.length<=1}var Eg=function(t){Re(e,t);function e(r,i){var n=t.call(this,r)||this;return n.link=i,n}return e}(Error),$t=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return oe.of()})},t.from=function(e){return e.length===0?t.empty():e.map(wa).reduce(function(r,i){return r.concat(i)})},t.split=function(e,r,i){var n=wa(r),a=wa(i||new t(xf));return Go(n)&&Go(a)?new t(function(o){return e(o)?n.request(o)||oe.of():a.request(o)||oe.of()}):new t(function(o,s){return e(o)?n.request(o,s)||oe.of():a.request(o,s)||oe.of()})},t.execute=function(e,r){return e.request(Su(r.context,wu(_u(r))))||oe.of()},t.concat=function(e,r){var i=wa(e);if(Go(i))return __DEV__&&$.warn(new Eg("You are calling concat on a terminating link, which will have no effect",i)),i;var n=wa(r);return Go(n)?new t(function(a){return i.request(a,function(o){return n.request(o)||oe.of()})||oe.of()}):new t(function(a,o){return i.request(a,function(s){return n.request(s,o)||oe.of()})||oe.of()})},t.prototype.split=function(e,r,i){return this.concat(t.split(e,r,i||new t(xf)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new Z("request is not implemented"):new Z(22)},t.prototype.onError=function(e,r){if(r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}();var En=$t.execute;var Af="3.7.10";function kf(t){return!!t.body}function Tf(t){return!!t.getReader}function If(t){return!!(Mr&&t[Symbol.asyncIterator])}function Of(t){return!!t.stream}function Df(t){return!!t.arrayBuffer}function Nf(t){return!!t.pipe}function Cu(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Eu(t){var e=null,r=null,i=!1,n=[],a=[];function o(d){if(!r){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){r=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function u(){i=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,t.removeListener("data",o),t.removeListener("error",s),t.removeListener("end",u),t.removeListener("finish",u),t.removeListener("close",u)},t.on("data",o),t.on("error",s),t.on("end",u),t.on("finish",u),t.on("close",u);function c(){return new Promise(function(d,f){if(r)return f(r);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 c()}};return Mr&&(l[Symbol.asyncIterator]=function(){return this}),l}function xu(t){var e=!1,r={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){t.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return Mr&&(r[Symbol.asyncIterator]=function(){return this}),r}function Ko(t){var e={next:function(){return t.read()}};return Mr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Rf(t){var e=t;if(kf(t)&&(e=t.body),If(e))return Cu(e);if(Tf(e))return Ko(e.getReader());if(Of(e))return Ko(e.stream().getReader());if(Df(e))return xu(e.arrayBuffer());if(Nf(e))return Eu(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Pf=Object.prototype.hasOwnProperty;function $f(t,e){var r,i,n;return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,p,h,m,b,_,S,w,v,D,N,A,R;return Vt(this,function(F){switch(F.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=(r=t.headers)===null||r===void 0?void 0:r.get("content-type"),s="boundary=",u=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",c="--".concat(u),l="",d=Rf(t),f=!0,F.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=F.sent(),h=p.value,m=p.done,b=typeof h=="string"?h:a.decode(h),f=!m,l+=b,_=l.indexOf(c);_>-1;){if(S=void 0,R=[l.slice(0,_),l.slice(_+c.length)],S=R[0],l=R[1],S.trim()){if(w=S.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
- `),v=xg(S.slice(0,w)),D=v["content-type"],D&&D.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");N=S.slice(w);try{A=Lf(t,N.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){Zo(P,e)}}_=l.indexOf(c)}return[3,1];case 3:return(n=e.complete)===null||n===void 0||n.call(e),[2]}})})}function xg(t){var e={};return t.split(`
30
- `).forEach(function(r){var i=r.indexOf(":");if(i>-1){var n=r.slice(0,i).trim().toLowerCase(),a=r.slice(i+1).trim();e[n]=a}}),e}function Lf(t,e){if(t.status>=300){var r=function(){try{return JSON.parse(e)}catch{return e}};Sa(t,r(),"Response not successful: Received status code ".concat(t.status))}try{return JSON.parse(e)}catch(n){var i=n;throw i.name="ServerParseError",i.response=t,i.statusCode=t.status,i.bodyText=e,i}}function Zo(t,e){var r,i;t.name!=="AbortError"&&(t.result&&t.result.errors&&t.result.data&&((r=e.next)===null||r===void 0||r.call(e,t.result)),(i=e.error)===null||i===void 0||i.call(e,t))}function Ff(t,e,r){Ag(e)(t).then(function(i){var n,a;(n=r.next)===null||n===void 0||n.call(r,i),(a=r.complete)===null||a===void 0||a.call(r)}).catch(function(i){return Zo(i,r)})}function Ag(t){return function(e){return e.text().then(function(r){return Lf(e,r)}).then(function(r){return e.status>=300&&Sa(e,r,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(r)&&!Pf.call(r,"data")&&!Pf.call(r,"errors")&&Sa(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(i){return i.operationName}):t.operationName,"'.")),r})}}var Ca=function(t,e){var r;try{r=JSON.stringify(t)}catch(n){var i=__DEV__?new Z("Network request failed. ".concat(e," is not serializable: ").concat(n.message)):new Z(24);throw i.parseError=n,i}return r};var kg={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Tg={accept:"*/*","content-type":"application/json"},Ig={method:"POST"},Mf={http:kg,headers:Tg,options:Ig},Uf=function(t,e){return e(t)};function jf(t,e){for(var r=[],i=2;i<arguments.length;i++)r[i-2]=arguments[i];var n={},a={};r.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=Og(n.headers,a.preserveHeaderCase));var o=t.operationName,s=t.extensions,u=t.variables,c=t.query,l={operationName:o,variables:u};return a.includeExtensions&&(l.extensions=s),a.includeQuery&&(l.query=e(c,gn)),{options:n,body:l}}function Og(t,e){if(!e){var r=Object.create(null);return Object.keys(Object(t)).forEach(function(a){r[a.toLowerCase()]=t[a]}),r}var i=Object.create(null);Object.keys(Object(t)).forEach(function(a){i[a.toLowerCase()]={originalName:a,value:t[a]}});var n=Object.create(null);return Object.keys(i).forEach(function(a){n[i[a].originalName]=i[a].value}),n}var qf=function(t){if(!t&&typeof fetch>"u")throw __DEV__?new Z(`
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 Z(23)};var Bf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var t=new AbortController,e=t.signal;return{controller:t,signal:e}};var Vf=function(t,e){var r=t.getContext(),i=r.uri;return i||(typeof e=="function"?e(t):e||"/graphql")};function Qf(t,e){var r=[],i=function(d,f){r.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=t,u=t.indexOf("#");u!==-1&&(o=t.substr(u),s=t.substr(0,u));var c=s.indexOf("?")===-1?"?":"&",l=s+c+r.join("&")+o;return{newURI:l}}var zf=He(function(){return fetch}),Wf=function(t){t===void 0&&(t={});var e=t.uri,r=e===void 0?"/graphql":e,i=t.fetch,n=t.print,a=n===void 0?Uf:n,o=t.includeExtensions,s=t.preserveHeaderCase,u=t.useGETForQueries,c=t.includeUnusedVariables,l=c===void 0?!1:c,d=Yt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&qf(i||zf);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new $t(function(p){var h=Vf(p,r),m=p.getContext(),b={};if(m.clientAwareness){var _=m.clientAwareness,S=_.name,w=_.version;S&&(b["apollographql-client-name"]=S),w&&(b["apollographql-client-version"]=w)}var v=C(C({},b),m.headers),D={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:v},N=jf(p,a,Mf,f,D),A=N.options,R=N.body;if(R.variables&&!l){var F=new Set(Object.keys(R.variables));nt(p.query,{Variable:function(pe,Zt,ae){ae&&ae.kind!=="VariableDefinition"&&F.delete(pe.name.value)}}),F.size&&(R.variables=C({},R.variables),F.forEach(function(pe){delete R.variables[pe]}))}var P;if(!A.signal){var j=Bf(),Je=j.controller,je=j.signal;P=Je,P&&(A.signal=je)}var H=function(pe){return pe.kind==="OperationDefinition"&&pe.operation==="mutation"};if(u&&!p.query.definitions.some(H)&&(A.method="GET"),yn(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var we=Qf(h,R),Ce=we.newURI,le=we.parseError;if(le)return Ho(le);h=Ce}else try{A.body=Ca(R,"Payload")}catch(pe){return Ho(pe)}return new oe(function(pe){var Zt=i||He(function(){return fetch})||zf;return Zt(h,A).then(function(ae){var Jt;p.setContext({response:ae});var Dr=(Jt=ae.headers)===null||Jt===void 0?void 0:Jt.get("content-type");return Dr!==null&&/^multipart\/mixed/i.test(Dr)?$f(ae,pe):Ff(ae,p,pe)}).catch(function(ae){return Zo(ae,pe)}),function(){P&&P.abort()}})})};var Au=function(t){Re(e,t);function e(r){r===void 0&&(r={});var i=t.call(this,Wf(r).request)||this;return i.options=r,i}return e}($t);var{toString:Hf,hasOwnProperty:Dg}=Object.prototype,Gf=Function.prototype.toString,ku=new Map;function ke(t,e){try{return Tu(t,e)}finally{ku.clear()}}function Tu(t,e){if(t===e)return!0;let r=Hf.call(t),i=Hf.call(e);if(r!==i)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(Zf(t,e))return!0;let n=Kf(t),a=Kf(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Dg.call(e,n[s]))return!1;for(let s=0;s<o;++s){let u=n[s];if(!Tu(t[u],e[u]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t==`${e}`;case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(Zf(t,e))return!0;let n=t.entries(),a=r==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,u]=o.value;if(!e.has(s)||a&&!Tu(u,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]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{let n=t.byteLength;if(n===e.byteLength)for(;n--&&t[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Gf.call(t);return n!==Gf.call(e)?!1:!Pg(n,Rg)}}return!1}function Kf(t){return Object.keys(t).filter(Ng,t)}function Ng(t){return this[t]!==void 0}var Rg="{ [native code] }";function Pg(t,e){let r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function Zf(t,e){let r=ku.get(t);if(r){if(r.has(e))return!0}else ku.set(t,r=new Set);return r.add(e),!1}var $g=function(){return Object.create(null)},Jf=Array.prototype,Lg=Jf.forEach,Fg=Jf.slice,tr=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=$g),this.weakness=e,this.makeData=r}return t.prototype.lookup=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.lookupArray(e)},t.prototype.lookupArray=function(e){var r=this;return Lg.call(e,function(i){return r=r.getChildTrie(i)}),r.data||(r.data=this.makeData(Fg.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&Mg(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=r.get(e);return i||r.set(e,i=new t(this.weakness,this.makeData)),i},t}();function Mg(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var et=null,Yf={},Ug=1,jg=()=>class{constructor(){this.id=["slot",Ug++,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 r=e.slots[this.id];if(r===Yf)break;return e!==et&&(et.slots[this.id]=r),!0}return et&&(et.slots[this.id]=Yf),!1}getValue(){if(this.hasValue())return et.slots[this.id]}withValue(e,r,i,n){let a={__proto__:null,[this.id]:e},o=et;et={parent:o,slots:a};try{return r.apply(n,i)}finally{et=o}}static bind(e){let r=et;return function(){let i=et;try{return et=r,e.apply(this,arguments)}finally{et=i}}}static noContext(e,r,i){if(et){let n=et;try{return et=null,e.apply(i,r)}finally{et=n}}else return e.apply(i,r)}};function Xf(t){try{return t()}catch{}}var Iu="@wry/context:Slot",qg=Xf(()=>globalThis)||Xf(()=>global)||Object.create(null),ed=qg,xn=ed[Iu]||Array[Iu]||function(t){try{Object.defineProperty(ed,Iu,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(jg());var{bind:Bg,noContext:Vg}=xn;function Qg(){}var zg=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=Qg),this.max=e,this.dispose=r,this.map=new Map,this.newest=null,this.oldest=null}return t.prototype.has=function(e){return this.map.has(e)},t.prototype.get=function(e){var r=this.getNode(e);return r&&r.value},t.prototype.getNode=function(e){var r=this.map.get(e);if(r&&r!==this.newest){var i=r.older,n=r.newer;n&&(n.older=i),i&&(i.newer=n),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=n)}return r},t.prototype.set=function(e,r){var i=this.getNode(e);return i?i.value=r:(i={key:e,value:r,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)},t.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},t.prototype.delete=function(e){var r=this.map.get(e);return r?(r===this.newest&&(this.newest=r.older),r===this.oldest&&(this.oldest=r.newer),r.newer&&(r.newer.older=r.older),r.older&&(r.older.newer=r.newer),this.map.delete(e),this.dispose(r.value,e),!0):!1},t}(),Yo=new xn,Ou,Wg=Object.prototype.hasOwnProperty,Nu=(Ou=Array.from,Ou===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:Ou);function Jo(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var Ea=[],Hg=100;function An(t,e){if(!t)throw new Error(e||"assertion failure")}function Gg(t,e){var r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function rd(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function Kg(t){return t.slice(0)}var Zg=function(){function t(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,++t.count}return t.prototype.peek=function(){if(this.value.length===1&&!qr(this))return td(this),this.value[0]},t.prototype.recompute=function(e){return An(!this.recomputing,"already recomputing"),td(this),qr(this)?Jg(this,e):rd(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,id(this),Jo(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),cd(this),Ru(this,function(r,i){r.setDirty(),ud(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Ea.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Nu(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),Ea.push(this.deps),this.deps=null)},t.count=0,t}();function td(t){var e=Yo.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),qr(t)?ad(e,t):od(e,t),e}function Jg(t,e){return cd(t),Yo.withValue(t,Yg,[t,e]),ey(t,e)&&Xg(t),rd(t.value)}function Yg(t,e){t.recomputing=!0,t.value.length=0;try{t.value[0]=t.fn.apply(null,e)}catch(r){t.value[1]=r}t.recomputing=!1}function qr(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function Xg(t){t.dirty=!1,!qr(t)&&nd(t)}function id(t){Ru(t,ad)}function nd(t){Ru(t,od)}function Ru(t,e){var r=t.parents.size;if(r)for(var i=Nu(t.parents),n=0;n<r;++n)e(i[n],t)}function ad(t,e){An(t.childValues.has(e)),An(qr(e));var r=!qr(t);if(!t.dirtyChildren)t.dirtyChildren=Ea.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&id(t)}function od(t,e){An(t.childValues.has(e)),An(!qr(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,Kg(e.value)):Gg(r,e.value)||t.setDirty(),sd(t,e),!qr(t)&&nd(t)}function sd(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(Ea.length<Hg&&Ea.push(r),t.dirtyChildren=null))}function cd(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){ud(t,r)}),t.forgetDeps(),An(t.dirtyChildren===null)}function ud(t,e){e.parents.delete(t),t.childValues.delete(e),sd(t,e)}function ey(t,e){if(typeof t.subscribe=="function")try{Jo(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var ty={setDirty:!0,dispose:!0,forget:!0};function Xo(t){var e=new Map,r=t&&t.subscribe;function i(n){var a=Yo.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof r=="function"&&(Jo(o),o.unsubscribe=r(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var u=o&&Wg.call(ty,o)?o:"setDirty";Nu(s).forEach(function(c){return c[u]()}),e.delete(a),Jo(s)}},i}function ld(){var t=new tr(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var bw=ld(),Du=new Set;function Ti(t,e){e===void 0&&(e=Object.create(null));var r=new zg(e.max||Math.pow(2,16),function(c){return c.dispose()}),i=e.keyArgs,n=e.makeCacheKey||ld(),a=function(){var c=n.apply(null,i?i.apply(null,arguments):arguments);if(c===void 0)return t.apply(null,arguments);var l=r.get(c);l||(r.set(c,l=new Zg(t)),l.subscribe=e.subscribe,l.forget=function(){return r.delete(c)});var d=l.recompute(Array.prototype.slice.call(arguments));return r.set(c,l),Du.add(r),Yo.hasValue()||(Du.forEach(function(f){return f.clean()}),Du.clear()),d};Object.defineProperty(a,"size",{get:function(){return r.map.size},configurable:!1,enumerable:!1});function o(c){var l=r.get(c);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(c){var l=r.get(c);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function u(c){return r.delete(c)}return a.forgetKey=u,a.forget=function(){return u(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Pu=function(){function t(){this.getFragmentDoc=Ti(eu)}return t.prototype.batch=function(e){var r=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(r)},i),n},t.prototype.recordOptimisticTransaction=function(e,r){this.performTransaction(e,r)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(C(C({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(C(C({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:r}))},t.prototype.writeQuery=function(e){var r=e.id,i=e.data,n=Yt(e,["id","data"]);return this.write(Object.assign(n,{dataId:r||"ROOT_QUERY",result:i}))},t.prototype.writeFragment=function(e){var r=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:r,result:i}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(i){var n=i.readQuery(e),a=r(n);return a==null?n:(i.writeQuery(C(C({},e),{data:a})),a)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(i){var n=i.readFragment(e),a=r(n);return a==null?n:(i.writeFragment(C(C({},e),{data:a})),a)}})},t}();var xa=function(t){Re(e,t);function e(r,i,n,a){var o,s=t.call(this,r)||this;if(s.message=r,s.path=i,s.query=n,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var u=s.path.length-1;u>=0;--u)s.missing=(o={},o[s.path[u]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var Pe=Object.prototype.hasOwnProperty;function Aa(t){return t==null}function ts(t,e){var r=t.__typename,i=t.id,n=t._id;if(typeof r=="string"&&(e&&(e.keyObject=Aa(i)?Aa(n)?void 0:{_id:n}:{id:i}),Aa(i)&&!Aa(n)&&(i=n),!Aa(i)))return"".concat(r,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var pd={dataIdFromObject:ts,addTypename:!0,resultCaching:!0,canonizeResults:!1};function fd(t){return jr(pd,t)}function rs(t){var e=t.canonizeResults;return e===void 0?pd.canonizeResults:e}function dd(t,e){return se(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var $u=/^[_a-z][_0-9a-z]*/i;function Wt(t){var e=t.match($u);return e?e[0]:t}function es(t,e,r){return fe(e)?Se(e)?e.every(function(i){return es(t,i,r)}):t.selections.every(function(i){if(Et(i)&&yr(i,r)){var n=Rt(i);return Pe.call(e,n)&&(!i.selectionSet||es(i.selectionSet,e[n],r))}return!0}):!1}function Br(t){return fe(t)&&!se(t)&&!Se(t)}function hd(){return new mt}function is(t,e){var r=Si(Ci(t));return{fragmentMap:r,lookupFragment:function(i){var n=r[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var ns=Object.create(null),Lu=function(){return ns},md=Object.create(null),kn=function(){function t(e,r){var i=this;this.policies=e,this.group=r,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return va(se(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return se(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return Xt(n);if(se(n))return n;var o=i.policies.identify(n)[0];if(o){var s=Xt(o);return a&&i.merge(o,n),s}}}return t.prototype.toObject=function(){return C({},this.data)},t.prototype.has=function(e){return this.lookup(e,!0)!==void 0},t.prototype.get=function(e,r){if(this.group.depend(e,r),Pe.call(this.data,e)){var i=this.data[e];if(i&&Pe.call(i,r))return i[r]}if(r==="__typename"&&Pe.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Vr)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Pe.call(this.data,e))return this.data[e];if(this instanceof Vr)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var i=this,n;se(e)&&(e=e.__ref),se(r)&&(r=r.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof r=="string"?this.lookup(n=r):r;if(!!o){__DEV__?$(typeof n=="string","store.merge expects a string ID"):$(typeof n=="string",1);var s=new mt(iy).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var u=Object.create(null);a||(u.__exists=1),Object.keys(o).forEach(function(c){if(!a||a[c]!==s[c]){u[c]=1;var l=Wt(c);l!==c&&!i.policies.hasKeyArgs(s.__typename,l)&&(u[l]=1),s[c]===void 0&&!(i instanceof Vr)&&delete s[c]}}),u.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete u.__typename,Object.keys(u).forEach(function(c){return i.group.dirty(n,c)})}}},t.prototype.modify=function(e,r){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,u={DELETE:ns,INVALIDATE:md,isReference:se,toReference:this.toReference,canRead:this.canRead,readField:function(c,l){return i.policies.readField(typeof c=="string"?{fieldName:c,from:l||Xt(e)}:c,{store:i})}};if(Object.keys(n).forEach(function(c){var l=Wt(c),d=n[c];if(d!==void 0){var f=typeof r=="function"?r:r[c]||r[l];if(f){var p=f===Lu?ns:f(va(d),C(C({},u),{fieldName:l,storeFieldName:c,storage:i.getStorage(e,c)}));p===md?i.group.dirty(e,c):(p===ns&&(p=void 0),p!==d&&(a[c]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Vr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,r,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=r&&i?this.policies.getStoreFieldName({typename:o,fieldName:r,args:i}):r;return this.modify(e,s?(n={},n[s]=Lu,n):Lu)}return!1},t.prototype.evict=function(e,r){var i=!1;return e.id&&(Pe.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof Vr&&this!==r&&(i=this.parent.evict(e,r)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){Pe.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(r.__META={extraRootIds:i.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(a){e&&Pe.call(e,a)||r.delete(a)}),e){var i=e.__META,n=Yt(e,["__META"]);Object.keys(n).forEach(function(a){r.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var r=--this.rootIds[e];return r||delete this.rootIds[e],r}return 0},t.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Vr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),i=this.toObject();r.forEach(function(o){Pe.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(r.add,r),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof Vr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},t.prototype.findChildRefIds=function(e){if(!Pe.call(this.refs,e)){var r=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return r;var n=new Set([i]);n.forEach(function(a){se(a)&&(r[a.__ref]=!0),fe(a)&&Object.keys(a).forEach(function(o){var s=a[o];fe(s)&&n.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var gd=function(){function t(e,r){r===void 0&&(r=null),this.caching=e,this.parent=r,this.d=null,this.resetCaching()}return t.prototype.resetCaching=function(){this.d=this.caching?Xo():null,this.keyMaker=new tr(Pt)},t.prototype.depend=function(e,r){if(this.d){this.d(Fu(e,r));var i=Wt(r);i!==r&&this.d(Fu(e,i)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Fu(e,r),r==="__exists"?"forget":"setDirty")},t}();function Fu(t,e){return e+"#"+t}function Mu(t,e){Ii(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){Re(i,r);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,u=n.seed,c=r.call(this,a,new gd(s))||this;return c.stump=new ry(c),c.storageTrie=new tr(Pt),u&&c.replace(u),c}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}(t);t.Root=e})(kn||(kn={}));var Vr=function(t){Re(e,t);function e(r,i,n,a){var o=t.call(this,i.policies,a)||this;return o.id=r,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(r,i){return new e(r,this,i,this.group)},e.prototype.removeLayer=function(r){var i=this,n=this.parent.removeLayer(r);return r===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(u){ke(o[u],s[u])||i.group.dirty(a,u)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(u){i.group.dirty(a,u)})):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(r){var i=this.parent.findChildRefIds(r);return Pe.call(this.data,r)?C(C({},i),t.prototype.findChildRefIds.call(this,r)):i},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(kn),ry=function(t){Re(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new gd(r.group.caching,r.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Vr);function iy(t,e,r){var i=t[r],n=e[r];return ke(i,n)?i:n}function Ii(t){return!!(t instanceof kn&&t.group.caching)}function ny(t){return fe(t)?Se(t)?t.slice(0):C({__proto__:Object.getPrototypeOf(t)},t):t}var as=function(){function t(){this.known=new(_f?WeakSet:Set),this.pool=new tr(Pt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return fe(e)&&this.known.has(e)},t.prototype.pass=function(e){if(fe(e)){var r=ny(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(fe(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),u=[s],c=this.sortedKeys(e);u.push(c.json);var l=u.length;c.sorted.forEach(function(p){u.push(r.admit(e[p]))});var o=this.pool.lookupArray(u);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),c.sorted.forEach(function(p,h){d[p]=u[l+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},t.prototype.sortedKeys=function(e){var r=Object.keys(e),i=this.pool.lookupArray(r);if(!i.keys){r.sort();var n=JSON.stringify(r);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:r,json:n})}return i.keys},t}();var xt=Object.assign(function(t){if(fe(t)){Uu===void 0&&yd();var e=Uu.admit(t),r=ju.get(e);return r===void 0&&ju.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:yd}),Uu,ju;function yd(){Uu=new as,ju=new(Pt?WeakMap:Map)}function vd(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var bd=function(){function t(e){var r=this;this.knownResults=new(Pt?WeakMap:Map),this.config=jr(e,{addTypename:e.addTypename!==!1,canonizeResults:rs(e)}),this.canon=e.canon||new as,this.executeSelectionSet=Ti(function(i){var n,a=i.context.canonizeResults,o=vd(i);o[3]=!a;var s=(n=r.executeSelectionSet).peek.apply(n,o);return s?a?C(C({},s),{result:r.canon.admit(s.result)}):s:(Mu(i.context.store,i.enclosingRef.__ref),r.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:vd,makeCacheKey:function(i,n,a,o){if(Ii(a.store))return a.store.makeCacheKey(i,se(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=Ti(function(i){return Mu(i.context.store,i.enclosingRef.__ref),r.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 t.prototype.resetCanon=function(){this.canon=new as},t.prototype.diffQueryAgainstStore=function(e){var r=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,u=s===void 0?!0:s,c=e.canonizeResults,l=c===void 0?this.config.canonizeResults:c,d=this.config.cache.policies;o=C(C({},xi(ma(i))),o);var f=Xt(a),p=this.executeSelectionSet({selectionSet:Ei(i).selectionSet,objectOrReference:f,enclosingRef:f,context:C({store:r,query:i,policies:d,variables:o,varString:xt(o),canonizeResults:l},is(i,this.config.fragments))}),h;if(p.missing&&(h=[new xa(ay(p.missing),p.missing,i,o)],!u))throw h[0];return{result:p.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,i,n){if(Ii(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,r,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(se(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,u=o.policies,c=o.store,l=c.getFieldValue(n,"__typename"),d=[],f,p=new mt;this.config.addTypename&&typeof l=="string"&&!u.rootIdsByTypename[l]&&d.push({__typename:l});function h(w,v){var D;return w.missing&&(f=p.merge(f,(D={},D[v]=w.missing,D))),w.result}var m=new Set(i.selections);m.forEach(function(w){var v,D;if(!!yr(w,s))if(Et(w)){var N=u.readField({fieldName:w.name.value,field:w,variables:o.variables,from:n},o),A=Rt(w);N===void 0?Ai.added(w)||(f=p.merge(f,(v={},v[A]="Can't find field '".concat(w.name.value,"' on ").concat(se(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),v))):Se(N)?N=h(r.executeSubSelectedArray({field:w,array:N,enclosingRef:a,context:o}),A):w.selectionSet?N!=null&&(N=h(r.executeSelectionSet({selectionSet:w.selectionSet,objectOrReference:N,enclosingRef:se(N)?N:a,context:o}),A)):o.canonizeResults&&(N=r.canon.pass(N)),N!==void 0&&d.push((D={},D[A]=N,D))}else{var R=wi(w,o.lookupFragment);if(!R&&w.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new Z("No fragment named ".concat(w.name.value)):new Z(5);R&&u.fragmentMatches(R,l)&&R.selectionSet.selections.forEach(m.add,m)}});var b=ga(d),_={result:b,missing:f},S=o.canonizeResults?this.canon.admit(_):va(_);return S.result&&this.knownResults.set(S.result,i),S},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,u=new mt;function c(l,d){var f;return l.missing&&(s=u.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:Se(l)?c(r.executeSubSelectedArray({field:i,array:l,enclosingRef:a,context:o}),d):i.selectionSet?c(r.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:l,enclosingRef:se(l)?l:a,context:o}),d):(__DEV__&&oy(o.store,i,l),l)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},t}();function ay(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function oy(t,e,r){if(!e.selectionSet){var i=new Set([r]);i.forEach(function(n){fe(n)&&(__DEV__?$(!se(n),"Missing selection set for object of type ".concat(dd(t,n)," returned for query field ").concat(e.name.value)):$(!se(n),6),Object.values(n).forEach(i.add,i))})}}var Tn=new xn,_d=new WeakMap;function ka(t){var e=_d.get(t);return e||_d.set(t,e={vars:new Set,dep:Xo()}),e}function qu(t){ka(t).vars.forEach(function(e){return e.forgetCache(t)})}function Sd(t){ka(t).vars.forEach(function(e){return e.attachCache(t)})}function os(t){var e=new Set,r=new Set,i=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(u){ka(u).dep.dirty(i),sy(u)});var o=Array.from(r);r.clear(),o.forEach(function(u){return u(t)})}}else{var s=Tn.getValue();s&&(n(s),ka(s).dep(i))}return t};i.onNextChange=function(a){return r.add(a),function(){r.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 sy(t){t.broadcastWatches&&t.broadcastWatches()}var wd=Object.create(null);function Bu(t){var e=JSON.stringify(t);return wd[e]||(wd[e]=Object.create(null))}function Vu(t){var e=Bu(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=zu(t,function(o){var s=In(i.storeObject,o,n);return s===void 0&&r!==i.storeObject&&Pe.call(r,o[0])&&(s=In(r,o,Ed)),__DEV__?$(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(r))):$(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function Qu(t){var e=Bu(t);return e.keyArgsFn||(e.keyArgsFn=function(r,i){var n=i.field,a=i.variables,o=i.fieldName,s=zu(t,function(c){var l=c[0],d=l.charAt(0);if(d==="@"){if(n&&qe(n.directives)){var f=l.slice(1),p=n.directives.find(function(_){return _.name.value===f}),h=p&&vr(p,a);return h&&In(h,c.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&Pe.call(a,m)){var b=c.slice(0);return b[0]=m,In(a,b)}return}if(r)return In(r,c)}),u=JSON.stringify(s);return(r||u!=="{}")&&(o+=":"+u),o})}function zu(t,e){var r=new mt;return Cd(t).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=r.merge(i,o)}return i},Object.create(null))}function Cd(t){var e=Bu(t);if(!e.paths){var r=e.paths=[],i=[];t.forEach(function(n,a){Se(n)?(Cd(n).forEach(function(o){return r.push(i.concat(o))}),i.length=0):(i.push(n),Se(t[a+1])||(r.push(i.slice(0)),i.length=0))})}return e.paths}function Ed(t,e){return t[e]}function In(t,e,r){return r=r||Ed,xd(e.reduce(function i(n,a){return Se(n)?n.map(function(o){return i(o,a)}):n&&r(n,a)},t))}function xd(t){return fe(t)?Se(t)?t.map(xd):zu(Object.keys(t).sort(),function(e){return In(t,e)}):t}da.setStringify(xt);function Wu(t){return t.args!==void 0?t.args:t.field?vr(t.field,t.variables):null}var cy=function(){},Ad=function(t,e){return e.fieldName},kd=function(t,e,r){var i=r.mergeObjects;return i(t,e)},Td=function(t,e){return e},Od=function(){function t(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:ts},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 t.prototype.identify=function(e,r){var i,n=this,a=r&&(r.typename||((i=r.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=r&&r.storeObject||e,s=C(C({},r),{typename:a,storeObject:o,readField:r&&r.readField||function(){var f=ss(arguments,o);return n.readField(f,{store:n.cache.data,variables:f.variables})}}),u,c=a&&this.getTypePolicy(a),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(Se(d))l=Vu(d);else{u=d;break}}return u=u?String(u):void 0,s.keyObject?[u,s.keyObject]:[u]},t.prototype.addTypePolicies=function(e){var r=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,u=Yt(n,["queryType","mutationType","subscriptionType"]);a&&r.setRootTypename("Query",i),o&&r.setRootTypename("Mutation",i),s&&r.setRootTypename("Subscription",i),Pe.call(r.toBeAdded,i)?r.toBeAdded[i].push(u):r.toBeAdded[i]=[u]})},t.prototype.updateTypePolicy=function(e,r){var i=this,n=this.getTypePolicy(e),a=r.keyFields,o=r.fields;function s(u,c){u.merge=typeof c=="function"?c:c===!0?kd:c===!1?Td:u.merge}s(n,r.merge),n.keyFn=a===!1?cy:Se(a)?Vu(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(u){var c=i.getFieldPolicy(e,u,!0),l=o[u];if(typeof l=="function")c.read=l;else{var d=l.keyArgs,f=l.read,p=l.merge;c.keyFn=d===!1?Ad:Se(d)?Qu(d):typeof d=="function"?d:c.keyFn,typeof f=="function"&&(c.read=f),s(c,p)}c.read&&c.merge&&(c.keyFn=c.keyFn||Ad)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];r!==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[r]=i,this.rootTypenamesById[i]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){r.getSupertypeSet(i,!0),e[i].forEach(function(n){r.getSupertypeSet(n,!0).add(i);var a=n.match($u);(!a||a[0]!==n)&&r.fuzzySubtypes.set(n,new RegExp(n))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!Pe.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=r.getTypePolicy(o),u=s.fields,c=Yt(s,["fields"]);Object.assign(i,c),Object.assign(i.fields,u)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){r.updateTypePolicy(e,o)}),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,r,i){if(e){var n=this.getTypePolicy(e).fields;return n[r]||i&&(n[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var i=this.supertypeMap.get(e);return!i&&r&&this.supertypeMap.set(e,i=new Set),i},t.prototype.fragmentMatches=function(e,r,i,n){var a=this;if(!e.typeCondition)return!0;if(!r)return!1;var o=e.typeCondition.name.value;if(r===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(r,!0),u=[s],c=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&u.indexOf(m)<0&&u.push(m)},l=!!(i&&this.fuzzySubtypes.size),d=!1,f=0;f<u.length;++f){var p=u[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&$.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;p.forEach(c),l&&f===u.length-1&&es(e.selectionSet,i,n)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var b=r.match(h);b&&b[0]===r&&c(m)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var i=this.getFieldPolicy(e,r,!1);return!!(i&&i.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,i=e.fieldName,n=this.getFieldPolicy(r,i,!1),a,o=n&&n.keyFn;if(o&&r)for(var s={typename:r,fieldName:i,field:e.field||null,variables:e.variables},u=Wu(e);o;){var c=o(u,s);if(Se(c))o=Qu(c);else{a=c||i;break}}return a===void 0&&(a=e.field?ru(e.field,e.variables):da(i,Wu(e))),a===!1?i:i===Wt(a)?a:i+":"+a},t.prototype.readField=function(e,r){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=r.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Wt(o),u=r.store.getFieldValue(i,o),c=this.getFieldPolicy(e.typename,s,!1),l=c&&c.read;if(l){var d=Id(this,i,e,r,r.store.getStorage(se(i)?i.__ref:i,o));return Tn.withValue(this.cache,l,[u,d])}return u}}},t.prototype.getReadFunction=function(e,r){var i=this.getFieldPolicy(e,r,!1);return i&&i.read},t.prototype.getMergeFunction=function(e,r,i){var n=this.getFieldPolicy(e,r,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},t.prototype.runMergeFunction=function(e,r,i,n,a){var o=i.field,s=i.typename,u=i.merge;return u===kd?Dd(n.store)(e,r):u===Td?r:(n.overwrite&&(e=void 0),u(e,r,Id(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},t}();function Id(t,e,r,i,n){var a=t.getStoreFieldName(r),o=Wt(a),s=r.variables||i.variables,u=i.store,c=u.toReference,l=u.canRead;return{args:Wu(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:se,toReference:c,storage:n,cache:t.cache,canRead:l,readField:function(){return t.readField(ss(arguments,e,s),i)},mergeObjects:Dd(i.store)}}function ss(t,e,r){var i=t[0],n=t[1],a=t.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=C({},i),Pe.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&$.warn("Undefined 'from' passed to readField with arguments ".concat(Ef(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function Dd(t){return function(r,i){if(Se(r)||Se(i))throw __DEV__?new Z("Cannot automatically merge arrays"):new Z(4);if(fe(r)&&fe(i)){var n=t.getFieldValue(r,"__typename"),a=t.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(se(r)&&Br(i))return t.merge(r.__ref,i),r;if(Br(r)&&se(i))return t.merge(r,i.__ref),i;if(Br(r)&&Br(i))return C(C({},r),i)}return i}}function Hu(t,e,r){var i="".concat(e).concat(r),n=t.flavors.get(i);return n||t.flavors.set(i,n=t.clientOnly===e&&t.deferred===r?t:C(C({},t),{clientOnly:e,deferred:r})),n}var $d=function(){function t(e,r,i){this.cache=e,this.reader=r,this.fragments=i}return t.prototype.writeToStore=function(e,r){var i=this,n=r.query,a=r.result,o=r.dataId,s=r.variables,u=r.overwrite,c=er(n),l=hd();s=C(C({},xi(c)),s);var d=C(C({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:xt(s)},is(n,this.fragments)),{overwrite:!!u,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:d});if(!se(f))throw __DEV__?new Z("Could not identify object ".concat(JSON.stringify(a))):new Z(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,b=p.mergeTree,_=p.fieldNodeSet,S=Xt(h);if(b&&b.map.size){var w=i.applyMerges(b,S,m,d);if(se(w))return;m=w}if(__DEV__&&!d.overwrite){var v=Object.create(null);_.forEach(function(A){A.selectionSet&&(v[A.name.value]=!0)});var D=function(A){return v[Wt(A)]===!0},N=function(A){var R=b&&b.map.get(A);return Boolean(R&&R.info&&R.info.merge)};Object.keys(m).forEach(function(A){D(A)&&!N(A)&&uy(S,m,A,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},t.prototype.processSelectionSet=function(e){var r=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,u=this.cache.policies,c=Object.create(null),l=i&&u.rootTypenamesById[i]||ha(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof l=="string"&&(c.__typename=l);var d=function(){var w=ss(arguments,c,o.variables);if(se(w.from)){var v=o.incomingById.get(w.from.__ref);if(v){var D=u.readField(C(C({},w),{from:v.storeObject}),o);if(D!==void 0)return D}}return u.readField(w,o)},f=new Set;this.flattenFields(a,n,o,l).forEach(function(w,v){var D,N=Rt(v),A=n[N];if(f.add(v),A!==void 0){var R=u.getStoreFieldName({typename:l,fieldName:v.name.value,field:v,variables:w.variables}),F=Nd(s,R),P=r.processFieldValue(A,v,v.selectionSet?Hu(w,!1,!1):w,F),j=void 0;v.selectionSet&&(se(P)||Br(P))&&(j=d("__typename",P));var Je=u.getMergeFunction(l,v.name.value,j);Je?F.info={field:v,typename:l,merge:Je}:Rd(s,R),c=w.merge(c,(D={},D[R]=P,D))}else __DEV__&&!w.clientOnly&&!w.deferred&&!Ai.added(v)&&!u.getReadFunction(l,v.name.value)&&__DEV__&&$.error("Missing field '".concat(Rt(v),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=u.identify(n,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:c,readField:d}),h=p[0],m=p[1];i=i||h,m&&(c=o.merge(c,m))}catch(w){if(!i)throw w}if(typeof i=="string"){var b=Xt(i),_=o.written[i]||(o.written[i]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(n,b,a,o)))return b;var S=o.incomingById.get(i);return S?(S.storeObject=o.merge(S.storeObject,c),S.mergeTree=Gu(S.mergeTree,s),f.forEach(function(w){return S.fieldNodeSet.add(w)})):o.incomingById.set(i,{storeObject:c,mergeTree:cs(s)?void 0:s,fieldNodeSet:f}),b}return c},t.prototype.processFieldValue=function(e,r,i,n){var a=this;return!r.selectionSet||e===null?__DEV__?Bo(e):e:Se(e)?e.map(function(o,s){var u=a.processFieldValue(o,r,i,Nd(n,s));return Rd(n,s),u}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:i,mergeTree:n})},t.prototype.flattenFields=function(e,r,i,n){n===void 0&&(n=ha(r,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new tr(!1);return function u(c,l){var d=s.lookup(c,l.clientOnly,l.deferred);d.visited||(d.visited=!0,c.selections.forEach(function(f){if(!!yr(f,i.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&qe(f.directives)&&f.directives.forEach(function(_){var S=_.name.value;if(S==="client"&&(p=!0),S==="defer"){var w=vr(_,i.variables);(!w||w.if!==!1)&&(h=!0)}}),Et(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Hu(i,p,h))}else{var b=wi(f,i.lookupFragment);if(!b&&f.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new Z("No fragment named ".concat(f.name.value)):new Z(8);b&&o.fragmentMatches(b,n,r,i.variables)&&u(b.selectionSet,Hu(i,p,h))}}}))}(e,i),a},t.prototype.applyMerges=function(e,r,i,n,a){var o,s=this;if(e.map.size&&!se(i)){var u=!Se(i)&&(se(r)||Br(r))?r:void 0,c=i;u&&!a&&(a=[se(u)?u.__ref:u]);var l,d=function(f,p){return Se(f)?typeof p=="number"?f[p]:void 0:n.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(u,p),m=d(c,p);if(m!==void 0){a&&a.push(p);var b=s.applyMerges(f,h,m,n,a);b!==m&&(l=l||new Map,l.set(p,b)),a&&$(a.pop()===p)}}),l&&(i=Se(c)?c.slice(0):C({},c),l.forEach(function(f,p){i[p]=f}))}return e.info?this.cache.policies.runMergeFunction(r,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},t}();var Ld=[];function Nd(t,e){var r=t.map;return r.has(e)||r.set(e,Ld.pop()||{map:new Map}),r.get(e)}function Gu(t,e){if(t===e||!e||cs(e))return t;if(!t||cs(t))return e;var r=t.info&&e.info?C(C({},t.info),e.info):t.info||e.info,i=t.map.size&&e.map.size,n=i?new Map:t.map.size?t.map:e.map,a={info:r,map:n};if(i){var o=new Set(e.map.keys());t.map.forEach(function(s,u){a.map.set(u,Gu(s,e.map.get(u))),o.delete(u)}),o.forEach(function(s){a.map.set(s,Gu(e.map.get(s),t.map.get(s)))})}return a}function cs(t){return!t||!(t.info||t.map.size)}function Rd(t,e){var r=t.map,i=r.get(e);i&&cs(i)&&(Ld.push(i),r.delete(e))}var Pd=new Set;function uy(t,e,r,i){var n=function(d){var f=i.getFieldValue(d,r);return typeof f=="object"&&f},a=n(t);if(!!a){var o=n(e);if(!!o&&!se(a)&&!ke(a,o)&&!Object.keys(a).every(function(d){return i.getFieldValue(o,d)!==void 0})){var s=i.getFieldValue(t,"__typename")||i.getFieldValue(e,"__typename"),u=Wt(r),c="".concat(s,".").concat(u);if(!Pd.has(c)){Pd.add(c);var l=[];!Se(a)&&!Se(o)&&[a,o].forEach(function(d){var f=i.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&$.warn("Cache data may be lost when replacing the ".concat(u," 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(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(c,` 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,21 +46,21 @@ 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(t){Re(e,t);function e(r){r===void 0&&(r={});var i=t.call(this)||this;return i.watches=new Set,i.typenameDocumentCache=new Map,i.makeVar=os,i.txCount=0,i.config=fd(r),i.addTypename=!!i.config.addTypename,i.policies=new Od({cache:i,dataIdFromObject:i.config.dataIdFromObject,possibleTypes:i.config.possibleTypes,typePolicies:i.config.typePolicies}),i.init(),i}return e.prototype.init=function(){var r=this.data=new kn.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=r.stump,this.resetResultCache()},e.prototype.resetResultCache=function(r){var i=this,n=this.storeReader,a=this.config.fragments;this.storeWriter=new $d(this,this.storeReader=new bd({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:rs(this.config),canon:r?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 u=o.optimistic,c=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,xt({optimistic:u,id:c,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(r){return this.init(),r&&this.data.replace(r),this},e.prototype.extract=function(r){return r===void 0&&(r=!1),(r?this.optimisticData:this.data).extract()},e.prototype.read=function(r){var i=r.returnPartialData,n=i===void 0?!1:i;try{return this.storeReader.diffQueryAgainstStore(C(C({},r),{store:r.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(r){try{return++this.txCount,this.storeWriter.writeToStore(this.data,r)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(r){if(Pe.call(r,"id")&&!r.id)return!1;var i=r.optimistic?this.optimisticData:this.data;try{return++this.txCount,i.modify(r.id||"ROOT_QUERY",r.fields)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(r){return this.storeReader.diffQueryAgainstStore(C(C({},r),{store:r.optimistic?this.optimisticData:this.data,rootId:r.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(r){var i=this;return this.watches.size||Sd(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){i.watches.delete(r)&&!i.watches.size&&qu(i),i.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){xt.reset();var i=this.optimisticData.gc();return r&&!this.txCount&&(r.resetResultCache?this.resetResultCache(r.resetResultIdentities):r.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(r,i){return(i?this.optimisticData:this.data).retain(r)},e.prototype.release=function(r,i){return(i?this.optimisticData:this.data).release(r)},e.prototype.identify=function(r){if(se(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(i){__DEV__&&$.warn(i)}},e.prototype.evict=function(r){if(!r.id){if(Pe.call(r,"id"))return!1;r=C(C({},r),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(r,this.data)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(r){var i=this;return this.init(),xt.reset(),r&&r.discardWatches?(this.watches.forEach(function(n){return i.maybeBroadcastWatch.forget(n)}),this.watches.clear(),qu(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(r){var i=this.optimisticData.removeLayer(r);i!==this.optimisticData&&(this.optimisticData=i,this.broadcastWatches())},e.prototype.batch=function(r){var i=this,n=r.update,a=r.optimistic,o=a===void 0?!0:a,s=r.removeOptimistic,u=r.onWatchUpdated,c,l=function(f){var p=i,h=p.data,m=p.optimisticData;++i.txCount,f&&(i.data=i.optimisticData=f);try{return c=n(i)}finally{--i.txCount,i.data=h,i.optimisticData=m}},d=new Set;return u&&!this.txCount&&this.broadcastWatches(C(C({},r),{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)),u&&d.size?(this.broadcastWatches(C(C({},r),{onWatchUpdated:function(f,p){var h=u.call(this,f,p);return h!==!1&&d.delete(f),h}})),d.size&&d.forEach(function(f){return i.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(r),c},e.prototype.performTransaction=function(r,i){return this.batch({update:r,optimistic:i||i!==null})},e.prototype.transformDocument=function(r){if(this.addTypename){var i=this.typenameDocumentCache.get(r);return i||(i=Ai(r),this.typenameDocumentCache.set(r,i),this.typenameDocumentCache.set(i,i)),i}return r},e.prototype.transformForLink=function(r){var i=this.config.fragments;return i?i.transform(r):r},e.prototype.broadcastWatches=function(r){var i=this;this.txCount||this.watches.forEach(function(n){return i.maybeBroadcastWatch(n,r)})},e.prototype.broadcastWatch=function(r,i){var n=r.lastDiff,a=this.diff(r);i&&(r.optimistic&&typeof i.optimistic=="string"&&(a.fromOptimisticTransaction=!0),i.onWatchUpdated&&i.onWatchUpdated.call(this,r,a,n)===!1)||(!n||!ke(n.result,a.result))&&r.callback(r.lastDiff=a,n)},e}(Pu);function Fd(t){return t.hasOwnProperty("graphQLErrors")}var ly=function(t){var e="";if(qe(t.graphQLErrors)||qe(t.clientErrors)){var r=(t.graphQLErrors||[]).concat(t.clientErrors||[]);r.forEach(function(i){var n=i?i.message:"Error message not found.";e+="".concat(n,`
50
- `)})}return t.networkError&&(e+="".concat(t.networkError.message,`
51
- `)),e=e.replace(/\n$/,""),e},br=function(t){Re(e,t);function e(r){var i=r.graphQLErrors,n=r.clientErrors,a=r.networkError,o=r.errorMessage,s=r.extraInfo,u=t.call(this,o)||this;return u.name="ApolloError",u.graphQLErrors=i||[],u.clientErrors=n||[],u.networkError=a||null,u.message=o||ly(u),u.extraInfo=s,u.__proto__=e.prototype,u}return e}(Error);var ye;(function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error"})(ye||(ye={}));function Qr(t){return t?t<7:!1}var py=Object.assign,fy=Object.hasOwnProperty,us=function(t){Re(e,t);function e(r){var i=r.queryManager,n=r.queryInfo,a=r.options,o=t.call(this,function(b){try{var _=b._subscription._observer;_&&!_.error&&(_.error=dy)}catch{}var S=!o.observers.size;o.observers.add(b);var w=o.last;return w&&w.error?b.error&&b.error(w.error):w&&w.result&&b.next&&b.next(w.result),S&&o.reobserve().catch(function(){}),function(){o.observers.delete(b)&&!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,u=s===void 0?{}:s,c=u.fetchPolicy,l=c===void 0?"cache-first":c,d=a.fetchPolicy,f=d===void 0?l:d,p=a.initialFetchPolicy,h=p===void 0?f==="standby"?l: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 r=this;return new Promise(function(i,n){var a={next:function(s){i(s),r.observers.delete(a),r.observers.size||r.queryManager.removeQuery(r.queryId),setTimeout(function(){o.unsubscribe()},0)},error:n},o=r.subscribe(a)})},e.prototype.getCurrentResult=function(r){r===void 0&&(r=!0);var i=this.getLastResult(!0),n=this.queryInfo.networkStatus||i&&i.networkStatus||ye.ready,a=C(C({},i),{loading:Qr(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 u=this.queryInfo.getDiff();(u.complete||this.options.returnPartialData)&&(a.data=u.result),ke(a.data,{})&&(a.data=void 0),u.complete?(delete a.partial,u.complete&&a.networkStatus===ye.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=ye.ready,a.loading=!1)):a.partial=!0,__DEV__&&!u.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Zu(u.missing)}return r&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(r,i){return!this.last||!ke(this.last.result,r)||i&&!ke(this.last.variables,i)},e.prototype.getLast=function(r,i){var n=this.last;if(n&&n[r]&&(!i||ke(n.variables,this.variables)))return n[r]},e.prototype.getLastResult=function(r){return this.getLast("result",r)},e.prototype.getLastError=function(r){return this.getLast("error",r)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(r){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__&&r&&fy.call(r,"variables")){var o=ma(this.query),s=o.variableDefinitions;(!s||!s.some(function(u){return u.variable.name.value==="variables"}))&&__DEV__&&$.warn("Called refetch(".concat(JSON.stringify(r),") 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 r&&!ke(this.options.variables,r)&&(n.variables=this.options.variables=C(C({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(n,ye.refetch)},e.prototype.fetchMore=function(r){var i=this,n=C(C({},r.query?r:C(C(C(C({},this.options),{query:this.query}),r),{variables:C(C({},this.options.variables),r.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=ye.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var u=new Set;return this.queryManager.fetchQuery(a,n,ye.fetchMore).then(function(c){return i.queryManager.removeQuery(a),o.networkStatus===ye.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(l){var d=r.updateQuery;d?l.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:c.data,variables:n.variables})}):l.writeQuery({query:n.query,variables:n.variables,data:c.data})},onWatchUpdated:function(l){u.add(l.query)}}),c}).finally(function(){u.has(i.query)||Ku(i)})},e.prototype.subscribeToMore=function(r){var i=this,n=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(a){var o=r.updateQuery;o&&i.updateQuery(function(s,u){var c=u.variables;return o(s,{subscriptionData:a,variables:c})})},error:function(a){if(r.onError){r.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(r){return this.reobserve(r)},e.prototype.setVariables=function(r){return ke(this.variables,r)?this.observers.size?this.result():Promise.resolve():(this.options.variables=r,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:r},ye.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=r(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(r){this.options.pollInterval=r,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(r,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:r,options:i,observable:this,initialFetchPolicy:s}):r==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(r,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,r,i)},e.prototype.updatePolling=function(){var r=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(){r.pollingInfo&&(Qr(r.queryInfo.networkStatus)?u():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ye.poll).then(u,u))},u=function(){var c=r.pollingInfo;c&&(clearTimeout(c.timeout),c.timeout=setTimeout(s,c.interval))};u()}}},e.prototype.updateLastResult=function(r,i){return i===void 0&&(i=this.variables),this.last=C(C({},this.last),{result:this.queryManager.assumeImmutableResults?r:Bo(r),variables:i}),qe(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,i){var n=this;this.isTornDown=!1;var a=i===ye.refetch||i===ye.fetchMore||i===ye.poll,o=this.options.variables,s=this.options.fetchPolicy,u=jr(this.options,r||{}),c=a?u:py(this.options,u);a||(this.updatePolling(),r&&r.variables&&!ke(r.variables,o)&&c.fetchPolicy!=="standby"&&c.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",c),i===void 0&&(i=ye.setVariables)));var l=c.variables&&C({},c.variables),d=this.fetch(c,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(r,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(r,i))&&((n||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,i),ki(this.observers,"next",r))},e.prototype.reportError=function(r,i){var n=C(C({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:ye.error,loading:!1});this.updateLastResult(n,i),ki(this.observers,"error",this.last.error=r)},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(r){return r.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(oe);Qo(us);function Ku(t){var e=t.options,r=e.fetchPolicy,i=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):r}}):t.reobserve()}function dy(t){__DEV__&&$.error("Unhandled error",t.message,t.stack)}function Zu(t){__DEV__&&t&&__DEV__&&$.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var ls=function(){function t(e){var r=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=r,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){r.resolvers=uu(r.resolvers,i)}):this.resolvers=uu(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var r=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(u){return r?[2,this.resolveDocument(r,i.data,n,a,this.fragmentMatcher,s).then(function(c){return C(C({},i),{data:c.result})})]:[2,i]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return yn(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return cu(e)},t.prototype.prepareContext=function(e){var r=this.cache;return C(C({},e),{cache:r,getCacheKey:function(i){return r.identify(i)}})},t.prototype.addExportedVariables=function(e,r,i){return r===void 0&&(r={}),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,r)||{},this.prepareContext(i),r).then(function(a){return C(C({},r),a.exportedVariables)})]:[2,C({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return nt(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(r=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),r))return _i}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:su(e),variables:r,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,r,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,u,c,l,d,f,p,h,m,b,_;return Vt(this,function(S){return s=Ei(e),u=Ci(e),c=Si(u),l=this.collectSelectionsToResolve(s,c),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,b={fragmentMap:c,context:C(C({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,r,b).then(function(w){return{result:w,exportedVariables:b.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,i,n){return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l=this;return Vt(this,function(d){return a=n.fragmentMap,o=n.context,s=n.variables,u=[i],c=function(f){return Bt(l,void 0,void 0,function(){var p,h;return Vt(this,function(m){return!r&&!n.selectionsToResolve.has(f)?[2]:yr(f,s)?Et(f)?[2,this.resolveField(f,r,i,n).then(function(b){var _;typeof b<"u"&&u.push((_={},_[Rt(f)]=b,_))})]:(iu(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,r,i,n).then(function(b){u.push(b)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(c)).then(function(){return ga(u)})]})})},t.prototype.resolveField=function(e,r,i,n){return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,p,h=this;return Vt(this,function(m){return i?(a=n.variables,o=e.name.value,s=Rt(e),u=o!==s,c=i[s]||i[o],l=Promise.resolve(c),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=i.__typename||n.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[u?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(b){var _,S;if(b===void 0&&(b=c),e.directives&&e.directives.forEach(function(v){v.name.value==="export"&&v.arguments&&v.arguments.forEach(function(D){D.name.value==="as"&&D.value.kind==="StringValue"&&(n.exportedVariables[D.value.value]=b)})}),!e.selectionSet||b==null)return b;var w=(S=(_=e.directives)===null||_===void 0?void 0:_.some(function(v){return v.name.value==="client"}))!==null&&S!==void 0?S:!1;if(Array.isArray(b))return h.resolveSubSelectedArray(e,r||w,b,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,r||w,b,n)})]):[2,null]})})},t.prototype.resolveSubSelectedArray=function(e,r,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,r,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,r,o,n)}))},t.prototype.collectSelectionsToResolve=function(e,r){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),nt(o,{Directive:function(u,c,l,d,f){u.name.value==="client"&&f.forEach(function(p){i(p)&&pa(p)&&s.add(p)})},FragmentSpread:function(u,c,l,d,f){var p=r[u.name.value];__DEV__?$(p,"No fragment named ".concat(u.name.value)):$(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){i(m)&&pa(m)&&s.add(m)}),s.add(u),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},t}();var On=new(Pt?WeakMap:Map);function Ju(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return On.set(t,(On.get(t)+1)%1e15),r.apply(this,arguments)})}function Md(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var ps=function(){function t(e,r){r===void 0&&(r=e.generateQueryId()),this.queryId=r,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),Ju(i,"evict"),Ju(i,"modify"),Ju(i,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||ye.loading;return this.variables&&this.networkStatus!==ye.loading&&!ke(this.variables,e.variables)&&(r=ye.setVariables),ke(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:r}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){Md(this),this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&ke(r,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(r);return this.updateLastDiff(n,r),n},t.prototype.updateLastDiff=function(e,r){this.lastDiff=e?{diff:e,options:r||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){var r;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(r=this.observableQuery)===null||r===void 0?void 0:r.options.canonizeResults}},t.prototype.setDiff=function(e){var r=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!ke(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return r.notify()},0)))},t.prototype.setObservableQuery=function(e){var r=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=r.getDiff();i.fromOptimisticTransaction?e.observe():Ku(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;Md(this),this.shouldNotify()&&this.listeners.forEach(function(r){return r(e)}),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Qr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=t.prototype.cancel,this.subscriptions.forEach(function(r){return r.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){},t.prototype.updateWatch=function(e){var r=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 r.setDiff(a)}});(!this.lastWatch||!ke(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var i=this.lastWrite;return!(i&&i.dmCount===On.get(this.cache)&&ke(r,i.variables)&&ke(e.data,i.result.data))},t.prototype.markResult=function(e,r,i,n){var a=this,o=new mt,s=qe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&qe(e.incremental)){var u=zo(this.getDiff().result,e);e.data=u}else if("hasNext"in e&&e.hasNext){var c=this.getDiff();e.data=o.merge(c.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(fs(e,i.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,i.variables))l.writeQuery({query:r,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)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ye.ready},t.prototype.markError=function(e){return this.networkStatus=ye.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function fs(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",i=!Cn(t);return!i&&r&&t.data&&(i=!0),i}var hy=Object.prototype.hasOwnProperty,Ud=function(){function t(e){var r=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,u=e.ssrMode,c=u===void 0?!1:u,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(Pt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=r,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new ls({cache:r}),this.ssrMode=c,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var e=this;this.queries.forEach(function(r,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new Z("QueryManager stopped while query was in flight"):new Z(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,u=e.refetchQueries,c=u===void 0?[]:u,l=e.awaitRefetchQueries,d=l===void 0?!1:l,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((r=this.defaultOptions.mutate)===null||r===void 0?void 0:r.fetchPolicy)||"network-only":h,b=e.errorPolicy,_=b===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":b,S=e.keepRootFields,w=e.context;return Bt(this,void 0,void 0,function(){var v,D,N,A,R,F;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),v=this.generateMutationId(),D=this.transform(n),N=D.document,A=D.hasClientExports,n=this.cache.transformForLink(N),a=this.getVariables(n,a),A?[4,this.localState.addExportedVariables(n,a,w)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return R=this.mutationStore&&(this.mutationStore[v]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:v,document:n,variables:a,fetchPolicy:m,errorPolicy:_,context:w,updateQueries:s,update:f,keepRootFields:S}),this.broadcastQueries(),F=this,[2,new Promise(function(j,Je){return Vo(F.getObservableFromLink(n,C(C({},w),{optimisticResponse:o}),a,!1),function(je){if(Cn(je)&&_==="none")throw new br({graphQLErrors:Wo(je)});R&&(R.loading=!1,R.error=null);var H=C({},je);return typeof c=="function"&&(c=c(H)),_==="ignore"&&Cn(H)&&delete H.errors,F.markMutationResult({mutationId:v,result:H,document:n,variables:a,fetchPolicy:m,errorPolicy:_,context:w,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:c,removeOptimistic:o?v:void 0,onQueryUpdated:p,keepRootFields:S})}).subscribe({next:function(je){F.broadcastQueries(),(!("hasNext"in je)||je.hasNext===!1)&&j(je)},error:function(je){R&&(R.loading=!1,R.error=je),o&&F.cache.removeOptimistic(v),F.broadcastQueries(),Je(je instanceof br?je:new br({networkError:je}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var i=this;r===void 0&&(r=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&fs(n,e.errorPolicy)){if(Ur(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Ur(n)&&qe(n.incremental)){var s=r.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),u=void 0;s.result&&(u=zo(s.result,n)),typeof u<"u"&&(n.data=u,a.push({result:u,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var c=e.updateQueries;c&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!hy.call(c,h))){var m=c[h],b=i.queries.get(f),_=b.document,S=b.variables,w=r.diff({query:_,variables:S,returnPartialData:!0,optimistic:!1}),v=w.result,D=w.complete;if(D&&v){var N=m(v,{mutationResult:n,queryName:_&&bn(_)||void 0,queryVariables:S});N&&a.push({result:N,dataId:"ROOT_QUERY",query:_,variables:S})}}})}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=!wf(n)||Ur(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,b){var _=b.fieldName,S=b.DELETE;return _==="__typename"?m:S}})},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)},t.prototype.markMutationOptimistic=function(e,r){var i=this,n=typeof e=="function"?e(r.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(C(C({},r),{result:{data:n}}),a)}catch(o){__DEV__&&$.error(o)}},r.mutationId)},t.prototype.fetchQuery=function(e,r,i){return this.fetchQueryObservable(e,r,i).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,i){e[i]={variables:r.variables,networkStatus:r.networkStatus,networkError:r.networkError,graphQLErrors:r.graphQLErrors}}),e},t.prototype.resetErrors=function(e){var r=this.queries.get(e);r&&(r.networkError=void 0,r.graphQLErrors=[])},t.prototype.transform=function(e){var r=this.transformCache;if(!r.has(e)){var i=this.cache.transformDocument(e),n=ou(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:Xc(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:xi(er(i)),asQuery:C(C({},i),{definitions:i.definitions.map(function(c){return c.kind==="OperationDefinition"&&c.operation!=="query"?C(C({},c),{operation:"query"}):c})})},u=function(c){c&&!r.has(c)&&r.set(c,s)};u(e),u(i),u(a),u(o)}return r.get(e)},t.prototype.getVariables=function(e,r){return C(C({},this.transform(e).defaultVars),r)},t.prototype.watchQuery=function(e){e=C(C({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var r=new ps(this),i=new us({queryManager:this,queryInfo:r,options:e});return this.queries.set(i.queryId,r),r.init({document:i.query,observableQuery:i,variables:i.variables}),i},t.prototype.query=function(e,r){var i=this;return r===void 0&&(r=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(r,e).finally(function(){return i.stopQuery(r)})},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var r=this.queries.get(e);r&&r.stop()},t.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new Z("Store reset while query was in flight (not completed in link chain)"):new Z(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=ye.loading:r.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},t.prototype.getObservableQueries=function(e){var r=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):tu(o)?n.set(r.transform(o).document,!1):fe(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var u=o.observableQuery,c=o.document;if(u){if(e==="all"){i.set(s,u);return}var l=u.queryName,d=u.options.fetchPolicy;if(d==="standby"||e==="active"&&!u.hasObservers())return;(e==="active"||l&&n.has(l)||c&&n.has(c))&&(i.set(s,u),l&&n.set(l,!0),c&&n.set(c,!0))}}),a.size&&a.forEach(function(o){var s=ba("legacyOneTimeQuery"),u=r.getQuery(s).init({document:o.query,variables:o.variables}),c=new us({queryManager:r,queryInfo:u,options:C(C({},o),{fetchPolicy:"network-only"})});$(c.queryId===s),u.setObservableQuery(c),i.set(s,c)}),__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},t.prototype.reFetchObservableQueries=function(e){var r=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()),r.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,u=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var c=function(d){return r.getObservableFromLink(i,u,d).map(function(f){if(n!=="no-cache"&&(fs(f,a)&&r.cache.write({query:i,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),r.broadcastQueries()),Cn(f))throw new br({graphQLErrors:f.errors});return f})};if(this.transform(i).hasClientExports){var l=this.localState.addExportedVariables(i,o,u).then(c);return new oe(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return c(o)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,r,i,n){var a=this,o;n===void 0&&(n=(o=r?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,u=this.transform(e).serverQuery;if(u){var c=this,l=c.inFlightLinkObservables,d=c.link,f={query:u,variables:i,operationName:bn(u)||void 0,context:this.prepareContext(C(C({},r),{forceFetch:!n}))};if(r=f.context,n){var p=l.get(u)||new Map;l.set(u,p);var h=xt(i);if(s=p.get(h),!s){var m=new wn([En(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(u)})}}else s=new wn([En(d,f)])}else s=new wn([oe.of({data:{}})]),r=this.prepareContext(r);var b=this.transform(e).clientQuery;return b&&(s=Vo(s,function(_){return a.localState.runResolvers({document:b,remoteResult:_,context:r,variables:i})})),s},t.prototype.getResultsFromLink=function(e,r,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Vo(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Wo(o),u=s.length>0;if(n>=e.lastRequestId){if(u&&i.errorPolicy==="none")throw e.markError(new br({graphQLErrors:s}));e.markResult(o,a,i,r),e.markReady()}var c={data:o.data,loading:!1,networkStatus:ye.ready};return u&&i.errorPolicy!=="ignore"&&(c.errors=s,c.networkStatus=ye.error),c},function(o){var s=Fd(o)?o:new br({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,i){var n=this;i===void 0&&(i=ye.loading);var a=this.transform(r.query).document,o=this.getVariables(a,r.variables),s=this.getQuery(e),u=this.defaultOptions.watchQuery,c=r.fetchPolicy,l=c===void 0?u&&u.fetchPolicy||"cache-first":c,d=r.errorPolicy,f=d===void 0?u&&u.errorPolicy||"none":d,p=r.returnPartialData,h=p===void 0?!1:p,m=r.notifyOnNetworkStatusChange,b=m===void 0?!1:m,_=r.context,S=_===void 0?{}:_,w=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:b,context:S}),v=function(A){w.variables=A;var R=n.fetchQueryByPolicy(s,w,i);return w.fetchPolicy!=="standby"&&R.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),R},D=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){D(),setTimeout(function(){return N.cancel(A)})});var N=new wn(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(v):v(w.variables));return N.promise.then(D,D),N},t.prototype.refetchQueries=function(e){var r=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,u=s===void 0?o?ba("refetchQueries"):void 0:s,c=e.onQueryUpdated,l=new Map;n&&this.getObservableQueries(n).forEach(function(f,p){l.set(p,{oq:f,lastDiff:r.getQuery(p).getDiff()})});var d=new Map;return i&&this.cache.batch({update:i,optimistic:o&&u||!1,removeOptimistic:u,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof ps&&f.watcher.observableQuery;if(m){if(c){l.delete(m.queryId);var b=c(m,p,h);return b===!0&&(b=m.refetch()),b!==!1&&d.set(m,b),b}c!==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,b=f.diff,_;if(c){if(!b){var S=h.queryInfo;S.reset(),b=S.getDiff()}_=c(h,b,m)}(!c||_===!0)&&(_=h.refetch()),_!==!1&&d.set(h,_),p.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(p)}),u&&this.cache.removeOptimistic(u),d},t.prototype.fetchQueryByPolicy=function(e,r,i){var n=this,a=r.query,o=r.variables,s=r.fetchPolicy,u=r.refetchWritePolicy,c=r.errorPolicy,l=r.returnPartialData,d=r.context,f=r.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(v,D){D===void 0&&(D=e.networkStatus||ye.loading);var N=v.result;__DEV__&&!l&&!ke(N,{})&&Zu(v.missing);var A=function(R){return oe.of(C({data:R,loading:Qr(D),networkStatus:D},v.complete?null:{partial:!0}))};return N&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:N},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(R){return A(R.data||void 0)}):c==="none"&&D===ye.refetch&&Array.isArray(v.missing)?A(void 0):A(N)},b=s==="no-cache"?0:i===ye.refetch&&u!=="merge"?1:2,_=function(){return n.getResultsFromLink(e,b,{variables:o,context:d,fetchPolicy:s,errorPolicy:c})},S=f&&typeof p=="number"&&p!==i&&Qr(i);switch(s){default:case"cache-first":{var w=h();return w.complete?[m(w,e.markReady())]:l||S?[m(w),_()]:[_()]}case"cache-and-network":{var w=h();return w.complete||l||S?[m(w),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return S?[m(h()),_()]:[_()];case"no-cache":return S?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new ps(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return C(C({},r),{clientAwareness:this.clientAwareness})},t}();var jd=!1;var ds=function(){function t(e){var r=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,u=s===void 0?!1:s,c=e.ssrForceFetchDelay,l=c===void 0?0:c,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,b=e.assumeImmutableResults,_=b===void 0?!1:b,S=e.resolvers,w=e.typeDefs,v=e.fragmentMatcher,D=e.name,N=e.version,A=e.link;if(A||(A=i?new Au({uri:i,credentials:n,headers:a}):$t.empty()),!o)throw __DEV__?new Z(`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 Z(9);if(this.link=A,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=w,l&&setTimeout(function(){return r.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),!jd&&f&&__DEV__&&(jd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var R=window.navigator,F=R&&R.userAgent,P=void 0;typeof F=="string"&&(F.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":F.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=Af,this.localState=new ls({cache:o,client:this,resolvers:S,fragmentMatcher:v}),this.queryManager=new Ud({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:u,clientAwareness:{name:D,version:N},localState:this.localState,assumeImmutableResults:_,onBroadcast:f?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.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)},t.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)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=_a(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!1),this.cache.readQuery(e,r)},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!1),this.cache.readFragment(e,r)},t.prototype.writeQuery=function(e){var r=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.writeFragment=function(e){var r=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return En(this.link,e)},t.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(r){return r()}))}).then(function(){return e.reFetchObservableQueries()})},t.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(r){return r()}))})},t.prototype.onResetStore=function(e){var r=this;return this.resetStoreCallbacks.push(e),function(){r.resetStoreCallbacks=r.resetStoreCallbacks.filter(function(i){return i!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(i){return i!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),i=[],n=[];r.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},t.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();Jp(bi?"log":"silent");function ct(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function _r(t){return ct(t)==="object"}function qd(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function Yu(t,e){return t.length<124?t:e}var Bd="graphql-transport-ws";var gt;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(gt||(gt={}));var $e;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})($e||($e={}));function Vd(t){if(!_r(t))throw new Error(`Message is expected to be an object, but got ${ct(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${ct(t.type)}`);switch(t.type){case $e.ConnectionInit:case $e.ConnectionAck:case $e.Ping:case $e.Pong:{if(t.payload!=null&&!_r(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case $e.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ct(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!_r(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ct(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${ct(t.payload.query)}`);if(t.payload.variables!=null&&!_r(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${ct(t.payload.variables)}`);if(t.payload.operationName!=null&&ct(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${ct(t.payload.operationName)}`);if(t.payload.extensions!=null&&!_r(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${ct(t.payload.extensions)}`);break}case $e.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ct(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!_r(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ct(t.payload)}`);break}case $e.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ct(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!qd(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case $e.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${ct(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function Qd(t,e){return Vd(typeof t=="string"?JSON.parse(t,e):t)}function Dn(t,e){return Vd(t),JSON.stringify(t,e)}function Xu(t){let{url:e,connectionParams:r,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:u=0,retryAttempts:c=5,retryWait:l=async function(we){let Ce=1e3;for(let le=0;le<we;le++)Ce*=2;await new Promise(le=>setTimeout(le,Ce+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=hs,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{let Ce=Math.random()*16|0;return(we=="x"?Ce:Ce&3|8).toString(16)})},jsonMessageReplacer:b,jsonMessageReviver:_}=t,S;if(h){if(!gy(h))throw new Error("Invalid WebSocket implementation provided");S=h}else typeof WebSocket<"u"?S=WebSocket:typeof global<"u"?S=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(S=window.WebSocket||window.MozWebSocket);if(!S)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=S,v=(()=>{let H=(()=>{let Ce={};return{on(le,pe){return Ce[le]=pe,()=>{delete Ce[le]}},emit(le){var pe;"id"in le&&((pe=Ce[le.id])===null||pe===void 0||pe.call(Ce,le))}}})(),we={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?[H.emit,p.message]:[H.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:H.on,on(Ce,le){let pe=we[Ce];return pe.push(le),()=>{pe.splice(pe.indexOf(le),1)}},emit(Ce,...le){for(let pe of[...we[Ce]])pe(...le)}}})();function D(H){let we=[v.on("error",Ce=>{we.forEach(le=>le()),H(Ce)}),v.on("closed",Ce=>{we.forEach(le=>le()),H(Ce)})]}let N,A=0,R,F=!1,P=0,j=!1;async function Je(){clearTimeout(R);let[H,we]=await(N??(N=new Promise((pe,Zt)=>(async()=>{if(F){if(await l(P),!A)return N=void 0,Zt({code:1e3,reason:"All Subscriptions Gone"});P++}v.emit("connecting");let ae=new w(typeof e=="function"?await e():e,Bd),Jt,Dr;function Ao(){isFinite(o)&&o>0&&(clearTimeout(Dr),Dr=setTimeout(()=>{ae.readyState===w.OPEN&&(ae.send(Dn({type:$e.Ping})),v.emit("ping",!1,void 0))},o))}D(Ye=>{N=void 0,clearTimeout(Jt),clearTimeout(Dr),Zt(Ye),hs(Ye)&&Ye.code===4499&&(ae.close(4499,"Terminated"),ae.onerror=null,ae.onclose=null)}),ae.onerror=Ye=>v.emit("error",Ye),ae.onclose=Ye=>v.emit("closed",Ye),ae.onopen=async()=>{try{v.emit("opened",ae);let Ye=typeof r=="function"?await r():r;if(ae.readyState!==w.OPEN)return;ae.send(Dn(Ye?{type:$e.ConnectionInit,payload:Ye}:{type:$e.ConnectionInit},b)),isFinite(u)&&u>0&&(Jt=setTimeout(()=>{ae.close(gt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},u)),Ao()}catch(Ye){v.emit("error",Ye),ae.close(gt.InternalClientError,Yu(Ye instanceof Error?Ye.message:new Error(Ye).message,"Internal client error"))}};let fn=!1;ae.onmessage=({data:Ye})=>{try{let Xe=Qd(Ye,_);if(v.emit("message",Xe),Xe.type==="ping"||Xe.type==="pong"){v.emit(Xe.type,!0,Xe.payload),Xe.type==="pong"?Ao():s||(ae.send(Dn(Xe.payload?{type:$e.Pong,payload:Xe.payload}:{type:$e.Pong})),v.emit("pong",!1,Xe.payload));return}if(fn)return;if(Xe.type!==$e.ConnectionAck)throw new Error(`First message cannot be of type ${Xe.type}`);clearTimeout(Jt),fn=!0,v.emit("connected",ae,Xe.payload),F=!1,P=0,pe([ae,new Promise((V3,pm)=>D(pm))])}catch(Xe){ae.onmessage=null,v.emit("error",Xe),ae.close(gt.BadResponse,Yu(Xe instanceof Error?Xe.message:new Error(Xe).message,"Bad response"))}}})())));H.readyState===w.CLOSING&&await we;let Ce=()=>{},le=new Promise(pe=>Ce=pe);return[H,Ce,Promise.race([le.then(()=>{if(!A){let pe=()=>H.close(1e3,"Normal Closure");isFinite(a)&&a>0?R=setTimeout(()=>{H.readyState===w.OPEN&&pe()},a):pe()}}),we])]}function je(H){if(hs(H)&&(my(H.code)||[gt.InternalServerError,gt.InternalClientError,gt.BadRequest,gt.BadResponse,gt.Unauthorized,gt.SubprotocolNotAcceptable,gt.SubscriberAlreadyExists,gt.TooManyInitialisationRequests].includes(H.code)))throw H;if(j)return!1;if(hs(H)&&H.code===1e3)return A>0;if(!c||P>=c||!d(H)||f?.(H))throw H;return F=!0}return i||(async()=>{for(A++;;)try{let[,,H]=await Je();await H}catch(H){try{if(!je(H))return}catch(we){return n?.(we)}}})(),{on:v.on,subscribe(H,we){let Ce=m(H),le=!1,pe=!1,Zt=()=>{A--,le=!0};return(async()=>{for(A++;;)try{let[ae,Jt,Dr]=await Je();if(le)return Jt();let Ao=v.onMessage(Ce,fn=>{switch(fn.type){case $e.Next:{we.next(fn.payload);return}case $e.Error:{pe=!0,le=!0,we.error(fn.payload),Zt();return}case $e.Complete:{le=!0,Zt();return}}});ae.send(Dn({id:Ce,type:$e.Subscribe,payload:H},b)),Zt=()=>{!le&&ae.readyState===w.OPEN&&ae.send(Dn({id:Ce,type:$e.Complete},b)),A--,le=!0,Jt()},await Dr.finally(Ao);return}catch(ae){if(!je(ae))return}})().then(()=>{pe||we.complete()}).catch(ae=>{we.error(ae)}),()=>{le||Zt()}},async dispose(){if(j=!0,N){let[H]=await N;H.close(1e3,"Normal Closure")}},terminate(){N&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function hs(t){return _r(t)&&"code"in t&&"reason"in t}function my(t){return[1e3,1001,1006,1005,1012,1013,1013].includes(t)?!1:t>=1e3&&t<=1999}function gy(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function yy(t){return fe(t)&&"code"in t&&"reason"in t}var el=function(t){Re(e,t);function e(r){var i=t.call(this)||this;return i.client=r,i}return e.prototype.request=function(r){var i=this;return new oe(function(n){return i.client.subscribe(C(C({},r),{query:gn(r.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):yy(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}($t);var Ws=function(){return Ws=Object.assign||function(e){for(var r,i=1,n=arguments.length;i<n;i++){r=arguments[i];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Ws.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ts(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ts=function(r){return typeof r}:Ts=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ts(t)}function vy(t){return Ts(t)=="object"&&t!==null}var u1=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Sl(t,e){for(var r=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=r.exec(t.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function by(t){return l1(t.source,Sl(t.source,t.start))}function l1(t,e){var r=t.locationOffset.column-1,i=Is(r)+t.body,n=e.line-1,a=t.locationOffset.line-1,o=e.line+a,s=e.line===1?r:0,u=e.column+s,c="".concat(t.name,":").concat(o,":").concat(u,`
54
- `),l=i.split(/\r\n|[\n\r]/g),d=l[n];if(d.length>120){for(var f=Math.floor(u/80),p=u%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return c+zd([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(b){return["",b]}),[[" ",Is(p-1)+"^"],["",h[f+1]]]))}return c+zd([["".concat(o-1),l[n-1]],["".concat(o),d],["",Is(u-1)+"^"],["".concat(o+1),l[n+1]]])}function zd(t){var e=t.filter(function(i){i[0];var n=i[1];return n!==void 0}),r=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 _y(r,n)+(a?" | "+a:" |")}).join(`
55
- `)}function Is(t){return Array(t+1).join(" ")}function _y(t,e){return Is(t-e.length)+e}function Os(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Os=function(r){return typeof r}:Os=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Os(t)}function Wd(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable})),r.push.apply(r,i)}return r}function Sy(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Wd(Object(r),!0).forEach(function(i){wy(t,i,r[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wd(Object(r)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(r,i))})}return t}function wy(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Cy(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function Hd(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function Ey(t,e,r){return e&&Hd(t.prototype,e),r&&Hd(t,r),t}function xy(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&to(t,e)}function Ay(t){var e=f1();return function(){var i=ro(t),n;if(e){var a=ro(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return p1(this,n)}}function p1(t,e){return e&&(Os(e)==="object"||typeof e=="function")?e:Ra(t)}function Ra(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function wl(t){var e=typeof Map=="function"?new Map:void 0;return wl=function(i){if(i===null||!ky(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 Ds(i,arguments,ro(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),to(n,i)},wl(t)}function Ds(t,e,r){return f1()?Ds=Reflect.construct:Ds=function(n,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(n,s),c=new u;return o&&to(c,o.prototype),c},Ds.apply(null,arguments)}function f1(){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 ky(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function to(t,e){return to=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},to(t,e)}function ro(t){return ro=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},ro(t)}var Ty=function(t){xy(r,t);var e=Ay(r);function r(i,n,a,o,s,u,c){var l,d,f,p;Cy(this,r),p=e.call(this,i),p.name="GraphQLError",p.originalError=u??void 0,p.nodes=Gd(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],m=0,b=(_=p.nodes)!==null&&_!==void 0?_:[];m<b.length;m++){var _,S=b[m],w=S.loc;w!=null&&h.push(w)}h=Gd(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(D){return D.start})),p.locations=o&&a?o.map(function(D){return Sl(a,D)}):(f=h)===null||f===void 0?void 0:f.map(function(D){return Sl(D.source,D.start)}),p.path=s??void 0;var v=u?.extensions;return c==null&&vy(v)?p.extensions=Sy({},v):p.extensions=c??{},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}}),u!=null&&u.stack?(Object.defineProperty(Ra(p),"stack",{value:u.stack,writable:!0,configurable:!0}),p1(p)):(Error.captureStackTrace?Error.captureStackTrace(Ra(p),r):Object.defineProperty(Ra(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return Ey(r,[{key:"toString",value:function(){return Iy(this)}},{key:u1,get:function(){return"Object"}}]),r}(wl(Error));function Gd(t){return t===void 0||t.length===0?void 0:t}function Iy(t){var e=t.message;if(t.nodes)for(var r=0,i=t.nodes;r<i.length;r++){var n=i[r];n.loc&&(e+=`
56
-
57
- `+by(n.loc))}else if(t.source&&t.locations)for(var a=0,o=t.locations;a<o.length;a++){var s=o[a];e+=`
58
-
59
- `+l1(t.source,s)}return e}function kt(t,e,r){return new Ty("Syntax Error: ".concat(r),void 0,t,[e])}var W=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 Oy(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Dy=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Cl=Dy;function d1(t){var e=t.prototype.toJSON;typeof e=="function"||Oy(0),t.prototype.inspect=e,Cl&&(t.prototype[Cl]=e)}var h1=function(){function t(r,i,n){this.start=r.start,this.end=i.end,this.startToken=r,this.endToken=i,this.source=n}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();d1(h1);var Fe=function(){function t(r,i,n,a,o,s,u){this.kind=r,this.start=i,this.end=n,this.line=a,this.column=o,this.value=u,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();d1(Fe);var I=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 Ns(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ns=function(r){return typeof r}:Ns=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ns(t)}var Ny=10,m1=2;function Ry(t){return gc(t,[])}function gc(t,e){switch(Ns(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Py(t,e);default:return String(t)}}function Py(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),i=Fy(t);if(i!==void 0){var n=i.call(t);if(n!==t)return typeof n=="string"?n:gc(n,r)}else if(Array.isArray(t))return Ly(t,r);return $y(t,r)}function $y(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>m1)return"["+My(t)+"]";var i=r.map(function(n){var a=gc(t[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function Ly(t,e){if(t.length===0)return"[]";if(e.length>m1)return"[Array]";for(var r=Math.min(Ny,t.length),i=t.length-r,n=[],a=0;a<r;++a)n.push(gc(t[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function Fy(t){var e=t[String(Cl)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function My(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function tl(t,e){var r=Boolean(t);if(!r)throw new Error(e)}var Uy=function(e,r){return e instanceof r};function Kd(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,i.key,i)}}function jy(t,e,r){return e&&Kd(t.prototype,e),r&&Kd(t,r),t}var g1=function(){function t(e){var r=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"||tl(0,"Body must be a string. Received: ".concat(Ry(e),".")),this.body=e,this.name=r,this.locationOffset=i,this.locationOffset.line>0||tl(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||tl(0,"column in locationOffset is 1-indexed and must be positive.")}return jy(t,[{key:u1,get:function(){return"Source"}}]),t}();function qy(t){return Uy(t,g1)}var By=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 Vy(t){var e=t.split(/\r\n|[\n\r]/g),r=Qy(t);if(r!==0)for(var i=1;i<e.length;i++)e[i]=e[i].slice(r);for(var n=0;n<e.length&&Zd(e[n]);)++n;for(var a=e.length;a>n&&Zd(e[a-1]);)--a;return e.slice(n,a).join(`
60
- `)}function Zd(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Qy(t){for(var e,r=!0,i=!0,n=0,a=null,o=0;o<t.length;++o)switch(t.charCodeAt(o)){case 13:t.charCodeAt(o+1)===10&&++o;case 10:r=!1,i=!0,n=0;break;case 9:case 32:++n;break;default:i&&!r&&(a===null||n<a)&&(a=n),i=!1}return(e=a)!==null&&e!==void 0?e:0}var zy=function(){function t(r){var i=new Fe(I.SOF,0,0,0,0,null);this.source=r,this.lastToken=i,this.token=i,this.line=1,this.lineStart=0}var e=t.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!==I.EOF)do{var n;i=(n=i.next)!==null&&n!==void 0?n:i.next=Hy(this,i)}while(i.kind===I.COMMENT);return i},t}();function Wy(t){return t===I.BANG||t===I.DOLLAR||t===I.AMP||t===I.PAREN_L||t===I.PAREN_R||t===I.SPREAD||t===I.COLON||t===I.EQUALS||t===I.AT||t===I.BRACKET_L||t===I.BRACKET_R||t===I.BRACE_L||t===I.PIPE||t===I.BRACE_R}function zi(t){return isNaN(t)?I.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function Hy(t,e){for(var r=t.source,i=r.body,n=i.length,a=e.end;a<n;){var o=i.charCodeAt(a),s=t.line,u=1+a-t.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++t.line,t.lineStart=a;continue;case 13:i.charCodeAt(a+1)===10?a+=2:++a,++t.line,t.lineStart=a;continue;case 33:return new Fe(I.BANG,a,a+1,s,u,e);case 35:return Ky(r,a,s,u,e);case 36:return new Fe(I.DOLLAR,a,a+1,s,u,e);case 38:return new Fe(I.AMP,a,a+1,s,u,e);case 40:return new Fe(I.PAREN_L,a,a+1,s,u,e);case 41:return new Fe(I.PAREN_R,a,a+1,s,u,e);case 46:if(i.charCodeAt(a+1)===46&&i.charCodeAt(a+2)===46)return new Fe(I.SPREAD,a,a+3,s,u,e);break;case 58:return new Fe(I.COLON,a,a+1,s,u,e);case 61:return new Fe(I.EQUALS,a,a+1,s,u,e);case 64:return new Fe(I.AT,a,a+1,s,u,e);case 91:return new Fe(I.BRACKET_L,a,a+1,s,u,e);case 93:return new Fe(I.BRACKET_R,a,a+1,s,u,e);case 123:return new Fe(I.BRACE_L,a,a+1,s,u,e);case 124:return new Fe(I.PIPE,a,a+1,s,u,e);case 125:return new Fe(I.BRACE_R,a,a+1,s,u,e);case 34:return i.charCodeAt(a+1)===34&&i.charCodeAt(a+2)===34?Yy(r,a,s,u,e,t):Jy(r,a,s,u,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Zy(r,a,o,s,u,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 e0(r,a,s,u,e)}throw kt(r,a,Gy(o))}var c=t.line,l=1+a-t.lineStart;return new Fe(I.EOF,n,n,c,l,e)}function Gy(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(zi(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(zi(t),".")}function Ky(t,e,r,i,n){var a=t.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Fe(I.COMMENT,e,s,r,i,n,a.slice(e+1,s))}function Zy(t,e,r,i,n,a){var o=t.body,s=r,u=e,c=!1;if(s===45&&(s=o.charCodeAt(++u)),s===48){if(s=o.charCodeAt(++u),s>=48&&s<=57)throw kt(t,u,"Invalid number, unexpected digit after 0: ".concat(zi(s),"."))}else u=rl(t,u,s),s=o.charCodeAt(u);if(s===46&&(c=!0,s=o.charCodeAt(++u),u=rl(t,u,s),s=o.charCodeAt(u)),(s===69||s===101)&&(c=!0,s=o.charCodeAt(++u),(s===43||s===45)&&(s=o.charCodeAt(++u)),u=rl(t,u,s),s=o.charCodeAt(u)),s===46||t0(s))throw kt(t,u,"Invalid number, expected digit but got: ".concat(zi(s),"."));return new Fe(c?I.FLOAT:I.INT,e,u,i,n,a,o.slice(e,u))}function rl(t,e,r){var i=t.body,n=e,a=r;if(a>=48&&a<=57){do a=i.charCodeAt(++n);while(a>=48&&a<=57);return n}throw kt(t,n,"Invalid number, expected digit but got: ".concat(zi(a),"."))}function Jy(t,e,r,i,n){for(var a=t.body,o=e+1,s=o,u=0,c="";o<a.length&&!isNaN(u=a.charCodeAt(o))&&u!==10&&u!==13;){if(u===34)return c+=a.slice(s,o),new Fe(I.STRING,e,o+1,r,i,n,c);if(u<32&&u!==9)throw kt(t,o,"Invalid character within String: ".concat(zi(u),"."));if(++o,u===92){switch(c+=a.slice(s,o-1),u=a.charCodeAt(o),u){case 34:c+='"';break;case 47:c+="/";break;case 92:c+="\\";break;case 98:c+="\b";break;case 102:c+="\f";break;case 110:c+=`
61
- `;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var l=Xy(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 kt(t,o,"Invalid character escape sequence: \\u".concat(d,"."))}c+=String.fromCharCode(l),o+=4;break}default:throw kt(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(u),"."))}++o,s=o}}throw kt(t,o,"Unterminated string.")}function Yy(t,e,r,i,n,a){for(var o=t.body,s=e+3,u=s,c=0,l="";s<o.length&&!isNaN(c=o.charCodeAt(s));){if(c===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(u,s),new Fe(I.BLOCK_STRING,e,s+3,r,i,n,Vy(l));if(c<32&&c!==9&&c!==10&&c!==13)throw kt(t,s,"Invalid character within String: ".concat(zi(c),"."));c===10?(++s,++a.line,a.lineStart=s):c===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):c===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(u,s)+'"""',s+=4,u=s):++s}throw kt(t,s,"Unterminated string.")}function Xy(t,e,r,i){return ms(t)<<12|ms(e)<<8|ms(r)<<4|ms(i)}function ms(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function e0(t,e,r,i,n){for(var a=t.body,o=a.length,s=e+1,u=0;s!==o&&!isNaN(u=a.charCodeAt(s))&&(u===95||u>=48&&u<=57||u>=65&&u<=90||u>=97&&u<=122);)++s;return new Fe(I.NAME,e,s,r,i,n,a.slice(e,s))}function t0(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function r0(t,e){var r=new i0(t,e);return r.parseDocument()}var i0=function(){function t(r,i){var n=qy(r)?r:new g1(r);this._lexer=new zy(n),this._options=i}var e=t.prototype;return e.parseName=function(){var i=this.expectToken(I.NAME);return{kind:W.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:W.DOCUMENT,definitions:this.many(I.SOF,this.parseDefinition,I.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(I.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(I.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(I.BRACE_L))return{kind:W.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(I.NAME)&&(a=this.parseName()),{kind:W.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(I.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(I.PAREN_L,this.parseVariableDefinition,I.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:W.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(I.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(I.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(I.DOLLAR),{kind:W.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:W.SELECTION_SET,selections:this.many(I.BRACE_L,this.parseSelection,I.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(I.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(I.COLON)?(a=n,o=this.parseName()):o=n,{kind:W.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(I.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(I.PAREN_L,n,I.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(I.COLON),{kind:W.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:W.ARGUMENT,name:this.parseName(),value:(this.expectToken(I.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(I.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(I.NAME)?{kind:W.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:W.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:W.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:W.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 I.BRACKET_L:return this.parseList(i);case I.BRACE_L:return this.parseObject(i);case I.INT:return this._lexer.advance(),{kind:W.INT,value:n.value,loc:this.loc(n)};case I.FLOAT:return this._lexer.advance(),{kind:W.FLOAT,value:n.value,loc:this.loc(n)};case I.STRING:case I.BLOCK_STRING:return this.parseStringLiteral();case I.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:W.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:W.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:W.NULL,loc:this.loc(n)};default:return{kind:W.ENUM,value:n.value,loc:this.loc(n)}}case I.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:W.STRING,value:i.value,block:i.kind===I.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:W.LIST,values:this.any(I.BRACKET_L,o,I.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:W.OBJECT,fields:this.any(I.BRACE_L,o,I.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(I.COLON),{kind:W.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(I.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(I.AT),{kind:W.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(I.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(I.BRACKET_R),n={kind:W.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(I.BANG)?{kind:W.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:W.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===I.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(I.STRING)||this.peek(I.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(I.BRACE_L,this.parseOperationTypeDefinition,I.BRACE_R);return{kind:W.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(I.COLON);var a=this.parseNamedType();return{kind:W.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:W.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),u=this.parseFieldsDefinition();return{kind:W.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:u,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(I.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(I.AMP)||this.peek(I.NAME));return n}return this.delimitedMany(I.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(I.BRACE_L)&&this._lexer.lookahead().kind===I.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(I.BRACE_L,this.parseFieldDefinition,I.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(I.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:W.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:u,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(I.PAREN_L,this.parseInputValueDef,I.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(I.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(I.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:W.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:u,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),u=this.parseFieldsDefinition();return{kind:W.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:u,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:W.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(I.EQUALS)?this.delimitedMany(I.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:W.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(I.BRACE_L,this.parseEnumValueDefinition,I.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:W.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:W.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(I.BRACE_L,this.parseInputValueDef,I.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===I.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(I.BRACE_L,this.parseOperationTypeDefinition,I.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:W.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:W.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:W.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:W.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:W.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:W.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:W.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(I.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:W.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(I.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(By[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 h1(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(y1(i),", found ").concat(il(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===I.NAME&&n.value===i)this._lexer.advance();else throw kt(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(il(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===I.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(il(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},t}();function il(t){var e=t.value;return y1(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function y1(t){return Wy(t)?'"'.concat(t,'"'):t}var Rs=new Map,El=new Map,v1=!0,Hs=!1;function b1(t){return t.replace(/[\s,]+/g," ").trim()}function n0(t){return b1(t.source.body.substring(t.start,t.end))}function a0(t){var e=new Set,r=[];return t.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=n0(i.loc),o=El.get(n);o&&!o.has(a)?v1&&console.warn("Warning: fragment with name "+n+` already exists.
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
+ `)})}return r.networkError&&(e+="".concat(r.networkError.message,`
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
+
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
+
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||El.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(i))}else r.push(i)}),Ws(Ws({},t),{definitions:r})}function o0(t){var e=new Set(t.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 r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function s0(t){var e=b1(t);if(!Rs.has(e)){var r=r0(t,{experimentalFragmentVariables:Hs,allowLegacyFragmentVariables:Hs});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");Rs.set(e,o0(a0(r)))}return Rs.get(e)}function E(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var i=t[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=t[a+1]}),s0(i)}function c0(){Rs.clear(),El.clear()}function u0(){v1=!1}function l0(){Hs=!0}function p0(){Hs=!1}var Ia={gql:E,resetCaches:c0,disableFragmentWarnings:u0,enableExperimentalFragmentVariables:l0,disableExperimentalFragmentVariables:p0};(function(t){t.gql=Ia.gql,t.resetCaches=Ia.resetCaches,t.disableFragmentWarnings=Ia.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Ia.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Ia.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function k(t){if(!t)throw"Got no result from Apollo";if(t.error)throw t.error;if(t.errors)throw t.errors;return t.data}function f0(){}function li(){return f0}var Y=li,g=li,Ze=li,_e=li,G=li,Dt=li,d0=li,Gl=li,_1=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},S1=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Wi=class{constructor(e){this.code=e}};_1([g(),S1("design:type",String)],Wi.prototype,"code",void 0);Wi=_1([G(),S1("design:paramtypes",[String])],Wi);var Kl=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Zl=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ur=class{constructor(e,r){this.address=e,this.name=r}};Kl([g(),Zl("design:type",String)],ur.prototype,"address",void 0);Kl([g(),Zl("design:type",String)],ur.prototype,"name",void 0);ur=Kl([G(),Zl("design:paramtypes",[String,String])],ur);var Ie=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Qe=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Tr=class{constructor(e,r){this.key=r,this.signature=e}};Ie([g(),Qe("design:type",String)],Tr.prototype,"signature",void 0);Ie([g(),Qe("design:type",String)],Tr.prototype,"key",void 0);Ie([g(),Qe("design:type",Boolean)],Tr.prototype,"valid",void 0);Ie([g(),Qe("design:type",Boolean)],Tr.prototype,"invalid",void 0);Tr=Ie([G(),Ze(),Qe("design:paramtypes",[String,String])],Tr);var Hi=class{};Ie([g(),Qe("design:type",String)],Hi.prototype,"signature",void 0);Ie([g(),Qe("design:type",String)],Hi.prototype,"key",void 0);Ie([g(),Qe("design:type",Boolean)],Hi.prototype,"valid",void 0);Ie([g(),Qe("design:type",Boolean)],Hi.prototype,"invalid",void 0);Hi=Ie([Ze()],Hi);function pi(t){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return Ie([g(),Qe("design:type",String)],e.prototype,"author",void 0),Ie([g(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Ie([g(),Qe("design:type",Object)],e.prototype,"data",void 0),Ie([g(),Qe("design:type",Tr)],e.prototype,"proof",void 0),e=Ie([G(),Qe("design:paramtypes",[String,String,Object,Tr])],e),e}function h0(t){let e=class{};return Ie([g(),Qe("design:type",String)],e.prototype,"author",void 0),Ie([g(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Ie([g(),Qe("design:type",Object)],e.prototype,"data",void 0),Ie([g(),Qe("design:type",Hi)],e.prototype,"proof",void 0),e=Ie([Ze()],e),e}var Jd=class extends pi(){};Jd=Ie([G()],Jd);var Gs=class extends pi(){};Ie([g(),Qe("design:type",ur)],Gs.prototype,"language",void 0);Ie([g(),Qe("design:type",Wi)],Gs.prototype,"icon",void 0);Gs=Ie([G()],Gs);function v8(t){return t&&t.author&&t.timestamp&&t.data}var Ue=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},it=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Gi=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Ue([g(),it("design:type",String)],Gi.prototype,"source",void 0);Ue([g(),it("design:type",String)],Gi.prototype,"target",void 0);Ue([g(),it("design:type",String)],Gi.prototype,"predicate",void 0);Gi=Ue([G(),it("design:paramtypes",[Object])],Gi);var Ks=class{};Ue([g(),it("design:type",Array)],Ks.prototype,"additions",void 0);Ue([g(),it("design:type",Array)],Ks.prototype,"removals",void 0);Ks=Ue([Ze()],Ks);var Zs=class{constructor(e,r){this.additions=e,this.removals=r}};Ue([g(),it("design:type",Array)],Zs.prototype,"additions",void 0);Ue([g(),it("design:type",Array)],Zs.prototype,"removals",void 0);Zs=Ue([G(),it("design:paramtypes",[Array,Array])],Zs);var io=class{};Ue([g(),it("design:type",String)],io.prototype,"source",void 0);Ue([g(),it("design:type",String)],io.prototype,"target",void 0);Ue([g(),it("design:type",String)],io.prototype,"predicate",void 0);io=Ue([Ze()],io);var ni=class extends pi(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),r=(r<<5)-r+n,r|=0;return r}};Ue([g(),it("design:type",String)],ni.prototype,"status",void 0);ni=Ue([G()],ni);var xl=class extends h0(){};Ue([g(),it("design:type",String)],xl.prototype,"status",void 0);xl=Ue([Ze()],xl);function x8(t,e){return t.author==e.author&&t.timestamp==e.timestamp&&t.data.source==e.data.source&&t.data.predicate==e.data.predicate&&t.data.target==e.data.target}function A8(t){return t&&t.source&&t.target}var Js=class{constructor(e,r){this.oldLink=e,this.newLink=r}};Ue([g(),it("design:type",ni)],Js.prototype,"oldLink",void 0);Ue([g(),it("design:type",ni)],Js.prototype,"newLink",void 0);Js=Ue([G(),it("design:paramtypes",[ni,ni])],Js);var nn=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},yo=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Al,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 r=JSON.parse(JSON.stringify(this.links));return r=r.filter(i=>i.data.predicate===e.predicate),e.limit&&(r=r.slice(0,e.limit)),r}getSingleTarget(e){delete e.target;let r=this.get(e);return r.length?r[0].data.target:null}};nn([g(),yo("design:type",Array)],fr.prototype,"links",void 0);fr=nn([G(),yo("design:paramtypes",[Array])],fr);var Ys=class{};nn([g(),yo("design:type",Array)],Ys.prototype,"links",void 0);Ys=nn([Ze()],Ys);var kl=Al=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new Al;return r.links.push(e),r}};nn([g(),yo("design:type",Array)],kl.prototype,"links",void 0);kl=Al=nn([Ze(),yo("design:paramtypes",[Array])],kl);var Ki=class extends pi(){};Ki=nn([G()],Ki);var q=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},B=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Xr=class{constructor(e,r){this.did=e,r?this.perspective=r: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([G(),B("design:paramtypes",[String,fr])],Xr);var Yd=class extends pi(){};Yd=q([G()],Yd);var ai=class{constructor(e,r,i,n,a,o){this.did=e,this.didSigningKeyId=r,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([G(),B("design:paramtypes",[String,String,String,String,String,String])],ai);var oi=class{constructor(e,r,i,n,a,o){this.did=e,this.didSigningKeyId=r,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([Ze(),B("design:paramtypes",[String,String,String,String,String,String])],oi);var Xs=class{constructor(e,r){this.signature=e,this.publicKey=r}};q([g(),B("design:type",String)],Xs.prototype,"signature",void 0);q([g(),B("design:type",String)],Xs.prototype,"publicKey",void 0);Xs=q([G(),B("design:paramtypes",[String,String])],Xs);var Bn=class{constructor(e,r){this.domain=e,this.pointers=r}};q([g(),B("design:type",String)],Bn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Bn.prototype,"pointers",void 0);Bn=q([G(),B("design:paramtypes",[String,Array])],Bn);var ec=class{constructor(e,r){this.with=e,this.can=r}};q([g(),B("design:type",Bn)],ec.prototype,"with",void 0);q([g(),B("design:type",Array)],ec.prototype,"can",void 0);ec=q([G(),B("design:paramtypes",[Bn,Array])],ec);var Ir=class{constructor(e,r,i,n,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};q([g(),B("design:type",String)],Ir.prototype,"appName",void 0);q([g(),B("design:type",String)],Ir.prototype,"appDesc",void 0);q([g(),B("design:type",String)],Ir.prototype,"appUrl",void 0);q([g(),B("design:type",String)],Ir.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],Ir.prototype,"capabilities",void 0);Ir=q([G(),B("design:paramtypes",[String,String,String,Array,String])],Ir);var Vn=class{constructor(e,r,i,n){this.requestId=e,this.auth=r,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",Ir)],Vn.prototype,"auth",void 0);Vn=q([G(),B("design:paramtypes",[String,Ir,String,Boolean])],Vn);var Qn=class{constructor(e,r){this.domain=e,this.pointers=r}};q([g(),B("design:type",String)],Qn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Qn.prototype,"pointers",void 0);Qn=q([Ze(),B("design:paramtypes",[String,Array])],Qn);var tc=class{constructor(e,r){this.with=e,this.can=r}};q([g(),B("design:type",Qn)],tc.prototype,"with",void 0);q([g(),B("design:type",Array)],tc.prototype,"can",void 0);tc=q([Ze(),B("design:paramtypes",[Qn,Array])],tc);var dr=class{constructor(e,r,i,n,a,o){this.appName=e,this.appDesc=r,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([Ze(),B("design:paramtypes",[String,String,String,String,String,Array])],dr);var Zi=class{constructor(e,r,i){this.did=e,this.success=r,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([G(),B("design:paramtypes",[String,Boolean,String])],Zi);var Jn=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Yn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,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([G(),Yn("design:paramtypes",[Object])],Mt);var Xd=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Le=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},yt,vt,Tl=class{constructor(e,r){yt.set(this,void 0),vt.set(this,void 0),Xd(this,yt,e,"f"),Xd(this,vt,r,"f")}async otherAgents(){return await Le(this,yt,"f").otherAgents(Le(this,vt,"f"))}async hasTelepresenceAdapter(){return await Le(this,yt,"f").hasTelepresenceAdapter(Le(this,vt,"f"))}async onlineAgents(){return await Le(this,yt,"f").onlineAgents(Le(this,vt,"f"))}async setOnlineStatus(e){return await Le(this,yt,"f").setOnlineStatus(Le(this,vt,"f"),e)}async setOnlineStatusU(e){return await Le(this,yt,"f").setOnlineStatusU(Le(this,vt,"f"),e)}async sendSignal(e,r){return await Le(this,yt,"f").sendSignal(Le(this,vt,"f"),e,r)}async sendSignalU(e,r){return await Le(this,yt,"f").sendSignalU(Le(this,vt,"f"),e,r)}async sendBroadcast(e,r=!1){return await Le(this,yt,"f").sendBroadcast(Le(this,vt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await Le(this,yt,"f").sendBroadcastU(Le(this,vt,"f"),e,r)}async addSignalHandler(e){await Le(this,yt,"f").addSignalHandler(Le(this,vt,"f"),e)}removeSignalHandler(e){Le(this,yt,"f").removeSignalHandler(Le(this,vt,"f"),e)}};yt=new WeakMap,vt=new WeakMap;var an=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},on=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,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)}};an([g(),on("design:type",String)],ot.prototype,"source",void 0);an([g(),on("design:type",String)],ot.prototype,"target",void 0);an([g(),on("design:type",String)],ot.prototype,"predicate",void 0);an([g(),on("design:type",Date)],ot.prototype,"fromDate",void 0);an([g(),on("design:type",Date)],ot.prototype,"untilDate",void 0);an([g(),on("design:type",Number)],ot.prototype,"limit",void 0);ot=an([G(),Ze(),on("design:paramtypes",[Object])],ot);var eh=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},tt=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},bt,wr;function gs(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var wt=class{constructor(){bt.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 r=new wt;return eh(r,wr,e,"f"),r}static from(e){let r=new wt;return eh(r,bt,e,"f"),r}toUrl(){if(tt(this,wr,"f")&&!tt(this,bt,"f"))return tt(this,wr,"f");if(!tt(this,wr,"f")&&(tt(this,bt,"f")===void 0||tt(this,bt,"f")===""||tt(this,bt,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof tt(this,bt,"f")){case"string":e=`string:${gs(tt(this,bt,"f"))}`;break;case"number":e=`number:${gs(tt(this,bt,"f"))}`;break;case"boolean":e=`boolean:${gs(tt(this,bt,"f"))}`;break;case"object":e=`json:${gs(JSON.stringify(tt(this,bt,"f")))}`;break}return`literal://${e}`}get(){if(tt(this,bt,"f"))return tt(this,bt,"f");if(!tt(this,wr,"f"))throw new Error("Can't render empty Literal");if(!tt(this,wr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=tt(this,wr,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let r=e.substring(7);return parseFloat(r)}if(e.startsWith("json:")){let r=e.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${e}`)}};bt=new WeakMap,wr=new WeakMap;function ei(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Jl(t){return`set${ei(t)}`}function kr(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function Yl(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function m0(t){return`add${ei(Yl(t))}`}function g0(t){let e=t.substring(3),r=kr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function y0(t){return`remove${ei(Yl(t))}`}function v0(t){let e=t.substring(6),r=kr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function b0(t){let e=t.substring(13),r=kr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function _0(t){return`setCollection${ei(Yl(t))}`}function Di(t){if(Array.isArray(t))return`[${t.map(Di).join(", ")}]`;let e=Object.keys(t),r=[];for(let i of e){let n=JSON.stringify(t[i]),a=`${i}: ${n}`;r.push(a)}return`{${r.join(", ")}}`}var nl=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},J=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},lt,pt,De,rc=class{constructor(t,e,r){lt.set(this,void 0),pt.set(this,void 0),De.set(this,void 0),nl(this,lt,e,"f"),nl(this,pt,r,"f"),nl(this,De,t,"f")}get baseExpression(){return J(this,lt,"f")}async init(){let isInstance=await J(this,De,"f").isSubjectInstance(J(this,lt,"f"),J(this,pt,"f"));if(!isInstance)throw`Not a valid subject instance of ${J(this,pt,"f")} for ${J(this,lt,"f")}`;let results=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property_resolve(C, "${t}")`);Object.defineProperty(this,t,{configurable:!0,get:async()=>{let r=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property_getter(C, "${J(this,lt,"f")}", "${t}", Value)`);if(r&&r.length>0){let i=r[0].Value;if(e)try{if(i){let n=await J(this,De,"f").getExpression(i);try{return JSON.parse(n.data)}catch{return n.data}}else return i}catch{return i}else return i}else return r||void 0}})}let setters=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Jl(property)]=async t=>{resolveLanguage&&(t=await J(this,De,"f").createExpression(t,resolveLanguage)),await J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:t}])}}let results2=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(t=>t.Collection);for(let t of collections)Object.defineProperty(this,t,{configurable:!0,get:async()=>{let e=await J(this,De,"f").infer(`subject_class("${J(this,pt,"f")}", C), collection_getter(C, "${J(this,lt,"f")}", "${t}", Value)`);return e&&e.length>0&&e[0].Value?e[0].Value.filter(i=>i!==""&&i!==""):[]}});let adders=await J(this,De,"f").infer(`subject_class("${J(this,pt,"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[m0(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:e}]))):await J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:t}])}}let removers=await J(this,De,"f").infer(`subject_class("${J(this,pt,"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[y0(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:e}]))):await J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:t}])}}let collectionSetters=await J(this,De,"f").infer(`subject_class("${J(this,pt,"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[_0(collection)]=async t=>{Array.isArray(t)?await J(this,De,"f").executeAction(actions,J(this,lt,"f"),t.map(e=>({name:"value",value:e}))):await J(this,De,"f").executeAction(actions,J(this,lt,"f"),[{name:"value",value:t}])}}}};lt=new WeakMap,pt=new WeakMap,De=new WeakMap;var be=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},T=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},Ps,Cr,ir,nr,ji,Gr,Kr,Ni,Pa,$s,Ri,Pi,Lt,Mn,Il,de,ge,$i,Li,Fi,$a,ic=class{constructor(e,r,i){Ps.add(this),Cr.set(this,void 0),ir.set(this,void 0),nr.set(this,void 0),ji.set(this,void 0),Gr.set(this,void 0),Kr.set(this,void 0),Ni.set(this,void 0),Pa.set(this,!1),$s.set(this,void 0),Ri.set(this,void 0),Pi.set(this,void 0),Lt.set(this,void 0),Mn.set(this,void 0),this.isSurrealDB=!1,be(this,Cr,e,"f"),be(this,Mn,r,"f"),be(this,nr,i,"f"),be(this,ji,new Set,"f"),be(this,Ni,null,"f"),be(this,$s,new Promise((n,a)=>{be(this,Ri,n,"f"),be(this,Pi,a,"f")}),"f")}async subscribe(){T(this,Kr,"f")&&(T(this,Kr,"f").call(this),be(this,Kr,void 0,"f")),T(this,Lt,"f")&&(clearTimeout(T(this,Lt,"f")),be(this,Lt,void 0,"f")),T(this,Gr,"f")&&(clearTimeout(T(this,Gr,"f")),be(this,Gr,void 0,"f"));try{let r;this.isSurrealDB?r=await T(this,nr,"f").perspectiveSubscribeSurrealQuery(T(this,Cr,"f"),T(this,Mn,"f")):r=await T(this,nr,"f").subscribeQuery(T(this,Cr,"f"),T(this,Mn,"f")),be(this,ir,r.subscriptionId,"f"),r.result?(be(this,Ni,r.result,"f"),T(this,Ps,"m",Il).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),be(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"),be(this,Kr,T(this,nr,"f").subscribeToQueryUpdates(T(this,ir,"f"),i=>{T(this,Lt,"f")&&(clearTimeout(T(this,Lt,"f")),be(this,Lt,void 0,"f")),T(this,Ri,"f")&&(T(this,Ri,"f").call(this,!0),be(this,Ri,void 0,"f"),be(this,Pi,void 0,"f")),!(i.isInit&&T(this,Ni,"f"))&&(be(this,Ni,i,"f"),T(this,Ps,"m",Il).call(this,i))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),T(this,Pi,"f")&&(T(this,Pi,"f").call(this,r),be(this,Ri,void 0,"f"),be(this,Pi,void 0,"f")),r}let e=async()=>{if(!T(this,Pa,"f")){try{this.isSurrealDB?await T(this,nr,"f").perspectiveKeepAliveSurrealQuery(T(this,Cr,"f"),T(this,ir,"f")):await T(this,nr,"f").keepAliveQuery(T(this,Cr,"f"),T(this,ir,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",T(this,Mn,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}T(this,Pa,"f")||be(this,Gr,setTimeout(e,3e4),"f")}};be(this,Gr,setTimeout(e,3e4),"f")}get id(){return T(this,ir,"f")}get initialized(){return T(this,$s,"f")}get result(){return T(this,Ni,"f")}onResult(e){return T(this,ji,"f").add(e),()=>T(this,ji,"f").delete(e)}dispose(){be(this,Pa,!0,"f"),clearTimeout(T(this,Gr,"f")),T(this,Kr,"f")&&T(this,Kr,"f").call(this),T(this,ji,"f").clear(),T(this,Lt,"f")&&(clearTimeout(T(this,Lt,"f")),be(this,Lt,void 0,"f")),T(this,ir,"f")&&(this.isSurrealDB?T(this,nr,"f").perspectiveDisposeSurrealQuerySubscription(T(this,Cr,"f"),T(this,ir,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):T(this,nr,"f").disposeQuerySubscription(T(this,Cr,"f"),T(this,ir,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Cr=new WeakMap,ir=new WeakMap,nr=new WeakMap,ji=new WeakMap,Gr=new WeakMap,Kr=new WeakMap,Ni=new WeakMap,Pa=new WeakMap,$s=new WeakMap,Ri=new WeakMap,Pi=new WeakMap,Lt=new WeakMap,Mn=new WeakMap,Ps=new WeakSet,Il=function t(e){for(let r of T(this,ji,"f"))try{r(e)}catch(i){console.error("Error in query subscription callback:",i)}};var jn=class{constructor(t,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),$a.set(this,void 0),be(this,$i,[],"f"),be(this,Li,[],"f"),be(this,Fi,[],"f"),be(this,$a,[],"f"),be(this,de,t,"f"),be(this,ge,e,"f"),this.uuid=T(this,de,"f").uuid,this.name=T(this,de,"f").name,this.owners=T(this,de,"f").owners,this.sharedUrl=T(this,de,"f").sharedUrl,this.neighbourhood=T(this,de,"f").neighbourhood,this.state=T(this,de,"f").state,T(this,ge,"f").addPerspectiveLinkAddedListener(T(this,de,"f").uuid,T(this,$i,"f")),T(this,ge,"f").addPerspectiveLinkRemovedListener(T(this,de,"f").uuid,T(this,Li,"f")),T(this,ge,"f").addPerspectiveLinkUpdatedListener(T(this,de,"f").uuid,T(this,Fi,"f")),T(this,ge,"f").addPerspectiveSyncStateChangeListener(T(this,de,"f").uuid,T(this,$a,"f"))}async executeAction(t,e,r,i){return await T(this,ge,"f").executeCommands(T(this,de,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),i)}async get(t){return await T(this,ge,"f").queryLinks(T(this,de,"f").uuid,t)}async infer(t){return await T(this,ge,"f").queryProlog(T(this,de,"f").uuid,t)}async querySurrealDB(t){return await T(this,ge,"f").querySurrealDB(T(this,de,"f").uuid,t)}async add(t,e="shared",r){return await T(this,ge,"f").addLink(T(this,de,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await T(this,ge,"f").addLinks(T(this,de,"f").uuid,t,e,r)}async removeLinks(t,e){return await T(this,ge,"f").removeLinks(T(this,de,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await T(this,ge,"f").linkMutations(T(this,de,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await T(this,ge,"f").addLinkExpression(T(this,de,"f").uuid,t,e,r)}async update(t,e,r){return await T(this,ge,"f").updateLink(T(this,de,"f").uuid,t,e,r)}async remove(t,e){return await T(this,ge,"f").removeLink(T(this,de,"f").uuid,t,e)}async createBatch(){return await T(this,ge,"f").createBatch(T(this,de,"f").uuid)}async commitBatch(t){return await T(this,ge,"f").commitBatch(T(this,de,"f").uuid,t)}async getExpression(t){return await T(this,ge,"f").getExpression(t)}async createExpression(t,e){return await T(this,ge,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?T(this,$i,"f").push(e):t==="link-removed"?T(this,Li,"f").push(e):t==="link-updated"&&T(this,Fi,"f").push(e)}async addSyncStateChangeListener(t){T(this,$a,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=T(this,$i,"f").indexOf(e);T(this,$i,"f").splice(r,1)}else if(t==="link-removed"){let r=T(this,Li,"f").indexOf(e);T(this,Li,"f").splice(r,1)}else if(t==="link-updated"){let r=T(this,Fi,"f").indexOf(e);T(this,Fi,"f").splice(r,1)}}async snapshot(){return T(this,ge,"f").snapshotByUUID(T(this,de,"f").uuid)}async loadSnapshot(t){let e=JSON.parse(JSON.stringify(t));delete e.__typename,e.links.forEach(r=>{delete r.data.__typename});for(let r of e.links)await this.addLinkExpression(r)}async getSingleTarget(t){delete t.target;let e=await this.get(t);return e.length?e[0].data.target:null}async setSingleTarget(t,e="shared"){let r=new ot({source:t.source,predicate:t.predicate}),i=await this.get(r),n=[];for(let o of i)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,n.push(o);let a=[t];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(t){return(await this.infer(`flowable("${t}", F), register_sdna_flow(X, F)`)).map(r=>r.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(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state(X, ${e}, F)`)).map(i=>i.X)}async flowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(t,e){return(await this.infer(`register_sdna_flow("${t}", 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 t=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let r of t){let i=await this.get(new ot({source:"ad4m://self",predicate:r}));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 u=wt.fromUrl(s.data.target).get();typeof u=="string"&&e.push(u)}}}return e}async getSdnaForClass(t){let e=wt.from(t);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=wt.fromUrl(i[0].data.target).get();return typeof n=="string"?n:null}async addSdna(t,e,r){return T(this,ge,"f").addSdna(T(this,de,"f").uuid,t,e,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(t=>t.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(t){if(typeof t=="string")return t;{let e=await this.subjectClassesByTemplate(t);return e[0]?e[0]:t.className}}async createSubject(t,e,r,i){let n;if(typeof t=="string")n=t,await T(this,ge,"f").createSubject(T(this,de,"f").uuid,JSON.stringify({className:n,initialValues:r}),e,r?JSON.stringify(r):void 0,i);else{let a=this.buildQueryFromTemplate(t);await T(this,ge,"f").createSubject(T(this,de,"f").uuid,JSON.stringify({query:a,initialValues:r}),e,r?JSON.stringify(r):void 0,i)}return i?e:this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await T(this,ge,"f").getSubjectData(T(this,de,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await T(this,ge,"f").getSubjectData(T(this,de,"f").uuid,JSON.stringify({query:r}),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(t,e){let r=await this.stringOrTemplateObjectToSubjectClassName(e),i=!1,n=5,a=0;for(;a<n&&!i;)i=await this.infer(`subject_class("${r}", C), instance(C, "${t}")`),a++;return i}async getSubjectProxy(t,e){if(!await this.isSubjectInstance(t,e))throw`Expression ${t} is not a subject instance of given class: ${JSON.stringify(e)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(e),i=new rc(this,t,r);return await i.init(),i}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let i of e){let n=await this.infer(`subject_class("${i}", C), instance(C, X)`),a=await Promise.all(n.map(async o=>await this.getSubjectProxy(o.X,i)));r=r.concat(a)}return r}async getAllSubjectProxies(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let i of e)r=await this.infer(`subject_class("${i}", C), instance(C, X)`);return r}buildQueryFromTemplate(t){let e;return function(r){let i=[],n=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>i.push(l)):i.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>{n.includes(l)||n.push(l)}):n.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let u=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));u=u.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let l of i)c+=`, property(C, "${l}")`;for(let l of n)c+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),c+=`, property_setter(C, "${d}", _)`}for(let l of o)c+=`, collection_adder(C, "${g0(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${v0(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${b0(l)}", _)`;c+=".",e=c}(t),e}async subjectClassesByTemplate(t){let e=this.buildQueryFromTemplate(t),r=await this.infer(e);return r?r.map(i=>i.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:i}=t.generateSDNA();await this.addSdna(r,i,"subject_class")}getNeighbourhoodProxy(){return T(this,ge,"f").getNeighbourhoodProxy(T(this,de,"f").uuid)}get ai(){return T(this,ge,"f").aiClient}async subscribeInfer(t){let e=new ic(this.uuid,t,T(this,ge,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new ic(this.uuid,t,T(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,$a=new WeakMap;var zr=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Q=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},ie,La,Fa,Ma,Ls,Ua,Fs,Ms,ut=`
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
@@ -87,139 +87,139 @@ neighbourhood {
87
87
  }
88
88
  author
89
89
  }
90
- `,nc=class{constructor(e,r=!0){ie.set(this,void 0),La.set(this,void 0),Fa.set(this,void 0),Ma.set(this,void 0),Ls.set(this,void 0),Ua.set(this,void 0),Fs.set(this,void 0),Ms.set(this,void 0),zr(this,ie,e,"f"),zr(this,La,[],"f"),zr(this,Fa,[],"f"),zr(this,Ma,[],"f"),zr(this,Ls,[],"f"),r&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){zr(this,Ua,e,"f")}setNeighbourhoodClient(e){zr(this,Fs,e,"f")}setAIClient(e){zr(this,Ms,e,"f")}get aiClient(){return Q(this,Ms,"f")}async all(){let{perspectives:e}=k(await Q(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
92
  ${Nn}
93
93
  }
94
- }`}));return e.map(r=>new jn(r,this))}async byUUID(e){let{perspective:r}=k(await Q(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
96
  ${Nn}
97
97
  }
98
- }`,variables:{uuid:e}}));return r?new jn(r,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:r}=k(await Q(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 { ${ut} }
100
+ links { ${ht} }
101
101
  }
102
- }`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=k(await Q(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 r}async queryLinks(e,r){let{perspectiveQueryLinks:i}=k(await Q(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
- ${ut}
106
+ ${ht}
107
107
  }
108
- }`,variables:{uuid:e,query:r}}));return i}async queryProlog(e,r){let{perspectiveQueryProlog:i}=k(await Q(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:r}}));return JSON.parse(i)}async querySurrealDB(e,r){let{perspectiveQuerySurrealDb:i}=k(await Q(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:r}}));return JSON.parse(i)}async subscribeQuery(e,r){let{perspectiveSubscribeQuery:i}=k(await Q(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:r}})),{subscriptionId:n,result:a}=i,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(u){console.error("Error parsing perspectiveSubscribeQuery result:",u)}return{subscriptionId:n,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,r){let{perspectiveSubscribeSurrealQuery:i}=k(await Q(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:r}})),{subscriptionId:n,result:a}=i,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(u){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",u)}return{subscriptionId:n,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,r){let{perspectiveKeepAliveSurrealQuery:i}=k(await Q(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:r}}));return i}async perspectiveDisposeSurrealQuerySubscription(e,r){let{perspectiveDisposeSurrealQuerySubscription:i}=k(await Q(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:r}}));return i}subscribeToQueryUpdates(e,r){let i=Q(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)}r(a)}},error:n=>console.error("Error in query subscription:",n)});return()=>i.unsubscribe()}async keepAliveQuery(e,r){let{perspectiveKeepAliveQuery:i}=k(await Q(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:r}}));return i}async disposeQuerySubscription(e,r){let{perspectiveDisposeQuerySubscription:i}=k(await Q(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:r}}));return i}async add(e){let{perspectiveAdd:r}=k(await Q(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
136
  ${Nn}
137
137
  }
138
- }`,variables:{name:e}}));return new jn(r,this)}async update(e,r){let{perspectiveUpdate:i}=k(await Q(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
140
  ${Nn}
141
141
  }
142
- }`,variables:{uuid:e,name:r}}));return new jn(i,this)}async remove(e){return k(await Q(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,r,i="shared",n){let{perspectiveAddLink:a}=k(await Q(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
- ${ut}
146
+ ${ht}
147
147
  }
148
- }`,variables:{uuid:e,link:r,status:i,batchId:n}}));return a}async addLinks(e,r,i="shared",n){let{perspectiveAddLinks:a}=k(await Q(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
- ${ut}
150
+ ${ht}
151
151
  }
152
- }`,variables:{uuid:e,links:r,status:i,batchId:n}}));return a}async removeLinks(e,r,i){let{perspectiveRemoveLinks:n}=k(await Q(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
- ${ut}
154
+ ${ht}
155
155
  }
156
- }`,variables:{uuid:e,links:r,batchId:i}}));return n}async linkMutations(e,r,i){let{perspectiveLinkMutations:n}=k(await Q(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
- ${ut}
159
+ ${ht}
160
160
  }
161
161
  removals {
162
- ${ut}
162
+ ${ht}
163
163
  }
164
164
  }
165
- }`,variables:{uuid:e,mutations:r,status:i}}));return n}async addLinkExpression(e,r,i="shared",n){let{perspectiveAddLinkExpression:a}=k(await Q(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
- ${ut}
167
+ ${ht}
168
168
  }
169
- }`,variables:{uuid:e,link:r,status:i,batchId:n}}));return a}async updateLink(e,r,i,n){let{perspectiveUpdateLink:a}=k(await Q(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
- ${ut}
171
+ ${ht}
172
172
  }
173
- }`,variables:{uuid:e,oldLink:r,newLink:i,batchId:n}}));return a}async removeLink(e,r,i){delete r.__typename,delete r.data.__typename,delete r.proof.__typename,delete r.status;let{perspectiveRemoveLink:n}=k(await Q(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:r,batchId:i}}));return n}async addSdna(e,r,i,n){return k(await Q(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:r,sdnaCode:i,sdnaType:n}})).perspectiveAddSdna}async executeCommands(e,r,i,n,a){return k(await Q(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:r,expression:i,parameters:n,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,r,i,n,a){return k(await Q(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:r,expressionAddress:i,initialValues:n,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,r,i){return k(await Q(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:r,expressionAddress:i}})).perspectiveGetSubjectData}async getExpression(e){return await Q(this,Ua,"f").get(e)}async createExpression(e,r){return await Q(this,Ua,"f").create(e,r)}addPerspectiveAddedListener(e){Q(this,La,"f").push(e)}subscribePerspectiveAdded(){Q(this,ie,"f").subscribe({query:E` subscription {
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
184
  perspectiveAdded { ${Nn} }
185
185
  }
186
- `}).subscribe({next:e=>{Q(this,La,"f").forEach(r=>{r(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){Q(this,Fa,"f").push(e)}subscribePerspectiveUpdated(){Q(this,ie,"f").subscribe({query:E` subscription {
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
187
  perspectiveUpdated { ${Nn} }
188
188
  }
189
- `}).subscribe({next:e=>{Q(this,Fa,"f").forEach(r=>{r(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){Q(this,Ls,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,r){Q(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=>{r.forEach(n=>{n(i.data.perspectiveSyncStateChange)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}addPerspectiveRemovedListener(e){Q(this,Ma,"f").push(e)}subscribePerspectiveRemoved(){Q(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=>{Q(this,Ma,"f").forEach(r=>{r(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,r){Q(this,ie,"f").subscribe({query:E` subscription {
196
- perspectiveLinkAdded(uuid: "${e}") { ${ut} }
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=>{r.forEach(n=>{n(i.data.perspectiveLinkAdded)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkRemovedListener(e,r){Q(this,ie,"f").subscribe({query:E` subscription {
199
- perspectiveLinkRemoved(uuid: "${e}") { ${ut} }
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=>{r.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,r){Q(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
- ${ut}
204
+ ${ht}
205
205
  }
206
206
  newLink {
207
- ${ut}
207
+ ${ht}
208
208
  }
209
209
  }
210
210
  }
211
- `}).subscribe({next:i=>{r.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 Tl(Q(this,Fs,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:r}=k(await Q(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 r}async commitBatch(e,r){let{perspectiveCommitBatch:i}=k(await Q(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
- ${ut}
216
+ ${ht}
217
217
  }
218
218
  removals {
219
- ${ut}
219
+ ${ht}
220
220
  }
221
221
  }
222
- }`,variables:{uuid:e,batchId:r}}));return i}};ie=new WeakMap,La=new WeakMap,Fa=new WeakMap,Ma=new WeakMap,Ls=new WeakMap,Ua=new WeakMap,Fs=new WeakMap,Ms=new WeakMap;var ys=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},ce=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},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
- `,vs=`
236
+ `,Ss=`
237
237
  requestId
238
238
  revoked
239
239
  auth {
@@ -255,27 +255,27 @@ neighbourhood {
255
255
  did
256
256
  didDocument
257
257
  error
258
- `,bs=`
258
+ `,ws=`
259
259
  did
260
260
  didSigningKeyId
261
261
  deviceKeyType
262
262
  deviceKey
263
263
  deviceKeySignedByDid
264
264
  didSignedByDeviceKey
265
- `,S0=`
265
+ `,E0=`
266
266
  signature
267
267
  publicKey
268
- `,no=class{constructor(e,r=!0){he.set(this,void 0),ja.set(this,void 0),qa.set(this,void 0),Ba.set(this,void 0),ys(this,he,e,"f"),ys(this,qa,[],"f"),ys(this,Ba,[],"f"),ys(this,ja,[],"f"),r&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await ce(this,he,"f").query({query:E`query agent { agent { ${Oa} } }`})),r=new Xr(e.did,e.perspective);return r.directMessageLanguage=e.directMessageLanguage,r}async status(){let{agentStatus:e}=k(await ce(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
270
  ${Rn}
271
271
  }
272
- }`}));return new Mt(e)}async generate(e){let{agentGenerate:r}=k(await ce(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
276
  ${Rn}
277
277
  }
278
- }`,variables:{passphrase:e}}));return new Mt(r)}async import(e){let{did:r,didDocument:i,keystore:n,passphrase:a}=e,{agentImport:o}=k(await ce(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!,
@@ -284,110 +284,110 @@ neighbourhood {
284
284
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
285
285
  ${Rn}
286
286
  }
287
- }`,variables:{did:r,didDocument:i,keystore:n,passphrase:a}}));return new Mt(o)}async lock(e){let{agentLock:r}=k(await ce(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
289
  ${Rn}
290
290
  }
291
- }`,variables:{passphrase:e}}));return new Mt(r)}async unlock(e,r=!0){let{agentUnlock:i}=k(await ce(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
293
  ${Rn}
294
294
  }
295
- }`,variables:{passphrase:e,holochain:r}}));return new Mt(i)}async byDID(e){let{agentByDID:r}=k(await ce(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 r}async updatePublicPerspective(e){let r=JSON.parse(JSON.stringify(e));delete r.__typename,r.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:i}=k(await ce(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:r}})),n=i,a=new Xr(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new nc(ce(this,he,"f")),i=new no(ce(this,he,"f")),n=await r.add("Agent Perspective Proxy"),a=await i.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let u of e.additions)await n.add(u);for(let u of e.removals)await n.remove(u);let o=await n.snapshot(),s=await this.updatePublicPerspective(o);return await r.remove(n.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:r}=k(await ce(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=r,n=new Xr(i.did,i.perspective);return n.directMessageLanguage=i.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=k(await ce(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
- ${bs}
309
+ ${ws}
310
310
  }
311
- }`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=k(await ce(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
- ${bs}
313
+ ${ws}
314
314
  }
315
- }`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await ce(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
- ${bs}
317
+ ${ws}
318
318
  }
319
- }`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:i}=k(await ce(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
- ${bs}
321
+ ${ws}
322
322
  }
323
- }`,variables:{deviceKey:e,deviceKeyType:r}}));return i}addUpdatedListener(e){ce(this,qa,"f").push(e)}addAppChangedListener(e){ce(this,ja,"f").push(e)}subscribeAgentUpdated(){ce(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 r=e.data.agentUpdated;ce(this,qa,"f").forEach(i=>{i(r)})},error:e=>console.error(e)})}subscribeAppsChanged(){ce(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
- ${vs}
328
+ ${Ss}
329
329
  }
330
330
  }
331
- `}).subscribe({next:e=>{ce(this,ja,"f").forEach(r=>{r()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){ce(this,Ba,"f").push(e)}subscribeAgentStatusChanged(){ce(this,he,"f").subscribe({query:E` subscription {
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
332
  agentStatusChanged { ${Rn} }
333
333
  }
334
- `}).subscribe({next:e=>{let r=e.data.agentStatusChanged;ce(this,Ba,"f").forEach(i=>{i(r)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:r}=k(await ce(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 r}async permitCapability(e){let{agentPermitCapability:r}=k(await ce(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 r}async generateJwt(e,r){let{agentGenerateJwt:i}=k(await ce(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:r}}));return i}async getApps(){let{agentGetApps:e}=k(await ce(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
- ${vs}
348
+ ${Ss}
349
349
  }
350
- }`}));return e}async removeApp(e){let{agentRemoveApp:r}=k(await ce(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
- ${vs}
352
+ ${Ss}
353
353
  }
354
- }`,variables:{requestId:e}}));return r}async revokeToken(e){let{agentRevokeToken:r}=k(await ce(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
- ${vs}
356
+ ${Ss}
357
357
  }
358
- }`,variables:{requestId:e}}));return r}async isLocked(){let{agentIsLocked:e}=k(await ce(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:r}=k(await ce(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
- ${S0}
364
+ ${E0}
365
365
  }
366
- }`,variables:{message:e}}));return r}async createUser(e,r,i){let{runtimeCreateUser:n}=k(await ce(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:r,appInfo:i}}));return n}async loginUser(e,r){let{runtimeLoginUser:i}=k(await ce(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:r}}));return i}async requestLoginVerification(e,r){let{runtimeRequestLoginVerification:i}=k(await ce(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:r}}));return i}async verifyEmailCode(e,r,i){let{runtimeVerifyEmailCode:n}=k(await ce(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:r,verificationType:i}}));return n}};he=new WeakMap,ja=new WeakMap,qa=new WeakMap,Ba=new WeakMap;var w0=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Wr=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},Ht,th=`
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
- `,rh=`
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
- `,Ol=class{constructor(e){Ht.set(this,void 0),w0(this,Ht,e,"f")}async byAddress(e){let{language:r}=k(await Wr(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
- ${th}
402
+ ${nh}
403
403
  }
404
- }`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=k(await Wr(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
- ${th}
406
+ ${nh}
407
407
  }
408
- }`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:i}=k(await Wr(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:r}}));return i}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:i}=k(await Wr(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:r}}));return i}async publish(e,r){let{languagePublish:i}=k(await Wr(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
- ${rh}
422
+ ${ah}
423
423
  }
424
- }`,variables:{languagePath:e,languageMeta:r}}));return i}async meta(e){let{languageMeta:r}=k(await Wr(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
- ${rh}
428
+ ${ah}
429
429
  }
430
- }`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=k(await Wr(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 r}async remove(e){let{languageRemove:r}=k(await Wr(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 r}};Ht=new WeakMap;var C0=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},at=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},ft,Un,Dl=class{constructor(e){ft.set(this,void 0),Un.set(this,new Map),C0(this,ft,e,"f")}async publishFromPerspective(e,r,i){let{neighbourhoodPublishFromPerspective:n}=k(await at(this,ft,"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:r,meta:i}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=k(await at(this,ft,"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 r}async otherAgents(e){let{neighbourhoodOtherAgents:r}=k(await at(this,ft,"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 r}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:r}=k(await at(this,ft,"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 r}async onlineAgents(e){let{neighbourhoodOnlineAgents:r}=k(await at(this,ft,"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 r}async setOnlineStatus(e,r){let{neighbourhoodSetOnlineStatus:i}=k(await at(this,ft,"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:r}}));return i}async setOnlineStatusU(e,r){let{neighbourhoodSetOnlineStatusU:i}=k(await at(this,ft,"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:r}}));return i}async sendSignal(e,r,i){let{neighbourhoodSendSignal:n}=k(await at(this,ft,"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:r,payload:i}}));return n}async sendSignalU(e,r,i){let{neighbourhoodSendSignalU:n}=k(await at(this,ft,"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:r,payload:i}}));return n}async sendBroadcast(e,r,i=!1){let{neighbourhoodSendBroadcast:n}=k(await at(this,ft,"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:r,loopback:i}}));return n}async sendBroadcastU(e,r,i=!1){let{neighbourhoodSendBroadcastU:n}=k(await at(this,ft,"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:r,loopback:i}}));return n}dispatchSignal(e,r){let i=at(this,Un,"f").get(e);i&&i.forEach(n=>n(r))}async subscribeToSignals(e){let r=this;await at(this,ft,"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);r.dispatchSignal(e,n)}})}async addSignalHandler(e,r){let i=at(this,Un,"f").get(e);i||(i=[],at(this,Un,"f").set(e,i),await this.subscribeToSignals(e)),i.push(r)}removeSignalHandler(e,r){let i=at(this,Un,"f").get(e);if(i){let n=i.indexOf(r);n>-1&&i.splice(n,1)}}};ft=new WeakMap,Un=new WeakMap;var _s=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},z=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},K,Va,Qa,za,w1,Ss=`
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
- `,E0=`
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
- `,C1=`
583
+ `,A1=`
584
584
  id
585
585
  granted
586
- ${E0}
587
- `,x0=`
588
- notification { ${C1} }
586
+ ${A0}
587
+ `,k0=`
588
+ notification { ${A1} }
589
589
  perspectiveId
590
590
  triggerMatch
591
- `,Nl=class{constructor(e,r=!0){K.set(this,void 0),Va.set(this,void 0),Qa.set(this,void 0),za.set(this,void 0),w1.set(this,void 0),_s(this,K,e,"f"),_s(this,Va,[],"f"),_s(this,Qa,[],"f"),_s(this,za,[],"f"),r&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await z(this,K,"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 z(this,K,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:r}=k(await z(this,K,"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 r}async addTrustedAgents(e){let{addTrustedAgents:r}=k(await z(this,K,"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 r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=k(await z(this,K,"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 r}async getTrustedAgents(){let{getTrustedAgents:e}=k(await z(this,K,"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:r}=k(await z(this,K,"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 r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=k(await z(this,K,"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 r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await z(this,K,"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:r}=k(await z(this,K,"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 r}async removeFriends(e){let{runtimeRemoveFriends:r}=k(await z(this,K,"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 r}async friends(){let{runtimeFriends:e}=k(await z(this,K,"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 z(this,K,"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 z(this,K,"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 z(this,K,"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:r}=k(await z(this,K,"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 r}async verifyStringSignedByDid(e,r,i,n){let{runtimeVerifyStringSignedByDid:a}=k(await z(this,K,"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:r,data:i,signedData:n}}));return a}async setStatus(e){let{runtimeSetStatus:r}=k(await z(this,K,"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 r}async friendStatus(e){let{runtimeFriendStatus:r}=k(await z(this,K,"f").query({query:E`query runtimeFriendStatus($did: String!) {
630
- runtimeFriendStatus(did: $did) { ${Ss} }
631
- }`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:i}=k(await z(this,K,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
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
+ 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:C`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
632
632
  runtimeFriendSendMessage(did: $did, message: $message)
633
- }`,variables:{did:e,message:r}}));return i}async messageInbox(e){let{runtimeMessageInbox:r}=k(await z(this,K,"f").query({query:E`query runtimeMessageInbox($filter: String) {
634
- runtimeMessageInbox(filter: $filter) { ${Ss} }
635
- }`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=k(await z(this,K,"f").query({query:E`query runtimeMessageOutbox($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
+ runtimeMessageInbox(filter: $filter) { ${Cs} }
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
- ${Ss}
639
+ ${Cs}
640
640
  }
641
641
  }
642
- }`,variables:{filter:e}}));return r}async requestInstallNotification(e){let{runtimeRequestInstallNotification:r}=k(await z(this,K,"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 r}async grantNotification(e){let{runtimeGrantNotification:r}=k(await z(this,K,"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 r}async exportDb(e){let{runtimeExportDb:r}=k(await z(this,K,"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 r}async importDb(e){let{runtimeImportDb:r}=k(await z(this,K,"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 r}async notifications(){let{runtimeNotifications:e}=k(await z(this,K,"f").query({query:E`query runtimeNotifications {
663
- runtimeNotifications { ${C1} }
664
- }`}));return e}async updateNotification(e,r){let{runtimeUpdateNotification:i}=k(await z(this,K,"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:r}}));return i}async removeNotification(e){let{runtimeRemoveNotification:r}=k(await z(this,K,"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 r}async exportPerspective(e,r){let{runtimeExportPerspective:i}=k(await z(this,K,"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:r}}));return i}async importPerspective(e){let{runtimeImportPerspective:r}=k(await z(this,K,"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 r}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await z(this,K,"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:r}=k(await z(this,K,"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 r}async listUsers(){let{runtimeListUsers:e}=k(await z(this,K,"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 z(this,K,"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 z(this,K,"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:r}=k(await z(this,K,"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 r}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=k(await z(this,K,"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,r,i){let{runtimeEmailTestSetExpiry:n}=k(await z(this,K,"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:r,expiresAt:i}}));return n}addNotificationTriggeredCallback(e){z(this,za,"f").push(e)}subscribeNotificationTriggered(){z(this,K,"f").subscribe({query:E` subscription {
694
- runtimeNotificationTriggered { ${x0} }
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=>{z(this,za,"f").forEach(r=>{r(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){z(this,Va,"f").push(e)}subscribeMessageReceived(){z(this,K,"f").subscribe({query:E` subscription {
697
- runtimeMessageReceived { ${Ss} }
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
+ runtimeMessageReceived { ${Cs} }
698
698
  }
699
- `}).subscribe({next:e=>{z(this,Va,"f").forEach(r=>{r(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){z(this,Qa,"f").push(e)}subscribeExceptionOccurred(){z(this,K,"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=>{z(this,Qa,"f").forEach(r=>{r(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};K=new WeakMap,Va=new WeakMap,Qa=new WeakMap,za=new WeakMap,w1=new WeakMap;var A0=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Pn=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},Er,Rl=class{constructor(e){Er.set(this,void 0),A0(this,Er,e,"f")}async get(e,r=!1){if(!r)try{let n=wt.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,Er,"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:r}=k(await Pn(this,Er,"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 r}async getRaw(e){let{expressionRaw:r}=k(await Pn(this,Er,"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 r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:i}=k(await Pn(this,Er,"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:r}}));return i}async interactions(e){let{expressionInteractions:r}=k(await Pn(this,Er,"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 r}async interact(e,r){let{expressionInteract:i}=k(await Pn(this,Er,"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:r}}));return i}};Er=new WeakMap;var yc={};yc.byteLength=T0;yc.toByteArray=O0;yc.fromByteArray=R0;var sr=[],Ft=[],k0=typeof Uint8Array<"u"?Uint8Array:Array,al="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Oi=0,ih=al.length;Oi<ih;++Oi)sr[Oi]=al[Oi],Ft[al.charCodeAt(Oi)]=Oi;var Oi,ih;Ft["-".charCodeAt(0)]=62;Ft["_".charCodeAt(0)]=63;function E1(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var i=r===e?0:4-r%4;return[r,i]}function T0(t){var e=E1(t),r=e[0],i=e[1];return(r+i)*3/4-i}function I0(t,e,r){return(e+r)*3/4-r}function O0(t){var e,r=E1(t),i=r[0],n=r[1],a=new k0(I0(t,i,n)),o=0,s=n>0?i-4:i,u;for(u=0;u<s;u+=4)e=Ft[t.charCodeAt(u)]<<18|Ft[t.charCodeAt(u+1)]<<12|Ft[t.charCodeAt(u+2)]<<6|Ft[t.charCodeAt(u+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Ft[t.charCodeAt(u)]<<2|Ft[t.charCodeAt(u+1)]>>4,a[o++]=e&255),n===1&&(e=Ft[t.charCodeAt(u)]<<10|Ft[t.charCodeAt(u+1)]<<4|Ft[t.charCodeAt(u+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function D0(t){return sr[t>>18&63]+sr[t>>12&63]+sr[t>>6&63]+sr[t&63]}function N0(t,e,r){for(var i,n=[],a=e;a<r;a+=3)i=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),n.push(D0(i));return n.join("")}function R0(t){for(var e,r=t.length,i=r%3,n=[],a=16383,o=0,s=r-i;o<s;o+=a)n.push(N0(t,o,o+a>s?s:o+a));return i===1?(e=t[r-1],n.push(sr[e>>2]+sr[e<<4&63]+"==")):i===2&&(e=(t[r-2]<<8)+t[r-1],n.push(sr[e>>10]+sr[e>>4&63]+sr[e<<2&63]+"=")),n.join("")}var P0=4,nh=0,ah=1,$0=2;function Xn(t){let e=t.length;for(;--e>=0;)t[e]=0}var L0=0,x1=1,F0=2,M0=3,U0=258,Xl=29,vo=256,ao=vo+1+Xl,qn=30,ep=19,A1=2*ao+1,qi=15,ol=16,j0=7,tp=256,k1=16,T1=17,I1=18,Pl=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]),Us=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]),q0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),O1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),B0=512,xr=new Array((ao+2)*2);Xn(xr);var Ya=new Array(qn*2);Xn(Ya);var oo=new Array(B0);Xn(oo);var so=new Array(U0-M0+1);Xn(so);var rp=new Array(Xl);Xn(rp);var ac=new Array(qn);Xn(ac);function sl(t,e,r,i,n){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=i,this.max_length=n,this.has_stree=t&&t.length}var D1,N1,R1;function cl(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}var P1=t=>t<256?oo[t]:oo[256+(t>>>7)],co=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},St=(t,e,r)=>{t.bi_valid>ol-r?(t.bi_buf|=e<<t.bi_valid&65535,co(t,t.bi_buf),t.bi_buf=e>>ol-t.bi_valid,t.bi_valid+=r-ol):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},cr=(t,e,r)=>{St(t,r[e*2],r[e*2+1])},$1=(t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},V0=t=>{t.bi_valid===16?(co(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},Q0=(t,e)=>{let r=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,u=e.stat_desc.max_length,c,l,d,f,p,h,m=0;for(f=0;f<=qi;f++)t.bl_count[f]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<A1;c++)l=t.heap[c],f=r[r[l*2+1]*2+1]+1,f>u&&(f=u,m++),r[l*2+1]=f,!(l>i)&&(t.bl_count[f]++,p=0,l>=s&&(p=o[l-s]),h=r[l*2],t.opt_len+=h*(f+p),a&&(t.static_len+=h*(n[l*2+1]+p)));if(m!==0){do{for(f=u-1;t.bl_count[f]===0;)f--;t.bl_count[f]--,t.bl_count[f+1]+=2,t.bl_count[u]--,m-=2}while(m>0);for(f=u;f!==0;f--)for(l=t.bl_count[f];l!==0;)d=t.heap[--c],!(d>i)&&(r[d*2+1]!==f&&(t.opt_len+=(f-r[d*2+1])*r[d*2],r[d*2+1]=f),l--)}},L1=(t,e,r)=>{let i=new Array(qi+1),n=0,a,o;for(a=1;a<=qi;a++)n=n+r[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=$1(i[s]++,s))}},z0=()=>{let t,e,r,i,n,a=new Array(qi+1);for(r=0,i=0;i<Xl-1;i++)for(rp[i]=r,t=0;t<1<<Pl[i];t++)so[r++]=i;for(so[r-1]=i,n=0,i=0;i<16;i++)for(ac[i]=n,t=0;t<1<<Us[i];t++)oo[n++]=i;for(n>>=7;i<qn;i++)for(ac[i]=n<<7,t=0;t<1<<Us[i]-7;t++)oo[256+n++]=i;for(e=0;e<=qi;e++)a[e]=0;for(t=0;t<=143;)xr[t*2+1]=8,t++,a[8]++;for(;t<=255;)xr[t*2+1]=9,t++,a[9]++;for(;t<=279;)xr[t*2+1]=7,t++,a[7]++;for(;t<=287;)xr[t*2+1]=8,t++,a[8]++;for(L1(xr,ao+1,a),t=0;t<qn;t++)Ya[t*2+1]=5,Ya[t*2]=$1(t,5);D1=new sl(xr,Pl,vo+1,ao,qi),N1=new sl(Ya,Us,0,qn,qi),R1=new sl(new Array(0),q0,0,ep,j0)},F1=t=>{let e;for(e=0;e<ao;e++)t.dyn_ltree[e*2]=0;for(e=0;e<qn;e++)t.dyn_dtree[e*2]=0;for(e=0;e<ep;e++)t.bl_tree[e*2]=0;t.dyn_ltree[tp*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},M1=t=>{t.bi_valid>8?co(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},oh=(t,e,r,i)=>{let n=e*2,a=r*2;return t[n]<t[a]||t[n]===t[a]&&i[e]<=i[r]},ul=(t,e,r)=>{let i=t.heap[r],n=r<<1;for(;n<=t.heap_len&&(n<t.heap_len&&oh(e,t.heap[n+1],t.heap[n],t.depth)&&n++,!oh(e,i,t.heap[n],t.depth));)t.heap[r]=t.heap[n],r=n,n<<=1;t.heap[r]=i},sh=(t,e,r)=>{let i,n,a=0,o,s;if(t.sym_next!==0)do i=t.pending_buf[t.sym_buf+a++]&255,i+=(t.pending_buf[t.sym_buf+a++]&255)<<8,n=t.pending_buf[t.sym_buf+a++],i===0?cr(t,n,e):(o=so[n],cr(t,o+vo+1,e),s=Pl[o],s!==0&&(n-=rp[o],St(t,n,s)),i--,o=P1(i),cr(t,o,r),s=Us[o],s!==0&&(i-=ac[o],St(t,i,s)));while(a<t.sym_next);cr(t,tp,e)},$l=(t,e)=>{let r=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,u=-1,c;for(t.heap_len=0,t.heap_max=A1,o=0;o<a;o++)r[o*2]!==0?(t.heap[++t.heap_len]=u=o,t.depth[o]=0):r[o*2+1]=0;for(;t.heap_len<2;)c=t.heap[++t.heap_len]=u<2?++u:0,r[c*2]=1,t.depth[c]=0,t.opt_len--,n&&(t.static_len-=i[c*2+1]);for(e.max_code=u,o=t.heap_len>>1;o>=1;o--)ul(t,r,o);c=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],ul(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,r[c*2]=r[o*2]+r[s*2],t.depth[c]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,r[o*2+1]=r[s*2+1]=c,t.heap[1]=c++,ul(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Q0(t,e),L1(r,u,t.bl_count)},ch=(t,e,r)=>{let i,n=-1,a,o=e[0*2+1],s=0,u=7,c=4;for(o===0&&(u=138,c=3),e[(r+1)*2+1]=65535,i=0;i<=r;i++)a=o,o=e[(i+1)*2+1],!(++s<u&&a===o)&&(s<c?t.bl_tree[a*2]+=s:a!==0?(a!==n&&t.bl_tree[a*2]++,t.bl_tree[k1*2]++):s<=10?t.bl_tree[T1*2]++:t.bl_tree[I1*2]++,s=0,n=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4))},uh=(t,e,r)=>{let i,n=-1,a,o=e[0*2+1],s=0,u=7,c=4;for(o===0&&(u=138,c=3),i=0;i<=r;i++)if(a=o,o=e[(i+1)*2+1],!(++s<u&&a===o)){if(s<c)do cr(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==n&&(cr(t,a,t.bl_tree),s--),cr(t,k1,t.bl_tree),St(t,s-3,2)):s<=10?(cr(t,T1,t.bl_tree),St(t,s-3,3)):(cr(t,I1,t.bl_tree),St(t,s-11,7));s=0,n=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4)}},W0=t=>{let e;for(ch(t,t.dyn_ltree,t.l_desc.max_code),ch(t,t.dyn_dtree,t.d_desc.max_code),$l(t,t.bl_desc),e=ep-1;e>=3&&t.bl_tree[O1[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},H0=(t,e,r,i)=>{let n;for(St(t,e-257,5),St(t,r-1,5),St(t,i-4,4),n=0;n<i;n++)St(t,t.bl_tree[O1[n]*2+1],3);uh(t,t.dyn_ltree,e-1),uh(t,t.dyn_dtree,r-1)},G0=t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return nh;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return ah;for(r=32;r<vo;r++)if(t.dyn_ltree[r*2]!==0)return ah;return nh},lh=!1,K0=t=>{lh||(z0(),lh=!0),t.l_desc=new cl(t.dyn_ltree,D1),t.d_desc=new cl(t.dyn_dtree,N1),t.bl_desc=new cl(t.bl_tree,R1),t.bi_buf=0,t.bi_valid=0,F1(t)},U1=(t,e,r,i)=>{St(t,(L0<<1)+(i?1:0),3),M1(t),co(t,r),co(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},Z0=t=>{St(t,x1<<1,3),cr(t,tp,xr),V0(t)},J0=(t,e,r,i)=>{let n,a,o=0;t.level>0?(t.strm.data_type===$0&&(t.strm.data_type=G0(t)),$l(t,t.l_desc),$l(t,t.d_desc),o=W0(t),n=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=n&&(n=a)):n=a=r+5,r+4<=n&&e!==-1?U1(t,e,r,i):t.strategy===P0||a===n?(St(t,(x1<<1)+(i?1:0),3),sh(t,xr,Ya)):(St(t,(F0<<1)+(i?1:0),3),H0(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),sh(t,t.dyn_ltree,t.dyn_dtree)),F1(t),i&&M1(t)},Y0=(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(so[r]+vo+1)*2]++,t.dyn_dtree[P1(e)*2]++),t.sym_next===t.sym_end),X0=K0,ev=U1,tv=J0,rv=Y0,iv=Z0,nv={_tr_init:X0,_tr_stored_block:ev,_tr_flush_block:tv,_tr_tally:rv,_tr_align:iv},av=(t,e,r,i)=>{let n=t&65535|0,a=t>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},uo=av,ov=()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var i=0;i<8;i++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e},sv=new Uint32Array(ov()),cv=(t,e,r,i)=>{let n=sv,a=i+r;t^=-1;for(let o=i;o<a;o++)t=t>>>8^n[(t^e[o])&255];return t^-1},Ge=cv,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:uv,_tr_stored_block:Ll,_tr_flush_block:lv,_tr_tally:ti,_tr_align:pv}=nv,{Z_NO_FLUSH:ri,Z_PARTIAL_FLUSH:fv,Z_FULL_FLUSH:dv,Z_FINISH:Ut,Z_BLOCK:ph,Z_OK:rt,Z_STREAM_END:fh,Z_STREAM_ERROR:lr,Z_DATA_ERROR:hv,Z_BUF_ERROR:ll,Z_DEFAULT_COMPRESSION:mv,Z_FILTERED:gv,Z_HUFFMAN_ONLY:ws,Z_RLE:yv,Z_FIXED:vv,Z_DEFAULT_STRATEGY:bv,Z_UNKNOWN:_v,Z_DEFLATED:vc}=sn,Sv=9,wv=15,Cv=8,Ev=29,xv=256,Fl=xv+1+Ev,Av=30,kv=19,Tv=2*Fl+1,Iv=15,ue=3,Jr=258,pr=Jr+ue+1,Ov=32,zn=42,ip=57,Ml=69,Ul=73,jl=91,ql=103,Bi=113,Wa=666,dt=1,ea=2,Yi=3,ta=4,Dv=3,Vi=(t,e)=>(t.msg=Ji[e],e),dh=t=>t*2-(t>4?9:0),Zr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Nv=t=>{let e,r,i,n=t.w_size;e=t.hash_size,i=e;do r=t.head[--i],t.head[i]=r>=n?r-n:0;while(--e);e=n,i=e;do r=t.prev[--i],t.prev[i]=r>=n?r-n:0;while(--e)},Rv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,ii=Rv,At=t=>{let e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))},Tt=(t,e)=>{lv(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,At(t.strm)},ve=(t,e)=>{t.pending_buf[t.pending++]=e},Da=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Bl=(t,e,r,i)=>{let n=t.avail_in;return n>i&&(n=i),n===0?0:(t.avail_in-=n,e.set(t.input.subarray(t.next_in,t.next_in+n),r),t.state.wrap===1?t.adler=uo(t.adler,e,n,r):t.state.wrap===2&&(t.adler=Ge(t.adler,e,n,r)),t.next_in+=n,t.total_in+=n,n)},j1=(t,e)=>{let r=t.max_chain_length,i=t.strstart,n,a,o=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-pr?t.strstart-(t.w_size-pr):0,c=t.window,l=t.w_mask,d=t.prev,f=t.strstart+Jr,p=c[i+o-1],h=c[i+o];t.prev_length>=t.good_match&&(r>>=2),s>t.lookahead&&(s=t.lookahead);do if(n=e,!(c[n+o]!==h||c[n+o-1]!==p||c[n]!==c[i]||c[++n]!==c[i+1])){i+=2,n++;do;while(c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&c[++i]===c[++n]&&i<f);if(a=Jr-(f-i),i=f-Jr,a>o){if(t.match_start=e,o=a,a>=s)break;p=c[i+o-1],h=c[i+o]}}while((e=d[e&l])>u&&--r!==0);return o<=t.lookahead?o:t.lookahead},Wn=t=>{let e=t.w_size,r,i,n;do{if(i=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-pr)&&(t.window.set(t.window.subarray(e,e+e-i),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Nv(t),i+=e),t.strm.avail_in===0)break;if(r=Bl(t.strm,t.window,t.strstart+t.lookahead,i),t.lookahead+=r,t.lookahead+t.insert>=ue)for(n=t.strstart-t.insert,t.ins_h=t.window[n],t.ins_h=ii(t,t.ins_h,t.window[n+1]);t.insert&&(t.ins_h=ii(t,t.ins_h,t.window[n+ue-1]),t.prev[n&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=n,n++,t.insert--,!(t.lookahead+t.insert<ue)););}while(t.lookahead<pr&&t.strm.avail_in!==0)},q1=(t,e)=>{let r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,i,n,a,o=0,s=t.strm.avail_in;do{if(i=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,n=t.strstart-t.block_start,i>n+t.strm.avail_in&&(i=n+t.strm.avail_in),i>a&&(i=a),i<r&&(i===0&&e!==Ut||e===ri||i!==n+t.strm.avail_in)))break;o=e===Ut&&i===n+t.strm.avail_in?1:0,Ll(t,0,0,o),t.pending_buf[t.pending-4]=i,t.pending_buf[t.pending-3]=i>>8,t.pending_buf[t.pending-2]=~i,t.pending_buf[t.pending-1]=~i>>8,At(t.strm),n&&(n>i&&(n=i),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+n),t.strm.next_out),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n,t.block_start+=n,i-=n),i&&(Bl(t.strm,t.strm.output,t.strm.next_out,i),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i)}while(o===0);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?ta:e!==ri&&e!==Ut&&t.strm.avail_in===0&&t.strstart===t.block_start?ea:(a=t.window_size-t.strstart,t.strm.avail_in>a&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(Bl(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water<t.strstart&&(t.high_water=t.strstart),a=t.bi_valid+42>>3,a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a,r=a>t.w_size?t.w_size:a,n=t.strstart-t.block_start,(n>=r||(n||e===Ut)&&e!==ri&&t.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Ut&&t.strm.avail_in===0&&i===n?1:0,Ll(t,t.block_start,i,o),t.block_start+=i,At(t.strm)),o?Yi:dt)},pl=(t,e)=>{let r,i;for(;;){if(t.lookahead<pr){if(Wn(t),t.lookahead<pr&&e===ri)return dt;if(t.lookahead===0)break}if(r=0,t.lookahead>=ue&&(t.ins_h=ii(t,t.ins_h,t.window[t.strstart+ue-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-pr&&(t.match_length=j1(t,r)),t.match_length>=ue)if(i=ti(t,t.strstart-t.match_start,t.match_length-ue),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ue){t.match_length--;do t.strstart++,t.ins_h=ii(t,t.ins_h,t.window[t.strstart+ue-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=ii(t,t.ins_h,t.window[t.strstart+1]);else i=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(i&&(Tt(t,!1),t.strm.avail_out===0))return dt}return t.insert=t.strstart<ue-1?t.strstart:ue-1,e===Ut?(Tt(t,!0),t.strm.avail_out===0?Yi:ta):t.sym_next&&(Tt(t,!1),t.strm.avail_out===0)?dt:ea},$n=(t,e)=>{let r,i,n;for(;;){if(t.lookahead<pr){if(Wn(t),t.lookahead<pr&&e===ri)return dt;if(t.lookahead===0)break}if(r=0,t.lookahead>=ue&&(t.ins_h=ii(t,t.ins_h,t.window[t.strstart+ue-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ue-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-pr&&(t.match_length=j1(t,r),t.match_length<=5&&(t.strategy===gv||t.match_length===ue&&t.strstart-t.match_start>4096)&&(t.match_length=ue-1)),t.prev_length>=ue&&t.match_length<=t.prev_length){n=t.strstart+t.lookahead-ue,i=ti(t,t.strstart-1-t.prev_match,t.prev_length-ue),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=n&&(t.ins_h=ii(t,t.ins_h,t.window[t.strstart+ue-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=ue-1,t.strstart++,i&&(Tt(t,!1),t.strm.avail_out===0))return dt}else if(t.match_available){if(i=ti(t,0,t.window[t.strstart-1]),i&&Tt(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return dt}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(i=ti(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ue-1?t.strstart:ue-1,e===Ut?(Tt(t,!0),t.strm.avail_out===0?Yi:ta):t.sym_next&&(Tt(t,!1),t.strm.avail_out===0)?dt:ea},Pv=(t,e)=>{let r,i,n,a,o=t.window;for(;;){if(t.lookahead<=Jr){if(Wn(t),t.lookahead<=Jr&&e===ri)return dt;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=ue&&t.strstart>0&&(n=t.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=t.strstart+Jr;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);t.match_length=Jr-(a-n),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ue?(r=ti(t,1,t.match_length-ue),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(Tt(t,!1),t.strm.avail_out===0))return dt}return t.insert=0,e===Ut?(Tt(t,!0),t.strm.avail_out===0?Yi:ta):t.sym_next&&(Tt(t,!1),t.strm.avail_out===0)?dt:ea},$v=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(Wn(t),t.lookahead===0)){if(e===ri)return dt;break}if(t.match_length=0,r=ti(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(Tt(t,!1),t.strm.avail_out===0))return dt}return t.insert=0,e===Ut?(Tt(t,!0),t.strm.avail_out===0?Yi:ta):t.sym_next&&(Tt(t,!1),t.strm.avail_out===0)?dt:ea};function rr(t,e,r,i,n){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=i,this.func=n}var Ha=[new rr(0,0,0,0,q1),new rr(4,4,8,4,pl),new rr(4,5,16,8,pl),new rr(4,6,32,32,pl),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)],Lv=t=>{t.window_size=2*t.w_size,Zr(t.head),t.max_lazy_match=Ha[t.level].max_lazy,t.good_match=Ha[t.level].good_length,t.nice_match=Ha[t.level].nice_length,t.max_chain_length=Ha[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ue-1,t.match_available=0,t.ins_h=0};function Fv(){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=vc,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(Tv*2),this.dyn_dtree=new Uint16Array((2*Av+1)*2),this.bl_tree=new Uint16Array((2*kv+1)*2),Zr(this.dyn_ltree),Zr(this.dyn_dtree),Zr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Iv+1),this.heap=new Uint16Array(2*Fl+1),Zr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Fl+1),Zr(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 bo=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==zn&&e.status!==ip&&e.status!==Ml&&e.status!==Ul&&e.status!==jl&&e.status!==ql&&e.status!==Bi&&e.status!==Wa?1:0},B1=t=>{if(bo(t))return Vi(t,lr);t.total_in=t.total_out=0,t.data_type=_v;let e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?ip:e.wrap?zn:Bi,t.adler=e.wrap===2?0:1,e.last_flush=-2,uv(e),rt},V1=t=>{let e=B1(t);return e===rt&&Lv(t.state),e},Mv=(t,e)=>bo(t)||t.state.wrap!==2?lr:(t.state.gzhead=e,rt),Q1=(t,e,r,i,n,a)=>{if(!t)return lr;let o=1;if(e===mv&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>Sv||r!==vc||i<8||i>15||e<0||e>9||a<0||a>vv||i===8&&o!==1)return Vi(t,lr);i===8&&(i=9);let s=new Fv;return t.state=s,s.strm=t,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+ue-1)/ue),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=r,V1(t)},Uv=(t,e)=>Q1(t,e,vc,wv,Cv,bv),jv=(t,e)=>{if(bo(t)||e>ph||e<0)return t?Vi(t,lr):lr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===Wa&&e!==Ut)return Vi(t,t.avail_out===0?ll:lr);let i=r.last_flush;if(r.last_flush=e,r.pending!==0){if(At(t),t.avail_out===0)return r.last_flush=-1,rt}else if(t.avail_in===0&&dh(e)<=dh(i)&&e!==Ut)return Vi(t,ll);if(r.status===Wa&&t.avail_in!==0)return Vi(t,ll);if(r.status===zn&&r.wrap===0&&(r.status=Bi),r.status===zn){let n=vc+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=ws||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,n|=a<<6,r.strstart!==0&&(n|=Ov),n+=31-n%31,Da(r,n),r.strstart!==0&&(Da(r,t.adler>>>16),Da(r,t.adler&65535)),t.adler=1,r.status=Bi,At(t),r.pending!==0)return r.last_flush=-1,rt}if(r.status===ip){if(t.adler=0,ve(r,31),ve(r,139),ve(r,8),r.gzhead)ve(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),ve(r,r.gzhead.time&255),ve(r,r.gzhead.time>>8&255),ve(r,r.gzhead.time>>16&255),ve(r,r.gzhead.time>>24&255),ve(r,r.level===9?2:r.strategy>=ws||r.level<2?4:0),ve(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ve(r,r.gzhead.extra.length&255),ve(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Ge(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Ml;else if(ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,0),ve(r,r.level===9?2:r.strategy>=ws||r.level<2?4:0),ve(r,Dv),r.status=Bi,At(t),r.pending!==0)return r.last_flush=-1,rt}if(r.status===Ml){if(r.gzhead.extra){let n=r.pending,a=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let s=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+s),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex+=s,At(t),r.pending!==0)return r.last_flush=-1,rt;n=0,a-=s}let o=new Uint8Array(r.gzhead.extra);r.pending_buf.set(o.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=Ul}if(r.status===Ul){if(r.gzhead.name){let n=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),At(t),r.pending!==0)return r.last_flush=-1,rt;n=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,ve(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),r.gzindex=0}r.status=jl}if(r.status===jl){if(r.gzhead.comment){let n=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n)),At(t),r.pending!==0)return r.last_flush=-1,rt;n=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,ve(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>n&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-n,n))}r.status=ql}if(r.status===ql){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(At(t),r.pending!==0))return r.last_flush=-1,rt;ve(r,t.adler&255),ve(r,t.adler>>8&255),t.adler=0}if(r.status=Bi,At(t),r.pending!==0)return r.last_flush=-1,rt}if(t.avail_in!==0||r.lookahead!==0||e!==ri&&r.status!==Wa){let n=r.level===0?q1(r,e):r.strategy===ws?$v(r,e):r.strategy===yv?Pv(r,e):Ha[r.level].func(r,e);if((n===Yi||n===ta)&&(r.status=Wa),n===dt||n===Yi)return t.avail_out===0&&(r.last_flush=-1),rt;if(n===ea&&(e===fv?pv(r):e!==ph&&(Ll(r,0,0,!1),e===dv&&(Zr(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),At(t),t.avail_out===0))return r.last_flush=-1,rt}return e!==Ut?rt:r.wrap<=0?fh:(r.wrap===2?(ve(r,t.adler&255),ve(r,t.adler>>8&255),ve(r,t.adler>>16&255),ve(r,t.adler>>24&255),ve(r,t.total_in&255),ve(r,t.total_in>>8&255),ve(r,t.total_in>>16&255),ve(r,t.total_in>>24&255)):(Da(r,t.adler>>>16),Da(r,t.adler&65535)),At(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?rt:fh)},qv=t=>{if(bo(t))return lr;let e=t.state.status;return t.state=null,e===Bi?Vi(t,hv):rt},Bv=(t,e)=>{let r=e.length;if(bo(t))return lr;let i=t.state,n=i.wrap;if(n===2||n===1&&i.status!==zn||i.lookahead)return lr;if(n===1&&(t.adler=uo(t.adler,e,r,0)),i.wrap=0,r>=i.w_size){n===0&&(Zr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let u=new Uint8Array(i.w_size);u.set(e.subarray(r-i.w_size,r),0),e=u,r=i.w_size}let a=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Wn(i);i.lookahead>=ue;){let u=i.strstart,c=i.lookahead-(ue-1);do i.ins_h=ii(i,i.ins_h,i.window[u+ue-1]),i.prev[u&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=u,u++;while(--c);i.strstart=u,i.lookahead=ue-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=ue-1,i.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,i.wrap=n,rt},Vv=Uv,Qv=Q1,zv=V1,Wv=B1,Hv=Mv,Gv=jv,Kv=qv,Zv=Bv,Jv="pako deflate (from Nodeca project)",Xa={deflateInit:Vv,deflateInit2:Qv,deflateReset:zv,deflateResetKeep:Wv,deflateSetHeader:Hv,deflate:Gv,deflateEnd:Kv,deflateSetDictionary:Zv,deflateInfo:Jv},Yv=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Xv=function(t){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let r=e.shift();if(!!r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let i in r)Yv(r,i)&&(t[i]=r[i])}}return t},e2=t=>{let e=0;for(let i=0,n=t.length;i<n;i++)e+=t[i].length;let r=new Uint8Array(e);for(let i=0,n=0,a=t.length;i<a;i++){let o=t[i];r.set(o,n),n+=o.length}return r},bc={assign:Xv,flattenChunks:e2},z1=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){z1=!1}var lo=new Uint8Array(256);for(let t=0;t<256;t++)lo[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;lo[254]=lo[254]=1;var t2=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,r,i,n,a,o=t.length,s=0;for(n=0;n<o;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)r=t.charCodeAt(n),(r&64512)===55296&&n+1<o&&(i=t.charCodeAt(n+1),(i&64512)===56320&&(r=65536+(r-55296<<10)+(i-56320),n++)),r<128?e[a++]=r:r<2048?(e[a++]=192|r>>>6,e[a++]=128|r&63):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|r&63):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|r&63);return e},r2=(t,e)=>{if(e<65534&&t.subarray&&z1)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let i=0;i<e;i++)r+=String.fromCharCode(t[i]);return r},i2=(t,e)=>{let r=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let i,n,a=new Array(r*2);for(n=0,i=0;i<r;){let o=t[i++];if(o<128){a[n++]=o;continue}let s=lo[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<r;)o=o<<6|t[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 r2(a,n)},n2=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let r=e-1;for(;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+lo[t[r]]>e?r:e},po={string2buf:t2,buf2string:i2,utf8border:n2};function a2(){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 W1=a2,H1=Object.prototype.toString,{Z_NO_FLUSH:o2,Z_SYNC_FLUSH:s2,Z_FULL_FLUSH:c2,Z_FINISH:u2,Z_OK:oc,Z_STREAM_END:l2,Z_DEFAULT_COMPRESSION:p2,Z_DEFAULT_STRATEGY:f2,Z_DEFLATED:d2}=sn;function _o(t){this.options=bc.assign({level:p2,method:d2,chunkSize:16384,windowBits:15,memLevel:8,strategy:f2},t||{});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 W1,this.strm.avail_out=0;let r=Xa.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==oc)throw new Error(Ji[r]);if(e.header&&Xa.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=po.string2buf(e.dictionary):H1.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,r=Xa.deflateSetDictionary(this.strm,i),r!==oc)throw new Error(Ji[r]);this._dict_set=!0}}_o.prototype.push=function(t,e){let r=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?u2:o2,typeof t=="string"?r.input=po.string2buf(t):H1.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),(a===s2||a===c2)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(n=Xa.deflate(r,a),n===l2)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),n=Xa.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===oc;if(r.avail_out===0){this.onData(r.output);continue}if(a>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};_o.prototype.onData=function(t){this.chunks.push(t)};_o.prototype.onEnd=function(t){t===oc&&(this.result=bc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function np(t,e){let r=new _o(e);if(r.push(t,!0),r.err)throw r.msg||Ji[r.err];return r.result}function h2(t,e){return e=e||{},e.raw=!0,np(t,e)}function m2(t,e){return e=e||{},e.gzip=!0,np(t,e)}var g2=_o,y2=np,v2=h2,b2=m2,_2=sn,S2={Deflate:g2,deflate:y2,deflateRaw:v2,gzip:b2,constants:_2},Cs=16209,w2=16191,C2=function t(e,r){let i,n,a,o,s,u,c,l,d,f,p,h,m,b,_,S,w,v,D,N,A,R,F,P,j=e.state;i=e.next_in,F=e.input,n=i+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(r-e.avail_out),s=a+(e.avail_out-257),u=j.dmax,c=j.wsize,l=j.whave,d=j.wnext,f=j.window,p=j.hold,h=j.bits,m=j.lencode,b=j.distcode,_=(1<<j.lenbits)-1,S=(1<<j.distbits)-1;e:do{h<15&&(p+=F[i++]<<h,h+=8,p+=F[i++]<<h,h+=8),w=m[p&_];t:for(;;){if(v=w>>>24,p>>>=v,h-=v,v=w>>>16&255,v===0)P[a++]=w&65535;else if(v&16){D=w&65535,v&=15,v&&(h<v&&(p+=F[i++]<<h,h+=8),D+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=F[i++]<<h,h+=8,p+=F[i++]<<h,h+=8),w=b[p&S];r:for(;;){if(v=w>>>24,p>>>=v,h-=v,v=w>>>16&255,v&16){if(N=w&65535,v&=15,h<v&&(p+=F[i++]<<h,h+=8,h<v&&(p+=F[i++]<<h,h+=8)),N+=p&(1<<v)-1,N>u){e.msg="invalid distance too far back",j.mode=Cs;break e}if(p>>>=v,h-=v,v=a-o,N>v){if(v=N-v,v>l&&j.sane){e.msg="invalid distance too far back",j.mode=Cs;break e}if(A=0,R=f,d===0){if(A+=c-v,v<D){D-=v;do P[a++]=f[A++];while(--v);A=a-N,R=P}}else if(d<v){if(A+=c+d-v,v-=d,v<D){D-=v;do P[a++]=f[A++];while(--v);if(A=0,d<D){v=d,D-=v;do P[a++]=f[A++];while(--v);A=a-N,R=P}}}else if(A+=d-v,v<D){D-=v;do P[a++]=f[A++];while(--v);A=a-N,R=P}for(;D>2;)P[a++]=R[A++],P[a++]=R[A++],P[a++]=R[A++],D-=3;D&&(P[a++]=R[A++],D>1&&(P[a++]=R[A++]))}else{A=a-N;do P[a++]=P[A++],P[a++]=P[A++],P[a++]=P[A++],D-=3;while(D>2);D&&(P[a++]=P[A++],D>1&&(P[a++]=P[A++]))}}else if((v&64)===0){w=b[(w&65535)+(p&(1<<v)-1)];continue r}else{e.msg="invalid distance code",j.mode=Cs;break e}break}}else if((v&64)===0){w=m[(w&65535)+(p&(1<<v)-1)];continue t}else if(v&32){j.mode=w2;break e}else{e.msg="invalid literal/length code",j.mode=Cs;break e}break}}while(i<n&&a<s);D=h>>3,i-=D,h-=D<<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,hh=852,mh=592,gh=0,fl=1,yh=2,E2=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]),x2=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]),A2=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]),k2=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]),T2=(t,e,r,i,n,a,o,s)=>{let u=s.bits,c=0,l=0,d=0,f=0,p=0,h=0,m=0,b=0,_=0,S=0,w,v,D,N,A,R=null,F,P=new Uint16Array(Ln+1),j=new Uint16Array(Ln+1),Je=null,je,H,we;for(c=0;c<=Ln;c++)P[c]=0;for(l=0;l<i;l++)P[e[r+l]]++;for(p=u,f=Ln;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),b=1,c=1;c<=Ln;c++)if(b<<=1,b-=P[c],b<0)return-1;if(b>0&&(t===gh||f!==1))return-1;for(j[1]=0,c=1;c<Ln;c++)j[c+1]=j[c]+P[c];for(l=0;l<i;l++)e[r+l]!==0&&(o[j[e[r+l]]++]=l);if(t===gh?(R=Je=o,F=20):t===fl?(R=E2,Je=x2,F=257):(R=A2,Je=k2,F=0),S=0,l=0,c=d,A=a,h=p,m=0,D=-1,_=1<<p,N=_-1,t===fl&&_>hh||t===yh&&_>mh)return 1;for(;;){je=c-m,o[l]+1<F?(H=0,we=o[l]):o[l]>=F?(H=Je[o[l]-F],we=R[o[l]-F]):(H=32+64,we=0),w=1<<c-m,v=1<<h,d=v;do v-=w,n[A+(S>>m)+v]=je<<24|H<<16|we|0;while(v!==0);for(w=1<<c-1;S&w;)w>>=1;if(w!==0?(S&=w-1,S+=w):S=0,l++,--P[c]===0){if(c===f)break;c=e[r+o[l]]}if(c>p&&(S&N)!==D){for(m===0&&(m=p),A+=d,h=c-m,b=1<<h;h+m<f&&(b-=P[h+m],!(b<=0));)h++,b<<=1;if(_+=1<<h,t===fl&&_>hh||t===yh&&_>mh)return 1;D=S&N,n[D]=p<<24|h<<16|A-a|0}}return S!==0&&(n[A+S]=c-m<<24|64<<16|0),s.bits=p,0},eo=T2,I2=0,G1=1,K1=2,{Z_FINISH:vh,Z_BLOCK:O2,Z_TREES:Es,Z_OK:Xi,Z_STREAM_END:D2,Z_NEED_DICT:N2,Z_STREAM_ERROR:jt,Z_DATA_ERROR:Z1,Z_MEM_ERROR:J1,Z_BUF_ERROR:R2,Z_DEFLATED:bh}=sn,_c=16180,_h=16181,Sh=16182,wh=16183,Ch=16184,Eh=16185,xh=16186,Ah=16187,kh=16188,Th=16189,sc=16190,Sr=16191,dl=16192,Ih=16193,hl=16194,Oh=16195,Dh=16196,Nh=16197,Rh=16198,xs=16199,As=16200,Ph=16201,$h=16202,Lh=16203,Fh=16204,Mh=16205,ml=16206,Uh=16207,jh=16208,Te=16209,Y1=16210,X1=16211,P2=852,$2=592,L2=15,F2=L2,qh=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function M2(){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=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<_c||e.mode>X1?1:0},em=t=>{if(cn(t))return jt;let e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=_c,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($2),e.sane=1,e.back=-1,Xi},tm=t=>{if(cn(t))return jt;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,em(t)},rm=(t,e)=>{let r;if(cn(t))return jt;let i=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?jt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=r,i.wbits=e,tm(t))},im=(t,e)=>{if(!t)return jt;let r=new M2;t.state=r,r.strm=t,r.window=null,r.mode=_c;let i=rm(t,e);return i!==Xi&&(t.state=null),i},U2=t=>im(t,F2),Bh=!0,gl,yl,j2=t=>{if(Bh){gl=new Int32Array(512),yl=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(eo(G1,t.lens,0,288,gl,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;eo(K1,t.lens,0,32,yl,0,t.work,{bits:5}),Bh=!1}t.lencode=gl,t.lenbits=9,t.distcode=yl,t.distbits=5},nm=(t,e,r,i)=>{let n,a=t.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(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),a.window.set(e.subarray(r-i,r-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(r-i,r),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},q2=(t,e)=>{let r,i,n,a,o,s,u,c,l,d,f,p,h,m,b=0,_,S,w,v,D,N,A,R,F=new Uint8Array(4),P,j,Je=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(cn(t)||!t.output||!t.input&&t.avail_in!==0)return jt;r=t.state,r.mode===Sr&&(r.mode=dl),o=t.next_out,n=t.output,u=t.avail_out,a=t.next_in,i=t.input,s=t.avail_in,c=r.hold,l=r.bits,d=s,f=u,R=Xi;e:for(;;)switch(r.mode){case _c:if(r.wrap===0){r.mode=dl;break}for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.wrap&2&&c===35615){r.wbits===0&&(r.wbits=15),r.check=0,F[0]=c&255,F[1]=c>>>8&255,r.check=Ge(r.check,F,2,0),c=0,l=0,r.mode=_h;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=Te;break}if((c&15)!==bh){t.msg="unknown compression method",r.mode=Te;break}if(c>>>=4,l-=4,A=(c&15)+8,r.wbits===0&&(r.wbits=A),A>15||A>r.wbits){t.msg="invalid window size",r.mode=Te;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=c&512?Th:Sr,c=0,l=0;break;case _h:for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.flags=c,(r.flags&255)!==bh){t.msg="unknown compression method",r.mode=Te;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Te;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ge(r.check,F,2,0)),c=0,l=0,r.mode=Sh;case Sh:for(;l<32;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.head&&(r.head.time=c),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,F[2]=c>>>16&255,F[3]=c>>>24&255,r.check=Ge(r.check,F,4,0)),c=0,l=0,r.mode=wh;case wh:for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.head&&(r.head.xflags=c&255,r.head.os=c>>8),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ge(r.check,F,2,0)),c=0,l=0,r.mode=Ch;case Ch:if(r.flags&1024){for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ge(r.check,F,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=Eh;case Eh:if(r.flags&1024&&(p=r.length,p>s&&(p=s),p&&(r.head&&(A=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(i.subarray(a,a+p),A)),r.flags&512&&r.wrap&4&&(r.check=Ge(r.check,i,p,a)),s-=p,a+=p,r.length-=p),r.length))break e;r.length=0,r.mode=xh;case xh:if(r.flags&2048){if(s===0)break e;p=0;do A=i[a+p++],r.head&&A&&r.length<65536&&(r.head.name+=String.fromCharCode(A));while(A&&p<s);if(r.flags&512&&r.wrap&4&&(r.check=Ge(r.check,i,p,a)),s-=p,a+=p,A)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Ah;case Ah:if(r.flags&4096){if(s===0)break e;p=0;do A=i[a+p++],r.head&&A&&r.length<65536&&(r.head.comment+=String.fromCharCode(A));while(A&&p<s);if(r.flags&512&&r.wrap&4&&(r.check=Ge(r.check,i,p,a)),s-=p,a+=p,A)break e}else r.head&&(r.head.comment=null);r.mode=kh;case kh:if(r.flags&512){for(;l<16;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.wrap&4&&c!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Te;break}c=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=Sr;break;case Th:for(;l<32;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}t.adler=r.check=qh(c),c=0,l=0,r.mode=sc;case sc:if(r.havedict===0)return t.next_out=o,t.avail_out=u,t.next_in=a,t.avail_in=s,r.hold=c,r.bits=l,N2;t.adler=r.check=1,r.mode=Sr;case Sr:if(e===O2||e===Es)break e;case dl:if(r.last){c>>>=l&7,l-=l&7,r.mode=ml;break}for(;l<3;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}switch(r.last=c&1,c>>>=1,l-=1,c&3){case 0:r.mode=Ih;break;case 1:if(j2(r),r.mode=xs,e===Es){c>>>=2,l-=2;break e}break;case 2:r.mode=Dh;break;case 3:t.msg="invalid block type",r.mode=Te}c>>>=2,l-=2;break;case Ih:for(c>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Te;break}if(r.length=c&65535,c=0,l=0,r.mode=hl,e===Es)break e;case hl:r.mode=Oh;case Oh:if(p=r.length,p){if(p>s&&(p=s),p>u&&(p=u),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,u-=p,o+=p,r.length-=p;break}r.mode=Sr;break;case Dh:for(;l<14;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.nlen=(c&31)+257,c>>>=5,l-=5,r.ndist=(c&31)+1,c>>>=5,l-=5,r.ncode=(c&15)+4,c>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Te;break}r.have=0,r.mode=Nh;case Nh:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.lens[Je[r.have++]]=c&7,c>>>=3,l-=3}for(;r.have<19;)r.lens[Je[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},R=eo(I2,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,R){t.msg="invalid code lengths set",r.mode=Te;break}r.have=0,r.mode=Rh;case Rh:for(;r.have<r.nlen+r.ndist;){for(;b=r.lencode[c&(1<<r.lenbits)-1],_=b>>>24,S=b>>>16&255,w=b&65535,!(_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(w<16)c>>>=_,l-=_,r.lens[r.have++]=w;else{if(w===16){for(j=_+2;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(c>>>=_,l-=_,r.have===0){t.msg="invalid bit length repeat",r.mode=Te;break}A=r.lens[r.have-1],p=3+(c&3),c>>>=2,l-=2}else if(w===17){for(j=_+3;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}c>>>=_,l-=_,A=0,p=3+(c&7),c>>>=3,l-=3}else{for(j=_+7;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}c>>>=_,l-=_,A=0,p=11+(c&127),c>>>=7,l-=7}if(r.have+p>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Te;break}for(;p--;)r.lens[r.have++]=A}}if(r.mode===Te)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Te;break}if(r.lenbits=9,P={bits:r.lenbits},R=eo(G1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,R){t.msg="invalid literal/lengths set",r.mode=Te;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},R=eo(K1,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,R){t.msg="invalid distances set",r.mode=Te;break}if(r.mode=xs,e===Es)break e;case xs:r.mode=As;case As:if(s>=6&&u>=258){t.next_out=o,t.avail_out=u,t.next_in=a,t.avail_in=s,r.hold=c,r.bits=l,C2(t,f),o=t.next_out,n=t.output,u=t.avail_out,a=t.next_in,i=t.input,s=t.avail_in,c=r.hold,l=r.bits,r.mode===Sr&&(r.back=-1);break}for(r.back=0;b=r.lencode[c&(1<<r.lenbits)-1],_=b>>>24,S=b>>>16&255,w=b&65535,!(_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(S&&(S&240)===0){for(v=_,D=S,N=w;b=r.lencode[N+((c&(1<<v+D)-1)>>v)],_=b>>>24,S=b>>>16&255,w=b&65535,!(v+_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}c>>>=v,l-=v,r.back+=v}if(c>>>=_,l-=_,r.back+=_,r.length=w,S===0){r.mode=Mh;break}if(S&32){r.back=-1,r.mode=Sr;break}if(S&64){t.msg="invalid literal/length code",r.mode=Te;break}r.extra=S&15,r.mode=Ph;case Ph:if(r.extra){for(j=r.extra;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.length+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=$h;case $h:for(;b=r.distcode[c&(1<<r.distbits)-1],_=b>>>24,S=b>>>16&255,w=b&65535,!(_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if((S&240)===0){for(v=_,D=S,N=w;b=r.distcode[N+((c&(1<<v+D)-1)>>v)],_=b>>>24,S=b>>>16&255,w=b&65535,!(v+_<=l);){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}c>>>=v,l-=v,r.back+=v}if(c>>>=_,l-=_,r.back+=_,S&64){t.msg="invalid distance code",r.mode=Te;break}r.offset=w,r.extra=S&15,r.mode=Lh;case Lh:if(r.extra){for(j=r.extra;l<j;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}r.offset+=c&(1<<r.extra)-1,c>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Te;break}r.mode=Fh;case Fh:if(u===0)break e;if(p=f-u,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Te;break}p>r.wnext?(p-=r.wnext,h=r.wsize-p):h=r.wnext-p,p>r.length&&(p=r.length),m=r.window}else m=n,h=o-r.offset,p=r.length;p>u&&(p=u),u-=p,r.length-=p;do n[o++]=m[h++];while(--p);r.length===0&&(r.mode=As);break;case Mh:if(u===0)break e;n[o++]=r.length,u--,r.mode=As;break;case ml:if(r.wrap){for(;l<32;){if(s===0)break e;s--,c|=i[a++]<<l,l+=8}if(f-=u,t.total_out+=f,r.total+=f,r.wrap&4&&f&&(t.adler=r.check=r.flags?Ge(r.check,n,f,o-f):uo(r.check,n,f,o-f)),f=u,r.wrap&4&&(r.flags?c:qh(c))!==r.check){t.msg="incorrect data check",r.mode=Te;break}c=0,l=0}r.mode=Uh;case Uh:if(r.wrap&&r.flags){for(;l<32;){if(s===0)break e;s--,c+=i[a++]<<l,l+=8}if(r.wrap&4&&c!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Te;break}c=0,l=0}r.mode=jh;case jh:R=D2;break e;case Te:R=Z1;break e;case Y1:return J1;case X1:default:return jt}return t.next_out=o,t.avail_out=u,t.next_in=a,t.avail_in=s,r.hold=c,r.bits=l,(r.wsize||f!==t.avail_out&&r.mode<Te&&(r.mode<ml||e!==vh))&&nm(t,t.output,t.next_out,f-t.avail_out),d-=t.avail_in,f-=t.avail_out,t.total_in+=d,t.total_out+=f,r.total+=f,r.wrap&4&&f&&(t.adler=r.check=r.flags?Ge(r.check,n,f,t.next_out-f):uo(r.check,n,f,t.next_out-f)),t.data_type=r.bits+(r.last?64:0)+(r.mode===Sr?128:0)+(r.mode===xs||r.mode===hl?256:0),(d===0&&f===0||e===vh)&&R===Xi&&(R=R2),R},B2=t=>{if(cn(t))return jt;let e=t.state;return e.window&&(e.window=null),t.state=null,Xi},V2=(t,e)=>{if(cn(t))return jt;let r=t.state;return(r.wrap&2)===0?jt:(r.head=e,e.done=!1,Xi)},Q2=(t,e)=>{let r=e.length,i,n,a;return cn(t)||(i=t.state,i.wrap!==0&&i.mode!==sc)?jt:i.mode===sc&&(n=1,n=uo(n,e,r,0),n!==i.check)?Z1:(a=nm(t,e,r,r),a?(i.mode=Y1,J1):(i.havedict=1,Xi))},z2=tm,W2=rm,H2=em,G2=U2,K2=im,Z2=q2,J2=B2,Y2=V2,X2=Q2,e3="pako inflate (from Nodeca project)",Ar={inflateReset:z2,inflateReset2:W2,inflateResetKeep:H2,inflateInit:G2,inflateInit2:K2,inflate:Z2,inflateEnd:J2,inflateGetHeader:Y2,inflateSetDictionary:X2,inflateInfo:e3};function t3(){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 r3=t3,am=Object.prototype.toString,{Z_NO_FLUSH:i3,Z_FINISH:n3,Z_OK:fo,Z_STREAM_END:vl,Z_NEED_DICT:bl,Z_STREAM_ERROR:a3,Z_DATA_ERROR:Vh,Z_MEM_ERROR:o3}=sn;function So(t){this.options=bc.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});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&&!(t&&t.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 W1,this.strm.avail_out=0;let r=Ar.inflateInit2(this.strm,e.windowBits);if(r!==fo)throw new Error(Ji[r]);if(this.header=new r3,Ar.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=po.string2buf(e.dictionary):am.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=Ar.inflateSetDictionary(this.strm,e.dictionary),r!==fo)))throw new Error(Ji[r])}So.prototype.push=function(t,e){let r=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?n3:i3,am.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(i),r.next_out=0,r.avail_out=i),a=Ar.inflate(r,o),a===bl&&n&&(a=Ar.inflateSetDictionary(r,n),a===fo?a=Ar.inflate(r,o):a===Vh&&(a=bl));r.avail_in>0&&a===vl&&r.state.wrap>0&&t[r.next_in]!==0;)Ar.inflateReset(r),a=Ar.inflate(r,o);switch(a){case a3:case Vh:case bl:case o3:return this.onEnd(a),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(r.avail_out===0||a===vl))if(this.options.to==="string"){let u=po.utf8border(r.output,r.next_out),c=r.next_out-u,l=po.buf2string(r.output,u);r.next_out=c,r.avail_out=i-c,c&&r.output.set(r.output.subarray(u,u+c),0),this.onData(l)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===fo&&s===0)){if(a===vl)return a=Ar.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};So.prototype.onData=function(t){this.chunks.push(t)};So.prototype.onEnd=function(t){t===fo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=bc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ap(t,e){let r=new So(e);if(r.push(t),r.err)throw r.msg||Ji[r.err];return r.result}function s3(t,e){return e=e||{},e.raw=!0,ap(t,e)}var c3=So,u3=ap,l3=s3,p3=ap,f3=sn,d3={Inflate:c3,inflate:u3,inflateRaw:l3,ungzip:p3,constants:f3},{Deflate:h3,deflate:m3,deflateRaw:g3,gzip:y3}=S2,{Inflate:v3,inflate:b3,inflateRaw:_3,ungzip:S3}=d3,w3=h3,C3=m3,E3=g3,x3=y3,A3=v3,k3=b3,T3=_3,I3=S3,O3=sn,D3={Deflate:w3,deflate:C3,deflateRaw:E3,gzip:x3,Inflate:A3,inflate:k3,inflateRaw:T3,ungzip:I3,constants:O3},xe=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Ae=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},cc=class{constructor(e,r){this.input=e,this.output=r}};xe([g(),Ae("design:type",String)],cc.prototype,"input",void 0);xe([g(),Ae("design:type",String)],cc.prototype,"output",void 0);cc=xe([Ze(),Ae("design:paramtypes",[String,String])],cc);var uc=class{constructor(e,r){this.input=e,this.output=r}};xe([g(),Ae("design:type",String)],uc.prototype,"input",void 0);xe([g(),Ae("design:type",String)],uc.prototype,"output",void 0);uc=xe([G(),Ae("design:paramtypes",[String,String])],uc);var si=class{constructor(e,r,i,n,a){this.name=e,this.modelId=r,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};xe([g(),Ae("design:type",String)],si.prototype,"name",void 0);xe([g(),Ae("design:type",String)],si.prototype,"modelId",void 0);xe([g(),Ae("design:type",String)],si.prototype,"systemPrompt",void 0);xe([g(),Ae("design:type",Array)],si.prototype,"promptExamples",void 0);xe([g(),Ae("design:type",String)],si.prototype,"metaData",void 0);si=xe([Ze(),Ae("design:paramtypes",[String,String,String,Array,String])],si);var hr=class{constructor(e,r,i,n,a,o,s,u){this.name=e,this.modelId=r,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=u}};xe([g(),Ae("design:type",String)],hr.prototype,"name",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"modelId",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"taskId",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"systemPrompt",void 0);xe([g(),Ae("design:type",Array)],hr.prototype,"promptExamples",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"metaData",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"createdAt",void 0);xe([g(),Ae("design:type",String)],hr.prototype,"updatedAt",void 0);hr=xe([G(),Ae("design:paramtypes",[String,String,String,String,Array,String,String,String])],hr);var en=class{constructor(e,r,i,n,a){this.model=e,this.status=r,this.progress=i,this.downloaded=n,this.loaded=a}};xe([g(),Ae("design:type",String)],en.prototype,"model",void 0);xe([g(),Ae("design:type",String)],en.prototype,"status",void 0);xe([g(),Ae("design:type",Number)],en.prototype,"progress",void 0);xe([g(),Ae("design:type",Boolean)],en.prototype,"downloaded",void 0);xe([g(),Ae("design:type",Boolean)],en.prototype,"loaded",void 0);en=xe([G(),Ae("design:paramtypes",[String,String,Number,Boolean,Boolean])],en);var N3=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},ze=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},Ve,js,Vl=class{constructor(e,r=!0){Ve.set(this,void 0),js.set(this,new Map),N3(this,Ve,e,"f")}async getModels(){let e=await ze(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 r=await ze(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(r).aiAddModel}async updateModel(e,r){let i=await ze(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:r}});return k(i).aiUpdateModel}async removeModel(e){let r=await ze(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(r).aiRemoveModel}async setDefaultModel(e,r){let i=await ze(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:r,modelType:e}});return k(i).aiSetDefaultModel}async getDefaultModel(e){let r=await ze(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(r).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await ze(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,r,i,n,a){let o=new si(e,r,i,n,a),{aiAddTask:s}=k(await ze(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:r}=k(await ze(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 r}async updateTask(e,r){let{aiUpdateTask:i}=k(await ze(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:r.name,modelId:r.modelId,systemPrompt:r.systemPrompt,promptExamples:r.promptExamples}}}));return i}async modelLoadingStatus(e){let{aiModelLoadingStatus:r}=k(await ze(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 r}async prompt(e,r){let{aiPrompt:i}=k(await ze(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:r}}));return i}async embed(e,r){let{aiEmbed:i}=k(await ze(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:r}})),n=yc.toByteArray(i);return JSON.parse(D3.inflate(n,{to:"string"}))}async openTranscriptionStream(e,r,i){let{aiOpenTranscriptionStream:n}=k(await ze(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=ze(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 r(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return ze(this,js,"f").set(n,a),n}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:r}=k(await ze(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=ze(this,js,"f").get(e);return i.closed||i.unsubscribe(),r}async feedTranscriptionStream(e,r){let{aiFeedTranscriptionStream:i}=k(await ze(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:r}}));return i}};Ve=new WeakMap,js=new WeakMap;var Hr=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Be=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},ar,qs,Ga,Bs,Ka,Mi,Vs,Za,ho=class{constructor(e,r=!0){ar.set(this,void 0),qs.set(this,void 0),Ga.set(this,void 0),Bs.set(this,void 0),Ka.set(this,void 0),Mi.set(this,void 0),Vs.set(this,void 0),Za.set(this,void 0),Hr(this,ar,e,"f"),Hr(this,qs,new no(Be(this,ar,"f"),r),"f"),Hr(this,Ga,new Rl(Be(this,ar,"f")),"f"),Hr(this,Bs,new Ol(Be(this,ar,"f")),"f"),Hr(this,Ka,new Dl(Be(this,ar,"f")),"f"),Hr(this,Za,new Vl(Be(this,ar,"f"),r),"f"),Hr(this,Mi,new nc(Be(this,ar,"f"),r),"f"),Be(this,Mi,"f").setExpressionClient(Be(this,Ga,"f")),Be(this,Mi,"f").setNeighbourhoodClient(Be(this,Ka,"f")),Be(this,Mi,"f").setAIClient(Be(this,Za,"f")),Hr(this,Vs,new Nl(Be(this,ar,"f"),r),"f")}get agent(){return Be(this,qs,"f")}get expression(){return Be(this,Ga,"f")}get languages(){return Be(this,Bs,"f")}get neighbourhood(){return Be(this,Ka,"f")}get perspective(){return Be(this,Mi,"f")}get runtime(){return Be(this,Vs,"f")}get ai(){return Be(this,Za,"f")}};ar=new WeakMap,qs=new WeakMap,Ga=new WeakMap,Bs=new WeakMap,Ka=new WeakMap,Mi=new WeakMap,Vs=new WeakMap,Za=new WeakMap;var Ql;(function(t){t.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",t.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",t.AgentIsUntrusted="AGENT_IS_UNTRUSTED",t.CapabilityRequested="CAPABILITY_REQUESTED",t.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(Ql||(Ql={}));var op=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},sp=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Qi=class{constructor(e,r){this.language=e,this.expression=r}};op([g(),sp("design:type",ur)],Qi.prototype,"language",void 0);op([g(),sp("design:type",String)],Qi.prototype,"expression",void 0);Qi=op([G(),sp("design:paramtypes",[ur,String])],Qi);function X8(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function e7(t){if(t.startsWith("literal://")){let a=new ur;a.address="literal",a.name="literal";let o=t.substring(10);return new Qi(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new ur;return s.address=a,new Qi(s,o)}let n=/^did:([^\s]+)$/.exec(t);if(n&&n.length==2){let a=new ur;return a.address="did",new Qi(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var Nt=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},mr=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},lc=class{};Nt([g(),mr("design:type",String)],lc.prototype,"name",void 0);Nt([g(),mr("design:type",String)],lc.prototype,"type",void 0);lc=Nt([G()],lc);var mo=class{};Nt([g(),mr("design:type",String)],mo.prototype,"label",void 0);Nt([g(),mr("design:type",String)],mo.prototype,"name",void 0);Nt([g(),mr("design:type",Array)],mo.prototype,"parameters",void 0);mo=Nt([G()],mo);var pc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};Nt([g(),mr("design:type",String)],pc.prototype,"name",void 0);Nt([g(),mr("design:type",String)],pc.prototype,"parametersStringified",void 0);pc=Nt([Ze(),mr("design:paramtypes",[String,Object])],pc);var fc=class{};Nt([g(),mr("design:type",String)],fc.prototype,"did",void 0);Nt([g(),mr("design:type",Ki)],fc.prototype,"status",void 0);fc=Nt([G()],fc);var Qh=class{},un=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},ra=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ci=class{};un([g(),ra("design:type",String)],ci.prototype,"name",void 0);un([g(),ra("design:type",String)],ci.prototype,"address",void 0);un([g(),ra("design:type",String)],ci.prototype,"settings",void 0);un([g(),ra("design:type",Wi)],ci.prototype,"icon",void 0);un([g(),ra("design:type",Wi)],ci.prototype,"constructorIcon",void 0);un([g(),ra("design:type",Wi)],ci.prototype,"settingsIcon",void 0);ci=un([G()],ci);var ht=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},Ct=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Gt=class{};ht([g(),Ct("design:type",String)],Gt.prototype,"name",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"address",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"description",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"author",void 0);ht([g(),Ct("design:type",Boolean)],Gt.prototype,"templated",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"templateSourceLanguageAddress",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"templateAppliedParams",void 0);ht([g(),Ct("design:type",Array)],Gt.prototype,"possibleTemplateParams",void 0);ht([g(),Ct("design:type",String)],Gt.prototype,"sourceCodeLink",void 0);Gt=ht([G()],Gt);var Hn=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ht([g(),Ct("design:type",String)],Hn.prototype,"name",void 0);ht([g(),Ct("design:type",String)],Hn.prototype,"description",void 0);ht([g(),Ct("design:type",Array)],Hn.prototype,"possibleTemplateParams",void 0);ht([g(),Ct("design:type",String)],Hn.prototype,"sourceCodeLink",void 0);Hn=ht([Ze(),Ct("design:paramtypes",[String,String])],Hn);var zh=class{},Wh=class extends pi(){},Hh=class{},Sc=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},cp=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},dc=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};Sc([g(),cp("design:type",String)],dc.prototype,"linkLanguage",void 0);Sc([g(),cp("design:type",fr)],dc.prototype,"meta",void 0);dc=Sc([G(),cp("design:paramtypes",[String,fr])],dc);var zl=class extends pi(){};zl=Sc([G()],zl);var ln=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},pn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Wl;(function(t){t.Private="PRIVATE",t.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",t.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",t.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",t.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",t.Synced="SYNCED"})(Wl||(Wl={}));var ui=class{constructor(e,r,i){this.uuid=e,this.name=r,i?this.state=i:this.state=Wl.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",zl)],ui.prototype,"neighbourhood",void 0);ln([g(),pn("design:type",Array)],ui.prototype,"owners",void 0);ui=ln([G(),pn("design:paramtypes",[String,String,String])],ui);var wc=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},om=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},hc=class{};wc([g(),om("design:type",Array)],hc.prototype,"additions",void 0);wc([g(),om("design:type",Array)],hc.prototype,"removals",void 0);hc=wc([G()],hc);var Gh=class extends pi(){};Gh=wc([G()],Gh);var Kh=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},Fn=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},Ja,Ui,ks="smart_literal://content";function R3(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=r.length;for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*i));return e}var go=class{constructor(e,r){Ja.set(this,void 0),Ui.set(this,void 0),Kh(this,Ja,e,"f"),Kh(this,Ui,r,"f")}get base(){return Fn(this,Ui,"f")}static async create(e,r){let i=wt.from(R3(10)).toUrl(),n=new go(e,i);return await n.set(r),n}static async isSmartLiteralBase(e,r){return(await e.get(new ot({source:r,predicate:ks}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new ot({predicate:ks}))).map(i=>new go(e,i.data.source))}async get(){let e=await Fn(this,Ja,"f").getSingleTarget(new ot({source:Fn(this,Ui,"f"),predicate:ks}));if(!e)throw`No content for smart literal ${Fn(this,Ui,"f")}`;return wt.fromUrl(e).get()}async set(e){let r=wt.from(e);await Fn(this,Ja,"f").setSingleTarget(new Gi({source:Fn(this,Ui,"f"),predicate:ks,target:r.toUrl()}))}};Ja=new WeakMap,Ui=new WeakMap;var Zh=class{};function d7(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function h7(t){return`triple(this, "${t}", _)`}function m7(t){return function(e,r,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,u=`subject_class("${s}", C), instance(C, Instance)`;if(t&&t.where)for(let l in t.where){let d=t.where[l];u+=`, property_getter(C, Instance, "${l}", "${d}")`}t&&t.condition&&(u+=", "+t.condition);let c=await a.infer(u);if(c==!1)return o;if(typeof c=="string")throw c;for(let l of c){let d=l.Instance,f=new rc(a,d,s);await f.init(),o.push(f)}return o}}}function sm(t){return function(e,r){if(typeof t.writable>"u"&&t.through&&(t.writable=!0),t.required&&!t.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!t.through&&!t.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],...t},t.writable){let i=r;e[`set${ei(i)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function g7(t){return function(e,r){if(!t.through&&!t.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!t.through)throw new Error("SubjectFlag requires a 'through' option");if(!t.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],through:t.through,required:!0,initial:t.value,flag:!0},e[r]=t.value,Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function y7(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let i=r;e[`add${ei(i)}`]=()=>{},e[`remove${ei(i)}`]=()=>{},e[`setCollection${ei(i)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function cm(t){let e="",r="abcdefghijklmnopqrstuvwxyz",i=r.length;for(let n=0;n<t;n++)e+=r.charAt(Math.floor(Math.random()*i));return e}function P3(t){return function(e){e.prototype.className=t.name,e.className=t.name,e.generateSDNA=function(){let r="",i=t.name,n=e.prototype,a=cm(8);r+=`subject_class("${i}", ${a}).
905
- `;let o=[],s=[];n.subjectConstructor&&n.subjectConstructor.length&&(s=s.concat(n.subjectConstructor));let u=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(u=u.concat(n.isSubjectInstance));let c=[],l=n.__properties||{};for(let h in l){let m=`property(${a}, "${h}").
906
- `,{through:b,initial:_,required:S,resolveLanguage:w,writable:v,flag:D,getter:N,setter:A,local:R}=l[h];if(w&&(m+=`property_resolve(${a}, "${h}").
907
- `,m+=`property_resolve_language(${a}, "${h}", "${w}").
908
- `),N?m+=`property_getter(${a}, Base, "${h}", Value) :- ${N}.
909
- `:b&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${b}", Value).
910
- `,S&&(D?u.push(`triple(Base, "${b}", "${_}")`):u.push(`triple(Base, "${b}", _)`))),A)m+=`property_setter(${a}, "${h}", Actions) :- ${A}.
911
- `;else if(v&&b&&typeof n[Jl(h)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:b,target:"value",...R&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${Di(P)}').
912
- `}c.push(m),_&&(s.push({action:"addLink",source:"this",predicate:b,target:_}),o.push({action:"removeLink",source:"this",predicate:b,target:"*"}))}let d=[],f=n.__collections||{};for(let h in f){let m=`collection(${a}, "${h}").
913
- `,{through:b,where:_,local:S}=f[h];if(b){if(_){if(!_.isInstance&&!_.condition)throw"'where' needs one of 'isInstance' or 'condition'";let N=[];if(_.isInstance){let R;_.isInstance.name?R=_.isInstance.name:R=_.isInstance,N.push(`instance(OtherClass, Target), subject_class("${R}", OtherClass)`)}_.condition&&N.push(_.condition);let A=N.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${b}", Target), ${A}), List).
914
- `}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${b}", C), List).
915
- `;let w=[{action:"addLink",source:"this",predicate:b,target:"value",...S&&{local:!0}}],v=[{action:"removeLink",source:"this",predicate:b,target:"value"}],D=[{action:"collectionSetter",source:"this",predicate:b,target:"value",...S&&{local:!0}}];m+=`collection_adder(${a}, "${kr(h)}", '${Di(w)}').
916
- `,m+=`collection_remover(${a}, "${kr(h)}", '${Di(v)}').
917
- `,m+=`collection_setter(${a}, "${kr(h)}", '${Di(D)}').
918
- `}d.push(m)}let p=Di(s);if(r+=`constructor(${a}, '${p}').
919
- `,u.length>0){let h=u.join(", ");r+=`instance(${a}, Base) :- ${h}.
920
- `,r+=`
921
- `}return r+=`destructor(${a}, '${Di(o)}').
922
- `,r+=`
923
- `,r+=c.join(`
924
- `),r+=`
925
- `,r+=d.join(`
926
- `),{sdna:r,name:i}},Object.defineProperty(e,"type",{configurable:!0})}}function v7(t){return sm({...t,required:!0,writable:!0,initial:t.initial||"literal://string:uninitialized"})}function b7(t){return sm({...t,writable:!1})}var _7=`
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
+ `,m+=`property_resolve_language(${a}, "${h}", "${S}").
908
+ `),R?m+=`property_getter(${a}, Base, "${h}", Value) :- ${R}.
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
+ `,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
920
+ `,t+=`
921
+ `}return t+=`destructor(${a}, '${Di(o)}').
922
+ `,t+=`
923
+ `,t+=u.join(`
924
+ `),t+=`
925
+ `,t+=d.join(`
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 Jh(t){return t?.length?t.length===1?t.toString():t.length===2?t.join(" and "):t.slice(0,-1).join(", ")+", and "+t.slice(-1):""}function um(t){let e=t.can.includes("*")?["READ","WRITE","UPDATE"]:t.can,r=t.with.domain==="*"?"":t.with.domain,i=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${Jh(e)} your ${r} actions, with access to ${Jh(i)}`}var O=function(t,e,r,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,r):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,i);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(n<3?o(a):n>3?o(e,r,a):o(e,r))||a);return n>3&&a&&Object.defineProperty(e,r,a),a},y=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},X=function(t,e){return function(r,i){e(r,i,t)}},wo=new ni;wo.author="did:ad4m:test";wo.timestamp=Date.now();wo.data={source:"root",target:"neighbourhood://Qm12345"};wo.proof={signature:"",key:"",valid:!0};var Yr=new Ki;Yr.author="did:ad4m:test";Yr.timestamp=Date.now().toString();Yr.proof=new Tr("","");Yr.data=new fr([wo]);var mc=class{};O([g(),y("design:type",String)],mc.prototype,"recipient",void 0);O([g(),y("design:type",Ki)],mc.prototype,"message",void 0);mc=O([G()],mc);var Gn=class{};O([g(),y("design:type",String)],Gn.prototype,"ad4mExecutorVersion",void 0);O([g(),y("design:type",Boolean)],Gn.prototype,"isInitialized",void 0);O([g(),y("design:type",Boolean)],Gn.prototype,"isUnlocked",void 0);Gn=O([G()],Gn);var tn=class{};O([g(),y("design:type",String)],tn.prototype,"title",void 0);O([g(),y("design:type",String)],tn.prototype,"message",void 0);O([g(),y("design:type",String)],tn.prototype,"type",void 0);O([g(),y("design:type",String)],tn.prototype,"addon",void 0);tn=O([G()],tn);var qt=class{};O([g(),y("design:type",String)],qt.prototype,"description",void 0);O([g(),y("design:type",String)],qt.prototype,"appName",void 0);O([g(),y("design:type",String)],qt.prototype,"appUrl",void 0);O([g(),y("design:type",String)],qt.prototype,"appIconPath",void 0);O([g(),y("design:type",String)],qt.prototype,"trigger",void 0);O([g(),y("design:type",Array)],qt.prototype,"perspectiveIds",void 0);O([g(),y("design:type",String)],qt.prototype,"webhookUrl",void 0);O([g(),y("design:type",String)],qt.prototype,"webhookAuth",void 0);qt=O([Ze()],qt);var It=class{};O([g(),y("design:type",String)],It.prototype,"id",void 0);O([g(),y("design:type",Boolean)],It.prototype,"granted",void 0);O([g(),y("design:type",String)],It.prototype,"description",void 0);O([g(),y("design:type",String)],It.prototype,"appName",void 0);O([g(),y("design:type",String)],It.prototype,"appUrl",void 0);O([g(),y("design:type",String)],It.prototype,"appIconPath",void 0);O([g(),y("design:type",String)],It.prototype,"trigger",void 0);O([g(),y("design:type",Array)],It.prototype,"perspectiveIds",void 0);O([g(),y("design:type",String)],It.prototype,"webhookUrl",void 0);O([g(),y("design:type",String)],It.prototype,"webhookAuth",void 0);It=O([G()],It);var Kn=class{};O([g(),y("design:type",It)],Kn.prototype,"notification",void 0);O([g(),y("design:type",String)],Kn.prototype,"perspectiveId",void 0);O([g(),y("design:type",String)],Kn.prototype,"triggerMatch",void 0);Kn=O([G()],Kn);var Ke=class{};O([g(),y("design:type",Number)],Ke.prototype,"total",void 0);O([g(),y("design:type",Number)],Ke.prototype,"imported",void 0);O([g(),y("design:type",Number)],Ke.prototype,"failed",void 0);O([g(),y("design:type",Number)],Ke.prototype,"omitted",void 0);O([g(),y("design:type",Array)],Ke.prototype,"errors",void 0);Ke=O([G()],Ke);var Ot=class{};O([g(),y("design:type",Ke)],Ot.prototype,"perspectives",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"links",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"expressions",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"perspectiveDiffs",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"notifications",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"models",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"defaultModels",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"tasks",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"friends",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"trustedAgents",void 0);O([g(),y("design:type",Ke)],Ot.prototype,"knownLinkLanguages",void 0);Ot=O([G()],Ot);var Zn=class{};O([g(),y("design:type",String)],Zn.prototype,"email",void 0);O([g(),y("design:type",String)],Zn.prototype,"did",void 0);O([g(),y("design:type",String)],Zn.prototype,"lastSeen",void 0);O([g(),y("design:type",Number)],Zn.prototype,"perspectiveCount",void 0);Zn=O([G()],Zn);var rn=class{};O([g(),y("design:type",Boolean)],rn.prototype,"success",void 0);O([g(),y("design:type",String)],rn.prototype,"message",void 0);O([g(),y("design:type",Boolean)],rn.prototype,"requiresPassword",void 0);O([g(),y("design:type",Boolean)],rn.prototype,"isExistingUser",void 0);rn=O([G()],rn);var V=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,r,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Yr}runtimeFriendSendMessage(e,r){return!0}runtimeMessageInbox(e){return[Yr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Yr}]}runtimeMessageReceived(){return Yr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Ql.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,r){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,r){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,r){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,r,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,r,i){return new Zi("did:key:test123",!0)}runtimeLoginUser(e,r){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,r,i){return!0}};O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeQuit",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeOpenLink",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Gn)],V.prototype,"runtimeInfo",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"addTrustedAgents",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"deleteTrustedAgents",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"getTrustedAgents",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"runtimeKnownLinkLanguageTemplates",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"runtimeAddKnownLinkLanguageTemplates",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"runtimeFriends",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"runtimeAddFriends",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Array]),y("design:returntype",Array)],V.prototype,"runtimeRemoveFriends",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",String)],V.prototype,"runtimeHcAgentInfos",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",String)],V.prototype,"runtimeGetNetworkMetrics",null);O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeRestartHolochain",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Object]),y("design:returntype",Boolean)],V.prototype,"runtimeHcAddAgentInfos",null);O([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)],V.prototype,"runtimeVerifyStringSignedByDid",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[fr]),y("design:returntype",Boolean)],V.prototype,"runtimeSetStatus",null);O([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Ki)],V.prototype,"runtimeFriendStatus",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,Ys]),y("design:returntype",Boolean)],V.prototype,"runtimeFriendSendMessage",null);O([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Array)],V.prototype,"runtimeMessageInbox",null);O([Dt(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Array)],V.prototype,"runtimeMessageOutbox",null);O([Gl(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Ki)],V.prototype,"runtimeMessageReceived",null);O([Gl(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",tn)],V.prototype,"exceptionOccurred",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[qt]),y("design:returntype",String)],V.prototype,"runtimeRequestInstallNotification",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"runtimeNotifications",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,qt]),y("design:returntype",Boolean)],V.prototype,"runtimeUpdateNotification",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeRemoveNotification",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeGrantNotification",null);O([Gl(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Kn)],V.prototype,"runtimeNotificationTriggered",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeExportDb",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeImportDb",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",Boolean)],V.prototype,"runtimeExportPerspective",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeImportPerspective",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeMultiUserEnabled",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[Boolean]),y("design:returntype",Boolean)],V.prototype,"runtimeSetMultiUserEnabled",null);O([Dt(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Array)],V.prototype,"runtimeListUsers",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,dr]),y("design:returntype",rn)],V.prototype,"runtimeRequestLoginVerification",null);O([_e(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,String]),y("design:returntype",String)],V.prototype,"runtimeVerifyEmailCode",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",Boolean)],V.prototype,"runtimeTestEmail",null);O([_e(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,dr]),y("design:returntype",Zi)],V.prototype,"runtimeCreateUser",null);O([_e(),X(0,Y()),X(1,Y()),y("design:type",Function),y("design:paramtypes",[String,String]),y("design:returntype",String)],V.prototype,"runtimeLoginUser",null);O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeEmailTestModeEnable",null);O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeEmailTestModeDisable",null);O([_e(),X(0,Y()),y("design:type",Function),y("design:paramtypes",[String]),y("design:returntype",String)],V.prototype,"runtimeEmailTestGetCode",null);O([_e(),y("design:type",Function),y("design:paramtypes",[]),y("design:returntype",Boolean)],V.prototype,"runtimeEmailTestClearCodes",null);O([_e(),X(0,Y()),X(1,Y()),X(2,Y()),y("design:type",Function),y("design:paramtypes",[String,String,Number]),y("design:returntype",Boolean)],V.prototype,"runtimeEmailTestSetExpiry",null);V=O([d0()],V);var Na=function(t,e,r,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"?t!==e||!n:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(t,r):n?n.value=r:e.set(t,r),r},ne=function(t,e,r,i){if(r==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?i:r==="a"?i.call(t):i?i.value:e.get(t)},_t,or,Qs,Ne;function zs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Yh(t){return t?`triple("${t}", "ad4m://has_child", Base)`:""}function _l(){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,52 +1517,57 @@ input VoiceActivityParamsInput {
1517
1517
  ),
1518
1518
  sort(AllLinks, SortedLinks),
1519
1519
  SortedLinks = [[Timestamp, Author]|_]
1520
- `}function Xh(t){return`
1520
+ `}function t1(r){return`
1521
1521
  findall([PropertyName, PropertyValue, Resolve], (
1522
1522
  % Constrain to specified properties if provided
1523
- ${t?`member(PropertyName, [${t.map(e=>`"${e}"`).join(", ")}]),`:""}
1523
+ ${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
1524
1524
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1525
1525
  ), Properties)
1526
- `}function e1(t){return`
1526
+ `}function r1(r){return`
1527
1527
  findall([CollectionName, CollectionValues], (
1528
1528
  % Constrain to specified collections if provided
1529
- ${t?`member(CollectionName, [${t.map(e=>`"${e}"`).join(", ")}]),`:""}
1529
+ ${r?`member(CollectionName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
1530
1530
 
1531
1531
  collection(SubjectClass, CollectionName),
1532
1532
  collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
1533
1533
  ), Collections)
1534
- `}function t1(t={}){function e(r){return typeof r=="string"?`"${r}"`:r}return Object.entries(t).map(([r,i])=>{let n=["base","author","timestamp"].includes(r),a=`resolve_property(SubjectClass, Base, "${r}", Value${r}, _)`,o=zs(r);if(Array.isArray(i)){let s=i.map(u=>e(u)).join(", ");return n?`member(${o}, [${s}])`:`${a}, member(Value${r}, [${s}])`}if(typeof i=="object"&&i!==null){let{not:s,between:u,lt:c,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${r}, [${h}])`}else return n?`${o} \\= ${e(s)}`:`${a}, Value${r} \\= ${e(s)}`;if(u!==void 0&&Array.isArray(u)&&u.length===2)return n?`${o} >= ${u[0]}, ${o} =< ${u[1]}`:`${a}, Value${r} >= ${u[0]}, Value${r} =< ${u[1]}`;let p=[{value:c,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${r} ${m} ${h}`}return n?`${o} = ${e(i)}`:`${a}, Value${r} = ${e(i)}`}).join(", ")}function r1(t){return t?"length(UnsortedInstances, TotalCount)":""}function i1(t){if(!t)return"SortedInstances = UnsortedInstances";let[e,r]=Object.entries(t)[0];return`sort_instances(UnsortedInstances, "${e}", "${r}", SortedInstances)`}function n1(t){return!t||t<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${t}, InstancesWithOffset)`}function a1(t){return!t||t<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${t}, AllInstances)`}function o1(t){if(!t)return"";if(t.includes("://")){let[e,r]=t.split("://"),i=(r||"").replace(/\/+$/,"");return`${e}://${i}`}else return t.replace(/\/+$/,"")}function up(t){if(!!t){if(typeof t=="string")return t;if(Array.isArray(t)&&t.length>0)return t.find(r=>r!=="null")||t[0]}}function lm(t,e){return up(t.type)===e}function s1(t){return lm(t,"array")}function c1(t){return lm(t,"object")}function $3(t){let e=up(t.type);return e==="number"||e==="integer"}var _Ad4mModel=class{static async getClassName(t){if(this===_Ad4mModel)return await t.stringOrTemplateObjectToSubjectClassName(this);let r=this.classNamesByClass.get(this);r||(r={},this.classNamesByClass.set(this,r));let i=t.uuid;return r[i]||(r[i]=await t.stringOrTemplateObjectToSubjectClassName(this)),r[i]}static getModelMetadata(){let t=this.prototype;if(!t.className||t.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let e=t.className,r={},i=t.__properties||{};for(let[c,l]of Object.entries(i)){let d=l;r[c]={name:c,predicate:d.through||"",required:d.required||!1,writable:d.writable||!1,...d.initial!==void 0&&{initial:d.initial},...d.resolveLanguage!==void 0&&{resolveLanguage:d.resolveLanguage},...d.getter!==void 0&&{getter:d.getter},...d.setter!==void 0&&{setter:d.setter},...d.local!==void 0&&{local:d.local},...d.transform!==void 0&&{transform:d.transform},...d.flag!==void 0&&{flag:d.flag}}}let n={},a=t.__collections||{};for(let[c,l]of Object.entries(a)){let d=l;n[c]={name:c,predicate:d.through||"",...d.where!==void 0&&{where:d.where},...d.local!==void 0&&{local:d.local}}}let o=Object.keys(r).length>0,s=Object.keys(n).length>0;if(!(o||s)&&t.__jsonSchema){let c=t.__jsonSchema,l=t.__jsonSchemaOptions||{};if(c.properties)for(let[d,f]of Object.entries(c.properties)){let p=s1(f),h=this.determinePredicate(c,d,f,this.determineNamespace(c,l),l);if(p)n[d]={name:d,predicate:h,...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}};else{let m=c.required?.includes(d)||!1;r[d]={name:d,predicate:h,required:m,writable:f["x-ad4m"]?.writable!==!1,...f["x-ad4m"]?.resolveLanguage&&{resolveLanguage:f["x-ad4m"].resolveLanguage},...f["x-ad4m"]?.initial&&{initial:f["x-ad4m"].initial},...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}}}}}return{className:e,properties:r,collections:n}}constructor(t,e,r){_t.set(this,void 0),or.set(this,void 0),Qs.set(this,void 0),Ne.set(this,void 0),Na(this,_t,e||wt.from(cm(24)).toUrl(),"f"),Na(this,Ne,t,"f"),Na(this,Qs,r||"ad4m://self","f")}get baseExpression(){return ne(this,_t,"f")}get perspective(){return ne(this,Ne,"f")}static async assignValuesToInstance(t,e,r){let i=Object.fromEntries(await Promise.all(r.map(async([n,a,o])=>{let s=a;if(!o&&typeof a=="string"){let c=Array.from(a,f=>f.codePointAt(0)),l=c.every(f=>f<=255),d=c.some(f=>f>=128);if(l&&d)try{let f=Uint8Array.from(c),p=new TextDecoder("utf-8",{fatal:!0}).decode(f);p!==a&&(s=p)}catch(f){console.warn(`UTF-8 byte reconstruction failed for property "${n}"`,{value:a,error:f})}}if(o){let c=await t.getExpression(a);if(c)try{s=JSON.parse(c.data)}catch{s=c.data}}let u=e.__properties?.[n]?.transform;return u&&typeof u=="function"&&(s=u(s)),[n,s]})));Object.assign(e,i)}async getData(){let t=[_l(),Xh(),e1()],e=`
1535
- Base = "${ne(this,_t,"f")}",
1536
- subject_class("${ne(this,or,"f")}", SubjectClass),
1537
- ${t.join(", ")}
1538
- `,r=await ne(this,Ne,"f").infer(e);if(r?.[0]){let{Properties:i,Collections:n,Timestamp:a,Author:o}=r?.[0],s=[...i,...n,["timestamp",a],["author",o]];await _Ad4mModel.assignValuesToInstance(ne(this,Ne,"f"),this,s)}return this}static async queryToProlog(t,e,r){let{source:i,properties:n,collections:a,where:o,order:s,offset:u,limit:c,count:l}=e,d=r||await this.getClassName(t),f=[_l(),Yh(i),Xh(n),e1(a),t1(o)],p=[r1(l),i1(s),n1(u),a1(c)];return`
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
+ ${e.join(", ")}
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
+ SELECT id, predicate, out.uri AS target, author, timestamp
1540
+ FROM link
1541
+ WHERE in.uri = ${i.formatSurrealValue(fe(this,at,"f"))}
1542
+ ORDER BY timestamp ASC
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`
1539
1544
  findall([Base, Properties, Collections, Timestamp, Author], (
1540
- subject_class("${d}", SubjectClass),
1545
+ subject_class("${f}", SubjectClass),
1541
1546
  instance(SubjectClass, Base),
1542
- ${f.filter(m=>m).join(", ")}
1547
+ ${p.filter(y=>y).join(", ")}
1543
1548
  ), UnsortedInstances),
1544
- ${p.filter(m=>m).join(", ")}
1545
- `}static async queryToSurrealQL(t,e){let r=this.getModelMetadata(),{source:i,where:n,order:a,offset:o,limit:s}=e,u=[];i&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(i)} AND predicate = 'ad4m://has_child']) > 0`);for(let[f,p]of Object.entries(r.properties))p.required&&(p.flag&&p.initial?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${p.predicate}' AND out.uri = '${p.initial}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${p.predicate}']) > 0`));if(u.length===0){for(let[f,p]of Object.entries(r.properties))if(p.initial){p.flag?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${p.predicate}' AND out.uri = '${p.initial}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${p.predicate}']) > 0`);break}}let c=this.buildGraphTraversalWhereClause(r,n),l=[];return l.push(...u),c&&l.push(c),l.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"),`
1546
1551
  SELECT
1547
1552
  id AS source,
1548
1553
  uri AS source_uri,
1549
1554
  ->link[WHERE perspective = $perspective] AS links
1550
1555
  FROM node
1551
- WHERE ${l.join(" AND ")}
1552
- `.trim()}static buildGraphTraversalWhereClause(t,e){if(!e)return"";let r=[];for(let[i,n]of Object.entries(e))if(["base","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let o="uri";if(Array.isArray(n)){let s=n.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} IN [${s}]`)}else if(typeof n=="object"&&n!==null){let s=n;if(s.not!==void 0)if(Array.isArray(s.not)){let u=s.not.map(c=>this.formatSurrealValue(c)).join(", ");r.push(`${o} NOT IN [${u}]`)}else r.push(`${o} != ${this.formatSurrealValue(s.not)}`);s.between!==void 0&&Array.isArray(s.between)&&s.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(s.between[0])} AND ${o} <= ${this.formatSurrealValue(s.between[1])}`),s.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(s.gt)}`),s.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(s.gte)}`),s.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(s.lt)}`),s.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(s.lte)}`),s.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(s.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(n)}`)}else{let o=t.properties[i];if(!o)continue;let s=o.predicate,u=o.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(n)){let c=n.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${s}' AND ${u} IN [${c}]]) > 0`)}else if(typeof n=="object"&&n!==null){let c=n;if(c.not!==void 0)if(Array.isArray(c.not)){let d=c.not.map(f=>this.formatSurrealValue(f)).join(", ");r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${s}' AND ${u} IN [${d}]]) = 0`)}else r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${s}' AND ${u} = ${this.formatSurrealValue(c.not)}]) = 0`);(c.gt!==void 0||c.gte!==void 0||c.lt!==void 0||c.lte!==void 0||c.between!==void 0||c.contains!==void 0)&&r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${s}']) > 0`)}else r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${s}' AND ${u} = ${this.formatSurrealValue(n)}]) > 0`)}return r.join(" AND ")}static buildSurrealWhereClause(t,e){if(!e)return"";let r=[];for(let[i,n]of Object.entries(e))if(["base","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let o="source";if(Array.isArray(n)){let s=n.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} IN [${s}]`)}else if(typeof n=="object"&&n!==null){let s=n;if(s.not!==void 0)if(Array.isArray(s.not)){let u=s.not.map(c=>this.formatSurrealValue(c)).join(", ");r.push(`${o} NOT IN [${u}]`)}else r.push(`${o} != ${this.formatSurrealValue(s.not)}`);s.between!==void 0&&Array.isArray(s.between)&&s.between.length===2&&r.push(`${o} >= ${this.formatSurrealValue(s.between[0])} AND ${o} <= ${this.formatSurrealValue(s.between[1])}`),s.gt!==void 0&&r.push(`${o} > ${this.formatSurrealValue(s.gt)}`),s.gte!==void 0&&r.push(`${o} >= ${this.formatSurrealValue(s.gte)}`),s.lt!==void 0&&r.push(`${o} < ${this.formatSurrealValue(s.lt)}`),s.lte!==void 0&&r.push(`${o} <= ${this.formatSurrealValue(s.lte)}`),s.contains!==void 0&&r.push(`${o} CONTAINS ${this.formatSurrealValue(s.contains)}`)}else r.push(`${o} = ${this.formatSurrealValue(n)}`)}else{let o=t.properties[i];if(!o)continue;let s=o.predicate,u=o.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(n)){let c=n.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${s}' AND ${u} IN [${c}])`)}else if(typeof n=="object"&&n!==null){let c=n;if(c.not!==void 0)if(Array.isArray(c.not)){let d=c.not.map(f=>this.formatSurrealValue(f)).join(", ");r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${s}' AND ${u} IN [${d}])`)}else r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${s}' AND ${u} = ${this.formatSurrealValue(c.not)})`);(c.gt!==void 0||c.gte!==void 0||c.lt!==void 0||c.lte!==void 0||c.between!==void 0||c.contains!==void 0)&&r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${s}')`)}else r.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${s}' AND ${u} = ${this.formatSurrealValue(n)})`)}return r.join(" AND ")}static buildSurrealSelectFields(t,e,r){let i=[],n=e||Object.keys(t.properties);for(let o of n){let s=t.properties[o];!s||i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${s.predicate}' LIMIT 1) AS ${o}`)}let a=r||Object.keys(t.collections);for(let o of a){let s=t.collections[o];!s||i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${s.predicate}') AS ${o}`)}return i.push("(SELECT VALUE author FROM link WHERE source = source LIMIT 1) AS author"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source LIMIT 1) AS timestamp"),i.join(`,
1553
- `)}static buildSurrealSelectFieldsWithAggregation(t,e,r){let i=[],n=e||Object.keys(t.properties);for(let o of n){let s=t.properties[o];!s||i.push(`array::first(target[WHERE predicate = '${s.predicate}']) AS ${o}`)}let a=r||Object.keys(t.collections);for(let o of a){let s=t.collections[o];!s||i.push(`target[WHERE predicate = '${s.predicate}'] AS ${o}`)}return i.push("array::first(author) AS author"),i.push("array::first(timestamp) AS timestamp"),i.join(`,
1554
- `)}static formatSurrealValue(t){return typeof t=="string"?`'${t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof t=="number"||typeof t=="boolean"?String(t):Array.isArray(t)?`[${t.map(e=>this.formatSurrealValue(e)).join(", ")}]`:String(t)}static async instancesFromPrologResult(t,e,r){if(!r?.[0]?.AllInstances)return{results:[],totalCount:0};let i=[...e?.properties||[],...e?.collections||[]];return{results:(await Promise.all(r[0].AllInstances.map(async([a,o,s,u,c])=>{try{let l=new this(t,a);i.length&&Object.keys(l).forEach(f=>{i.includes(f)||delete l[f]});let d=[...o,...s,["timestamp",u],["author",c]];return await _Ad4mModel.assignValuesToInstance(t,l,d),l}catch(l){return console.error(`Failed to process instance ${a}:`,l),null}}))).filter(a=>a!==null),totalCount:r[0].TotalCount}}static async instancesFromSurrealResult(t,e,r){if(!r||r.length===0)return{results:[],totalCount:0};let i=this.getModelMetadata(),n=e?.properties||[],a=e?.collections||[],o=[];for(let d of r){let f;try{if(f=d.source_uri,!f)continue;let p=d.links||[],h=new this(t,f),m=null,b=null;for(let _=0;_<p.length;_++){let S=p[_],w=S.predicate,v=S.target;if(v==="None")continue;S.timestamp&&(!m||S.timestamp>m)&&(m=S.timestamp,b=S.author);let D=!1;for(let[N,A]of Object.entries(i.properties))if(A.predicate===w){let R=h[N],F=typeof R=="object"&&R!==null&&!Array.isArray(R)&&Object.keys(R).length===0;if(!R||R===""||R===0||F){let P=v;if(v!=null){if(A.resolveLanguage!=null&&A.resolveLanguage!=="literal"&&typeof v=="string")try{let j=await t.getExpression(v);if(j)try{P=JSON.parse(j.data)}catch{P=j.data}}catch(j){console.warn(`Failed to resolve expression for ${N}:`,j),P=v}else if(typeof v=="string"&&v.startsWith("literal://"))try{let j=wt.fromUrl(v).get();j.data!==void 0?P=j.data:P=j}catch{P=v}else if(typeof v=="string"){let j=typeof h[N];j==="number"?P=Number(v):j==="boolean"&&(P=v==="true"||v==="1")}}A.transform&&typeof A.transform=="function"&&(P=A.transform(P)),h[N]=P}D=!0;break}if(!D){for(let[N,A]of Object.entries(i.collections))if(A.predicate===w){h[N]||(h[N]=[]);let R=`__${N}_timestamps`,F=`__${N}_indices`;h[R]||(h[R]=[]),h[F]||(h[F]=[]),h[N].includes(v)||(h[N].push(v),h[R].push(S.timestamp||""),h[F].push(_));break}}}if(b&&m)if(h.author=b,typeof m=="string"&&m.includes("T"))h.timestamp=new Date(m).getTime();else if(typeof m=="string"){let _=parseInt(m,10);h.timestamp=isNaN(_)?m:_}else h.timestamp=m;for(let[_,S]of Object.entries(i.collections)){let w=`__${_}_timestamps`,v=`__${_}_indices`;if(h[_]&&h[w]){let D=h[_].map((N,A)=>({value:N,timestamp:h[w][A]||"",originalIndex:h[v]?.[A]??A}));D.sort((N,A)=>{let R=String(N.timestamp||""),F=String(A.timestamp||""),P=R.localeCompare(F);return P!==0?P:N.originalIndex-A.originalIndex}),h[_]=D.map(N=>N.value),delete h[w],delete h[v]}}if(n.length>0||a.length>0){let _=[...n,...a];Object.keys(h).forEach(S=>{!_.includes(S)&&S!=="timestamp"&&S!=="author"&&S!=="baseExpression"&&delete h[S]})}o.push(h)}catch(p){console.error(`Failed to process SurrealDB instance ${f}:`,p)}}let s=o;e.where&&(s=o.filter(d=>{for(let[f,p]of Object.entries(e.where))if(f!=="base"){if(f==="author"||f==="timestamp"){if(!this.matchesCondition(d[f],p))return!1;continue}if(typeof p=="object"&&p!==null&&!Array.isArray(p)){let h=p;if((h.gt!==void 0||h.gte!==void 0||h.lt!==void 0||h.lte!==void 0||h.between!==void 0||h.contains!==void 0)&&!this.matchesCondition(d[f],p))return!1}}return!0}));let u=e.order||(e.limit!==void 0||e.offset!==void 0?{timestamp:"ASC"}:null);if(u){let d=Object.keys(u)[0],f=Object.values(u)[0];s.sort((p,h)=>{let m=p[d],b=h[d];if(m===void 0&&b===void 0)return 0;if(m===void 0)return f==="ASC"?1:-1;if(b===void 0)return f==="ASC"?-1:1;let _=0;return typeof m=="number"&&typeof b=="number"?_=m-b:typeof m=="string"&&typeof b=="string"?_=m.localeCompare(b):_=String(m).localeCompare(String(b)),f==="DESC"?-_:_})}let c=s.length,l=s;if(e.offset!==void 0||e.limit!==void 0){let d=e.offset||0,f=e.limit?d+e.limit:void 0;l=s.slice(d,f)}return{results:l,totalCount:c}}static matchesCondition(t,e){if(Array.isArray(e))return e.includes(t);if(typeof e=="object"&&e!==null){let r=e;if(r.not!==void 0)return Array.isArray(r.not)?!r.not.includes(t):t!==r.not;if(r.between!==void 0&&Array.isArray(r.between)&&r.between.length===2)return t>=r.between[0]&&t<=r.between[1];let i=!0;return r.gt!==void 0&&(i=i&&t>r.gt),r.gte!==void 0&&(i=i&&t>=r.gte),r.lt!==void 0&&(i=i&&t<r.lt),r.lte!==void 0&&(i=i&&t<=r.lte),r.contains!==void 0&&(typeof t=="string"?i=i&&t.includes(String(r.contains)):Array.isArray(t)?i=i&&t.includes(r.contains):i=!1),i}return t===e}static async findAll(t,e={},r=!0){if(r){let i=await this.queryToSurrealQL(t,e),n=await t.querySurrealDB(i),{results:a}=await this.instancesFromSurrealResult(t,e,n);return a}else{let i=await this.queryToProlog(t,e),n=await t.infer(i),{results:a}=await this.instancesFromPrologResult(t,e,n);return a}}static async findAllAndCount(t,e={},r=!0){if(r){let i=await this.queryToSurrealQL(t,e),n=await t.querySurrealDB(i);return await this.instancesFromSurrealResult(t,e,n)}else{let i=await this.queryToProlog(t,e),n=await t.infer(i);return await this.instancesFromPrologResult(t,e,n)}}static async paginate(t,e,r,i,n=!0){let a={...i||{},limit:e,offset:e*(r-1),count:!0};if(n){let o=await this.queryToSurrealQL(t,a),s=await t.querySurrealDB(o),{results:u,totalCount:c}=await this.instancesFromSurrealResult(t,a,s);return{results:u,totalCount:c,pageSize:e,pageNumber:r}}else{let o=await this.queryToProlog(t,a),s=await t.infer(o),{results:u,totalCount:c}=await this.instancesFromPrologResult(t,a,s);return{results:u,totalCount:c,pageSize:e,pageNumber:r}}}static async countQueryToProlog(t,e={},r){let{source:i,where:n}=e,a=r||await this.getClassName(t),o=[_l(),Yh(i),t1(n)],s=[r1(!0),i1(),n1(),a1()];return`
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(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`
1555
1560
  findall([Base, Properties, Collections, Timestamp, Author], (
1556
- subject_class("${a}", SubjectClass),
1561
+ subject_class("${o}", SubjectClass),
1557
1562
  instance(SubjectClass, Base),
1558
- ${o.filter(c=>c).join(", ")}
1563
+ ${s.filter(l=>l).join(", ")}
1559
1564
  ), UnsortedInstances),
1560
- ${s.filter(c=>c).join(", ")}
1561
- `}static async countQueryToSurrealQL(t,e){let r={...e};return delete r.limit,delete r.offset,await this.queryToSurrealQL(t,r)}static async count(t,e={},r=!0){if(r){let i=await this.queryToSurrealQL(t,e),n=await t.querySurrealDB(i),{totalCount:a}=await this.instancesFromSurrealResult(t,e,n);return a}else return(await t.infer(await this.countQueryToProlog(t,e)))?.[0]?.TotalCount||0}async setProperty(key,value,batchId){let setters=await ne(this,Ne,"f").infer(`subject_class("${ne(this,or,"f")}", C), property_setter(C, "${key}", Setter)`);if(setters&&setters.length>0){let actions=eval(setters[0].Setter),resolveLanguageResults=await ne(this,Ne,"f").infer(`subject_class("${ne(this,or,"f")}", C), property_resolve_language(C, "${key}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),resolveLanguage&&(value=await ne(this,Ne,"f").createExpression(value,resolveLanguage)),await ne(this,Ne,"f").executeAction(actions,ne(this,_t,"f"),[{name:"value",value}],batchId)}}async setCollectionSetter(key,value,batchId){let collectionSetters=await ne(this,Ne,"f").infer(`subject_class("${ne(this,or,"f")}", C), collection_setter(C, "${kr(key)}", Setter)`);if(collectionSetters||(collectionSetters=[]),collectionSetters.length>0){let actions=eval(collectionSetters[0].Setter);value&&(Array.isArray(value)?await ne(this,Ne,"f").executeAction(actions,ne(this,_t,"f"),value.map(t=>({name:"value",value:t})),batchId):await ne(this,Ne,"f").executeAction(actions,ne(this,_t,"f"),[{name:"value",value}],batchId))}}async setCollectionAdder(key,value,batchId){let adders=await ne(this,Ne,"f").infer(`subject_class("${ne(this,or,"f")}", C), collection_adder(C, "${kr(key)}", Adder)`);if(adders||(adders=[]),adders.length>0){let actions=eval(adders[0].Adder);value&&(Array.isArray(value)?await Promise.all(value.map(t=>ne(this,Ne,"f").executeAction(actions,ne(this,_t,"f"),[{name:"value",value:t}],batchId))):await ne(this,Ne,"f").executeAction(actions,ne(this,_t,"f"),[{name:"value",value}],batchId))}}async setCollectionRemover(key,value,batchId){let removers=await ne(this,Ne,"f").infer(`subject_class("${ne(this,or,"f")}", C), collection_remover(C, "${kr(key)}", Remover)`);if(removers||(removers=[]),removers.length>0){let actions=eval(removers[0].Remover);value&&(Array.isArray(value)?await Promise.all(value.map(t=>ne(this,Ne,"f").executeAction(actions,ne(this,_t,"f"),[{name:"value",value:t}],batchId))):await ne(this,Ne,"f").executeAction(actions,ne(this,_t,"f"),[{name:"value",value}],batchId))}}async save(t){let e=!1;t||(t=await this.perspective.createBatch(),e=!0);let r={};for(let[i,n]of Object.entries(this))n!=null&&!(Array.isArray(n)&&n.length>0)&&!n?.action&&(r[i]=n);await this.perspective.createSubject(this,ne(this,_t,"f"),r,t),await ne(this,Ne,"f").add(new Gi({source:ne(this,Qs,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",t),await this.innerUpdate(!1,t),e&&(await this.perspective.commitBatch(t),await this.getData())}cleanCopy(){let t={},e=Object.entries(this);for(let[r,i]of e)i!=null&&r!=="author"&&r!=="timestamp"&&(t[r]=i);return t}async innerUpdate(t=!0,e){Na(this,or,await ne(this,Ne,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let r=Object.entries(this);for(let[i,n]of r)if(n!=null)if(n?.action)switch(n.action){case"setter":await this.setCollectionSetter(i,n.value,e);break;case"adder":await this.setCollectionAdder(i,n.value,e);break;case"remover":await this.setCollectionRemover(i,n.value,e);break;default:await this.setCollectionSetter(i,n.value,e);break}else Array.isArray(n)&&n.length>0?await this.setCollectionSetter(i,n,e):n!=null&&n!==""&&t&&await this.setProperty(i,n,e)}async update(t){await this.innerUpdate(!0,t),await this.getData()}async get(){return Na(this,or,await ne(this,Ne,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(t){await ne(this,Ne,"f").removeSubject(this,ne(this,_t,"f"),t)}static query(t,e){return new Hl(t,this,e)}static fromJSONSchema(t,e){if(t?.properties&&Object.prototype.hasOwnProperty.call(t.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let r=this.determineNamespace(t,e),i=class extends _Ad4mModel{};if(!e.name||e.name.trim()==="")throw new Error("options.name is required and cannot be empty");i.className=e.name,i.prototype.className=e.name;let n={},a={};if(t.properties)for(let[u,c]of Object.entries(t.properties)){let l=this.determinePredicate(t,u,c,r,e),d=t.required?.includes(u)||!1,f=up(c.type);if(s1(c)){a[u]={through:l,local:this.getPropertyOption(u,c,e,"local")},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:[]});let h=`add${zs(u)}`,m=`remove${zs(u)}`,b=`setCollection${zs(u)}`;i.prototype[h]=function(){},i.prototype[m]=function(){},i.prototype[b]=function(){}}else{let h=this.getPropertyOption(u,c,e,"resolveLanguage");!h&&e.resolveLanguage&&(h=e.resolveLanguage);let m=this.getPropertyOption(u,c,e,"local"),b=this.getPropertyOption(u,c,e,"writable",!0),_=this.getPropertyOption(u,c,e,"initial");if(c1(c)&&!h&&(h="literal",console.warn(`Property "${u}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),h==null&&$3(c)&&(h="literal"),d&&!_&&(c1(c)?_="literal://json:{}":_="ad4m://undefined"),n[u]={through:l,required:d,writable:b,...h&&{resolveLanguage:h},...m!==void 0&&{local:m},..._&&{initial:_}},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(f)}),b){let S=Jl(u);i.prototype[S]=function(){}}}}if(!Object.values(n).some(u=>u.initial)){let u="ad4m://type",c;if(r.includes("://")){let[l,d]=r.split("://"),f=(d||"").replace(/\/+$/,"");f?c=`${l}://${f}/instance`:c=`${l}://instance`}else c=`${r.replace(/\/+$/,"")}/instance`;n.__ad4m_type={through:u,required:!0,writable:!1,initial:c,flag:!0},Object.defineProperty(i.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:c}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${c}`)}return i.prototype.__properties=n,i.prototype.__collections=a,i.prototype.__jsonSchema=t,i.prototype.__jsonSchemaOptions=e,P3({name:e.name})(i),i}static determineNamespace(t,e){if(e.namespace)return e.namespace;if(t["x-ad4m"]?.namespace)return t["x-ad4m"].namespace;if(t.title)return`${t.title.toLowerCase()}://`;if(t.$id)try{let i=new URL(t.$id).pathname.split("/").filter(n=>n);if(i.length>0)return`${i[i.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:
1562
1567
  - options.namespace
1563
1568
  - schema["x-ad4m"].namespace
1564
1569
  - schema.title
1565
- - valid schema.$id`)}static determinePredicate(t,e,r,i,n){if(n.propertyMapping?.[e])return n.propertyMapping[e];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(n.predicateTemplate){let o=o1(i),[s,u]=o.includes("://")?o.split("://"):["",o],c=u||"";return n.predicateTemplate.replace("${namespace}",c).replace("${scheme}",s).replace("${ns}",c).replace("${title}",t.title||"").replace("${property}",e)}if(n.predicateGenerator)return n.predicateGenerator(t.title||"",e);let a=o1(i);return a.includes("://")?`${a}${e}`:`${a}://${e}`}static getPropertyOption(t,e,r,i,n){return r.propertyOptions?.[t]?.[i]!==void 0?r.propertyOptions[t][i]:e["x-ad4m"]?.[i]!==void 0?e["x-ad4m"][i]:r[i]!==void 0?r[i]:n}static getDefaultValueForType(t){switch(t){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};_t=new WeakMap,or=new WeakMap,Qs=new WeakMap,Ne=new WeakMap;_Ad4mModel.classNamesByClass=new WeakMap;var Hl=class{constructor(e,r,i){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=r,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),r=await this.perspective.querySurrealDB(e),{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return i}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(e),{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r);return i}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);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 r=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);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),r=await this.perspective.querySurrealDB(e),{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);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 r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);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 r=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);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,r){let i={...this.queryParams||{},limit:e,offset:e*(r-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:r}}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:r}}}async paginateSubscribe(e,r,i){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(r-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 c=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,n,c);i({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:u}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:u,pageSize:e,pageNumber:r}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async c=>{let{results:l,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,c);i({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:u}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:u,pageSize:e,pageNumber:r}}}};var Cc="0.11.2-dev-multi-user-email-2";var Or=12e3;function F3(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function fi(t,e=1e4){return re(this,null,function*(){return Promise.race([new Promise((r,i)=>{let n;try{n=new WebSocket(t,"graphql-transport-ws"),n.onopen=()=>{n.close(),r(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((r,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}function lp(t){return re(this,null,function*(){try{let e=yield fetch(`http://localhost:${t}/graphql/`,{signal:F3().signal,mode:"cors"});if(e.status===400||e.status===0||e.status===200)return t;throw new Error(`Could not connect to port ${t}`)}catch(e){throw new Error(`Could not connect to port ${t}`)}})}function M3(){return new Promise((t,e)=>{let r=document.querySelector("ad4m-connect"),i=r==null?void 0:r.getAd4mClient();i?t(i):e("No Ad4mClient found")})}function pp(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function Ec(t,e){pp()&&localStorage.setItem(`${Cc}/${t}`,e)}function Kt(t){return pp()?localStorage.getItem(`${Cc}/${t}`):null}function fp(t){pp()&&localStorage.removeItem(`${Cc}/${t}`)}var U3=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};function Co(t,{include:e,exclude:r}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):r?!r.some(a):!0};for(let[n,a]of U3(t.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(t[a]=t[a].bind(t))}return t}var Eo=class{constructor(e){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=Or;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};Co(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,r){this.listeners.configstatechange.forEach(i=>{i(e,r)})}notifyConnectionChange(e){this.connectionState!==e&&(this.connectionState=e,this.listeners.connectionstatechange.forEach(r=>{r(e)}))}notifyAuthChange(e){this.authState!==e&&(this.authState=e,this.listeners.authstatechange.forEach(r=>{r(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,r){this.listeners[e].push(r)}buildTempClient(e){let r=Xu({url:e,connectionParams:()=>re(this,null,function*(){return{headers:{authorization:""}}})}),i=new ds({link:new el(r),cache:new Ta({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"}}});return new ho(i)}connect(e){return re(this,null,function*(){try{if(e){yield fi(e),this.setUrl(e);let r=this.buildClient();return yield this.checkAuth(),r}else{let r=`ws://localhost:${this.port}/graphql`;yield fi(r),this.setUrl(r);let i=this.buildClient();return yield this.checkAuth(),i}}catch(r){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 r=this.buildClient();console.debug("[Ad4m Connect] Built client:",r);let i;try{console.debug("[Ad4m Connect] Logging in user:",this.options.userEmail),i=yield r.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 r.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 r.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,r){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:r})});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,Ec("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(r){console.log(r)}})}connectToPort(e){return re(this,null,function*(){try{if(e){let r=yield lp(e);return this.setPort(r),this.buildClient()}else if(this.url.includes("localhost")){let r=yield this.findPort();return this.setPort(r),this.buildClient()}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}ensureConnection(){return re(this,null,function*(){var r,i;if(((r=this.activeSocket)==null?void 0:r.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)=>lp(Or+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=Xu({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 r=yield this.connect();r?this.ad4mClient=r:(this.notifyConnectionChange(this.token?"disconnected":"not_connected"),this.notifyAuthChange("unauthenticated"),this.requestedRestart=!1)}})}}),this.apolloClient=new ds({link:new el(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 ho(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 r;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(r=this.ad4mClient)==null?void 0:r.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 r;try{let i=yield(r=this.ad4mClient)==null?void 0:r.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(Or),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function dp({unlockAgent:t,reconnect:e}){return L`
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`
1566
1571
  <div class="text-center">
1567
1572
  <div class="items">
1568
1573
  <div>
@@ -1574,22 +1579,22 @@ WHERE ${l.join(" AND ")}
1574
1579
  <button class="button" @click=${e}>Reconnect</button>
1575
1580
  </div>
1576
1581
  </div>
1577
- `}function hp({localDetected:t,multiUserConfigured:e,backendUrl:r,configuredUrl:i,isMobile:n,onConnectLocal:a,onConnectRemote:o,onScanQR:s,onDownloadAd4m:u}){let c=!n&&t,l=!0,d=n,f=!t&&!e,p=r||i;return L`
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`
1578
1583
  <div class="items">
1579
1584
  <div class="text-center">
1580
1585
  <h3 class="heading">Connect to AD4M</h3>
1581
- ${t?L`
1586
+ ${r?F`
1582
1587
  <p class="body">Choose how you want to connect:</p>
1583
- `:L`
1588
+ `:F`
1584
1589
  <p class="body" style="color: var(--body-color); opacity: 0.8;">
1585
1590
  No local AD4M detected.
1586
- ${n?L`Connect to a remote executor or scan a QR code.`:L`Download AD4M or connect to a remote executor.`}
1591
+ ${n?F`Connect to a remote executor or scan a QR code.`:F`Download AD4M or connect to a remote executor.`}
1587
1592
  </p>
1588
1593
  `}
1589
1594
  </div>
1590
1595
 
1591
1596
  <div class="items items--small">
1592
- ${c?L`
1597
+ ${u?F`
1593
1598
  <div class="connection-option connection-option--primary">
1594
1599
  <div class="connection-option__header">
1595
1600
  <svg
@@ -1616,9 +1621,9 @@ WHERE ${l.join(" AND ")}
1616
1621
  </div>
1617
1622
  `:""}
1618
1623
 
1619
- ${l?L`
1624
+ ${l?F`
1620
1625
  <div
1621
- class="connection-option ${c?"":"connection-option--primary"}"
1626
+ class="connection-option ${u?"":"connection-option--primary"}"
1622
1627
  >
1623
1628
  <div class="connection-option__header">
1624
1629
  <svg
@@ -1638,7 +1643,7 @@ WHERE ${l.join(" AND ")}
1638
1643
  ${p?"Configured AD4M Node":"Remote AD4M"}
1639
1644
  </h4>
1640
1645
  </div>
1641
- ${p?L`
1646
+ ${p?F`
1642
1647
  <p
1643
1648
  class="body"
1644
1649
  style="margin: 10px 0 5px 0; font-size: 13px;"
@@ -1651,7 +1656,7 @@ WHERE ${l.join(" AND ")}
1651
1656
  >
1652
1657
  ${p}
1653
1658
  </p>
1654
- `:L`
1659
+ `:F`
1655
1660
  <p
1656
1661
  class="body"
1657
1662
  style="margin: 10px 0 15px 0; font-size: 13px;"
@@ -1660,7 +1665,7 @@ WHERE ${l.join(" AND ")}
1660
1665
  </p>
1661
1666
  `}
1662
1667
  <button
1663
- class="button ${c?"button--secondary":""} button--full"
1668
+ class="button ${u?"button--secondary":""} button--full"
1664
1669
  @click=${o}
1665
1670
  >
1666
1671
  ${p?"Connect to Configured Node":"Enter Remote URL"}
@@ -1668,7 +1673,7 @@ WHERE ${l.join(" AND ")}
1668
1673
  </div>
1669
1674
  `:""}
1670
1675
 
1671
- ${d?L`
1676
+ ${d?F`
1672
1677
  <div class="connection-option">
1673
1678
  <div class="connection-option__header">
1674
1679
  <svg
@@ -1697,7 +1702,7 @@ WHERE ${l.join(" AND ")}
1697
1702
  </div>
1698
1703
  `:""}
1699
1704
 
1700
- ${f?L`
1705
+ ${f?F`
1701
1706
  <div class="connection-option connection-option--download">
1702
1707
  <div class="connection-option__header">
1703
1708
  <svg
@@ -1718,7 +1723,7 @@ WHERE ${l.join(" AND ")}
1718
1723
  </p>
1719
1724
  <button
1720
1725
  class="button button--full"
1721
- @click=${u}
1726
+ @click=${c}
1722
1727
  >
1723
1728
  Download AD4M
1724
1729
  </button>
@@ -1772,7 +1777,7 @@ WHERE ${l.join(" AND ")}
1772
1777
  opacity: 1;
1773
1778
  }
1774
1779
  </style>
1775
- `}function mp(){return L`
1780
+ `}function yp(){return F`
1776
1781
  <div class="items">
1777
1782
  <div class="text-center">
1778
1783
  <h1 class="heading">Request to AD4M blocked</h1>
@@ -1793,16 +1798,16 @@ WHERE ${l.join(" AND ")}
1793
1798
  </button>
1794
1799
  </div>
1795
1800
  </div>
1796
- `}function gp({reconnect:t}){return L`
1801
+ `}function vp({reconnect:r}){return F`
1797
1802
  <div class="items items--small">
1798
1803
  <div class="text-center">
1799
1804
  <h1 class="heading">Could not connect to AD4M</h1>
1800
1805
  </div>
1801
1806
  <div class="text-center">
1802
- <button class="button" @click=${()=>t()}>Try again</button>
1807
+ <button class="button" @click=${()=>r()}>Try again</button>
1803
1808
  </div>
1804
1809
  </div>
1805
- `}function yp(){return L`<header class="dialog__header">
1810
+ `}function bp(){return F`<header class="dialog__header">
1806
1811
  <div class="dialog__logo">
1807
1812
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 37" fill="none">
1808
1813
  <path
@@ -1811,7 +1816,7 @@ WHERE ${l.join(" AND ")}
1811
1816
  />
1812
1817
  </svg>
1813
1818
  </div>
1814
- </header>`}function vp({step:t,email:e,changeEmail:r,changeState:i,password:n,changePassword:a,login:o,checkEmail:s,passwordError:u,setHostingStep:c,isHostingRunning:l,setIsHostingRunning:d}){if(l)return L`
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`
1815
1820
  <div class="text-center">
1816
1821
  <p>
1817
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.
@@ -1823,13 +1828,13 @@ WHERE ${l.join(" AND ")}
1823
1828
  Back
1824
1829
  </button>
1825
1830
  </div>
1826
- `;if(t===0)return L`
1831
+ `;if(r===0)return F`
1827
1832
  <div class="input">
1828
1833
  <label class="input__label">EMAIL</label>
1829
1834
  <input
1830
1835
  class="input__field"
1831
1836
  value=${e}
1832
- @input=${f=>r(f.target.value)}
1837
+ @input=${f=>t(f.target.value)}
1833
1838
  />
1834
1839
  <div class="buttons">
1835
1840
  <button
@@ -1846,7 +1851,7 @@ WHERE ${l.join(" AND ")}
1846
1851
  </button>
1847
1852
  </div>
1848
1853
  </div>
1849
- `;if(t===1)return L`
1854
+ `;if(r===1)return F`
1850
1855
  <div class="input">
1851
1856
  <label class="input__label">PASSWORD</label>
1852
1857
  <input
@@ -1857,7 +1862,7 @@ WHERE ${l.join(" AND ")}
1857
1862
  errortext={passwordError}
1858
1863
  error={passwordError}
1859
1864
  />
1860
- ${u?L`<p class="error">${u}</p>`:""}
1865
+ ${c?F`<p class="error">${c}</p>`:""}
1861
1866
  <div class="buttons">
1862
1867
  <button
1863
1868
  class="button button--full button-secondary"
@@ -1874,19 +1879,19 @@ WHERE ${l.join(" AND ")}
1874
1879
  </button>
1875
1880
  </div>
1876
1881
  </div>
1877
- `;if(t===2)return L`
1882
+ `;if(r===2)return F`
1878
1883
  <div class="text-center">
1879
1884
  <p>
1880
1885
  Email is not registered. Please follow the <a target="_blank" href="https://hosting.ad4m.dev/">link</a> to register.
1881
1886
  </p>
1882
1887
  <button
1883
1888
  class="button button--full button-secondary"
1884
- @click=${()=>{c(0),i("start")}}
1889
+ @click=${()=>{u(0),i("start")}}
1885
1890
  >
1886
1891
  Back
1887
1892
  </button>
1888
1893
  </div>
1889
- `}function bp(){return L`
1894
+ `}function Sp(){return F`
1890
1895
  <div>
1891
1896
  <div class="lds-ring">
1892
1897
  <div></div>
@@ -1895,20 +1900,20 @@ WHERE ${l.join(" AND ")}
1895
1900
  <div></div>
1896
1901
  </div>
1897
1902
  </div>
1898
- `}function xo(){return L`
1903
+ `}function To(){return F`
1899
1904
  <svg width="44" height="40" viewBox="0 0 70 60" fill="none" xmlns="http://www.w3.org/2000/svg">
1900
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"/>
1901
1906
  </svg>
1902
- `}function _p({openModal:t}){return L`
1903
- <div class="mainlogo" @click=${t}>
1904
- ${xo()}
1907
+ `}function wp({openModal:r}){return F`
1908
+ <div class="mainlogo" @click=${r}>
1909
+ ${To()}
1905
1910
  </div>
1906
- `}function Sp({email:t,password:e,verificationCode:r,error:i,isLoading:n,backendUrl:a,step:o,verificationType:s,changeEmail:u,changePassword:c,changeVerificationCode:l,onEmailSubmit:d,onPasswordSubmit:f,onCodeSubmit:p,onBackToEmail:h}){return o==="email"?L`
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`
1907
1912
  <div class="items">
1908
1913
  <div class="text-center">
1909
1914
  <h3 class="heading">Sign in or Sign up</h3>
1910
1915
  <p class="body">Enter your email to continue</p>
1911
- ${a?L`
1916
+ ${a?F`
1912
1917
  <p
1913
1918
  class="body"
1914
1919
  style="margin-top: 10px; font-size: 12px; opacity: 0.7; font-family: monospace;"
@@ -1918,7 +1923,7 @@ WHERE ${l.join(" AND ")}
1918
1923
  `:""}
1919
1924
  </div>
1920
1925
 
1921
- ${i?L`
1926
+ ${i?F`
1922
1927
  <div class="error-message">
1923
1928
  <p>${i}</p>
1924
1929
  </div>
@@ -1932,9 +1937,9 @@ WHERE ${l.join(" AND ")}
1932
1937
  type="email"
1933
1938
  class="input__field"
1934
1939
  placeholder="your@email.com"
1935
- .value=${t}
1936
- @input=${m=>u(m.target.value)}
1937
- @keypress=${m=>{m.key==="Enter"&&t&&!n&&d()}}
1940
+ .value=${r}
1941
+ @input=${m=>c(m.target.value)}
1942
+ @keypress=${m=>{m.key==="Enter"&&r&&!n&&d()}}
1938
1943
  ?disabled=${n}
1939
1944
  autofocus
1940
1945
  />
@@ -1945,7 +1950,7 @@ WHERE ${l.join(" AND ")}
1945
1950
  <button
1946
1951
  class="button button--full"
1947
1952
  @click=${d}
1948
- ?disabled=${n||!t}
1953
+ ?disabled=${n||!r}
1949
1954
  >
1950
1955
  ${n?"Checking...":"Continue"}
1951
1956
  </button>
@@ -1966,17 +1971,17 @@ WHERE ${l.join(" AND ")}
1966
1971
  margin: 0;
1967
1972
  }
1968
1973
  </style>
1969
- `:o==="password"?L`
1974
+ `:o==="password"?F`
1970
1975
  <div class="items">
1971
1976
  <div class="text-center">
1972
1977
  <h3 class="heading">${s==="signup"?"Create your account":"Sign in to your account"}</h3>
1973
- <p class="body">Email: <strong>${t}</strong></p>
1978
+ <p class="body">Email: <strong>${r}</strong></p>
1974
1979
  <p class="body" style="margin-top: 10px;">
1975
1980
  ${s==="signup"?"Choose a password to create your account":"Enter your password to sign in"}
1976
1981
  </p>
1977
1982
  </div>
1978
1983
 
1979
- ${i?L`
1984
+ ${i?F`
1980
1985
  <div class="error-message">
1981
1986
  <p>${i}</p>
1982
1987
  </div>
@@ -1991,7 +1996,7 @@ WHERE ${l.join(" AND ")}
1991
1996
  class="input__field"
1992
1997
  placeholder="${s==="signup"?"Enter a strong password":"Enter your password"}"
1993
1998
  .value=${e}
1994
- @input=${m=>c(m.target.value)}
1999
+ @input=${m=>u(m.target.value)}
1995
2000
  @keypress=${m=>{m.key==="Enter"&&e&&!n&&f()}}
1996
2001
  ?disabled=${n}
1997
2002
  autofocus
@@ -2035,20 +2040,20 @@ WHERE ${l.join(" AND ")}
2035
2040
  margin: 0;
2036
2041
  }
2037
2042
  </style>
2038
- `:o==="code"?L`
2043
+ `:o==="code"?F`
2039
2044
  <div class="items">
2040
2045
  <div class="text-center">
2041
2046
  <h3 class="heading">Check your email</h3>
2042
2047
  <p class="body">
2043
2048
  We've sent a 6-digit verification code to
2044
- <strong>${t}</strong>
2049
+ <strong>${r}</strong>
2045
2050
  </p>
2046
2051
  <p class="body" style="margin-top: 10px; font-size: 12px; opacity: 0.7;">
2047
2052
  The code will expire in 15 minutes
2048
2053
  </p>
2049
2054
  </div>
2050
2055
 
2051
- ${i?L`
2056
+ ${i?F`
2052
2057
  <div class="error-message">
2053
2058
  <p>${i}</p>
2054
2059
  </div>
@@ -2065,8 +2070,8 @@ WHERE ${l.join(" AND ")}
2065
2070
  maxlength="6"
2066
2071
  class="input__field code-input"
2067
2072
  placeholder="000000"
2068
- .value=${r}
2069
- @input=${m=>{let _=m.target.value.replace(/\D/g,"");l(_)}}
2073
+ .value=${t}
2074
+ @input=${m=>{let w=m.target.value.replace(/\D/g,"");l(w)}}
2070
2075
  ?disabled=${n}
2071
2076
  autofocus
2072
2077
  />
@@ -2077,7 +2082,7 @@ WHERE ${l.join(" AND ")}
2077
2082
  <button
2078
2083
  class="button button--full"
2079
2084
  @click=${p}
2080
- ?disabled=${n||r.length!==6}
2085
+ ?disabled=${n||t.length!==6}
2081
2086
  >
2082
2087
  ${n?"Verifying...":"Verify Code"}
2083
2088
  </button>
@@ -2123,14 +2128,14 @@ WHERE ${l.join(" AND ")}
2123
2128
  opacity: 0.8;
2124
2129
  }
2125
2130
  </style>
2126
- `:L``}function wp({initialUrl:t,detecting:e,multiUserDetected:r,error:i,onBack:n,onUrlChange:a,onConnect:o,onMultiUserAuth:s,onRequestCapability:u}){let c=r!==null&&!e,l=t||"";return L`
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`
2127
2132
  <div class="items">
2128
2133
  <div class="text-center">
2129
2134
  <h3 class="heading">Connect to Remote AD4M</h3>
2130
2135
  <p class="body">Enter the URL of a remote AD4M executor</p>
2131
2136
  </div>
2132
2137
 
2133
- ${c?L`
2138
+ ${u?F`
2134
2139
  <div class="items items--small">
2135
2140
  <div class="remote-info">
2136
2141
  <p class="body" style="margin: 0 0 5px 0; font-size: 13px;">
@@ -2144,7 +2149,7 @@ WHERE ${l.join(" AND ")}
2144
2149
  </p>
2145
2150
  </div>
2146
2151
 
2147
- ${r?L`
2152
+ ${t?F`
2148
2153
  <div class="auth-option auth-option--primary">
2149
2154
  <div class="auth-option__header">
2150
2155
  <svg
@@ -2209,12 +2214,12 @@ WHERE ${l.join(" AND ")}
2209
2214
  </p>
2210
2215
  <button
2211
2216
  class="button button--secondary button--full"
2212
- @click=${u}
2217
+ @click=${c}
2213
2218
  >
2214
2219
  Request Capability
2215
2220
  </button>
2216
2221
  </div>
2217
- `:L`
2222
+ `:F`
2218
2223
  <div class="auth-option auth-option--primary">
2219
2224
  <div class="auth-option__header">
2220
2225
  <svg
@@ -2247,7 +2252,7 @@ WHERE ${l.join(" AND ")}
2247
2252
  </p>
2248
2253
  <button
2249
2254
  class="button button--full"
2250
- @click=${u}
2255
+ @click=${c}
2251
2256
  >
2252
2257
  Request Capability
2253
2258
  </button>
@@ -2264,7 +2269,7 @@ WHERE ${l.join(" AND ")}
2264
2269
  </button>
2265
2270
  </div>
2266
2271
  </div>
2267
- `:L`
2272
+ `:F`
2268
2273
  <div class="items items--small">
2269
2274
  <div class="input">
2270
2275
  <label class="input__label" for="remote-url">
@@ -2281,7 +2286,7 @@ WHERE ${l.join(" AND ")}
2281
2286
  />
2282
2287
  </div>
2283
2288
 
2284
- ${i?L`
2289
+ ${i?F`
2285
2290
  <div class="error-message">
2286
2291
  <p>${i}</p>
2287
2292
  </div>
@@ -2367,22 +2372,22 @@ WHERE ${l.join(" AND ")}
2367
2372
  margin: 0;
2368
2373
  }
2369
2374
  </style>
2370
- `}function Cp({capabilities:t,appname:e,appiconpath:r,changeState:i,setOpen:n,requestCapability:a}){return L`
2375
+ `}function xp({capabilities:r,appname:e,appiconpath:t,changeState:i,setOpen:n,requestCapability:a}){return F`
2371
2376
  <div class="items">
2372
2377
  <div class="text-center">
2373
2378
  <p class="body">An external application</p>
2374
2379
  <h1 class="heading nomargin">${e}</h1>
2375
2380
  <p class="body">wants to access your AD4M data</p>
2376
2381
  </div>
2377
- ${r&&L`<div class="dialog__connect">
2378
- <img class="dialog__connect-app" src=${r} alt="Logo" />
2382
+ ${t&&F`<div class="dialog__connect">
2383
+ <img class="dialog__connect-app" src=${t} alt="Logo" />
2379
2384
  <div class="dialog__connect-check"></div>
2380
- <div class="dialog__connect-ad4m">${xo()}</div>
2385
+ <div class="dialog__connect-ad4m">${To()}</div>
2381
2386
  </div>`}
2382
2387
  <div>
2383
2388
  <p class="text-center"><b>This will allow the developer to:</b></p>
2384
2389
  <ul class="check-list">
2385
- ${t.map(o=>L`<li>
2390
+ ${r.map(o=>F`<li>
2386
2391
  <span>
2387
2392
  <svg
2388
2393
  xmlns="http://www.w3.org/2000/svg"
@@ -2396,7 +2401,7 @@ WHERE ${l.join(" AND ")}
2396
2401
  />
2397
2402
  </svg>
2398
2403
  </span>
2399
- <span>${um(o)}</span>
2404
+ <span>${C1(o)}</span>
2400
2405
  </li>`)}
2401
2406
  </ul>
2402
2407
  </div>
@@ -2421,12 +2426,12 @@ WHERE ${l.join(" AND ")}
2421
2426
  Connection settings
2422
2427
  </button>
2423
2428
  </div>
2424
- `}function Ep({changeState:t,onSuccess:e,uiState:r}){function i(n){let a=new BarcodeDetector,o=n.currentTarget,s=()=>re(this,null,function*(){try{if(r!=="qr")return;let c=(yield a.detect(o)).find(l=>l.format==="qr_code");if(c!=null&&c.rawValue){t("requestcap"),e(c.rawValue);return}else requestAnimationFrame(s)}catch(u){console.error(u)}});s()}return L`
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`
2425
2430
  <div class="qr-scanner">
2426
2431
  <div class="qr-content">
2427
2432
  <button
2428
2433
  class="button button--primary stop"
2429
- @click=${()=>t("start")}
2434
+ @click=${()=>r("start")}
2430
2435
  >
2431
2436
  Stop scanning
2432
2437
  </button>
@@ -2440,21 +2445,21 @@ WHERE ${l.join(" AND ")}
2440
2445
  ></video>
2441
2446
  </div>
2442
2447
  </div>
2443
- `}function xp({port:t,url:e,isRemote:r,connectToPort:i,changeIsRemote:n,connectRemote:a,changeState:o,changeUrl:s,changePort:u,clearState:c}){return L`
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`
2444
2449
  <div class="items items--small">
2445
2450
  <div class="text-center">
2446
2451
  <h1 class="heading">Connection Settings</h1>
2447
2452
  <p class="body">Please choose how you want to connect to AD4M</p>
2448
2453
  </div>
2449
2454
  <div style="display: flex; gap: 10px;">
2450
- <button class=${`button ${r?"button--secondary":"button--primary"}`} @click=${()=>n(!1)}>
2455
+ <button class=${`button ${t?"button--secondary":"button--primary"}`} @click=${()=>n(!1)}>
2451
2456
  Locally
2452
2457
  </button>
2453
- <button class=${`button ${r?"button--primary":"button--secondary"}`} @click=${()=>n(!0)}>
2458
+ <button class=${`button ${t?"button--primary":"button--secondary"}`} @click=${()=>n(!0)}>
2454
2459
  Remotely
2455
2460
  </button>
2456
2461
  </div>
2457
- ${r?L`
2462
+ ${t?F`
2458
2463
  <div class="input">
2459
2464
  <label class="input__label">URL</label>
2460
2465
  <input
@@ -2471,20 +2476,20 @@ WHERE ${l.join(" AND ")}
2471
2476
  Connect
2472
2477
  </button>
2473
2478
  </div>
2474
- `:L`
2479
+ `:F`
2475
2480
  <div class="input">
2476
2481
  <label class="input__label">PORT</label>
2477
2482
  <input
2478
2483
  class="input__field"
2479
- value=${t}
2480
- @input=${f=>u(parseInt(f.target.value))}
2484
+ value=${r}
2485
+ @input=${f=>c(parseInt(f.target.value))}
2481
2486
  />
2482
2487
  </div>
2483
2488
 
2484
2489
  <div class="buttons">
2485
2490
  <button
2486
2491
  class="button button--full"
2487
- @click=${()=>i(t)}
2492
+ @click=${()=>i(r)}
2488
2493
  >
2489
2494
  Connect
2490
2495
  </button>
@@ -2501,17 +2506,17 @@ WHERE ${l.join(" AND ")}
2501
2506
  </button>
2502
2507
  <button
2503
2508
  class="button button--full button--secondary"
2504
- @click=${c}
2509
+ @click=${u}
2505
2510
  >
2506
2511
  Clear state
2507
2512
  </button>
2508
2513
  </div
2509
2514
  </div>
2510
- `}function Ap({connect:t,isMobile:e,hasClickedDownload:r,changeState:i,onDownloaded:n,scanQrcode:a,hosting:o}){let u=(Kt("ad4murl")||`http://localhost:${Or}`).includes("localhost");function c(l){l.preventDefault();let d=l.currentTarget;window.open(d.href,"_blank"),this.onDownloaded()}return L`
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`
2511
2516
  <div class="items">
2512
- ${r?L`
2517
+ ${t?F`
2513
2518
  <div class="text-center">
2514
- <a class="button" target="_blank" @click=${()=>t()}>
2519
+ <a class="button" target="_blank" @click=${()=>r()}>
2515
2520
  Connect to ADAM
2516
2521
  </a>
2517
2522
  <p>
@@ -2519,17 +2524,17 @@ WHERE ${l.join(" AND ")}
2519
2524
  ADAM agent
2520
2525
  </p>
2521
2526
  </div>
2522
- `:L`
2527
+ `:F`
2523
2528
  <div class="text-center">
2524
2529
  <h1 class="heading">Could not connect to AD4M</h1>
2525
- ${u?L`
2530
+ ${c?F`
2526
2531
  <p style="color: #b9b9b9; font-size: 15px; text-align: center; margin: 30px 0;">
2527
2532
  Please make sure you have the ADAM Launcher running on your computer and there are no browser restrictions ("Shields") blocking your connection to ADAM on localhost.
2528
2533
  <br/>
2529
2534
  <br/>
2530
2535
  (Safari users: please use a different browser for now. Safari is very strict about this and we are working on a solution.)
2531
2536
  </p>
2532
- `:L`
2537
+ `:F`
2533
2538
  <p style="color: #b9b9b9; font-size: 15px; text-align: center; margin: 30px 0;">
2534
2539
  Looks like the remote executor you are trying to connect to is not reachable.
2535
2540
  <br/>
@@ -2537,24 +2542,24 @@ WHERE ${l.join(" AND ")}
2537
2542
  Please try connecting to a different remote executor or check your connection settings.
2538
2543
  </p>
2539
2544
  `}
2540
- ${e?L`<button class="button" @click=${()=>a()}>
2545
+ ${e?F`<button class="button" @click=${()=>a()}>
2541
2546
  Connect with QR
2542
- </button>`:L`<a
2547
+ </button>`:F`<a
2543
2548
  class="button"
2544
2549
  target="_blank"
2545
- @click=${c}
2550
+ @click=${u}
2546
2551
  href="https://github.com/coasys/ad4m/releases"
2547
2552
  >
2548
2553
  Download AD4M
2549
2554
  </a>
2550
2555
  `}
2551
- ${o?L`<p>Or</p>`:""}
2552
- ${o?L`<button class="button" @click=${()=>i("hosting")}>Use hosted AD4M (alpha)</button>`:""}
2556
+ ${o?F`<p>Or</p>`:""}
2557
+ ${o?F`<button class="button" @click=${()=>i("hosting")}>Use hosted AD4M (alpha)</button>`:""}
2553
2558
  </div>
2554
2559
 
2555
2560
  <div style="display: flex; flex-direction: column; align-items: center; gap: 20px; margin-top: -30px">
2556
2561
  or
2557
- <button class="button button--secondary" @click=${()=>t()}>
2562
+ <button class="button button--secondary" @click=${()=>r()}>
2558
2563
  Try reconnecting
2559
2564
  </button>
2560
2565
  or
@@ -2573,7 +2578,7 @@ WHERE ${l.join(" AND ")}
2573
2578
  </a>
2574
2579
  </div>
2575
2580
  </div>
2576
- `}function kp({code:t,changeState:e,verifyCode:r,changeCode:i,isHosting:n,verifyCodeError:a}){return L`
2581
+ `}function Ip({code:r,changeState:e,verifyCode:t,changeCode:i,isHosting:n,verifyCodeError:a}){return F`
2577
2582
  <div class="items">
2578
2583
  <div class="text-center">
2579
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>
@@ -2588,10 +2593,10 @@ WHERE ${l.join(" AND ")}
2588
2593
  type="tel"
2589
2594
  placeholder="XXXXXX"
2590
2595
  class="input__field"
2591
- value=${t}
2596
+ value=${r}
2592
2597
  @change=${o=>i(o.target.value)}
2593
2598
  />
2594
- ${a?L`<p class="error">${a}</p>`:""}
2599
+ ${a?F`<p class="error">${a}</p>`:""}
2595
2600
  </div>
2596
2601
  <div class="buttons">
2597
2602
  <button
@@ -2600,12 +2605,12 @@ WHERE ${l.join(" AND ")}
2600
2605
  >
2601
2606
  Back
2602
2607
  </button>
2603
- <button class="button button--full" @click=${()=>r(t)}>
2608
+ <button class="button button--full" @click=${()=>t(r)}>
2604
2609
  Continue
2605
2610
  </button>
2606
2611
  </div>
2607
2612
  </div>
2608
- `}function j3(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(e=>navigator.userAgent.match(e))}var q3=kc`
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`
2609
2614
  :host {
2610
2615
  --primary-color: #fff;
2611
2616
  --heading-color: #fff;
@@ -3006,16 +3011,16 @@ WHERE ${l.join(" AND ")}
3006
3011
  width: 100vw;
3007
3012
  object-fit: cover;
3008
3013
  }
3009
- `,ee=class extends Pr{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"))||Or;this.url=Kt("ad4murl")||"";this.multiUser=!1;this.backendUrl=""}get authState(){return this._client.authState}get connectionState(){return this._client.connectionState}injectFont(){let r=document.createElement("link");r.setAttribute("rel","stylesheet"),r.setAttribute("href","https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,200..800&display=swap"),document.head.appendChild(r)}connectedCallback(){super.connectedCallback(),Co(this),this.injectFont(),this._isMobile=j3(),this._client=new Eo({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"))||Or,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(r){console.log(r)}})}handleMultiUserEmailSubmit(){return re(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null;let r=this._client.buildTempClient(this.backendUrl),i={appName:this.appName,appDesc:this.appDesc,appDomain:this.appDomain,appUrl:window.location.origin,appIconPath:this.appIconPath},n=yield r.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(r){this._multiUserError=r.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 r=this._client.buildTempClient(this.backendUrl);if(this._multiUserVerificationType==="login")try{let i=yield r.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 r.agent.createUser(this._multiUserEmail,this._multiUserPassword,i);if(n.success)if(n.error&&n.error.includes("SMTP is not configured"))try{let a=yield r.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(r){this._multiUserError=r.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(r){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(r){this._multiUserEmail=r,this._multiUserError=null}changeMultiUserPassword(r){this._multiUserPassword=r,this._multiUserError=null}changeMultiUserVerificationCode(r){this._codeSubmitTimeout!==null&&(clearTimeout(this._codeSubmitTimeout),this._codeSubmitTimeout=null),this._multiUserVerificationCode=r,this._multiUserError=null,r.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(r){console.log("[Ad4m Connect] Local detection failed:",r),this._localDetected=!1}})}verifyAd4mApi(r){return re(this,null,function*(){console.log("[Ad4m Connect] Verifying AD4M API at URL:",r);let i=this._client.buildTempClient(r);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(r){return re(this,null,function*(){console.log("[Ad4m Connect] Detecting multi-user mode for URL:",r);let i=this._client.buildTempClient(r);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(r){console.error("Failed to connect to local AD4M:",r),this.changeUIState("connection_overview")}})}handleShowRemoteConnection(){this._remoteUrl=this.backendUrl||this.url||"",this._remoteMultiUserDetected=null,this._remoteError=null,this.changeUIState("remote_connection")}handleRemoteUrlChange(r){this._remoteUrl=r,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 r=yield this.detectRemoteMultiUser(this._remoteUrl);this._remoteMultiUserDetected=r,this._remoteDetecting=!1}catch(r){console.error("[Ad4m Connect] Connection/detection failed:",r),this._remoteError=r.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(r){this._remoteError=r.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(r){r.message.includes("Passwords did not match")?this._passwordError="Passwords did not match":this._hostingNotRunningError="Hosting is not running"}})}changeEmail(r){this._email=r}changePassword(r){this._passowrd=r}unlockAgent(r,i=!0){return re(this,null,function*(){yield this._client.ad4mClient.agent.unlock(r,i)})}verifyCode(r){return re(this,null,function*(){try{yield this._client.verifyCode(r)}catch(i){this._verifyCodeError="Invalid code"}})}changeUrl(r){r!==this._client.url&&(fp("ad4mtoken"),this._client.setToken(null)),this._client.setUrl(r)}changePort(r){this._client.setPort(r)}changeUIState(r){this.uiState=r}setIsHostingRunning(r){this._hostingNotRunningError=r}changeIsRemote(r){this._isRemote=r}changeCode(r){this._code=r}onDownloaded(){this._hasClickedDownload=!0}handleAuthChange(r){let i=new CustomEvent("authstatechange",{detail:r});r==="locked"&&(this._isOpen=!0),r==="authenticated"&&(this._isOpen=!1),this.dispatchEvent(i),this.requestUpdate()}handleConfigChange(r,i){this[r]=i,i?Ec("ad4m"+r,i):fp("ad4m"+r),this.requestUpdate()}handleConnectionChange(r){if(r==="checking_local"){this._isOpen=!1;return}r==="connected"&&(this.authState!=="authenticated"?(this.changeUIState("requestcap"),this._isOpen=!0):(this.changeUIState("connected"),this._isOpen=!1)),r==="disconnected"&&(this._isOpen=!0),r==="not_connected"&&(this._isOpen=!0,this.multiUser&&this.backendUrl?this.changeUIState("multiuser_auth"):this.changeUIState("start"));let i=new CustomEvent("connectionstatechange",{detail:r});this.dispatchEvent(i),this.requestUpdate()}loadFont(){let r=document.createElement("link");r.rel="stylesheet",r.type="text/css",r.crossOrigin="anonymous",r.href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap",document.head.appendChild(r)}startCamera(r){return re(this,null,function*(){try{window.BarcodeDetector.getSupportedFormats()}catch(i){window.BarcodeDetector=Nr}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 r=yield this._client.connect();try{let i=yield r.agent.status();i.isUnlocked&&i.isInitialized&&window.location.reload()}catch(i){console.warn(i)}return r})}getAd4mClient(){return this._client.ad4mClient}connectRemote(r){return re(this,null,function*(){try{this.changeUrl(r);let i=yield this._client.connect(r),n=yield i.agent.status();return n.isUnlocked&&n.isInitialized||this.changeUIState("requestcap"),i}catch(i){this.changeUIState("requestcap"),this._isOpen=!0}})}requestCapability(r){return re(this,null,function*(){try{yield this._client.requestCapability(r),this.changeUIState("verifycode")}catch(i){console.warn(i)}})}isAuthenticated(){return re(this,null,function*(){return this._client.checkAuth()})}setOpen(r){this._isOpen=r}setHostingStep(r){this._hostingStep=r}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 bp();if(this.uiState==="connection_overview")return hp({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 wp({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 Sp({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 vp({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 Ep({changeState:this.changeUIState,onSuccess:r=>{this.changeUrl(r),this._client.connect(r)},uiState:this.uiState});if(this.authState==="locked")return dp({unlockAgent:this.unlockAgent,reconnect:this.connect});if(this.uiState==="settings")return xp({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 Ap({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"?kp({code:this._code,changeCode:this.changeCode,changeState:this.changeUIState,verifyCode:this.verifyCode,isHosting:this._client.isHosting,verifyCodeError:this._verifyCodeError}):Cp({changeState:this.changeUIState,requestCapability:this.requestCapability,capabilities:this.capabilities,appname:this.appName,setOpen:this.setOpen,appiconpath:this.appIconPath});if(this.connectionState==="disconnected")return gp({reconnect:this.connect});if(this.connectionState==="port_not_found")return mp()}mobileView(){return this.mobile?_p({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:L`
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`
3010
3015
  <div class="wrapper">
3011
3016
  <div class="dialog">
3012
- ${yp()}
3017
+ ${bp()}
3013
3018
  <main class="dialog__content">${this.renderViews()}</main>
3014
3019
  ${this.mobileView()}
3015
3020
  </div>
3016
3021
  <div class="ad4mConnect__backdrop" />
3017
3022
  </div>
3018
- `}};ee.styles=[q3],te([Ee()],ee.prototype,"_code",2),te([Ee()],ee.prototype,"_isMobile",2),te([Ee()],ee.prototype,"_hasClickedDownload",2),te([Ee()],ee.prototype,"_isRemote",2),te([Ee()],ee.prototype,"_client",2),te([Ee()],ee.prototype,"_isOpen",2),te([Ee()],ee.prototype,"_hostingStep",2),te([Ee()],ee.prototype,"_email",2),te([Ee()],ee.prototype,"_passowrd",2),te([Ee()],ee.prototype,"_passwordError",2),te([Ee()],ee.prototype,"_hostingNotRunningError",2),te([Ee()],ee.prototype,"_verifyCodeError",2),te([Ee()],ee.prototype,"_isHostingLoading",2),te([Ee()],ee.prototype,"_multiUserEmail",2),te([Ee()],ee.prototype,"_multiUserPassword",2),te([Ee()],ee.prototype,"_multiUserVerificationCode",2),te([Ee()],ee.prototype,"_multiUserError",2),te([Ee()],ee.prototype,"_multiUserLoading",2),te([Ee()],ee.prototype,"_multiUserStep",2),te([Ee()],ee.prototype,"_multiUserVerificationType",2),te([Ee()],ee.prototype,"_localDetected",2),te([Ee()],ee.prototype,"_remoteUrl",2),te([Ee()],ee.prototype,"_remoteMultiUserDetected",2),te([Ee()],ee.prototype,"_remoteDetecting",2),te([Ee()],ee.prototype,"_remoteError",2),te([Ee()],ee.prototype,"uiState",2),te([st({type:String,reflect:!0})],ee.prototype,"appName",2),te([st({type:String,reflect:!0})],ee.prototype,"appDesc",2),te([st({type:String,reflect:!0})],ee.prototype,"appDomain",2),te([st({type:String,reflect:!0})],ee.prototype,"appIconPath",2),te([st({type:Boolean,reflect:!0})],ee.prototype,"mobile",2),te([st({type:String,reflect:!0})],ee.prototype,"capabilities",2),te([st({type:Boolean,reflect:!0})],ee.prototype,"hosting",2),te([st({type:String})],ee.prototype,"token",2),te([st({type:String,reflect:!0})],ee.prototype,"port",2),te([st({type:String,reflect:!0})],ee.prototype,"url",2),te([st({type:Boolean,reflect:!0})],ee.prototype,"multiUser",2),te([st({type:String,reflect:!0})],ee.prototype,"backendUrl",2),ee=te([Kp("ad4m-connect")],ee);function B3(t){let e=new ee;return Object.entries(t).forEach(([r,i])=>{e[r]=i}),document.body.appendChild(e),e}export{ee as Ad4mConnectElement,B3 as default,M3 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};
3019
3024
  /*!
3020
3025
  * @undecaf/barcode-detector-polyfill v0.9.20
3021
3026
  * A WebAssembly polyfill for the Barcode Detection API