@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/components/ConnectionOverview.d.ts +13 -0
- package/dist/components/MultiUserAuth.d.ts +15 -0
- package/dist/components/RemoteConnection.d.ts +13 -0
- package/dist/core.d.ts +8 -1
- package/dist/core.js +263 -232
- package/dist/utils.js +1 -1
- package/dist/web.d.ts +26 -0
- package/dist/web.js +936 -306
- package/package.json +2 -2
package/dist/core.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
1
|
+
var We=(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())});var Bs=function(t,e){return Bs=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])},Bs(t,e)};function Ie(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Bs(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var E=function(){return E=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},E.apply(this,arguments)};function Vt(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 Rt(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 Lt(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 _r(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 Vs="Invariant Violation",fl=Object.setPrototypeOf,Oh=fl===void 0?function(t,e){return t.__proto__=e,t}:fl,z=function(t){Ie(e,t);function e(r){r===void 0&&(r=Vs);var n=t.call(this,typeof r=="number"?Vs+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=Vs,Oh(n,e.prototype),n}return e}(Error);function L(t,e){if(!t)throw new z(e)}var Ja=["debug","log","warn","error","silent"],Qs=Ja.indexOf("log");function Ha(t){return function(){if(Ja.indexOf(t)>=Qs){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Ha("debug"),t.log=Ha("log"),t.warn=Ha("warn"),t.error=Ha("error")})(L||(L={}));function pl(t){var e=Ja[Qs];return Qs=Math.max(0,Ja.indexOf(t)),e}function je(t){try{return t()}catch{}}var Ya=je(function(){return globalThis})||je(function(){return window})||je(function(){return self})||je(function(){return global})||je(function(){return je.constructor("return this")()});var dl="__",hl=[dl,dl].join("DEV");function Ah(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Ya,hl,{value:je(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Ya[hl]}}var Zr=Ah();function Sr(t){try{return t()}catch{}}var zs=Sr(function(){return globalThis})||Sr(function(){return window})||Sr(function(){return self})||Sr(function(){return global})||Sr(function(){return Sr.constructor("return this")()}),Ws=!1;function Dh(){zs&&!Sr(function(){return"production"})&&!Sr(function(){return process})&&(Object.defineProperty(zs,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Ws=!0)}Dh();function Gs(){Ws&&(delete zs.process,Ws=!1)}var tS=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",rS=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",ml=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var De=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 Ks(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Nh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Ni=Nh;function Za(t){var e=t.prototype.toJSON;typeof e=="function"||Ks(0),t.prototype.inspect=e,Ni&&(t.prototype[Ni]=e)}var yl=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}();Za(yl);var gl=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}();Za(gl);function Hs(t){return t!=null&&typeof t.kind=="string"}function Xa(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Xa=function(r){return typeof r}:Xa=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Xa(t)}var Ch=10,vl=2;function Ci(t){return eo(t,[])}function eo(t,e){switch(Xa(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Ph(t,e);default:return String(t)}}function Ph(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Fh(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:eo(i,r)}else if(Array.isArray(t))return Lh(t,r);return Rh(t,r)}function Rh(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>vl)return"["+$h(t)+"]";var n=r.map(function(i){var a=eo(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Lh(t,e){if(t.length===0)return"[]";if(e.length>vl)return"[Array]";for(var r=Math.min(Ch,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(eo(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Fh(t){var e=t[String(Ni)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function $h(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 Pi(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function bl(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 Mh(t,e,r){return e&&bl(t.prototype,e),r&&bl(t,r),t}var to=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"||Pi(0,"Body must be a string. Received: ".concat(Ci(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Pi(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Pi(0,"column in locationOffset is 1-indexed and must be positive.")}return Mh(t,[{key:ml,get:function(){return"Source"}}]),t}();function _l(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(`
|
|
2
2
|
`)===-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+=`
|
|
3
3
|
`+e),u+=e?t.replace(/\n/g,`
|
|
4
4
|
`+e):t,s&&(u+=`
|
|
5
|
-
`),'"""'+u.replace(/"""/g,'\\"""')+'"""'}var
|
|
5
|
+
`),'"""'+u.replace(/"""/g,'\\"""')+'"""'}var jh={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"]},Xr=Object.freeze({});function Ye(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:jh,n=void 0,i=Array.isArray(t),a=[t],o=-1,s=[],u=void 0,c=void 0,l=void 0,d=[],p=[],f=t;do{o++;var h=o===a.length,y=h&&s.length!==0;if(h){if(c=p.length===0?void 0:d[d.length-1],u=l,l=p.pop(),y){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 g=0,D=0;D<s.length;D++){var N=s[D][0],T=s[D][1];i&&(N-=g),i&&T===null?(u.splice(N,1),g++):u[N]=T}}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]:f,u==null)continue;l&&d.push(c)}var C=void 0;if(!Array.isArray(u)){if(!Hs(u))throw new Error("Invalid AST Node: ".concat(Ci(u),"."));var F=Js(e,u.kind,h);if(F){if(C=F.call(e,u,c,l,d,p),C===Xr)break;if(C===!1){if(!h){d.pop();continue}}else if(C!==void 0&&(s.push([c,C]),!h))if(Hs(C))u=C;else{d.pop();continue}}}if(C===void 0&&y&&s.push([c,u]),h)d.pop();else{var R;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(u),a=i?u:(R=r[u.kind])!==null&&R!==void 0?R:[],o=-1,s=[],l&&p.push(l),l=u}}while(n!==void 0);return s.length!==0&&(f=s[s.length-1][1]),f}function Js(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 Qn(t){return Ye(t,{leave:qh})}var Uh=80,qh={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return $(e.definitions,`
|
|
6
6
|
|
|
7
7
|
`)+`
|
|
8
|
-
`},OperationDefinition:function(e){var r=e.operation,n=e.name,i=we("(",$(e.variableDefinitions,", "),")"),a=$(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&r==="query"?o:$([r,$([n,i]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return r+": "+n+we(" = ",i)+we(" ",$(a," "))},SelectionSet:function(e){var r=e.selections;return
|
|
9
|
-
`,
|
|
8
|
+
`},OperationDefinition:function(e){var r=e.operation,n=e.name,i=we("(",$(e.variableDefinitions,", "),")"),a=$(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&r==="query"?o:$([r,$([n,i]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return r+": "+n+we(" = ",i)+we(" ",$(a," "))},SelectionSet:function(e){var r=e.selections;return $t(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=we("",r,": ")+n,u=s+we("(",$(i,", "),")");return u.length>Uh&&(u=s+we(`(
|
|
9
|
+
`,ro($(i,`
|
|
10
10
|
`)),`
|
|
11
|
-
)`)),$([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+we(" ",$(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return $(["...",we("on ",r),$(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(we("(",$(i,", "),")")," ")+"on ".concat(n," ").concat(we("",$(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?
|
|
12
|
-
`,
|
|
11
|
+
)`)),$([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+we(" ",$(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return $(["...",we("on ",r),$(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(we("(",$(i,", "),")")," ")+"on ".concat(n," ").concat(we("",$(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?_l(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"["+$(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+$(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+we("(",$(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:Ft(function(t){var e=t.directives,r=t.operationTypes;return $(["schema",$(e," "),$t(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:Ft(function(t){var e=t.name,r=t.directives;return $(["scalar",e,$(r," ")]," ")}),ObjectTypeDefinition:Ft(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return $(["type",e,we("implements ",$(r," & ")),$(n," "),$t(i)]," ")}),FieldDefinition:Ft(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(Sl(r)?we(`(
|
|
12
|
+
`,ro($(r,`
|
|
13
13
|
`)),`
|
|
14
|
-
)`):we("(",$(r,", "),")"))+": "+n+we(" ",$(i," "))}),InputValueDefinition:
|
|
15
|
-
`,
|
|
14
|
+
)`):we("(",$(r,", "),")"))+": "+n+we(" ",$(i," "))}),InputValueDefinition:Ft(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return $([e+": "+r,we("= ",n),$(i," ")]," ")}),InterfaceTypeDefinition:Ft(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return $(["interface",e,we("implements ",$(r," & ")),$(n," "),$t(i)]," ")}),UnionTypeDefinition:Ft(function(t){var e=t.name,r=t.directives,n=t.types;return $(["union",e,$(r," "),n&&n.length!==0?"= "+$(n," | "):""]," ")}),EnumTypeDefinition:Ft(function(t){var e=t.name,r=t.directives,n=t.values;return $(["enum",e,$(r," "),$t(n)]," ")}),EnumValueDefinition:Ft(function(t){var e=t.name,r=t.directives;return $([e,$(r," ")]," ")}),InputObjectTypeDefinition:Ft(function(t){var e=t.name,r=t.directives,n=t.fields;return $(["input",e,$(r," "),$t(n)]," ")}),DirectiveDefinition:Ft(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(Sl(r)?we(`(
|
|
15
|
+
`,ro($(r,`
|
|
16
16
|
`)),`
|
|
17
|
-
)`):we("(",$(r,", "),")"))+(n?" repeatable":"")+" on "+$(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return $(["extend schema",$(r," ")
|
|
18
|
-
`)}}function $(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
|
|
19
|
-
`,
|
|
17
|
+
)`):we("(",$(r,", "),")"))+(n?" repeatable":"")+" on "+$(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return $(["extend schema",$(r," "),$t(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return $(["extend scalar",r,$(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend type",r,we("implements ",$(n," & ")),$(i," "),$t(a)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend interface",r,we("implements ",$(n," & ")),$(i," "),$t(a)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return $(["extend union",r,$(n," "),i&&i.length!==0?"= "+$(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return $(["extend enum",r,$(n," "),$t(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return $(["extend input",r,$(n," "),$t(i)]," ")}};function Ft(t){return function(e){return $([e.description,t(e)],`
|
|
18
|
+
`)}}function $(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 $t(t){return we(`{
|
|
19
|
+
`,ro($(t,`
|
|
20
20
|
`)),`
|
|
21
|
-
}`)}function we(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function
|
|
22
|
-
`))}function
|
|
23
|
-
`)!==-1}function yl(t){return t!=null&&t.some(jh)}function Ci(t){return t.kind===De.FIELD||t.kind===De.FRAGMENT_SPREAD||t.kind===De.INLINE_FRAGMENT}function gl(){return typeof Ha=="function"?Vs():Vs()}function Hh(){__DEV__?R(typeof Yr=="boolean",Yr):R(typeof Yr=="boolean",39)}gl();Hh();function or(t,e){var r=t.directives;return!r||!r.length?!0:vl(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 Vn(t,e,r){var n=new Set(t),i=n.size;return Je(e,{Directive:function(a){if(n.delete(a.name.value)&&(!r||!n.size))return Zr}}),r?!n.size:n.size<i}function Gs(t){return t&&Vn(["client","export"],t,!0)}function Jh(t){var e=t.name.value;return e==="skip"||e==="include"}function vl(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!Jh(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 Ks(t,e){var r=e,n=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new Q("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 Q(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:_r([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return i}function Xr(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function en(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 ie(t){return t!==null&&typeof t=="object"}function Qt(t){return{__ref:String(t)}}function X(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function Hs(t){return ie(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function Yh(t){return t.kind==="StringValue"}function Zh(t){return t.kind==="BooleanValue"}function Xh(t){return t.kind==="IntValue"}function em(t){return t.kind==="FloatValue"}function tm(t){return t.kind==="Variable"}function rm(t){return t.kind==="ObjectValue"}function nm(t){return t.kind==="ListValue"}function im(t){return t.kind==="EnumValue"}function am(t){return t.kind==="NullValue"}function wr(t,e,r,n){if(Xh(r)||em(r))t[e.value]=Number(r.value);else if(Zh(r)||Yh(r))t[e.value]=r.value;else if(rm(r)){var i={};r.fields.map(function(o){return wr(i,o.name,o.value,n)}),t[e.value]=i}else if(tm(r)){var a=(n||{})[r.name.value];t[e.value]=a}else if(nm(r))t[e.value]=r.values.map(function(o){var s={};return wr(s,e,o,n),s[e.value]});else if(im(r))t[e.value]=r.value;else if(am(r))t[e.value]=null;else throw __DEV__?new Q('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 Q(55)}function Js(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 wr(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 wr(n,a,o,e)})),Li(t.name.value,n,r)}var om=["connection","include","skip","client","rest","export"],Li=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(Ri(i),")")}else return r.connection.key;var a=t;if(e){var o=Ri(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){om.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(Ri(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=Ri;return Ri=t,e}}),Ri=function(e){return JSON.stringify(e,sm)};function sm(t,e){return ie(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,n){return r[n]=e[n],r},{})),e}function sr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var i=n.name,a=n.value;return wr(r,i,a,e)}),r}return null}function xt(t){return t.alias?t.alias.value:t.name.value}function Fi(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(yt(a)){if(a.name.value==="__typename")return t[xt(a)]}else{var o=Fi(t,en(a,r).selectionSet,r);if(typeof o=="string")return o}}}function yt(t){return t.kind==="Field"}function Ys(t){return t.kind==="InlineFragment"}function Qn(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 Q('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new Q(48);return r});return __DEV__?R(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):R(e.length<=1,49),t}function zt(t){return Qn(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function zn(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function tn(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function $i(t){var e=zt(t);return __DEV__?R(e&&e.operation==="query","Must contain a query definition."):R(e&&e.operation==="query",50),e}function Zs(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 rn(t){Qn(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 Q("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new Q(54)}function nn(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&wr(e,n.variable.name,n.defaultValue)}),e}var fe=Array.isArray;function Ce(t){return Array.isArray(t)&&t.length>0}var bl={kind:De.FIELD,name:{kind:De.NAME,value:"__typename"}};function Sl(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===De.FRAGMENT_SPREAD&&Sl(e[r.name.value],e)})}function cm(t){return Sl(zt(t)||Zs(t),Xr(tn(t)))?null:t}function um(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 _l(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 Xs(t,e){for(var r=_l(""),n=_l(""),i=function(_){for(var S=0,g=void 0;S<_.length&&(g=_[S]);++S)if(!fe(g)){if(g.kind===De.OPERATION_DEFINITION)return r(g.name&&g.name.value);if(g.kind===De.FRAGMENT_DEFINITION)return n(g.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===De.OPERATION_DEFINITION&&++a;var s=um(t),u=t.some(function(_){return _.remove}),c=function(_){return u&&_&&_.some(s)},l=new Map,d=!1,p={enter:function(_){if(c(_.directives))return d=!0,null}},f=Je(e,{Field:p,InlineFragment:p,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,S,g,D,N){var T=i(N);T&&T.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,S,g,D,N){if(c(_.directives))return d=!0,null;var T=i(N);T&&T.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,S,g,D){l.set(JSON.stringify(D),_)},leave:function(_,S,g,D){var N=l.get(JSON.stringify(D));if(_===N)return _;if(a>0&&_.selectionSet.selections.every(function(T){return T.kind===De.FIELD&&T.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(g){_.transitiveVars.add(g)})})),_},y=new Set;f.definitions.forEach(function(_){_.kind===De.OPERATION_DEFINITION?h(r(_.name&&_.name.value)).fragmentSpreads.forEach(function(S){y.add(S)}):_.kind===De.FRAGMENT_DEFINITION&&a===0&&!n(_.name.value).removed&&y.add(_.name.value)}),y.forEach(function(_){h(n(_)).fragmentSpreads.forEach(function(S){y.add(S)})});var v=function(_){return!!(!y.has(_)||n(_).removed)},b={enter:function(_){if(v(_.name.value))return null}};return cm(Je(f,{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(g){return S.has(g.variable.name.value)})})}}}}))}var an=Object.assign(function(t){return Je(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind===De.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return yt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(yt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return w(w({},e),{selections:_r(_r([],i,!0),[bl],!1)})}}}}}})},{added:function(t){return t===bl}}),lm={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 ec(t){return Xs([lm],Qn(t))}function tc(t){var e=rn(t),r=e.operation;if(r==="query")return t;var n=Je(t,{OperationDefinition:{enter:function(i){return w(w({},i),{operation:"query"})}}});return n}function rc(t){Qn(t);var e=Xs([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}var fm=Object.prototype.hasOwnProperty;function nc(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Mi(t)}function Mi(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new st,i=1;i<r;++i)e=n.merge(e,t[i]);return e}var pm=function(t,e,r){return this.merge(t[r],e[r])},st=function(){function t(e){e===void 0&&(e=pm),this.reconciler=e,this.isObject=ie,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 ie(r)&&ie(e)?(Object.keys(r).forEach(function(o){if(fm.call(e,o)){var s=e[o];if(r[o]!==s){var u=n.reconciler.apply(n,_r([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 ie(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 dm(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=hm(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.
|
|
24
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function hm(t,e){if(!!t){if(typeof t=="string")return wl(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 wl(t,e)}}function wl(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 El(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 sc(t,e,r){return e&&El(t.prototype,e),r&&El(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var cc=function(){return typeof Symbol=="function"},uc=function(t){return cc()&&Boolean(Symbol[t])},lc=function(t){return uc(t)?Symbol[t]:"@@"+t};cc()&&!uc("observable")&&(Symbol.observable=Symbol("observable"));var mm=lc("iterator"),ac=lc("observable"),xl=lc("species");function Za(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function ji(t){var e=t.constructor;return e!==void 0&&(e=e[xl],e===null&&(e=void 0)),e!==void 0?e:Y}function ym(t){return t instanceof Y}function Wn(t){Wn.log?Wn.log(t):setTimeout(function(){throw t})}function Ya(t){Promise.resolve().then(function(){try{t()}catch(e){Wn(e)}})}function Il(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=Za(e,"unsubscribe");r&&r.call(e)}}catch(n){Wn(n)}}function oc(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function gm(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(Tl(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function Tl(t,e,r){t._state="running";var n=t._observer;try{var i=Za(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(oc(t),i)i.call(n,r);else throw r;break;case"complete":oc(t),i&&i.call(n);break}}catch(a){Wn(a)}t._state==="closed"?Il(t):t._state==="running"&&(t._state="ready")}function ic(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}],Ya(function(){return gm(t)});return}Tl(t,e,r)}}var vm=function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new bm(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"&&(oc(this),Il(this))},sc(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),bm=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){ic(this._subscription,"next",n)},e.error=function(n){ic(this._subscription,"error",n)},e.complete=function(){ic(this._subscription,"complete")},sc(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),Y=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 vm(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=ji(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=ji(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=ji(this),o=arguments.length>1,s=!1,u=arguments[1],c=u;return new a(function(l){return i.subscribe({next:function(d){var p=!s;if(s=!0,!p||o)try{c=n(c,d)}catch(f){return l.error(f)}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=ji(this);return new s(function(u){var c,l=0;function d(p){c=p.subscribe({next:function(f){u.next(f)},error:function(f){u.error(f)},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=ji(this);return new a(function(o){var s=[],u=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(p){return o.error(p)}var d=a.from(l).subscribe({next:function(p){o.next(p)},error:function(p){o.error(p)},complete:function(){var p=s.indexOf(d);p>=0&&s.splice(p,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[ac]=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=Za(n,ac);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return ym(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(uc("iterator")&&(a=Za(n,mm),a))return new i(function(s){Ya(function(){if(!s.closed){for(var u=dm(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){Ya(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){Ya(function(){if(!s.closed){for(var u=0;u<i.length;++u)if(s.next(i[u]),s.closed)return;s.complete()}})})},sc(t,null,[{key:xl,get:function(){return this}}]),t}();cc()&&Object.defineProperty(Y,Symbol("extensions"),{value:{symbol:ac,hostReportError:Wn},configurable:!0});function fc(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 Gn;typeof self<"u"?Gn=self:typeof window<"u"?Gn=window:typeof global<"u"?Gn=global:typeof module<"u"?Gn=module:Gn=Function("return this")();var T0=fc(Gn);var kl=Y.prototype,Ol="@@observable";kl[Ol]||(kl[Ol]=function(){return this});var _m=Object.prototype.toString;function Xa(t){return pc(t)}function pc(t,e){switch(_m.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]=pc(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]=pc(t[i],e)}),n}default:return t}}function Sm(t){var e=new Set([t]);return e.forEach(function(r){ie(r)&&wm(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){ie(r[n])&&e.add(r[n])})}),t}function wm(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function Ui(t){return __DEV__&&Sm(t),t}function on(t,e,r){var n=[];t.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](r)})}function eo(t,e,r){return new Y(function(n){var i=n.next,a=n.error,o=n.complete,s=0,u=!1,c={then:function(f){return new Promise(function(h){return h(f())})}};function l(f,h){return f?function(y){++s;var v=function(){return f(y)};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(y){return h&&h.call(n,y)}}var d={next:l(e,i),error:l(r,a),complete:function(){u=!0,s||o&&o.call(n)}},p=t.subscribe(d);return function(){return p.unsubscribe()}})}var It=typeof WeakMap=="function"&&je(function(){return navigator.product})!=="ReactNative",Al=typeof WeakSet=="function",dc=typeof Symbol=="function"&&typeof Symbol.for=="function",Er=dc&&Symbol.asyncIterator,j0=typeof je(function(){return window.document.createElement})=="function",U0=je(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function to(t){function e(r){Object.defineProperty(t,r,{value:Y})}return dc&&Symbol.species&&e(Symbol.species),e("@@species"),t}function Dl(t){return t&&typeof t.then=="function"}var Kn=function(t){Ie(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),on(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),on(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?Dl(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"),on(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 Y(r)]),Dl(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}(Y);to(Kn);function xr(t){return"incremental"in t}function Em(t){return"hasNext"in t&&"data"in t}function Nl(t){return xr(t)||Em(t)}function ro(t,e){var r=t,n=new st;return xr(e)&&Ce(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 Hn(t){var e=no(t);return Ce(e)}function no(t){var e=Ce(t.errors)?t.errors.slice(0):[];return xr(t)&&Ce(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function Ir(){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 Pl=new Map;function qi(t){var e=Pl.get(t)||1;return Pl.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Cl(t){var e=qi("stringifyForDisplay");return JSON.stringify(t,function(r,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Bi(t,e){return Ir(t,e,e.variables&&{variables:w(w({},t&&t.variables),e.variables)})}function io(t){return new Y(function(e){e.error(t)})}var Vi=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 hc(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 Q("illegal argument: ".concat(i)):new Q(27)}return t}function mc(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 yc(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?zn(e.query)||void 0:""),e}function Rl(t,e){return e?e(t):Y.of()}function Qi(t){return typeof t=="function"?new Tt(t):t}function ao(t){return t.request.length<=1}var xm=function(t){Ie(e,t);function e(r,n){var i=t.call(this,r)||this;return i.link=n,i}return e}(Error),Tt=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return Y.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Qi).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var i=Qi(r),a=Qi(n||new t(Rl));return ao(i)&&ao(a)?new t(function(o){return e(o)?i.request(o)||Y.of():a.request(o)||Y.of()}):new t(function(o,s){return e(o)?i.request(o,s)||Y.of():a.request(o,s)||Y.of()})},t.execute=function(e,r){return e.request(mc(r.context,yc(hc(r))))||Y.of()},t.concat=function(e,r){var n=Qi(e);if(ao(n))return __DEV__&&R.warn(new xm("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Qi(r);return ao(i)?new t(function(a){return n.request(a,function(o){return i.request(o)||Y.of()})||Y.of()}):new t(function(a,o){return n.request(a,function(s){return i.request(s,o)||Y.of()})||Y.of()})},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(Rl)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new Q("request is not implemented"):new Q(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 Jn=Tt.execute;var Ll="3.7.10";function Fl(t){return!!t.body}function $l(t){return!!t.getReader}function Ml(t){return!!(Er&&t[Symbol.asyncIterator])}function jl(t){return!!t.stream}function Ul(t){return!!t.arrayBuffer}function ql(t){return!!t.pipe}function gc(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function vc(t){var e=null,r=null,n=!1,i=[],a=[];function o(d){if(!r){if(a.length){var p=a.shift();if(Array.isArray(p)&&p[0])return p[0]({value:d,done:!1})}i.push(d)}}function s(d){r=d;var p=a.slice();p.forEach(function(f){f[1](d)}),!e||e()}function u(){n=!0;var d=a.slice();d.forEach(function(p){p[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,p){if(r)return p(r);if(i.length)return d({value:i.shift(),done:!1});if(n)return d({value:void 0,done:!0});a.push([d,p])})}var l={next:function(){return c()}};return Er&&(l[Symbol.asyncIterator]=function(){return this}),l}function bc(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 Er&&(r[Symbol.asyncIterator]=function(){return this}),r}function oo(t){var e={next:function(){return t.read()}};return Er&&(e[Symbol.asyncIterator]=function(){return this}),e}function Bl(t){var e=t;if(Fl(t)&&(e=t.body),Ml(e))return gc(e);if($l(e))return oo(e.getReader());if(jl(e))return oo(e.stream().getReader());if(Ul(e))return bc(e.arrayBuffer());if(ql(e))return vc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Vl=Object.prototype.hasOwnProperty;function Ql(t,e){var r,n,i;return Ct(this,void 0,void 0,function(){var a,o,s,u,c,l,d,p,f,h,y,v,b,_,S,g,D,N,T,P;return Rt(this,function(F){switch(F.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(r=t.headers)===null||r===void 0?void 0:r.get("content-type"),s="boundary=",u=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",c="--".concat(u),l="",d=Bl(t),p=!0,F.label=1;case 1:return p?[4,d.next()]:[3,3];case 2:for(f=F.sent(),h=f.value,y=f.done,v=typeof h=="string"?h:a.decode(h),p=!y,l+=v,b=l.indexOf(c);b>-1;){if(_=void 0,P=[l.slice(0,b),l.slice(b+c.length)],_=P[0],l=P[1],_.trim()){if(S=_.indexOf(`\r
|
|
21
|
+
}`)}function we(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function ro(t){return we(" ",t.replace(/\n/g,`
|
|
22
|
+
`))}function Bh(t){return t.indexOf(`
|
|
23
|
+
`)!==-1}function Sl(t){return t!=null&&t.some(Bh)}function Ri(t){return t.kind===De.FIELD||t.kind===De.FRAGMENT_SPREAD||t.kind===De.INLINE_FRAGMENT}function wl(){return typeof to=="function"?Gs():Gs()}function Zh(){__DEV__?L(typeof Zr=="boolean",Zr):L(typeof Zr=="boolean",39)}wl();Zh();function or(t,e){var r=t.directives;return!r||!r.length?!0:El(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__?L(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):L(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function zn(t,e,r){var n=new Set(t),i=n.size;return Ye(e,{Directive:function(a){if(n.delete(a.name.value)&&(!r||!n.size))return Xr}}),r?!n.size:n.size<i}function Ys(t){return t&&zn(["client","export"],t,!0)}function Xh(t){var e=t.name.value;return e==="skip"||e==="include"}function El(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!Xh(r)){var n=r.arguments,i=r.name.value;__DEV__?L(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):L(n&&n.length===1,41);var a=n[0];__DEV__?L(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):L(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:r,ifArgument:a})}}),e}function Zs(t,e){var r=e,n=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new z("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new z(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof r>"u"&&(__DEV__?L(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):L(n.length===1,45),r=n[0].name.value);var i=E(E({},t),{definitions:_r([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return i}function en(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function tn(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__?L(n,"No fragment named ".concat(r)):L(n,46),n||null}default:return null}}function ie(t){return t!==null&&typeof t=="object"}function Qt(t){return{__ref:String(t)}}function ee(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function Xs(t){return ie(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function em(t){return t.kind==="StringValue"}function tm(t){return t.kind==="BooleanValue"}function rm(t){return t.kind==="IntValue"}function nm(t){return t.kind==="FloatValue"}function im(t){return t.kind==="Variable"}function am(t){return t.kind==="ObjectValue"}function om(t){return t.kind==="ListValue"}function sm(t){return t.kind==="EnumValue"}function cm(t){return t.kind==="NullValue"}function wr(t,e,r,n){if(rm(r)||nm(r))t[e.value]=Number(r.value);else if(tm(r)||em(r))t[e.value]=r.value;else if(am(r)){var i={};r.fields.map(function(o){return wr(i,o.name,o.value,n)}),t[e.value]=i}else if(im(r)){var a=(n||{})[r.name.value];t[e.value]=a}else if(om(r))t[e.value]=r.values.map(function(o){var s={};return wr(s,e,o,n),s[e.value]});else if(sm(r))t[e.value]=r.value;else if(cm(r))t[e.value]=null;else throw __DEV__?new z('The inline argument "'.concat(e.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new z(55)}function ec(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 wr(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 wr(n,a,o,e)})),Fi(t.name.value,n,r)}var um=["connection","include","skip","client","rest","export"],Fi=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(Li(i),")")}else return r.connection.key;var a=t;if(e){var o=Li(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){um.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(Li(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=Li;return Li=t,e}}),Li=function(e){return JSON.stringify(e,lm)};function lm(t,e){return ie(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,n){return r[n]=e[n],r},{})),e}function sr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var i=n.name,a=n.value;return wr(r,i,a,e)}),r}return null}function It(t){return t.alias?t.alias.value:t.name.value}function $i(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(yt(a)){if(a.name.value==="__typename")return t[It(a)]}else{var o=$i(t,tn(a,r).selectionSet,r);if(typeof o=="string")return o}}}function yt(t){return t.kind==="Field"}function tc(t){return t.kind==="InlineFragment"}function Wn(t){__DEV__?L(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'):L(t&&t.kind==="Document",47);var e=t.definitions.filter(function(r){return r.kind!=="FragmentDefinition"}).map(function(r){if(r.kind!=="OperationDefinition")throw __DEV__?new z('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new z(48);return r});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),t}function zt(t){return Wn(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Gn(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function rn(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Mi(t){var e=zt(t);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function rc(t){__DEV__?L(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'):L(t.kind==="Document",51),__DEV__?L(t.definitions.length<=1,"Fragment must have exactly one definition."):L(t.definitions.length<=1,52);var e=t.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function nn(t){Wn(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 z("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new z(54)}function an(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&wr(e,n.variable.name,n.defaultValue)}),e}var pe=Array.isArray;function Re(t){return Array.isArray(t)&&t.length>0}var xl={kind:De.FIELD,name:{kind:De.NAME,value:"__typename"}};function Tl(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===De.FRAGMENT_SPREAD&&Tl(e[r.name.value],e)})}function fm(t){return Tl(zt(t)||rc(t),en(rn(t)))?null:t}function pm(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 Il(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 nc(t,e){for(var r=Il(""),n=Il(""),i=function(_){for(var S=0,g=void 0;S<_.length&&(g=_[S]);++S)if(!pe(g)){if(g.kind===De.OPERATION_DEFINITION)return r(g.name&&g.name.value);if(g.kind===De.FRAGMENT_DEFINITION)return n(g.name.value)}return __DEV__&&L.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===De.OPERATION_DEFINITION&&++a;var s=pm(t),u=t.some(function(_){return _.remove}),c=function(_){return u&&_&&_.some(s)},l=new Map,d=!1,p={enter:function(_){if(c(_.directives))return d=!0,null}},f=Ye(e,{Field:p,InlineFragment:p,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,S,g,D,N){var T=i(N);T&&T.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,S,g,D,N){if(c(_.directives))return d=!0,null;var T=i(N);T&&T.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,S,g,D){l.set(JSON.stringify(D),_)},leave:function(_,S,g,D){var N=l.get(JSON.stringify(D));if(_===N)return _;if(a>0&&_.selectionSet.selections.every(function(T){return T.kind===De.FIELD&&T.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(g){_.transitiveVars.add(g)})})),_},y=new Set;f.definitions.forEach(function(_){_.kind===De.OPERATION_DEFINITION?h(r(_.name&&_.name.value)).fragmentSpreads.forEach(function(S){y.add(S)}):_.kind===De.FRAGMENT_DEFINITION&&a===0&&!n(_.name.value).removed&&y.add(_.name.value)}),y.forEach(function(_){h(n(_)).fragmentSpreads.forEach(function(S){y.add(S)})});var v=function(_){return!!(!y.has(_)||n(_).removed)},b={enter:function(_){if(v(_.name.value))return null}};return fm(Ye(f,{FragmentSpread:b,FragmentDefinition:b,OperationDefinition:{leave:function(_){if(_.variableDefinitions){var S=h(r(_.name&&_.name.value)).transitiveVars;if(S.size<_.variableDefinitions.length)return E(E({},_),{variableDefinitions:_.variableDefinitions.filter(function(g){return S.has(g.variable.name.value)})})}}}}))}var on=Object.assign(function(t){return Ye(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind===De.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return yt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(yt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return E(E({},e),{selections:_r(_r([],i,!0),[xl],!1)})}}}}}})},{added:function(t){return t===xl}}),dm={test:function(t){var e=t.name.value==="connection";return e&&(!t.arguments||!t.arguments.some(function(r){return r.name.value==="key"}))&&__DEV__&&L.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 ic(t){return nc([dm],Wn(t))}function ac(t){var e=nn(t),r=e.operation;if(r==="query")return t;var n=Ye(t,{OperationDefinition:{enter:function(i){return E(E({},i),{operation:"query"})}}});return n}function oc(t){Wn(t);var e=nc([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}var hm=Object.prototype.hasOwnProperty;function sc(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return ji(t)}function ji(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new st,i=1;i<r;++i)e=n.merge(e,t[i]);return e}var mm=function(t,e,r){return this.merge(t[r],e[r])},st=function(){function t(e){e===void 0&&(e=mm),this.reconciler=e,this.isObject=ie,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 ie(r)&&ie(e)?(Object.keys(r).forEach(function(o){if(hm.call(e,o)){var s=e[o];if(r[o]!==s){var u=n.reconciler.apply(n,_r([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 ie(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=E({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},t}();function ym(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=gm(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.
|
|
24
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function gm(t,e){if(!!t){if(typeof t=="string")return kl(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 kl(t,e)}}function kl(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 Ol(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 fc(t,e,r){return e&&Ol(t.prototype,e),r&&Ol(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var pc=function(){return typeof Symbol=="function"},dc=function(t){return pc()&&Boolean(Symbol[t])},hc=function(t){return dc(t)?Symbol[t]:"@@"+t};pc()&&!dc("observable")&&(Symbol.observable=Symbol("observable"));var vm=hc("iterator"),uc=hc("observable"),Al=hc("species");function io(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function Ui(t){var e=t.constructor;return e!==void 0&&(e=e[Al],e===null&&(e=void 0)),e!==void 0?e:X}function bm(t){return t instanceof X}function Kn(t){Kn.log?Kn.log(t):setTimeout(function(){throw t})}function no(t){Promise.resolve().then(function(){try{t()}catch(e){Kn(e)}})}function Dl(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=io(e,"unsubscribe");r&&r.call(e)}}catch(n){Kn(n)}}function lc(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function _m(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(Nl(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function Nl(t,e,r){t._state="running";var n=t._observer;try{var i=io(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(lc(t),i)i.call(n,r);else throw r;break;case"complete":lc(t),i&&i.call(n);break}}catch(a){Kn(a)}t._state==="closed"?Dl(t):t._state==="running"&&(t._state="ready")}function cc(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}],no(function(){return _m(t)});return}Nl(t,e,r)}}var Sm=function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new wm(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"&&(lc(this),Dl(this))},fc(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),wm=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){cc(this._subscription,"next",n)},e.error=function(n){cc(this._subscription,"error",n)},e.complete=function(){cc(this._subscription,"complete")},fc(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 Sm(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=Ui(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=Ui(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=Ui(this),o=arguments.length>1,s=!1,u=arguments[1],c=u;return new a(function(l){return i.subscribe({next:function(d){var p=!s;if(s=!0,!p||o)try{c=n(c,d)}catch(f){return l.error(f)}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=Ui(this);return new s(function(u){var c,l=0;function d(p){c=p.subscribe({next:function(f){u.next(f)},error:function(f){u.error(f)},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=Ui(this);return new a(function(o){var s=[],u=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(p){return o.error(p)}var d=a.from(l).subscribe({next:function(p){o.next(p)},error:function(p){o.error(p)},complete:function(){var p=s.indexOf(d);p>=0&&s.splice(p,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[uc]=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=io(n,uc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return bm(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(dc("iterator")&&(a=io(n,vm),a))return new i(function(s){no(function(){if(!s.closed){for(var u=ym(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){no(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){no(function(){if(!s.closed){for(var u=0;u<i.length;++u)if(s.next(i[u]),s.closed)return;s.complete()}})})},fc(t,null,[{key:Al,get:function(){return this}}]),t}();pc()&&Object.defineProperty(X,Symbol("extensions"),{value:{symbol:uc,hostReportError:Kn},configurable:!0});function mc(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 Hn;typeof self<"u"?Hn=self:typeof window<"u"?Hn=window:typeof global<"u"?Hn=global:typeof module<"u"?Hn=module:Hn=Function("return this")();var A0=mc(Hn);var Cl=X.prototype,Pl="@@observable";Cl[Pl]||(Cl[Pl]=function(){return this});var Em=Object.prototype.toString;function ao(t){return yc(t)}function yc(t,e){switch(Em.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]=yc(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]=yc(t[i],e)}),n}default:return t}}function xm(t){var e=new Set([t]);return e.forEach(function(r){ie(r)&&Im(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){ie(r[n])&&e.add(r[n])})}),t}function Im(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function qi(t){return __DEV__&&xm(t),t}function sn(t,e,r){var n=[];t.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](r)})}function oo(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(f){return new Promise(function(h){return h(f())})}};function l(f,h){return f?function(y){++s;var v=function(){return f(y)};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(y){return h&&h.call(n,y)}}var d={next:l(e,i),error:l(r,a),complete:function(){u=!0,s||o&&o.call(n)}},p=t.subscribe(d);return function(){return p.unsubscribe()}})}var Tt=typeof WeakMap=="function"&&je(function(){return navigator.product})!=="ReactNative",Rl=typeof WeakSet=="function",gc=typeof Symbol=="function"&&typeof Symbol.for=="function",Er=gc&&Symbol.asyncIterator,B0=typeof je(function(){return window.document.createElement})=="function",V0=je(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function so(t){function e(r){Object.defineProperty(t,r,{value:X})}return gc&&Symbol.species&&e(Symbol.species),e("@@species"),t}function Ll(t){return t&&typeof t.then=="function"}var Jn=function(t){Ie(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),sn(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),sn(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?Ll(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"),sn(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)]),Ll(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);so(Jn);function xr(t){return"incremental"in t}function Tm(t){return"hasNext"in t&&"data"in t}function Fl(t){return xr(t)||Tm(t)}function co(t,e){var r=t,n=new st;return xr(e)&&Re(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 Yn(t){var e=uo(t);return Re(e)}function uo(t){var e=Re(t.errors)?t.errors.slice(0):[];return xr(t)&&Re(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function Ir(){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 $l=new Map;function Bi(t){var e=$l.get(t)||1;return $l.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ml(t){var e=Bi("stringifyForDisplay");return JSON.stringify(t,function(r,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Vi(t,e){return Ir(t,e,e.variables&&{variables:E(E({},t&&t.variables),e.variables)})}function lo(t){return new X(function(e){e.error(t)})}var Qi=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 vc(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 z("illegal argument: ".concat(i)):new z(27)}return t}function bc(t,e){var r=E({},t),n=function(a){typeof a=="function"?r=E(E({},r),a(r)):r=E(E({},r),a)},i=function(){return E({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function _c(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?Gn(e.query)||void 0:""),e}function jl(t,e){return e?e(t):X.of()}function zi(t){return typeof t=="function"?new kt(t):t}function fo(t){return t.request.length<=1}var km=function(t){Ie(e,t);function e(r,n){var i=t.call(this,r)||this;return i.link=n,i}return e}(Error),kt=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(zi).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var i=zi(r),a=zi(n||new t(jl));return fo(i)&&fo(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(bc(r.context,_c(vc(r))))||X.of()},t.concat=function(e,r){var n=zi(e);if(fo(n))return __DEV__&&L.warn(new km("You are calling concat on a terminating link, which will have no effect",n)),n;var i=zi(r);return fo(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(jl)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new z("request is not implemented"):new z(22)},t.prototype.onError=function(e,r){if(r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}();var Zn=kt.execute;var Ul="3.7.10";function ql(t){return!!t.body}function Bl(t){return!!t.getReader}function Vl(t){return!!(Er&&t[Symbol.asyncIterator])}function Ql(t){return!!t.stream}function zl(t){return!!t.arrayBuffer}function Wl(t){return!!t.pipe}function Sc(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function wc(t){var e=null,r=null,n=!1,i=[],a=[];function o(d){if(!r){if(a.length){var p=a.shift();if(Array.isArray(p)&&p[0])return p[0]({value:d,done:!1})}i.push(d)}}function s(d){r=d;var p=a.slice();p.forEach(function(f){f[1](d)}),!e||e()}function u(){n=!0;var d=a.slice();d.forEach(function(p){p[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,p){if(r)return p(r);if(i.length)return d({value:i.shift(),done:!1});if(n)return d({value:void 0,done:!0});a.push([d,p])})}var l={next:function(){return c()}};return Er&&(l[Symbol.asyncIterator]=function(){return this}),l}function Ec(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 Er&&(r[Symbol.asyncIterator]=function(){return this}),r}function po(t){var e={next:function(){return t.read()}};return Er&&(e[Symbol.asyncIterator]=function(){return this}),e}function Gl(t){var e=t;if(ql(t)&&(e=t.body),Vl(e))return Sc(e);if(Bl(e))return po(e.getReader());if(Ql(e))return po(e.stream().getReader());if(zl(e))return Ec(e.arrayBuffer());if(Wl(e))return wc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Kl=Object.prototype.hasOwnProperty;function Hl(t,e){var r,n,i;return Rt(this,void 0,void 0,function(){var a,o,s,u,c,l,d,p,f,h,y,v,b,_,S,g,D,N,T,C;return Lt(this,function(F){switch(F.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(r=t.headers)===null||r===void 0?void 0:r.get("content-type"),s="boundary=",u=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",c="--".concat(u),l="",d=Gl(t),p=!0,F.label=1;case 1:return p?[4,d.next()]:[3,3];case 2:for(f=F.sent(),h=f.value,y=f.done,v=typeof h=="string"?h:a.decode(h),p=!y,l+=v,b=l.indexOf(c);b>-1;){if(_=void 0,C=[l.slice(0,b),l.slice(b+c.length)],_=C[0],l=C[1],_.trim()){if(S=_.indexOf(`\r
|
|
25
25
|
\r
|
|
26
|
-
`),g=
|
|
27
|
-
`,"")),(Object.keys(T).length>1||"data"in T||"incremental"in T||"errors"in T)&&((n=e.next)===null||n===void 0||n.call(e,T))}catch(
|
|
28
|
-
`).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
|
|
26
|
+
`),g=Om(_.slice(0,S)),D=g["content-type"],D&&D.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");N=_.slice(S);try{T=Jl(t,N.replace(`\r
|
|
27
|
+
`,"")),(Object.keys(T).length>1||"data"in T||"incremental"in T||"errors"in T)&&((n=e.next)===null||n===void 0||n.call(e,T))}catch(R){ho(R,e)}}b=l.indexOf(c)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function Om(t){var e={};return t.split(`
|
|
28
|
+
`).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 Jl(t,e){if(t.status>=300){var r=function(){try{return JSON.parse(e)}catch{return e}};Qi(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 ho(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 Yl(t,e,r){Am(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 ho(n,r)})}function Am(t){return function(e){return e.text().then(function(r){return Jl(e,r)}).then(function(r){return e.status>=300&&Qi(e,r,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(r)&&!Kl.call(r,"data")&&!Kl.call(r,"errors")&&Qi(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(n){return n.operationName}):t.operationName,"'.")),r})}}var Wi=function(t,e){var r;try{r=JSON.stringify(t)}catch(i){var n=__DEV__?new z("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new z(24);throw n.parseError=i,n}return r};var Dm={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Nm={accept:"*/*","content-type":"application/json"},Cm={method:"POST"},Zl={http:Dm,headers:Nm,options:Cm},Xl=function(t,e){return e(t)};function ef(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},a={};r.forEach(function(d){i=E(E(E({},i),d.options),{headers:E(E({},i.headers),d.headers)}),d.credentials&&(i.credentials=d.credentials),a=E(E({},a),d.http)}),i.headers&&(i.headers=Pm(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,Qn)),{options:i,body:l}}function Pm(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 tf=function(t){if(!t&&typeof fetch>"u")throw __DEV__?new z(`
|
|
29
29
|
"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:
|
|
30
30
|
|
|
31
31
|
import fetch from 'cross-fetch';
|
|
@@ -33,7 +33,7 @@ import { ApolloClient, HttpLink } from '@apollo/client';
|
|
|
33
33
|
const client = new ApolloClient({
|
|
34
34
|
link: new HttpLink({ uri: '/graphql', fetch })
|
|
35
35
|
});
|
|
36
|
-
`):new Q(23)};var Yl=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var t=new AbortController,e=t.signal;return{controller:t,signal:e}};var Zl=function(t,e){var r=t.getContext(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function Xl(t,e){var r=[],n=function(d,p){r.push("".concat(d,"=").concat(encodeURIComponent(p)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=zi(e.variables,"Variables map")}catch(d){return{parseError:d}}n("variables",i)}if(e.extensions){var a=void 0;try{a=zi(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 ef=je(function(){return fetch}),tf=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?Kl:i,o=t.includeExtensions,s=t.preserveHeaderCase,u=t.useGETForQueries,c=t.includeUnusedVariables,l=c===void 0?!1:c,d=Vt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&Jl(n||ef);var p={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Tt(function(f){var h=Zl(f,r),y=f.getContext(),v={};if(y.clientAwareness){var b=y.clientAwareness,_=b.name,S=b.version;_&&(v["apollographql-client-name"]=_),S&&(v["apollographql-client-version"]=S)}var g=w(w({},v),y.headers),D={http:y.http,options:y.fetchOptions,credentials:y.credentials,headers:g},N=Hl(f,a,Gl,p,D),T=N.options,P=N.body;if(P.variables&&!l){var F=new Set(Object.keys(P.variables));Je(f.query,{Variable:function(ne,qt,J){J&&J.kind!=="VariableDefinition"&&F.delete(ne.name.value)}}),F.size&&(P.variables=w({},P.variables),F.forEach(function(ne){delete P.variables[ne]}))}var C;if(!T.signal){var M=Yl(),Ve=M.controller,Pe=M.signal;C=Ve,C&&(T.signal=Pe)}var V=function(ne){return ne.kind==="OperationDefinition"&&ne.operation==="mutation"};if(u&&!f.query.definitions.some(V)&&(T.method="GET"),Vn(["defer"],f.query)&&(T.headers=T.headers||{},T.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),T.method==="GET"){var me=Xl(h,P),ye=me.newURI,re=me.parseError;if(re)return io(re);h=ye}else try{T.body=zi(P,"Payload")}catch(ne){return io(ne)}return new Y(function(ne){var qt=n||je(function(){return fetch})||ef;return qt(h,T).then(function(J){var Bt;f.setContext({response:J});var br=(Bt=J.headers)===null||Bt===void 0?void 0:Bt.get("content-type");return br!==null&&/^multipart\/mixed/i.test(br)?Ql(J,ne):Wl(J,f,ne)}).catch(function(J){return so(J,ne)}),function(){C&&C.abort()}})})};var _c=function(t){Ie(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,tf(r).request)||this;return n.options=r,n}return e}(Tt);var{toString:rf,hasOwnProperty:Nm}=Object.prototype,nf=Function.prototype.toString,Sc=new Map;function be(t,e){try{return wc(t,e)}finally{Sc.clear()}}function wc(t,e){if(t===e)return!0;let r=rf.call(t),n=rf.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(of(t,e))return!0;let i=af(t),a=af(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Nm.call(e,i[s]))return!1;for(let s=0;s<o;++s){let u=i[s];if(!wc(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(of(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&&!wc(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=nf.call(t);return i!==nf.call(e)?!1:!Rm(i,Cm)}}return!1}function af(t){return Object.keys(t).filter(Pm,t)}function Pm(t){return this[t]!==void 0}var Cm="{ [native code] }";function Rm(t,e){let r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function of(t,e){let r=Sc.get(t);if(r){if(r.has(e))return!0}else Sc.set(t,r=new Set);return r.add(e),!1}var Lm=function(){return Object.create(null)},sf=Array.prototype,Fm=sf.forEach,$m=sf.slice,Wt=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=Lm),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 Fm.call(e,function(n){return r=r.getChildTrie(n)}),r.data||(r.data=this.makeData($m.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&Mm(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 Mm(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var We=null,cf={},jm=1,Um=()=>class{constructor(){this.id=["slot",jm++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=We;e;e=e.parent)if(this.id in e.slots){let r=e.slots[this.id];if(r===cf)break;return e!==We&&(We.slots[this.id]=r),!0}return We&&(We.slots[this.id]=cf),!1}getValue(){if(this.hasValue())return We.slots[this.id]}withValue(e,r,n,i){let a={__proto__:null,[this.id]:e},o=We;We={parent:o,slots:a};try{return r.apply(i,n)}finally{We=o}}static bind(e){let r=We;return function(){let n=We;try{return We=r,e.apply(this,arguments)}finally{We=n}}}static noContext(e,r,n){if(We){let i=We;try{return We=null,e.apply(n,r)}finally{We=i}}else return e.apply(n,r)}};function uf(t){try{return t()}catch{}}var Ec="@wry/context:Slot",qm=uf(()=>globalThis)||uf(()=>global)||Object.create(null),lf=qm,Yn=lf[Ec]||Array[Ec]||function(t){try{Object.defineProperty(lf,Ec,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(Um());var{bind:Bm,noContext:Vm}=Yn;function Qm(){}var zm=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=Qm),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}(),uo=new Yn,xc,Wm=Object.prototype.hasOwnProperty,Tc=(xc=Array.from,xc===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:xc);function co(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var Wi=[],Gm=100;function Zn(t,e){if(!t)throw new Error(e||"assertion failure")}function Km(t,e){var r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function pf(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function Hm(t){return t.slice(0)}var Jm=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&&!Tr(this))return ff(this),this.value[0]},t.prototype.recompute=function(e){return Zn(!this.recomputing,"already recomputing"),ff(this),Tr(this)?Ym(this,e):pf(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,df(this),co(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),vf(this),kc(this,function(r,n){r.setDirty(),bf(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Wi.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Tc(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),Wi.push(this.deps),this.deps=null)},t.count=0,t}();function ff(t){var e=uo.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),Tr(t)?mf(e,t):yf(e,t),e}function Ym(t,e){return vf(t),uo.withValue(t,Zm,[t,e]),ey(t,e)&&Xm(t),pf(t.value)}function Zm(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 Tr(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function Xm(t){t.dirty=!1,!Tr(t)&&hf(t)}function df(t){kc(t,mf)}function hf(t){kc(t,yf)}function kc(t,e){var r=t.parents.size;if(r)for(var n=Tc(t.parents),i=0;i<r;++i)e(n[i],t)}function mf(t,e){Zn(t.childValues.has(e)),Zn(Tr(e));var r=!Tr(t);if(!t.dirtyChildren)t.dirtyChildren=Wi.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&df(t)}function yf(t,e){Zn(t.childValues.has(e)),Zn(!Tr(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,Hm(e.value)):Km(r,e.value)||t.setDirty(),gf(t,e),!Tr(t)&&hf(t)}function gf(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(Wi.length<Gm&&Wi.push(r),t.dirtyChildren=null))}function vf(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){bf(t,r)}),t.forgetDeps(),Zn(t.dirtyChildren===null)}function bf(t,e){e.parents.delete(t),t.childValues.delete(e),gf(t,e)}function ey(t,e){if(typeof t.subscribe=="function")try{co(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var ty={setDirty:!0,dispose:!0,forget:!0};function lo(t){var e=new Map,r=t&&t.subscribe;function n(i){var a=uo.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof r=="function"&&(co(o),o.unsubscribe=r(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var u=o&&Wm.call(ty,o)?o:"setDirty";Tc(s).forEach(function(c){return c[u]()}),e.delete(a),co(s)}},n}function _f(){var t=new Wt(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var SE=_f(),Ic=new Set;function sn(t,e){e===void 0&&(e=Object.create(null));var r=new zm(e.max||Math.pow(2,16),function(c){return c.dispose()}),n=e.keyArgs,i=e.makeCacheKey||_f(),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 Jm(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),Ic.add(r),uo.hasValue()||(Ic.forEach(function(p){return p.clean()}),Ic.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 Oc=function(){function t(){this.getFragmentDoc=sn(Ks)}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=Vt(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=Vt(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 Gi=function(t){Ie(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 Te=Object.prototype.hasOwnProperty;function Ki(t){return t==null}function po(t,e){var r=t.__typename,n=t.id,i=t._id;if(typeof r=="string"&&(e&&(e.keyObject=Ki(n)?Ki(i)?void 0:{_id:i}:{id:n}),Ki(n)&&!Ki(i)&&(n=i),!Ki(n)))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Sf={dataIdFromObject:po,addTypename:!0,resultCaching:!0,canonizeResults:!1};function wf(t){return Ir(Sf,t)}function ho(t){var e=t.canonizeResults;return e===void 0?Sf.canonizeResults:e}function Ef(t,e){return X(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var Ac=/^[_a-z][_0-9a-z]*/i;function $t(t){var e=t.match(Ac);return e?e[0]:t}function fo(t,e,r){return ie(e)?fe(e)?e.every(function(n){return fo(t,n,r)}):t.selections.every(function(n){if(yt(n)&&or(n,r)){var i=xt(n);return Te.call(e,i)&&(!n.selectionSet||fo(n.selectionSet,e[i],r))}return!0}):!1}function kr(t){return ie(t)&&!X(t)&&!fe(t)}function xf(){return new st}function mo(t,e){var r=Xr(tn(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),Dc=function(){return yo},If=Object.create(null),Xn=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 Ui(X(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return X(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return Qt(i);if(X(i))return i;var o=n.policies.identify(i)[0];if(o){var s=Qt(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),Te.call(this.data,e)){var n=this.data[e];if(n&&Te.call(n,r))return n[r]}if(r==="__typename"&&Te.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Or)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Te.call(this.data,e))return this.data[e];if(this instanceof Or)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;X(e)&&(e=e.__ref),X(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 st(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=$t(c);l!==c&&!n.policies.hasKeyArgs(s.__typename,l)&&(u[l]=1),s[c]===void 0&&!(n instanceof Or)&&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:If,isReference:X,toReference:this.toReference,canRead:this.canRead,readField:function(c,l){return n.policies.readField(typeof c=="string"?{fieldName:c,from:l||Qt(e)}:c,{store:n})}};if(Object.keys(i).forEach(function(c){var l=$t(c),d=i[c];if(d!==void 0){var p=typeof r=="function"?r:r[c]||r[l];if(p){var f=p===Dc?yo:p(Ui(d),w(w({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(e,c)}));f===If?n.group.dirty(e,c):(f===yo&&(f=void 0),f!==d&&(a[c]=f,o=!0,d=f))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Or?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]=Dc,i):Dc)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(Te.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Or&&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){Te.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&&Te.call(e,a)||r.delete(a)}),e){var n=e.__META,i=Vt(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 Or?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){Te.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 Or;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},t.prototype.findChildRefIds=function(e){if(!Te.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){X(a)&&(r[a.__ref]=!0),ie(a)&&Object.keys(a).forEach(function(o){var s=a[o];ie(s)&&i.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var Tf=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?lo():null,this.keyMaker=new Wt(It)},t.prototype.depend=function(e,r){if(this.d){this.d(Nc(e,r));var n=$t(r);n!==r&&this.d(Nc(e,n)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Nc(e,r),r==="__exists"?"forget":"setDirty")},t}();function Nc(t,e){return e+"#"+t}function Pc(t,e){cn(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){Ie(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 Tf(s))||this;return c.stump=new ry(c),c.storageTrie=new Wt(It),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})(Xn||(Xn={}));var Or=function(t){Ie(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){be(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 Te.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}(Xn),ry=function(t){Ie(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new Tf(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}(Or);function ny(t,e,r){var n=t[r],i=e[r];return be(n,i)?n:i}function cn(t){return!!(t instanceof Xn&&t.group.caching)}function iy(t){return ie(t)?fe(t)?t.slice(0):w({__proto__:Object.getPrototypeOf(t)},t):t}var go=function(){function t(){this.known=new(Al?WeakSet:Set),this.pool=new Wt(It),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return ie(e)&&this.known.has(e)},t.prototype.pass=function(e){if(ie(e)){var r=iy(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(ie(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(f){u.push(r.admit(e[f]))});var o=this.pool.lookupArray(u);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),c.sorted.forEach(function(f,h){d[f]=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 gt=Object.assign(function(t){if(ie(t)){Cc===void 0&&kf();var e=Cc.admit(t),r=Rc.get(e);return r===void 0&&Rc.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:kf}),Cc,Rc;function kf(){Cc=new go,Rc=new(It?WeakMap:Map)}function Of(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var Af=function(){function t(e){var r=this;this.knownResults=new(It?WeakMap:Map),this.config=Ir(e,{addTypename:e.addTypename!==!1,canonizeResults:ho(e)}),this.canon=e.canon||new go,this.executeSelectionSet=sn(function(n){var i,a=n.context.canonizeResults,o=Of(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:(Pc(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Of,makeCacheKey:function(n,i,a,o){if(cn(a.store))return a.store.makeCacheKey(n,X(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=sn(function(n){return Pc(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(cn(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new go},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({},nn($i(n))),o);var p=Qt(a),f=this.executeSelectionSet({selectionSet:rn(n).selectionSet,objectOrReference:p,enclosingRef:p,context:w({store:r,query:n,policies:d,variables:o,varString:gt(o),canonizeResults:l},mo(n,this.config.fragments))}),h;if(f.missing&&(h=[new Gi(ay(f.missing),f.missing,n,o)],!u))throw h[0];return{result:f.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,n,i){if(cn(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(X(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=[],p,f=new st;this.config.addTypename&&typeof l=="string"&&!u.rootIdsByTypename[l]&&d.push({__typename:l});function h(S,g){var D;return S.missing&&(p=f.merge(p,(D={},D[g]=S.missing,D))),S.result}var y=new Set(n.selections);y.forEach(function(S){var g,D;if(!!or(S,s))if(yt(S)){var N=u.readField({fieldName:S.name.value,field:S,variables:o.variables,from:i},o),T=xt(S);N===void 0?an.added(S)||(p=f.merge(p,(g={},g[T]="Can't find field '".concat(S.name.value,"' on ").concat(X(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),g))):fe(N)?N=h(r.executeSubSelectedArray({field:S,array:N,enclosingRef:a,context:o}),T):S.selectionSet?N!=null&&(N=h(r.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:N,enclosingRef:X(N)?N:a,context:o}),T)):o.canonizeResults&&(N=r.canon.pass(N)),N!==void 0&&d.push((D={},D[T]=N,D))}else{var P=en(S,o.lookupFragment);if(!P&&S.kind===De.FRAGMENT_SPREAD)throw __DEV__?new Q("No fragment named ".concat(S.name.value)):new Q(5);P&&u.fragmentMatches(P,l)&&P.selectionSet.selections.forEach(y.add,y)}});var v=Mi(d),b={result:v,missing:p},_=o.canonizeResults?this.canon.admit(b):Ui(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 st;function c(l,d){var p;return l.missing&&(s=u.merge(s,(p={},p[d]=l.missing,p))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,d){return l===null?null:fe(l)?c(r.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?c(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:X(l)?l:a,context:o}),d):(__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){ie(i)&&(__DEV__?R(!X(i),"Missing selection set for object of type ".concat(Ef(t,i)," returned for query field ").concat(e.name.value)):R(!X(i),6),Object.values(i).forEach(n.add,n))})}}var ei=new Yn,Df=new WeakMap;function Hi(t){var e=Df.get(t);return e||Df.set(t,e={vars:new Set,dep:lo()}),e}function Lc(t){Hi(t).vars.forEach(function(e){return e.forgetCache(t)})}function Nf(t){Hi(t).vars.forEach(function(e){return e.attachCache(t)})}function vo(t){var e=new Set,r=new Set,n=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(u){Hi(u).dep.dirty(n),sy(u)});var o=Array.from(r);r.clear(),o.forEach(function(u){return u(t)})}}else{var s=ei.getValue();s&&(i(s),Hi(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),Hi(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function sy(t){t.broadcastWatches&&t.broadcastWatches()}var Pf=Object.create(null);function Fc(t){var e=JSON.stringify(t);return Pf[e]||(Pf[e]=Object.create(null))}function $c(t){var e=Fc(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=jc(t,function(o){var s=ti(n.storeObject,o,i);return s===void 0&&r!==n.storeObject&&Te.call(r,o[0])&&(s=ti(r,o,Rf)),__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 Mc(t){var e=Fc(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var i=n.field,a=n.variables,o=n.fieldName,s=jc(t,function(c){var l=c[0],d=l.charAt(0);if(d==="@"){if(i&&Ce(i.directives)){var p=l.slice(1),f=i.directives.find(function(b){return b.name.value===p}),h=f&&sr(f,a);return h&&ti(h,c.slice(1))}return}if(d==="$"){var y=l.slice(1);if(a&&Te.call(a,y)){var v=c.slice(0);return v[0]=y,ti(a,v)}return}if(r)return ti(r,c)}),u=JSON.stringify(s);return(r||u!=="{}")&&(o+=":"+u),o})}function jc(t,e){var r=new st;return Cf(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 Cf(t){var e=Fc(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(i,a){fe(i)?(Cf(i).forEach(function(o){return r.push(n.concat(o))}),n.length=0):(n.push(i),fe(t[a+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function Rf(t,e){return t[e]}function ti(t,e,r){return r=r||Rf,Lf(e.reduce(function n(i,a){return fe(i)?i.map(function(o){return n(o,a)}):i&&r(i,a)},t))}function Lf(t){return ie(t)?fe(t)?t.map(Lf):jc(Object.keys(t).sort(),function(e){return ti(t,e)}):t}Li.setStringify(gt);function Uc(t){return t.args!==void 0?t.args:t.field?sr(t.field,t.variables):null}var cy=function(){},Ff=function(t,e){return e.fieldName},$f=function(t,e,r){var n=r.mergeObjects;return n(t,e)},Mf=function(t,e){return e},Uf=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:po},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 p=bo(arguments,o);return i.readField(p,{store:i.cache.data,variables:p.variables})}}),u,c=a&&this.getTypePolicy(a),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(fe(d))l=$c(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=Vt(i,["queryType","mutationType","subscriptionType"]);a&&r.setRootTypename("Query",n),o&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),Te.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?$f:c===!1?Mf:u.merge}s(i,r.merge),i.keyFn=a===!1?cy:fe(a)?$c(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,p=l.read,f=l.merge;c.keyFn=d===!1?Ff:fe(d)?Mc(d):typeof d=="function"?d:c.keyFn,typeof p=="function"&&(c.read=p),s(c,f)}c.read&&c.merge&&(c.keyFn=c.keyFn||Ff)})},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(Ac);(!a||a[0]!==i)&&r.fuzzySubtypes.set(i,new RegExp(i))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!Te.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=Vt(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 y=a.getSupertypeSet(h,!1);y&&y.size&&u.indexOf(y)<0&&u.push(y)},l=!!(n&&this.fuzzySubtypes.size),d=!1,p=0;p<u.length;++p){var f=u[p];if(f.has(o))return s.has(o)||(d&&__DEV__&&R.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;f.forEach(c),l&&p===u.length-1&&fo(e.selectionSet,n,i)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,y){var v=r.match(h);v&&v[0]===r&&c(y)}))}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=Uc(e);o;){var c=o(u,s);if(fe(c))o=Mc(c);else{a=c||n;break}}return a===void 0&&(a=e.field?Js(e.field,e.variables):Li(n,Uc(e))),a===!1?n:n===$t(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=$t(o),u=r.store.getFieldValue(n,o),c=this.getFieldPolicy(e.typename,s,!1),l=c&&c.read;if(l){var d=jf(this,n,e,r,r.store.getStorage(X(n)?n.__ref:n,o));return ei.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===$f?qf(i.store)(e,r):u===Mf?r:(i.overwrite&&(e=void 0),u(e,r,jf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},t}();function jf(t,e,r,n,i){var a=t.getStoreFieldName(r),o=$t(a),s=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:Uc(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:X,toReference:c,storage:i,cache:t.cache,canRead:l,readField:function(){return t.readField(bo(arguments,e,s),n)},mergeObjects:qf(n.store)}}function bo(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),Te.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&R.warn("Undefined 'from' passed to readField with arguments ".concat(Cl(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function qf(t){return function(r,n){if(fe(r)||fe(n))throw __DEV__?new Q("Cannot automatically merge arrays"):new Q(4);if(ie(r)&&ie(n)){var i=t.getFieldValue(r,"__typename"),a=t.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(X(r)&&kr(n))return t.merge(r.__ref,n),r;if(kr(r)&&X(n))return t.merge(r,n.__ref),n;if(kr(r)&&kr(n))return w(w({},r),n)}return n}}function qc(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 zf=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=zt(i),l=xf();s=w(w({},nn(c)),s);var d=w(w({store:e,written:Object.create(null),merge:function(f,h){return l.merge(f,h)},variables:s,varString:gt(s)},mo(i,this.fragments)),{overwrite:!!u,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),p=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:d});if(!X(p))throw __DEV__?new Q("Could not identify object ".concat(JSON.stringify(a))):new Q(7);return d.incomingById.forEach(function(f,h){var y=f.storeObject,v=f.mergeTree,b=f.fieldNodeSet,_=Qt(h);if(v&&v.map.size){var S=n.applyMerges(v,_,y,d);if(X(S))return;y=S}if(__DEV__&&!d.overwrite){var g=Object.create(null);b.forEach(function(T){T.selectionSet&&(g[T.name.value]=!0)});var D=function(T){return g[$t(T)]===!0},N=function(T){var P=v&&v.map.get(T);return Boolean(P&&P.info&&P.info.merge)};Object.keys(y).forEach(function(T){D(T)&&!N(T)&&uy(_,y,T,d.store)})}e.merge(h,y)}),e.retain(p.__ref),p},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]||Fi(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(c.__typename=l);var d=function(){var S=bo(arguments,c,o.variables);if(X(S.from)){var g=o.incomingById.get(S.from.__ref);if(g){var D=u.readField(w(w({},S),{from:g.storeObject}),o);if(D!==void 0)return D}}return u.readField(S,o)},p=new Set;this.flattenFields(a,i,o,l).forEach(function(S,g){var D,N=xt(g),T=i[N];if(p.add(g),T!==void 0){var P=u.getStoreFieldName({typename:l,fieldName:g.name.value,field:g,variables:S.variables}),F=Bf(s,P),C=r.processFieldValue(T,g,g.selectionSet?qc(S,!1,!1):S,F),M=void 0;g.selectionSet&&(X(C)||kr(C))&&(M=d("__typename",C));var Ve=u.getMergeFunction(l,g.name.value,M);Ve?F.info={field:g,typename:l,merge:Ve}:Vf(s,P),c=S.merge(c,(D={},D[P]=C,D))}else __DEV__&&!S.clientOnly&&!S.deferred&&!an.added(g)&&!u.getReadFunction(l,g.name.value)&&__DEV__&&R.error("Missing field '".concat(xt(g),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var f=u.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:c,readField:d}),h=f[0],y=f[1];n=n||h,y&&(c=o.merge(c,y))}catch(S){if(!n)throw S}if(typeof n=="string"){var v=Qt(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=Bc(_.mergeTree,s),p.forEach(function(S){return _.fieldNodeSet.add(S)})):o.incomingById.set(n,{storeObject:c,mergeTree:_o(s)?void 0:s,fieldNodeSet:p}),v}return c},t.prototype.processFieldValue=function(e,r,n,i){var a=this;return!r.selectionSet||e===null?__DEV__?Xa(e):e:fe(e)?e.map(function(o,s){var u=a.processFieldValue(o,r,n,Bf(i,s));return Vf(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=Fi(r,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Wt(!1);return function u(c,l){var d=s.lookup(c,l.clientOnly,l.deferred);d.visited||(d.visited=!0,c.selections.forEach(function(p){if(!!or(p,n.variables)){var f=l.clientOnly,h=l.deferred;if(!(f&&h)&&Ce(p.directives)&&p.directives.forEach(function(b){var _=b.name.value;if(_==="client"&&(f=!0),_==="defer"){var S=sr(b,n.variables);(!S||S.if!==!1)&&(h=!0)}}),yt(p)){var y=a.get(p);y&&(f=f&&y.clientOnly,h=h&&y.deferred),a.set(p,qc(n,f,h))}else{var v=en(p,n.lookupFragment);if(!v&&p.kind===De.FRAGMENT_SPREAD)throw __DEV__?new Q("No fragment named ".concat(p.name.value)):new Q(8);v&&o.fragmentMatches(v,i,r,n.variables)&&u(v.selectionSet,qc(n,f,h))}}}))}(e,n),a},t.prototype.applyMerges=function(e,r,n,i,a){var o,s=this;if(e.map.size&&!X(n)){var u=!fe(n)&&(X(r)||kr(r))?r:void 0,c=n;u&&!a&&(a=[X(u)?u.__ref:u]);var l,d=function(p,f){return fe(p)?typeof f=="number"?p[f]:void 0:i.store.getFieldValue(p,String(f))};e.map.forEach(function(p,f){var h=d(u,f),y=d(c,f);if(y!==void 0){a&&a.push(f);var v=s.applyMerges(p,h,y,i,a);v!==y&&(l=l||new Map,l.set(f,v)),a&&R(a.pop()===f)}}),l&&(n=fe(c)?c.slice(0):w({},c),l.forEach(function(p,f){n[f]=p}))}return e.info?this.cache.policies.runMergeFunction(r,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},t}();var Wf=[];function Bf(t,e){var r=t.map;return r.has(e)||r.set(e,Wf.pop()||{map:new Map}),r.get(e)}function Bc(t,e){if(t===e||!e||_o(e))return t;if(!t||_o(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,Bc(s,e.map.get(u))),o.delete(u)}),o.forEach(function(s){a.map.set(s,Bc(e.map.get(s),t.map.get(s)))})}return a}function _o(t){return!t||!(t.info||t.map.size)}function Vf(t,e){var r=t.map,n=r.get(e);n&&_o(n)&&(Wf.push(n),r.delete(e))}var Qf=new Set;function uy(t,e,r,n){var i=function(d){var p=n.getFieldValue(d,r);return typeof p=="object"&&p},a=i(t);if(!!a){var o=i(e);if(!!o&&!X(a)&&!be(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=$t(r),c="".concat(s,".").concat(u);if(!Qf.has(c)){Qf.add(c);var l=[];!fe(a)&&!fe(o)&&[a,o].forEach(function(d){var p=n.getFieldValue(d,"__typename");typeof p=="string"&&!l.includes(p)&&l.push(p)}),__DEV__&&R.warn("Cache data may be lost when replacing the ".concat(u," field of a ").concat(s,` object.
|
|
36
|
+
`):new z(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 nf=function(t,e){var r=t.getContext(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function af(t,e){var r=[],n=function(d,p){r.push("".concat(d,"=").concat(encodeURIComponent(p)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Wi(e.variables,"Variables map")}catch(d){return{parseError:d}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Wi(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 of=je(function(){return fetch}),sf=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?Xl:i,o=t.includeExtensions,s=t.preserveHeaderCase,u=t.useGETForQueries,c=t.includeUnusedVariables,l=c===void 0?!1:c,d=Vt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&tf(n||of);var p={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new kt(function(f){var h=nf(f,r),y=f.getContext(),v={};if(y.clientAwareness){var b=y.clientAwareness,_=b.name,S=b.version;_&&(v["apollographql-client-name"]=_),S&&(v["apollographql-client-version"]=S)}var g=E(E({},v),y.headers),D={http:y.http,options:y.fetchOptions,credentials:y.credentials,headers:g},N=ef(f,a,Zl,p,D),T=N.options,C=N.body;if(C.variables&&!l){var F=new Set(Object.keys(C.variables));Ye(f.query,{Variable:function(ne,qt,Z){Z&&Z.kind!=="VariableDefinition"&&F.delete(ne.name.value)}}),F.size&&(C.variables=E({},C.variables),F.forEach(function(ne){delete C.variables[ne]}))}var R;if(!T.signal){var M=rf(),Ve=M.controller,Pe=M.signal;R=Ve,R&&(T.signal=Pe)}var V=function(ne){return ne.kind==="OperationDefinition"&&ne.operation==="mutation"};if(u&&!f.query.definitions.some(V)&&(T.method="GET"),zn(["defer"],f.query)&&(T.headers=T.headers||{},T.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),T.method==="GET"){var me=af(h,C),ye=me.newURI,re=me.parseError;if(re)return lo(re);h=ye}else try{T.body=Wi(C,"Payload")}catch(ne){return lo(ne)}return new X(function(ne){var qt=n||je(function(){return fetch})||of;return qt(h,T).then(function(Z){var Bt;f.setContext({response:Z});var br=(Bt=Z.headers)===null||Bt===void 0?void 0:Bt.get("content-type");return br!==null&&/^multipart\/mixed/i.test(br)?Hl(Z,ne):Yl(Z,f,ne)}).catch(function(Z){return ho(Z,ne)}),function(){R&&R.abort()}})})};var xc=function(t){Ie(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,sf(r).request)||this;return n.options=r,n}return e}(kt);var{toString:cf,hasOwnProperty:Rm}=Object.prototype,uf=Function.prototype.toString,Ic=new Map;function be(t,e){try{return Tc(t,e)}finally{Ic.clear()}}function Tc(t,e){if(t===e)return!0;let r=cf.call(t),n=cf.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(ff(t,e))return!0;let i=lf(t),a=lf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Rm.call(e,i[s]))return!1;for(let s=0;s<o;++s){let u=i[s];if(!Tc(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(ff(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&&!Tc(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:!$m(i,Fm)}}return!1}function lf(t){return Object.keys(t).filter(Lm,t)}function Lm(t){return this[t]!==void 0}var Fm="{ [native code] }";function $m(t,e){let r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function ff(t,e){let r=Ic.get(t);if(r){if(r.has(e))return!0}else Ic.set(t,r=new Set);return r.add(e),!1}var Mm=function(){return Object.create(null)},pf=Array.prototype,jm=pf.forEach,Um=pf.slice,Wt=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=Mm),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 jm.call(e,function(n){return r=r.getChildTrie(n)}),r.data||(r.data=this.makeData(Um.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&qm(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 qm(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var Ge=null,df={},Bm=1,Vm=()=>class{constructor(){this.id=["slot",Bm++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ge;e;e=e.parent)if(this.id in e.slots){let r=e.slots[this.id];if(r===df)break;return e!==Ge&&(Ge.slots[this.id]=r),!0}return Ge&&(Ge.slots[this.id]=df),!1}getValue(){if(this.hasValue())return Ge.slots[this.id]}withValue(e,r,n,i){let a={__proto__:null,[this.id]:e},o=Ge;Ge={parent:o,slots:a};try{return r.apply(i,n)}finally{Ge=o}}static bind(e){let r=Ge;return function(){let n=Ge;try{return Ge=r,e.apply(this,arguments)}finally{Ge=n}}}static noContext(e,r,n){if(Ge){let i=Ge;try{return Ge=null,e.apply(n,r)}finally{Ge=i}}else return e.apply(n,r)}};function hf(t){try{return t()}catch{}}var kc="@wry/context:Slot",Qm=hf(()=>globalThis)||hf(()=>global)||Object.create(null),mf=Qm,Xn=mf[kc]||Array[kc]||function(t){try{Object.defineProperty(mf,kc,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(Vm());var{bind:zm,noContext:Wm}=Xn;function Gm(){}var Km=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=Gm),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 Xn,Oc,Hm=Object.prototype.hasOwnProperty,Dc=(Oc=Array.from,Oc===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:Oc);function mo(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var Gi=[],Jm=100;function ei(t,e){if(!t)throw new Error(e||"assertion failure")}function Ym(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 Zm(t){return t.slice(0)}var Xm=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&&!Tr(this))return yf(this),this.value[0]},t.prototype.recompute=function(e){return ei(!this.recomputing,"already recomputing"),yf(this),Tr(this)?ey(this,e):gf(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,vf(this),mo(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),Ef(this),Nc(this,function(r,n){r.setDirty(),xf(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Gi.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Dc(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),Gi.push(this.deps),this.deps=null)},t.count=0,t}();function yf(t){var e=yo.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),Tr(t)?_f(e,t):Sf(e,t),e}function ey(t,e){return Ef(t),yo.withValue(t,ty,[t,e]),ny(t,e)&&ry(t),gf(t.value)}function ty(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 Tr(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function ry(t){t.dirty=!1,!Tr(t)&&bf(t)}function vf(t){Nc(t,_f)}function bf(t){Nc(t,Sf)}function Nc(t,e){var r=t.parents.size;if(r)for(var n=Dc(t.parents),i=0;i<r;++i)e(n[i],t)}function _f(t,e){ei(t.childValues.has(e)),ei(Tr(e));var r=!Tr(t);if(!t.dirtyChildren)t.dirtyChildren=Gi.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&vf(t)}function Sf(t,e){ei(t.childValues.has(e)),ei(!Tr(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,Zm(e.value)):Ym(r,e.value)||t.setDirty(),wf(t,e),!Tr(t)&&bf(t)}function wf(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(Gi.length<Jm&&Gi.push(r),t.dirtyChildren=null))}function Ef(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){xf(t,r)}),t.forgetDeps(),ei(t.dirtyChildren===null)}function xf(t,e){e.parents.delete(t),t.childValues.delete(e),wf(t,e)}function ny(t,e){if(typeof t.subscribe=="function")try{mo(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var iy={setDirty:!0,dispose:!0,forget:!0};function go(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"&&(mo(o),o.unsubscribe=r(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var u=o&&Hm.call(iy,o)?o:"setDirty";Dc(s).forEach(function(c){return c[u]()}),e.delete(a),mo(s)}},n}function If(){var t=new Wt(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var xE=If(),Ac=new Set;function cn(t,e){e===void 0&&(e=Object.create(null));var r=new Km(e.max||Math.pow(2,16),function(c){return c.dispose()}),n=e.keyArgs,i=e.makeCacheKey||If(),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 Xm(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),Ac.add(r),yo.hasValue()||(Ac.forEach(function(p){return p.clean()}),Ac.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 Cc=function(){function t(){this.getFragmentDoc=cn(Zs)}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(E(E({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(E(E({},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=Vt(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=Vt(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(E(E({},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(E(E({},e),{data:a})),a)}})},t}();var Ki=function(t){Ie(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 Te=Object.prototype.hasOwnProperty;function Hi(t){return t==null}function bo(t,e){var r=t.__typename,n=t.id,i=t._id;if(typeof r=="string"&&(e&&(e.keyObject=Hi(n)?Hi(i)?void 0:{_id:i}:{id:n}),Hi(n)&&!Hi(i)&&(n=i),!Hi(n)))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Tf={dataIdFromObject:bo,addTypename:!0,resultCaching:!0,canonizeResults:!1};function kf(t){return Ir(Tf,t)}function _o(t){var e=t.canonizeResults;return e===void 0?Tf.canonizeResults:e}function Of(t,e){return ee(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var Pc=/^[_a-z][_0-9a-z]*/i;function Mt(t){var e=t.match(Pc);return e?e[0]:t}function vo(t,e,r){return ie(e)?pe(e)?e.every(function(n){return vo(t,n,r)}):t.selections.every(function(n){if(yt(n)&&or(n,r)){var i=It(n);return Te.call(e,i)&&(!n.selectionSet||vo(n.selectionSet,e[i],r))}return!0}):!1}function kr(t){return ie(t)&&!ee(t)&&!pe(t)}function Af(){return new st}function So(t,e){var r=en(rn(t));return{fragmentMap:r,lookupFragment:function(n){var i=r[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var wo=Object.create(null),Rc=function(){return wo},Df=Object.create(null),ti=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 qi(ee(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return ee(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return Qt(i);if(ee(i))return i;var o=n.policies.identify(i)[0];if(o){var s=Qt(o);return a&&n.merge(o,i),s}}}return t.prototype.toObject=function(){return E({},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),Te.call(this.data,e)){var n=this.data[e];if(n&&Te.call(n,r))return n[r]}if(r==="__typename"&&Te.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Or)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),Te.call(this.data,e))return this.data[e];if(this instanceof Or)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;ee(e)&&(e=e.__ref),ee(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__?L(typeof i=="string","store.merge expects a string ID"):L(typeof i=="string",1);var s=new st(oy).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=Mt(c);l!==c&&!n.policies.hasKeyArgs(s.__typename,l)&&(u[l]=1),s[c]===void 0&&!(n instanceof Or)&&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:wo,INVALIDATE:Df,isReference:ee,toReference:this.toReference,canRead:this.canRead,readField:function(c,l){return n.policies.readField(typeof c=="string"?{fieldName:c,from:l||Qt(e)}:c,{store:n})}};if(Object.keys(i).forEach(function(c){var l=Mt(c),d=i[c];if(d!==void 0){var p=typeof r=="function"?r:r[c]||r[l];if(p){var f=p===Rc?wo:p(qi(d),E(E({},u),{fieldName:l,storeFieldName:c,storage:n.getStorage(e,c)}));f===Df?n.group.dirty(e,c):(f===wo&&(f=void 0),f!==d&&(a[c]=f,o=!0,d=f))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Or?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]=Rc,i):Rc)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(Te.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Or&&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){Te.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&&Te.call(e,a)||r.delete(a)}),e){var n=e.__META,i=Vt(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 Or?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){Te.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 Or;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},t.prototype.findChildRefIds=function(e){if(!Te.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){ee(a)&&(r[a.__ref]=!0),ie(a)&&Object.keys(a).forEach(function(o){var s=a[o];ie(s)&&i.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var Nf=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?go():null,this.keyMaker=new Wt(Tt)},t.prototype.depend=function(e,r){if(this.d){this.d(Lc(e,r));var n=Mt(r);n!==r&&this.d(Lc(e,n)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Lc(e,r),r==="__exists"?"forget":"setDirty")},t}();function Lc(t,e){return e+"#"+t}function Fc(t,e){un(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){Ie(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 Nf(s))||this;return c.stump=new ay(c),c.storageTrie=new Wt(Tt),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})(ti||(ti={}));var Or=function(t){Ie(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){be(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 E(E({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return Te.call(this.data,r)?E(E({},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}(ti),ay=function(t){Ie(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new Nf(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}(Or);function oy(t,e,r){var n=t[r],i=e[r];return be(n,i)?n:i}function un(t){return!!(t instanceof ti&&t.group.caching)}function sy(t){return ie(t)?pe(t)?t.slice(0):E({__proto__:Object.getPrototypeOf(t)},t):t}var Eo=function(){function t(){this.known=new(Rl?WeakSet:Set),this.pool=new Wt(Tt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return ie(e)&&this.known.has(e)},t.prototype.pass=function(e){if(ie(e)){var r=sy(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(ie(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(f){u.push(r.admit(e[f]))});var o=this.pool.lookupArray(u);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),c.sorted.forEach(function(f,h){d[f]=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 gt=Object.assign(function(t){if(ie(t)){$c===void 0&&Cf();var e=$c.admit(t),r=Mc.get(e);return r===void 0&&Mc.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:Cf}),$c,Mc;function Cf(){$c=new Eo,Mc=new(Tt?WeakMap:Map)}function Pf(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var Rf=function(){function t(e){var r=this;this.knownResults=new(Tt?WeakMap:Map),this.config=Ir(e,{addTypename:e.addTypename!==!1,canonizeResults:_o(e)}),this.canon=e.canon||new Eo,this.executeSelectionSet=cn(function(n){var i,a=n.context.canonizeResults,o=Pf(n);o[3]=!a;var s=(i=r.executeSelectionSet).peek.apply(i,o);return s?a?E(E({},s),{result:r.canon.admit(s.result)}):s:(Fc(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Pf,makeCacheKey:function(n,i,a,o){if(un(a.store))return a.store.makeCacheKey(n,ee(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=cn(function(n){return Fc(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(un(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new Eo},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=E(E({},an(Mi(n))),o);var p=Qt(a),f=this.executeSelectionSet({selectionSet:nn(n).selectionSet,objectOrReference:p,enclosingRef:p,context:E({store:r,query:n,policies:d,variables:o,varString:gt(o),canonizeResults:l},So(n,this.config.fragments))}),h;if(f.missing&&(h=[new Ki(cy(f.missing),f.missing,n,o)],!u))throw h[0];return{result:f.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,n,i){if(un(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(ee(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=[],p,f=new st;this.config.addTypename&&typeof l=="string"&&!u.rootIdsByTypename[l]&&d.push({__typename:l});function h(S,g){var D;return S.missing&&(p=f.merge(p,(D={},D[g]=S.missing,D))),S.result}var y=new Set(n.selections);y.forEach(function(S){var g,D;if(!!or(S,s))if(yt(S)){var N=u.readField({fieldName:S.name.value,field:S,variables:o.variables,from:i},o),T=It(S);N===void 0?on.added(S)||(p=f.merge(p,(g={},g[T]="Can't find field '".concat(S.name.value,"' on ").concat(ee(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),g))):pe(N)?N=h(r.executeSubSelectedArray({field:S,array:N,enclosingRef:a,context:o}),T):S.selectionSet?N!=null&&(N=h(r.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:N,enclosingRef:ee(N)?N:a,context:o}),T)):o.canonizeResults&&(N=r.canon.pass(N)),N!==void 0&&d.push((D={},D[T]=N,D))}else{var C=tn(S,o.lookupFragment);if(!C&&S.kind===De.FRAGMENT_SPREAD)throw __DEV__?new z("No fragment named ".concat(S.name.value)):new z(5);C&&u.fragmentMatches(C,l)&&C.selectionSet.selections.forEach(y.add,y)}});var v=ji(d),b={result:v,missing:p},_=o.canonizeResults?this.canon.admit(b):qi(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 st;function c(l,d){var p;return l.missing&&(s=u.merge(s,(p={},p[d]=l.missing,p))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,d){return l===null?null:pe(l)?c(r.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?c(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:ee(l)?l:a,context:o}),d):(__DEV__&&uy(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},t}();function cy(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function uy(t,e,r){if(!e.selectionSet){var n=new Set([r]);n.forEach(function(i){ie(i)&&(__DEV__?L(!ee(i),"Missing selection set for object of type ".concat(Of(t,i)," returned for query field ").concat(e.name.value)):L(!ee(i),6),Object.values(i).forEach(n.add,n))})}}var ri=new Xn,Lf=new WeakMap;function Ji(t){var e=Lf.get(t);return e||Lf.set(t,e={vars:new Set,dep:go()}),e}function jc(t){Ji(t).vars.forEach(function(e){return e.forgetCache(t)})}function Ff(t){Ji(t).vars.forEach(function(e){return e.attachCache(t)})}function xo(t){var e=new Set,r=new Set,n=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(u){Ji(u).dep.dirty(n),ly(u)});var o=Array.from(r);r.clear(),o.forEach(function(u){return u(t)})}}else{var s=ri.getValue();s&&(i(s),Ji(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),Ji(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function ly(t){t.broadcastWatches&&t.broadcastWatches()}var $f=Object.create(null);function Uc(t){var e=JSON.stringify(t);return $f[e]||($f[e]=Object.create(null))}function qc(t){var e=Uc(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Vc(t,function(o){var s=ni(n.storeObject,o,i);return s===void 0&&r!==n.storeObject&&Te.call(r,o[0])&&(s=ni(r,o,jf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(r))):L(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Bc(t){var e=Uc(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var i=n.field,a=n.variables,o=n.fieldName,s=Vc(t,function(c){var l=c[0],d=l.charAt(0);if(d==="@"){if(i&&Re(i.directives)){var p=l.slice(1),f=i.directives.find(function(b){return b.name.value===p}),h=f&&sr(f,a);return h&&ni(h,c.slice(1))}return}if(d==="$"){var y=l.slice(1);if(a&&Te.call(a,y)){var v=c.slice(0);return v[0]=y,ni(a,v)}return}if(r)return ni(r,c)}),u=JSON.stringify(s);return(r||u!=="{}")&&(o+=":"+u),o})}function Vc(t,e){var r=new st;return Mf(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 Mf(t){var e=Uc(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(i,a){pe(i)?(Mf(i).forEach(function(o){return r.push(n.concat(o))}),n.length=0):(n.push(i),pe(t[a+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function jf(t,e){return t[e]}function ni(t,e,r){return r=r||jf,Uf(e.reduce(function n(i,a){return pe(i)?i.map(function(o){return n(o,a)}):i&&r(i,a)},t))}function Uf(t){return ie(t)?pe(t)?t.map(Uf):Vc(Object.keys(t).sort(),function(e){return ni(t,e)}):t}Fi.setStringify(gt);function Qc(t){return t.args!==void 0?t.args:t.field?sr(t.field,t.variables):null}var fy=function(){},qf=function(t,e){return e.fieldName},Bf=function(t,e,r){var n=r.mergeObjects;return n(t,e)},Vf=function(t,e){return e},zf=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=E({dataIdFromObject:bo},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=E(E({},r),{typename:a,storeObject:o,readField:r&&r.readField||function(){var p=Io(arguments,o);return i.readField(p,{store:i.cache.data,variables:p.variables})}}),u,c=a&&this.getTypePolicy(a),l=c&&c.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(pe(d))l=qc(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=Vt(i,["queryType","mutationType","subscriptionType"]);a&&r.setRootTypename("Query",n),o&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),Te.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?Bf:c===!1?Vf:u.merge}s(i,r.merge),i.keyFn=a===!1?fy:pe(a)?qc(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,p=l.read,f=l.merge;c.keyFn=d===!1?qf:pe(d)?Bc(d):typeof d=="function"?d:c.keyFn,typeof p=="function"&&(c.read=p),s(c,f)}c.read&&c.merge&&(c.keyFn=c.keyFn||qf)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(__DEV__?L(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):L(!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(Pc);(!a||a[0]!==i)&&r.fuzzySubtypes.set(i,new RegExp(i))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!Te.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=Vt(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 y=a.getSupertypeSet(h,!1);y&&y.size&&u.indexOf(y)<0&&u.push(y)},l=!!(n&&this.fuzzySubtypes.size),d=!1,p=0;p<u.length;++p){var f=u[p];if(f.has(o))return s.has(o)||(d&&__DEV__&&L.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;f.forEach(c),l&&p===u.length-1&&vo(e.selectionSet,n,i)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,y){var v=r.match(h);v&&v[0]===r&&c(y)}))}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=Qc(e);o;){var c=o(u,s);if(pe(c))o=Bc(c);else{a=c||n;break}}return a===void 0&&(a=e.field?ec(e.field,e.variables):Fi(n,Qc(e))),a===!1?n:n===Mt(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=Mt(o),u=r.store.getFieldValue(n,o),c=this.getFieldPolicy(e.typename,s,!1),l=c&&c.read;if(l){var d=Qf(this,n,e,r,r.store.getStorage(ee(n)?n.__ref:n,o));return ri.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===Bf?Wf(i.store)(e,r):u===Vf?r:(i.overwrite&&(e=void 0),u(e,r,Qf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},t}();function Qf(t,e,r,n,i){var a=t.getStoreFieldName(r),o=Mt(a),s=r.variables||n.variables,u=n.store,c=u.toReference,l=u.canRead;return{args:Qc(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ee,toReference:c,storage:i,cache:t.cache,canRead:l,readField:function(){return t.readField(Io(arguments,e,s),n)},mergeObjects:Wf(n.store)}}function Io(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=E({},n),Te.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Ml(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function Wf(t){return function(r,n){if(pe(r)||pe(n))throw __DEV__?new z("Cannot automatically merge arrays"):new z(4);if(ie(r)&&ie(n)){var i=t.getFieldValue(r,"__typename"),a=t.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(ee(r)&&kr(n))return t.merge(r.__ref,n),r;if(kr(r)&&ee(n))return t.merge(r,n.__ref),n;if(kr(r)&&kr(n))return E(E({},r),n)}return n}}function zc(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:E(E({},t),{clientOnly:e,deferred:r})),i}var Jf=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=zt(i),l=Af();s=E(E({},an(c)),s);var d=E(E({store:e,written:Object.create(null),merge:function(f,h){return l.merge(f,h)},variables:s,varString:gt(s)},So(i,this.fragments)),{overwrite:!!u,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),p=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:c.selectionSet,mergeTree:{map:new Map},context:d});if(!ee(p))throw __DEV__?new z("Could not identify object ".concat(JSON.stringify(a))):new z(7);return d.incomingById.forEach(function(f,h){var y=f.storeObject,v=f.mergeTree,b=f.fieldNodeSet,_=Qt(h);if(v&&v.map.size){var S=n.applyMerges(v,_,y,d);if(ee(S))return;y=S}if(__DEV__&&!d.overwrite){var g=Object.create(null);b.forEach(function(T){T.selectionSet&&(g[T.name.value]=!0)});var D=function(T){return g[Mt(T)]===!0},N=function(T){var C=v&&v.map.get(T);return Boolean(C&&C.info&&C.info.merge)};Object.keys(y).forEach(function(T){D(T)&&!N(T)&&py(_,y,T,d.store)})}e.merge(h,y)}),e.retain(p.__ref),p},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]||$i(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(c.__typename=l);var d=function(){var S=Io(arguments,c,o.variables);if(ee(S.from)){var g=o.incomingById.get(S.from.__ref);if(g){var D=u.readField(E(E({},S),{from:g.storeObject}),o);if(D!==void 0)return D}}return u.readField(S,o)},p=new Set;this.flattenFields(a,i,o,l).forEach(function(S,g){var D,N=It(g),T=i[N];if(p.add(g),T!==void 0){var C=u.getStoreFieldName({typename:l,fieldName:g.name.value,field:g,variables:S.variables}),F=Gf(s,C),R=r.processFieldValue(T,g,g.selectionSet?zc(S,!1,!1):S,F),M=void 0;g.selectionSet&&(ee(R)||kr(R))&&(M=d("__typename",R));var Ve=u.getMergeFunction(l,g.name.value,M);Ve?F.info={field:g,typename:l,merge:Ve}:Kf(s,C),c=S.merge(c,(D={},D[C]=R,D))}else __DEV__&&!S.clientOnly&&!S.deferred&&!on.added(g)&&!u.getReadFunction(l,g.name.value)&&__DEV__&&L.error("Missing field '".concat(It(g),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var f=u.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:c,readField:d}),h=f[0],y=f[1];n=n||h,y&&(c=o.merge(c,y))}catch(S){if(!n)throw S}if(typeof n=="string"){var v=Qt(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=Wc(_.mergeTree,s),p.forEach(function(S){return _.fieldNodeSet.add(S)})):o.incomingById.set(n,{storeObject:c,mergeTree:To(s)?void 0:s,fieldNodeSet:p}),v}return c},t.prototype.processFieldValue=function(e,r,n,i){var a=this;return!r.selectionSet||e===null?__DEV__?ao(e):e:pe(e)?e.map(function(o,s){var u=a.processFieldValue(o,r,n,Gf(i,s));return Kf(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=$i(r,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Wt(!1);return function u(c,l){var d=s.lookup(c,l.clientOnly,l.deferred);d.visited||(d.visited=!0,c.selections.forEach(function(p){if(!!or(p,n.variables)){var f=l.clientOnly,h=l.deferred;if(!(f&&h)&&Re(p.directives)&&p.directives.forEach(function(b){var _=b.name.value;if(_==="client"&&(f=!0),_==="defer"){var S=sr(b,n.variables);(!S||S.if!==!1)&&(h=!0)}}),yt(p)){var y=a.get(p);y&&(f=f&&y.clientOnly,h=h&&y.deferred),a.set(p,zc(n,f,h))}else{var v=tn(p,n.lookupFragment);if(!v&&p.kind===De.FRAGMENT_SPREAD)throw __DEV__?new z("No fragment named ".concat(p.name.value)):new z(8);v&&o.fragmentMatches(v,i,r,n.variables)&&u(v.selectionSet,zc(n,f,h))}}}))}(e,n),a},t.prototype.applyMerges=function(e,r,n,i,a){var o,s=this;if(e.map.size&&!ee(n)){var u=!pe(n)&&(ee(r)||kr(r))?r:void 0,c=n;u&&!a&&(a=[ee(u)?u.__ref:u]);var l,d=function(p,f){return pe(p)?typeof f=="number"?p[f]:void 0:i.store.getFieldValue(p,String(f))};e.map.forEach(function(p,f){var h=d(u,f),y=d(c,f);if(y!==void 0){a&&a.push(f);var v=s.applyMerges(p,h,y,i,a);v!==y&&(l=l||new Map,l.set(f,v)),a&&L(a.pop()===f)}}),l&&(n=pe(c)?c.slice(0):E({},c),l.forEach(function(p,f){n[f]=p}))}return e.info?this.cache.policies.runMergeFunction(r,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},t}();var Yf=[];function Gf(t,e){var r=t.map;return r.has(e)||r.set(e,Yf.pop()||{map:new Map}),r.get(e)}function Wc(t,e){if(t===e||!e||To(e))return t;if(!t||To(t))return e;var r=t.info&&e.info?E(E({},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,Wc(s,e.map.get(u))),o.delete(u)}),o.forEach(function(s){a.map.set(s,Wc(e.map.get(s),t.map.get(s)))})}return a}function To(t){return!t||!(t.info||t.map.size)}function Kf(t,e){var r=t.map,n=r.get(e);n&&To(n)&&(Yf.push(n),r.delete(e))}var Hf=new Set;function py(t,e,r,n){var i=function(d){var p=n.getFieldValue(d,r);return typeof p=="object"&&p},a=i(t);if(!!a){var o=i(e);if(!!o&&!ee(a)&&!be(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=Mt(r),c="".concat(s,".").concat(u);if(!Hf.has(c)){Hf.add(c);var l=[];!pe(a)&&!pe(o)&&[a,o].forEach(function(d){var p=n.getFieldValue(d,"__typename");typeof p=="string"&&!l.includes(p)&&l.push(p)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(u," field of a ").concat(s,` object.
|
|
37
37
|
|
|
38
38
|
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:
|
|
39
39
|
|
|
@@ -44,31 +44,32 @@ For more information about these options, please refer to the documentation:
|
|
|
44
44
|
|
|
45
45
|
* Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers
|
|
46
46
|
* Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects
|
|
47
|
-
`))}}}}var
|
|
47
|
+
`))}}}}var Yi=function(t){Ie(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=xo,n.txCount=0,n.config=kf(r),n.addTypename=!!n.config.addTypename,n.policies=new zf({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 ti.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 Jf(this,this.storeReader=new Rf({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:_o(this.config),canon:r?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=cn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(un(s)){var u=o.optimistic,c=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,gt({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(E(E({},r),{store:r.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof Ki)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(Te.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(E(E({},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||Ff(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){n.watches.delete(r)&&!n.watches.size&&jc(n),n.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){gt.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(ee(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(n){__DEV__&&L.warn(n)}},e.prototype.evict=function(r){if(!r.id){if(Te.call(r,"id"))return!1;r=E(E({},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(),gt.reset(),r&&r.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),jc(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(p){var f=n,h=f.data,y=f.optimisticData;++n.txCount,p&&(n.data=n.optimisticData=p);try{return c=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=y}},d=new Set;return u&&!this.txCount&&this.broadcastWatches(E(E({},r),{onWatchUpdated:function(p){return d.add(p),!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(E(E({},r),{onWatchUpdated:function(p,f){var h=u.call(this,p,f);return h!==!1&&d.delete(p),h}})),d.size&&d.forEach(function(p){return n.maybeBroadcastWatch.dirty(p)})):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=on(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||!be(i.result,a.result))&&r.callback(r.lastDiff=a,i)},e}(Cc);function Zf(t){return t.hasOwnProperty("graphQLErrors")}var dy=function(t){var e="";if(Re(t.graphQLErrors)||Re(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,`
|
|
48
48
|
`)})}return t.networkError&&(e+="".concat(t.networkError.message,`
|
|
49
|
-
`)),e=e.replace(/\n$/,""),e},cr=function(t){Ie(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||
|
|
50
|
-
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return r&&!be(this.options.variables,r)&&(i.variables=this.options.variables=w(w({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(i,ce.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=ce.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var u=new Set;return this.queryManager.fetchQuery(a,i,ce.fetchMore).then(function(c){return n.queryManager.removeQuery(a),o.networkStatus===ce.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(p){return d(p,{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)||Vc(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 be(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},ce.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&&(Ar(r.queryInfo.networkStatus)?u():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ce.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:Xa(r),variables:n}),Ce(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,n){var i=this;this.isTornDown=!1;var a=n===ce.refetch||n===ce.fetchMore||n===ce.poll,o=this.options.variables,s=this.options.fetchPolicy,u=Ir(this.options,r||{}),c=a?u:fy(this.options,u);a||(this.updatePolling(),r&&r.variables&&!be(r.variables,o)&&c.fetchPolicy!=="standby"&&c.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",c),n===void 0&&(n=ce.setVariables)));var l=c.variables&&w({},c.variables),d=this.fetch(c,n),p={next:function(f){i.reportResult(f,l)},error:function(f){i.reportError(f,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=p),d.addObserver(p),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),on(this.observers,"next",r))},e.prototype.reportError=function(r,n){var i=w(w({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:ce.error,loading:!1});this.updateLastResult(i,n),on(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}(Y);to(wo);function Vc(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__&&R.error("Unhandled error",t.message,t.stack)}function Qc(t){__DEV__&&t&&__DEV__&&R.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var Eo=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=nc(r.resolvers,n)}):this.resolvers=nc(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 Ct(this,void 0,void 0,function(){return Rt(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 Vn(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return rc(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={}),Ct(this,void 0,void 0,function(){return Rt(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 Je(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 Zr}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:tc(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),Ct(this,void 0,void 0,function(){var s,u,c,l,d,p,f,h,y,v,b;return Rt(this,function(_){return s=rn(e),u=tn(e),c=Xr(u),l=this.collectSelectionsToResolve(s,c),d=s.operation,p=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",f=this,h=f.cache,y=f.client,v={fragmentMap:c,context:w(w({},n),{cache:h,client:y}),variables:i,fragmentMatcher:a,defaultOperationType:p,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 Ct(this,void 0,void 0,function(){var a,o,s,u,c,l=this;return Rt(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,u=[n],c=function(p){return Ct(l,void 0,void 0,function(){var f,h;return Rt(this,function(y){return!r&&!i.selectionsToResolve.has(p)?[2]:or(p,s)?yt(p)?[2,this.resolveField(p,r,n,i).then(function(v){var b;typeof v<"u"&&u.push((b={},b[xt(p)]=v,b))})]:(Ys(p)?f=p:(f=a[p.name.value],__DEV__?R(f,"No fragment named ".concat(p.name.value)):R(f,11)),f&&f.typeCondition&&(h=f.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(f.selectionSet,r,n,i).then(function(v){u.push(v)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(c)).then(function(){return Mi(u)})]})})},t.prototype.resolveField=function(e,r,n,i){return Ct(this,void 0,void 0,function(){var a,o,s,u,c,l,d,p,f,h=this;return Rt(this,function(y){return n?(a=i.variables,o=e.name.value,s=xt(e),u=o!==s,c=n[s]||n[o],l=Promise.resolve(c),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,p=this.resolvers&&this.resolvers[d],p&&(f=p[u?o:s],f&&(l=Promise.resolve(ei.withValue(this.cache,f,[n,sr(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(g){g.name.value==="export"&&g.arguments&&g.arguments.forEach(function(D){D.name.value==="as"&&D.value.kind==="StringValue"&&(i.exportedVariables[D.value.value]=v)})}),!e.selectionSet||v==null)return v;var S=(_=(b=e.directives)===null||b===void 0?void 0:b.some(function(g){return g.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),Je(o,{Directive:function(u,c,l,d,p){u.name.value==="client"&&p.forEach(function(f){n(f)&&Ci(f)&&s.add(f)})},FragmentSpread:function(u,c,l,d,p){var f=r[u.name.value];__DEV__?R(f,"No fragment named ".concat(u.name.value)):R(f,12);var h=a(f);h.size>0&&(p.forEach(function(y){n(y)&&Ci(y)&&s.add(y)}),s.add(u),h.forEach(function(y){s.add(y)}))}})}return i.get(o)}return a(e)},t}();var ri=new(It?WeakMap:Map);function zc(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return ri.set(t,(ri.get(t)+1)%1e15),r.apply(this,arguments)})}function Kf(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var xo=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;ri.has(n)||(ri.set(n,0),zc(n,"evict"),zc(n,"modify"),zc(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||ce.loading;return this.variables&&this.networkStatus!==ce.loading&&!be(this.variables,e.variables)&&(r=ce.setVariables),be(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(){Kf(this),this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&be(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&&!be(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():Vc(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;Kf(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(Ar(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||!be(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===ri.get(this.cache)&&be(r,n.variables)&&be(e.data,n.result.data))},t.prototype.markResult=function(e,r,n,i){var a=this,o=new st,s=Ce(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Ce(e.incremental)){var u=ro(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&&(Io(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:ri.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(n.variables),p=l.diff(d);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(p,d),p.complete&&(e.data=p.result)}):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ce.ready},t.prototype.markError=function(e){return this.networkStatus=ce.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function Io(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",n=!Hn(t);return!n&&r&&t.data&&(n=!0),n}var hy=Object.prototype.hasOwnProperty,Hf=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,p=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(It?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=p||new Eo({cache:r}),this.ssrMode=c,this.assumeImmutableResults=!!f,(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 Q("QueryManager stopped while query was in flight"):new Q(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,p=e.update,f=e.onQueryUpdated,h=e.fetchPolicy,y=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 Ct(this,void 0,void 0,function(){var g,D,N,T,P,F;return Rt(this,function(C){switch(C.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(y==="network-only"||y==="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(y==="network-only"||y==="no-cache",16),g=this.generateMutationId(),D=this.transform(i),N=D.document,T=D.hasClientExports,i=this.cache.transformForLink(N),a=this.getVariables(i,a),T?[4,this.localState.addExportedVariables(i,a,S)]:[3,2];case 1:a=C.sent(),C.label=2;case 2:return P=this.mutationStore&&(this.mutationStore[g]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:g,document:i,variables:a,fetchPolicy:y,errorPolicy:b,context:S,updateQueries:s,update:p,keepRootFields:_}),this.broadcastQueries(),F=this,[2,new Promise(function(M,Ve){return eo(F.getObservableFromLink(i,w(w({},S),{optimisticResponse:o}),a,!1),function(Pe){if(Hn(Pe)&&b==="none")throw new cr({graphQLErrors:no(Pe)});P&&(P.loading=!1,P.error=null);var V=w({},Pe);return typeof c=="function"&&(c=c(V)),b==="ignore"&&Hn(V)&&delete V.errors,F.markMutationResult({mutationId:g,result:V,document:i,variables:a,fetchPolicy:y,errorPolicy:b,context:S,update:p,updateQueries:s,awaitRefetchQueries:d,refetchQueries:c,removeOptimistic:o?g:void 0,onQueryUpdated:f,keepRootFields:_})}).subscribe({next:function(Pe){F.broadcastQueries(),(!("hasNext"in Pe)||Pe.hasNext===!1)&&M(Pe)},error:function(Pe){P&&(P.loading=!1,P.error=Pe),o&&F.cache.removeOptimistic(g),F.broadcastQueries(),Ve(Pe instanceof cr?Pe:new cr({networkError:Pe}))}})})]}})})},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&&Io(i,e.errorPolicy)){if(xr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),xr(i)&&Ce(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=ro(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,p){var f=d.observableQuery,h=f&&f.queryName;if(!(!h||!hy.call(c,h))){var y=c[h],v=n.queries.get(p),b=v.document,_=v.variables,S=r.diff({query:b,variables:_,returnPartialData:!0,optimistic:!1}),g=S.result,D=S.complete;if(D&&g){var N=y(g,{mutationResult:i,queryName:b&&zn(b)||void 0,queryVariables:_});N&&a.push({result:N,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(y){return d.write(y)});var p=e.update,f=!Nl(i)||xr(i)&&!i.hasNext;if(p){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)}f&&p(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&f&&d.modify({id:"ROOT_MUTATION",fields:function(y,v){var b=v.fieldName,_=v.DELETE;return b==="__typename"?y:_}})},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=ec(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:Gs(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:nn(zt(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 xo(this),n=new wo({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 Q("Store reset while query was in flight (not completed in link chain)"):new Q(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=ce.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):Hs(o)?i.set(r.transform(o).document,!1):ie(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=qi("legacyOneTimeQuery"),u=r.getQuery(s).init({document:o.query,variables:o.variables}),c=new wo({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(p){if(i!=="no-cache"&&(Io(p,a)&&r.cache.write({query:n,result:p.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),r.broadcastQueries()),Hn(p))throw new cr({graphQLErrors:p.errors});return p})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,u).then(c);return new Y(function(d){var p=null;return l.then(function(f){return p=f.subscribe(d)},d.error),function(){return p&&p.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,p={query:u,variables:n,operationName:zn(u)||void 0,context:this.prepareContext(w(w({},r),{forceFetch:!i}))};if(r=p.context,i){var f=l.get(u)||new Map;l.set(u,f);var h=gt(n);if(s=f.get(h),!s){var y=new Kn([Jn(d,p)]);f.set(h,s=y),y.beforeNext(function(){f.delete(h)&&f.size<1&&l.delete(u)})}}else s=new Kn([Jn(d,p)])}else s=new Kn([Y.of({data:{}})]),r=this.prepareContext(r);var v=this.transform(e).clientQuery;return v&&(s=eo(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 eo(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=no(o),u=s.length>0;if(i>=e.lastRequestId){if(u&&n.errorPolicy==="none")throw e.markError(new cr({graphQLErrors:s}));e.markResult(o,a,n,r),e.markReady()}var c={data:o.data,loading:!1,networkStatus:ce.ready};return u&&n.errorPolicy!=="ignore"&&(c.errors=s,c.networkStatus=ce.error),c},function(o){var s=Gf(o)?o:new cr({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,n){var i=this;n===void 0&&(n=ce.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,p=d===void 0?u&&u.errorPolicy||"none":d,f=r.returnPartialData,h=f===void 0?!1:f,y=r.notifyOnNetworkStatusChange,v=y===void 0?!1:y,b=r.context,_=b===void 0?{}:b,S=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:p,returnPartialData:h,notifyOnNetworkStatusChange:v,context:_}),g=function(T){S.variables=T;var P=i.fetchQueryByPolicy(s,S,n);return S.fetchPolicy!=="standby"&&P.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),P},D=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(T){D(),setTimeout(function(){return N.cancel(T)})});var N=new Kn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(g):g(S.variables));return N.promise.then(D,D),N},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?qi("refetchQueries"):void 0:s,c=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(p,f){l.set(f,{oq:p,lastDiff:r.getQuery(f).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&u||!1,removeOptimistic:u,onWatchUpdated:function(p,f,h){var y=p.watcher instanceof xo&&p.watcher.observableQuery;if(y){if(c){l.delete(y.queryId);var v=c(y,f,h);return v===!0&&(v=y.refetch()),v!==!1&&d.set(y,v),v}c!==null&&l.set(y.queryId,{oq:y,lastDiff:h,diff:f})}}}),l.size&&l.forEach(function(p,f){var h=p.oq,y=p.lastDiff,v=p.diff,b;if(c){if(!v){var _=h.queryInfo;_.reset(),v=_.getDiff()}b=c(h,v,y)}(!c||b===!0)&&(b=h.refetch()),b!==!1&&d.set(h,b),f.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(f)}),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,p=r.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},y=function(g,D){D===void 0&&(D=e.networkStatus||ce.loading);var N=g.result;__DEV__&&!l&&!be(N,{})&&Qc(g.missing);var T=function(P){return Y.of(w({data:P,loading:Ar(D),networkStatus:D},g.complete?null:{partial:!0}))};return N&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:N},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(P){return T(P.data||void 0)}):c==="none"&&D===ce.refetch&&Array.isArray(g.missing)?T(void 0):T(N)},v=s==="no-cache"?0:n===ce.refetch&&u!=="merge"?1:2,b=function(){return i.getResultsFromLink(e,v,{variables:o,context:d,fetchPolicy:s,errorPolicy:c})},_=p&&typeof f=="number"&&f!==n&&Ar(n);switch(s){default:case"cache-first":{var S=h();return S.complete?[y(S,e.markReady())]:l||_?[y(S),b()]:[b()]}case"cache-and-network":{var S=h();return S.complete||l||_?[y(S),b()]:[b()]}case"cache-only":return[y(h(),e.markReady())];case"network-only":return _?[y(h()),b()]:[b()];case"no-cache":return _?[y(e.getDiff()),b()]:[b()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new xo(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 Jf=!1;var Wc=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,p=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,f=e.queryDeduplication,h=f===void 0?!0:f,y=e.defaultOptions,v=e.assumeImmutableResults,b=v===void 0?!1:v,_=e.resolvers,S=e.typeDefs,g=e.fragmentMatcher,D=e.name,N=e.version,T=e.link;if(T||(T=n?new _c({uri:n,credentials:i,headers:a}):Tt.empty()),!o)throw __DEV__?new Q(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
|
|
51
|
-
For more information, please visit: https://go.apollo.dev/c/docs`):new Q(9);if(this.link=T,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=h,this.defaultOptions=y||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),p&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!Jf&&p&&__DEV__&&(Jf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var P=window.navigator,F=P&&P.userAgent,C=void 0;typeof F=="string"&&(F.indexOf("Chrome/")>-1?C="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":F.indexOf("Firefox/")>-1&&(C="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),C&&__DEV__&&R.log("Download the Apollo DevTools for a better development experience: "+C)}this.version=Ll,this.localState=new Eo({cache:o,client:this,resolvers:_,fragmentMatcher:g}),this.queryManager=new Hf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:u,clientAwareness:{name:D,version:N},localState:this.localState,assumeImmutableResults:b,onBroadcast:p?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=Bi(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=Bi(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=Bi(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 Jn(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}();sl(Yr?"log":"silent");function et(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function ur(t){return et(t)==="object"}function Yf(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function Gc(t,e){return t.length<124?t:e}var Zf="graphql-transport-ws";var ct;(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"})(ct||(ct={}));var ke;(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"})(ke||(ke={}));function Xf(t){if(!ur(t))throw new Error(`Message is expected to be an object, but got ${et(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 ${et(t.type)}`);switch(t.type){case ke.ConnectionInit:case ke.ConnectionAck:case ke.Ping:case ke.Pong:{if(t.payload!=null&&!ur(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 ke.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${et(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ur(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${et(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 ${et(t.payload.query)}`);if(t.payload.variables!=null&&!ur(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 ${et(t.payload.variables)}`);if(t.payload.operationName!=null&&et(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 ${et(t.payload.operationName)}`);if(t.payload.extensions!=null&&!ur(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 ${et(t.payload.extensions)}`);break}case ke.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${et(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ur(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${et(t.payload)}`);break}case ke.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${et(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!Yf(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 ke.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${et(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 ep(t,e){return Xf(typeof t=="string"?JSON.parse(t,e):t)}function ni(t,e){return Xf(t),JSON.stringify(t,e)}function tp(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(me){let ye=1e3;for(let re=0;re<me;re++)ye*=2;await new Promise(re=>setTimeout(re,ye+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=To,isFatalConnectionProblem:p,on:f,webSocketImpl:h,generateID:y=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,me=>{let ye=Math.random()*16|0;return(me=="x"?ye:ye&3|8).toString(16)})},jsonMessageReplacer:v,jsonMessageReviver:b}=t,_;if(h){if(!yy(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=_,g=(()=>{let V=(()=>{let ye={};return{on(re,ne){return ye[re]=ne,()=>{delete ye[re]}},emit(re){var ne;"id"in re&&((ne=ye[re.id])===null||ne===void 0||ne.call(ye,re))}}})(),me={connecting:f?.connecting?[f.connecting]:[],opened:f?.opened?[f.opened]:[],connected:f?.connected?[f.connected]:[],ping:f?.ping?[f.ping]:[],pong:f?.pong?[f.pong]:[],message:f?.message?[V.emit,f.message]:[V.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:V.on,on(ye,re){let ne=me[ye];return ne.push(re),()=>{ne.splice(ne.indexOf(re),1)}},emit(ye,...re){for(let ne of[...me[ye]])ne(...re)}}})();function D(V){let me=[g.on("error",ye=>{me.forEach(re=>re()),V(ye)}),g.on("closed",ye=>{me.forEach(re=>re()),V(ye)})]}let N,T=0,P,F=!1,C=0,M=!1;async function Ve(){clearTimeout(P);let[V,me]=await(N??(N=new Promise((ne,qt)=>(async()=>{if(F){if(await l(C),!T)return N=void 0,qt({code:1e3,reason:"All Subscriptions Gone"});C++}g.emit("connecting");let J=new S(typeof e=="function"?await e():e,Zf),Bt,br;function Ba(){isFinite(o)&&o>0&&(clearTimeout(br),br=setTimeout(()=>{J.readyState===S.OPEN&&(J.send(ni({type:ke.Ping})),g.emit("ping",!1,void 0))},o))}D(Qe=>{N=void 0,clearTimeout(Bt),clearTimeout(br),qt(Qe),To(Qe)&&Qe.code===4499&&(J.close(4499,"Terminated"),J.onerror=null,J.onclose=null)}),J.onerror=Qe=>g.emit("error",Qe),J.onclose=Qe=>g.emit("closed",Qe),J.onopen=async()=>{try{g.emit("opened",J);let Qe=typeof r=="function"?await r():r;if(J.readyState!==S.OPEN)return;J.send(ni(Qe?{type:ke.ConnectionInit,payload:Qe}:{type:ke.ConnectionInit},v)),isFinite(u)&&u>0&&(Bt=setTimeout(()=>{J.close(ct.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},u)),Ba()}catch(Qe){g.emit("error",Qe),J.close(ct.InternalClientError,Gc(Qe instanceof Error?Qe.message:new Error(Qe).message,"Internal client error"))}};let qn=!1;J.onmessage=({data:Qe})=>{try{let ze=ep(Qe,b);if(g.emit("message",ze),ze.type==="ping"||ze.type==="pong"){g.emit(ze.type,!0,ze.payload),ze.type==="pong"?Ba():s||(J.send(ni(ze.payload?{type:ke.Pong,payload:ze.payload}:{type:ke.Pong})),g.emit("pong",!1,ze.payload));return}if(qn)return;if(ze.type!==ke.ConnectionAck)throw new Error(`First message cannot be of type ${ze.type}`);clearTimeout(Bt),qn=!0,g.emit("connected",J,ze.payload),F=!1,C=0,ne([J,new Promise((U_,xh)=>D(xh))])}catch(ze){J.onmessage=null,g.emit("error",ze),J.close(ct.BadResponse,Gc(ze instanceof Error?ze.message:new Error(ze).message,"Bad response"))}}})())));V.readyState===S.CLOSING&&await me;let ye=()=>{},re=new Promise(ne=>ye=ne);return[V,ye,Promise.race([re.then(()=>{if(!T){let ne=()=>V.close(1e3,"Normal Closure");isFinite(a)&&a>0?P=setTimeout(()=>{V.readyState===S.OPEN&&ne()},a):ne()}}),me])]}function Pe(V){if(To(V)&&(my(V.code)||[ct.InternalServerError,ct.InternalClientError,ct.BadRequest,ct.BadResponse,ct.Unauthorized,ct.SubprotocolNotAcceptable,ct.SubscriberAlreadyExists,ct.TooManyInitialisationRequests].includes(V.code)))throw V;if(M)return!1;if(To(V)&&V.code===1e3)return T>0;if(!c||C>=c||!d(V)||p?.(V))throw V;return F=!0}return n||(async()=>{for(T++;;)try{let[,,V]=await Ve();await V}catch(V){try{if(!Pe(V))return}catch(me){return i?.(me)}}})(),{on:g.on,subscribe(V,me){let ye=y(V),re=!1,ne=!1,qt=()=>{T--,re=!0};return(async()=>{for(T++;;)try{let[J,Bt,br]=await Ve();if(re)return Bt();let Ba=g.onMessage(ye,qn=>{switch(qn.type){case ke.Next:{me.next(qn.payload);return}case ke.Error:{ne=!0,re=!0,me.error(qn.payload),qt();return}case ke.Complete:{re=!0,qt();return}}});J.send(ni({id:ye,type:ke.Subscribe,payload:V},v)),qt=()=>{!re&&J.readyState===S.OPEN&&J.send(ni({id:ye,type:ke.Complete},v)),T--,re=!0,Bt()},await br.finally(Ba);return}catch(J){if(!Pe(J))return}})().then(()=>{ne||me.complete()}).catch(J=>{me.error(J)}),()=>{re||qt()}},async dispose(){if(M=!0,N){let[V]=await N;V.close(1e3,"Normal Closure")}},terminate(){N&&g.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function To(t){return ur(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 yy(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function gy(t){return ie(t)&&"code"in t&&"reason"in t}var rp=function(t){Ie(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 Y(function(i){return n.client.subscribe(w(w({},r),{query:Bn(r.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):gy(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new cr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Tt);var is=function(){return is=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},is.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Uo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Uo=function(r){return typeof r}:Uo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Uo(t)}function vy(t){return Uo(t)=="object"&&t!==null}var Sd=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function hu(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 wd(t.source,hu(t.source,t.start))}function wd(t,e){var r=t.locationOffset.column-1,n=qo(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,`
|
|
52
|
-
`),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var p=Math.floor(u/80),f=u%80,h=[],y=0;y<d.length;y+=80)h.push(d.slice(y,y+80));return c+
|
|
53
|
-
`)}function
|
|
49
|
+
`)),e=e.replace(/\n$/,""),e},cr=function(t){Ie(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||dy(u),u.extraInfo=s,u.__proto__=e.prototype,u}return e}(Error);var ce;(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"})(ce||(ce={}));function Ar(t){return t?t<7:!1}var hy=Object.assign,my=Object.hasOwnProperty,ko=function(t){Ie(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=yy)}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,p=d===void 0?l:d,f=a.initialFetchPolicy,h=f===void 0?p==="standby"?l:p:f;o.options=E(E({},a),{initialFetchPolicy:h,fetchPolicy:p}),o.queryId=i.queryId||n.generateQueryId();var y=zt(o.query);return o.queryName=y&&y.name&&y.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||ce.ready,a=E(E({},n),{loading:Ar(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),be(a.data,{})&&(a.data=void 0),u.complete?(delete a.partial,u.complete&&a.networkStatus===ce.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=ce.ready,a.loading=!1)):a.partial=!0,__DEV__&&!u.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Kc(u.missing)}return r&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(r,n){return!this.last||!be(this.last.result,r)||n&&!be(this.last.variables,n)},e.prototype.getLast=function(r,n){var i=this.last;if(i&&i[r]&&(!n||be(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&&my.call(r,"variables")){var o=Mi(this.query),s=o.variableDefinitions;(!s||!s.some(function(u){return u.variable.name.value==="variables"}))&&__DEV__&&L.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.
|
|
50
|
+
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return r&&!be(this.options.variables,r)&&(i.variables=this.options.variables=E(E({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(i,ce.refetch)},e.prototype.fetchMore=function(r){var n=this,i=E(E({},r.query?r:E(E(E(E({},this.options),{query:this.query}),r),{variables:E(E({},this.options.variables),r.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=ce.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var u=new Set;return this.queryManager.fetchQuery(a,i,ce.fetchMore).then(function(c){return n.queryManager.removeQuery(a),o.networkStatus===ce.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(p){return d(p,{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)||Gc(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__&&L.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 be(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},ce.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__?L(a,"Attempted to start a polling query without a polling interval."):L(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){r.pollingInfo&&(Ar(r.queryInfo.networkStatus)?u():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},ce.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=E(E({},this.last),{result:this.queryManager.assumeImmutableResults?r:ao(r),variables:n}),Re(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,n){var i=this;this.isTornDown=!1;var a=n===ce.refetch||n===ce.fetchMore||n===ce.poll,o=this.options.variables,s=this.options.fetchPolicy,u=Ir(this.options,r||{}),c=a?u:hy(this.options,u);a||(this.updatePolling(),r&&r.variables&&!be(r.variables,o)&&c.fetchPolicy!=="standby"&&c.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",c),n===void 0&&(n=ce.setVariables)));var l=c.variables&&E({},c.variables),d=this.fetch(c,n),p={next:function(f){i.reportResult(f,l)},error:function(f){i.reportError(f,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=p),d.addObserver(p),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),sn(this.observers,"next",r))},e.prototype.reportError=function(r,n){var i=E(E({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:ce.error,loading:!1});this.updateLastResult(i,n),sn(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);so(ko);function Gc(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 yy(t){__DEV__&&L.error("Unhandled error",t.message,t.stack)}function Kc(t){__DEV__&&t&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var Oo=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=sc(r.resolvers,n)}):this.resolvers=sc(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 Rt(this,void 0,void 0,function(){return Lt(this,function(u){return r?[2,this.resolveDocument(r,n.data,i,a,this.fragmentMatcher,s).then(function(c){return E(E({},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 zn(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return oc(e)},t.prototype.prepareContext=function(e){var r=this.cache;return E(E({},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={}),Rt(this,void 0,void 0,function(){return Lt(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then(function(a){return E(E({},r),a.exportedVariables)})]:[2,E({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return Ye(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 Xr}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:ac(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),Rt(this,void 0,void 0,function(){var s,u,c,l,d,p,f,h,y,v,b;return Lt(this,function(_){return s=nn(e),u=rn(e),c=en(u),l=this.collectSelectionsToResolve(s,c),d=s.operation,p=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",f=this,h=f.cache,y=f.client,v={fragmentMap:c,context:E(E({},n),{cache:h,client:y}),variables:i,fragmentMatcher:a,defaultOperationType:p,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 Rt(this,void 0,void 0,function(){var a,o,s,u,c,l=this;return Lt(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,u=[n],c=function(p){return Rt(l,void 0,void 0,function(){var f,h;return Lt(this,function(y){return!r&&!i.selectionsToResolve.has(p)?[2]:or(p,s)?yt(p)?[2,this.resolveField(p,r,n,i).then(function(v){var b;typeof v<"u"&&u.push((b={},b[It(p)]=v,b))})]:(tc(p)?f=p:(f=a[p.name.value],__DEV__?L(f,"No fragment named ".concat(p.name.value)):L(f,11)),f&&f.typeCondition&&(h=f.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(f.selectionSet,r,n,i).then(function(v){u.push(v)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(c)).then(function(){return ji(u)})]})})},t.prototype.resolveField=function(e,r,n,i){return Rt(this,void 0,void 0,function(){var a,o,s,u,c,l,d,p,f,h=this;return Lt(this,function(y){return n?(a=i.variables,o=e.name.value,s=It(e),u=o!==s,c=n[s]||n[o],l=Promise.resolve(c),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,p=this.resolvers&&this.resolvers[d],p&&(f=p[u?o:s],f&&(l=Promise.resolve(ri.withValue(this.cache,f,[n,sr(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(g){g.name.value==="export"&&g.arguments&&g.arguments.forEach(function(D){D.name.value==="as"&&D.value.kind==="StringValue"&&(i.exportedVariables[D.value.value]=v)})}),!e.selectionSet||v==null)return v;var S=(_=(b=e.directives)===null||b===void 0?void 0:b.some(function(g){return g.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),Ye(o,{Directive:function(u,c,l,d,p){u.name.value==="client"&&p.forEach(function(f){n(f)&&Ri(f)&&s.add(f)})},FragmentSpread:function(u,c,l,d,p){var f=r[u.name.value];__DEV__?L(f,"No fragment named ".concat(u.name.value)):L(f,12);var h=a(f);h.size>0&&(p.forEach(function(y){n(y)&&Ri(y)&&s.add(y)}),s.add(u),h.forEach(function(y){s.add(y)}))}})}return i.get(o)}return a(e)},t}();var ii=new(Tt?WeakMap:Map);function Hc(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 Xf(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var Ao=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),Hc(n,"evict"),Hc(n,"modify"),Hc(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||ce.loading;return this.variables&&this.networkStatus!==ce.loading&&!be(this.variables,e.variables)&&(r=ce.setVariables),be(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(){Xf(this),this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&be(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&&!be(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():Gc(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;Xf(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(Ar(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=E(E({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return r.setDiff(a)}});(!this.lastWatch||!be(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)&&be(r,n.variables)&&be(e.data,n.result.data))},t.prototype.markResult=function(e,r,n,i){var a=this,o=new st,s=Re(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Re(e.incremental)){var u=co(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&&(Do(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 d=a.getDiffOptions(n.variables),p=l.diff(d);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(p,d),p.complete&&(e.data=p.result)}):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=ce.ready},t.prototype.markError=function(e){return this.networkStatus=ce.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function Do(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",n=!Yn(t);return!n&&r&&t.data&&(n=!0),n}var gy=Object.prototype.hasOwnProperty,ep=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,p=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Tt?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=p||new Oo({cache:r}),this.ssrMode=c,this.assumeImmutableResults=!!f,(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 z("QueryManager stopped while query was in flight"):new z(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,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,p=e.update,f=e.onQueryUpdated,h=e.fetchPolicy,y=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 Rt(this,void 0,void 0,function(){var g,D,N,T,C,F;return Lt(this,function(R){switch(R.label){case 0:return __DEV__?L(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):L(i,15),__DEV__?L(y==="network-only"||y==="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."):L(y==="network-only"||y==="no-cache",16),g=this.generateMutationId(),D=this.transform(i),N=D.document,T=D.hasClientExports,i=this.cache.transformForLink(N),a=this.getVariables(i,a),T?[4,this.localState.addExportedVariables(i,a,S)]:[3,2];case 1:a=R.sent(),R.label=2;case 2:return C=this.mutationStore&&(this.mutationStore[g]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:g,document:i,variables:a,fetchPolicy:y,errorPolicy:b,context:S,updateQueries:s,update:p,keepRootFields:_}),this.broadcastQueries(),F=this,[2,new Promise(function(M,Ve){return oo(F.getObservableFromLink(i,E(E({},S),{optimisticResponse:o}),a,!1),function(Pe){if(Yn(Pe)&&b==="none")throw new cr({graphQLErrors:uo(Pe)});C&&(C.loading=!1,C.error=null);var V=E({},Pe);return typeof c=="function"&&(c=c(V)),b==="ignore"&&Yn(V)&&delete V.errors,F.markMutationResult({mutationId:g,result:V,document:i,variables:a,fetchPolicy:y,errorPolicy:b,context:S,update:p,updateQueries:s,awaitRefetchQueries:d,refetchQueries:c,removeOptimistic:o?g:void 0,onQueryUpdated:f,keepRootFields:_})}).subscribe({next:function(Pe){F.broadcastQueries(),(!("hasNext"in Pe)||Pe.hasNext===!1)&&M(Pe)},error:function(Pe){C&&(C.loading=!1,C.error=Pe),o&&F.cache.removeOptimistic(g),F.broadcastQueries(),Ve(Pe instanceof cr?Pe:new cr({networkError:Pe}))}})})]}})})},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&&Do(i,e.errorPolicy)){if(xr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),xr(i)&&Re(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=co(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,p){var f=d.observableQuery,h=f&&f.queryName;if(!(!h||!gy.call(c,h))){var y=c[h],v=n.queries.get(p),b=v.document,_=v.variables,S=r.diff({query:b,variables:_,returnPartialData:!0,optimistic:!1}),g=S.result,D=S.complete;if(D&&g){var N=y(g,{mutationResult:i,queryName:b&&Gn(b)||void 0,queryVariables:_});N&&a.push({result:N,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(y){return d.write(y)});var p=e.update,f=!Fl(i)||xr(i)&&!i.hasNext;if(p){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=E(E({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}f&&p(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&f&&d.modify({id:"ROOT_MUTATION",fields:function(y,v){var b=v.fieldName,_=v.DELETE;return b==="__typename"?y:_}})},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(E(E({},r),{result:{data:i}}),a)}catch(o){__DEV__&&L.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=ic(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:Ys(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:an(zt(n)),asQuery:E(E({},n),{definitions:n.definitions.map(function(c){return c.kind==="OperationDefinition"&&c.operation!=="query"?E(E({},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 E(E({},this.transform(e).defaultVars),r)},t.prototype.watchQuery=function(e){e=E(E({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var r=new Ao(this),n=new ko({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__?L(e.query,"query option is required. You must specify your GraphQL document in the query option."):L(e.query,17),__DEV__?L(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):L(e.query.kind==="Document",18),__DEV__?L(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):L(!e.returnPartialData,19),__DEV__?L(!e.pollInterval,"pollInterval option only supported on watchQuery."):L(!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 z("Store reset while query was in flight (not completed in link chain)"):new z(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=ce.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):Xs(o)?i.set(r.transform(o).document,!1):ie(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=Bi("legacyOneTimeQuery"),u=r.getQuery(s).init({document:o.query,variables:o.variables}),c=new ko({queryManager:r,queryInfo:u,options:E(E({},o),{fetchPolicy:"network-only"})});L(c.queryId===s),u.setObservableQuery(c),n.set(s,c)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&L.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(p){if(i!=="no-cache"&&(Do(p,a)&&r.cache.write({query:n,result:p.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),r.broadcastQueries()),Yn(p))throw new cr({graphQLErrors:p.errors});return p})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,u).then(c);return new X(function(d){var p=null;return l.then(function(f){return p=f.subscribe(d)},d.error),function(){return p&&p.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,p={query:u,variables:n,operationName:Gn(u)||void 0,context:this.prepareContext(E(E({},r),{forceFetch:!i}))};if(r=p.context,i){var f=l.get(u)||new Map;l.set(u,f);var h=gt(n);if(s=f.get(h),!s){var y=new Jn([Zn(d,p)]);f.set(h,s=y),y.beforeNext(function(){f.delete(h)&&f.size<1&&l.delete(u)})}}else s=new Jn([Zn(d,p)])}else s=new Jn([X.of({data:{}})]),r=this.prepareContext(r);var v=this.transform(e).clientQuery;return v&&(s=oo(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 oo(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 cr({graphQLErrors:s}));e.markResult(o,a,n,r),e.markReady()}var c={data:o.data,loading:!1,networkStatus:ce.ready};return u&&n.errorPolicy!=="ignore"&&(c.errors=s,c.networkStatus=ce.error),c},function(o){var s=Zf(o)?o:new cr({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,n){var i=this;n===void 0&&(n=ce.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,p=d===void 0?u&&u.errorPolicy||"none":d,f=r.returnPartialData,h=f===void 0?!1:f,y=r.notifyOnNetworkStatusChange,v=y===void 0?!1:y,b=r.context,_=b===void 0?{}:b,S=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:p,returnPartialData:h,notifyOnNetworkStatusChange:v,context:_}),g=function(T){S.variables=T;var C=i.fetchQueryByPolicy(s,S,n);return S.fetchPolicy!=="standby"&&C.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),C},D=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(T){D(),setTimeout(function(){return N.cancel(T)})});var N=new Jn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(g):g(S.variables));return N.promise.then(D,D),N},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?Bi("refetchQueries"):void 0:s,c=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(p,f){l.set(f,{oq:p,lastDiff:r.getQuery(f).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&u||!1,removeOptimistic:u,onWatchUpdated:function(p,f,h){var y=p.watcher instanceof Ao&&p.watcher.observableQuery;if(y){if(c){l.delete(y.queryId);var v=c(y,f,h);return v===!0&&(v=y.refetch()),v!==!1&&d.set(y,v),v}c!==null&&l.set(y.queryId,{oq:y,lastDiff:h,diff:f})}}}),l.size&&l.forEach(function(p,f){var h=p.oq,y=p.lastDiff,v=p.diff,b;if(c){if(!v){var _=h.queryInfo;_.reset(),v=_.getDiff()}b=c(h,v,y)}(!c||b===!0)&&(b=h.refetch()),b!==!1&&d.set(h,b),f.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(f)}),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,p=r.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},y=function(g,D){D===void 0&&(D=e.networkStatus||ce.loading);var N=g.result;__DEV__&&!l&&!be(N,{})&&Kc(g.missing);var T=function(C){return X.of(E({data:C,loading:Ar(D),networkStatus:D},g.complete?null:{partial:!0}))};return N&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:N},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(C){return T(C.data||void 0)}):c==="none"&&D===ce.refetch&&Array.isArray(g.missing)?T(void 0):T(N)},v=s==="no-cache"?0:n===ce.refetch&&u!=="merge"?1:2,b=function(){return i.getResultsFromLink(e,v,{variables:o,context:d,fetchPolicy:s,errorPolicy:c})},_=p&&typeof f=="number"&&f!==n&&Ar(n);switch(s){default:case"cache-first":{var S=h();return S.complete?[y(S,e.markReady())]:l||_?[y(S),b()]:[b()]}case"cache-and-network":{var S=h();return S.complete||l||_?[y(S),b()]:[b()]}case"cache-only":return[y(h(),e.markReady())];case"network-only":return _?[y(h()),b()]:[b()];case"no-cache":return _?[y(e.getDiff()),b()]:[b()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Ao(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return E(E({},r),{clientAwareness:this.clientAwareness})},t}();var tp=!1;var No=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,p=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,f=e.queryDeduplication,h=f===void 0?!0:f,y=e.defaultOptions,v=e.assumeImmutableResults,b=v===void 0?!1:v,_=e.resolvers,S=e.typeDefs,g=e.fragmentMatcher,D=e.name,N=e.version,T=e.link;if(T||(T=n?new xc({uri:n,credentials:i,headers:a}):kt.empty()),!o)throw __DEV__?new z(`To initialize Apollo Client, you must specify a 'cache' property in the options object.
|
|
51
|
+
For more information, please visit: https://go.apollo.dev/c/docs`):new z(9);if(this.link=T,this.cache=o,this.disableNetworkFetches=u||l>0,this.queryDeduplication=h,this.defaultOptions=y||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),p&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!tp&&p&&__DEV__&&(tp=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var C=window.navigator,F=C&&C.userAgent,R=void 0;typeof F=="string"&&(F.indexOf("Chrome/")>-1?R="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":F.indexOf("Firefox/")>-1&&(R="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),R&&__DEV__&&L.log("Download the Apollo DevTools for a better development experience: "+R)}this.version=Ul,this.localState=new Oo({cache:o,client:this,resolvers:_,fragmentMatcher:g}),this.queryManager=new ep({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:u,clientAwareness:{name:D,version:N},localState:this.localState,assumeImmutableResults:b,onBroadcast:p?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=Vi(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(e){return this.defaultOptions.query&&(e=Vi(this.defaultOptions.query,e)),__DEV__?L(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."):L(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Vi(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 Zn(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__&&L.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}();pl(Zr?"log":"silent");function et(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function ur(t){return et(t)==="object"}function rp(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function Jc(t,e){return t.length<124?t:e}var np="graphql-transport-ws";var ct;(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"})(ct||(ct={}));var ke;(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"})(ke||(ke={}));function ip(t){if(!ur(t))throw new Error(`Message is expected to be an object, but got ${et(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 ${et(t.type)}`);switch(t.type){case ke.ConnectionInit:case ke.ConnectionAck:case ke.Ping:case ke.Pong:{if(t.payload!=null&&!ur(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 ke.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${et(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ur(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${et(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 ${et(t.payload.query)}`);if(t.payload.variables!=null&&!ur(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 ${et(t.payload.variables)}`);if(t.payload.operationName!=null&&et(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 ${et(t.payload.operationName)}`);if(t.payload.extensions!=null&&!ur(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 ${et(t.payload.extensions)}`);break}case ke.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${et(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ur(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${et(t.payload)}`);break}case ke.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${et(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!rp(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 ke.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${et(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 ap(t,e){return ip(typeof t=="string"?JSON.parse(t,e):t)}function ai(t,e){return ip(t),JSON.stringify(t,e)}function Yc(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(me){let ye=1e3;for(let re=0;re<me;re++)ye*=2;await new Promise(re=>setTimeout(re,ye+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Co,isFatalConnectionProblem:p,on:f,webSocketImpl:h,generateID:y=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,me=>{let ye=Math.random()*16|0;return(me=="x"?ye:ye&3|8).toString(16)})},jsonMessageReplacer:v,jsonMessageReviver:b}=t,_;if(h){if(!by(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=_,g=(()=>{let V=(()=>{let ye={};return{on(re,ne){return ye[re]=ne,()=>{delete ye[re]}},emit(re){var ne;"id"in re&&((ne=ye[re.id])===null||ne===void 0||ne.call(ye,re))}}})(),me={connecting:f?.connecting?[f.connecting]:[],opened:f?.opened?[f.opened]:[],connected:f?.connected?[f.connected]:[],ping:f?.ping?[f.ping]:[],pong:f?.pong?[f.pong]:[],message:f?.message?[V.emit,f.message]:[V.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:V.on,on(ye,re){let ne=me[ye];return ne.push(re),()=>{ne.splice(ne.indexOf(re),1)}},emit(ye,...re){for(let ne of[...me[ye]])ne(...re)}}})();function D(V){let me=[g.on("error",ye=>{me.forEach(re=>re()),V(ye)}),g.on("closed",ye=>{me.forEach(re=>re()),V(ye)})]}let N,T=0,C,F=!1,R=0,M=!1;async function Ve(){clearTimeout(C);let[V,me]=await(N??(N=new Promise((ne,qt)=>(async()=>{if(F){if(await l(R),!T)return N=void 0,qt({code:1e3,reason:"All Subscriptions Gone"});R++}g.emit("connecting");let Z=new S(typeof e=="function"?await e():e,np),Bt,br;function Ka(){isFinite(o)&&o>0&&(clearTimeout(br),br=setTimeout(()=>{Z.readyState===S.OPEN&&(Z.send(ai({type:ke.Ping})),g.emit("ping",!1,void 0))},o))}D(Qe=>{N=void 0,clearTimeout(Bt),clearTimeout(br),qt(Qe),Co(Qe)&&Qe.code===4499&&(Z.close(4499,"Terminated"),Z.onerror=null,Z.onclose=null)}),Z.onerror=Qe=>g.emit("error",Qe),Z.onclose=Qe=>g.emit("closed",Qe),Z.onopen=async()=>{try{g.emit("opened",Z);let Qe=typeof r=="function"?await r():r;if(Z.readyState!==S.OPEN)return;Z.send(ai(Qe?{type:ke.ConnectionInit,payload:Qe}:{type:ke.ConnectionInit},v)),isFinite(u)&&u>0&&(Bt=setTimeout(()=>{Z.close(ct.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},u)),Ka()}catch(Qe){g.emit("error",Qe),Z.close(ct.InternalClientError,Jc(Qe instanceof Error?Qe.message:new Error(Qe).message,"Internal client error"))}};let Vn=!1;Z.onmessage=({data:Qe})=>{try{let ze=ap(Qe,b);if(g.emit("message",ze),ze.type==="ping"||ze.type==="pong"){g.emit(ze.type,!0,ze.payload),ze.type==="pong"?Ka():s||(Z.send(ai(ze.payload?{type:ke.Pong,payload:ze.payload}:{type:ke.Pong})),g.emit("pong",!1,ze.payload));return}if(Vn)return;if(ze.type!==ke.ConnectionAck)throw new Error(`First message cannot be of type ${ze.type}`);clearTimeout(Bt),Vn=!0,g.emit("connected",Z,ze.payload),F=!1,R=0,ne([Z,new Promise((V_,kh)=>D(kh))])}catch(ze){Z.onmessage=null,g.emit("error",ze),Z.close(ct.BadResponse,Jc(ze instanceof Error?ze.message:new Error(ze).message,"Bad response"))}}})())));V.readyState===S.CLOSING&&await me;let ye=()=>{},re=new Promise(ne=>ye=ne);return[V,ye,Promise.race([re.then(()=>{if(!T){let ne=()=>V.close(1e3,"Normal Closure");isFinite(a)&&a>0?C=setTimeout(()=>{V.readyState===S.OPEN&&ne()},a):ne()}}),me])]}function Pe(V){if(Co(V)&&(vy(V.code)||[ct.InternalServerError,ct.InternalClientError,ct.BadRequest,ct.BadResponse,ct.Unauthorized,ct.SubprotocolNotAcceptable,ct.SubscriberAlreadyExists,ct.TooManyInitialisationRequests].includes(V.code)))throw V;if(M)return!1;if(Co(V)&&V.code===1e3)return T>0;if(!c||R>=c||!d(V)||p?.(V))throw V;return F=!0}return n||(async()=>{for(T++;;)try{let[,,V]=await Ve();await V}catch(V){try{if(!Pe(V))return}catch(me){return i?.(me)}}})(),{on:g.on,subscribe(V,me){let ye=y(V),re=!1,ne=!1,qt=()=>{T--,re=!0};return(async()=>{for(T++;;)try{let[Z,Bt,br]=await Ve();if(re)return Bt();let Ka=g.onMessage(ye,Vn=>{switch(Vn.type){case ke.Next:{me.next(Vn.payload);return}case ke.Error:{ne=!0,re=!0,me.error(Vn.payload),qt();return}case ke.Complete:{re=!0,qt();return}}});Z.send(ai({id:ye,type:ke.Subscribe,payload:V},v)),qt=()=>{!re&&Z.readyState===S.OPEN&&Z.send(ai({id:ye,type:ke.Complete},v)),T--,re=!0,Bt()},await br.finally(Ka);return}catch(Z){if(!Pe(Z))return}})().then(()=>{ne||me.complete()}).catch(Z=>{me.error(Z)}),()=>{re||qt()}},async dispose(){if(M=!0,N){let[V]=await N;V.close(1e3,"Normal Closure")}},terminate(){N&&g.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Co(t){return ur(t)&&"code"in t&&"reason"in t}function vy(t){return[1e3,1001,1006,1005,1012,1013,1013].includes(t)?!1:t>=1e3&&t<=1999}function by(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function _y(t){return ie(t)&&"code"in t&&"reason"in t}var Zc=function(t){Ie(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(E(E({},r),{query:Qn(r.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):_y(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new cr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(kt);var ls=function(){return ls=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},ls.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Wo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wo=function(r){return typeof r}:Wo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Wo(t)}function Sy(t){return Wo(t)=="object"&&t!==null}var xd=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function bu(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 wy(t){return Id(t.source,bu(t.source,t.start))}function Id(t,e){var r=t.locationOffset.column-1,n=Go(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,`
|
|
52
|
+
`),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var p=Math.floor(u/80),f=u%80,h=[],y=0;y<d.length;y+=80)h.push(d.slice(y,y+80));return c+op([["".concat(o),h[0]]].concat(h.slice(1,p+1).map(function(v){return["",v]}),[[" ",Go(f-1)+"^"],["",h[p+1]]]))}return c+op([["".concat(o-1),l[i-1]],["".concat(o),d],["",Go(u-1)+"^"],["".concat(o+1),l[i+1]]])}function op(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 Ey(r,i)+(a?" | "+a:" |")}).join(`
|
|
53
|
+
`)}function Go(t){return Array(t+1).join(" ")}function Ey(t,e){return Go(t-e.length)+e}function Ko(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ko=function(r){return typeof r}:Ko=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Ko(t)}function sp(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 xy(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?sp(Object(r),!0).forEach(function(n){Iy(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):sp(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Iy(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Ty(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function cp(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 ky(t,e,r){return e&&cp(t.prototype,e),r&&cp(t,r),t}function Oy(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=kd();return function(){var n=Ia(t),i;if(e){var a=Ia(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Td(this,i)}}function Td(t,e){return e&&(Ko(e)==="object"||typeof e=="function")?e:ra(t)}function ra(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function _u(t){var e=typeof Map=="function"?new Map:void 0;return _u=function(n){if(n===null||!Dy(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 Ho(n,arguments,Ia(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),xa(i,n)},_u(t)}function Ho(t,e,r){return kd()?Ho=Reflect.construct:Ho=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},Ho.apply(null,arguments)}function kd(){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 Dy(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 Ia(t){return Ia=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Ia(t)}var Ny=function(t){Oy(r,t);var e=Ay(r);function r(n,i,a,o,s,u,c){var l,d,p,f;Ty(this,r),f=e.call(this,n),f.name="GraphQLError",f.originalError=u??void 0,f.nodes=up(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],y=0,v=(b=f.nodes)!==null&&b!==void 0?b:[];y<v.length;y++){var b,_=v[y],S=_.loc;S!=null&&h.push(S)}h=up(h),f.source=a??((l=h)===null||l===void 0?void 0:l[0].source),f.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(D){return D.start})),f.locations=o&&a?o.map(function(D){return bu(a,D)}):(p=h)===null||p===void 0?void 0:p.map(function(D){return bu(D.source,D.start)}),f.path=s??void 0;var g=u?.extensions;return c==null&&Sy(g)?f.extensions=xy({},g):f.extensions=c??{},Object.defineProperties(ra(f),{message:{enumerable:!0},locations:{enumerable:f.locations!=null},path:{enumerable:f.path!=null},extensions:{enumerable:f.extensions!=null&&Object.keys(f.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),u!=null&&u.stack?(Object.defineProperty(ra(f),"stack",{value:u.stack,writable:!0,configurable:!0}),Td(f)):(Error.captureStackTrace?Error.captureStackTrace(ra(f),r):Object.defineProperty(ra(f),"stack",{value:Error().stack,writable:!0,configurable:!0}),f)}return ky(r,[{key:"toString",value:function(){return Cy(this)}},{key:xd,get:function(){return"Object"}}]),r}(_u(Error));function up(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+=`
|
|
54
54
|
|
|
55
|
-
`+
|
|
55
|
+
`+wy(i.loc))}else if(t.source&&t.locations)for(var a=0,o=t.locations;a<o.length;a++){var s=o[a];e+=`
|
|
56
56
|
|
|
57
|
-
`+
|
|
58
|
-
`)}function
|
|
59
|
-
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var l=Xy(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var d=a.slice(o+1,o+5);throw bt(t,o,"Invalid character escape sequence: \\u".concat(d,"."))}c+=String.fromCharCode(l),o+=4;break}default:throw bt(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(u),"."))}++o,s=o}}throw bt(t,o,"Unterminated string.")}function Zy(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 Ae(A.BLOCK_STRING,e,s+3,r,n,i,Vy(l));if(c<32&&c!==9&&c!==10&&c!==13)throw bt(t,s,"Invalid character within String: ".concat(xn(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 bt(t,s,"Unterminated string.")}function Xy(t,e,r,n){return ko(t)<<12|ko(e)<<8|ko(r)<<4|ko(n)}function ko(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function eg(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 Ae(A.NAME,e,s,r,n,i,a.slice(e,s))}function tg(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function rg(t,e){var r=new ng(t,e);return r.parseDocument()}var ng=function(){function t(r,n){var i=qy(r)?r:new Od(r);this._lexer=new zy(i),this._options=n}var e=t.prototype;return e.parseName=function(){var n=this.expectToken(A.NAME);return{kind:B.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:B.DOCUMENT,definitions:this.many(A.SOF,this.parseDefinition,A.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(A.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(A.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(A.BRACE_L))return{kind:B.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(A.NAME)&&(a=this.parseName()),{kind:B.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(A.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(A.PAREN_L,this.parseVariableDefinition,A.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:B.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(A.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(A.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(A.DOLLAR),{kind:B.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:B.SELECTION_SET,selections:this.many(A.BRACE_L,this.parseSelection,A.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(A.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(A.COLON)?(a=i,o=this.parseName()):o=i,{kind:B.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(A.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(A.PAREN_L,i,A.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(A.COLON),{kind:B.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:B.ARGUMENT,name:this.parseName(),value:(this.expectToken(A.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(A.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(A.NAME)?{kind:B.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:B.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:B.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:B.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 A.BRACKET_L:return this.parseList(n);case A.BRACE_L:return this.parseObject(n);case A.INT:return this._lexer.advance(),{kind:B.INT,value:i.value,loc:this.loc(i)};case A.FLOAT:return this._lexer.advance(),{kind:B.FLOAT,value:i.value,loc:this.loc(i)};case A.STRING:case A.BLOCK_STRING:return this.parseStringLiteral();case A.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:B.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:B.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:B.NULL,loc:this.loc(i)};default:return{kind:B.ENUM,value:i.value,loc:this.loc(i)}}case A.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:B.STRING,value:n.value,block:n.kind===A.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:B.LIST,values:this.any(A.BRACKET_L,o,A.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:B.OBJECT,fields:this.any(A.BRACE_L,o,A.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(A.COLON),{kind:B.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(A.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(A.AT),{kind:B.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(A.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(A.BRACKET_R),i={kind:B.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(A.BANG)?{kind:B.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:B.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===A.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(A.STRING)||this.peek(A.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(A.BRACE_L,this.parseOperationTypeDefinition,A.BRACE_R);return{kind:B.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(A.COLON);var a=this.parseNamedType();return{kind:B.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:B.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:B.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(A.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(A.AMP)||this.peek(A.NAME));return i}return this.delimitedMany(A.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(A.BRACE_L)&&this._lexer.lookahead().kind===A.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(A.BRACE_L,this.parseFieldDefinition,A.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(A.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:B.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:u,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(A.PAREN_L,this.parseInputValueDef,A.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(A.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(A.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:B.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:B.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:B.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(A.EQUALS)?this.delimitedMany(A.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:B.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(A.BRACE_L,this.parseEnumValueDefinition,A.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:B.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:B.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(A.BRACE_L,this.parseInputValueDef,A.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===A.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(A.BRACE_L,this.parseOperationTypeDefinition,A.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:B.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:B.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:B.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:B.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:B.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:B.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:B.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(A.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:B.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(A.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 Td(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 bt(this._lexer.source,i.start,"Expected ".concat(Ad(n),", found ").concat(Jc(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===A.NAME&&i.value===n)this._lexer.advance();else throw bt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(Jc(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===A.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return bt(this._lexer.source,i.start,"Unexpected ".concat(Jc(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 Jc(t){var e=t.value;return Ad(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function Ad(t){return Wy(t)?'"'.concat(t,'"'):t}var zo=new Map,gu=new Map,Dd=!0,as=!1;function Nd(t){return t.replace(/[\s,]+/g," ").trim()}function ig(t){return Nd(t.source.body.substring(t.start,t.end))}function ag(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=ig(n.loc),o=gu.get(i);o&&!o.has(a)?Dd&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
57
|
+
`+Id(t.source,s)}return e}function bt(t,e,r){return new Ny("Syntax Error: ".concat(r),void 0,t,[e])}var B=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function Py(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Ry=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Su=Ry;function Od(t){var e=t.prototype.toJSON;typeof e=="function"||Py(0),t.prototype.inspect=e,Su&&(t.prototype[Su]=e)}var Ad=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}();Od(Ad);var Ae=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}();Od(Ae);var A=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 Jo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jo=function(r){return typeof r}:Jo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Jo(t)}var Ly=10,Dd=2;function Fy(t){return Rs(t,[])}function Rs(t,e){switch(Jo(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":$y(t,e);default:return String(t)}}function $y(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Uy(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Rs(i,r)}else if(Array.isArray(t))return jy(t,r);return My(t,r)}function My(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Dd)return"["+qy(t)+"]";var n=r.map(function(i){var a=Rs(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function jy(t,e){if(t.length===0)return"[]";if(e.length>Dd)return"[Array]";for(var r=Math.min(Ly,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(Rs(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Uy(t){var e=t[String(Su)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function qy(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 Xc(t,e){var r=Boolean(t);if(!r)throw new Error(e)}var By=function(e,r){return e instanceof r};function lp(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&&lp(t.prototype,e),r&&lp(t,r),t}var Nd=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"||Xc(0,"Body must be a string. Received: ".concat(Fy(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Xc(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Xc(0,"column in locationOffset is 1-indexed and must be positive.")}return Vy(t,[{key:xd,get:function(){return"Source"}}]),t}();function Qy(t){return By(t,Nd)}var zy=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 Wy(t){var e=t.split(/\r\n|[\n\r]/g),r=Gy(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&&fp(e[i]);)++i;for(var a=e.length;a>i&&fp(e[a-1]);)--a;return e.slice(i,a).join(`
|
|
58
|
+
`)}function fp(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Gy(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 Ky=function(){function t(r){var n=new Ae(A.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!==A.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=Jy(this,n)}while(n.kind===A.COMMENT);return n},t}();function Hy(t){return t===A.BANG||t===A.DOLLAR||t===A.AMP||t===A.PAREN_L||t===A.PAREN_R||t===A.SPREAD||t===A.COLON||t===A.EQUALS||t===A.AT||t===A.BRACKET_L||t===A.BRACKET_R||t===A.BRACE_L||t===A.PIPE||t===A.BRACE_R}function In(t){return isNaN(t)?A.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function Jy(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 Ae(A.BANG,a,a+1,s,u,e);case 35:return Zy(r,a,s,u,e);case 36:return new Ae(A.DOLLAR,a,a+1,s,u,e);case 38:return new Ae(A.AMP,a,a+1,s,u,e);case 40:return new Ae(A.PAREN_L,a,a+1,s,u,e);case 41:return new Ae(A.PAREN_R,a,a+1,s,u,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Ae(A.SPREAD,a,a+3,s,u,e);break;case 58:return new Ae(A.COLON,a,a+1,s,u,e);case 61:return new Ae(A.EQUALS,a,a+1,s,u,e);case 64:return new Ae(A.AT,a,a+1,s,u,e);case 91:return new Ae(A.BRACKET_L,a,a+1,s,u,e);case 93:return new Ae(A.BRACKET_R,a,a+1,s,u,e);case 123:return new Ae(A.BRACE_L,a,a+1,s,u,e);case 124:return new Ae(A.PIPE,a,a+1,s,u,e);case 125:return new Ae(A.BRACE_R,a,a+1,s,u,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?tg(r,a,s,u,e,t):eg(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 Xy(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 ng(r,a,s,u,e)}throw bt(r,a,Yy(o))}var c=t.line,l=1+a-t.lineStart;return new Ae(A.EOF,i,i,c,l,e)}function Yy(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(In(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(In(t),".")}function Zy(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 Ae(A.COMMENT,e,s,r,n,i,a.slice(e+1,s))}function Xy(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 bt(t,u,"Invalid number, unexpected digit after 0: ".concat(In(s),"."))}else u=eu(t,u,s),s=o.charCodeAt(u);if(s===46&&(c=!0,s=o.charCodeAt(++u),u=eu(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=eu(t,u,s),s=o.charCodeAt(u)),s===46||ig(s))throw bt(t,u,"Invalid number, expected digit but got: ".concat(In(s),"."));return new Ae(c?A.FLOAT:A.INT,e,u,n,i,a,o.slice(e,u))}function eu(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 bt(t,i,"Invalid number, expected digit but got: ".concat(In(a),"."))}function eg(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 Ae(A.STRING,e,o+1,r,n,i,c);if(u<32&&u!==9)throw bt(t,o,"Invalid character within String: ".concat(In(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+=`
|
|
59
|
+
`;break;case 114:c+="\r";break;case 116:c+=" ";break;case 117:{var l=rg(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 bt(t,o,"Invalid character escape sequence: \\u".concat(d,"."))}c+=String.fromCharCode(l),o+=4;break}default:throw bt(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(u),"."))}++o,s=o}}throw bt(t,o,"Unterminated string.")}function tg(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 Ae(A.BLOCK_STRING,e,s+3,r,n,i,Wy(l));if(c<32&&c!==9&&c!==10&&c!==13)throw bt(t,s,"Invalid character within String: ".concat(In(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 bt(t,s,"Unterminated string.")}function rg(t,e,r,n){return Po(t)<<12|Po(e)<<8|Po(r)<<4|Po(n)}function Po(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function ng(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 Ae(A.NAME,e,s,r,n,i,a.slice(e,s))}function ig(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function ag(t,e){var r=new og(t,e);return r.parseDocument()}var og=function(){function t(r,n){var i=Qy(r)?r:new Nd(r);this._lexer=new Ky(i),this._options=n}var e=t.prototype;return e.parseName=function(){var n=this.expectToken(A.NAME);return{kind:B.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:B.DOCUMENT,definitions:this.many(A.SOF,this.parseDefinition,A.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(A.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(A.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(A.BRACE_L))return{kind:B.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(A.NAME)&&(a=this.parseName()),{kind:B.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(A.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(A.PAREN_L,this.parseVariableDefinition,A.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:B.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(A.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(A.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(A.DOLLAR),{kind:B.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:B.SELECTION_SET,selections:this.many(A.BRACE_L,this.parseSelection,A.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(A.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(A.COLON)?(a=i,o=this.parseName()):o=i,{kind:B.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(A.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(A.PAREN_L,i,A.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(A.COLON),{kind:B.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:B.ARGUMENT,name:this.parseName(),value:(this.expectToken(A.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(A.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(A.NAME)?{kind:B.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:B.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:B.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:B.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 A.BRACKET_L:return this.parseList(n);case A.BRACE_L:return this.parseObject(n);case A.INT:return this._lexer.advance(),{kind:B.INT,value:i.value,loc:this.loc(i)};case A.FLOAT:return this._lexer.advance(),{kind:B.FLOAT,value:i.value,loc:this.loc(i)};case A.STRING:case A.BLOCK_STRING:return this.parseStringLiteral();case A.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:B.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:B.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:B.NULL,loc:this.loc(i)};default:return{kind:B.ENUM,value:i.value,loc:this.loc(i)}}case A.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:B.STRING,value:n.value,block:n.kind===A.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:B.LIST,values:this.any(A.BRACKET_L,o,A.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:B.OBJECT,fields:this.any(A.BRACE_L,o,A.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(A.COLON),{kind:B.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(A.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(A.AT),{kind:B.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(A.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(A.BRACKET_R),i={kind:B.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(A.BANG)?{kind:B.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:B.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===A.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(A.STRING)||this.peek(A.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(A.BRACE_L,this.parseOperationTypeDefinition,A.BRACE_R);return{kind:B.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(A.COLON);var a=this.parseNamedType();return{kind:B.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:B.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:B.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(A.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(A.AMP)||this.peek(A.NAME));return i}return this.delimitedMany(A.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(A.BRACE_L)&&this._lexer.lookahead().kind===A.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(A.BRACE_L,this.parseFieldDefinition,A.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(A.COLON);var s=this.parseTypeReference(),u=this.parseDirectives(!0);return{kind:B.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:u,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(A.PAREN_L,this.parseInputValueDef,A.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(A.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(A.EQUALS)&&(s=this.parseValueLiteral(!0));var u=this.parseDirectives(!0);return{kind:B.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:B.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:B.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(A.EQUALS)?this.delimitedMany(A.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:B.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(A.BRACE_L,this.parseEnumValueDefinition,A.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:B.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:B.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(A.BRACE_L,this.parseInputValueDef,A.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===A.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(A.BRACE_L,this.parseOperationTypeDefinition,A.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:B.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:B.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:B.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:B.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:B.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:B.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:B.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(A.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var u=this.parseDirectiveLocations();return{kind:B.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:u,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(A.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(zy[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 Ad(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 bt(this._lexer.source,i.start,"Expected ".concat(Cd(n),", found ").concat(tu(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===A.NAME&&i.value===n)this._lexer.advance();else throw bt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(tu(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===A.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return bt(this._lexer.source,i.start,"Unexpected ".concat(tu(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 tu(t){var e=t.value;return Cd(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function Cd(t){return Hy(t)?'"'.concat(t,'"'):t}var Yo=new Map,wu=new Map,Pd=!0,fs=!1;function Rd(t){return t.replace(/[\s,]+/g," ").trim()}function sg(t){return Rd(t.source.body.substring(t.start,t.end))}function cg(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=sg(n.loc),o=wu.get(i);o&&!o.has(a)?Pd&&console.warn("Warning: fragment with name "+i+` already exists.
|
|
60
60
|
graphql-tag enforces all fragment names across your application to be unique; read more about
|
|
61
|
-
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||gu.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),is(is({},t),{definitions:r})}function og(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 sg(t){var e=Nd(t);if(!zo.has(e)){var r=rg(t,{experimentalFragmentVariables:as,allowLegacyFragmentVariables:as});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");zo.set(e,og(ag(r)))}return zo.get(e)}function I(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]}),sg(n)}function cg(){zo.clear(),gu.clear()}function ug(){Dd=!1}function lg(){as=!0}function fg(){as=!1}var Ji={gql:I,resetCaches:cg,disableFragmentWarnings:ug,enableExperimentalFragmentVariables:lg,disableExperimentalFragmentVariables:fg};(function(t){t.gql=Ji.gql,t.resetCaches=Ji.resetCaches,t.disableFragmentWarnings=Ji.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Ji.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Ji.disableExperimentalFragmentVariables})(I||(I={}));I.default=I;function O(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 pg(){}function Hr(){return pg}var de=Hr,m=Hr,Be=Hr,$e=Hr,W=Hr,Ut=Hr,dg=Hr,qu=Hr,Pd=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},Cd=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},In=class{constructor(e){this.code=e}};Pd([m(),Cd("design:type",String)],In.prototype,"code",void 0);In=Pd([W(),Cd("design:paramtypes",[String])],In);var Bu=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},Vu=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},er=class{constructor(e,r){this.address=e,this.name=r}};Bu([m(),Vu("design:type",String)],er.prototype,"address",void 0);Bu([m(),Vu("design:type",String)],er.prototype,"name",void 0);er=Bu([W(),Vu("design:paramtypes",[String,String])],er);var Se=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},Fe=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},gr=class{constructor(e,r){this.key=r,this.signature=e}};Se([m(),Fe("design:type",String)],gr.prototype,"signature",void 0);Se([m(),Fe("design:type",String)],gr.prototype,"key",void 0);Se([m(),Fe("design:type",Boolean)],gr.prototype,"valid",void 0);Se([m(),Fe("design:type",Boolean)],gr.prototype,"invalid",void 0);gr=Se([W(),Be(),Fe("design:paramtypes",[String,String])],gr);var Tn=class{};Se([m(),Fe("design:type",String)],Tn.prototype,"signature",void 0);Se([m(),Fe("design:type",String)],Tn.prototype,"key",void 0);Se([m(),Fe("design:type",Boolean)],Tn.prototype,"valid",void 0);Se([m(),Fe("design:type",Boolean)],Tn.prototype,"invalid",void 0);Tn=Se([Be()],Tn);function Jr(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Se([m(),Fe("design:type",String)],e.prototype,"author",void 0),Se([m(),Fe("design:type",String)],e.prototype,"timestamp",void 0),Se([m(),Fe("design:type",Object)],e.prototype,"data",void 0),Se([m(),Fe("design:type",gr)],e.prototype,"proof",void 0),e=Se([W(),Fe("design:paramtypes",[String,String,Object,gr])],e),e}function hg(t){let e=class{};return Se([m(),Fe("design:type",String)],e.prototype,"author",void 0),Se([m(),Fe("design:type",String)],e.prototype,"timestamp",void 0),Se([m(),Fe("design:type",Object)],e.prototype,"data",void 0),Se([m(),Fe("design:type",Tn)],e.prototype,"proof",void 0),e=Se([Be()],e),e}var up=class extends Jr(){};up=Se([W()],up);var os=class extends Jr(){};Se([m(),Fe("design:type",er)],os.prototype,"language",void 0);Se([m(),Fe("design:type",In)],os.prototype,"icon",void 0);os=Se([W()],os);function _T(t){return t&&t.author&&t.timestamp&&t.data}var Ne=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},He=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:""}};Ne([m(),He("design:type",String)],kn.prototype,"source",void 0);Ne([m(),He("design:type",String)],kn.prototype,"target",void 0);Ne([m(),He("design:type",String)],kn.prototype,"predicate",void 0);kn=Ne([W(),He("design:paramtypes",[Object])],kn);var ss=class{};Ne([m(),He("design:type",Array)],ss.prototype,"additions",void 0);Ne([m(),He("design:type",Array)],ss.prototype,"removals",void 0);ss=Ne([Be()],ss);var cs=class{constructor(e,r){this.additions=e,this.removals=r}};Ne([m(),He("design:type",Array)],cs.prototype,"additions",void 0);Ne([m(),He("design:type",Array)],cs.prototype,"removals",void 0);cs=Ne([W(),He("design:paramtypes",[Array,Array])],cs);var xa=class{};Ne([m(),He("design:type",String)],xa.prototype,"source",void 0);Ne([m(),He("design:type",String)],xa.prototype,"target",void 0);Ne([m(),He("design:type",String)],xa.prototype,"predicate",void 0);xa=Ne([Be()],xa);var Vr=class extends Jr(){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}};Ne([m(),He("design:type",String)],Vr.prototype,"status",void 0);Vr=Ne([W()],Vr);var vu=class extends hg(){};Ne([m(),He("design:type",String)],vu.prototype,"status",void 0);vu=Ne([Be()],vu);function kT(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 OT(t){return t&&t.source&&t.target}var us=class{constructor(e,r){this.oldLink=e,this.newLink=r}};Ne([m(),He("design:type",Vr)],us.prototype,"oldLink",void 0);Ne([m(),He("design:type",Vr)],us.prototype,"newLink",void 0);us=Ne([W(),He("design:paramtypes",[Vr,Vr])],us);var Ln=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},Fa=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},bu,nr=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}};Ln([m(),Fa("design:type",Array)],nr.prototype,"links",void 0);nr=Ln([W(),Fa("design:paramtypes",[Array])],nr);var ls=class{};Ln([m(),Fa("design:type",Array)],ls.prototype,"links",void 0);ls=Ln([Be()],ls);var _u=bu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new bu;return r.links.push(e),r}};Ln([m(),Fa("design:type",Array)],_u.prototype,"links",void 0);_u=bu=Ln([Be(),Fa("design:paramtypes",[Array])],_u);var On=class extends Jr(){};On=Ln([W()],On);var j=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},U=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Mr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new nr}};j([m(),U("design:type",String)],Mr.prototype,"did",void 0);j([m(),U("design:type",nr)],Mr.prototype,"perspective",void 0);j([m(),U("design:type",String)],Mr.prototype,"directMessageLanguage",void 0);Mr=j([W(),U("design:paramtypes",[String,nr])],Mr);var lp=class extends Jr(){};lp=j([W()],lp);var Qr=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}};j([m(),U("design:type",String)],Qr.prototype,"did",void 0);j([m(),U("design:type",String)],Qr.prototype,"didSigningKeyId",void 0);j([m(),U("design:type",String)],Qr.prototype,"deviceKeyType",void 0);j([m(),U("design:type",String)],Qr.prototype,"deviceKey",void 0);j([m(),U("design:type",String)],Qr.prototype,"deviceKeySignedByDid",void 0);j([m(),U("design:type",String)],Qr.prototype,"didSignedByDeviceKey",void 0);Qr=j([W(),U("design:paramtypes",[String,String,String,String,String,String])],Qr);var zr=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}};j([m(),U("design:type",String)],zr.prototype,"did",void 0);j([m(),U("design:type",String)],zr.prototype,"didSigningKeyId",void 0);j([m(),U("design:type",String)],zr.prototype,"deviceKeyType",void 0);j([m(),U("design:type",String)],zr.prototype,"deviceKey",void 0);j([m(),U("design:type",String)],zr.prototype,"deviceKeySignedByDid",void 0);j([m(),U("design:type",String)],zr.prototype,"didSignedByDeviceKey",void 0);zr=j([Be(),U("design:paramtypes",[String,String,String,String,String,String])],zr);var fs=class{constructor(e,r){this.signature=e,this.publicKey=r}};j([m(),U("design:type",String)],fs.prototype,"signature",void 0);j([m(),U("design:type",String)],fs.prototype,"publicKey",void 0);fs=j([W(),U("design:paramtypes",[String,String])],fs);var hi=class{constructor(e,r){this.domain=e,this.pointers=r}};j([m(),U("design:type",String)],hi.prototype,"domain",void 0);j([m(),U("design:type",Array)],hi.prototype,"pointers",void 0);hi=j([W(),U("design:paramtypes",[String,Array])],hi);var ps=class{constructor(e,r){this.with=e,this.can=r}};j([m(),U("design:type",hi)],ps.prototype,"with",void 0);j([m(),U("design:type",Array)],ps.prototype,"can",void 0);ps=j([W(),U("design:paramtypes",[hi,Array])],ps);var vr=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};j([m(),U("design:type",String)],vr.prototype,"appName",void 0);j([m(),U("design:type",String)],vr.prototype,"appDesc",void 0);j([m(),U("design:type",String)],vr.prototype,"appUrl",void 0);j([m(),U("design:type",String)],vr.prototype,"appIconPath",void 0);j([m(),U("design:type",Array)],vr.prototype,"capabilities",void 0);vr=j([W(),U("design:paramtypes",[String,String,String,Array,String])],vr);var mi=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};j([m(),U("design:type",String)],mi.prototype,"requestId",void 0);j([m(),U("design:type",String)],mi.prototype,"token",void 0);j([m(),U("design:type",Boolean)],mi.prototype,"revoked",void 0);j([m(),U("design:type",vr)],mi.prototype,"auth",void 0);mi=j([W(),U("design:paramtypes",[String,vr,String,Boolean])],mi);var yi=class{constructor(e,r){this.domain=e,this.pointers=r}};j([m(),U("design:type",String)],yi.prototype,"domain",void 0);j([m(),U("design:type",Array)],yi.prototype,"pointers",void 0);yi=j([Be(),U("design:paramtypes",[String,Array])],yi);var ds=class{constructor(e,r){this.with=e,this.can=r}};j([m(),U("design:type",yi)],ds.prototype,"with",void 0);j([m(),U("design:type",Array)],ds.prototype,"can",void 0);ds=j([Be(),U("design:paramtypes",[yi,Array])],ds);var Wr=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}};j([m(),U("design:type",String)],Wr.prototype,"appName",void 0);j([m(),U("design:type",String)],Wr.prototype,"appDesc",void 0);j([m(),U("design:type",String)],Wr.prototype,"appDomain",void 0);j([m(),U("design:type",String)],Wr.prototype,"appUrl",void 0);j([m(),U("design:type",String)],Wr.prototype,"appIconPath",void 0);j([m(),U("design:type",Array)],Wr.prototype,"capabilities",void 0);Wr=j([Be(),U("design:paramtypes",[String,String,String,String,String,Array])],Wr);var wi=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},Ei=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},At=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};wi([m(),Ei("design:type",Boolean)],At.prototype,"isInitialized",void 0);wi([m(),Ei("design:type",Boolean)],At.prototype,"isUnlocked",void 0);wi([m(),Ei("design:type",String)],At.prototype,"did",void 0);wi([m(),Ei("design:type",String)],At.prototype,"didDocument",void 0);wi([m(),Ei("design:type",String)],At.prototype,"error",void 0);At=wi([W(),Ei("design:paramtypes",[Object])],At);var fp=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},Oe=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,Su=class{constructor(e,r){ut.set(this,void 0),lt.set(this,void 0),fp(this,ut,e,"f"),fp(this,lt,r,"f")}async otherAgents(){return await Oe(this,ut,"f").otherAgents(Oe(this,lt,"f"))}async hasTelepresenceAdapter(){return await Oe(this,ut,"f").hasTelepresenceAdapter(Oe(this,lt,"f"))}async onlineAgents(){return await Oe(this,ut,"f").onlineAgents(Oe(this,lt,"f"))}async setOnlineStatus(e){return await Oe(this,ut,"f").setOnlineStatus(Oe(this,lt,"f"),e)}async setOnlineStatusU(e){return await Oe(this,ut,"f").setOnlineStatusU(Oe(this,lt,"f"),e)}async sendSignal(e,r){return await Oe(this,ut,"f").sendSignal(Oe(this,lt,"f"),e,r)}async sendSignalU(e,r){return await Oe(this,ut,"f").sendSignalU(Oe(this,lt,"f"),e,r)}async sendBroadcast(e,r=!1){return await Oe(this,ut,"f").sendBroadcast(Oe(this,lt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await Oe(this,ut,"f").sendBroadcastU(Oe(this,lt,"f"),e,r)}async addSignalHandler(e){await Oe(this,ut,"f").addSignalHandler(Oe(this,lt,"f"),e)}removeSignalHandler(e){Oe(this,ut,"f").removeSignalHandler(Oe(this,lt,"f"),e)}};ut=new WeakMap,lt=new WeakMap;var Fn=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},$n=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ze=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)}};Fn([m(),$n("design:type",String)],Ze.prototype,"source",void 0);Fn([m(),$n("design:type",String)],Ze.prototype,"target",void 0);Fn([m(),$n("design:type",String)],Ze.prototype,"predicate",void 0);Fn([m(),$n("design:type",Date)],Ze.prototype,"fromDate",void 0);Fn([m(),$n("design:type",Date)],Ze.prototype,"untilDate",void 0);Fn([m(),$n("design:type",Number)],Ze.prototype,"limit",void 0);Ze=Fn([W(),Be(),$n("design:paramtypes",[Object])],Ze);var pp=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},Ge=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,fr;function Oo(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ht=class{constructor(){ft.set(this,void 0),fr.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 ht;return pp(r,fr,e,"f"),r}static from(e){let r=new ht;return pp(r,ft,e,"f"),r}toUrl(){if(Ge(this,fr,"f")&&!Ge(this,ft,"f"))return Ge(this,fr,"f");if(!Ge(this,fr,"f")&&(Ge(this,ft,"f")===void 0||Ge(this,ft,"f")===""||Ge(this,ft,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ge(this,ft,"f")){case"string":e=`string:${Oo(Ge(this,ft,"f"))}`;break;case"number":e=`number:${Oo(Ge(this,ft,"f"))}`;break;case"boolean":e=`boolean:${Oo(Ge(this,ft,"f"))}`;break;case"object":e=`json:${Oo(JSON.stringify(Ge(this,ft,"f")))}`;break}return`literal://${e}`}get(){if(Ge(this,ft,"f"))return Ge(this,ft,"f");if(!Ge(this,fr,"f"))throw new Error("Can't render empty Literal");if(!Ge(this,fr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ge(this,fr,"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}`)}};ft=new WeakMap,fr=new WeakMap;function jr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Qu(t){return`set${jr(t)}`}function yr(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function zu(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function mg(t){return`add${jr(zu(t))}`}function yg(t){let e=t.substring(3),r=yr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function gg(t){return`remove${jr(zu(t))}`}function vg(t){let e=t.substring(6),r=yr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function bg(t){let e=t.substring(13),r=yr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function _g(t){return`setCollection${jr(zu(t))}`}function ln(t){if(Array.isArray(t))return`[${t.map(ln).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 Yc=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},z=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)},rt,nt,Ee,hs=class{constructor(t,e,r){rt.set(this,void 0),nt.set(this,void 0),Ee.set(this,void 0),Yc(this,rt,e,"f"),Yc(this,nt,r,"f"),Yc(this,Ee,t,"f")}get baseExpression(){return z(this,rt,"f")}async init(){let isInstance=await z(this,Ee,"f").isSubjectInstance(z(this,rt,"f"),z(this,nt,"f"));if(!isInstance)throw`Not a valid subject instance of ${z(this,nt,"f")} for ${z(this,rt,"f")}`;let results=await z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), property_resolve(C, "${t}")`);Object.defineProperty(this,t,{configurable:!0,get:async()=>{let r=await z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), property_getter(C, "${z(this,rt,"f")}", "${t}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(e)try{if(n){let i=await z(this,Ee,"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 z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Qu(property)]=async t=>{resolveLanguage&&(t=await z(this,Ee,"f").createExpression(t,resolveLanguage)),await z(this,Ee,"f").executeAction(actions,z(this,rt,"f"),[{name:"value",value:t}])}}let results2=await z(this,Ee,"f").infer(`subject_class("${z(this,nt,"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 z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), collection_getter(C, "${z(this,rt,"f")}", "${t}", Value)`);return e&&e.length>0&&e[0].Value?e[0].Value.filter(n=>n!==""&&n!==""):[]}});let adders=await z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[mg(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>z(this,Ee,"f").executeAction(actions,z(this,rt,"f"),[{name:"value",value:e}]))):await z(this,Ee,"f").executeAction(actions,z(this,rt,"f"),[{name:"value",value:t}])}}let removers=await z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[gg(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>z(this,Ee,"f").executeAction(actions,z(this,rt,"f"),[{name:"value",value:e}]))):await z(this,Ee,"f").executeAction(actions,z(this,rt,"f"),[{name:"value",value:t}])}}let collectionSetters=await z(this,Ee,"f").infer(`subject_class("${z(this,nt,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[_g(collection)]=async t=>{Array.isArray(t)?await z(this,Ee,"f").executeAction(actions,z(this,rt,"f"),t.map(e=>({name:"value",value:e}))):await z(this,Ee,"f").executeAction(actions,z(this,rt,"f"),[{name:"value",value:t}])}}}};rt=new WeakMap,nt=new WeakMap,Ee=new WeakMap;var le=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)},Wo,pr,Kt,Ht,bn,Cr,Rr,fn,ta,Go,pn,dn,kt,li,wu,oe,se,hn,mn,yn,ra,ms=class{constructor(e,r,n){Wo.add(this),pr.set(this,void 0),Kt.set(this,void 0),Ht.set(this,void 0),bn.set(this,void 0),Cr.set(this,void 0),Rr.set(this,void 0),fn.set(this,void 0),ta.set(this,!1),Go.set(this,void 0),pn.set(this,void 0),dn.set(this,void 0),kt.set(this,void 0),li.set(this,void 0),this.isSurrealDB=!1,le(this,pr,e,"f"),le(this,li,r,"f"),le(this,Ht,n,"f"),le(this,bn,new Set,"f"),le(this,fn,null,"f"),le(this,Go,new Promise((i,a)=>{le(this,pn,i,"f"),le(this,dn,a,"f")}),"f")}async subscribe(){k(this,Rr,"f")&&(k(this,Rr,"f").call(this),le(this,Rr,void 0,"f")),k(this,kt,"f")&&(clearTimeout(k(this,kt,"f")),le(this,kt,void 0,"f")),k(this,Cr,"f")&&(clearTimeout(k(this,Cr,"f")),le(this,Cr,void 0,"f"));try{let r;this.isSurrealDB?r=await k(this,Ht,"f").perspectiveSubscribeSurrealQuery(k(this,pr,"f"),k(this,li,"f")):r=await k(this,Ht,"f").subscribeQuery(k(this,pr,"f"),k(this,li,"f")),le(this,Kt,r.subscriptionId,"f"),r.result?(le(this,fn,r.result,"f"),k(this,Wo,"m",wu).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),le(this,kt,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"),le(this,Rr,k(this,Ht,"f").subscribeToQueryUpdates(k(this,Kt,"f"),n=>{k(this,kt,"f")&&(clearTimeout(k(this,kt,"f")),le(this,kt,void 0,"f")),k(this,pn,"f")&&(k(this,pn,"f").call(this,!0),le(this,pn,void 0,"f"),le(this,dn,void 0,"f")),!(n.isInit&&k(this,fn,"f"))&&(le(this,fn,n,"f"),k(this,Wo,"m",wu).call(this,n))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),k(this,dn,"f")&&(k(this,dn,"f").call(this,r),le(this,pn,void 0,"f"),le(this,dn,void 0,"f")),r}let e=async()=>{if(!k(this,ta,"f")){try{this.isSurrealDB?await k(this,Ht,"f").perspectiveKeepAliveSurrealQuery(k(this,pr,"f"),k(this,Kt,"f")):await k(this,Ht,"f").keepAliveQuery(k(this,pr,"f"),k(this,Kt,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",k(this,li,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}k(this,ta,"f")||le(this,Cr,setTimeout(e,3e4),"f")}};le(this,Cr,setTimeout(e,3e4),"f")}get id(){return k(this,Kt,"f")}get initialized(){return k(this,Go,"f")}get result(){return k(this,fn,"f")}onResult(e){return k(this,bn,"f").add(e),()=>k(this,bn,"f").delete(e)}dispose(){le(this,ta,!0,"f"),clearTimeout(k(this,Cr,"f")),k(this,Rr,"f")&&k(this,Rr,"f").call(this),k(this,bn,"f").clear(),k(this,kt,"f")&&(clearTimeout(k(this,kt,"f")),le(this,kt,void 0,"f")),k(this,Kt,"f")&&(this.isSurrealDB?k(this,Ht,"f").perspectiveDisposeSurrealQuerySubscription(k(this,pr,"f"),k(this,Kt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):k(this,Ht,"f").disposeQuerySubscription(k(this,pr,"f"),k(this,Kt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};pr=new WeakMap,Kt=new WeakMap,Ht=new WeakMap,bn=new WeakMap,Cr=new WeakMap,Rr=new WeakMap,fn=new WeakMap,ta=new WeakMap,Go=new WeakMap,pn=new WeakMap,dn=new WeakMap,kt=new WeakMap,li=new WeakMap,Wo=new WeakSet,wu=function t(e){for(let r of k(this,bn,"f"))try{r(e)}catch(n){console.error("Error in query subscription callback:",n)}};var pi=class{constructor(t,e){oe.set(this,void 0),se.set(this,void 0),hn.set(this,void 0),mn.set(this,void 0),yn.set(this,void 0),ra.set(this,void 0),le(this,hn,[],"f"),le(this,mn,[],"f"),le(this,yn,[],"f"),le(this,ra,[],"f"),le(this,oe,t,"f"),le(this,se,e,"f"),this.uuid=k(this,oe,"f").uuid,this.name=k(this,oe,"f").name,this.sharedUrl=k(this,oe,"f").sharedUrl,this.neighbourhood=k(this,oe,"f").neighbourhood,this.state=k(this,oe,"f").state,k(this,se,"f").addPerspectiveLinkAddedListener(k(this,oe,"f").uuid,k(this,hn,"f")),k(this,se,"f").addPerspectiveLinkRemovedListener(k(this,oe,"f").uuid,k(this,mn,"f")),k(this,se,"f").addPerspectiveLinkUpdatedListener(k(this,oe,"f").uuid,k(this,yn,"f")),k(this,se,"f").addPerspectiveSyncStateChangeListener(k(this,oe,"f").uuid,k(this,ra,"f"))}async executeAction(t,e,r,n){return await k(this,se,"f").executeCommands(k(this,oe,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),n)}async get(t){return await k(this,se,"f").queryLinks(k(this,oe,"f").uuid,t)}async infer(t){return await k(this,se,"f").queryProlog(k(this,oe,"f").uuid,t)}async querySurrealDB(t){return await k(this,se,"f").querySurrealDB(k(this,oe,"f").uuid,t)}async add(t,e="shared",r){return await k(this,se,"f").addLink(k(this,oe,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await k(this,se,"f").addLinks(k(this,oe,"f").uuid,t,e,r)}async removeLinks(t,e){return await k(this,se,"f").removeLinks(k(this,oe,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await k(this,se,"f").linkMutations(k(this,oe,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await k(this,se,"f").addLinkExpression(k(this,oe,"f").uuid,t,e,r)}async update(t,e,r){return await k(this,se,"f").updateLink(k(this,oe,"f").uuid,t,e,r)}async remove(t,e){return await k(this,se,"f").removeLink(k(this,oe,"f").uuid,t,e)}async createBatch(){return await k(this,se,"f").createBatch(k(this,oe,"f").uuid)}async commitBatch(t){return await k(this,se,"f").commitBatch(k(this,oe,"f").uuid,t)}async getExpression(t){return await k(this,se,"f").getExpression(t)}async createExpression(t,e){return await k(this,se,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?k(this,hn,"f").push(e):t==="link-removed"?k(this,mn,"f").push(e):t==="link-updated"&&k(this,yn,"f").push(e)}async addSyncStateChangeListener(t){k(this,ra,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=k(this,hn,"f").indexOf(e);k(this,hn,"f").splice(r,1)}else if(t==="link-removed"){let r=k(this,mn,"f").indexOf(e);k(this,mn,"f").splice(r,1)}else if(t==="link-updated"){let r=k(this,yn,"f").indexOf(e);k(this,yn,"f").splice(r,1)}}async snapshot(){return k(this,se,"f").snapshotByUUID(k(this,oe,"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 Ze({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 Ze({source:"ad4m://self",predicate:r}));for(let i of n){let a=i.data.target,o=await this.get(new Ze({source:a,predicate:"ad4m://sdna"}));for(let s of o){let u=ht.fromUrl(s.data.target).get();typeof u=="string"&&e.push(u)}}}return e}async getSdnaForClass(t){let e=ht.from(t);if((await this.get(new Ze({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new Ze({source:e.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let i=ht.fromUrl(n[0].data.target).get();return typeof i=="string"?i:null}async addSdna(t,e,r){return k(this,se,"f").addSdna(k(this,oe,"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,se,"f").createSubject(k(this,oe,"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,se,"f").createSubject(k(this,oe,"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,se,"f").getSubjectData(k(this,oe,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await k(this,se,"f").getSubjectData(k(this,oe,"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 hs(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, "${yg(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${vg(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${bg(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,se,"f").getNeighbourhoodProxy(k(this,oe,"f").uuid)}get ai(){return k(this,se,"f").aiClient}async subscribeInfer(t){let e=new ms(this.uuid,t,k(this,se,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new ms(this.uuid,t,k(this,se,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};oe=new WeakMap,se=new WeakMap,hn=new WeakMap,mn=new WeakMap,yn=new WeakMap,ra=new WeakMap;var Dr=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},q=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)},K,na,ia,aa,Ko,oa,Ho,Jo,tt=`
|
|
61
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||wu.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),ls(ls({},t),{definitions:r})}function ug(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 lg(t){var e=Rd(t);if(!Yo.has(e)){var r=ag(t,{experimentalFragmentVariables:fs,allowLegacyFragmentVariables:fs});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");Yo.set(e,ug(cg(r)))}return Yo.get(e)}function I(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]}),lg(n)}function fg(){Yo.clear(),wu.clear()}function pg(){Pd=!1}function dg(){fs=!0}function hg(){fs=!1}var Zi={gql:I,resetCaches:fg,disableFragmentWarnings:pg,enableExperimentalFragmentVariables:dg,disableExperimentalFragmentVariables:hg};(function(t){t.gql=Zi.gql,t.resetCaches=Zi.resetCaches,t.disableFragmentWarnings=Zi.disableFragmentWarnings,t.enableExperimentalFragmentVariables=Zi.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=Zi.disableExperimentalFragmentVariables})(I||(I={}));I.default=I;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 mg(){}function Jr(){return mg}var de=Jr,m=Jr,Be=Jr,Ne=Jr,Q=Jr,Et=Jr,yg=Jr,Wu=Jr,Ld=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},Fd=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Tn=class{constructor(e){this.code=e}};Ld([m(),Fd("design:type",String)],Tn.prototype,"code",void 0);Tn=Ld([Q(),Fd("design:paramtypes",[String])],Tn);var Gu=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},Ku=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},er=class{constructor(e,r){this.address=e,this.name=r}};Gu([m(),Ku("design:type",String)],er.prototype,"address",void 0);Gu([m(),Ku("design:type",String)],er.prototype,"name",void 0);er=Gu([Q(),Ku("design:paramtypes",[String,String])],er);var Se=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},$e=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},gr=class{constructor(e,r){this.key=r,this.signature=e}};Se([m(),$e("design:type",String)],gr.prototype,"signature",void 0);Se([m(),$e("design:type",String)],gr.prototype,"key",void 0);Se([m(),$e("design:type",Boolean)],gr.prototype,"valid",void 0);Se([m(),$e("design:type",Boolean)],gr.prototype,"invalid",void 0);gr=Se([Q(),Be(),$e("design:paramtypes",[String,String])],gr);var kn=class{};Se([m(),$e("design:type",String)],kn.prototype,"signature",void 0);Se([m(),$e("design:type",String)],kn.prototype,"key",void 0);Se([m(),$e("design:type",Boolean)],kn.prototype,"valid",void 0);Se([m(),$e("design:type",Boolean)],kn.prototype,"invalid",void 0);kn=Se([Be()],kn);function Yr(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Se([m(),$e("design:type",String)],e.prototype,"author",void 0),Se([m(),$e("design:type",String)],e.prototype,"timestamp",void 0),Se([m(),$e("design:type",Object)],e.prototype,"data",void 0),Se([m(),$e("design:type",gr)],e.prototype,"proof",void 0),e=Se([Q(),$e("design:paramtypes",[String,String,Object,gr])],e),e}function gg(t){let e=class{};return Se([m(),$e("design:type",String)],e.prototype,"author",void 0),Se([m(),$e("design:type",String)],e.prototype,"timestamp",void 0),Se([m(),$e("design:type",Object)],e.prototype,"data",void 0),Se([m(),$e("design:type",kn)],e.prototype,"proof",void 0),e=Se([Be()],e),e}var pp=class extends Yr(){};pp=Se([Q()],pp);var ps=class extends Yr(){};Se([m(),$e("design:type",er)],ps.prototype,"language",void 0);Se([m(),$e("design:type",Tn)],ps.prototype,"icon",void 0);ps=Se([Q()],ps);function ET(t){return t&&t.author&&t.timestamp&&t.data}var 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},Je=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},On=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Ce([m(),Je("design:type",String)],On.prototype,"source",void 0);Ce([m(),Je("design:type",String)],On.prototype,"target",void 0);Ce([m(),Je("design:type",String)],On.prototype,"predicate",void 0);On=Ce([Q(),Je("design:paramtypes",[Object])],On);var ds=class{};Ce([m(),Je("design:type",Array)],ds.prototype,"additions",void 0);Ce([m(),Je("design:type",Array)],ds.prototype,"removals",void 0);ds=Ce([Be()],ds);var hs=class{constructor(e,r){this.additions=e,this.removals=r}};Ce([m(),Je("design:type",Array)],hs.prototype,"additions",void 0);Ce([m(),Je("design:type",Array)],hs.prototype,"removals",void 0);hs=Ce([Q(),Je("design:paramtypes",[Array,Array])],hs);var Ta=class{};Ce([m(),Je("design:type",String)],Ta.prototype,"source",void 0);Ce([m(),Je("design:type",String)],Ta.prototype,"target",void 0);Ce([m(),Je("design:type",String)],Ta.prototype,"predicate",void 0);Ta=Ce([Be()],Ta);var Vr=class extends Yr(){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}};Ce([m(),Je("design:type",String)],Vr.prototype,"status",void 0);Vr=Ce([Q()],Vr);var Eu=class extends gg(){};Ce([m(),Je("design:type",String)],Eu.prototype,"status",void 0);Eu=Ce([Be()],Eu);function DT(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 NT(t){return t&&t.source&&t.target}var ms=class{constructor(e,r){this.oldLink=e,this.newLink=r}};Ce([m(),Je("design:type",Vr)],ms.prototype,"oldLink",void 0);Ce([m(),Je("design:type",Vr)],ms.prototype,"newLink",void 0);ms=Ce([Q(),Je("design:paramtypes",[Vr,Vr])],ms);var Ln=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},qa=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},xu,nr=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}};Ln([m(),qa("design:type",Array)],nr.prototype,"links",void 0);nr=Ln([Q(),qa("design:paramtypes",[Array])],nr);var ys=class{};Ln([m(),qa("design:type",Array)],ys.prototype,"links",void 0);ys=Ln([Be()],ys);var Iu=xu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new xu;return r.links.push(e),r}};Ln([m(),qa("design:type",Array)],Iu.prototype,"links",void 0);Iu=xu=Ln([Be(),qa("design:paramtypes",[Array])],Iu);var An=class extends Yr(){};An=Ln([Q()],An);var j=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},U=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Mr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new nr}};j([m(),U("design:type",String)],Mr.prototype,"did",void 0);j([m(),U("design:type",nr)],Mr.prototype,"perspective",void 0);j([m(),U("design:type",String)],Mr.prototype,"directMessageLanguage",void 0);Mr=j([Q(),U("design:paramtypes",[String,nr])],Mr);var dp=class extends Yr(){};dp=j([Q()],dp);var Qr=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}};j([m(),U("design:type",String)],Qr.prototype,"did",void 0);j([m(),U("design:type",String)],Qr.prototype,"didSigningKeyId",void 0);j([m(),U("design:type",String)],Qr.prototype,"deviceKeyType",void 0);j([m(),U("design:type",String)],Qr.prototype,"deviceKey",void 0);j([m(),U("design:type",String)],Qr.prototype,"deviceKeySignedByDid",void 0);j([m(),U("design:type",String)],Qr.prototype,"didSignedByDeviceKey",void 0);Qr=j([Q(),U("design:paramtypes",[String,String,String,String,String,String])],Qr);var zr=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}};j([m(),U("design:type",String)],zr.prototype,"did",void 0);j([m(),U("design:type",String)],zr.prototype,"didSigningKeyId",void 0);j([m(),U("design:type",String)],zr.prototype,"deviceKeyType",void 0);j([m(),U("design:type",String)],zr.prototype,"deviceKey",void 0);j([m(),U("design:type",String)],zr.prototype,"deviceKeySignedByDid",void 0);j([m(),U("design:type",String)],zr.prototype,"didSignedByDeviceKey",void 0);zr=j([Be(),U("design:paramtypes",[String,String,String,String,String,String])],zr);var gs=class{constructor(e,r){this.signature=e,this.publicKey=r}};j([m(),U("design:type",String)],gs.prototype,"signature",void 0);j([m(),U("design:type",String)],gs.prototype,"publicKey",void 0);gs=j([Q(),U("design:paramtypes",[String,String])],gs);var yi=class{constructor(e,r){this.domain=e,this.pointers=r}};j([m(),U("design:type",String)],yi.prototype,"domain",void 0);j([m(),U("design:type",Array)],yi.prototype,"pointers",void 0);yi=j([Q(),U("design:paramtypes",[String,Array])],yi);var vs=class{constructor(e,r){this.with=e,this.can=r}};j([m(),U("design:type",yi)],vs.prototype,"with",void 0);j([m(),U("design:type",Array)],vs.prototype,"can",void 0);vs=j([Q(),U("design:paramtypes",[yi,Array])],vs);var vr=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};j([m(),U("design:type",String)],vr.prototype,"appName",void 0);j([m(),U("design:type",String)],vr.prototype,"appDesc",void 0);j([m(),U("design:type",String)],vr.prototype,"appUrl",void 0);j([m(),U("design:type",String)],vr.prototype,"appIconPath",void 0);j([m(),U("design:type",Array)],vr.prototype,"capabilities",void 0);vr=j([Q(),U("design:paramtypes",[String,String,String,Array,String])],vr);var gi=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};j([m(),U("design:type",String)],gi.prototype,"requestId",void 0);j([m(),U("design:type",String)],gi.prototype,"token",void 0);j([m(),U("design:type",Boolean)],gi.prototype,"revoked",void 0);j([m(),U("design:type",vr)],gi.prototype,"auth",void 0);gi=j([Q(),U("design:paramtypes",[String,vr,String,Boolean])],gi);var vi=class{constructor(e,r){this.domain=e,this.pointers=r}};j([m(),U("design:type",String)],vi.prototype,"domain",void 0);j([m(),U("design:type",Array)],vi.prototype,"pointers",void 0);vi=j([Be(),U("design:paramtypes",[String,Array])],vi);var bs=class{constructor(e,r){this.with=e,this.can=r}};j([m(),U("design:type",vi)],bs.prototype,"with",void 0);j([m(),U("design:type",Array)],bs.prototype,"can",void 0);bs=j([Be(),U("design:paramtypes",[vi,Array])],bs);var Wr=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}};j([m(),U("design:type",String)],Wr.prototype,"appName",void 0);j([m(),U("design:type",String)],Wr.prototype,"appDesc",void 0);j([m(),U("design:type",String)],Wr.prototype,"appDomain",void 0);j([m(),U("design:type",String)],Wr.prototype,"appUrl",void 0);j([m(),U("design:type",String)],Wr.prototype,"appIconPath",void 0);j([m(),U("design:type",Array)],Wr.prototype,"capabilities",void 0);Wr=j([Be(),U("design:paramtypes",[String,String,String,String,String,Array])],Wr);var ka=class{constructor(e,r,n){this.username=e,this.did=r,this.password=n}};j([m(),U("design:type",String)],ka.prototype,"username",void 0);j([m(),U("design:type",String)],ka.prototype,"did",void 0);j([m(),U("design:type",String)],ka.prototype,"password",void 0);ka=j([Q(),U("design:paramtypes",[String,String,String])],ka);var Oa=class{constructor(e,r,n){this.did=e,this.success=r,this.error=n}};j([m(),U("design:type",String)],Oa.prototype,"did",void 0);j([m(),U("design:type",Boolean)],Oa.prototype,"success",void 0);j([m(),U("design:type",String)],Oa.prototype,"error",void 0);Oa=j([Q(),U("design:paramtypes",[String,Boolean,String])],Oa);var Ii=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},Ti=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Dt=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)}};Ii([m(),Ti("design:type",Boolean)],Dt.prototype,"isInitialized",void 0);Ii([m(),Ti("design:type",Boolean)],Dt.prototype,"isUnlocked",void 0);Ii([m(),Ti("design:type",String)],Dt.prototype,"did",void 0);Ii([m(),Ti("design:type",String)],Dt.prototype,"didDocument",void 0);Ii([m(),Ti("design:type",String)],Dt.prototype,"error",void 0);Dt=Ii([Q(),Ti("design:paramtypes",[Object])],Dt);var hp=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},Oe=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,Tu=class{constructor(e,r){ut.set(this,void 0),lt.set(this,void 0),hp(this,ut,e,"f"),hp(this,lt,r,"f")}async otherAgents(){return await Oe(this,ut,"f").otherAgents(Oe(this,lt,"f"))}async hasTelepresenceAdapter(){return await Oe(this,ut,"f").hasTelepresenceAdapter(Oe(this,lt,"f"))}async onlineAgents(){return await Oe(this,ut,"f").onlineAgents(Oe(this,lt,"f"))}async setOnlineStatus(e){return await Oe(this,ut,"f").setOnlineStatus(Oe(this,lt,"f"),e)}async setOnlineStatusU(e){return await Oe(this,ut,"f").setOnlineStatusU(Oe(this,lt,"f"),e)}async sendSignal(e,r){return await Oe(this,ut,"f").sendSignal(Oe(this,lt,"f"),e,r)}async sendSignalU(e,r){return await Oe(this,ut,"f").sendSignalU(Oe(this,lt,"f"),e,r)}async sendBroadcast(e,r=!1){return await Oe(this,ut,"f").sendBroadcast(Oe(this,lt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await Oe(this,ut,"f").sendBroadcastU(Oe(this,lt,"f"),e,r)}async addSignalHandler(e){await Oe(this,ut,"f").addSignalHandler(Oe(this,lt,"f"),e)}removeSignalHandler(e){Oe(this,ut,"f").removeSignalHandler(Oe(this,lt,"f"),e)}};ut=new WeakMap,lt=new WeakMap;var Fn=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},$n=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Xe=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)}};Fn([m(),$n("design:type",String)],Xe.prototype,"source",void 0);Fn([m(),$n("design:type",String)],Xe.prototype,"target",void 0);Fn([m(),$n("design:type",String)],Xe.prototype,"predicate",void 0);Fn([m(),$n("design:type",Date)],Xe.prototype,"fromDate",void 0);Fn([m(),$n("design:type",Date)],Xe.prototype,"untilDate",void 0);Fn([m(),$n("design:type",Number)],Xe.prototype,"limit",void 0);Xe=Fn([Q(),Be(),$n("design:paramtypes",[Object])],Xe);var mp=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},Ke=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,fr;function Ro(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ht=class{constructor(){ft.set(this,void 0),fr.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 ht;return mp(r,fr,e,"f"),r}static from(e){let r=new ht;return mp(r,ft,e,"f"),r}toUrl(){if(Ke(this,fr,"f")&&!Ke(this,ft,"f"))return Ke(this,fr,"f");if(!Ke(this,fr,"f")&&(Ke(this,ft,"f")===void 0||Ke(this,ft,"f")===""||Ke(this,ft,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ke(this,ft,"f")){case"string":e=`string:${Ro(Ke(this,ft,"f"))}`;break;case"number":e=`number:${Ro(Ke(this,ft,"f"))}`;break;case"boolean":e=`boolean:${Ro(Ke(this,ft,"f"))}`;break;case"object":e=`json:${Ro(JSON.stringify(Ke(this,ft,"f")))}`;break}return`literal://${e}`}get(){if(Ke(this,ft,"f"))return Ke(this,ft,"f");if(!Ke(this,fr,"f"))throw new Error("Can't render empty Literal");if(!Ke(this,fr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ke(this,fr,"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}`)}};ft=new WeakMap,fr=new WeakMap;function jr(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Hu(t){return`set${jr(t)}`}function yr(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function Ju(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function vg(t){return`add${jr(Ju(t))}`}function bg(t){let e=t.substring(3),r=yr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function _g(t){return`remove${jr(Ju(t))}`}function Sg(t){let e=t.substring(6),r=yr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function wg(t){let e=t.substring(13),r=yr(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Eg(t){return`setCollection${jr(Ju(t))}`}function fn(t){if(Array.isArray(t))return`[${t.map(fn).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 ru=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},W=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)},rt,nt,Ee,_s=class{constructor(t,e,r){rt.set(this,void 0),nt.set(this,void 0),Ee.set(this,void 0),ru(this,rt,e,"f"),ru(this,nt,r,"f"),ru(this,Ee,t,"f")}get baseExpression(){return W(this,rt,"f")}async init(){let isInstance=await W(this,Ee,"f").isSubjectInstance(W(this,rt,"f"),W(this,nt,"f"));if(!isInstance)throw`Not a valid subject instance of ${W(this,nt,"f")} for ${W(this,rt,"f")}`;let results=await W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties){let e=await W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), property_resolve(C, "${t}")`);Object.defineProperty(this,t,{configurable:!0,get:async()=>{let r=await W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), property_getter(C, "${W(this,rt,"f")}", "${t}", Value)`);if(r&&r.length>0){let n=r[0].Value;if(e)try{if(n){let i=await W(this,Ee,"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 W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Hu(property)]=async t=>{resolveLanguage&&(t=await W(this,Ee,"f").createExpression(t,resolveLanguage)),await W(this,Ee,"f").executeAction(actions,W(this,rt,"f"),[{name:"value",value:t}])}}let results2=await W(this,Ee,"f").infer(`subject_class("${W(this,nt,"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 W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), collection_getter(C, "${W(this,rt,"f")}", "${t}", Value)`);return e&&e.length>0&&e[0].Value?e[0].Value.filter(n=>n!==""&&n!==""):[]}});let adders=await W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[vg(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>W(this,Ee,"f").executeAction(actions,W(this,rt,"f"),[{name:"value",value:e}]))):await W(this,Ee,"f").executeAction(actions,W(this,rt,"f"),[{name:"value",value:t}])}}let removers=await W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[_g(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>W(this,Ee,"f").executeAction(actions,W(this,rt,"f"),[{name:"value",value:e}]))):await W(this,Ee,"f").executeAction(actions,W(this,rt,"f"),[{name:"value",value:t}])}}let collectionSetters=await W(this,Ee,"f").infer(`subject_class("${W(this,nt,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[Eg(collection)]=async t=>{Array.isArray(t)?await W(this,Ee,"f").executeAction(actions,W(this,rt,"f"),t.map(e=>({name:"value",value:e}))):await W(this,Ee,"f").executeAction(actions,W(this,rt,"f"),[{name:"value",value:t}])}}}};rt=new WeakMap,nt=new WeakMap,Ee=new WeakMap;var fe=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},O=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)},Zo,pr,Kt,Ht,_n,Pr,Rr,pn,na,Xo,dn,hn,Ot,pi,ku,oe,se,mn,yn,gn,ia,Ss=class{constructor(e,r,n){Zo.add(this),pr.set(this,void 0),Kt.set(this,void 0),Ht.set(this,void 0),_n.set(this,void 0),Pr.set(this,void 0),Rr.set(this,void 0),pn.set(this,void 0),na.set(this,!1),Xo.set(this,void 0),dn.set(this,void 0),hn.set(this,void 0),Ot.set(this,void 0),pi.set(this,void 0),this.isSurrealDB=!1,fe(this,pr,e,"f"),fe(this,pi,r,"f"),fe(this,Ht,n,"f"),fe(this,_n,new Set,"f"),fe(this,pn,null,"f"),fe(this,Xo,new Promise((i,a)=>{fe(this,dn,i,"f"),fe(this,hn,a,"f")}),"f")}async subscribe(){O(this,Rr,"f")&&(O(this,Rr,"f").call(this),fe(this,Rr,void 0,"f")),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),fe(this,Ot,void 0,"f")),O(this,Pr,"f")&&(clearTimeout(O(this,Pr,"f")),fe(this,Pr,void 0,"f"));try{let r;this.isSurrealDB?r=await O(this,Ht,"f").perspectiveSubscribeSurrealQuery(O(this,pr,"f"),O(this,pi,"f")):r=await O(this,Ht,"f").subscribeQuery(O(this,pr,"f"),O(this,pi,"f")),fe(this,Kt,r.subscriptionId,"f"),r.result?(fe(this,pn,r.result,"f"),O(this,Zo,"m",ku).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),fe(this,Ot,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"),fe(this,Rr,O(this,Ht,"f").subscribeToQueryUpdates(O(this,Kt,"f"),n=>{O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),fe(this,Ot,void 0,"f")),O(this,dn,"f")&&(O(this,dn,"f").call(this,!0),fe(this,dn,void 0,"f"),fe(this,hn,void 0,"f")),!(n.isInit&&O(this,pn,"f"))&&(fe(this,pn,n,"f"),O(this,Zo,"m",ku).call(this,n))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),O(this,hn,"f")&&(O(this,hn,"f").call(this,r),fe(this,dn,void 0,"f"),fe(this,hn,void 0,"f")),r}let e=async()=>{if(!O(this,na,"f")){try{this.isSurrealDB?await O(this,Ht,"f").perspectiveKeepAliveSurrealQuery(O(this,pr,"f"),O(this,Kt,"f")):await O(this,Ht,"f").keepAliveQuery(O(this,pr,"f"),O(this,Kt,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",O(this,pi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,na,"f")||fe(this,Pr,setTimeout(e,3e4),"f")}};fe(this,Pr,setTimeout(e,3e4),"f")}get id(){return O(this,Kt,"f")}get initialized(){return O(this,Xo,"f")}get result(){return O(this,pn,"f")}onResult(e){return O(this,_n,"f").add(e),()=>O(this,_n,"f").delete(e)}dispose(){fe(this,na,!0,"f"),clearTimeout(O(this,Pr,"f")),O(this,Rr,"f")&&O(this,Rr,"f").call(this),O(this,_n,"f").clear(),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),fe(this,Ot,void 0,"f")),O(this,Kt,"f")&&(this.isSurrealDB?O(this,Ht,"f").perspectiveDisposeSurrealQuerySubscription(O(this,pr,"f"),O(this,Kt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,Ht,"f").disposeQuerySubscription(O(this,pr,"f"),O(this,Kt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};pr=new WeakMap,Kt=new WeakMap,Ht=new WeakMap,_n=new WeakMap,Pr=new WeakMap,Rr=new WeakMap,pn=new WeakMap,na=new WeakMap,Xo=new WeakMap,dn=new WeakMap,hn=new WeakMap,Ot=new WeakMap,pi=new WeakMap,Zo=new WeakSet,ku=function t(e){for(let r of O(this,_n,"f"))try{r(e)}catch(n){console.error("Error in query subscription callback:",n)}};var hi=class{constructor(t,e){oe.set(this,void 0),se.set(this,void 0),mn.set(this,void 0),yn.set(this,void 0),gn.set(this,void 0),ia.set(this,void 0),fe(this,mn,[],"f"),fe(this,yn,[],"f"),fe(this,gn,[],"f"),fe(this,ia,[],"f"),fe(this,oe,t,"f"),fe(this,se,e,"f"),this.uuid=O(this,oe,"f").uuid,this.name=O(this,oe,"f").name,this.owners=O(this,oe,"f").owners,this.sharedUrl=O(this,oe,"f").sharedUrl,this.neighbourhood=O(this,oe,"f").neighbourhood,this.state=O(this,oe,"f").state,O(this,se,"f").addPerspectiveLinkAddedListener(O(this,oe,"f").uuid,O(this,mn,"f")),O(this,se,"f").addPerspectiveLinkRemovedListener(O(this,oe,"f").uuid,O(this,yn,"f")),O(this,se,"f").addPerspectiveLinkUpdatedListener(O(this,oe,"f").uuid,O(this,gn,"f")),O(this,se,"f").addPerspectiveSyncStateChangeListener(O(this,oe,"f").uuid,O(this,ia,"f"))}async executeAction(t,e,r,n){return await O(this,se,"f").executeCommands(O(this,oe,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),n)}async get(t){return await O(this,se,"f").queryLinks(O(this,oe,"f").uuid,t)}async infer(t){return await O(this,se,"f").queryProlog(O(this,oe,"f").uuid,t)}async querySurrealDB(t){return await O(this,se,"f").querySurrealDB(O(this,oe,"f").uuid,t)}async add(t,e="shared",r){return await O(this,se,"f").addLink(O(this,oe,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await O(this,se,"f").addLinks(O(this,oe,"f").uuid,t,e,r)}async removeLinks(t,e){return await O(this,se,"f").removeLinks(O(this,oe,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await O(this,se,"f").linkMutations(O(this,oe,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await O(this,se,"f").addLinkExpression(O(this,oe,"f").uuid,t,e,r)}async update(t,e,r){return await O(this,se,"f").updateLink(O(this,oe,"f").uuid,t,e,r)}async remove(t,e){return await O(this,se,"f").removeLink(O(this,oe,"f").uuid,t,e)}async createBatch(){return await O(this,se,"f").createBatch(O(this,oe,"f").uuid)}async commitBatch(t){return await O(this,se,"f").commitBatch(O(this,oe,"f").uuid,t)}async getExpression(t){return await O(this,se,"f").getExpression(t)}async createExpression(t,e){return await O(this,se,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?O(this,mn,"f").push(e):t==="link-removed"?O(this,yn,"f").push(e):t==="link-updated"&&O(this,gn,"f").push(e)}async addSyncStateChangeListener(t){O(this,ia,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=O(this,mn,"f").indexOf(e);O(this,mn,"f").splice(r,1)}else if(t==="link-removed"){let r=O(this,yn,"f").indexOf(e);O(this,yn,"f").splice(r,1)}else if(t==="link-updated"){let r=O(this,gn,"f").indexOf(e);O(this,gn,"f").splice(r,1)}}async snapshot(){return O(this,se,"f").snapshotByUUID(O(this,oe,"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 Xe({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 Xe({source:"ad4m://self",predicate:r}));for(let i of n){let a=i.data.target,o=await this.get(new Xe({source:a,predicate:"ad4m://sdna"}));for(let s of o){let u=ht.fromUrl(s.data.target).get();typeof u=="string"&&e.push(u)}}}return e}async getSdnaForClass(t){let e=ht.from(t);if((await this.get(new Xe({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new Xe({source:e.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let i=ht.fromUrl(n[0].data.target).get();return typeof i=="string"?i:null}async addSdna(t,e,r){return O(this,se,"f").addSdna(O(this,oe,"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 O(this,se,"f").createSubject(O(this,oe,"f").uuid,JSON.stringify({className:i,initialValues:r}),e,r?JSON.stringify(r):void 0,n);else{let a=this.buildQueryFromTemplate(t);await O(this,se,"f").createSubject(O(this,oe,"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 O(this,se,"f").getSubjectData(O(this,oe,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await O(this,se,"f").getSubjectData(O(this,oe,"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 _s(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, "${bg(l)}", _)`;for(let l of s)c+=`, collection_remover(C, "${Sg(l)}", _)`;for(let l of u)c+=`, collection_setter(C, "${wg(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 O(this,se,"f").getNeighbourhoodProxy(O(this,oe,"f").uuid)}get ai(){return O(this,se,"f").aiClient}async subscribeInfer(t){let e=new Ss(this.uuid,t,O(this,se,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new Ss(this.uuid,t,O(this,se,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};oe=new WeakMap,se=new WeakMap,mn=new WeakMap,yn=new WeakMap,gn=new WeakMap,ia=new WeakMap;var Dr=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},q=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)},K,aa,oa,sa,es,ca,ts,rs,tt=`
|
|
62
62
|
author
|
|
63
63
|
timestamp
|
|
64
64
|
status
|
|
65
65
|
data { source, predicate, target }
|
|
66
66
|
proof { valid, invalid, signature, key }
|
|
67
|
-
`,
|
|
67
|
+
`,oi=`
|
|
68
68
|
uuid
|
|
69
69
|
name
|
|
70
70
|
sharedUrl
|
|
71
71
|
state
|
|
72
|
+
owners
|
|
72
73
|
neighbourhood {
|
|
73
74
|
data {
|
|
74
75
|
linkLanguage
|
|
@@ -84,73 +85,73 @@ neighbourhood {
|
|
|
84
85
|
}
|
|
85
86
|
author
|
|
86
87
|
}
|
|
87
|
-
`,
|
|
88
|
+
`,ws=class{constructor(e,r=!0){K.set(this,void 0),aa.set(this,void 0),oa.set(this,void 0),sa.set(this,void 0),es.set(this,void 0),ca.set(this,void 0),ts.set(this,void 0),rs.set(this,void 0),Dr(this,K,e,"f"),Dr(this,aa,[],"f"),Dr(this,oa,[],"f"),Dr(this,sa,[],"f"),Dr(this,es,[],"f"),r&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Dr(this,ca,e,"f")}setNeighbourhoodClient(e){Dr(this,ts,e,"f")}setAIClient(e){Dr(this,rs,e,"f")}get aiClient(){return q(this,rs,"f")}async all(){let{perspectives:e}=k(await q(this,K,"f").query({query:I`query perspectives {
|
|
88
89
|
perspectives {
|
|
89
|
-
${
|
|
90
|
+
${oi}
|
|
90
91
|
}
|
|
91
|
-
}`}));return e.map(r=>new
|
|
92
|
+
}`}));return e.map(r=>new hi(r,this))}async byUUID(e){let{perspective:r}=k(await q(this,K,"f").query({query:I`query perspective($uuid: String!) {
|
|
92
93
|
perspective(uuid: $uuid) {
|
|
93
|
-
${
|
|
94
|
+
${oi}
|
|
94
95
|
}
|
|
95
|
-
}`,variables:{uuid:e}}));return r?new
|
|
96
|
+
}`,variables:{uuid:e}}));return r?new hi(r,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:r}=k(await q(this,K,"f").query({query:I`query perspectiveSnapshot($uuid: String!) {
|
|
96
97
|
perspectiveSnapshot(uuid: $uuid) {
|
|
97
98
|
links { ${tt} }
|
|
98
99
|
}
|
|
99
|
-
}`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=
|
|
100
|
+
}`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectivePublishSnapshot($uuid: String!) {
|
|
100
101
|
perspectivePublishSnapshot(uuid: $uuid)
|
|
101
|
-
}`,variables:{uuid:e}}));return r}async queryLinks(e,r){let{perspectiveQueryLinks:n}=
|
|
102
|
+
}`,variables:{uuid:e}}));return r}async queryLinks(e,r){let{perspectiveQueryLinks:n}=k(await q(this,K,"f").query({query:I`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
102
103
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
103
104
|
${tt}
|
|
104
105
|
}
|
|
105
|
-
}`,variables:{uuid:e,query:r}}));return n}async queryProlog(e,r){let{perspectiveQueryProlog:n}=
|
|
106
|
+
}`,variables:{uuid:e,query:r}}));return n}async queryProlog(e,r){let{perspectiveQueryProlog:n}=k(await q(this,K,"f").query({query:I`query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
106
107
|
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
107
|
-
}`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async querySurrealDB(e,r){let{perspectiveQuerySurrealDb:n}=
|
|
108
|
+
}`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async querySurrealDB(e,r){let{perspectiveQuerySurrealDb:n}=k(await q(this,K,"f").query({query:I`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
|
|
108
109
|
perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
|
|
109
|
-
}`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async subscribeQuery(e,r){let{perspectiveSubscribeQuery:n}=
|
|
110
|
+
}`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async subscribeQuery(e,r){let{perspectiveSubscribeQuery:n}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
|
|
110
111
|
perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
|
|
111
112
|
subscriptionId
|
|
112
113
|
result
|
|
113
114
|
}
|
|
114
|
-
}`,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}=
|
|
115
|
+
}`,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 q(this,K,"f").mutate({mutation:I`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
|
|
115
116
|
perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
|
|
116
117
|
subscriptionId
|
|
117
118
|
result
|
|
118
119
|
}
|
|
119
|
-
}`,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}=
|
|
120
|
+
}`,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 q(this,K,"f").mutate({mutation:I`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
|
|
120
121
|
perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
121
|
-
}`,variables:{uuid:e,subscriptionId:r}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,r){let{perspectiveDisposeSurrealQuerySubscription:n}=
|
|
122
|
+
}`,variables:{uuid:e,subscriptionId:r}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,r){let{perspectiveDisposeSurrealQuerySubscription:n}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
122
123
|
perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
123
124
|
}`,variables:{uuid:e,subscriptionId:r}}));return n}subscribeToQueryUpdates(e,r){let n=q(this,K,"f").subscribe({query:I`
|
|
124
125
|
subscription perspectiveQuerySubscription($subscriptionId: String!) {
|
|
125
126
|
perspectiveQuerySubscription(subscriptionId: $subscriptionId)
|
|
126
127
|
}
|
|
127
|
-
`,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}=
|
|
128
|
+
`,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 q(this,K,"f").mutate({mutation:I`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
128
129
|
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
129
|
-
}`,variables:{uuid:e,subscriptionId:r}}));return n}async disposeQuerySubscription(e,r){let{perspectiveDisposeQuerySubscription:n}=
|
|
130
|
+
}`,variables:{uuid:e,subscriptionId:r}}));return n}async disposeQuerySubscription(e,r){let{perspectiveDisposeQuerySubscription:n}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
130
131
|
perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
131
|
-
}`,variables:{uuid:e,subscriptionId:r}}));return n}async add(e){let{perspectiveAdd:r}=
|
|
132
|
+
}`,variables:{uuid:e,subscriptionId:r}}));return n}async add(e){let{perspectiveAdd:r}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveAdd($name: String!) {
|
|
132
133
|
perspectiveAdd(name: $name) {
|
|
133
|
-
${
|
|
134
|
+
${oi}
|
|
134
135
|
}
|
|
135
|
-
}`,variables:{name:e}}));return new
|
|
136
|
+
}`,variables:{name:e}}));return new hi(r,this)}async update(e,r){let{perspectiveUpdate:n}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveUpdate($uuid: String!, $name: String!) {
|
|
136
137
|
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
137
|
-
${
|
|
138
|
+
${oi}
|
|
138
139
|
}
|
|
139
|
-
}`,variables:{uuid:e,name:r}}));return new
|
|
140
|
+
}`,variables:{uuid:e,name:r}}));return new hi(n,this)}async remove(e){return k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveRemove($uuid: String!) {
|
|
140
141
|
perspectiveRemove(uuid: $uuid)
|
|
141
|
-
}`,variables:{uuid:e}}))}async addLink(e,r,n="shared",i){let{perspectiveAddLink:a}=
|
|
142
|
+
}`,variables:{uuid:e}}))}async addLink(e,r,n="shared",i){let{perspectiveAddLink:a}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
142
143
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
143
144
|
${tt}
|
|
144
145
|
}
|
|
145
|
-
}`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async addLinks(e,r,n="shared",i){let{perspectiveAddLinks:a}=
|
|
146
|
+
}`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async addLinks(e,r,n="shared",i){let{perspectiveAddLinks:a}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
146
147
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
147
148
|
${tt}
|
|
148
149
|
}
|
|
149
|
-
}`,variables:{uuid:e,links:r,status:n,batchId:i}}));return a}async removeLinks(e,r,n){let{perspectiveRemoveLinks:i}=
|
|
150
|
+
}`,variables:{uuid:e,links:r,status:n,batchId:i}}));return a}async removeLinks(e,r,n){let{perspectiveRemoveLinks:i}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
150
151
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
151
152
|
${tt}
|
|
152
153
|
}
|
|
153
|
-
}`,variables:{uuid:e,links:r,batchId:n}}));return i}async linkMutations(e,r,n){let{perspectiveLinkMutations:i}=
|
|
154
|
+
}`,variables:{uuid:e,links:r,batchId:n}}));return i}async linkMutations(e,r,n){let{perspectiveLinkMutations:i}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
154
155
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
155
156
|
additions {
|
|
156
157
|
${tt}
|
|
@@ -159,37 +160,37 @@ neighbourhood {
|
|
|
159
160
|
${tt}
|
|
160
161
|
}
|
|
161
162
|
}
|
|
162
|
-
}`,variables:{uuid:e,mutations:r,status:n}}));return i}async addLinkExpression(e,r,n="shared",i){let{perspectiveAddLinkExpression:a}=
|
|
163
|
+
}`,variables:{uuid:e,mutations:r,status:n}}));return i}async addLinkExpression(e,r,n="shared",i){let{perspectiveAddLinkExpression:a}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
163
164
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
164
165
|
${tt}
|
|
165
166
|
}
|
|
166
|
-
}`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async updateLink(e,r,n,i){let{perspectiveUpdateLink:a}=
|
|
167
|
+
}`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async updateLink(e,r,n,i){let{perspectiveUpdateLink:a}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
167
168
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
168
169
|
${tt}
|
|
169
170
|
}
|
|
170
|
-
}`,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}=
|
|
171
|
+
}`,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 q(this,K,"f").mutate({mutation:I`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
|
|
171
172
|
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
172
|
-
}`,variables:{uuid:e,link:r,batchId:n}}));return i}async addSdna(e,r,n,i){return
|
|
173
|
+
}`,variables:{uuid:e,link:r,batchId:n}}));return i}async addSdna(e,r,n,i){return k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
|
|
173
174
|
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType)
|
|
174
|
-
}`,variables:{uuid:e,name:r,sdnaCode:n,sdnaType:i}})).perspectiveAddSdna}async executeCommands(e,r,n,i,a){return
|
|
175
|
+
}`,variables:{uuid:e,name:r,sdnaCode:n,sdnaType:i}})).perspectiveAddSdna}async executeCommands(e,r,n,i,a){return k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
175
176
|
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
176
|
-
}`,variables:{uuid:e,commands:r,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,r,n,i,a){return
|
|
177
|
+
}`,variables:{uuid:e,commands:r,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,r,n,i,a){return k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
177
178
|
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
178
|
-
}`,variables:{uuid:e,subjectClass:r,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,r,n){return
|
|
179
|
+
}`,variables:{uuid:e,subjectClass:r,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,r,n){return k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
179
180
|
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
180
|
-
}`,variables:{uuid:e,subjectClass:r,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await q(this,
|
|
181
|
-
perspectiveAdded { ${
|
|
181
|
+
}`,variables:{uuid:e,subjectClass:r,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await q(this,ca,"f").get(e)}async createExpression(e,r){return await q(this,ca,"f").create(e,r)}addPerspectiveAddedListener(e){q(this,aa,"f").push(e)}subscribePerspectiveAdded(){q(this,K,"f").subscribe({query:I` subscription {
|
|
182
|
+
perspectiveAdded { ${oi} }
|
|
182
183
|
}
|
|
183
|
-
`}).subscribe({next:e=>{q(this,
|
|
184
|
-
perspectiveUpdated { ${
|
|
184
|
+
`}).subscribe({next:e=>{q(this,aa,"f").forEach(r=>{r(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){q(this,oa,"f").push(e)}subscribePerspectiveUpdated(){q(this,K,"f").subscribe({query:I` subscription {
|
|
185
|
+
perspectiveUpdated { ${oi} }
|
|
185
186
|
}
|
|
186
|
-
`}).subscribe({next:e=>{q(this,
|
|
187
|
+
`}).subscribe({next:e=>{q(this,oa,"f").forEach(r=>{r(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){q(this,es,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,r){q(this,K,"f").subscribe({query:I` subscription {
|
|
187
188
|
perspectiveSyncStateChange(uuid: "${e}")
|
|
188
189
|
}
|
|
189
|
-
`}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){q(this,
|
|
190
|
+
`}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){q(this,sa,"f").push(e)}subscribePerspectiveRemoved(){q(this,K,"f").subscribe({query:I` subscription {
|
|
190
191
|
perspectiveRemoved
|
|
191
192
|
}
|
|
192
|
-
`}).subscribe({next:e=>{q(this,
|
|
193
|
+
`}).subscribe({next:e=>{q(this,sa,"f").forEach(r=>{r(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,r){q(this,K,"f").subscribe({query:I` subscription {
|
|
193
194
|
perspectiveLinkAdded(uuid: "${e}") { ${tt} }
|
|
194
195
|
}
|
|
195
196
|
`}).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){q(this,K,"f").subscribe({query:I` subscription {
|
|
@@ -205,9 +206,9 @@ neighbourhood {
|
|
|
205
206
|
}
|
|
206
207
|
}
|
|
207
208
|
}
|
|
208
|
-
`}).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
|
|
209
|
+
`}).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 Tu(q(this,ts,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:r}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveCreateBatch($uuid: String!) {
|
|
209
210
|
perspectiveCreateBatch(uuid: $uuid)
|
|
210
|
-
}`,variables:{uuid:e}}));return r}async commitBatch(e,r){let{perspectiveCommitBatch:n}=
|
|
211
|
+
}`,variables:{uuid:e}}));return r}async commitBatch(e,r){let{perspectiveCommitBatch:n}=k(await q(this,K,"f").mutate({mutation:I`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
211
212
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
212
213
|
additions {
|
|
213
214
|
${tt}
|
|
@@ -216,7 +217,7 @@ neighbourhood {
|
|
|
216
217
|
${tt}
|
|
217
218
|
}
|
|
218
219
|
}
|
|
219
|
-
}`,variables:{uuid:e,batchId:r}}));return n}};K=new WeakMap,
|
|
220
|
+
}`,variables:{uuid:e,batchId:r}}));return n}};K=new WeakMap,aa=new WeakMap,oa=new WeakMap,sa=new WeakMap,es=new WeakMap,ca=new WeakMap,ts=new WeakMap,rs=new WeakMap;var Lo=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},ae=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)},le,ua,la,fa,Xi=`
|
|
220
221
|
did
|
|
221
222
|
directMessageLanguage
|
|
222
223
|
perspective {
|
|
@@ -230,7 +231,7 @@ neighbourhood {
|
|
|
230
231
|
}
|
|
231
232
|
}
|
|
232
233
|
}
|
|
233
|
-
`,
|
|
234
|
+
`,Fo=`
|
|
234
235
|
requestId
|
|
235
236
|
revoked
|
|
236
237
|
auth {
|
|
@@ -246,128 +247,136 @@ neighbourhood {
|
|
|
246
247
|
can
|
|
247
248
|
}
|
|
248
249
|
}
|
|
249
|
-
`,
|
|
250
|
+
`,si=`
|
|
250
251
|
isInitialized
|
|
251
252
|
isUnlocked
|
|
252
253
|
did
|
|
253
254
|
didDocument
|
|
254
255
|
error
|
|
255
|
-
|
|
256
|
+
`,$o=`
|
|
256
257
|
did
|
|
257
258
|
didSigningKeyId
|
|
258
259
|
deviceKeyType
|
|
259
260
|
deviceKey
|
|
260
261
|
deviceKeySignedByDid
|
|
261
262
|
didSignedByDeviceKey
|
|
262
|
-
`,
|
|
263
|
+
`,xg=`
|
|
263
264
|
signature
|
|
264
265
|
publicKey
|
|
265
|
-
`,
|
|
266
|
+
`,Aa=class{constructor(e,r=!0){le.set(this,void 0),ua.set(this,void 0),la.set(this,void 0),fa.set(this,void 0),Lo(this,le,e,"f"),Lo(this,la,[],"f"),Lo(this,fa,[],"f"),Lo(this,ua,[],"f"),r&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await ae(this,le,"f").query({query:I`query agent { agent { ${Xi} } }`})),r=new Mr(e.did,e.perspective);return r.directMessageLanguage=e.directMessageLanguage,r}async status(){let{agentStatus:e}=k(await ae(this,le,"f").query({query:I`query agentStatus {
|
|
266
267
|
agentStatus {
|
|
267
|
-
${
|
|
268
|
+
${si}
|
|
268
269
|
}
|
|
269
|
-
}`}));return new
|
|
270
|
+
}`}));return new Dt(e)}async generate(e){let{agentGenerate:r}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentGenerate(
|
|
270
271
|
$passphrase: String!
|
|
271
272
|
) {
|
|
272
273
|
agentGenerate(passphrase: $passphrase) {
|
|
273
|
-
${
|
|
274
|
+
${si}
|
|
274
275
|
}
|
|
275
|
-
}`,variables:{passphrase:e}}));return new
|
|
276
|
+
}`,variables:{passphrase:e}}));return new Dt(r)}async import(e){let{did:r,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentImport(
|
|
276
277
|
$did: String!,
|
|
277
278
|
$didDocument: String!,
|
|
278
279
|
$keystore: String!,
|
|
279
280
|
$passphrase: String!
|
|
280
281
|
) {
|
|
281
282
|
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
282
|
-
${
|
|
283
|
+
${si}
|
|
283
284
|
}
|
|
284
|
-
}`,variables:{did:r,didDocument:n,keystore:i,passphrase:a}}));return new
|
|
285
|
+
}`,variables:{did:r,didDocument:n,keystore:i,passphrase:a}}));return new Dt(o)}async lock(e){let{agentLock:r}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentLock($passphrase: String!) {
|
|
285
286
|
agentLock(passphrase: $passphrase) {
|
|
286
|
-
${
|
|
287
|
+
${si}
|
|
287
288
|
}
|
|
288
|
-
}`,variables:{passphrase:e}}));return new
|
|
289
|
+
}`,variables:{passphrase:e}}));return new Dt(r)}async unlock(e,r=!0){let{agentUnlock:n}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
|
|
289
290
|
agentUnlock(passphrase: $passphrase, holochain: $holochain) {
|
|
290
|
-
${
|
|
291
|
+
${si}
|
|
291
292
|
}
|
|
292
|
-
}`,variables:{passphrase:e,holochain:r}}));return new
|
|
293
|
+
}`,variables:{passphrase:e,holochain:r}}));return new Dt(n)}async byDID(e){let{agentByDID:r}=k(await ae(this,le,"f").query({query:I`query agentByDID($did: String!) {
|
|
293
294
|
agentByDID(did: $did) {
|
|
294
|
-
${
|
|
295
|
+
${Xi}
|
|
295
296
|
}
|
|
296
|
-
}`,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}=
|
|
297
|
+
}`,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 ae(this,le,"f").mutate({mutation:I`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
|
|
297
298
|
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
298
|
-
${
|
|
299
|
+
${Xi}
|
|
299
300
|
}
|
|
300
|
-
}`,variables:{perspective:r}})),i=n,a=new Mr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new
|
|
301
|
+
}`,variables:{perspective:r}})),i=n,a=new Mr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new ws(ae(this,le,"f")),n=new Aa(ae(this,le,"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 ae(this,le,"f").mutate({mutation:I`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
|
|
301
302
|
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
302
|
-
${
|
|
303
|
+
${Xi}
|
|
303
304
|
}
|
|
304
|
-
}`,variables:{directMessageLanguage:e}})),n=r,i=new Mr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=
|
|
305
|
+
}`,variables:{directMessageLanguage:e}})),n=r,i=new Mr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
305
306
|
agentAddEntanglementProofs(proofs: $proofs) {
|
|
306
|
-
${
|
|
307
|
+
${$o}
|
|
307
308
|
}
|
|
308
|
-
}`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=
|
|
309
|
+
}`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
309
310
|
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
310
|
-
${
|
|
311
|
+
${$o}
|
|
311
312
|
}
|
|
312
|
-
}`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=
|
|
313
|
+
}`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await ae(this,le,"f").query({query:I`query agentGetEntanglementProofs {
|
|
313
314
|
agentGetEntanglementProofs {
|
|
314
|
-
${
|
|
315
|
+
${$o}
|
|
315
316
|
}
|
|
316
|
-
}`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:n}=
|
|
317
|
+
}`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:n}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
|
|
317
318
|
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
318
|
-
${
|
|
319
|
+
${$o}
|
|
319
320
|
}
|
|
320
|
-
}`,variables:{deviceKey:e,deviceKeyType:r}}));return n}addUpdatedListener(e){ae(this,
|
|
321
|
-
agentUpdated { ${
|
|
321
|
+
}`,variables:{deviceKey:e,deviceKeyType:r}}));return n}addUpdatedListener(e){ae(this,la,"f").push(e)}addAppChangedListener(e){ae(this,ua,"f").push(e)}subscribeAgentUpdated(){ae(this,le,"f").subscribe({query:I` subscription {
|
|
322
|
+
agentUpdated { ${Xi} }
|
|
322
323
|
}
|
|
323
|
-
`}).subscribe({next:e=>{let r=e.data.agentUpdated;ae(this,
|
|
324
|
+
`}).subscribe({next:e=>{let r=e.data.agentUpdated;ae(this,la,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}subscribeAppsChanged(){ae(this,le,"f").subscribe({query:I` subscription {
|
|
324
325
|
agentAppsChanged {
|
|
325
|
-
${
|
|
326
|
+
${Fo}
|
|
326
327
|
}
|
|
327
328
|
}
|
|
328
|
-
`}).subscribe({next:e=>{ae(this,
|
|
329
|
-
agentStatusChanged { ${
|
|
329
|
+
`}).subscribe({next:e=>{ae(this,ua,"f").forEach(r=>{r()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){ae(this,fa,"f").push(e)}subscribeAgentStatusChanged(){ae(this,le,"f").subscribe({query:I` subscription {
|
|
330
|
+
agentStatusChanged { ${si} }
|
|
330
331
|
}
|
|
331
|
-
`}).subscribe({next:e=>{let r=e.data.agentStatusChanged;ae(this,
|
|
332
|
+
`}).subscribe({next:e=>{let r=e.data.agentStatusChanged;ae(this,fa,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:r}=k(await ae(this,le,"f").mutate({mutation:I`
|
|
332
333
|
mutation agentRequestCapability($authInfo: AuthInfoInput!) {
|
|
333
334
|
agentRequestCapability(authInfo: $authInfo)
|
|
334
335
|
}
|
|
335
|
-
`,variables:{authInfo:e}}));return r}async permitCapability(e){let{agentPermitCapability:r}=
|
|
336
|
+
`,variables:{authInfo:e}}));return r}async permitCapability(e){let{agentPermitCapability:r}=k(await ae(this,le,"f").mutate({mutation:I`
|
|
336
337
|
mutation agentPermitCapability($auth: String!) {
|
|
337
338
|
agentPermitCapability(auth: $auth)
|
|
338
339
|
}
|
|
339
|
-
`,variables:{auth:e}}));return r}async generateJwt(e,r){let{agentGenerateJwt:n}=
|
|
340
|
+
`,variables:{auth:e}}));return r}async generateJwt(e,r){let{agentGenerateJwt:n}=k(await ae(this,le,"f").mutate({mutation:I`
|
|
340
341
|
mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
341
342
|
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
342
343
|
}
|
|
343
|
-
`,variables:{requestId:e,rand:r}}));return n}async getApps(){let{agentGetApps:e}=
|
|
344
|
+
`,variables:{requestId:e,rand:r}}));return n}async getApps(){let{agentGetApps:e}=k(await ae(this,le,"f").mutate({mutation:I`query agentGetApps {
|
|
344
345
|
agentGetApps {
|
|
345
|
-
${
|
|
346
|
+
${Fo}
|
|
346
347
|
}
|
|
347
|
-
}`}));return e}async removeApp(e){let{agentRemoveApp:r}=
|
|
348
|
+
}`}));return e}async removeApp(e){let{agentRemoveApp:r}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentRemoveApp($requestId: String!) {
|
|
348
349
|
agentRemoveApp(requestId: $requestId) {
|
|
349
|
-
${
|
|
350
|
+
${Fo}
|
|
350
351
|
}
|
|
351
|
-
}`,variables:{requestId:e}}));return r}async revokeToken(e){let{agentRevokeToken:r}=
|
|
352
|
+
}`,variables:{requestId:e}}));return r}async revokeToken(e){let{agentRevokeToken:r}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentRevokeToken($requestId: String!) {
|
|
352
353
|
agentRevokeToken(requestId: $requestId) {
|
|
353
|
-
${
|
|
354
|
+
${Fo}
|
|
354
355
|
}
|
|
355
|
-
}`,variables:{requestId:e}}));return r}async isLocked(){let{agentIsLocked:e}=
|
|
356
|
+
}`,variables:{requestId:e}}));return r}async isLocked(){let{agentIsLocked:e}=k(await ae(this,le,"f").mutate({mutation:I`
|
|
356
357
|
query agentIsLocked {
|
|
357
358
|
agentIsLocked
|
|
358
359
|
}
|
|
359
|
-
`}));return e}async signMessage(e){let{agentSignMessage:r}=
|
|
360
|
+
`}));return e}async signMessage(e){let{agentSignMessage:r}=k(await ae(this,le,"f").mutate({mutation:I`mutation agentSignMessage($message: String!) {
|
|
360
361
|
agentSignMessage(message: $message) {
|
|
361
|
-
${
|
|
362
|
+
${xg}
|
|
363
|
+
}
|
|
364
|
+
}`,variables:{message:e}}));return r}async createUser(e,r){let{runtimeCreateUser:n}=k(await ae(this,le,"f").mutate({mutation:I`mutation runtimeCreateUser($email: String!, $password: String!) {
|
|
365
|
+
runtimeCreateUser(email: $email, password: $password) {
|
|
366
|
+
did
|
|
367
|
+
success
|
|
368
|
+
error
|
|
362
369
|
}
|
|
363
|
-
}`,variables:{
|
|
370
|
+
}`,variables:{email:e,password:r}}));return n}async loginUser(e,r){let{runtimeLoginUser:n}=k(await ae(this,le,"f").mutate({mutation:I`mutation runtimeLoginUser($email: String!, $password: String!) {
|
|
371
|
+
runtimeLoginUser(email: $email, password: $password)
|
|
372
|
+
}`,variables:{email:e,password:r}}));return n}};le=new WeakMap,ua=new WeakMap,la=new WeakMap,fa=new WeakMap;var Ig=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},Nr=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)},jt,yp=`
|
|
364
373
|
name
|
|
365
374
|
address
|
|
366
375
|
settings
|
|
367
376
|
icon { code }
|
|
368
377
|
constructorIcon { code }
|
|
369
378
|
settingsIcon { code }
|
|
370
|
-
`,
|
|
379
|
+
`,gp=`
|
|
371
380
|
name
|
|
372
381
|
address
|
|
373
382
|
description
|
|
@@ -377,45 +386,45 @@ neighbourhood {
|
|
|
377
386
|
templateAppliedParams
|
|
378
387
|
possibleTemplateParams
|
|
379
388
|
sourceCodeLink
|
|
380
|
-
`,
|
|
389
|
+
`,Ou=class{constructor(e){jt.set(this,void 0),Ig(this,jt,e,"f")}async byAddress(e){let{language:r}=k(await Nr(this,jt,"f").query({query:I`query byAddress($address: String!) {
|
|
381
390
|
language(address: $address) {
|
|
382
|
-
${
|
|
391
|
+
${yp}
|
|
383
392
|
}
|
|
384
|
-
}`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=
|
|
393
|
+
}`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=k(await Nr(this,jt,"f").query({query:I`query byFilter($filter: String!) {
|
|
385
394
|
languages(filter: $filter) {
|
|
386
|
-
${
|
|
395
|
+
${yp}
|
|
387
396
|
}
|
|
388
|
-
}`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:n}=
|
|
397
|
+
}`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:n}=k(await Nr(this,jt,"f").mutate({mutation:I`mutation writeSettings($languageAddress: String!, $settings: String!) {
|
|
389
398
|
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
390
|
-
}`,variables:{languageAddress:e,settings:r}}));return n}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:n}=
|
|
399
|
+
}`,variables:{languageAddress:e,settings:r}}));return n}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:n}=k(await Nr(this,jt,"f").mutate({mutation:I`mutation languageApplyTemplateAndPublish(
|
|
391
400
|
$sourceLanguageHash: String!,
|
|
392
401
|
$templateData: String!,
|
|
393
402
|
) {
|
|
394
403
|
languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
|
|
395
404
|
name, address
|
|
396
405
|
}
|
|
397
|
-
}`,variables:{sourceLanguageHash:e,templateData:r}}));return n}async publish(e,r){let{languagePublish:n}=
|
|
406
|
+
}`,variables:{sourceLanguageHash:e,templateData:r}}));return n}async publish(e,r){let{languagePublish:n}=k(await Nr(this,jt,"f").mutate({mutation:I`mutation languagePublish(
|
|
398
407
|
$languagePath: String!,
|
|
399
408
|
$languageMeta: LanguageMetaInput!,
|
|
400
409
|
) {
|
|
401
410
|
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
402
|
-
${
|
|
411
|
+
${gp}
|
|
403
412
|
}
|
|
404
|
-
}`,variables:{languagePath:e,languageMeta:r}}));return n}async meta(e){let{languageMeta:r}=
|
|
413
|
+
}`,variables:{languagePath:e,languageMeta:r}}));return n}async meta(e){let{languageMeta:r}=k(await Nr(this,jt,"f").query({query:I`query languageMeta(
|
|
405
414
|
$address: String!,
|
|
406
415
|
) {
|
|
407
416
|
languageMeta(address: $address) {
|
|
408
|
-
${
|
|
417
|
+
${gp}
|
|
409
418
|
}
|
|
410
|
-
}`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=
|
|
419
|
+
}`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=k(await Nr(this,jt,"f").query({query:I`query languageSource(
|
|
411
420
|
$address: String!,
|
|
412
421
|
) {
|
|
413
422
|
languageSource(address: $address)
|
|
414
|
-
}`,variables:{address:e}}));return r}async remove(e){let{languageRemove:r}=
|
|
423
|
+
}`,variables:{address:e}}));return r}async remove(e){let{languageRemove:r}=k(await Nr(this,jt,"f").mutate({mutation:I`mutation languageRemove(
|
|
415
424
|
$address: String!,
|
|
416
425
|
) {
|
|
417
426
|
languageRemove(address: $address)
|
|
418
|
-
}`,variables:{address:e}}));return r}};
|
|
427
|
+
}`,variables:{address:e}}));return r}};jt=new WeakMap;var Tg=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)},it,di,Au=class{constructor(e){it.set(this,void 0),di.set(this,new Map),Tg(this,it,e,"f")}async publishFromPerspective(e,r,n){let{neighbourhoodPublishFromPerspective:i}=k(await Ze(this,it,"f").mutate({mutation:I`mutation neighbourhoodPublishFromPerspective(
|
|
419
428
|
$linkLanguage: String!,
|
|
420
429
|
$meta: PerspectiveInput!,
|
|
421
430
|
$perspectiveUUID: String!
|
|
@@ -425,7 +434,7 @@ neighbourhood {
|
|
|
425
434
|
meta: $meta,
|
|
426
435
|
perspectiveUUID: $perspectiveUUID
|
|
427
436
|
)
|
|
428
|
-
}`,variables:{perspectiveUUID:e,linkLanguage:r,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=
|
|
437
|
+
}`,variables:{perspectiveUUID:e,linkLanguage:r,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=k(await Ze(this,it,"f").mutate({mutation:I`mutation neighbourhoodJoinFromUrl($url: String!) {
|
|
429
438
|
neighbourhoodJoinFromUrl(url: $url) {
|
|
430
439
|
uuid
|
|
431
440
|
name
|
|
@@ -447,11 +456,11 @@ neighbourhood {
|
|
|
447
456
|
author
|
|
448
457
|
}
|
|
449
458
|
}
|
|
450
|
-
}`,variables:{url:e}}));return r}async otherAgents(e){let{neighbourhoodOtherAgents:r}=
|
|
459
|
+
}`,variables:{url:e}}));return r}async otherAgents(e){let{neighbourhoodOtherAgents:r}=k(await Ze(this,it,"f").query({query:I`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
|
|
451
460
|
neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
|
|
452
|
-
}`,variables:{perspectiveUUID:e}}));return r}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:r}=
|
|
461
|
+
}`,variables:{perspectiveUUID:e}}));return r}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:r}=k(await Ze(this,it,"f").query({query:I`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
|
|
453
462
|
neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
|
|
454
|
-
}`,variables:{perspectiveUUID:e}}));return r}async onlineAgents(e){let{neighbourhoodOnlineAgents:r}=
|
|
463
|
+
}`,variables:{perspectiveUUID:e}}));return r}async onlineAgents(e){let{neighbourhoodOnlineAgents:r}=k(await Ze(this,it,"f").query({query:I`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
|
|
455
464
|
neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
|
|
456
465
|
did
|
|
457
466
|
status {
|
|
@@ -468,7 +477,7 @@ neighbourhood {
|
|
|
468
477
|
proof { valid, invalid, signature, key }
|
|
469
478
|
}
|
|
470
479
|
}
|
|
471
|
-
}`,variables:{perspectiveUUID:e}}));return r}async setOnlineStatus(e,r){let{neighbourhoodSetOnlineStatus:n}=
|
|
480
|
+
}`,variables:{perspectiveUUID:e}}));return r}async setOnlineStatus(e,r){let{neighbourhoodSetOnlineStatus:n}=k(await Ze(this,it,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatus(
|
|
472
481
|
$perspectiveUUID: String!,
|
|
473
482
|
$status: PerspectiveInput!
|
|
474
483
|
) {
|
|
@@ -476,7 +485,7 @@ neighbourhood {
|
|
|
476
485
|
perspectiveUUID: $perspectiveUUID,
|
|
477
486
|
status: $status
|
|
478
487
|
)
|
|
479
|
-
}`,variables:{perspectiveUUID:e,status:r}}));return n}async setOnlineStatusU(e,r){let{neighbourhoodSetOnlineStatusU:n}=
|
|
488
|
+
}`,variables:{perspectiveUUID:e,status:r}}));return n}async setOnlineStatusU(e,r){let{neighbourhoodSetOnlineStatusU:n}=k(await Ze(this,it,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatusU(
|
|
480
489
|
$perspectiveUUID: String!,
|
|
481
490
|
$status: PerspectiveUnsignedInput!
|
|
482
491
|
) {
|
|
@@ -484,7 +493,7 @@ neighbourhood {
|
|
|
484
493
|
perspectiveUUID: $perspectiveUUID,
|
|
485
494
|
status: $status
|
|
486
495
|
)
|
|
487
|
-
}`,variables:{perspectiveUUID:e,status:r}}));return n}async sendSignal(e,r,n){let{neighbourhoodSendSignal:i}=
|
|
496
|
+
}`,variables:{perspectiveUUID:e,status:r}}));return n}async sendSignal(e,r,n){let{neighbourhoodSendSignal:i}=k(await Ze(this,it,"f").mutate({mutation:I`mutation neighbourhoodSendSignal(
|
|
488
497
|
$perspectiveUUID: String!,
|
|
489
498
|
$remoteAgentDid: String!,
|
|
490
499
|
$payload: PerspectiveInput!
|
|
@@ -494,7 +503,7 @@ neighbourhood {
|
|
|
494
503
|
remoteAgentDid: $remoteAgentDid,
|
|
495
504
|
payload: $payload
|
|
496
505
|
)
|
|
497
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendSignalU(e,r,n){let{neighbourhoodSendSignalU:i}=
|
|
506
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendSignalU(e,r,n){let{neighbourhoodSendSignalU:i}=k(await Ze(this,it,"f").mutate({mutation:I`mutation neighbourhoodSendSignalU(
|
|
498
507
|
$perspectiveUUID: String!,
|
|
499
508
|
$remoteAgentDid: String!,
|
|
500
509
|
$payload: PerspectiveUnsignedInput!
|
|
@@ -504,7 +513,7 @@ neighbourhood {
|
|
|
504
513
|
remoteAgentDid: $remoteAgentDid,
|
|
505
514
|
payload: $payload
|
|
506
515
|
)
|
|
507
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r,n=!1){let{neighbourhoodSendBroadcast:i}=
|
|
516
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r,n=!1){let{neighbourhoodSendBroadcast:i}=k(await Ze(this,it,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcast(
|
|
508
517
|
$perspectiveUUID: String!,
|
|
509
518
|
$payload: PerspectiveInput!,
|
|
510
519
|
$loopback: Boolean
|
|
@@ -514,7 +523,7 @@ neighbourhood {
|
|
|
514
523
|
payload: $payload,
|
|
515
524
|
loopback: $loopback
|
|
516
525
|
)
|
|
517
|
-
}`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}async sendBroadcastU(e,r,n=!1){let{neighbourhoodSendBroadcastU:i}=
|
|
526
|
+
}`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}async sendBroadcastU(e,r,n=!1){let{neighbourhoodSendBroadcastU:i}=k(await Ze(this,it,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcastU(
|
|
518
527
|
$perspectiveUUID: String!,
|
|
519
528
|
$payload: PerspectiveUnsignedInput!,
|
|
520
529
|
$loopback: Boolean
|
|
@@ -524,7 +533,7 @@ neighbourhood {
|
|
|
524
533
|
payload: $payload,
|
|
525
534
|
loopback: $loopback
|
|
526
535
|
)
|
|
527
|
-
}`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}dispatchSignal(e,r){let n=
|
|
536
|
+
}`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}dispatchSignal(e,r){let n=Ze(this,di,"f").get(e);n&&n.forEach(i=>i(r))}async subscribeToSignals(e){let r=this;await Ze(this,it,"f").subscribe({query:I`subscription neighbourhoodSignal($perspectiveUUID: String!) {
|
|
528
537
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
529
538
|
author
|
|
530
539
|
timestamp
|
|
@@ -539,7 +548,7 @@ neighbourhood {
|
|
|
539
548
|
}
|
|
540
549
|
proof { valid, invalid, signature, key }
|
|
541
550
|
}
|
|
542
|
-
}`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{let{neighbourhoodSignal:i}=
|
|
551
|
+
}`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{let{neighbourhoodSignal:i}=k(n);r.dispatchSignal(e,i)}})}async addSignalHandler(e,r){let n=Ze(this,di,"f").get(e);n||(n=[],Ze(this,di,"f").set(e,n),await this.subscribeToSignals(e)),n.push(r)}removeSignalHandler(e,r){let n=Ze(this,di,"f").get(e);if(n){let i=n.indexOf(r);i>-1&&n.splice(i,1)}}};it=new WeakMap,di=new WeakMap;var Mo=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)},H,pa,da,ha,$d,jo=`
|
|
543
552
|
author
|
|
544
553
|
timestamp
|
|
545
554
|
data {
|
|
@@ -551,7 +560,7 @@ data {
|
|
|
551
560
|
}
|
|
552
561
|
}
|
|
553
562
|
proof { valid, invalid, signature, key }
|
|
554
|
-
`,
|
|
563
|
+
`,kg=`
|
|
555
564
|
description
|
|
556
565
|
appName
|
|
557
566
|
appUrl
|
|
@@ -560,72 +569,72 @@ trigger
|
|
|
560
569
|
perspectiveIds
|
|
561
570
|
webhookUrl
|
|
562
571
|
webhookAuth
|
|
563
|
-
`,
|
|
572
|
+
`,Md=`
|
|
564
573
|
id
|
|
565
574
|
granted
|
|
566
|
-
${
|
|
567
|
-
`,
|
|
568
|
-
notification { ${
|
|
575
|
+
${kg}
|
|
576
|
+
`,Og=`
|
|
577
|
+
notification { ${Md} }
|
|
569
578
|
perspectiveId
|
|
570
579
|
triggerMatch
|
|
571
|
-
`,
|
|
580
|
+
`,Du=class{constructor(e,r=!0){H.set(this,void 0),pa.set(this,void 0),da.set(this,void 0),ha.set(this,void 0),$d.set(this,void 0),Mo(this,H,e,"f"),Mo(this,pa,[],"f"),Mo(this,da,[],"f"),Mo(this,ha,[],"f"),r&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await G(this,H,"f").query({query:I`query runtimeInfo {
|
|
572
581
|
runtimeInfo {
|
|
573
582
|
ad4mExecutorVersion,
|
|
574
583
|
isInitialized,
|
|
575
584
|
isUnlocked
|
|
576
585
|
}
|
|
577
|
-
}`}));return e}async quit(){return
|
|
586
|
+
}`}));return e}async quit(){return k(await G(this,H,"f").mutate({mutation:I`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeOpenLink($url: String!) {
|
|
578
587
|
runtimeOpenLink(url: $url)
|
|
579
|
-
}`,variables:{url:e}}));return r}async addTrustedAgents(e){let{addTrustedAgents:r}=
|
|
588
|
+
}`,variables:{url:e}}));return r}async addTrustedAgents(e){let{addTrustedAgents:r}=k(await G(this,H,"f").mutate({mutation:I`mutation addTrustedAgents($agents: [String!]!) {
|
|
580
589
|
addTrustedAgents(agents: $agents)
|
|
581
|
-
}`,variables:{agents:e}}));return r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=
|
|
590
|
+
}`,variables:{agents:e}}));return r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=k(await G(this,H,"f").mutate({mutation:I`mutation deleteTrustedAgents($agents: [String!]!) {
|
|
582
591
|
deleteTrustedAgents(agents: $agents)
|
|
583
|
-
}`,variables:{agents:e}}));return r}async getTrustedAgents(){let{getTrustedAgents:e}=
|
|
592
|
+
}`,variables:{agents:e}}));return r}async getTrustedAgents(){let{getTrustedAgents:e}=k(await G(this,H,"f").query({query:I`query getTrustedAgents {
|
|
584
593
|
getTrustedAgents
|
|
585
|
-
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:r}=
|
|
594
|
+
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
586
595
|
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
587
|
-
}`,variables:{addresses:e}}));return r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=
|
|
596
|
+
}`,variables:{addresses:e}}));return r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
588
597
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
589
|
-
}`,variables:{addresses:e}}));return r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=
|
|
598
|
+
}`,variables:{addresses:e}}));return r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await G(this,H,"f").query({query:I`query runtimeKnownLinkLanguageTemplates {
|
|
590
599
|
runtimeKnownLinkLanguageTemplates
|
|
591
|
-
}`}));return e}async addFriends(e){let{runtimeAddFriends:r}=
|
|
600
|
+
}`}));return e}async addFriends(e){let{runtimeAddFriends:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeAddFriends($dids: [String!]!) {
|
|
592
601
|
runtimeAddFriends(dids: $dids)
|
|
593
|
-
}`,variables:{dids:e}}));return r}async removeFriends(e){let{runtimeRemoveFriends:r}=
|
|
602
|
+
}`,variables:{dids:e}}));return r}async removeFriends(e){let{runtimeRemoveFriends:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
594
603
|
runtimeRemoveFriends(dids: $dids)
|
|
595
|
-
}`,variables:{dids:e}}));return r}async friends(){let{runtimeFriends:e}=
|
|
604
|
+
}`,variables:{dids:e}}));return r}async friends(){let{runtimeFriends:e}=k(await G(this,H,"f").query({query:I`query runtimeFriends {
|
|
596
605
|
runtimeFriends
|
|
597
|
-
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=
|
|
606
|
+
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await G(this,H,"f").query({query:I`query runtimeHcAgentInfos {
|
|
598
607
|
runtimeHcAgentInfos
|
|
599
|
-
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=
|
|
608
|
+
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await G(this,H,"f").query({query:I`query runtimeGetNetworkMetrics {
|
|
600
609
|
runtimeGetNetworkMetrics
|
|
601
|
-
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=
|
|
610
|
+
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeRestartHolochain {
|
|
602
611
|
runtimeRestartHolochain
|
|
603
|
-
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:r}=
|
|
612
|
+
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
604
613
|
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
605
|
-
}`,variables:{agentInfos:e}}));return r}async verifyStringSignedByDid(e,r,n,i){let{runtimeVerifyStringSignedByDid:a}=
|
|
614
|
+
}`,variables:{agentInfos:e}}));return r}async verifyStringSignedByDid(e,r,n,i){let{runtimeVerifyStringSignedByDid:a}=k(await G(this,H,"f").mutate({mutation:I`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
|
|
606
615
|
runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
|
|
607
|
-
}`,variables:{did:e,didSigningKeyId:r,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:r}=
|
|
616
|
+
}`,variables:{did:e,didSigningKeyId:r,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
608
617
|
runtimeSetStatus(status: $status)
|
|
609
|
-
}`,variables:{status:e}}));return r}async friendStatus(e){let{runtimeFriendStatus:r}=
|
|
610
|
-
runtimeFriendStatus(did: $did) { ${
|
|
611
|
-
}`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:n}=
|
|
618
|
+
}`,variables:{status:e}}));return r}async friendStatus(e){let{runtimeFriendStatus:r}=k(await G(this,H,"f").query({query:I`query runtimeFriendStatus($did: String!) {
|
|
619
|
+
runtimeFriendStatus(did: $did) { ${jo} }
|
|
620
|
+
}`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:n}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
|
|
612
621
|
runtimeFriendSendMessage(did: $did, message: $message)
|
|
613
|
-
}`,variables:{did:e,message:r}}));return n}async messageInbox(e){let{runtimeMessageInbox:r}=
|
|
614
|
-
runtimeMessageInbox(filter: $filter) { ${
|
|
615
|
-
}`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=
|
|
622
|
+
}`,variables:{did:e,message:r}}));return n}async messageInbox(e){let{runtimeMessageInbox:r}=k(await G(this,H,"f").query({query:I`query runtimeMessageInbox($filter: String) {
|
|
623
|
+
runtimeMessageInbox(filter: $filter) { ${jo} }
|
|
624
|
+
}`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=k(await G(this,H,"f").query({query:I`query runtimeMessageOutbox($filter: String) {
|
|
616
625
|
runtimeMessageOutbox(filter: $filter) {
|
|
617
626
|
recipient,
|
|
618
627
|
message {
|
|
619
|
-
${
|
|
628
|
+
${jo}
|
|
620
629
|
}
|
|
621
630
|
}
|
|
622
|
-
}`,variables:{filter:e}}));return r}async requestInstallNotification(e){let{runtimeRequestInstallNotification:r}=
|
|
631
|
+
}`,variables:{filter:e}}));return r}async requestInstallNotification(e){let{runtimeRequestInstallNotification:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
|
|
623
632
|
runtimeRequestInstallNotification(notification: $notification)
|
|
624
|
-
}`,variables:{notification:e}}));return r}async grantNotification(e){let{runtimeGrantNotification:r}=
|
|
633
|
+
}`,variables:{notification:e}}));return r}async grantNotification(e){let{runtimeGrantNotification:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeGrantNotification($id: String!) {
|
|
625
634
|
runtimeGrantNotification(id: $id)
|
|
626
|
-
}`,variables:{id:e}}));return r}async exportDb(e){let{runtimeExportDb:r}=
|
|
635
|
+
}`,variables:{id:e}}));return r}async exportDb(e){let{runtimeExportDb:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeExportDb($filePath: String!) {
|
|
627
636
|
runtimeExportDb(filePath: $filePath)
|
|
628
|
-
}`,variables:{filePath:e}}));return r}async importDb(e){let{runtimeImportDb:r}=
|
|
637
|
+
}`,variables:{filePath:e}}));return r}async importDb(e){let{runtimeImportDb:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeImportDb($filePath: String!) {
|
|
629
638
|
runtimeImportDb(filePath: $filePath) {
|
|
630
639
|
perspectives { total imported failed omitted errors }
|
|
631
640
|
links { total imported failed omitted errors }
|
|
@@ -639,30 +648,41 @@ triggerMatch
|
|
|
639
648
|
trustedAgents { total imported failed omitted errors }
|
|
640
649
|
knownLinkLanguages { total imported failed omitted errors }
|
|
641
650
|
}
|
|
642
|
-
}`,variables:{filePath:e}}));return r}async notifications(){let{runtimeNotifications:e}=
|
|
643
|
-
runtimeNotifications { ${
|
|
644
|
-
}`}));return e}async updateNotification(e,r){let{runtimeUpdateNotification:n}=
|
|
651
|
+
}`,variables:{filePath:e}}));return r}async notifications(){let{runtimeNotifications:e}=k(await G(this,H,"f").query({query:I`query runtimeNotifications {
|
|
652
|
+
runtimeNotifications { ${Md} }
|
|
653
|
+
}`}));return e}async updateNotification(e,r){let{runtimeUpdateNotification:n}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
|
|
645
654
|
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
646
|
-
}`,variables:{id:e,notification:r}}));return n}async removeNotification(e){let{runtimeRemoveNotification:r}=
|
|
655
|
+
}`,variables:{id:e,notification:r}}));return n}async removeNotification(e){let{runtimeRemoveNotification:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeRemoveNotification($id: String!) {
|
|
647
656
|
runtimeRemoveNotification(id: $id)
|
|
648
|
-
}`,variables:{id:e}}));return r}async exportPerspective(e,r){let{runtimeExportPerspective:n}=
|
|
657
|
+
}`,variables:{id:e}}));return r}async exportPerspective(e,r){let{runtimeExportPerspective:n}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
649
658
|
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
650
|
-
}`,variables:{perspectiveUuid:e,filePath:r}}));return n}async importPerspective(e){let{runtimeImportPerspective:r}=
|
|
659
|
+
}`,variables:{perspectiveUuid:e,filePath:r}}));return n}async importPerspective(e){let{runtimeImportPerspective:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeImportPerspective($filePath: String!) {
|
|
651
660
|
runtimeImportPerspective(filePath: $filePath)
|
|
652
|
-
}`,variables:{filePath:e}}));return r}
|
|
653
|
-
|
|
661
|
+
}`,variables:{filePath:e}}));return r}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await G(this,H,"f").query({query:I`query runtimeMultiUserEnabled {
|
|
662
|
+
runtimeMultiUserEnabled
|
|
663
|
+
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:r}=k(await G(this,H,"f").mutate({mutation:I`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
664
|
+
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
665
|
+
}`,variables:{enabled:e}}));return r}async listUsers(){let{runtimeListUsers:e}=k(await G(this,H,"f").query({query:I`query runtimeListUsers {
|
|
666
|
+
runtimeListUsers {
|
|
667
|
+
email
|
|
668
|
+
did
|
|
669
|
+
lastSeen
|
|
670
|
+
perspectiveCount
|
|
671
|
+
}
|
|
672
|
+
}`}));return e}addNotificationTriggeredCallback(e){G(this,ha,"f").push(e)}subscribeNotificationTriggered(){G(this,H,"f").subscribe({query:I` subscription {
|
|
673
|
+
runtimeNotificationTriggered { ${Og} }
|
|
654
674
|
}
|
|
655
|
-
`}).subscribe({next:e=>{G(this,
|
|
656
|
-
runtimeMessageReceived { ${
|
|
675
|
+
`}).subscribe({next:e=>{G(this,ha,"f").forEach(r=>{r(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){G(this,pa,"f").push(e)}subscribeMessageReceived(){G(this,H,"f").subscribe({query:I` subscription {
|
|
676
|
+
runtimeMessageReceived { ${jo} }
|
|
657
677
|
}
|
|
658
|
-
`}).subscribe({next:e=>{G(this,
|
|
678
|
+
`}).subscribe({next:e=>{G(this,pa,"f").forEach(r=>{r(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){G(this,da,"f").push(e)}subscribeExceptionOccurred(){G(this,H,"f").subscribe({query:I` subscription {
|
|
659
679
|
exceptionOccurred {
|
|
660
680
|
title
|
|
661
681
|
message
|
|
662
682
|
type
|
|
663
683
|
addon
|
|
664
684
|
}
|
|
665
|
-
}`}).subscribe({next:e=>{G(this,
|
|
685
|
+
}`}).subscribe({next:e=>{G(this,da,"f").forEach(r=>{r(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};H=new WeakMap,pa=new WeakMap,da=new WeakMap,ha=new WeakMap,$d=new WeakMap;var Ag=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},ci=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)},dr,Nu=class{constructor(e){dr.set(this,void 0),Ag(this,dr,e,"f")}async get(e,r=!1){if(!r)try{let i=ht.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 ci(this,dr,"f").query({query:I`query expression($url: String!) {
|
|
666
686
|
expression(url: $url) {
|
|
667
687
|
author
|
|
668
688
|
timestamp
|
|
@@ -675,7 +695,7 @@ triggerMatch
|
|
|
675
695
|
invalid
|
|
676
696
|
}
|
|
677
697
|
}
|
|
678
|
-
}`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:r}=
|
|
698
|
+
}`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:r}=k(await ci(this,dr,"f").query({query:I`query expressionMany($urls: [String!]!) {
|
|
679
699
|
expressionMany(urls: $urls) {
|
|
680
700
|
author
|
|
681
701
|
timestamp
|
|
@@ -688,19 +708,19 @@ triggerMatch
|
|
|
688
708
|
invalid
|
|
689
709
|
}
|
|
690
710
|
}
|
|
691
|
-
}`,variables:{urls:e}}));return r}async getRaw(e){let{expressionRaw:r}=
|
|
711
|
+
}`,variables:{urls:e}}));return r}async getRaw(e){let{expressionRaw:r}=k(await ci(this,dr,"f").query({query:I`query expressionRaw($url: String!) {
|
|
692
712
|
expressionRaw(url: $url)
|
|
693
|
-
}`,variables:{url:e}}));return r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:n}=
|
|
713
|
+
}`,variables:{url:e}}));return r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:n}=k(await ci(this,dr,"f").mutate({mutation:I`mutation expressionCreate($content: String!, $languageAddress: String!){
|
|
694
714
|
expressionCreate(content: $content, languageAddress: $languageAddress)
|
|
695
|
-
}`,variables:{content:e,languageAddress:r}}));return n}async interactions(e){let{expressionInteractions:r}=
|
|
715
|
+
}`,variables:{content:e,languageAddress:r}}));return n}async interactions(e){let{expressionInteractions:r}=k(await ci(this,dr,"f").query({query:I`query expressionInteractions($url: String!) {
|
|
696
716
|
expressionInteractions(url: $url) {
|
|
697
717
|
label
|
|
698
718
|
name
|
|
699
719
|
parameters { name, type }
|
|
700
720
|
}
|
|
701
|
-
}`,variables:{url:e}}));return r}async interact(e,r){let{expressionInteract:n}=
|
|
721
|
+
}`,variables:{url:e}}));return r}async interact(e,r){let{expressionInteract:n}=k(await ci(this,dr,"f").mutate({mutation:I`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
|
|
702
722
|
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
703
|
-
}`,variables:{url:e,interactionCall:r}}));return n}};dr=new WeakMap;var Ds={};Ds.byteLength=Og;Ds.toByteArray=Dg;Ds.fromByteArray=Cg;var Zt=[],Ot=[],kg=typeof Uint8Array<"u"?Uint8Array:Array,Zc="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(un=0,mp=Zc.length;un<mp;++un)Zt[un]=Zc[un],Ot[Zc.charCodeAt(un)]=un;var un,mp;Ot["-".charCodeAt(0)]=62;Ot["_".charCodeAt(0)]=63;function Fd(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 Og(t){var e=Fd(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Ag(t,e,r){return(e+r)*3/4-r}function Dg(t){var e,r=Fd(t),n=r[0],i=r[1],a=new kg(Ag(t,n,i)),o=0,s=i>0?n-4:n,u;for(u=0;u<s;u+=4)e=Ot[t.charCodeAt(u)]<<18|Ot[t.charCodeAt(u+1)]<<12|Ot[t.charCodeAt(u+2)]<<6|Ot[t.charCodeAt(u+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Ot[t.charCodeAt(u)]<<2|Ot[t.charCodeAt(u+1)]>>4,a[o++]=e&255),i===1&&(e=Ot[t.charCodeAt(u)]<<10|Ot[t.charCodeAt(u+1)]<<4|Ot[t.charCodeAt(u+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function Ng(t){return Zt[t>>18&63]+Zt[t>>12&63]+Zt[t>>6&63]+Zt[t&63]}function Pg(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(Ng(n));return i.join("")}function Cg(t){for(var e,r=t.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(Pg(t,o,o+a>s?s:o+a));return n===1?(e=t[r-1],i.push(Zt[e>>2]+Zt[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Zt[e>>10]+Zt[e>>4&63]+Zt[e<<2&63]+"=")),i.join("")}var Rg=4,yp=0,gp=1,Lg=2;function xi(t){let e=t.length;for(;--e>=0;)t[e]=0}var Fg=0,$d=1,$g=2,Mg=3,jg=258,Wu=29,$a=256,Ta=$a+1+Wu,di=30,Gu=19,Md=2*Ta+1,_n=15,Xc=16,Ug=7,Ku=256,jd=16,Ud=17,qd=18,ku=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]),Yo=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]),qg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Bd=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Bg=512,hr=new Array((Ta+2)*2);xi(hr);var ba=new Array(di*2);xi(ba);var ka=new Array(Bg);xi(ka);var Oa=new Array(jg-Mg+1);xi(Oa);var Hu=new Array(Wu);xi(Hu);var gs=new Array(di);xi(gs);function eu(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 Vd,Qd,zd;function tu(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}var Wd=t=>t<256?ka[t]:ka[256+(t>>>7)],Aa=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},dt=(t,e,r)=>{t.bi_valid>Xc-r?(t.bi_buf|=e<<t.bi_valid&65535,Aa(t,t.bi_buf),t.bi_buf=e>>Xc-t.bi_valid,t.bi_valid+=r-Xc):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Xt=(t,e,r)=>{dt(t,r[e*2],r[e*2+1])},Gd=(t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},Vg=t=>{t.bi_valid===16?(Aa(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)},Qg=(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,p,f,h,y=0;for(p=0;p<=_n;p++)t.bl_count[p]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<Md;c++)l=t.heap[c],p=r[r[l*2+1]*2+1]+1,p>u&&(p=u,y++),r[l*2+1]=p,!(l>n)&&(t.bl_count[p]++,f=0,l>=s&&(f=o[l-s]),h=r[l*2],t.opt_len+=h*(p+f),a&&(t.static_len+=h*(i[l*2+1]+f)));if(y!==0){do{for(p=u-1;t.bl_count[p]===0;)p--;t.bl_count[p]--,t.bl_count[p+1]+=2,t.bl_count[u]--,y-=2}while(y>0);for(p=u;p!==0;p--)for(l=t.bl_count[p];l!==0;)d=t.heap[--c],!(d>n)&&(r[d*2+1]!==p&&(t.opt_len+=(p-r[d*2+1])*r[d*2],r[d*2+1]=p),l--)}},Kd=(t,e,r)=>{let n=new Array(_n+1),i=0,a,o;for(a=1;a<=_n;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]=Gd(n[s]++,s))}},zg=()=>{let t,e,r,n,i,a=new Array(_n+1);for(r=0,n=0;n<Wu-1;n++)for(Hu[n]=r,t=0;t<1<<ku[n];t++)Oa[r++]=n;for(Oa[r-1]=n,i=0,n=0;n<16;n++)for(gs[n]=i,t=0;t<1<<Yo[n];t++)ka[i++]=n;for(i>>=7;n<di;n++)for(gs[n]=i<<7,t=0;t<1<<Yo[n]-7;t++)ka[256+i++]=n;for(e=0;e<=_n;e++)a[e]=0;for(t=0;t<=143;)hr[t*2+1]=8,t++,a[8]++;for(;t<=255;)hr[t*2+1]=9,t++,a[9]++;for(;t<=279;)hr[t*2+1]=7,t++,a[7]++;for(;t<=287;)hr[t*2+1]=8,t++,a[8]++;for(Kd(hr,Ta+1,a),t=0;t<di;t++)ba[t*2+1]=5,ba[t*2]=Gd(t,5);Vd=new eu(hr,ku,$a+1,Ta,_n),Qd=new eu(ba,Yo,0,di,_n),zd=new eu(new Array(0),qg,0,Gu,Ug)},Hd=t=>{let e;for(e=0;e<Ta;e++)t.dyn_ltree[e*2]=0;for(e=0;e<di;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Gu;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Ku*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Jd=t=>{t.bi_valid>8?Aa(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},vp=(t,e,r,n)=>{let i=e*2,a=r*2;return t[i]<t[a]||t[i]===t[a]&&n[e]<=n[r]},ru=(t,e,r)=>{let n=t.heap[r],i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&vp(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!vp(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},bp=(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?Xt(t,i,e):(o=Oa[i],Xt(t,o+$a+1,e),s=ku[o],s!==0&&(i-=Hu[o],dt(t,i,s)),n--,o=Wd(n),Xt(t,o,r),s=Yo[o],s!==0&&(n-=gs[o],dt(t,n,s)));while(a<t.sym_next);Xt(t,Ku,e)},Ou=(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=Md,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--)ru(t,r,o);c=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],ru(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++,ru(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Qg(t,e),Kd(r,u,t.bl_count)},_p=(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[jd*2]++):s<=10?t.bl_tree[Ud*2]++:t.bl_tree[qd*2]++,s=0,i=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4))},Sp=(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 Xt(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Xt(t,a,t.bl_tree),s--),Xt(t,jd,t.bl_tree),dt(t,s-3,2)):s<=10?(Xt(t,Ud,t.bl_tree),dt(t,s-3,3)):(Xt(t,qd,t.bl_tree),dt(t,s-11,7));s=0,i=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4)}},Wg=t=>{let e;for(_p(t,t.dyn_ltree,t.l_desc.max_code),_p(t,t.dyn_dtree,t.d_desc.max_code),Ou(t,t.bl_desc),e=Gu-1;e>=3&&t.bl_tree[Bd[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},Gg=(t,e,r,n)=>{let i;for(dt(t,e-257,5),dt(t,r-1,5),dt(t,n-4,4),i=0;i<n;i++)dt(t,t.bl_tree[Bd[i]*2+1],3);Sp(t,t.dyn_ltree,e-1),Sp(t,t.dyn_dtree,r-1)},Kg=t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return yp;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return gp;for(r=32;r<$a;r++)if(t.dyn_ltree[r*2]!==0)return gp;return yp},wp=!1,Hg=t=>{wp||(zg(),wp=!0),t.l_desc=new tu(t.dyn_ltree,Vd),t.d_desc=new tu(t.dyn_dtree,Qd),t.bl_desc=new tu(t.bl_tree,zd),t.bi_buf=0,t.bi_valid=0,Hd(t)},Yd=(t,e,r,n)=>{dt(t,(Fg<<1)+(n?1:0),3),Jd(t),Aa(t,r),Aa(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},Jg=t=>{dt(t,$d<<1,3),Xt(t,Ku,hr),Vg(t)},Yg=(t,e,r,n)=>{let i,a,o=0;t.level>0?(t.strm.data_type===Lg&&(t.strm.data_type=Kg(t)),Ou(t,t.l_desc),Ou(t,t.d_desc),o=Wg(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?Yd(t,e,r,n):t.strategy===Rg||a===i?(dt(t,($d<<1)+(n?1:0),3),bp(t,hr,ba)):(dt(t,($g<<1)+(n?1:0),3),Gg(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),bp(t,t.dyn_ltree,t.dyn_dtree)),Hd(t),n&&Jd(t)},Zg=(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[(Oa[r]+$a+1)*2]++,t.dyn_dtree[Wd(e)*2]++),t.sym_next===t.sym_end),Xg=Hg,ev=Yd,tv=Yg,rv=Zg,nv=Jg,iv={_tr_init:Xg,_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},Da=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},Ue=cv,An={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"},Mn={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:Au,_tr_flush_block:lv,_tr_tally:Ur,_tr_align:fv}=iv,{Z_NO_FLUSH:qr,Z_PARTIAL_FLUSH:pv,Z_FULL_FLUSH:dv,Z_FINISH:Dt,Z_BLOCK:Ep,Z_OK:Ke,Z_STREAM_END:xp,Z_STREAM_ERROR:tr,Z_DATA_ERROR:hv,Z_BUF_ERROR:nu,Z_DEFAULT_COMPRESSION:mv,Z_FILTERED:yv,Z_HUFFMAN_ONLY:Ro,Z_RLE:gv,Z_FIXED:vv,Z_DEFAULT_STRATEGY:bv,Z_UNKNOWN:_v,Z_DEFLATED:Ns}=Mn,Sv=9,wv=15,Ev=8,xv=29,Iv=256,Du=Iv+1+xv,Tv=30,kv=19,Ov=2*Du+1,Av=15,te=3,Fr=258,rr=Fr+te+1,Dv=32,gi=42,Ju=57,Nu=69,Pu=73,Cu=91,Ru=103,Sn=113,da=666,at=1,Ii=2,Dn=3,Ti=4,Nv=3,wn=(t,e)=>(t.msg=An[e],e),Ip=t=>t*2-(t>4?9:0),Lr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Pv=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)},Cv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,Br=Cv,vt=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))},_t=(t,e)=>{lv(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,vt(t.strm)},ue=(t,e)=>{t.pending_buf[t.pending++]=e},Zi=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Lu=(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=Da(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Ue(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},Zd=(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-rr?t.strstart-(t.w_size-rr):0,c=t.window,l=t.w_mask,d=t.prev,p=t.strstart+Fr,f=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]!==f||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<p);if(a=Fr-(p-n),n=p-Fr,a>o){if(t.match_start=e,o=a,a>=s)break;f=c[n+o-1],h=c[n+o]}}while((e=d[e&l])>u&&--r!==0);return o<=t.lookahead?o:t.lookahead},vi=t=>{let e=t.w_size,r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-rr)&&(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),Pv(t),n+=e),t.strm.avail_in===0)break;if(r=Lu(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=te)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Br(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Br(t,t.ins_h,t.window[i+te-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<te)););}while(t.lookahead<rr&&t.strm.avail_in!==0)},Xd=(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!==Dt||e===qr||n!==i+t.strm.avail_in)))break;o=e===Dt&&n===i+t.strm.avail_in?1:0,Au(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,vt(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&&(Lu(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?Ti:e!==qr&&e!==Dt&&t.strm.avail_in===0&&t.strstart===t.block_start?Ii:(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&&(Lu(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===Dt)&&e!==qr&&t.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Dt&&t.strm.avail_in===0&&n===i?1:0,Au(t,t.block_start,n,o),t.block_start+=n,vt(t.strm)),o?Dn:at)},iu=(t,e)=>{let r,n;for(;;){if(t.lookahead<rr){if(vi(t),t.lookahead<rr&&e===qr)return at;if(t.lookahead===0)break}if(r=0,t.lookahead>=te&&(t.ins_h=Br(t,t.ins_h,t.window[t.strstart+te-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-rr&&(t.match_length=Zd(t,r)),t.match_length>=te)if(n=Ur(t,t.strstart-t.match_start,t.match_length-te),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=te){t.match_length--;do t.strstart++,t.ins_h=Br(t,t.ins_h,t.window[t.strstart+te-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=Br(t,t.ins_h,t.window[t.strstart+1]);else n=Ur(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(_t(t,!1),t.strm.avail_out===0))return at}return t.insert=t.strstart<te-1?t.strstart:te-1,e===Dt?(_t(t,!0),t.strm.avail_out===0?Dn:Ti):t.sym_next&&(_t(t,!1),t.strm.avail_out===0)?at:Ii},si=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<rr){if(vi(t),t.lookahead<rr&&e===qr)return at;if(t.lookahead===0)break}if(r=0,t.lookahead>=te&&(t.ins_h=Br(t,t.ins_h,t.window[t.strstart+te-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=te-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-rr&&(t.match_length=Zd(t,r),t.match_length<=5&&(t.strategy===yv||t.match_length===te&&t.strstart-t.match_start>4096)&&(t.match_length=te-1)),t.prev_length>=te&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-te,n=Ur(t,t.strstart-1-t.prev_match,t.prev_length-te),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=Br(t,t.ins_h,t.window[t.strstart+te-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=te-1,t.strstart++,n&&(_t(t,!1),t.strm.avail_out===0))return at}else if(t.match_available){if(n=Ur(t,0,t.window[t.strstart-1]),n&&_t(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return at}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=Ur(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<te-1?t.strstart:te-1,e===Dt?(_t(t,!0),t.strm.avail_out===0?Dn:Ti):t.sym_next&&(_t(t,!1),t.strm.avail_out===0)?at:Ii},Rv=(t,e)=>{let r,n,i,a,o=t.window;for(;;){if(t.lookahead<=Fr){if(vi(t),t.lookahead<=Fr&&e===qr)return at;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=te&&t.strstart>0&&(i=t.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=t.strstart+Fr;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=Fr-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=te?(r=Ur(t,1,t.match_length-te),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Ur(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(_t(t,!1),t.strm.avail_out===0))return at}return t.insert=0,e===Dt?(_t(t,!0),t.strm.avail_out===0?Dn:Ti):t.sym_next&&(_t(t,!1),t.strm.avail_out===0)?at:Ii},Lv=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(vi(t),t.lookahead===0)){if(e===qr)return at;break}if(t.match_length=0,r=Ur(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(_t(t,!1),t.strm.avail_out===0))return at}return t.insert=0,e===Dt?(_t(t,!0),t.strm.avail_out===0?Dn:Ti):t.sym_next&&(_t(t,!1),t.strm.avail_out===0)?at:Ii};function Gt(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 ha=[new Gt(0,0,0,0,Xd),new Gt(4,4,8,4,iu),new Gt(4,5,16,8,iu),new Gt(4,6,32,32,iu),new Gt(4,4,16,16,si),new Gt(8,16,32,32,si),new Gt(8,16,128,128,si),new Gt(8,32,128,256,si),new Gt(32,128,258,1024,si),new Gt(32,258,258,4096,si)],Fv=t=>{t.window_size=2*t.w_size,Lr(t.head),t.max_lazy_match=ha[t.level].max_lazy,t.good_match=ha[t.level].good_length,t.nice_match=ha[t.level].nice_length,t.max_chain_length=ha[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=te-1,t.match_available=0,t.ins_h=0};function $v(){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=Ns,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(Ov*2),this.dyn_dtree=new Uint16Array((2*Tv+1)*2),this.bl_tree=new Uint16Array((2*kv+1)*2),Lr(this.dyn_ltree),Lr(this.dyn_dtree),Lr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Av+1),this.heap=new Uint16Array(2*Du+1),Lr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Du+1),Lr(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 Ma=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==gi&&e.status!==Ju&&e.status!==Nu&&e.status!==Pu&&e.status!==Cu&&e.status!==Ru&&e.status!==Sn&&e.status!==da?1:0},eh=t=>{if(Ma(t))return wn(t,tr);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?Ju:e.wrap?gi:Sn,t.adler=e.wrap===2?0:1,e.last_flush=-2,uv(e),Ke},th=t=>{let e=eh(t);return e===Ke&&Fv(t.state),e},Mv=(t,e)=>Ma(t)||t.state.wrap!==2?tr:(t.state.gzhead=e,Ke),rh=(t,e,r,n,i,a)=>{if(!t)return tr;let o=1;if(e===mv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>Sv||r!==Ns||n<8||n>15||e<0||e>9||a<0||a>vv||n===8&&o!==1)return wn(t,tr);n===8&&(n=9);let s=new $v;return t.state=s,s.strm=t,s.status=gi,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+te-1)/te),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,th(t)},jv=(t,e)=>rh(t,e,Ns,wv,Ev,bv),Uv=(t,e)=>{if(Ma(t)||e>Ep||e<0)return t?wn(t,tr):tr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===da&&e!==Dt)return wn(t,t.avail_out===0?nu:tr);let n=r.last_flush;if(r.last_flush=e,r.pending!==0){if(vt(t),t.avail_out===0)return r.last_flush=-1,Ke}else if(t.avail_in===0&&Ip(e)<=Ip(n)&&e!==Dt)return wn(t,nu);if(r.status===da&&t.avail_in!==0)return wn(t,nu);if(r.status===gi&&r.wrap===0&&(r.status=Sn),r.status===gi){let i=Ns+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Ro||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=Dv),i+=31-i%31,Zi(r,i),r.strstart!==0&&(Zi(r,t.adler>>>16),Zi(r,t.adler&65535)),t.adler=1,r.status=Sn,vt(t),r.pending!==0)return r.last_flush=-1,Ke}if(r.status===Ju){if(t.adler=0,ue(r,31),ue(r,139),ue(r,8),r.gzhead)ue(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)),ue(r,r.gzhead.time&255),ue(r,r.gzhead.time>>8&255),ue(r,r.gzhead.time>>16&255),ue(r,r.gzhead.time>>24&255),ue(r,r.level===9?2:r.strategy>=Ro||r.level<2?4:0),ue(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ue(r,r.gzhead.extra.length&255),ue(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Ue(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Nu;else if(ue(r,0),ue(r,0),ue(r,0),ue(r,0),ue(r,0),ue(r,r.level===9?2:r.strategy>=Ro||r.level<2?4:0),ue(r,Nv),r.status=Sn,vt(t),r.pending!==0)return r.last_flush=-1,Ke}if(r.status===Nu){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=Ue(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=s,vt(t),r.pending!==0)return r.last_flush=-1,Ke;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=Ue(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Pu}if(r.status===Pu){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=Ue(t.adler,r.pending_buf,r.pending-i,i)),vt(t),r.pending!==0)return r.last_flush=-1,Ke;i=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,ue(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ue(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Cu}if(r.status===Cu){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=Ue(t.adler,r.pending_buf,r.pending-i,i)),vt(t),r.pending!==0)return r.last_flush=-1,Ke;i=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,ue(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ue(t.adler,r.pending_buf,r.pending-i,i))}r.status=Ru}if(r.status===Ru){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(vt(t),r.pending!==0))return r.last_flush=-1,Ke;ue(r,t.adler&255),ue(r,t.adler>>8&255),t.adler=0}if(r.status=Sn,vt(t),r.pending!==0)return r.last_flush=-1,Ke}if(t.avail_in!==0||r.lookahead!==0||e!==qr&&r.status!==da){let i=r.level===0?Xd(r,e):r.strategy===Ro?Lv(r,e):r.strategy===gv?Rv(r,e):ha[r.level].func(r,e);if((i===Dn||i===Ti)&&(r.status=da),i===at||i===Dn)return t.avail_out===0&&(r.last_flush=-1),Ke;if(i===Ii&&(e===pv?fv(r):e!==Ep&&(Au(r,0,0,!1),e===dv&&(Lr(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),vt(t),t.avail_out===0))return r.last_flush=-1,Ke}return e!==Dt?Ke:r.wrap<=0?xp:(r.wrap===2?(ue(r,t.adler&255),ue(r,t.adler>>8&255),ue(r,t.adler>>16&255),ue(r,t.adler>>24&255),ue(r,t.total_in&255),ue(r,t.total_in>>8&255),ue(r,t.total_in>>16&255),ue(r,t.total_in>>24&255)):(Zi(r,t.adler>>>16),Zi(r,t.adler&65535)),vt(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Ke:xp)},qv=t=>{if(Ma(t))return tr;let e=t.state.status;return t.state=null,e===Sn?wn(t,hv):Ke},Bv=(t,e)=>{let r=e.length;if(Ma(t))return tr;let n=t.state,i=n.wrap;if(i===2||i===1&&n.status!==gi||n.lookahead)return tr;if(i===1&&(t.adler=Da(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Lr(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,vi(n);n.lookahead>=te;){let u=n.strstart,c=n.lookahead-(te-1);do n.ins_h=Br(n,n.ins_h,n.window[u+te-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=te-1,vi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=te-1,n.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,n.wrap=i,Ke},Vv=jv,Qv=rh,zv=th,Wv=eh,Gv=Mv,Kv=Uv,Hv=qv,Jv=Bv,Yv="pako deflate (from Nodeca project)",_a={deflateInit:Vv,deflateInit2:Qv,deflateReset:zv,deflateResetKeep:Wv,deflateSetHeader:Gv,deflate:Kv,deflateEnd:Hv,deflateSetDictionary:Jv,deflateInfo:Yv},Zv=(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)Zv(r,n)&&(t[n]=r[n])}}return t},eb=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},Ps={assign:Xv,flattenChunks:eb},nh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){nh=!1}var Na=new Uint8Array(256);for(let t=0;t<256;t++)Na[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Na[254]=Na[254]=1;var tb=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},rb=(t,e)=>{if(e<65534&&t.subarray&&nh)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},nb=(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=Na[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 rb(a,i)},ib=(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+Na[t[r]]>e?r:e},Pa={string2buf:tb,buf2string:nb,utf8border:ib};function ab(){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 ih=ab,ah=Object.prototype.toString,{Z_NO_FLUSH:ob,Z_SYNC_FLUSH:sb,Z_FULL_FLUSH:cb,Z_FINISH:ub,Z_OK:vs,Z_STREAM_END:lb,Z_DEFAULT_COMPRESSION:fb,Z_DEFAULT_STRATEGY:pb,Z_DEFLATED:db}=Mn;function ja(t){this.options=Ps.assign({level:fb,method:db,chunkSize:16384,windowBits:15,memLevel:8,strategy:pb},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 ih,this.strm.avail_out=0;let r=_a.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==vs)throw new Error(An[r]);if(e.header&&_a.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=Pa.string2buf(e.dictionary):ah.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=_a.deflateSetDictionary(this.strm,n),r!==vs)throw new Error(An[r]);this._dict_set=!0}}ja.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?ub:ob,typeof t=="string"?r.input=Pa.string2buf(t):ah.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===sb||a===cb)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=_a.deflate(r,a),i===lb)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=_a.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===vs;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};ja.prototype.onData=function(t){this.chunks.push(t)};ja.prototype.onEnd=function(t){t===vs&&(this.result=Ps.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Yu(t,e){let r=new ja(e);if(r.push(t,!0),r.err)throw r.msg||An[r.err];return r.result}function hb(t,e){return e=e||{},e.raw=!0,Yu(t,e)}function mb(t,e){return e=e||{},e.gzip=!0,Yu(t,e)}var yb=ja,gb=Yu,vb=hb,bb=mb,_b=Mn,Sb={Deflate:yb,deflate:gb,deflateRaw:vb,gzip:bb,constants:_b},Lo=16209,wb=16191,Eb=function t(e,r){let n,i,a,o,s,u,c,l,d,p,f,h,y,v,b,_,S,g,D,N,T,P,F,C,M=e.state;n=e.next_in,F=e.input,i=n+(e.avail_in-5),a=e.next_out,C=e.output,o=a-(r-e.avail_out),s=a+(e.avail_out-257),u=M.dmax,c=M.wsize,l=M.whave,d=M.wnext,p=M.window,f=M.hold,h=M.bits,y=M.lencode,v=M.distcode,b=(1<<M.lenbits)-1,_=(1<<M.distbits)-1;e:do{h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),S=y[f&b];t:for(;;){if(g=S>>>24,f>>>=g,h-=g,g=S>>>16&255,g===0)C[a++]=S&65535;else if(g&16){D=S&65535,g&=15,g&&(h<g&&(f+=F[n++]<<h,h+=8),D+=f&(1<<g)-1,f>>>=g,h-=g),h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),S=v[f&_];r:for(;;){if(g=S>>>24,f>>>=g,h-=g,g=S>>>16&255,g&16){if(N=S&65535,g&=15,h<g&&(f+=F[n++]<<h,h+=8,h<g&&(f+=F[n++]<<h,h+=8)),N+=f&(1<<g)-1,N>u){e.msg="invalid distance too far back",M.mode=Lo;break e}if(f>>>=g,h-=g,g=a-o,N>g){if(g=N-g,g>l&&M.sane){e.msg="invalid distance too far back",M.mode=Lo;break e}if(T=0,P=p,d===0){if(T+=c-g,g<D){D-=g;do C[a++]=p[T++];while(--g);T=a-N,P=C}}else if(d<g){if(T+=c+d-g,g-=d,g<D){D-=g;do C[a++]=p[T++];while(--g);if(T=0,d<D){g=d,D-=g;do C[a++]=p[T++];while(--g);T=a-N,P=C}}}else if(T+=d-g,g<D){D-=g;do C[a++]=p[T++];while(--g);T=a-N,P=C}for(;D>2;)C[a++]=P[T++],C[a++]=P[T++],C[a++]=P[T++],D-=3;D&&(C[a++]=P[T++],D>1&&(C[a++]=P[T++]))}else{T=a-N;do C[a++]=C[T++],C[a++]=C[T++],C[a++]=C[T++],D-=3;while(D>2);D&&(C[a++]=C[T++],D>1&&(C[a++]=C[T++]))}}else if((g&64)===0){S=v[(S&65535)+(f&(1<<g)-1)];continue r}else{e.msg="invalid distance code",M.mode=Lo;break e}break}}else if((g&64)===0){S=y[(S&65535)+(f&(1<<g)-1)];continue t}else if(g&32){M.mode=wb;break e}else{e.msg="invalid literal/length code",M.mode=Lo;break e}break}}while(n<i&&a<s);D=h>>3,n-=D,h-=D<<3,f&=(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),M.hold=f,M.bits=h},ci=15,Tp=852,kp=592,Op=0,au=1,Ap=2,xb=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]),Ib=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]),Tb=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]),kb=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]),Ob=(t,e,r,n,i,a,o,s)=>{let u=s.bits,c=0,l=0,d=0,p=0,f=0,h=0,y=0,v=0,b=0,_=0,S,g,D,N,T,P=null,F,C=new Uint16Array(ci+1),M=new Uint16Array(ci+1),Ve=null,Pe,V,me;for(c=0;c<=ci;c++)C[c]=0;for(l=0;l<n;l++)C[e[r+l]]++;for(f=u,p=ci;p>=1&&C[p]===0;p--);if(f>p&&(f=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<p&&C[d]===0;d++);for(f<d&&(f=d),v=1,c=1;c<=ci;c++)if(v<<=1,v-=C[c],v<0)return-1;if(v>0&&(t===Op||p!==1))return-1;for(M[1]=0,c=1;c<ci;c++)M[c+1]=M[c]+C[c];for(l=0;l<n;l++)e[r+l]!==0&&(o[M[e[r+l]]++]=l);if(t===Op?(P=Ve=o,F=20):t===au?(P=xb,Ve=Ib,F=257):(P=Tb,Ve=kb,F=0),_=0,l=0,c=d,T=a,h=f,y=0,D=-1,b=1<<f,N=b-1,t===au&&b>Tp||t===Ap&&b>kp)return 1;for(;;){Pe=c-y,o[l]+1<F?(V=0,me=o[l]):o[l]>=F?(V=Ve[o[l]-F],me=P[o[l]-F]):(V=32+64,me=0),S=1<<c-y,g=1<<h,d=g;do g-=S,i[T+(_>>y)+g]=Pe<<24|V<<16|me|0;while(g!==0);for(S=1<<c-1;_&S;)S>>=1;if(S!==0?(_&=S-1,_+=S):_=0,l++,--C[c]===0){if(c===p)break;c=e[r+o[l]]}if(c>f&&(_&N)!==D){for(y===0&&(y=f),T+=d,h=c-y,v=1<<h;h+y<p&&(v-=C[h+y],!(v<=0));)h++,v<<=1;if(b+=1<<h,t===au&&b>Tp||t===Ap&&b>kp)return 1;D=_&N,i[D]=f<<24|h<<16|T-a|0}}return _!==0&&(i[T+_]=c-y<<24|64<<16|0),s.bits=f,0},Sa=Ob,Ab=0,oh=1,sh=2,{Z_FINISH:Dp,Z_BLOCK:Db,Z_TREES:Fo,Z_OK:Nn,Z_STREAM_END:Nb,Z_NEED_DICT:Pb,Z_STREAM_ERROR:Nt,Z_DATA_ERROR:ch,Z_MEM_ERROR:uh,Z_BUF_ERROR:Cb,Z_DEFLATED:Np}=Mn,Cs=16180,Pp=16181,Cp=16182,Rp=16183,Lp=16184,Fp=16185,$p=16186,Mp=16187,jp=16188,Up=16189,bs=16190,lr=16191,ou=16192,qp=16193,su=16194,Bp=16195,Vp=16196,Qp=16197,zp=16198,$o=16199,Mo=16200,Wp=16201,Gp=16202,Kp=16203,Hp=16204,Jp=16205,cu=16206,Yp=16207,Zp=16208,_e=16209,lh=16210,fh=16211,Rb=852,Lb=592,Fb=15,$b=Fb,Xp=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function Mb(){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 jn=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<Cs||e.mode>fh?1:0},ph=t=>{if(jn(t))return Nt;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=Cs,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(Rb),e.distcode=e.distdyn=new Int32Array(Lb),e.sane=1,e.back=-1,Nn},dh=t=>{if(jn(t))return Nt;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,ph(t)},hh=(t,e)=>{let r;if(jn(t))return Nt;let n=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Nt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,dh(t))},mh=(t,e)=>{if(!t)return Nt;let r=new Mb;t.state=r,r.strm=t,r.window=null,r.mode=Cs;let n=hh(t,e);return n!==Nn&&(t.state=null),n},jb=t=>mh(t,$b),ed=!0,uu,lu,Ub=t=>{if(ed){uu=new Int32Array(512),lu=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(Sa(oh,t.lens,0,288,uu,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Sa(sh,t.lens,0,32,lu,0,t.work,{bits:5}),ed=!1}t.lencode=uu,t.lenbits=9,t.distcode=lu,t.distbits=5},yh=(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},qb=(t,e)=>{let r,n,i,a,o,s,u,c,l,d,p,f,h,y,v=0,b,_,S,g,D,N,T,P,F=new Uint8Array(4),C,M,Ve=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(jn(t)||!t.output||!t.input&&t.avail_in!==0)return Nt;r=t.state,r.mode===lr&&(r.mode=ou),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,p=u,P=Nn;e:for(;;)switch(r.mode){case Cs:if(r.wrap===0){r.mode=ou;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,F[0]=c&255,F[1]=c>>>8&255,r.check=Ue(r.check,F,2,0),c=0,l=0,r.mode=Pp;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=_e;break}if((c&15)!==Np){t.msg="unknown compression method",r.mode=_e;break}if(c>>>=4,l-=4,T=(c&15)+8,r.wbits===0&&(r.wbits=T),T>15||T>r.wbits){t.msg="invalid window size",r.mode=_e;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=c&512?Up:lr,c=0,l=0;break;case Pp:for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(r.flags=c,(r.flags&255)!==Np){t.msg="unknown compression method",r.mode=_e;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=_e;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ue(r.check,F,2,0)),c=0,l=0,r.mode=Cp;case Cp: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&&(F[0]=c&255,F[1]=c>>>8&255,F[2]=c>>>16&255,F[3]=c>>>24&255,r.check=Ue(r.check,F,4,0)),c=0,l=0,r.mode=Rp;case Rp: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&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ue(r.check,F,2,0)),c=0,l=0,r.mode=Lp;case Lp: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&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ue(r.check,F,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=Fp;case Fp:if(r.flags&1024&&(f=r.length,f>s&&(f=s),f&&(r.head&&(T=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+f),T)),r.flags&512&&r.wrap&4&&(r.check=Ue(r.check,n,f,a)),s-=f,a+=f,r.length-=f),r.length))break e;r.length=0,r.mode=$p;case $p:if(r.flags&2048){if(s===0)break e;f=0;do T=n[a+f++],r.head&&T&&r.length<65536&&(r.head.name+=String.fromCharCode(T));while(T&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ue(r.check,n,f,a)),s-=f,a+=f,T)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Mp;case Mp:if(r.flags&4096){if(s===0)break e;f=0;do T=n[a+f++],r.head&&T&&r.length<65536&&(r.head.comment+=String.fromCharCode(T));while(T&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ue(r.check,n,f,a)),s-=f,a+=f,T)break e}else r.head&&(r.head.comment=null);r.mode=jp;case jp: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=_e;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=lr;break;case Up:for(;l<32;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}t.adler=r.check=Xp(c),c=0,l=0,r.mode=bs;case bs: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,Pb;t.adler=r.check=1,r.mode=lr;case lr:if(e===Db||e===Fo)break e;case ou:if(r.last){c>>>=l&7,l-=l&7,r.mode=cu;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=qp;break;case 1:if(Ub(r),r.mode=$o,e===Fo){c>>>=2,l-=2;break e}break;case 2:r.mode=Vp;break;case 3:t.msg="invalid block type",r.mode=_e}c>>>=2,l-=2;break;case qp: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=_e;break}if(r.length=c&65535,c=0,l=0,r.mode=su,e===Fo)break e;case su:r.mode=Bp;case Bp:if(f=r.length,f){if(f>s&&(f=s),f>u&&(f=u),f===0)break e;i.set(n.subarray(a,a+f),o),s-=f,a+=f,u-=f,o+=f,r.length-=f;break}r.mode=lr;break;case Vp: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=_e;break}r.have=0,r.mode=Qp;case Qp:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}r.lens[Ve[r.have++]]=c&7,c>>>=3,l-=3}for(;r.have<19;)r.lens[Ve[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,C={bits:r.lenbits},P=Sa(Ab,r.lens,0,19,r.lencode,0,r.work,C),r.lenbits=C.bits,P){t.msg="invalid code lengths set",r.mode=_e;break}r.have=0,r.mode=zp;case zp: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(M=b+2;l<M;){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=_e;break}T=r.lens[r.have-1],f=3+(c&3),c>>>=2,l-=2}else if(S===17){for(M=b+3;l<M;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=b,l-=b,T=0,f=3+(c&7),c>>>=3,l-=3}else{for(M=b+7;l<M;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=b,l-=b,T=0,f=11+(c&127),c>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=_e;break}for(;f--;)r.lens[r.have++]=T}}if(r.mode===_e)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=_e;break}if(r.lenbits=9,C={bits:r.lenbits},P=Sa(oh,r.lens,0,r.nlen,r.lencode,0,r.work,C),r.lenbits=C.bits,P){t.msg="invalid literal/lengths set",r.mode=_e;break}if(r.distbits=6,r.distcode=r.distdyn,C={bits:r.distbits},P=Sa(sh,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,C),r.distbits=C.bits,P){t.msg="invalid distances set",r.mode=_e;break}if(r.mode=$o,e===Fo)break e;case $o:r.mode=Mo;case Mo: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,Eb(t,p),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===lr&&(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(g=b,D=_,N=S;v=r.lencode[N+((c&(1<<g+D)-1)>>g)],b=v>>>24,_=v>>>16&255,S=v&65535,!(g+b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=g,l-=g,r.back+=g}if(c>>>=b,l-=b,r.back+=b,r.length=S,_===0){r.mode=Jp;break}if(_&32){r.back=-1,r.mode=lr;break}if(_&64){t.msg="invalid literal/length code",r.mode=_e;break}r.extra=_&15,r.mode=Wp;case Wp:if(r.extra){for(M=r.extra;l<M;){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=Gp;case Gp: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(g=b,D=_,N=S;v=r.distcode[N+((c&(1<<g+D)-1)>>g)],b=v>>>24,_=v>>>16&255,S=v&65535,!(g+b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=g,l-=g,r.back+=g}if(c>>>=b,l-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=_e;break}r.offset=S,r.extra=_&15,r.mode=Kp;case Kp:if(r.extra){for(M=r.extra;l<M;){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=_e;break}r.mode=Hp;case Hp:if(u===0)break e;if(f=p-u,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=_e;break}f>r.wnext?(f-=r.wnext,h=r.wsize-f):h=r.wnext-f,f>r.length&&(f=r.length),y=r.window}else y=i,h=o-r.offset,f=r.length;f>u&&(f=u),u-=f,r.length-=f;do i[o++]=y[h++];while(--f);r.length===0&&(r.mode=Mo);break;case Jp:if(u===0)break e;i[o++]=r.length,u--,r.mode=Mo;break;case cu:if(r.wrap){for(;l<32;){if(s===0)break e;s--,c|=n[a++]<<l,l+=8}if(p-=u,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ue(r.check,i,p,o-p):Da(r.check,i,p,o-p)),p=u,r.wrap&4&&(r.flags?c:Xp(c))!==r.check){t.msg="incorrect data check",r.mode=_e;break}c=0,l=0}r.mode=Yp;case Yp: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=_e;break}c=0,l=0}r.mode=Zp;case Zp:P=Nb;break e;case _e:P=ch;break e;case lh:return uh;case fh:default:return Nt}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||p!==t.avail_out&&r.mode<_e&&(r.mode<cu||e!==Dp))&&yh(t,t.output,t.next_out,p-t.avail_out),d-=t.avail_in,p-=t.avail_out,t.total_in+=d,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ue(r.check,i,p,t.next_out-p):Da(r.check,i,p,t.next_out-p)),t.data_type=r.bits+(r.last?64:0)+(r.mode===lr?128:0)+(r.mode===$o||r.mode===su?256:0),(d===0&&p===0||e===Dp)&&P===Nn&&(P=Cb),P},Bb=t=>{if(jn(t))return Nt;let e=t.state;return e.window&&(e.window=null),t.state=null,Nn},Vb=(t,e)=>{if(jn(t))return Nt;let r=t.state;return(r.wrap&2)===0?Nt:(r.head=e,e.done=!1,Nn)},Qb=(t,e)=>{let r=e.length,n,i,a;return jn(t)||(n=t.state,n.wrap!==0&&n.mode!==bs)?Nt:n.mode===bs&&(i=1,i=Da(i,e,r,0),i!==n.check)?ch:(a=yh(t,e,r,r),a?(n.mode=lh,uh):(n.havedict=1,Nn))},zb=dh,Wb=hh,Gb=ph,Kb=jb,Hb=mh,Jb=qb,Yb=Bb,Zb=Vb,Xb=Qb,e_="pako inflate (from Nodeca project)",mr={inflateReset:zb,inflateReset2:Wb,inflateResetKeep:Gb,inflateInit:Kb,inflateInit2:Hb,inflate:Jb,inflateEnd:Yb,inflateGetHeader:Zb,inflateSetDictionary:Xb,inflateInfo:e_};function t_(){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 r_=t_,gh=Object.prototype.toString,{Z_NO_FLUSH:n_,Z_FINISH:i_,Z_OK:Ca,Z_STREAM_END:fu,Z_NEED_DICT:pu,Z_STREAM_ERROR:a_,Z_DATA_ERROR:td,Z_MEM_ERROR:o_}=Mn;function Ua(t){this.options=Ps.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 ih,this.strm.avail_out=0;let r=mr.inflateInit2(this.strm,e.windowBits);if(r!==Ca)throw new Error(An[r]);if(this.header=new r_,mr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Pa.string2buf(e.dictionary):gh.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=mr.inflateSetDictionary(this.strm,e.dictionary),r!==Ca)))throw new Error(An[r])}Ua.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?i_:n_,gh.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=mr.inflate(r,o),a===pu&&i&&(a=mr.inflateSetDictionary(r,i),a===Ca?a=mr.inflate(r,o):a===td&&(a=pu));r.avail_in>0&&a===fu&&r.state.wrap>0&&t[r.next_in]!==0;)mr.inflateReset(r),a=mr.inflate(r,o);switch(a){case a_:case td:case pu:case o_:return this.onEnd(a),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(r.avail_out===0||a===fu))if(this.options.to==="string"){let u=Pa.utf8border(r.output,r.next_out),c=r.next_out-u,l=Pa.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===Ca&&s===0)){if(a===fu)return a=mr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};Ua.prototype.onData=function(t){this.chunks.push(t)};Ua.prototype.onEnd=function(t){t===Ca&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Ps.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function Zu(t,e){let r=new Ua(e);if(r.push(t),r.err)throw r.msg||An[r.err];return r.result}function s_(t,e){return e=e||{},e.raw=!0,Zu(t,e)}var c_=Ua,u_=Zu,l_=s_,f_=Zu,p_=Mn,d_={Inflate:c_,inflate:u_,inflateRaw:l_,ungzip:f_,constants:p_},{Deflate:h_,deflate:m_,deflateRaw:y_,gzip:g_}=Sb,{Inflate:v_,inflate:b_,inflateRaw:__,ungzip:S_}=d_,w_=h_,E_=m_,x_=y_,I_=g_,T_=v_,k_=b_,O_=__,A_=S_,D_=Mn,N_={Deflate:w_,deflate:E_,deflateRaw:x_,gzip:I_,Inflate:T_,inflate:k_,inflateRaw:O_,ungzip:A_,constants:D_},ge=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},ve=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},_s=class{constructor(e,r){this.input=e,this.output=r}};ge([m(),ve("design:type",String)],_s.prototype,"input",void 0);ge([m(),ve("design:type",String)],_s.prototype,"output",void 0);_s=ge([Be(),ve("design:paramtypes",[String,String])],_s);var Ss=class{constructor(e,r){this.input=e,this.output=r}};ge([m(),ve("design:type",String)],Ss.prototype,"input",void 0);ge([m(),ve("design:type",String)],Ss.prototype,"output",void 0);Ss=ge([W(),ve("design:paramtypes",[String,String])],Ss);var Gr=class{constructor(e,r,n,i,a){this.name=e,this.modelId=r,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};ge([m(),ve("design:type",String)],Gr.prototype,"name",void 0);ge([m(),ve("design:type",String)],Gr.prototype,"modelId",void 0);ge([m(),ve("design:type",String)],Gr.prototype,"systemPrompt",void 0);ge([m(),ve("design:type",Array)],Gr.prototype,"promptExamples",void 0);ge([m(),ve("design:type",String)],Gr.prototype,"metaData",void 0);Gr=ge([Be(),ve("design:paramtypes",[String,String,String,Array,String])],Gr);var ir=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}};ge([m(),ve("design:type",String)],ir.prototype,"name",void 0);ge([m(),ve("design:type",String)],ir.prototype,"modelId",void 0);ge([m(),ve("design:type",String)],ir.prototype,"taskId",void 0);ge([m(),ve("design:type",String)],ir.prototype,"systemPrompt",void 0);ge([m(),ve("design:type",Array)],ir.prototype,"promptExamples",void 0);ge([m(),ve("design:type",String)],ir.prototype,"metaData",void 0);ge([m(),ve("design:type",String)],ir.prototype,"createdAt",void 0);ge([m(),ve("design:type",String)],ir.prototype,"updatedAt",void 0);ir=ge([W(),ve("design:paramtypes",[String,String,String,String,Array,String,String,String])],ir);var Pn=class{constructor(e,r,n,i,a){this.model=e,this.status=r,this.progress=n,this.downloaded=i,this.loaded=a}};ge([m(),ve("design:type",String)],Pn.prototype,"model",void 0);ge([m(),ve("design:type",String)],Pn.prototype,"status",void 0);ge([m(),ve("design:type",Number)],Pn.prototype,"progress",void 0);ge([m(),ve("design:type",Boolean)],Pn.prototype,"downloaded",void 0);ge([m(),ve("design:type",Boolean)],Pn.prototype,"loaded",void 0);Pn=ge([W(),ve("design:paramtypes",[String,String,Number,Boolean,Boolean])],Pn);var P_=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},Me=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)},Le,Zo,Fu=class{constructor(e,r=!0){Le.set(this,void 0),Zo.set(this,new Map),P_(this,Le,e,"f")}async getModels(){let e=await Me(this,Le,"f").query({query:I`
|
|
723
|
+
}`,variables:{url:e,interactionCall:r}}));return n}};dr=new WeakMap;var Ls={};Ls.byteLength=Ng;Ls.toByteArray=Pg;Ls.fromByteArray=Fg;var Zt=[],At=[],Dg=typeof Uint8Array<"u"?Uint8Array:Array,nu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ln=0,vp=nu.length;ln<vp;++ln)Zt[ln]=nu[ln],At[nu.charCodeAt(ln)]=ln;var ln,vp;At["-".charCodeAt(0)]=62;At["_".charCodeAt(0)]=63;function jd(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 Ng(t){var e=jd(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Cg(t,e,r){return(e+r)*3/4-r}function Pg(t){var e,r=jd(t),n=r[0],i=r[1],a=new Dg(Cg(t,n,i)),o=0,s=i>0?n-4:n,u;for(u=0;u<s;u+=4)e=At[t.charCodeAt(u)]<<18|At[t.charCodeAt(u+1)]<<12|At[t.charCodeAt(u+2)]<<6|At[t.charCodeAt(u+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=At[t.charCodeAt(u)]<<2|At[t.charCodeAt(u+1)]>>4,a[o++]=e&255),i===1&&(e=At[t.charCodeAt(u)]<<10|At[t.charCodeAt(u+1)]<<4|At[t.charCodeAt(u+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function Rg(t){return Zt[t>>18&63]+Zt[t>>12&63]+Zt[t>>6&63]+Zt[t&63]}function Lg(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(Rg(n));return i.join("")}function Fg(t){for(var e,r=t.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(Lg(t,o,o+a>s?s:o+a));return n===1?(e=t[r-1],i.push(Zt[e>>2]+Zt[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Zt[e>>10]+Zt[e>>4&63]+Zt[e<<2&63]+"=")),i.join("")}var $g=4,bp=0,_p=1,Mg=2;function ki(t){let e=t.length;for(;--e>=0;)t[e]=0}var jg=0,Ud=1,Ug=2,qg=3,Bg=258,Yu=29,Ba=256,Da=Ba+1+Yu,mi=30,Zu=19,qd=2*Da+1,Sn=15,iu=16,Vg=7,Xu=256,Bd=16,Vd=17,Qd=18,Cu=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]),ns=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]),Qg=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),zd=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),zg=512,hr=new Array((Da+2)*2);ki(hr);var Sa=new Array(mi*2);ki(Sa);var Na=new Array(zg);ki(Na);var Ca=new Array(Bg-qg+1);ki(Ca);var el=new Array(Yu);ki(el);var Es=new Array(mi);ki(Es);function au(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 Wd,Gd,Kd;function ou(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}var Hd=t=>t<256?Na[t]:Na[256+(t>>>7)],Pa=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},dt=(t,e,r)=>{t.bi_valid>iu-r?(t.bi_buf|=e<<t.bi_valid&65535,Pa(t,t.bi_buf),t.bi_buf=e>>iu-t.bi_valid,t.bi_valid+=r-iu):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Xt=(t,e,r)=>{dt(t,r[e*2],r[e*2+1])},Jd=(t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},Wg=t=>{t.bi_valid===16?(Pa(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)},Gg=(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,p,f,h,y=0;for(p=0;p<=Sn;p++)t.bl_count[p]=0;for(r[t.heap[t.heap_max]*2+1]=0,c=t.heap_max+1;c<qd;c++)l=t.heap[c],p=r[r[l*2+1]*2+1]+1,p>u&&(p=u,y++),r[l*2+1]=p,!(l>n)&&(t.bl_count[p]++,f=0,l>=s&&(f=o[l-s]),h=r[l*2],t.opt_len+=h*(p+f),a&&(t.static_len+=h*(i[l*2+1]+f)));if(y!==0){do{for(p=u-1;t.bl_count[p]===0;)p--;t.bl_count[p]--,t.bl_count[p+1]+=2,t.bl_count[u]--,y-=2}while(y>0);for(p=u;p!==0;p--)for(l=t.bl_count[p];l!==0;)d=t.heap[--c],!(d>n)&&(r[d*2+1]!==p&&(t.opt_len+=(p-r[d*2+1])*r[d*2],r[d*2+1]=p),l--)}},Yd=(t,e,r)=>{let n=new Array(Sn+1),i=0,a,o;for(a=1;a<=Sn;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]=Jd(n[s]++,s))}},Kg=()=>{let t,e,r,n,i,a=new Array(Sn+1);for(r=0,n=0;n<Yu-1;n++)for(el[n]=r,t=0;t<1<<Cu[n];t++)Ca[r++]=n;for(Ca[r-1]=n,i=0,n=0;n<16;n++)for(Es[n]=i,t=0;t<1<<ns[n];t++)Na[i++]=n;for(i>>=7;n<mi;n++)for(Es[n]=i<<7,t=0;t<1<<ns[n]-7;t++)Na[256+i++]=n;for(e=0;e<=Sn;e++)a[e]=0;for(t=0;t<=143;)hr[t*2+1]=8,t++,a[8]++;for(;t<=255;)hr[t*2+1]=9,t++,a[9]++;for(;t<=279;)hr[t*2+1]=7,t++,a[7]++;for(;t<=287;)hr[t*2+1]=8,t++,a[8]++;for(Yd(hr,Da+1,a),t=0;t<mi;t++)Sa[t*2+1]=5,Sa[t*2]=Jd(t,5);Wd=new au(hr,Cu,Ba+1,Da,Sn),Gd=new au(Sa,ns,0,mi,Sn),Kd=new au(new Array(0),Qg,0,Zu,Vg)},Zd=t=>{let e;for(e=0;e<Da;e++)t.dyn_ltree[e*2]=0;for(e=0;e<mi;e++)t.dyn_dtree[e*2]=0;for(e=0;e<Zu;e++)t.bl_tree[e*2]=0;t.dyn_ltree[Xu*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},Xd=t=>{t.bi_valid>8?Pa(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},Sp=(t,e,r,n)=>{let i=e*2,a=r*2;return t[i]<t[a]||t[i]===t[a]&&n[e]<=n[r]},su=(t,e,r)=>{let n=t.heap[r],i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&Sp(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!Sp(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},wp=(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?Xt(t,i,e):(o=Ca[i],Xt(t,o+Ba+1,e),s=Cu[o],s!==0&&(i-=el[o],dt(t,i,s)),n--,o=Hd(n),Xt(t,o,r),s=ns[o],s!==0&&(n-=Es[o],dt(t,n,s)));while(a<t.sym_next);Xt(t,Xu,e)},Pu=(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=qd,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--)su(t,r,o);c=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],su(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++,su(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Gg(t,e),Yd(r,u,t.bl_count)},Ep=(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[Bd*2]++):s<=10?t.bl_tree[Vd*2]++:t.bl_tree[Qd*2]++,s=0,i=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4))},xp=(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 Xt(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Xt(t,a,t.bl_tree),s--),Xt(t,Bd,t.bl_tree),dt(t,s-3,2)):s<=10?(Xt(t,Vd,t.bl_tree),dt(t,s-3,3)):(Xt(t,Qd,t.bl_tree),dt(t,s-11,7));s=0,i=a,o===0?(u=138,c=3):a===o?(u=6,c=3):(u=7,c=4)}},Hg=t=>{let e;for(Ep(t,t.dyn_ltree,t.l_desc.max_code),Ep(t,t.dyn_dtree,t.d_desc.max_code),Pu(t,t.bl_desc),e=Zu-1;e>=3&&t.bl_tree[zd[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},Jg=(t,e,r,n)=>{let i;for(dt(t,e-257,5),dt(t,r-1,5),dt(t,n-4,4),i=0;i<n;i++)dt(t,t.bl_tree[zd[i]*2+1],3);xp(t,t.dyn_ltree,e-1),xp(t,t.dyn_dtree,r-1)},Yg=t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return bp;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return _p;for(r=32;r<Ba;r++)if(t.dyn_ltree[r*2]!==0)return _p;return bp},Ip=!1,Zg=t=>{Ip||(Kg(),Ip=!0),t.l_desc=new ou(t.dyn_ltree,Wd),t.d_desc=new ou(t.dyn_dtree,Gd),t.bl_desc=new ou(t.bl_tree,Kd),t.bi_buf=0,t.bi_valid=0,Zd(t)},eh=(t,e,r,n)=>{dt(t,(jg<<1)+(n?1:0),3),Xd(t),Pa(t,r),Pa(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},Xg=t=>{dt(t,Ud<<1,3),Xt(t,Xu,hr),Wg(t)},ev=(t,e,r,n)=>{let i,a,o=0;t.level>0?(t.strm.data_type===Mg&&(t.strm.data_type=Yg(t)),Pu(t,t.l_desc),Pu(t,t.d_desc),o=Hg(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?eh(t,e,r,n):t.strategy===$g||a===i?(dt(t,(Ud<<1)+(n?1:0),3),wp(t,hr,Sa)):(dt(t,(Ug<<1)+(n?1:0),3),Jg(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),wp(t,t.dyn_ltree,t.dyn_dtree)),Zd(t),n&&Xd(t)},tv=(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[(Ca[r]+Ba+1)*2]++,t.dyn_dtree[Hd(e)*2]++),t.sym_next===t.sym_end),rv=Zg,nv=eh,iv=ev,av=tv,ov=Xg,sv={_tr_init:rv,_tr_stored_block:nv,_tr_flush_block:iv,_tr_tally:av,_tr_align:ov},cv=(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},Ra=cv,uv=()=>{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},lv=new Uint32Array(uv()),fv=(t,e,r,n)=>{let i=lv,a=n+r;t^=-1;for(let o=n;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1},Ue=fv,Dn={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"},Mn={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:pv,_tr_stored_block:Ru,_tr_flush_block:dv,_tr_tally:Ur,_tr_align:hv}=sv,{Z_NO_FLUSH:qr,Z_PARTIAL_FLUSH:mv,Z_FULL_FLUSH:yv,Z_FINISH:Nt,Z_BLOCK:Tp,Z_OK:He,Z_STREAM_END:kp,Z_STREAM_ERROR:tr,Z_DATA_ERROR:gv,Z_BUF_ERROR:cu,Z_DEFAULT_COMPRESSION:vv,Z_FILTERED:bv,Z_HUFFMAN_ONLY:Uo,Z_RLE:_v,Z_FIXED:Sv,Z_DEFAULT_STRATEGY:wv,Z_UNKNOWN:Ev,Z_DEFLATED:Fs}=Mn,xv=9,Iv=15,Tv=8,kv=29,Ov=256,Lu=Ov+1+kv,Av=30,Dv=19,Nv=2*Lu+1,Cv=15,te=3,Fr=258,rr=Fr+te+1,Pv=32,bi=42,tl=57,Fu=69,$u=73,Mu=91,ju=103,wn=113,ma=666,at=1,Oi=2,Nn=3,Ai=4,Rv=3,En=(t,e)=>(t.msg=Dn[e],e),Op=t=>t*2-(t>4?9:0),Lr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Lv=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)},Fv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,Br=Fv,vt=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))},_t=(t,e)=>{dv(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,vt(t.strm)},ue=(t,e)=>{t.pending_buf[t.pending++]=e},ea=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Uu=(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=Ra(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Ue(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},th=(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-rr?t.strstart-(t.w_size-rr):0,c=t.window,l=t.w_mask,d=t.prev,p=t.strstart+Fr,f=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]!==f||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<p);if(a=Fr-(p-n),n=p-Fr,a>o){if(t.match_start=e,o=a,a>=s)break;f=c[n+o-1],h=c[n+o]}}while((e=d[e&l])>u&&--r!==0);return o<=t.lookahead?o:t.lookahead},_i=t=>{let e=t.w_size,r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-rr)&&(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),Lv(t),n+=e),t.strm.avail_in===0)break;if(r=Uu(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=te)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Br(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Br(t,t.ins_h,t.window[i+te-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<te)););}while(t.lookahead<rr&&t.strm.avail_in!==0)},rh=(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!==Nt||e===qr||n!==i+t.strm.avail_in)))break;o=e===Nt&&n===i+t.strm.avail_in?1:0,Ru(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,vt(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&&(Uu(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?Ai:e!==qr&&e!==Nt&&t.strm.avail_in===0&&t.strstart===t.block_start?Oi:(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&&(Uu(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===Nt)&&e!==qr&&t.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Nt&&t.strm.avail_in===0&&n===i?1:0,Ru(t,t.block_start,n,o),t.block_start+=n,vt(t.strm)),o?Nn:at)},uu=(t,e)=>{let r,n;for(;;){if(t.lookahead<rr){if(_i(t),t.lookahead<rr&&e===qr)return at;if(t.lookahead===0)break}if(r=0,t.lookahead>=te&&(t.ins_h=Br(t,t.ins_h,t.window[t.strstart+te-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-rr&&(t.match_length=th(t,r)),t.match_length>=te)if(n=Ur(t,t.strstart-t.match_start,t.match_length-te),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=te){t.match_length--;do t.strstart++,t.ins_h=Br(t,t.ins_h,t.window[t.strstart+te-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=Br(t,t.ins_h,t.window[t.strstart+1]);else n=Ur(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(_t(t,!1),t.strm.avail_out===0))return at}return t.insert=t.strstart<te-1?t.strstart:te-1,e===Nt?(_t(t,!0),t.strm.avail_out===0?Nn:Ai):t.sym_next&&(_t(t,!1),t.strm.avail_out===0)?at:Oi},ui=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<rr){if(_i(t),t.lookahead<rr&&e===qr)return at;if(t.lookahead===0)break}if(r=0,t.lookahead>=te&&(t.ins_h=Br(t,t.ins_h,t.window[t.strstart+te-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=te-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-rr&&(t.match_length=th(t,r),t.match_length<=5&&(t.strategy===bv||t.match_length===te&&t.strstart-t.match_start>4096)&&(t.match_length=te-1)),t.prev_length>=te&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-te,n=Ur(t,t.strstart-1-t.prev_match,t.prev_length-te),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=Br(t,t.ins_h,t.window[t.strstart+te-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=te-1,t.strstart++,n&&(_t(t,!1),t.strm.avail_out===0))return at}else if(t.match_available){if(n=Ur(t,0,t.window[t.strstart-1]),n&&_t(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return at}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=Ur(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<te-1?t.strstart:te-1,e===Nt?(_t(t,!0),t.strm.avail_out===0?Nn:Ai):t.sym_next&&(_t(t,!1),t.strm.avail_out===0)?at:Oi},$v=(t,e)=>{let r,n,i,a,o=t.window;for(;;){if(t.lookahead<=Fr){if(_i(t),t.lookahead<=Fr&&e===qr)return at;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=te&&t.strstart>0&&(i=t.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=t.strstart+Fr;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=Fr-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=te?(r=Ur(t,1,t.match_length-te),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=Ur(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(_t(t,!1),t.strm.avail_out===0))return at}return t.insert=0,e===Nt?(_t(t,!0),t.strm.avail_out===0?Nn:Ai):t.sym_next&&(_t(t,!1),t.strm.avail_out===0)?at:Oi},Mv=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(_i(t),t.lookahead===0)){if(e===qr)return at;break}if(t.match_length=0,r=Ur(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(_t(t,!1),t.strm.avail_out===0))return at}return t.insert=0,e===Nt?(_t(t,!0),t.strm.avail_out===0?Nn:Ai):t.sym_next&&(_t(t,!1),t.strm.avail_out===0)?at:Oi};function Gt(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 ya=[new Gt(0,0,0,0,rh),new Gt(4,4,8,4,uu),new Gt(4,5,16,8,uu),new Gt(4,6,32,32,uu),new Gt(4,4,16,16,ui),new Gt(8,16,32,32,ui),new Gt(8,16,128,128,ui),new Gt(8,32,128,256,ui),new Gt(32,128,258,1024,ui),new Gt(32,258,258,4096,ui)],jv=t=>{t.window_size=2*t.w_size,Lr(t.head),t.max_lazy_match=ya[t.level].max_lazy,t.good_match=ya[t.level].good_length,t.nice_match=ya[t.level].nice_length,t.max_chain_length=ya[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=te-1,t.match_available=0,t.ins_h=0};function Uv(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Fs,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(Nv*2),this.dyn_dtree=new Uint16Array((2*Av+1)*2),this.bl_tree=new Uint16Array((2*Dv+1)*2),Lr(this.dyn_ltree),Lr(this.dyn_dtree),Lr(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*Lu+1),Lr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Lu+1),Lr(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 Va=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==bi&&e.status!==tl&&e.status!==Fu&&e.status!==$u&&e.status!==Mu&&e.status!==ju&&e.status!==wn&&e.status!==ma?1:0},nh=t=>{if(Va(t))return En(t,tr);t.total_in=t.total_out=0,t.data_type=Ev;let e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?tl:e.wrap?bi:wn,t.adler=e.wrap===2?0:1,e.last_flush=-2,pv(e),He},ih=t=>{let e=nh(t);return e===He&&jv(t.state),e},qv=(t,e)=>Va(t)||t.state.wrap!==2?tr:(t.state.gzhead=e,He),ah=(t,e,r,n,i,a)=>{if(!t)return tr;let o=1;if(e===vv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>xv||r!==Fs||n<8||n>15||e<0||e>9||a<0||a>Sv||n===8&&o!==1)return En(t,tr);n===8&&(n=9);let s=new Uv;return t.state=s,s.strm=t,s.status=bi,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+te-1)/te),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,ih(t)},Bv=(t,e)=>ah(t,e,Fs,Iv,Tv,wv),Vv=(t,e)=>{if(Va(t)||e>Tp||e<0)return t?En(t,tr):tr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===ma&&e!==Nt)return En(t,t.avail_out===0?cu:tr);let n=r.last_flush;if(r.last_flush=e,r.pending!==0){if(vt(t),t.avail_out===0)return r.last_flush=-1,He}else if(t.avail_in===0&&Op(e)<=Op(n)&&e!==Nt)return En(t,cu);if(r.status===ma&&t.avail_in!==0)return En(t,cu);if(r.status===bi&&r.wrap===0&&(r.status=wn),r.status===bi){let i=Fs+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Uo||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=Pv),i+=31-i%31,ea(r,i),r.strstart!==0&&(ea(r,t.adler>>>16),ea(r,t.adler&65535)),t.adler=1,r.status=wn,vt(t),r.pending!==0)return r.last_flush=-1,He}if(r.status===tl){if(t.adler=0,ue(r,31),ue(r,139),ue(r,8),r.gzhead)ue(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)),ue(r,r.gzhead.time&255),ue(r,r.gzhead.time>>8&255),ue(r,r.gzhead.time>>16&255),ue(r,r.gzhead.time>>24&255),ue(r,r.level===9?2:r.strategy>=Uo||r.level<2?4:0),ue(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(ue(r,r.gzhead.extra.length&255),ue(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Ue(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=Fu;else if(ue(r,0),ue(r,0),ue(r,0),ue(r,0),ue(r,0),ue(r,r.level===9?2:r.strategy>=Uo||r.level<2?4:0),ue(r,Rv),r.status=wn,vt(t),r.pending!==0)return r.last_flush=-1,He}if(r.status===Fu){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=Ue(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=s,vt(t),r.pending!==0)return r.last_flush=-1,He;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=Ue(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=$u}if(r.status===$u){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=Ue(t.adler,r.pending_buf,r.pending-i,i)),vt(t),r.pending!==0)return r.last_flush=-1,He;i=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,ue(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ue(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Mu}if(r.status===Mu){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=Ue(t.adler,r.pending_buf,r.pending-i,i)),vt(t),r.pending!==0)return r.last_flush=-1,He;i=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,ue(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ue(t.adler,r.pending_buf,r.pending-i,i))}r.status=ju}if(r.status===ju){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(vt(t),r.pending!==0))return r.last_flush=-1,He;ue(r,t.adler&255),ue(r,t.adler>>8&255),t.adler=0}if(r.status=wn,vt(t),r.pending!==0)return r.last_flush=-1,He}if(t.avail_in!==0||r.lookahead!==0||e!==qr&&r.status!==ma){let i=r.level===0?rh(r,e):r.strategy===Uo?Mv(r,e):r.strategy===_v?$v(r,e):ya[r.level].func(r,e);if((i===Nn||i===Ai)&&(r.status=ma),i===at||i===Nn)return t.avail_out===0&&(r.last_flush=-1),He;if(i===Oi&&(e===mv?hv(r):e!==Tp&&(Ru(r,0,0,!1),e===yv&&(Lr(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),vt(t),t.avail_out===0))return r.last_flush=-1,He}return e!==Nt?He:r.wrap<=0?kp:(r.wrap===2?(ue(r,t.adler&255),ue(r,t.adler>>8&255),ue(r,t.adler>>16&255),ue(r,t.adler>>24&255),ue(r,t.total_in&255),ue(r,t.total_in>>8&255),ue(r,t.total_in>>16&255),ue(r,t.total_in>>24&255)):(ea(r,t.adler>>>16),ea(r,t.adler&65535)),vt(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?He:kp)},Qv=t=>{if(Va(t))return tr;let e=t.state.status;return t.state=null,e===wn?En(t,gv):He},zv=(t,e)=>{let r=e.length;if(Va(t))return tr;let n=t.state,i=n.wrap;if(i===2||i===1&&n.status!==bi||n.lookahead)return tr;if(i===1&&(t.adler=Ra(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Lr(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,_i(n);n.lookahead>=te;){let u=n.strstart,c=n.lookahead-(te-1);do n.ins_h=Br(n,n.ins_h,n.window[u+te-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=te-1,_i(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=te-1,n.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,n.wrap=i,He},Wv=Bv,Gv=ah,Kv=ih,Hv=nh,Jv=qv,Yv=Vv,Zv=Qv,Xv=zv,eb="pako deflate (from Nodeca project)",wa={deflateInit:Wv,deflateInit2:Gv,deflateReset:Kv,deflateResetKeep:Hv,deflateSetHeader:Jv,deflate:Yv,deflateEnd:Zv,deflateSetDictionary:Xv,deflateInfo:eb},tb=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),rb=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)tb(r,n)&&(t[n]=r[n])}}return t},nb=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},$s={assign:rb,flattenChunks:nb},oh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){oh=!1}var La=new Uint8Array(256);for(let t=0;t<256;t++)La[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;La[254]=La[254]=1;var ib=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},ab=(t,e)=>{if(e<65534&&t.subarray&&oh)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},ob=(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=La[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 ab(a,i)},sb=(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+La[t[r]]>e?r:e},Fa={string2buf:ib,buf2string:ob,utf8border:sb};function cb(){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 sh=cb,ch=Object.prototype.toString,{Z_NO_FLUSH:ub,Z_SYNC_FLUSH:lb,Z_FULL_FLUSH:fb,Z_FINISH:pb,Z_OK:xs,Z_STREAM_END:db,Z_DEFAULT_COMPRESSION:hb,Z_DEFAULT_STRATEGY:mb,Z_DEFLATED:yb}=Mn;function Qa(t){this.options=$s.assign({level:hb,method:yb,chunkSize:16384,windowBits:15,memLevel:8,strategy:mb},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 sh,this.strm.avail_out=0;let r=wa.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==xs)throw new Error(Dn[r]);if(e.header&&wa.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=Fa.string2buf(e.dictionary):ch.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=wa.deflateSetDictionary(this.strm,n),r!==xs)throw new Error(Dn[r]);this._dict_set=!0}}Qa.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?pb:ub,typeof t=="string"?r.input=Fa.string2buf(t):ch.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===lb||a===fb)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=wa.deflate(r,a),i===db)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=wa.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===xs;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};Qa.prototype.onData=function(t){this.chunks.push(t)};Qa.prototype.onEnd=function(t){t===xs&&(this.result=$s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function rl(t,e){let r=new Qa(e);if(r.push(t,!0),r.err)throw r.msg||Dn[r.err];return r.result}function gb(t,e){return e=e||{},e.raw=!0,rl(t,e)}function vb(t,e){return e=e||{},e.gzip=!0,rl(t,e)}var bb=Qa,_b=rl,Sb=gb,wb=vb,Eb=Mn,xb={Deflate:bb,deflate:_b,deflateRaw:Sb,gzip:wb,constants:Eb},qo=16209,Ib=16191,Tb=function t(e,r){let n,i,a,o,s,u,c,l,d,p,f,h,y,v,b,_,S,g,D,N,T,C,F,R,M=e.state;n=e.next_in,F=e.input,i=n+(e.avail_in-5),a=e.next_out,R=e.output,o=a-(r-e.avail_out),s=a+(e.avail_out-257),u=M.dmax,c=M.wsize,l=M.whave,d=M.wnext,p=M.window,f=M.hold,h=M.bits,y=M.lencode,v=M.distcode,b=(1<<M.lenbits)-1,_=(1<<M.distbits)-1;e:do{h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),S=y[f&b];t:for(;;){if(g=S>>>24,f>>>=g,h-=g,g=S>>>16&255,g===0)R[a++]=S&65535;else if(g&16){D=S&65535,g&=15,g&&(h<g&&(f+=F[n++]<<h,h+=8),D+=f&(1<<g)-1,f>>>=g,h-=g),h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),S=v[f&_];r:for(;;){if(g=S>>>24,f>>>=g,h-=g,g=S>>>16&255,g&16){if(N=S&65535,g&=15,h<g&&(f+=F[n++]<<h,h+=8,h<g&&(f+=F[n++]<<h,h+=8)),N+=f&(1<<g)-1,N>u){e.msg="invalid distance too far back",M.mode=qo;break e}if(f>>>=g,h-=g,g=a-o,N>g){if(g=N-g,g>l&&M.sane){e.msg="invalid distance too far back",M.mode=qo;break e}if(T=0,C=p,d===0){if(T+=c-g,g<D){D-=g;do R[a++]=p[T++];while(--g);T=a-N,C=R}}else if(d<g){if(T+=c+d-g,g-=d,g<D){D-=g;do R[a++]=p[T++];while(--g);if(T=0,d<D){g=d,D-=g;do R[a++]=p[T++];while(--g);T=a-N,C=R}}}else if(T+=d-g,g<D){D-=g;do R[a++]=p[T++];while(--g);T=a-N,C=R}for(;D>2;)R[a++]=C[T++],R[a++]=C[T++],R[a++]=C[T++],D-=3;D&&(R[a++]=C[T++],D>1&&(R[a++]=C[T++]))}else{T=a-N;do R[a++]=R[T++],R[a++]=R[T++],R[a++]=R[T++],D-=3;while(D>2);D&&(R[a++]=R[T++],D>1&&(R[a++]=R[T++]))}}else if((g&64)===0){S=v[(S&65535)+(f&(1<<g)-1)];continue r}else{e.msg="invalid distance code",M.mode=qo;break e}break}}else if((g&64)===0){S=y[(S&65535)+(f&(1<<g)-1)];continue t}else if(g&32){M.mode=Ib;break e}else{e.msg="invalid literal/length code",M.mode=qo;break e}break}}while(n<i&&a<s);D=h>>3,n-=D,h-=D<<3,f&=(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),M.hold=f,M.bits=h},li=15,Ap=852,Dp=592,Np=0,lu=1,Cp=2,kb=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]),Ob=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]),Ab=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]),Db=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]),Nb=(t,e,r,n,i,a,o,s)=>{let u=s.bits,c=0,l=0,d=0,p=0,f=0,h=0,y=0,v=0,b=0,_=0,S,g,D,N,T,C=null,F,R=new Uint16Array(li+1),M=new Uint16Array(li+1),Ve=null,Pe,V,me;for(c=0;c<=li;c++)R[c]=0;for(l=0;l<n;l++)R[e[r+l]]++;for(f=u,p=li;p>=1&&R[p]===0;p--);if(f>p&&(f=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<p&&R[d]===0;d++);for(f<d&&(f=d),v=1,c=1;c<=li;c++)if(v<<=1,v-=R[c],v<0)return-1;if(v>0&&(t===Np||p!==1))return-1;for(M[1]=0,c=1;c<li;c++)M[c+1]=M[c]+R[c];for(l=0;l<n;l++)e[r+l]!==0&&(o[M[e[r+l]]++]=l);if(t===Np?(C=Ve=o,F=20):t===lu?(C=kb,Ve=Ob,F=257):(C=Ab,Ve=Db,F=0),_=0,l=0,c=d,T=a,h=f,y=0,D=-1,b=1<<f,N=b-1,t===lu&&b>Ap||t===Cp&&b>Dp)return 1;for(;;){Pe=c-y,o[l]+1<F?(V=0,me=o[l]):o[l]>=F?(V=Ve[o[l]-F],me=C[o[l]-F]):(V=32+64,me=0),S=1<<c-y,g=1<<h,d=g;do g-=S,i[T+(_>>y)+g]=Pe<<24|V<<16|me|0;while(g!==0);for(S=1<<c-1;_&S;)S>>=1;if(S!==0?(_&=S-1,_+=S):_=0,l++,--R[c]===0){if(c===p)break;c=e[r+o[l]]}if(c>f&&(_&N)!==D){for(y===0&&(y=f),T+=d,h=c-y,v=1<<h;h+y<p&&(v-=R[h+y],!(v<=0));)h++,v<<=1;if(b+=1<<h,t===lu&&b>Ap||t===Cp&&b>Dp)return 1;D=_&N,i[D]=f<<24|h<<16|T-a|0}}return _!==0&&(i[T+_]=c-y<<24|64<<16|0),s.bits=f,0},Ea=Nb,Cb=0,uh=1,lh=2,{Z_FINISH:Pp,Z_BLOCK:Pb,Z_TREES:Bo,Z_OK:Cn,Z_STREAM_END:Rb,Z_NEED_DICT:Lb,Z_STREAM_ERROR:Ct,Z_DATA_ERROR:fh,Z_MEM_ERROR:ph,Z_BUF_ERROR:Fb,Z_DEFLATED:Rp}=Mn,Ms=16180,Lp=16181,Fp=16182,$p=16183,Mp=16184,jp=16185,Up=16186,qp=16187,Bp=16188,Vp=16189,Is=16190,lr=16191,fu=16192,Qp=16193,pu=16194,zp=16195,Wp=16196,Gp=16197,Kp=16198,Vo=16199,Qo=16200,Hp=16201,Jp=16202,Yp=16203,Zp=16204,Xp=16205,du=16206,ed=16207,td=16208,_e=16209,dh=16210,hh=16211,$b=852,Mb=592,jb=15,Ub=jb,rd=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function qb(){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 jn=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<Ms||e.mode>hh?1:0},mh=t=>{if(jn(t))return Ct;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=Ms,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($b),e.distcode=e.distdyn=new Int32Array(Mb),e.sane=1,e.back=-1,Cn},yh=t=>{if(jn(t))return Ct;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,mh(t)},gh=(t,e)=>{let r;if(jn(t))return Ct;let n=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Ct:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,yh(t))},vh=(t,e)=>{if(!t)return Ct;let r=new qb;t.state=r,r.strm=t,r.window=null,r.mode=Ms;let n=gh(t,e);return n!==Cn&&(t.state=null),n},Bb=t=>vh(t,Ub),nd=!0,hu,mu,Vb=t=>{if(nd){hu=new Int32Array(512),mu=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(Ea(uh,t.lens,0,288,hu,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Ea(lh,t.lens,0,32,mu,0,t.work,{bits:5}),nd=!1}t.lencode=hu,t.lenbits=9,t.distcode=mu,t.distbits=5},bh=(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},Qb=(t,e)=>{let r,n,i,a,o,s,u,c,l,d,p,f,h,y,v=0,b,_,S,g,D,N,T,C,F=new Uint8Array(4),R,M,Ve=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(jn(t)||!t.output||!t.input&&t.avail_in!==0)return Ct;r=t.state,r.mode===lr&&(r.mode=fu),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,p=u,C=Cn;e:for(;;)switch(r.mode){case Ms:if(r.wrap===0){r.mode=fu;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,F[0]=c&255,F[1]=c>>>8&255,r.check=Ue(r.check,F,2,0),c=0,l=0,r.mode=Lp;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((c&255)<<8)+(c>>8))%31){t.msg="incorrect header check",r.mode=_e;break}if((c&15)!==Rp){t.msg="unknown compression method",r.mode=_e;break}if(c>>>=4,l-=4,T=(c&15)+8,r.wbits===0&&(r.wbits=T),T>15||T>r.wbits){t.msg="invalid window size",r.mode=_e;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=c&512?Vp:lr,c=0,l=0;break;case Lp:for(;l<16;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}if(r.flags=c,(r.flags&255)!==Rp){t.msg="unknown compression method",r.mode=_e;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=_e;break}r.head&&(r.head.text=c>>8&1),r.flags&512&&r.wrap&4&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ue(r.check,F,2,0)),c=0,l=0,r.mode=Fp;case Fp: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&&(F[0]=c&255,F[1]=c>>>8&255,F[2]=c>>>16&255,F[3]=c>>>24&255,r.check=Ue(r.check,F,4,0)),c=0,l=0,r.mode=$p;case $p: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&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ue(r.check,F,2,0)),c=0,l=0,r.mode=Mp;case Mp: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&&(F[0]=c&255,F[1]=c>>>8&255,r.check=Ue(r.check,F,2,0)),c=0,l=0}else r.head&&(r.head.extra=null);r.mode=jp;case jp:if(r.flags&1024&&(f=r.length,f>s&&(f=s),f&&(r.head&&(T=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+f),T)),r.flags&512&&r.wrap&4&&(r.check=Ue(r.check,n,f,a)),s-=f,a+=f,r.length-=f),r.length))break e;r.length=0,r.mode=Up;case Up:if(r.flags&2048){if(s===0)break e;f=0;do T=n[a+f++],r.head&&T&&r.length<65536&&(r.head.name+=String.fromCharCode(T));while(T&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ue(r.check,n,f,a)),s-=f,a+=f,T)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=qp;case qp:if(r.flags&4096){if(s===0)break e;f=0;do T=n[a+f++],r.head&&T&&r.length<65536&&(r.head.comment+=String.fromCharCode(T));while(T&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ue(r.check,n,f,a)),s-=f,a+=f,T)break e}else r.head&&(r.head.comment=null);r.mode=Bp;case Bp: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=_e;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=lr;break;case Vp:for(;l<32;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}t.adler=r.check=rd(c),c=0,l=0,r.mode=Is;case Is: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,Lb;t.adler=r.check=1,r.mode=lr;case lr:if(e===Pb||e===Bo)break e;case fu:if(r.last){c>>>=l&7,l-=l&7,r.mode=du;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=Qp;break;case 1:if(Vb(r),r.mode=Vo,e===Bo){c>>>=2,l-=2;break e}break;case 2:r.mode=Wp;break;case 3:t.msg="invalid block type",r.mode=_e}c>>>=2,l-=2;break;case Qp: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=_e;break}if(r.length=c&65535,c=0,l=0,r.mode=pu,e===Bo)break e;case pu:r.mode=zp;case zp:if(f=r.length,f){if(f>s&&(f=s),f>u&&(f=u),f===0)break e;i.set(n.subarray(a,a+f),o),s-=f,a+=f,u-=f,o+=f,r.length-=f;break}r.mode=lr;break;case Wp: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=_e;break}r.have=0,r.mode=Gp;case Gp:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}r.lens[Ve[r.have++]]=c&7,c>>>=3,l-=3}for(;r.have<19;)r.lens[Ve[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,R={bits:r.lenbits},C=Ea(Cb,r.lens,0,19,r.lencode,0,r.work,R),r.lenbits=R.bits,C){t.msg="invalid code lengths set",r.mode=_e;break}r.have=0,r.mode=Kp;case Kp: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(M=b+2;l<M;){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=_e;break}T=r.lens[r.have-1],f=3+(c&3),c>>>=2,l-=2}else if(S===17){for(M=b+3;l<M;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=b,l-=b,T=0,f=3+(c&7),c>>>=3,l-=3}else{for(M=b+7;l<M;){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=b,l-=b,T=0,f=11+(c&127),c>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=_e;break}for(;f--;)r.lens[r.have++]=T}}if(r.mode===_e)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=_e;break}if(r.lenbits=9,R={bits:r.lenbits},C=Ea(uh,r.lens,0,r.nlen,r.lencode,0,r.work,R),r.lenbits=R.bits,C){t.msg="invalid literal/lengths set",r.mode=_e;break}if(r.distbits=6,r.distcode=r.distdyn,R={bits:r.distbits},C=Ea(lh,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,R),r.distbits=R.bits,C){t.msg="invalid distances set",r.mode=_e;break}if(r.mode=Vo,e===Bo)break e;case Vo:r.mode=Qo;case Qo: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,Tb(t,p),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===lr&&(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(g=b,D=_,N=S;v=r.lencode[N+((c&(1<<g+D)-1)>>g)],b=v>>>24,_=v>>>16&255,S=v&65535,!(g+b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=g,l-=g,r.back+=g}if(c>>>=b,l-=b,r.back+=b,r.length=S,_===0){r.mode=Xp;break}if(_&32){r.back=-1,r.mode=lr;break}if(_&64){t.msg="invalid literal/length code",r.mode=_e;break}r.extra=_&15,r.mode=Hp;case Hp:if(r.extra){for(M=r.extra;l<M;){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=Jp;case Jp: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(g=b,D=_,N=S;v=r.distcode[N+((c&(1<<g+D)-1)>>g)],b=v>>>24,_=v>>>16&255,S=v&65535,!(g+b<=l);){if(s===0)break e;s--,c+=n[a++]<<l,l+=8}c>>>=g,l-=g,r.back+=g}if(c>>>=b,l-=b,r.back+=b,_&64){t.msg="invalid distance code",r.mode=_e;break}r.offset=S,r.extra=_&15,r.mode=Yp;case Yp:if(r.extra){for(M=r.extra;l<M;){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=_e;break}r.mode=Zp;case Zp:if(u===0)break e;if(f=p-u,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=_e;break}f>r.wnext?(f-=r.wnext,h=r.wsize-f):h=r.wnext-f,f>r.length&&(f=r.length),y=r.window}else y=i,h=o-r.offset,f=r.length;f>u&&(f=u),u-=f,r.length-=f;do i[o++]=y[h++];while(--f);r.length===0&&(r.mode=Qo);break;case Xp:if(u===0)break e;i[o++]=r.length,u--,r.mode=Qo;break;case du:if(r.wrap){for(;l<32;){if(s===0)break e;s--,c|=n[a++]<<l,l+=8}if(p-=u,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ue(r.check,i,p,o-p):Ra(r.check,i,p,o-p)),p=u,r.wrap&4&&(r.flags?c:rd(c))!==r.check){t.msg="incorrect data check",r.mode=_e;break}c=0,l=0}r.mode=ed;case ed: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=_e;break}c=0,l=0}r.mode=td;case td:C=Rb;break e;case _e:C=fh;break e;case dh:return ph;case hh:default:return Ct}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||p!==t.avail_out&&r.mode<_e&&(r.mode<du||e!==Pp))&&bh(t,t.output,t.next_out,p-t.avail_out),d-=t.avail_in,p-=t.avail_out,t.total_in+=d,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ue(r.check,i,p,t.next_out-p):Ra(r.check,i,p,t.next_out-p)),t.data_type=r.bits+(r.last?64:0)+(r.mode===lr?128:0)+(r.mode===Vo||r.mode===pu?256:0),(d===0&&p===0||e===Pp)&&C===Cn&&(C=Fb),C},zb=t=>{if(jn(t))return Ct;let e=t.state;return e.window&&(e.window=null),t.state=null,Cn},Wb=(t,e)=>{if(jn(t))return Ct;let r=t.state;return(r.wrap&2)===0?Ct:(r.head=e,e.done=!1,Cn)},Gb=(t,e)=>{let r=e.length,n,i,a;return jn(t)||(n=t.state,n.wrap!==0&&n.mode!==Is)?Ct:n.mode===Is&&(i=1,i=Ra(i,e,r,0),i!==n.check)?fh:(a=bh(t,e,r,r),a?(n.mode=dh,ph):(n.havedict=1,Cn))},Kb=yh,Hb=gh,Jb=mh,Yb=Bb,Zb=vh,Xb=Qb,e_=zb,t_=Wb,r_=Gb,n_="pako inflate (from Nodeca project)",mr={inflateReset:Kb,inflateReset2:Hb,inflateResetKeep:Jb,inflateInit:Yb,inflateInit2:Zb,inflate:Xb,inflateEnd:e_,inflateGetHeader:t_,inflateSetDictionary:r_,inflateInfo:n_};function i_(){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 a_=i_,_h=Object.prototype.toString,{Z_NO_FLUSH:o_,Z_FINISH:s_,Z_OK:$a,Z_STREAM_END:yu,Z_NEED_DICT:gu,Z_STREAM_ERROR:c_,Z_DATA_ERROR:id,Z_MEM_ERROR:u_}=Mn;function za(t){this.options=$s.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 sh,this.strm.avail_out=0;let r=mr.inflateInit2(this.strm,e.windowBits);if(r!==$a)throw new Error(Dn[r]);if(this.header=new a_,mr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=Fa.string2buf(e.dictionary):_h.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=mr.inflateSetDictionary(this.strm,e.dictionary),r!==$a)))throw new Error(Dn[r])}za.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?s_:o_,_h.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=mr.inflate(r,o),a===gu&&i&&(a=mr.inflateSetDictionary(r,i),a===$a?a=mr.inflate(r,o):a===id&&(a=gu));r.avail_in>0&&a===yu&&r.state.wrap>0&&t[r.next_in]!==0;)mr.inflateReset(r),a=mr.inflate(r,o);switch(a){case c_:case id:case gu:case u_:return this.onEnd(a),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(r.avail_out===0||a===yu))if(this.options.to==="string"){let u=Fa.utf8border(r.output,r.next_out),c=r.next_out-u,l=Fa.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===$a&&s===0)){if(a===yu)return a=mr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};za.prototype.onData=function(t){this.chunks.push(t)};za.prototype.onEnd=function(t){t===$a&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=$s.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function nl(t,e){let r=new za(e);if(r.push(t),r.err)throw r.msg||Dn[r.err];return r.result}function l_(t,e){return e=e||{},e.raw=!0,nl(t,e)}var f_=za,p_=nl,d_=l_,h_=nl,m_=Mn,y_={Inflate:f_,inflate:p_,inflateRaw:d_,ungzip:h_,constants:m_},{Deflate:g_,deflate:v_,deflateRaw:b_,gzip:__}=xb,{Inflate:S_,inflate:w_,inflateRaw:E_,ungzip:x_}=y_,I_=g_,T_=v_,k_=b_,O_=__,A_=S_,D_=w_,N_=E_,C_=x_,P_=Mn,R_={Deflate:I_,deflate:T_,deflateRaw:k_,gzip:O_,Inflate:A_,inflate:D_,inflateRaw:N_,ungzip:C_,constants:P_},ge=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},ve=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ts=class{constructor(e,r){this.input=e,this.output=r}};ge([m(),ve("design:type",String)],Ts.prototype,"input",void 0);ge([m(),ve("design:type",String)],Ts.prototype,"output",void 0);Ts=ge([Be(),ve("design:paramtypes",[String,String])],Ts);var ks=class{constructor(e,r){this.input=e,this.output=r}};ge([m(),ve("design:type",String)],ks.prototype,"input",void 0);ge([m(),ve("design:type",String)],ks.prototype,"output",void 0);ks=ge([Q(),ve("design:paramtypes",[String,String])],ks);var Gr=class{constructor(e,r,n,i,a){this.name=e,this.modelId=r,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};ge([m(),ve("design:type",String)],Gr.prototype,"name",void 0);ge([m(),ve("design:type",String)],Gr.prototype,"modelId",void 0);ge([m(),ve("design:type",String)],Gr.prototype,"systemPrompt",void 0);ge([m(),ve("design:type",Array)],Gr.prototype,"promptExamples",void 0);ge([m(),ve("design:type",String)],Gr.prototype,"metaData",void 0);Gr=ge([Be(),ve("design:paramtypes",[String,String,String,Array,String])],Gr);var ir=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}};ge([m(),ve("design:type",String)],ir.prototype,"name",void 0);ge([m(),ve("design:type",String)],ir.prototype,"modelId",void 0);ge([m(),ve("design:type",String)],ir.prototype,"taskId",void 0);ge([m(),ve("design:type",String)],ir.prototype,"systemPrompt",void 0);ge([m(),ve("design:type",Array)],ir.prototype,"promptExamples",void 0);ge([m(),ve("design:type",String)],ir.prototype,"metaData",void 0);ge([m(),ve("design:type",String)],ir.prototype,"createdAt",void 0);ge([m(),ve("design:type",String)],ir.prototype,"updatedAt",void 0);ir=ge([Q(),ve("design:paramtypes",[String,String,String,String,Array,String,String,String])],ir);var Pn=class{constructor(e,r,n,i,a){this.model=e,this.status=r,this.progress=n,this.downloaded=i,this.loaded=a}};ge([m(),ve("design:type",String)],Pn.prototype,"model",void 0);ge([m(),ve("design:type",String)],Pn.prototype,"status",void 0);ge([m(),ve("design:type",Number)],Pn.prototype,"progress",void 0);ge([m(),ve("design:type",Boolean)],Pn.prototype,"downloaded",void 0);ge([m(),ve("design:type",Boolean)],Pn.prototype,"loaded",void 0);Pn=ge([Q(),ve("design:paramtypes",[String,String,Number,Boolean,Boolean])],Pn);var L_=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},Me=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)},Fe,is,qu=class{constructor(e,r=!0){Fe.set(this,void 0),is.set(this,new Map),L_(this,Fe,e,"f")}async getModels(){let e=await Me(this,Fe,"f").query({query:I`
|
|
704
724
|
query {
|
|
705
725
|
aiGetModels {
|
|
706
726
|
id
|
|
@@ -724,23 +744,23 @@ triggerMatch
|
|
|
724
744
|
modelType
|
|
725
745
|
}
|
|
726
746
|
}
|
|
727
|
-
`});return
|
|
747
|
+
`});return k(e).aiGetModels}async addModel(e){let r=await Me(this,Fe,"f").mutate({mutation:I`
|
|
728
748
|
mutation($model: ModelInput!) {
|
|
729
749
|
aiAddModel(model: $model)
|
|
730
750
|
}
|
|
731
|
-
`,variables:{model:e}});return
|
|
751
|
+
`,variables:{model:e}});return k(r).aiAddModel}async updateModel(e,r){let n=await Me(this,Fe,"f").mutate({mutation:I`
|
|
732
752
|
mutation($modelId: String!, $model: ModelInput!) {
|
|
733
753
|
aiUpdateModel(modelId: $modelId, model: $model)
|
|
734
754
|
}
|
|
735
|
-
`,variables:{modelId:e,model:r}});return
|
|
755
|
+
`,variables:{modelId:e,model:r}});return k(n).aiUpdateModel}async removeModel(e){let r=await Me(this,Fe,"f").mutate({mutation:I`
|
|
736
756
|
mutation($modelId: String!) {
|
|
737
757
|
aiRemoveModel(modelId: $modelId)
|
|
738
758
|
}
|
|
739
|
-
`,variables:{modelId:e}});return
|
|
759
|
+
`,variables:{modelId:e}});return k(r).aiRemoveModel}async setDefaultModel(e,r){let n=await Me(this,Fe,"f").mutate({mutation:I`
|
|
740
760
|
mutation($modelType: ModelType!, $modelId: String!) {
|
|
741
761
|
aiSetDefaultModel(modelType: $modelType modelId: $modelId)
|
|
742
762
|
}
|
|
743
|
-
`,variables:{modelId:r,modelType:e}});return
|
|
763
|
+
`,variables:{modelId:r,modelType:e}});return k(n).aiSetDefaultModel}async getDefaultModel(e){let r=await Me(this,Fe,"f").query({query:I`
|
|
744
764
|
query($modelType: ModelType!) {
|
|
745
765
|
aiGetDefaultModel(modelType: $modelType) {
|
|
746
766
|
id
|
|
@@ -764,7 +784,7 @@ triggerMatch
|
|
|
764
784
|
modelType
|
|
765
785
|
}
|
|
766
786
|
}
|
|
767
|
-
`,variables:{modelType:e}});return
|
|
787
|
+
`,variables:{modelType:e}});return k(r).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await Me(this,Fe,"f").query({query:I`
|
|
768
788
|
query {
|
|
769
789
|
aiTasks {
|
|
770
790
|
name
|
|
@@ -780,7 +800,7 @@ triggerMatch
|
|
|
780
800
|
updatedAt
|
|
781
801
|
}
|
|
782
802
|
}
|
|
783
|
-
`}));return e}async addTask(e,r,n,i,a){let o=new Gr(e,r,n,i,a),{aiAddTask:s}=
|
|
803
|
+
`}));return e}async addTask(e,r,n,i,a){let o=new Gr(e,r,n,i,a),{aiAddTask:s}=k(await Me(this,Fe,"f").mutate({mutation:I`
|
|
784
804
|
mutation AiAddTask($task: AITaskInput!) {
|
|
785
805
|
aiAddTask(task: $task) {
|
|
786
806
|
name
|
|
@@ -796,7 +816,7 @@ triggerMatch
|
|
|
796
816
|
updatedAt
|
|
797
817
|
}
|
|
798
818
|
}
|
|
799
|
-
`,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:r}=
|
|
819
|
+
`,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:r}=k(await Me(this,Fe,"f").mutate({mutation:I`
|
|
800
820
|
mutation AiRemoveTask($taskId: String!) {
|
|
801
821
|
aiRemoveTask(taskId: $taskId) {
|
|
802
822
|
name
|
|
@@ -812,7 +832,7 @@ triggerMatch
|
|
|
812
832
|
updatedAt
|
|
813
833
|
}
|
|
814
834
|
}
|
|
815
|
-
`,variables:{taskId:e}}));return r}async updateTask(e,r){let{aiUpdateTask:n}=
|
|
835
|
+
`,variables:{taskId:e}}));return r}async updateTask(e,r){let{aiUpdateTask:n}=k(await Me(this,Fe,"f").mutate({mutation:I`
|
|
816
836
|
mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
|
|
817
837
|
aiUpdateTask(taskId: $taskId, task: $task) {
|
|
818
838
|
name
|
|
@@ -828,7 +848,7 @@ triggerMatch
|
|
|
828
848
|
updatedAt
|
|
829
849
|
}
|
|
830
850
|
}
|
|
831
|
-
`,variables:{taskId:e,task:{name:r.name,modelId:r.modelId,systemPrompt:r.systemPrompt,promptExamples:r.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:r}=
|
|
851
|
+
`,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 Me(this,Fe,"f").query({query:I`
|
|
832
852
|
query AiModelLoadingStatus($model: String!) {
|
|
833
853
|
aiModelLoadingStatus(model: $model) {
|
|
834
854
|
model
|
|
@@ -838,51 +858,51 @@ triggerMatch
|
|
|
838
858
|
downloaded
|
|
839
859
|
}
|
|
840
860
|
}
|
|
841
|
-
`,variables:{model:e}}));return r}async prompt(e,r){let{aiPrompt:n}=
|
|
861
|
+
`,variables:{model:e}}));return r}async prompt(e,r){let{aiPrompt:n}=k(await Me(this,Fe,"f").mutate({mutation:I`
|
|
842
862
|
mutation AiPrompt($taskId: String!, $prompt: String!) {
|
|
843
863
|
aiPrompt(taskId: $taskId, prompt: $prompt)
|
|
844
864
|
}
|
|
845
|
-
`,variables:{taskId:e,prompt:r}}));return n}async embed(e,r){let{aiEmbed:n}=
|
|
865
|
+
`,variables:{taskId:e,prompt:r}}));return n}async embed(e,r){let{aiEmbed:n}=k(await Me(this,Fe,"f").mutate({mutation:I`
|
|
846
866
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
847
867
|
aiEmbed(modelId: $modelId, text: $text)
|
|
848
868
|
}
|
|
849
|
-
`,variables:{modelId:e,text:r}})),i=
|
|
869
|
+
`,variables:{modelId:e,text:r}})),i=Ls.toByteArray(n);return JSON.parse(R_.inflate(i,{to:"string"}))}async openTranscriptionStream(e,r,n){let{aiOpenTranscriptionStream:i}=k(await Me(this,Fe,"f").mutate({mutation:I`
|
|
850
870
|
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
|
|
851
871
|
aiOpenTranscriptionStream(modelId: $modelId, params: $params)
|
|
852
872
|
}
|
|
853
|
-
`,variables:{modelId:e,params:n}})),a=Me(this,
|
|
873
|
+
`,variables:{modelId:e,params:n}})),a=Me(this,Fe,"f").subscribe({query:I` subscription {
|
|
854
874
|
aiTranscriptionText(streamId: "${i}")
|
|
855
|
-
}`}).subscribe({next(o){return r(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Me(this,
|
|
875
|
+
}`}).subscribe({next(o){return r(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Me(this,is,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:r}=k(await Me(this,Fe,"f").mutate({mutation:I`
|
|
856
876
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
857
877
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
858
878
|
}
|
|
859
|
-
`,variables:{streamId:e}})),n=Me(this,
|
|
879
|
+
`,variables:{streamId:e}})),n=Me(this,is,"f").get(e);return n.closed||n.unsubscribe(),r}async feedTranscriptionStream(e,r){let{aiFeedTranscriptionStream:n}=k(await Me(this,Fe,"f").mutate({mutation:I`
|
|
860
880
|
mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
|
|
861
881
|
aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
|
|
862
882
|
}
|
|
863
|
-
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:r}}));return n}};Le=new WeakMap,Zo=new WeakMap;var Pr=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)},Jt,Xo,ma,es,ya,gn,ts,ga,ws=class{constructor(e,r=!0){Jt.set(this,void 0),Xo.set(this,void 0),ma.set(this,void 0),es.set(this,void 0),ya.set(this,void 0),gn.set(this,void 0),ts.set(this,void 0),ga.set(this,void 0),Pr(this,Jt,e,"f"),Pr(this,Xo,new Ia(Re(this,Jt,"f"),r),"f"),Pr(this,ma,new Tu(Re(this,Jt,"f")),"f"),Pr(this,es,new Eu(Re(this,Jt,"f")),"f"),Pr(this,ya,new xu(Re(this,Jt,"f")),"f"),Pr(this,ga,new Fu(Re(this,Jt,"f"),r),"f"),Pr(this,gn,new ys(Re(this,Jt,"f"),r),"f"),Re(this,gn,"f").setExpressionClient(Re(this,ma,"f")),Re(this,gn,"f").setNeighbourhoodClient(Re(this,ya,"f")),Re(this,gn,"f").setAIClient(Re(this,ga,"f")),Pr(this,ts,new Iu(Re(this,Jt,"f"),r),"f")}get agent(){return Re(this,Xo,"f")}get expression(){return Re(this,ma,"f")}get languages(){return Re(this,es,"f")}get neighbourhood(){return Re(this,ya,"f")}get perspective(){return Re(this,gn,"f")}get runtime(){return Re(this,ts,"f")}get ai(){return Re(this,ga,"f")}};Jt=new WeakMap,Xo=new WeakMap,ma=new WeakMap,es=new WeakMap,ya=new WeakMap,gn=new WeakMap,ts=new WeakMap,ga=new WeakMap;var $u;(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"})($u||($u={}));var Xu=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},el=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},En=class{constructor(e,r){this.language=e,this.expression=r}};Xu([m(),el("design:type",er)],En.prototype,"language",void 0);Xu([m(),el("design:type",String)],En.prototype,"expression",void 0);En=Xu([W(),el("design:paramtypes",[er,String])],En);function ek(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function tk(t){if(t.startsWith("literal://")){let a=new er;a.address="literal",a.name="literal";let o=t.substring(10);return new En(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new er;return s.address=a,new En(s,o)}let i=/^did:([^\s]+)$/.exec(t);if(i&&i.length==2){let a=new er;return a.address="did",new En(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var Et=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},ar=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Es=class{};Et([m(),ar("design:type",String)],Es.prototype,"name",void 0);Et([m(),ar("design:type",String)],Es.prototype,"type",void 0);Es=Et([W()],Es);var Ra=class{};Et([m(),ar("design:type",String)],Ra.prototype,"label",void 0);Et([m(),ar("design:type",String)],Ra.prototype,"name",void 0);Et([m(),ar("design:type",Array)],Ra.prototype,"parameters",void 0);Ra=Et([W()],Ra);var xs=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};Et([m(),ar("design:type",String)],xs.prototype,"name",void 0);Et([m(),ar("design:type",String)],xs.prototype,"parametersStringified",void 0);xs=Et([Be(),ar("design:paramtypes",[String,Object])],xs);var Is=class{};Et([m(),ar("design:type",String)],Is.prototype,"did",void 0);Et([m(),ar("design:type",On)],Is.prototype,"status",void 0);Is=Et([W()],Is);var rd=class{},Un=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},ki=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Kr=class{};Un([m(),ki("design:type",String)],Kr.prototype,"name",void 0);Un([m(),ki("design:type",String)],Kr.prototype,"address",void 0);Un([m(),ki("design:type",String)],Kr.prototype,"settings",void 0);Un([m(),ki("design:type",In)],Kr.prototype,"icon",void 0);Un([m(),ki("design:type",In)],Kr.prototype,"constructorIcon",void 0);Un([m(),ki("design:type",In)],Kr.prototype,"settingsIcon",void 0);Kr=Un([W()],Kr);var ot=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},mt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},jt=class{};ot([m(),mt("design:type",String)],jt.prototype,"name",void 0);ot([m(),mt("design:type",String)],jt.prototype,"address",void 0);ot([m(),mt("design:type",String)],jt.prototype,"description",void 0);ot([m(),mt("design:type",String)],jt.prototype,"author",void 0);ot([m(),mt("design:type",Boolean)],jt.prototype,"templated",void 0);ot([m(),mt("design:type",String)],jt.prototype,"templateSourceLanguageAddress",void 0);ot([m(),mt("design:type",String)],jt.prototype,"templateAppliedParams",void 0);ot([m(),mt("design:type",Array)],jt.prototype,"possibleTemplateParams",void 0);ot([m(),mt("design:type",String)],jt.prototype,"sourceCodeLink",void 0);jt=ot([W()],jt);var bi=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ot([m(),mt("design:type",String)],bi.prototype,"name",void 0);ot([m(),mt("design:type",String)],bi.prototype,"description",void 0);ot([m(),mt("design:type",Array)],bi.prototype,"possibleTemplateParams",void 0);ot([m(),mt("design:type",String)],bi.prototype,"sourceCodeLink",void 0);bi=ot([Be(),mt("design:paramtypes",[String,String])],bi);var nd=class{},id=class extends Jr(){},ad=class{},Rs=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},tl=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ts=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};Rs([m(),tl("design:type",String)],Ts.prototype,"linkLanguage",void 0);Rs([m(),tl("design:type",nr)],Ts.prototype,"meta",void 0);Ts=Rs([W(),tl("design:paramtypes",[String,nr])],Ts);var Mu=class extends Jr(){};Mu=Rs([W()],Mu);var 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},Ai=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ju;(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"})(ju||(ju={}));var Cn=class{constructor(e,r,n){this.uuid=e,this.name=r,n?this.state=n:this.state=ju.Private}};Oi([m(),Ai("design:type",String)],Cn.prototype,"uuid",void 0);Oi([m(),Ai("design:type",String)],Cn.prototype,"name",void 0);Oi([m(),Ai("design:type",String)],Cn.prototype,"state",void 0);Oi([m(),Ai("design:type",String)],Cn.prototype,"sharedUrl",void 0);Oi([m(),Ai("design:type",Mu)],Cn.prototype,"neighbourhood",void 0);Cn=Oi([W(),Ai("design:paramtypes",[String,String,String])],Cn);var Ls=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},vh=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ks=class{};Ls([m(),vh("design:type",Array)],ks.prototype,"additions",void 0);Ls([m(),vh("design:type",Array)],ks.prototype,"removals",void 0);ks=Ls([W()],ks);var od=class extends Jr(){};od=Ls([W()],od);var sd=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},ui=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)},va,vn,jo="smart_literal://content";function C_(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 La=class{constructor(e,r){va.set(this,void 0),vn.set(this,void 0),sd(this,va,e,"f"),sd(this,vn,r,"f")}get base(){return ui(this,vn,"f")}static async create(e,r){let n=ht.from(C_(10)).toUrl(),i=new La(e,n);return await i.set(r),i}static async isSmartLiteralBase(e,r){return(await e.get(new Ze({source:r,predicate:jo}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Ze({predicate:jo}))).map(n=>new La(e,n.data.source))}async get(){let e=await ui(this,va,"f").getSingleTarget(new Ze({source:ui(this,vn,"f"),predicate:jo}));if(!e)throw`No content for smart literal ${ui(this,vn,"f")}`;return ht.fromUrl(e).get()}async set(e){let r=ht.from(e);await ui(this,va,"f").setSingleTarget(new kn({source:ui(this,vn,"f"),predicate:jo,target:r.toUrl()}))}};va=new WeakMap,vn=new WeakMap;var cd=class{};function hk(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function mk(t){return`triple(this, "${t}", _)`}function yk(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,p=new hs(a,d,s);await p.init(),o.push(p)}return o}}}function bh(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${jr(n)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function gk(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 vk(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let n=r;e[`add${jr(n)}`]=()=>{},e[`remove${jr(n)}`]=()=>{},e[`setCollection${jr(n)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function _h(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 R_(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=_h(8);r+=`subject_class("${n}", ${a}).
|
|
883
|
+
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:r}}));return n}};Fe=new WeakMap,is=new WeakMap;var Cr=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)},Jt,as,ga,os,va,vn,ss,ba,Ma=class{constructor(e,r=!0){Jt.set(this,void 0),as.set(this,void 0),ga.set(this,void 0),os.set(this,void 0),va.set(this,void 0),vn.set(this,void 0),ss.set(this,void 0),ba.set(this,void 0),Cr(this,Jt,e,"f"),Cr(this,as,new Aa(Le(this,Jt,"f"),r),"f"),Cr(this,ga,new Nu(Le(this,Jt,"f")),"f"),Cr(this,os,new Ou(Le(this,Jt,"f")),"f"),Cr(this,va,new Au(Le(this,Jt,"f")),"f"),Cr(this,ba,new qu(Le(this,Jt,"f"),r),"f"),Cr(this,vn,new ws(Le(this,Jt,"f"),r),"f"),Le(this,vn,"f").setExpressionClient(Le(this,ga,"f")),Le(this,vn,"f").setNeighbourhoodClient(Le(this,va,"f")),Le(this,vn,"f").setAIClient(Le(this,ba,"f")),Cr(this,ss,new Du(Le(this,Jt,"f"),r),"f")}get agent(){return Le(this,as,"f")}get expression(){return Le(this,ga,"f")}get languages(){return Le(this,os,"f")}get neighbourhood(){return Le(this,va,"f")}get perspective(){return Le(this,vn,"f")}get runtime(){return Le(this,ss,"f")}get ai(){return Le(this,ba,"f")}};Jt=new WeakMap,as=new WeakMap,ga=new WeakMap,os=new WeakMap,va=new WeakMap,vn=new WeakMap,ss=new WeakMap,ba=new WeakMap;var Bu;(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"})(Bu||(Bu={}));var il=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},al=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},xn=class{constructor(e,r){this.language=e,this.expression=r}};il([m(),al("design:type",er)],xn.prototype,"language",void 0);il([m(),al("design:type",String)],xn.prototype,"expression",void 0);xn=il([Q(),al("design:paramtypes",[er,String])],xn);function ak(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function ok(t){if(t.startsWith("literal://")){let a=new er;a.address="literal",a.name="literal";let o=t.substring(10);return new xn(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new er;return s.address=a,new xn(s,o)}let i=/^did:([^\s]+)$/.exec(t);if(i&&i.length==2){let a=new er;return a.address="did",new xn(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var xt=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},ar=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Os=class{};xt([m(),ar("design:type",String)],Os.prototype,"name",void 0);xt([m(),ar("design:type",String)],Os.prototype,"type",void 0);Os=xt([Q()],Os);var ja=class{};xt([m(),ar("design:type",String)],ja.prototype,"label",void 0);xt([m(),ar("design:type",String)],ja.prototype,"name",void 0);xt([m(),ar("design:type",Array)],ja.prototype,"parameters",void 0);ja=xt([Q()],ja);var As=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};xt([m(),ar("design:type",String)],As.prototype,"name",void 0);xt([m(),ar("design:type",String)],As.prototype,"parametersStringified",void 0);As=xt([Be(),ar("design:paramtypes",[String,Object])],As);var Ds=class{};xt([m(),ar("design:type",String)],Ds.prototype,"did",void 0);xt([m(),ar("design:type",An)],Ds.prototype,"status",void 0);Ds=xt([Q()],Ds);var ad=class{},Un=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},Di=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Kr=class{};Un([m(),Di("design:type",String)],Kr.prototype,"name",void 0);Un([m(),Di("design:type",String)],Kr.prototype,"address",void 0);Un([m(),Di("design:type",String)],Kr.prototype,"settings",void 0);Un([m(),Di("design:type",Tn)],Kr.prototype,"icon",void 0);Un([m(),Di("design:type",Tn)],Kr.prototype,"constructorIcon",void 0);Un([m(),Di("design:type",Tn)],Kr.prototype,"settingsIcon",void 0);Kr=Un([Q()],Kr);var ot=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},mt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ut=class{};ot([m(),mt("design:type",String)],Ut.prototype,"name",void 0);ot([m(),mt("design:type",String)],Ut.prototype,"address",void 0);ot([m(),mt("design:type",String)],Ut.prototype,"description",void 0);ot([m(),mt("design:type",String)],Ut.prototype,"author",void 0);ot([m(),mt("design:type",Boolean)],Ut.prototype,"templated",void 0);ot([m(),mt("design:type",String)],Ut.prototype,"templateSourceLanguageAddress",void 0);ot([m(),mt("design:type",String)],Ut.prototype,"templateAppliedParams",void 0);ot([m(),mt("design:type",Array)],Ut.prototype,"possibleTemplateParams",void 0);ot([m(),mt("design:type",String)],Ut.prototype,"sourceCodeLink",void 0);Ut=ot([Q()],Ut);var Si=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ot([m(),mt("design:type",String)],Si.prototype,"name",void 0);ot([m(),mt("design:type",String)],Si.prototype,"description",void 0);ot([m(),mt("design:type",Array)],Si.prototype,"possibleTemplateParams",void 0);ot([m(),mt("design:type",String)],Si.prototype,"sourceCodeLink",void 0);Si=ot([Be(),mt("design:paramtypes",[String,String])],Si);var od=class{},sd=class extends Yr(){},cd=class{},js=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},ol=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ns=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};js([m(),ol("design:type",String)],Ns.prototype,"linkLanguage",void 0);js([m(),ol("design:type",nr)],Ns.prototype,"meta",void 0);Ns=js([Q(),ol("design:paramtypes",[String,nr])],Ns);var Vu=class extends Yr(){};Vu=js([Q()],Vu);var qn=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},Bn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Qu;(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"})(Qu||(Qu={}));var Hr=class{constructor(e,r,n){this.uuid=e,this.name=r,n?this.state=n:this.state=Qu.Private}};qn([m(),Bn("design:type",String)],Hr.prototype,"uuid",void 0);qn([m(),Bn("design:type",String)],Hr.prototype,"name",void 0);qn([m(),Bn("design:type",String)],Hr.prototype,"state",void 0);qn([m(),Bn("design:type",String)],Hr.prototype,"sharedUrl",void 0);qn([m(),Bn("design:type",Vu)],Hr.prototype,"neighbourhood",void 0);qn([m(),Bn("design:type",Array)],Hr.prototype,"owners",void 0);Hr=qn([Q(),Bn("design:paramtypes",[String,String,String])],Hr);var Us=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},Sh=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Cs=class{};Us([m(),Sh("design:type",Array)],Cs.prototype,"additions",void 0);Us([m(),Sh("design:type",Array)],Cs.prototype,"removals",void 0);Cs=Us([Q()],Cs);var ud=class extends Yr(){};ud=Us([Q()],ud);var ld=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},fi=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)},_a,bn,zo="smart_literal://content";function F_(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 Ua=class{constructor(e,r){_a.set(this,void 0),bn.set(this,void 0),ld(this,_a,e,"f"),ld(this,bn,r,"f")}get base(){return fi(this,bn,"f")}static async create(e,r){let n=ht.from(F_(10)).toUrl(),i=new Ua(e,n);return await i.set(r),i}static async isSmartLiteralBase(e,r){return(await e.get(new Xe({source:r,predicate:zo}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Xe({predicate:zo}))).map(n=>new Ua(e,n.data.source))}async get(){let e=await fi(this,_a,"f").getSingleTarget(new Xe({source:fi(this,bn,"f"),predicate:zo}));if(!e)throw`No content for smart literal ${fi(this,bn,"f")}`;return ht.fromUrl(e).get()}async set(e){let r=ht.from(e);await fi(this,_a,"f").setSingleTarget(new On({source:fi(this,bn,"f"),predicate:zo,target:r.toUrl()}))}};_a=new WeakMap,bn=new WeakMap;var fd=class{};function bk(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function _k(t){return`triple(this, "${t}", _)`}function Sk(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,p=new _s(a,d,s);await p.init(),o.push(p)}return o}}}function wh(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${jr(n)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function wk(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 Ek(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let n=r;e[`add${jr(n)}`]=()=>{},e[`remove${jr(n)}`]=()=>{},e[`setCollection${jr(n)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function Eh(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 $_(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=Eh(8);r+=`subject_class("${n}", ${a}).
|
|
864
884
|
`;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 y=`property(${a}, "${h}").
|
|
865
|
-
`,{through:v,initial:b,required:_,resolveLanguage:S,writable:g,flag:D,getter:N,setter:T,local:
|
|
885
|
+
`,{through:v,initial:b,required:_,resolveLanguage:S,writable:g,flag:D,getter:N,setter:T,local:C}=l[h];if(S&&(y+=`property_resolve(${a}, "${h}").
|
|
866
886
|
`,y+=`property_resolve_language(${a}, "${h}", "${S}").
|
|
867
887
|
`),N?y+=`property_getter(${a}, Base, "${h}", Value) :- ${N}.
|
|
868
888
|
`:v&&(y+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${v}", Value).
|
|
869
889
|
`,_&&(D?u.push(`triple(Base, "${v}", "${b}")`):u.push(`triple(Base, "${v}", _)`))),T)y+=`property_setter(${a}, "${h}", Actions) :- ${T}.
|
|
870
|
-
`;else if(g&&v&&typeof i[
|
|
890
|
+
`;else if(g&&v&&typeof i[Hu(h)]=="function"){let R=[{action:"setSingleTarget",source:"this",predicate:v,target:"value",...C&&{local:!0}}];y+=`property_setter(${a}, "${h}", '${fn(R)}').
|
|
871
891
|
`}c.push(y),b&&(s.push({action:"addLink",source:"this",predicate:v,target:b}),o.push({action:"removeLink",source:"this",predicate:v,target:"*"}))}let d=[],p=i.__collections||{};for(let h in p){let y=`collection(${a}, "${h}").
|
|
872
|
-
`,{through:v,where:b,local:_}=p[h];if(v){if(b){if(!b.isInstance&&!b.condition)throw"'where' needs one of 'isInstance' or 'condition'";let N=[];if(b.isInstance){let
|
|
892
|
+
`,{through:v,where:b,local:_}=p[h];if(v){if(b){if(!b.isInstance&&!b.condition)throw"'where' needs one of 'isInstance' or 'condition'";let N=[];if(b.isInstance){let C;b.isInstance.name?C=b.isInstance.name:C=b.isInstance,N.push(`instance(OtherClass, Target), subject_class("${C}", OtherClass)`)}b.condition&&N.push(b.condition);let T=N.join(", ");y+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${v}", Target), ${T}), List).
|
|
873
893
|
`}else y+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${v}", C), List).
|
|
874
|
-
`;let S=[{action:"addLink",source:"this",predicate:v,target:"value",..._&&{local:!0}}],g=[{action:"removeLink",source:"this",predicate:v,target:"value"}],D=[{action:"collectionSetter",source:"this",predicate:v,target:"value",..._&&{local:!0}}];y+=`collection_adder(${a}, "${yr(h)}", '${
|
|
875
|
-
`,y+=`collection_remover(${a}, "${yr(h)}", '${
|
|
876
|
-
`,y+=`collection_setter(${a}, "${yr(h)}", '${
|
|
877
|
-
`}d.push(y)}let f=
|
|
894
|
+
`;let S=[{action:"addLink",source:"this",predicate:v,target:"value",..._&&{local:!0}}],g=[{action:"removeLink",source:"this",predicate:v,target:"value"}],D=[{action:"collectionSetter",source:"this",predicate:v,target:"value",..._&&{local:!0}}];y+=`collection_adder(${a}, "${yr(h)}", '${fn(S)}').
|
|
895
|
+
`,y+=`collection_remover(${a}, "${yr(h)}", '${fn(g)}').
|
|
896
|
+
`,y+=`collection_setter(${a}, "${yr(h)}", '${fn(D)}').
|
|
897
|
+
`}d.push(y)}let f=fn(s);if(r+=`constructor(${a}, '${f}').
|
|
878
898
|
`,u.length>0){let h=u.join(", ");r+=`instance(${a}, Base) :- ${h}.
|
|
879
899
|
`,r+=`
|
|
880
|
-
`}return r+=`destructor(${a}, '${
|
|
900
|
+
`}return r+=`destructor(${a}, '${fn(o)}').
|
|
881
901
|
`,r+=`
|
|
882
902
|
`,r+=c.join(`
|
|
883
903
|
`),r+=`
|
|
884
904
|
`,r+=d.join(`
|
|
885
|
-
`),{sdna:r,name:n}},Object.defineProperty(e,"type",{configurable:!0})}}function
|
|
905
|
+
`),{sdna:r,name:n}},Object.defineProperty(e,"type",{configurable:!0})}}function xk(t){return wh({...t,required:!0,writable:!0,initial:t.initial||"literal://string:uninitialized"})}function Ik(t){return wh({...t,writable:!1})}var Tk=`
|
|
886
906
|
type AIModelLoadingStatus {
|
|
887
907
|
downloaded: Boolean!
|
|
888
908
|
loaded: Boolean!
|
|
@@ -1251,6 +1271,7 @@ type Mutation {
|
|
|
1251
1271
|
runtimeRemoveNotification(id: String!): Boolean!
|
|
1252
1272
|
runtimeRequestInstallNotification(notification: NotificationInput!): String!
|
|
1253
1273
|
runtimeRestartHolochain: Boolean!
|
|
1274
|
+
runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
|
|
1254
1275
|
runtimeSetStatus(status: PerspectiveInput!): Boolean!
|
|
1255
1276
|
runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
|
|
1256
1277
|
}
|
|
@@ -1310,6 +1331,7 @@ type PerspectiveExpression {
|
|
|
1310
1331
|
type PerspectiveHandle {
|
|
1311
1332
|
name: String!
|
|
1312
1333
|
neighbourhood: NeighbourhoodExpression
|
|
1334
|
+
owners: [String!]
|
|
1313
1335
|
sharedUrl: String
|
|
1314
1336
|
state: String!
|
|
1315
1337
|
uuid: String!
|
|
@@ -1358,8 +1380,10 @@ type Query {
|
|
|
1358
1380
|
runtimeHcAgentInfos: String!
|
|
1359
1381
|
runtimeInfo: RuntimeInfo!
|
|
1360
1382
|
runtimeKnownLinkLanguageTemplates: [String!]!
|
|
1383
|
+
runtimeListUsers: [UserStatistics!]!
|
|
1361
1384
|
runtimeMessageInbox(filter: String): [PerspectiveExpression!]!
|
|
1362
1385
|
runtimeMessageOutbox(filter: String): [SentMessage!]!
|
|
1386
|
+
runtimeMultiUserEnabled: Boolean!
|
|
1363
1387
|
runtimeNotifications: [Notification!]!
|
|
1364
1388
|
runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
|
|
1365
1389
|
}
|
|
@@ -1427,6 +1451,13 @@ type TriggeredNotification {
|
|
|
1427
1451
|
triggerMatch: String!
|
|
1428
1452
|
}
|
|
1429
1453
|
|
|
1454
|
+
type UserStatistics {
|
|
1455
|
+
did: String!
|
|
1456
|
+
email: String!
|
|
1457
|
+
lastSeen: String
|
|
1458
|
+
perspectiveCount: Int!
|
|
1459
|
+
}
|
|
1460
|
+
|
|
1430
1461
|
input VoiceActivityParamsInput {
|
|
1431
1462
|
endThreshold: Float
|
|
1432
1463
|
endWindow: Float
|
|
@@ -1434,7 +1465,7 @@ input VoiceActivityParamsInput {
|
|
|
1434
1465
|
startWindow: Float
|
|
1435
1466
|
timeBeforeSpeech: Float
|
|
1436
1467
|
}
|
|
1437
|
-
`;function ud(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 wk(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`${ud(e)} your ${r} actions, with access to ${ud(n)}`}var L=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},E=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},he=function(t,e){return function(r,n){e(r,n,t)}},qa=new Vr;qa.author="did:ad4m:test";qa.timestamp=Date.now();qa.data={source:"root",target:"neighbourhood://Qm12345"};qa.proof={signature:"",key:"",valid:!0};var $r=new On;$r.author="did:ad4m:test";$r.timestamp=Date.now().toString();$r.proof=new gr("","");$r.data=new nr([qa]);var Os=class{};L([m(),E("design:type",String)],Os.prototype,"recipient",void 0);L([m(),E("design:type",On)],Os.prototype,"message",void 0);Os=L([W()],Os);var _i=class{};L([m(),E("design:type",String)],_i.prototype,"ad4mExecutorVersion",void 0);L([m(),E("design:type",Boolean)],_i.prototype,"isInitialized",void 0);L([m(),E("design:type",Boolean)],_i.prototype,"isUnlocked",void 0);_i=L([W()],_i);var Rn=class{};L([m(),E("design:type",String)],Rn.prototype,"title",void 0);L([m(),E("design:type",String)],Rn.prototype,"message",void 0);L([m(),E("design:type",String)],Rn.prototype,"type",void 0);L([m(),E("design:type",String)],Rn.prototype,"addon",void 0);Rn=L([W()],Rn);var Pt=class{};L([m(),E("design:type",String)],Pt.prototype,"description",void 0);L([m(),E("design:type",String)],Pt.prototype,"appName",void 0);L([m(),E("design:type",String)],Pt.prototype,"appUrl",void 0);L([m(),E("design:type",String)],Pt.prototype,"appIconPath",void 0);L([m(),E("design:type",String)],Pt.prototype,"trigger",void 0);L([m(),E("design:type",Array)],Pt.prototype,"perspectiveIds",void 0);L([m(),E("design:type",String)],Pt.prototype,"webhookUrl",void 0);L([m(),E("design:type",String)],Pt.prototype,"webhookAuth",void 0);Pt=L([Be()],Pt);var St=class{};L([m(),E("design:type",String)],St.prototype,"id",void 0);L([m(),E("design:type",Boolean)],St.prototype,"granted",void 0);L([m(),E("design:type",String)],St.prototype,"description",void 0);L([m(),E("design:type",String)],St.prototype,"appName",void 0);L([m(),E("design:type",String)],St.prototype,"appUrl",void 0);L([m(),E("design:type",String)],St.prototype,"appIconPath",void 0);L([m(),E("design:type",String)],St.prototype,"trigger",void 0);L([m(),E("design:type",Array)],St.prototype,"perspectiveIds",void 0);L([m(),E("design:type",String)],St.prototype,"webhookUrl",void 0);L([m(),E("design:type",String)],St.prototype,"webhookAuth",void 0);St=L([W()],St);var Si=class{};L([m(),E("design:type",St)],Si.prototype,"notification",void 0);L([m(),E("design:type",String)],Si.prototype,"perspectiveId",void 0);L([m(),E("design:type",String)],Si.prototype,"triggerMatch",void 0);Si=L([W()],Si);var qe=class{};L([m(),E("design:type",Number)],qe.prototype,"total",void 0);L([m(),E("design:type",Number)],qe.prototype,"imported",void 0);L([m(),E("design:type",Number)],qe.prototype,"failed",void 0);L([m(),E("design:type",Number)],qe.prototype,"omitted",void 0);L([m(),E("design:type",Array)],qe.prototype,"errors",void 0);qe=L([W()],qe);var wt=class{};L([m(),E("design:type",qe)],wt.prototype,"perspectives",void 0);L([m(),E("design:type",qe)],wt.prototype,"links",void 0);L([m(),E("design:type",qe)],wt.prototype,"expressions",void 0);L([m(),E("design:type",qe)],wt.prototype,"perspectiveDiffs",void 0);L([m(),E("design:type",qe)],wt.prototype,"notifications",void 0);L([m(),E("design:type",qe)],wt.prototype,"models",void 0);L([m(),E("design:type",qe)],wt.prototype,"defaultModels",void 0);L([m(),E("design:type",qe)],wt.prototype,"tasks",void 0);L([m(),E("design:type",qe)],wt.prototype,"friends",void 0);L([m(),E("design:type",qe)],wt.prototype,"trustedAgents",void 0);L([m(),E("design:type",qe)],wt.prototype,"knownLinkLanguages",void 0);wt=L([W()],wt);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 $r}runtimeFriendSendMessage(e,r){return!0}runtimeMessageInbox(e){return[$r]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:$r}]}runtimeMessageReceived(){return $r}exceptionOccurred(){return{title:"Test title",message:"Test message",type:$u.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}};L([$e(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Boolean)],ee.prototype,"runtimeQuit",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",Boolean)],ee.prototype,"runtimeOpenLink",null);L([Ut(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",_i)],ee.prototype,"runtimeInfo",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[Array]),E("design:returntype",Array)],ee.prototype,"addTrustedAgents",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[Array]),E("design:returntype",Array)],ee.prototype,"deleteTrustedAgents",null);L([Ut(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Array)],ee.prototype,"getTrustedAgents",null);L([Ut(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Array)],ee.prototype,"runtimeKnownLinkLanguageTemplates",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[Array]),E("design:returntype",Array)],ee.prototype,"runtimeAddKnownLinkLanguageTemplates",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[Array]),E("design:returntype",Array)],ee.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);L([Ut(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Array)],ee.prototype,"runtimeFriends",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[Array]),E("design:returntype",Array)],ee.prototype,"runtimeAddFriends",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[Array]),E("design:returntype",Array)],ee.prototype,"runtimeRemoveFriends",null);L([Ut(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",String)],ee.prototype,"runtimeHcAgentInfos",null);L([Ut(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",String)],ee.prototype,"runtimeGetNetworkMetrics",null);L([$e(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Boolean)],ee.prototype,"runtimeRestartHolochain",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[Object]),E("design:returntype",Boolean)],ee.prototype,"runtimeHcAddAgentInfos",null);L([Ut(),he(0,de()),he(1,de()),he(2,de()),he(3,de()),E("design:type",Function),E("design:paramtypes",[String,String,String,String]),E("design:returntype",void 0)],ee.prototype,"runtimeVerifyStringSignedByDid",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[nr]),E("design:returntype",Boolean)],ee.prototype,"runtimeSetStatus",null);L([Ut(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",On)],ee.prototype,"runtimeFriendStatus",null);L([$e(),he(0,de()),he(1,de()),E("design:type",Function),E("design:paramtypes",[String,ls]),E("design:returntype",Boolean)],ee.prototype,"runtimeFriendSendMessage",null);L([Ut(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",Array)],ee.prototype,"runtimeMessageInbox",null);L([Ut(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",Array)],ee.prototype,"runtimeMessageOutbox",null);L([qu(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",On)],ee.prototype,"runtimeMessageReceived",null);L([qu(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Rn)],ee.prototype,"exceptionOccurred",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[Pt]),E("design:returntype",String)],ee.prototype,"runtimeRequestInstallNotification",null);L([Ut(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Array)],ee.prototype,"runtimeNotifications",null);L([$e(),he(0,de()),he(1,de()),E("design:type",Function),E("design:paramtypes",[String,Pt]),E("design:returntype",Boolean)],ee.prototype,"runtimeUpdateNotification",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",Boolean)],ee.prototype,"runtimeRemoveNotification",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",Boolean)],ee.prototype,"runtimeGrantNotification",null);L([qu(),E("design:type",Function),E("design:paramtypes",[]),E("design:returntype",Si)],ee.prototype,"runtimeNotificationTriggered",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",Boolean)],ee.prototype,"runtimeExportDb",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",Boolean)],ee.prototype,"runtimeImportDb",null);L([$e(),he(0,de()),he(1,de()),E("design:type",Function),E("design:paramtypes",[String,String]),E("design:returntype",Boolean)],ee.prototype,"runtimeExportPerspective",null);L([$e(),he(0,de()),E("design:type",Function),E("design:paramtypes",[String]),E("design:returntype",Boolean)],ee.prototype,"runtimeImportPerspective",null);ee=L([dg()],ee);var Xi=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)},pt,Yt,rs,xe;function ns(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ld(t){return t?`triple("${t}", "ad4m://has_child", Base)`:""}function du(){return`
|
|
1468
|
+
`;function pd(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 kk(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`${pd(e)} your ${r} actions, with access to ${pd(n)}`}var P=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},w=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},he=function(t,e){return function(r,n){e(r,n,t)}},Wa=new Vr;Wa.author="did:ad4m:test";Wa.timestamp=Date.now();Wa.data={source:"root",target:"neighbourhood://Qm12345"};Wa.proof={signature:"",key:"",valid:!0};var $r=new An;$r.author="did:ad4m:test";$r.timestamp=Date.now().toString();$r.proof=new gr("","");$r.data=new nr([Wa]);var Ps=class{};P([m(),w("design:type",String)],Ps.prototype,"recipient",void 0);P([m(),w("design:type",An)],Ps.prototype,"message",void 0);Ps=P([Q()],Ps);var wi=class{};P([m(),w("design:type",String)],wi.prototype,"ad4mExecutorVersion",void 0);P([m(),w("design:type",Boolean)],wi.prototype,"isInitialized",void 0);P([m(),w("design:type",Boolean)],wi.prototype,"isUnlocked",void 0);wi=P([Q()],wi);var Rn=class{};P([m(),w("design:type",String)],Rn.prototype,"title",void 0);P([m(),w("design:type",String)],Rn.prototype,"message",void 0);P([m(),w("design:type",String)],Rn.prototype,"type",void 0);P([m(),w("design:type",String)],Rn.prototype,"addon",void 0);Rn=P([Q()],Rn);var Pt=class{};P([m(),w("design:type",String)],Pt.prototype,"description",void 0);P([m(),w("design:type",String)],Pt.prototype,"appName",void 0);P([m(),w("design:type",String)],Pt.prototype,"appUrl",void 0);P([m(),w("design:type",String)],Pt.prototype,"appIconPath",void 0);P([m(),w("design:type",String)],Pt.prototype,"trigger",void 0);P([m(),w("design:type",Array)],Pt.prototype,"perspectiveIds",void 0);P([m(),w("design:type",String)],Pt.prototype,"webhookUrl",void 0);P([m(),w("design:type",String)],Pt.prototype,"webhookAuth",void 0);Pt=P([Be()],Pt);var St=class{};P([m(),w("design:type",String)],St.prototype,"id",void 0);P([m(),w("design:type",Boolean)],St.prototype,"granted",void 0);P([m(),w("design:type",String)],St.prototype,"description",void 0);P([m(),w("design:type",String)],St.prototype,"appName",void 0);P([m(),w("design:type",String)],St.prototype,"appUrl",void 0);P([m(),w("design:type",String)],St.prototype,"appIconPath",void 0);P([m(),w("design:type",String)],St.prototype,"trigger",void 0);P([m(),w("design:type",Array)],St.prototype,"perspectiveIds",void 0);P([m(),w("design:type",String)],St.prototype,"webhookUrl",void 0);P([m(),w("design:type",String)],St.prototype,"webhookAuth",void 0);St=P([Q()],St);var Ei=class{};P([m(),w("design:type",St)],Ei.prototype,"notification",void 0);P([m(),w("design:type",String)],Ei.prototype,"perspectiveId",void 0);P([m(),w("design:type",String)],Ei.prototype,"triggerMatch",void 0);Ei=P([Q()],Ei);var qe=class{};P([m(),w("design:type",Number)],qe.prototype,"total",void 0);P([m(),w("design:type",Number)],qe.prototype,"imported",void 0);P([m(),w("design:type",Number)],qe.prototype,"failed",void 0);P([m(),w("design:type",Number)],qe.prototype,"omitted",void 0);P([m(),w("design:type",Array)],qe.prototype,"errors",void 0);qe=P([Q()],qe);var wt=class{};P([m(),w("design:type",qe)],wt.prototype,"perspectives",void 0);P([m(),w("design:type",qe)],wt.prototype,"links",void 0);P([m(),w("design:type",qe)],wt.prototype,"expressions",void 0);P([m(),w("design:type",qe)],wt.prototype,"perspectiveDiffs",void 0);P([m(),w("design:type",qe)],wt.prototype,"notifications",void 0);P([m(),w("design:type",qe)],wt.prototype,"models",void 0);P([m(),w("design:type",qe)],wt.prototype,"defaultModels",void 0);P([m(),w("design:type",qe)],wt.prototype,"tasks",void 0);P([m(),w("design:type",qe)],wt.prototype,"friends",void 0);P([m(),w("design:type",qe)],wt.prototype,"trustedAgents",void 0);P([m(),w("design:type",qe)],wt.prototype,"knownLinkLanguages",void 0);wt=P([Q()],wt);var xi=class{};P([m(),w("design:type",String)],xi.prototype,"email",void 0);P([m(),w("design:type",String)],xi.prototype,"did",void 0);P([m(),w("design:type",String)],xi.prototype,"lastSeen",void 0);P([m(),w("design:type",Number)],xi.prototype,"perspectiveCount",void 0);xi=P([Q()],xi);var J=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 $r}runtimeFriendSendMessage(e,r){return!0}runtimeMessageInbox(e){return[$r]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:$r}]}runtimeMessageReceived(){return $r}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Bu.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}]}};P([Ne(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],J.prototype,"runtimeQuit",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],J.prototype,"runtimeOpenLink",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",wi)],J.prototype,"runtimeInfo",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],J.prototype,"addTrustedAgents",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],J.prototype,"deleteTrustedAgents",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],J.prototype,"getTrustedAgents",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],J.prototype,"runtimeKnownLinkLanguageTemplates",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],J.prototype,"runtimeAddKnownLinkLanguageTemplates",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],J.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],J.prototype,"runtimeFriends",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],J.prototype,"runtimeAddFriends",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],J.prototype,"runtimeRemoveFriends",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",String)],J.prototype,"runtimeHcAgentInfos",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",String)],J.prototype,"runtimeGetNetworkMetrics",null);P([Ne(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],J.prototype,"runtimeRestartHolochain",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Object]),w("design:returntype",Boolean)],J.prototype,"runtimeHcAddAgentInfos",null);P([Et(),he(0,de()),he(1,de()),he(2,de()),he(3,de()),w("design:type",Function),w("design:paramtypes",[String,String,String,String]),w("design:returntype",void 0)],J.prototype,"runtimeVerifyStringSignedByDid",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[nr]),w("design:returntype",Boolean)],J.prototype,"runtimeSetStatus",null);P([Et(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",An)],J.prototype,"runtimeFriendStatus",null);P([Ne(),he(0,de()),he(1,de()),w("design:type",Function),w("design:paramtypes",[String,ys]),w("design:returntype",Boolean)],J.prototype,"runtimeFriendSendMessage",null);P([Et(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Array)],J.prototype,"runtimeMessageInbox",null);P([Et(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Array)],J.prototype,"runtimeMessageOutbox",null);P([Wu(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",An)],J.prototype,"runtimeMessageReceived",null);P([Wu(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Rn)],J.prototype,"exceptionOccurred",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Pt]),w("design:returntype",String)],J.prototype,"runtimeRequestInstallNotification",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],J.prototype,"runtimeNotifications",null);P([Ne(),he(0,de()),he(1,de()),w("design:type",Function),w("design:paramtypes",[String,Pt]),w("design:returntype",Boolean)],J.prototype,"runtimeUpdateNotification",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],J.prototype,"runtimeRemoveNotification",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],J.prototype,"runtimeGrantNotification",null);P([Wu(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Ei)],J.prototype,"runtimeNotificationTriggered",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],J.prototype,"runtimeExportDb",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],J.prototype,"runtimeImportDb",null);P([Ne(),he(0,de()),he(1,de()),w("design:type",Function),w("design:paramtypes",[String,String]),w("design:returntype",Boolean)],J.prototype,"runtimeExportPerspective",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],J.prototype,"runtimeImportPerspective",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],J.prototype,"runtimeMultiUserEnabled",null);P([Ne(),he(0,de()),w("design:type",Function),w("design:paramtypes",[Boolean]),w("design:returntype",Boolean)],J.prototype,"runtimeSetMultiUserEnabled",null);P([Et(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],J.prototype,"runtimeListUsers",null);J=P([yg()],J);var ta=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},Y=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,Yt,cs,xe;function us(t){return t.charAt(0).toUpperCase()+t.slice(1)}function dd(t){return t?`triple("${t}", "ad4m://has_child", Base)`:""}function vu(){return`
|
|
1438
1469
|
findall(
|
|
1439
1470
|
[T, A],
|
|
1440
1471
|
link(Base, _, _, T, A),
|
|
@@ -1442,13 +1473,13 @@ input VoiceActivityParamsInput {
|
|
|
1442
1473
|
),
|
|
1443
1474
|
sort(AllLinks, SortedLinks),
|
|
1444
1475
|
SortedLinks = [[Timestamp, Author]|_]
|
|
1445
|
-
`}function
|
|
1476
|
+
`}function hd(t){return`
|
|
1446
1477
|
findall([PropertyName, PropertyValue, Resolve], (
|
|
1447
1478
|
% Constrain to specified properties if provided
|
|
1448
1479
|
${t?`member(PropertyName, [${t.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1449
1480
|
resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
|
|
1450
1481
|
), Properties)
|
|
1451
|
-
`}function
|
|
1482
|
+
`}function md(t){return`
|
|
1452
1483
|
findall([CollectionName, CollectionValues], (
|
|
1453
1484
|
% Constrain to specified collections if provided
|
|
1454
1485
|
${t?`member(CollectionName, [${t.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
@@ -1456,11 +1487,11 @@ input VoiceActivityParamsInput {
|
|
|
1456
1487
|
collection(SubjectClass, CollectionName),
|
|
1457
1488
|
collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
|
|
1458
1489
|
), Collections)
|
|
1459
|
-
`}function
|
|
1460
|
-
Base = "${
|
|
1461
|
-
subject_class("${
|
|
1490
|
+
`}function yd(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=us(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:p}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(y=>e(y)).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 f=[{value:c,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:p,symbol:">="}];for(let{value:h,symbol:y}of f)if(h!==void 0)return i?`${o} ${y} ${h}`:`${a}, Value${r} ${y} ${h}`}return i?`${o} = ${e(n)}`:`${a}, Value${r} = ${e(n)}`}).join(", ")}function gd(t){return t?"length(UnsortedInstances, TotalCount)":""}function vd(t){if(!t)return"SortedInstances = UnsortedInstances";let[e,r]=Object.entries(t)[0];return`sort_instances(UnsortedInstances, "${e}", "${r}", SortedInstances)`}function bd(t){return!t||t<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${t}, InstancesWithOffset)`}function _d(t){return!t||t<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${t}, AllInstances)`}function Sd(t){if(!t)return"";if(t.includes("://")){let[e,r]=t.split("://"),n=(r||"").replace(/\/+$/,"");return`${e}://${n}`}else return t.replace(/\/+$/,"")}function sl(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 xh(t,e){return sl(t.type)===e}function wd(t){return xh(t,"array")}function Ed(t){return xh(t,"object")}function M_(t){let e=sl(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,p]of Object.entries(c.properties)){let f=wd(p),h=this.determinePredicate(c,d,p,this.determineNamespace(c,l),l);if(f)i[d]={name:d,predicate:h,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let y=c.required?.includes(d)||!1;r[d]={name:d,predicate:h,required:y,writable:p["x-ad4m"]?.writable!==!1,...p["x-ad4m"]?.resolveLanguage&&{resolveLanguage:p["x-ad4m"].resolveLanguage},...p["x-ad4m"]?.initial&&{initial:p["x-ad4m"].initial},...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}}}}}return{className:e,properties:r,collections:i}}constructor(t,e,r){pt.set(this,void 0),Yt.set(this,void 0),cs.set(this,void 0),xe.set(this,void 0),ta(this,pt,e||ht.from(Eh(24)).toUrl(),"f"),ta(this,xe,t,"f"),ta(this,cs,r||"ad4m://self","f")}get baseExpression(){return Y(this,pt,"f")}get perspective(){return Y(this,xe,"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,p=>p.codePointAt(0)),l=c.every(p=>p<=255),d=c.some(p=>p>=128);if(l&&d)try{let p=Uint8Array.from(c),f=new TextDecoder("utf-8",{fatal:!0}).decode(p);f!==a&&(s=f)}catch(p){console.warn(`UTF-8 byte reconstruction failed for property "${i}"`,{value:a,error:p})}}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=[vu(),hd(),md()],e=`
|
|
1491
|
+
Base = "${Y(this,pt,"f")}",
|
|
1492
|
+
subject_class("${Y(this,Yt,"f")}", SubjectClass),
|
|
1462
1493
|
${t.join(", ")}
|
|
1463
|
-
`,r=await
|
|
1494
|
+
`,r=await Y(this,xe,"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(Y(this,xe,"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),p=[vu(),dd(n),hd(i),md(a),yd(o)],f=[gd(l),vd(s),bd(u),_d(c)];return`
|
|
1464
1495
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1465
1496
|
subject_class("${d}", SubjectClass),
|
|
1466
1497
|
instance(SubjectClass, Base),
|
|
@@ -1476,17 +1507,17 @@ FROM node
|
|
|
1476
1507
|
WHERE ${l.join(" AND ")}
|
|
1477
1508
|
`.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(p=>this.formatSurrealValue(p)).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(p=>this.formatSurrealValue(p)).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(`,
|
|
1478
1509
|
`)}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(`,
|
|
1479
|
-
`)}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(p=>{n.includes(p)||delete l[p]});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 p;try{if(p=d.source_uri,!p)continue;let f=d.links||[],h=new this(t,p),y=null,v=null;for(let b=0;b<f.length;b++){let _=f[b],S=_.predicate,g=_.target;if(g==="None")continue;_.timestamp&&(!y||_.timestamp>y)&&(y=_.timestamp,v=_.author);let D=!1;for(let[N,T]of Object.entries(n.properties))if(T.predicate===S){let
|
|
1510
|
+
`)}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(p=>{n.includes(p)||delete l[p]});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 p;try{if(p=d.source_uri,!p)continue;let f=d.links||[],h=new this(t,p),y=null,v=null;for(let b=0;b<f.length;b++){let _=f[b],S=_.predicate,g=_.target;if(g==="None")continue;_.timestamp&&(!y||_.timestamp>y)&&(y=_.timestamp,v=_.author);let D=!1;for(let[N,T]of Object.entries(n.properties))if(T.predicate===S){let C=h[N],F=typeof C=="object"&&C!==null&&!Array.isArray(C)&&Object.keys(C).length===0;if(!C||C===""||C===0||F){let R=g;if(g!=null){if(T.resolveLanguage!=null&&T.resolveLanguage!=="literal"&&typeof g=="string")try{let M=await t.getExpression(g);if(M)try{R=JSON.parse(M.data)}catch{R=M.data}}catch(M){console.warn(`Failed to resolve expression for ${N}:`,M),R=g}else if(typeof g=="string"&&g.startsWith("literal://"))try{let M=ht.fromUrl(g).get();M.data!==void 0?R=M.data:R=M}catch{R=g}else if(typeof g=="string"){let M=typeof h[N];M==="number"?R=Number(g):M==="boolean"&&(R=g==="true"||g==="1")}}T.transform&&typeof T.transform=="function"&&(R=T.transform(R)),h[N]=R}D=!0;break}if(!D){for(let[N,T]of Object.entries(n.collections))if(T.predicate===S){h[N]||(h[N]=[]);let C=`__${N}_timestamps`,F=`__${N}_indices`;h[C]||(h[C]=[]),h[F]||(h[F]=[]),h[N].includes(g)||(h[N].push(g),h[C].push(_.timestamp||""),h[F].push(b));break}}}if(v&&y)if(h.author=v,typeof y=="string"&&y.includes("T"))h.timestamp=new Date(y).getTime();else if(typeof y=="string"){let b=parseInt(y,10);h.timestamp=isNaN(b)?y:b}else h.timestamp=y;for(let[b,_]of Object.entries(n.collections)){let S=`__${b}_timestamps`,g=`__${b}_indices`;if(h[b]&&h[S]){let D=h[b].map((N,T)=>({value:N,timestamp:h[S][T]||"",originalIndex:h[g]?.[T]??T}));D.sort((N,T)=>{let C=String(N.timestamp||""),F=String(T.timestamp||""),R=C.localeCompare(F);return R!==0?R:N.originalIndex-T.originalIndex}),h[b]=D.map(N=>N.value),delete h[S],delete h[g]}}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(f){console.error(`Failed to process SurrealDB instance ${p}:`,f)}}let s=o;e.where&&(s=o.filter(d=>{for(let[p,f]of Object.entries(e.where))if(p!=="base"){if(p==="author"||p==="timestamp"){if(!this.matchesCondition(d[p],f))return!1;continue}if(typeof f=="object"&&f!==null&&!Array.isArray(f)){let h=f;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[p],f))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],p=Object.values(u)[0];s.sort((f,h)=>{let y=f[d],v=h[d];if(y===void 0&&v===void 0)return 0;if(y===void 0)return p==="ASC"?1:-1;if(v===void 0)return p==="ASC"?-1:1;let b=0;return typeof y=="number"&&typeof v=="number"?b=y-v:typeof y=="string"&&typeof v=="string"?b=y.localeCompare(v):b=String(y).localeCompare(String(v)),p==="DESC"?-b:b})}let c=s.length,l=s;if(e.offset!==void 0||e.limit!==void 0){let d=e.offset||0,p=e.limit?d+e.limit:void 0;l=s.slice(d,p)}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=[vu(),dd(n),yd(i)],s=[gd(!0),vd(),bd(),_d()];return`
|
|
1480
1511
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1481
1512
|
subject_class("${a}", SubjectClass),
|
|
1482
1513
|
instance(SubjectClass, Base),
|
|
1483
1514
|
${o.filter(c=>c).join(", ")}
|
|
1484
1515
|
), UnsortedInstances),
|
|
1485
1516
|
${s.filter(c=>c).join(", ")}
|
|
1486
|
-
`}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
|
|
1517
|
+
`}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 Y(this,xe,"f").infer(`subject_class("${Y(this,Yt,"f")}", C), property_setter(C, "${key}", Setter)`);if(setters&&setters.length>0){let actions=eval(setters[0].Setter),resolveLanguageResults=await Y(this,xe,"f").infer(`subject_class("${Y(this,Yt,"f")}", C), property_resolve_language(C, "${key}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),resolveLanguage&&(value=await Y(this,xe,"f").createExpression(value,resolveLanguage)),await Y(this,xe,"f").executeAction(actions,Y(this,pt,"f"),[{name:"value",value}],batchId)}}async setCollectionSetter(key,value,batchId){let collectionSetters=await Y(this,xe,"f").infer(`subject_class("${Y(this,Yt,"f")}", C), collection_setter(C, "${yr(key)}", Setter)`);if(collectionSetters||(collectionSetters=[]),collectionSetters.length>0){let actions=eval(collectionSetters[0].Setter);value&&(Array.isArray(value)?await Y(this,xe,"f").executeAction(actions,Y(this,pt,"f"),value.map(t=>({name:"value",value:t})),batchId):await Y(this,xe,"f").executeAction(actions,Y(this,pt,"f"),[{name:"value",value}],batchId))}}async setCollectionAdder(key,value,batchId){let adders=await Y(this,xe,"f").infer(`subject_class("${Y(this,Yt,"f")}", C), collection_adder(C, "${yr(key)}", Adder)`);if(adders||(adders=[]),adders.length>0){let actions=eval(adders[0].Adder);value&&(Array.isArray(value)?await Promise.all(value.map(t=>Y(this,xe,"f").executeAction(actions,Y(this,pt,"f"),[{name:"value",value:t}],batchId))):await Y(this,xe,"f").executeAction(actions,Y(this,pt,"f"),[{name:"value",value}],batchId))}}async setCollectionRemover(key,value,batchId){let removers=await Y(this,xe,"f").infer(`subject_class("${Y(this,Yt,"f")}", C), collection_remover(C, "${yr(key)}", Remover)`);if(removers||(removers=[]),removers.length>0){let actions=eval(removers[0].Remover);value&&(Array.isArray(value)?await Promise.all(value.map(t=>Y(this,xe,"f").executeAction(actions,Y(this,pt,"f"),[{name:"value",value:t}],batchId))):await Y(this,xe,"f").executeAction(actions,Y(this,pt,"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,Y(this,pt,"f"),r,t),await Y(this,xe,"f").add(new On({source:Y(this,cs,"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){ta(this,Yt,await Y(this,xe,"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 ta(this,Yt,await Y(this,xe,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(t){await Y(this,xe,"f").removeSubject(this,Y(this,pt,"f"),t)}static query(t,e){return new zu(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,p=sl(c.type);if(wd(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${us(u)}`,y=`remove${us(u)}`,v=`setCollection${us(u)}`;n.prototype[h]=function(){},n.prototype[y]=function(){},n.prototype[v]=function(){}}else{let h=this.getPropertyOption(u,c,e,"resolveLanguage");!h&&e.resolveLanguage&&(h=e.resolveLanguage);let y=this.getPropertyOption(u,c,e,"local"),v=this.getPropertyOption(u,c,e,"writable",!0),b=this.getPropertyOption(u,c,e,"initial");if(Ed(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&&M_(c)&&(h="literal"),d&&!b&&(Ed(c)?b="literal://json:{}":b="ad4m://undefined"),i[u]={through:l,required:d,writable:v,...h&&{resolveLanguage:h},...y!==void 0&&{local:y},...b&&{initial:b}},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(p)}),v){let _=Hu(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("://"),p=(d||"").replace(/\/+$/,"");p?c=`${l}://${p}/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,$_({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:
|
|
1487
1518
|
- options.namespace
|
|
1488
1519
|
- schema["x-ad4m"].namespace
|
|
1489
1520
|
- schema.title
|
|
1490
|
-
- 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=vd(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=vd(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""}}};pt=new WeakMap,Yt=new WeakMap,rs=new WeakMap,xe=new WeakMap;_Ad4mModel.classNamesByClass=new WeakMap;var Uu=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 wh="0.11.1";var Fs=12e3;function $_(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function $s(t,e=1e4){return Xe(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 nl(t){return Xe(this,null,function*(){try{let e=yield fetch(`http://localhost:${t}/graphql/`,{signal:$_().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 M_(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function Eh(t,e){M_()&&localStorage.setItem(`${wh}/${t}`,e)}var j_=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 il(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 j_(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 al=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=Fs;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};il(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 Xe(this,null,function*(){try{if(e){yield $s(e),this.setUrl(e);let r=this.buildClient();return yield this.checkAuth(),r}else{this.notifyConnectionChange("checking_local");try{yield $s(`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 Xe(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,Eh("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 Xe(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 Xe(this,null,function*(){try{if(e){let r=yield nl(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 Xe(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 $s(this.url),this.buildClient()}catch(i){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return Xe(this,null,function*(){let e=[...Array(10).keys()].map((i,a)=>nl(Fs+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=tp({url:this.url,connectionParams:()=>Xe(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=>Xe(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 Wc({link:new rp(this.wsClient),cache:new So({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new ws(this.apolloClient),this.ad4mClient}checkAuth(){return Xe(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 Xe(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 Xe(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(Fs),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};export{al as default};
|
|
1521
|
+
- 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=Sd(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=Sd(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""}}};pt=new WeakMap,Yt=new WeakMap,cs=new WeakMap,xe=new WeakMap;_Ad4mModel.classNamesByClass=new WeakMap;var zu=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 Ih="0.11.2-dev-multi-user-2";var qs=12e3;function U_(){let t=new AbortController;return setTimeout(()=>t.abort(),20),t}function Ga(t,e=1e4){return We(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 cl(t){return We(this,null,function*(){try{let e=yield fetch(`http://localhost:${t}/graphql/`,{signal:U_().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 q_(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function Th(t,e){q_()&&localStorage.setItem(`${Ih}/${t}`,e)}var B_=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 ul(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 B_(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 ll=class{constructor(e){this.activeSocket=null;this.requestedRestart=!1;this.authState="unauthenticated";this.connectionState="not_connected";this.port=qs;this.capabilities=[];this.isHosting=!1;this.listeners={authstatechange:[],configstatechange:[],connectionstatechange:[]};ul(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=Yc({url:e,connectionParams:()=>We(this,null,function*(){return{headers:{authorization:""}}})}),n=new No({link:new Zc(r),cache:new Yi({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"}}});return new Ma(n)}connect(e){return We(this,null,function*(){try{if(e){yield Ga(e),this.setUrl(e);let r=this.buildClient();return yield this.checkAuth(),r}else{let r=`ws://localhost:${this.port}/graphql`;yield Ga(r),this.setUrl(r);let n=this.buildClient();return yield this.checkAuth(),n}}catch(r){this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}})}connectMultiUser(){return We(this,null,function*(){try{let e=this.options.backendUrl;console.debug("[Ad4m Connect] Connecting to backend:",e),yield Ga(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 We(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,Th("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 We(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 We(this,null,function*(){try{if(e){let r=yield cl(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 We(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 Ga(this.url),this.buildClient()}catch(i){return this.notifyConnectionChange("not_connected"),this.connectToPort()}})}findPort(){return We(this,null,function*(){let e=[...Array(10).keys()].map((i,a)=>cl(qs+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=Yc({url:this.url,connectionParams:()=>We(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=>We(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 No({link:new Zc(this.wsClient),cache:new Yi({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}}),this.ad4mClient=new Ma(this.apolloClient),this.ad4mClient}checkAuth(){return We(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 We(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 We(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(qs),this.notifyConnectionChange("not_connected"),this.notifyAuthChange("unauthenticated")}};export{ll as default};
|
|
1491
1522
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
1492
1523
|
//! @fayeed - make it support node.js
|