@coasys/ad4m-connect 0.11.1 → 0.11.2-dev-multi-user-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 om=Object.defineProperty;var sm=Object.getOwnPropertyDescriptor;var Ee=(t,e,r,n)=>{for(var i=n>1?void 0:n?sm(e,r):e,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&om(e,r,i),i};var ye=(t,e,r)=>new Promise((n,i)=>{var a=u=>{try{s(r.next(u))}catch(c){i(c)}},o=u=>{try{s(r.throw(u))}catch(c){i(c)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,o);s((r=r.apply(t,e)).next())});import{ZBarSymbolType as se,ZBarConfigType as Sp,scanRGBABuffer as cm,getDefaultScanner as um}from"https://cdn.jsdelivr.net/npm/@undecaf/zbar-wasm@0.9.15/dist/main.js";function lm(t,e,r,n){return new(r||(r=Promise))(function(i,a){function o(c){try{u(n.next(c))}catch(l){a(l)}}function s(c){try{u(n.throw(c))}catch(l){a(l)}}function u(c){var l;c.done?i(c.value):(l=c.value,l instanceof r?l:new r(function(d){d(l)})).then(o,s)}u((n=n.apply(t,e||[])).next())})}var F=class{constructor(e,r=Sp.ZBAR_CFG_ENABLE,n=1){this.symbolType=e,this.configType=r,this.number=n,this.configSteps=[this]}static register(e,r,n=r.symbolType){return F.formatsToConfigs[e]=r,F.typesToFormats[n]=F.typesToFormats[n]||e,r}static formats(){return Object.keys(F.formatsToConfigs)}static toFormat(e){return F.typesToFormats[e]}static configure(e,r){var n;(n=F.formatsToConfigs[r])===null||n===void 0||n.configSteps.forEach(i=>e.setConfig(i.symbolType,i.configType,i.number))}add(e){return this.configSteps.push(e),this}},_p;F.formatsToConfigs={},F.typesToFormats={},F.register("codabar",new F(se.ZBAR_CODABAR)),F.register("code_39",new F(se.ZBAR_CODE39)),F.register("code_93",new F(se.ZBAR_CODE93)),F.register("code_128",new F(se.ZBAR_CODE128)),F.register("databar",new F(se.ZBAR_DATABAR)),F.register("databar_exp",new F(se.ZBAR_DATABAR_EXP)),F.register("ean_2",new F(se.ZBAR_EAN2)),F.register("ean_5",new F(se.ZBAR_EAN5)),F.register("ean_8",new F(se.ZBAR_EAN8)),F.register("ean_13",new F(se.ZBAR_EAN13)),F.register("ean_13+2",new F(se.ZBAR_EAN13)).add(new F(se.ZBAR_EAN2)),F.register("ean_13+5",new F(se.ZBAR_EAN13)).add(new F(se.ZBAR_EAN5)),F.register("isbn_10",new F(se.ZBAR_ISBN10)).add(new F(se.ZBAR_EAN13)),F.register("isbn_13",new F(se.ZBAR_ISBN13)).add(new F(se.ZBAR_EAN13)),F.register("isbn_13+2",new F(se.ZBAR_ISBN13)).add(new F(se.ZBAR_EAN13)).add(new F(se.ZBAR_EAN2)),F.register("isbn_13+5",new F(se.ZBAR_ISBN13)).add(new F(se.ZBAR_EAN13)).add(new F(se.ZBAR_EAN5)),F.register("itf",new F(se.ZBAR_I25)),F.register("qr_code",new F(se.ZBAR_QRCODE)),F.register("sq_code",new F(se.ZBAR_SQCODE)),F.register("upc_a",new F(se.ZBAR_UPCA)).add(new F(se.ZBAR_EAN13)),F.register("upc_e",new F(se.ZBAR_UPCE)).add(new F(se.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"}(_p||(_p={}));var Sc=class{},pm=(()=>{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 r=e.formats.filter(n=>!F.formats().includes(n));if(r.length)throw new TypeError(`Unsupported barcode format(s): ${r.join(", ")}`)}this.formats=e.formats||F.formats(),this.zbarConfig=e.zbar||new Sc}static getSupportedFormats(){return Promise.resolve(F.formats())}detect(e){if(!Dr.isImageBitmapSource(e))throw new TypeError("BarcodeDetector.detect() argument is not an ImageBitmapSource");let r=Dr.intrinsicDimensions(e);if(r.width===0||r.height===0)return Promise.resolve([]);try{return Promise.all([this.toImageData(e),this.getScanner()]).then(n=>{let i=n[0],a=n[1];return this.zbarConfig.enableCache!==void 0&&a.enableCache(this.zbarConfig.enableCache),cm(i.data,i.width,i.height,a)}).then(n=>n.map(i=>this.toBarcodeDetectorResult(i)))}catch(n){return Promise.reject(n)}}getScanner(){return new Promise((e,r)=>lm(this,void 0,void 0,function*(){if(!this.scanner){let n=yield um();this.formats.length>0&&(n.setConfig(se.ZBAR_NONE,Sp.ZBAR_CFG_ENABLE,0),this.formats.forEach(i=>F.configure(n,i))),this.scanner=n}e(this.scanner)}))}toImageData(e){let r=n=>{let i=Dr.intrinsicDimensions(n);this.canvas&&this.canvas.width===i.width&&this.canvas.height===i.height||(this.canvas=function(s,u){if(pm)return new OffscreenCanvas(s,u);{let c=document.createElement("canvas");return c.width=s,c.height=u,c}}(i.width,i.height));let a=this.canvas,o=a.getContext("2d");return o.drawImage(n,0,0),o.getImageData(0,0,a.width,a.height)};if(e instanceof ImageData)return Promise.resolve(e);if(e instanceof Blob){let n=document.createElement("img");return n.src=URL.createObjectURL(e),n.decode().then(()=>r(n)).finally(()=>URL.revokeObjectURL(n.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(n=>{r.minX=Math.min(r.minX,n.x),r.maxX=Math.max(r.maxX,n.x),r.minY=Math.min(r.minY,n.y),r.maxY=Math.max(r.maxY,n.y)}),{format:F.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 So=window,wo=So.ShadowRoot&&(So.ShadyCSS===void 0||So.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wc=Symbol(),wp=new WeakMap,Xi=class{constructor(e,r,n){if(this._$cssResult$=!0,n!==wc)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(wo&&e===void 0){let n=r!==void 0&&r.length===1;n&&(e=wp.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&wp.set(r,e))}return e}toString(){return this.cssText}},Cp=t=>new Xi(typeof t=="string"?t:t+"",void 0,wc),Cc=(t,...e)=>{let r=t.length===1?t[0]:e.reduce((n,i,a)=>n+(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.")})(i)+t[a+1],t[0]);return new Xi(r,t,wc)},Ec=(t,e)=>{wo?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{let n=document.createElement("style"),i=So.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)})},Co=wo?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(let n of e.cssRules)r+=n.cssText;return Cp(r)})(t):t;var xc,Eo=window,Ep=Eo.trustedTypes,fm=Ep?Ep.emptyScript:"",xp=Eo.reactiveElementPolyfillSupport,kc={toAttribute(t,e){switch(e){case Boolean:t=t?fm: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}},Ap=(t,e)=>e!==t&&(e==e||t==t),Ac={attribute:!0,type:String,converter:kc,reflect:!1,hasChanged:Ap},Ic="finalized",mr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var 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,n)=>{let i=this._$Ep(n,r);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,r=Ac){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(e,r),!r.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,r,n){return{get(){return this[r]},set(i){let a=this[e];this[r]=i,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||Ac}static finalize(){if(this.hasOwnProperty(Ic))return!1;this[Ic]=!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,n=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(let i of n)this.createProperty(i,r[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let r=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)r.unshift(Co(i))}else e!==void 0&&r.push(Co(e));return r}static _$Ep(e,r){let n=r.attribute;return n===!1?void 0:typeof n=="string"?n: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,n;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.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 Ec(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 n;return(n=r.hostConnected)===null||n===void 0?void 0:n.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var n;return(n=r.hostDisconnected)===null||n===void 0?void 0:n.call(r)})}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$EO(e,r,n=Ac){var i;let a=this.constructor._$Ep(e,n);if(a!==void 0&&n.reflect===!0){let o=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:kc).toAttribute(r,n.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,r){var n;let i=this.constructor,a=i._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=i.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?o.converter:kc;this._$El=a,this[a]=s.fromAttribute(r,o.type),this._$El=null}}requestUpdate(e,r,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Ap)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(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((i,a)=>this[a]=i),this._$Ei=void 0);let r=!1,n=this._$AL;try{r=this.shouldUpdate(n),r?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var a;return(a=i.hostUpdate)===null||a===void 0?void 0:a.call(i)}),this.update(n)):this._$Ek()}catch(i){throw r=!1,this._$Ek(),i}r&&this._$AE(n)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((r,n)=>this._$EO(n,this[n],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};mr[Ic]=!0,mr.elementProperties=new Map,mr.elementStyles=[],mr.shadowRootOptions={mode:"open"},xp?.({ReactiveElement:mr}),((xc=Eo.reactiveElementVersions)!==null&&xc!==void 0?xc:Eo.reactiveElementVersions=[]).push("1.6.3");var Tc,xo=window,ci=xo.trustedTypes,kp=ci?ci.createPolicy("lit-html",{createHTML:t=>t}):void 0,Dc="$lit$",Nr=`lit$${(Math.random()+"").slice(9)}$`,Rp="?"+Nr,dm=`<${Rp}>`,hn=document,ta=()=>hn.createComment(""),ra=t=>t===null||typeof t!="object"&&typeof t!="function",$p=Array.isArray,hm=t=>$p(t)||typeof t?.[Symbol.iterator]=="function",Oc=`[
2
- \f\r]`,ea=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ip=/-->/g,Tp=/>/g,fn=RegExp(`>|${Oc}(?:([^\\s"'>=/]+)(${Oc}*=${Oc}*(?:[^
3
- \f\r"'\`<>=]|("|')|))|$)`,"g"),Op=/'/g,Dp=/"/g,Lp=/^(?:script|style|textarea|title)$/i,Fp=t=>(e,...r)=>({_$litType$:t,strings:e,values:r}),z=Fp(1),z3=Fp(2),mn=Symbol.for("lit-noChange"),ze=Symbol.for("lit-nothing"),Np=new WeakMap,dn=hn.createTreeWalker(hn,129,null,!1);function Mp(t,e){if(!Array.isArray(t)||!t.hasOwnProperty("raw"))throw Error("invalid template strings array");return kp!==void 0?kp.createHTML(e):e}var mm=(t,e)=>{let r=t.length-1,n=[],i,a=e===2?"<svg>":"",o=ea;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===ea?l[1]==="!--"?o=Ip:l[1]!==void 0?o=Tp:l[2]!==void 0?(Lp.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=fn):l[3]!==void 0&&(o=fn):o===fn?l[0]===">"?(o=i??ea,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,c=l[1],o=l[3]===void 0?fn:l[3]==='"'?Dp:Op):o===Dp||o===Op?o=fn:o===Ip||o===Tp?o=ea:(o=fn,i=void 0);let p=o===fn&&t[s+1].startsWith("/>")?" ":"";a+=o===ea?u+dm:d>=0?(n.push(c),u.slice(0,d)+Dc+u.slice(d)+Nr+p):u+Nr+(d===-2?(n.push(void 0),s):p)}return[Mp(t,a+(t[r]||"<?>")+(e===2?"</svg>":"")),n]},gn=class{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=e.length-1,u=this.parts,[c,l]=mm(e,r);if(this.el=gn.createElement(c,n),dn.currentNode=this.el.content,r===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(i=dn.nextNode())!==null&&u.length<s;){if(i.nodeType===1){if(i.hasAttributes()){let d=[];for(let f of i.getAttributeNames())if(f.endsWith(Dc)||f.startsWith(Nr)){let p=l[o++];if(d.push(f),p!==void 0){let h=i.getAttribute(p.toLowerCase()+Dc).split(Nr),m=/([.?@])?(.*)/.exec(p);u.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?Pc:m[1]==="?"?Rc:m[1]==="@"?$c:li})}else u.push({type:6,index:a})}for(let f of d)i.removeAttribute(f)}if(Lp.test(i.tagName)){let d=i.textContent.split(Nr),f=d.length-1;if(f>0){i.textContent=ci?ci.emptyScript:"";for(let p=0;p<f;p++)i.append(d[p],ta()),dn.nextNode(),u.push({type:2,index:++a});i.append(d[f],ta())}}}else if(i.nodeType===8)if(i.data===Rp)u.push({type:2,index:a});else{let d=-1;for(;(d=i.data.indexOf(Nr,d+1))!==-1;)u.push({type:7,index:a}),d+=Nr.length-1}a++}}static createElement(e,r){let n=hn.createElement("template");return n.innerHTML=e,n}};function ui(t,e,r=t,n){var i,a,o,s;if(e===mn)return e;let u=n!==void 0?(i=r._$Co)===null||i===void 0?void 0:i[n]:r._$Cl,c=ra(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,n)),n!==void 0?((o=(s=r)._$Co)!==null&&o!==void 0?o:s._$Co=[])[n]=u:r._$Cl=u),u!==void 0&&(e=ui(t,u._$AS(t,e.values),u,n)),e}var Nc=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:n},parts:i}=this._$AD,a=((r=e?.creationScope)!==null&&r!==void 0?r:hn).importNode(n,!0);dn.currentNode=a;let o=dn.nextNode(),s=0,u=0,c=i[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new yn(o,o.nextSibling,this,e):c.type===1?l=new c.ctor(o,c.name,c.strings,this,e):c.type===6&&(l=new Lc(o,this,e)),this._$AV.push(l),c=i[++u]}s!==c?.index&&(o=dn.nextNode(),s++)}return dn.currentNode=hn,a}v(e){let r=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,r),r+=n.strings.length-2):n._$AI(e[r])),r++}},yn=class{constructor(e,r,n,i){var a;this.type=2,this._$AH=ze,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=n,this.options=i,this._$Cp=(a=i?.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=ui(this,e,r),ra(e)?e===ze||e==null||e===""?(this._$AH!==ze&&this._$AR(),this._$AH=ze):e!==this._$AH&&e!==mn&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):hm(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!==ze&&ra(this._$AH)?this._$AA.nextSibling.data=e:this.$(hn.createTextNode(e)),this._$AH=e}g(e){var r;let{values:n,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=gn.createElement(Mp(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===a)this._$AH.v(n);else{let o=new Nc(a,this),s=o.u(this.options);o.v(n),this.$(s),this._$AH=o}}_$AC(e){let r=Np.get(e.strings);return r===void 0&&Np.set(e.strings,r=new gn(e)),r}T(e){$p(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,i=0;for(let a of e)i===r.length?r.push(n=new yn(this.k(ta()),this.k(ta()),this,this.options)):n=r[i],n._$AI(a),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(e=this._$AA.nextSibling,r){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,r);e&&e!==this._$AB;){let i=e.nextSibling;e.remove(),e=i}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}},li=class{constructor(e,r,n,i,a){this.type=1,this._$AH=ze,this._$AN=void 0,this.element=e,this.name=r,this._$AM=i,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=ze}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,r=this,n,i){let a=this.strings,o=!1;if(a===void 0)e=ui(this,e,r,0),o=!ra(e)||e!==this._$AH&&e!==mn,o&&(this._$AH=e);else{let s=e,u,c;for(e=a[0],u=0;u<a.length-1;u++)c=ui(this,s[n+u],r,u),c===mn&&(c=this._$AH[u]),o||(o=!ra(c)||c!==this._$AH[u]),c===ze?e=ze:e!==ze&&(e+=(c??"")+a[u+1]),this._$AH[u]=c}o&&!i&&this.j(e)}j(e){e===ze?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Pc=class extends li{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===ze?void 0:e}},gm=ci?ci.emptyScript:"",Rc=class extends li{constructor(){super(...arguments),this.type=4}j(e){e&&e!==ze?this.element.setAttribute(this.name,gm):this.element.removeAttribute(this.name)}},$c=class extends li{constructor(e,r,n,i,a){super(e,r,n,i,a),this.type=5}_$AI(e,r=this){var n;if((e=(n=ui(this,e,r,0))!==null&&n!==void 0?n:ze)===mn)return;let i=this._$AH,a=e===ze&&i!==ze||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==ze&&(i===ze||a);a&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var r,n;typeof this._$AH=="function"?this._$AH.call((n=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},Lc=class{constructor(e,r,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){ui(this,e)}};var Pp=xo.litHtmlPolyfillSupport;Pp?.(gn,yn),((Tc=xo.litHtmlVersions)!==null&&Tc!==void 0?Tc:xo.litHtmlVersions=[]).push("2.8.0");var jp=(t,e,r)=>{var n,i;let a=(n=r?.renderBefore)!==null&&n!==void 0?n:e,o=a._$litPart$;if(o===void 0){let s=(i=r?.renderBefore)!==null&&i!==void 0?i:null;a._$litPart$=o=new yn(e.insertBefore(ta(),s),s,void 0,r??{})}return o._$AI(t),o};var Fc,Mc;var Pr=class extends mr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let n=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=n.firstChild),n}update(e){let r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=jp(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 mn}};Pr.finalized=!0,Pr._$litElement$=!0,(Fc=globalThis.litElementHydrateSupport)===null||Fc===void 0||Fc.call(globalThis,{LitElement:Pr});var Up=globalThis.litElementPolyfillSupport;Up?.({LitElement:Pr});((Mc=globalThis.litElementVersions)!==null&&Mc!==void 0?Mc:globalThis.litElementVersions=[]).push("3.3.3");var qp=t=>e=>typeof e=="function"?((r,n)=>(customElements.define(r,n),n))(t,e):((r,n)=>{let{kind:i,elements:a}=n;return{kind:i,elements:a,finisher(o){customElements.define(r,o)}}})(t,e);var ym=(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)}},vm=(t,e,r)=>{e.constructor.createProperty(r,t)};function Ct(t){return(e,r)=>r!==void 0?vm(t,e,r):ym(t,e)}function ot(t){return Ct({...t,state:!0})}var jc,vb=((jc=window.HTMLSlotElement)===null||jc===void 0?void 0:jc.prototype.assignedElements)!=null?(t,e)=>t.assignedElements(e):(t,e)=>t.assignedNodes(e).filter(r=>r.nodeType===Node.ELEMENT_NODE);var Uc=function(t,e){return Uc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Uc(t,e)};function De(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Uc(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var w=function(){return w=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},w.apply(this,arguments)};function Jt(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function qt(t,e,r,n){function i(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(n.next(l))}catch(d){o(d)}}function u(l){try{c(n.throw(l))}catch(d){o(d)}}function c(l){l.done?a(l.value):i(l.value).then(s,u)}c((n=n.apply(t,e||[])).next())})}function Bt(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,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(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(a=c[0]&2?i.return:c[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,c[1])).done)return a;switch(i=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++,i=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],i=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Rr(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))}var qc="Invariant Violation",Bp=Object.setPrototypeOf,bm=Bp===void 0?function(t,e){return t.__proto__=e,t}:Bp,W=function(t){De(e,t);function e(r){r===void 0&&(r=qc);var n=t.call(this,typeof r=="number"?qc+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=qc,bm(n,e.prototype),n}return e}(Error);function R(t,e){if(!t)throw new W(e)}var ko=["debug","log","warn","error","silent"],Bc=ko.indexOf("log");function Ao(t){return function(){if(ko.indexOf(t)>=Bc){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Ao("debug"),t.log=Ao("log"),t.warn=Ao("warn"),t.error=Ao("error")})(R||(R={}));function Vp(t){var e=ko[Bc];return Bc=Math.max(0,ko.indexOf(t)),e}function We(t){try{return t()}catch{}}var Io=We(function(){return globalThis})||We(function(){return window})||We(function(){return self})||We(function(){return global})||We(function(){return We.constructor("return this")()});var Qp="__",zp=[Qp,Qp].join("DEV");function _m(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Io,zp,{value:We(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Io[zp]}}var vn=_m();function $r(t){try{return t()}catch{}}var Vc=$r(function(){return globalThis})||$r(function(){return window})||$r(function(){return self})||$r(function(){return global})||$r(function(){return $r.constructor("return this")()}),Qc=!1;function Sm(){Vc&&!$r(function(){return"production"})&&!$r(function(){return process})&&(Object.defineProperty(Vc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Qc=!0)}Sm();function zc(){Qc&&(delete Vc.process,Qc=!1)}var Qb=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",zb=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",Wp=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Le=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 Wc(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var wm=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ia=wm;function To(t){var e=t.prototype.toJSON;typeof e=="function"||Wc(0),t.prototype.inspect=e,ia&&(t.prototype[ia]=e)}var Hp=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();To(Hp);var Gp=function(){function t(r,n,i,a,o,s,u){this.kind=r,this.start=n,this.end=i,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}();To(Gp);function Hc(t){return t!=null&&typeof t.kind=="string"}function Oo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Oo=function(r){return typeof r}:Oo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Oo(t)}var Cm=10,Kp=2;function aa(t){return Do(t,[])}function Do(t,e){switch(Oo(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Em(t,e);default:return String(t)}}function Em(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=km(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Do(i,r)}else if(Array.isArray(t))return Am(t,r);return xm(t,r)}function xm(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Kp)return"["+Im(t)+"]";var n=r.map(function(i){var a=Do(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Am(t,e){if(t.length===0)return"[]";if(e.length>Kp)return"[Array]";for(var r=Math.min(Cm,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(Do(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function km(t){var e=t[String(ia)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Im(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 oa(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function Zp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Tm(t,e,r){return e&&Zp(t.prototype,e),r&&Zp(t,r),t}var No=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||oa(0,"Body must be a string. Received: ".concat(aa(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||oa(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||oa(0,"column in locationOffset is 1-indexed and must be positive.")}return Tm(t,[{key:Wp,get:function(){return"Source"}}]),t}();function Jp(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
1
+ var fm=Object.defineProperty;var dm=Object.getOwnPropertyDescriptor;var te=(t,e,r,n)=>{for(var i=n>1?void 0:n?dm(e,r):e,a=t.length-1,o;a>=0;a--)(o=t[a])&&(i=(n?o(e,r,i):o(i))||i);return n&&i&&fm(e,r,i),i};var X=(t,e,r)=>new Promise((n,i)=>{var a=u=>{try{s(r.next(u))}catch(c){i(c)}},o=u=>{try{s(r.throw(u))}catch(c){i(c)}},s=u=>u.done?n(u.value):Promise.resolve(u.value).then(a,o);s((r=r.apply(t,e)).next())});import{ZBarSymbolType as fe,ZBarConfigType as Tp,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,n){return new(r||(r=Promise))(function(i,a){function o(c){try{u(n.next(c))}catch(l){a(l)}}function s(c){try{u(n.throw(c))}catch(l){a(l)}}function u(c){var l;c.done?i(c.value):(l=c.value,l instanceof r?l:new r(function(f){f(l)})).then(o,s)}u((n=n.apply(t,e||[])).next())})}var M=class{constructor(e,r=Tp.ZBAR_CFG_ENABLE,n=1){this.symbolType=e,this.configType=r,this.number=n,this.configSteps=[this]}static register(e,r,n=r.symbolType){return M.formatsToConfigs[e]=r,M.typesToFormats[n]=M.typesToFormats[n]||e,r}static formats(){return Object.keys(M.formatsToConfigs)}static toFormat(e){return M.typesToFormats[e]}static configure(e,r){var n;(n=M.formatsToConfigs[r])===null||n===void 0||n.configSteps.forEach(i=>e.setConfig(i.symbolType,i.configType,i.number))}add(e){return this.configSteps.push(e),this}},Ip;M.formatsToConfigs={},M.typesToFormats={},M.register("codabar",new M(fe.ZBAR_CODABAR)),M.register("code_39",new M(fe.ZBAR_CODE39)),M.register("code_93",new M(fe.ZBAR_CODE93)),M.register("code_128",new M(fe.ZBAR_CODE128)),M.register("databar",new M(fe.ZBAR_DATABAR)),M.register("databar_exp",new M(fe.ZBAR_DATABAR_EXP)),M.register("ean_2",new M(fe.ZBAR_EAN2)),M.register("ean_5",new M(fe.ZBAR_EAN5)),M.register("ean_8",new M(fe.ZBAR_EAN8)),M.register("ean_13",new M(fe.ZBAR_EAN13)),M.register("ean_13+2",new M(fe.ZBAR_EAN13)).add(new M(fe.ZBAR_EAN2)),M.register("ean_13+5",new M(fe.ZBAR_EAN13)).add(new M(fe.ZBAR_EAN5)),M.register("isbn_10",new M(fe.ZBAR_ISBN10)).add(new M(fe.ZBAR_EAN13)),M.register("isbn_13",new M(fe.ZBAR_ISBN13)).add(new M(fe.ZBAR_EAN13)),M.register("isbn_13+2",new M(fe.ZBAR_ISBN13)).add(new M(fe.ZBAR_EAN13)).add(new M(fe.ZBAR_EAN2)),M.register("isbn_13+5",new M(fe.ZBAR_ISBN13)).add(new M(fe.ZBAR_EAN13)).add(new M(fe.ZBAR_EAN5)),M.register("itf",new M(fe.ZBAR_I25)),M.register("qr_code",new M(fe.ZBAR_QRCODE)),M.register("sq_code",new M(fe.ZBAR_SQCODE)),M.register("upc_a",new M(fe.ZBAR_UPCA)).add(new M(fe.ZBAR_EAN13)),M.register("upc_e",new M(fe.ZBAR_UPCE)).add(new M(fe.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"}(Ip||(Ip={}));var xc=class{},ym=(()=>{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 r=e.formats.filter(n=>!M.formats().includes(n));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(!Dr.isImageBitmapSource(e))throw new TypeError("BarcodeDetector.detect() argument is not an ImageBitmapSource");let r=Dr.intrinsicDimensions(e);if(r.width===0||r.height===0)return Promise.resolve([]);try{return Promise.all([this.toImageData(e),this.getScanner()]).then(n=>{let i=n[0],a=n[1];return this.zbarConfig.enableCache!==void 0&&a.enableCache(this.zbarConfig.enableCache),hm(i.data,i.width,i.height,a)}).then(n=>n.map(i=>this.toBarcodeDetectorResult(i)))}catch(n){return Promise.reject(n)}}getScanner(){return new Promise((e,r)=>gm(this,void 0,void 0,function*(){if(!this.scanner){let n=yield mm();this.formats.length>0&&(n.setConfig(fe.ZBAR_NONE,Tp.ZBAR_CFG_ENABLE,0),this.formats.forEach(i=>M.configure(n,i))),this.scanner=n}e(this.scanner)}))}toImageData(e){let r=n=>{let i=Dr.intrinsicDimensions(n);this.canvas&&this.canvas.width===i.width&&this.canvas.height===i.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}}(i.width,i.height));let a=this.canvas,o=a.getContext("2d");return o.drawImage(n,0,0),o.getImageData(0,0,a.width,a.height)};if(e instanceof ImageData)return Promise.resolve(e);if(e instanceof Blob){let n=document.createElement("img");return n.src=URL.createObjectURL(e),n.decode().then(()=>r(n)).finally(()=>URL.revokeObjectURL(n.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(n=>{r.minX=Math.min(r.minX,n.x),r.maxX=Math.max(r.maxX,n.x),r.minY=Math.min(r.minY,n.y),r.maxY=Math.max(r.maxY,n.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,Io=ko.ShadowRoot&&(ko.ShadyCSS===void 0||ko.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,Ac=Symbol(),Op=new WeakMap,ta=class{constructor(e,r,n){if(this._$cssResult$=!0,n!==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(Io&&e===void 0){let n=r!==void 0&&r.length===1;n&&(e=Op.get(r)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Op.set(r,e))}return e}toString(){return this.cssText}},Dp=t=>new ta(typeof t=="string"?t:t+"",void 0,Ac),kc=(t,...e)=>{let r=t.length===1?t[0]:e.reduce((n,i,a)=>n+(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.")})(i)+t[a+1],t[0]);return new ta(r,t,Ac)},Ic=(t,e)=>{Io?t.adoptedStyleSheets=e.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):e.forEach(r=>{let n=document.createElement("style"),i=ko.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=r.cssText,t.appendChild(n)})},To=Io?t=>t:t=>t instanceof CSSStyleSheet?(e=>{let r="";for(let n of e.cssRules)r+=n.cssText;return Dp(r)})(t):t;var Tc,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",mr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var 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,n)=>{let i=this._$Ep(n,r);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),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 n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,r);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,r,n){return{get(){return this[r]},set(i){let a=this[e];this[r]=i,this.requestUpdate(e,a,n)},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,n=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(let i of n)this.createProperty(i,r[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let r=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)r.unshift(To(i))}else e!==void 0&&r.push(To(e));return r}static _$Ep(e,r){let n=r.attribute;return n===!1?void 0:typeof n=="string"?n: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,n;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.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 Ic(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 n;return(n=r.hostConnected)===null||n===void 0?void 0:n.call(r)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(r=>{var n;return(n=r.hostDisconnected)===null||n===void 0?void 0:n.call(r)})}attributeChangedCallback(e,r,n){this._$AK(e,n)}_$EO(e,r,n=Oc){var i;let a=this.constructor._$Ep(e,n);if(a!==void 0&&n.reflect===!0){let o=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:Dc).toAttribute(r,n.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,r){var n;let i=this.constructor,a=i._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=i.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?o.converter:Dc;this._$El=a,this[a]=s.fromAttribute(r,o.type),this._$El=null}}requestUpdate(e,r,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Pp)(this[e],r)?(this._$AL.has(e)||this._$AL.set(e,r),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(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((i,a)=>this[a]=i),this._$Ei=void 0);let r=!1,n=this._$AL;try{r=this.shouldUpdate(n),r?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var a;return(a=i.hostUpdate)===null||a===void 0?void 0:a.call(i)}),this.update(n)):this._$Ek()}catch(i){throw r=!1,this._$Ek(),i}r&&this._$AE(n)}willUpdate(e){}_$AE(e){var r;(r=this._$ES)===null||r===void 0||r.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((r,n)=>this._$EO(n,this[n],r)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};mr[Nc]=!0,mr.elementProperties=new Map,mr.elementStyles=[],mr.shadowRootOptions={mode:"open"},Rp?.({ReactiveElement:mr}),((Tc=Oo.reactiveElementVersions)!==null&&Tc!==void 0?Tc:Oo.reactiveElementVersions=[]).push("1.6.3");var Rc,Do=window,pi=Do.trustedTypes,$p=pi?pi.createPolicy("lit-html",{createHTML:t=>t}):void 0,$c="$lit$",Nr=`lit$${(Math.random()+"").slice(9)}$`,Bp="?"+Nr,bm=`<${Bp}>`,gn=document,na=()=>gn.createComment(""),ia=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]`,ra=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Lp=/-->/g,Fp=/>/g,hn=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}),F=zp(1),J3=zp(2),yn=Symbol.for("lit-noChange"),We=Symbol.for("lit-nothing"),jp=new WeakMap,mn=gn.createTreeWalker(gn,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 wm=(t,e)=>{let r=t.length-1,n=[],i,a=e===2?"<svg>":"",o=ra;for(let s=0;s<r;s++){let u=t[s],c,l,f=-1,d=0;for(;d<u.length&&(o.lastIndex=d,l=o.exec(u),l!==null);)d=o.lastIndex,o===ra?l[1]==="!--"?o=Lp:l[1]!==void 0?o=Fp:l[2]!==void 0?(Qp.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=hn):l[3]!==void 0&&(o=hn):o===hn?l[0]===">"?(o=i??ra,f=-1):l[1]===void 0?f=-2:(f=o.lastIndex-l[2].length,c=l[1],o=l[3]===void 0?hn:l[3]==='"'?Up:Mp):o===Up||o===Mp?o=hn:o===Lp||o===Fp?o=ra:(o=hn,i=void 0);let p=o===hn&&t[s+1].startsWith("/>")?" ":"";a+=o===ra?u+bm:f>=0?(n.push(c),u.slice(0,f)+$c+u.slice(f)+Nr+p):u+Nr+(f===-2?(n.push(void 0),s):p)}return[Wp(t,a+(t[r]||"<?>")+(e===2?"</svg>":"")),n]},vn=class{constructor({strings:e,_$litType$:r},n){let i;this.parts=[];let a=0,o=0,s=e.length-1,u=this.parts,[c,l]=wm(e,r);if(this.el=vn.createElement(c,n),mn.currentNode=this.el.content,r===2){let f=this.el.content,d=f.firstChild;d.remove(),f.append(...d.childNodes)}for(;(i=mn.nextNode())!==null&&u.length<s;){if(i.nodeType===1){if(i.hasAttributes()){let f=[];for(let d of i.getAttributeNames())if(d.endsWith($c)||d.startsWith(Nr)){let p=l[o++];if(f.push(d),p!==void 0){let h=i.getAttribute(p.toLowerCase()+$c).split(Nr),g=/([.?@])?(.*)/.exec(p);u.push({type:1,index:a,name:g[2],strings:h,ctor:g[1]==="."?Fc:g[1]==="?"?Mc:g[1]==="@"?Uc:di})}else u.push({type:6,index:a})}for(let d of f)i.removeAttribute(d)}if(Qp.test(i.tagName)){let f=i.textContent.split(Nr),d=f.length-1;if(d>0){i.textContent=pi?pi.emptyScript:"";for(let p=0;p<d;p++)i.append(f[p],na()),mn.nextNode(),u.push({type:2,index:++a});i.append(f[d],na())}}}else if(i.nodeType===8)if(i.data===Bp)u.push({type:2,index:a});else{let f=-1;for(;(f=i.data.indexOf(Nr,f+1))!==-1;)u.push({type:7,index:a}),f+=Nr.length-1}a++}}static createElement(e,r){let n=gn.createElement("template");return n.innerHTML=e,n}};function fi(t,e,r=t,n){var i,a,o,s;if(e===yn)return e;let u=n!==void 0?(i=r._$Co)===null||i===void 0?void 0:i[n]:r._$Cl,c=ia(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,n)),n!==void 0?((o=(s=r)._$Co)!==null&&o!==void 0?o:s._$Co=[])[n]=u:r._$Cl=u),u!==void 0&&(e=fi(t,u._$AS(t,e.values),u,n)),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:n},parts:i}=this._$AD,a=((r=e?.creationScope)!==null&&r!==void 0?r:gn).importNode(n,!0);mn.currentNode=a;let o=mn.nextNode(),s=0,u=0,c=i[0];for(;c!==void 0;){if(s===c.index){let l;c.type===2?l=new bn(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=i[++u]}s!==c?.index&&(o=mn.nextNode(),s++)}return mn.currentNode=gn,a}v(e){let r=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,r),r+=n.strings.length-2):n._$AI(e[r])),r++}},bn=class{constructor(e,r,n,i){var a;this.type=2,this._$AH=We,this._$AN=void 0,this._$AA=e,this._$AB=r,this._$AM=n,this.options=i,this._$Cp=(a=i?.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=fi(this,e,r),ia(e)?e===We||e==null||e===""?(this._$AH!==We&&this._$AR(),this._$AH=We):e!==this._$AH&&e!==yn&&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&&ia(this._$AH)?this._$AA.nextSibling.data=e:this.$(gn.createTextNode(e)),this._$AH=e}g(e){var r;let{values:n,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=vn.createElement(Wp(i.h,i.h[0]),this.options)),i);if(((r=this._$AH)===null||r===void 0?void 0:r._$AD)===a)this._$AH.v(n);else{let o=new Lc(a,this),s=o.u(this.options);o.v(n),this.$(s),this._$AH=o}}_$AC(e){let r=jp.get(e.strings);return r===void 0&&jp.set(e.strings,r=new vn(e)),r}T(e){Vp(this._$AH)||(this._$AH=[],this._$AR());let r=this._$AH,n,i=0;for(let a of e)i===r.length?r.push(n=new bn(this.k(na()),this.k(na()),this,this.options)):n=r[i],n._$AI(a),i++;i<r.length&&(this._$AR(n&&n._$AB.nextSibling,i),r.length=i)}_$AR(e=this._$AA.nextSibling,r){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,r);e&&e!==this._$AB;){let i=e.nextSibling;e.remove(),e=i}}setConnected(e){var r;this._$AM===void 0&&(this._$Cp=e,(r=this._$AP)===null||r===void 0||r.call(this,e))}},di=class{constructor(e,r,n,i,a){this.type=1,this._$AH=We,this._$AN=void 0,this.element=e,this.name=r,this._$AM=i,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=We}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,r=this,n,i){let a=this.strings,o=!1;if(a===void 0)e=fi(this,e,r,0),o=!ia(e)||e!==this._$AH&&e!==yn,o&&(this._$AH=e);else{let s=e,u,c;for(e=a[0],u=0;u<a.length-1;u++)c=fi(this,s[n+u],r,u),c===yn&&(c=this._$AH[u]),o||(o=!ia(c)||c!==this._$AH[u]),c===We?e=We:e!==We&&(e+=(c??"")+a[u+1]),this._$AH[u]=c}o&&!i&&this.j(e)}j(e){e===We?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Fc=class extends di{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===We?void 0:e}},Sm=pi?pi.emptyScript:"",Mc=class extends di{constructor(){super(...arguments),this.type=4}j(e){e&&e!==We?this.element.setAttribute(this.name,Sm):this.element.removeAttribute(this.name)}},Uc=class extends di{constructor(e,r,n,i,a){super(e,r,n,i,a),this.type=5}_$AI(e,r=this){var n;if((e=(n=fi(this,e,r,0))!==null&&n!==void 0?n:We)===yn)return;let i=this._$AH,a=e===We&&i!==We||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==We&&(i===We||a);a&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var r,n;typeof this._$AH=="function"?this._$AH.call((n=(r=this.options)===null||r===void 0?void 0:r.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},jc=class{constructor(e,r,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=r,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){fi(this,e)}};var qp=Do.litHtmlPolyfillSupport;qp?.(vn,bn),((Rc=Do.litHtmlVersions)!==null&&Rc!==void 0?Rc:Do.litHtmlVersions=[]).push("2.8.0");var Hp=(t,e,r)=>{var n,i;let a=(n=r?.renderBefore)!==null&&n!==void 0?n:e,o=a._$litPart$;if(o===void 0){let s=(i=r?.renderBefore)!==null&&i!==void 0?i:null;a._$litPart$=o=new bn(e.insertBefore(na(),s),s,void 0,r??{})}return o._$AI(t),o};var qc,Bc;var Rr=class extends mr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,r;let n=super.createRenderRoot();return(e=(r=this.renderOptions).renderBefore)!==null&&e!==void 0||(r.renderBefore=n.firstChild),n}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 yn}};Rr.finalized=!0,Rr._$litElement$=!0,(qc=globalThis.litElementHydrateSupport)===null||qc===void 0||qc.call(globalThis,{LitElement:Rr});var Gp=globalThis.litElementPolyfillSupport;Gp?.({LitElement:Rr});((Bc=globalThis.litElementVersions)!==null&&Bc!==void 0?Bc:globalThis.litElementVersions=[]).push("3.3.3");var Kp=t=>e=>typeof e=="function"?((r,n)=>(customElements.define(r,n),n))(t,e):((r,n)=>{let{kind:i,elements:a}=n;return{kind:i,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 xe(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,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},Qc(t,e)};function Ne(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,n=1,i=arguments.length;n<i;n++){r=arguments[n];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 n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Bt(t,e,r,n){function i(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(n.next(l))}catch(f){o(f)}}function u(l){try{c(n.throw(l))}catch(f){o(f)}}function c(l){l.done?a(l.value):i(l.value).then(s,u)}c((n=n.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:[]},n,i,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(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,c[0]&&(r=0)),r;)try{if(n=1,i&&(a=c[0]&2?i.return:c[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,c[1])).done)return a;switch(i=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++,i=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],i=0}finally{n=a=0}if(c[0]&5)throw c[1];return{value:c[0]?c[1]:void 0,done:!0}}}function Pr(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);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,H=function(t){Ne(e,t);function e(r){r===void 0&&(r=zc);var n=t.call(this,typeof r=="number"?zc+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=zc,xm(n,e.prototype),n}return e}(Error);function $(t,e){if(!t)throw new H(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 _n=Am();function $r(t){try{return t()}catch{}}var Hc=$r(function(){return globalThis})||$r(function(){return window})||$r(function(){return self})||$r(function(){return global})||$r(function(){return $r.constructor("return this")()}),Gc=!1;function km(){Hc&&!$r(function(){return"production"})&&!$r(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 Fe=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 Im=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,oa=Im;function $o(t){var e=t.prototype.toJSON;typeof e=="function"||Zc(0),t.prototype.inspect=e,oa&&(t.prototype[oa]=e)}var tf=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();$o(tf);var rf=function(){function t(r,n,i,a,o,s,u){this.kind=r,this.start=n,this.end=i,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 Tm=10,nf=2;function sa(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]),n=Rm(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Fo(i,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 n=r.map(function(i){var a=Fo(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Nm(t,e){if(t.length===0)return"[]";if(e.length>nf)return"[Array]";for(var r=Math.min(Tm,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(Fo(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Rm(t){var e=t[String(oa)];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 ca(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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ca(0,"Body must be a string. Received: ".concat(sa(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||ca(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ca(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,n=t.indexOf(`
4
4
  `)===-1,i=t[0]===" "||t[0]===" ",a=t[t.length-1]==='"',o=t[t.length-1]==="\\",s=!n||a||o||r,u="";return s&&!(n&&i)&&(u+=`
5
5
  `+e),u+=e?t.replace(/\n/g,`
6
6
  `+e):t,s&&(u+=`
7
- `),'"""'+u.replace(/"""/g,'\\"""')+'"""'}var Om={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"]},bn=Object.freeze({});function nt(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Om,n=void 0,i=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(i)u=u.slice();else{for(var v={},b=0,_=Object.keys(u);b<_.length;b++){var S=_[b];v[S]=u[S]}u=v}for(var y=0,O=0;O<s.length;O++){var D=s[O][0],A=s[O][1];i&&(D-=y),i&&A===null?(u.splice(D,1),y++):u[D]=A}}o=n.index,a=n.keys,s=n.edits,i=n.inArray,n=n.prev}else{if(c=l?i?o:a[o]:void 0,u=l?l[c]:p,u==null)continue;l&&d.push(c)}var N=void 0;if(!Array.isArray(u)){if(!Hc(u))throw new Error("Invalid AST Node: ".concat(aa(u),"."));var L=Gc(e,u.kind,h);if(L){if(N=L.call(e,u,c,l,d,f),N===bn)break;if(N===!1){if(!h){d.pop();continue}}else if(N!==void 0&&(s.push([c,N]),!h))if(Hc(N))u=N;else{d.pop();continue}}}if(N===void 0&&m&&s.push([c,u]),h)d.pop();else{var P;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(u),a=i?u:(P=r[u.kind])!==null&&P!==void 0?P:[],o=-1,s=[],l&&f.push(l),l=u}}while(n!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function Gc(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}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 pi(t){return nt(t,{leave:Nm})}var Dm=80,Nm={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return M(e.definitions,`
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"]},wn=Object.freeze({});function it(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Lm,n=void 0,i=Array.isArray(t),a=[t],o=-1,s=[],u=void 0,c=void 0,l=void 0,f=[],d=[],p=t;do{o++;var h=o===a.length,g=h&&s.length!==0;if(h){if(c=d.length===0?void 0:f[f.length-1],u=l,l=d.pop(),g){if(i)u=u.slice();else{for(var v={},b=0,_=Object.keys(u);b<_.length;b++){var w=_[b];v[w]=u[w]}u=v}for(var y=0,O=0;O<s.length;O++){var D=s[O][0],A=s[O][1];i&&(D-=y),i&&A===null?(u.splice(D,1),y++):u[D]=A}}o=n.index,a=n.keys,s=n.edits,i=n.inArray,n=n.prev}else{if(c=l?i?o:a[o]:void 0,u=l?l[c]:p,u==null)continue;l&&f.push(c)}var N=void 0;if(!Array.isArray(u)){if(!Jc(u))throw new Error("Invalid AST Node: ".concat(sa(u),"."));var L=Yc(e,u.kind,h);if(L){if(N=L.call(e,u,c,l,f,d),N===wn)break;if(N===!1){if(!h){f.pop();continue}}else if(N!==void 0&&(s.push([c,N]),!h))if(Jc(N))u=N;else{f.pop();continue}}}if(N===void 0&&g&&s.push([c,u]),h)f.pop();else{var P;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(u),a=i?u:(P=r[u.kind])!==null&&P!==void 0?P:[],o=-1,s=[],l&&d.push(l),l=u}}while(n!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function Yc(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}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 hi(t){return it(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,`
8
8
 
9
9
  `)+`
10
- `},OperationDefinition:function(e){var r=e.operation,n=e.name,i=Ie("(",M(e.variableDefinitions,", "),")"),a=M(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&r==="query"?o:M([r,M([n,i]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return r+": "+n+Ie(" = ",i)+Ie(" ",M(a," "))},SelectionSet:function(e){var r=e.selections;return Qt(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Ie("",r,": ")+n,u=s+Ie("(",M(i,", "),")");return u.length>Dm&&(u=s+Ie(`(
11
- `,Po(M(i,`
10
+ `},OperationDefinition:function(e){var r=e.operation,n=e.name,i=Te("(",U(e.variableDefinitions,", "),")"),a=U(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&r==="query"?o:U([r,U([n,i]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return r+": "+n+Te(" = ",i)+Te(" ",U(a," "))},SelectionSet:function(e){var r=e.selections;return zt(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Te("",r,": ")+n,u=s+Te("(",U(i,", "),")");return u.length>Fm&&(u=s+Te(`(
11
+ `,Uo(U(i,`
12
12
  `)),`
13
- )`)),M([u,M(a," "),o]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+Ie(" ",M(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return M(["...",Ie("on ",r),M(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(r).concat(Ie("(",M(i,", "),")")," ")+"on ".concat(n," ").concat(Ie("",M(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 n=e.value,i=e.block;return i?Jp(n,r==="description"?"":" "):JSON.stringify(n)},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"["+M(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+M(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+Ie("(",M(n,", "),")")},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:Vt(function(t){var e=t.directives,r=t.operationTypes;return M(["schema",M(e," "),Qt(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:Vt(function(t){var e=t.name,r=t.directives;return M(["scalar",e,M(r," ")]," ")}),ObjectTypeDefinition:Vt(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return M(["type",e,Ie("implements ",M(r," & ")),M(n," "),Qt(i)]," ")}),FieldDefinition:Vt(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(Yp(r)?Ie(`(
14
- `,Po(M(r,`
13
+ )`)),U([u,U(a," "),o]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+Te(" ",U(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return U(["...",Te("on ",r),U(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(r).concat(Te("(",U(i,", "),")")," ")+"on ".concat(n," ").concat(Te("",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 n=e.value,i=e.block;return i?of(n,r==="description"?"":" "):JSON.stringify(n)},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,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+Te("(",U(n,", "),")")},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,n=e.type;return r+": "+n},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,n=t.directives,i=t.fields;return U(["type",e,Te("implements ",U(r," & ")),U(n," "),zt(i)]," ")}),FieldDefinition:Qt(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(sf(r)?Te(`(
14
+ `,Uo(U(r,`
15
15
  `)),`
16
- )`):Ie("(",M(r,", "),")"))+": "+n+Ie(" ",M(i," "))}),InputValueDefinition:Vt(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return M([e+": "+r,Ie("= ",n),M(i," ")]," ")}),InterfaceTypeDefinition:Vt(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return M(["interface",e,Ie("implements ",M(r," & ")),M(n," "),Qt(i)]," ")}),UnionTypeDefinition:Vt(function(t){var e=t.name,r=t.directives,n=t.types;return M(["union",e,M(r," "),n&&n.length!==0?"= "+M(n," | "):""]," ")}),EnumTypeDefinition:Vt(function(t){var e=t.name,r=t.directives,n=t.values;return M(["enum",e,M(r," "),Qt(n)]," ")}),EnumValueDefinition:Vt(function(t){var e=t.name,r=t.directives;return M([e,M(r," ")]," ")}),InputObjectTypeDefinition:Vt(function(t){var e=t.name,r=t.directives,n=t.fields;return M(["input",e,M(r," "),Qt(n)]," ")}),DirectiveDefinition:Vt(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(Yp(r)?Ie(`(
17
- `,Po(M(r,`
16
+ )`):Te("(",U(r,", "),")"))+": "+n+Te(" ",U(i," "))}),InputValueDefinition:Qt(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return U([e+": "+r,Te("= ",n),U(i," ")]," ")}),InterfaceTypeDefinition:Qt(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return U(["interface",e,Te("implements ",U(r," & ")),U(n," "),zt(i)]," ")}),UnionTypeDefinition:Qt(function(t){var e=t.name,r=t.directives,n=t.types;return U(["union",e,U(r," "),n&&n.length!==0?"= "+U(n," | "):""]," ")}),EnumTypeDefinition:Qt(function(t){var e=t.name,r=t.directives,n=t.values;return U(["enum",e,U(r," "),zt(n)]," ")}),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,n=t.fields;return U(["input",e,U(r," "),zt(n)]," ")}),DirectiveDefinition:Qt(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(sf(r)?Te(`(
17
+ `,Uo(U(r,`
18
18
  `)),`
19
- )`):Ie("(",M(r,", "),")"))+(n?" repeatable":"")+" on "+M(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return M(["extend schema",M(r," "),Qt(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return M(["extend scalar",r,M(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return M(["extend type",r,Ie("implements ",M(n," & ")),M(i," "),Qt(a)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return M(["extend interface",r,Ie("implements ",M(n," & ")),M(i," "),Qt(a)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return M(["extend union",r,M(n," "),i&&i.length!==0?"= "+M(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return M(["extend enum",r,M(n," "),Qt(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return M(["extend input",r,M(n," "),Qt(i)]," ")}};function Vt(t){return function(e){return M([e.description,t(e)],`
20
- `)}}function M(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t?.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function Qt(t){return Ie(`{
21
- `,Po(M(t,`
19
+ )`):Te("(",U(r,", "),")"))+(n?" repeatable":"")+" on "+U(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return U(["extend schema",U(r," "),zt(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return U(["extend scalar",r,U(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return U(["extend type",r,Te("implements ",U(n," & ")),U(i," "),zt(a)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return U(["extend interface",r,Te("implements ",U(n," & ")),U(i," "),zt(a)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return U(["extend union",r,U(n," "),i&&i.length!==0?"= "+U(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return U(["extend enum",r,U(n," "),zt(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return U(["extend input",r,U(n," "),zt(i)]," ")}};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(n){return n}).join(r))!==null&&e!==void 0?e:""}function zt(t){return Te(`{
21
+ `,Uo(U(t,`
22
22
  `)),`
23
- }`)}function Ie(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function Po(t){return Ie(" ",t.replace(/\n/g,`
24
- `))}function Pm(t){return t.indexOf(`
25
- `)!==-1}function Yp(t){return t!=null&&t.some(Pm)}function sa(t){return t.kind===Le.FIELD||t.kind===Le.FRAGMENT_SPREAD||t.kind===Le.INLINE_FRAGMENT}function Xp(){return typeof No=="function"?zc():zc()}function Vm(){__DEV__?R(typeof vn=="boolean",vn):R(typeof vn=="boolean",39)}Xp();Vm();function gr(t,e){var r=t.directives;return!r||!r.length?!0:ef(r).every(function(n){var i=n.directive,a=n.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?R(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):R(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function fi(t,e,r){var n=new Set(t),i=n.size;return nt(e,{Directive:function(a){if(n.delete(a.name.value)&&(!r||!n.size))return bn}}),r?!n.size:n.size<i}function Kc(t){return t&&fi(["client","export"],t,!0)}function Qm(t){var e=t.name.value;return e==="skip"||e==="include"}function ef(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!Qm(r)){var n=r.arguments,i=r.name.value;__DEV__?R(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):R(n&&n.length===1,41);var a=n[0];__DEV__?R(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):R(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?R(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):R(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:r,ifArgument:a})}}),e}function Zc(t,e){var r=e,n=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new W("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 W(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof r>"u"&&(__DEV__?R(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):R(n.length===1,45),r=n[0].name.value);var i=w(w({},t),{definitions:Rr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return i}function _n(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function Sn(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=t.name.value;if(typeof e=="function")return e(r);var n=e&&e[r];return __DEV__?R(n,"No fragment named ".concat(r)):R(n,46),n||null}default:return null}}function oe(t){return t!==null&&typeof t=="object"}function Yt(t){return{__ref:String(t)}}function te(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function Jc(t){return oe(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function zm(t){return t.kind==="StringValue"}function Wm(t){return t.kind==="BooleanValue"}function Hm(t){return t.kind==="IntValue"}function Gm(t){return t.kind==="FloatValue"}function Km(t){return t.kind==="Variable"}function Zm(t){return t.kind==="ObjectValue"}function Jm(t){return t.kind==="ListValue"}function Ym(t){return t.kind==="EnumValue"}function Xm(t){return t.kind==="NullValue"}function Lr(t,e,r,n){if(Hm(r)||Gm(r))t[e.value]=Number(r.value);else if(Wm(r)||zm(r))t[e.value]=r.value;else if(Zm(r)){var i={};r.fields.map(function(o){return Lr(i,o.name,o.value,n)}),t[e.value]=i}else if(Km(r)){var a=(n||{})[r.name.value];t[e.value]=a}else if(Jm(r))t[e.value]=r.values.map(function(o){var s={};return Lr(s,e,o,n),s[e.value]});else if(Ym(r))t[e.value]=r.value;else if(Xm(r))t[e.value]=null;else throw __DEV__?new W('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 W(55)}function Yc(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(i){r[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return Lr(r[i.name.value],o,s,e)})}));var n=null;return t.arguments&&t.arguments.length&&(n={},t.arguments.forEach(function(i){var a=i.name,o=i.value;return Lr(n,a,o,e)})),ua(t.name.value,n,r)}var eg=["connection","include","skip","client","rest","export"],ua=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(r.connection.key,"(").concat(ca(i),")")}else return r.connection.key;var a=t;if(e){var o=ca(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){eg.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(ca(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=ca;return ca=t,e}}),ca=function(e){return JSON.stringify(e,tg)};function tg(t,e){return oe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,n){return r[n]=e[n],r},{})),e}function yr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var i=n.name,a=n.value;return Lr(r,i,a,e)}),r}return null}function Nt(t){return t.alias?t.alias.value:t.name.value}function la(t,e,r){if(typeof t.__typename=="string")return t.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(Et(a)){if(a.name.value==="__typename")return t[Nt(a)]}else{var o=la(t,Sn(a,r).selectionSet,r);if(typeof o=="string")return o}}}function Et(t){return t.kind==="Field"}function Xc(t){return t.kind==="InlineFragment"}function di(t){__DEV__?R(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'):R(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 W('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new W(48);return r});return __DEV__?R(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):R(e.length<=1,49),t}function Xt(t){return di(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function hi(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function wn(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function pa(t){var e=Xt(t);return __DEV__?R(e&&e.operation==="query","Must contain a query definition."):R(e&&e.operation==="query",50),e}function eu(t){__DEV__?R(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'):R(t.kind==="Document",51),__DEV__?R(t.definitions.length<=1,"Fragment must have exactly one definition."):R(t.definitions.length<=1,52);var e=t.definitions[0];return __DEV__?R(e.kind==="FragmentDefinition","Must be a fragment definition."):R(e.kind==="FragmentDefinition",53),e}function Cn(t){di(t);for(var e,r=0,n=t.definitions;r<n.length;r++){var i=n[r];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw __DEV__?new W("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new W(54)}function En(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&Lr(e,n.variable.name,n.defaultValue)}),e}var me=Array.isArray;function je(t){return Array.isArray(t)&&t.length>0}var tf={kind:Le.FIELD,name:{kind:Le.NAME,value:"__typename"}};function nf(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===Le.FRAGMENT_SPREAD&&nf(e[r.name.value],e)})}function rg(t){return nf(Xt(t)||eu(t),_n(wn(t)))?null:t}function ng(t){var e=new Set,r=[];return t.forEach(function(n){n.name?e.add(n.name):n.test&&r.push(n.test)}),function(n){return e.has(n.name.value)||r.some(function(i){return i(n)})}}function rf(t){var e=new Map;return function(n){n===void 0&&(n=t);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function tu(t,e){for(var r=rf(""),n=rf(""),i=function(_){for(var S=0,y=void 0;S<_.length&&(y=_[S]);++S)if(!me(y)){if(y.kind===Le.OPERATION_DEFINITION)return r(y.name&&y.name.value);if(y.kind===Le.FRAGMENT_DEFINITION)return n(y.name.value)}return __DEV__&&R.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Le.OPERATION_DEFINITION&&++a;var s=ng(t),u=t.some(function(_){return _.remove}),c=function(_){return u&&_&&_.some(s)},l=new Map,d=!1,f={enter:function(_){if(c(_.directives))return d=!0,null}},p=nt(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,S,y,O,D){var A=i(D);A&&A.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,S,y,O,D){if(c(_.directives))return d=!0,null;var A=i(D);A&&A.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,S,y,O){l.set(JSON.stringify(O),_)},leave:function(_,S,y,O){var D=l.get(JSON.stringify(O));if(_===D)return _;if(a>0&&_.selectionSet.selections.every(function(A){return A.kind===Le.FIELD&&A.name.value==="__typename"}))return n(_.name.value).removed=!0,d=!0,null}},Directive:{leave:function(_){if(s(_))return d=!0,null}}});if(!d)return e;var h=function(_){return _.transitiveVars||(_.transitiveVars=new Set(_.variables),_.removed||_.fragmentSpreads.forEach(function(S){h(n(S)).transitiveVars.forEach(function(y){_.transitiveVars.add(y)})})),_},m=new Set;p.definitions.forEach(function(_){_.kind===Le.OPERATION_DEFINITION?h(r(_.name&&_.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):_.kind===Le.FRAGMENT_DEFINITION&&a===0&&!n(_.name.value).removed&&m.add(_.name.value)}),m.forEach(function(_){h(n(_)).fragmentSpreads.forEach(function(S){m.add(S)})});var v=function(_){return!!(!m.has(_)||n(_).removed)},b={enter:function(_){if(v(_.name.value))return null}};return rg(nt(p,{FragmentSpread:b,FragmentDefinition:b,OperationDefinition:{leave:function(_){if(_.variableDefinitions){var S=h(r(_.name&&_.name.value)).transitiveVars;if(S.size<_.variableDefinitions.length)return w(w({},_),{variableDefinitions:_.variableDefinitions.filter(function(y){return S.has(y.variable.name.value)})})}}}}))}var xn=Object.assign(function(t){return nt(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind===Le.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return Et(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(Et(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return w(w({},e),{selections:Rr(Rr([],i,!0),[tf],!1)})}}}}}})},{added:function(t){return t===tf}}),ig={test:function(t){var e=t.name.value==="connection";return e&&(!t.arguments||!t.arguments.some(function(r){return r.name.value==="key"}))&&__DEV__&&R.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 ru(t){return tu([ig],di(t))}function nu(t){var e=Cn(t),r=e.operation;if(r==="query")return t;var n=nt(t,{OperationDefinition:{enter:function(i){return w(w({},i),{operation:"query"})}}});return n}function iu(t){di(t);var e=tu([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}var ag=Object.prototype.hasOwnProperty;function au(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return fa(t)}function fa(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new ht,i=1;i<r;++i)e=n.merge(e,t[i]);return e}var og=function(t,e,r){return this.merge(t[r],e[r])},ht=function(){function t(e){e===void 0&&(e=og),this.reconciler=e,this.isObject=oe,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return oe(r)&&oe(e)?(Object.keys(r).forEach(function(o){if(ag.call(e,o)){var s=e[o];if(r[o]!==s){var u=n.reconciler.apply(n,Rr([e,r,o],i,!1));u!==s&&(e=n.shallowCopyForMerge(e),e[o]=u)}}else e=n.shallowCopyForMerge(e),e[o]=r[o]}),e):r},t.prototype.shallowCopyForMerge=function(e){return oe(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=w({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},t}();function sg(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=cg(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}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 cg(t,e){if(!!t){if(typeof t=="string")return af(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 af(t,e)}}function af(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function of(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function uu(t,e,r){return e&&of(t.prototype,e),r&&of(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var lu=function(){return typeof Symbol=="function"},pu=function(t){return lu()&&Boolean(Symbol[t])},fu=function(t){return pu(t)?Symbol[t]:"@@"+t};lu()&&!pu("observable")&&(Symbol.observable=Symbol("observable"));var ug=fu("iterator"),su=fu("observable"),sf=fu("species");function $o(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function da(t){var e=t.constructor;return e!==void 0&&(e=e[sf],e===null&&(e=void 0)),e!==void 0?e:X}function lg(t){return t instanceof X}function mi(t){mi.log?mi.log(t):setTimeout(function(){throw t})}function Ro(t){Promise.resolve().then(function(){try{t()}catch(e){mi(e)}})}function cf(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=$o(e,"unsubscribe");r&&r.call(e)}}catch(n){mi(n)}}function cu(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function pg(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(uf(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function uf(t,e,r){t._state="running";var n=t._observer;try{var i=$o(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(cu(t),i)i.call(n,r);else throw r;break;case"complete":cu(t),i&&i.call(n);break}}catch(a){mi(a)}t._state==="closed"?cf(t):t._state==="running"&&(t._state="ready")}function ou(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}],Ro(function(){return pg(t)});return}uf(t,e,r)}}var fg=function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new dg(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(cu(this),cf(this))},uu(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),dg=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){ou(this._subscription,"next",n)},e.error=function(n){ou(this._subscription,"error",n)},e.complete=function(){ou(this._subscription,"complete")},uu(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),X=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(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new fg(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,o){if(typeof n!="function"){o(new TypeError(n+" is not a function"));return}function s(){u.unsubscribe(),a()}var u=i.subscribe({next:function(c){try{n(c,s)}catch(l){o(l),u.unsubscribe()}},error:o,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=da(this);return new a(function(o){return i.subscribe({next:function(s){try{s=n(s)}catch(u){return o.error(u)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=da(this);return new a(function(o){return i.subscribe({next:function(s){try{if(!n(s))return}catch(u){return o.error(u)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=da(this),o=arguments.length>1,s=!1,u=arguments[1],c=u;return new a(function(l){return i.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{c=n(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 n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=da(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(n),function(){c&&(c.unsubscribe(),c=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=da(this);return new a(function(o){var s=[],u=i.subscribe({next:function(l){if(n)try{l=n(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[su]=function(){return this},t.from=function(n){var i=typeof this=="function"?this:t;if(n==null)throw new TypeError(n+" is not an object");var a=$o(n,su);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return lg(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(pu("iterator")&&(a=$o(n,ug),a))return new i(function(s){Ro(function(){if(!s.closed){for(var u=sg(a.call(n)),c;!(c=u()).done;){var l=c.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(n))return new i(function(s){Ro(function(){if(!s.closed){for(var u=0;u<n.length;++u)if(s.next(n[u]),s.closed)return;s.complete()}})});throw new TypeError(n+" is not observable")},t.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=typeof this=="function"?this:t;return new o(function(s){Ro(function(){if(!s.closed){for(var u=0;u<i.length;++u)if(s.next(i[u]),s.closed)return;s.complete()}})})},uu(t,null,[{key:sf,get:function(){return this}}]),t}();lu()&&Object.defineProperty(X,Symbol("extensions"),{value:{symbol:su,hostReportError:mi},configurable:!0});function du(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 gi;typeof self<"u"?gi=self:typeof window<"u"?gi=window:typeof global<"u"?gi=global:typeof module<"u"?gi=module:gi=Function("return this")();var v_=du(gi);var lf=X.prototype,pf="@@observable";lf[pf]||(lf[pf]=function(){return this});var hg=Object.prototype.toString;function Lo(t){return hu(t)}function hu(t,e){switch(hg.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(i,a){r[a]=hu(i,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var n=Object.create(Object.getPrototypeOf(t));return e.set(t,n),Object.keys(t).forEach(function(i){n[i]=hu(t[i],e)}),n}default:return t}}function mg(t){var e=new Set([t]);return e.forEach(function(r){oe(r)&&gg(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){oe(r[n])&&e.add(r[n])})}),t}function gg(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function ha(t){return __DEV__&&mg(t),t}function An(t,e,r){var n=[];t.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](r)})}function Fo(t,e,r){return new X(function(n){var i=n.next,a=n.error,o=n.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 v=function(){return p(m)};c=c.then(v,v).then(function(b){--s,i&&i.call(n,b),u&&d.complete()},function(b){throw--s,b}).catch(function(b){a&&a.call(n,b)})}:function(m){return h&&h.call(n,m)}}var d={next:l(e,i),error:l(r,a),complete:function(){u=!0,s||o&&o.call(n)}},f=t.subscribe(d);return function(){return f.unsubscribe()}})}var Pt=typeof WeakMap=="function"&&We(function(){return navigator.product})!=="ReactNative",ff=typeof WeakSet=="function",mu=typeof Symbol=="function"&&typeof Symbol.for=="function",Fr=mu&&Symbol.asyncIterator,D_=typeof We(function(){return window.document.createElement})=="function",N_=We(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Mo(t){function e(r){Object.defineProperty(t,r,{value:X})}return mu&&Symbol.species&&e(Symbol.species),e("@@species"),t}function df(t){return t&&typeof t.then=="function"}var yi=function(t){De(e,t);function e(r){var n=t.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),An(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),An(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,o=i.sources,s=o===void 0?[]:o;if(a!==null){var u=s.shift();u?df(u)?u.then(function(c){return n.sub=c.subscribe(n.handlers)}):n.sub=u.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),An(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof r=="function"&&(r=[new X(r)]),df(r)?r.then(function(i){return n.start(i)},n.handlers.error):n.start(r),n}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 n=this.latest[0],i=r[n];i&&i.call(r,this.latest[1]),this.sub===null&&n==="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,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(r,n)}))},e.prototype.beforeNext=function(r){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,r(i,a))})},e}(X);Mo(yi);function Mr(t){return"incremental"in t}function yg(t){return"hasNext"in t&&"data"in t}function hf(t){return Mr(t)||yg(t)}function jo(t,e){var r=t,n=new ht;return Mr(e)&&je(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,o=i.path,s=o.length-1;s>=0;--s){var u=o[s],c=!isNaN(+u),l=c?[]:{};l[u]=a,a=l}r=n.merge(r,a)}),r}function vi(t){var e=Uo(t);return je(e)}function Uo(t){var e=je(t.errors)?t.errors.slice(0):[];return Mr(t)&&je(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(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(r[i]=a)})}),r}var mf=new Map;function ma(t){var e=mf.get(t)||1;return mf.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function gf(t){var e=ma("stringifyForDisplay");return JSON.stringify(t,function(r,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function ga(t,e){return jr(t,e,e.variables&&{variables:w(w({},t&&t.variables),e.variables)})}function qo(t){return new X(function(e){e.error(t)})}var ya=function(t,e,r){var n=new Error(r);throw n.name="ServerError",n.response=t,n.statusCode=t.status,n.result=e,n};function gu(t){for(var e=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(e.indexOf(i)<0)throw __DEV__?new W("illegal argument: ".concat(i)):new W(27)}return t}function yu(t,e){var r=w({},t),n=function(a){typeof a=="function"?r=w(w({},r),a(r)):r=w(w({},r),a)},i=function(){return w({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function vu(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?hi(e.query)||void 0:""),e}function yf(t,e){return e?e(t):X.of()}function va(t){return typeof t=="function"?new Rt(t):t}function Bo(t){return t.request.length<=1}var vg=function(t){De(e,t);function e(r,n){var i=t.call(this,r)||this;return i.link=n,i}return e}(Error),Rt=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return X.of()})},t.from=function(e){return e.length===0?t.empty():e.map(va).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var i=va(r),a=va(n||new t(yf));return Bo(i)&&Bo(a)?new t(function(o){return e(o)?i.request(o)||X.of():a.request(o)||X.of()}):new t(function(o,s){return e(o)?i.request(o,s)||X.of():a.request(o,s)||X.of()})},t.execute=function(e,r){return e.request(yu(r.context,vu(gu(r))))||X.of()},t.concat=function(e,r){var n=va(e);if(Bo(n))return __DEV__&&R.warn(new vg("You are calling concat on a terminating link, which will have no effect",n)),n;var i=va(r);return Bo(i)?new t(function(a){return n.request(a,function(o){return i.request(o)||X.of()})||X.of()}):new t(function(a,o){return n.request(a,function(s){return i.request(s,o)||X.of()})||X.of()})},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(yf)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new W("request is not implemented"):new W(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 bi=Rt.execute;var vf="3.7.10";function bf(t){return!!t.body}function _f(t){return!!t.getReader}function Sf(t){return!!(Fr&&t[Symbol.asyncIterator])}function wf(t){return!!t.stream}function Cf(t){return!!t.arrayBuffer}function Ef(t){return!!t.pipe}function bu(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function _u(t){var e=null,r=null,n=!1,i=[],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})}i.push(d)}}function s(d){r=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function u(){n=!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(i.length)return d({value:i.shift(),done:!1});if(n)return d({value:void 0,done:!0});a.push([d,f])})}var l={next:function(){return c()}};return Fr&&(l[Symbol.asyncIterator]=function(){return this}),l}function Su(t){var e=!1,r={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){t.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return Fr&&(r[Symbol.asyncIterator]=function(){return this}),r}function Vo(t){var e={next:function(){return t.read()}};return Fr&&(e[Symbol.asyncIterator]=function(){return this}),e}function xf(t){var e=t;if(bf(t)&&(e=t.body),Sf(e))return bu(e);if(_f(e))return Vo(e.getReader());if(wf(e))return Vo(e.stream().getReader());if(Cf(e))return Su(e.arrayBuffer());if(Ef(e))return _u(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Af=Object.prototype.hasOwnProperty;function kf(t,e){var r,n,i;return qt(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,p,h,m,v,b,_,S,y,O,D,A,N;return Bt(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=(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=xf(t),f=!0,L.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=L.sent(),h=p.value,m=p.done,v=typeof h=="string"?h:a.decode(h),f=!m,l+=v,b=l.indexOf(c);b>-1;){if(_=void 0,N=[l.slice(0,b),l.slice(b+c.length)],_=N[0],l=N[1],_.trim()){if(S=_.indexOf(`\r
23
+ }`)}function Te(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function Uo(t){return Te(" ",t.replace(/\n/g,`
24
+ `))}function Um(t){return t.indexOf(`
25
+ `)!==-1}function sf(t){return t!=null&&t.some(Um)}function ua(t){return t.kind===Fe.FIELD||t.kind===Fe.FRAGMENT_SPREAD||t.kind===Fe.INLINE_FRAGMENT}function cf(){return typeof Mo=="function"?Kc():Kc()}function Km(){__DEV__?$(typeof _n=="boolean",_n):$(typeof _n=="boolean",39)}cf();Km();function gr(t,e){var r=t.directives;return!r||!r.length?!0:uf(r).every(function(n){var i=n.directive,a=n.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?$(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):$(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function mi(t,e,r){var n=new Set(t),i=n.size;return it(e,{Directive:function(a){if(n.delete(a.name.value)&&(!r||!n.size))return wn}}),r?!n.size:n.size<i}function Xc(t){return t&&mi(["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 n=r.arguments,i=r.name.value;__DEV__?$(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):$(n&&n.length===1,41);var a=n[0];__DEV__?$(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):$(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?$(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," 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,n=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new H("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 H(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof r>"u"&&(__DEV__?$(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):$(n.length===1,45),r=n[0].name.value);var i=C(C({},t),{definitions:Pr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return i}function Sn(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function Cn(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=t.name.value;if(typeof e=="function")return e(r);var n=e&&e[r];return __DEV__?$(n,"No fragment named ".concat(r)):$(n,46),n||null}default:return null}}function ue(t){return t!==null&&typeof t=="object"}function Xt(t){return{__ref:String(t)}}function ae(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function tu(t){return ue(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 ng(t){return t.kind==="ListValue"}function ig(t){return t.kind==="EnumValue"}function ag(t){return t.kind==="NullValue"}function Lr(t,e,r,n){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 i={};r.fields.map(function(o){return Lr(i,o.name,o.value,n)}),t[e.value]=i}else if(tg(r)){var a=(n||{})[r.name.value];t[e.value]=a}else if(ng(r))t[e.value]=r.values.map(function(o){var s={};return Lr(s,e,o,n),s[e.value]});else if(ig(r))t[e.value]=r.value;else if(ag(r))t[e.value]=null;else throw __DEV__?new H('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 H(55)}function ru(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(i){r[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return Lr(r[i.name.value],o,s,e)})}));var n=null;return t.arguments&&t.arguments.length&&(n={},t.arguments.forEach(function(i){var a=i.name,o=i.value;return Lr(n,a,o,e)})),pa(t.name.value,n,r)}var og=["connection","include","skip","client","rest","export"],pa=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(r.connection.key,"(").concat(la(i),")")}else return r.connection.key;var a=t;if(e){var o=la(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(la(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=la;return la=t,e}}),la=function(e){return JSON.stringify(e,sg)};function sg(t,e){return ue(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,n){return r[n]=e[n],r},{})),e}function yr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var i=n.name,a=n.value;return Lr(r,i,a,e)}),r}return null}function Rt(t){return t.alias?t.alias.value:t.name.value}function fa(t,e,r){if(typeof t.__typename=="string")return t.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(Et(a)){if(a.name.value==="__typename")return t[Rt(a)]}else{var o=fa(t,Cn(a,r).selectionSet,r);if(typeof o=="string")return o}}}function Et(t){return t.kind==="Field"}function nu(t){return t.kind==="InlineFragment"}function gi(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 H('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new H(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 gi(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function yi(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function En(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function da(t){var e=er(t);return __DEV__?$(e&&e.operation==="query","Must contain a query definition."):$(e&&e.operation==="query",50),e}function iu(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 xn(t){gi(t);for(var e,r=0,n=t.definitions;r<n.length;r++){var i=n[r];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw __DEV__?new H("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new H(54)}function An(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&Lr(e,n.variable.name,n.defaultValue)}),e}var ve=Array.isArray;function qe(t){return Array.isArray(t)&&t.length>0}var lf={kind:Fe.FIELD,name:{kind:Fe.NAME,value:"__typename"}};function ff(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===Fe.FRAGMENT_SPREAD&&ff(e[r.name.value],e)})}function cg(t){return ff(er(t)||iu(t),Sn(En(t)))?null:t}function ug(t){var e=new Set,r=[];return t.forEach(function(n){n.name?e.add(n.name):n.test&&r.push(n.test)}),function(n){return e.has(n.name.value)||r.some(function(i){return i(n)})}}function pf(t){var e=new Map;return function(n){n===void 0&&(n=t);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function au(t,e){for(var r=pf(""),n=pf(""),i=function(_){for(var w=0,y=void 0;w<_.length&&(y=_[w]);++w)if(!ve(y)){if(y.kind===Fe.OPERATION_DEFINITION)return r(y.name&&y.name.value);if(y.kind===Fe.FRAGMENT_DEFINITION)return n(y.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===Fe.OPERATION_DEFINITION&&++a;var s=ug(t),u=t.some(function(_){return _.remove}),c=function(_){return u&&_&&_.some(s)},l=new Map,f=!1,d={enter:function(_){if(c(_.directives))return f=!0,null}},p=it(e,{Field:d,InlineFragment:d,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,w,y,O,D){var A=i(D);A&&A.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,w,y,O,D){if(c(_.directives))return f=!0,null;var A=i(D);A&&A.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,w,y,O){l.set(JSON.stringify(O),_)},leave:function(_,w,y,O){var D=l.get(JSON.stringify(O));if(_===D)return _;if(a>0&&_.selectionSet.selections.every(function(A){return A.kind===Fe.FIELD&&A.name.value==="__typename"}))return n(_.name.value).removed=!0,f=!0,null}},Directive:{leave:function(_){if(s(_))return f=!0,null}}});if(!f)return e;var h=function(_){return _.transitiveVars||(_.transitiveVars=new Set(_.variables),_.removed||_.fragmentSpreads.forEach(function(w){h(n(w)).transitiveVars.forEach(function(y){_.transitiveVars.add(y)})})),_},g=new Set;p.definitions.forEach(function(_){_.kind===Fe.OPERATION_DEFINITION?h(r(_.name&&_.name.value)).fragmentSpreads.forEach(function(w){g.add(w)}):_.kind===Fe.FRAGMENT_DEFINITION&&a===0&&!n(_.name.value).removed&&g.add(_.name.value)}),g.forEach(function(_){h(n(_)).fragmentSpreads.forEach(function(w){g.add(w)})});var v=function(_){return!!(!g.has(_)||n(_).removed)},b={enter:function(_){if(v(_.name.value))return null}};return cg(it(p,{FragmentSpread:b,FragmentDefinition:b,OperationDefinition:{leave:function(_){if(_.variableDefinitions){var w=h(r(_.name&&_.name.value)).transitiveVars;if(w.size<_.variableDefinitions.length)return C(C({},_),{variableDefinitions:_.variableDefinitions.filter(function(y){return w.has(y.variable.name.value)})})}}}}))}var kn=Object.assign(function(t){return it(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind===Fe.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return Et(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(Et(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return C(C({},e),{selections:Pr(Pr([],i,!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],gi(t))}function su(t){var e=xn(t),r=e.operation;if(r==="query")return t;var n=it(t,{OperationDefinition:{enter:function(i){return C(C({},i),{operation:"query"})}}});return n}function cu(t){gi(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 ha(t)}function ha(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new mt,i=1;i<r;++i)e=n.merge(e,t[i]);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=ue,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return ue(r)&&ue(e)?(Object.keys(r).forEach(function(o){if(pg.call(e,o)){var s=e[o];if(r[o]!==s){var u=n.reconciler.apply(n,Pr([e,r,o],i,!1));u!==s&&(e=n.shallowCopyForMerge(e),e[o]=u)}}else e=n.shallowCopyForMerge(e),e[o]=r[o]}),e):r},t.prototype.shallowCopyForMerge=function(e){return ue(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 n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}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,n=new Array(e);r<e;r++)n[r]=t[r];return n}function hf(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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 ma(t){var e=t.constructor;return e!==void 0&&(e=e[mf],e===null&&(e=void 0)),e!==void 0?e:ie}function gg(t){return t instanceof ie}function vi(t){vi.log?vi.log(t):setTimeout(function(){throw t})}function jo(t){Promise.resolve().then(function(){try{t()}catch(e){vi(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(n){vi(n)}}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 n=t._observer;try{var i=qo(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(fu(t),i)i.call(n,r);else throw r;break;case"complete":fu(t),i&&i.call(n);break}}catch(a){vi(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,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new bg(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.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(n){lu(this._subscription,"next",n)},e.error=function(n){lu(this._subscription,"error",n)},e.complete=function(){lu(this._subscription,"complete")},du(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),ie=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(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new vg(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,o){if(typeof n!="function"){o(new TypeError(n+" is not a function"));return}function s(){u.unsubscribe(),a()}var u=i.subscribe({next:function(c){try{n(c,s)}catch(l){o(l),u.unsubscribe()}},error:o,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ma(this);return new a(function(o){return i.subscribe({next:function(s){try{s=n(s)}catch(u){return o.error(u)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ma(this);return new a(function(o){return i.subscribe({next:function(s){try{if(!n(s))return}catch(u){return o.error(u)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ma(this),o=arguments.length>1,s=!1,u=arguments[1],c=u;return new a(function(l){return i.subscribe({next:function(f){var d=!s;if(s=!0,!d||o)try{c=n(c,f)}catch(p){return l.error(p)}else c=f},error:function(f){l.error(f)},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 n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=ma(this);return new s(function(u){var c,l=0;function f(d){c=d.subscribe({next:function(p){u.next(p)},error:function(p){u.error(p)},complete:function(){l===a.length?(c=void 0,u.complete()):f(s.from(a[l++]))}})}return f(n),function(){c&&(c.unsubscribe(),c=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=ma(this);return new a(function(o){var s=[],u=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(d){return o.error(d)}var f=a.from(l).subscribe({next:function(d){o.next(d)},error:function(d){o.error(d)},complete:function(){var d=s.indexOf(f);d>=0&&s.splice(d,1),c()}});s.push(f)},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(n){var i=typeof this=="function"?this:t;if(n==null)throw new TypeError(n+" is not an object");var a=qo(n,pu);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return gg(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(mu("iterator")&&(a=qo(n,mg),a))return new i(function(s){jo(function(){if(!s.closed){for(var u=dg(a.call(n)),c;!(c=u()).done;){var l=c.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(n))return new i(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()}})});throw new TypeError(n+" is not observable")},t.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[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<i.length;++u)if(s.next(i[u]),s.closed)return;s.complete()}})})},du(t,null,[{key:mf,get:function(){return this}}]),t}();hu()&&Object.defineProperty(ie,Symbol("extensions"),{value:{symbol:pu,hostReportError:vi},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 bi;typeof self<"u"?bi=self:typeof window<"u"?bi=window:typeof global<"u"?bi=global:typeof module<"u"?bi=module:bi=Function("return this")();var E4=yu(bi);var vf=ie.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(i,a){r[a]=vu(i,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var n=Object.create(Object.getPrototypeOf(t));return e.set(t,n),Object.keys(t).forEach(function(i){n[i]=vu(t[i],e)}),n}default:return t}}function wg(t){var e=new Set([t]);return e.forEach(function(r){ue(r)&&Sg(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){ue(r[n])&&e.add(r[n])})}),t}function Sg(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function ga(t){return __DEV__&&wg(t),t}function In(t,e,r){var n=[];t.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](r)})}function Vo(t,e,r){return new ie(function(n){var i=n.next,a=n.error,o=n.complete,s=0,u=!1,c={then:function(p){return new Promise(function(h){return h(p())})}};function l(p,h){return p?function(g){++s;var v=function(){return p(g)};c=c.then(v,v).then(function(b){--s,i&&i.call(n,b),u&&f.complete()},function(b){throw--s,b}).catch(function(b){a&&a.call(n,b)})}:function(g){return h&&h.call(n,g)}}var f={next:l(e,i),error:l(r,a),complete:function(){u=!0,s||o&&o.call(n)}},d=t.subscribe(f);return function(){return d.unsubscribe()}})}var Pt=typeof WeakMap=="function"&&He(function(){return navigator.product})!=="ReactNative",_f=typeof WeakSet=="function",bu=typeof Symbol=="function"&&typeof Symbol.for=="function",Fr=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:ie})}return bu&&Symbol.species&&e(Symbol.species),e("@@species"),t}function wf(t){return t&&typeof t.then=="function"}var _i=function(t){Ne(e,t);function e(r){var n=t.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),In(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),In(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,o=i.sources,s=o===void 0?[]:o;if(a!==null){var u=s.shift();u?wf(u)?u.then(function(c){return n.sub=c.subscribe(n.handlers)}):n.sub=u.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),In(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof r=="function"&&(r=[new ie(r)]),wf(r)?r.then(function(i){return n.start(i)},n.handlers.error):n.start(r),n}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 n=this.latest[0],i=r[n];i&&i.call(r,this.latest[1]),this.sub===null&&n==="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,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(r,n)}))},e.prototype.beforeNext=function(r){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,r(i,a))})},e}(ie);Qo(_i);function Mr(t){return"incremental"in t}function Cg(t){return"hasNext"in t&&"data"in t}function Sf(t){return Mr(t)||Cg(t)}function zo(t,e){var r=t,n=new mt;return Mr(e)&&qe(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,o=i.path,s=o.length-1;s>=0;--s){var u=o[s],c=!isNaN(+u),l=c?[]:{};l[u]=a,a=l}r=n.merge(r,a)}),r}function wi(t){var e=Wo(t);return qe(e)}function Wo(t){var e=qe(t.errors)?t.errors.slice(0):[];return Mr(t)&&qe(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function Ur(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach(function(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(r[i]=a)})}),r}var Cf=new Map;function ya(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=ya("stringifyForDisplay");return JSON.stringify(t,function(r,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function va(t,e){return Ur(t,e,e.variables&&{variables:C(C({},t&&t.variables),e.variables)})}function Ho(t){return new ie(function(e){e.error(t)})}var ba=function(t,e,r){var n=new Error(r);throw n.name="ServerError",n.response=t,n.statusCode=t.status,n.result=e,n};function _u(t){for(var e=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(e.indexOf(i)<0)throw __DEV__?new H("illegal argument: ".concat(i)):new H(27)}return t}function wu(t,e){var r=C({},t),n=function(a){typeof a=="function"?r=C(C({},r),a(r)):r=C(C({},r),a)},i=function(){return C({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function Su(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?yi(e.query)||void 0:""),e}function xf(t,e){return e?e(t):ie.of()}function _a(t){return typeof t=="function"?new $t(t):t}function Go(t){return t.request.length<=1}var Eg=function(t){Ne(e,t);function e(r,n){var i=t.call(this,r)||this;return i.link=n,i}return e}(Error),$t=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return ie.of()})},t.from=function(e){return e.length===0?t.empty():e.map(_a).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var i=_a(r),a=_a(n||new t(xf));return Go(i)&&Go(a)?new t(function(o){return e(o)?i.request(o)||ie.of():a.request(o)||ie.of()}):new t(function(o,s){return e(o)?i.request(o,s)||ie.of():a.request(o,s)||ie.of()})},t.execute=function(e,r){return e.request(wu(r.context,Su(_u(r))))||ie.of()},t.concat=function(e,r){var n=_a(e);if(Go(n))return __DEV__&&$.warn(new Eg("You are calling concat on a terminating link, which will have no effect",n)),n;var i=_a(r);return Go(i)?new t(function(a){return n.request(a,function(o){return i.request(o)||ie.of()})||ie.of()}):new t(function(a,o){return n.request(a,function(s){return i.request(s,o)||ie.of()})||ie.of()})},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(xf)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new H("request is not implemented"):new H(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 Si=$t.execute;var Af="3.7.10";function kf(t){return!!t.body}function If(t){return!!t.getReader}function Tf(t){return!!(Fr&&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,n=!1,i=[],a=[];function o(f){if(!r){if(a.length){var d=a.shift();if(Array.isArray(d)&&d[0])return d[0]({value:f,done:!1})}i.push(f)}}function s(f){r=f;var d=a.slice();d.forEach(function(p){p[1](f)}),!e||e()}function u(){n=!0;var f=a.slice();f.forEach(function(d){d[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(f,d){if(r)return d(r);if(i.length)return f({value:i.shift(),done:!1});if(n)return f({value:void 0,done:!0});a.push([f,d])})}var l={next:function(){return c()}};return Fr&&(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(n,i){t.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return Fr&&(r[Symbol.asyncIterator]=function(){return this}),r}function Ko(t){var e={next:function(){return t.read()}};return Fr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Rf(t){var e=t;if(kf(t)&&(e=t.body),Tf(e))return Cu(e);if(If(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,n,i;return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l,f,d,p,h,g,v,b,_,w,y,O,D,A,N;return Vt(this,function(L){switch(L.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(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="",f=Rf(t),d=!0,L.label=1;case 1:return d?[4,f.next()]:[3,3];case 2:for(p=L.sent(),h=p.value,g=p.done,v=typeof h=="string"?h:a.decode(h),d=!g,l+=v,b=l.indexOf(c);b>-1;){if(_=void 0,N=[l.slice(0,b),l.slice(b+c.length)],_=N[0],l=N[1],_.trim()){if(w=_.indexOf(`\r
27
27
  \r
28
- `),y=bg(_.slice(0,S)),O=y["content-type"],O&&O.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");D=_.slice(S);try{A=If(t,D.replace(`\r
29
- `,"")),(Object.keys(A).length>1||"data"in A||"incremental"in A||"errors"in A)&&((n=e.next)===null||n===void 0||n.call(e,A))}catch(P){Qo(P,e)}}b=l.indexOf(c)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function bg(t){var e={};return t.split(`
30
- `).forEach(function(r){var n=r.indexOf(":");if(n>-1){var i=r.slice(0,n).trim().toLowerCase(),a=r.slice(n+1).trim();e[i]=a}}),e}function If(t,e){if(t.status>=300){var r=function(){try{return JSON.parse(e)}catch{return e}};ya(t,r(),"Response not successful: Received status code ".concat(t.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=t,n.statusCode=t.status,n.bodyText=e,n}}function Qo(t,e){var r,n;t.name!=="AbortError"&&(t.result&&t.result.errors&&t.result.data&&((r=e.next)===null||r===void 0||r.call(e,t.result)),(n=e.error)===null||n===void 0||n.call(e,t))}function Tf(t,e,r){_g(e)(t).then(function(n){var i,a;(i=r.next)===null||i===void 0||i.call(r,n),(a=r.complete)===null||a===void 0||a.call(r)}).catch(function(n){return Qo(n,r)})}function _g(t){return function(e){return e.text().then(function(r){return If(e,r)}).then(function(r){return e.status>=300&&ya(e,r,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(r)&&!Af.call(r,"data")&&!Af.call(r,"errors")&&ya(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(n){return n.operationName}):t.operationName,"'.")),r})}}var ba=function(t,e){var r;try{r=JSON.stringify(t)}catch(i){var n=__DEV__?new W("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new W(24);throw n.parseError=i,n}return r};var Sg={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},wg={accept:"*/*","content-type":"application/json"},Cg={method:"POST"},Of={http:Sg,headers:wg,options:Cg},Df=function(t,e){return e(t)};function Nf(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},a={};r.forEach(function(d){i=w(w(w({},i),d.options),{headers:w(w({},i.headers),d.headers)}),d.credentials&&(i.credentials=d.credentials),a=w(w({},a),d.http)}),i.headers&&(i.headers=Eg(i.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,pi)),{options:i,body:l}}function Eg(t,e){if(!e){var r=Object.create(null);return Object.keys(Object(t)).forEach(function(a){r[a.toLowerCase()]=t[a]}),r}var n=Object.create(null);Object.keys(Object(t)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:t[a]}});var i=Object.create(null);return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var Pf=function(t){if(!t&&typeof fetch>"u")throw __DEV__?new W(`
28
+ `),y=xg(_.slice(0,w)),O=y["content-type"],O&&O.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");D=_.slice(w);try{A=Lf(t,D.replace(`\r
29
+ `,"")),(Object.keys(A).length>1||"data"in A||"incremental"in A||"errors"in A)&&((n=e.next)===null||n===void 0||n.call(e,A))}catch(P){Zo(P,e)}}b=l.indexOf(c)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function xg(t){var e={};return t.split(`
30
+ `).forEach(function(r){var n=r.indexOf(":");if(n>-1){var i=r.slice(0,n).trim().toLowerCase(),a=r.slice(n+1).trim();e[i]=a}}),e}function Lf(t,e){if(t.status>=300){var r=function(){try{return JSON.parse(e)}catch{return e}};ba(t,r(),"Response not successful: Received status code ".concat(t.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=t,n.statusCode=t.status,n.bodyText=e,n}}function Zo(t,e){var r,n;t.name!=="AbortError"&&(t.result&&t.result.errors&&t.result.data&&((r=e.next)===null||r===void 0||r.call(e,t.result)),(n=e.error)===null||n===void 0||n.call(e,t))}function Ff(t,e,r){Ag(e)(t).then(function(n){var i,a;(i=r.next)===null||i===void 0||i.call(r,n),(a=r.complete)===null||a===void 0||a.call(r)}).catch(function(n){return Zo(n,r)})}function Ag(t){return function(e){return e.text().then(function(r){return Lf(e,r)}).then(function(r){return e.status>=300&&ba(e,r,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(r)&&!Pf.call(r,"data")&&!Pf.call(r,"errors")&&ba(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(n){return n.operationName}):t.operationName,"'.")),r})}}var wa=function(t,e){var r;try{r=JSON.stringify(t)}catch(i){var n=__DEV__?new H("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new H(24);throw n.parseError=i,n}return r};var kg={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Ig={accept:"*/*","content-type":"application/json"},Tg={method:"POST"},Mf={http:kg,headers:Ig,options:Tg},Uf=function(t,e){return e(t)};function jf(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},a={};r.forEach(function(f){i=C(C(C({},i),f.options),{headers:C(C({},i.headers),f.headers)}),f.credentials&&(i.credentials=f.credentials),a=C(C({},a),f.http)}),i.headers&&(i.headers=Og(i.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,hi)),{options:i,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 n=Object.create(null);Object.keys(Object(t)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:t[a]}});var i=Object.create(null);return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var qf=function(t){if(!t&&typeof fetch>"u")throw __DEV__?new H(`
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,7 +35,7 @@ import { ApolloClient, HttpLink } from '@apollo/client';
35
35
  const client = new ApolloClient({
36
36
  link: new HttpLink({ uri: '/graphql', fetch })
37
37
  });
38
- `):new W(23)};var Rf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var t=new AbortController,e=t.signal;return{controller:t,signal:e}};var $f=function(t,e){var r=t.getContext(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function Lf(t,e){var r=[],n=function(d,f){r.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=ba(e.variables,"Variables map")}catch(d){return{parseError:d}}n("variables",i)}if(e.extensions){var a=void 0;try{a=ba(e.extensions,"Extensions map")}catch(d){return{parseError:d}}n("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 Ff=We(function(){return fetch}),Mf=function(t){t===void 0&&(t={});var e=t.uri,r=e===void 0?"/graphql":e,n=t.fetch,i=t.print,a=i===void 0?Df:i,o=t.includeExtensions,s=t.preserveHeaderCase,u=t.useGETForQueries,c=t.includeUnusedVariables,l=c===void 0?!1:c,d=Jt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&Pf(n||Ff);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Rt(function(p){var h=$f(p,r),m=p.getContext(),v={};if(m.clientAwareness){var b=m.clientAwareness,_=b.name,S=b.version;_&&(v["apollographql-client-name"]=_),S&&(v["apollographql-client-version"]=S)}var y=w(w({},v),m.headers),O={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:y},D=Nf(p,a,Of,f,O),A=D.options,N=D.body;if(N.variables&&!l){var L=new Set(Object.keys(N.variables));nt(p.query,{Variable:function(ae,Kt,Y){Y&&Y.kind!=="VariableDefinition"&&L.delete(ae.name.value)}}),L.size&&(N.variables=w({},N.variables),L.forEach(function(ae){delete N.variables[ae]}))}var P;if(!A.signal){var j=Rf(),Ze=j.controller,Me=j.signal;P=Ze,P&&(A.signal=Me)}var Q=function(ae){return ae.kind==="OperationDefinition"&&ae.operation==="mutation"};if(u&&!p.query.definitions.some(Q)&&(A.method="GET"),fi(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var _e=Lf(h,N),Se=_e.newURI,ie=_e.parseError;if(ie)return qo(ie);h=Se}else try{A.body=ba(N,"Payload")}catch(ae){return qo(ae)}return new X(function(ae){var Kt=n||We(function(){return fetch})||Ff;return Kt(h,A).then(function(Y){var Zt;p.setContext({response:Y});var Or=(Zt=Y.headers)===null||Zt===void 0?void 0:Zt.get("content-type");return Or!==null&&/^multipart\/mixed/i.test(Or)?kf(Y,ae):Tf(Y,p,ae)}).catch(function(Y){return Qo(Y,ae)}),function(){P&&P.abort()}})})};var wu=function(t){De(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,Mf(r).request)||this;return n.options=r,n}return e}(Rt);var{toString:jf,hasOwnProperty:xg}=Object.prototype,Uf=Function.prototype.toString,Cu=new Map;function xe(t,e){try{return Eu(t,e)}finally{Cu.clear()}}function Eu(t,e){if(t===e)return!0;let r=jf.call(t),n=jf.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(Bf(t,e))return!0;let i=qf(t),a=qf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!xg.call(e,i[s]))return!1;for(let s=0;s<o;++s){let u=i[s];if(!Eu(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(Bf(t,e))return!0;let i=t.entries(),a=r==="[object Map]";for(;;){let o=i.next();if(o.done)break;let[s,u]=o.value;if(!e.has(s)||a&&!Eu(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 i=t.byteLength;if(i===e.byteLength)for(;i--&&t[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let i=Uf.call(t);return i!==Uf.call(e)?!1:!Ig(i,kg)}}return!1}function qf(t){return Object.keys(t).filter(Ag,t)}function Ag(t){return this[t]!==void 0}var kg="{ [native code] }";function Ig(t,e){let r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function Bf(t,e){let r=Cu.get(t);if(r){if(r.has(e))return!0}else Cu.set(t,r=new Set);return r.add(e),!1}var Tg=function(){return Object.create(null)},Vf=Array.prototype,Og=Vf.forEach,Dg=Vf.slice,er=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=Tg),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 Og.call(e,function(n){return r=r.getChildTrie(n)}),r.data||(r.data=this.makeData(Dg.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&Ng(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=r.get(e);return n||r.set(e,n=new t(this.weakness,this.makeData)),n},t}();function Ng(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var Xe=null,Qf={},Pg=1,Rg=()=>class{constructor(){this.id=["slot",Pg++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Xe;e;e=e.parent)if(this.id in e.slots){let r=e.slots[this.id];if(r===Qf)break;return e!==Xe&&(Xe.slots[this.id]=r),!0}return Xe&&(Xe.slots[this.id]=Qf),!1}getValue(){if(this.hasValue())return Xe.slots[this.id]}withValue(e,r,n,i){let a={__proto__:null,[this.id]:e},o=Xe;Xe={parent:o,slots:a};try{return r.apply(i,n)}finally{Xe=o}}static bind(e){let r=Xe;return function(){let n=Xe;try{return Xe=r,e.apply(this,arguments)}finally{Xe=n}}}static noContext(e,r,n){if(Xe){let i=Xe;try{return Xe=null,e.apply(n,r)}finally{Xe=i}}else return e.apply(n,r)}};function zf(t){try{return t()}catch{}}var xu="@wry/context:Slot",$g=zf(()=>globalThis)||zf(()=>global)||Object.create(null),Wf=$g,_i=Wf[xu]||Array[xu]||function(t){try{Object.defineProperty(Wf,xu,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(Rg());var{bind:Lg,noContext:Fg}=_i;function Mg(){}var jg=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=Mg),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 n=r.older,i=r.newer;i&&(i.older=n),n&&(n.newer=i),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=i)}return r},t.prototype.set=function(e,r){var n=this.getNode(e);return n?n.value=r:(n={key:e,value:r,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.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}(),Wo=new _i,Au,Ug=Object.prototype.hasOwnProperty,Iu=(Au=Array.from,Au===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:Au);function zo(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var _a=[],qg=100;function Si(t,e){if(!t)throw new Error(e||"assertion failure")}function Bg(t,e){var r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function Gf(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function Vg(t){return t.slice(0)}var Qg=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&&!Ur(this))return Hf(this),this.value[0]},t.prototype.recompute=function(e){return Si(!this.recomputing,"already recomputing"),Hf(this),Ur(this)?zg(this,e):Gf(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,Kf(this),zo(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),ed(this),Tu(this,function(r,n){r.setDirty(),td(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=_a.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Iu(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),_a.push(this.deps),this.deps=null)},t.count=0,t}();function Hf(t){var e=Wo.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),Ur(t)?Jf(e,t):Yf(e,t),e}function zg(t,e){return ed(t),Wo.withValue(t,Wg,[t,e]),Gg(t,e)&&Hg(t),Gf(t.value)}function Wg(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 Ur(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function Hg(t){t.dirty=!1,!Ur(t)&&Zf(t)}function Kf(t){Tu(t,Jf)}function Zf(t){Tu(t,Yf)}function Tu(t,e){var r=t.parents.size;if(r)for(var n=Iu(t.parents),i=0;i<r;++i)e(n[i],t)}function Jf(t,e){Si(t.childValues.has(e)),Si(Ur(e));var r=!Ur(t);if(!t.dirtyChildren)t.dirtyChildren=_a.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&Kf(t)}function Yf(t,e){Si(t.childValues.has(e)),Si(!Ur(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,Vg(e.value)):Bg(r,e.value)||t.setDirty(),Xf(t,e),!Ur(t)&&Zf(t)}function Xf(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(_a.length<qg&&_a.push(r),t.dirtyChildren=null))}function ed(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){td(t,r)}),t.forgetDeps(),Si(t.dirtyChildren===null)}function td(t,e){e.parents.delete(t),t.childValues.delete(e),Xf(t,e)}function Gg(t,e){if(typeof t.subscribe=="function")try{zo(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var Kg={setDirty:!0,dispose:!0,forget:!0};function Ho(t){var e=new Map,r=t&&t.subscribe;function n(i){var a=Wo.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof r=="function"&&(zo(o),o.unsubscribe=r(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var u=o&&Ug.call(Kg,o)?o:"setDirty";Iu(s).forEach(function(c){return c[u]()}),e.delete(a),zo(s)}},n}function rd(){var t=new er(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var d9=rd(),ku=new Set;function kn(t,e){e===void 0&&(e=Object.create(null));var r=new jg(e.max||Math.pow(2,16),function(c){return c.dispose()}),n=e.keyArgs,i=e.makeCacheKey||rd(),a=function(){var c=i.apply(null,n?n.apply(null,arguments):arguments);if(c===void 0)return t.apply(null,arguments);var l=r.get(c);l||(r.set(c,l=new Qg(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),ku.add(r),Wo.hasValue()||(ku.forEach(function(f){return f.clean()}),ku.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(i.apply(null,arguments))};function s(c){var l=r.get(c);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function u(c){return r.delete(c)}return a.forgetKey=u,a.forget=function(){return u(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var Ou=function(){function t(){this.getFragmentDoc=kn(Zc)}return t.prototype.batch=function(e){var r=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(r)},n),i},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(w(w({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(w(w({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:r}))},t.prototype.writeQuery=function(e){var r=e.id,n=e.data,i=Jt(e,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(e){var r=e.id,n=e.data,i=e.fragment,a=e.fragmentName,o=Jt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(i,a),dataId:r,result:n}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(n){var i=n.readQuery(e),a=r(i);return a==null?i:(n.writeQuery(w(w({},e),{data:a})),a)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(n){var i=n.readFragment(e),a=r(i);return a==null?i:(n.writeFragment(w(w({},e),{data:a})),a)}})},t}();var Sa=function(t){De(e,t);function e(r,n,i,a){var o,s=t.call(this,r)||this;if(s.message=r,s.path=n,s.query=i,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 Ne=Object.prototype.hasOwnProperty;function wa(t){return t==null}function Ko(t,e){var r=t.__typename,n=t.id,i=t._id;if(typeof r=="string"&&(e&&(e.keyObject=wa(n)?wa(i)?void 0:{_id:i}:{id:n}),wa(n)&&!wa(i)&&(n=i),!wa(n)))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var nd={dataIdFromObject:Ko,addTypename:!0,resultCaching:!0,canonizeResults:!1};function id(t){return jr(nd,t)}function Zo(t){var e=t.canonizeResults;return e===void 0?nd.canonizeResults:e}function ad(t,e){return te(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var Du=/^[_a-z][_0-9a-z]*/i;function zt(t){var e=t.match(Du);return e?e[0]:t}function Go(t,e,r){return oe(e)?me(e)?e.every(function(n){return Go(t,n,r)}):t.selections.every(function(n){if(Et(n)&&gr(n,r)){var i=Nt(n);return Ne.call(e,i)&&(!n.selectionSet||Go(n.selectionSet,e[i],r))}return!0}):!1}function qr(t){return oe(t)&&!te(t)&&!me(t)}function od(){return new ht}function Jo(t,e){var r=_n(wn(t));return{fragmentMap:r,lookupFragment:function(n){var i=r[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Yo=Object.create(null),Nu=function(){return Yo},sd=Object.create(null),wi=function(){function t(e,r){var n=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(i,a){return ha(te(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return te(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return Yt(i);if(te(i))return i;var o=n.policies.identify(i)[0];if(o){var s=Yt(o);return a&&n.merge(o,i),s}}}return t.prototype.toObject=function(){return w({},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),Ne.call(this.data,e)){var n=this.data[e];if(n&&Ne.call(n,r))return n[r]}if(r==="__typename"&&Ne.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Br)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Ne.call(this.data,e))return this.data[e];if(this instanceof Br)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var n=this,i;te(e)&&(e=e.__ref),te(r)&&(r=r.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof r=="string"?this.lookup(i=r):r;if(!!o){__DEV__?R(typeof i=="string","store.merge expects a string ID"):R(typeof i=="string",1);var s=new ht(Jg).merge(a,o);if(this.data[i]=s,s!==a&&(delete this.refs[i],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=zt(c);l!==c&&!n.policies.hasKeyArgs(s.__typename,l)&&(u[l]=1),s[c]===void 0&&!(n instanceof Br)&&delete s[c]}}),u.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===s.__typename&&delete u.__typename,Object.keys(u).forEach(function(c){return n.group.dirty(i,c)})}}},t.prototype.modify=function(e,r){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,u={DELETE:Yo,INVALIDATE:sd,isReference:te,toReference:this.toReference,canRead:this.canRead,readField:function(c,l){return n.policies.readField(typeof c=="string"?{fieldName:c,from:l||Yt(e)}:c,{store:n})}};if(Object.keys(i).forEach(function(c){var l=zt(c),d=i[c];if(d!==void 0){var f=typeof r=="function"?r:r[c]||r[l];if(f){var p=f===Nu?Yo:f(ha(d),w(w({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(e,c)}));p===sd?n.group.dirty(e,c):(p===Yo&&(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 Br?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,r,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=r&&n?this.policies.getStoreFieldName({typename:o,fieldName:r,args:n}):r;return this.modify(e,s?(i={},i[s]=Nu,i):Nu)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(Ne.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Br&&this!==r&&(n=this.parent.evict(e,r)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){Ne.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(r.__META={extraRootIds:n.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(a){e&&Ne.call(e,a)||r.delete(a)}),e){var n=e.__META,i=Jt(e,["__META"]);Object.keys(i).forEach(function(a){r.merge(a,i[a])}),n&&n.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 Br?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),n=this.toObject();r.forEach(function(o){Ne.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(r.add,r),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Br;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},t.prototype.findChildRefIds=function(e){if(!Ne.call(this.refs,e)){var r=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return r;var i=new Set([n]);i.forEach(function(a){te(a)&&(r[a.__ref]=!0),oe(a)&&Object.keys(a).forEach(function(o){var s=a[o];oe(s)&&i.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var cd=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?Ho():null,this.keyMaker=new er(Pt)},t.prototype.depend=function(e,r){if(this.d){this.d(Pu(e,r));var n=zt(r);n!==r&&this.d(Pu(e,n)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Pu(e,r),r==="__exists"?"forget":"setDirty")},t}();function Pu(t,e){return e+"#"+t}function Ru(t,e){In(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){De(n,r);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,u=i.seed,c=r.call(this,a,new cd(s))||this;return c.stump=new Zg(c),c.storageTrie=new er(Pt),u&&c.replace(u),c}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(t);t.Root=e})(wi||(wi={}));var Br=function(t){De(e,t);function e(r,n,i,a){var o=t.call(this,n.policies,a)||this;return o.id=r,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(r,n){return new e(r,this,n,this.group)},e.prototype.removeLayer=function(r){var n=this,i=this.parent.removeLayer(r);return r===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=n.data[a],s=i.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(u){xe(o[u],s[u])||n.group.dirty(a,u)}):(n.group.dirty(a,"__exists"),Object.keys(s).forEach(function(u){n.group.dirty(a,u)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return w(w({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return Ne.call(this.data,r)?w(w({},n),t.prototype.findChildRefIds.call(this,r)):n},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(wi),Zg=function(t){De(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new cd(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}(Br);function Jg(t,e,r){var n=t[r],i=e[r];return xe(n,i)?n:i}function In(t){return!!(t instanceof wi&&t.group.caching)}function Yg(t){return oe(t)?me(t)?t.slice(0):w({__proto__:Object.getPrototypeOf(t)},t):t}var Xo=function(){function t(){this.known=new(ff?WeakSet:Set),this.pool=new er(Pt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return oe(e)&&this.known.has(e)},t.prototype.pass=function(e){if(oe(e)){var r=Yg(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(oe(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){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),n=this.pool.lookupArray(r);if(!n.keys){r.sort();var i=JSON.stringify(r);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:r,json:i})}return n.keys},t}();var xt=Object.assign(function(t){if(oe(t)){$u===void 0&&ud();var e=$u.admit(t),r=Lu.get(e);return r===void 0&&Lu.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:ud}),$u,Lu;function ud(){$u=new Xo,Lu=new(Pt?WeakMap:Map)}function ld(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var pd=function(){function t(e){var r=this;this.knownResults=new(Pt?WeakMap:Map),this.config=jr(e,{addTypename:e.addTypename!==!1,canonizeResults:Zo(e)}),this.canon=e.canon||new Xo,this.executeSelectionSet=kn(function(n){var i,a=n.context.canonizeResults,o=ld(n);o[3]=!a;var s=(i=r.executeSelectionSet).peek.apply(i,o);return s?a?w(w({},s),{result:r.canon.admit(s.result)}):s:(Ru(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:ld,makeCacheKey:function(n,i,a,o){if(In(a.store))return a.store.makeCacheKey(n,te(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=kn(function(n){return Ru(n.context.store,n.enclosingRef.__ref),r.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(In(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new Xo},t.prototype.diffQueryAgainstStore=function(e){var r=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,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=w(w({},En(pa(n))),o);var f=Yt(a),p=this.executeSelectionSet({selectionSet:Cn(n).selectionSet,objectOrReference:f,enclosingRef:f,context:w({store:r,query:n,policies:d,variables:o,varString:xt(o),canonizeResults:l},Jo(n,this.config.fragments))}),h;if(p.missing&&(h=[new Sa(Xg(p.missing),p.missing,n,o)],!u))throw h[0];return{result:p.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,n,i){if(In(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,r,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,o=e.context;if(te(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,u=o.policies,c=o.store,l=c.getFieldValue(i,"__typename"),d=[],f,p=new ht;this.config.addTypename&&typeof l=="string"&&!u.rootIdsByTypename[l]&&d.push({__typename:l});function h(S,y){var O;return S.missing&&(f=p.merge(f,(O={},O[y]=S.missing,O))),S.result}var m=new Set(n.selections);m.forEach(function(S){var y,O;if(!!gr(S,s))if(Et(S)){var D=u.readField({fieldName:S.name.value,field:S,variables:o.variables,from:i},o),A=Nt(S);D===void 0?xn.added(S)||(f=p.merge(f,(y={},y[A]="Can't find field '".concat(S.name.value,"' on ").concat(te(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),y))):me(D)?D=h(r.executeSubSelectedArray({field:S,array:D,enclosingRef:a,context:o}),A):S.selectionSet?D!=null&&(D=h(r.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:D,enclosingRef:te(D)?D:a,context:o}),A)):o.canonizeResults&&(D=r.canon.pass(D)),D!==void 0&&d.push((O={},O[A]=D,O))}else{var N=Sn(S,o.lookupFragment);if(!N&&S.kind===Le.FRAGMENT_SPREAD)throw __DEV__?new W("No fragment named ".concat(S.name.value)):new W(5);N&&u.fragmentMatches(N,l)&&N.selectionSet.selections.forEach(m.add,m)}});var v=fa(d),b={result:v,missing:f},_=o.canonizeResults?this.canon.admit(b):ha(b);return _.result&&this.knownResults.set(_.result,n),_},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,u=new ht;function c(l,d){var f;return l.missing&&(s=u.merge(s,(f={},f[d]=l.missing,f))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,d){return l===null?null:me(l)?c(r.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?c(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:te(l)?l:a,context:o}),d):(__DEV__&&ey(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},t}();function Xg(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function ey(t,e,r){if(!e.selectionSet){var n=new Set([r]);n.forEach(function(i){oe(i)&&(__DEV__?R(!te(i),"Missing selection set for object of type ".concat(ad(t,i)," returned for query field ").concat(e.name.value)):R(!te(i),6),Object.values(i).forEach(n.add,n))})}}var Ci=new _i,fd=new WeakMap;function Ca(t){var e=fd.get(t);return e||fd.set(t,e={vars:new Set,dep:Ho()}),e}function Fu(t){Ca(t).vars.forEach(function(e){return e.forgetCache(t)})}function dd(t){Ca(t).vars.forEach(function(e){return e.attachCache(t)})}function es(t){var e=new Set,r=new Set,n=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(u){Ca(u).dep.dirty(n),ty(u)});var o=Array.from(r);r.clear(),o.forEach(function(u){return u(t)})}}else{var s=Ci.getValue();s&&(i(s),Ca(s).dep(n))}return t};n.onNextChange=function(a){return r.add(a),function(){r.delete(a)}};var i=n.attachCache=function(a){return e.add(a),Ca(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function ty(t){t.broadcastWatches&&t.broadcastWatches()}var hd=Object.create(null);function Mu(t){var e=JSON.stringify(t);return hd[e]||(hd[e]=Object.create(null))}function ju(t){var e=Mu(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=qu(t,function(o){var s=Ei(n.storeObject,o,i);return s===void 0&&r!==n.storeObject&&Ne.call(r,o[0])&&(s=Ei(r,o,gd)),__DEV__?R(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(r))):R(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Uu(t){var e=Mu(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var i=n.field,a=n.variables,o=n.fieldName,s=qu(t,function(c){var l=c[0],d=l.charAt(0);if(d==="@"){if(i&&je(i.directives)){var f=l.slice(1),p=i.directives.find(function(b){return b.name.value===f}),h=p&&yr(p,a);return h&&Ei(h,c.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&Ne.call(a,m)){var v=c.slice(0);return v[0]=m,Ei(a,v)}return}if(r)return Ei(r,c)}),u=JSON.stringify(s);return(r||u!=="{}")&&(o+=":"+u),o})}function qu(t,e){var r=new ht;return md(t).reduce(function(n,i){var a,o=e(i);if(o!==void 0){for(var s=i.length-1;s>=0;--s)o=(a={},a[i[s]]=o,a);n=r.merge(n,o)}return n},Object.create(null))}function md(t){var e=Mu(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(i,a){me(i)?(md(i).forEach(function(o){return r.push(n.concat(o))}),n.length=0):(n.push(i),me(t[a+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function gd(t,e){return t[e]}function Ei(t,e,r){return r=r||gd,yd(e.reduce(function n(i,a){return me(i)?i.map(function(o){return n(o,a)}):i&&r(i,a)},t))}function yd(t){return oe(t)?me(t)?t.map(yd):qu(Object.keys(t).sort(),function(e){return Ei(t,e)}):t}ua.setStringify(xt);function Bu(t){return t.args!==void 0?t.args:t.field?yr(t.field,t.variables):null}var ry=function(){},vd=function(t,e){return e.fieldName},bd=function(t,e,r){var n=r.mergeObjects;return n(t,e)},_d=function(t,e){return e},wd=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=w({dataIdFromObject:Ko},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 n,i=this,a=r&&(r.typename||((n=r.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=r&&r.storeObject||e,s=w(w({},r),{typename:a,storeObject:o,readField:r&&r.readField||function(){var f=ts(arguments,o);return i.readField(f,{store:i.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(me(d))l=ju(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(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,u=Jt(i,["queryType","mutationType","subscriptionType"]);a&&r.setRootTypename("Query",n),o&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),Ne.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]})},t.prototype.updateTypePolicy=function(e,r){var n=this,i=this.getTypePolicy(e),a=r.keyFields,o=r.fields;function s(u,c){u.merge=typeof c=="function"?c:c===!0?bd:c===!1?_d:u.merge}s(i,r.merge),i.keyFn=a===!1?ry:me(a)?ju(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(u){var c=n.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?vd:me(d)?Uu(d):typeof d=="function"?d:c.keyFn,typeof f=="function"&&(c.read=f),s(c,p)}c.read&&c.merge&&(c.keyFn=c.keyFn||vd)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(__DEV__?R(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):R(!i||i===e,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){r.getSupertypeSet(n,!0),e[n].forEach(function(i){r.getSupertypeSet(i,!0).add(n);var a=i.match(Du);(!a||a[0]!==i)&&r.fuzzySubtypes.set(i,new RegExp(i))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!Ne.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach(function(o){var s=r.getTypePolicy(o),u=s.fields,c=Jt(s,["fields"]);Object.assign(n,c),Object.assign(n.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,n){if(e){var i=this.getTypePolicy(e).fields;return i[r]||n&&(i[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var n=this.supertypeMap.get(e);return!n&&r&&this.supertypeMap.set(e,n=new Set),n},t.prototype.fragmentMatches=function(e,r,n,i){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=!!(n&&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__&&R.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;p.forEach(c),l&&f===u.length-1&&Go(e.selectionSet,n,i)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var v=r.match(h);v&&v[0]===r&&c(m)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var n=this.getFieldPolicy(e,r,!1);return!!(n&&n.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),a,o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},u=Bu(e);o;){var c=o(u,s);if(me(c))o=Uu(c);else{a=c||n;break}}return a===void 0&&(a=e.field?Yc(e.field,e.variables):ua(n,Bu(e))),a===!1?n:n===zt(a)?a:n+":"+a},t.prototype.readField=function(e,r){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=r.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=zt(o),u=r.store.getFieldValue(n,o),c=this.getFieldPolicy(e.typename,s,!1),l=c&&c.read;if(l){var d=Sd(this,n,e,r,r.store.getStorage(te(n)?n.__ref:n,o));return Ci.withValue(this.cache,l,[u,d])}return u}}},t.prototype.getReadFunction=function(e,r){var n=this.getFieldPolicy(e,r,!1);return n&&n.read},t.prototype.getMergeFunction=function(e,r,n){var i=this.getFieldPolicy(e,r,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},t.prototype.runMergeFunction=function(e,r,n,i,a){var o=n.field,s=n.typename,u=n.merge;return u===bd?Cd(i.store)(e,r):u===_d?r:(i.overwrite&&(e=void 0),u(e,r,Sd(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},t}();function Sd(t,e,r,n,i){var a=t.getStoreFieldName(r),o=zt(a),s=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:Bu(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:te,toReference:c,storage:i,cache:t.cache,canRead:l,readField:function(){return t.readField(ts(arguments,e,s),n)},mergeObjects:Cd(n.store)}}function ts(t,e,r){var n=t[0],i=t[1],a=t.length,o;return typeof n=="string"?o={fieldName:n,from:a>1?i:e}:(o=w({},n),Ne.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&R.warn("Undefined 'from' passed to readField with arguments ".concat(gf(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function Cd(t){return function(r,n){if(me(r)||me(n))throw __DEV__?new W("Cannot automatically merge arrays"):new W(4);if(oe(r)&&oe(n)){var i=t.getFieldValue(r,"__typename"),a=t.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(te(r)&&qr(n))return t.merge(r.__ref,n),r;if(qr(r)&&te(n))return t.merge(r,n.__ref),n;if(qr(r)&&qr(n))return w(w({},r),n)}return n}}function Vu(t,e,r){var n="".concat(e).concat(r),i=t.flavors.get(n);return i||t.flavors.set(n,i=t.clientOnly===e&&t.deferred===r?t:w(w({},t),{clientOnly:e,deferred:r})),i}var kd=function(){function t(e,r,n){this.cache=e,this.reader=r,this.fragments=n}return t.prototype.writeToStore=function(e,r){var n=this,i=r.query,a=r.result,o=r.dataId,s=r.variables,u=r.overwrite,c=Xt(i),l=od();s=w(w({},En(c)),s);var d=w(w({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:xt(s)},Jo(i,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(!te(f))throw __DEV__?new W("Could not identify object ".concat(JSON.stringify(a))):new W(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,v=p.mergeTree,b=p.fieldNodeSet,_=Yt(h);if(v&&v.map.size){var S=n.applyMerges(v,_,m,d);if(te(S))return;m=S}if(__DEV__&&!d.overwrite){var y=Object.create(null);b.forEach(function(A){A.selectionSet&&(y[A.name.value]=!0)});var O=function(A){return y[zt(A)]===!0},D=function(A){var N=v&&v.map.get(A);return Boolean(N&&N.info&&N.info.merge)};Object.keys(m).forEach(function(A){O(A)&&!D(A)&&ny(_,m,A,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},t.prototype.processSelectionSet=function(e){var r=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,u=this.cache.policies,c=Object.create(null),l=n&&u.rootTypenamesById[n]||la(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(c.__typename=l);var d=function(){var S=ts(arguments,c,o.variables);if(te(S.from)){var y=o.incomingById.get(S.from.__ref);if(y){var O=u.readField(w(w({},S),{from:y.storeObject}),o);if(O!==void 0)return O}}return u.readField(S,o)},f=new Set;this.flattenFields(a,i,o,l).forEach(function(S,y){var O,D=Nt(y),A=i[D];if(f.add(y),A!==void 0){var N=u.getStoreFieldName({typename:l,fieldName:y.name.value,field:y,variables:S.variables}),L=Ed(s,N),P=r.processFieldValue(A,y,y.selectionSet?Vu(S,!1,!1):S,L),j=void 0;y.selectionSet&&(te(P)||qr(P))&&(j=d("__typename",P));var Ze=u.getMergeFunction(l,y.name.value,j);Ze?L.info={field:y,typename:l,merge:Ze}:xd(s,N),c=S.merge(c,(O={},O[N]=P,O))}else __DEV__&&!S.clientOnly&&!S.deferred&&!xn.added(y)&&!u.getReadFunction(l,y.name.value)&&__DEV__&&R.error("Missing field '".concat(Nt(y),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var p=u.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:c,readField:d}),h=p[0],m=p[1];n=n||h,m&&(c=o.merge(c,m))}catch(S){if(!n)throw S}if(typeof n=="string"){var v=Yt(n),b=o.written[n]||(o.written[n]=[]);if(b.indexOf(a)>=0||(b.push(a),this.reader&&this.reader.isFresh(i,v,a,o)))return v;var _=o.incomingById.get(n);return _?(_.storeObject=o.merge(_.storeObject,c),_.mergeTree=Qu(_.mergeTree,s),f.forEach(function(S){return _.fieldNodeSet.add(S)})):o.incomingById.set(n,{storeObject:c,mergeTree:rs(s)?void 0:s,fieldNodeSet:f}),v}return c},t.prototype.processFieldValue=function(e,r,n,i){var a=this;return!r.selectionSet||e===null?__DEV__?Lo(e):e:me(e)?e.map(function(o,s){var u=a.processFieldValue(o,r,n,Ed(i,s));return xd(i,s),u}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:n,mergeTree:i})},t.prototype.flattenFields=function(e,r,n,i){i===void 0&&(i=la(r,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new er(!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(!!gr(f,n.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&je(f.directives)&&f.directives.forEach(function(b){var _=b.name.value;if(_==="client"&&(p=!0),_==="defer"){var S=yr(b,n.variables);(!S||S.if!==!1)&&(h=!0)}}),Et(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Vu(n,p,h))}else{var v=Sn(f,n.lookupFragment);if(!v&&f.kind===Le.FRAGMENT_SPREAD)throw __DEV__?new W("No fragment named ".concat(f.name.value)):new W(8);v&&o.fragmentMatches(v,i,r,n.variables)&&u(v.selectionSet,Vu(n,p,h))}}}))}(e,n),a},t.prototype.applyMerges=function(e,r,n,i,a){var o,s=this;if(e.map.size&&!te(n)){var u=!me(n)&&(te(r)||qr(r))?r:void 0,c=n;u&&!a&&(a=[te(u)?u.__ref:u]);var l,d=function(f,p){return me(f)?typeof p=="number"?f[p]:void 0:i.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 v=s.applyMerges(f,h,m,i,a);v!==m&&(l=l||new Map,l.set(p,v)),a&&R(a.pop()===p)}}),l&&(n=me(c)?c.slice(0):w({},c),l.forEach(function(f,p){n[p]=f}))}return e.info?this.cache.policies.runMergeFunction(r,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},t}();var Id=[];function Ed(t,e){var r=t.map;return r.has(e)||r.set(e,Id.pop()||{map:new Map}),r.get(e)}function Qu(t,e){if(t===e||!e||rs(e))return t;if(!t||rs(t))return e;var r=t.info&&e.info?w(w({},t.info),e.info):t.info||e.info,n=t.map.size&&e.map.size,i=n?new Map:t.map.size?t.map:e.map,a={info:r,map:i};if(n){var o=new Set(e.map.keys());t.map.forEach(function(s,u){a.map.set(u,Qu(s,e.map.get(u))),o.delete(u)}),o.forEach(function(s){a.map.set(s,Qu(e.map.get(s),t.map.get(s)))})}return a}function rs(t){return!t||!(t.info||t.map.size)}function xd(t,e){var r=t.map,n=r.get(e);n&&rs(n)&&(Id.push(n),r.delete(e))}var Ad=new Set;function ny(t,e,r,n){var i=function(d){var f=n.getFieldValue(d,r);return typeof f=="object"&&f},a=i(t);if(!!a){var o=i(e);if(!!o&&!te(a)&&!xe(a,o)&&!Object.keys(a).every(function(d){return n.getFieldValue(o,d)!==void 0})){var s=n.getFieldValue(t,"__typename")||n.getFieldValue(e,"__typename"),u=zt(r),c="".concat(s,".").concat(u);if(!Ad.has(c)){Ad.add(c);var l=[];!me(a)&&!me(o)&&[a,o].forEach(function(d){var f=n.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&R.warn("Cache data may be lost when replacing the ".concat(u," field of a ").concat(s,` object.
38
+ `):new H(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(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function Qf(t,e){var r=[],n=function(f,d){r.push("".concat(f,"=").concat(encodeURIComponent(d)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=wa(e.variables,"Variables map")}catch(f){return{parseError:f}}n("variables",i)}if(e.extensions){var a=void 0;try{a=wa(e.extensions,"Extensions map")}catch(f){return{parseError:f}}n("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,n=t.fetch,i=t.print,a=i===void 0?Uf:i,o=t.includeExtensions,s=t.preserveHeaderCase,u=t.useGETForQueries,c=t.includeUnusedVariables,l=c===void 0?!1:c,f=Yt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&qf(n||zf);var d={http:{includeExtensions:o,preserveHeaderCase:s},options:f.fetchOptions,credentials:f.credentials,headers:f.headers};return new $t(function(p){var h=Vf(p,r),g=p.getContext(),v={};if(g.clientAwareness){var b=g.clientAwareness,_=b.name,w=b.version;_&&(v["apollographql-client-name"]=_),w&&(v["apollographql-client-version"]=w)}var y=C(C({},v),g.headers),O={http:g.http,options:g.fetchOptions,credentials:g.credentials,headers:y},D=jf(p,a,Mf,d,O),A=D.options,N=D.body;if(N.variables&&!l){var L=new Set(Object.keys(N.variables));it(p.query,{Variable:function(ce,Zt,ne){ne&&ne.kind!=="VariableDefinition"&&L.delete(ce.name.value)}}),L.size&&(N.variables=C({},N.variables),L.forEach(function(ce){delete N.variables[ce]}))}var P;if(!A.signal){var j=Bf(),Je=j.controller,je=j.signal;P=Je,P&&(A.signal=je)}var z=function(ce){return ce.kind==="OperationDefinition"&&ce.operation==="mutation"};if(u&&!p.query.definitions.some(z)&&(A.method="GET"),mi(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var we=Qf(h,N),Se=we.newURI,se=we.parseError;if(se)return Ho(se);h=Se}else try{A.body=wa(N,"Payload")}catch(ce){return Ho(ce)}return new ie(function(ce){var Zt=n||He(function(){return fetch})||zf;return Zt(h,A).then(function(ne){var Jt;p.setContext({response:ne});var Or=(Jt=ne.headers)===null||Jt===void 0?void 0:Jt.get("content-type");return Or!==null&&/^multipart\/mixed/i.test(Or)?$f(ne,ce):Ff(ne,p,ce)}).catch(function(ne){return Zo(ne,ce)}),function(){P&&P.abort()}})})};var Au=function(t){Ne(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,Wf(r).request)||this;return n.options=r,n}return e}($t);var{toString:Hf,hasOwnProperty:Dg}=Object.prototype,Gf=Function.prototype.toString,ku=new Map;function Ae(t,e){try{return Iu(t,e)}finally{ku.clear()}}function Iu(t,e){if(t===e)return!0;let r=Hf.call(t),n=Hf.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(Zf(t,e))return!0;let i=Kf(t),a=Kf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Dg.call(e,i[s]))return!1;for(let s=0;s<o;++s){let u=i[s];if(!Iu(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 i=t.entries(),a=r==="[object Map]";for(;;){let o=i.next();if(o.done)break;let[s,u]=o.value;if(!e.has(s)||a&&!Iu(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 i=t.byteLength;if(i===e.byteLength)for(;i--&&t[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let i=Gf.call(t);return i!==Gf.call(e)?!1:!Pg(i,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(n){return r=r.getChildTrie(n)}),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),n=r.get(e);return n||r.set(e,n=new t(this.weakness,this.makeData)),n},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,n,i){let a={__proto__:null,[this.id]:e},o=et;et={parent:o,slots:a};try{return r.apply(i,n)}finally{et=o}}static bind(e){let r=et;return function(){let n=et;try{return et=r,e.apply(this,arguments)}finally{et=n}}}static noContext(e,r,n){if(et){let i=et;try{return et=null,e.apply(n,r)}finally{et=i}}else return e.apply(n,r)}};function Xf(t){try{return t()}catch{}}var Tu="@wry/context:Slot",qg=Xf(()=>globalThis)||Xf(()=>global)||Object.create(null),ed=qg,Ci=ed[Tu]||Array[Tu]||function(t){try{Object.defineProperty(ed,Tu,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(jg());var{bind:Bg,noContext:Vg}=Ci;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 n=r.older,i=r.newer;i&&(i.older=n),n&&(n.newer=i),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=i)}return r},t.prototype.set=function(e,r){var n=this.getNode(e);return n?n.value=r:(n={key:e,value:r,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.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 Ci,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 Sa=[],Hg=100;function Ei(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&&!jr(this))return td(this),this.value[0]},t.prototype.recompute=function(e){return Ei(!this.recomputing,"already recomputing"),td(this),jr(this)?Jg(this,e):rd(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,nd(this),Jo(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),cd(this),Ru(this,function(r,n){r.setDirty(),ud(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Sa.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(),Sa.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,[]),jr(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 jr(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function Xg(t){t.dirty=!1,!jr(t)&&id(t)}function nd(t){Ru(t,ad)}function id(t){Ru(t,od)}function Ru(t,e){var r=t.parents.size;if(r)for(var n=Nu(t.parents),i=0;i<r;++i)e(n[i],t)}function ad(t,e){Ei(t.childValues.has(e)),Ei(jr(e));var r=!jr(t);if(!t.dirtyChildren)t.dirtyChildren=Sa.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&nd(t)}function od(t,e){Ei(t.childValues.has(e)),Ei(!jr(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),!jr(t)&&id(t)}function sd(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(Sa.length<Hg&&Sa.push(r),t.dirtyChildren=null))}function cd(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){ud(t,r)}),t.forgetDeps(),Ei(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 n(i){var a=Yo.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof r=="function"&&(Jo(o),o.unsubscribe=r(i))}}return n.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)}},n}function ld(){var t=new tr(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var bw=ld(),Du=new Set;function Tn(t,e){e===void 0&&(e=Object.create(null));var r=new zg(e.max||Math.pow(2,16),function(c){return c.dispose()}),n=e.keyArgs,i=e.makeCacheKey||ld(),a=function(){var c=i.apply(null,n?n.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 f=l.recompute(Array.prototype.slice.call(arguments));return r.set(c,l),Du.add(r),Yo.hasValue()||(Du.forEach(function(d){return d.clean()}),Du.clear()),f};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(i.apply(null,arguments))};function s(c){var l=r.get(c);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function u(c){return r.delete(c)}return a.forgetKey=u,a.forget=function(){return u(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var Pu=function(){function t(){this.getFragmentDoc=Tn(eu)}return t.prototype.batch=function(e){var r=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(r)},n),i},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,n=e.data,i=Yt(e,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(e){var r=e.id,n=e.data,i=e.fragment,a=e.fragmentName,o=Yt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(i,a),dataId:r,result:n}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(n){var i=n.readQuery(e),a=r(i);return a==null?i:(n.writeQuery(C(C({},e),{data:a})),a)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(n){var i=n.readFragment(e),a=r(i);return a==null?i:(n.writeFragment(C(C({},e),{data:a})),a)}})},t}();var Ca=function(t){Ne(e,t);function e(r,n,i,a){var o,s=t.call(this,r)||this;if(s.message=r,s.path=n,s.query=i,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 Re=Object.prototype.hasOwnProperty;function Ea(t){return t==null}function ts(t,e){var r=t.__typename,n=t.id,i=t._id;if(typeof r=="string"&&(e&&(e.keyObject=Ea(n)?Ea(i)?void 0:{_id:i}:{id:n}),Ea(n)&&!Ea(i)&&(n=i),!Ea(n)))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var pd={dataIdFromObject:ts,addTypename:!0,resultCaching:!0,canonizeResults:!1};function fd(t){return Ur(pd,t)}function rs(t){var e=t.canonizeResults;return e===void 0?pd.canonizeResults:e}function dd(t,e){return ae(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 ue(e)?ve(e)?e.every(function(n){return es(t,n,r)}):t.selections.every(function(n){if(Et(n)&&gr(n,r)){var i=Rt(n);return Re.call(e,i)&&(!n.selectionSet||es(n.selectionSet,e[i],r))}return!0}):!1}function qr(t){return ue(t)&&!ae(t)&&!ve(t)}function hd(){return new mt}function ns(t,e){var r=Sn(En(t));return{fragmentMap:r,lookupFragment:function(n){var i=r[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var is=Object.create(null),Lu=function(){return is},md=Object.create(null),xi=function(){function t(e,r){var n=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(i,a){return ga(ae(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return ae(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return Xt(i);if(ae(i))return i;var o=n.policies.identify(i)[0];if(o){var s=Xt(o);return a&&n.merge(o,i),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),Re.call(this.data,e)){var n=this.data[e];if(n&&Re.call(n,r))return n[r]}if(r==="__typename"&&Re.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Br)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Re.call(this.data,e))return this.data[e];if(this instanceof Br)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var n=this,i;ae(e)&&(e=e.__ref),ae(r)&&(r=r.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof r=="string"?this.lookup(i=r):r;if(!!o){__DEV__?$(typeof i=="string","store.merge expects a string ID"):$(typeof i=="string",1);var s=new mt(ny).merge(a,o);if(this.data[i]=s,s!==a&&(delete this.refs[i],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&&!n.policies.hasKeyArgs(s.__typename,l)&&(u[l]=1),s[c]===void 0&&!(n instanceof Br)&&delete s[c]}}),u.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===s.__typename&&delete u.__typename,Object.keys(u).forEach(function(c){return n.group.dirty(i,c)})}}},t.prototype.modify=function(e,r){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,u={DELETE:is,INVALIDATE:md,isReference:ae,toReference:this.toReference,canRead:this.canRead,readField:function(c,l){return n.policies.readField(typeof c=="string"?{fieldName:c,from:l||Xt(e)}:c,{store:n})}};if(Object.keys(i).forEach(function(c){var l=Wt(c),f=i[c];if(f!==void 0){var d=typeof r=="function"?r:r[c]||r[l];if(d){var p=d===Lu?is:d(ga(f),C(C({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(e,c)}));p===md?n.group.dirty(e,c):(p===is&&(p=void 0),p!==f&&(a[c]=p,o=!0,f=p))}f!==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},t.prototype.delete=function(e,r,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=r&&n?this.policies.getStoreFieldName({typename:o,fieldName:r,args:n}):r;return this.modify(e,s?(i={},i[s]=Lu,i):Lu)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(Re.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Br&&this!==r&&(n=this.parent.evict(e,r)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){Re.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(r.__META={extraRootIds:n.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(a){e&&Re.call(e,a)||r.delete(a)}),e){var n=e.__META,i=Yt(e,["__META"]);Object.keys(i).forEach(function(a){r.merge(a,i[a])}),n&&n.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 Br?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),n=this.toObject();r.forEach(function(o){Re.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(r.add,r),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Br;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},t.prototype.findChildRefIds=function(e){if(!Re.call(this.refs,e)){var r=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return r;var i=new Set([n]);i.forEach(function(a){ae(a)&&(r[a.__ref]=!0),ue(a)&&Object.keys(a).forEach(function(o){var s=a[o];ue(s)&&i.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 n=Wt(r);n!==r&&this.d(Fu(e,n)),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){On(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){Ne(n,r);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,u=i.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 n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(t);t.Root=e})(xi||(xi={}));var Br=function(t){Ne(e,t);function e(r,n,i,a){var o=t.call(this,n.policies,a)||this;return o.id=r,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(r,n){return new e(r,this,n,this.group)},e.prototype.removeLayer=function(r){var n=this,i=this.parent.removeLayer(r);return r===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=n.data[a],s=i.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(u){Ae(o[u],s[u])||n.group.dirty(a,u)}):(n.group.dirty(a,"__exists"),Object.keys(s).forEach(function(u){n.group.dirty(a,u)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return C(C({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return Re.call(this.data,r)?C(C({},n),t.prototype.findChildRefIds.call(this,r)):n},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(xi),ry=function(t){Ne(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}(Br);function ny(t,e,r){var n=t[r],i=e[r];return Ae(n,i)?n:i}function On(t){return!!(t instanceof xi&&t.group.caching)}function iy(t){return ue(t)?ve(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 ue(e)&&this.known.has(e)},t.prototype.pass=function(e){if(ue(e)){var r=iy(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(ue(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){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 f=o.object=Object.create(s);this.known.add(f),c.sorted.forEach(function(p,h){f[p]=u[l+h]}),__DEV__&&Object.freeze(f)}return o.object}}}return e},t.prototype.sortedKeys=function(e){var r=Object.keys(e),n=this.pool.lookupArray(r);if(!n.keys){r.sort();var i=JSON.stringify(r);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:r,json:i})}return n.keys},t}();var xt=Object.assign(function(t){if(ue(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=Ur(e,{addTypename:e.addTypename!==!1,canonizeResults:rs(e)}),this.canon=e.canon||new as,this.executeSelectionSet=Tn(function(n){var i,a=n.context.canonizeResults,o=vd(n);o[3]=!a;var s=(i=r.executeSelectionSet).peek.apply(i,o);return s?a?C(C({},s),{result:r.canon.admit(s.result)}):s:(Mu(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:vd,makeCacheKey:function(n,i,a,o){if(On(a.store))return a.store.makeCacheKey(n,ae(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=Tn(function(n){return Mu(n.context.store,n.enclosingRef.__ref),r.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(On(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new as},t.prototype.diffQueryAgainstStore=function(e){var r=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,o=e.variables,s=e.returnPartialData,u=s===void 0?!0:s,c=e.canonizeResults,l=c===void 0?this.config.canonizeResults:c,f=this.config.cache.policies;o=C(C({},An(da(n))),o);var d=Xt(a),p=this.executeSelectionSet({selectionSet:xn(n).selectionSet,objectOrReference:d,enclosingRef:d,context:C({store:r,query:n,policies:f,variables:o,varString:xt(o),canonizeResults:l},ns(n,this.config.fragments))}),h;if(p.missing&&(h=[new Ca(ay(p.missing),p.missing,n,o)],!u))throw h[0];return{result:p.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,n,i){if(On(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,r,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,o=e.context;if(ae(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,u=o.policies,c=o.store,l=c.getFieldValue(i,"__typename"),f=[],d,p=new mt;this.config.addTypename&&typeof l=="string"&&!u.rootIdsByTypename[l]&&f.push({__typename:l});function h(w,y){var O;return w.missing&&(d=p.merge(d,(O={},O[y]=w.missing,O))),w.result}var g=new Set(n.selections);g.forEach(function(w){var y,O;if(!!gr(w,s))if(Et(w)){var D=u.readField({fieldName:w.name.value,field:w,variables:o.variables,from:i},o),A=Rt(w);D===void 0?kn.added(w)||(d=p.merge(d,(y={},y[A]="Can't find field '".concat(w.name.value,"' on ").concat(ae(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),y))):ve(D)?D=h(r.executeSubSelectedArray({field:w,array:D,enclosingRef:a,context:o}),A):w.selectionSet?D!=null&&(D=h(r.executeSelectionSet({selectionSet:w.selectionSet,objectOrReference:D,enclosingRef:ae(D)?D:a,context:o}),A)):o.canonizeResults&&(D=r.canon.pass(D)),D!==void 0&&f.push((O={},O[A]=D,O))}else{var N=Cn(w,o.lookupFragment);if(!N&&w.kind===Fe.FRAGMENT_SPREAD)throw __DEV__?new H("No fragment named ".concat(w.name.value)):new H(5);N&&u.fragmentMatches(N,l)&&N.selectionSet.selections.forEach(g.add,g)}});var v=ha(f),b={result:v,missing:d},_=o.canonizeResults?this.canon.admit(b):ga(b);return _.result&&this.knownResults.set(_.result,n),_},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,u=new mt;function c(l,f){var d;return l.missing&&(s=u.merge(s,(d={},d[f]=l.missing,d))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,f){return l===null?null:ve(l)?c(r.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),f):n.selectionSet?c(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:ae(l)?l:a,context:o}),f):(__DEV__&&oy(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,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 n=new Set([r]);n.forEach(function(i){ue(i)&&(__DEV__?$(!ae(i),"Missing selection set for object of type ".concat(dd(t,i)," returned for query field ").concat(e.name.value)):$(!ae(i),6),Object.values(i).forEach(n.add,n))})}}var Ai=new Ci,_d=new WeakMap;function xa(t){var e=_d.get(t);return e||_d.set(t,e={vars:new Set,dep:Xo()}),e}function qu(t){xa(t).vars.forEach(function(e){return e.forgetCache(t)})}function wd(t){xa(t).vars.forEach(function(e){return e.attachCache(t)})}function os(t){var e=new Set,r=new Set,n=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(u){xa(u).dep.dirty(n),sy(u)});var o=Array.from(r);r.clear(),o.forEach(function(u){return u(t)})}}else{var s=Ai.getValue();s&&(i(s),xa(s).dep(n))}return t};n.onNextChange=function(a){return r.add(a),function(){r.delete(a)}};var i=n.attachCache=function(a){return e.add(a),xa(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function sy(t){t.broadcastWatches&&t.broadcastWatches()}var Sd=Object.create(null);function Bu(t){var e=JSON.stringify(t);return Sd[e]||(Sd[e]=Object.create(null))}function Vu(t){var e=Bu(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=zu(t,function(o){var s=ki(n.storeObject,o,i);return s===void 0&&r!==n.storeObject&&Re.call(r,o[0])&&(s=ki(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(n.typename,":").concat(JSON.stringify(a))})}function Qu(t){var e=Bu(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var i=n.field,a=n.variables,o=n.fieldName,s=zu(t,function(c){var l=c[0],f=l.charAt(0);if(f==="@"){if(i&&qe(i.directives)){var d=l.slice(1),p=i.directives.find(function(b){return b.name.value===d}),h=p&&yr(p,a);return h&&ki(h,c.slice(1))}return}if(f==="$"){var g=l.slice(1);if(a&&Re.call(a,g)){var v=c.slice(0);return v[0]=g,ki(a,v)}return}if(r)return ki(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(n,i){var a,o=e(i);if(o!==void 0){for(var s=i.length-1;s>=0;--s)o=(a={},a[i[s]]=o,a);n=r.merge(n,o)}return n},Object.create(null))}function Cd(t){var e=Bu(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(i,a){ve(i)?(Cd(i).forEach(function(o){return r.push(n.concat(o))}),n.length=0):(n.push(i),ve(t[a+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function Ed(t,e){return t[e]}function ki(t,e,r){return r=r||Ed,xd(e.reduce(function n(i,a){return ve(i)?i.map(function(o){return n(o,a)}):i&&r(i,a)},t))}function xd(t){return ue(t)?ve(t)?t.map(xd):zu(Object.keys(t).sort(),function(e){return ki(t,e)}):t}pa.setStringify(xt);function Wu(t){return t.args!==void 0?t.args:t.field?yr(t.field,t.variables):null}var cy=function(){},Ad=function(t,e){return e.fieldName},kd=function(t,e,r){var n=r.mergeObjects;return n(t,e)},Id=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 n,i=this,a=r&&(r.typename||((n=r.storeObject)===null||n===void 0?void 0:n.__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 d=ss(arguments,o);return i.readField(d,{store:i.cache.data,variables:d.variables})}}),u,c=a&&this.getTypePolicy(a),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var f=l(e,s);if(ve(f))l=Vu(f);else{u=f;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(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,u=Yt(i,["queryType","mutationType","subscriptionType"]);a&&r.setRootTypename("Query",n),o&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),Re.call(r.toBeAdded,n)?r.toBeAdded[n].push(u):r.toBeAdded[n]=[u]})},t.prototype.updateTypePolicy=function(e,r){var n=this,i=this.getTypePolicy(e),a=r.keyFields,o=r.fields;function s(u,c){u.merge=typeof c=="function"?c:c===!0?kd:c===!1?Id:u.merge}s(i,r.merge),i.keyFn=a===!1?cy:ve(a)?Vu(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(u){var c=n.getFieldPolicy(e,u,!0),l=o[u];if(typeof l=="function")c.read=l;else{var f=l.keyArgs,d=l.read,p=l.merge;c.keyFn=f===!1?Ad:ve(f)?Qu(f):typeof f=="function"?f:c.keyFn,typeof d=="function"&&(c.read=d),s(c,p)}c.read&&c.merge&&(c.keyFn=c.keyFn||Ad)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(__DEV__?$(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):$(!i||i===e,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){r.getSupertypeSet(n,!0),e[n].forEach(function(i){r.getSupertypeSet(i,!0).add(n);var a=i.match($u);(!a||a[0]!==i)&&r.fuzzySubtypes.set(i,new RegExp(i))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!Re.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach(function(o){var s=r.getTypePolicy(o),u=s.fields,c=Yt(s,["fields"]);Object.assign(n,c),Object.assign(n.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,n){if(e){var i=this.getTypePolicy(e).fields;return i[r]||n&&(i[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var n=this.supertypeMap.get(e);return!n&&r&&this.supertypeMap.set(e,n=new Set),n},t.prototype.fragmentMatches=function(e,r,n,i){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 g=a.getSupertypeSet(h,!1);g&&g.size&&u.indexOf(g)<0&&u.push(g)},l=!!(n&&this.fuzzySubtypes.size),f=!1,d=0;d<u.length;++d){var p=u[d];if(p.has(o))return s.has(o)||(f&&__DEV__&&$.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;p.forEach(c),l&&d===u.length-1&&es(e.selectionSet,n,i)&&(l=!1,f=!0,this.fuzzySubtypes.forEach(function(h,g){var v=r.match(h);v&&v[0]===r&&c(g)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var n=this.getFieldPolicy(e,r,!1);return!!(n&&n.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),a,o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},u=Wu(e);o;){var c=o(u,s);if(ve(c))o=Qu(c);else{a=c||n;break}}return a===void 0&&(a=e.field?ru(e.field,e.variables):pa(n,Wu(e))),a===!1?n:n===Wt(a)?a:n+":"+a},t.prototype.readField=function(e,r){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=r.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Wt(o),u=r.store.getFieldValue(n,o),c=this.getFieldPolicy(e.typename,s,!1),l=c&&c.read;if(l){var f=Td(this,n,e,r,r.store.getStorage(ae(n)?n.__ref:n,o));return Ai.withValue(this.cache,l,[u,f])}return u}}},t.prototype.getReadFunction=function(e,r){var n=this.getFieldPolicy(e,r,!1);return n&&n.read},t.prototype.getMergeFunction=function(e,r,n){var i=this.getFieldPolicy(e,r,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},t.prototype.runMergeFunction=function(e,r,n,i,a){var o=n.field,s=n.typename,u=n.merge;return u===kd?Dd(i.store)(e,r):u===Id?r:(i.overwrite&&(e=void 0),u(e,r,Td(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},t}();function Td(t,e,r,n,i){var a=t.getStoreFieldName(r),o=Wt(a),s=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:Wu(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ae,toReference:c,storage:i,cache:t.cache,canRead:l,readField:function(){return t.readField(ss(arguments,e,s),n)},mergeObjects:Dd(n.store)}}function ss(t,e,r){var n=t[0],i=t[1],a=t.length,o;return typeof n=="string"?o={fieldName:n,from:a>1?i:e}:(o=C({},n),Re.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,n){if(ve(r)||ve(n))throw __DEV__?new H("Cannot automatically merge arrays"):new H(4);if(ue(r)&&ue(n)){var i=t.getFieldValue(r,"__typename"),a=t.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(ae(r)&&qr(n))return t.merge(r.__ref,n),r;if(qr(r)&&ae(n))return t.merge(r,n.__ref),n;if(qr(r)&&qr(n))return C(C({},r),n)}return n}}function Hu(t,e,r){var n="".concat(e).concat(r),i=t.flavors.get(n);return i||t.flavors.set(n,i=t.clientOnly===e&&t.deferred===r?t:C(C({},t),{clientOnly:e,deferred:r})),i}var $d=function(){function t(e,r,n){this.cache=e,this.reader=r,this.fragments=n}return t.prototype.writeToStore=function(e,r){var n=this,i=r.query,a=r.result,o=r.dataId,s=r.variables,u=r.overwrite,c=er(i),l=hd();s=C(C({},An(c)),s);var f=C(C({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:xt(s)},ns(i,this.fragments)),{overwrite:!!u,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:f});if(!ae(d))throw __DEV__?new H("Could not identify object ".concat(JSON.stringify(a))):new H(7);return f.incomingById.forEach(function(p,h){var g=p.storeObject,v=p.mergeTree,b=p.fieldNodeSet,_=Xt(h);if(v&&v.map.size){var w=n.applyMerges(v,_,g,f);if(ae(w))return;g=w}if(__DEV__&&!f.overwrite){var y=Object.create(null);b.forEach(function(A){A.selectionSet&&(y[A.name.value]=!0)});var O=function(A){return y[Wt(A)]===!0},D=function(A){var N=v&&v.map.get(A);return Boolean(N&&N.info&&N.info.merge)};Object.keys(g).forEach(function(A){O(A)&&!D(A)&&uy(_,g,A,f.store)})}e.merge(h,g)}),e.retain(d.__ref),d},t.prototype.processSelectionSet=function(e){var r=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,u=this.cache.policies,c=Object.create(null),l=n&&u.rootTypenamesById[n]||fa(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(c.__typename=l);var f=function(){var w=ss(arguments,c,o.variables);if(ae(w.from)){var y=o.incomingById.get(w.from.__ref);if(y){var O=u.readField(C(C({},w),{from:y.storeObject}),o);if(O!==void 0)return O}}return u.readField(w,o)},d=new Set;this.flattenFields(a,i,o,l).forEach(function(w,y){var O,D=Rt(y),A=i[D];if(d.add(y),A!==void 0){var N=u.getStoreFieldName({typename:l,fieldName:y.name.value,field:y,variables:w.variables}),L=Nd(s,N),P=r.processFieldValue(A,y,y.selectionSet?Hu(w,!1,!1):w,L),j=void 0;y.selectionSet&&(ae(P)||qr(P))&&(j=f("__typename",P));var Je=u.getMergeFunction(l,y.name.value,j);Je?L.info={field:y,typename:l,merge:Je}:Rd(s,N),c=w.merge(c,(O={},O[N]=P,O))}else __DEV__&&!w.clientOnly&&!w.deferred&&!kn.added(y)&&!u.getReadFunction(l,y.name.value)&&__DEV__&&$.error("Missing field '".concat(Rt(y),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var p=u.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:c,readField:f}),h=p[0],g=p[1];n=n||h,g&&(c=o.merge(c,g))}catch(w){if(!n)throw w}if(typeof n=="string"){var v=Xt(n),b=o.written[n]||(o.written[n]=[]);if(b.indexOf(a)>=0||(b.push(a),this.reader&&this.reader.isFresh(i,v,a,o)))return v;var _=o.incomingById.get(n);return _?(_.storeObject=o.merge(_.storeObject,c),_.mergeTree=Gu(_.mergeTree,s),d.forEach(function(w){return _.fieldNodeSet.add(w)})):o.incomingById.set(n,{storeObject:c,mergeTree:cs(s)?void 0:s,fieldNodeSet:d}),v}return c},t.prototype.processFieldValue=function(e,r,n,i){var a=this;return!r.selectionSet||e===null?__DEV__?Bo(e):e:ve(e)?e.map(function(o,s){var u=a.processFieldValue(o,r,n,Nd(i,s));return Rd(i,s),u}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:n,mergeTree:i})},t.prototype.flattenFields=function(e,r,n,i){i===void 0&&(i=fa(r,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new tr(!1);return function u(c,l){var f=s.lookup(c,l.clientOnly,l.deferred);f.visited||(f.visited=!0,c.selections.forEach(function(d){if(!!gr(d,n.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&qe(d.directives)&&d.directives.forEach(function(b){var _=b.name.value;if(_==="client"&&(p=!0),_==="defer"){var w=yr(b,n.variables);(!w||w.if!==!1)&&(h=!0)}}),Et(d)){var g=a.get(d);g&&(p=p&&g.clientOnly,h=h&&g.deferred),a.set(d,Hu(n,p,h))}else{var v=Cn(d,n.lookupFragment);if(!v&&d.kind===Fe.FRAGMENT_SPREAD)throw __DEV__?new H("No fragment named ".concat(d.name.value)):new H(8);v&&o.fragmentMatches(v,i,r,n.variables)&&u(v.selectionSet,Hu(n,p,h))}}}))}(e,n),a},t.prototype.applyMerges=function(e,r,n,i,a){var o,s=this;if(e.map.size&&!ae(n)){var u=!ve(n)&&(ae(r)||qr(r))?r:void 0,c=n;u&&!a&&(a=[ae(u)?u.__ref:u]);var l,f=function(d,p){return ve(d)?typeof p=="number"?d[p]:void 0:i.store.getFieldValue(d,String(p))};e.map.forEach(function(d,p){var h=f(u,p),g=f(c,p);if(g!==void 0){a&&a.push(p);var v=s.applyMerges(d,h,g,i,a);v!==g&&(l=l||new Map,l.set(p,v)),a&&$(a.pop()===p)}}),l&&(n=ve(c)?c.slice(0):C({},c),l.forEach(function(d,p){n[p]=d}))}return e.info?this.cache.policies.runMergeFunction(r,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},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,n=t.map.size&&e.map.size,i=n?new Map:t.map.size?t.map:e.map,a={info:r,map:i};if(n){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,n=r.get(e);n&&cs(n)&&(Ld.push(n),r.delete(e))}var Pd=new Set;function uy(t,e,r,n){var i=function(f){var d=n.getFieldValue(f,r);return typeof d=="object"&&d},a=i(t);if(!!a){var o=i(e);if(!!o&&!ae(a)&&!Ae(a,o)&&!Object.keys(a).every(function(f){return n.getFieldValue(o,f)!==void 0})){var s=n.getFieldValue(t,"__typename")||n.getFieldValue(e,"__typename"),u=Wt(r),c="".concat(s,".").concat(u);if(!Pd.has(c)){Pd.add(c);var l=[];!ve(a)&&!ve(o)&&[a,o].forEach(function(f){var d=n.getFieldValue(f,"__typename");typeof d=="string"&&!l.includes(d)&&l.push(d)}),__DEV__&&$.warn("Cache data may be lost when replacing the ".concat(u," field of a ").concat(s,` object.
39
39
 
40
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:
41
41
 
@@ -46,31 +46,32 @@ 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 ns=function(t){De(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=es,n.txCount=0,n.config=id(r),n.addTypename=!!n.config.addTypename,n.policies=new wd({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var r=this.data=new wi.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=r.stump,this.resetResultCache()},e.prototype.resetResultCache=function(r){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new kd(this,this.storeReader=new pd({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Zo(this.config),canon:r?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=kn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(In(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 n=r.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(w(w({},r),{store:r.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof Sa)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(Ne.call(r,"id")&&!r.id)return!1;var n=r.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(r.id||"ROOT_QUERY",r.fields)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(r){return this.storeReader.diffQueryAgainstStore(w(w({},r),{store:r.optimistic?this.optimisticData:this.data,rootId:r.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(r){var n=this;return this.watches.size||dd(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){n.watches.delete(r)&&!n.watches.size&&Fu(n),n.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){xt.reset();var n=this.optimisticData.gc();return r&&!this.txCount&&(r.resetResultCache?this.resetResultCache(r.resetResultIdentities):r.resetResultIdentities&&this.storeReader.resetCanon()),n},e.prototype.retain=function(r,n){return(n?this.optimisticData:this.data).retain(r)},e.prototype.release=function(r,n){return(n?this.optimisticData:this.data).release(r)},e.prototype.identify=function(r){if(te(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(n){__DEV__&&R.warn(n)}},e.prototype.evict=function(r){if(!r.id){if(Ne.call(r,"id"))return!1;r=w(w({},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 n=this;return this.init(),xt.reset(),r&&r.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Fu(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(r){var n=this.optimisticData.removeLayer(r);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(r){var n=this,i=r.update,a=r.optimistic,o=a===void 0?!0:a,s=r.removeOptimistic,u=r.onWatchUpdated,c,l=function(f){var p=n,h=p.data,m=p.optimisticData;++n.txCount,f&&(n.data=n.optimisticData=f);try{return c=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},d=new Set;return u&&!this.txCount&&this.broadcastWatches(w(w({},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(w(w({},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 n.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(r),c},e.prototype.performTransaction=function(r,n){return this.batch({update:r,optimistic:n||n!==null})},e.prototype.transformDocument=function(r){if(this.addTypename){var n=this.typenameDocumentCache.get(r);return n||(n=xn(r),this.typenameDocumentCache.set(r,n),this.typenameDocumentCache.set(n,n)),n}return r},e.prototype.transformForLink=function(r){var n=this.config.fragments;return n?n.transform(r):r},e.prototype.broadcastWatches=function(r){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,r)})},e.prototype.broadcastWatch=function(r,n){var i=r.lastDiff,a=this.diff(r);n&&(r.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,r,a,i)===!1)||(!i||!xe(i.result,a.result))&&r.callback(r.lastDiff=a,i)},e}(Ou);function Td(t){return t.hasOwnProperty("graphQLErrors")}var iy=function(t){var e="";if(je(t.graphQLErrors)||je(t.clientErrors)){var r=(t.graphQLErrors||[]).concat(t.clientErrors||[]);r.forEach(function(n){var i=n?n.message:"Error message not found.";e+="".concat(i,`
49
+ `))}}}}var Aa=function(t){Ne(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=os,n.txCount=0,n.config=fd(r),n.addTypename=!!n.config.addTypename,n.policies=new Od({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var r=this.data=new xi.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=r.stump,this.resetResultCache()},e.prototype.resetResultCache=function(r){var n=this,i=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:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=Tn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(On(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 n=r.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(C(C({},r),{store:r.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof Ca)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(Re.call(r,"id")&&!r.id)return!1;var n=r.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.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 n=this;return this.watches.size||wd(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){n.watches.delete(r)&&!n.watches.size&&qu(n),n.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){xt.reset();var n=this.optimisticData.gc();return r&&!this.txCount&&(r.resetResultCache?this.resetResultCache(r.resetResultIdentities):r.resetResultIdentities&&this.storeReader.resetCanon()),n},e.prototype.retain=function(r,n){return(n?this.optimisticData:this.data).retain(r)},e.prototype.release=function(r,n){return(n?this.optimisticData:this.data).release(r)},e.prototype.identify=function(r){if(ae(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(n){__DEV__&&$.warn(n)}},e.prototype.evict=function(r){if(!r.id){if(Re.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 n=this;return this.init(),xt.reset(),r&&r.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),qu(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(r){var n=this.optimisticData.removeLayer(r);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(r){var n=this,i=r.update,a=r.optimistic,o=a===void 0?!0:a,s=r.removeOptimistic,u=r.onWatchUpdated,c,l=function(d){var p=n,h=p.data,g=p.optimisticData;++n.txCount,d&&(n.data=n.optimisticData=d);try{return c=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=g}},f=new Set;return u&&!this.txCount&&this.broadcastWatches(C(C({},r),{onWatchUpdated:function(d){return f.add(d),!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&&f.size?(this.broadcastWatches(C(C({},r),{onWatchUpdated:function(d,p){var h=u.call(this,d,p);return h!==!1&&f.delete(d),h}})),f.size&&f.forEach(function(d){return n.maybeBroadcastWatch.dirty(d)})):this.broadcastWatches(r),c},e.prototype.performTransaction=function(r,n){return this.batch({update:r,optimistic:n||n!==null})},e.prototype.transformDocument=function(r){if(this.addTypename){var n=this.typenameDocumentCache.get(r);return n||(n=kn(r),this.typenameDocumentCache.set(r,n),this.typenameDocumentCache.set(n,n)),n}return r},e.prototype.transformForLink=function(r){var n=this.config.fragments;return n?n.transform(r):r},e.prototype.broadcastWatches=function(r){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,r)})},e.prototype.broadcastWatch=function(r,n){var i=r.lastDiff,a=this.diff(r);n&&(r.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,r,a,i)===!1)||(!i||!Ae(i.result,a.result))&&r.callback(r.lastDiff=a,i)},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(n){var i=n?n.message:"Error message not found.";e+="".concat(i,`
50
50
  `)})}return t.networkError&&(e+="".concat(t.networkError.message,`
51
- `)),e=e.replace(/\n$/,""),e},vr=function(t){De(e,t);function e(r){var n=r.graphQLErrors,i=r.clientErrors,a=r.networkError,o=r.errorMessage,s=r.extraInfo,u=t.call(this,o)||this;return u.name="ApolloError",u.graphQLErrors=n||[],u.clientErrors=i||[],u.networkError=a||null,u.message=o||iy(u),u.extraInfo=s,u.__proto__=e.prototype,u}return e}(Error);var pe;(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"})(pe||(pe={}));function Vr(t){return t?t<7:!1}var ay=Object.assign,oy=Object.hasOwnProperty,is=function(t){De(e,t);function e(r){var n=r.queryManager,i=r.queryInfo,a=r.options,o=t.call(this,function(v){try{var b=v._subscription._observer;b&&!b.error&&(b.error=sy)}catch{}var _=!o.observers.size;o.observers.add(v);var S=o.last;return S&&S.error?v.error&&v.error(S.error):S&&S.result&&v.next&&v.next(S.result),_&&o.reobserve().catch(function(){}),function(){o.observers.delete(v)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=i,o.queryManager=n,o.isTornDown=!1;var s=n.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=w(w({},a),{initialFetchPolicy:h,fetchPolicy:f}),o.queryId=i.queryId||n.generateQueryId();var m=Xt(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(n,i){var a={next:function(s){n(s),r.observers.delete(a),r.observers.size||r.queryManager.removeQuery(r.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=r.subscribe(a)})},e.prototype.getCurrentResult=function(r){r===void 0&&(r=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||pe.ready,a=w(w({},n),{loading:Vr(i),networkStatus:i}),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),xe(a.data,{})&&(a.data=void 0),u.complete?(delete a.partial,u.complete&&a.networkStatus===pe.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=pe.ready,a.loading=!1)):a.partial=!0,__DEV__&&!u.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Wu(u.missing)}return r&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(r,n){return!this.last||!xe(this.last.result,r)||n&&!xe(this.last.variables,n)},e.prototype.getLast=function(r,n){var i=this.last;if(i&&i[r]&&(!n||xe(i.variables,this.variables)))return i[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 n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",__DEV__&&r&&oy.call(r,"variables")){var o=pa(this.query),s=o.variableDefinitions;(!s||!s.some(function(u){return u.variable.name.value==="variables"}))&&__DEV__&&R.warn("Called refetch(".concat(JSON.stringify(r),") for query ").concat(((n=o.name)===null||n===void 0?void 0:n.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&&!xe(this.options.variables,r)&&(i.variables=this.options.variables=w(w({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(i,pe.refetch)},e.prototype.fetchMore=function(r){var n=this,i=w(w({},r.query?r:w(w(w(w({},this.options),{query:this.query}),r),{variables:w(w({},this.options.variables),r.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=pe.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var u=new Set;return this.queryManager.fetchQuery(a,i,pe.fetchMore).then(function(c){return n.queryManager.removeQuery(a),o.networkStatus===pe.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var d=r.updateQuery;d?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:c.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:c.data})},onWatchUpdated:function(l){u.add(l.query)}}),c}).finally(function(){u.has(n.query)||zu(n)})},e.prototype.subscribeToMore=function(r){var n=this,i=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(a){var o=r.updateQuery;o&&n.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__&&R.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(r){return this.reobserve(r)},e.prototype.setVariables=function(r){return xe(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},pe.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=r(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.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,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,o=n.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:r,options:n,observable:this,initialFetchPolicy:s}):r==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(r,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,r,n)},e.prototype.updatePolling=function(){var r=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){__DEV__?R(a,"Attempted to start a polling query without a polling interval."):R(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){r.pollingInfo&&(Vr(r.queryInfo.networkStatus)?u():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},pe.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,n){return n===void 0&&(n=this.variables),this.last=w(w({},this.last),{result:this.queryManager.assumeImmutableResults?r:Lo(r),variables:n}),je(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,n){var i=this;this.isTornDown=!1;var a=n===pe.refetch||n===pe.fetchMore||n===pe.poll,o=this.options.variables,s=this.options.fetchPolicy,u=jr(this.options,r||{}),c=a?u:ay(this.options,u);a||(this.updatePolling(),r&&r.variables&&!xe(r.variables,o)&&c.fetchPolicy!=="standby"&&c.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",c),n===void 0&&(n=pe.setVariables)));var l=c.variables&&w({},c.variables),d=this.fetch(c,n),f={next:function(p){i.reportResult(p,l)},error:function(p){i.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,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(r,n))&&((i||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,n),An(this.observers,"next",r))},e.prototype.reportError=function(r,n){var i=w(w({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:pe.error,loading:!1});this.updateLastResult(i,n),An(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}(X);Mo(is);function zu(t){var e=t.options,r=e.fetchPolicy,n=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):r}}):t.reobserve()}function sy(t){__DEV__&&R.error("Unhandled error",t.message,t.stack)}function Wu(t){__DEV__&&t&&__DEV__&&R.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var as=function(){function t(e){var r=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=r,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){r.resolvers=au(r.resolvers,n)}):this.resolvers=au(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,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return qt(this,void 0,void 0,function(){return Bt(this,function(u){return r?[2,this.resolveDocument(r,n.data,i,a,this.fragmentMatcher,s).then(function(c){return w(w({},n),{data:c.result})})]:[2,n]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return fi(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return iu(e)},t.prototype.prepareContext=function(e){var r=this.cache;return w(w({},e),{cache:r,getCacheKey:function(n){return r.identify(n)}})},t.prototype.addExportedVariables=function(e,r,n){return r===void 0&&(r={}),n===void 0&&(n={}),qt(this,void 0,void 0,function(){return Bt(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then(function(a){return w(w({},r),a.exportedVariables)})]:[2,w({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return nt(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(r=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),r))return bn}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:nu(e),variables:r,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,r,n,i,a,o){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),qt(this,void 0,void 0,function(){var s,u,c,l,d,f,p,h,m,v,b;return Bt(this,function(_){return s=Cn(e),u=wn(e),c=_n(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,v={fragmentMap:c,context:w(w({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},b=!1,[2,this.resolveSelectionSet(s.selectionSet,b,r,v).then(function(S){return{result:S,exportedVariables:v.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,n,i){return qt(this,void 0,void 0,function(){var a,o,s,u,c,l=this;return Bt(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,u=[n],c=function(f){return qt(l,void 0,void 0,function(){var p,h;return Bt(this,function(m){return!r&&!i.selectionsToResolve.has(f)?[2]:gr(f,s)?Et(f)?[2,this.resolveField(f,r,n,i).then(function(v){var b;typeof v<"u"&&u.push((b={},b[Nt(f)]=v,b))})]:(Xc(f)?p=f:(p=a[f.name.value],__DEV__?R(p,"No fragment named ".concat(f.name.value)):R(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(p.selectionSet,r,n,i).then(function(v){u.push(v)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(c)).then(function(){return fa(u)})]})})},t.prototype.resolveField=function(e,r,n,i){return qt(this,void 0,void 0,function(){var a,o,s,u,c,l,d,f,p,h=this;return Bt(this,function(m){return n?(a=i.variables,o=e.name.value,s=Nt(e),u=o!==s,c=n[s]||n[o],l=Promise.resolve(c),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[u?o:s],p&&(l=Promise.resolve(Ci.withValue(this.cache,p,[n,yr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(v){var b,_;if(v===void 0&&(v=c),e.directives&&e.directives.forEach(function(y){y.name.value==="export"&&y.arguments&&y.arguments.forEach(function(O){O.name.value==="as"&&O.value.kind==="StringValue"&&(i.exportedVariables[O.value.value]=v)})}),!e.selectionSet||v==null)return v;var S=(_=(b=e.directives)===null||b===void 0?void 0:b.some(function(y){return y.name.value==="client"}))!==null&&_!==void 0?_:!1;if(Array.isArray(v))return h.resolveSubSelectedArray(e,r||S,v,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,r||S,v,i)})]):[2,null]})})},t.prototype.resolveSubSelectedArray=function(e,r,n,i){var a=this;return Promise.all(n.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,r,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,r,o,i)}))},t.prototype.collectSelectionsToResolve=function(e,r){var n=function(o){return!Array.isArray(o)},i=this.selectionsToResolveCache;function a(o){if(!i.has(o)){var s=new Set;i.set(o,s),nt(o,{Directive:function(u,c,l,d,f){u.name.value==="client"&&f.forEach(function(p){n(p)&&sa(p)&&s.add(p)})},FragmentSpread:function(u,c,l,d,f){var p=r[u.name.value];__DEV__?R(p,"No fragment named ".concat(u.name.value)):R(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){n(m)&&sa(m)&&s.add(m)}),s.add(u),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},t}();var xi=new(Pt?WeakMap:Map);function Hu(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return xi.set(t,(xi.get(t)+1)%1e15),r.apply(this,arguments)})}function Od(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var os=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 n=this.cache=e.cache;xi.has(n)||(xi.set(n,0),Hu(n,"evict"),Hu(n,"modify"),Hu(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||pe.loading;return this.variables&&this.networkStatus!==pe.loading&&!xe(this.variables,e.variables)&&(r=pe.setVariables),xe(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(){Od(this),this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&xe(r,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var n=this.observableQuery;if(n&&n.options.fetchPolicy==="no-cache")return{complete:!1};var i=this.cache.diff(r);return this.updateLastDiff(i,r),i},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,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!xe(n&&n.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 n=r.getDiff();n.fromOptimisticTransaction?e.observe():zu(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;Od(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(Vr(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 n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=w(w({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return r.setDiff(a)}});(!this.lastWatch||!xe(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var n=this.lastWrite;return!(n&&n.dmCount===xi.get(this.cache)&&xe(r,n.variables)&&xe(e.data,n.result.data))},t.prototype.markResult=function(e,r,n,i){var a=this,o=new ht,s=je(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&je(e.incremental)){var u=jo(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,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(ss(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:r,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:xi.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(n.variables),f=l.diff(d);a.stopped||a.updateWatch(n.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=pe.ready},t.prototype.markError=function(e){return this.networkStatus=pe.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function ss(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",n=!vi(t);return!n&&r&&t.data&&(n=!0),n}var cy=Object.prototype.hasOwnProperty,Dd=function(){function t(e){var r=e.cache,n=e.link,i=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=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new as({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,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new W("QueryManager stopped while query was in flight"):new W(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,n,i=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,v=e.errorPolicy,b=v===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":v,_=e.keepRootFields,S=e.context;return qt(this,void 0,void 0,function(){var y,O,D,A,N,L;return Bt(this,function(P){switch(P.label){case 0:return __DEV__?R(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):R(i,15),__DEV__?R(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."):R(m==="network-only"||m==="no-cache",16),y=this.generateMutationId(),O=this.transform(i),D=O.document,A=O.hasClientExports,i=this.cache.transformForLink(D),a=this.getVariables(i,a),A?[4,this.localState.addExportedVariables(i,a,S)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return N=this.mutationStore&&(this.mutationStore[y]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:y,document:i,variables:a,fetchPolicy:m,errorPolicy:b,context:S,updateQueries:s,update:f,keepRootFields:_}),this.broadcastQueries(),L=this,[2,new Promise(function(j,Ze){return Fo(L.getObservableFromLink(i,w(w({},S),{optimisticResponse:o}),a,!1),function(Me){if(vi(Me)&&b==="none")throw new vr({graphQLErrors:Uo(Me)});N&&(N.loading=!1,N.error=null);var Q=w({},Me);return typeof c=="function"&&(c=c(Q)),b==="ignore"&&vi(Q)&&delete Q.errors,L.markMutationResult({mutationId:y,result:Q,document:i,variables:a,fetchPolicy:m,errorPolicy:b,context:S,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:c,removeOptimistic:o?y:void 0,onQueryUpdated:p,keepRootFields:_})}).subscribe({next:function(Me){L.broadcastQueries(),(!("hasNext"in Me)||Me.hasNext===!1)&&j(Me)},error:function(Me){N&&(N.loading=!1,N.error=Me),o&&L.cache.removeOptimistic(y),L.broadcastQueries(),Ze(Me instanceof vr?Me:new vr({networkError:Me}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var n=this;r===void 0&&(r=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&ss(i,e.errorPolicy)){if(Mr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Mr(i)&&je(i.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=jo(s.result,i)),typeof u<"u"&&(i.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||!cy.call(c,h))){var m=c[h],v=n.queries.get(f),b=v.document,_=v.variables,S=r.diff({query:b,variables:_,returnPartialData:!0,optimistic:!1}),y=S.result,O=S.complete;if(O&&y){var D=m(y,{mutationResult:i,queryName:b&&hi(b)||void 0,queryVariables:_});D&&a.push({result:D,dataId:"ROOT_QUERY",query:b,variables:_})}}})}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=!hf(i)||Mr(i)&&!i.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=w(w({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}p&&f(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,v){var b=v.fieldName,_=v.DELETE;return b==="__typename"?m:_}})},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 i})}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(e,r){var n=this,i=typeof e=="function"?e(r.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(w(w({},r),{result:{data:i}}),a)}catch(o){__DEV__&&R.error(o)}},r.mutationId)},t.prototype.fetchQuery=function(e,r,n){return this.fetchQueryObservable(e,r,n).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,n){e[n]={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 n=this.cache.transformDocument(e),i=ru(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:Kc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:En(Xt(n)),asQuery:w(w({},n),{definitions:n.definitions.map(function(c){return c.kind==="OperationDefinition"&&c.operation!=="query"?w(w({},c),{operation:"query"}):c})})},u=function(c){c&&!r.has(c)&&r.set(c,s)};u(e),u(n),u(a),u(o)}return r.get(e)},t.prototype.getVariables=function(e,r){return w(w({},this.transform(e).defaultVars),r)},t.prototype.watchQuery=function(e){e=w(w({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var r=new os(this),n=new is({queryManager:this,queryInfo:r,options:e});return this.queries.set(n.queryId,r),r.init({document:n.query,observableQuery:n,variables:n.variables}),n},t.prototype.query=function(e,r){var n=this;return r===void 0&&(r=this.generateQueryId()),__DEV__?R(e.query,"query option is required. You must specify your GraphQL document in the query option."):R(e.query,17),__DEV__?R(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):R(e.query.kind==="Document",18),__DEV__?R(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):R(!e.returnPartialData,19),__DEV__?R(!e.pollInterval,"pollInterval option only supported on watchQuery."):R(!e.pollInterval,20),this.fetchQuery(r,e).finally(function(){return n.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 W("Store reset while query was in flight (not completed in link chain)"):new W(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=pe.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 n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):Jc(o)?i.set(r.transform(o).document,!1):oe(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var u=o.observableQuery,c=o.document;if(u){if(e==="all"){n.set(s,u);return}var l=u.queryName,d=u.options.fetchPolicy;if(d==="standby"||e==="active"&&!u.hasObservers())return;(e==="active"||l&&i.has(l)||c&&i.has(c))&&(n.set(s,u),l&&i.set(l,!0),c&&i.set(c,!0))}}),a.size&&a.forEach(function(o){var s=ma("legacyOneTimeQuery"),u=r.getQuery(s).init({document:o.query,variables:o.variables}),c=new is({queryManager:r,queryInfo:u,options:w(w({},o),{fetchPolicy:"network-only"})});R(c.queryId===s),u.setObservableQuery(c),n.set(s,c)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&R.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},t.prototype.reFetchObservableQueries=function(e){var r=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),r.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,u=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var c=function(d){return r.getObservableFromLink(n,u,d).map(function(f){if(i!=="no-cache"&&(ss(f,a)&&r.cache.write({query:n,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),r.broadcastQueries()),vi(f))throw new vr({graphQLErrors:f.errors});return f})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,u).then(c);return new X(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,n,i){var a=this,o;i===void 0&&(i=(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:n,operationName:hi(u)||void 0,context:this.prepareContext(w(w({},r),{forceFetch:!i}))};if(r=f.context,i){var p=l.get(u)||new Map;l.set(u,p);var h=xt(n);if(s=p.get(h),!s){var m=new yi([bi(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(u)})}}else s=new yi([bi(d,f)])}else s=new yi([X.of({data:{}})]),r=this.prepareContext(r);var v=this.transform(e).clientQuery;return v&&(s=Fo(s,function(b){return a.localState.runResolvers({document:v,remoteResult:b,context:r,variables:n})})),s},t.prototype.getResultsFromLink=function(e,r,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Fo(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=Uo(o),u=s.length>0;if(i>=e.lastRequestId){if(u&&n.errorPolicy==="none")throw e.markError(new vr({graphQLErrors:s}));e.markResult(o,a,n,r),e.markReady()}var c={data:o.data,loading:!1,networkStatus:pe.ready};return u&&n.errorPolicy!=="ignore"&&(c.errors=s,c.networkStatus=pe.error),c},function(o){var s=Td(o)?o:new vr({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,n){var i=this;n===void 0&&(n=pe.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,v=m===void 0?!1:m,b=r.context,_=b===void 0?{}:b,S=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:v,context:_}),y=function(A){S.variables=A;var N=i.fetchQueryByPolicy(s,S,n);return S.fetchPolicy!=="standby"&&N.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),N},O=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){O(),setTimeout(function(){return D.cancel(A)})});var D=new yi(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(y):y(S.variables));return D.promise.then(O,O),D},t.prototype.refetchQueries=function(e){var r=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,u=s===void 0?o?ma("refetchQueries"):void 0:s,c=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(f,p){l.set(p,{oq:f,lastDiff:r.getQuery(p).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&u||!1,removeOptimistic:u,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof os&&f.watcher.observableQuery;if(m){if(c){l.delete(m.queryId);var v=c(m,p,h);return v===!0&&(v=m.refetch()),v!==!1&&d.set(m,v),v}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,v=f.diff,b;if(c){if(!v){var _=h.queryInfo;_.reset(),v=_.getDiff()}b=c(h,v,m)}(!c||b===!0)&&(b=h.refetch()),b!==!1&&d.set(h,b),p.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(p)}),u&&this.cache.removeOptimistic(u),d},t.prototype.fetchQueryByPolicy=function(e,r,n){var i=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:n});var h=function(){return e.getDiff(o)},m=function(y,O){O===void 0&&(O=e.networkStatus||pe.loading);var D=y.result;__DEV__&&!l&&!xe(D,{})&&Wu(y.missing);var A=function(N){return X.of(w({data:N,loading:Vr(O),networkStatus:O},y.complete?null:{partial:!0}))};return D&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:D},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(N){return A(N.data||void 0)}):c==="none"&&O===pe.refetch&&Array.isArray(y.missing)?A(void 0):A(D)},v=s==="no-cache"?0:n===pe.refetch&&u!=="merge"?1:2,b=function(){return i.getResultsFromLink(e,v,{variables:o,context:d,fetchPolicy:s,errorPolicy:c})},_=f&&typeof p=="number"&&p!==n&&Vr(n);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:l||_?[m(S),b()]:[b()]}case"cache-and-network":{var S=h();return S.complete||l||_?[m(S),b()]:[b()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return _?[m(h()),b()]:[b()];case"no-cache":return _?[m(e.getDiff()),b()]:[b()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new os(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return w(w({},r),{clientAwareness:this.clientAwareness})},t}();var Nd=!1;var Gu=function(){function t(e){var r=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=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,v=e.assumeImmutableResults,b=v===void 0?!1:v,_=e.resolvers,S=e.typeDefs,y=e.fragmentMatcher,O=e.name,D=e.version,A=e.link;if(A||(A=n?new wu({uri:n,credentials:i,headers:a}):Rt.empty()),!o)throw __DEV__?new W(`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 W(9);if(this.link=A,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,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),!Nd&&f&&__DEV__&&(Nd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var N=window.navigator,L=N&&N.userAgent,P=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&R.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=vf,this.localState=new as({cache:o,client:this,resolvers:_,fragmentMatcher:y}),this.queryManager=new Dd({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:u,clientAwareness:{name:O,version:D},localState:this.localState,assumeImmutableResults:b,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=ga(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=w(w({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(e){return this.defaultOptions.query&&(e=ga(this.defaultOptions.query,e)),__DEV__?R(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."):R(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=w(w({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=ga(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 bi(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(n){return n!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),n=[],i=[];r.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&R.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}();Vp(vn?"log":"silent");function st(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function br(t){return st(t)==="object"}function Pd(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function Ku(t,e){return t.length<124?t:e}var Rd="graphql-transport-ws";var mt;(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"})(mt||(mt={}));var Pe;(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"})(Pe||(Pe={}));function $d(t){if(!br(t))throw new Error(`Message is expected to be an object, but got ${st(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 ${st(t.type)}`);switch(t.type){case Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(t.payload!=null&&!br(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 Pe.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${st(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!br(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${st(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 ${st(t.payload.query)}`);if(t.payload.variables!=null&&!br(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 ${st(t.payload.variables)}`);if(t.payload.operationName!=null&&st(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 ${st(t.payload.operationName)}`);if(t.payload.extensions!=null&&!br(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 ${st(t.payload.extensions)}`);break}case Pe.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${st(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!br(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${st(t.payload)}`);break}case Pe.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${st(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Pd(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 Pe.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${st(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 Ld(t,e){return $d(typeof t=="string"?JSON.parse(t,e):t)}function Ai(t,e){return $d(t),JSON.stringify(t,e)}function Fd(t){let{url:e,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:u=0,retryAttempts:c=5,retryWait:l=async function(_e){let Se=1e3;for(let ie=0;ie<_e;ie++)Se*=2;await new Promise(ie=>setTimeout(ie,Se+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=cs,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,_e=>{let Se=Math.random()*16|0;return(_e=="x"?Se:Se&3|8).toString(16)})},jsonMessageReplacer:v,jsonMessageReviver:b}=t,_;if(h){if(!ly(h))throw new Error("Invalid WebSocket implementation provided");_=h}else typeof WebSocket<"u"?_=WebSocket:typeof global<"u"?_=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(_=window.WebSocket||window.MozWebSocket);if(!_)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=_,y=(()=>{let Q=(()=>{let Se={};return{on(ie,ae){return Se[ie]=ae,()=>{delete Se[ie]}},emit(ie){var ae;"id"in ie&&((ae=Se[ie.id])===null||ae===void 0||ae.call(Se,ie))}}})(),_e={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?[Q.emit,p.message]:[Q.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:Q.on,on(Se,ie){let ae=_e[Se];return ae.push(ie),()=>{ae.splice(ae.indexOf(ie),1)}},emit(Se,...ie){for(let ae of[..._e[Se]])ae(...ie)}}})();function O(Q){let _e=[y.on("error",Se=>{_e.forEach(ie=>ie()),Q(Se)}),y.on("closed",Se=>{_e.forEach(ie=>ie()),Q(Se)})]}let D,A=0,N,L=!1,P=0,j=!1;async function Ze(){clearTimeout(N);let[Q,_e]=await(D??(D=new Promise((ae,Kt)=>(async()=>{if(L){if(await l(P),!A)return D=void 0,Kt({code:1e3,reason:"All Subscriptions Gone"});P++}y.emit("connecting");let Y=new S(typeof e=="function"?await e():e,Rd),Zt,Or;function _o(){isFinite(o)&&o>0&&(clearTimeout(Or),Or=setTimeout(()=>{Y.readyState===S.OPEN&&(Y.send(Ai({type:Pe.Ping})),y.emit("ping",!1,void 0))},o))}O(Je=>{D=void 0,clearTimeout(Zt),clearTimeout(Or),Kt(Je),cs(Je)&&Je.code===4499&&(Y.close(4499,"Terminated"),Y.onerror=null,Y.onclose=null)}),Y.onerror=Je=>y.emit("error",Je),Y.onclose=Je=>y.emit("closed",Je),Y.onopen=async()=>{try{y.emit("opened",Y);let Je=typeof r=="function"?await r():r;if(Y.readyState!==S.OPEN)return;Y.send(Ai(Je?{type:Pe.ConnectionInit,payload:Je}:{type:Pe.ConnectionInit},v)),isFinite(u)&&u>0&&(Zt=setTimeout(()=>{Y.close(mt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},u)),_o()}catch(Je){y.emit("error",Je),Y.close(mt.InternalClientError,Ku(Je instanceof Error?Je.message:new Error(Je).message,"Internal client error"))}};let si=!1;Y.onmessage=({data:Je})=>{try{let Ye=Ld(Je,b);if(y.emit("message",Ye),Ye.type==="ping"||Ye.type==="pong"){y.emit(Ye.type,!0,Ye.payload),Ye.type==="pong"?_o():s||(Y.send(Ai(Ye.payload?{type:Pe.Pong,payload:Ye.payload}:{type:Pe.Pong})),y.emit("pong",!1,Ye.payload));return}if(si)return;if(Ye.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Ye.type}`);clearTimeout(Zt),si=!0,y.emit("connected",Y,Ye.payload),L=!1,P=0,ae([Y,new Promise((F3,am)=>O(am))])}catch(Ye){Y.onmessage=null,y.emit("error",Ye),Y.close(mt.BadResponse,Ku(Ye instanceof Error?Ye.message:new Error(Ye).message,"Bad response"))}}})())));Q.readyState===S.CLOSING&&await _e;let Se=()=>{},ie=new Promise(ae=>Se=ae);return[Q,Se,Promise.race([ie.then(()=>{if(!A){let ae=()=>Q.close(1e3,"Normal Closure");isFinite(a)&&a>0?N=setTimeout(()=>{Q.readyState===S.OPEN&&ae()},a):ae()}}),_e])]}function Me(Q){if(cs(Q)&&(uy(Q.code)||[mt.InternalServerError,mt.InternalClientError,mt.BadRequest,mt.BadResponse,mt.Unauthorized,mt.SubprotocolNotAcceptable,mt.SubscriberAlreadyExists,mt.TooManyInitialisationRequests].includes(Q.code)))throw Q;if(j)return!1;if(cs(Q)&&Q.code===1e3)return A>0;if(!c||P>=c||!d(Q)||f?.(Q))throw Q;return L=!0}return n||(async()=>{for(A++;;)try{let[,,Q]=await Ze();await Q}catch(Q){try{if(!Me(Q))return}catch(_e){return i?.(_e)}}})(),{on:y.on,subscribe(Q,_e){let Se=m(Q),ie=!1,ae=!1,Kt=()=>{A--,ie=!0};return(async()=>{for(A++;;)try{let[Y,Zt,Or]=await Ze();if(ie)return Zt();let _o=y.onMessage(Se,si=>{switch(si.type){case Pe.Next:{_e.next(si.payload);return}case Pe.Error:{ae=!0,ie=!0,_e.error(si.payload),Kt();return}case Pe.Complete:{ie=!0,Kt();return}}});Y.send(Ai({id:Se,type:Pe.Subscribe,payload:Q},v)),Kt=()=>{!ie&&Y.readyState===S.OPEN&&Y.send(Ai({id:Se,type:Pe.Complete},v)),A--,ie=!0,Zt()},await Or.finally(_o);return}catch(Y){if(!Me(Y))return}})().then(()=>{ae||_e.complete()}).catch(Y=>{_e.error(Y)}),()=>{ie||Kt()}},async dispose(){if(j=!0,D){let[Q]=await D;Q.close(1e3,"Normal Closure")}},terminate(){D&&y.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function cs(t){return br(t)&&"code"in t&&"reason"in t}function uy(t){return[1e3,1001,1006,1005,1012,1013,1013].includes(t)?!1:t>=1e3&&t<=1999}function ly(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function py(t){return oe(t)&&"code"in t&&"reason"in t}var Md=function(t){De(e,t);function e(r){var n=t.call(this)||this;return n.client=r,n}return e.prototype.request=function(r){var n=this;return new X(function(i){return n.client.subscribe(w(w({},r),{query:pi(r.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):py(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new vr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Rt);var Us=function(){return Us=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},Us.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function ws(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ws=function(r){return typeof r}:ws=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},ws(t)}function fy(t){return ws(t)=="object"&&t!==null}var n1=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function gl(t,e){for(var r=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=r.exec(t.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function dy(t){return i1(t.source,gl(t.source,t.start))}function i1(t,e){var r=t.locationOffset.column-1,n=Cs(r)+t.body,i=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=n.split(/\r\n|[\n\r]/g),d=l[i];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+jd([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(v){return["",v]}),[[" ",Cs(p-1)+"^"],["",h[f+1]]]))}return c+jd([["".concat(o-1),l[i-1]],["".concat(o),d],["",Cs(u-1)+"^"],["".concat(o+1),l[i+1]]])}function jd(t){var e=t.filter(function(n){n[0];var i=n[1];return i!==void 0}),r=Math.max.apply(Math,e.map(function(n){var i=n[0];return i.length}));return e.map(function(n){var i=n[0],a=n[1];return hy(r,i)+(a?" | "+a:" |")}).join(`
55
- `)}function Cs(t){return Array(t+1).join(" ")}function hy(t,e){return Cs(t-e.length)+e}function Es(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Es=function(r){return typeof r}:Es=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Es(t)}function Ud(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function my(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Ud(Object(r),!0).forEach(function(n){gy(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ud(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function gy(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function yy(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function qd(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function vy(t,e,r){return e&&qd(t.prototype,e),r&&qd(t,r),t}function by(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&&Za(t,e)}function _y(t){var e=o1();return function(){var n=Ja(t),i;if(e){var a=Ja(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return a1(this,i)}}function a1(t,e){return e&&(Es(e)==="object"||typeof e=="function")?e:Ia(t)}function Ia(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function yl(t){var e=typeof Map=="function"?new Map:void 0;return yl=function(n){if(n===null||!Sy(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return xs(n,arguments,Ja(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Za(i,n)},yl(t)}function xs(t,e,r){return o1()?xs=Reflect.construct:xs=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),c=new u;return o&&Za(c,o.prototype),c},xs.apply(null,arguments)}function o1(){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 Sy(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Za(t,e){return Za=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Za(t,e)}function Ja(t){return Ja=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ja(t)}var wy=function(t){by(r,t);var e=_y(r);function r(n,i,a,o,s,u,c){var l,d,f,p;yy(this,r),p=e.call(this,n),p.name="GraphQLError",p.originalError=u??void 0,p.nodes=Bd(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,v=(b=p.nodes)!==null&&b!==void 0?b:[];m<v.length;m++){var b,_=v[m],S=_.loc;S!=null&&h.push(S)}h=Bd(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(O){return O.start})),p.locations=o&&a?o.map(function(O){return gl(a,O)}):(f=h)===null||f===void 0?void 0:f.map(function(O){return gl(O.source,O.start)}),p.path=s??void 0;var y=u?.extensions;return c==null&&fy(y)?p.extensions=my({},y):p.extensions=c??{},Object.defineProperties(Ia(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(Ia(p),"stack",{value:u.stack,writable:!0,configurable:!0}),a1(p)):(Error.captureStackTrace?Error.captureStackTrace(Ia(p),r):Object.defineProperty(Ia(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return vy(r,[{key:"toString",value:function(){return Cy(this)}},{key:n1,get:function(){return"Object"}}]),r}(yl(Error));function Bd(t){return t===void 0||t.length===0?void 0:t}function Cy(t){var e=t.message;if(t.nodes)for(var r=0,n=t.nodes;r<n.length;r++){var i=n[r];i.loc&&(e+=`
51
+ `)),e=e.replace(/\n$/,""),e},vr=function(t){Ne(e,t);function e(r){var n=r.graphQLErrors,i=r.clientErrors,a=r.networkError,o=r.errorMessage,s=r.extraInfo,u=t.call(this,o)||this;return u.name="ApolloError",u.graphQLErrors=n||[],u.clientErrors=i||[],u.networkError=a||null,u.message=o||ly(u),u.extraInfo=s,u.__proto__=e.prototype,u}return e}(Error);var he;(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"})(he||(he={}));function Vr(t){return t?t<7:!1}var py=Object.assign,fy=Object.hasOwnProperty,us=function(t){Ne(e,t);function e(r){var n=r.queryManager,i=r.queryInfo,a=r.options,o=t.call(this,function(v){try{var b=v._subscription._observer;b&&!b.error&&(b.error=dy)}catch{}var _=!o.observers.size;o.observers.add(v);var w=o.last;return w&&w.error?v.error&&v.error(w.error):w&&w.result&&v.next&&v.next(w.result),_&&o.reobserve().catch(function(){}),function(){o.observers.delete(v)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=i,o.queryManager=n,o.isTornDown=!1;var s=n.defaultOptions.watchQuery,u=s===void 0?{}:s,c=u.fetchPolicy,l=c===void 0?"cache-first":c,f=a.fetchPolicy,d=f===void 0?l:f,p=a.initialFetchPolicy,h=p===void 0?d==="standby"?l:d:p;o.options=C(C({},a),{initialFetchPolicy:h,fetchPolicy:d}),o.queryId=i.queryId||n.generateQueryId();var g=er(o.query);return o.queryName=g&&g.name&&g.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(n,i){var a={next:function(s){n(s),r.observers.delete(a),r.observers.size||r.queryManager.removeQuery(r.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=r.subscribe(a)})},e.prototype.getCurrentResult=function(r){r===void 0&&(r=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||he.ready,a=C(C({},n),{loading:Vr(i),networkStatus:i}),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),Ae(a.data,{})&&(a.data=void 0),u.complete?(delete a.partial,u.complete&&a.networkStatus===he.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=he.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,n){return!this.last||!Ae(this.last.result,r)||n&&!Ae(this.last.variables,n)},e.prototype.getLast=function(r,n){var i=this.last;if(i&&i[r]&&(!n||Ae(i.variables,this.variables)))return i[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 n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",__DEV__&&r&&fy.call(r,"variables")){var o=da(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(((n=o.name)===null||n===void 0?void 0:n.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&&!Ae(this.options.variables,r)&&(i.variables=this.options.variables=C(C({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(i,he.refetch)},e.prototype.fetchMore=function(r){var n=this,i=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=he.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var u=new Set;return this.queryManager.fetchQuery(a,i,he.fetchMore).then(function(c){return n.queryManager.removeQuery(a),o.networkStatus===he.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var f=r.updateQuery;f?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(d){return f(d,{fetchMoreResult:c.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:c.data})},onWatchUpdated:function(l){u.add(l.query)}}),c}).finally(function(){u.has(n.query)||Ku(n)})},e.prototype.subscribeToMore=function(r){var n=this,i=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(a){var o=r.updateQuery;o&&n.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(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(r){return this.reobserve(r)},e.prototype.setVariables=function(r){return Ae(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},he.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=r(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.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,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,o=n.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:r,options:n,observable:this,initialFetchPolicy:s}):r==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(r,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,r,n)},e.prototype.updatePolling=function(){var r=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){__DEV__?$(a,"Attempted to start a polling query without a polling interval."):$(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){r.pollingInfo&&(Vr(r.queryInfo.networkStatus)?u():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},he.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,n){return n===void 0&&(n=this.variables),this.last=C(C({},this.last),{result:this.queryManager.assumeImmutableResults?r:Bo(r),variables:n}),qe(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,n){var i=this;this.isTornDown=!1;var a=n===he.refetch||n===he.fetchMore||n===he.poll,o=this.options.variables,s=this.options.fetchPolicy,u=Ur(this.options,r||{}),c=a?u:py(this.options,u);a||(this.updatePolling(),r&&r.variables&&!Ae(r.variables,o)&&c.fetchPolicy!=="standby"&&c.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",c),n===void 0&&(n=he.setVariables)));var l=c.variables&&C({},c.variables),f=this.fetch(c,n),d={next:function(p){i.reportResult(p,l)},error:function(p){i.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=f,this.observer=d),f.addObserver(d),f.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(r,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(r,n))&&((i||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,n),In(this.observers,"next",r))},e.prototype.reportError=function(r,n){var i=C(C({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:he.error,loading:!1});this.updateLastResult(i,n),In(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}(ie);Qo(us);function Ku(t){var e=t.options,r=e.fetchPolicy,n=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.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,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=r,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){r.resolvers=uu(r.resolvers,n)}):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,n=e.remoteResult,i=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,n.data,i,a,this.fragmentMatcher,s).then(function(c){return C(C({},n),{data:c.result})})]:[2,n]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return mi(["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(n){return r.identify(n)}})},t.prototype.addExportedVariables=function(e,r,n){return r===void 0&&(r={}),n===void 0&&(n={}),Bt(this,void 0,void 0,function(){return Vt(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then(function(a){return C(C({},r),a.exportedVariables)})]:[2,C({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return it(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(r=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),r))return wn}}}),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,n,i,a,o){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Bt(this,void 0,void 0,function(){var s,u,c,l,f,d,p,h,g,v,b;return Vt(this,function(_){return s=xn(e),u=En(e),c=Sn(u),l=this.collectSelectionsToResolve(s,c),f=s.operation,d=f?f.charAt(0).toUpperCase()+f.slice(1):"Query",p=this,h=p.cache,g=p.client,v={fragmentMap:c,context:C(C({},n),{cache:h,client:g}),variables:i,fragmentMatcher:a,defaultOperationType:d,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},b=!1,[2,this.resolveSelectionSet(s.selectionSet,b,r,v).then(function(w){return{result:w,exportedVariables:v.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,n,i){return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l=this;return Vt(this,function(f){return a=i.fragmentMap,o=i.context,s=i.variables,u=[n],c=function(d){return Bt(l,void 0,void 0,function(){var p,h;return Vt(this,function(g){return!r&&!i.selectionsToResolve.has(d)?[2]:gr(d,s)?Et(d)?[2,this.resolveField(d,r,n,i).then(function(v){var b;typeof v<"u"&&u.push((b={},b[Rt(d)]=v,b))})]:(nu(d)?p=d:(p=a[d.name.value],__DEV__?$(p,"No fragment named ".concat(d.name.value)):$(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(p.selectionSet,r,n,i).then(function(v){u.push(v)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(c)).then(function(){return ha(u)})]})})},t.prototype.resolveField=function(e,r,n,i){return Bt(this,void 0,void 0,function(){var a,o,s,u,c,l,f,d,p,h=this;return Vt(this,function(g){return n?(a=i.variables,o=e.name.value,s=Rt(e),u=o!==s,c=n[s]||n[o],l=Promise.resolve(c),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(f=n.__typename||i.defaultOperationType,d=this.resolvers&&this.resolvers[f],d&&(p=d[u?o:s],p&&(l=Promise.resolve(Ai.withValue(this.cache,p,[n,yr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(v){var b,_;if(v===void 0&&(v=c),e.directives&&e.directives.forEach(function(y){y.name.value==="export"&&y.arguments&&y.arguments.forEach(function(O){O.name.value==="as"&&O.value.kind==="StringValue"&&(i.exportedVariables[O.value.value]=v)})}),!e.selectionSet||v==null)return v;var w=(_=(b=e.directives)===null||b===void 0?void 0:b.some(function(y){return y.name.value==="client"}))!==null&&_!==void 0?_:!1;if(Array.isArray(v))return h.resolveSubSelectedArray(e,r||w,v,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,r||w,v,i)})]):[2,null]})})},t.prototype.resolveSubSelectedArray=function(e,r,n,i){var a=this;return Promise.all(n.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,r,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,r,o,i)}))},t.prototype.collectSelectionsToResolve=function(e,r){var n=function(o){return!Array.isArray(o)},i=this.selectionsToResolveCache;function a(o){if(!i.has(o)){var s=new Set;i.set(o,s),it(o,{Directive:function(u,c,l,f,d){u.name.value==="client"&&d.forEach(function(p){n(p)&&ua(p)&&s.add(p)})},FragmentSpread:function(u,c,l,f,d){var p=r[u.name.value];__DEV__?$(p,"No fragment named ".concat(u.name.value)):$(p,12);var h=a(p);h.size>0&&(d.forEach(function(g){n(g)&&ua(g)&&s.add(g)}),s.add(u),h.forEach(function(g){s.add(g)}))}})}return i.get(o)}return a(e)},t}();var Ii=new(Pt?WeakMap:Map);function Ju(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return Ii.set(t,(Ii.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 n=this.cache=e.cache;Ii.has(n)||(Ii.set(n,0),Ju(n,"evict"),Ju(n,"modify"),Ju(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||he.loading;return this.variables&&this.networkStatus!==he.loading&&!Ae(this.variables,e.variables)&&(r=he.setVariables),Ae(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&&Ae(r,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var n=this.observableQuery;if(n&&n.options.fetchPolicy==="no-cache")return{complete:!1};var i=this.cache.diff(r);return this.updateLastDiff(i,r),i},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,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Ae(n&&n.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 n=r.getDiff();n.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(Vr(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 n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=C(C({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return r.setDiff(a)}});(!this.lastWatch||!Ae(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var n=this.lastWrite;return!(n&&n.dmCount===Ii.get(this.cache)&&Ae(r,n.variables)&&Ae(e.data,n.result.data))},t.prototype.markResult=function(e,r,n,i){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,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(fs(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:r,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:Ii.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var f=a.getDiffOptions(n.variables),d=l.diff(f);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(d,f),d.complete&&(e.data=d.result)}):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=he.ready},t.prototype.markError=function(e){return this.networkStatus=he.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",n=!wi(t);return!n&&r&&t.data&&(n=!0),n}var hy=Object.prototype.hasOwnProperty,Ud=function(){function t(e){var r=e.cache,n=e.link,i=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,f=l===void 0?{}:l,d=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=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=f,this.localState=d||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,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new H("QueryManager stopped while query was in flight"):new H(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,n,i=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,u=e.refetchQueries,c=u===void 0?[]:u,l=e.awaitRefetchQueries,f=l===void 0?!1:l,d=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,g=h===void 0?((r=this.defaultOptions.mutate)===null||r===void 0?void 0:r.fetchPolicy)||"network-only":h,v=e.errorPolicy,b=v===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":v,_=e.keepRootFields,w=e.context;return Bt(this,void 0,void 0,function(){var y,O,D,A,N,L;return Vt(this,function(P){switch(P.label){case 0:return __DEV__?$(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):$(i,15),__DEV__?$(g==="network-only"||g==="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."):$(g==="network-only"||g==="no-cache",16),y=this.generateMutationId(),O=this.transform(i),D=O.document,A=O.hasClientExports,i=this.cache.transformForLink(D),a=this.getVariables(i,a),A?[4,this.localState.addExportedVariables(i,a,w)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return N=this.mutationStore&&(this.mutationStore[y]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:y,document:i,variables:a,fetchPolicy:g,errorPolicy:b,context:w,updateQueries:s,update:d,keepRootFields:_}),this.broadcastQueries(),L=this,[2,new Promise(function(j,Je){return Vo(L.getObservableFromLink(i,C(C({},w),{optimisticResponse:o}),a,!1),function(je){if(wi(je)&&b==="none")throw new vr({graphQLErrors:Wo(je)});N&&(N.loading=!1,N.error=null);var z=C({},je);return typeof c=="function"&&(c=c(z)),b==="ignore"&&wi(z)&&delete z.errors,L.markMutationResult({mutationId:y,result:z,document:i,variables:a,fetchPolicy:g,errorPolicy:b,context:w,update:d,updateQueries:s,awaitRefetchQueries:f,refetchQueries:c,removeOptimistic:o?y:void 0,onQueryUpdated:p,keepRootFields:_})}).subscribe({next:function(je){L.broadcastQueries(),(!("hasNext"in je)||je.hasNext===!1)&&j(je)},error:function(je){N&&(N.loading=!1,N.error=je),o&&L.cache.removeOptimistic(y),L.broadcastQueries(),Je(je instanceof vr?je:new vr({networkError:je}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var n=this;r===void 0&&(r=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&fs(i,e.errorPolicy)){if(Mr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Mr(i)&&qe(i.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,i)),typeof u<"u"&&(i.data=u,a.push({result:u,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var c=e.updateQueries;c&&this.queries.forEach(function(f,d){var p=f.observableQuery,h=p&&p.queryName;if(!(!h||!hy.call(c,h))){var g=c[h],v=n.queries.get(d),b=v.document,_=v.variables,w=r.diff({query:b,variables:_,returnPartialData:!0,optimistic:!1}),y=w.result,O=w.complete;if(O&&y){var D=g(y,{mutationResult:i,queryName:b&&yi(b)||void 0,queryVariables:_});D&&a.push({result:D,dataId:"ROOT_QUERY",query:b,variables:_})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(f){o||a.forEach(function(g){return f.write(g)});var d=e.update,p=!Sf(i)||Mr(i)&&!i.hasNext;if(d){if(!o){var h=f.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=C(C({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}p&&d(f,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&f.modify({id:"ROOT_MUTATION",fields:function(g,v){var b=v.fieldName,_=v.DELETE;return b==="__typename"?g:_}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(f){return l.push(f)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(e,r){var n=this,i=typeof e=="function"?e(r.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(C(C({},r),{result:{data:i}}),a)}catch(o){__DEV__&&$.error(o)}},r.mutationId)},t.prototype.fetchQuery=function(e,r,n){return this.fetchQueryObservable(e,r,n).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,n){e[n]={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 n=this.cache.transformDocument(e),i=ou(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:Xc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:An(er(n)),asQuery:C(C({},n),{definitions:n.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(n),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),n=new us({queryManager:this,queryInfo:r,options:e});return this.queries.set(n.queryId,r),r.init({document:n.query,observableQuery:n,variables:n.variables}),n},t.prototype.query=function(e,r){var n=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 n.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 H("Store reset while query was in flight (not completed in link chain)"):new H(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=he.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 n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):tu(o)?i.set(r.transform(o).document,!1):ue(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var u=o.observableQuery,c=o.document;if(u){if(e==="all"){n.set(s,u);return}var l=u.queryName,f=u.options.fetchPolicy;if(f==="standby"||e==="active"&&!u.hasObservers())return;(e==="active"||l&&i.has(l)||c&&i.has(c))&&(n.set(s,u),l&&i.set(l,!0),c&&i.set(c,!0))}}),a.size&&a.forEach(function(o){var s=ya("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),n.set(s,c)}),__DEV__&&i.size&&i.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"))}),n},t.prototype.reFetchObservableQueries=function(e){var r=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),r.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,u=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var c=function(f){return r.getObservableFromLink(n,u,f).map(function(d){if(i!=="no-cache"&&(fs(d,a)&&r.cache.write({query:n,result:d.data,dataId:"ROOT_SUBSCRIPTION",variables:f}),r.broadcastQueries()),wi(d))throw new vr({graphQLErrors:d.errors});return d})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,u).then(c);return new ie(function(f){var d=null;return l.then(function(p){return d=p.subscribe(f)},f.error),function(){return d&&d.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,n,i){var a=this,o;i===void 0&&(i=(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,f=c.link,d={query:u,variables:n,operationName:yi(u)||void 0,context:this.prepareContext(C(C({},r),{forceFetch:!i}))};if(r=d.context,i){var p=l.get(u)||new Map;l.set(u,p);var h=xt(n);if(s=p.get(h),!s){var g=new _i([Si(f,d)]);p.set(h,s=g),g.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(u)})}}else s=new _i([Si(f,d)])}else s=new _i([ie.of({data:{}})]),r=this.prepareContext(r);var v=this.transform(e).clientQuery;return v&&(s=Vo(s,function(b){return a.localState.runResolvers({document:v,remoteResult:b,context:r,variables:n})})),s},t.prototype.getResultsFromLink=function(e,r,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Vo(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=Wo(o),u=s.length>0;if(i>=e.lastRequestId){if(u&&n.errorPolicy==="none")throw e.markError(new vr({graphQLErrors:s}));e.markResult(o,a,n,r),e.markReady()}var c={data:o.data,loading:!1,networkStatus:he.ready};return u&&n.errorPolicy!=="ignore"&&(c.errors=s,c.networkStatus=he.error),c},function(o){var s=Fd(o)?o:new vr({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,n){var i=this;n===void 0&&(n=he.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,f=r.errorPolicy,d=f===void 0?u&&u.errorPolicy||"none":f,p=r.returnPartialData,h=p===void 0?!1:p,g=r.notifyOnNetworkStatusChange,v=g===void 0?!1:g,b=r.context,_=b===void 0?{}:b,w=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:d,returnPartialData:h,notifyOnNetworkStatusChange:v,context:_}),y=function(A){w.variables=A;var N=i.fetchQueryByPolicy(s,w,n);return w.fetchPolicy!=="standby"&&N.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),N},O=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){O(),setTimeout(function(){return D.cancel(A)})});var D=new _i(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(y):y(w.variables));return D.promise.then(O,O),D},t.prototype.refetchQueries=function(e){var r=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,u=s===void 0?o?ya("refetchQueries"):void 0:s,c=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(d,p){l.set(p,{oq:d,lastDiff:r.getQuery(p).getDiff()})});var f=new Map;return n&&this.cache.batch({update:n,optimistic:o&&u||!1,removeOptimistic:u,onWatchUpdated:function(d,p,h){var g=d.watcher instanceof ps&&d.watcher.observableQuery;if(g){if(c){l.delete(g.queryId);var v=c(g,p,h);return v===!0&&(v=g.refetch()),v!==!1&&f.set(g,v),v}c!==null&&l.set(g.queryId,{oq:g,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(d,p){var h=d.oq,g=d.lastDiff,v=d.diff,b;if(c){if(!v){var _=h.queryInfo;_.reset(),v=_.getDiff()}b=c(h,v,g)}(!c||b===!0)&&(b=h.refetch()),b!==!1&&f.set(h,b),p.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(p)}),u&&this.cache.removeOptimistic(u),f},t.prototype.fetchQueryByPolicy=function(e,r,n){var i=this,a=r.query,o=r.variables,s=r.fetchPolicy,u=r.refetchWritePolicy,c=r.errorPolicy,l=r.returnPartialData,f=r.context,d=r.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},g=function(y,O){O===void 0&&(O=e.networkStatus||he.loading);var D=y.result;__DEV__&&!l&&!Ae(D,{})&&Zu(y.missing);var A=function(N){return ie.of(C({data:N,loading:Vr(O),networkStatus:O},y.complete?null:{partial:!0}))};return D&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:D},context:f,variables:o,onlyRunForcedResolvers:!0}).then(function(N){return A(N.data||void 0)}):c==="none"&&O===he.refetch&&Array.isArray(y.missing)?A(void 0):A(D)},v=s==="no-cache"?0:n===he.refetch&&u!=="merge"?1:2,b=function(){return i.getResultsFromLink(e,v,{variables:o,context:f,fetchPolicy:s,errorPolicy:c})},_=d&&typeof p=="number"&&p!==n&&Vr(n);switch(s){default:case"cache-first":{var w=h();return w.complete?[g(w,e.markReady())]:l||_?[g(w),b()]:[b()]}case"cache-and-network":{var w=h();return w.complete||l||_?[g(w),b()]:[b()]}case"cache-only":return[g(h(),e.markReady())];case"network-only":return _?[g(h()),b()]:[b()];case"no-cache":return _?[g(e.getDiff()),b()]:[b()];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 n=e.uri,i=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,f=e.connectToDevTools,d=f===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:f,p=e.queryDeduplication,h=p===void 0?!0:p,g=e.defaultOptions,v=e.assumeImmutableResults,b=v===void 0?!1:v,_=e.resolvers,w=e.typeDefs,y=e.fragmentMatcher,O=e.name,D=e.version,A=e.link;if(A||(A=n?new Au({uri:n,credentials:i,headers:a}):$t.empty()),!o)throw __DEV__?new H(`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 H(9);if(this.link=A,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=h,this.defaultOptions=g||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),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!jd&&d&&__DEV__&&(jd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var N=window.navigator,L=N&&N.userAgent,P=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&$.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=Af,this.localState=new ls({cache:o,client:this,resolvers:_,fragmentMatcher:y}),this.queryManager=new Ud({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:u,clientAwareness:{name:O,version:D},localState:this.localState,assumeImmutableResults:b,onBroadcast:d?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=va(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=va(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=va(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 Si(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(n){return n!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),n=[],i=[];r.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,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(_n?"log":"silent");function ct(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function br(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 Pe;(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"})(Pe||(Pe={}));function Vd(t){if(!br(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 Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(t.payload!=null&&!br(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 Pe.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(!br(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&&!br(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&&!br(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 Pe.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(!br(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${ct(t.payload)}`);break}case Pe.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 Pe.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 Ti(t,e){return Vd(t),JSON.stringify(t,e)}function Xu(t){let{url:e,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:u=0,retryAttempts:c=5,retryWait:l=async function(we){let Se=1e3;for(let se=0;se<we;se++)Se*=2;await new Promise(se=>setTimeout(se,Se+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:f=hs,isFatalConnectionProblem:d,on:p,webSocketImpl:h,generateID:g=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{let Se=Math.random()*16|0;return(we=="x"?Se:Se&3|8).toString(16)})},jsonMessageReplacer:v,jsonMessageReviver:b}=t,_;if(h){if(!gy(h))throw new Error("Invalid WebSocket implementation provided");_=h}else typeof WebSocket<"u"?_=WebSocket:typeof global<"u"?_=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(_=window.WebSocket||window.MozWebSocket);if(!_)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=_,y=(()=>{let z=(()=>{let Se={};return{on(se,ce){return Se[se]=ce,()=>{delete Se[se]}},emit(se){var ce;"id"in se&&((ce=Se[se.id])===null||ce===void 0||ce.call(Se,se))}}})(),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?[z.emit,p.message]:[z.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:z.on,on(Se,se){let ce=we[Se];return ce.push(se),()=>{ce.splice(ce.indexOf(se),1)}},emit(Se,...se){for(let ce of[...we[Se]])ce(...se)}}})();function O(z){let we=[y.on("error",Se=>{we.forEach(se=>se()),z(Se)}),y.on("closed",Se=>{we.forEach(se=>se()),z(Se)})]}let D,A=0,N,L=!1,P=0,j=!1;async function Je(){clearTimeout(N);let[z,we]=await(D??(D=new Promise((ce,Zt)=>(async()=>{if(L){if(await l(P),!A)return D=void 0,Zt({code:1e3,reason:"All Subscriptions Gone"});P++}y.emit("connecting");let ne=new w(typeof e=="function"?await e():e,Bd),Jt,Or;function Ao(){isFinite(o)&&o>0&&(clearTimeout(Or),Or=setTimeout(()=>{ne.readyState===w.OPEN&&(ne.send(Ti({type:Pe.Ping})),y.emit("ping",!1,void 0))},o))}O(Ye=>{D=void 0,clearTimeout(Jt),clearTimeout(Or),Zt(Ye),hs(Ye)&&Ye.code===4499&&(ne.close(4499,"Terminated"),ne.onerror=null,ne.onclose=null)}),ne.onerror=Ye=>y.emit("error",Ye),ne.onclose=Ye=>y.emit("closed",Ye),ne.onopen=async()=>{try{y.emit("opened",ne);let Ye=typeof r=="function"?await r():r;if(ne.readyState!==w.OPEN)return;ne.send(Ti(Ye?{type:Pe.ConnectionInit,payload:Ye}:{type:Pe.ConnectionInit},v)),isFinite(u)&&u>0&&(Jt=setTimeout(()=>{ne.close(gt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},u)),Ao()}catch(Ye){y.emit("error",Ye),ne.close(gt.InternalClientError,Yu(Ye instanceof Error?Ye.message:new Error(Ye).message,"Internal client error"))}};let li=!1;ne.onmessage=({data:Ye})=>{try{let Xe=Qd(Ye,b);if(y.emit("message",Xe),Xe.type==="ping"||Xe.type==="pong"){y.emit(Xe.type,!0,Xe.payload),Xe.type==="pong"?Ao():s||(ne.send(Ti(Xe.payload?{type:Pe.Pong,payload:Xe.payload}:{type:Pe.Pong})),y.emit("pong",!1,Xe.payload));return}if(li)return;if(Xe.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Xe.type}`);clearTimeout(Jt),li=!0,y.emit("connected",ne,Xe.payload),L=!1,P=0,ce([ne,new Promise((V3,pm)=>O(pm))])}catch(Xe){ne.onmessage=null,y.emit("error",Xe),ne.close(gt.BadResponse,Yu(Xe instanceof Error?Xe.message:new Error(Xe).message,"Bad response"))}}})())));z.readyState===w.CLOSING&&await we;let Se=()=>{},se=new Promise(ce=>Se=ce);return[z,Se,Promise.race([se.then(()=>{if(!A){let ce=()=>z.close(1e3,"Normal Closure");isFinite(a)&&a>0?N=setTimeout(()=>{z.readyState===w.OPEN&&ce()},a):ce()}}),we])]}function je(z){if(hs(z)&&(my(z.code)||[gt.InternalServerError,gt.InternalClientError,gt.BadRequest,gt.BadResponse,gt.Unauthorized,gt.SubprotocolNotAcceptable,gt.SubscriberAlreadyExists,gt.TooManyInitialisationRequests].includes(z.code)))throw z;if(j)return!1;if(hs(z)&&z.code===1e3)return A>0;if(!c||P>=c||!f(z)||d?.(z))throw z;return L=!0}return n||(async()=>{for(A++;;)try{let[,,z]=await Je();await z}catch(z){try{if(!je(z))return}catch(we){return i?.(we)}}})(),{on:y.on,subscribe(z,we){let Se=g(z),se=!1,ce=!1,Zt=()=>{A--,se=!0};return(async()=>{for(A++;;)try{let[ne,Jt,Or]=await Je();if(se)return Jt();let Ao=y.onMessage(Se,li=>{switch(li.type){case Pe.Next:{we.next(li.payload);return}case Pe.Error:{ce=!0,se=!0,we.error(li.payload),Zt();return}case Pe.Complete:{se=!0,Zt();return}}});ne.send(Ti({id:Se,type:Pe.Subscribe,payload:z},v)),Zt=()=>{!se&&ne.readyState===w.OPEN&&ne.send(Ti({id:Se,type:Pe.Complete},v)),A--,se=!0,Jt()},await Or.finally(Ao);return}catch(ne){if(!je(ne))return}})().then(()=>{ce||we.complete()}).catch(ne=>{we.error(ne)}),()=>{se||Zt()}},async dispose(){if(j=!0,D){let[z]=await D;z.close(1e3,"Normal Closure")}},terminate(){D&&y.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function hs(t){return br(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 ue(t)&&"code"in t&&"reason"in t}var el=function(t){Ne(e,t);function e(r){var n=t.call(this)||this;return n.client=r,n}return e.prototype.request=function(r){var n=this;return new ie(function(i){return n.client.subscribe(C(C({},r),{query:hi(r.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):yy(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new vr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}($t);var Ws=function(){return Ws=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];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 Is(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Is=function(r){return typeof r}:Is=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Is(t)}function vy(t){return Is(t)=="object"&&t!==null}var u1=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function wl(t,e){for(var r=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=r.exec(t.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function by(t){return l1(t.source,wl(t.source,t.start))}function l1(t,e){var r=t.locationOffset.column-1,n=Ts(r)+t.body,i=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=n.split(/\r\n|[\n\r]/g),f=l[i];if(f.length>120){for(var d=Math.floor(u/80),p=u%80,h=[],g=0;g<f.length;g+=80)h.push(f.slice(g,g+80));return c+zd([["".concat(o),h[0]]].concat(h.slice(1,d+1).map(function(v){return["",v]}),[[" ",Ts(p-1)+"^"],["",h[d+1]]]))}return c+zd([["".concat(o-1),l[i-1]],["".concat(o),f],["",Ts(u-1)+"^"],["".concat(o+1),l[i+1]]])}function zd(t){var e=t.filter(function(n){n[0];var i=n[1];return i!==void 0}),r=Math.max.apply(Math,e.map(function(n){var i=n[0];return i.length}));return e.map(function(n){var i=n[0],a=n[1];return _y(r,i)+(a?" | "+a:" |")}).join(`
55
+ `)}function Ts(t){return Array(t+1).join(" ")}function _y(t,e){return Ts(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 n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function wy(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?Wd(Object(r),!0).forEach(function(n){Sy(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Wd(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Sy(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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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&&Xa(t,e)}function Ay(t){var e=f1();return function(){var n=eo(t),i;if(e){var a=eo(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return p1(this,i)}}function p1(t,e){return e&&(Os(e)==="object"||typeof e=="function")?e:Da(t)}function Da(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Sl(t){var e=typeof Map=="function"?new Map:void 0;return Sl=function(n){if(n===null||!ky(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return Ds(n,arguments,eo(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Xa(i,n)},Sl(t)}function Ds(t,e,r){return f1()?Ds=Reflect.construct:Ds=function(i,a,o){var s=[null];s.push.apply(s,a);var u=Function.bind.apply(i,s),c=new u;return o&&Xa(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 Xa(t,e){return Xa=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Xa(t,e)}function eo(t){return eo=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},eo(t)}var Iy=function(t){xy(r,t);var e=Ay(r);function r(n,i,a,o,s,u,c){var l,f,d,p;Cy(this,r),p=e.call(this,n),p.name="GraphQLError",p.originalError=u??void 0,p.nodes=Gd(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],g=0,v=(b=p.nodes)!==null&&b!==void 0?b:[];g<v.length;g++){var b,_=v[g],w=_.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??((f=h)===null||f===void 0?void 0:f.map(function(O){return O.start})),p.locations=o&&a?o.map(function(O){return wl(a,O)}):(d=h)===null||d===void 0?void 0:d.map(function(O){return wl(O.source,O.start)}),p.path=s??void 0;var y=u?.extensions;return c==null&&vy(y)?p.extensions=wy({},y):p.extensions=c??{},Object.defineProperties(Da(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(Da(p),"stack",{value:u.stack,writable:!0,configurable:!0}),p1(p)):(Error.captureStackTrace?Error.captureStackTrace(Da(p),r):Object.defineProperty(Da(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return Ey(r,[{key:"toString",value:function(){return Ty(this)}},{key:u1,get:function(){return"Object"}}]),r}(Sl(Error));function Gd(t){return t===void 0||t.length===0?void 0:t}function Ty(t){var e=t.message;if(t.nodes)for(var r=0,n=t.nodes;r<n.length;r++){var i=n[r];i.loc&&(e+=`
56
56
 
57
- `+dy(i.loc))}else if(t.source&&t.locations)for(var a=0,o=t.locations;a<o.length;a++){var s=o[a];e+=`
57
+ `+by(i.loc))}else if(t.source&&t.locations)for(var a=0,o=t.locations;a<o.length;a++){var s=o[a];e+=`
58
58
 
59
- `+i1(t.source,s)}return e}function kt(t,e,r){return new wy("Syntax Error: ".concat(r),void 0,t,[e])}var V=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 Ey(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var xy=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,vl=xy;function s1(t){var e=t.prototype.toJSON;typeof e=="function"||Ey(0),t.prototype.inspect=e,vl&&(t.prototype[vl]=e)}var c1=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();s1(c1);var $e=function(){function t(r,n,i,a,o,s,u){this.kind=r,this.start=n,this.end=i,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}();s1($e);var T=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 As(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?As=function(r){return typeof r}:As=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},As(t)}var Ay=10,u1=2;function ky(t){return pc(t,[])}function pc(t,e){switch(As(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Iy(t,e);default:return String(t)}}function Iy(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Dy(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:pc(i,r)}else if(Array.isArray(t))return Oy(t,r);return Ty(t,r)}function Ty(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>u1)return"["+Ny(t)+"]";var n=r.map(function(i){var a=pc(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Oy(t,e){if(t.length===0)return"[]";if(e.length>u1)return"[Array]";for(var r=Math.min(Ay,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(pc(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Dy(t){var e=t[String(vl)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Ny(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 Zu(t,e){var r=Boolean(t);if(!r)throw new Error(e)}var Py=function(e,r){return e instanceof r};function Vd(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Ry(t,e,r){return e&&Vd(t.prototype,e),r&&Vd(t,r),t}var l1=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||Zu(0,"Body must be a string. Received: ".concat(ky(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Zu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Zu(0,"column in locationOffset is 1-indexed and must be positive.")}return Ry(t,[{key:n1,get:function(){return"Source"}}]),t}();function $y(t){return Py(t,l1)}var Ly=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 Fy(t){var e=t.split(/\r\n|[\n\r]/g),r=My(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&Qd(e[i]);)++i;for(var a=e.length;a>i&&Qd(e[a-1]);)--a;return e.slice(i,a).join(`
60
- `)}function Qd(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function My(t){for(var e,r=!0,n=!0,i=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,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var jy=function(){function t(r){var n=new $e(T.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=t.prototype;return e.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},e.lookahead=function(){var n=this.token;if(n.kind!==T.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=qy(this,n)}while(n.kind===T.COMMENT);return n},t}();function Uy(t){return t===T.BANG||t===T.DOLLAR||t===T.AMP||t===T.PAREN_L||t===T.PAREN_R||t===T.SPREAD||t===T.COLON||t===T.EQUALS||t===T.AT||t===T.BRACKET_L||t===T.BRACKET_R||t===T.BRACE_L||t===T.PIPE||t===T.BRACE_R}function Qn(t){return isNaN(t)?T.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function qy(t,e){for(var r=t.source,n=r.body,i=n.length,a=e.end;a<i;){var o=n.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:n.charCodeAt(a+1)===10?a+=2:++a,++t.line,t.lineStart=a;continue;case 33:return new $e(T.BANG,a,a+1,s,u,e);case 35:return Vy(r,a,s,u,e);case 36:return new $e(T.DOLLAR,a,a+1,s,u,e);case 38:return new $e(T.AMP,a,a+1,s,u,e);case 40:return new $e(T.PAREN_L,a,a+1,s,u,e);case 41:return new $e(T.PAREN_R,a,a+1,s,u,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new $e(T.SPREAD,a,a+3,s,u,e);break;case 58:return new $e(T.COLON,a,a+1,s,u,e);case 61:return new $e(T.EQUALS,a,a+1,s,u,e);case 64:return new $e(T.AT,a,a+1,s,u,e);case 91:return new $e(T.BRACKET_L,a,a+1,s,u,e);case 93:return new $e(T.BRACKET_R,a,a+1,s,u,e);case 123:return new $e(T.BRACE_L,a,a+1,s,u,e);case 124:return new $e(T.PIPE,a,a+1,s,u,e);case 125:return new $e(T.BRACE_R,a,a+1,s,u,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?Wy(r,a,s,u,e,t):zy(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 Qy(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 Gy(r,a,s,u,e)}throw kt(r,a,By(o))}var c=t.line,l=1+a-t.lineStart;return new $e(T.EOF,i,i,c,l,e)}function By(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(Qn(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Qn(t),".")}function Vy(t,e,r,n,i){var a=t.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new $e(T.COMMENT,e,s,r,n,i,a.slice(e+1,s))}function Qy(t,e,r,n,i,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(Qn(s),"."))}else u=Ju(t,u,s),s=o.charCodeAt(u);if(s===46&&(c=!0,s=o.charCodeAt(++u),u=Ju(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=Ju(t,u,s),s=o.charCodeAt(u)),s===46||Ky(s))throw kt(t,u,"Invalid number, expected digit but got: ".concat(Qn(s),"."));return new $e(c?T.FLOAT:T.INT,e,u,n,i,a,o.slice(e,u))}function Ju(t,e,r){var n=t.body,i=e,a=r;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw kt(t,i,"Invalid number, expected digit but got: ".concat(Qn(a),"."))}function zy(t,e,r,n,i){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 $e(T.STRING,e,o+1,r,n,i,c);if(u<32&&u!==9)throw kt(t,o,"Invalid character within String: ".concat(Qn(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=Hy(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 Wy(t,e,r,n,i,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 $e(T.BLOCK_STRING,e,s+3,r,n,i,Fy(l));if(c<32&&c!==9&&c!==10&&c!==13)throw kt(t,s,"Invalid character within String: ".concat(Qn(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 Hy(t,e,r,n){return us(t)<<12|us(e)<<8|us(r)<<4|us(n)}function us(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function Gy(t,e,r,n,i){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 $e(T.NAME,e,s,r,n,i,a.slice(e,s))}function Ky(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function Zy(t,e){var r=new Jy(t,e);return r.parseDocument()}var Jy=function(){function t(r,n){var i=$y(r)?r:new l1(r);this._lexer=new jy(i),this._options=n}var e=t.prototype;return e.parseName=function(){var n=this.expectToken(T.NAME);return{kind:V.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:V.DOCUMENT,definitions:this.many(T.SOF,this.parseDefinition,T.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(T.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(T.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(T.BRACE_L))return{kind:V.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(T.NAME)&&(a=this.parseName()),{kind:V.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(T.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(T.PAREN_L,this.parseVariableDefinition,T.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:V.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(T.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(T.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(T.DOLLAR),{kind:V.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:V.SELECTION_SET,selections:this.many(T.BRACE_L,this.parseSelection,T.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(T.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(T.COLON)?(a=i,o=this.parseName()):o=i,{kind:V.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(T.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(T.PAREN_L,i,T.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(T.COLON),{kind:V.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:V.ARGUMENT,name:this.parseName(),value:(this.expectToken(T.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(T.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(T.NAME)?{kind:V.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:V.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:V.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:V.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case T.BRACKET_L:return this.parseList(n);case T.BRACE_L:return this.parseObject(n);case T.INT:return this._lexer.advance(),{kind:V.INT,value:i.value,loc:this.loc(i)};case T.FLOAT:return this._lexer.advance(),{kind:V.FLOAT,value:i.value,loc:this.loc(i)};case T.STRING:case T.BLOCK_STRING:return this.parseStringLiteral();case T.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:V.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:V.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:V.NULL,loc:this.loc(i)};default:return{kind:V.ENUM,value:i.value,loc:this.loc(i)}}case T.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:V.STRING,value:n.value,block:n.kind===T.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:V.LIST,values:this.any(T.BRACKET_L,o,T.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:V.OBJECT,fields:this.any(T.BRACE_L,o,T.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(T.COLON),{kind:V.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(T.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(T.AT),{kind:V.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(T.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(T.BRACKET_R),i={kind:V.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(T.BANG)?{kind:V.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:V.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===T.NAME)switch(n.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(n)},e.peekDescription=function(){return this.peek(T.STRING)||this.peek(T.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);return{kind:V.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(T.COLON);var a=this.parseNamedType();return{kind:V.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:V.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:V.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(T.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(T.AMP)||this.peek(T.NAME));return i}return this.delimitedMany(T.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(T.BRACE_L)&&this._lexer.lookahead().kind===T.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(T.BRACE_L,this.parseFieldDefinition,T.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(T.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:V.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:u,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(T.PAREN_L,this.parseInputValueDef,T.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(T.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(T.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:V.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:u,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:V.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:V.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(T.EQUALS)?this.delimitedMany(T.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:V.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(T.BRACE_L,this.parseEnumValueDefinition,T.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:V.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:V.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(T.BRACE_L,this.parseInputValueDef,T.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===T.NAME)switch(n.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(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:V.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:V.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=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:V.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=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:V.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:V.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:V.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:V.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(T.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:V.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(T.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(Ly[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new c1(n,this._lexer.lastToken,this._lexer.source)},e.peek=function(n){return this._lexer.token.kind===n},e.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw kt(this._lexer.source,i.start,"Expected ".concat(p1(n),", found ").concat(Yu(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===T.NAME&&i.value===n)this._lexer.advance();else throw kt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(Yu(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===T.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return kt(this._lexer.source,i.start,"Unexpected ".concat(Yu(i),"."))},e.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},e.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},t}();function Yu(t){var e=t.value;return p1(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function p1(t){return Uy(t)?'"'.concat(t,'"'):t}var ks=new Map,bl=new Map,f1=!0,qs=!1;function d1(t){return t.replace(/[\s,]+/g," ").trim()}function Yy(t){return d1(t.source.body.substring(t.start,t.end))}function Xy(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=Yy(n.loc),o=bl.get(i);o&&!o.has(a)?f1&&console.warn("Warning: fragment with name "+i+` already exists.
59
+ `+l1(t.source,s)}return e}function kt(t,e,r){return new Iy("Syntax Error: ".concat(r),void 0,t,[e])}var Q=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,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();d1(h1);var Le=function(){function t(r,n,i,a,o,s,u){this.kind=r,this.start=n,this.end=i,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(Le);var T=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]),n=Fy(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:gc(i,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 n=r.map(function(i){var a=gc(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Ly(t,e){if(t.length===0)return"[]";if(e.length>m1)return"[Array]";for(var r=Math.min(Ny,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(gc(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.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 n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}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",n=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=n,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 n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&Zd(e[i]);)++i;for(var a=e.length;a>i&&Zd(e[a-1]);)--a;return e.slice(i,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,n=!0,i=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,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var zy=function(){function t(r){var n=new Le(T.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=t.prototype;return e.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},e.lookahead=function(){var n=this.token;if(n.kind!==T.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=Hy(this,n)}while(n.kind===T.COMMENT);return n},t}();function Wy(t){return t===T.BANG||t===T.DOLLAR||t===T.AMP||t===T.PAREN_L||t===T.PAREN_R||t===T.SPREAD||t===T.COLON||t===T.EQUALS||t===T.AT||t===T.BRACKET_L||t===T.BRACKET_R||t===T.BRACE_L||t===T.PIPE||t===T.BRACE_R}function Wn(t){return isNaN(t)?T.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,n=r.body,i=n.length,a=e.end;a<i;){var o=n.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:n.charCodeAt(a+1)===10?a+=2:++a,++t.line,t.lineStart=a;continue;case 33:return new Le(T.BANG,a,a+1,s,u,e);case 35:return Ky(r,a,s,u,e);case 36:return new Le(T.DOLLAR,a,a+1,s,u,e);case 38:return new Le(T.AMP,a,a+1,s,u,e);case 40:return new Le(T.PAREN_L,a,a+1,s,u,e);case 41:return new Le(T.PAREN_R,a,a+1,s,u,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Le(T.SPREAD,a,a+3,s,u,e);break;case 58:return new Le(T.COLON,a,a+1,s,u,e);case 61:return new Le(T.EQUALS,a,a+1,s,u,e);case 64:return new Le(T.AT,a,a+1,s,u,e);case 91:return new Le(T.BRACKET_L,a,a+1,s,u,e);case 93:return new Le(T.BRACKET_R,a,a+1,s,u,e);case 123:return new Le(T.BRACE_L,a,a+1,s,u,e);case 124:return new Le(T.PIPE,a,a+1,s,u,e);case 125:return new Le(T.BRACE_R,a,a+1,s,u,e);case 34:return n.charCodeAt(a+1)===34&&n.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 Le(T.EOF,i,i,c,l,e)}function Gy(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(Wn(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Wn(t),".")}function Ky(t,e,r,n,i){var a=t.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Le(T.COMMENT,e,s,r,n,i,a.slice(e+1,s))}function Zy(t,e,r,n,i,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(Wn(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(Wn(s),"."));return new Le(c?T.FLOAT:T.INT,e,u,n,i,a,o.slice(e,u))}function rl(t,e,r){var n=t.body,i=e,a=r;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw kt(t,i,"Invalid number, expected digit but got: ".concat(Wn(a),"."))}function Jy(t,e,r,n,i){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 Le(T.STRING,e,o+1,r,n,i,c);if(u<32&&u!==9)throw kt(t,o,"Invalid character within String: ".concat(Wn(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 f=a.slice(o+1,o+5);throw kt(t,o,"Invalid character escape sequence: \\u".concat(f,"."))}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,n,i,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 Le(T.BLOCK_STRING,e,s+3,r,n,i,Vy(l));if(c<32&&c!==9&&c!==10&&c!==13)throw kt(t,s,"Invalid character within String: ".concat(Wn(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,n){return ms(t)<<12|ms(e)<<8|ms(r)<<4|ms(n)}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,n,i){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 Le(T.NAME,e,s,r,n,i,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 n0(t,e);return r.parseDocument()}var n0=function(){function t(r,n){var i=qy(r)?r:new g1(r);this._lexer=new zy(i),this._options=n}var e=t.prototype;return e.parseName=function(){var n=this.expectToken(T.NAME);return{kind:Q.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:Q.DOCUMENT,definitions:this.many(T.SOF,this.parseDefinition,T.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(T.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(T.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(T.BRACE_L))return{kind:Q.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(T.NAME)&&(a=this.parseName()),{kind:Q.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(T.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(T.PAREN_L,this.parseVariableDefinition,T.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:Q.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(T.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(T.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(T.DOLLAR),{kind:Q.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:Q.SELECTION_SET,selections:this.many(T.BRACE_L,this.parseSelection,T.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(T.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(T.COLON)?(a=i,o=this.parseName()):o=i,{kind:Q.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(T.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(T.PAREN_L,i,T.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(T.COLON),{kind:Q.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:Q.ARGUMENT,name:this.parseName(),value:(this.expectToken(T.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(T.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(T.NAME)?{kind:Q.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:Q.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:Q.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:Q.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case T.BRACKET_L:return this.parseList(n);case T.BRACE_L:return this.parseObject(n);case T.INT:return this._lexer.advance(),{kind:Q.INT,value:i.value,loc:this.loc(i)};case T.FLOAT:return this._lexer.advance(),{kind:Q.FLOAT,value:i.value,loc:this.loc(i)};case T.STRING:case T.BLOCK_STRING:return this.parseStringLiteral();case T.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:Q.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:Q.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:Q.NULL,loc:this.loc(i)};default:return{kind:Q.ENUM,value:i.value,loc:this.loc(i)}}case T.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:Q.STRING,value:n.value,block:n.kind===T.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:Q.LIST,values:this.any(T.BRACKET_L,o,T.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:Q.OBJECT,fields:this.any(T.BRACE_L,o,T.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(T.COLON),{kind:Q.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(T.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(T.AT),{kind:Q.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(T.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(T.BRACKET_R),i={kind:Q.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(T.BANG)?{kind:Q.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:Q.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===T.NAME)switch(n.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(n)},e.peekDescription=function(){return this.peek(T.STRING)||this.peek(T.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);return{kind:Q.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(T.COLON);var a=this.parseNamedType();return{kind:Q.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:Q.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:Q.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(T.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(T.AMP)||this.peek(T.NAME));return i}return this.delimitedMany(T.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(T.BRACE_L)&&this._lexer.lookahead().kind===T.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(T.BRACE_L,this.parseFieldDefinition,T.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(T.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:Q.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:u,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(T.PAREN_L,this.parseInputValueDef,T.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(T.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(T.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:Q.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:u,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),u=this.parseFieldsDefinition();return{kind:Q.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:u,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:Q.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(T.EQUALS)?this.delimitedMany(T.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:Q.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(T.BRACE_L,this.parseEnumValueDefinition,T.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:Q.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:Q.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(T.BRACE_L,this.parseInputValueDef,T.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===T.NAME)switch(n.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(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(T.BRACE_L,this.parseOperationTypeDefinition,T.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:Q.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:Q.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=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:Q.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=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:Q.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(T.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:Q.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(T.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(By[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new h1(n,this._lexer.lastToken,this._lexer.source)},e.peek=function(n){return this._lexer.token.kind===n},e.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw kt(this._lexer.source,i.start,"Expected ".concat(y1(n),", found ").concat(nl(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===T.NAME&&i.value===n)this._lexer.advance();else throw kt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(nl(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===T.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return kt(this._lexer.source,i.start,"Unexpected ".concat(nl(i),"."))},e.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},e.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},t}();function nl(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 i0(t){return b1(t.source.body.substring(t.start,t.end))}function a0(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=i0(n.loc),o=El.get(i);o&&!o.has(a)?v1&&console.warn("Warning: fragment with name "+i+` 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||bl.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),Us(Us({},t),{definitions:r})}function e0(t){var e=new Set(t.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function t0(t){var e=d1(t);if(!ks.has(e)){var r=Zy(t,{experimentalFragmentVariables:qs,allowLegacyFragmentVariables:qs});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");ks.set(e,e0(Xy(r)))}return ks.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 n=t[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=t[a+1]}),t0(n)}function r0(){ks.clear(),bl.clear()}function n0(){f1=!1}function i0(){qs=!0}function a0(){qs=!1}var Ea={gql:E,resetCaches:r0,disableFragmentWarnings:n0,enableExperimentalFragmentVariables:i0,disableExperimentalFragmentVariables:a0};(function(t){t.gql=Ea.gql,t.resetCaches=Ea.resetCaches,t.disableFragmentWarnings=Ea.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Ea.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Ea.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function I(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 o0(){}function ln(){return o0}var ve=ln,g=ln,Ke=ln,Ve=ln,G=ln,Gt=ln,s0=ln,Vl=ln,h1=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},m1=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},zn=class{constructor(e){this.code=e}};h1([g(),m1("design:type",String)],zn.prototype,"code",void 0);zn=h1([G(),m1("design:paramtypes",[String])],zn);var Ql=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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)},cr=class{constructor(e,r){this.address=e,this.name=r}};Ql([g(),zl("design:type",String)],cr.prototype,"address",void 0);Ql([g(),zl("design:type",String)],cr.prototype,"name",void 0);cr=Ql([G(),zl("design:paramtypes",[String,String])],cr);var ke=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Be=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},kr=class{constructor(e,r){this.key=r,this.signature=e}};ke([g(),Be("design:type",String)],kr.prototype,"signature",void 0);ke([g(),Be("design:type",String)],kr.prototype,"key",void 0);ke([g(),Be("design:type",Boolean)],kr.prototype,"valid",void 0);ke([g(),Be("design:type",Boolean)],kr.prototype,"invalid",void 0);kr=ke([G(),Ke(),Be("design:paramtypes",[String,String])],kr);var Wn=class{};ke([g(),Be("design:type",String)],Wn.prototype,"signature",void 0);ke([g(),Be("design:type",String)],Wn.prototype,"key",void 0);ke([g(),Be("design:type",Boolean)],Wn.prototype,"valid",void 0);ke([g(),Be("design:type",Boolean)],Wn.prototype,"invalid",void 0);Wn=ke([Ke()],Wn);function pn(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return ke([g(),Be("design:type",String)],e.prototype,"author",void 0),ke([g(),Be("design:type",String)],e.prototype,"timestamp",void 0),ke([g(),Be("design:type",Object)],e.prototype,"data",void 0),ke([g(),Be("design:type",kr)],e.prototype,"proof",void 0),e=ke([G(),Be("design:paramtypes",[String,String,Object,kr])],e),e}function c0(t){let e=class{};return ke([g(),Be("design:type",String)],e.prototype,"author",void 0),ke([g(),Be("design:type",String)],e.prototype,"timestamp",void 0),ke([g(),Be("design:type",Object)],e.prototype,"data",void 0),ke([g(),Be("design:type",Wn)],e.prototype,"proof",void 0),e=ke([Ke()],e),e}var zd=class extends pn(){};zd=ke([G()],zd);var Bs=class extends pn(){};ke([g(),Be("design:type",cr)],Bs.prototype,"language",void 0);ke([g(),Be("design:type",zn)],Bs.prototype,"icon",void 0);Bs=ke([G()],Bs);function f7(t){return t&&t.author&&t.timestamp&&t.data}var Fe=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},rt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Hn=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Fe([g(),rt("design:type",String)],Hn.prototype,"source",void 0);Fe([g(),rt("design:type",String)],Hn.prototype,"target",void 0);Fe([g(),rt("design:type",String)],Hn.prototype,"predicate",void 0);Hn=Fe([G(),rt("design:paramtypes",[Object])],Hn);var Vs=class{};Fe([g(),rt("design:type",Array)],Vs.prototype,"additions",void 0);Fe([g(),rt("design:type",Array)],Vs.prototype,"removals",void 0);Vs=Fe([Ke()],Vs);var Qs=class{constructor(e,r){this.additions=e,this.removals=r}};Fe([g(),rt("design:type",Array)],Qs.prototype,"additions",void 0);Fe([g(),rt("design:type",Array)],Qs.prototype,"removals",void 0);Qs=Fe([G(),rt("design:paramtypes",[Array,Array])],Qs);var Ya=class{};Fe([g(),rt("design:type",String)],Ya.prototype,"source",void 0);Fe([g(),rt("design:type",String)],Ya.prototype,"target",void 0);Fe([g(),rt("design:type",String)],Ya.prototype,"predicate",void 0);Ya=Fe([Ke()],Ya);var nn=class extends pn(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};Fe([g(),rt("design:type",String)],nn.prototype,"status",void 0);nn=Fe([G()],nn);var _l=class extends c0(){};Fe([g(),rt("design:type",String)],_l.prototype,"status",void 0);_l=Fe([Ke()],_l);function b7(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 _7(t){return t&&t.source&&t.target}var zs=class{constructor(e,r){this.oldLink=e,this.newLink=r}};Fe([g(),rt("design:type",nn)],zs.prototype,"oldLink",void 0);Fe([g(),rt("design:type",nn)],zs.prototype,"newLink",void 0);zs=Fe([G(),rt("design:paramtypes",[nn,nn])],zs);var ti=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},lo=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Sl,pr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.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}};ti([g(),lo("design:type",Array)],pr.prototype,"links",void 0);pr=ti([G(),lo("design:paramtypes",[Array])],pr);var Ws=class{};ti([g(),lo("design:type",Array)],Ws.prototype,"links",void 0);Ws=ti([Ke()],Ws);var wl=Sl=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new Sl;return r.links.push(e),r}};ti([g(),lo("design:type",Array)],wl.prototype,"links",void 0);wl=Sl=ti([Ke(),lo("design:paramtypes",[Array])],wl);var Gn=class extends pn(){};Gn=ti([G()],Gn);var U=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},q=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Yr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new pr}};U([g(),q("design:type",String)],Yr.prototype,"did",void 0);U([g(),q("design:type",pr)],Yr.prototype,"perspective",void 0);U([g(),q("design:type",String)],Yr.prototype,"directMessageLanguage",void 0);Yr=U([G(),q("design:paramtypes",[String,pr])],Yr);var Wd=class extends pn(){};Wd=U([G()],Wd);var an=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};U([g(),q("design:type",String)],an.prototype,"did",void 0);U([g(),q("design:type",String)],an.prototype,"didSigningKeyId",void 0);U([g(),q("design:type",String)],an.prototype,"deviceKeyType",void 0);U([g(),q("design:type",String)],an.prototype,"deviceKey",void 0);U([g(),q("design:type",String)],an.prototype,"deviceKeySignedByDid",void 0);U([g(),q("design:type",String)],an.prototype,"didSignedByDeviceKey",void 0);an=U([G(),q("design:paramtypes",[String,String,String,String,String,String])],an);var on=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};U([g(),q("design:type",String)],on.prototype,"did",void 0);U([g(),q("design:type",String)],on.prototype,"didSigningKeyId",void 0);U([g(),q("design:type",String)],on.prototype,"deviceKeyType",void 0);U([g(),q("design:type",String)],on.prototype,"deviceKey",void 0);U([g(),q("design:type",String)],on.prototype,"deviceKeySignedByDid",void 0);U([g(),q("design:type",String)],on.prototype,"didSignedByDeviceKey",void 0);on=U([Ke(),q("design:paramtypes",[String,String,String,String,String,String])],on);var Hs=class{constructor(e,r){this.signature=e,this.publicKey=r}};U([g(),q("design:type",String)],Hs.prototype,"signature",void 0);U([g(),q("design:type",String)],Hs.prototype,"publicKey",void 0);Hs=U([G(),q("design:paramtypes",[String,String])],Hs);var Fi=class{constructor(e,r){this.domain=e,this.pointers=r}};U([g(),q("design:type",String)],Fi.prototype,"domain",void 0);U([g(),q("design:type",Array)],Fi.prototype,"pointers",void 0);Fi=U([G(),q("design:paramtypes",[String,Array])],Fi);var Gs=class{constructor(e,r){this.with=e,this.can=r}};U([g(),q("design:type",Fi)],Gs.prototype,"with",void 0);U([g(),q("design:type",Array)],Gs.prototype,"can",void 0);Gs=U([G(),q("design:paramtypes",[Fi,Array])],Gs);var Ir=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};U([g(),q("design:type",String)],Ir.prototype,"appName",void 0);U([g(),q("design:type",String)],Ir.prototype,"appDesc",void 0);U([g(),q("design:type",String)],Ir.prototype,"appUrl",void 0);U([g(),q("design:type",String)],Ir.prototype,"appIconPath",void 0);U([g(),q("design:type",Array)],Ir.prototype,"capabilities",void 0);Ir=U([G(),q("design:paramtypes",[String,String,String,Array,String])],Ir);var Mi=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};U([g(),q("design:type",String)],Mi.prototype,"requestId",void 0);U([g(),q("design:type",String)],Mi.prototype,"token",void 0);U([g(),q("design:type",Boolean)],Mi.prototype,"revoked",void 0);U([g(),q("design:type",Ir)],Mi.prototype,"auth",void 0);Mi=U([G(),q("design:paramtypes",[String,Ir,String,Boolean])],Mi);var ji=class{constructor(e,r){this.domain=e,this.pointers=r}};U([g(),q("design:type",String)],ji.prototype,"domain",void 0);U([g(),q("design:type",Array)],ji.prototype,"pointers",void 0);ji=U([Ke(),q("design:paramtypes",[String,Array])],ji);var Ks=class{constructor(e,r){this.with=e,this.can=r}};U([g(),q("design:type",ji)],Ks.prototype,"with",void 0);U([g(),q("design:type",Array)],Ks.prototype,"can",void 0);Ks=U([Ke(),q("design:paramtypes",[ji,Array])],Ks);var sn=class{constructor(e,r,n,i,a,o){this.appName=e,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};U([g(),q("design:type",String)],sn.prototype,"appName",void 0);U([g(),q("design:type",String)],sn.prototype,"appDesc",void 0);U([g(),q("design:type",String)],sn.prototype,"appDomain",void 0);U([g(),q("design:type",String)],sn.prototype,"appUrl",void 0);U([g(),q("design:type",String)],sn.prototype,"appIconPath",void 0);U([g(),q("design:type",Array)],sn.prototype,"capabilities",void 0);sn=U([Ke(),q("design:paramtypes",[String,String,String,String,String,Array])],sn);var zi=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Wi=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ft=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)}};zi([g(),Wi("design:type",Boolean)],Ft.prototype,"isInitialized",void 0);zi([g(),Wi("design:type",Boolean)],Ft.prototype,"isUnlocked",void 0);zi([g(),Wi("design:type",String)],Ft.prototype,"did",void 0);zi([g(),Wi("design:type",String)],Ft.prototype,"didDocument",void 0);zi([g(),Wi("design:type",String)],Ft.prototype,"error",void 0);Ft=zi([G(),Wi("design:paramtypes",[Object])],Ft);var Hd=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Re=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},gt,yt,Cl=class{constructor(e,r){gt.set(this,void 0),yt.set(this,void 0),Hd(this,gt,e,"f"),Hd(this,yt,r,"f")}async otherAgents(){return await Re(this,gt,"f").otherAgents(Re(this,yt,"f"))}async hasTelepresenceAdapter(){return await Re(this,gt,"f").hasTelepresenceAdapter(Re(this,yt,"f"))}async onlineAgents(){return await Re(this,gt,"f").onlineAgents(Re(this,yt,"f"))}async setOnlineStatus(e){return await Re(this,gt,"f").setOnlineStatus(Re(this,yt,"f"),e)}async setOnlineStatusU(e){return await Re(this,gt,"f").setOnlineStatusU(Re(this,yt,"f"),e)}async sendSignal(e,r){return await Re(this,gt,"f").sendSignal(Re(this,yt,"f"),e,r)}async sendSignalU(e,r){return await Re(this,gt,"f").sendSignalU(Re(this,yt,"f"),e,r)}async sendBroadcast(e,r=!1){return await Re(this,gt,"f").sendBroadcast(Re(this,yt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await Re(this,gt,"f").sendBroadcastU(Re(this,yt,"f"),e,r)}async addSignalHandler(e){await Re(this,gt,"f").addSignalHandler(Re(this,yt,"f"),e)}removeSignalHandler(e){Re(this,gt,"f").removeSignalHandler(Re(this,yt,"f"),e)}};gt=new WeakMap,yt=new WeakMap;var ri=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},ni=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},at=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)}};ri([g(),ni("design:type",String)],at.prototype,"source",void 0);ri([g(),ni("design:type",String)],at.prototype,"target",void 0);ri([g(),ni("design:type",String)],at.prototype,"predicate",void 0);ri([g(),ni("design:type",Date)],at.prototype,"fromDate",void 0);ri([g(),ni("design:type",Date)],at.prototype,"untilDate",void 0);ri([g(),ni("design:type",Number)],at.prototype,"limit",void 0);at=ri([G(),Ke(),ni("design:paramtypes",[Object])],at);var Gd=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},et=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},vt,Sr;function ls(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var St=class{constructor(){vt.set(this,void 0),Sr.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new St;return Gd(r,Sr,e,"f"),r}static from(e){let r=new St;return Gd(r,vt,e,"f"),r}toUrl(){if(et(this,Sr,"f")&&!et(this,vt,"f"))return et(this,Sr,"f");if(!et(this,Sr,"f")&&(et(this,vt,"f")===void 0||et(this,vt,"f")===""||et(this,vt,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof et(this,vt,"f")){case"string":e=`string:${ls(et(this,vt,"f"))}`;break;case"number":e=`number:${ls(et(this,vt,"f"))}`;break;case"boolean":e=`boolean:${ls(et(this,vt,"f"))}`;break;case"object":e=`json:${ls(JSON.stringify(et(this,vt,"f")))}`;break}return`literal://${e}`}get(){if(et(this,vt,"f"))return et(this,vt,"f");if(!et(this,Sr,"f"))throw new Error("Can't render empty Literal");if(!et(this,Sr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=et(this,Sr,"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}`)}};vt=new WeakMap,Sr=new WeakMap;function Xr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Wl(t){return`set${Xr(t)}`}function Ar(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function Hl(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function u0(t){return`add${Xr(Hl(t))}`}function l0(t){let e=t.substring(3),r=Ar(e);return r.charAt(0).toLowerCase()+r.slice(1)}function p0(t){return`remove${Xr(Hl(t))}`}function f0(t){let e=t.substring(6),r=Ar(e);return r.charAt(0).toLowerCase()+r.slice(1)}function d0(t){let e=t.substring(13),r=Ar(e);return r.charAt(0).toLowerCase()+r.slice(1)}function h0(t){return`setCollection${Xr(Hl(t))}`}function On(t){if(Array.isArray(t))return`[${t.map(On).join(", ")}]`;let e=Object.keys(t),r=[];for(let n of e){let i=JSON.stringify(t[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var Xu=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},H=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ut,lt,Te,Zs=class{constructor(t,e,r){ut.set(this,void 0),lt.set(this,void 0),Te.set(this,void 0),Xu(this,ut,e,"f"),Xu(this,lt,r,"f"),Xu(this,Te,t,"f")}get baseExpression(){return H(this,ut,"f")}async init(){let isInstance=await H(this,Te,"f").isSubjectInstance(H(this,ut,"f"),H(this,lt,"f"));if(!isInstance)throw`Not a valid subject instance of ${H(this,lt,"f")} for ${H(this,ut,"f")}`;let results=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"f")}", C), property_resolve(C, "${t}")`);Object.defineProperty(this,t,{configurable:!0,get:async()=>{let r=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"f")}", C), property_getter(C, "${H(this,ut,"f")}", "${t}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(e)try{if(n){let i=await H(this,Te,"f").getExpression(n);try{return JSON.parse(i.data)}catch{return i.data}}else return n}catch{return n}else return n}else return r||void 0}})}let setters=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Wl(property)]=async t=>{resolveLanguage&&(t=await H(this,Te,"f").createExpression(t,resolveLanguage)),await H(this,Te,"f").executeAction(actions,H(this,ut,"f"),[{name:"value",value:t}])}}let results2=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"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 H(this,Te,"f").infer(`subject_class("${H(this,lt,"f")}", C), collection_getter(C, "${H(this,ut,"f")}", "${t}", Value)`);return e&&e.length>0&&e[0].Value?e[0].Value.filter(n=>n!==""&&n!==""):[]}});let adders=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"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[u0(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>H(this,Te,"f").executeAction(actions,H(this,ut,"f"),[{name:"value",value:e}]))):await H(this,Te,"f").executeAction(actions,H(this,ut,"f"),[{name:"value",value:t}])}}let removers=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"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[p0(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>H(this,Te,"f").executeAction(actions,H(this,ut,"f"),[{name:"value",value:e}]))):await H(this,Te,"f").executeAction(actions,H(this,ut,"f"),[{name:"value",value:t}])}}let collectionSetters=await H(this,Te,"f").infer(`subject_class("${H(this,lt,"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[h0(collection)]=async t=>{Array.isArray(t)?await H(this,Te,"f").executeAction(actions,H(this,ut,"f"),t.map(e=>({name:"value",value:e}))):await H(this,Te,"f").executeAction(actions,H(this,ut,"f"),[{name:"value",value:t}])}}}};ut=new WeakMap,lt=new WeakMap,Te=new WeakMap;var de=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},k=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Is,wr,rr,nr,jn,Hr,Gr,Dn,Ta,Ts,Nn,Pn,$t,Pi,El,ue,le,Rn,$n,Ln,Oa,Js=class{constructor(e,r,n){Is.add(this),wr.set(this,void 0),rr.set(this,void 0),nr.set(this,void 0),jn.set(this,void 0),Hr.set(this,void 0),Gr.set(this,void 0),Dn.set(this,void 0),Ta.set(this,!1),Ts.set(this,void 0),Nn.set(this,void 0),Pn.set(this,void 0),$t.set(this,void 0),Pi.set(this,void 0),this.isSurrealDB=!1,de(this,wr,e,"f"),de(this,Pi,r,"f"),de(this,nr,n,"f"),de(this,jn,new Set,"f"),de(this,Dn,null,"f"),de(this,Ts,new Promise((i,a)=>{de(this,Nn,i,"f"),de(this,Pn,a,"f")}),"f")}async subscribe(){k(this,Gr,"f")&&(k(this,Gr,"f").call(this),de(this,Gr,void 0,"f")),k(this,$t,"f")&&(clearTimeout(k(this,$t,"f")),de(this,$t,void 0,"f")),k(this,Hr,"f")&&(clearTimeout(k(this,Hr,"f")),de(this,Hr,void 0,"f"));try{let r;this.isSurrealDB?r=await k(this,nr,"f").perspectiveSubscribeSurrealQuery(k(this,wr,"f"),k(this,Pi,"f")):r=await k(this,nr,"f").subscribeQuery(k(this,wr,"f"),k(this,Pi,"f")),de(this,rr,r.subscriptionId,"f"),r.result?(de(this,Dn,r.result,"f"),k(this,Is,"m",El).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),de(this,$t,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(n=>{console.error("Error during subscription retry after timeout:",n)})},3e4),"f"),de(this,Gr,k(this,nr,"f").subscribeToQueryUpdates(k(this,rr,"f"),n=>{k(this,$t,"f")&&(clearTimeout(k(this,$t,"f")),de(this,$t,void 0,"f")),k(this,Nn,"f")&&(k(this,Nn,"f").call(this,!0),de(this,Nn,void 0,"f"),de(this,Pn,void 0,"f")),!(n.isInit&&k(this,Dn,"f"))&&(de(this,Dn,n,"f"),k(this,Is,"m",El).call(this,n))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),k(this,Pn,"f")&&(k(this,Pn,"f").call(this,r),de(this,Nn,void 0,"f"),de(this,Pn,void 0,"f")),r}let e=async()=>{if(!k(this,Ta,"f")){try{this.isSurrealDB?await k(this,nr,"f").perspectiveKeepAliveSurrealQuery(k(this,wr,"f"),k(this,rr,"f")):await k(this,nr,"f").keepAliveQuery(k(this,wr,"f"),k(this,rr,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",k(this,Pi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}k(this,Ta,"f")||de(this,Hr,setTimeout(e,3e4),"f")}};de(this,Hr,setTimeout(e,3e4),"f")}get id(){return k(this,rr,"f")}get initialized(){return k(this,Ts,"f")}get result(){return k(this,Dn,"f")}onResult(e){return k(this,jn,"f").add(e),()=>k(this,jn,"f").delete(e)}dispose(){de(this,Ta,!0,"f"),clearTimeout(k(this,Hr,"f")),k(this,Gr,"f")&&k(this,Gr,"f").call(this),k(this,jn,"f").clear(),k(this,$t,"f")&&(clearTimeout(k(this,$t,"f")),de(this,$t,void 0,"f")),k(this,rr,"f")&&(this.isSurrealDB?k(this,nr,"f").perspectiveDisposeSurrealQuerySubscription(k(this,wr,"f"),k(this,rr,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):k(this,nr,"f").disposeQuerySubscription(k(this,wr,"f"),k(this,rr,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};wr=new WeakMap,rr=new WeakMap,nr=new WeakMap,jn=new WeakMap,Hr=new WeakMap,Gr=new WeakMap,Dn=new WeakMap,Ta=new WeakMap,Ts=new WeakMap,Nn=new WeakMap,Pn=new WeakMap,$t=new WeakMap,Pi=new WeakMap,Is=new WeakSet,El=function t(e){for(let r of k(this,jn,"f"))try{r(e)}catch(n){console.error("Error in query subscription callback:",n)}};var $i=class{constructor(t,e){ue.set(this,void 0),le.set(this,void 0),Rn.set(this,void 0),$n.set(this,void 0),Ln.set(this,void 0),Oa.set(this,void 0),de(this,Rn,[],"f"),de(this,$n,[],"f"),de(this,Ln,[],"f"),de(this,Oa,[],"f"),de(this,ue,t,"f"),de(this,le,e,"f"),this.uuid=k(this,ue,"f").uuid,this.name=k(this,ue,"f").name,this.sharedUrl=k(this,ue,"f").sharedUrl,this.neighbourhood=k(this,ue,"f").neighbourhood,this.state=k(this,ue,"f").state,k(this,le,"f").addPerspectiveLinkAddedListener(k(this,ue,"f").uuid,k(this,Rn,"f")),k(this,le,"f").addPerspectiveLinkRemovedListener(k(this,ue,"f").uuid,k(this,$n,"f")),k(this,le,"f").addPerspectiveLinkUpdatedListener(k(this,ue,"f").uuid,k(this,Ln,"f")),k(this,le,"f").addPerspectiveSyncStateChangeListener(k(this,ue,"f").uuid,k(this,Oa,"f"))}async executeAction(t,e,r,n){return await k(this,le,"f").executeCommands(k(this,ue,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),n)}async get(t){return await k(this,le,"f").queryLinks(k(this,ue,"f").uuid,t)}async infer(t){return await k(this,le,"f").queryProlog(k(this,ue,"f").uuid,t)}async querySurrealDB(t){return await k(this,le,"f").querySurrealDB(k(this,ue,"f").uuid,t)}async add(t,e="shared",r){return await k(this,le,"f").addLink(k(this,ue,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await k(this,le,"f").addLinks(k(this,ue,"f").uuid,t,e,r)}async removeLinks(t,e){return await k(this,le,"f").removeLinks(k(this,ue,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await k(this,le,"f").linkMutations(k(this,ue,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await k(this,le,"f").addLinkExpression(k(this,ue,"f").uuid,t,e,r)}async update(t,e,r){return await k(this,le,"f").updateLink(k(this,ue,"f").uuid,t,e,r)}async remove(t,e){return await k(this,le,"f").removeLink(k(this,ue,"f").uuid,t,e)}async createBatch(){return await k(this,le,"f").createBatch(k(this,ue,"f").uuid)}async commitBatch(t){return await k(this,le,"f").commitBatch(k(this,ue,"f").uuid,t)}async getExpression(t){return await k(this,le,"f").getExpression(t)}async createExpression(t,e){return await k(this,le,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?k(this,Rn,"f").push(e):t==="link-removed"?k(this,$n,"f").push(e):t==="link-updated"&&k(this,Ln,"f").push(e)}async addSyncStateChangeListener(t){k(this,Oa,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=k(this,Rn,"f").indexOf(e);k(this,Rn,"f").splice(r,1)}else if(t==="link-removed"){let r=k(this,$n,"f").indexOf(e);k(this,$n,"f").splice(r,1)}else if(t==="link-updated"){let r=k(this,Ln,"f").indexOf(e);k(this,Ln,"f").splice(r,1)}}async snapshot(){return k(this,le,"f").snapshotByUUID(k(this,ue,"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 at({source:t.source,predicate:t.predicate}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[t];await this.linkMutations({additions:a,removals:i},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(n=>n.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(n=>n.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 n=await this.get(new at({source:"ad4m://self",predicate:r}));for(let i of n){let a=i.data.target,o=await this.get(new at({source:a,predicate:"ad4m://sdna"}));for(let s of o){let u=St.fromUrl(s.data.target).get();typeof u=="string"&&e.push(u)}}}return e}async getSdnaForClass(t){let e=St.from(t);if((await this.get(new at({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new at({source:e.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let i=St.fromUrl(n[0].data.target).get();return typeof i=="string"?i:null}async addSdna(t,e,r){return k(this,le,"f").addSdna(k(this,ue,"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,n){let i;if(typeof t=="string")i=t,await k(this,le,"f").createSubject(k(this,ue,"f").uuid,JSON.stringify({className:i,initialValues:r}),e,r?JSON.stringify(r):void 0,n);else{let a=this.buildQueryFromTemplate(t);await k(this,le,"f").createSubject(k(this,ue,"f").uuid,JSON.stringify({query:a,initialValues:r}),e,r?JSON.stringify(r):void 0,n)}return n?e:this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await k(this,le,"f").getSubjectData(k(this,ue,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await k(this,le,"f").getSubjectData(k(this,ue,"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),n=!1,i=5,a=0;for(;a<i&&!n;)n=await this.infer(`subject_class("${r}", C), instance(C, "${t}")`),a++;return n}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),n=new Zs(this,t,r);return await n.init(),n}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.infer(`subject_class("${n}", C), instance(C, X)`),a=await Promise.all(i.map(async o=>await this.getSubjectProxy(o.X,n)));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 n of e)r=await this.infer(`subject_class("${n}", C), instance(C, X)`);return r}buildQueryFromTemplate(t){let e;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.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=>{i.includes(l)||i.push(l)}):i.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 n)c+=`, property(C, "${l}")`;for(let l of i)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, "${l0(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${f0(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${d0(l)}", _)`;c+=".",e=c}(t),e}async subjectClassesByTemplate(t){let e=this.buildQueryFromTemplate(t),r=await this.infer(e);return r?r.map(n=>n.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:n}=t.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return k(this,le,"f").getNeighbourhoodProxy(k(this,ue,"f").uuid)}get ai(){return k(this,le,"f").aiClient}async subscribeInfer(t){let e=new Js(this.uuid,t,k(this,le,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new Js(this.uuid,t,k(this,le,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};ue=new WeakMap,le=new WeakMap,Rn=new WeakMap,$n=new WeakMap,Ln=new WeakMap,Oa=new WeakMap;var Qr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},B=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Z,Da,Na,Pa,Os,Ra,Ds,Ns,ct=`
63
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||El.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),Ws(Ws({},t),{definitions:r})}function o0(t){var e=new Set(t.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];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 n=t[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=t[a+1]}),s0(n)}function c0(){Rs.clear(),El.clear()}function u0(){v1=!1}function l0(){Hs=!0}function p0(){Hs=!1}var ka={gql:E,resetCaches:c0,disableFragmentWarnings:u0,enableExperimentalFragmentVariables:l0,disableExperimentalFragmentVariables:p0};(function(t){t.gql=ka.gql,t.resetCaches=ka.resetCaches,t.disableFragmentWarnings=ka.disableFragmentWarnings,t.enableExperimentalFragmentVariables=ka.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=ka.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 pn(){return f0}var be=pn,m=pn,Ze=pn,Me=pn,W=pn,Dt=pn,d0=pn,Gl=pn,_1=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},w1=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Hn=class{constructor(e){this.code=e}};_1([m(),w1("design:type",String)],Hn.prototype,"code",void 0);Hn=_1([W(),w1("design:paramtypes",[String])],Hn);var Kl=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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([m(),Zl("design:type",String)],ur.prototype,"address",void 0);Kl([m(),Zl("design:type",String)],ur.prototype,"name",void 0);ur=Kl([W(),Zl("design:paramtypes",[String,String])],ur);var Ie=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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)},kr=class{constructor(e,r){this.key=r,this.signature=e}};Ie([m(),Qe("design:type",String)],kr.prototype,"signature",void 0);Ie([m(),Qe("design:type",String)],kr.prototype,"key",void 0);Ie([m(),Qe("design:type",Boolean)],kr.prototype,"valid",void 0);Ie([m(),Qe("design:type",Boolean)],kr.prototype,"invalid",void 0);kr=Ie([W(),Ze(),Qe("design:paramtypes",[String,String])],kr);var Gn=class{};Ie([m(),Qe("design:type",String)],Gn.prototype,"signature",void 0);Ie([m(),Qe("design:type",String)],Gn.prototype,"key",void 0);Ie([m(),Qe("design:type",Boolean)],Gn.prototype,"valid",void 0);Ie([m(),Qe("design:type",Boolean)],Gn.prototype,"invalid",void 0);Gn=Ie([Ze()],Gn);function fn(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Ie([m(),Qe("design:type",String)],e.prototype,"author",void 0),Ie([m(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Ie([m(),Qe("design:type",Object)],e.prototype,"data",void 0),Ie([m(),Qe("design:type",kr)],e.prototype,"proof",void 0),e=Ie([W(),Qe("design:paramtypes",[String,String,Object,kr])],e),e}function h0(t){let e=class{};return Ie([m(),Qe("design:type",String)],e.prototype,"author",void 0),Ie([m(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Ie([m(),Qe("design:type",Object)],e.prototype,"data",void 0),Ie([m(),Qe("design:type",Gn)],e.prototype,"proof",void 0),e=Ie([Ze()],e),e}var Jd=class extends fn(){};Jd=Ie([W()],Jd);var Gs=class extends fn(){};Ie([m(),Qe("design:type",ur)],Gs.prototype,"language",void 0);Ie([m(),Qe("design:type",Hn)],Gs.prototype,"icon",void 0);Gs=Ie([W()],Gs);function v8(t){return t&&t.author&&t.timestamp&&t.data}var Ue=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},nt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Kn=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Ue([m(),nt("design:type",String)],Kn.prototype,"source",void 0);Ue([m(),nt("design:type",String)],Kn.prototype,"target",void 0);Ue([m(),nt("design:type",String)],Kn.prototype,"predicate",void 0);Kn=Ue([W(),nt("design:paramtypes",[Object])],Kn);var Ks=class{};Ue([m(),nt("design:type",Array)],Ks.prototype,"additions",void 0);Ue([m(),nt("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([m(),nt("design:type",Array)],Zs.prototype,"additions",void 0);Ue([m(),nt("design:type",Array)],Zs.prototype,"removals",void 0);Zs=Ue([W(),nt("design:paramtypes",[Array,Array])],Zs);var to=class{};Ue([m(),nt("design:type",String)],to.prototype,"source",void 0);Ue([m(),nt("design:type",String)],to.prototype,"target",void 0);Ue([m(),nt("design:type",String)],to.prototype,"predicate",void 0);to=Ue([Ze()],to);var nn=class extends fn(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};Ue([m(),nt("design:type",String)],nn.prototype,"status",void 0);nn=Ue([W()],nn);var xl=class extends h0(){};Ue([m(),nt("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([m(),nt("design:type",nn)],Js.prototype,"oldLink",void 0);Ue([m(),nt("design:type",nn)],Js.prototype,"newLink",void 0);Js=Ue([W(),nt("design:paramtypes",[nn,nn])],Js);var ri=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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 n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.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}};ri([m(),yo("design:type",Array)],fr.prototype,"links",void 0);fr=ri([W(),yo("design:paramtypes",[Array])],fr);var Ys=class{};ri([m(),yo("design:type",Array)],Ys.prototype,"links",void 0);Ys=ri([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}};ri([m(),yo("design:type",Array)],kl.prototype,"links",void 0);kl=Al=ri([Ze(),yo("design:paramtypes",[Array])],kl);var Zn=class extends fn(){};Zn=ri([W()],Zn);var q=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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)},Yr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new fr}};q([m(),B("design:type",String)],Yr.prototype,"did",void 0);q([m(),B("design:type",fr)],Yr.prototype,"perspective",void 0);q([m(),B("design:type",String)],Yr.prototype,"directMessageLanguage",void 0);Yr=q([W(),B("design:paramtypes",[String,fr])],Yr);var Yd=class extends fn(){};Yd=q([W()],Yd);var an=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([m(),B("design:type",String)],an.prototype,"did",void 0);q([m(),B("design:type",String)],an.prototype,"didSigningKeyId",void 0);q([m(),B("design:type",String)],an.prototype,"deviceKeyType",void 0);q([m(),B("design:type",String)],an.prototype,"deviceKey",void 0);q([m(),B("design:type",String)],an.prototype,"deviceKeySignedByDid",void 0);q([m(),B("design:type",String)],an.prototype,"didSignedByDeviceKey",void 0);an=q([W(),B("design:paramtypes",[String,String,String,String,String,String])],an);var on=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([m(),B("design:type",String)],on.prototype,"did",void 0);q([m(),B("design:type",String)],on.prototype,"didSigningKeyId",void 0);q([m(),B("design:type",String)],on.prototype,"deviceKeyType",void 0);q([m(),B("design:type",String)],on.prototype,"deviceKey",void 0);q([m(),B("design:type",String)],on.prototype,"deviceKeySignedByDid",void 0);q([m(),B("design:type",String)],on.prototype,"didSignedByDeviceKey",void 0);on=q([Ze(),B("design:paramtypes",[String,String,String,String,String,String])],on);var Xs=class{constructor(e,r){this.signature=e,this.publicKey=r}};q([m(),B("design:type",String)],Xs.prototype,"signature",void 0);q([m(),B("design:type",String)],Xs.prototype,"publicKey",void 0);Xs=q([W(),B("design:paramtypes",[String,String])],Xs);var ji=class{constructor(e,r){this.domain=e,this.pointers=r}};q([m(),B("design:type",String)],ji.prototype,"domain",void 0);q([m(),B("design:type",Array)],ji.prototype,"pointers",void 0);ji=q([W(),B("design:paramtypes",[String,Array])],ji);var ec=class{constructor(e,r){this.with=e,this.can=r}};q([m(),B("design:type",ji)],ec.prototype,"with",void 0);q([m(),B("design:type",Array)],ec.prototype,"can",void 0);ec=q([W(),B("design:paramtypes",[ji,Array])],ec);var Ir=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};q([m(),B("design:type",String)],Ir.prototype,"appName",void 0);q([m(),B("design:type",String)],Ir.prototype,"appDesc",void 0);q([m(),B("design:type",String)],Ir.prototype,"appUrl",void 0);q([m(),B("design:type",String)],Ir.prototype,"appIconPath",void 0);q([m(),B("design:type",Array)],Ir.prototype,"capabilities",void 0);Ir=q([W(),B("design:paramtypes",[String,String,String,Array,String])],Ir);var qi=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};q([m(),B("design:type",String)],qi.prototype,"requestId",void 0);q([m(),B("design:type",String)],qi.prototype,"token",void 0);q([m(),B("design:type",Boolean)],qi.prototype,"revoked",void 0);q([m(),B("design:type",Ir)],qi.prototype,"auth",void 0);qi=q([W(),B("design:paramtypes",[String,Ir,String,Boolean])],qi);var Bi=class{constructor(e,r){this.domain=e,this.pointers=r}};q([m(),B("design:type",String)],Bi.prototype,"domain",void 0);q([m(),B("design:type",Array)],Bi.prototype,"pointers",void 0);Bi=q([Ze(),B("design:paramtypes",[String,Array])],Bi);var tc=class{constructor(e,r){this.with=e,this.can=r}};q([m(),B("design:type",Bi)],tc.prototype,"with",void 0);q([m(),B("design:type",Array)],tc.prototype,"can",void 0);tc=q([Ze(),B("design:paramtypes",[Bi,Array])],tc);var sn=class{constructor(e,r,n,i,a,o){this.appName=e,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};q([m(),B("design:type",String)],sn.prototype,"appName",void 0);q([m(),B("design:type",String)],sn.prototype,"appDesc",void 0);q([m(),B("design:type",String)],sn.prototype,"appDomain",void 0);q([m(),B("design:type",String)],sn.prototype,"appUrl",void 0);q([m(),B("design:type",String)],sn.prototype,"appIconPath",void 0);q([m(),B("design:type",Array)],sn.prototype,"capabilities",void 0);sn=q([Ze(),B("design:paramtypes",[String,String,String,String,String,Array])],sn);var ro=class{constructor(e,r,n){this.username=e,this.did=r,this.password=n}};q([m(),B("design:type",String)],ro.prototype,"username",void 0);q([m(),B("design:type",String)],ro.prototype,"did",void 0);q([m(),B("design:type",String)],ro.prototype,"password",void 0);ro=q([W(),B("design:paramtypes",[String,String,String])],ro);var no=class{constructor(e,r,n){this.did=e,this.success=r,this.error=n}};q([m(),B("design:type",String)],no.prototype,"did",void 0);q([m(),B("design:type",Boolean)],no.prototype,"success",void 0);q([m(),B("design:type",String)],no.prototype,"error",void 0);no=q([W(),B("design:paramtypes",[String,Boolean,String])],no);var Ki=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Zi=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)}};Ki([m(),Zi("design:type",Boolean)],Mt.prototype,"isInitialized",void 0);Ki([m(),Zi("design:type",Boolean)],Mt.prototype,"isUnlocked",void 0);Ki([m(),Zi("design:type",String)],Mt.prototype,"did",void 0);Ki([m(),Zi("design:type",String)],Mt.prototype,"didDocument",void 0);Ki([m(),Zi("design:type",String)],Mt.prototype,"error",void 0);Mt=Ki([W(),Zi("design:paramtypes",[Object])],Mt);var Xd=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},$e=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},yt,vt,Il=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 $e(this,yt,"f").otherAgents($e(this,vt,"f"))}async hasTelepresenceAdapter(){return await $e(this,yt,"f").hasTelepresenceAdapter($e(this,vt,"f"))}async onlineAgents(){return await $e(this,yt,"f").onlineAgents($e(this,vt,"f"))}async setOnlineStatus(e){return await $e(this,yt,"f").setOnlineStatus($e(this,vt,"f"),e)}async setOnlineStatusU(e){return await $e(this,yt,"f").setOnlineStatusU($e(this,vt,"f"),e)}async sendSignal(e,r){return await $e(this,yt,"f").sendSignal($e(this,vt,"f"),e,r)}async sendSignalU(e,r){return await $e(this,yt,"f").sendSignalU($e(this,vt,"f"),e,r)}async sendBroadcast(e,r=!1){return await $e(this,yt,"f").sendBroadcast($e(this,vt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await $e(this,yt,"f").sendBroadcastU($e(this,vt,"f"),e,r)}async addSignalHandler(e){await $e(this,yt,"f").addSignalHandler($e(this,vt,"f"),e)}removeSignalHandler(e){$e(this,yt,"f").removeSignalHandler($e(this,vt,"f"),e)}};yt=new WeakMap,vt=new WeakMap;var ni=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},ii=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)}};ni([m(),ii("design:type",String)],ot.prototype,"source",void 0);ni([m(),ii("design:type",String)],ot.prototype,"target",void 0);ni([m(),ii("design:type",String)],ot.prototype,"predicate",void 0);ni([m(),ii("design:type",Date)],ot.prototype,"fromDate",void 0);ni([m(),ii("design:type",Date)],ot.prototype,"untilDate",void 0);ni([m(),ii("design:type",Number)],ot.prototype,"limit",void 0);ot=ni([W(),Ze(),ii("design:paramtypes",[Object])],ot);var eh=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},tt=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},bt,wr;function gs(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var St=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 St;return eh(r,wr,e,"f"),r}static from(e){let r=new St;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 Xr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Jl(t){return`set${Xr(t)}`}function Ar(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${Xr(Yl(t))}`}function g0(t){let e=t.substring(3),r=Ar(e);return r.charAt(0).toLowerCase()+r.slice(1)}function y0(t){return`remove${Xr(Yl(t))}`}function v0(t){let e=t.substring(6),r=Ar(e);return r.charAt(0).toLowerCase()+r.slice(1)}function b0(t){let e=t.substring(13),r=Ar(e);return r.charAt(0).toLowerCase()+r.slice(1)}function _0(t){return`setCollection${Xr(Yl(t))}`}function Nn(t){if(Array.isArray(t))return`[${t.map(Nn).join(", ")}]`;let e=Object.keys(t),r=[];for(let n of e){let i=JSON.stringify(t[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var il=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},G=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},lt,pt,Oe,rc=class{constructor(t,e,r){lt.set(this,void 0),pt.set(this,void 0),Oe.set(this,void 0),il(this,lt,e,"f"),il(this,pt,r,"f"),il(this,Oe,t,"f")}get baseExpression(){return G(this,lt,"f")}async init(){let isInstance=await G(this,Oe,"f").isSubjectInstance(G(this,lt,"f"),G(this,pt,"f"));if(!isInstance)throw`Not a valid subject instance of ${G(this,pt,"f")} for ${G(this,lt,"f")}`;let results=await G(this,Oe,"f").infer(`subject_class("${G(this,pt,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await G(this,Oe,"f").infer(`subject_class("${G(this,pt,"f")}", C), property_resolve(C, "${t}")`);Object.defineProperty(this,t,{configurable:!0,get:async()=>{let r=await G(this,Oe,"f").infer(`subject_class("${G(this,pt,"f")}", C), property_getter(C, "${G(this,lt,"f")}", "${t}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(e)try{if(n){let i=await G(this,Oe,"f").getExpression(n);try{return JSON.parse(i.data)}catch{return i.data}}else return n}catch{return n}else return n}else return r||void 0}})}let setters=await G(this,Oe,"f").infer(`subject_class("${G(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 G(this,Oe,"f").infer(`subject_class("${G(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 G(this,Oe,"f").createExpression(t,resolveLanguage)),await G(this,Oe,"f").executeAction(actions,G(this,lt,"f"),[{name:"value",value:t}])}}let results2=await G(this,Oe,"f").infer(`subject_class("${G(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 G(this,Oe,"f").infer(`subject_class("${G(this,pt,"f")}", C), collection_getter(C, "${G(this,lt,"f")}", "${t}", Value)`);return e&&e.length>0&&e[0].Value?e[0].Value.filter(n=>n!==""&&n!==""):[]}});let adders=await G(this,Oe,"f").infer(`subject_class("${G(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=>G(this,Oe,"f").executeAction(actions,G(this,lt,"f"),[{name:"value",value:e}]))):await G(this,Oe,"f").executeAction(actions,G(this,lt,"f"),[{name:"value",value:t}])}}let removers=await G(this,Oe,"f").infer(`subject_class("${G(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=>G(this,Oe,"f").executeAction(actions,G(this,lt,"f"),[{name:"value",value:e}]))):await G(this,Oe,"f").executeAction(actions,G(this,lt,"f"),[{name:"value",value:t}])}}let collectionSetters=await G(this,Oe,"f").infer(`subject_class("${G(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 G(this,Oe,"f").executeAction(actions,G(this,lt,"f"),t.map(e=>({name:"value",value:e}))):await G(this,Oe,"f").executeAction(actions,G(this,lt,"f"),[{name:"value",value:t}])}}}};lt=new WeakMap,pt=new WeakMap,Oe=new WeakMap;var ye=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},I=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ps,Sr,nr,ir,qn,Hr,Gr,Rn,Na,$s,Pn,$n,Lt,Li,Tl,pe,de,Ln,Fn,Mn,Ra,nc=class{constructor(e,r,n){Ps.add(this),Sr.set(this,void 0),nr.set(this,void 0),ir.set(this,void 0),qn.set(this,void 0),Hr.set(this,void 0),Gr.set(this,void 0),Rn.set(this,void 0),Na.set(this,!1),$s.set(this,void 0),Pn.set(this,void 0),$n.set(this,void 0),Lt.set(this,void 0),Li.set(this,void 0),this.isSurrealDB=!1,ye(this,Sr,e,"f"),ye(this,Li,r,"f"),ye(this,ir,n,"f"),ye(this,qn,new Set,"f"),ye(this,Rn,null,"f"),ye(this,$s,new Promise((i,a)=>{ye(this,Pn,i,"f"),ye(this,$n,a,"f")}),"f")}async subscribe(){I(this,Gr,"f")&&(I(this,Gr,"f").call(this),ye(this,Gr,void 0,"f")),I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),ye(this,Lt,void 0,"f")),I(this,Hr,"f")&&(clearTimeout(I(this,Hr,"f")),ye(this,Hr,void 0,"f"));try{let r;this.isSurrealDB?r=await I(this,ir,"f").perspectiveSubscribeSurrealQuery(I(this,Sr,"f"),I(this,Li,"f")):r=await I(this,ir,"f").subscribeQuery(I(this,Sr,"f"),I(this,Li,"f")),ye(this,nr,r.subscriptionId,"f"),r.result?(ye(this,Rn,r.result,"f"),I(this,Ps,"m",Tl).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ye(this,Lt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(n=>{console.error("Error during subscription retry after timeout:",n)})},3e4),"f"),ye(this,Gr,I(this,ir,"f").subscribeToQueryUpdates(I(this,nr,"f"),n=>{I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),ye(this,Lt,void 0,"f")),I(this,Pn,"f")&&(I(this,Pn,"f").call(this,!0),ye(this,Pn,void 0,"f"),ye(this,$n,void 0,"f")),!(n.isInit&&I(this,Rn,"f"))&&(ye(this,Rn,n,"f"),I(this,Ps,"m",Tl).call(this,n))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),I(this,$n,"f")&&(I(this,$n,"f").call(this,r),ye(this,Pn,void 0,"f"),ye(this,$n,void 0,"f")),r}let e=async()=>{if(!I(this,Na,"f")){try{this.isSurrealDB?await I(this,ir,"f").perspectiveKeepAliveSurrealQuery(I(this,Sr,"f"),I(this,nr,"f")):await I(this,ir,"f").keepAliveQuery(I(this,Sr,"f"),I(this,nr,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",I(this,Li,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}I(this,Na,"f")||ye(this,Hr,setTimeout(e,3e4),"f")}};ye(this,Hr,setTimeout(e,3e4),"f")}get id(){return I(this,nr,"f")}get initialized(){return I(this,$s,"f")}get result(){return I(this,Rn,"f")}onResult(e){return I(this,qn,"f").add(e),()=>I(this,qn,"f").delete(e)}dispose(){ye(this,Na,!0,"f"),clearTimeout(I(this,Hr,"f")),I(this,Gr,"f")&&I(this,Gr,"f").call(this),I(this,qn,"f").clear(),I(this,Lt,"f")&&(clearTimeout(I(this,Lt,"f")),ye(this,Lt,void 0,"f")),I(this,nr,"f")&&(this.isSurrealDB?I(this,ir,"f").perspectiveDisposeSurrealQuerySubscription(I(this,Sr,"f"),I(this,nr,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):I(this,ir,"f").disposeQuerySubscription(I(this,Sr,"f"),I(this,nr,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Sr=new WeakMap,nr=new WeakMap,ir=new WeakMap,qn=new WeakMap,Hr=new WeakMap,Gr=new WeakMap,Rn=new WeakMap,Na=new WeakMap,$s=new WeakMap,Pn=new WeakMap,$n=new WeakMap,Lt=new WeakMap,Li=new WeakMap,Ps=new WeakSet,Tl=function t(e){for(let r of I(this,qn,"f"))try{r(e)}catch(n){console.error("Error in query subscription callback:",n)}};var Mi=class{constructor(t,e){pe.set(this,void 0),de.set(this,void 0),Ln.set(this,void 0),Fn.set(this,void 0),Mn.set(this,void 0),Ra.set(this,void 0),ye(this,Ln,[],"f"),ye(this,Fn,[],"f"),ye(this,Mn,[],"f"),ye(this,Ra,[],"f"),ye(this,pe,t,"f"),ye(this,de,e,"f"),this.uuid=I(this,pe,"f").uuid,this.name=I(this,pe,"f").name,this.owners=I(this,pe,"f").owners,this.sharedUrl=I(this,pe,"f").sharedUrl,this.neighbourhood=I(this,pe,"f").neighbourhood,this.state=I(this,pe,"f").state,I(this,de,"f").addPerspectiveLinkAddedListener(I(this,pe,"f").uuid,I(this,Ln,"f")),I(this,de,"f").addPerspectiveLinkRemovedListener(I(this,pe,"f").uuid,I(this,Fn,"f")),I(this,de,"f").addPerspectiveLinkUpdatedListener(I(this,pe,"f").uuid,I(this,Mn,"f")),I(this,de,"f").addPerspectiveSyncStateChangeListener(I(this,pe,"f").uuid,I(this,Ra,"f"))}async executeAction(t,e,r,n){return await I(this,de,"f").executeCommands(I(this,pe,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),n)}async get(t){return await I(this,de,"f").queryLinks(I(this,pe,"f").uuid,t)}async infer(t){return await I(this,de,"f").queryProlog(I(this,pe,"f").uuid,t)}async querySurrealDB(t){return await I(this,de,"f").querySurrealDB(I(this,pe,"f").uuid,t)}async add(t,e="shared",r){return await I(this,de,"f").addLink(I(this,pe,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await I(this,de,"f").addLinks(I(this,pe,"f").uuid,t,e,r)}async removeLinks(t,e){return await I(this,de,"f").removeLinks(I(this,pe,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await I(this,de,"f").linkMutations(I(this,pe,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await I(this,de,"f").addLinkExpression(I(this,pe,"f").uuid,t,e,r)}async update(t,e,r){return await I(this,de,"f").updateLink(I(this,pe,"f").uuid,t,e,r)}async remove(t,e){return await I(this,de,"f").removeLink(I(this,pe,"f").uuid,t,e)}async createBatch(){return await I(this,de,"f").createBatch(I(this,pe,"f").uuid)}async commitBatch(t){return await I(this,de,"f").commitBatch(I(this,pe,"f").uuid,t)}async getExpression(t){return await I(this,de,"f").getExpression(t)}async createExpression(t,e){return await I(this,de,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?I(this,Ln,"f").push(e):t==="link-removed"?I(this,Fn,"f").push(e):t==="link-updated"&&I(this,Mn,"f").push(e)}async addSyncStateChangeListener(t){I(this,Ra,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=I(this,Ln,"f").indexOf(e);I(this,Ln,"f").splice(r,1)}else if(t==="link-removed"){let r=I(this,Fn,"f").indexOf(e);I(this,Fn,"f").splice(r,1)}else if(t==="link-updated"){let r=I(this,Mn,"f").indexOf(e);I(this,Mn,"f").splice(r,1)}}async snapshot(){return I(this,de,"f").snapshotByUUID(I(this,pe,"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}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[t];await this.linkMutations({additions:a,removals:i},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(n=>n.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(n=>n.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 n=await this.get(new ot({source:"ad4m://self",predicate:r}));for(let i of n){let a=i.data.target,o=await this.get(new ot({source:a,predicate:"ad4m://sdna"}));for(let s of o){let u=St.fromUrl(s.data.target).get();typeof u=="string"&&e.push(u)}}}return e}async getSdnaForClass(t){let e=St.from(t);if((await this.get(new ot({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new ot({source:e.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let i=St.fromUrl(n[0].data.target).get();return typeof i=="string"?i:null}async addSdna(t,e,r){return I(this,de,"f").addSdna(I(this,pe,"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,n){let i;if(typeof t=="string")i=t,await I(this,de,"f").createSubject(I(this,pe,"f").uuid,JSON.stringify({className:i,initialValues:r}),e,r?JSON.stringify(r):void 0,n);else{let a=this.buildQueryFromTemplate(t);await I(this,de,"f").createSubject(I(this,pe,"f").uuid,JSON.stringify({query:a,initialValues:r}),e,r?JSON.stringify(r):void 0,n)}return n?e:this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await I(this,de,"f").getSubjectData(I(this,pe,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await I(this,de,"f").getSubjectData(I(this,pe,"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),n=!1,i=5,a=0;for(;a<i&&!n;)n=await this.infer(`subject_class("${r}", C), instance(C, "${t}")`),a++;return n}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),n=new rc(this,t,r);return await n.init(),n}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.infer(`subject_class("${n}", C), instance(C, X)`),a=await Promise.all(i.map(async o=>await this.getSubjectProxy(o.X,n)));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 n of e)r=await this.infer(`subject_class("${n}", C), instance(C, X)`);return r}buildQueryFromTemplate(t){let e;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.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=>{i.includes(l)||i.push(l)}):i.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 f=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return f&&typeof f.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 f=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return f&&typeof f.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 f=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return f&&typeof f.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 f=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return f&&typeof f.value=="function"&&l.startsWith("setCollection")}));let c="subject_class(Class, C)";for(let l of n)c+=`, property(C, "${l}")`;for(let l of i)c+=`, collection(C, "${l}")`;for(let l of a){let f=l.substring(3);f=f.charAt(0).toLowerCase()+f.slice(1),c+=`, property_setter(C, "${f}", _)`}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(n=>n.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:n}=t.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return I(this,de,"f").getNeighbourhoodProxy(I(this,pe,"f").uuid)}get ai(){return I(this,de,"f").aiClient}async subscribeInfer(t){let e=new nc(this.uuid,t,I(this,de,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new nc(this.uuid,t,I(this,de,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};pe=new WeakMap,de=new WeakMap,Ln=new WeakMap,Fn=new WeakMap,Mn=new WeakMap,Ra=new WeakMap;var Qr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},V=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},J,Pa,$a,La,Ls,Fa,Fs,Ms,ut=`
64
64
  author
65
65
  timestamp
66
66
  status
67
67
  data { source, predicate, target }
68
68
  proof { valid, invalid, signature, key }
69
- `,ki=`
69
+ `,Oi=`
70
70
  uuid
71
71
  name
72
72
  sharedUrl
73
73
  state
74
+ owners
74
75
  neighbourhood {
75
76
  data {
76
77
  linkLanguage
@@ -86,139 +87,139 @@ neighbourhood {
86
87
  }
87
88
  author
88
89
  }
89
- `,Ys=class{constructor(e,r=!0){Z.set(this,void 0),Da.set(this,void 0),Na.set(this,void 0),Pa.set(this,void 0),Os.set(this,void 0),Ra.set(this,void 0),Ds.set(this,void 0),Ns.set(this,void 0),Qr(this,Z,e,"f"),Qr(this,Da,[],"f"),Qr(this,Na,[],"f"),Qr(this,Pa,[],"f"),Qr(this,Os,[],"f"),r&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Qr(this,Ra,e,"f")}setNeighbourhoodClient(e){Qr(this,Ds,e,"f")}setAIClient(e){Qr(this,Ns,e,"f")}get aiClient(){return B(this,Ns,"f")}async all(){let{perspectives:e}=I(await B(this,Z,"f").query({query:E`query perspectives {
90
+ `,ic=class{constructor(e,r=!0){J.set(this,void 0),Pa.set(this,void 0),$a.set(this,void 0),La.set(this,void 0),Ls.set(this,void 0),Fa.set(this,void 0),Fs.set(this,void 0),Ms.set(this,void 0),Qr(this,J,e,"f"),Qr(this,Pa,[],"f"),Qr(this,$a,[],"f"),Qr(this,La,[],"f"),Qr(this,Ls,[],"f"),r&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Qr(this,Fa,e,"f")}setNeighbourhoodClient(e){Qr(this,Fs,e,"f")}setAIClient(e){Qr(this,Ms,e,"f")}get aiClient(){return V(this,Ms,"f")}async all(){let{perspectives:e}=k(await V(this,J,"f").query({query:E`query perspectives {
90
91
  perspectives {
91
- ${ki}
92
+ ${Oi}
92
93
  }
93
- }`}));return e.map(r=>new $i(r,this))}async byUUID(e){let{perspective:r}=I(await B(this,Z,"f").query({query:E`query perspective($uuid: String!) {
94
+ }`}));return e.map(r=>new Mi(r,this))}async byUUID(e){let{perspective:r}=k(await V(this,J,"f").query({query:E`query perspective($uuid: String!) {
94
95
  perspective(uuid: $uuid) {
95
- ${ki}
96
+ ${Oi}
96
97
  }
97
- }`,variables:{uuid:e}}));return r?new $i(r,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:r}=I(await B(this,Z,"f").query({query:E`query perspectiveSnapshot($uuid: String!) {
98
+ }`,variables:{uuid:e}}));return r?new Mi(r,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:r}=k(await V(this,J,"f").query({query:E`query perspectiveSnapshot($uuid: String!) {
98
99
  perspectiveSnapshot(uuid: $uuid) {
99
- links { ${ct} }
100
+ links { ${ut} }
100
101
  }
101
- }`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectivePublishSnapshot($uuid: String!) {
102
+ }`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectivePublishSnapshot($uuid: String!) {
102
103
  perspectivePublishSnapshot(uuid: $uuid)
103
- }`,variables:{uuid:e}}));return r}async queryLinks(e,r){let{perspectiveQueryLinks:n}=I(await B(this,Z,"f").query({query:E`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
104
+ }`,variables:{uuid:e}}));return r}async queryLinks(e,r){let{perspectiveQueryLinks:n}=k(await V(this,J,"f").query({query:E`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
104
105
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
105
- ${ct}
106
+ ${ut}
106
107
  }
107
- }`,variables:{uuid:e,query:r}}));return n}async queryProlog(e,r){let{perspectiveQueryProlog:n}=I(await B(this,Z,"f").query({query:E`query perspectiveQueryProlog($uuid: String!, $query: String!) {
108
+ }`,variables:{uuid:e,query:r}}));return n}async queryProlog(e,r){let{perspectiveQueryProlog:n}=k(await V(this,J,"f").query({query:E`query perspectiveQueryProlog($uuid: String!, $query: String!) {
108
109
  perspectiveQueryProlog(uuid: $uuid, query: $query)
109
- }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async querySurrealDB(e,r){let{perspectiveQuerySurrealDb:n}=I(await B(this,Z,"f").query({query:E`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
110
+ }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async querySurrealDB(e,r){let{perspectiveQuerySurrealDb:n}=k(await V(this,J,"f").query({query:E`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
110
111
  perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
111
- }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async subscribeQuery(e,r){let{perspectiveSubscribeQuery:n}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
112
+ }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async subscribeQuery(e,r){let{perspectiveSubscribeQuery:n}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
112
113
  perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
113
114
  subscriptionId
114
115
  result
115
116
  }
116
- }`,variables:{uuid:e,query:r}})),{subscriptionId:i,result:a}=n,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:i,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,r){let{perspectiveSubscribeSurrealQuery:n}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
117
+ }`,variables:{uuid:e,query:r}})),{subscriptionId:i,result:a}=n,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:i,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,r){let{perspectiveSubscribeSurrealQuery:n}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
117
118
  perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
118
119
  subscriptionId
119
120
  result
120
121
  }
121
- }`,variables:{uuid:e,query:r}})),{subscriptionId:i,result:a}=n,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:i,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,r){let{perspectiveKeepAliveSurrealQuery:n}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
122
+ }`,variables:{uuid:e,query:r}})),{subscriptionId:i,result:a}=n,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:i,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,r){let{perspectiveKeepAliveSurrealQuery:n}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
122
123
  perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
123
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,r){let{perspectiveDisposeSurrealQuerySubscription:n}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
124
+ }`,variables:{uuid:e,subscriptionId:r}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,r){let{perspectiveDisposeSurrealQuerySubscription:n}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
124
125
  perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
125
- }`,variables:{uuid:e,subscriptionId:r}}));return n}subscribeToQueryUpdates(e,r){let n=B(this,Z,"f").subscribe({query:E`
126
+ }`,variables:{uuid:e,subscriptionId:r}}));return n}subscribeToQueryUpdates(e,r){let n=V(this,J,"f").subscribe({query:E`
126
127
  subscription perspectiveQuerySubscription($subscriptionId: String!) {
127
128
  perspectiveQuerySubscription(subscriptionId: $subscriptionId)
128
129
  }
129
- `,variables:{subscriptionId:e}}).subscribe({next:i=>{if(i.data&&i.data.perspectiveQuerySubscription){let a=i.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:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,r){let{perspectiveKeepAliveQuery:n}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
130
+ `,variables:{subscriptionId:e}}).subscribe({next:i=>{if(i.data&&i.data.perspectiveQuerySubscription){let a=i.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:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,r){let{perspectiveKeepAliveQuery:n}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
130
131
  perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
131
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async disposeQuerySubscription(e,r){let{perspectiveDisposeQuerySubscription:n}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
132
+ }`,variables:{uuid:e,subscriptionId:r}}));return n}async disposeQuerySubscription(e,r){let{perspectiveDisposeQuerySubscription:n}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
132
133
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
133
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async add(e){let{perspectiveAdd:r}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAdd($name: String!) {
134
+ }`,variables:{uuid:e,subscriptionId:r}}));return n}async add(e){let{perspectiveAdd:r}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveAdd($name: String!) {
134
135
  perspectiveAdd(name: $name) {
135
- ${ki}
136
+ ${Oi}
136
137
  }
137
- }`,variables:{name:e}}));return new $i(r,this)}async update(e,r){let{perspectiveUpdate:n}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveUpdate($uuid: String!, $name: String!) {
138
+ }`,variables:{name:e}}));return new Mi(r,this)}async update(e,r){let{perspectiveUpdate:n}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveUpdate($uuid: String!, $name: String!) {
138
139
  perspectiveUpdate(uuid: $uuid, name: $name) {
139
- ${ki}
140
+ ${Oi}
140
141
  }
141
- }`,variables:{uuid:e,name:r}}));return new $i(n,this)}async remove(e){return I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveRemove($uuid: String!) {
142
+ }`,variables:{uuid:e,name:r}}));return new Mi(n,this)}async remove(e){return k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveRemove($uuid: String!) {
142
143
  perspectiveRemove(uuid: $uuid)
143
- }`,variables:{uuid:e}}))}async addLink(e,r,n="shared",i){let{perspectiveAddLink:a}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
144
+ }`,variables:{uuid:e}}))}async addLink(e,r,n="shared",i){let{perspectiveAddLink:a}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
144
145
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
145
- ${ct}
146
+ ${ut}
146
147
  }
147
- }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async addLinks(e,r,n="shared",i){let{perspectiveAddLinks:a}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
148
+ }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async addLinks(e,r,n="shared",i){let{perspectiveAddLinks:a}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
148
149
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
149
- ${ct}
150
+ ${ut}
150
151
  }
151
- }`,variables:{uuid:e,links:r,status:n,batchId:i}}));return a}async removeLinks(e,r,n){let{perspectiveRemoveLinks:i}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
152
+ }`,variables:{uuid:e,links:r,status:n,batchId:i}}));return a}async removeLinks(e,r,n){let{perspectiveRemoveLinks:i}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
152
153
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
153
- ${ct}
154
+ ${ut}
154
155
  }
155
- }`,variables:{uuid:e,links:r,batchId:n}}));return i}async linkMutations(e,r,n){let{perspectiveLinkMutations:i}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
156
+ }`,variables:{uuid:e,links:r,batchId:n}}));return i}async linkMutations(e,r,n){let{perspectiveLinkMutations:i}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
156
157
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
157
158
  additions {
158
- ${ct}
159
+ ${ut}
159
160
  }
160
161
  removals {
161
- ${ct}
162
+ ${ut}
162
163
  }
163
164
  }
164
- }`,variables:{uuid:e,mutations:r,status:n}}));return i}async addLinkExpression(e,r,n="shared",i){let{perspectiveAddLinkExpression:a}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
165
+ }`,variables:{uuid:e,mutations:r,status:n}}));return i}async addLinkExpression(e,r,n="shared",i){let{perspectiveAddLinkExpression:a}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
165
166
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
166
- ${ct}
167
+ ${ut}
167
168
  }
168
- }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async updateLink(e,r,n,i){let{perspectiveUpdateLink:a}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
169
+ }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async updateLink(e,r,n,i){let{perspectiveUpdateLink:a}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
169
170
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
170
- ${ct}
171
+ ${ut}
171
172
  }
172
- }`,variables:{uuid:e,oldLink:r,newLink:n,batchId:i}}));return a}async removeLink(e,r,n){delete r.__typename,delete r.data.__typename,delete r.proof.__typename,delete r.status;let{perspectiveRemoveLink:i}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
173
+ }`,variables:{uuid:e,oldLink:r,newLink:n,batchId:i}}));return a}async removeLink(e,r,n){delete r.__typename,delete r.data.__typename,delete r.proof.__typename,delete r.status;let{perspectiveRemoveLink:i}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
173
174
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
174
- }`,variables:{uuid:e,link:r,batchId:n}}));return i}async addSdna(e,r,n,i){return I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
175
+ }`,variables:{uuid:e,link:r,batchId:n}}));return i}async addSdna(e,r,n,i){return k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
175
176
  perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType)
176
- }`,variables:{uuid:e,name:r,sdnaCode:n,sdnaType:i}})).perspectiveAddSdna}async executeCommands(e,r,n,i,a){return I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
177
+ }`,variables:{uuid:e,name:r,sdnaCode:n,sdnaType:i}})).perspectiveAddSdna}async executeCommands(e,r,n,i,a){return k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
177
178
  perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
178
- }`,variables:{uuid:e,commands:r,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,r,n,i,a){return I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
179
+ }`,variables:{uuid:e,commands:r,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,r,n,i,a){return k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
179
180
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
180
- }`,variables:{uuid:e,subjectClass:r,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,r,n){return I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
181
+ }`,variables:{uuid:e,subjectClass:r,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,r,n){return k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
181
182
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
182
- }`,variables:{uuid:e,subjectClass:r,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await B(this,Ra,"f").get(e)}async createExpression(e,r){return await B(this,Ra,"f").create(e,r)}addPerspectiveAddedListener(e){B(this,Da,"f").push(e)}subscribePerspectiveAdded(){B(this,Z,"f").subscribe({query:E` subscription {
183
- perspectiveAdded { ${ki} }
183
+ }`,variables:{uuid:e,subjectClass:r,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await V(this,Fa,"f").get(e)}async createExpression(e,r){return await V(this,Fa,"f").create(e,r)}addPerspectiveAddedListener(e){V(this,Pa,"f").push(e)}subscribePerspectiveAdded(){V(this,J,"f").subscribe({query:E` subscription {
184
+ perspectiveAdded { ${Oi} }
184
185
  }
185
- `}).subscribe({next:e=>{B(this,Da,"f").forEach(r=>{r(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){B(this,Na,"f").push(e)}subscribePerspectiveUpdated(){B(this,Z,"f").subscribe({query:E` subscription {
186
- perspectiveUpdated { ${ki} }
186
+ `}).subscribe({next:e=>{V(this,Pa,"f").forEach(r=>{r(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){V(this,$a,"f").push(e)}subscribePerspectiveUpdated(){V(this,J,"f").subscribe({query:E` subscription {
187
+ perspectiveUpdated { ${Oi} }
187
188
  }
188
- `}).subscribe({next:e=>{B(this,Na,"f").forEach(r=>{r(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){B(this,Os,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,r){B(this,Z,"f").subscribe({query:E` subscription {
189
+ `}).subscribe({next:e=>{V(this,$a,"f").forEach(r=>{r(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){V(this,Ls,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,r){V(this,J,"f").subscribe({query:E` subscription {
189
190
  perspectiveSyncStateChange(uuid: "${e}")
190
191
  }
191
- `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){B(this,Pa,"f").push(e)}subscribePerspectiveRemoved(){B(this,Z,"f").subscribe({query:E` subscription {
192
+ `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){V(this,La,"f").push(e)}subscribePerspectiveRemoved(){V(this,J,"f").subscribe({query:E` subscription {
192
193
  perspectiveRemoved
193
194
  }
194
- `}).subscribe({next:e=>{B(this,Pa,"f").forEach(r=>{r(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,r){B(this,Z,"f").subscribe({query:E` subscription {
195
- perspectiveLinkAdded(uuid: "${e}") { ${ct} }
195
+ `}).subscribe({next:e=>{V(this,La,"f").forEach(r=>{r(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,r){V(this,J,"f").subscribe({query:E` subscription {
196
+ perspectiveLinkAdded(uuid: "${e}") { ${ut} }
196
197
  }
197
- `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,r){B(this,Z,"f").subscribe({query:E` subscription {
198
- perspectiveLinkRemoved(uuid: "${e}") { ${ct} }
198
+ `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,r){V(this,J,"f").subscribe({query:E` subscription {
199
+ perspectiveLinkRemoved(uuid: "${e}") { ${ut} }
199
200
  }
200
- `}).subscribe({next:n=>{r.forEach(i=>{n.data.perspectiveLinkRemoved.status||delete n.data.perspectiveLinkRemoved.status,i(n.data.perspectiveLinkRemoved)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkUpdatedListener(e,r){B(this,Z,"f").subscribe({query:E` subscription {
201
+ `}).subscribe({next:n=>{r.forEach(i=>{n.data.perspectiveLinkRemoved.status||delete n.data.perspectiveLinkRemoved.status,i(n.data.perspectiveLinkRemoved)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkUpdatedListener(e,r){V(this,J,"f").subscribe({query:E` subscription {
201
202
  perspectiveLinkUpdated(uuid: "${e}") {
202
203
  oldLink {
203
- ${ct}
204
+ ${ut}
204
205
  }
205
206
  newLink {
206
- ${ct}
207
+ ${ut}
207
208
  }
208
209
  }
209
210
  }
210
- `}).subscribe({next:n=>{r.forEach(i=>{n.data.perspectiveLinkUpdated.newLink.status||delete n.data.perspectiveLinkUpdated.newLink.status,n.data.perspectiveLinkUpdated.oldLink.status||delete n.data.perspectiveLinkUpdated.oldLink.status,i(n.data.perspectiveLinkUpdated)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}getNeighbourhoodProxy(e){return new Cl(B(this,Ds,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:r}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveCreateBatch($uuid: String!) {
211
+ `}).subscribe({next:n=>{r.forEach(i=>{n.data.perspectiveLinkUpdated.newLink.status||delete n.data.perspectiveLinkUpdated.newLink.status,n.data.perspectiveLinkUpdated.oldLink.status||delete n.data.perspectiveLinkUpdated.oldLink.status,i(n.data.perspectiveLinkUpdated)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}getNeighbourhoodProxy(e){return new Il(V(this,Fs,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:r}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveCreateBatch($uuid: String!) {
211
212
  perspectiveCreateBatch(uuid: $uuid)
212
- }`,variables:{uuid:e}}));return r}async commitBatch(e,r){let{perspectiveCommitBatch:n}=I(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
213
+ }`,variables:{uuid:e}}));return r}async commitBatch(e,r){let{perspectiveCommitBatch:n}=k(await V(this,J,"f").mutate({mutation:E`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
213
214
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
214
215
  additions {
215
- ${ct}
216
+ ${ut}
216
217
  }
217
218
  removals {
218
- ${ct}
219
+ ${ut}
219
220
  }
220
221
  }
221
- }`,variables:{uuid:e,batchId:r}}));return n}};Z=new WeakMap,Da=new WeakMap,Na=new WeakMap,Pa=new WeakMap,Os=new WeakMap,Ra=new WeakMap,Ds=new WeakMap,Ns=new WeakMap;var ps=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ce=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ge,$a,La,Fa,xa=`
222
+ }`,variables:{uuid:e,batchId:r}}));return n}};J=new WeakMap,Pa=new WeakMap,$a=new WeakMap,La=new WeakMap,Ls=new WeakMap,Fa=new WeakMap,Fs=new WeakMap,Ms=new WeakMap;var ys=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},le=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ge,Ma,Ua,ja,Ia=`
222
223
  did
223
224
  directMessageLanguage
224
225
  perspective {
@@ -232,7 +233,7 @@ neighbourhood {
232
233
  }
233
234
  }
234
235
  }
235
- `,fs=`
236
+ `,vs=`
236
237
  requestId
237
238
  revoked
238
239
  auth {
@@ -248,128 +249,136 @@ neighbourhood {
248
249
  can
249
250
  }
250
251
  }
251
- `,Ii=`
252
+ `,Di=`
252
253
  isInitialized
253
254
  isUnlocked
254
255
  did
255
256
  didDocument
256
257
  error
257
- `,ds=`
258
+ `,bs=`
258
259
  did
259
260
  didSigningKeyId
260
261
  deviceKeyType
261
262
  deviceKey
262
263
  deviceKeySignedByDid
263
264
  didSignedByDeviceKey
264
- `,m0=`
265
+ `,w0=`
265
266
  signature
266
267
  publicKey
267
- `,Xa=class{constructor(e,r=!0){ge.set(this,void 0),$a.set(this,void 0),La.set(this,void 0),Fa.set(this,void 0),ps(this,ge,e,"f"),ps(this,La,[],"f"),ps(this,Fa,[],"f"),ps(this,$a,[],"f"),r&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=I(await ce(this,ge,"f").query({query:E`query agent { agent { ${xa} } }`})),r=new Yr(e.did,e.perspective);return r.directMessageLanguage=e.directMessageLanguage,r}async status(){let{agentStatus:e}=I(await ce(this,ge,"f").query({query:E`query agentStatus {
268
+ `,io=class{constructor(e,r=!0){ge.set(this,void 0),Ma.set(this,void 0),Ua.set(this,void 0),ja.set(this,void 0),ys(this,ge,e,"f"),ys(this,Ua,[],"f"),ys(this,ja,[],"f"),ys(this,Ma,[],"f"),r&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await le(this,ge,"f").query({query:E`query agent { agent { ${Ia} } }`})),r=new Yr(e.did,e.perspective);return r.directMessageLanguage=e.directMessageLanguage,r}async status(){let{agentStatus:e}=k(await le(this,ge,"f").query({query:E`query agentStatus {
268
269
  agentStatus {
269
- ${Ii}
270
+ ${Di}
270
271
  }
271
- }`}));return new Ft(e)}async generate(e){let{agentGenerate:r}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentGenerate(
272
+ }`}));return new Mt(e)}async generate(e){let{agentGenerate:r}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentGenerate(
272
273
  $passphrase: String!
273
274
  ) {
274
275
  agentGenerate(passphrase: $passphrase) {
275
- ${Ii}
276
+ ${Di}
276
277
  }
277
- }`,variables:{passphrase:e}}));return new Ft(r)}async import(e){let{did:r,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentImport(
278
+ }`,variables:{passphrase:e}}));return new Mt(r)}async import(e){let{did:r,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentImport(
278
279
  $did: String!,
279
280
  $didDocument: String!,
280
281
  $keystore: String!,
281
282
  $passphrase: String!
282
283
  ) {
283
284
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
284
- ${Ii}
285
+ ${Di}
285
286
  }
286
- }`,variables:{did:r,didDocument:n,keystore:i,passphrase:a}}));return new Ft(o)}async lock(e){let{agentLock:r}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentLock($passphrase: String!) {
287
+ }`,variables:{did:r,didDocument:n,keystore:i,passphrase:a}}));return new Mt(o)}async lock(e){let{agentLock:r}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentLock($passphrase: String!) {
287
288
  agentLock(passphrase: $passphrase) {
288
- ${Ii}
289
+ ${Di}
289
290
  }
290
- }`,variables:{passphrase:e}}));return new Ft(r)}async unlock(e,r=!0){let{agentUnlock:n}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
291
+ }`,variables:{passphrase:e}}));return new Mt(r)}async unlock(e,r=!0){let{agentUnlock:n}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
291
292
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
292
- ${Ii}
293
+ ${Di}
293
294
  }
294
- }`,variables:{passphrase:e,holochain:r}}));return new Ft(n)}async byDID(e){let{agentByDID:r}=I(await ce(this,ge,"f").query({query:E`query agentByDID($did: String!) {
295
+ }`,variables:{passphrase:e,holochain:r}}));return new Mt(n)}async byDID(e){let{agentByDID:r}=k(await le(this,ge,"f").query({query:E`query agentByDID($did: String!) {
295
296
  agentByDID(did: $did) {
296
- ${xa}
297
+ ${Ia}
297
298
  }
298
- }`,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:n}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
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:n}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
299
300
  agentUpdatePublicPerspective(perspective: $perspective) {
300
- ${xa}
301
+ ${Ia}
301
302
  }
302
- }`,variables:{perspective:r}})),i=n,a=new Yr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new Ys(ce(this,ge,"f")),n=new Xa(ce(this,ge,"f")),i=await r.add("Agent Perspective Proxy"),a=await n.me();a.perspective&&await i.loadSnapshot(a.perspective);for(let u of e.additions)await i.add(u);for(let u of e.removals)await i.remove(u);let o=await i.snapshot(),s=await this.updatePublicPerspective(o);return await r.remove(i.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:r}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
303
+ }`,variables:{perspective:r}})),i=n,a=new Yr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new ic(le(this,ge,"f")),n=new io(le(this,ge,"f")),i=await r.add("Agent Perspective Proxy"),a=await n.me();a.perspective&&await i.loadSnapshot(a.perspective);for(let u of e.additions)await i.add(u);for(let u of e.removals)await i.remove(u);let o=await i.snapshot(),s=await this.updatePublicPerspective(o);return await r.remove(i.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:r}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
303
304
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
304
- ${xa}
305
+ ${Ia}
305
306
  }
306
- }`,variables:{directMessageLanguage:e}})),n=r,i=new Yr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
307
+ }`,variables:{directMessageLanguage:e}})),n=r,i=new Yr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
307
308
  agentAddEntanglementProofs(proofs: $proofs) {
308
- ${ds}
309
+ ${bs}
309
310
  }
310
- }`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
311
+ }`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
311
312
  agentDeleteEntanglementProofs(proofs: $proofs) {
312
- ${ds}
313
+ ${bs}
313
314
  }
314
- }`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=I(await ce(this,ge,"f").query({query:E`query agentGetEntanglementProofs {
315
+ }`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await le(this,ge,"f").query({query:E`query agentGetEntanglementProofs {
315
316
  agentGetEntanglementProofs {
316
- ${ds}
317
+ ${bs}
317
318
  }
318
- }`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:n}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
319
+ }`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:n}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
319
320
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
320
- ${ds}
321
+ ${bs}
321
322
  }
322
- }`,variables:{deviceKey:e,deviceKeyType:r}}));return n}addUpdatedListener(e){ce(this,La,"f").push(e)}addAppChangedListener(e){ce(this,$a,"f").push(e)}subscribeAgentUpdated(){ce(this,ge,"f").subscribe({query:E` subscription {
323
- agentUpdated { ${xa} }
323
+ }`,variables:{deviceKey:e,deviceKeyType:r}}));return n}addUpdatedListener(e){le(this,Ua,"f").push(e)}addAppChangedListener(e){le(this,Ma,"f").push(e)}subscribeAgentUpdated(){le(this,ge,"f").subscribe({query:E` subscription {
324
+ agentUpdated { ${Ia} }
324
325
  }
325
- `}).subscribe({next:e=>{let r=e.data.agentUpdated;ce(this,La,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}subscribeAppsChanged(){ce(this,ge,"f").subscribe({query:E` subscription {
326
+ `}).subscribe({next:e=>{let r=e.data.agentUpdated;le(this,Ua,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}subscribeAppsChanged(){le(this,ge,"f").subscribe({query:E` subscription {
326
327
  agentAppsChanged {
327
- ${fs}
328
+ ${vs}
328
329
  }
329
330
  }
330
- `}).subscribe({next:e=>{ce(this,$a,"f").forEach(r=>{r()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){ce(this,Fa,"f").push(e)}subscribeAgentStatusChanged(){ce(this,ge,"f").subscribe({query:E` subscription {
331
- agentStatusChanged { ${Ii} }
331
+ `}).subscribe({next:e=>{le(this,Ma,"f").forEach(r=>{r()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){le(this,ja,"f").push(e)}subscribeAgentStatusChanged(){le(this,ge,"f").subscribe({query:E` subscription {
332
+ agentStatusChanged { ${Di} }
332
333
  }
333
- `}).subscribe({next:e=>{let r=e.data.agentStatusChanged;ce(this,Fa,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:r}=I(await ce(this,ge,"f").mutate({mutation:E`
334
+ `}).subscribe({next:e=>{let r=e.data.agentStatusChanged;le(this,ja,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:r}=k(await le(this,ge,"f").mutate({mutation:E`
334
335
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
335
336
  agentRequestCapability(authInfo: $authInfo)
336
337
  }
337
- `,variables:{authInfo:e}}));return r}async permitCapability(e){let{agentPermitCapability:r}=I(await ce(this,ge,"f").mutate({mutation:E`
338
+ `,variables:{authInfo:e}}));return r}async permitCapability(e){let{agentPermitCapability:r}=k(await le(this,ge,"f").mutate({mutation:E`
338
339
  mutation agentPermitCapability($auth: String!) {
339
340
  agentPermitCapability(auth: $auth)
340
341
  }
341
- `,variables:{auth:e}}));return r}async generateJwt(e,r){let{agentGenerateJwt:n}=I(await ce(this,ge,"f").mutate({mutation:E`
342
+ `,variables:{auth:e}}));return r}async generateJwt(e,r){let{agentGenerateJwt:n}=k(await le(this,ge,"f").mutate({mutation:E`
342
343
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
343
344
  agentGenerateJwt(requestId: $requestId, rand: $rand)
344
345
  }
345
- `,variables:{requestId:e,rand:r}}));return n}async getApps(){let{agentGetApps:e}=I(await ce(this,ge,"f").mutate({mutation:E`query agentGetApps {
346
+ `,variables:{requestId:e,rand:r}}));return n}async getApps(){let{agentGetApps:e}=k(await le(this,ge,"f").mutate({mutation:E`query agentGetApps {
346
347
  agentGetApps {
347
- ${fs}
348
+ ${vs}
348
349
  }
349
- }`}));return e}async removeApp(e){let{agentRemoveApp:r}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentRemoveApp($requestId: String!) {
350
+ }`}));return e}async removeApp(e){let{agentRemoveApp:r}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentRemoveApp($requestId: String!) {
350
351
  agentRemoveApp(requestId: $requestId) {
351
- ${fs}
352
+ ${vs}
352
353
  }
353
- }`,variables:{requestId:e}}));return r}async revokeToken(e){let{agentRevokeToken:r}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentRevokeToken($requestId: String!) {
354
+ }`,variables:{requestId:e}}));return r}async revokeToken(e){let{agentRevokeToken:r}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentRevokeToken($requestId: String!) {
354
355
  agentRevokeToken(requestId: $requestId) {
355
- ${fs}
356
+ ${vs}
356
357
  }
357
- }`,variables:{requestId:e}}));return r}async isLocked(){let{agentIsLocked:e}=I(await ce(this,ge,"f").mutate({mutation:E`
358
+ }`,variables:{requestId:e}}));return r}async isLocked(){let{agentIsLocked:e}=k(await le(this,ge,"f").mutate({mutation:E`
358
359
  query agentIsLocked {
359
360
  agentIsLocked
360
361
  }
361
- `}));return e}async signMessage(e){let{agentSignMessage:r}=I(await ce(this,ge,"f").mutate({mutation:E`mutation agentSignMessage($message: String!) {
362
+ `}));return e}async signMessage(e){let{agentSignMessage:r}=k(await le(this,ge,"f").mutate({mutation:E`mutation agentSignMessage($message: String!) {
362
363
  agentSignMessage(message: $message) {
363
- ${m0}
364
+ ${w0}
364
365
  }
365
- }`,variables:{message:e}}));return r}};ge=new WeakMap,$a=new WeakMap,La=new WeakMap,Fa=new WeakMap;var g0=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},zr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Wt,Kd=`
366
+ }`,variables:{message:e}}));return r}async createUser(e,r){let{runtimeCreateUser:n}=k(await le(this,ge,"f").mutate({mutation:E`mutation runtimeCreateUser($email: String!, $password: String!) {
367
+ runtimeCreateUser(email: $email, password: $password) {
368
+ did
369
+ success
370
+ error
371
+ }
372
+ }`,variables:{email:e,password:r}}));return n}async loginUser(e,r){let{runtimeLoginUser:n}=k(await le(this,ge,"f").mutate({mutation:E`mutation runtimeLoginUser($email: String!, $password: String!) {
373
+ runtimeLoginUser(email: $email, password: $password)
374
+ }`,variables:{email:e,password:r}}));return n}};ge=new WeakMap,Ma=new WeakMap,Ua=new WeakMap,ja=new WeakMap;var S0=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},zr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ht,th=`
366
375
  name
367
376
  address
368
377
  settings
369
378
  icon { code }
370
379
  constructorIcon { code }
371
380
  settingsIcon { code }
372
- `,Zd=`
381
+ `,rh=`
373
382
  name
374
383
  address
375
384
  description
@@ -379,45 +388,45 @@ neighbourhood {
379
388
  templateAppliedParams
380
389
  possibleTemplateParams
381
390
  sourceCodeLink
382
- `,xl=class{constructor(e){Wt.set(this,void 0),g0(this,Wt,e,"f")}async byAddress(e){let{language:r}=I(await zr(this,Wt,"f").query({query:E`query byAddress($address: String!) {
391
+ `,Ol=class{constructor(e){Ht.set(this,void 0),S0(this,Ht,e,"f")}async byAddress(e){let{language:r}=k(await zr(this,Ht,"f").query({query:E`query byAddress($address: String!) {
383
392
  language(address: $address) {
384
- ${Kd}
393
+ ${th}
385
394
  }
386
- }`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=I(await zr(this,Wt,"f").query({query:E`query byFilter($filter: String!) {
395
+ }`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=k(await zr(this,Ht,"f").query({query:E`query byFilter($filter: String!) {
387
396
  languages(filter: $filter) {
388
- ${Kd}
397
+ ${th}
389
398
  }
390
- }`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:n}=I(await zr(this,Wt,"f").mutate({mutation:E`mutation writeSettings($languageAddress: String!, $settings: String!) {
399
+ }`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:n}=k(await zr(this,Ht,"f").mutate({mutation:E`mutation writeSettings($languageAddress: String!, $settings: String!) {
391
400
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
392
- }`,variables:{languageAddress:e,settings:r}}));return n}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:n}=I(await zr(this,Wt,"f").mutate({mutation:E`mutation languageApplyTemplateAndPublish(
401
+ }`,variables:{languageAddress:e,settings:r}}));return n}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:n}=k(await zr(this,Ht,"f").mutate({mutation:E`mutation languageApplyTemplateAndPublish(
393
402
  $sourceLanguageHash: String!,
394
403
  $templateData: String!,
395
404
  ) {
396
405
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
397
406
  name, address
398
407
  }
399
- }`,variables:{sourceLanguageHash:e,templateData:r}}));return n}async publish(e,r){let{languagePublish:n}=I(await zr(this,Wt,"f").mutate({mutation:E`mutation languagePublish(
408
+ }`,variables:{sourceLanguageHash:e,templateData:r}}));return n}async publish(e,r){let{languagePublish:n}=k(await zr(this,Ht,"f").mutate({mutation:E`mutation languagePublish(
400
409
  $languagePath: String!,
401
410
  $languageMeta: LanguageMetaInput!,
402
411
  ) {
403
412
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
404
- ${Zd}
413
+ ${rh}
405
414
  }
406
- }`,variables:{languagePath:e,languageMeta:r}}));return n}async meta(e){let{languageMeta:r}=I(await zr(this,Wt,"f").query({query:E`query languageMeta(
415
+ }`,variables:{languagePath:e,languageMeta:r}}));return n}async meta(e){let{languageMeta:r}=k(await zr(this,Ht,"f").query({query:E`query languageMeta(
407
416
  $address: String!,
408
417
  ) {
409
418
  languageMeta(address: $address) {
410
- ${Zd}
419
+ ${rh}
411
420
  }
412
- }`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=I(await zr(this,Wt,"f").query({query:E`query languageSource(
421
+ }`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=k(await zr(this,Ht,"f").query({query:E`query languageSource(
413
422
  $address: String!,
414
423
  ) {
415
424
  languageSource(address: $address)
416
- }`,variables:{address:e}}));return r}async remove(e){let{languageRemove:r}=I(await zr(this,Wt,"f").mutate({mutation:E`mutation languageRemove(
425
+ }`,variables:{address:e}}));return r}async remove(e){let{languageRemove:r}=k(await zr(this,Ht,"f").mutate({mutation:E`mutation languageRemove(
417
426
  $address: String!,
418
427
  ) {
419
428
  languageRemove(address: $address)
420
- }`,variables:{address:e}}));return r}};Wt=new WeakMap;var y0=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},it=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},pt,Ri,Al=class{constructor(e){pt.set(this,void 0),Ri.set(this,new Map),y0(this,pt,e,"f")}async publishFromPerspective(e,r,n){let{neighbourhoodPublishFromPerspective:i}=I(await it(this,pt,"f").mutate({mutation:E`mutation neighbourhoodPublishFromPerspective(
429
+ }`,variables:{address:e}}));return r}};Ht=new WeakMap;var C0=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},at=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ft,Fi,Dl=class{constructor(e){ft.set(this,void 0),Fi.set(this,new Map),C0(this,ft,e,"f")}async publishFromPerspective(e,r,n){let{neighbourhoodPublishFromPerspective:i}=k(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodPublishFromPerspective(
421
430
  $linkLanguage: String!,
422
431
  $meta: PerspectiveInput!,
423
432
  $perspectiveUUID: String!
@@ -427,7 +436,7 @@ neighbourhood {
427
436
  meta: $meta,
428
437
  perspectiveUUID: $perspectiveUUID
429
438
  )
430
- }`,variables:{perspectiveUUID:e,linkLanguage:r,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=I(await it(this,pt,"f").mutate({mutation:E`mutation neighbourhoodJoinFromUrl($url: String!) {
439
+ }`,variables:{perspectiveUUID:e,linkLanguage:r,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=k(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodJoinFromUrl($url: String!) {
431
440
  neighbourhoodJoinFromUrl(url: $url) {
432
441
  uuid
433
442
  name
@@ -449,11 +458,11 @@ neighbourhood {
449
458
  author
450
459
  }
451
460
  }
452
- }`,variables:{url:e}}));return r}async otherAgents(e){let{neighbourhoodOtherAgents:r}=I(await it(this,pt,"f").query({query:E`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
461
+ }`,variables:{url:e}}));return r}async otherAgents(e){let{neighbourhoodOtherAgents:r}=k(await at(this,ft,"f").query({query:E`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
453
462
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
454
- }`,variables:{perspectiveUUID:e}}));return r}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:r}=I(await it(this,pt,"f").query({query:E`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
463
+ }`,variables:{perspectiveUUID:e}}));return r}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:r}=k(await at(this,ft,"f").query({query:E`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
455
464
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
456
- }`,variables:{perspectiveUUID:e}}));return r}async onlineAgents(e){let{neighbourhoodOnlineAgents:r}=I(await it(this,pt,"f").query({query:E`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
465
+ }`,variables:{perspectiveUUID:e}}));return r}async onlineAgents(e){let{neighbourhoodOnlineAgents:r}=k(await at(this,ft,"f").query({query:E`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
457
466
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
458
467
  did
459
468
  status {
@@ -470,7 +479,7 @@ neighbourhood {
470
479
  proof { valid, invalid, signature, key }
471
480
  }
472
481
  }
473
- }`,variables:{perspectiveUUID:e}}));return r}async setOnlineStatus(e,r){let{neighbourhoodSetOnlineStatus:n}=I(await it(this,pt,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatus(
482
+ }`,variables:{perspectiveUUID:e}}));return r}async setOnlineStatus(e,r){let{neighbourhoodSetOnlineStatus:n}=k(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatus(
474
483
  $perspectiveUUID: String!,
475
484
  $status: PerspectiveInput!
476
485
  ) {
@@ -478,7 +487,7 @@ neighbourhood {
478
487
  perspectiveUUID: $perspectiveUUID,
479
488
  status: $status
480
489
  )
481
- }`,variables:{perspectiveUUID:e,status:r}}));return n}async setOnlineStatusU(e,r){let{neighbourhoodSetOnlineStatusU:n}=I(await it(this,pt,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatusU(
490
+ }`,variables:{perspectiveUUID:e,status:r}}));return n}async setOnlineStatusU(e,r){let{neighbourhoodSetOnlineStatusU:n}=k(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatusU(
482
491
  $perspectiveUUID: String!,
483
492
  $status: PerspectiveUnsignedInput!
484
493
  ) {
@@ -486,7 +495,7 @@ neighbourhood {
486
495
  perspectiveUUID: $perspectiveUUID,
487
496
  status: $status
488
497
  )
489
- }`,variables:{perspectiveUUID:e,status:r}}));return n}async sendSignal(e,r,n){let{neighbourhoodSendSignal:i}=I(await it(this,pt,"f").mutate({mutation:E`mutation neighbourhoodSendSignal(
498
+ }`,variables:{perspectiveUUID:e,status:r}}));return n}async sendSignal(e,r,n){let{neighbourhoodSendSignal:i}=k(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSendSignal(
490
499
  $perspectiveUUID: String!,
491
500
  $remoteAgentDid: String!,
492
501
  $payload: PerspectiveInput!
@@ -496,7 +505,7 @@ neighbourhood {
496
505
  remoteAgentDid: $remoteAgentDid,
497
506
  payload: $payload
498
507
  )
499
- }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendSignalU(e,r,n){let{neighbourhoodSendSignalU:i}=I(await it(this,pt,"f").mutate({mutation:E`mutation neighbourhoodSendSignalU(
508
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendSignalU(e,r,n){let{neighbourhoodSendSignalU:i}=k(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSendSignalU(
500
509
  $perspectiveUUID: String!,
501
510
  $remoteAgentDid: String!,
502
511
  $payload: PerspectiveUnsignedInput!
@@ -506,7 +515,7 @@ neighbourhood {
506
515
  remoteAgentDid: $remoteAgentDid,
507
516
  payload: $payload
508
517
  )
509
- }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r,n=!1){let{neighbourhoodSendBroadcast:i}=I(await it(this,pt,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
518
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r,n=!1){let{neighbourhoodSendBroadcast:i}=k(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
510
519
  $perspectiveUUID: String!,
511
520
  $payload: PerspectiveInput!,
512
521
  $loopback: Boolean
@@ -516,7 +525,7 @@ neighbourhood {
516
525
  payload: $payload,
517
526
  loopback: $loopback
518
527
  )
519
- }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}async sendBroadcastU(e,r,n=!1){let{neighbourhoodSendBroadcastU:i}=I(await it(this,pt,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
528
+ }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}async sendBroadcastU(e,r,n=!1){let{neighbourhoodSendBroadcastU:i}=k(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
520
529
  $perspectiveUUID: String!,
521
530
  $payload: PerspectiveUnsignedInput!,
522
531
  $loopback: Boolean
@@ -526,7 +535,7 @@ neighbourhood {
526
535
  payload: $payload,
527
536
  loopback: $loopback
528
537
  )
529
- }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}dispatchSignal(e,r){let n=it(this,Ri,"f").get(e);n&&n.forEach(i=>i(r))}async subscribeToSignals(e){let r=this;await it(this,pt,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
538
+ }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}dispatchSignal(e,r){let n=at(this,Fi,"f").get(e);n&&n.forEach(i=>i(r))}async subscribeToSignals(e){let r=this;await at(this,ft,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
530
539
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
531
540
  author
532
541
  timestamp
@@ -541,7 +550,7 @@ neighbourhood {
541
550
  }
542
551
  proof { valid, invalid, signature, key }
543
552
  }
544
- }`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{let{neighbourhoodSignal:i}=I(n);r.dispatchSignal(e,i)}})}async addSignalHandler(e,r){let n=it(this,Ri,"f").get(e);n||(n=[],it(this,Ri,"f").set(e,n),await this.subscribeToSignals(e)),n.push(r)}removeSignalHandler(e,r){let n=it(this,Ri,"f").get(e);if(n){let i=n.indexOf(r);i>-1&&n.splice(i,1)}}};pt=new WeakMap,Ri=new WeakMap;var hs=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},K=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ee,Ma,ja,Ua,g1,ms=`
553
+ }`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{let{neighbourhoodSignal:i}=k(n);r.dispatchSignal(e,i)}})}async addSignalHandler(e,r){let n=at(this,Fi,"f").get(e);n||(n=[],at(this,Fi,"f").set(e,n),await this.subscribeToSignals(e)),n.push(r)}removeSignalHandler(e,r){let n=at(this,Fi,"f").get(e);if(n){let i=n.indexOf(r);i>-1&&n.splice(i,1)}}};ft=new WeakMap,Fi=new WeakMap;var _s=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},K=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Y,qa,Ba,Va,S1,ws=`
545
554
  author
546
555
  timestamp
547
556
  data {
@@ -553,7 +562,7 @@ data {
553
562
  }
554
563
  }
555
564
  proof { valid, invalid, signature, key }
556
- `,v0=`
565
+ `,E0=`
557
566
  description
558
567
  appName
559
568
  appUrl
@@ -562,72 +571,72 @@ trigger
562
571
  perspectiveIds
563
572
  webhookUrl
564
573
  webhookAuth
565
- `,y1=`
574
+ `,C1=`
566
575
  id
567
576
  granted
568
- ${v0}
569
- `,b0=`
570
- notification { ${y1} }
577
+ ${E0}
578
+ `,x0=`
579
+ notification { ${C1} }
571
580
  perspectiveId
572
581
  triggerMatch
573
- `,kl=class{constructor(e,r=!0){ee.set(this,void 0),Ma.set(this,void 0),ja.set(this,void 0),Ua.set(this,void 0),g1.set(this,void 0),hs(this,ee,e,"f"),hs(this,Ma,[],"f"),hs(this,ja,[],"f"),hs(this,Ua,[],"f"),r&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=I(await K(this,ee,"f").query({query:E`query runtimeInfo {
582
+ `,Nl=class{constructor(e,r=!0){Y.set(this,void 0),qa.set(this,void 0),Ba.set(this,void 0),Va.set(this,void 0),S1.set(this,void 0),_s(this,Y,e,"f"),_s(this,qa,[],"f"),_s(this,Ba,[],"f"),_s(this,Va,[],"f"),r&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await K(this,Y,"f").query({query:E`query runtimeInfo {
574
583
  runtimeInfo {
575
584
  ad4mExecutorVersion,
576
585
  isInitialized,
577
586
  isUnlocked
578
587
  }
579
- }`}));return e}async quit(){return I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeOpenLink($url: String!) {
588
+ }`}));return e}async quit(){return k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeOpenLink($url: String!) {
580
589
  runtimeOpenLink(url: $url)
581
- }`,variables:{url:e}}));return r}async addTrustedAgents(e){let{addTrustedAgents:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation addTrustedAgents($agents: [String!]!) {
590
+ }`,variables:{url:e}}));return r}async addTrustedAgents(e){let{addTrustedAgents:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation addTrustedAgents($agents: [String!]!) {
582
591
  addTrustedAgents(agents: $agents)
583
- }`,variables:{agents:e}}));return r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation deleteTrustedAgents($agents: [String!]!) {
592
+ }`,variables:{agents:e}}));return r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation deleteTrustedAgents($agents: [String!]!) {
584
593
  deleteTrustedAgents(agents: $agents)
585
- }`,variables:{agents:e}}));return r}async getTrustedAgents(){let{getTrustedAgents:e}=I(await K(this,ee,"f").query({query:E`query getTrustedAgents {
594
+ }`,variables:{agents:e}}));return r}async getTrustedAgents(){let{getTrustedAgents:e}=k(await K(this,Y,"f").query({query:E`query getTrustedAgents {
586
595
  getTrustedAgents
587
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
596
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
588
597
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
589
- }`,variables:{addresses:e}}));return r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
598
+ }`,variables:{addresses:e}}));return r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
590
599
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
591
- }`,variables:{addresses:e}}));return r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=I(await K(this,ee,"f").query({query:E`query runtimeKnownLinkLanguageTemplates {
600
+ }`,variables:{addresses:e}}));return r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await K(this,Y,"f").query({query:E`query runtimeKnownLinkLanguageTemplates {
592
601
  runtimeKnownLinkLanguageTemplates
593
- }`}));return e}async addFriends(e){let{runtimeAddFriends:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeAddFriends($dids: [String!]!) {
602
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeAddFriends($dids: [String!]!) {
594
603
  runtimeAddFriends(dids: $dids)
595
- }`,variables:{dids:e}}));return r}async removeFriends(e){let{runtimeRemoveFriends:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeRemoveFriends($dids: [String!]!) {
604
+ }`,variables:{dids:e}}));return r}async removeFriends(e){let{runtimeRemoveFriends:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeRemoveFriends($dids: [String!]!) {
596
605
  runtimeRemoveFriends(dids: $dids)
597
- }`,variables:{dids:e}}));return r}async friends(){let{runtimeFriends:e}=I(await K(this,ee,"f").query({query:E`query runtimeFriends {
606
+ }`,variables:{dids:e}}));return r}async friends(){let{runtimeFriends:e}=k(await K(this,Y,"f").query({query:E`query runtimeFriends {
598
607
  runtimeFriends
599
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=I(await K(this,ee,"f").query({query:E`query runtimeHcAgentInfos {
608
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await K(this,Y,"f").query({query:E`query runtimeHcAgentInfos {
600
609
  runtimeHcAgentInfos
601
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=I(await K(this,ee,"f").query({query:E`query runtimeGetNetworkMetrics {
610
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await K(this,Y,"f").query({query:E`query runtimeGetNetworkMetrics {
602
611
  runtimeGetNetworkMetrics
603
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeRestartHolochain {
612
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeRestartHolochain {
604
613
  runtimeRestartHolochain
605
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
614
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
606
615
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
607
- }`,variables:{agentInfos:e}}));return r}async verifyStringSignedByDid(e,r,n,i){let{runtimeVerifyStringSignedByDid:a}=I(await K(this,ee,"f").mutate({mutation:E`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
616
+ }`,variables:{agentInfos:e}}));return r}async verifyStringSignedByDid(e,r,n,i){let{runtimeVerifyStringSignedByDid:a}=k(await K(this,Y,"f").mutate({mutation:E`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
608
617
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
609
- }`,variables:{did:e,didSigningKeyId:r,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeSetStatus($status: PerspectiveInput!) {
618
+ }`,variables:{did:e,didSigningKeyId:r,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeSetStatus($status: PerspectiveInput!) {
610
619
  runtimeSetStatus(status: $status)
611
- }`,variables:{status:e}}));return r}async friendStatus(e){let{runtimeFriendStatus:r}=I(await K(this,ee,"f").query({query:E`query runtimeFriendStatus($did: String!) {
612
- runtimeFriendStatus(did: $did) { ${ms} }
613
- }`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:n}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
620
+ }`,variables:{status:e}}));return r}async friendStatus(e){let{runtimeFriendStatus:r}=k(await K(this,Y,"f").query({query:E`query runtimeFriendStatus($did: String!) {
621
+ runtimeFriendStatus(did: $did) { ${ws} }
622
+ }`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:n}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
614
623
  runtimeFriendSendMessage(did: $did, message: $message)
615
- }`,variables:{did:e,message:r}}));return n}async messageInbox(e){let{runtimeMessageInbox:r}=I(await K(this,ee,"f").query({query:E`query runtimeMessageInbox($filter: String) {
616
- runtimeMessageInbox(filter: $filter) { ${ms} }
617
- }`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=I(await K(this,ee,"f").query({query:E`query runtimeMessageOutbox($filter: String) {
624
+ }`,variables:{did:e,message:r}}));return n}async messageInbox(e){let{runtimeMessageInbox:r}=k(await K(this,Y,"f").query({query:E`query runtimeMessageInbox($filter: String) {
625
+ runtimeMessageInbox(filter: $filter) { ${ws} }
626
+ }`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=k(await K(this,Y,"f").query({query:E`query runtimeMessageOutbox($filter: String) {
618
627
  runtimeMessageOutbox(filter: $filter) {
619
628
  recipient,
620
629
  message {
621
- ${ms}
630
+ ${ws}
622
631
  }
623
632
  }
624
- }`,variables:{filter:e}}));return r}async requestInstallNotification(e){let{runtimeRequestInstallNotification:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
633
+ }`,variables:{filter:e}}));return r}async requestInstallNotification(e){let{runtimeRequestInstallNotification:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
625
634
  runtimeRequestInstallNotification(notification: $notification)
626
- }`,variables:{notification:e}}));return r}async grantNotification(e){let{runtimeGrantNotification:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeGrantNotification($id: String!) {
635
+ }`,variables:{notification:e}}));return r}async grantNotification(e){let{runtimeGrantNotification:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeGrantNotification($id: String!) {
627
636
  runtimeGrantNotification(id: $id)
628
- }`,variables:{id:e}}));return r}async exportDb(e){let{runtimeExportDb:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeExportDb($filePath: String!) {
637
+ }`,variables:{id:e}}));return r}async exportDb(e){let{runtimeExportDb:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeExportDb($filePath: String!) {
629
638
  runtimeExportDb(filePath: $filePath)
630
- }`,variables:{filePath:e}}));return r}async importDb(e){let{runtimeImportDb:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeImportDb($filePath: String!) {
639
+ }`,variables:{filePath:e}}));return r}async importDb(e){let{runtimeImportDb:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeImportDb($filePath: String!) {
631
640
  runtimeImportDb(filePath: $filePath) {
632
641
  perspectives { total imported failed omitted errors }
633
642
  links { total imported failed omitted errors }
@@ -641,30 +650,41 @@ triggerMatch
641
650
  trustedAgents { total imported failed omitted errors }
642
651
  knownLinkLanguages { total imported failed omitted errors }
643
652
  }
644
- }`,variables:{filePath:e}}));return r}async notifications(){let{runtimeNotifications:e}=I(await K(this,ee,"f").query({query:E`query runtimeNotifications {
645
- runtimeNotifications { ${y1} }
646
- }`}));return e}async updateNotification(e,r){let{runtimeUpdateNotification:n}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
653
+ }`,variables:{filePath:e}}));return r}async notifications(){let{runtimeNotifications:e}=k(await K(this,Y,"f").query({query:E`query runtimeNotifications {
654
+ runtimeNotifications { ${C1} }
655
+ }`}));return e}async updateNotification(e,r){let{runtimeUpdateNotification:n}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
647
656
  runtimeUpdateNotification(id: $id, notification: $notification)
648
- }`,variables:{id:e,notification:r}}));return n}async removeNotification(e){let{runtimeRemoveNotification:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeRemoveNotification($id: String!) {
657
+ }`,variables:{id:e,notification:r}}));return n}async removeNotification(e){let{runtimeRemoveNotification:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeRemoveNotification($id: String!) {
649
658
  runtimeRemoveNotification(id: $id)
650
- }`,variables:{id:e}}));return r}async exportPerspective(e,r){let{runtimeExportPerspective:n}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
659
+ }`,variables:{id:e}}));return r}async exportPerspective(e,r){let{runtimeExportPerspective:n}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
651
660
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
652
- }`,variables:{perspectiveUuid:e,filePath:r}}));return n}async importPerspective(e){let{runtimeImportPerspective:r}=I(await K(this,ee,"f").mutate({mutation:E`mutation runtimeImportPerspective($filePath: String!) {
661
+ }`,variables:{perspectiveUuid:e,filePath:r}}));return n}async importPerspective(e){let{runtimeImportPerspective:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeImportPerspective($filePath: String!) {
653
662
  runtimeImportPerspective(filePath: $filePath)
654
- }`,variables:{filePath:e}}));return r}addNotificationTriggeredCallback(e){K(this,Ua,"f").push(e)}subscribeNotificationTriggered(){K(this,ee,"f").subscribe({query:E` subscription {
655
- runtimeNotificationTriggered { ${b0} }
663
+ }`,variables:{filePath:e}}));return r}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await K(this,Y,"f").query({query:E`query runtimeMultiUserEnabled {
664
+ runtimeMultiUserEnabled
665
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:r}=k(await K(this,Y,"f").mutate({mutation:E`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
666
+ runtimeSetMultiUserEnabled(enabled: $enabled)
667
+ }`,variables:{enabled:e}}));return r}async listUsers(){let{runtimeListUsers:e}=k(await K(this,Y,"f").query({query:E`query runtimeListUsers {
668
+ runtimeListUsers {
669
+ email
670
+ did
671
+ lastSeen
672
+ perspectiveCount
673
+ }
674
+ }`}));return e}addNotificationTriggeredCallback(e){K(this,Va,"f").push(e)}subscribeNotificationTriggered(){K(this,Y,"f").subscribe({query:E` subscription {
675
+ runtimeNotificationTriggered { ${x0} }
656
676
  }
657
- `}).subscribe({next:e=>{K(this,Ua,"f").forEach(r=>{r(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){K(this,Ma,"f").push(e)}subscribeMessageReceived(){K(this,ee,"f").subscribe({query:E` subscription {
658
- runtimeMessageReceived { ${ms} }
677
+ `}).subscribe({next:e=>{K(this,Va,"f").forEach(r=>{r(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){K(this,qa,"f").push(e)}subscribeMessageReceived(){K(this,Y,"f").subscribe({query:E` subscription {
678
+ runtimeMessageReceived { ${ws} }
659
679
  }
660
- `}).subscribe({next:e=>{K(this,Ma,"f").forEach(r=>{r(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){K(this,ja,"f").push(e)}subscribeExceptionOccurred(){K(this,ee,"f").subscribe({query:E` subscription {
680
+ `}).subscribe({next:e=>{K(this,qa,"f").forEach(r=>{r(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){K(this,Ba,"f").push(e)}subscribeExceptionOccurred(){K(this,Y,"f").subscribe({query:E` subscription {
661
681
  exceptionOccurred {
662
682
  title
663
683
  message
664
684
  type
665
685
  addon
666
686
  }
667
- }`}).subscribe({next:e=>{K(this,ja,"f").forEach(r=>{r(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};ee=new WeakMap,Ma=new WeakMap,ja=new WeakMap,Ua=new WeakMap,g1=new WeakMap;var _0=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ti=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Cr,Il=class{constructor(e){Cr.set(this,void 0),_0(this,Cr,e,"f")}async get(e,r=!1){if(!r)try{let i=St.fromUrl(e).get();if(typeof i=="object"&&i!==null&&"author"in i&&"timestamp"in i&&"data"in i&&"proof"in i)return i}catch{}let{expression:n}=I(await Ti(this,Cr,"f").query({query:E`query expression($url: String!) {
687
+ }`}).subscribe({next:e=>{K(this,Ba,"f").forEach(r=>{r(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};Y=new WeakMap,qa=new WeakMap,Ba=new WeakMap,Va=new WeakMap,S1=new WeakMap;var A0=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ni=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Cr,Rl=class{constructor(e){Cr.set(this,void 0),A0(this,Cr,e,"f")}async get(e,r=!1){if(!r)try{let i=St.fromUrl(e).get();if(typeof i=="object"&&i!==null&&"author"in i&&"timestamp"in i&&"data"in i&&"proof"in i)return i}catch{}let{expression:n}=k(await Ni(this,Cr,"f").query({query:E`query expression($url: String!) {
668
688
  expression(url: $url) {
669
689
  author
670
690
  timestamp
@@ -677,7 +697,7 @@ triggerMatch
677
697
  invalid
678
698
  }
679
699
  }
680
- }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:r}=I(await Ti(this,Cr,"f").query({query:E`query expressionMany($urls: [String!]!) {
700
+ }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:r}=k(await Ni(this,Cr,"f").query({query:E`query expressionMany($urls: [String!]!) {
681
701
  expressionMany(urls: $urls) {
682
702
  author
683
703
  timestamp
@@ -690,19 +710,19 @@ triggerMatch
690
710
  invalid
691
711
  }
692
712
  }
693
- }`,variables:{urls:e}}));return r}async getRaw(e){let{expressionRaw:r}=I(await Ti(this,Cr,"f").query({query:E`query expressionRaw($url: String!) {
713
+ }`,variables:{urls:e}}));return r}async getRaw(e){let{expressionRaw:r}=k(await Ni(this,Cr,"f").query({query:E`query expressionRaw($url: String!) {
694
714
  expressionRaw(url: $url)
695
- }`,variables:{url:e}}));return r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:n}=I(await Ti(this,Cr,"f").mutate({mutation:E`mutation expressionCreate($content: String!, $languageAddress: String!){
715
+ }`,variables:{url:e}}));return r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:n}=k(await Ni(this,Cr,"f").mutate({mutation:E`mutation expressionCreate($content: String!, $languageAddress: String!){
696
716
  expressionCreate(content: $content, languageAddress: $languageAddress)
697
- }`,variables:{content:e,languageAddress:r}}));return n}async interactions(e){let{expressionInteractions:r}=I(await Ti(this,Cr,"f").query({query:E`query expressionInteractions($url: String!) {
717
+ }`,variables:{content:e,languageAddress:r}}));return n}async interactions(e){let{expressionInteractions:r}=k(await Ni(this,Cr,"f").query({query:E`query expressionInteractions($url: String!) {
698
718
  expressionInteractions(url: $url) {
699
719
  label
700
720
  name
701
721
  parameters { name, type }
702
722
  }
703
- }`,variables:{url:e}}));return r}async interact(e,r){let{expressionInteract:n}=I(await Ti(this,Cr,"f").mutate({mutation:E`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
723
+ }`,variables:{url:e}}));return r}async interact(e,r){let{expressionInteract:n}=k(await Ni(this,Cr,"f").mutate({mutation:E`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
704
724
  expressionInteract(url: $url, interactionCall: $interactionCall)
705
- }`,variables:{url:e,interactionCall:r}}));return n}};Cr=new WeakMap;var fc={};fc.byteLength=w0;fc.toByteArray=E0;fc.fromByteArray=k0;var or=[],Lt=[],S0=typeof Uint8Array<"u"?Uint8Array:Array,el="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Tn=0,Jd=el.length;Tn<Jd;++Tn)or[Tn]=el[Tn],Lt[el.charCodeAt(Tn)]=Tn;var Tn,Jd;Lt["-".charCodeAt(0)]=62;Lt["_".charCodeAt(0)]=63;function v1(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 n=r===e?0:4-r%4;return[r,n]}function w0(t){var e=v1(t),r=e[0],n=e[1];return(r+n)*3/4-n}function C0(t,e,r){return(e+r)*3/4-r}function E0(t){var e,r=v1(t),n=r[0],i=r[1],a=new S0(C0(t,n,i)),o=0,s=i>0?n-4:n,u;for(u=0;u<s;u+=4)e=Lt[t.charCodeAt(u)]<<18|Lt[t.charCodeAt(u+1)]<<12|Lt[t.charCodeAt(u+2)]<<6|Lt[t.charCodeAt(u+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Lt[t.charCodeAt(u)]<<2|Lt[t.charCodeAt(u+1)]>>4,a[o++]=e&255),i===1&&(e=Lt[t.charCodeAt(u)]<<10|Lt[t.charCodeAt(u+1)]<<4|Lt[t.charCodeAt(u+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function x0(t){return or[t>>18&63]+or[t>>12&63]+or[t>>6&63]+or[t&63]}function A0(t,e,r){for(var n,i=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),i.push(x0(n));return i.join("")}function k0(t){for(var e,r=t.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(A0(t,o,o+a>s?s:o+a));return n===1?(e=t[r-1],i.push(or[e>>2]+or[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(or[e>>10]+or[e>>4&63]+or[e<<2&63]+"=")),i.join("")}var I0=4,Yd=0,Xd=1,T0=2;function Hi(t){let e=t.length;for(;--e>=0;)t[e]=0}var O0=0,b1=1,D0=2,N0=3,P0=258,Gl=29,po=256,eo=po+1+Gl,Li=30,Kl=19,_1=2*eo+1,Un=15,tl=16,R0=7,Zl=256,S1=16,w1=17,C1=18,Tl=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]),Ps=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]),$0=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),E1=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),L0=512,Er=new Array((eo+2)*2);Hi(Er);var Ha=new Array(Li*2);Hi(Ha);var to=new Array(L0);Hi(to);var ro=new Array(P0-N0+1);Hi(ro);var Jl=new Array(Gl);Hi(Jl);var Xs=new Array(Li);Hi(Xs);function rl(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}var x1,A1,k1;function nl(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}var I1=t=>t<256?to[t]:to[256+(t>>>7)],no=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},_t=(t,e,r)=>{t.bi_valid>tl-r?(t.bi_buf|=e<<t.bi_valid&65535,no(t,t.bi_buf),t.bi_buf=e>>tl-t.bi_valid,t.bi_valid+=r-tl):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},sr=(t,e,r)=>{_t(t,r[e*2],r[e*2+1])},T1=(t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},F0=t=>{t.bi_valid===16?(no(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)},M0=(t,e)=>{let r=e.dyn_tree,n=e.max_code,i=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<=Un;f++)t.bl_count[f]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<_1;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>n)&&(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*(i[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>n)&&(r[d*2+1]!==f&&(t.opt_len+=(f-r[d*2+1])*r[d*2],r[d*2+1]=f),l--)}},O1=(t,e,r)=>{let n=new Array(Un+1),i=0,a,o;for(a=1;a<=Un;a++)i=i+r[a-1]<<1,n[a]=i;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=T1(n[s]++,s))}},j0=()=>{let t,e,r,n,i,a=new Array(Un+1);for(r=0,n=0;n<Gl-1;n++)for(Jl[n]=r,t=0;t<1<<Tl[n];t++)ro[r++]=n;for(ro[r-1]=n,i=0,n=0;n<16;n++)for(Xs[n]=i,t=0;t<1<<Ps[n];t++)to[i++]=n;for(i>>=7;n<Li;n++)for(Xs[n]=i<<7,t=0;t<1<<Ps[n]-7;t++)to[256+i++]=n;for(e=0;e<=Un;e++)a[e]=0;for(t=0;t<=143;)Er[t*2+1]=8,t++,a[8]++;for(;t<=255;)Er[t*2+1]=9,t++,a[9]++;for(;t<=279;)Er[t*2+1]=7,t++,a[7]++;for(;t<=287;)Er[t*2+1]=8,t++,a[8]++;for(O1(Er,eo+1,a),t=0;t<Li;t++)Ha[t*2+1]=5,Ha[t*2]=T1(t,5);x1=new rl(Er,Tl,po+1,eo,Un),A1=new rl(Ha,Ps,0,Li,Un),k1=new rl(new Array(0),$0,0,Kl,R0)},D1=t=>{let e;for(e=0;e<eo;e++)t.dyn_ltree[e*2]=0;for(e=0;e<Li;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Kl;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Zl*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},N1=t=>{t.bi_valid>8?no(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},eh=(t,e,r,n)=>{let i=e*2,a=r*2;return t[i]<t[a]||t[i]===t[a]&&n[e]<=n[r]},il=(t,e,r)=>{let n=t.heap[r],i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&eh(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!eh(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},th=(t,e,r)=>{let n,i,a=0,o,s;if(t.sym_next!==0)do n=t.pending_buf[t.sym_buf+a++]&255,n+=(t.pending_buf[t.sym_buf+a++]&255)<<8,i=t.pending_buf[t.sym_buf+a++],n===0?sr(t,i,e):(o=ro[i],sr(t,o+po+1,e),s=Tl[o],s!==0&&(i-=Jl[o],_t(t,i,s)),n--,o=I1(n),sr(t,o,r),s=Ps[o],s!==0&&(n-=Xs[o],_t(t,n,s)));while(a<t.sym_next);sr(t,Zl,e)},Ol=(t,e)=>{let r=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,u=-1,c;for(t.heap_len=0,t.heap_max=_1,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--,i&&(t.static_len-=n[c*2+1]);for(e.max_code=u,o=t.heap_len>>1;o>=1;o--)il(t,r,o);c=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],il(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++,il(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],M0(t,e),O1(r,u,t.bl_count)},rh=(t,e,r)=>{let n,i=-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,n=0;n<=r;n++)a=o,o=e[(n+1)*2+1],!(++s<u&&a===o)&&(s<c?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[S1*2]++):s<=10?t.bl_tree[w1*2]++:t.bl_tree[C1*2]++,s=0,i=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4))},nh=(t,e,r)=>{let n,i=-1,a,o=e[0*2+1],s=0,u=7,c=4;for(o===0&&(u=138,c=3),n=0;n<=r;n++)if(a=o,o=e[(n+1)*2+1],!(++s<u&&a===o)){if(s<c)do sr(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(sr(t,a,t.bl_tree),s--),sr(t,S1,t.bl_tree),_t(t,s-3,2)):s<=10?(sr(t,w1,t.bl_tree),_t(t,s-3,3)):(sr(t,C1,t.bl_tree),_t(t,s-11,7));s=0,i=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4)}},U0=t=>{let e;for(rh(t,t.dyn_ltree,t.l_desc.max_code),rh(t,t.dyn_dtree,t.d_desc.max_code),Ol(t,t.bl_desc),e=Kl-1;e>=3&&t.bl_tree[E1[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},q0=(t,e,r,n)=>{let i;for(_t(t,e-257,5),_t(t,r-1,5),_t(t,n-4,4),i=0;i<n;i++)_t(t,t.bl_tree[E1[i]*2+1],3);nh(t,t.dyn_ltree,e-1),nh(t,t.dyn_dtree,r-1)},B0=t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return Yd;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Xd;for(r=32;r<po;r++)if(t.dyn_ltree[r*2]!==0)return Xd;return Yd},ih=!1,V0=t=>{ih||(j0(),ih=!0),t.l_desc=new nl(t.dyn_ltree,x1),t.d_desc=new nl(t.dyn_dtree,A1),t.bl_desc=new nl(t.bl_tree,k1),t.bi_buf=0,t.bi_valid=0,D1(t)},P1=(t,e,r,n)=>{_t(t,(O0<<1)+(n?1:0),3),N1(t),no(t,r),no(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},Q0=t=>{_t(t,b1<<1,3),sr(t,Zl,Er),F0(t)},z0=(t,e,r,n)=>{let i,a,o=0;t.level>0?(t.strm.data_type===T0&&(t.strm.data_type=B0(t)),Ol(t,t.l_desc),Ol(t,t.d_desc),o=U0(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&e!==-1?P1(t,e,r,n):t.strategy===I0||a===i?(_t(t,(b1<<1)+(n?1:0),3),th(t,Er,Ha)):(_t(t,(D0<<1)+(n?1:0),3),q0(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),th(t,t.dyn_ltree,t.dyn_dtree)),D1(t),n&&N1(t)},W0=(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[(ro[r]+po+1)*2]++,t.dyn_dtree[I1(e)*2]++),t.sym_next===t.sym_end),H0=V0,G0=P1,K0=z0,Z0=W0,J0=Q0,Y0={_tr_init:H0,_tr_stored_block:G0,_tr_flush_block:K0,_tr_tally:Z0,_tr_align:J0},X0=(t,e,r,n)=>{let i=t&65535|0,a=t>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+e[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},io=X0,ev=()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e},tv=new Uint32Array(ev()),rv=(t,e,r,n)=>{let i=tv,a=n+r;t^=-1;for(let o=n;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1},He=rv,Kn={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"},ii={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:nv,_tr_stored_block:Dl,_tr_flush_block:iv,_tr_tally:en,_tr_align:av}=Y0,{Z_NO_FLUSH:tn,Z_PARTIAL_FLUSH:ov,Z_FULL_FLUSH:sv,Z_FINISH:Mt,Z_BLOCK:ah,Z_OK:tt,Z_STREAM_END:oh,Z_STREAM_ERROR:ur,Z_DATA_ERROR:cv,Z_BUF_ERROR:al,Z_DEFAULT_COMPRESSION:uv,Z_FILTERED:lv,Z_HUFFMAN_ONLY:gs,Z_RLE:pv,Z_FIXED:fv,Z_DEFAULT_STRATEGY:dv,Z_UNKNOWN:hv,Z_DEFLATED:dc}=ii,mv=9,gv=15,yv=8,vv=29,bv=256,Nl=bv+1+vv,_v=30,Sv=19,wv=2*Nl+1,Cv=15,ne=3,Zr=258,lr=Zr+ne+1,Ev=32,Ui=42,Yl=57,Pl=69,Rl=73,$l=91,Ll=103,qn=113,qa=666,ft=1,Gi=2,Zn=3,Ki=4,xv=3,Bn=(t,e)=>(t.msg=Kn[e],e),sh=t=>t*2-(t>4?9:0),Kr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Av=t=>{let e,r,n,i=t.w_size;e=t.hash_size,n=e;do r=t.head[--n],t.head[n]=r>=i?r-i:0;while(--e);e=i,n=e;do r=t.prev[--n],t.prev[n]=r>=i?r-i:0;while(--e)},kv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,rn=kv,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))},It=(t,e)=>{iv(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,At(t.strm)},fe=(t,e)=>{t.pending_buf[t.pending++]=e},Aa=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Fl=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),t.state.wrap===1?t.adler=io(t.adler,e,i,r):t.state.wrap===2&&(t.adler=He(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},R1=(t,e)=>{let r=t.max_chain_length,n=t.strstart,i,a,o=t.prev_length,s=t.nice_match,u=t.strstart>t.w_size-lr?t.strstart-(t.w_size-lr):0,c=t.window,l=t.w_mask,d=t.prev,f=t.strstart+Zr,p=c[n+o-1],h=c[n+o];t.prev_length>=t.good_match&&(r>>=2),s>t.lookahead&&(s=t.lookahead);do if(i=e,!(c[i+o]!==h||c[i+o-1]!==p||c[i]!==c[n]||c[++i]!==c[n+1])){n+=2,i++;do;while(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]===c[++i]&&n<f);if(a=Zr-(f-n),n=f-Zr,a>o){if(t.match_start=e,o=a,a>=s)break;p=c[n+o-1],h=c[n+o]}}while((e=d[e&l])>u&&--r!==0);return o<=t.lookahead?o:t.lookahead},qi=t=>{let e=t.w_size,r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-lr)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Av(t),n+=e),t.strm.avail_in===0)break;if(r=Fl(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=ne)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=rn(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=rn(t,t.ins_h,t.window[i+ne-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<ne)););}while(t.lookahead<lr&&t.strm.avail_in!==0)},$1=(t,e)=>{let r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,n,i,a,o=0,s=t.strm.avail_in;do{if(n=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,i=t.strstart-t.block_start,n>i+t.strm.avail_in&&(n=i+t.strm.avail_in),n>a&&(n=a),n<r&&(n===0&&e!==Mt||e===tn||n!==i+t.strm.avail_in)))break;o=e===Mt&&n===i+t.strm.avail_in?1:0,Dl(t,0,0,o),t.pending_buf[t.pending-4]=n,t.pending_buf[t.pending-3]=n>>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,At(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Fl(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}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?Ki:e!==tn&&e!==Mt&&t.strm.avail_in===0&&t.strstart===t.block_start?Gi:(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&&(Fl(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,i=t.strstart-t.block_start,(i>=r||(i||e===Mt)&&e!==tn&&t.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Mt&&t.strm.avail_in===0&&n===i?1:0,Dl(t,t.block_start,n,o),t.block_start+=n,At(t.strm)),o?Zn:ft)},ol=(t,e)=>{let r,n;for(;;){if(t.lookahead<lr){if(qi(t),t.lookahead<lr&&e===tn)return ft;if(t.lookahead===0)break}if(r=0,t.lookahead>=ne&&(t.ins_h=rn(t,t.ins_h,t.window[t.strstart+ne-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-lr&&(t.match_length=R1(t,r)),t.match_length>=ne)if(n=en(t,t.strstart-t.match_start,t.match_length-ne),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ne){t.match_length--;do t.strstart++,t.ins_h=rn(t,t.ins_h,t.window[t.strstart+ne-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=rn(t,t.ins_h,t.window[t.strstart+1]);else n=en(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(It(t,!1),t.strm.avail_out===0))return ft}return t.insert=t.strstart<ne-1?t.strstart:ne-1,e===Mt?(It(t,!0),t.strm.avail_out===0?Zn:Ki):t.sym_next&&(It(t,!1),t.strm.avail_out===0)?ft:Gi},Oi=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<lr){if(qi(t),t.lookahead<lr&&e===tn)return ft;if(t.lookahead===0)break}if(r=0,t.lookahead>=ne&&(t.ins_h=rn(t,t.ins_h,t.window[t.strstart+ne-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=ne-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-lr&&(t.match_length=R1(t,r),t.match_length<=5&&(t.strategy===lv||t.match_length===ne&&t.strstart-t.match_start>4096)&&(t.match_length=ne-1)),t.prev_length>=ne&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ne,n=en(t,t.strstart-1-t.prev_match,t.prev_length-ne),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=rn(t,t.ins_h,t.window[t.strstart+ne-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=ne-1,t.strstart++,n&&(It(t,!1),t.strm.avail_out===0))return ft}else if(t.match_available){if(n=en(t,0,t.window[t.strstart-1]),n&&It(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return ft}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=en(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ne-1?t.strstart:ne-1,e===Mt?(It(t,!0),t.strm.avail_out===0?Zn:Ki):t.sym_next&&(It(t,!1),t.strm.avail_out===0)?ft:Gi},Iv=(t,e)=>{let r,n,i,a,o=t.window;for(;;){if(t.lookahead<=Zr){if(qi(t),t.lookahead<=Zr&&e===tn)return ft;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=ne&&t.strstart>0&&(i=t.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=t.strstart+Zr;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);t.match_length=Zr-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ne?(r=en(t,1,t.match_length-ne),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=en(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(It(t,!1),t.strm.avail_out===0))return ft}return t.insert=0,e===Mt?(It(t,!0),t.strm.avail_out===0?Zn:Ki):t.sym_next&&(It(t,!1),t.strm.avail_out===0)?ft:Gi},Tv=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(qi(t),t.lookahead===0)){if(e===tn)return ft;break}if(t.match_length=0,r=en(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(It(t,!1),t.strm.avail_out===0))return ft}return t.insert=0,e===Mt?(It(t,!0),t.strm.avail_out===0?Zn:Ki):t.sym_next&&(It(t,!1),t.strm.avail_out===0)?ft:Gi};function tr(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}var Ba=[new tr(0,0,0,0,$1),new tr(4,4,8,4,ol),new tr(4,5,16,8,ol),new tr(4,6,32,32,ol),new tr(4,4,16,16,Oi),new tr(8,16,32,32,Oi),new tr(8,16,128,128,Oi),new tr(8,32,128,256,Oi),new tr(32,128,258,1024,Oi),new tr(32,258,258,4096,Oi)],Ov=t=>{t.window_size=2*t.w_size,Kr(t.head),t.max_lazy_match=Ba[t.level].max_lazy,t.good_match=Ba[t.level].good_length,t.nice_match=Ba[t.level].nice_length,t.max_chain_length=Ba[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ne-1,t.match_available=0,t.ins_h=0};function Dv(){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=dc,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(wv*2),this.dyn_dtree=new Uint16Array((2*_v+1)*2),this.bl_tree=new Uint16Array((2*Sv+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(Cv+1),this.heap=new Uint16Array(2*Nl+1),Kr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Nl+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 fo=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==Ui&&e.status!==Yl&&e.status!==Pl&&e.status!==Rl&&e.status!==$l&&e.status!==Ll&&e.status!==qn&&e.status!==qa?1:0},L1=t=>{if(fo(t))return Bn(t,ur);t.total_in=t.total_out=0,t.data_type=hv;let e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Yl:e.wrap?Ui:qn,t.adler=e.wrap===2?0:1,e.last_flush=-2,nv(e),tt},F1=t=>{let e=L1(t);return e===tt&&Ov(t.state),e},Nv=(t,e)=>fo(t)||t.state.wrap!==2?ur:(t.state.gzhead=e,tt),M1=(t,e,r,n,i,a)=>{if(!t)return ur;let o=1;if(e===uv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>mv||r!==dc||n<8||n>15||e<0||e>9||a<0||a>fv||n===8&&o!==1)return Bn(t,ur);n===8&&(n=9);let s=new Dv;return t.state=s,s.strm=t,s.status=Ui,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ne-1)/ne),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<<i+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,F1(t)},Pv=(t,e)=>M1(t,e,dc,gv,yv,dv),Rv=(t,e)=>{if(fo(t)||e>ah||e<0)return t?Bn(t,ur):ur;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===qa&&e!==Mt)return Bn(t,t.avail_out===0?al:ur);let n=r.last_flush;if(r.last_flush=e,r.pending!==0){if(At(t),t.avail_out===0)return r.last_flush=-1,tt}else if(t.avail_in===0&&sh(e)<=sh(n)&&e!==Mt)return Bn(t,al);if(r.status===qa&&t.avail_in!==0)return Bn(t,al);if(r.status===Ui&&r.wrap===0&&(r.status=qn),r.status===Ui){let i=dc+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=gs||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=Ev),i+=31-i%31,Aa(r,i),r.strstart!==0&&(Aa(r,t.adler>>>16),Aa(r,t.adler&65535)),t.adler=1,r.status=qn,At(t),r.pending!==0)return r.last_flush=-1,tt}if(r.status===Yl){if(t.adler=0,fe(r,31),fe(r,139),fe(r,8),r.gzhead)fe(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)),fe(r,r.gzhead.time&255),fe(r,r.gzhead.time>>8&255),fe(r,r.gzhead.time>>16&255),fe(r,r.gzhead.time>>24&255),fe(r,r.level===9?2:r.strategy>=gs||r.level<2?4:0),fe(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(fe(r,r.gzhead.extra.length&255),fe(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=He(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Pl;else if(fe(r,0),fe(r,0),fe(r,0),fe(r,0),fe(r,0),fe(r,r.level===9?2:r.strategy>=gs||r.level<2?4:0),fe(r,xv),r.status=qn,At(t),r.pending!==0)return r.last_flush=-1,tt}if(r.status===Pl){if(r.gzhead.extra){let i=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>i&&(t.adler=He(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=s,At(t),r.pending!==0)return r.last_flush=-1,tt;i=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>i&&(t.adler=He(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Rl}if(r.status===Rl){if(r.gzhead.name){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=He(t.adler,r.pending_buf,r.pending-i,i)),At(t),r.pending!==0)return r.last_flush=-1,tt;i=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,fe(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=He(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=$l}if(r.status===$l){if(r.gzhead.comment){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=He(t.adler,r.pending_buf,r.pending-i,i)),At(t),r.pending!==0)return r.last_flush=-1,tt;i=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,fe(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=He(t.adler,r.pending_buf,r.pending-i,i))}r.status=Ll}if(r.status===Ll){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(At(t),r.pending!==0))return r.last_flush=-1,tt;fe(r,t.adler&255),fe(r,t.adler>>8&255),t.adler=0}if(r.status=qn,At(t),r.pending!==0)return r.last_flush=-1,tt}if(t.avail_in!==0||r.lookahead!==0||e!==tn&&r.status!==qa){let i=r.level===0?$1(r,e):r.strategy===gs?Tv(r,e):r.strategy===pv?Iv(r,e):Ba[r.level].func(r,e);if((i===Zn||i===Ki)&&(r.status=qa),i===ft||i===Zn)return t.avail_out===0&&(r.last_flush=-1),tt;if(i===Gi&&(e===ov?av(r):e!==ah&&(Dl(r,0,0,!1),e===sv&&(Kr(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,tt}return e!==Mt?tt:r.wrap<=0?oh:(r.wrap===2?(fe(r,t.adler&255),fe(r,t.adler>>8&255),fe(r,t.adler>>16&255),fe(r,t.adler>>24&255),fe(r,t.total_in&255),fe(r,t.total_in>>8&255),fe(r,t.total_in>>16&255),fe(r,t.total_in>>24&255)):(Aa(r,t.adler>>>16),Aa(r,t.adler&65535)),At(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?tt:oh)},$v=t=>{if(fo(t))return ur;let e=t.state.status;return t.state=null,e===qn?Bn(t,cv):tt},Lv=(t,e)=>{let r=e.length;if(fo(t))return ur;let n=t.state,i=n.wrap;if(i===2||i===1&&n.status!==Ui||n.lookahead)return ur;if(i===1&&(t.adler=io(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Kr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let u=new Uint8Array(n.w_size);u.set(e.subarray(r-n.w_size,r),0),e=u,r=n.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,qi(n);n.lookahead>=ne;){let u=n.strstart,c=n.lookahead-(ne-1);do n.ins_h=rn(n,n.ins_h,n.window[u+ne-1]),n.prev[u&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=u,u++;while(--c);n.strstart=u,n.lookahead=ne-1,qi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ne-1,n.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,n.wrap=i,tt},Fv=Pv,Mv=M1,jv=F1,Uv=L1,qv=Nv,Bv=Rv,Vv=$v,Qv=Lv,zv="pako deflate (from Nodeca project)",Ga={deflateInit:Fv,deflateInit2:Mv,deflateReset:jv,deflateResetKeep:Uv,deflateSetHeader:qv,deflate:Bv,deflateEnd:Vv,deflateSetDictionary:Qv,deflateInfo:zv},Wv=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),Hv=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 n in r)Wv(r,n)&&(t[n]=r[n])}}return t},Gv=t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;let r=new Uint8Array(e);for(let n=0,i=0,a=t.length;n<a;n++){let o=t[n];r.set(o,i),i+=o.length}return r},hc={assign:Hv,flattenChunks:Gv},j1=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){j1=!1}var ao=new Uint8Array(256);for(let t=0;t<256;t++)ao[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;ao[254]=ao[254]=1;var Kv=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,r,n,i,a,o=t.length,s=0;for(i=0;i<o;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),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},Zv=(t,e)=>{if(e<65534&&t.subarray&&j1)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r},Jv=(t,e)=>{let r=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let n,i,a=new Array(r*2);for(i=0,n=0;n<r;){let o=t[n++];if(o<128){a[i++]=o;continue}let s=ao[o];if(s>4){a[i++]=65533,n+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&n<r;)o=o<<6|t[n++]&63,s--;if(s>1){a[i++]=65533;continue}o<65536?a[i++]=o:(o-=65536,a[i++]=55296|o>>10&1023,a[i++]=56320|o&1023)}return Zv(a,i)},Yv=(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+ao[t[r]]>e?r:e},oo={string2buf:Kv,buf2string:Jv,utf8border:Yv};function Xv(){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 U1=Xv,q1=Object.prototype.toString,{Z_NO_FLUSH:e2,Z_SYNC_FLUSH:t2,Z_FULL_FLUSH:r2,Z_FINISH:n2,Z_OK:ec,Z_STREAM_END:i2,Z_DEFAULT_COMPRESSION:a2,Z_DEFAULT_STRATEGY:o2,Z_DEFLATED:s2}=ii;function ho(t){this.options=hc.assign({level:a2,method:s2,chunkSize:16384,windowBits:15,memLevel:8,strategy:o2},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 U1,this.strm.avail_out=0;let r=Ga.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==ec)throw new Error(Kn[r]);if(e.header&&Ga.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=oo.string2buf(e.dictionary):q1.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=Ga.deflateSetDictionary(this.strm,n),r!==ec)throw new Error(Kn[r]);this._dict_set=!0}}ho.prototype.push=function(t,e){let r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?n2:e2,typeof t=="string"?r.input=oo.string2buf(t):q1.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(n),r.next_out=0,r.avail_out=n),(a===t2||a===r2)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=Ga.deflate(r,a),i===i2)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Ga.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===ec;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};ho.prototype.onData=function(t){this.chunks.push(t)};ho.prototype.onEnd=function(t){t===ec&&(this.result=hc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Xl(t,e){let r=new ho(e);if(r.push(t,!0),r.err)throw r.msg||Kn[r.err];return r.result}function c2(t,e){return e=e||{},e.raw=!0,Xl(t,e)}function u2(t,e){return e=e||{},e.gzip=!0,Xl(t,e)}var l2=ho,p2=Xl,f2=c2,d2=u2,h2=ii,m2={Deflate:l2,deflate:p2,deflateRaw:f2,gzip:d2,constants:h2},ys=16209,g2=16191,y2=function t(e,r){let n,i,a,o,s,u,c,l,d,f,p,h,m,v,b,_,S,y,O,D,A,N,L,P,j=e.state;n=e.next_in,L=e.input,i=n+(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,v=j.distcode,b=(1<<j.lenbits)-1,_=(1<<j.distbits)-1;e:do{h<15&&(p+=L[n++]<<h,h+=8,p+=L[n++]<<h,h+=8),S=m[p&b];t:for(;;){if(y=S>>>24,p>>>=y,h-=y,y=S>>>16&255,y===0)P[a++]=S&65535;else if(y&16){O=S&65535,y&=15,y&&(h<y&&(p+=L[n++]<<h,h+=8),O+=p&(1<<y)-1,p>>>=y,h-=y),h<15&&(p+=L[n++]<<h,h+=8,p+=L[n++]<<h,h+=8),S=v[p&_];r:for(;;){if(y=S>>>24,p>>>=y,h-=y,y=S>>>16&255,y&16){if(D=S&65535,y&=15,h<y&&(p+=L[n++]<<h,h+=8,h<y&&(p+=L[n++]<<h,h+=8)),D+=p&(1<<y)-1,D>u){e.msg="invalid distance too far back",j.mode=ys;break e}if(p>>>=y,h-=y,y=a-o,D>y){if(y=D-y,y>l&&j.sane){e.msg="invalid distance too far back",j.mode=ys;break e}if(A=0,N=f,d===0){if(A+=c-y,y<O){O-=y;do P[a++]=f[A++];while(--y);A=a-D,N=P}}else if(d<y){if(A+=c+d-y,y-=d,y<O){O-=y;do P[a++]=f[A++];while(--y);if(A=0,d<O){y=d,O-=y;do P[a++]=f[A++];while(--y);A=a-D,N=P}}}else if(A+=d-y,y<O){O-=y;do P[a++]=f[A++];while(--y);A=a-D,N=P}for(;O>2;)P[a++]=N[A++],P[a++]=N[A++],P[a++]=N[A++],O-=3;O&&(P[a++]=N[A++],O>1&&(P[a++]=N[A++]))}else{A=a-D;do P[a++]=P[A++],P[a++]=P[A++],P[a++]=P[A++],O-=3;while(O>2);O&&(P[a++]=P[A++],O>1&&(P[a++]=P[A++]))}}else if((y&64)===0){S=v[(S&65535)+(p&(1<<y)-1)];continue r}else{e.msg="invalid distance code",j.mode=ys;break e}break}}else if((y&64)===0){S=m[(S&65535)+(p&(1<<y)-1)];continue t}else if(y&32){j.mode=g2;break e}else{e.msg="invalid literal/length code",j.mode=ys;break e}break}}while(n<i&&a<s);O=h>>3,n-=O,h-=O<<3,p&=(1<<h)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?5+(i-n):5-(n-i),e.avail_out=a<s?257+(s-a):257-(a-s),j.hold=p,j.bits=h},Di=15,ch=852,uh=592,lh=0,sl=1,ph=2,v2=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]),b2=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]),_2=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]),S2=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]),w2=(t,e,r,n,i,a,o,s)=>{let u=s.bits,c=0,l=0,d=0,f=0,p=0,h=0,m=0,v=0,b=0,_=0,S,y,O,D,A,N=null,L,P=new Uint16Array(Di+1),j=new Uint16Array(Di+1),Ze=null,Me,Q,_e;for(c=0;c<=Di;c++)P[c]=0;for(l=0;l<n;l++)P[e[r+l]]++;for(p=u,f=Di;f>=1&&P[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&P[d]===0;d++);for(p<d&&(p=d),v=1,c=1;c<=Di;c++)if(v<<=1,v-=P[c],v<0)return-1;if(v>0&&(t===lh||f!==1))return-1;for(j[1]=0,c=1;c<Di;c++)j[c+1]=j[c]+P[c];for(l=0;l<n;l++)e[r+l]!==0&&(o[j[e[r+l]]++]=l);if(t===lh?(N=Ze=o,L=20):t===sl?(N=v2,Ze=b2,L=257):(N=_2,Ze=S2,L=0),_=0,l=0,c=d,A=a,h=p,m=0,O=-1,b=1<<p,D=b-1,t===sl&&b>ch||t===ph&&b>uh)return 1;for(;;){Me=c-m,o[l]+1<L?(Q=0,_e=o[l]):o[l]>=L?(Q=Ze[o[l]-L],_e=N[o[l]-L]):(Q=32+64,_e=0),S=1<<c-m,y=1<<h,d=y;do y-=S,i[A+(_>>m)+y]=Me<<24|Q<<16|_e|0;while(y!==0);for(S=1<<c-1;_&S;)S>>=1;if(S!==0?(_&=S-1,_+=S):_=0,l++,--P[c]===0){if(c===f)break;c=e[r+o[l]]}if(c>p&&(_&D)!==O){for(m===0&&(m=p),A+=d,h=c-m,v=1<<h;h+m<f&&(v-=P[h+m],!(v<=0));)h++,v<<=1;if(b+=1<<h,t===sl&&b>ch||t===ph&&b>uh)return 1;O=_&D,i[O]=p<<24|h<<16|A-a|0}}return _!==0&&(i[A+_]=c-m<<24|64<<16|0),s.bits=p,0},Ka=w2,C2=0,B1=1,V1=2,{Z_FINISH:fh,Z_BLOCK:E2,Z_TREES:vs,Z_OK:Jn,Z_STREAM_END:x2,Z_NEED_DICT:A2,Z_STREAM_ERROR:jt,Z_DATA_ERROR:Q1,Z_MEM_ERROR:z1,Z_BUF_ERROR:k2,Z_DEFLATED:dh}=ii,mc=16180,hh=16181,mh=16182,gh=16183,yh=16184,vh=16185,bh=16186,_h=16187,Sh=16188,wh=16189,tc=16190,_r=16191,cl=16192,Ch=16193,ul=16194,Eh=16195,xh=16196,Ah=16197,kh=16198,bs=16199,_s=16200,Ih=16201,Th=16202,Oh=16203,Dh=16204,Nh=16205,ll=16206,Ph=16207,Rh=16208,Ae=16209,W1=16210,H1=16211,I2=852,T2=592,O2=15,D2=O2,$h=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function N2(){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 ai=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<mc||e.mode>H1?1:0},G1=t=>{if(ai(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=mc,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(I2),e.distcode=e.distdyn=new Int32Array(T2),e.sane=1,e.back=-1,Jn},K1=t=>{if(ai(t))return jt;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,G1(t)},Z1=(t,e)=>{let r;if(ai(t))return jt;let n=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?jt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,K1(t))},J1=(t,e)=>{if(!t)return jt;let r=new N2;t.state=r,r.strm=t,r.window=null,r.mode=mc;let n=Z1(t,e);return n!==Jn&&(t.state=null),n},P2=t=>J1(t,D2),Lh=!0,pl,fl,R2=t=>{if(Lh){pl=new Int32Array(512),fl=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(Ka(B1,t.lens,0,288,pl,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ka(V1,t.lens,0,32,fl,0,t.work,{bits:5}),Lh=!1}t.lencode=pl,t.lenbits=9,t.distcode=fl,t.distbits=5},Y1=(t,e,r,n)=>{let i,a=t.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(e.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(e.subarray(r-n,r-n+i),a.wnext),n-=i,n?(a.window.set(e.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},$2=(t,e)=>{let r,n,i,a,o,s,u,c,l,d,f,p,h,m,v=0,b,_,S,y,O,D,A,N,L=new Uint8Array(4),P,j,Ze=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ai(t)||!t.output||!t.input&&t.avail_in!==0)return jt;r=t.state,r.mode===_r&&(r.mode=cl),o=t.next_out,i=t.output,u=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,c=r.hold,l=r.bits,d=s,f=u,N=Jn;e:for(;;)switch(r.mode){case mc:if(r.wrap===0){r.mode=cl;break}for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(r.wrap&2&&c===35615){r.wbits===0&&(r.wbits=15),r.check=0,L[0]=c&255,L[1]=c>>>8&255,r.check=He(r.check,L,2,0),c=0,l=0,r.mode=hh;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=Ae;break}if((c&15)!==dh){t.msg="unknown compression method",r.mode=Ae;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=Ae;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=c&512?wh:_r,c=0,l=0;break;case hh:for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(r.flags=c,(r.flags&255)!==dh){t.msg="unknown compression method",r.mode=Ae;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Ae;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&r.wrap&4&&(L[0]=c&255,L[1]=c>>>8&255,r.check=He(r.check,L,2,0)),c=0,l=0,r.mode=mh;case mh:for(;l<32;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}r.head&&(r.head.time=c),r.flags&512&&r.wrap&4&&(L[0]=c&255,L[1]=c>>>8&255,L[2]=c>>>16&255,L[3]=c>>>24&255,r.check=He(r.check,L,4,0)),c=0,l=0,r.mode=gh;case gh:for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}r.head&&(r.head.xflags=c&255,r.head.os=c>>8),r.flags&512&&r.wrap&4&&(L[0]=c&255,L[1]=c>>>8&255,r.check=He(r.check,L,2,0)),c=0,l=0,r.mode=yh;case yh:if(r.flags&1024){for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),r.flags&512&&r.wrap&4&&(L[0]=c&255,L[1]=c>>>8&255,r.check=He(r.check,L,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=vh;case vh: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(n.subarray(a,a+p),A)),r.flags&512&&r.wrap&4&&(r.check=He(r.check,n,p,a)),s-=p,a+=p,r.length-=p),r.length))break e;r.length=0,r.mode=bh;case bh:if(r.flags&2048){if(s===0)break e;p=0;do A=n[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=He(r.check,n,p,a)),s-=p,a+=p,A)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=_h;case _h:if(r.flags&4096){if(s===0)break e;p=0;do A=n[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=He(r.check,n,p,a)),s-=p,a+=p,A)break e}else r.head&&(r.head.comment=null);r.mode=Sh;case Sh:if(r.flags&512){for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(r.wrap&4&&c!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Ae;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=_r;break;case wh:for(;l<32;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}t.adler=r.check=$h(c),c=0,l=0,r.mode=tc;case tc: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,A2;t.adler=r.check=1,r.mode=_r;case _r:if(e===E2||e===vs)break e;case cl:if(r.last){c>>>=l&7,l-=l&7,r.mode=ll;break}for(;l<3;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}switch(r.last=c&1,c>>>=1,l-=1,c&3){case 0:r.mode=Ch;break;case 1:if(R2(r),r.mode=bs,e===vs){c>>>=2,l-=2;break e}break;case 2:r.mode=xh;break;case 3:t.msg="invalid block type",r.mode=Ae}c>>>=2,l-=2;break;case Ch:for(c>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Ae;break}if(r.length=c&65535,c=0,l=0,r.mode=ul,e===vs)break e;case ul:r.mode=Eh;case Eh:if(p=r.length,p){if(p>s&&(p=s),p>u&&(p=u),p===0)break e;i.set(n.subarray(a,a+p),o),s-=p,a+=p,u-=p,o+=p,r.length-=p;break}r.mode=_r;break;case xh:for(;l<14;){if(s===0)break e;s--,c+=n[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=Ae;break}r.have=0,r.mode=Ah;case Ah:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}r.lens[Ze[r.have++]]=c&7,c>>>=3,l-=3}for(;r.have<19;)r.lens[Ze[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},N=Ka(C2,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,N){t.msg="invalid code lengths set",r.mode=Ae;break}r.have=0,r.mode=kh;case kh:for(;r.have<r.nlen+r.ndist;){for(;v=r.lencode[c&(1<<r.lenbits)-1],b=v>>>24,_=v>>>16&255,S=v&65535,!(b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(S<16)c>>>=b,l-=b,r.lens[r.have++]=S;else{if(S===16){for(j=b+2;l<j;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(c>>>=b,l-=b,r.have===0){t.msg="invalid bit length repeat",r.mode=Ae;break}A=r.lens[r.have-1],p=3+(c&3),c>>>=2,l-=2}else if(S===17){for(j=b+3;l<j;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=b,l-=b,A=0,p=3+(c&7),c>>>=3,l-=3}else{for(j=b+7;l<j;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=b,l-=b,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=Ae;break}for(;p--;)r.lens[r.have++]=A}}if(r.mode===Ae)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Ae;break}if(r.lenbits=9,P={bits:r.lenbits},N=Ka(B1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,N){t.msg="invalid literal/lengths set",r.mode=Ae;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},N=Ka(V1,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,N){t.msg="invalid distances set",r.mode=Ae;break}if(r.mode=bs,e===vs)break e;case bs:r.mode=_s;case _s: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,y2(t,f),o=t.next_out,i=t.output,u=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,c=r.hold,l=r.bits,r.mode===_r&&(r.back=-1);break}for(r.back=0;v=r.lencode[c&(1<<r.lenbits)-1],b=v>>>24,_=v>>>16&255,S=v&65535,!(b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(_&&(_&240)===0){for(y=b,O=_,D=S;v=r.lencode[D+((c&(1<<y+O)-1)>>y)],b=v>>>24,_=v>>>16&255,S=v&65535,!(y+b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=y,l-=y,r.back+=y}if(c>>>=b,l-=b,r.back+=b,r.length=S,_===0){r.mode=Nh;break}if(_&32){r.back=-1,r.mode=_r;break}if(_&64){t.msg="invalid literal/length code",r.mode=Ae;break}r.extra=_&15,r.mode=Ih;case Ih:if(r.extra){for(j=r.extra;l<j;){if(s===0)break e;s--,c+=n[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=Th;case Th:for(;v=r.distcode[c&(1<<r.distbits)-1],b=v>>>24,_=v>>>16&255,S=v&65535,!(b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if((_&240)===0){for(y=b,O=_,D=S;v=r.distcode[D+((c&(1<<y+O)-1)>>y)],b=v>>>24,_=v>>>16&255,S=v&65535,!(y+b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=y,l-=y,r.back+=y}if(c>>>=b,l-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=Ae;break}r.offset=S,r.extra=_&15,r.mode=Oh;case Oh:if(r.extra){for(j=r.extra;l<j;){if(s===0)break e;s--,c+=n[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=Ae;break}r.mode=Dh;case Dh: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=Ae;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=i,h=o-r.offset,p=r.length;p>u&&(p=u),u-=p,r.length-=p;do i[o++]=m[h++];while(--p);r.length===0&&(r.mode=_s);break;case Nh:if(u===0)break e;i[o++]=r.length,u--,r.mode=_s;break;case ll:if(r.wrap){for(;l<32;){if(s===0)break e;s--,c|=n[a++]<<l,l+=8}if(f-=u,t.total_out+=f,r.total+=f,r.wrap&4&&f&&(t.adler=r.check=r.flags?He(r.check,i,f,o-f):io(r.check,i,f,o-f)),f=u,r.wrap&4&&(r.flags?c:$h(c))!==r.check){t.msg="incorrect data check",r.mode=Ae;break}c=0,l=0}r.mode=Ph;case Ph:if(r.wrap&&r.flags){for(;l<32;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(r.wrap&4&&c!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Ae;break}c=0,l=0}r.mode=Rh;case Rh:N=x2;break e;case Ae:N=Q1;break e;case W1:return z1;case H1: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<Ae&&(r.mode<ll||e!==fh))&&Y1(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?He(r.check,i,f,t.next_out-f):io(r.check,i,f,t.next_out-f)),t.data_type=r.bits+(r.last?64:0)+(r.mode===_r?128:0)+(r.mode===bs||r.mode===ul?256:0),(d===0&&f===0||e===fh)&&N===Jn&&(N=k2),N},L2=t=>{if(ai(t))return jt;let e=t.state;return e.window&&(e.window=null),t.state=null,Jn},F2=(t,e)=>{if(ai(t))return jt;let r=t.state;return(r.wrap&2)===0?jt:(r.head=e,e.done=!1,Jn)},M2=(t,e)=>{let r=e.length,n,i,a;return ai(t)||(n=t.state,n.wrap!==0&&n.mode!==tc)?jt:n.mode===tc&&(i=1,i=io(i,e,r,0),i!==n.check)?Q1:(a=Y1(t,e,r,r),a?(n.mode=W1,z1):(n.havedict=1,Jn))},j2=K1,U2=Z1,q2=G1,B2=P2,V2=J1,Q2=$2,z2=L2,W2=F2,H2=M2,G2="pako inflate (from Nodeca project)",xr={inflateReset:j2,inflateReset2:U2,inflateResetKeep:q2,inflateInit:B2,inflateInit2:V2,inflate:Q2,inflateEnd:z2,inflateGetHeader:W2,inflateSetDictionary:H2,inflateInfo:G2};function K2(){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 Z2=K2,X1=Object.prototype.toString,{Z_NO_FLUSH:J2,Z_FINISH:Y2,Z_OK:so,Z_STREAM_END:dl,Z_NEED_DICT:hl,Z_STREAM_ERROR:X2,Z_DATA_ERROR:Fh,Z_MEM_ERROR:e3}=ii;function mo(t){this.options=hc.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 U1,this.strm.avail_out=0;let r=xr.inflateInit2(this.strm,e.windowBits);if(r!==so)throw new Error(Kn[r]);if(this.header=new Z2,xr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=oo.string2buf(e.dictionary):X1.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=xr.inflateSetDictionary(this.strm,e.dictionary),r!==so)))throw new Error(Kn[r])}mo.prototype.push=function(t,e){let r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?Y2:J2,X1.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(n),r.next_out=0,r.avail_out=n),a=xr.inflate(r,o),a===hl&&i&&(a=xr.inflateSetDictionary(r,i),a===so?a=xr.inflate(r,o):a===Fh&&(a=hl));r.avail_in>0&&a===dl&&r.state.wrap>0&&t[r.next_in]!==0;)xr.inflateReset(r),a=xr.inflate(r,o);switch(a){case X2:case Fh:case hl:case e3:return this.onEnd(a),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(r.avail_out===0||a===dl))if(this.options.to==="string"){let u=oo.utf8border(r.output,r.next_out),c=r.next_out-u,l=oo.buf2string(r.output,u);r.next_out=c,r.avail_out=n-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===so&&s===0)){if(a===dl)return a=xr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};mo.prototype.onData=function(t){this.chunks.push(t)};mo.prototype.onEnd=function(t){t===so&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=hc.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ep(t,e){let r=new mo(e);if(r.push(t),r.err)throw r.msg||Kn[r.err];return r.result}function t3(t,e){return e=e||{},e.raw=!0,ep(t,e)}var r3=mo,n3=ep,i3=t3,a3=ep,o3=ii,s3={Inflate:r3,inflate:n3,inflateRaw:i3,ungzip:a3,constants:o3},{Deflate:c3,deflate:u3,deflateRaw:l3,gzip:p3}=m2,{Inflate:f3,inflate:d3,inflateRaw:h3,ungzip:m3}=s3,g3=c3,y3=u3,v3=l3,b3=p3,_3=f3,S3=d3,w3=h3,C3=m3,E3=ii,x3={Deflate:g3,deflate:y3,deflateRaw:v3,gzip:b3,Inflate:_3,inflate:S3,inflateRaw:w3,ungzip:C3,constants:E3},we=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ce=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},rc=class{constructor(e,r){this.input=e,this.output=r}};we([g(),Ce("design:type",String)],rc.prototype,"input",void 0);we([g(),Ce("design:type",String)],rc.prototype,"output",void 0);rc=we([Ke(),Ce("design:paramtypes",[String,String])],rc);var nc=class{constructor(e,r){this.input=e,this.output=r}};we([g(),Ce("design:type",String)],nc.prototype,"input",void 0);we([g(),Ce("design:type",String)],nc.prototype,"output",void 0);nc=we([G(),Ce("design:paramtypes",[String,String])],nc);var cn=class{constructor(e,r,n,i,a){this.name=e,this.modelId=r,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};we([g(),Ce("design:type",String)],cn.prototype,"name",void 0);we([g(),Ce("design:type",String)],cn.prototype,"modelId",void 0);we([g(),Ce("design:type",String)],cn.prototype,"systemPrompt",void 0);we([g(),Ce("design:type",Array)],cn.prototype,"promptExamples",void 0);we([g(),Ce("design:type",String)],cn.prototype,"metaData",void 0);cn=we([Ke(),Ce("design:paramtypes",[String,String,String,Array,String])],cn);var fr=class{constructor(e,r,n,i,a,o,s,u){this.name=e,this.modelId=r,this.taskId=n,this.systemPrompt=i,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=u}};we([g(),Ce("design:type",String)],fr.prototype,"name",void 0);we([g(),Ce("design:type",String)],fr.prototype,"modelId",void 0);we([g(),Ce("design:type",String)],fr.prototype,"taskId",void 0);we([g(),Ce("design:type",String)],fr.prototype,"systemPrompt",void 0);we([g(),Ce("design:type",Array)],fr.prototype,"promptExamples",void 0);we([g(),Ce("design:type",String)],fr.prototype,"metaData",void 0);we([g(),Ce("design:type",String)],fr.prototype,"createdAt",void 0);we([g(),Ce("design:type",String)],fr.prototype,"updatedAt",void 0);fr=we([G(),Ce("design:paramtypes",[String,String,String,String,Array,String,String,String])],fr);var Yn=class{constructor(e,r,n,i,a){this.model=e,this.status=r,this.progress=n,this.downloaded=i,this.loaded=a}};we([g(),Ce("design:type",String)],Yn.prototype,"model",void 0);we([g(),Ce("design:type",String)],Yn.prototype,"status",void 0);we([g(),Ce("design:type",Number)],Yn.prototype,"progress",void 0);we([g(),Ce("design:type",Boolean)],Yn.prototype,"downloaded",void 0);we([g(),Ce("design:type",Boolean)],Yn.prototype,"loaded",void 0);Yn=we([G(),Ce("design:paramtypes",[String,String,Number,Boolean,Boolean])],Yn);var A3=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Qe=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},qe,Rs,Ml=class{constructor(e,r=!0){qe.set(this,void 0),Rs.set(this,new Map),A3(this,qe,e,"f")}async getModels(){let e=await Qe(this,qe,"f").query({query:E`
725
+ }`,variables:{url:e,interactionCall:r}}));return n}};Cr=new WeakMap;var yc={};yc.byteLength=I0;yc.toByteArray=O0;yc.fromByteArray=R0;var sr=[],Ft=[],k0=typeof Uint8Array<"u"?Uint8Array:Array,al="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Dn=0,nh=al.length;Dn<nh;++Dn)sr[Dn]=al[Dn],Ft[al.charCodeAt(Dn)]=Dn;var Dn,nh;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 n=r===e?0:4-r%4;return[r,n]}function I0(t){var e=E1(t),r=e[0],n=e[1];return(r+n)*3/4-n}function T0(t,e,r){return(e+r)*3/4-r}function O0(t){var e,r=E1(t),n=r[0],i=r[1],a=new k0(T0(t,n,i)),o=0,s=i>0?n-4:n,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 i===2&&(e=Ft[t.charCodeAt(u)]<<2|Ft[t.charCodeAt(u+1)]>>4,a[o++]=e&255),i===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 n,i=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),i.push(D0(n));return i.join("")}function R0(t){for(var e,r=t.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(N0(t,o,o+a>s?s:o+a));return n===1?(e=t[r-1],i.push(sr[e>>2]+sr[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(sr[e>>10]+sr[e>>4&63]+sr[e<<2&63]+"=")),i.join("")}var P0=4,ih=0,ah=1,$0=2;function Ji(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,Ui=30,ep=19,A1=2*ao+1,Bn=15,ol=16,j0=7,tp=256,k1=16,I1=17,T1=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,Er=new Array((ao+2)*2);Ji(Er);var Za=new Array(Ui*2);Ji(Za);var oo=new Array(B0);Ji(oo);var so=new Array(U0-M0+1);Ji(so);var rp=new Array(Xl);Ji(rp);var ac=new Array(Ui);Ji(ac);function sl(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,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},wt=(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)=>{wt(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,n=e.max_code,i=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,f,d,p,h,g=0;for(d=0;d<=Bn;d++)t.bl_count[d]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<A1;c++)l=t.heap[c],d=r[r[l*2+1]*2+1]+1,d>u&&(d=u,g++),r[l*2+1]=d,!(l>n)&&(t.bl_count[d]++,p=0,l>=s&&(p=o[l-s]),h=r[l*2],t.opt_len+=h*(d+p),a&&(t.static_len+=h*(i[l*2+1]+p)));if(g!==0){do{for(d=u-1;t.bl_count[d]===0;)d--;t.bl_count[d]--,t.bl_count[d+1]+=2,t.bl_count[u]--,g-=2}while(g>0);for(d=u;d!==0;d--)for(l=t.bl_count[d];l!==0;)f=t.heap[--c],!(f>n)&&(r[f*2+1]!==d&&(t.opt_len+=(d-r[f*2+1])*r[f*2],r[f*2+1]=d),l--)}},L1=(t,e,r)=>{let n=new Array(Bn+1),i=0,a,o;for(a=1;a<=Bn;a++)i=i+r[a-1]<<1,n[a]=i;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=$1(n[s]++,s))}},z0=()=>{let t,e,r,n,i,a=new Array(Bn+1);for(r=0,n=0;n<Xl-1;n++)for(rp[n]=r,t=0;t<1<<Pl[n];t++)so[r++]=n;for(so[r-1]=n,i=0,n=0;n<16;n++)for(ac[n]=i,t=0;t<1<<Us[n];t++)oo[i++]=n;for(i>>=7;n<Ui;n++)for(ac[n]=i<<7,t=0;t<1<<Us[n]-7;t++)oo[256+i++]=n;for(e=0;e<=Bn;e++)a[e]=0;for(t=0;t<=143;)Er[t*2+1]=8,t++,a[8]++;for(;t<=255;)Er[t*2+1]=9,t++,a[9]++;for(;t<=279;)Er[t*2+1]=7,t++,a[7]++;for(;t<=287;)Er[t*2+1]=8,t++,a[8]++;for(L1(Er,ao+1,a),t=0;t<Ui;t++)Za[t*2+1]=5,Za[t*2]=$1(t,5);D1=new sl(Er,Pl,vo+1,ao,Bn),N1=new sl(Za,Us,0,Ui,Bn),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<Ui;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,n)=>{let i=e*2,a=r*2;return t[i]<t[a]||t[i]===t[a]&&n[e]<=n[r]},ul=(t,e,r)=>{let n=t.heap[r],i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&oh(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!oh(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},sh=(t,e,r)=>{let n,i,a=0,o,s;if(t.sym_next!==0)do n=t.pending_buf[t.sym_buf+a++]&255,n+=(t.pending_buf[t.sym_buf+a++]&255)<<8,i=t.pending_buf[t.sym_buf+a++],n===0?cr(t,i,e):(o=so[i],cr(t,o+vo+1,e),s=Pl[o],s!==0&&(i-=rp[o],wt(t,i,s)),n--,o=P1(n),cr(t,o,r),s=Us[o],s!==0&&(n-=ac[o],wt(t,n,s)));while(a<t.sym_next);cr(t,tp,e)},$l=(t,e)=>{let r=e.dyn_tree,n=e.stat_desc.static_tree,i=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--,i&&(t.static_len-=n[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 n,i=-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,n=0;n<=r;n++)a=o,o=e[(n+1)*2+1],!(++s<u&&a===o)&&(s<c?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[k1*2]++):s<=10?t.bl_tree[I1*2]++:t.bl_tree[T1*2]++,s=0,i=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4))},uh=(t,e,r)=>{let n,i=-1,a,o=e[0*2+1],s=0,u=7,c=4;for(o===0&&(u=138,c=3),n=0;n<=r;n++)if(a=o,o=e[(n+1)*2+1],!(++s<u&&a===o)){if(s<c)do cr(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(cr(t,a,t.bl_tree),s--),cr(t,k1,t.bl_tree),wt(t,s-3,2)):s<=10?(cr(t,I1,t.bl_tree),wt(t,s-3,3)):(cr(t,T1,t.bl_tree),wt(t,s-11,7));s=0,i=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,n)=>{let i;for(wt(t,e-257,5),wt(t,r-1,5),wt(t,n-4,4),i=0;i<n;i++)wt(t,t.bl_tree[O1[i]*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 ih;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 ih},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,n)=>{wt(t,(L0<<1)+(n?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=>{wt(t,x1<<1,3),cr(t,tp,Er),V0(t)},J0=(t,e,r,n)=>{let i,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),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&e!==-1?U1(t,e,r,n):t.strategy===P0||a===i?(wt(t,(x1<<1)+(n?1:0),3),sh(t,Er,Za)):(wt(t,(F0<<1)+(n?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),n&&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,nv=Z0,iv={_tr_init:X0,_tr_stored_block:ev,_tr_flush_block:tv,_tr_tally:rv,_tr_align:nv},av=(t,e,r,n)=>{let i=t&65535|0,a=t>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+e[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},uo=av,ov=()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e},sv=new Uint32Array(ov()),cv=(t,e,r,n)=>{let i=sv,a=n+r;t^=-1;for(let o=n;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1},Ge=cv,Jn={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"},ai={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:en,_tr_align:pv}=iv,{Z_NO_FLUSH:tn,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:Ss,Z_RLE:yv,Z_FIXED:vv,Z_DEFAULT_STRATEGY:bv,Z_UNKNOWN:_v,Z_DEFLATED:vc}=ai,wv=9,Sv=15,Cv=8,Ev=29,xv=256,Fl=xv+1+Ev,Av=30,kv=19,Iv=2*Fl+1,Tv=15,oe=3,Zr=258,pr=Zr+oe+1,Ov=32,Vi=42,np=57,Ml=69,Ul=73,jl=91,ql=103,Vn=113,Qa=666,dt=1,Yi=2,Yn=3,Xi=4,Dv=3,Qn=(t,e)=>(t.msg=Jn[e],e),dh=t=>t*2-(t>4?9:0),Kr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Nv=t=>{let e,r,n,i=t.w_size;e=t.hash_size,n=e;do r=t.head[--n],t.head[n]=r>=i?r-i:0;while(--e);e=i,n=e;do r=t.prev[--n],t.prev[n]=r>=i?r-i:0;while(--e)},Rv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,rn=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))},It=(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)},me=(t,e)=>{t.pending_buf[t.pending++]=e},Ta=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Bl=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),t.state.wrap===1?t.adler=uo(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Ge(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},j1=(t,e)=>{let r=t.max_chain_length,n=t.strstart,i,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,f=t.prev,d=t.strstart+Zr,p=c[n+o-1],h=c[n+o];t.prev_length>=t.good_match&&(r>>=2),s>t.lookahead&&(s=t.lookahead);do if(i=e,!(c[i+o]!==h||c[i+o-1]!==p||c[i]!==c[n]||c[++i]!==c[n+1])){n+=2,i++;do;while(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]===c[++i]&&n<d);if(a=Zr-(d-n),n=d-Zr,a>o){if(t.match_start=e,o=a,a>=s)break;p=c[n+o-1],h=c[n+o]}}while((e=f[e&l])>u&&--r!==0);return o<=t.lookahead?o:t.lookahead},Qi=t=>{let e=t.w_size,r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-pr)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Nv(t),n+=e),t.strm.avail_in===0)break;if(r=Bl(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=oe)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=rn(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=rn(t,t.ins_h,t.window[i+oe-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<oe)););}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,n,i,a,o=0,s=t.strm.avail_in;do{if(n=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,i=t.strstart-t.block_start,n>i+t.strm.avail_in&&(n=i+t.strm.avail_in),n>a&&(n=a),n<r&&(n===0&&e!==Ut||e===tn||n!==i+t.strm.avail_in)))break;o=e===Ut&&n===i+t.strm.avail_in?1:0,Ll(t,0,0,o),t.pending_buf[t.pending-4]=n,t.pending_buf[t.pending-3]=n>>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,At(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Bl(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}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?Xi:e!==tn&&e!==Ut&&t.strm.avail_in===0&&t.strstart===t.block_start?Yi:(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,i=t.strstart-t.block_start,(i>=r||(i||e===Ut)&&e!==tn&&t.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Ut&&t.strm.avail_in===0&&n===i?1:0,Ll(t,t.block_start,n,o),t.block_start+=n,At(t.strm)),o?Yn:dt)},pl=(t,e)=>{let r,n;for(;;){if(t.lookahead<pr){if(Qi(t),t.lookahead<pr&&e===tn)return dt;if(t.lookahead===0)break}if(r=0,t.lookahead>=oe&&(t.ins_h=rn(t,t.ins_h,t.window[t.strstart+oe-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>=oe)if(n=en(t,t.strstart-t.match_start,t.match_length-oe),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=oe){t.match_length--;do t.strstart++,t.ins_h=rn(t,t.ins_h,t.window[t.strstart+oe-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=rn(t,t.ins_h,t.window[t.strstart+1]);else n=en(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(It(t,!1),t.strm.avail_out===0))return dt}return t.insert=t.strstart<oe-1?t.strstart:oe-1,e===Ut?(It(t,!0),t.strm.avail_out===0?Yn:Xi):t.sym_next&&(It(t,!1),t.strm.avail_out===0)?dt:Yi},Ri=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<pr){if(Qi(t),t.lookahead<pr&&e===tn)return dt;if(t.lookahead===0)break}if(r=0,t.lookahead>=oe&&(t.ins_h=rn(t,t.ins_h,t.window[t.strstart+oe-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=oe-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===oe&&t.strstart-t.match_start>4096)&&(t.match_length=oe-1)),t.prev_length>=oe&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-oe,n=en(t,t.strstart-1-t.prev_match,t.prev_length-oe),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=rn(t,t.ins_h,t.window[t.strstart+oe-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=oe-1,t.strstart++,n&&(It(t,!1),t.strm.avail_out===0))return dt}else if(t.match_available){if(n=en(t,0,t.window[t.strstart-1]),n&&It(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&&(n=en(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<oe-1?t.strstart:oe-1,e===Ut?(It(t,!0),t.strm.avail_out===0?Yn:Xi):t.sym_next&&(It(t,!1),t.strm.avail_out===0)?dt:Yi},Pv=(t,e)=>{let r,n,i,a,o=t.window;for(;;){if(t.lookahead<=Zr){if(Qi(t),t.lookahead<=Zr&&e===tn)return dt;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=oe&&t.strstart>0&&(i=t.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=t.strstart+Zr;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);t.match_length=Zr-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=oe?(r=en(t,1,t.match_length-oe),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=en(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(It(t,!1),t.strm.avail_out===0))return dt}return t.insert=0,e===Ut?(It(t,!0),t.strm.avail_out===0?Yn:Xi):t.sym_next&&(It(t,!1),t.strm.avail_out===0)?dt:Yi},$v=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(Qi(t),t.lookahead===0)){if(e===tn)return dt;break}if(t.match_length=0,r=en(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(It(t,!1),t.strm.avail_out===0))return dt}return t.insert=0,e===Ut?(It(t,!0),t.strm.avail_out===0?Yn:Xi):t.sym_next&&(It(t,!1),t.strm.avail_out===0)?dt:Yi};function rr(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}var za=[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,Ri),new rr(8,16,32,32,Ri),new rr(8,16,128,128,Ri),new rr(8,32,128,256,Ri),new rr(32,128,258,1024,Ri),new rr(32,258,258,4096,Ri)],Lv=t=>{t.window_size=2*t.w_size,Kr(t.head),t.max_lazy_match=za[t.level].max_lazy,t.good_match=za[t.level].good_length,t.nice_match=za[t.level].nice_length,t.max_chain_length=za[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=oe-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(Iv*2),this.dyn_dtree=new Uint16Array((2*Av+1)*2),this.bl_tree=new Uint16Array((2*kv+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(Tv+1),this.heap=new Uint16Array(2*Fl+1),Kr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Fl+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 bo=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==Vi&&e.status!==np&&e.status!==Ml&&e.status!==Ul&&e.status!==jl&&e.status!==ql&&e.status!==Vn&&e.status!==Qa?1:0},B1=t=>{if(bo(t))return Qn(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?np:e.wrap?Vi:Vn,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,n,i,a)=>{if(!t)return lr;let o=1;if(e===mv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>wv||r!==vc||n<8||n>15||e<0||e>9||a<0||a>vv||n===8&&o!==1)return Qn(t,lr);n===8&&(n=9);let s=new Fv;return t.state=s,s.strm=t,s.status=Vi,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+oe-1)/oe),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<<i+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,Sv,Cv,bv),jv=(t,e)=>{if(bo(t)||e>ph||e<0)return t?Qn(t,lr):lr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===Qa&&e!==Ut)return Qn(t,t.avail_out===0?ll:lr);let n=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(n)&&e!==Ut)return Qn(t,ll);if(r.status===Qa&&t.avail_in!==0)return Qn(t,ll);if(r.status===Vi&&r.wrap===0&&(r.status=Vn),r.status===Vi){let i=vc+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Ss||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=Ov),i+=31-i%31,Ta(r,i),r.strstart!==0&&(Ta(r,t.adler>>>16),Ta(r,t.adler&65535)),t.adler=1,r.status=Vn,At(t),r.pending!==0)return r.last_flush=-1,rt}if(r.status===np){if(t.adler=0,me(r,31),me(r,139),me(r,8),r.gzhead)me(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)),me(r,r.gzhead.time&255),me(r,r.gzhead.time>>8&255),me(r,r.gzhead.time>>16&255),me(r,r.gzhead.time>>24&255),me(r,r.level===9?2:r.strategy>=Ss||r.level<2?4:0),me(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(me(r,r.gzhead.extra.length&255),me(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(me(r,0),me(r,0),me(r,0),me(r,0),me(r,0),me(r,r.level===9?2:r.strategy>=Ss||r.level<2?4:0),me(r,Dv),r.status=Vn,At(t),r.pending!==0)return r.last_flush=-1,rt}if(r.status===Ml){if(r.gzhead.extra){let i=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>i&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=s,At(t),r.pending!==0)return r.last_flush=-1,rt;i=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>i&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Ul}if(r.status===Ul){if(r.gzhead.name){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-i,i)),At(t),r.pending!==0)return r.last_flush=-1,rt;i=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,me(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=jl}if(r.status===jl){if(r.gzhead.comment){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-i,i)),At(t),r.pending!==0)return r.last_flush=-1,rt;i=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,me(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ge(t.adler,r.pending_buf,r.pending-i,i))}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;me(r,t.adler&255),me(r,t.adler>>8&255),t.adler=0}if(r.status=Vn,At(t),r.pending!==0)return r.last_flush=-1,rt}if(t.avail_in!==0||r.lookahead!==0||e!==tn&&r.status!==Qa){let i=r.level===0?q1(r,e):r.strategy===Ss?$v(r,e):r.strategy===yv?Pv(r,e):za[r.level].func(r,e);if((i===Yn||i===Xi)&&(r.status=Qa),i===dt||i===Yn)return t.avail_out===0&&(r.last_flush=-1),rt;if(i===Yi&&(e===fv?pv(r):e!==ph&&(Ll(r,0,0,!1),e===dv&&(Kr(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?(me(r,t.adler&255),me(r,t.adler>>8&255),me(r,t.adler>>16&255),me(r,t.adler>>24&255),me(r,t.total_in&255),me(r,t.total_in>>8&255),me(r,t.total_in>>16&255),me(r,t.total_in>>24&255)):(Ta(r,t.adler>>>16),Ta(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===Vn?Qn(t,hv):rt},Bv=(t,e)=>{let r=e.length;if(bo(t))return lr;let n=t.state,i=n.wrap;if(i===2||i===1&&n.status!==Vi||n.lookahead)return lr;if(i===1&&(t.adler=uo(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Kr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let u=new Uint8Array(n.w_size);u.set(e.subarray(r-n.w_size,r),0),e=u,r=n.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,Qi(n);n.lookahead>=oe;){let u=n.strstart,c=n.lookahead-(oe-1);do n.ins_h=rn(n,n.ins_h,n.window[u+oe-1]),n.prev[u&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=u,u++;while(--c);n.strstart=u,n.lookahead=oe-1,Qi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=oe-1,n.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,n.wrap=i,rt},Vv=Uv,Qv=Q1,zv=V1,Wv=B1,Hv=Mv,Gv=jv,Kv=qv,Zv=Bv,Jv="pako deflate (from Nodeca project)",Ja={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 n in r)Yv(r,n)&&(t[n]=r[n])}}return t},e2=t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;let r=new Uint8Array(e);for(let n=0,i=0,a=t.length;n<a;n++){let o=t[n];r.set(o,i),i+=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,n,i,a,o=t.length,s=0;for(i=0;i<o;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),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 n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r},n2=(t,e)=>{let r=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let n,i,a=new Array(r*2);for(i=0,n=0;n<r;){let o=t[n++];if(o<128){a[i++]=o;continue}let s=lo[o];if(s>4){a[i++]=65533,n+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&n<r;)o=o<<6|t[n++]&63,s--;if(s>1){a[i++]=65533;continue}o<65536?a[i++]=o:(o-=65536,a[i++]=55296|o>>10&1023,a[i++]=56320|o&1023)}return r2(a,i)},i2=(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:n2,utf8border:i2};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}=ai;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=Ja.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==oc)throw new Error(Jn[r]);if(e.header&&Ja.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=po.string2buf(e.dictionary):H1.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=Ja.deflateSetDictionary(this.strm,n),r!==oc)throw new Error(Jn[r]);this._dict_set=!0}}_o.prototype.push=function(t,e){let r=this.strm,n=this.options.chunkSize,i,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(n),r.next_out=0,r.avail_out=n),(a===s2||a===c2)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=Ja.deflate(r,a),i===l2)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=Ja.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===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 ip(t,e){let r=new _o(e);if(r.push(t,!0),r.err)throw r.msg||Jn[r.err];return r.result}function h2(t,e){return e=e||{},e.raw=!0,ip(t,e)}function m2(t,e){return e=e||{},e.gzip=!0,ip(t,e)}var g2=_o,y2=ip,v2=h2,b2=m2,_2=ai,w2={Deflate:g2,deflate:y2,deflateRaw:v2,gzip:b2,constants:_2},Cs=16209,S2=16191,C2=function t(e,r){let n,i,a,o,s,u,c,l,f,d,p,h,g,v,b,_,w,y,O,D,A,N,L,P,j=e.state;n=e.next_in,L=e.input,i=n+(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,f=j.wnext,d=j.window,p=j.hold,h=j.bits,g=j.lencode,v=j.distcode,b=(1<<j.lenbits)-1,_=(1<<j.distbits)-1;e:do{h<15&&(p+=L[n++]<<h,h+=8,p+=L[n++]<<h,h+=8),w=g[p&b];t:for(;;){if(y=w>>>24,p>>>=y,h-=y,y=w>>>16&255,y===0)P[a++]=w&65535;else if(y&16){O=w&65535,y&=15,y&&(h<y&&(p+=L[n++]<<h,h+=8),O+=p&(1<<y)-1,p>>>=y,h-=y),h<15&&(p+=L[n++]<<h,h+=8,p+=L[n++]<<h,h+=8),w=v[p&_];r:for(;;){if(y=w>>>24,p>>>=y,h-=y,y=w>>>16&255,y&16){if(D=w&65535,y&=15,h<y&&(p+=L[n++]<<h,h+=8,h<y&&(p+=L[n++]<<h,h+=8)),D+=p&(1<<y)-1,D>u){e.msg="invalid distance too far back",j.mode=Cs;break e}if(p>>>=y,h-=y,y=a-o,D>y){if(y=D-y,y>l&&j.sane){e.msg="invalid distance too far back",j.mode=Cs;break e}if(A=0,N=d,f===0){if(A+=c-y,y<O){O-=y;do P[a++]=d[A++];while(--y);A=a-D,N=P}}else if(f<y){if(A+=c+f-y,y-=f,y<O){O-=y;do P[a++]=d[A++];while(--y);if(A=0,f<O){y=f,O-=y;do P[a++]=d[A++];while(--y);A=a-D,N=P}}}else if(A+=f-y,y<O){O-=y;do P[a++]=d[A++];while(--y);A=a-D,N=P}for(;O>2;)P[a++]=N[A++],P[a++]=N[A++],P[a++]=N[A++],O-=3;O&&(P[a++]=N[A++],O>1&&(P[a++]=N[A++]))}else{A=a-D;do P[a++]=P[A++],P[a++]=P[A++],P[a++]=P[A++],O-=3;while(O>2);O&&(P[a++]=P[A++],O>1&&(P[a++]=P[A++]))}}else if((y&64)===0){w=v[(w&65535)+(p&(1<<y)-1)];continue r}else{e.msg="invalid distance code",j.mode=Cs;break e}break}}else if((y&64)===0){w=g[(w&65535)+(p&(1<<y)-1)];continue t}else if(y&32){j.mode=S2;break e}else{e.msg="invalid literal/length code",j.mode=Cs;break e}break}}while(n<i&&a<s);O=h>>3,n-=O,h-=O<<3,p&=(1<<h)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?5+(i-n):5-(n-i),e.avail_out=a<s?257+(s-a):257-(a-s),j.hold=p,j.bits=h},Pi=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]),I2=(t,e,r,n,i,a,o,s)=>{let u=s.bits,c=0,l=0,f=0,d=0,p=0,h=0,g=0,v=0,b=0,_=0,w,y,O,D,A,N=null,L,P=new Uint16Array(Pi+1),j=new Uint16Array(Pi+1),Je=null,je,z,we;for(c=0;c<=Pi;c++)P[c]=0;for(l=0;l<n;l++)P[e[r+l]]++;for(p=u,d=Pi;d>=1&&P[d]===0;d--);if(p>d&&(p=d),d===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<d&&P[f]===0;f++);for(p<f&&(p=f),v=1,c=1;c<=Pi;c++)if(v<<=1,v-=P[c],v<0)return-1;if(v>0&&(t===gh||d!==1))return-1;for(j[1]=0,c=1;c<Pi;c++)j[c+1]=j[c]+P[c];for(l=0;l<n;l++)e[r+l]!==0&&(o[j[e[r+l]]++]=l);if(t===gh?(N=Je=o,L=20):t===fl?(N=E2,Je=x2,L=257):(N=A2,Je=k2,L=0),_=0,l=0,c=f,A=a,h=p,g=0,O=-1,b=1<<p,D=b-1,t===fl&&b>hh||t===yh&&b>mh)return 1;for(;;){je=c-g,o[l]+1<L?(z=0,we=o[l]):o[l]>=L?(z=Je[o[l]-L],we=N[o[l]-L]):(z=32+64,we=0),w=1<<c-g,y=1<<h,f=y;do y-=w,i[A+(_>>g)+y]=je<<24|z<<16|we|0;while(y!==0);for(w=1<<c-1;_&w;)w>>=1;if(w!==0?(_&=w-1,_+=w):_=0,l++,--P[c]===0){if(c===d)break;c=e[r+o[l]]}if(c>p&&(_&D)!==O){for(g===0&&(g=p),A+=f,h=c-g,v=1<<h;h+g<d&&(v-=P[h+g],!(v<=0));)h++,v<<=1;if(b+=1<<h,t===fl&&b>hh||t===yh&&b>mh)return 1;O=_&D,i[O]=p<<24|h<<16|A-a|0}}return _!==0&&(i[A+_]=c-g<<24|64<<16|0),s.bits=p,0},Ya=I2,T2=0,G1=1,K1=2,{Z_FINISH:vh,Z_BLOCK:O2,Z_TREES:Es,Z_OK:Xn,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}=ai,_c=16180,_h=16181,wh=16182,Sh=16183,Ch=16184,Eh=16185,xh=16186,Ah=16187,kh=16188,Ih=16189,sc=16190,_r=16191,dl=16192,Th=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,ke=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 oi=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(oi(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,Xn},tm=t=>{if(oi(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(oi(t))return jt;let n=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?jt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,tm(t))},nm=(t,e)=>{if(!t)return jt;let r=new M2;t.state=r,r.strm=t,r.window=null,r.mode=_c;let n=rm(t,e);return n!==Xn&&(t.state=null),n},U2=t=>nm(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(Ya(G1,t.lens,0,288,gl,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ya(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},im=(t,e,r,n)=>{let i,a=t.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(e.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(e.subarray(r-n,r-n+i),a.wnext),n-=i,n?(a.window.set(e.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},q2=(t,e)=>{let r,n,i,a,o,s,u,c,l,f,d,p,h,g,v=0,b,_,w,y,O,D,A,N,L=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(oi(t)||!t.output||!t.input&&t.avail_in!==0)return jt;r=t.state,r.mode===_r&&(r.mode=dl),o=t.next_out,i=t.output,u=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,c=r.hold,l=r.bits,f=s,d=u,N=Xn;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+=n[a++]<<l,l+=8}if(r.wrap&2&&c===35615){r.wbits===0&&(r.wbits=15),r.check=0,L[0]=c&255,L[1]=c>>>8&255,r.check=Ge(r.check,L,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=ke;break}if((c&15)!==bh){t.msg="unknown compression method",r.mode=ke;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=ke;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=c&512?Ih:_r,c=0,l=0;break;case _h:for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(r.flags=c,(r.flags&255)!==bh){t.msg="unknown compression method",r.mode=ke;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=ke;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&r.wrap&4&&(L[0]=c&255,L[1]=c>>>8&255,r.check=Ge(r.check,L,2,0)),c=0,l=0,r.mode=wh;case wh:for(;l<32;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}r.head&&(r.head.time=c),r.flags&512&&r.wrap&4&&(L[0]=c&255,L[1]=c>>>8&255,L[2]=c>>>16&255,L[3]=c>>>24&255,r.check=Ge(r.check,L,4,0)),c=0,l=0,r.mode=Sh;case Sh:for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}r.head&&(r.head.xflags=c&255,r.head.os=c>>8),r.flags&512&&r.wrap&4&&(L[0]=c&255,L[1]=c>>>8&255,r.check=Ge(r.check,L,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+=n[a++]<<l,l+=8}r.length=c,r.head&&(r.head.extra_len=c),r.flags&512&&r.wrap&4&&(L[0]=c&255,L[1]=c>>>8&255,r.check=Ge(r.check,L,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(n.subarray(a,a+p),A)),r.flags&512&&r.wrap&4&&(r.check=Ge(r.check,n,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=n[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,n,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=n[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,n,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+=n[a++]<<l,l+=8}if(r.wrap&4&&c!==(r.check&65535)){t.msg="header crc mismatch",r.mode=ke;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=_r;break;case Ih:for(;l<32;){if(s===0)break e;s--,c+=n[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=_r;case _r: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+=n[a++]<<l,l+=8}switch(r.last=c&1,c>>>=1,l-=1,c&3){case 0:r.mode=Th;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=ke}c>>>=2,l-=2;break;case Th:for(c>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if((c&65535)!==(c>>>16^65535)){t.msg="invalid stored block lengths",r.mode=ke;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;i.set(n.subarray(a,a+p),o),s-=p,a+=p,u-=p,o+=p,r.length-=p;break}r.mode=_r;break;case Dh:for(;l<14;){if(s===0)break e;s--,c+=n[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=ke;break}r.have=0,r.mode=Nh;case Nh:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,c+=n[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},N=Ya(T2,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,N){t.msg="invalid code lengths set",r.mode=ke;break}r.have=0,r.mode=Rh;case Rh:for(;r.have<r.nlen+r.ndist;){for(;v=r.lencode[c&(1<<r.lenbits)-1],b=v>>>24,_=v>>>16&255,w=v&65535,!(b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(w<16)c>>>=b,l-=b,r.lens[r.have++]=w;else{if(w===16){for(j=b+2;l<j;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(c>>>=b,l-=b,r.have===0){t.msg="invalid bit length repeat",r.mode=ke;break}A=r.lens[r.have-1],p=3+(c&3),c>>>=2,l-=2}else if(w===17){for(j=b+3;l<j;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=b,l-=b,A=0,p=3+(c&7),c>>>=3,l-=3}else{for(j=b+7;l<j;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=b,l-=b,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=ke;break}for(;p--;)r.lens[r.have++]=A}}if(r.mode===ke)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=ke;break}if(r.lenbits=9,P={bits:r.lenbits},N=Ya(G1,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,N){t.msg="invalid literal/lengths set",r.mode=ke;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},N=Ya(K1,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,N){t.msg="invalid distances set",r.mode=ke;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,d),o=t.next_out,i=t.output,u=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,c=r.hold,l=r.bits,r.mode===_r&&(r.back=-1);break}for(r.back=0;v=r.lencode[c&(1<<r.lenbits)-1],b=v>>>24,_=v>>>16&255,w=v&65535,!(b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(_&&(_&240)===0){for(y=b,O=_,D=w;v=r.lencode[D+((c&(1<<y+O)-1)>>y)],b=v>>>24,_=v>>>16&255,w=v&65535,!(y+b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=y,l-=y,r.back+=y}if(c>>>=b,l-=b,r.back+=b,r.length=w,_===0){r.mode=Mh;break}if(_&32){r.back=-1,r.mode=_r;break}if(_&64){t.msg="invalid literal/length code",r.mode=ke;break}r.extra=_&15,r.mode=Ph;case Ph:if(r.extra){for(j=r.extra;l<j;){if(s===0)break e;s--,c+=n[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(;v=r.distcode[c&(1<<r.distbits)-1],b=v>>>24,_=v>>>16&255,w=v&65535,!(b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if((_&240)===0){for(y=b,O=_,D=w;v=r.distcode[D+((c&(1<<y+O)-1)>>y)],b=v>>>24,_=v>>>16&255,w=v&65535,!(y+b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=y,l-=y,r.back+=y}if(c>>>=b,l-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=ke;break}r.offset=w,r.extra=_&15,r.mode=Lh;case Lh:if(r.extra){for(j=r.extra;l<j;){if(s===0)break e;s--,c+=n[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=ke;break}r.mode=Fh;case Fh:if(u===0)break e;if(p=d-u,r.offset>p){if(p=r.offset-p,p>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=ke;break}p>r.wnext?(p-=r.wnext,h=r.wsize-p):h=r.wnext-p,p>r.length&&(p=r.length),g=r.window}else g=i,h=o-r.offset,p=r.length;p>u&&(p=u),u-=p,r.length-=p;do i[o++]=g[h++];while(--p);r.length===0&&(r.mode=As);break;case Mh:if(u===0)break e;i[o++]=r.length,u--,r.mode=As;break;case ml:if(r.wrap){for(;l<32;){if(s===0)break e;s--,c|=n[a++]<<l,l+=8}if(d-=u,t.total_out+=d,r.total+=d,r.wrap&4&&d&&(t.adler=r.check=r.flags?Ge(r.check,i,d,o-d):uo(r.check,i,d,o-d)),d=u,r.wrap&4&&(r.flags?c:qh(c))!==r.check){t.msg="incorrect data check",r.mode=ke;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+=n[a++]<<l,l+=8}if(r.wrap&4&&c!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=ke;break}c=0,l=0}r.mode=jh;case jh:N=D2;break e;case ke:N=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||d!==t.avail_out&&r.mode<ke&&(r.mode<ml||e!==vh))&&im(t,t.output,t.next_out,d-t.avail_out),f-=t.avail_in,d-=t.avail_out,t.total_in+=f,t.total_out+=d,r.total+=d,r.wrap&4&&d&&(t.adler=r.check=r.flags?Ge(r.check,i,d,t.next_out-d):uo(r.check,i,d,t.next_out-d)),t.data_type=r.bits+(r.last?64:0)+(r.mode===_r?128:0)+(r.mode===xs||r.mode===hl?256:0),(f===0&&d===0||e===vh)&&N===Xn&&(N=R2),N},B2=t=>{if(oi(t))return jt;let e=t.state;return e.window&&(e.window=null),t.state=null,Xn},V2=(t,e)=>{if(oi(t))return jt;let r=t.state;return(r.wrap&2)===0?jt:(r.head=e,e.done=!1,Xn)},Q2=(t,e)=>{let r=e.length,n,i,a;return oi(t)||(n=t.state,n.wrap!==0&&n.mode!==sc)?jt:n.mode===sc&&(i=1,i=uo(i,e,r,0),i!==n.check)?Z1:(a=im(t,e,r,r),a?(n.mode=Y1,J1):(n.havedict=1,Xn))},z2=tm,W2=rm,H2=em,G2=U2,K2=nm,Z2=q2,J2=B2,Y2=V2,X2=Q2,e3="pako inflate (from Nodeca project)",xr={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:n3,Z_FINISH:i3,Z_OK:fo,Z_STREAM_END:vl,Z_NEED_DICT:bl,Z_STREAM_ERROR:a3,Z_DATA_ERROR:Vh,Z_MEM_ERROR:o3}=ai;function wo(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=xr.inflateInit2(this.strm,e.windowBits);if(r!==fo)throw new Error(Jn[r]);if(this.header=new r3,xr.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=xr.inflateSetDictionary(this.strm,e.dictionary),r!==fo)))throw new Error(Jn[r])}wo.prototype.push=function(t,e){let r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?i3:n3,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(n),r.next_out=0,r.avail_out=n),a=xr.inflate(r,o),a===bl&&i&&(a=xr.inflateSetDictionary(r,i),a===fo?a=xr.inflate(r,o):a===Vh&&(a=bl));r.avail_in>0&&a===vl&&r.state.wrap>0&&t[r.next_in]!==0;)xr.inflateReset(r),a=xr.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=n-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=xr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};wo.prototype.onData=function(t){this.chunks.push(t)};wo.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 wo(e);if(r.push(t),r.err)throw r.msg||Jn[r.err];return r.result}function s3(t,e){return e=e||{},e.raw=!0,ap(t,e)}var c3=wo,u3=ap,l3=s3,p3=ap,f3=ai,d3={Inflate:c3,inflate:u3,inflateRaw:l3,ungzip:p3,constants:f3},{Deflate:h3,deflate:m3,deflateRaw:g3,gzip:y3}=w2,{Inflate:v3,inflate:b3,inflateRaw:_3,ungzip:w3}=d3,S3=h3,C3=m3,E3=g3,x3=y3,A3=v3,k3=b3,I3=_3,T3=w3,O3=ai,D3={Deflate:S3,deflate:C3,deflateRaw:E3,gzip:x3,Inflate:A3,inflate:k3,inflateRaw:I3,ungzip:T3,constants:O3},Ce=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ee=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}};Ce([m(),Ee("design:type",String)],cc.prototype,"input",void 0);Ce([m(),Ee("design:type",String)],cc.prototype,"output",void 0);cc=Ce([Ze(),Ee("design:paramtypes",[String,String])],cc);var uc=class{constructor(e,r){this.input=e,this.output=r}};Ce([m(),Ee("design:type",String)],uc.prototype,"input",void 0);Ce([m(),Ee("design:type",String)],uc.prototype,"output",void 0);uc=Ce([W(),Ee("design:paramtypes",[String,String])],uc);var cn=class{constructor(e,r,n,i,a){this.name=e,this.modelId=r,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};Ce([m(),Ee("design:type",String)],cn.prototype,"name",void 0);Ce([m(),Ee("design:type",String)],cn.prototype,"modelId",void 0);Ce([m(),Ee("design:type",String)],cn.prototype,"systemPrompt",void 0);Ce([m(),Ee("design:type",Array)],cn.prototype,"promptExamples",void 0);Ce([m(),Ee("design:type",String)],cn.prototype,"metaData",void 0);cn=Ce([Ze(),Ee("design:paramtypes",[String,String,String,Array,String])],cn);var dr=class{constructor(e,r,n,i,a,o,s,u){this.name=e,this.modelId=r,this.taskId=n,this.systemPrompt=i,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=u}};Ce([m(),Ee("design:type",String)],dr.prototype,"name",void 0);Ce([m(),Ee("design:type",String)],dr.prototype,"modelId",void 0);Ce([m(),Ee("design:type",String)],dr.prototype,"taskId",void 0);Ce([m(),Ee("design:type",String)],dr.prototype,"systemPrompt",void 0);Ce([m(),Ee("design:type",Array)],dr.prototype,"promptExamples",void 0);Ce([m(),Ee("design:type",String)],dr.prototype,"metaData",void 0);Ce([m(),Ee("design:type",String)],dr.prototype,"createdAt",void 0);Ce([m(),Ee("design:type",String)],dr.prototype,"updatedAt",void 0);dr=Ce([W(),Ee("design:paramtypes",[String,String,String,String,Array,String,String,String])],dr);var ei=class{constructor(e,r,n,i,a){this.model=e,this.status=r,this.progress=n,this.downloaded=i,this.loaded=a}};Ce([m(),Ee("design:type",String)],ei.prototype,"model",void 0);Ce([m(),Ee("design:type",String)],ei.prototype,"status",void 0);Ce([m(),Ee("design:type",Number)],ei.prototype,"progress",void 0);Ce([m(),Ee("design:type",Boolean)],ei.prototype,"downloaded",void 0);Ce([m(),Ee("design:type",Boolean)],ei.prototype,"loaded",void 0);ei=Ce([W(),Ee("design:paramtypes",[String,String,Number,Boolean,Boolean])],ei);var N3=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ze=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.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`
706
726
  query {
707
727
  aiGetModels {
708
728
  id
@@ -726,23 +746,23 @@ triggerMatch
726
746
  modelType
727
747
  }
728
748
  }
729
- `});return I(e).aiGetModels}async addModel(e){let r=await Qe(this,qe,"f").mutate({mutation:E`
749
+ `});return k(e).aiGetModels}async addModel(e){let r=await ze(this,Ve,"f").mutate({mutation:E`
730
750
  mutation($model: ModelInput!) {
731
751
  aiAddModel(model: $model)
732
752
  }
733
- `,variables:{model:e}});return I(r).aiAddModel}async updateModel(e,r){let n=await Qe(this,qe,"f").mutate({mutation:E`
753
+ `,variables:{model:e}});return k(r).aiAddModel}async updateModel(e,r){let n=await ze(this,Ve,"f").mutate({mutation:E`
734
754
  mutation($modelId: String!, $model: ModelInput!) {
735
755
  aiUpdateModel(modelId: $modelId, model: $model)
736
756
  }
737
- `,variables:{modelId:e,model:r}});return I(n).aiUpdateModel}async removeModel(e){let r=await Qe(this,qe,"f").mutate({mutation:E`
757
+ `,variables:{modelId:e,model:r}});return k(n).aiUpdateModel}async removeModel(e){let r=await ze(this,Ve,"f").mutate({mutation:E`
738
758
  mutation($modelId: String!) {
739
759
  aiRemoveModel(modelId: $modelId)
740
760
  }
741
- `,variables:{modelId:e}});return I(r).aiRemoveModel}async setDefaultModel(e,r){let n=await Qe(this,qe,"f").mutate({mutation:E`
761
+ `,variables:{modelId:e}});return k(r).aiRemoveModel}async setDefaultModel(e,r){let n=await ze(this,Ve,"f").mutate({mutation:E`
742
762
  mutation($modelType: ModelType!, $modelId: String!) {
743
763
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
744
764
  }
745
- `,variables:{modelId:r,modelType:e}});return I(n).aiSetDefaultModel}async getDefaultModel(e){let r=await Qe(this,qe,"f").query({query:E`
765
+ `,variables:{modelId:r,modelType:e}});return k(n).aiSetDefaultModel}async getDefaultModel(e){let r=await ze(this,Ve,"f").query({query:E`
746
766
  query($modelType: ModelType!) {
747
767
  aiGetDefaultModel(modelType: $modelType) {
748
768
  id
@@ -766,7 +786,7 @@ triggerMatch
766
786
  modelType
767
787
  }
768
788
  }
769
- `,variables:{modelType:e}});return I(r).aiGetDefaultModel}async tasks(){let{aiTasks:e}=I(await Qe(this,qe,"f").query({query:E`
789
+ `,variables:{modelType:e}});return k(r).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await ze(this,Ve,"f").query({query:E`
770
790
  query {
771
791
  aiTasks {
772
792
  name
@@ -782,7 +802,7 @@ triggerMatch
782
802
  updatedAt
783
803
  }
784
804
  }
785
- `}));return e}async addTask(e,r,n,i,a){let o=new cn(e,r,n,i,a),{aiAddTask:s}=I(await Qe(this,qe,"f").mutate({mutation:E`
805
+ `}));return e}async addTask(e,r,n,i,a){let o=new cn(e,r,n,i,a),{aiAddTask:s}=k(await ze(this,Ve,"f").mutate({mutation:E`
786
806
  mutation AiAddTask($task: AITaskInput!) {
787
807
  aiAddTask(task: $task) {
788
808
  name
@@ -798,7 +818,7 @@ triggerMatch
798
818
  updatedAt
799
819
  }
800
820
  }
801
- `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:r}=I(await Qe(this,qe,"f").mutate({mutation:E`
821
+ `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:r}=k(await ze(this,Ve,"f").mutate({mutation:E`
802
822
  mutation AiRemoveTask($taskId: String!) {
803
823
  aiRemoveTask(taskId: $taskId) {
804
824
  name
@@ -814,7 +834,7 @@ triggerMatch
814
834
  updatedAt
815
835
  }
816
836
  }
817
- `,variables:{taskId:e}}));return r}async updateTask(e,r){let{aiUpdateTask:n}=I(await Qe(this,qe,"f").mutate({mutation:E`
837
+ `,variables:{taskId:e}}));return r}async updateTask(e,r){let{aiUpdateTask:n}=k(await ze(this,Ve,"f").mutate({mutation:E`
818
838
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
819
839
  aiUpdateTask(taskId: $taskId, task: $task) {
820
840
  name
@@ -830,7 +850,7 @@ triggerMatch
830
850
  updatedAt
831
851
  }
832
852
  }
833
- `,variables:{taskId:e,task:{name:r.name,modelId:r.modelId,systemPrompt:r.systemPrompt,promptExamples:r.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:r}=I(await Qe(this,qe,"f").query({query:E`
853
+ `,variables:{taskId:e,task:{name:r.name,modelId:r.modelId,systemPrompt:r.systemPrompt,promptExamples:r.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:r}=k(await ze(this,Ve,"f").query({query:E`
834
854
  query AiModelLoadingStatus($model: String!) {
835
855
  aiModelLoadingStatus(model: $model) {
836
856
  model
@@ -840,51 +860,51 @@ triggerMatch
840
860
  downloaded
841
861
  }
842
862
  }
843
- `,variables:{model:e}}));return r}async prompt(e,r){let{aiPrompt:n}=I(await Qe(this,qe,"f").mutate({mutation:E`
863
+ `,variables:{model:e}}));return r}async prompt(e,r){let{aiPrompt:n}=k(await ze(this,Ve,"f").mutate({mutation:E`
844
864
  mutation AiPrompt($taskId: String!, $prompt: String!) {
845
865
  aiPrompt(taskId: $taskId, prompt: $prompt)
846
866
  }
847
- `,variables:{taskId:e,prompt:r}}));return n}async embed(e,r){let{aiEmbed:n}=I(await Qe(this,qe,"f").mutate({mutation:E`
867
+ `,variables:{taskId:e,prompt:r}}));return n}async embed(e,r){let{aiEmbed:n}=k(await ze(this,Ve,"f").mutate({mutation:E`
848
868
  mutation aiEmbed($modelId: String!, $text: String!) {
849
869
  aiEmbed(modelId: $modelId, text: $text)
850
870
  }
851
- `,variables:{modelId:e,text:r}})),i=fc.toByteArray(n);return JSON.parse(x3.inflate(i,{to:"string"}))}async openTranscriptionStream(e,r,n){let{aiOpenTranscriptionStream:i}=I(await Qe(this,qe,"f").mutate({mutation:E`
871
+ `,variables:{modelId:e,text:r}})),i=yc.toByteArray(n);return JSON.parse(D3.inflate(i,{to:"string"}))}async openTranscriptionStream(e,r,n){let{aiOpenTranscriptionStream:i}=k(await ze(this,Ve,"f").mutate({mutation:E`
852
872
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
853
873
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
854
874
  }
855
- `,variables:{modelId:e,params:n}})),a=Qe(this,qe,"f").subscribe({query:E` subscription {
875
+ `,variables:{modelId:e,params:n}})),a=ze(this,Ve,"f").subscribe({query:E` subscription {
856
876
  aiTranscriptionText(streamId: "${i}")
857
- }`}).subscribe({next(o){return r(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Qe(this,Rs,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:r}=I(await Qe(this,qe,"f").mutate({mutation:E`
877
+ }`}).subscribe({next(o){return r(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return ze(this,js,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:r}=k(await ze(this,Ve,"f").mutate({mutation:E`
858
878
  mutation aiCloseTranscriptionStream($streamId: String!) {
859
879
  aiCloseTranscriptionStream(streamId: $streamId)
860
880
  }
861
- `,variables:{streamId:e}})),n=Qe(this,Rs,"f").get(e);return n.closed||n.unsubscribe(),r}async feedTranscriptionStream(e,r){let{aiFeedTranscriptionStream:n}=I(await Qe(this,qe,"f").mutate({mutation:E`
881
+ `,variables:{streamId:e}})),n=ze(this,js,"f").get(e);return n.closed||n.unsubscribe(),r}async feedTranscriptionStream(e,r){let{aiFeedTranscriptionStream:n}=k(await ze(this,Ve,"f").mutate({mutation:E`
862
882
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
863
883
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
864
884
  }
865
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:r}}));return n}};qe=new WeakMap,Rs=new WeakMap;var Wr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ue=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ir,$s,Va,Ls,Qa,Fn,Fs,za,ic=class{constructor(e,r=!0){ir.set(this,void 0),$s.set(this,void 0),Va.set(this,void 0),Ls.set(this,void 0),Qa.set(this,void 0),Fn.set(this,void 0),Fs.set(this,void 0),za.set(this,void 0),Wr(this,ir,e,"f"),Wr(this,$s,new Xa(Ue(this,ir,"f"),r),"f"),Wr(this,Va,new Il(Ue(this,ir,"f")),"f"),Wr(this,Ls,new xl(Ue(this,ir,"f")),"f"),Wr(this,Qa,new Al(Ue(this,ir,"f")),"f"),Wr(this,za,new Ml(Ue(this,ir,"f"),r),"f"),Wr(this,Fn,new Ys(Ue(this,ir,"f"),r),"f"),Ue(this,Fn,"f").setExpressionClient(Ue(this,Va,"f")),Ue(this,Fn,"f").setNeighbourhoodClient(Ue(this,Qa,"f")),Ue(this,Fn,"f").setAIClient(Ue(this,za,"f")),Wr(this,Fs,new kl(Ue(this,ir,"f"),r),"f")}get agent(){return Ue(this,$s,"f")}get expression(){return Ue(this,Va,"f")}get languages(){return Ue(this,Ls,"f")}get neighbourhood(){return Ue(this,Qa,"f")}get perspective(){return Ue(this,Fn,"f")}get runtime(){return Ue(this,Fs,"f")}get ai(){return Ue(this,za,"f")}};ir=new WeakMap,$s=new WeakMap,Va=new WeakMap,Ls=new WeakMap,Qa=new WeakMap,Fn=new WeakMap,Fs=new WeakMap,za=new WeakMap;var jl;(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"})(jl||(jl={}));var tp=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},rp=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Vn=class{constructor(e,r){this.language=e,this.expression=r}};tp([g(),rp("design:type",cr)],Vn.prototype,"language",void 0);tp([g(),rp("design:type",String)],Vn.prototype,"expression",void 0);Vn=tp([G(),rp("design:paramtypes",[cr,String])],Vn);function W7(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function H7(t){if(t.startsWith("literal://")){let a=new cr;a.address="literal",a.name="literal";let o=t.substring(10);return new Vn(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new cr;return s.address=a,new Vn(s,o)}let i=/^did:([^\s]+)$/.exec(t);if(i&&i.length==2){let a=new cr;return a.address="did",new Vn(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var Dt=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},dr=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ac=class{};Dt([g(),dr("design:type",String)],ac.prototype,"name",void 0);Dt([g(),dr("design:type",String)],ac.prototype,"type",void 0);ac=Dt([G()],ac);var co=class{};Dt([g(),dr("design:type",String)],co.prototype,"label",void 0);Dt([g(),dr("design:type",String)],co.prototype,"name",void 0);Dt([g(),dr("design:type",Array)],co.prototype,"parameters",void 0);co=Dt([G()],co);var oc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};Dt([g(),dr("design:type",String)],oc.prototype,"name",void 0);Dt([g(),dr("design:type",String)],oc.prototype,"parametersStringified",void 0);oc=Dt([Ke(),dr("design:paramtypes",[String,Object])],oc);var sc=class{};Dt([g(),dr("design:type",String)],sc.prototype,"did",void 0);Dt([g(),dr("design:type",Gn)],sc.prototype,"status",void 0);sc=Dt([G()],sc);var Mh=class{},oi=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Zi=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},un=class{};oi([g(),Zi("design:type",String)],un.prototype,"name",void 0);oi([g(),Zi("design:type",String)],un.prototype,"address",void 0);oi([g(),Zi("design:type",String)],un.prototype,"settings",void 0);oi([g(),Zi("design:type",zn)],un.prototype,"icon",void 0);oi([g(),Zi("design:type",zn)],un.prototype,"constructorIcon",void 0);oi([g(),Zi("design:type",zn)],un.prototype,"settingsIcon",void 0);un=oi([G()],un);var dt=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},wt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ht=class{};dt([g(),wt("design:type",String)],Ht.prototype,"name",void 0);dt([g(),wt("design:type",String)],Ht.prototype,"address",void 0);dt([g(),wt("design:type",String)],Ht.prototype,"description",void 0);dt([g(),wt("design:type",String)],Ht.prototype,"author",void 0);dt([g(),wt("design:type",Boolean)],Ht.prototype,"templated",void 0);dt([g(),wt("design:type",String)],Ht.prototype,"templateSourceLanguageAddress",void 0);dt([g(),wt("design:type",String)],Ht.prototype,"templateAppliedParams",void 0);dt([g(),wt("design:type",Array)],Ht.prototype,"possibleTemplateParams",void 0);dt([g(),wt("design:type",String)],Ht.prototype,"sourceCodeLink",void 0);Ht=dt([G()],Ht);var Bi=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};dt([g(),wt("design:type",String)],Bi.prototype,"name",void 0);dt([g(),wt("design:type",String)],Bi.prototype,"description",void 0);dt([g(),wt("design:type",Array)],Bi.prototype,"possibleTemplateParams",void 0);dt([g(),wt("design:type",String)],Bi.prototype,"sourceCodeLink",void 0);Bi=dt([Ke(),wt("design:paramtypes",[String,String])],Bi);var jh=class{},Uh=class extends pn(){},qh=class{},gc=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},np=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},cc=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};gc([g(),np("design:type",String)],cc.prototype,"linkLanguage",void 0);gc([g(),np("design:type",pr)],cc.prototype,"meta",void 0);cc=gc([G(),np("design:paramtypes",[String,pr])],cc);var Ul=class extends pn(){};Ul=gc([G()],Ul);var Ji=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Yi=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ql;(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"})(ql||(ql={}));var Xn=class{constructor(e,r,n){this.uuid=e,this.name=r,n?this.state=n:this.state=ql.Private}};Ji([g(),Yi("design:type",String)],Xn.prototype,"uuid",void 0);Ji([g(),Yi("design:type",String)],Xn.prototype,"name",void 0);Ji([g(),Yi("design:type",String)],Xn.prototype,"state",void 0);Ji([g(),Yi("design:type",String)],Xn.prototype,"sharedUrl",void 0);Ji([g(),Yi("design:type",Ul)],Xn.prototype,"neighbourhood",void 0);Xn=Ji([G(),Yi("design:paramtypes",[String,String,String])],Xn);var yc=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},em=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},uc=class{};yc([g(),em("design:type",Array)],uc.prototype,"additions",void 0);yc([g(),em("design:type",Array)],uc.prototype,"removals",void 0);uc=yc([G()],uc);var Bh=class extends pn(){};Bh=yc([G()],Bh);var Vh=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ni=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Wa,Mn,Ss="smart_literal://content";function k3(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}var uo=class{constructor(e,r){Wa.set(this,void 0),Mn.set(this,void 0),Vh(this,Wa,e,"f"),Vh(this,Mn,r,"f")}get base(){return Ni(this,Mn,"f")}static async create(e,r){let n=St.from(k3(10)).toUrl(),i=new uo(e,n);return await i.set(r),i}static async isSmartLiteralBase(e,r){return(await e.get(new at({source:r,predicate:Ss}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new at({predicate:Ss}))).map(n=>new uo(e,n.data.source))}async get(){let e=await Ni(this,Wa,"f").getSingleTarget(new at({source:Ni(this,Mn,"f"),predicate:Ss}));if(!e)throw`No content for smart literal ${Ni(this,Mn,"f")}`;return St.fromUrl(e).get()}async set(e){let r=St.from(e);await Ni(this,Wa,"f").setSingleTarget(new Hn({source:Ni(this,Mn,"f"),predicate:Ss,target:r.toUrl()}))}};Wa=new WeakMap,Mn=new WeakMap;var Qh=class{};function ow(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function sw(t){return`triple(this, "${t}", _)`}function cw(t){return function(e,r,n){if(typeof n.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");n.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 Zs(a,d,s);await f.init(),o.push(f)}return o}}}function tm(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 n=r;e[`set${Xr(n)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function uw(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 lw(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let n=r;e[`add${Xr(n)}`]=()=>{},e[`remove${Xr(n)}`]=()=>{},e[`setCollection${Xr(n)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function rm(t){let e="",r="abcdefghijklmnopqrstuvwxyz",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}function I3(t){return function(e){e.prototype.className=t.name,e.className=t.name,e.generateSDNA=function(){let r="",n=t.name,i=e.prototype,a=rm(8);r+=`subject_class("${n}", ${a}).
866
- `;let o=[],s=[];i.subjectConstructor&&i.subjectConstructor.length&&(s=s.concat(i.subjectConstructor));let u=[];i.isSubjectInstance&&i.isSubjectInstance.length&&(u=u.concat(i.isSubjectInstance));let c=[],l=i.__properties||{};for(let h in l){let m=`property(${a}, "${h}").
867
- `,{through:v,initial:b,required:_,resolveLanguage:S,writable:y,flag:O,getter:D,setter:A,local:N}=l[h];if(S&&(m+=`property_resolve(${a}, "${h}").
868
- `,m+=`property_resolve_language(${a}, "${h}", "${S}").
869
- `),D?m+=`property_getter(${a}, Base, "${h}", Value) :- ${D}.
870
- `:v&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${v}", Value).
871
- `,_&&(O?u.push(`triple(Base, "${v}", "${b}")`):u.push(`triple(Base, "${v}", _)`))),A)m+=`property_setter(${a}, "${h}", Actions) :- ${A}.
872
- `;else if(y&&v&&typeof i[Wl(h)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:v,target:"value",...N&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${On(P)}').
873
- `}c.push(m),b&&(s.push({action:"addLink",source:"this",predicate:v,target:b}),o.push({action:"removeLink",source:"this",predicate:v,target:"*"}))}let d=[],f=i.__collections||{};for(let h in f){let m=`collection(${a}, "${h}").
874
- `,{through:v,where:b,local:_}=f[h];if(v){if(b){if(!b.isInstance&&!b.condition)throw"'where' needs one of 'isInstance' or 'condition'";let D=[];if(b.isInstance){let N;b.isInstance.name?N=b.isInstance.name:N=b.isInstance,D.push(`instance(OtherClass, Target), subject_class("${N}", OtherClass)`)}b.condition&&D.push(b.condition);let A=D.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${v}", Target), ${A}), List).
875
- `}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${v}", C), List).
876
- `;let S=[{action:"addLink",source:"this",predicate:v,target:"value",..._&&{local:!0}}],y=[{action:"removeLink",source:"this",predicate:v,target:"value"}],O=[{action:"collectionSetter",source:"this",predicate:v,target:"value",..._&&{local:!0}}];m+=`collection_adder(${a}, "${Ar(h)}", '${On(S)}').
877
- `,m+=`collection_remover(${a}, "${Ar(h)}", '${On(y)}').
878
- `,m+=`collection_setter(${a}, "${Ar(h)}", '${On(O)}').
879
- `}d.push(m)}let p=On(s);if(r+=`constructor(${a}, '${p}').
885
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:r}}));return n}};Ve=new WeakMap,js=new WeakMap;var Wr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Be=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ar,qs,Wa,Bs,Ha,Un,Vs,Ga,ho=class{constructor(e,r=!0){ar.set(this,void 0),qs.set(this,void 0),Wa.set(this,void 0),Bs.set(this,void 0),Ha.set(this,void 0),Un.set(this,void 0),Vs.set(this,void 0),Ga.set(this,void 0),Wr(this,ar,e,"f"),Wr(this,qs,new io(Be(this,ar,"f"),r),"f"),Wr(this,Wa,new Rl(Be(this,ar,"f")),"f"),Wr(this,Bs,new Ol(Be(this,ar,"f")),"f"),Wr(this,Ha,new Dl(Be(this,ar,"f")),"f"),Wr(this,Ga,new Vl(Be(this,ar,"f"),r),"f"),Wr(this,Un,new ic(Be(this,ar,"f"),r),"f"),Be(this,Un,"f").setExpressionClient(Be(this,Wa,"f")),Be(this,Un,"f").setNeighbourhoodClient(Be(this,Ha,"f")),Be(this,Un,"f").setAIClient(Be(this,Ga,"f")),Wr(this,Vs,new Nl(Be(this,ar,"f"),r),"f")}get agent(){return Be(this,qs,"f")}get expression(){return Be(this,Wa,"f")}get languages(){return Be(this,Bs,"f")}get neighbourhood(){return Be(this,Ha,"f")}get perspective(){return Be(this,Un,"f")}get runtime(){return Be(this,Vs,"f")}get ai(){return Be(this,Ga,"f")}};ar=new WeakMap,qs=new WeakMap,Wa=new WeakMap,Bs=new WeakMap,Ha=new WeakMap,Un=new WeakMap,Vs=new WeakMap,Ga=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,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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)},zn=class{constructor(e,r){this.language=e,this.expression=r}};op([m(),sp("design:type",ur)],zn.prototype,"language",void 0);op([m(),sp("design:type",String)],zn.prototype,"expression",void 0);zn=op([W(),sp("design:paramtypes",[ur,String])],zn);function e7(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function t7(t){if(t.startsWith("literal://")){let a=new ur;a.address="literal",a.name="literal";let o=t.substring(10);return new zn(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 zn(s,o)}let i=/^did:([^\s]+)$/.exec(t);if(i&&i.length==2){let a=new ur;return a.address="did",new zn(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var Nt=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},hr=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},lc=class{};Nt([m(),hr("design:type",String)],lc.prototype,"name",void 0);Nt([m(),hr("design:type",String)],lc.prototype,"type",void 0);lc=Nt([W()],lc);var mo=class{};Nt([m(),hr("design:type",String)],mo.prototype,"label",void 0);Nt([m(),hr("design:type",String)],mo.prototype,"name",void 0);Nt([m(),hr("design:type",Array)],mo.prototype,"parameters",void 0);mo=Nt([W()],mo);var pc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};Nt([m(),hr("design:type",String)],pc.prototype,"name",void 0);Nt([m(),hr("design:type",String)],pc.prototype,"parametersStringified",void 0);pc=Nt([Ze(),hr("design:paramtypes",[String,Object])],pc);var fc=class{};Nt([m(),hr("design:type",String)],fc.prototype,"did",void 0);Nt([m(),hr("design:type",Zn)],fc.prototype,"status",void 0);fc=Nt([W()],fc);var Qh=class{},si=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},ea=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},un=class{};si([m(),ea("design:type",String)],un.prototype,"name",void 0);si([m(),ea("design:type",String)],un.prototype,"address",void 0);si([m(),ea("design:type",String)],un.prototype,"settings",void 0);si([m(),ea("design:type",Hn)],un.prototype,"icon",void 0);si([m(),ea("design:type",Hn)],un.prototype,"constructorIcon",void 0);si([m(),ea("design:type",Hn)],un.prototype,"settingsIcon",void 0);un=si([W()],un);var ht=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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([m(),Ct("design:type",String)],Gt.prototype,"name",void 0);ht([m(),Ct("design:type",String)],Gt.prototype,"address",void 0);ht([m(),Ct("design:type",String)],Gt.prototype,"description",void 0);ht([m(),Ct("design:type",String)],Gt.prototype,"author",void 0);ht([m(),Ct("design:type",Boolean)],Gt.prototype,"templated",void 0);ht([m(),Ct("design:type",String)],Gt.prototype,"templateSourceLanguageAddress",void 0);ht([m(),Ct("design:type",String)],Gt.prototype,"templateAppliedParams",void 0);ht([m(),Ct("design:type",Array)],Gt.prototype,"possibleTemplateParams",void 0);ht([m(),Ct("design:type",String)],Gt.prototype,"sourceCodeLink",void 0);Gt=ht([W()],Gt);var zi=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ht([m(),Ct("design:type",String)],zi.prototype,"name",void 0);ht([m(),Ct("design:type",String)],zi.prototype,"description",void 0);ht([m(),Ct("design:type",Array)],zi.prototype,"possibleTemplateParams",void 0);ht([m(),Ct("design:type",String)],zi.prototype,"sourceCodeLink",void 0);zi=ht([Ze(),Ct("design:paramtypes",[String,String])],zi);var zh=class{},Wh=class extends fn(){},Hh=class{},wc=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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}};wc([m(),cp("design:type",String)],dc.prototype,"linkLanguage",void 0);wc([m(),cp("design:type",fr)],dc.prototype,"meta",void 0);dc=wc([W(),cp("design:paramtypes",[String,fr])],dc);var zl=class extends fn(){};zl=wc([W()],zl);var ci=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},ui=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 ln=class{constructor(e,r,n){this.uuid=e,this.name=r,n?this.state=n:this.state=Wl.Private}};ci([m(),ui("design:type",String)],ln.prototype,"uuid",void 0);ci([m(),ui("design:type",String)],ln.prototype,"name",void 0);ci([m(),ui("design:type",String)],ln.prototype,"state",void 0);ci([m(),ui("design:type",String)],ln.prototype,"sharedUrl",void 0);ci([m(),ui("design:type",zl)],ln.prototype,"neighbourhood",void 0);ci([m(),ui("design:type",Array)],ln.prototype,"owners",void 0);ln=ci([W(),ui("design:paramtypes",[String,String,String])],ln);var Sc=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>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{};Sc([m(),om("design:type",Array)],hc.prototype,"additions",void 0);Sc([m(),om("design:type",Array)],hc.prototype,"removals",void 0);hc=Sc([W()],hc);var Gh=class extends fn(){};Gh=Sc([W()],Gh);var Kh=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},$i=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ka,jn,ks="smart_literal://content";function R3(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}var go=class{constructor(e,r){Ka.set(this,void 0),jn.set(this,void 0),Kh(this,Ka,e,"f"),Kh(this,jn,r,"f")}get base(){return $i(this,jn,"f")}static async create(e,r){let n=St.from(R3(10)).toUrl(),i=new go(e,n);return await i.set(r),i}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(n=>new go(e,n.data.source))}async get(){let e=await $i(this,Ka,"f").getSingleTarget(new ot({source:$i(this,jn,"f"),predicate:ks}));if(!e)throw`No content for smart literal ${$i(this,jn,"f")}`;return St.fromUrl(e).get()}async set(e){let r=St.from(e);await $i(this,Ka,"f").setSingleTarget(new Kn({source:$i(this,jn,"f"),predicate:ks,target:r.toUrl()}))}};Ka=new WeakMap,jn=new WeakMap;var Zh=class{};function h7(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function m7(t){return`triple(this, "${t}", _)`}function g7(t){return function(e,r,n){if(typeof n.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");n.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 f=t.where[l];u+=`, property_getter(C, Instance, "${l}", "${f}")`}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 f=l.Instance,d=new rc(a,f,s);await d.init(),o.push(d)}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 n=r;e[`set${Xr(n)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function y7(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 v7(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let n=r;e[`add${Xr(n)}`]=()=>{},e[`remove${Xr(n)}`]=()=>{},e[`setCollection${Xr(n)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function cm(t){let e="",r="abcdefghijklmnopqrstuvwxyz",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}function P3(t){return function(e){e.prototype.className=t.name,e.className=t.name,e.generateSDNA=function(){let r="",n=t.name,i=e.prototype,a=cm(8);r+=`subject_class("${n}", ${a}).
886
+ `;let o=[],s=[];i.subjectConstructor&&i.subjectConstructor.length&&(s=s.concat(i.subjectConstructor));let u=[];i.isSubjectInstance&&i.isSubjectInstance.length&&(u=u.concat(i.isSubjectInstance));let c=[],l=i.__properties||{};for(let h in l){let g=`property(${a}, "${h}").
887
+ `,{through:v,initial:b,required:_,resolveLanguage:w,writable:y,flag:O,getter:D,setter:A,local:N}=l[h];if(w&&(g+=`property_resolve(${a}, "${h}").
888
+ `,g+=`property_resolve_language(${a}, "${h}", "${w}").
889
+ `),D?g+=`property_getter(${a}, Base, "${h}", Value) :- ${D}.
890
+ `:v&&(g+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${v}", Value).
891
+ `,_&&(O?u.push(`triple(Base, "${v}", "${b}")`):u.push(`triple(Base, "${v}", _)`))),A)g+=`property_setter(${a}, "${h}", Actions) :- ${A}.
892
+ `;else if(y&&v&&typeof i[Jl(h)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:v,target:"value",...N&&{local:!0}}];g+=`property_setter(${a}, "${h}", '${Nn(P)}').
893
+ `}c.push(g),b&&(s.push({action:"addLink",source:"this",predicate:v,target:b}),o.push({action:"removeLink",source:"this",predicate:v,target:"*"}))}let f=[],d=i.__collections||{};for(let h in d){let g=`collection(${a}, "${h}").
894
+ `,{through:v,where:b,local:_}=d[h];if(v){if(b){if(!b.isInstance&&!b.condition)throw"'where' needs one of 'isInstance' or 'condition'";let D=[];if(b.isInstance){let N;b.isInstance.name?N=b.isInstance.name:N=b.isInstance,D.push(`instance(OtherClass, Target), subject_class("${N}", OtherClass)`)}b.condition&&D.push(b.condition);let A=D.join(", ");g+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${v}", Target), ${A}), List).
895
+ `}else g+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${v}", C), List).
896
+ `;let w=[{action:"addLink",source:"this",predicate:v,target:"value",..._&&{local:!0}}],y=[{action:"removeLink",source:"this",predicate:v,target:"value"}],O=[{action:"collectionSetter",source:"this",predicate:v,target:"value",..._&&{local:!0}}];g+=`collection_adder(${a}, "${Ar(h)}", '${Nn(w)}').
897
+ `,g+=`collection_remover(${a}, "${Ar(h)}", '${Nn(y)}').
898
+ `,g+=`collection_setter(${a}, "${Ar(h)}", '${Nn(O)}').
899
+ `}f.push(g)}let p=Nn(s);if(r+=`constructor(${a}, '${p}').
880
900
  `,u.length>0){let h=u.join(", ");r+=`instance(${a}, Base) :- ${h}.
881
901
  `,r+=`
882
- `}return r+=`destructor(${a}, '${On(o)}').
902
+ `}return r+=`destructor(${a}, '${Nn(o)}').
883
903
  `,r+=`
884
904
  `,r+=c.join(`
885
905
  `),r+=`
886
- `,r+=d.join(`
887
- `),{sdna:r,name:n}},Object.defineProperty(e,"type",{configurable:!0})}}function pw(t){return tm({...t,required:!0,writable:!0,initial:t.initial||"literal://string:uninitialized"})}function fw(t){return tm({...t,writable:!1})}var dw=`
906
+ `,r+=f.join(`
907
+ `),{sdna:r,name:n}},Object.defineProperty(e,"type",{configurable:!0})}}function b7(t){return sm({...t,required:!0,writable:!0,initial:t.initial||"literal://string:uninitialized"})}function _7(t){return sm({...t,writable:!1})}var w7=`
888
908
  type AIModelLoadingStatus {
889
909
  downloaded: Boolean!
890
910
  loaded: Boolean!
@@ -1253,6 +1273,7 @@ type Mutation {
1253
1273
  runtimeRemoveNotification(id: String!): Boolean!
1254
1274
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
1255
1275
  runtimeRestartHolochain: Boolean!
1276
+ runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
1256
1277
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
1257
1278
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
1258
1279
  }
@@ -1312,6 +1333,7 @@ type PerspectiveExpression {
1312
1333
  type PerspectiveHandle {
1313
1334
  name: String!
1314
1335
  neighbourhood: NeighbourhoodExpression
1336
+ owners: [String!]
1315
1337
  sharedUrl: String
1316
1338
  state: String!
1317
1339
  uuid: String!
@@ -1360,8 +1382,10 @@ type Query {
1360
1382
  runtimeHcAgentInfos: String!
1361
1383
  runtimeInfo: RuntimeInfo!
1362
1384
  runtimeKnownLinkLanguageTemplates: [String!]!
1385
+ runtimeListUsers: [UserStatistics!]!
1363
1386
  runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
1364
1387
  runtimeMessageOutbox(filter: String): [SentMessage!]!
1388
+ runtimeMultiUserEnabled: Boolean!
1365
1389
  runtimeNotifications: [Notification!]!
1366
1390
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
1367
1391
  }
@@ -1429,6 +1453,13 @@ type TriggeredNotification {
1429
1453
  triggerMatch: String!
1430
1454
  }
1431
1455
 
1456
+ type UserStatistics {
1457
+ did: String!
1458
+ email: String!
1459
+ lastSeen: String
1460
+ perspectiveCount: Int!
1461
+ }
1462
+
1432
1463
  input VoiceActivityParamsInput {
1433
1464
  endThreshold: Float
1434
1465
  endWindow: Float
@@ -1436,7 +1467,7 @@ input VoiceActivityParamsInput {
1436
1467
  startWindow: Float
1437
1468
  timeBeforeSpeech: Float
1438
1469
  }
1439
- `;function zh(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 nm(t){let e=t.can.includes("*")?["READ","WRITE","UPDATE"]:t.can,r=t.with.domain==="*"?"":t.with.domain,n=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${zh(e)} your ${r} actions, with access to ${zh(n)}`}var $=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},C=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},be=function(t,e){return function(r,n){e(r,n,t)}},go=new nn;go.author="did:ad4m:test";go.timestamp=Date.now();go.data={source:"root",target:"neighbourhood://Qm12345"};go.proof={signature:"",key:"",valid:!0};var Jr=new Gn;Jr.author="did:ad4m:test";Jr.timestamp=Date.now().toString();Jr.proof=new kr("","");Jr.data=new pr([go]);var lc=class{};$([g(),C("design:type",String)],lc.prototype,"recipient",void 0);$([g(),C("design:type",Gn)],lc.prototype,"message",void 0);lc=$([G()],lc);var Vi=class{};$([g(),C("design:type",String)],Vi.prototype,"ad4mExecutorVersion",void 0);$([g(),C("design:type",Boolean)],Vi.prototype,"isInitialized",void 0);$([g(),C("design:type",Boolean)],Vi.prototype,"isUnlocked",void 0);Vi=$([G()],Vi);var ei=class{};$([g(),C("design:type",String)],ei.prototype,"title",void 0);$([g(),C("design:type",String)],ei.prototype,"message",void 0);$([g(),C("design:type",String)],ei.prototype,"type",void 0);$([g(),C("design:type",String)],ei.prototype,"addon",void 0);ei=$([G()],ei);var Ut=class{};$([g(),C("design:type",String)],Ut.prototype,"description",void 0);$([g(),C("design:type",String)],Ut.prototype,"appName",void 0);$([g(),C("design:type",String)],Ut.prototype,"appUrl",void 0);$([g(),C("design:type",String)],Ut.prototype,"appIconPath",void 0);$([g(),C("design:type",String)],Ut.prototype,"trigger",void 0);$([g(),C("design:type",Array)],Ut.prototype,"perspectiveIds",void 0);$([g(),C("design:type",String)],Ut.prototype,"webhookUrl",void 0);$([g(),C("design:type",String)],Ut.prototype,"webhookAuth",void 0);Ut=$([Ke()],Ut);var Tt=class{};$([g(),C("design:type",String)],Tt.prototype,"id",void 0);$([g(),C("design:type",Boolean)],Tt.prototype,"granted",void 0);$([g(),C("design:type",String)],Tt.prototype,"description",void 0);$([g(),C("design:type",String)],Tt.prototype,"appName",void 0);$([g(),C("design:type",String)],Tt.prototype,"appUrl",void 0);$([g(),C("design:type",String)],Tt.prototype,"appIconPath",void 0);$([g(),C("design:type",String)],Tt.prototype,"trigger",void 0);$([g(),C("design:type",Array)],Tt.prototype,"perspectiveIds",void 0);$([g(),C("design:type",String)],Tt.prototype,"webhookUrl",void 0);$([g(),C("design:type",String)],Tt.prototype,"webhookAuth",void 0);Tt=$([G()],Tt);var Qi=class{};$([g(),C("design:type",Tt)],Qi.prototype,"notification",void 0);$([g(),C("design:type",String)],Qi.prototype,"perspectiveId",void 0);$([g(),C("design:type",String)],Qi.prototype,"triggerMatch",void 0);Qi=$([G()],Qi);var Ge=class{};$([g(),C("design:type",Number)],Ge.prototype,"total",void 0);$([g(),C("design:type",Number)],Ge.prototype,"imported",void 0);$([g(),C("design:type",Number)],Ge.prototype,"failed",void 0);$([g(),C("design:type",Number)],Ge.prototype,"omitted",void 0);$([g(),C("design:type",Array)],Ge.prototype,"errors",void 0);Ge=$([G()],Ge);var Ot=class{};$([g(),C("design:type",Ge)],Ot.prototype,"perspectives",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"links",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"expressions",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"perspectiveDiffs",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"notifications",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"models",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"defaultModels",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"tasks",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"friends",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"trustedAgents",void 0);$([g(),C("design:type",Ge)],Ot.prototype,"knownLinkLanguages",void 0);Ot=$([G()],Ot);var re=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,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Jr}runtimeFriendSendMessage(e,r){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:jl.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}};$([Ve(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Boolean)],re.prototype,"runtimeQuit",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Boolean)],re.prototype,"runtimeOpenLink",null);$([Gt(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Vi)],re.prototype,"runtimeInfo",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[Array]),C("design:returntype",Array)],re.prototype,"addTrustedAgents",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[Array]),C("design:returntype",Array)],re.prototype,"deleteTrustedAgents",null);$([Gt(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Array)],re.prototype,"getTrustedAgents",null);$([Gt(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Array)],re.prototype,"runtimeKnownLinkLanguageTemplates",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[Array]),C("design:returntype",Array)],re.prototype,"runtimeAddKnownLinkLanguageTemplates",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[Array]),C("design:returntype",Array)],re.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);$([Gt(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Array)],re.prototype,"runtimeFriends",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[Array]),C("design:returntype",Array)],re.prototype,"runtimeAddFriends",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[Array]),C("design:returntype",Array)],re.prototype,"runtimeRemoveFriends",null);$([Gt(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",String)],re.prototype,"runtimeHcAgentInfos",null);$([Gt(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",String)],re.prototype,"runtimeGetNetworkMetrics",null);$([Ve(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Boolean)],re.prototype,"runtimeRestartHolochain",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[Object]),C("design:returntype",Boolean)],re.prototype,"runtimeHcAddAgentInfos",null);$([Gt(),be(0,ve()),be(1,ve()),be(2,ve()),be(3,ve()),C("design:type",Function),C("design:paramtypes",[String,String,String,String]),C("design:returntype",void 0)],re.prototype,"runtimeVerifyStringSignedByDid",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[pr]),C("design:returntype",Boolean)],re.prototype,"runtimeSetStatus",null);$([Gt(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Gn)],re.prototype,"runtimeFriendStatus",null);$([Ve(),be(0,ve()),be(1,ve()),C("design:type",Function),C("design:paramtypes",[String,Ws]),C("design:returntype",Boolean)],re.prototype,"runtimeFriendSendMessage",null);$([Gt(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Array)],re.prototype,"runtimeMessageInbox",null);$([Gt(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Array)],re.prototype,"runtimeMessageOutbox",null);$([Vl(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Gn)],re.prototype,"runtimeMessageReceived",null);$([Vl(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",ei)],re.prototype,"exceptionOccurred",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[Ut]),C("design:returntype",String)],re.prototype,"runtimeRequestInstallNotification",null);$([Gt(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Array)],re.prototype,"runtimeNotifications",null);$([Ve(),be(0,ve()),be(1,ve()),C("design:type",Function),C("design:paramtypes",[String,Ut]),C("design:returntype",Boolean)],re.prototype,"runtimeUpdateNotification",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Boolean)],re.prototype,"runtimeRemoveNotification",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Boolean)],re.prototype,"runtimeGrantNotification",null);$([Vl(),C("design:type",Function),C("design:paramtypes",[]),C("design:returntype",Qi)],re.prototype,"runtimeNotificationTriggered",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Boolean)],re.prototype,"runtimeExportDb",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Boolean)],re.prototype,"runtimeImportDb",null);$([Ve(),be(0,ve()),be(1,ve()),C("design:type",Function),C("design:paramtypes",[String,String]),C("design:returntype",Boolean)],re.prototype,"runtimeExportPerspective",null);$([Ve(),be(0,ve()),C("design:type",Function),C("design:paramtypes",[String]),C("design:returntype",Boolean)],re.prototype,"runtimeImportPerspective",null);re=$([s0()],re);var ka=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},J=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},bt,ar,Ms,Oe;function js(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Wh(t){return t?`triple("${t}", "ad4m://has_child", Base)`:""}function ml(){return`
1470
+ `;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,n=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${Jh(e)} your ${r} actions, with access to ${Jh(n)}`}var R=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},S=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},_e=function(t,e){return function(r,n){e(r,n,t)}},So=new nn;So.author="did:ad4m:test";So.timestamp=Date.now();So.data={source:"root",target:"neighbourhood://Qm12345"};So.proof={signature:"",key:"",valid:!0};var Jr=new Zn;Jr.author="did:ad4m:test";Jr.timestamp=Date.now().toString();Jr.proof=new kr("","");Jr.data=new fr([So]);var mc=class{};R([m(),S("design:type",String)],mc.prototype,"recipient",void 0);R([m(),S("design:type",Zn)],mc.prototype,"message",void 0);mc=R([W()],mc);var Wi=class{};R([m(),S("design:type",String)],Wi.prototype,"ad4mExecutorVersion",void 0);R([m(),S("design:type",Boolean)],Wi.prototype,"isInitialized",void 0);R([m(),S("design:type",Boolean)],Wi.prototype,"isUnlocked",void 0);Wi=R([W()],Wi);var ti=class{};R([m(),S("design:type",String)],ti.prototype,"title",void 0);R([m(),S("design:type",String)],ti.prototype,"message",void 0);R([m(),S("design:type",String)],ti.prototype,"type",void 0);R([m(),S("design:type",String)],ti.prototype,"addon",void 0);ti=R([W()],ti);var qt=class{};R([m(),S("design:type",String)],qt.prototype,"description",void 0);R([m(),S("design:type",String)],qt.prototype,"appName",void 0);R([m(),S("design:type",String)],qt.prototype,"appUrl",void 0);R([m(),S("design:type",String)],qt.prototype,"appIconPath",void 0);R([m(),S("design:type",String)],qt.prototype,"trigger",void 0);R([m(),S("design:type",Array)],qt.prototype,"perspectiveIds",void 0);R([m(),S("design:type",String)],qt.prototype,"webhookUrl",void 0);R([m(),S("design:type",String)],qt.prototype,"webhookAuth",void 0);qt=R([Ze()],qt);var Tt=class{};R([m(),S("design:type",String)],Tt.prototype,"id",void 0);R([m(),S("design:type",Boolean)],Tt.prototype,"granted",void 0);R([m(),S("design:type",String)],Tt.prototype,"description",void 0);R([m(),S("design:type",String)],Tt.prototype,"appName",void 0);R([m(),S("design:type",String)],Tt.prototype,"appUrl",void 0);R([m(),S("design:type",String)],Tt.prototype,"appIconPath",void 0);R([m(),S("design:type",String)],Tt.prototype,"trigger",void 0);R([m(),S("design:type",Array)],Tt.prototype,"perspectiveIds",void 0);R([m(),S("design:type",String)],Tt.prototype,"webhookUrl",void 0);R([m(),S("design:type",String)],Tt.prototype,"webhookAuth",void 0);Tt=R([W()],Tt);var Hi=class{};R([m(),S("design:type",Tt)],Hi.prototype,"notification",void 0);R([m(),S("design:type",String)],Hi.prototype,"perspectiveId",void 0);R([m(),S("design:type",String)],Hi.prototype,"triggerMatch",void 0);Hi=R([W()],Hi);var Ke=class{};R([m(),S("design:type",Number)],Ke.prototype,"total",void 0);R([m(),S("design:type",Number)],Ke.prototype,"imported",void 0);R([m(),S("design:type",Number)],Ke.prototype,"failed",void 0);R([m(),S("design:type",Number)],Ke.prototype,"omitted",void 0);R([m(),S("design:type",Array)],Ke.prototype,"errors",void 0);Ke=R([W()],Ke);var Ot=class{};R([m(),S("design:type",Ke)],Ot.prototype,"perspectives",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"links",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"expressions",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"perspectiveDiffs",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"notifications",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"models",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"defaultModels",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"tasks",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"friends",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"trustedAgents",void 0);R([m(),S("design:type",Ke)],Ot.prototype,"knownLinkLanguages",void 0);Ot=R([W()],Ot);var Gi=class{};R([m(),S("design:type",String)],Gi.prototype,"email",void 0);R([m(),S("design:type",String)],Gi.prototype,"did",void 0);R([m(),S("design:type",String)],Gi.prototype,"lastSeen",void 0);R([m(),S("design:type",Number)],Gi.prototype,"perspectiveCount",void 0);Gi=R([W()],Gi);var ee=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,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Jr}runtimeFriendSendMessage(e,r){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: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}]}};R([Me(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],ee.prototype,"runtimeQuit",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],ee.prototype,"runtimeOpenLink",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Wi)],ee.prototype,"runtimeInfo",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],ee.prototype,"addTrustedAgents",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],ee.prototype,"deleteTrustedAgents",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],ee.prototype,"getTrustedAgents",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],ee.prototype,"runtimeKnownLinkLanguageTemplates",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],ee.prototype,"runtimeAddKnownLinkLanguageTemplates",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],ee.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],ee.prototype,"runtimeFriends",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],ee.prototype,"runtimeAddFriends",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],ee.prototype,"runtimeRemoveFriends",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",String)],ee.prototype,"runtimeHcAgentInfos",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",String)],ee.prototype,"runtimeGetNetworkMetrics",null);R([Me(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],ee.prototype,"runtimeRestartHolochain",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[Object]),S("design:returntype",Boolean)],ee.prototype,"runtimeHcAddAgentInfos",null);R([Dt(),_e(0,be()),_e(1,be()),_e(2,be()),_e(3,be()),S("design:type",Function),S("design:paramtypes",[String,String,String,String]),S("design:returntype",void 0)],ee.prototype,"runtimeVerifyStringSignedByDid",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[fr]),S("design:returntype",Boolean)],ee.prototype,"runtimeSetStatus",null);R([Dt(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Zn)],ee.prototype,"runtimeFriendStatus",null);R([Me(),_e(0,be()),_e(1,be()),S("design:type",Function),S("design:paramtypes",[String,Ys]),S("design:returntype",Boolean)],ee.prototype,"runtimeFriendSendMessage",null);R([Dt(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Array)],ee.prototype,"runtimeMessageInbox",null);R([Dt(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Array)],ee.prototype,"runtimeMessageOutbox",null);R([Gl(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Zn)],ee.prototype,"runtimeMessageReceived",null);R([Gl(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",ti)],ee.prototype,"exceptionOccurred",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[qt]),S("design:returntype",String)],ee.prototype,"runtimeRequestInstallNotification",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],ee.prototype,"runtimeNotifications",null);R([Me(),_e(0,be()),_e(1,be()),S("design:type",Function),S("design:paramtypes",[String,qt]),S("design:returntype",Boolean)],ee.prototype,"runtimeUpdateNotification",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],ee.prototype,"runtimeRemoveNotification",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],ee.prototype,"runtimeGrantNotification",null);R([Gl(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Hi)],ee.prototype,"runtimeNotificationTriggered",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],ee.prototype,"runtimeExportDb",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],ee.prototype,"runtimeImportDb",null);R([Me(),_e(0,be()),_e(1,be()),S("design:type",Function),S("design:paramtypes",[String,String]),S("design:returntype",Boolean)],ee.prototype,"runtimeExportPerspective",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],ee.prototype,"runtimeImportPerspective",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],ee.prototype,"runtimeMultiUserEnabled",null);R([Me(),_e(0,be()),S("design:type",Function),S("design:paramtypes",[Boolean]),S("design:returntype",Boolean)],ee.prototype,"runtimeSetMultiUserEnabled",null);R([Dt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],ee.prototype,"runtimeListUsers",null);ee=R([d0()],ee);var Oa=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},re=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},_t,or,Qs,De;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`
1440
1471
  findall(
1441
1472
  [T, A],
1442
1473
  link(Base, _, _, T, A),
@@ -1444,13 +1475,13 @@ input VoiceActivityParamsInput {
1444
1475
  ),
1445
1476
  sort(AllLinks, SortedLinks),
1446
1477
  SortedLinks = [[Timestamp, Author]|_]
1447
- `}function Hh(t){return`
1478
+ `}function Xh(t){return`
1448
1479
  findall([PropertyName, PropertyValue, Resolve], (
1449
1480
  % Constrain to specified properties if provided
1450
1481
  ${t?`member(PropertyName, [${t.map(e=>`"${e}"`).join(", ")}]),`:""}
1451
1482
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1452
1483
  ), Properties)
1453
- `}function Gh(t){return`
1484
+ `}function e1(t){return`
1454
1485
  findall([CollectionName, CollectionValues], (
1455
1486
  % Constrain to specified collections if provided
1456
1487
  ${t?`member(CollectionName, [${t.map(e=>`"${e}"`).join(", ")}]),`:""}
@@ -1458,38 +1489,38 @@ input VoiceActivityParamsInput {
1458
1489
  collection(SubjectClass, CollectionName),
1459
1490
  collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
1460
1491
  ), Collections)
1461
- `}function Kh(t={}){function e(r){return typeof r=="string"?`"${r}"`:r}return Object.entries(t).map(([r,n])=>{let i=["base","author","timestamp"].includes(r),a=`resolve_property(SubjectClass, Base, "${r}", Value${r}, _)`,o=js(r);if(Array.isArray(n)){let s=n.map(u=>e(u)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${r}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:u,lt:c,lte:l,gt:d,gte:f}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return i?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${r}, [${h}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${r} \\= ${e(s)}`;if(u!==void 0&&Array.isArray(u)&&u.length===2)return i?`${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 i?`${o} ${m} ${h}`:`${a}, Value${r} ${m} ${h}`}return i?`${o} = ${e(n)}`:`${a}, Value${r} = ${e(n)}`}).join(", ")}function Zh(t){return t?"length(UnsortedInstances, TotalCount)":""}function Jh(t){if(!t)return"SortedInstances = UnsortedInstances";let[e,r]=Object.entries(t)[0];return`sort_instances(UnsortedInstances, "${e}", "${r}", SortedInstances)`}function Yh(t){return!t||t<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${t}, InstancesWithOffset)`}function Xh(t){return!t||t<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${t}, AllInstances)`}function e1(t){if(!t)return"";if(t.includes("://")){let[e,r]=t.split("://"),n=(r||"").replace(/\/+$/,"");return`${e}://${n}`}else return t.replace(/\/+$/,"")}function ip(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 im(t,e){return ip(t.type)===e}function t1(t){return im(t,"array")}function r1(t){return im(t,"object")}function T3(t){let e=ip(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 n=t.uuid;return r[n]||(r[n]=await t.stringOrTemplateObjectToSubjectClassName(this)),r[n]}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={},n=t.__properties||{};for(let[c,l]of Object.entries(n)){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 i={},a=t.__collections||{};for(let[c,l]of Object.entries(a)){let d=l;i[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(i).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=t1(f),h=this.determinePredicate(c,d,f,this.determineNamespace(c,l),l);if(p)i[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:i}}constructor(t,e,r){bt.set(this,void 0),ar.set(this,void 0),Ms.set(this,void 0),Oe.set(this,void 0),ka(this,bt,e||St.from(rm(24)).toUrl(),"f"),ka(this,Oe,t,"f"),ka(this,Ms,r||"ad4m://self","f")}get baseExpression(){return J(this,bt,"f")}get perspective(){return J(this,Oe,"f")}static async assignValuesToInstance(t,e,r){let n=Object.fromEntries(await Promise.all(r.map(async([i,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 "${i}"`,{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?.[i]?.transform;return u&&typeof u=="function"&&(s=u(s)),[i,s]})));Object.assign(e,n)}async getData(){let t=[ml(),Hh(),Gh()],e=`
1462
- Base = "${J(this,bt,"f")}",
1463
- subject_class("${J(this,ar,"f")}", SubjectClass),
1492
+ `}function t1(t={}){function e(r){return typeof r=="string"?`"${r}"`:r}return Object.entries(t).map(([r,n])=>{let i=["base","author","timestamp"].includes(r),a=`resolve_property(SubjectClass, Base, "${r}", Value${r}, _)`,o=zs(r);if(Array.isArray(n)){let s=n.map(u=>e(u)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${r}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:u,lt:c,lte:l,gt:f,gte:d}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(g=>e(g)).join(", ");return i?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${r}, [${h}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${r} \\= ${e(s)}`;if(u!==void 0&&Array.isArray(u)&&u.length===2)return i?`${o} >= ${u[0]}, ${o} =< ${u[1]}`:`${a}, Value${r} >= ${u[0]}, Value${r} =< ${u[1]}`;let p=[{value:c,symbol:"<"},{value:l,symbol:"=<"},{value:f,symbol:">"},{value:d,symbol:">="}];for(let{value:h,symbol:g}of p)if(h!==void 0)return i?`${o} ${g} ${h}`:`${a}, Value${r} ${g} ${h}`}return i?`${o} = ${e(n)}`:`${a}, Value${r} = ${e(n)}`}).join(", ")}function r1(t){return t?"length(UnsortedInstances, TotalCount)":""}function n1(t){if(!t)return"SortedInstances = UnsortedInstances";let[e,r]=Object.entries(t)[0];return`sort_instances(UnsortedInstances, "${e}", "${r}", SortedInstances)`}function i1(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("://"),n=(r||"").replace(/\/+$/,"");return`${e}://${n}`}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 n=t.uuid;return r[n]||(r[n]=await t.stringOrTemplateObjectToSubjectClassName(this)),r[n]}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={},n=t.__properties||{};for(let[c,l]of Object.entries(n)){let f=l;r[c]={name:c,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 i={},a=t.__collections||{};for(let[c,l]of Object.entries(a)){let f=l;i[c]={name:c,predicate:f.through||"",...f.where!==void 0&&{where:f.where},...f.local!==void 0&&{local:f.local}}}let o=Object.keys(r).length>0,s=Object.keys(i).length>0;if(!(o||s)&&t.__jsonSchema){let c=t.__jsonSchema,l=t.__jsonSchemaOptions||{};if(c.properties)for(let[f,d]of Object.entries(c.properties)){let p=s1(d),h=this.determinePredicate(c,f,d,this.determineNamespace(c,l),l);if(p)i[f]={name:f,predicate:h,...d["x-ad4m"]?.local!==void 0&&{local:d["x-ad4m"].local}};else{let g=c.required?.includes(f)||!1;r[f]={name:f,predicate:h,required:g,writable:d["x-ad4m"]?.writable!==!1,...d["x-ad4m"]?.resolveLanguage&&{resolveLanguage:d["x-ad4m"].resolveLanguage},...d["x-ad4m"]?.initial&&{initial:d["x-ad4m"].initial},...d["x-ad4m"]?.local!==void 0&&{local:d["x-ad4m"].local}}}}}return{className:e,properties:r,collections:i}}constructor(t,e,r){_t.set(this,void 0),or.set(this,void 0),Qs.set(this,void 0),De.set(this,void 0),Oa(this,_t,e||St.from(cm(24)).toUrl(),"f"),Oa(this,De,t,"f"),Oa(this,Qs,r||"ad4m://self","f")}get baseExpression(){return re(this,_t,"f")}get perspective(){return re(this,De,"f")}static async assignValuesToInstance(t,e,r){let n=Object.fromEntries(await Promise.all(r.map(async([i,a,o])=>{let s=a;if(!o&&typeof a=="string"){let c=Array.from(a,d=>d.codePointAt(0)),l=c.every(d=>d<=255),f=c.some(d=>d>=128);if(l&&f)try{let d=Uint8Array.from(c),p=new TextDecoder("utf-8",{fatal:!0}).decode(d);p!==a&&(s=p)}catch(d){console.warn(`UTF-8 byte reconstruction failed for property "${i}"`,{value:a,error:d})}}if(o){let c=await t.getExpression(a);if(c)try{s=JSON.parse(c.data)}catch{s=c.data}}let u=e.__properties?.[i]?.transform;return u&&typeof u=="function"&&(s=u(s)),[i,s]})));Object.assign(e,n)}async getData(){let t=[_l(),Xh(),e1()],e=`
1493
+ Base = "${re(this,_t,"f")}",
1494
+ subject_class("${re(this,or,"f")}", SubjectClass),
1464
1495
  ${t.join(", ")}
1465
- `,r=await J(this,Oe,"f").infer(e);if(r?.[0]){let{Properties:n,Collections:i,Timestamp:a,Author:o}=r?.[0],s=[...n,...i,["timestamp",a],["author",o]];await _Ad4mModel.assignValuesToInstance(J(this,Oe,"f"),this,s)}return this}static async queryToProlog(t,e,r){let{source:n,properties:i,collections:a,where:o,order:s,offset:u,limit:c,count:l}=e,d=r||await this.getClassName(t),f=[ml(),Wh(n),Hh(i),Gh(a),Kh(o)],p=[Zh(l),Jh(s),Yh(u),Xh(c)];return`
1496
+ `,r=await re(this,De,"f").infer(e);if(r?.[0]){let{Properties:n,Collections:i,Timestamp:a,Author:o}=r?.[0],s=[...n,...i,["timestamp",a],["author",o]];await _Ad4mModel.assignValuesToInstance(re(this,De,"f"),this,s)}return this}static async queryToProlog(t,e,r){let{source:n,properties:i,collections:a,where:o,order:s,offset:u,limit:c,count:l}=e,f=r||await this.getClassName(t),d=[_l(),Yh(n),Xh(i),e1(a),t1(o)],p=[r1(l),n1(s),i1(u),a1(c)];return`
1466
1497
  findall([Base, Properties, Collections, Timestamp, Author], (
1467
- subject_class("${d}", SubjectClass),
1498
+ subject_class("${f}", SubjectClass),
1468
1499
  instance(SubjectClass, Base),
1469
- ${f.filter(m=>m).join(", ")}
1500
+ ${d.filter(g=>g).join(", ")}
1470
1501
  ), UnsortedInstances),
1471
- ${p.filter(m=>m).join(", ")}
1472
- `}static async queryToSurrealQL(t,e){let r=this.getModelMetadata(),{source:n,where:i,order:a,offset:o,limit:s}=e,u=[];n&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(n)} 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,i),l=[];return l.push(...u),c&&l.push(c),l.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1502
+ ${p.filter(g=>g).join(", ")}
1503
+ `}static async queryToSurrealQL(t,e){let r=this.getModelMetadata(),{source:n,where:i,order:a,offset:o,limit:s}=e,u=[];n&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(n)} AND predicate = 'ad4m://has_child']) > 0`);for(let[d,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[d,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,i),l=[];return l.push(...u),c&&l.push(c),l.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1473
1504
  SELECT
1474
1505
  id AS source,
1475
1506
  uri AS source_uri,
1476
1507
  ->link[WHERE perspective = $perspective] AS links
1477
1508
  FROM node
1478
1509
  WHERE ${l.join(" AND ")}
1479
- `.trim()}static buildGraphTraversalWhereClause(t,e){if(!e)return"";let r=[];for(let[n,i]of Object.entries(e))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(i)){let s=i.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} IN [${s}]`)}else if(typeof i=="object"&&i!==null){let s=i;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(i)}`)}else{let o=t.properties[n];if(!o)continue;let s=o.predicate,u=o.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(i)){let c=i.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${s}' AND ${u} IN [${c}]]) > 0`)}else if(typeof i=="object"&&i!==null){let c=i;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(i)}]) > 0`)}return r.join(" AND ")}static buildSurrealWhereClause(t,e){if(!e)return"";let r=[];for(let[n,i]of Object.entries(e))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="source";if(Array.isArray(i)){let s=i.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} IN [${s}]`)}else if(typeof i=="object"&&i!==null){let s=i;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(i)}`)}else{let o=t.properties[n];if(!o)continue;let s=o.predicate,u=o.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(i)){let c=i.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 i=="object"&&i!==null){let c=i;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(i)})`)}return r.join(" AND ")}static buildSurrealSelectFields(t,e,r){let n=[],i=e||Object.keys(t.properties);for(let o of i){let s=t.properties[o];!s||n.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||n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${s.predicate}') AS ${o}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source LIMIT 1) AS timestamp"),n.join(`,
1510
+ `.trim()}static buildGraphTraversalWhereClause(t,e){if(!e)return"";let r=[];for(let[n,i]of Object.entries(e))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="uri";if(Array.isArray(i)){let s=i.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} IN [${s}]`)}else if(typeof i=="object"&&i!==null){let s=i;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(i)}`)}else{let o=t.properties[n];if(!o)continue;let s=o.predicate,u=o.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(i)){let c=i.map(l=>this.formatSurrealValue(l)).join(", ");r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${s}' AND ${u} IN [${c}]]) > 0`)}else if(typeof i=="object"&&i!==null){let c=i;if(c.not!==void 0)if(Array.isArray(c.not)){let f=c.not.map(d=>this.formatSurrealValue(d)).join(", ");r.push(`count(->link[WHERE perspective = $perspective AND predicate = '${s}' AND ${u} IN [${f}]]) = 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(i)}]) > 0`)}return r.join(" AND ")}static buildSurrealWhereClause(t,e){if(!e)return"";let r=[];for(let[n,i]of Object.entries(e))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let o="source";if(Array.isArray(i)){let s=i.map(u=>this.formatSurrealValue(u)).join(", ");r.push(`${o} IN [${s}]`)}else if(typeof i=="object"&&i!==null){let s=i;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(i)}`)}else{let o=t.properties[n];if(!o)continue;let s=o.predicate,u=o.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(i)){let c=i.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 i=="object"&&i!==null){let c=i;if(c.not!==void 0)if(Array.isArray(c.not)){let f=c.not.map(d=>this.formatSurrealValue(d)).join(", ");r.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${s}' AND ${u} IN [${f}])`)}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(i)})`)}return r.join(" AND ")}static buildSurrealSelectFields(t,e,r){let n=[],i=e||Object.keys(t.properties);for(let o of i){let s=t.properties[o];!s||n.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||n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${s.predicate}') AS ${o}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source LIMIT 1) AS timestamp"),n.join(`,
1480
1511
  `)}static buildSurrealSelectFieldsWithAggregation(t,e,r){let n=[],i=e||Object.keys(t.properties);for(let o of i){let s=t.properties[o];!s||n.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||n.push(`target[WHERE predicate = '${s.predicate}'] AS ${o}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS timestamp"),n.join(`,
1481
- `)}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 n=[...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);n.length&&Object.keys(l).forEach(f=>{n.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 n=this.getModelMetadata(),i=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,v=null;for(let b=0;b<p.length;b++){let _=p[b],S=_.predicate,y=_.target;if(y==="None")continue;_.timestamp&&(!m||_.timestamp>m)&&(m=_.timestamp,v=_.author);let O=!1;for(let[D,A]of Object.entries(n.properties))if(A.predicate===S){let N=h[D],L=typeof N=="object"&&N!==null&&!Array.isArray(N)&&Object.keys(N).length===0;if(!N||N===""||N===0||L){let P=y;if(y!=null){if(A.resolveLanguage!=null&&A.resolveLanguage!=="literal"&&typeof y=="string")try{let j=await t.getExpression(y);if(j)try{P=JSON.parse(j.data)}catch{P=j.data}}catch(j){console.warn(`Failed to resolve expression for ${D}:`,j),P=y}else if(typeof y=="string"&&y.startsWith("literal://"))try{let j=St.fromUrl(y).get();j.data!==void 0?P=j.data:P=j}catch{P=y}else if(typeof y=="string"){let j=typeof h[D];j==="number"?P=Number(y):j==="boolean"&&(P=y==="true"||y==="1")}}A.transform&&typeof A.transform=="function"&&(P=A.transform(P)),h[D]=P}O=!0;break}if(!O){for(let[D,A]of Object.entries(n.collections))if(A.predicate===S){h[D]||(h[D]=[]);let N=`__${D}_timestamps`,L=`__${D}_indices`;h[N]||(h[N]=[]),h[L]||(h[L]=[]),h[D].includes(y)||(h[D].push(y),h[N].push(_.timestamp||""),h[L].push(b));break}}}if(v&&m)if(h.author=v,typeof m=="string"&&m.includes("T"))h.timestamp=new Date(m).getTime();else if(typeof m=="string"){let b=parseInt(m,10);h.timestamp=isNaN(b)?m:b}else h.timestamp=m;for(let[b,_]of Object.entries(n.collections)){let S=`__${b}_timestamps`,y=`__${b}_indices`;if(h[b]&&h[S]){let O=h[b].map((D,A)=>({value:D,timestamp:h[S][A]||"",originalIndex:h[y]?.[A]??A}));O.sort((D,A)=>{let N=String(D.timestamp||""),L=String(A.timestamp||""),P=N.localeCompare(L);return P!==0?P:D.originalIndex-A.originalIndex}),h[b]=O.map(D=>D.value),delete h[S],delete h[y]}}if(i.length>0||a.length>0){let b=[...i,...a];Object.keys(h).forEach(_=>{!b.includes(_)&&_!=="timestamp"&&_!=="author"&&_!=="baseExpression"&&delete h[_]})}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],v=h[d];if(m===void 0&&v===void 0)return 0;if(m===void 0)return f==="ASC"?1:-1;if(v===void 0)return f==="ASC"?-1:1;let b=0;return typeof m=="number"&&typeof v=="number"?b=m-v:typeof m=="string"&&typeof v=="string"?b=m.localeCompare(v):b=String(m).localeCompare(String(v)),f==="DESC"?-b:b})}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 n=!0;return r.gt!==void 0&&(n=n&&t>r.gt),r.gte!==void 0&&(n=n&&t>=r.gte),r.lt!==void 0&&(n=n&&t<r.lt),r.lte!==void 0&&(n=n&&t<=r.lte),r.contains!==void 0&&(typeof t=="string"?n=n&&t.includes(String(r.contains)):Array.isArray(t)?n=n&&t.includes(r.contains):n=!1),n}return t===e}static async findAll(t,e={},r=!0){if(r){let n=await this.queryToSurrealQL(t,e),i=await t.querySurrealDB(n),{results:a}=await this.instancesFromSurrealResult(t,e,i);return a}else{let n=await this.queryToProlog(t,e),i=await t.infer(n),{results:a}=await this.instancesFromPrologResult(t,e,i);return a}}static async findAllAndCount(t,e={},r=!0){if(r){let n=await this.queryToSurrealQL(t,e),i=await t.querySurrealDB(n);return await this.instancesFromSurrealResult(t,e,i)}else{let n=await this.queryToProlog(t,e),i=await t.infer(n);return await this.instancesFromPrologResult(t,e,i)}}static async paginate(t,e,r,n,i=!0){let a={...n||{},limit:e,offset:e*(r-1),count:!0};if(i){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:n,where:i}=e,a=r||await this.getClassName(t),o=[ml(),Wh(n),Kh(i)],s=[Zh(!0),Jh(),Yh(),Xh()];return`
1512
+ `)}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 n=[...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);n.length&&Object.keys(l).forEach(d=>{n.includes(d)||delete l[d]});let f=[...o,...s,["timestamp",u],["author",c]];return await _Ad4mModel.assignValuesToInstance(t,l,f),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 n=this.getModelMetadata(),i=e?.properties||[],a=e?.collections||[],o=[];for(let f of r){let d;try{if(d=f.source_uri,!d)continue;let p=f.links||[],h=new this(t,d),g=null,v=null;for(let b=0;b<p.length;b++){let _=p[b],w=_.predicate,y=_.target;if(y==="None")continue;_.timestamp&&(!g||_.timestamp>g)&&(g=_.timestamp,v=_.author);let O=!1;for(let[D,A]of Object.entries(n.properties))if(A.predicate===w){let N=h[D],L=typeof N=="object"&&N!==null&&!Array.isArray(N)&&Object.keys(N).length===0;if(!N||N===""||N===0||L){let P=y;if(y!=null){if(A.resolveLanguage!=null&&A.resolveLanguage!=="literal"&&typeof y=="string")try{let j=await t.getExpression(y);if(j)try{P=JSON.parse(j.data)}catch{P=j.data}}catch(j){console.warn(`Failed to resolve expression for ${D}:`,j),P=y}else if(typeof y=="string"&&y.startsWith("literal://"))try{let j=St.fromUrl(y).get();j.data!==void 0?P=j.data:P=j}catch{P=y}else if(typeof y=="string"){let j=typeof h[D];j==="number"?P=Number(y):j==="boolean"&&(P=y==="true"||y==="1")}}A.transform&&typeof A.transform=="function"&&(P=A.transform(P)),h[D]=P}O=!0;break}if(!O){for(let[D,A]of Object.entries(n.collections))if(A.predicate===w){h[D]||(h[D]=[]);let N=`__${D}_timestamps`,L=`__${D}_indices`;h[N]||(h[N]=[]),h[L]||(h[L]=[]),h[D].includes(y)||(h[D].push(y),h[N].push(_.timestamp||""),h[L].push(b));break}}}if(v&&g)if(h.author=v,typeof g=="string"&&g.includes("T"))h.timestamp=new Date(g).getTime();else if(typeof g=="string"){let b=parseInt(g,10);h.timestamp=isNaN(b)?g:b}else h.timestamp=g;for(let[b,_]of Object.entries(n.collections)){let w=`__${b}_timestamps`,y=`__${b}_indices`;if(h[b]&&h[w]){let O=h[b].map((D,A)=>({value:D,timestamp:h[w][A]||"",originalIndex:h[y]?.[A]??A}));O.sort((D,A)=>{let N=String(D.timestamp||""),L=String(A.timestamp||""),P=N.localeCompare(L);return P!==0?P:D.originalIndex-A.originalIndex}),h[b]=O.map(D=>D.value),delete h[w],delete h[y]}}if(i.length>0||a.length>0){let b=[...i,...a];Object.keys(h).forEach(_=>{!b.includes(_)&&_!=="timestamp"&&_!=="author"&&_!=="baseExpression"&&delete h[_]})}o.push(h)}catch(p){console.error(`Failed to process SurrealDB instance ${d}:`,p)}}let s=o;e.where&&(s=o.filter(f=>{for(let[d,p]of Object.entries(e.where))if(d!=="base"){if(d==="author"||d==="timestamp"){if(!this.matchesCondition(f[d],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(f[d],p))return!1}}return!0}));let u=e.order||(e.limit!==void 0||e.offset!==void 0?{timestamp:"ASC"}:null);if(u){let f=Object.keys(u)[0],d=Object.values(u)[0];s.sort((p,h)=>{let g=p[f],v=h[f];if(g===void 0&&v===void 0)return 0;if(g===void 0)return d==="ASC"?1:-1;if(v===void 0)return d==="ASC"?-1:1;let b=0;return typeof g=="number"&&typeof v=="number"?b=g-v:typeof g=="string"&&typeof v=="string"?b=g.localeCompare(v):b=String(g).localeCompare(String(v)),d==="DESC"?-b:b})}let c=s.length,l=s;if(e.offset!==void 0||e.limit!==void 0){let f=e.offset||0,d=e.limit?f+e.limit:void 0;l=s.slice(f,d)}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 n=!0;return r.gt!==void 0&&(n=n&&t>r.gt),r.gte!==void 0&&(n=n&&t>=r.gte),r.lt!==void 0&&(n=n&&t<r.lt),r.lte!==void 0&&(n=n&&t<=r.lte),r.contains!==void 0&&(typeof t=="string"?n=n&&t.includes(String(r.contains)):Array.isArray(t)?n=n&&t.includes(r.contains):n=!1),n}return t===e}static async findAll(t,e={},r=!0){if(r){let n=await this.queryToSurrealQL(t,e),i=await t.querySurrealDB(n),{results:a}=await this.instancesFromSurrealResult(t,e,i);return a}else{let n=await this.queryToProlog(t,e),i=await t.infer(n),{results:a}=await this.instancesFromPrologResult(t,e,i);return a}}static async findAllAndCount(t,e={},r=!0){if(r){let n=await this.queryToSurrealQL(t,e),i=await t.querySurrealDB(n);return await this.instancesFromSurrealResult(t,e,i)}else{let n=await this.queryToProlog(t,e),i=await t.infer(n);return await this.instancesFromPrologResult(t,e,i)}}static async paginate(t,e,r,n,i=!0){let a={...n||{},limit:e,offset:e*(r-1),count:!0};if(i){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:n,where:i}=e,a=r||await this.getClassName(t),o=[_l(),Yh(n),t1(i)],s=[r1(!0),n1(),i1(),a1()];return`
1482
1513
  findall([Base, Properties, Collections, Timestamp, Author], (
1483
1514
  subject_class("${a}", SubjectClass),
1484
1515
  instance(SubjectClass, Base),
1485
1516
  ${o.filter(c=>c).join(", ")}
1486
1517
  ), UnsortedInstances),
1487
1518
  ${s.filter(c=>c).join(", ")}
1488
- `}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 n=await this.queryToSurrealQL(t,e),i=await t.querySurrealDB(n),{totalCount:a}=await this.instancesFromSurrealResult(t,e,i);return a}else return(await t.infer(await this.countQueryToProlog(t,e)))?.[0]?.TotalCount||0}async setProperty(key,value,batchId){let setters=await J(this,Oe,"f").infer(`subject_class("${J(this,ar,"f")}", C), property_setter(C, "${key}", Setter)`);if(setters&&setters.length>0){let actions=eval(setters[0].Setter),resolveLanguageResults=await J(this,Oe,"f").infer(`subject_class("${J(this,ar,"f")}", C), property_resolve_language(C, "${key}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),resolveLanguage&&(value=await J(this,Oe,"f").createExpression(value,resolveLanguage)),await J(this,Oe,"f").executeAction(actions,J(this,bt,"f"),[{name:"value",value}],batchId)}}async setCollectionSetter(key,value,batchId){let collectionSetters=await J(this,Oe,"f").infer(`subject_class("${J(this,ar,"f")}", C), collection_setter(C, "${Ar(key)}", Setter)`);if(collectionSetters||(collectionSetters=[]),collectionSetters.length>0){let actions=eval(collectionSetters[0].Setter);value&&(Array.isArray(value)?await J(this,Oe,"f").executeAction(actions,J(this,bt,"f"),value.map(t=>({name:"value",value:t})),batchId):await J(this,Oe,"f").executeAction(actions,J(this,bt,"f"),[{name:"value",value}],batchId))}}async setCollectionAdder(key,value,batchId){let adders=await J(this,Oe,"f").infer(`subject_class("${J(this,ar,"f")}", C), collection_adder(C, "${Ar(key)}", Adder)`);if(adders||(adders=[]),adders.length>0){let actions=eval(adders[0].Adder);value&&(Array.isArray(value)?await Promise.all(value.map(t=>J(this,Oe,"f").executeAction(actions,J(this,bt,"f"),[{name:"value",value:t}],batchId))):await J(this,Oe,"f").executeAction(actions,J(this,bt,"f"),[{name:"value",value}],batchId))}}async setCollectionRemover(key,value,batchId){let removers=await J(this,Oe,"f").infer(`subject_class("${J(this,ar,"f")}", C), collection_remover(C, "${Ar(key)}", Remover)`);if(removers||(removers=[]),removers.length>0){let actions=eval(removers[0].Remover);value&&(Array.isArray(value)?await Promise.all(value.map(t=>J(this,Oe,"f").executeAction(actions,J(this,bt,"f"),[{name:"value",value:t}],batchId))):await J(this,Oe,"f").executeAction(actions,J(this,bt,"f"),[{name:"value",value}],batchId))}}async save(t){let e=!1;t||(t=await this.perspective.createBatch(),e=!0);let r={};for(let[n,i]of Object.entries(this))i!=null&&!(Array.isArray(i)&&i.length>0)&&!i?.action&&(r[n]=i);await this.perspective.createSubject(this,J(this,bt,"f"),r,t),await J(this,Oe,"f").add(new Hn({source:J(this,Ms,"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,n]of e)n!=null&&r!=="author"&&r!=="timestamp"&&(t[r]=n);return t}async innerUpdate(t=!0,e){ka(this,ar,await J(this,Oe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let r=Object.entries(this);for(let[n,i]of r)if(i!=null)if(i?.action)switch(i.action){case"setter":await this.setCollectionSetter(n,i.value,e);break;case"adder":await this.setCollectionAdder(n,i.value,e);break;case"remover":await this.setCollectionRemover(n,i.value,e);break;default:await this.setCollectionSetter(n,i.value,e);break}else Array.isArray(i)&&i.length>0?await this.setCollectionSetter(n,i,e):i!=null&&i!==""&&t&&await this.setProperty(n,i,e)}async update(t){await this.innerUpdate(!0,t),await this.getData()}async get(){return ka(this,ar,await J(this,Oe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(t){await J(this,Oe,"f").removeSubject(this,J(this,bt,"f"),t)}static query(t,e){return new Bl(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),n=class extends _Ad4mModel{};if(!e.name||e.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=e.name,n.prototype.className=e.name;let i={},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=ip(c.type);if(t1(c)){a[u]={through:l,local:this.getPropertyOption(u,c,e,"local")},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:[]});let h=`add${js(u)}`,m=`remove${js(u)}`,v=`setCollection${js(u)}`;n.prototype[h]=function(){},n.prototype[m]=function(){},n.prototype[v]=function(){}}else{let h=this.getPropertyOption(u,c,e,"resolveLanguage");!h&&e.resolveLanguage&&(h=e.resolveLanguage);let m=this.getPropertyOption(u,c,e,"local"),v=this.getPropertyOption(u,c,e,"writable",!0),b=this.getPropertyOption(u,c,e,"initial");if(r1(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&&T3(c)&&(h="literal"),d&&!b&&(r1(c)?b="literal://json:{}":b="ad4m://undefined"),i[u]={through:l,required:d,writable:v,...h&&{resolveLanguage:h},...m!==void 0&&{local:m},...b&&{initial:b}},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(f)}),v){let _=Wl(u);n.prototype[_]=function(){}}}}if(!Object.values(i).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`;i.__ad4m_type={through:u,required:!0,writable:!1,initial:c,flag:!0},Object.defineProperty(n.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:c}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${c}`)}return n.prototype.__properties=i,n.prototype.__collections=a,n.prototype.__jsonSchema=t,n.prototype.__jsonSchemaOptions=e,I3({name:e.name})(n),n}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 n=new URL(t.$id).pathname.split("/").filter(i=>i);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:
1519
+ `}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 n=await this.queryToSurrealQL(t,e),i=await t.querySurrealDB(n),{totalCount:a}=await this.instancesFromSurrealResult(t,e,i);return a}else return(await t.infer(await this.countQueryToProlog(t,e)))?.[0]?.TotalCount||0}async setProperty(key,value,batchId){let setters=await re(this,De,"f").infer(`subject_class("${re(this,or,"f")}", C), property_setter(C, "${key}", Setter)`);if(setters&&setters.length>0){let actions=eval(setters[0].Setter),resolveLanguageResults=await re(this,De,"f").infer(`subject_class("${re(this,or,"f")}", C), property_resolve_language(C, "${key}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),resolveLanguage&&(value=await re(this,De,"f").createExpression(value,resolveLanguage)),await re(this,De,"f").executeAction(actions,re(this,_t,"f"),[{name:"value",value}],batchId)}}async setCollectionSetter(key,value,batchId){let collectionSetters=await re(this,De,"f").infer(`subject_class("${re(this,or,"f")}", C), collection_setter(C, "${Ar(key)}", Setter)`);if(collectionSetters||(collectionSetters=[]),collectionSetters.length>0){let actions=eval(collectionSetters[0].Setter);value&&(Array.isArray(value)?await re(this,De,"f").executeAction(actions,re(this,_t,"f"),value.map(t=>({name:"value",value:t})),batchId):await re(this,De,"f").executeAction(actions,re(this,_t,"f"),[{name:"value",value}],batchId))}}async setCollectionAdder(key,value,batchId){let adders=await re(this,De,"f").infer(`subject_class("${re(this,or,"f")}", C), collection_adder(C, "${Ar(key)}", Adder)`);if(adders||(adders=[]),adders.length>0){let actions=eval(adders[0].Adder);value&&(Array.isArray(value)?await Promise.all(value.map(t=>re(this,De,"f").executeAction(actions,re(this,_t,"f"),[{name:"value",value:t}],batchId))):await re(this,De,"f").executeAction(actions,re(this,_t,"f"),[{name:"value",value}],batchId))}}async setCollectionRemover(key,value,batchId){let removers=await re(this,De,"f").infer(`subject_class("${re(this,or,"f")}", C), collection_remover(C, "${Ar(key)}", Remover)`);if(removers||(removers=[]),removers.length>0){let actions=eval(removers[0].Remover);value&&(Array.isArray(value)?await Promise.all(value.map(t=>re(this,De,"f").executeAction(actions,re(this,_t,"f"),[{name:"value",value:t}],batchId))):await re(this,De,"f").executeAction(actions,re(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[n,i]of Object.entries(this))i!=null&&!(Array.isArray(i)&&i.length>0)&&!i?.action&&(r[n]=i);await this.perspective.createSubject(this,re(this,_t,"f"),r,t),await re(this,De,"f").add(new Kn({source:re(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,n]of e)n!=null&&r!=="author"&&r!=="timestamp"&&(t[r]=n);return t}async innerUpdate(t=!0,e){Oa(this,or,await re(this,De,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let r=Object.entries(this);for(let[n,i]of r)if(i!=null)if(i?.action)switch(i.action){case"setter":await this.setCollectionSetter(n,i.value,e);break;case"adder":await this.setCollectionAdder(n,i.value,e);break;case"remover":await this.setCollectionRemover(n,i.value,e);break;default:await this.setCollectionSetter(n,i.value,e);break}else Array.isArray(i)&&i.length>0?await this.setCollectionSetter(n,i,e):i!=null&&i!==""&&t&&await this.setProperty(n,i,e)}async update(t){await this.innerUpdate(!0,t),await this.getData()}async get(){return Oa(this,or,await re(this,De,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(t){await re(this,De,"f").removeSubject(this,re(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),n=class extends _Ad4mModel{};if(!e.name||e.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=e.name,n.prototype.className=e.name;let i={},a={};if(t.properties)for(let[u,c]of Object.entries(t.properties)){let l=this.determinePredicate(t,u,c,r,e),f=t.required?.includes(u)||!1,d=up(c.type);if(s1(c)){a[u]={through:l,local:this.getPropertyOption(u,c,e,"local")},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:[]});let h=`add${zs(u)}`,g=`remove${zs(u)}`,v=`setCollection${zs(u)}`;n.prototype[h]=function(){},n.prototype[g]=function(){},n.prototype[v]=function(){}}else{let h=this.getPropertyOption(u,c,e,"resolveLanguage");!h&&e.resolveLanguage&&(h=e.resolveLanguage);let g=this.getPropertyOption(u,c,e,"local"),v=this.getPropertyOption(u,c,e,"writable",!0),b=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"),f&&!b&&(c1(c)?b="literal://json:{}":b="ad4m://undefined"),i[u]={through:l,required:f,writable:v,...h&&{resolveLanguage:h},...g!==void 0&&{local:g},...b&&{initial:b}},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(d)}),v){let _=Jl(u);n.prototype[_]=function(){}}}}if(!Object.values(i).some(u=>u.initial)){let u="ad4m://type",c;if(r.includes("://")){let[l,f]=r.split("://"),d=(f||"").replace(/\/+$/,"");d?c=`${l}://${d}/instance`:c=`${l}://instance`}else c=`${r.replace(/\/+$/,"")}/instance`;i.__ad4m_type={through:u,required:!0,writable:!1,initial:c,flag:!0},Object.defineProperty(n.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:c}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${c}`)}return n.prototype.__properties=i,n.prototype.__collections=a,n.prototype.__jsonSchema=t,n.prototype.__jsonSchemaOptions=e,P3({name:e.name})(n),n}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 n=new URL(t.$id).pathname.split("/").filter(i=>i);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:
1489
1520
  - options.namespace
1490
1521
  - schema["x-ad4m"].namespace
1491
1522
  - schema.title
1492
- - valid schema.$id`)}static determinePredicate(t,e,r,n,i){if(i.propertyMapping?.[e])return i.propertyMapping[e];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(i.predicateTemplate){let o=e1(n),[s,u]=o.includes("://")?o.split("://"):["",o],c=u||"";return i.predicateTemplate.replace("${namespace}",c).replace("${scheme}",s).replace("${ns}",c).replace("${title}",t.title||"").replace("${property}",e)}if(i.predicateGenerator)return i.predicateGenerator(t.title||"",e);let a=e1(n);return a.includes("://")?`${a}${e}`:`${a}://${e}`}static getPropertyOption(t,e,r,n,i){return r.propertyOptions?.[t]?.[n]!==void 0?r.propertyOptions[t][n]:e["x-ad4m"]?.[n]!==void 0?e["x-ad4m"][n]:r[n]!==void 0?r[n]:i}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""}}};bt=new WeakMap,ar=new WeakMap,Ms=new WeakMap,Oe=new WeakMap;_Ad4mModel.classNamesByClass=new WeakMap;var Bl=class{constructor(e,r,n){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=r,n&&(this.queryParams=n)}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:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return n}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(e),{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r);return n}}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 n=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let r=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return n}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 n=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let r=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async i=>{let a=i?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(n),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,r){let n={...this.queryParams||{},limit:e,offset:e*(r-1),count:!0};if(this.useSurrealDBFlag){let i=await this.ctor.queryToSurrealQL(this.perspective,n),a=await this.perspective.querySurrealDB(i),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:r}}else{let i=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName),a=await this.perspective.infer(i),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:r}}}async paginateSubscribe(e,r,n){this.dispose();let i={...this.queryParams||{},limit:e,offset:e*(r-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,i);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async c=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,c);n({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:u}=await this.ctor.instancesFromSurrealResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:u,pageSize:e,pageNumber:r}}else{let a=await this.ctor.queryToProlog(this.perspective,i,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);n({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:u}=await this.ctor.instancesFromPrologResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:u,pageSize:e,pageNumber:r}}}};var vc="0.11.1";var Tr=12e3;function D3(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function bc(t,e=1e4){return ye(this,null,function*(){return Promise.race([new Promise((r,n)=>{try{t.includes("localhost")||r(new WebSocket(t));let i=new WebSocket(t);i.onopen=()=>{r(i)},i.onerror=a=>{n(a)}}catch(i){n(i)}}),new Promise((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}function ap(t){return ye(this,null,function*(){try{let e=yield fetch(`http://localhost:${t}/graphql/`,{signal:D3().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 N3(){return new Promise((t,e)=>{let r=document.querySelector("ad4m-connect"),n=r==null?void 0:r.getAd4mClient();n?t(n):e("No Ad4mClient found")})}function op(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function _c(t,e){op()&&localStorage.setItem(`${vc}/${t}`,e)}function hr(t){return op()?localStorage.getItem(`${vc}/${t}`):null}function sp(t){op()&&localStorage.removeItem(`${vc}/${t}`)}var P3=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 yo(t,{include:e,exclude:r}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):r?!r.some(a):!0};for(let[i,a]of P3(t.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(t[a]=t[a].bind(t))}return t}var vo=class{constructor({appName:e,appDesc:r,appIconPath:n,appUrl:i,appDomain:a,capabilities:o,port:s,token:u,url:c,hosting:l}){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=Tr;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};yo(this);this.appName=e,this.appDesc=r,this.appDomain=a,this.appUrl=i,this.appIconPath=n,this.capabilities=o,this.port=s||this.port,this.url=c||`ws://localhost:${this.port}/graphql`,this.token=u||this.token,this.isHosting=l||!1,this.buildClient()}notifyConfigChange(e,r){this.listeners.configstatechange.forEach(n=>{n(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)}connect(e){return ye(this,null,function*(){try{if(e){yield bc(e),this.setUrl(e);let r=this.buildClient();return yield this.checkAuth(),r}else{this.notifyConnectionChange("checking_local");try{yield bc(`ws://localhost:${this.port}/graphql`,2e3);let r=this.buildClient();return yield this.checkAuth(),r}catch(r){let n=yield this.ensureConnection();return yield this.checkAuth(),n}}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}loginToHosting(e,r){return ye(this,null,function*(){try{let n=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:r})});if(n.status===200){let i=yield n.json();localStorage.setItem("hosting_token",i.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,_c("ad4mhosting","true"),!s.paused)this.connect();else throw new Error("Hosting is not running")}}else if((yield n.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(n){throw console.log(n),new Error(`Error logging in ${n}`)}})}checkEmail(e){return ye(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 ye(this,null,function*(){try{if(e){let r=yield ap(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 ye(this,null,function*(){var r,n;if(((r=this.activeSocket)==null?void 0:r.readyState)===WebSocket.OPEN&&((n=this.activeSocket)==null?void 0:n.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield bc(this.url),this.buildClient()}catch(i){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return ye(this,null,function*(){let e=[...Array(10).keys()].map((i,a)=>ap(Tr+a)),n=(yield Promise.allSettled(e)).find(i=>i.status==="fulfilled");if(n)return n.value;throw Error("Couldn't find an open port")})}buildClient(){this.notifyConnectionChange("connecting");try{let e=new WebSocket(this.url)}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=Fd({url:this.url,connectionParams:()=>ye(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=>ye(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 Gu({link:new Md(this.wsClient),cache:new ns({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new ic(this.apolloClient),this.ad4mClient}checkAuth(){return ye(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 ye(this,null,function*(){var r;if(e&&this.setToken(null),this.isHosting){let n=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+n}})).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 ye(this,null,function*(){var r;try{let n=yield(r=this.ad4mClient)==null?void 0:r.agent.generateJwt(this.requestId,e);return this.setToken(n),yield this.buildClient(),yield this.checkAuth(),this.token}catch(n){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(Tr),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function cp({unlockAgent:t,reconnect:e}){return z`
1523
+ - valid schema.$id`)}static determinePredicate(t,e,r,n,i){if(i.propertyMapping?.[e])return i.propertyMapping[e];if(r["x-ad4m"]?.through)return r["x-ad4m"].through;if(i.predicateTemplate){let o=o1(n),[s,u]=o.includes("://")?o.split("://"):["",o],c=u||"";return i.predicateTemplate.replace("${namespace}",c).replace("${scheme}",s).replace("${ns}",c).replace("${title}",t.title||"").replace("${property}",e)}if(i.predicateGenerator)return i.predicateGenerator(t.title||"",e);let a=o1(n);return a.includes("://")?`${a}${e}`:`${a}://${e}`}static getPropertyOption(t,e,r,n,i){return r.propertyOptions?.[t]?.[n]!==void 0?r.propertyOptions[t][n]:e["x-ad4m"]?.[n]!==void 0?e["x-ad4m"][n]:r[n]!==void 0?r[n]:i}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,De=new WeakMap;_Ad4mModel.classNamesByClass=new WeakMap;var Hl=class{constructor(e,r,n){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=r,n&&(this.queryParams=n)}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:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return n}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(e),{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r);return n}}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 n=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let r=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return n}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 n=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let r=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async i=>{let a=i?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(n),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,r){let n={...this.queryParams||{},limit:e,offset:e*(r-1),count:!0};if(this.useSurrealDBFlag){let i=await this.ctor.queryToSurrealQL(this.perspective,n),a=await this.perspective.querySurrealDB(i),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:r}}else{let i=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName),a=await this.perspective.infer(i),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:r}}}async paginateSubscribe(e,r,n){this.dispose();let i={...this.queryParams||{},limit:e,offset:e*(r-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,i);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async c=>{let{results:l,totalCount:f}=await this.ctor.instancesFromSurrealResult(this.perspective,i,c);n({results:l,totalCount:f,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:u}=await this.ctor.instancesFromSurrealResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:u,pageSize:e,pageNumber:r}}else{let a=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async c=>{let{results:l,totalCount:f}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,c);n({results:l,totalCount:f,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:u}=await this.ctor.instancesFromPrologResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:u,pageSize:e,pageNumber:r}}}};var Cc="0.11.2-dev-multi-user-2";var Tr=12e3;function F3(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function dn(t,e=1e4){return X(this,null,function*(){return Promise.race([new Promise((r,n)=>{let i;try{i=new WebSocket(t,"graphql-transport-ws"),i.onopen=()=>{i.close(),r(i)},i.onerror=a=>{n(a)},i.onclose=a=>{a.code!==1e3&&n(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){i&&i.close(),n(a)}}),new Promise((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}function lp(t){return X(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"),n=r==null?void 0:r.getAd4mClient();n?t(n):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 n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):r?!r.some(a):!0};for(let[i,a]of U3(t.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,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=Tr;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(n=>{n(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:()=>X(this,null,function*(){return{headers:{authorization:""}}})}),n=new ds({link:new el(r),cache:new Aa({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"}}});return new ho(n)}connect(e){return X(this,null,function*(){try{if(e){yield dn(e),this.setUrl(e);let r=this.buildClient();return yield this.checkAuth(),r}else{let r=`ws://localhost:${this.port}/graphql`;yield dn(r),this.setUrl(r);let n=this.buildClient();return yield this.checkAuth(),n}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}connectMultiUser(){return X(this,null,function*(){try{let e=this.options.backendUrl;console.debug("[Ad4m Connect] Connecting to backend:",e),yield dn(e),this.setUrl(e);let r=this.buildClient();console.debug("[Ad4m Connect] Built client:",r);let n;try{console.debug("[Ad4m Connect] Logging in user:",this.options.userEmail),n=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);try{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")}catch(o){console.log("[Ad4m Connect] Failed to create user:",o)}console.debug("[Ad4m Connect] Logging in user after creation:",this.options.userEmail),n=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}`)}}this.setToken(n);let i=this.buildClient();return yield i.agent.status(),this.ad4mClient=i,this.notifyAuthChange("authenticated"),this.notifyConnectionChange("connected"),i}catch(e){throw this.notifyConnectionChange("error"),this.notifyAuthChange("unauthenticated"),e}})}loginToHosting(e,r){return X(this,null,function*(){try{let n=yield fetch("https://hosting.ad4m.dev/api/auth/login",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({email:e,password:r})});if(n.status===200){let i=yield n.json();localStorage.setItem("hosting_token",i.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 n.json()).message==="Passwords did not match")throw new Error("Passwords did not match")}catch(n){throw console.log(n),new Error(`Error logging in ${n}`)}})}checkEmail(e){return X(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 X(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 X(this,null,function*(){var r,n;if(((r=this.activeSocket)==null?void 0:r.readyState)===WebSocket.OPEN&&((n=this.activeSocket)==null?void 0:n.url)===this.url&&this.ad4mClient)return this.ad4mClient;try{return this.notifyConnectionChange("connecting"),yield dn(this.url),this.buildClient()}catch(i){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return X(this,null,function*(){let e=[...Array(10).keys()].map((i,a)=>lp(Tr+a)),n=(yield Promise.allSettled(e)).find(i=>i.status==="fulfilled");if(n)return n.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:()=>X(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=>X(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 Aa({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 X(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 X(this,null,function*(){var r;if(e&&this.setToken(null),this.isHosting){let n=localStorage.getItem("hosting_token");(yield fetch("https://hosting.ad4m.dev/api/service/checkStatus",{method:"POST",headers:{"Content-Type":"application/json",Authorization:"Bearer "+n}})).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 X(this,null,function*(){var r;try{let n=yield(r=this.ad4mClient)==null?void 0:r.agent.generateJwt(this.requestId,e);return this.setToken(n),yield this.buildClient(),yield this.checkAuth(),this.token}catch(n){throw new Error("Invalid code")}})}clearState(){this.setToken(null),this.setPort(Tr),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};function dp({unlockAgent:t,reconnect:e}){return F`
1493
1524
  <div class="text-center">
1494
1525
  <div class="items">
1495
1526
  <div>
@@ -1501,7 +1532,205 @@ WHERE ${l.join(" AND ")}
1501
1532
  <button class="button" @click=${e}>Reconnect</button>
1502
1533
  </div>
1503
1534
  </div>
1504
- `}function up(){return z`
1535
+ `}function hp({localDetected:t,multiUserConfigured:e,backendUrl:r,configuredUrl:n,isMobile:i,onConnectLocal:a,onConnectRemote:o,onScanQR:s,onDownloadAd4m:u}){let c=!i&&t,l=!0,f=i,d=!t&&!e,p=r||n;return F`
1536
+ <div class="items">
1537
+ <div class="text-center">
1538
+ <h3 class="heading">Connect to AD4M</h3>
1539
+ ${t?F`
1540
+ <p class="body">Choose how you want to connect:</p>
1541
+ `:F`
1542
+ <p class="body" style="color: var(--body-color); opacity: 0.8;">
1543
+ No local AD4M detected.
1544
+ ${i?F`Connect to a remote executor or scan a QR code.`:F`Download AD4M or connect to a remote executor.`}
1545
+ </p>
1546
+ `}
1547
+ </div>
1548
+
1549
+ <div class="items items--small">
1550
+ ${c?F`
1551
+ <div class="connection-option connection-option--primary">
1552
+ <div class="connection-option__header">
1553
+ <svg
1554
+ width="24"
1555
+ height="24"
1556
+ viewBox="0 0 24 24"
1557
+ fill="none"
1558
+ stroke="currentColor"
1559
+ >
1560
+ <circle cx="12" cy="12" r="10"></circle>
1561
+ <circle cx="12" cy="12" r="3" fill="currentColor"></circle>
1562
+ </svg>
1563
+ <h4 class="heading nomargin">Local AD4M</h4>
1564
+ </div>
1565
+ <p class="body" style="margin: 10px 0 15px 0; font-size: 13px;">
1566
+ Connect to your local executor on port 12000
1567
+ </p>
1568
+ <button
1569
+ class="button button--full"
1570
+ @click=${a}
1571
+ >
1572
+ Connect to Local AD4M
1573
+ </button>
1574
+ </div>
1575
+ `:""}
1576
+
1577
+ ${l?F`
1578
+ <div
1579
+ class="connection-option ${c?"":"connection-option--primary"}"
1580
+ >
1581
+ <div class="connection-option__header">
1582
+ <svg
1583
+ width="24"
1584
+ height="24"
1585
+ viewBox="0 0 24 24"
1586
+ fill="none"
1587
+ stroke="currentColor"
1588
+ >
1589
+ <circle cx="12" cy="12" r="10"></circle>
1590
+ <path d="M2 12h20"></path>
1591
+ <path
1592
+ d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"
1593
+ ></path>
1594
+ </svg>
1595
+ <h4 class="heading nomargin">
1596
+ ${p?"Configured AD4M Node":"Remote AD4M"}
1597
+ </h4>
1598
+ </div>
1599
+ ${p?F`
1600
+ <p
1601
+ class="body"
1602
+ style="margin: 10px 0 5px 0; font-size: 13px;"
1603
+ >
1604
+ ${e?"Multi-user backend configured":"Connect to AD4M node at URL"}
1605
+ </p>
1606
+ <p
1607
+ class="body"
1608
+ style="margin: 0 0 15px 0; font-size: 12px; opacity: 0.7; font-family: monospace;"
1609
+ >
1610
+ ${p}
1611
+ </p>
1612
+ `:F`
1613
+ <p
1614
+ class="body"
1615
+ style="margin: 10px 0 15px 0; font-size: 13px;"
1616
+ >
1617
+ Connect to a remote executor or multi-user backend
1618
+ </p>
1619
+ `}
1620
+ <button
1621
+ class="button ${c?"button--secondary":""} button--full"
1622
+ @click=${o}
1623
+ >
1624
+ ${p?"Connect to Configured Node":"Enter Remote URL"}
1625
+ </button>
1626
+ </div>
1627
+ `:""}
1628
+
1629
+ ${f?F`
1630
+ <div class="connection-option">
1631
+ <div class="connection-option__header">
1632
+ <svg
1633
+ width="24"
1634
+ height="24"
1635
+ viewBox="0 0 24 24"
1636
+ fill="none"
1637
+ stroke="currentColor"
1638
+ >
1639
+ <rect x="3" y="3" width="7" height="7"></rect>
1640
+ <rect x="14" y="3" width="7" height="7"></rect>
1641
+ <rect x="14" y="14" width="7" height="7"></rect>
1642
+ <rect x="3" y="14" width="7" height="7"></rect>
1643
+ </svg>
1644
+ <h4 class="heading nomargin">Scan QR Code</h4>
1645
+ </div>
1646
+ <p class="body" style="margin: 10px 0 15px 0; font-size: 13px;">
1647
+ Scan a QR code from another device
1648
+ </p>
1649
+ <button
1650
+ class="button button--secondary button--full"
1651
+ @click=${s}
1652
+ >
1653
+ Scan QR Code
1654
+ </button>
1655
+ </div>
1656
+ `:""}
1657
+
1658
+ ${d?F`
1659
+ <div class="connection-option connection-option--download">
1660
+ <div class="connection-option__header">
1661
+ <svg
1662
+ width="24"
1663
+ height="24"
1664
+ viewBox="0 0 24 24"
1665
+ fill="none"
1666
+ stroke="currentColor"
1667
+ >
1668
+ <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
1669
+ <polyline points="7 10 12 15 17 10"></polyline>
1670
+ <line x1="12" y1="15" x2="12" y2="3"></line>
1671
+ </svg>
1672
+ <h4 class="heading nomargin">Get AD4M</h4>
1673
+ </div>
1674
+ <p class="body" style="margin: 10px 0 15px 0; font-size: 13px;">
1675
+ Download and install AD4M on your device
1676
+ </p>
1677
+ <button
1678
+ class="button button--full"
1679
+ @click=${u}
1680
+ >
1681
+ Download AD4M
1682
+ </button>
1683
+ </div>
1684
+ `:""}
1685
+ </div>
1686
+ </div>
1687
+
1688
+ <style>
1689
+ .connection-option {
1690
+ background: rgba(145, 227, 253, 0.05);
1691
+ border: 1px solid rgba(145, 227, 253, 0.2);
1692
+ border-radius: 8px;
1693
+ padding: 20px;
1694
+ transition: all 0.3s ease;
1695
+ }
1696
+
1697
+ .connection-option:hover {
1698
+ border-color: rgba(145, 227, 253, 0.4);
1699
+ background: rgba(145, 227, 253, 0.08);
1700
+ }
1701
+
1702
+ .connection-option--primary {
1703
+ border: 2px solid var(--gradient);
1704
+ background: rgba(145, 227, 253, 0.1);
1705
+ }
1706
+
1707
+ .connection-option--primary:hover {
1708
+ background: rgba(145, 227, 253, 0.15);
1709
+ }
1710
+
1711
+ .connection-option--download {
1712
+ border-style: dashed;
1713
+ opacity: 0.9;
1714
+ }
1715
+
1716
+ .connection-option__header {
1717
+ display: flex;
1718
+ align-items: center;
1719
+ gap: 10px;
1720
+ margin-bottom: 5px;
1721
+ }
1722
+
1723
+ .connection-option__header svg {
1724
+ flex-shrink: 0;
1725
+ opacity: 0.8;
1726
+ }
1727
+
1728
+ .connection-option--primary .connection-option__header svg {
1729
+ color: var(--gradient);
1730
+ opacity: 1;
1731
+ }
1732
+ </style>
1733
+ `}function mp(){return F`
1505
1734
  <div class="items">
1506
1735
  <div class="text-center">
1507
1736
  <h1 class="heading">Request to AD4M blocked</h1>
@@ -1522,7 +1751,7 @@ WHERE ${l.join(" AND ")}
1522
1751
  </button>
1523
1752
  </div>
1524
1753
  </div>
1525
- `}function lp({reconnect:t}){return z`
1754
+ `}function gp({reconnect:t}){return F`
1526
1755
  <div class="items items--small">
1527
1756
  <div class="text-center">
1528
1757
  <h1 class="heading">Could not connect to AD4M</h1>
@@ -1531,7 +1760,7 @@ WHERE ${l.join(" AND ")}
1531
1760
  <button class="button" @click=${()=>t()}>Try again</button>
1532
1761
  </div>
1533
1762
  </div>
1534
- `}function pp(){return z`<header class="dialog__header">
1763
+ `}function yp(){return F`<header class="dialog__header">
1535
1764
  <div class="dialog__logo">
1536
1765
  <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 38 37" fill="none">
1537
1766
  <path
@@ -1540,25 +1769,25 @@ WHERE ${l.join(" AND ")}
1540
1769
  />
1541
1770
  </svg>
1542
1771
  </div>
1543
- </header>`}function fp({step:t,email:e,changeEmail:r,changeState:n,password:i,changePassword:a,login:o,checkEmail:s,passwordError:u,setHostingStep:c,isHostingRunning:l,setIsHostingRunning:d}){if(l)return z`
1772
+ </header>`}function vp({step:t,email:e,changeEmail:r,changeState:n,password:i,changePassword:a,login:o,checkEmail:s,passwordError:u,setHostingStep:c,isHostingRunning:l,setIsHostingRunning:f}){if(l)return F`
1544
1773
  <div class="text-center">
1545
1774
  <p>
1546
1775
  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.
1547
1776
  </p>
1548
1777
  <button
1549
1778
  class="button button--full button-secondary"
1550
- @click=${()=>d(null)}
1779
+ @click=${()=>f(null)}
1551
1780
  >
1552
1781
  Back
1553
1782
  </button>
1554
1783
  </div>
1555
- `;if(t===0)return z`
1784
+ `;if(t===0)return F`
1556
1785
  <div class="input">
1557
1786
  <label class="input__label">EMAIL</label>
1558
1787
  <input
1559
1788
  class="input__field"
1560
1789
  value=${e}
1561
- @input=${f=>r(f.target.value)}
1790
+ @input=${d=>r(d.target.value)}
1562
1791
  />
1563
1792
  <div class="buttons">
1564
1793
  <button
@@ -1575,18 +1804,18 @@ WHERE ${l.join(" AND ")}
1575
1804
  </button>
1576
1805
  </div>
1577
1806
  </div>
1578
- `;if(t===1)return z`
1807
+ `;if(t===1)return F`
1579
1808
  <div class="input">
1580
1809
  <label class="input__label">PASSWORD</label>
1581
1810
  <input
1582
1811
  class="input__field"
1583
1812
  value=${i}
1584
- @input=${f=>a(f.target.value)}
1813
+ @input=${d=>a(d.target.value)}
1585
1814
  type="password"
1586
1815
  errortext={passwordError}
1587
1816
  error={passwordError}
1588
1817
  />
1589
- ${u?z`<p class="error">${u}</p>`:""}
1818
+ ${u?F`<p class="error">${u}</p>`:""}
1590
1819
  <div class="buttons">
1591
1820
  <button
1592
1821
  class="button button--full button-secondary"
@@ -1603,7 +1832,7 @@ WHERE ${l.join(" AND ")}
1603
1832
  </button>
1604
1833
  </div>
1605
1834
  </div>
1606
- `;if(t===2)return z`
1835
+ `;if(t===2)return F`
1607
1836
  <div class="text-center">
1608
1837
  <p>
1609
1838
  Email is not registered. Please follow the <a target="_blank" href="https://hosting.ad4m.dev/">link</a> to register.
@@ -1615,7 +1844,7 @@ WHERE ${l.join(" AND ")}
1615
1844
  Back
1616
1845
  </button>
1617
1846
  </div>
1618
- `}function dp(){return z`
1847
+ `}function bp(){return F`
1619
1848
  <div>
1620
1849
  <div class="lds-ring">
1621
1850
  <div></div>
@@ -1624,30 +1853,431 @@ WHERE ${l.join(" AND ")}
1624
1853
  <div></div>
1625
1854
  </div>
1626
1855
  </div>
1627
- `}function bo(){return z`
1856
+ `}function xo(){return F`
1628
1857
  <svg width="44" height="40" viewBox="0 0 70 60" fill="none" xmlns="http://www.w3.org/2000/svg">
1629
1858
  <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"/>
1630
1859
  </svg>
1631
- `}function hp({openModal:t}){return z`
1860
+ `}function _p({openModal:t}){return F`
1632
1861
  <div class="mainlogo" @click=${t}>
1633
- ${bo()}
1862
+ ${xo()}
1863
+ </div>
1864
+ `}function wp({email:t,password:e,error:r,isLoading:n,backendUrl:i,changeEmail:a,changePassword:o,onLogin:s,onSignup:u,activeTab:c,setActiveTab:l}){return F`
1865
+ <div class="items">
1866
+ <div class="text-center">
1867
+ <h3 class="heading">Multi-User Authentication</h3>
1868
+ <p class="body">Please sign in or create an account to continue</p>
1869
+ ${i?F`
1870
+ <p
1871
+ class="body"
1872
+ style="margin-top: 10px; font-size: 12px; opacity: 0.7; font-family: monospace;"
1873
+ >
1874
+ ${i}
1875
+ </p>
1876
+ `:""}
1877
+ </div>
1878
+
1879
+ <!-- Tab Switcher -->
1880
+ <div class="tab-switcher">
1881
+ <button
1882
+ class="tab-button ${c==="login"?"active":""}"
1883
+ @click=${()=>l("login")}
1884
+ >
1885
+ Login
1886
+ </button>
1887
+ <button
1888
+ class="tab-button ${c==="signup"?"active":""}"
1889
+ @click=${()=>l("signup")}
1890
+ >
1891
+ Sign Up
1892
+ </button>
1893
+ </div>
1894
+
1895
+ ${r?F`
1896
+ <div class="error-message">
1897
+ <p>${r}</p>
1898
+ </div>
1899
+ `:""}
1900
+
1901
+ <!-- Login/Signup Form -->
1902
+ <div class="items items--small">
1903
+ <div class="input">
1904
+ <label class="input__label" for="email">Email</label>
1905
+ <input
1906
+ id="email"
1907
+ type="email"
1908
+ class="input__field"
1909
+ placeholder="your@email.com"
1910
+ .value=${t}
1911
+ @input=${f=>a(f.target.value)}
1912
+ ?disabled=${n}
1913
+ />
1634
1914
  </div>
1635
- `}function mp({capabilities:t,appname:e,appiconpath:r,changeState:n,setOpen:i,requestCapability:a}){return z`
1915
+
1916
+ <div class="input">
1917
+ <label class="input__label" for="password">Password</label>
1918
+ <input
1919
+ id="password"
1920
+ type="password"
1921
+ class="input__field"
1922
+ placeholder="Enter password"
1923
+ .value=${e}
1924
+ @input=${f=>o(f.target.value)}
1925
+ @keypress=${f=>{f.key==="Enter"&&(c==="login"?s():u())}}
1926
+ ?disabled=${n}
1927
+ />
1928
+ </div>
1929
+ </div>
1930
+
1931
+ <div class="buttons">
1932
+ ${c==="login"?F`
1933
+ <button
1934
+ class="button button--full"
1935
+ @click=${s}
1936
+ ?disabled=${n||!t||!e}
1937
+ >
1938
+ ${n?"Logging in...":"Login"}
1939
+ </button>
1940
+ `:F`
1941
+ <button
1942
+ class="button button--full"
1943
+ @click=${u}
1944
+ ?disabled=${n||!t||!e}
1945
+ >
1946
+ ${n?"Creating account...":"Sign Up"}
1947
+ </button>
1948
+ `}
1949
+ </div>
1950
+
1951
+ ${c==="login"?F`
1952
+ <div class="text-center">
1953
+ <p class="body">
1954
+ Don't have an account?
1955
+ <button
1956
+ class="button button--link"
1957
+ @click=${()=>l("signup")}
1958
+ >
1959
+ Sign up
1960
+ </button>
1961
+ </p>
1962
+ </div>
1963
+ `:F`
1964
+ <div class="text-center">
1965
+ <p class="body">
1966
+ Already have an account?
1967
+ <button
1968
+ class="button button--link"
1969
+ @click=${()=>l("login")}
1970
+ >
1971
+ Log in
1972
+ </button>
1973
+ </p>
1974
+ </div>
1975
+ `}
1976
+ </div>
1977
+
1978
+ <style>
1979
+ .tab-switcher {
1980
+ display: flex;
1981
+ gap: 10px;
1982
+ justify-content: center;
1983
+ border-bottom: 1px solid var(--body-color);
1984
+ padding-bottom: 10px;
1985
+ }
1986
+
1987
+ .tab-button {
1988
+ background: none;
1989
+ border: none;
1990
+ color: var(--body-color);
1991
+ padding: 10px 20px;
1992
+ cursor: pointer;
1993
+ font-size: 16px;
1994
+ font-weight: 500;
1995
+ border-bottom: 2px solid transparent;
1996
+ transition: all 0.3s ease;
1997
+ }
1998
+
1999
+ .tab-button.active {
2000
+ color: var(--gradient);
2001
+ border-bottom-color: var(--gradient);
2002
+ }
2003
+
2004
+ .tab-button:hover {
2005
+ color: var(--primary-color);
2006
+ }
2007
+
2008
+ .error-message {
2009
+ background-color: rgba(255, 0, 0, 0.1);
2010
+ border: 1px solid rgba(255, 0, 0, 0.3);
2011
+ border-radius: 8px;
2012
+ padding: 15px;
2013
+ color: #ff6b6b;
2014
+ text-align: center;
2015
+ }
2016
+
2017
+ .error-message p {
2018
+ margin: 0;
2019
+ }
2020
+ </style>
2021
+ `}function Sp({initialUrl:t,detecting:e,multiUserDetected:r,error:n,onBack:i,onUrlChange:a,onConnect:o,onMultiUserAuth:s,onRequestCapability:u}){let c=r!==null&&!e,l=t||"";return F`
2022
+ <div class="items">
2023
+ <div class="text-center">
2024
+ <h3 class="heading">Connect to Remote AD4M</h3>
2025
+ <p class="body">Enter the URL of a remote AD4M executor</p>
2026
+ </div>
2027
+
2028
+ ${c?F`
2029
+ <div class="items items--small">
2030
+ <div class="remote-info">
2031
+ <p class="body" style="margin: 0 0 5px 0; font-size: 13px;">
2032
+ Connected to:
2033
+ </p>
2034
+ <p
2035
+ class="body"
2036
+ style="margin: 0; font-family: monospace; font-size: 12px; opacity: 0.8;"
2037
+ >
2038
+ ${l}
2039
+ </p>
2040
+ </div>
2041
+
2042
+ ${r?F`
2043
+ <div class="auth-option auth-option--primary">
2044
+ <div class="auth-option__header">
2045
+ <svg
2046
+ width="20"
2047
+ height="20"
2048
+ viewBox="0 0 24 24"
2049
+ fill="none"
2050
+ stroke="currentColor"
2051
+ >
2052
+ <path
2053
+ d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"
2054
+ ></path>
2055
+ <circle cx="9" cy="7" r="4"></circle>
2056
+ <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
2057
+ <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
2058
+ </svg>
2059
+ <h4 class="heading nomargin" style="font-size: 16px;">
2060
+ Multi-User Login
2061
+ </h4>
2062
+ </div>
2063
+ <p
2064
+ class="body"
2065
+ style="margin: 10px 0 15px 0; font-size: 13px;"
2066
+ >
2067
+ This executor supports multi-user authentication. Sign
2068
+ in or create an account.
2069
+ </p>
2070
+ <button class="button button--full" @click=${s}>
2071
+ Login / Sign Up
2072
+ </button>
2073
+ </div>
2074
+
2075
+ <div class="auth-option">
2076
+ <div class="auth-option__header">
2077
+ <svg
2078
+ width="20"
2079
+ height="20"
2080
+ viewBox="0 0 24 24"
2081
+ fill="none"
2082
+ stroke="currentColor"
2083
+ >
2084
+ <rect
2085
+ x="3"
2086
+ y="11"
2087
+ width="18"
2088
+ height="11"
2089
+ rx="2"
2090
+ ry="2"
2091
+ ></rect>
2092
+ <path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
2093
+ </svg>
2094
+ <h4 class="heading nomargin" style="font-size: 16px;">
2095
+ Capability Request
2096
+ </h4>
2097
+ </div>
2098
+ <p
2099
+ class="body"
2100
+ style="margin: 10px 0 15px 0; font-size: 13px;"
2101
+ >
2102
+ Request access to the main agent with a verification
2103
+ code.
2104
+ </p>
2105
+ <button
2106
+ class="button button--secondary button--full"
2107
+ @click=${u}
2108
+ >
2109
+ Request Capability
2110
+ </button>
2111
+ </div>
2112
+ `:F`
2113
+ <div class="auth-option auth-option--primary">
2114
+ <div class="auth-option__header">
2115
+ <svg
2116
+ width="20"
2117
+ height="20"
2118
+ viewBox="0 0 24 24"
2119
+ fill="none"
2120
+ stroke="currentColor"
2121
+ >
2122
+ <rect
2123
+ x="3"
2124
+ y="11"
2125
+ width="18"
2126
+ height="11"
2127
+ rx="2"
2128
+ ry="2"
2129
+ ></rect>
2130
+ <path d="M7 11V7a5 5 0 0 1 10 0v4"></path>
2131
+ </svg>
2132
+ <h4 class="heading nomargin" style="font-size: 16px;">
2133
+ Single-User Executor
2134
+ </h4>
2135
+ </div>
2136
+ <p
2137
+ class="body"
2138
+ style="margin: 10px 0 15px 0; font-size: 13px;"
2139
+ >
2140
+ This executor uses capability-based authentication.
2141
+ Request access with a verification code.
2142
+ </p>
2143
+ <button
2144
+ class="button button--full"
2145
+ @click=${u}
2146
+ >
2147
+ Request Capability
2148
+ </button>
2149
+ </div>
2150
+ `}
2151
+
2152
+ <div class="buttons">
2153
+ <button
2154
+ class="button button--link"
2155
+ @click=${i}
2156
+ style="margin: 0 auto;"
2157
+ >
2158
+ ← Back to connection options
2159
+ </button>
2160
+ </div>
2161
+ </div>
2162
+ `:F`
2163
+ <div class="items items--small">
2164
+ <div class="input">
2165
+ <label class="input__label" for="remote-url">
2166
+ Executor URL
2167
+ </label>
2168
+ <input
2169
+ id="remote-url"
2170
+ type="text"
2171
+ class="input__field"
2172
+ placeholder="wss://your-server.com/graphql"
2173
+ .value=${l}
2174
+ @input=${f=>a(f.target.value)}
2175
+ ?disabled=${e}
2176
+ />
2177
+ </div>
2178
+
2179
+ ${n?F`
2180
+ <div class="error-message">
2181
+ <p>${n}</p>
2182
+ </div>
2183
+ `:""}
2184
+
2185
+ <div class="buttons">
2186
+ <button
2187
+ class="button button--secondary"
2188
+ @click=${i}
2189
+ ?disabled=${e}
2190
+ >
2191
+ Back
2192
+ </button>
2193
+ <button
2194
+ class="button"
2195
+ @click=${o}
2196
+ ?disabled=${e||!l}
2197
+ >
2198
+ ${e?"Detecting...":"Connect"}
2199
+ </button>
2200
+ </div>
2201
+ </div>
2202
+ `}
2203
+ </div>
2204
+
2205
+ <style>
2206
+ .remote-info {
2207
+ background: rgba(145, 227, 253, 0.05);
2208
+ border: 1px solid rgba(145, 227, 253, 0.2);
2209
+ border-radius: 8px;
2210
+ padding: 15px;
2211
+ }
2212
+
2213
+ .auth-option {
2214
+ background: rgba(145, 227, 253, 0.05);
2215
+ border: 1px solid rgba(145, 227, 253, 0.2);
2216
+ border-radius: 8px;
2217
+ padding: 20px;
2218
+ transition: all 0.3s ease;
2219
+ }
2220
+
2221
+ .auth-option:hover {
2222
+ border-color: rgba(145, 227, 253, 0.4);
2223
+ background: rgba(145, 227, 253, 0.08);
2224
+ }
2225
+
2226
+ .auth-option--primary {
2227
+ border: 2px solid var(--gradient);
2228
+ background: rgba(145, 227, 253, 0.1);
2229
+ }
2230
+
2231
+ .auth-option--primary:hover {
2232
+ background: rgba(145, 227, 253, 0.15);
2233
+ }
2234
+
2235
+ .auth-option__header {
2236
+ display: flex;
2237
+ align-items: center;
2238
+ gap: 10px;
2239
+ margin-bottom: 5px;
2240
+ }
2241
+
2242
+ .auth-option__header svg {
2243
+ flex-shrink: 0;
2244
+ opacity: 0.8;
2245
+ }
2246
+
2247
+ .auth-option--primary .auth-option__header svg {
2248
+ color: var(--gradient);
2249
+ opacity: 1;
2250
+ }
2251
+
2252
+ .error-message {
2253
+ background-color: rgba(255, 0, 0, 0.1);
2254
+ border: 1px solid rgba(255, 0, 0, 0.3);
2255
+ border-radius: 8px;
2256
+ padding: 15px;
2257
+ color: #ff6b6b;
2258
+ text-align: center;
2259
+ }
2260
+
2261
+ .error-message p {
2262
+ margin: 0;
2263
+ }
2264
+ </style>
2265
+ `}function Cp({capabilities:t,appname:e,appiconpath:r,changeState:n,setOpen:i,requestCapability:a}){return F`
1636
2266
  <div class="items">
1637
2267
  <div class="text-center">
1638
2268
  <p class="body">An external application</p>
1639
2269
  <h1 class="heading nomargin">${e}</h1>
1640
2270
  <p class="body">wants to access your AD4M data</p>
1641
2271
  </div>
1642
- ${r&&z`<div class="dialog__connect">
2272
+ ${r&&F`<div class="dialog__connect">
1643
2273
  <img class="dialog__connect-app" src=${r} alt="Logo" />
1644
2274
  <div class="dialog__connect-check"></div>
1645
- <div class="dialog__connect-ad4m">${bo()}</div>
2275
+ <div class="dialog__connect-ad4m">${xo()}</div>
1646
2276
  </div>`}
1647
2277
  <div>
1648
2278
  <p class="text-center"><b>This will allow the developer to:</b></p>
1649
2279
  <ul class="check-list">
1650
- ${t.map(o=>z`<li>
2280
+ ${t.map(o=>F`<li>
1651
2281
  <span>
1652
2282
  <svg
1653
2283
  xmlns="http://www.w3.org/2000/svg"
@@ -1661,7 +2291,7 @@ WHERE ${l.join(" AND ")}
1661
2291
  />
1662
2292
  </svg>
1663
2293
  </span>
1664
- <span>${nm(o)}</span>
2294
+ <span>${um(o)}</span>
1665
2295
  </li>`)}
1666
2296
  </ul>
1667
2297
  </div>
@@ -1686,7 +2316,7 @@ WHERE ${l.join(" AND ")}
1686
2316
  Connection settings
1687
2317
  </button>
1688
2318
  </div>
1689
- `}function gp({changeState:t,onSuccess:e,uiState:r}){function n(i){let a=new BarcodeDetector,o=i.currentTarget,s=()=>ye(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 z`
2319
+ `}function Ep({changeState:t,onSuccess:e,uiState:r}){function n(i){let a=new BarcodeDetector,o=i.currentTarget,s=()=>X(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 F`
1690
2320
  <div class="qr-scanner">
1691
2321
  <div class="qr-content">
1692
2322
  <button
@@ -1705,7 +2335,7 @@ WHERE ${l.join(" AND ")}
1705
2335
  ></video>
1706
2336
  </div>
1707
2337
  </div>
1708
- `}function yp({port:t,url:e,isRemote:r,connectToPort:n,changeIsRemote:i,connectRemote:a,changeState:o,changeUrl:s,changePort:u,clearState:c}){return z`
2338
+ `}function xp({port:t,url:e,isRemote:r,connectToPort:n,changeIsRemote:i,connectRemote:a,changeState:o,changeUrl:s,changePort:u,clearState:c}){return F`
1709
2339
  <div class="items items--small">
1710
2340
  <div class="text-center">
1711
2341
  <h1 class="heading">Connection Settings</h1>
@@ -1719,13 +2349,13 @@ WHERE ${l.join(" AND ")}
1719
2349
  Remotely
1720
2350
  </button>
1721
2351
  </div>
1722
- ${r?z`
2352
+ ${r?F`
1723
2353
  <div class="input">
1724
2354
  <label class="input__label">URL</label>
1725
2355
  <input
1726
2356
  class="input__field"
1727
2357
  value=${e}
1728
- @input=${f=>s(f.target.value)}
2358
+ @input=${d=>s(d.target.value)}
1729
2359
  />
1730
2360
  </div>
1731
2361
  <div class="buttons">
@@ -1736,13 +2366,13 @@ WHERE ${l.join(" AND ")}
1736
2366
  Connect
1737
2367
  </button>
1738
2368
  </div>
1739
- `:z`
2369
+ `:F`
1740
2370
  <div class="input">
1741
2371
  <label class="input__label">PORT</label>
1742
2372
  <input
1743
2373
  class="input__field"
1744
2374
  value=${t}
1745
- @input=${f=>u(parseInt(f.target.value))}
2375
+ @input=${d=>u(parseInt(d.target.value))}
1746
2376
  />
1747
2377
  </div>
1748
2378
 
@@ -1772,9 +2402,9 @@ WHERE ${l.join(" AND ")}
1772
2402
  </button>
1773
2403
  </div
1774
2404
  </div>
1775
- `}function vp({connect:t,isMobile:e,hasClickedDownload:r,changeState:n,onDownloaded:i,scanQrcode:a,hosting:o}){let u=(hr("ad4murl")||`http://localhost:${Tr}`).includes("localhost");function c(l){l.preventDefault();let d=l.currentTarget;window.open(d.href,"_blank"),this.onDownloaded()}return z`
2405
+ `}function Ap({connect:t,isMobile:e,hasClickedDownload:r,changeState:n,onDownloaded:i,scanQrcode:a,hosting:o}){let u=(Kt("ad4murl")||`http://localhost:${Tr}`).includes("localhost");function c(l){l.preventDefault();let f=l.currentTarget;window.open(f.href,"_blank"),this.onDownloaded()}return F`
1776
2406
  <div class="items">
1777
- ${r?z`
2407
+ ${r?F`
1778
2408
  <div class="text-center">
1779
2409
  <a class="button" target="_blank" @click=${()=>t()}>
1780
2410
  Connect to ADAM
@@ -1784,17 +2414,17 @@ WHERE ${l.join(" AND ")}
1784
2414
  ADAM agent
1785
2415
  </p>
1786
2416
  </div>
1787
- `:z`
2417
+ `:F`
1788
2418
  <div class="text-center">
1789
2419
  <h1 class="heading">Could not connect to AD4M</h1>
1790
- ${u?z`
2420
+ ${u?F`
1791
2421
  <p style="color: #b9b9b9; font-size: 15px; text-align: center; margin: 30px 0;">
1792
2422
  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.
1793
2423
  <br/>
1794
2424
  <br/>
1795
2425
  (Safari users: please use a different browser for now. Safari is very strict about this and we are working on a solution.)
1796
2426
  </p>
1797
- `:z`
2427
+ `:F`
1798
2428
  <p style="color: #b9b9b9; font-size: 15px; text-align: center; margin: 30px 0;">
1799
2429
  Looks like the remote executor you are trying to connect to is not reachable.
1800
2430
  <br/>
@@ -1802,9 +2432,9 @@ WHERE ${l.join(" AND ")}
1802
2432
  Please try connecting to a different remote executor or check your connection settings.
1803
2433
  </p>
1804
2434
  `}
1805
- ${e?z`<button class="button" @click=${()=>a()}>
2435
+ ${e?F`<button class="button" @click=${()=>a()}>
1806
2436
  Connect with QR
1807
- </button>`:z`<a
2437
+ </button>`:F`<a
1808
2438
  class="button"
1809
2439
  target="_blank"
1810
2440
  @click=${c}
@@ -1813,8 +2443,8 @@ WHERE ${l.join(" AND ")}
1813
2443
  Download AD4M
1814
2444
  </a>
1815
2445
  `}
1816
- ${o?z`<p>Or</p>`:""}
1817
- ${o?z`<button class="button" @click=${()=>n("hosting")}>Use hosted AD4M (alpha)</button>`:""}
2446
+ ${o?F`<p>Or</p>`:""}
2447
+ ${o?F`<button class="button" @click=${()=>n("hosting")}>Use hosted AD4M (alpha)</button>`:""}
1818
2448
  </div>
1819
2449
 
1820
2450
  <div style="display: flex; flex-direction: column; align-items: center; gap: 20px; margin-top: -30px">
@@ -1838,7 +2468,7 @@ WHERE ${l.join(" AND ")}
1838
2468
  </a>
1839
2469
  </div>
1840
2470
  </div>
1841
- `}function bp({code:t,changeState:e,verifyCode:r,changeCode:n,isHosting:i,verifyCodeError:a}){return z`
2471
+ `}function kp({code:t,changeState:e,verifyCode:r,changeCode:n,isHosting:i,verifyCodeError:a}){return F`
1842
2472
  <div class="items">
1843
2473
  <div class="text-center">
1844
2474
  <div class="heading">${i?"Please check your emails for the 2FA security code that was sent from the ADAM hosting service":"Please check your ADAM Launcher"}</div>
@@ -1856,7 +2486,7 @@ WHERE ${l.join(" AND ")}
1856
2486
  value=${t}
1857
2487
  @change=${o=>n(o.target.value)}
1858
2488
  />
1859
- ${a?z`<p class="error">${a}</p>`:""}
2489
+ ${a?F`<p class="error">${a}</p>`:""}
1860
2490
  </div>
1861
2491
  <div class="buttons">
1862
2492
  <button
@@ -1870,7 +2500,7 @@ WHERE ${l.join(" AND ")}
1870
2500
  </button>
1871
2501
  </div>
1872
2502
  </div>
1873
- `}function R3(){return[/Android/i,/webOS/i,/iPhone/i,/iPad/i,/iPod/i,/BlackBerry/i,/Windows Phone/i].some(e=>navigator.userAgent.match(e))}var $3=Cc`
2503
+ `}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`
1874
2504
  :host {
1875
2505
  --primary-color: #fff;
1876
2506
  --heading-color: #fff;
@@ -2271,16 +2901,16 @@ WHERE ${l.join(" AND ")}
2271
2901
  width: 100vw;
2272
2902
  object-fit: cover;
2273
2903
  }
2274
- `,he=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.uiState="start";this.appName=null;this.appDesc=null;this.appDomain=null;this.appIconPath=null;this.mobile=null;this.capabilities=[];this.hosting=hr("ad4mhosting")==="true"||!1;this.token=hr("ad4mToken")||"";this.port=parseInt(hr("ad4mport"))||Tr;this.url=hr("ad4murl")||""}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(),yo(this),this.injectFont(),this._isMobile=R3(),this._client=new vo({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(hr("ad4mport"))||Tr,token:this.token||hr("ad4mtoken"),url:this.url||hr("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._client.connect()}checkEmail(){return ye(this,null,function*(){try{(yield this._client.checkEmail(this._email))?this._hostingStep=1:this._hostingStep=2}catch(r){console.log(r)}})}loginToHosting(){return ye(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,n=!0){return ye(this,null,function*(){yield this._client.ad4mClient.agent.unlock(r,n)})}verifyCode(r){return ye(this,null,function*(){try{yield this._client.verifyCode(r)}catch(n){this._verifyCodeError="Invalid code"}})}changeUrl(r){r!==this._client.url&&(sp("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 n=new CustomEvent("authstatechange",{detail:r});r==="locked"&&(this._isOpen=!0),r==="authenticated"&&(this._isOpen=!1),this.dispatchEvent(n),this.requestUpdate()}handleConfigChange(r,n){this[r]=n,n?_c("ad4m"+r,n):sp("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.changeUIState("start"));let n=new CustomEvent("connectionstatechange",{detail:r});this.dispatchEvent(n),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 ye(this,null,function*(){try{window.BarcodeDetector.getSupportedFormats()}catch(n){window.BarcodeDetector=Dr}yield this.changeUIState("qr"),setTimeout(()=>ye(this,null,function*(){let n=this.shadowRoot.querySelector("video");if(!n)return;let i=yield navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:"environment"}});n.srcObject=i,n.autoplay=!0}),100)})}connect(){return ye(this,null,function*(){this._isOpen=!0,this.requestUpdate();let r=yield this._client.connect();try{let n=yield r.agent.status();n.isUnlocked&&n.isInitialized&&window.location.reload()}catch(n){console.warn(n)}return r})}getAd4mClient(){return this._client.ad4mClient}connectRemote(r){return ye(this,null,function*(){try{this.changeUrl(r);let n=yield this._client.connect(r),i=yield n.agent.status();return i.isUnlocked&&i.isInitialized||this.changeUIState("requestcap"),n}catch(n){this.changeUIState("requestcap"),this._isOpen=!0}})}requestCapability(r){return ye(this,null,function*(){try{yield this._client.requestCapability(r),this.changeUIState("verifycode")}catch(n){console.warn(n)}})}isAuthenticated(){return ye(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 dp();if(this.uiState==="hosting")return fp({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 gp({changeState:this.changeUIState,onSuccess:r=>{this.changeUrl(r),this._client.connect(r)},uiState:this.uiState});if(this.authState==="locked")return cp({unlockAgent:this.unlockAgent,reconnect:this.connect});if(this.uiState==="settings")return yp({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 vp({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"?bp({code:this._code,changeCode:this.changeCode,changeState:this.changeUIState,verifyCode:this.verifyCode,isHosting:this._client.isHosting,verifyCodeError:this._verifyCodeError}):mp({changeState:this.changeUIState,requestCapability:this.requestCapability,capabilities:this.capabilities,appname:this.appName,setOpen:this.setOpen,appiconpath:this.appIconPath});if(this.connectionState==="disconnected")return lp({reconnect:this.connect});if(this.connectionState==="port_not_found")return up()}mobileView(){return this.mobile?hp({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:z`
2904
+ `,Z=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._multiUserError=null;this._multiUserLoading=!1;this._multiUserTab="login";this._localDetected=!1;this._remoteUrl="";this._remoteMultiUserDetected=null;this._remoteDetecting=!1;this._remoteError=null;this.uiState="connection_overview";this.appName=null;this.appDesc=null;this.appDomain=null;this.appIconPath=null;this.mobile=null;this.capabilities=[];this.hosting=Kt("ad4mhosting")==="true"||!1;this.token=Kt("ad4mToken")||"";this.port=parseInt(Kt("ad4mport"))||Tr;this.url=Kt("ad4murl")||"";this.multiUser=!1;this.backendUrl=""}get authState(){return this._client.authState}get connectionState(){return this._client.connectionState}injectFont(){let 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"))||Tr,token:this.token||Kt("ad4mtoken"),url:this.url||Kt("ad4murl"),hosting:this.hosting}),this._client.on("configstatechange",this.handleConfigChange),this._client.on("authstatechange",this.handleAuthChange),this._client.on("connectionstatechange",this.handleConnectionChange),this.loadFont(),this.token||Kt("ad4mtoken")?this.multiUser&&this.backendUrl?this._client.connect(this.backendUrl):this._client.connect():(this.detectLocal(),this.changeUIState("connection_overview"),this._isOpen=!0)}checkEmail(){return X(this,null,function*(){try{(yield this._client.checkEmail(this._email))?this._hostingStep=1:this._hostingStep=2}catch(r){console.log(r)}})}handleMultiUserSignup(){return X(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null,this._client.options.userEmail=this._multiUserEmail,this._client.options.userPassword=this._multiUserPassword,this._client.options.backendUrl=this.backendUrl;let r=yield this._client.connectMultiUser();this._multiUserEmail="",this._multiUserPassword="",this._isOpen=!1,this.changeUIState("connected")}catch(r){this._multiUserError=r.message||"Failed to create account. Please try again."}finally{this._multiUserLoading=!1}})}handleMultiUserLogin(){return X(this,null,function*(){try{this._multiUserLoading=!0,this._multiUserError=null,this._client.options.userEmail=this._multiUserEmail,this._client.options.userPassword=this._multiUserPassword,this._client.options.backendUrl=this.backendUrl;let r=yield this._client.connectMultiUser();this._multiUserEmail="",this._multiUserPassword="",this._isOpen=!1,this.changeUIState("connected")}catch(r){this._multiUserError=r.message||"Failed to log in. Please check your credentials."}finally{this._multiUserLoading=!1}})}changeMultiUserEmail(r){this._multiUserEmail=r,this._multiUserError=null}changeMultiUserPassword(r){this._multiUserPassword=r,this._multiUserError=null}setMultiUserTab(r){this._multiUserTab=r,this._multiUserError=null}detectLocal(){return X(this,null,function*(){try{yield dn(`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 X(this,null,function*(){console.log("[Ad4m Connect] Verifying AD4M API at URL:",r);let n=this._client.buildTempClient(r);try{yield n.runtime.info(),console.log("[Ad4m Connect] AD4M API verified")}catch(i){throw console.error("[Ad4m Connect] Failed to verify AD4M API:",i),new Error("Server is reachable but doesn't appear to be an AD4M executor. Make sure the URL includes '/graphql'.")}})}detectRemoteMultiUser(r){return X(this,null,function*(){console.log("[Ad4m Connect] Detecting multi-user mode for URL:",r);let n=this._client.buildTempClient(r);try{let i=yield n.runtime.multiUserEnabled();return console.log("[Ad4m Connect] Multi-user detection result:",i),i}catch(i){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",i),console.error("[Ad4m Connect] Error details:",i.message,i.stack),!1}})}handleConnectLocal(){return X(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 X(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 dn(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 X(this,null,function*(){this.backendUrl=this._remoteUrl,this.changeUIState("multiuser_auth")})}handleRemoteRequestCapability(){return X(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 X(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,n=!0){return X(this,null,function*(){yield this._client.ad4mClient.agent.unlock(r,n)})}verifyCode(r){return X(this,null,function*(){try{yield this._client.verifyCode(r)}catch(n){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 n=new CustomEvent("authstatechange",{detail:r});r==="locked"&&(this._isOpen=!0),r==="authenticated"&&(this._isOpen=!1),this.dispatchEvent(n),this.requestUpdate()}handleConfigChange(r,n){this[r]=n,n?Ec("ad4m"+r,n):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 n=new CustomEvent("connectionstatechange",{detail:r});this.dispatchEvent(n),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 X(this,null,function*(){try{window.BarcodeDetector.getSupportedFormats()}catch(n){window.BarcodeDetector=Dr}yield this.changeUIState("qr"),setTimeout(()=>X(this,null,function*(){let n=this.shadowRoot.querySelector("video");if(!n)return;let i=yield navigator.mediaDevices.getUserMedia({audio:!1,video:{facingMode:"environment"}});n.srcObject=i,n.autoplay=!0}),100)})}connect(){return X(this,null,function*(){this._isOpen=!0,this.requestUpdate();let r=yield this._client.connect();try{let n=yield r.agent.status();n.isUnlocked&&n.isInitialized&&window.location.reload()}catch(n){console.warn(n)}return r})}getAd4mClient(){return this._client.ad4mClient}connectRemote(r){return X(this,null,function*(){try{this.changeUrl(r);let n=yield this._client.connect(r),i=yield n.agent.status();return i.isUnlocked&&i.isInitialized||this.changeUIState("requestcap"),n}catch(n){this.changeUIState("requestcap"),this._isOpen=!0}})}requestCapability(r){return X(this,null,function*(){try{yield this._client.requestCapability(r),this.changeUIState("verifycode")}catch(n){console.warn(n)}})}isAuthenticated(){return X(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 Sp({initialUrl:this._remoteUrl,detecting:this._remoteDetecting,multiUserDetected:this._remoteMultiUserDetected,error:this._remoteError,onBack:()=>this.changeUIState("connection_overview"),onUrlChange:this.handleRemoteUrlChange,onConnect:this.handleRemoteConnect,onMultiUserAuth:this.handleRemoteMultiUserAuth,onRequestCapability:this.handleRemoteRequestCapability});if(this.uiState==="multiuser_auth")return wp({email:this._multiUserEmail,password:this._multiUserPassword,error:this._multiUserError,isLoading:this._multiUserLoading,backendUrl:this.backendUrl,changeEmail:this.changeMultiUserEmail,changePassword:this.changeMultiUserPassword,onLogin:this.handleMultiUserLogin,onSignup:this.handleMultiUserSignup,activeTab:this._multiUserTab,setActiveTab:this.setMultiUserTab});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:F`
2275
2905
  <div class="wrapper">
2276
2906
  <div class="dialog">
2277
- ${pp()}
2907
+ ${yp()}
2278
2908
  <main class="dialog__content">${this.renderViews()}</main>
2279
2909
  ${this.mobileView()}
2280
2910
  </div>
2281
2911
  <div class="ad4mConnect__backdrop" />
2282
2912
  </div>
2283
- `}};he.styles=[$3],Ee([ot()],he.prototype,"_code",2),Ee([ot()],he.prototype,"_isMobile",2),Ee([ot()],he.prototype,"_hasClickedDownload",2),Ee([ot()],he.prototype,"_isRemote",2),Ee([ot()],he.prototype,"_client",2),Ee([ot()],he.prototype,"_isOpen",2),Ee([ot()],he.prototype,"_hostingStep",2),Ee([ot()],he.prototype,"_email",2),Ee([ot()],he.prototype,"_passowrd",2),Ee([ot()],he.prototype,"_passwordError",2),Ee([ot()],he.prototype,"_hostingNotRunningError",2),Ee([ot()],he.prototype,"_verifyCodeError",2),Ee([ot()],he.prototype,"_isHostingLoading",2),Ee([ot()],he.prototype,"uiState",2),Ee([Ct({type:String,reflect:!0})],he.prototype,"appName",2),Ee([Ct({type:String,reflect:!0})],he.prototype,"appDesc",2),Ee([Ct({type:String,reflect:!0})],he.prototype,"appDomain",2),Ee([Ct({type:String,reflect:!0})],he.prototype,"appIconPath",2),Ee([Ct({type:Boolean,reflect:!0})],he.prototype,"mobile",2),Ee([Ct({type:String,reflect:!0})],he.prototype,"capabilities",2),Ee([Ct({type:Boolean,reflect:!0})],he.prototype,"hosting",2),Ee([Ct({type:String})],he.prototype,"token",2),Ee([Ct({type:String,reflect:!0})],he.prototype,"port",2),Ee([Ct({type:String,reflect:!0})],he.prototype,"url",2),he=Ee([qp("ad4m-connect")],he);function L3(t){let e=new he;return Object.entries(t).forEach(([r,n])=>{e[r]=n}),document.body.appendChild(e),e}export{he as Ad4mConnectElement,L3 as default,N3 as getAd4mClient};
2913
+ `}};Z.styles=[q3],te([xe()],Z.prototype,"_code",2),te([xe()],Z.prototype,"_isMobile",2),te([xe()],Z.prototype,"_hasClickedDownload",2),te([xe()],Z.prototype,"_isRemote",2),te([xe()],Z.prototype,"_client",2),te([xe()],Z.prototype,"_isOpen",2),te([xe()],Z.prototype,"_hostingStep",2),te([xe()],Z.prototype,"_email",2),te([xe()],Z.prototype,"_passowrd",2),te([xe()],Z.prototype,"_passwordError",2),te([xe()],Z.prototype,"_hostingNotRunningError",2),te([xe()],Z.prototype,"_verifyCodeError",2),te([xe()],Z.prototype,"_isHostingLoading",2),te([xe()],Z.prototype,"_multiUserEmail",2),te([xe()],Z.prototype,"_multiUserPassword",2),te([xe()],Z.prototype,"_multiUserError",2),te([xe()],Z.prototype,"_multiUserLoading",2),te([xe()],Z.prototype,"_multiUserTab",2),te([xe()],Z.prototype,"_localDetected",2),te([xe()],Z.prototype,"_remoteUrl",2),te([xe()],Z.prototype,"_remoteMultiUserDetected",2),te([xe()],Z.prototype,"_remoteDetecting",2),te([xe()],Z.prototype,"_remoteError",2),te([xe()],Z.prototype,"uiState",2),te([st({type:String,reflect:!0})],Z.prototype,"appName",2),te([st({type:String,reflect:!0})],Z.prototype,"appDesc",2),te([st({type:String,reflect:!0})],Z.prototype,"appDomain",2),te([st({type:String,reflect:!0})],Z.prototype,"appIconPath",2),te([st({type:Boolean,reflect:!0})],Z.prototype,"mobile",2),te([st({type:String,reflect:!0})],Z.prototype,"capabilities",2),te([st({type:Boolean,reflect:!0})],Z.prototype,"hosting",2),te([st({type:String})],Z.prototype,"token",2),te([st({type:String,reflect:!0})],Z.prototype,"port",2),te([st({type:String,reflect:!0})],Z.prototype,"url",2),te([st({type:Boolean,reflect:!0})],Z.prototype,"multiUser",2),te([st({type:String,reflect:!0})],Z.prototype,"backendUrl",2),Z=te([Kp("ad4m-connect")],Z);function B3(t){let e=new Z;return Object.entries(t).forEach(([r,n])=>{e[r]=n}),document.body.appendChild(e),e}export{Z as Ad4mConnectElement,B3 as default,M3 as getAd4mClient};
2284
2914
  /*!
2285
2915
  * @undecaf/barcode-detector-polyfill v0.9.20
2286
2916
  * A WebAssembly polyfill for the Barcode Detection API