@coasys/ad4m-connect 0.11.2-dev.5 → 0.12.0-dev-whisper-lang
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/core.js +161 -160
- package/dist/index.js +130 -129
- package/dist/utils.js +1 -1
- package/dist/web.js +129 -128
- package/package.json +15 -15
- package/dist/components/icons/CheckCircleIcon.d.ts +0 -1
- package/dist/components/icons/TickIcon.d.ts +0 -1
- package/dist/components/shared/Ad4mLogo.d.ts +0 -1
- package/dist/components/shared/AppLogo.d.ts +0 -1
- package/dist/components/shared/Header.d.ts +0 -1
- package/dist/components/shared/Logo.d.ts +0 -1
- package/dist/components/states/ErrorState.d.ts +0 -6
- package/dist/components/views/ConnectionOverview.d.ts +0 -22
- package/dist/components/views/Hosting.d.ts +0 -22
- package/dist/components/views/MultiUserAuth.d.ts +0 -26
- package/dist/components/views/RemoteConnection.d.ts +0 -19
- package/dist/components/views/RequestCapability.d.ts +0 -16
- package/dist/components/views/ScanQRCode.d.ts +0 -14
- package/dist/components/views/Settings.d.ts +0 -19
- package/dist/components/views/Start.d.ts +0 -19
- package/dist/components/views/old/Hosting.d.ts +0 -22
- package/dist/components/views/old/MultiUserAuth.d.ts +0 -26
- package/dist/components/views/old/RemoteConnection.d.ts +0 -19
- package/dist/components/views/old/RequestCapability.d.ts +0 -16
- package/dist/components/views/old/ScanQRCode.d.ts +0 -14
- package/dist/components/views/old/Settings.d.ts +0 -19
- package/dist/components/views/old/Start.d.ts +0 -19
- package/dist/old/components/InvalidToken.d.ts +0 -0
- package/dist/old/components/VerifyCode.d.ts +0 -0
- package/dist/old/core.d.ts +0 -0
- package/dist/old/electron.d.ts +0 -0
- package/dist/old/state/ConnectState.d.ts +0 -0
- package/dist/old/state/index.d.ts +0 -0
- package/dist/old/utils.d.ts +0 -0
- package/dist/old/views/Hosting.d.ts +0 -0
- package/dist/old/views/MultiUserAuth.d.ts +0 -0
- package/dist/old/views/RemoteConnection.d.ts +0 -0
- package/dist/old/views/RequestCapability.d.ts +0 -0
- package/dist/old/views/ScanQRCode.d.ts +0 -0
- package/dist/old/views/Settings.d.ts +0 -0
- package/dist/old/views/Start.d.ts +0 -0
- package/dist/old/web.d.ts +0 -0
- package/dist/state/ConnectState.d.ts +0 -101
- package/dist/state/index.d.ts +0 -2
package/dist/index.js
CHANGED
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
var ag=Object.defineProperty;var og=Object.getOwnPropertyDescriptor;var sg=Object.getPrototypeOf;var cg=Reflect.get;var W=(r,e,t,i)=>{for(var n=i>1?void 0:i?og(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&ag(e,t,n),n};var Ep=(r,e,t)=>cg(sg(r),t,e);var J=(r,e,t)=>new Promise((i,n)=>{var a=c=>{try{s(t.next(c))}catch(u){n(u)}},o=c=>{try{s(t.throw(c))}catch(u){n(u)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});var jc=function(r,e){return jc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},jc(r,e)};function
|
|
1
|
+
var ag=Object.defineProperty;var og=Object.getOwnPropertyDescriptor;var sg=Object.getPrototypeOf;var cg=Reflect.get;var W=(r,e,t,i)=>{for(var n=i>1?void 0:i?og(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(n=(i?o(e,t,n):o(n))||n);return i&&n&&ag(e,t,n),n};var Ep=(r,e,t)=>cg(sg(r),t,e);var J=(r,e,t)=>new Promise((i,n)=>{var a=c=>{try{s(t.next(c))}catch(u){n(u)}},o=c=>{try{s(t.throw(c))}catch(u){n(u)}},s=c=>c.done?i(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});var jc=function(r,e){return jc=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,i){t.__proto__=i}||function(t,i){for(var n in i)Object.prototype.hasOwnProperty.call(i,n)&&(t[n]=i[n])},jc(r,e)};function $e(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");jc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var A=function(){return A=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},A.apply(this,arguments)};function nr(r,e){var t={};for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&e.indexOf(i)<0&&(t[i]=r[i]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var n=0,i=Object.getOwnPropertySymbols(r);n<i.length;n++)e.indexOf(i[n])<0&&Object.prototype.propertyIsEnumerable.call(r,i[n])&&(t[i[n]]=r[i[n]]);return t}function Ht(r,e,t,i){function n(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{u(i.next(l))}catch(d){o(d)}}function c(l){try{u(i.throw(l))}catch(d){o(d)}}function u(l){l.done?a(l.value):n(l.value).then(s,c)}u((i=i.apply(r,e||[])).next())})}function Gt(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},i,n,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(i)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(t=0)),t;)try{if(i=1,n&&(a=u[0]&2?n.return:u[0]?n.throw||((a=n.return)&&a.call(n),0):n.next)&&!(a=a.call(n,u[1])).done)return a;switch(n=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return t.label++,{value:u[1],done:!1};case 5:t.label++,n=u[1],u=[0];continue;case 7:u=t.ops.pop(),t.trys.pop();continue;default:if(a=t.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){t=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){t.label=u[1];break}if(u[0]===6&&t.label<a[1]){t.label=a[1],a=u;break}if(a&&t.label<a[2]){t.label=a[2],t.ops.push(u);break}a[2]&&t.ops.pop(),t.trys.pop();continue}u=e.call(r,t)}catch(l){u=[6,l],n=0}finally{i=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Lr(r,e,t){if(t||arguments.length===2)for(var i=0,n=e.length,a;i<n;i++)(a||!(i in e))&&(a||(a=Array.prototype.slice.call(e,0,i)),a[i]=e[i]);return r.concat(a||Array.prototype.slice.call(e))}var Uc="Invariant Violation",xp=Object.setPrototypeOf,ug=xp===void 0?function(r,e){return r.__proto__=e,r}:xp,Z=function(r){$e(e,r);function e(t){t===void 0&&(t=Uc);var i=r.call(this,typeof t=="number"?Uc+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return i.framesToPop=1,i.name=Uc,ug(i,e.prototype),i}return e}(Error);function L(r,e){if(!r)throw new Z(e)}var Mo=["debug","log","warn","error","silent"],qc=Mo.indexOf("log");function Fo(r){return function(){if(Mo.indexOf(r)>=qc){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=Fo("debug"),r.log=Fo("log"),r.warn=Fo("warn"),r.error=Fo("error")})(L||(L={}));function Ap(r){var e=Mo[qc];return qc=Math.max(0,Mo.indexOf(r)),e}function We(r){try{return r()}catch{}}var jo=We(function(){return globalThis})||We(function(){return window})||We(function(){return self})||We(function(){return global})||We(function(){return We.constructor("return this")()});var Ip="__",Tp=[Ip,Ip].join("DEV");function lg(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(jo,Tp,{value:We(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),jo[Tp]}}var gi=lg();function Fr(r){try{return r()}catch{}}var Bc=Fr(function(){return globalThis})||Fr(function(){return window})||Fr(function(){return self})||Fr(function(){return global})||Fr(function(){return Fr.constructor("return this")()}),Vc=!1;function pg(){Bc&&!Fr(function(){return"production"})&&!Fr(function(){return process})&&(Object.defineProperty(Bc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Vc=!0)}pg();function Qc(){Vc&&(delete Bc.process,Vc=!1)}var W_=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",H_=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",kp=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var je=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function zc(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var fg=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ha=fg;function Uo(r){var e=r.prototype.toJSON;typeof e=="function"||zc(0),r.prototype.inspect=e,ha&&(r.prototype[ha]=e)}var Op=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();Uo(Op);var Cp=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();Uo(Cp);function Wc(r){return r!=null&&typeof r.kind=="string"}function qo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qo=function(t){return typeof t}:qo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qo(r)}var dg=10,Np=2;function ma(r){return Bo(r,[])}function Bo(r,e){switch(qo(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":hg(r,e);default:return String(r)}}function hg(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=yg(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:Bo(n,t)}else if(Array.isArray(r))return gg(r,t);return mg(r,t)}function mg(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Np)return"["+vg(r)+"]";var i=t.map(function(n){var a=Bo(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function gg(r,e){if(r.length===0)return"[]";if(e.length>Np)return"[Array]";for(var t=Math.min(dg,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(Bo(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function yg(r){var e=r[String(ha)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function vg(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ga(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function Dp(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function bg(r,e,t){return e&&Dp(r.prototype,e),t&&Dp(r,t),r}var Vo=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||ga(0,"Body must be a string. Received: ".concat(ma(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||ga(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ga(0,"column in locationOffset is 1-indexed and must be positive.")}return bg(r,[{key:kp,get:function(){return"Source"}}]),r}();function $p(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=r.indexOf(`
|
|
2
2
|
`)===-1,n=r[0]===" "||r[0]===" ",a=r[r.length-1]==='"',o=r[r.length-1]==="\\",s=!i||a||o||t,c="";return s&&!(i&&n)&&(c+=`
|
|
3
3
|
`+e),c+=e?r.replace(/\n/g,`
|
|
4
4
|
`+e):r,s&&(c+=`
|
|
5
|
-
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var wg={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"]},yi=Object.freeze({});function ot(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wg,i=void 0,n=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,d=[],f=[],p=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=f.length===0?void 0:d[d.length-1],c=l,l=f.pop(),m){if(n)c=c.slice();else{for(var
|
|
5
|
+
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var wg={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"]},yi=Object.freeze({});function ot(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:wg,i=void 0,n=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,d=[],f=[],p=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=f.length===0?void 0:d[d.length-1],c=l,l=f.pop(),m){if(n)c=c.slice();else{for(var g={},w=0,_=Object.keys(c);w<_.length;w++){var S=_[w];g[S]=c[S]}c=g}for(var b=0,O=0;O<s.length;O++){var D=s[O][0],E=s[O][1];n&&(D-=b),n&&E===null?(c.splice(D,1),b++):c[D]=E}}o=i.index,a=i.keys,s=i.edits,n=i.inArray,i=i.prev}else{if(u=l?n?o:a[o]:void 0,c=l?l[u]:p,c==null)continue;l&&d.push(u)}var $=void 0;if(!Array.isArray(c)){if(!Wc(c))throw new Error("Invalid AST Node: ".concat(ma(c),"."));var P=Hc(e,c.kind,h);if(P){if($=P.call(e,c,u,l,d,f),$===yi)break;if($===!1){if(!h){d.pop();continue}}else if($!==void 0&&(s.push([u,$]),!h))if(Wc($))c=$;else{d.pop();continue}}}if($===void 0&&m&&s.push([u,c]),h)d.pop();else{var R;i={inArray:n,index:o,keys:a,edits:s,prev:i},n=Array.isArray(c),a=n?c:(R=t[c.kind])!==null&&R!==void 0?R:[],o=-1,s=[],l&&f.push(l),l=c}}while(i!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function Hc(r,e,t){var i=r[e];if(i){if(!t&&typeof i=="function")return i;var n=t?i.leave:i.enter;if(typeof n=="function")return n}else{var a=t?r.leave:r.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function vn(r){return ot(r,{leave:Sg})}var _g=80,Sg={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return F(e.definitions,`
|
|
6
6
|
|
|
7
7
|
`)+`
|
|
8
|
-
`},OperationDefinition:function(e){var t=e.operation,i=e.name,n=
|
|
8
|
+
`},OperationDefinition:function(e){var t=e.operation,i=e.name,n=Ne("(",F(e.variableDefinitions,", "),")"),a=F(e.directives," "),o=e.selectionSet;return!i&&!a&&!n&&t==="query"?o:F([t,F([i,n]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,i=e.type,n=e.defaultValue,a=e.directives;return t+": "+i+Ne(" = ",n)+Ne(" ",F(a," "))},SelectionSet:function(e){var t=e.selections;return Jt(t)},Field:function(e){var t=e.alias,i=e.name,n=e.arguments,a=e.directives,o=e.selectionSet,s=Ne("",t,": ")+i,c=s+Ne("(",F(n,", "),")");return c.length>_g&&(c=s+Ne(`(
|
|
9
9
|
`,Qo(F(n,`
|
|
10
10
|
`)),`
|
|
11
|
-
)`)),F([c,F(a," "),o]," ")},Argument:function(e){var t=e.name,i=e.value;return t+": "+i},FragmentSpread:function(e){var t=e.name,i=e.directives;return"..."+t+
|
|
11
|
+
)`)),F([c,F(a," "),o]," ")},Argument:function(e){var t=e.name,i=e.value;return t+": "+i},FragmentSpread:function(e){var t=e.name,i=e.directives;return"..."+t+Ne(" ",F(i," "))},InlineFragment:function(e){var t=e.typeCondition,i=e.directives,n=e.selectionSet;return F(["...",Ne("on ",t),F(i," "),n]," ")},FragmentDefinition:function(e){var t=e.name,i=e.typeCondition,n=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Ne("(",F(n,", "),")")," ")+"on ".concat(i," ").concat(Ne("",F(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var i=e.value,n=e.block;return n?$p(i,t==="description"?"":" "):JSON.stringify(i)},BooleanValue:function(e){var t=e.value;return t?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var t=e.value;return t},ListValue:function(e){var t=e.values;return"["+F(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+F(t,", ")+"}"},ObjectField:function(e){var t=e.name,i=e.value;return t+": "+i},Directive:function(e){var t=e.name,i=e.arguments;return"@"+t+Ne("(",F(i,", "),")")},NamedType:function(e){var t=e.name;return t},ListType:function(e){var t=e.type;return"["+t+"]"},NonNullType:function(e){var t=e.type;return t+"!"},SchemaDefinition:Kt(function(r){var e=r.directives,t=r.operationTypes;return F(["schema",F(e," "),Jt(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,i=e.type;return t+": "+i},ScalarTypeDefinition:Kt(function(r){var e=r.name,t=r.directives;return F(["scalar",e,F(t," ")]," ")}),ObjectTypeDefinition:Kt(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return F(["type",e,Ne("implements ",F(t," & ")),F(i," "),Jt(n)]," ")}),FieldDefinition:Kt(function(r){var e=r.name,t=r.arguments,i=r.type,n=r.directives;return e+(Rp(t)?Ne(`(
|
|
12
12
|
`,Qo(F(t,`
|
|
13
13
|
`)),`
|
|
14
|
-
)`):
|
|
14
|
+
)`):Ne("(",F(t,", "),")"))+": "+i+Ne(" ",F(n," "))}),InputValueDefinition:Kt(function(r){var e=r.name,t=r.type,i=r.defaultValue,n=r.directives;return F([e+": "+t,Ne("= ",i),F(n," ")]," ")}),InterfaceTypeDefinition:Kt(function(r){var e=r.name,t=r.interfaces,i=r.directives,n=r.fields;return F(["interface",e,Ne("implements ",F(t," & ")),F(i," "),Jt(n)]," ")}),UnionTypeDefinition:Kt(function(r){var e=r.name,t=r.directives,i=r.types;return F(["union",e,F(t," "),i&&i.length!==0?"= "+F(i," | "):""]," ")}),EnumTypeDefinition:Kt(function(r){var e=r.name,t=r.directives,i=r.values;return F(["enum",e,F(t," "),Jt(i)]," ")}),EnumValueDefinition:Kt(function(r){var e=r.name,t=r.directives;return F([e,F(t," ")]," ")}),InputObjectTypeDefinition:Kt(function(r){var e=r.name,t=r.directives,i=r.fields;return F(["input",e,F(t," "),Jt(i)]," ")}),DirectiveDefinition:Kt(function(r){var e=r.name,t=r.arguments,i=r.repeatable,n=r.locations;return"directive @"+e+(Rp(t)?Ne(`(
|
|
15
15
|
`,Qo(F(t,`
|
|
16
16
|
`)),`
|
|
17
|
-
)`):
|
|
18
|
-
`)}}function F(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(i){return i}).join(t))!==null&&e!==void 0?e:""}function Jt(r){return
|
|
17
|
+
)`):Ne("(",F(t,", "),")"))+(i?" repeatable":"")+" on "+F(n," | ")}),SchemaExtension:function(e){var t=e.directives,i=e.operationTypes;return F(["extend schema",F(t," "),Jt(i)]," ")},ScalarTypeExtension:function(e){var t=e.name,i=e.directives;return F(["extend scalar",t,F(i," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return F(["extend type",t,Ne("implements ",F(i," & ")),F(n," "),Jt(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,i=e.interfaces,n=e.directives,a=e.fields;return F(["extend interface",t,Ne("implements ",F(i," & ")),F(n," "),Jt(a)]," ")},UnionTypeExtension:function(e){var t=e.name,i=e.directives,n=e.types;return F(["extend union",t,F(i," "),n&&n.length!==0?"= "+F(n," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,i=e.directives,n=e.values;return F(["extend enum",t,F(i," "),Jt(n)]," ")},InputObjectTypeExtension:function(e){var t=e.name,i=e.directives,n=e.fields;return F(["extend input",t,F(i," "),Jt(n)]," ")}};function Kt(r){return function(e){return F([e.description,r(e)],`
|
|
18
|
+
`)}}function F(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(i){return i}).join(t))!==null&&e!==void 0?e:""}function Jt(r){return Ne(`{
|
|
19
19
|
`,Qo(F(r,`
|
|
20
20
|
`)),`
|
|
21
|
-
}`)}function
|
|
21
|
+
}`)}function Ne(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function Qo(r){return Ne(" ",r.replace(/\n/g,`
|
|
22
22
|
`))}function Eg(r){return r.indexOf(`
|
|
23
|
-
`)!==-1}function Rp(r){return r!=null&&r.some(Eg)}function ya(r){return r.kind===Me.FIELD||r.kind===Me.FRAGMENT_SPREAD||r.kind===Me.INLINE_FRAGMENT}function Pp(){return typeof Vo=="function"?Qc():Qc()}function $g(){__DEV__?L(typeof gi=="boolean",gi):L(typeof gi=="boolean",39)}Pp();$g();function Sr(r,e){var t=r.directives;return!t||!t.length?!0:Lp(t).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?L(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):L(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function bn(r,e,t){var i=new Set(r),n=i.size;return ot(e,{Directive:function(a){if(i.delete(a.name.value)&&(!t||!i.size))return yi}}),t?!i.size:i.size<n}function Hc(r){return r&&bn(["client","export"],r,!0)}function Rg(r){var e=r.name.value;return e==="skip"||e==="include"}function Lp(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Rg(t)){var i=t.arguments,n=t.name.value;__DEV__?L(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):L(i&&i.length===1,41);var a=i[0];__DEV__?L(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," 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(n," directive must be a variable or a boolean value.")):L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function Kc(r,e){var t=e,i=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new Z("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new Z(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof t>"u"&&(__DEV__?L(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):L(i.length===1,45),t=i[0].name.value);var n=A(A({},r),{definitions:Lr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return n}function vi(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function bi(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var i=e&&e[t];return __DEV__?L(i,"No fragment named ".concat(t)):L(i,46),i||null}default:return null}}function le(r){return r!==null&&typeof r=="object"}function ar(r){return{__ref:String(r)}}function ne(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function Jc(r){return le(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Pg(r){return r.kind==="StringValue"}function Lg(r){return r.kind==="BooleanValue"}function Fg(r){return r.kind==="IntValue"}function Mg(r){return r.kind==="FloatValue"}function jg(r){return r.kind==="Variable"}function Ug(r){return r.kind==="ObjectValue"}function qg(r){return r.kind==="ListValue"}function Bg(r){return r.kind==="EnumValue"}function Vg(r){return r.kind==="NullValue"}function Mr(r,e,t,i){if(Fg(t)||Mg(t))r[e.value]=Number(t.value);else if(Lg(t)||Pg(t))r[e.value]=t.value;else if(Ug(t)){var n={};t.fields.map(function(o){return Mr(n,o.name,o.value,i)}),r[e.value]=n}else if(jg(t)){var a=(i||{})[t.name.value];r[e.value]=a}else if(qg(t))r[e.value]=t.values.map(function(o){var s={};return Mr(s,e,o,i),s[e.value]});else if(Bg(t))r[e.value]=t.value;else if(Vg(t))r[e.value]=null;else throw __DEV__?new Z('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new Z(55)}function Zc(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(n){t[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Mr(t[n.name.value],o,s,e)})}));var i=null;return r.arguments&&r.arguments.length&&(i={},r.arguments.forEach(function(n){var a=n.name,o=n.value;return Mr(i,a,o,e)})),ba(r.name.value,i,t)}var Qg=["connection","include","skip","client","rest","export"],ba=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(t.connection.key,"(").concat(va(n),")")}else return t.connection.key;var a=r;if(e){var o=va(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){Qg.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(va(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=va;return va=r,e}}),va=function(e){return JSON.stringify(e,zg)};function zg(r,e){return le(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})),e}function Er(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(i){var n=i.name,a=i.value;return Mr(t,n,a,e)}),t}return null}function Mt(r){return r.alias?r.alias.value:r.name.value}function wa(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(It(a)){if(a.name.value==="__typename")return r[Mt(a)]}else{var o=wa(r,bi(a,t).selectionSet,t);if(typeof o=="string")return o}}}function It(r){return r.kind==="Field"}function Yc(r){return r.kind==="InlineFragment"}function wn(r){__DEV__?L(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new Z('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new Z(48);return t});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),r}function or(r){return wn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function _n(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function wi(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function _a(r){var e=or(r);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function Xc(r){__DEV__?L(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r.kind==="Document",51),__DEV__?L(r.definitions.length<=1,"Fragment must have exactly one definition."):L(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function _i(r){wn(r);for(var e,t=0,i=r.definitions;t<i.length;t++){var n=i[t];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new Z("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new Z(54)}function Si(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(i){i.defaultValue&&Mr(e,i.variable.name,i.defaultValue)}),e}var be=Array.isArray;function qe(r){return Array.isArray(r)&&r.length>0}var Fp={kind:Me.FIELD,name:{kind:Me.NAME,value:"__typename"}};function jp(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Me.FRAGMENT_SPREAD&&jp(e[t.name.value],e)})}function Wg(r){return jp(or(r)||Xc(r),vi(wi(r)))?null:r}function Gg(r){var e=new Set,t=[];return r.forEach(function(i){i.name?e.add(i.name):i.test&&t.push(i.test)}),function(i){return e.has(i.name.value)||t.some(function(n){return n(i)})}}function Mp(r){var e=new Map;return function(i){i===void 0&&(i=r);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function eu(r,e){for(var t=Mp(""),i=Mp(""),n=function(_){for(var S=0,b=void 0;S<_.length&&(b=_[S]);++S)if(!be(b)){if(b.kind===Me.OPERATION_DEFINITION)return t(b.name&&b.name.value);if(b.kind===Me.FRAGMENT_DEFINITION)return i(b.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===Me.OPERATION_DEFINITION&&++a;var s=Gg(r),c=r.some(function(_){return _.remove}),u=function(_){return c&&_&&_.some(s)},l=new Map,d=!1,f={enter:function(_){if(u(_.directives))return d=!0,null}},p=ot(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,S,b,k,$){var E=n($);E&&E.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,S,b,k,$){if(u(_.directives))return d=!0,null;var E=n($);E&&E.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,S,b,k){l.set(JSON.stringify(k),_)},leave:function(_,S,b,k){var $=l.get(JSON.stringify(k));if(_===$)return _;if(a>0&&_.selectionSet.selections.every(function(E){return E.kind===Me.FIELD&&E.name.value==="__typename"}))return i(_.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(i(S)).transitiveVars.forEach(function(b){_.transitiveVars.add(b)})})),_},m=new Set;p.definitions.forEach(function(_){_.kind===Me.OPERATION_DEFINITION?h(t(_.name&&_.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):_.kind===Me.FRAGMENT_DEFINITION&&a===0&&!i(_.name.value).removed&&m.add(_.name.value)}),m.forEach(function(_){h(i(_)).fragmentSpreads.forEach(function(S){m.add(S)})});var y=function(_){return!!(!m.has(_)||i(_).removed)},w={enter:function(_){if(y(_.name.value))return null}};return Wg(ot(p,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(_){if(_.variableDefinitions){var S=h(t(_.name&&_.name.value)).transitiveVars;if(S.size<_.variableDefinitions.length)return A(A({},_),{variableDefinitions:_.variableDefinitions.filter(function(b){return S.has(b.variable.name.value)})})}}}}))}var Ei=Object.assign(function(r){return ot(r,{SelectionSet:{enter:function(e,t,i){if(!(i&&i.kind===Me.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return It(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(It(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return A(A({},e),{selections:Lr(Lr([],n,!0),[Fp],!1)})}}}}}})},{added:function(r){return r===Fp}}),Hg={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.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 tu(r){return eu([Hg],wn(r))}function ru(r){var e=_i(r),t=e.operation;if(t==="query")return r;var i=ot(r,{OperationDefinition:{enter:function(n){return A(A({},n),{operation:"query"})}}});return i}function iu(r){wn(r);var e=eu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Kg=Object.prototype.hasOwnProperty;function nu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Sa(r)}function Sa(r){var e=r[0]||{},t=r.length;if(t>1)for(var i=new bt,n=1;n<t;++n)e=i.merge(e,r[n]);return e}var Jg=function(r,e,t){return this.merge(r[t],e[t])},bt=function(){function r(e){e===void 0&&(e=Jg),this.reconciler=e,this.isObject=le,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return le(t)&&le(e)?(Object.keys(t).forEach(function(o){if(Kg.call(e,o)){var s=e[o];if(t[o]!==s){var c=i.reconciler.apply(i,Lr([e,t,o],n,!1));c!==s&&(e=i.shallowCopyForMerge(e),e[o]=c)}}else e=i.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return le(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=A({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function Zg(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=Yg(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
24
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yg(r,e){if(!!r){if(typeof r=="string")return Up(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Up(r,e)}}function Up(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function qp(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function cu(r,e,t){return e&&qp(r.prototype,e),t&&qp(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var uu=function(){return typeof Symbol=="function"},lu=function(r){return uu()&&Boolean(Symbol[r])},pu=function(r){return lu(r)?Symbol[r]:"@@"+r};uu()&&!lu("observable")&&(Symbol.observable=Symbol("observable"));var Xg=pu("iterator"),ou=pu("observable"),Bp=pu("species");function Wo(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Ea(r){var e=r.constructor;return e!==void 0&&(e=e[Bp],e===null&&(e=void 0)),e!==void 0?e:ie}function ey(r){return r instanceof ie}function Sn(r){Sn.log?Sn.log(r):setTimeout(function(){throw r})}function zo(r){Promise.resolve().then(function(){try{r()}catch(e){Sn(e)}})}function Vp(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Wo(e,"unsubscribe");t&&t.call(e)}}catch(i){Sn(i)}}function su(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function ty(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Qp(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Qp(r,e,t){r._state="running";var i=r._observer;try{var n=Wo(i,e);switch(e){case"next":n&&n.call(i,t);break;case"error":if(su(r),n)n.call(i,t);else throw t;break;case"complete":su(r),n&&n.call(i);break}}catch(a){Sn(a)}r._state==="closed"?Vp(r):r._state==="running"&&(r._state="ready")}function au(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],zo(function(){return ty(r)});return}Qp(r,e,t)}}var ry=function(){function r(t,i){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var n=new iy(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(su(this),Vp(this))},cu(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),iy=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(i){au(this._subscription,"next",i)},e.error=function(i){au(this._subscription,"error",i)},e.complete=function(){au(this._subscription,"complete")},cu(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ie=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new ry(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=n.subscribe({next:function(u){try{i(u,s)}catch(l){o(l),c.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return n.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{u=i(u,d)}catch(p){return l.error(p)}else u=d},error:function(d){l.error(d)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(u),l.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=Ea(this);return new s(function(c){var u,l=0;function d(f){u=f.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){l===a.length?(u=void 0,c.complete()):d(s.from(a[l++]))}})}return d(i),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){var s=[],c=n.subscribe({next:function(l){if(i)try{l=i(l)}catch(f){return o.error(f)}var d=a.from(l).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),u()}});s.push(d)},error:function(l){o.error(l)},complete:function(){u()}});function u(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),c.unsubscribe()}})},e[ou]=function(){return this},r.from=function(i){var n=typeof this=="function"?this:r;if(i==null)throw new TypeError(i+" is not an object");var a=Wo(i,ou);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return ey(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(lu("iterator")&&(a=Wo(i,Xg),a))return new n(function(s){zo(function(){if(!s.closed){for(var c=Zg(a.call(i)),u;!(u=c()).done;){var l=u.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){zo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},r.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){zo(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})})},cu(r,null,[{key:Bp,get:function(){return this}}]),r}();uu()&&Object.defineProperty(ie,Symbol("extensions"),{value:{symbol:ou,hostReportError:Sn},configurable:!0});function fu(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var En;typeof self<"u"?En=self:typeof window<"u"?En=window:typeof global<"u"?En=global:typeof module<"u"?En=module:En=Function("return this")();var w1=fu(En);var zp=ie.prototype,Wp="@@observable";zp[Wp]||(zp[Wp]=function(){return this});var ny=Object.prototype.toString;function Go(r){return du(r)}function du(r,e){switch(ny.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(n,a){t[a]=du(n,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var i=Object.create(Object.getPrototypeOf(r));return e.set(r,i),Object.keys(r).forEach(function(n){i[n]=du(r[n],e)}),i}default:return r}}function ay(r){var e=new Set([r]);return e.forEach(function(t){le(t)&&oy(t)===t&&Object.getOwnPropertyNames(t).forEach(function(i){le(t[i])&&e.add(t[i])})}),r}function oy(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function xa(r){return __DEV__&&ay(r),r}function xi(r,e,t){var i=[];r.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](t)})}function Ho(r,e,t){return new ie(function(i){var n=i.next,a=i.error,o=i.complete,s=0,c=!1,u={then:function(p){return new Promise(function(h){return h(p())})}};function l(p,h){return p?function(m){++s;var y=function(){return p(m)};u=u.then(y,y).then(function(w){--s,n&&n.call(i,w),c&&d.complete()},function(w){throw--s,w}).catch(function(w){a&&a.call(i,w)})}:function(m){return h&&h.call(i,m)}}var d={next:l(e,n),error:l(t,a),complete:function(){c=!0,s||o&&o.call(i)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var jt=typeof WeakMap=="function"&&We(function(){return navigator.product})!=="ReactNative",Gp=typeof WeakSet=="function",hu=typeof Symbol=="function"&&typeof Symbol.for=="function",jr=hu&&Symbol.asyncIterator,$1=typeof We(function(){return window.document.createElement})=="function",R1=We(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Ko(r){function e(t){Object.defineProperty(r,t,{value:ie})}return hu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Hp(r){return r&&typeof r.then=="function"}var xn=function(r){De(e,r);function e(t){var i=r.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),xi(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),xi(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?Hp(c)?c.then(function(u){return i.sub=u.subscribe(i.handlers)}):i.sub=c.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),xi(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof t=="function"&&(t=[new ie(t)]),Hp(t)?t.then(function(n){return i.start(n)},i.handlers.error):i.start(t),i}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var i=this.latest[0],n=t[i];n&&n.call(t,this.latest[1]),this.sub===null&&i==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(t,i)}))},e.prototype.beforeNext=function(t){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,t(n,a))})},e}(ie);Ko(xn);function Ur(r){return"incremental"in r}function sy(r){return"hasNext"in r&&"data"in r}function Kp(r){return Ur(r)||sy(r)}function Jo(r,e){var t=r,i=new bt;return Ur(e)&&qe(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}t=i.merge(t,a)}),t}function An(r){var e=Zo(r);return qe(e)}function Zo(r){var e=qe(r.errors)?r.errors.slice(0):[];return Ur(r)&&qe(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function qr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(t[n]=a)})}),t}var Jp=new Map;function Aa(r){var e=Jp.get(r)||1;return Jp.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Zp(r){var e=Aa("stringifyForDisplay");return JSON.stringify(r,function(t,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function Ia(r,e){return qr(r,e,e.variables&&{variables:A(A({},r&&r.variables),e.variables)})}function Yo(r){return new ie(function(e){e.error(r)})}var Ta=function(r,e,t){var i=new Error(t);throw i.name="ServerError",i.response=r,i.statusCode=r.status,i.result=e,i};function mu(r){for(var e=["query","operationName","variables","extensions","context"],t=0,i=Object.keys(r);t<i.length;t++){var n=i[t];if(e.indexOf(n)<0)throw __DEV__?new Z("illegal argument: ".concat(n)):new Z(27)}return r}function gu(r,e){var t=A({},r),i=function(a){typeof a=="function"?t=A(A({},t),a(t)):t=A(A({},t),a)},n=function(){return A({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function yu(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?_n(e.query)||void 0:""),e}function Yp(r,e){return e?e(r):ie.of()}function ka(r){return typeof r=="function"?new Ut(r):r}function Xo(r){return r.request.length<=1}var cy=function(r){De(e,r);function e(t,i){var n=r.call(this,t)||this;return n.link=i,n}return e}(Error),Ut=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return ie.of()})},r.from=function(e){return e.length===0?r.empty():e.map(ka).reduce(function(t,i){return t.concat(i)})},r.split=function(e,t,i){var n=ka(t),a=ka(i||new r(Yp));return Xo(n)&&Xo(a)?new r(function(o){return e(o)?n.request(o)||ie.of():a.request(o)||ie.of()}):new r(function(o,s){return e(o)?n.request(o,s)||ie.of():a.request(o,s)||ie.of()})},r.execute=function(e,t){return e.request(gu(t.context,yu(mu(t))))||ie.of()},r.concat=function(e,t){var i=ka(e);if(Xo(i))return __DEV__&&L.warn(new cy("You are calling concat on a terminating link, which will have no effect",i)),i;var n=ka(t);return Xo(n)?new r(function(a){return i.request(a,function(o){return n.request(o)||ie.of()})||ie.of()}):new r(function(a,o){return i.request(a,function(s){return n.request(s,o)||ie.of()})||ie.of()})},r.prototype.split=function(e,t,i){return this.concat(r.split(e,t,i||new r(Yp)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new Z("request is not implemented"):new Z(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var In=Ut.execute;var Xp="3.7.10";function ef(r){return!!r.body}function tf(r){return!!r.getReader}function rf(r){return!!(jr&&r[Symbol.asyncIterator])}function nf(r){return!!r.stream}function af(r){return!!r.arrayBuffer}function of(r){return!!r.pipe}function vu(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function bu(r){var e=null,t=null,i=!1,n=[],a=[];function o(d){if(!t){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}n.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){i=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(d,f){if(t)return f(t);if(n.length)return d({value:n.shift(),done:!1});if(i)return d({value:void 0,done:!0});a.push([d,f])})}var l={next:function(){return u()}};return jr&&(l[Symbol.asyncIterator]=function(){return this}),l}function wu(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){r.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return jr&&(t[Symbol.asyncIterator]=function(){return this}),t}function es(r){var e={next:function(){return r.read()}};return jr&&(e[Symbol.asyncIterator]=function(){return this}),e}function sf(r){var e=r;if(ef(r)&&(e=r.body),rf(e))return vu(e);if(tf(e))return es(e.getReader());if(nf(e))return es(e.stream().getReader());if(af(e))return wu(e.arrayBuffer());if(of(e))return bu(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var cf=Object.prototype.hasOwnProperty;function uf(r,e){var t,i,n;return Gt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h,m,y,w,_,S,b,k,$,E,D;return Ht(this,function(P){switch(P.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=sf(r),f=!0,P.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=P.sent(),h=p.value,m=p.done,y=typeof h=="string"?h:a.decode(h),f=!m,l+=y,w=l.indexOf(u);w>-1;){if(_=void 0,D=[l.slice(0,w),l.slice(w+u.length)],_=D[0],l=D[1],_.trim()){if(S=_.indexOf(`\r
|
|
23
|
+
`)!==-1}function Rp(r){return r!=null&&r.some(Eg)}function ya(r){return r.kind===je.FIELD||r.kind===je.FRAGMENT_SPREAD||r.kind===je.INLINE_FRAGMENT}function Pp(){return typeof Vo=="function"?Qc():Qc()}function $g(){__DEV__?L(typeof gi=="boolean",gi):L(typeof gi=="boolean",39)}Pp();$g();function Sr(r,e){var t=r.directives;return!t||!t.length?!0:Lp(t).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?L(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):L(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function bn(r,e,t){var i=new Set(r),n=i.size;return ot(e,{Directive:function(a){if(i.delete(a.name.value)&&(!t||!i.size))return yi}}),t?!i.size:i.size<n}function Gc(r){return r&&bn(["client","export"],r,!0)}function Rg(r){var e=r.name.value;return e==="skip"||e==="include"}function Lp(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Rg(t)){var i=t.arguments,n=t.name.value;__DEV__?L(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):L(i&&i.length===1,41);var a=i[0];__DEV__?L(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," 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(n," directive must be a variable or a boolean value.")):L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function Kc(r,e){var t=e,i=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new Z("Found a ".concat(a.operation," operation").concat(a.name?" named '".concat(a.name.value,"'"):"",". ")+"No operations are allowed when using a fragment as a query. Only fragments are allowed."):new Z(44);a.kind==="FragmentDefinition"&&i.push(a)}),typeof t>"u"&&(__DEV__?L(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):L(i.length===1,45),t=i[0].name.value);var n=A(A({},r),{definitions:Lr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return n}function vi(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function bi(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var i=e&&e[t];return __DEV__?L(i,"No fragment named ".concat(t)):L(i,46),i||null}default:return null}}function pe(r){return r!==null&&typeof r=="object"}function ar(r){return{__ref:String(r)}}function ne(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function Jc(r){return pe(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Pg(r){return r.kind==="StringValue"}function Lg(r){return r.kind==="BooleanValue"}function Fg(r){return r.kind==="IntValue"}function Mg(r){return r.kind==="FloatValue"}function jg(r){return r.kind==="Variable"}function Ug(r){return r.kind==="ObjectValue"}function qg(r){return r.kind==="ListValue"}function Bg(r){return r.kind==="EnumValue"}function Vg(r){return r.kind==="NullValue"}function Mr(r,e,t,i){if(Fg(t)||Mg(t))r[e.value]=Number(t.value);else if(Lg(t)||Pg(t))r[e.value]=t.value;else if(Ug(t)){var n={};t.fields.map(function(o){return Mr(n,o.name,o.value,i)}),r[e.value]=n}else if(jg(t)){var a=(i||{})[t.name.value];r[e.value]=a}else if(qg(t))r[e.value]=t.values.map(function(o){var s={};return Mr(s,e,o,i),s[e.value]});else if(Bg(t))r[e.value]=t.value;else if(Vg(t))r[e.value]=null;else throw __DEV__?new Z('The inline argument "'.concat(e.value,'" of kind "').concat(t.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new Z(55)}function Zc(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(n){t[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Mr(t[n.name.value],o,s,e)})}));var i=null;return r.arguments&&r.arguments.length&&(i={},r.arguments.forEach(function(n){var a=n.name,o=n.value;return Mr(i,a,o,e)})),ba(r.name.value,i,t)}var Qg=["connection","include","skip","client","rest","export"],ba=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(t.connection.key,"(").concat(va(n),")")}else return t.connection.key;var a=r;if(e){var o=va(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){Qg.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(va(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=va;return va=r,e}}),va=function(e){return JSON.stringify(e,zg)};function zg(r,e){return pe(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})),e}function Er(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(i){var n=i.name,a=i.value;return Mr(t,n,a,e)}),t}return null}function Mt(r){return r.alias?r.alias.value:r.name.value}function wa(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(It(a)){if(a.name.value==="__typename")return r[Mt(a)]}else{var o=wa(r,bi(a,t).selectionSet,t);if(typeof o=="string")return o}}}function It(r){return r.kind==="Field"}function Yc(r){return r.kind==="InlineFragment"}function wn(r){__DEV__?L(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new Z('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new Z(48);return t});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),r}function or(r){return wn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function _n(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function wi(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function _a(r){var e=or(r);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function Xc(r){__DEV__?L(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r.kind==="Document",51),__DEV__?L(r.definitions.length<=1,"Fragment must have exactly one definition."):L(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function _i(r){wn(r);for(var e,t=0,i=r.definitions;t<i.length;t++){var n=i[t];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new Z("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new Z(54)}function Si(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(i){i.defaultValue&&Mr(e,i.variable.name,i.defaultValue)}),e}var be=Array.isArray;function qe(r){return Array.isArray(r)&&r.length>0}var Fp={kind:je.FIELD,name:{kind:je.NAME,value:"__typename"}};function jp(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===je.FRAGMENT_SPREAD&&jp(e[t.name.value],e)})}function Wg(r){return jp(or(r)||Xc(r),vi(wi(r)))?null:r}function Hg(r){var e=new Set,t=[];return r.forEach(function(i){i.name?e.add(i.name):i.test&&t.push(i.test)}),function(i){return e.has(i.name.value)||t.some(function(n){return n(i)})}}function Mp(r){var e=new Map;return function(i){i===void 0&&(i=r);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function eu(r,e){for(var t=Mp(""),i=Mp(""),n=function(_){for(var S=0,b=void 0;S<_.length&&(b=_[S]);++S)if(!be(b)){if(b.kind===je.OPERATION_DEFINITION)return t(b.name&&b.name.value);if(b.kind===je.FRAGMENT_DEFINITION)return i(b.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===je.OPERATION_DEFINITION&&++a;var s=Hg(r),c=r.some(function(_){return _.remove}),u=function(_){return c&&_&&_.some(s)},l=new Map,d=!1,f={enter:function(_){if(u(_.directives))return d=!0,null}},p=ot(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(_,S,b,O,D){var E=n(D);E&&E.variables.add(_.name.value)}},FragmentSpread:{enter:function(_,S,b,O,D){if(u(_.directives))return d=!0,null;var E=n(D);E&&E.fragmentSpreads.add(_.name.value)}},FragmentDefinition:{enter:function(_,S,b,O){l.set(JSON.stringify(O),_)},leave:function(_,S,b,O){var D=l.get(JSON.stringify(O));if(_===D)return _;if(a>0&&_.selectionSet.selections.every(function(E){return E.kind===je.FIELD&&E.name.value==="__typename"}))return i(_.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(i(S)).transitiveVars.forEach(function(b){_.transitiveVars.add(b)})})),_},m=new Set;p.definitions.forEach(function(_){_.kind===je.OPERATION_DEFINITION?h(t(_.name&&_.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):_.kind===je.FRAGMENT_DEFINITION&&a===0&&!i(_.name.value).removed&&m.add(_.name.value)}),m.forEach(function(_){h(i(_)).fragmentSpreads.forEach(function(S){m.add(S)})});var g=function(_){return!!(!m.has(_)||i(_).removed)},w={enter:function(_){if(g(_.name.value))return null}};return Wg(ot(p,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(_){if(_.variableDefinitions){var S=h(t(_.name&&_.name.value)).transitiveVars;if(S.size<_.variableDefinitions.length)return A(A({},_),{variableDefinitions:_.variableDefinitions.filter(function(b){return S.has(b.variable.name.value)})})}}}}))}var Ei=Object.assign(function(r){return ot(r,{SelectionSet:{enter:function(e,t,i){if(!(i&&i.kind===je.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return It(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(It(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return A(A({},e),{selections:Lr(Lr([],n,!0),[Fp],!1)})}}}}}})},{added:function(r){return r===Fp}}),Gg={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.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 tu(r){return eu([Gg],wn(r))}function ru(r){var e=_i(r),t=e.operation;if(t==="query")return r;var i=ot(r,{OperationDefinition:{enter:function(n){return A(A({},n),{operation:"query"})}}});return i}function iu(r){wn(r);var e=eu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Kg=Object.prototype.hasOwnProperty;function nu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Sa(r)}function Sa(r){var e=r[0]||{},t=r.length;if(t>1)for(var i=new bt,n=1;n<t;++n)e=i.merge(e,r[n]);return e}var Jg=function(r,e,t){return this.merge(r[t],e[t])},bt=function(){function r(e){e===void 0&&(e=Jg),this.reconciler=e,this.isObject=pe,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return pe(t)&&pe(e)?(Object.keys(t).forEach(function(o){if(Kg.call(e,o)){var s=e[o];if(t[o]!==s){var c=i.reconciler.apply(i,Lr([e,t,o],n,!1));c!==s&&(e=i.shallowCopyForMerge(e),e[o]=c)}}else e=i.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return pe(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=A({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function Zg(r,e){var t=typeof Symbol<"u"&&r[Symbol.iterator]||r["@@iterator"];if(t)return(t=t.call(r)).next.bind(t);if(Array.isArray(r)||(t=Yg(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
24
|
+
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function Yg(r,e){if(!!r){if(typeof r=="string")return Up(r,e);var t=Object.prototype.toString.call(r).slice(8,-1);if(t==="Object"&&r.constructor&&(t=r.constructor.name),t==="Map"||t==="Set")return Array.from(r);if(t==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t))return Up(r,e)}}function Up(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function qp(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function cu(r,e,t){return e&&qp(r.prototype,e),t&&qp(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var uu=function(){return typeof Symbol=="function"},lu=function(r){return uu()&&Boolean(Symbol[r])},pu=function(r){return lu(r)?Symbol[r]:"@@"+r};uu()&&!lu("observable")&&(Symbol.observable=Symbol("observable"));var Xg=pu("iterator"),ou=pu("observable"),Bp=pu("species");function Wo(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Ea(r){var e=r.constructor;return e!==void 0&&(e=e[Bp],e===null&&(e=void 0)),e!==void 0?e:ie}function ey(r){return r instanceof ie}function Sn(r){Sn.log?Sn.log(r):setTimeout(function(){throw r})}function zo(r){Promise.resolve().then(function(){try{r()}catch(e){Sn(e)}})}function Vp(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Wo(e,"unsubscribe");t&&t.call(e)}}catch(i){Sn(i)}}function su(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function ty(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Qp(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Qp(r,e,t){r._state="running";var i=r._observer;try{var n=Wo(i,e);switch(e){case"next":n&&n.call(i,t);break;case"error":if(su(r),n)n.call(i,t);else throw t;break;case"complete":su(r),n&&n.call(i);break}}catch(a){Sn(a)}r._state==="closed"?Vp(r):r._state==="running"&&(r._state="ready")}function au(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],zo(function(){return ty(r)});return}Qp(r,e,t)}}var ry=function(){function r(t,i){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var n=new iy(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(su(this),Vp(this))},cu(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),iy=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(i){au(this._subscription,"next",i)},e.error=function(i){au(this._subscription,"error",i)},e.complete=function(){au(this._subscription,"complete")},cu(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ie=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new ry(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=n.subscribe({next:function(u){try{i(u,s)}catch(l){o(l),c.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return n.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{u=i(u,d)}catch(p){return l.error(p)}else u=d},error:function(d){l.error(d)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(u),l.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=Ea(this);return new s(function(c){var u,l=0;function d(f){u=f.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){l===a.length?(u=void 0,c.complete()):d(s.from(a[l++]))}})}return d(i),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){var s=[],c=n.subscribe({next:function(l){if(i)try{l=i(l)}catch(f){return o.error(f)}var d=a.from(l).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),u()}});s.push(d)},error:function(l){o.error(l)},complete:function(){u()}});function u(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),c.unsubscribe()}})},e[ou]=function(){return this},r.from=function(i){var n=typeof this=="function"?this:r;if(i==null)throw new TypeError(i+" is not an object");var a=Wo(i,ou);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return ey(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(lu("iterator")&&(a=Wo(i,Xg),a))return new n(function(s){zo(function(){if(!s.closed){for(var c=Zg(a.call(i)),u;!(u=c()).done;){var l=u.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){zo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},r.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){zo(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})})},cu(r,null,[{key:Bp,get:function(){return this}}]),r}();uu()&&Object.defineProperty(ie,Symbol("extensions"),{value:{symbol:ou,hostReportError:Sn},configurable:!0});function fu(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var En;typeof self<"u"?En=self:typeof window<"u"?En=window:typeof global<"u"?En=global:typeof module<"u"?En=module:En=Function("return this")();var w1=fu(En);var zp=ie.prototype,Wp="@@observable";zp[Wp]||(zp[Wp]=function(){return this});var ny=Object.prototype.toString;function Ho(r){return du(r)}function du(r,e){switch(ny.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(n,a){t[a]=du(n,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var i=Object.create(Object.getPrototypeOf(r));return e.set(r,i),Object.keys(r).forEach(function(n){i[n]=du(r[n],e)}),i}default:return r}}function ay(r){var e=new Set([r]);return e.forEach(function(t){pe(t)&&oy(t)===t&&Object.getOwnPropertyNames(t).forEach(function(i){pe(t[i])&&e.add(t[i])})}),r}function oy(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function xa(r){return __DEV__&&ay(r),r}function xi(r,e,t){var i=[];r.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](t)})}function Go(r,e,t){return new ie(function(i){var n=i.next,a=i.error,o=i.complete,s=0,c=!1,u={then:function(p){return new Promise(function(h){return h(p())})}};function l(p,h){return p?function(m){++s;var g=function(){return p(m)};u=u.then(g,g).then(function(w){--s,n&&n.call(i,w),c&&d.complete()},function(w){throw--s,w}).catch(function(w){a&&a.call(i,w)})}:function(m){return h&&h.call(i,m)}}var d={next:l(e,n),error:l(t,a),complete:function(){c=!0,s||o&&o.call(i)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var jt=typeof WeakMap=="function"&&We(function(){return navigator.product})!=="ReactNative",Hp=typeof WeakSet=="function",hu=typeof Symbol=="function"&&typeof Symbol.for=="function",jr=hu&&Symbol.asyncIterator,$1=typeof We(function(){return window.document.createElement})=="function",R1=We(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Ko(r){function e(t){Object.defineProperty(r,t,{value:ie})}return hu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Gp(r){return r&&typeof r.then=="function"}var xn=function(r){$e(e,r);function e(t){var i=r.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),xi(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),xi(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?Gp(c)?c.then(function(u){return i.sub=u.subscribe(i.handlers)}):i.sub=c.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),xi(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof t=="function"&&(t=[new ie(t)]),Gp(t)?t.then(function(n){return i.start(n)},i.handlers.error):i.start(t),i}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var i=this.latest[0],n=t[i];n&&n.call(t,this.latest[1]),this.sub===null&&i==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(t,i)}))},e.prototype.beforeNext=function(t){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,t(n,a))})},e}(ie);Ko(xn);function Ur(r){return"incremental"in r}function sy(r){return"hasNext"in r&&"data"in r}function Kp(r){return Ur(r)||sy(r)}function Jo(r,e){var t=r,i=new bt;return Ur(e)&&qe(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}t=i.merge(t,a)}),t}function An(r){var e=Zo(r);return qe(e)}function Zo(r){var e=qe(r.errors)?r.errors.slice(0):[];return Ur(r)&&qe(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function qr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(t[n]=a)})}),t}var Jp=new Map;function Aa(r){var e=Jp.get(r)||1;return Jp.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Zp(r){var e=Aa("stringifyForDisplay");return JSON.stringify(r,function(t,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function Ia(r,e){return qr(r,e,e.variables&&{variables:A(A({},r&&r.variables),e.variables)})}function Yo(r){return new ie(function(e){e.error(r)})}var Ta=function(r,e,t){var i=new Error(t);throw i.name="ServerError",i.response=r,i.statusCode=r.status,i.result=e,i};function mu(r){for(var e=["query","operationName","variables","extensions","context"],t=0,i=Object.keys(r);t<i.length;t++){var n=i[t];if(e.indexOf(n)<0)throw __DEV__?new Z("illegal argument: ".concat(n)):new Z(27)}return r}function gu(r,e){var t=A({},r),i=function(a){typeof a=="function"?t=A(A({},t),a(t)):t=A(A({},t),a)},n=function(){return A({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function yu(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?_n(e.query)||void 0:""),e}function Yp(r,e){return e?e(r):ie.of()}function ka(r){return typeof r=="function"?new Ut(r):r}function Xo(r){return r.request.length<=1}var cy=function(r){$e(e,r);function e(t,i){var n=r.call(this,t)||this;return n.link=i,n}return e}(Error),Ut=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return ie.of()})},r.from=function(e){return e.length===0?r.empty():e.map(ka).reduce(function(t,i){return t.concat(i)})},r.split=function(e,t,i){var n=ka(t),a=ka(i||new r(Yp));return Xo(n)&&Xo(a)?new r(function(o){return e(o)?n.request(o)||ie.of():a.request(o)||ie.of()}):new r(function(o,s){return e(o)?n.request(o,s)||ie.of():a.request(o,s)||ie.of()})},r.execute=function(e,t){return e.request(gu(t.context,yu(mu(t))))||ie.of()},r.concat=function(e,t){var i=ka(e);if(Xo(i))return __DEV__&&L.warn(new cy("You are calling concat on a terminating link, which will have no effect",i)),i;var n=ka(t);return Xo(n)?new r(function(a){return i.request(a,function(o){return n.request(o)||ie.of()})||ie.of()}):new r(function(a,o){return i.request(a,function(s){return n.request(s,o)||ie.of()})||ie.of()})},r.prototype.split=function(e,t,i){return this.concat(r.split(e,t,i||new r(Yp)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new Z("request is not implemented"):new Z(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var In=Ut.execute;var Xp="3.7.10";function ef(r){return!!r.body}function tf(r){return!!r.getReader}function rf(r){return!!(jr&&r[Symbol.asyncIterator])}function nf(r){return!!r.stream}function af(r){return!!r.arrayBuffer}function of(r){return!!r.pipe}function vu(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function bu(r){var e=null,t=null,i=!1,n=[],a=[];function o(d){if(!t){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}n.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){i=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(d,f){if(t)return f(t);if(n.length)return d({value:n.shift(),done:!1});if(i)return d({value:void 0,done:!0});a.push([d,f])})}var l={next:function(){return u()}};return jr&&(l[Symbol.asyncIterator]=function(){return this}),l}function wu(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){r.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return jr&&(t[Symbol.asyncIterator]=function(){return this}),t}function es(r){var e={next:function(){return r.read()}};return jr&&(e[Symbol.asyncIterator]=function(){return this}),e}function sf(r){var e=r;if(ef(r)&&(e=r.body),rf(e))return vu(e);if(tf(e))return es(e.getReader());if(nf(e))return es(e.stream().getReader());if(af(e))return wu(e.arrayBuffer());if(of(e))return bu(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var cf=Object.prototype.hasOwnProperty;function uf(r,e){var t,i,n;return Ht(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h,m,g,w,_,S,b,O,D,E,$;return Gt(this,function(P){switch(P.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=sf(r),f=!0,P.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=P.sent(),h=p.value,m=p.done,g=typeof h=="string"?h:a.decode(h),f=!m,l+=g,w=l.indexOf(u);w>-1;){if(_=void 0,$=[l.slice(0,w),l.slice(w+u.length)],_=$[0],l=$[1],_.trim()){if(S=_.indexOf(`\r
|
|
25
25
|
\r
|
|
26
|
-
`),b=uy(_.slice(0,S)),
|
|
26
|
+
`),b=uy(_.slice(0,S)),O=b["content-type"],O&&O.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");D=_.slice(S);try{E=lf(r,D.replace(`\r
|
|
27
27
|
`,"")),(Object.keys(E).length>1||"data"in E||"incremental"in E||"errors"in E)&&((i=e.next)===null||i===void 0||i.call(e,E))}catch(R){ts(R,e)}}w=l.indexOf(u)}return[3,1];case 3:return(n=e.complete)===null||n===void 0||n.call(e),[2]}})})}function uy(r){var e={};return r.split(`
|
|
28
28
|
`).forEach(function(t){var i=t.indexOf(":");if(i>-1){var n=t.slice(0,i).trim().toLowerCase(),a=t.slice(i+1).trim();e[n]=a}}),e}function lf(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Ta(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(n){var i=n;throw i.name="ServerParseError",i.response=r,i.statusCode=r.status,i.bodyText=e,i}}function ts(r,e){var t,i;r.name!=="AbortError"&&(r.result&&r.result.errors&&r.result.data&&((t=e.next)===null||t===void 0||t.call(e,r.result)),(i=e.error)===null||i===void 0||i.call(e,r))}function pf(r,e,t){ly(e)(r).then(function(i){var n,a;(n=t.next)===null||n===void 0||n.call(t,i),(a=t.complete)===null||a===void 0||a.call(t)}).catch(function(i){return ts(i,t)})}function ly(r){return function(e){return e.text().then(function(t){return lf(e,t)}).then(function(t){return e.status>=300&&Ta(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!cf.call(t,"data")&&!cf.call(t,"errors")&&Ta(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(i){return i.operationName}):r.operationName,"'.")),t})}}var Oa=function(r,e){var t;try{t=JSON.stringify(r)}catch(n){var i=__DEV__?new Z("Network request failed. ".concat(e," is not serializable: ").concat(n.message)):new Z(24);throw i.parseError=n,i}return t};var py={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},fy={accept:"*/*","content-type":"application/json"},dy={method:"POST"},ff={http:py,headers:fy,options:dy},df=function(r,e){return e(r)};function hf(r,e){for(var t=[],i=2;i<arguments.length;i++)t[i-2]=arguments[i];var n={},a={};t.forEach(function(d){n=A(A(A({},n),d.options),{headers:A(A({},n.headers),d.headers)}),d.credentials&&(n.credentials=d.credentials),a=A(A({},a),d.http)}),n.headers&&(n.headers=hy(n.headers,a.preserveHeaderCase));var o=r.operationName,s=r.extensions,c=r.variables,u=r.query,l={operationName:o,variables:c};return a.includeExtensions&&(l.extensions=s),a.includeQuery&&(l.query=e(u,vn)),{options:n,body:l}}function hy(r,e){if(!e){var t=Object.create(null);return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var i=Object.create(null);Object.keys(Object(r)).forEach(function(a){i[a.toLowerCase()]={originalName:a,value:r[a]}});var n=Object.create(null);return Object.keys(i).forEach(function(a){n[i[a].originalName]=i[a].value}),n}var mf=function(r){if(!r&&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:
|
|
@@ -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 Z(23)};var gf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var yf=function(r,e){var t=r.getContext(),i=t.uri;return i||(typeof e=="function"?e(r):e||"/graphql")};function vf(r,e){var t=[],i=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=Oa(e.variables,"Variables map")}catch(d){return{parseError:d}}i("variables",n)}if(e.extensions){var a=void 0;try{a=Oa(e.extensions,"Extensions map")}catch(d){return{parseError:d}}i("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+t.join("&")+o;return{newURI:l}}var bf=We(function(){return fetch}),wf=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,i=r.fetch,n=r.print,a=n===void 0?df:n,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,d=nr(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&mf(i||bf);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Ut(function(p){var h=yf(p,t),m=p.getContext(),y={};if(m.clientAwareness){var w=m.clientAwareness,_=w.name,S=w.version;_&&(y["apollographql-client-name"]=_),S&&(y["apollographql-client-version"]=S)}var b=A(A({},y),m.headers),k={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:b},$=hf(p,a,ff,f,k),E=$.options,D=$.body;if(D.variables&&!l){var P=new Set(Object.keys(D.variables));ot(p.query,{Variable:function(ue,rr,re){re&&re.kind!=="VariableDefinition"&&P.delete(ue.name.value)}}),P.size&&(D.variables=A({},D.variables),P.forEach(function(ue){delete D.variables[ue]}))}var R;if(!E.signal){var M=gf(),Ae=M.controller,oe=M.signal;R=Ae,R&&(E.signal=oe)}var j=function(ue){return ue.kind==="OperationDefinition"&&ue.operation==="mutation"};if(c&&!p.query.definitions.some(j)&&(E.method="GET"),bn(["defer"],p.query)&&(E.headers=E.headers||{},E.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),E.method==="GET"){var we=vf(h,D),_e=we.newURI,ce=we.parseError;if(ce)return Yo(ce);h=_e}else try{E.body=Oa(D,"Payload")}catch(ue){return Yo(ue)}return new ie(function(ue){var rr=i||We(function(){return fetch})||bf;return rr(h,E).then(function(re){var ir;p.setContext({response:re});var Pr=(ir=re.headers)===null||ir===void 0?void 0:ir.get("content-type");return Pr!==null&&/^multipart\/mixed/i.test(Pr)?uf(re,ue):pf(re,p,ue)}).catch(function(re){return ts(re,ue)}),function(){R&&R.abort()}})})};var _u=function(r){De(e,r);function e(t){t===void 0&&(t={});var i=r.call(this,wf(t).request)||this;return i.options=t,i}return e}(Ut);var{toString:_f,hasOwnProperty:my}=Object.prototype,Sf=Function.prototype.toString,Su=new Map;function Ie(r,e){try{return Eu(r,e)}finally{Su.clear()}}function Eu(r,e){if(r===e)return!0;let t=_f.call(r),i=_f.call(e);if(t!==i)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(xf(r,e))return!0;let n=Ef(r),a=Ef(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!my.call(e,n[s]))return!1;for(let s=0;s<o;++s){let c=n[s];if(!Eu(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(xf(r,e))return!0;let n=r.entries(),a=t==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Eu(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let n=r.byteLength;if(n===e.byteLength)for(;n--&&r[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Sf.call(r);return n!==Sf.call(e)?!1:!vy(n,yy)}}return!1}function Ef(r){return Object.keys(r).filter(gy,r)}function gy(r){return this[r]!==void 0}var yy="{ [native code] }";function vy(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function xf(r,e){let t=Su.get(r);if(t){if(t.has(e))return!0}else Su.set(r,t=new Set);return t.add(e),!1}var by=function(){return Object.create(null)},Af=Array.prototype,wy=Af.forEach,_y=Af.slice,sr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=by),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return wy.call(e,function(i){return t=t.getChildTrie(i)}),t.data||(t.data=this.makeData(_y.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Sy(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=t.get(e);return i||t.set(e,i=new r(this.weakness,this.makeData)),i},r}();function Sy(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Xe=null,If={},Ey=1,xy=()=>class{constructor(){this.id=["slot",Ey++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Xe;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===If)break;return e!==Xe&&(Xe.slots[this.id]=t),!0}return Xe&&(Xe.slots[this.id]=If),!1}getValue(){if(this.hasValue())return Xe.slots[this.id]}withValue(e,t,i,n){let a={__proto__:null,[this.id]:e},o=Xe;Xe={parent:o,slots:a};try{return t.apply(n,i)}finally{Xe=o}}static bind(e){let t=Xe;return function(){let i=Xe;try{return Xe=t,e.apply(this,arguments)}finally{Xe=i}}}static noContext(e,t,i){if(Xe){let n=Xe;try{return Xe=null,e.apply(i,t)}finally{Xe=n}}else return e.apply(i,t)}};function Tf(r){try{return r()}catch{}}var xu="@wry/context:Slot",Ay=Tf(()=>globalThis)||Tf(()=>global)||Object.create(null),kf=Ay,Tn=kf[xu]||Array[xu]||function(r){try{Object.defineProperty(kf,xu,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(xy());var{bind:Iy,noContext:Ty}=Tn;function ky(){}var Oy=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=ky),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var i=t.older,n=t.newer;n&&(n.older=i),i&&(i.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},r.prototype.set=function(e,t){var i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),is=new Tn,Au,Cy=Object.prototype.hasOwnProperty,Tu=(Au=Array.from,Au===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Au);function rs(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Ca=[],Ny=100;function kn(r,e){if(!r)throw new Error(e||"assertion failure")}function Dy(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Cf(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function $y(r){return r.slice(0)}var Ry=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Br(this))return Of(this),this.value[0]},r.prototype.recompute=function(e){return kn(!this.recomputing,"already recomputing"),Of(this),Br(this)?Py(this,e):Cf(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,Nf(this),rs(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Lf(this),ku(this,function(t,i){t.setDirty(),Ff(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Ca.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Tu(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Ca.push(this.deps),this.deps=null)},r.count=0,r}();function Of(r){var e=is.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Br(r)?$f(e,r):Rf(e,r),e}function Py(r,e){return Lf(r),is.withValue(r,Ly,[r,e]),My(r,e)&&Fy(r),Cf(r.value)}function Ly(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Br(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function Fy(r){r.dirty=!1,!Br(r)&&Df(r)}function Nf(r){ku(r,$f)}function Df(r){ku(r,Rf)}function ku(r,e){var t=r.parents.size;if(t)for(var i=Tu(r.parents),n=0;n<t;++n)e(i[n],r)}function $f(r,e){kn(r.childValues.has(e)),kn(Br(e));var t=!Br(r);if(!r.dirtyChildren)r.dirtyChildren=Ca.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&Nf(r)}function Rf(r,e){kn(r.childValues.has(e)),kn(!Br(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,$y(e.value)):Dy(t,e.value)||r.setDirty(),Pf(r,e),!Br(r)&&Df(r)}function Pf(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ca.length<Ny&&Ca.push(t),r.dirtyChildren=null))}function Lf(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Ff(r,t)}),r.forgetDeps(),kn(r.dirtyChildren===null)}function Ff(r,e){e.parents.delete(r),r.childValues.delete(e),Pf(r,e)}function My(r,e){if(typeof r.subscribe=="function")try{rs(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var jy={setDirty:!0,dispose:!0,forget:!0};function ns(r){var e=new Map,t=r&&r.subscribe;function i(n){var a=is.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof t=="function"&&(rs(o),o.unsubscribe=t(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Cy.call(jy,o)?o:"setDirty";Tu(s).forEach(function(u){return u[c]()}),e.delete(a),rs(s)}},i}function Mf(){var r=new sr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var mA=Mf(),Iu=new Set;function Ai(r,e){e===void 0&&(e=Object.create(null));var t=new Oy(e.max||Math.pow(2,16),function(u){return u.dispose()}),i=e.keyArgs,n=e.makeCacheKey||Mf(),a=function(){var u=n.apply(null,i?i.apply(null,arguments):arguments);if(u===void 0)return r.apply(null,arguments);var l=t.get(u);l||(t.set(u,l=new Ry(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Iu.add(t),is.hasValue()||(Iu.forEach(function(f){return f.clean()}),Iu.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(u){var l=t.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Ou=function(){function r(){this.getFragmentDoc=Ai(Kc)}return r.prototype.batch=function(e){var t=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(t)},i),n},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(A(A({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(A(A({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,i=e.data,n=nr(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:i}))},r.prototype.writeFragment=function(e){var t=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=nr(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:t,result:i}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var n=i.readQuery(e),a=t(n);return a==null?n:(i.writeQuery(A(A({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var n=i.readFragment(e),a=t(n);return a==null?n:(i.writeFragment(A(A({},e),{data:a})),a)}})},r}();var Na=function(r){De(e,r);function e(t,i,n,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=i,s.query=n,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var $e=Object.prototype.hasOwnProperty;function Da(r){return r==null}function os(r,e){var t=r.__typename,i=r.id,n=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Da(i)?Da(n)?void 0:{_id:n}:{id:i}),Da(i)&&!Da(n)&&(i=n),!Da(i)))return"".concat(t,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var jf={dataIdFromObject:os,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Uf(r){return qr(jf,r)}function ss(r){var e=r.canonizeResults;return e===void 0?jf.canonizeResults:e}function qf(r,e){return ne(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Cu=/^[_a-z][_0-9a-z]*/i;function Zt(r){var e=r.match(Cu);return e?e[0]:r}function as(r,e,t){return le(e)?be(e)?e.every(function(i){return as(r,i,t)}):r.selections.every(function(i){if(It(i)&&Sr(i,t)){var n=Mt(i);return $e.call(e,n)&&(!i.selectionSet||as(i.selectionSet,e[n],t))}return!0}):!1}function Vr(r){return le(r)&&!ne(r)&&!be(r)}function Bf(){return new bt}function cs(r,e){var t=vi(wi(r));return{fragmentMap:t,lookupFragment:function(i){var n=t[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var us=Object.create(null),Nu=function(){return us},Vf=Object.create(null),On=function(){function r(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return xa(ne(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return ne(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return ar(n);if(ne(n))return n;var o=i.policies.identify(n)[0];if(o){var s=ar(o);return a&&i.merge(o,n),s}}}return r.prototype.toObject=function(){return A({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),$e.call(this.data,e)){var i=this.data[e];if(i&&$e.call(i,t))return i[t]}if(t==="__typename"&&$e.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Qr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),$e.call(this.data,e))return this.data[e];if(this instanceof Qr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var i=this,n;ne(e)&&(e=e.__ref),ne(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof t=="string"?this.lookup(n=t):t;if(!!o){__DEV__?L(typeof n=="string","store.merge expects a string ID"):L(typeof n=="string",1);var s=new bt(qy).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(u){if(!a||a[u]!==s[u]){c[u]=1;var l=Zt(u);l!==u&&!i.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(i instanceof Qr)&&delete s[u]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(u){return i.group.dirty(n,u)})}}},r.prototype.modify=function(e,t){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,c={DELETE:us,INVALIDATE:Vf,isReference:ne,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return i.policies.readField(typeof u=="string"?{fieldName:u,from:l||ar(e)}:u,{store:i})}};if(Object.keys(n).forEach(function(u){var l=Zt(u),d=n[u];if(d!==void 0){var f=typeof t=="function"?t:t[u]||t[l];if(f){var p=f===Nu?us:f(xa(d),A(A({},c),{fieldName:l,storeFieldName:u,storage:i.getStorage(e,u)}));p===Vf?i.group.dirty(e,u):(p===us&&(p=void 0),p!==d&&(a[u]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Qr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&i?this.policies.getStoreFieldName({typename:o,fieldName:t,args:i}):t;return this.modify(e,s?(n={},n[s]=Nu,n):Nu)}return!1},r.prototype.evict=function(e,t){var i=!1;return e.id&&($e.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof Qr&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){$e.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(t.__META={extraRootIds:i.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&$e.call(e,a)||t.delete(a)}),e){var i=e.__META,n=nr(e,["__META"]);Object.keys(n).forEach(function(a){t.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Qr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach(function(o){$e.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof Qr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},r.prototype.findChildRefIds=function(e){if(!$e.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var n=new Set([i]);n.forEach(function(a){ne(a)&&(t[a.__ref]=!0),le(a)&&Object.keys(a).forEach(function(o){var s=a[o];le(s)&&n.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Qf=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?ns():null,this.keyMaker=new sr(jt)},r.prototype.depend=function(e,t){if(this.d){this.d(Du(e,t));var i=Zt(t);i!==t&&this.d(Du(e,i)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Du(e,t),t==="__exists"?"forget":"setDirty")},r}();function Du(r,e){return e+"#"+r}function $u(r,e){Ii(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){De(i,t);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,c=n.seed,u=t.call(this,a,new Qf(s))||this;return u.stump=new Uy(u),u.storageTrie=new sr(jt),c&&u.replace(c),u}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(r);r.Root=e})(On||(On={}));var Qr=function(r){De(e,r);function e(t,i,n,a){var o=r.call(this,i.policies,a)||this;return o.id=t,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(t,i){return new e(t,this,i,this.group)},e.prototype.removeLayer=function(t){var i=this,n=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Ie(o[c],s[c])||i.group.dirty(a,c)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){i.group.dirty(a,c)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return A(A({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return $e.call(this.data,t)?A(A({},i),r.prototype.findChildRefIds.call(this,t)):i},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(On),Uy=function(r){De(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Qf(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Qr);function qy(r,e,t){var i=r[t],n=e[t];return Ie(i,n)?i:n}function Ii(r){return!!(r instanceof On&&r.group.caching)}function By(r){return le(r)?be(r)?r.slice(0):A({__proto__:Object.getPrototypeOf(r)},r):r}var ls=function(){function r(){this.known=new(Gp?WeakSet:Set),this.pool=new sr(jt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return le(e)&&this.known.has(e)},r.prototype.pass=function(e){if(le(e)){var t=By(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(le(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),u.sorted.forEach(function(p,h){d[p]=c[l+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var n=JSON.stringify(t);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:t,json:n})}return i.keys},r}();var Tt=Object.assign(function(r){if(le(r)){Ru===void 0&&zf();var e=Ru.admit(r),t=Pu.get(e);return t===void 0&&Pu.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:zf}),Ru,Pu;function zf(){Ru=new ls,Pu=new(jt?WeakMap:Map)}function Wf(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Gf=function(){function r(e){var t=this;this.knownResults=new(jt?WeakMap:Map),this.config=qr(e,{addTypename:e.addTypename!==!1,canonizeResults:ss(e)}),this.canon=e.canon||new ls,this.executeSelectionSet=Ai(function(i){var n,a=i.context.canonizeResults,o=Wf(i);o[3]=!a;var s=(n=t.executeSelectionSet).peek.apply(n,o);return s?a?A(A({},s),{result:t.canon.admit(s.result)}):s:($u(i.context.store,i.enclosingRef.__ref),t.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:Wf,makeCacheKey:function(i,n,a,o){if(Ii(a.store))return a.store.makeCacheKey(i,ne(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=Ai(function(i){return $u(i.context.store,i.enclosingRef.__ref),t.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(Ii(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new ls},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,d=this.config.cache.policies;o=A(A({},Si(_a(i))),o);var f=ar(a),p=this.executeSelectionSet({selectionSet:_i(i).selectionSet,objectOrReference:f,enclosingRef:f,context:A({store:t,query:i,policies:d,variables:o,varString:Tt(o),canonizeResults:l},cs(i,this.config.fragments))}),h;if(p.missing&&(h=[new Na(Vy(p.missing),p.missing,i,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,i,n){if(Ii(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,t,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(ne(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(n,"__typename"),d=[],f,p=new bt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(S,b){var k;return S.missing&&(f=p.merge(f,(k={},k[b]=S.missing,k))),S.result}var m=new Set(i.selections);m.forEach(function(S){var b,k;if(!!Sr(S,s))if(It(S)){var $=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:n},o),E=Mt(S);$===void 0?Ei.added(S)||(f=p.merge(f,(b={},b[E]="Can't find field '".concat(S.name.value,"' on ").concat(ne(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),b))):be($)?$=h(t.executeSubSelectedArray({field:S,array:$,enclosingRef:a,context:o}),E):S.selectionSet?$!=null&&($=h(t.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:$,enclosingRef:ne($)?$:a,context:o}),E)):o.canonizeResults&&($=t.canon.pass($)),$!==void 0&&d.push((k={},k[E]=$,k))}else{var D=bi(S,o.lookupFragment);if(!D&&S.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new Z("No fragment named ".concat(S.name.value)):new Z(5);D&&c.fragmentMatches(D,l)&&D.selectionSet.selections.forEach(m.add,m)}});var y=Sa(d),w={result:y,missing:f},_=o.canonizeResults?this.canon.admit(w):xa(w);return _.result&&this.knownResults.set(_.result,i),_},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,c=new bt;function u(l,d){var f;return l.missing&&(s=c.merge(s,(f={},f[d]=l.missing,f))),l.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(l,d){return l===null?null:be(l)?u(t.executeSubSelectedArray({field:i,array:l,enclosingRef:a,context:o}),d):i.selectionSet?u(t.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:l,enclosingRef:ne(l)?l:a,context:o}),d):(__DEV__&&Qy(o.store,i,l),l)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},r}();function Vy(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function Qy(r,e,t){if(!e.selectionSet){var i=new Set([t]);i.forEach(function(n){le(n)&&(__DEV__?L(!ne(n),"Missing selection set for object of type ".concat(qf(r,n)," returned for query field ").concat(e.name.value)):L(!ne(n),6),Object.values(n).forEach(i.add,i))})}}var Cn=new Tn,Hf=new WeakMap;function $a(r){var e=Hf.get(r);return e||Hf.set(r,e={vars:new Set,dep:ns()}),e}function Lu(r){$a(r).vars.forEach(function(e){return e.forgetCache(r)})}function Kf(r){$a(r).vars.forEach(function(e){return e.attachCache(r)})}function ps(r){var e=new Set,t=new Set,i=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){$a(c).dep.dirty(i),zy(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=Cn.getValue();s&&(n(s),$a(s).dep(i))}return r};i.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var n=i.attachCache=function(a){return e.add(a),$a(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function zy(r){r.broadcastWatches&&r.broadcastWatches()}var Jf=Object.create(null);function Fu(r){var e=JSON.stringify(r);return Jf[e]||(Jf[e]=Object.create(null))}function Mu(r){var e=Fu(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=Uu(r,function(o){var s=Nn(i.storeObject,o,n);return s===void 0&&t!==i.storeObject&&$e.call(t,o[0])&&(s=Nn(t,o,Yf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):L(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function ju(r){var e=Fu(r);return e.keyArgsFn||(e.keyArgsFn=function(t,i){var n=i.field,a=i.variables,o=i.fieldName,s=Uu(r,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(n&&qe(n.directives)){var f=l.slice(1),p=n.directives.find(function(w){return w.name.value===f}),h=p&&Er(p,a);return h&&Nn(h,u.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&$e.call(a,m)){var y=u.slice(0);return y[0]=m,Nn(a,y)}return}if(t)return Nn(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Uu(r,e){var t=new bt;return Zf(r).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=t.merge(i,o)}return i},Object.create(null))}function Zf(r){var e=Fu(r);if(!e.paths){var t=e.paths=[],i=[];r.forEach(function(n,a){be(n)?(Zf(n).forEach(function(o){return t.push(i.concat(o))}),i.length=0):(i.push(n),be(r[a+1])||(t.push(i.slice(0)),i.length=0))})}return e.paths}function Yf(r,e){return r[e]}function Nn(r,e,t){return t=t||Yf,Xf(e.reduce(function i(n,a){return be(n)?n.map(function(o){return i(o,a)}):n&&t(n,a)},r))}function Xf(r){return le(r)?be(r)?r.map(Xf):Uu(Object.keys(r).sort(),function(e){return Nn(r,e)}):r}ba.setStringify(Tt);function qu(r){return r.args!==void 0?r.args:r.field?Er(r.field,r.variables):null}var Wy=function(){},ed=function(r,e){return e.fieldName},td=function(r,e,t){var i=t.mergeObjects;return i(r,e)},rd=function(r,e){return e},nd=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=A({dataIdFromObject:os},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var i,n=this,a=t&&(t.typename||((i=t.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=A(A({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=fs(arguments,o);return n.readField(f,{store:n.cache.data,variables:f.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(be(d))l=Mu(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,c=nr(n,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",i),o&&t.setRootTypename("Mutation",i),s&&t.setRootTypename("Subscription",i),$e.call(t.toBeAdded,i)?t.toBeAdded[i].push(c):t.toBeAdded[i]=[c]})},r.prototype.updateTypePolicy=function(e,t){var i=this,n=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?td:u===!1?rd:c.merge}s(n,t.merge),n.keyFn=a===!1?Wy:be(a)?Mu(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(c){var u=i.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var d=l.keyArgs,f=l.read,p=l.merge;u.keyFn=d===!1?ed:be(d)?ju(d):typeof d=="function"?d:u.keyFn,typeof f=="function"&&(u.read=f),s(u,p)}u.read&&u.merge&&(u.keyFn=u.keyFn||ed)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];t!==n&&(__DEV__?L(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):L(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){t.getSupertypeSet(i,!0),e[i].forEach(function(n){t.getSupertypeSet(n,!0).add(i);var a=n.match(Cu);(!a||a[0]!==n)&&t.fuzzySubtypes.set(n,new RegExp(n))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!$e.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,u=nr(s,["fields"]);Object.assign(i,u),Object.assign(i.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,i){if(e){var n=this.getTypePolicy(e).fields;return n[t]||i&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},r.prototype.fragmentMatches=function(e,t,i,n){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],u=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},l=!!(i&&this.fuzzySubtypes.size),d=!1,f=0;f<c.length;++f){var p=c[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&L.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(u),l&&f===c.length-1&&as(e.selectionSet,i,n)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var y=t.match(h);y&&y[0]===t&&u(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!!(i&&i.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,i=e.fieldName,n=this.getFieldPolicy(t,i,!1),a,o=n&&n.keyFn;if(o&&t)for(var s={typename:t,fieldName:i,field:e.field||null,variables:e.variables},c=qu(e);o;){var u=o(c,s);if(be(u))o=ju(u);else{a=u||i;break}}return a===void 0&&(a=e.field?Zc(e.field,e.variables):ba(i,qu(e))),a===!1?i:i===Zt(a)?a:i+":"+a},r.prototype.readField=function(e,t){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=t.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Zt(o),c=t.store.getFieldValue(i,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=id(this,i,e,t,t.store.getStorage(ne(i)?i.__ref:i,o));return Cn.withValue(this.cache,l,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},r.prototype.getMergeFunction=function(e,t,i){var n=this.getFieldPolicy(e,t,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},r.prototype.runMergeFunction=function(e,t,i,n,a){var o=i.field,s=i.typename,c=i.merge;return c===td?ad(n.store)(e,t):c===rd?t:(n.overwrite&&(e=void 0),c(e,t,id(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},r}();function id(r,e,t,i,n){var a=r.getStoreFieldName(t),o=Zt(a),s=t.variables||i.variables,c=i.store,u=c.toReference,l=c.canRead;return{args:qu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ne,toReference:u,storage:n,cache:r.cache,canRead:l,readField:function(){return r.readField(fs(arguments,e,s),i)},mergeObjects:ad(i.store)}}function fs(r,e,t){var i=r[0],n=r[1],a=r.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=A({},i),$e.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Zp(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function ad(r){return function(t,i){if(be(t)||be(i))throw __DEV__?new Z("Cannot automatically merge arrays"):new Z(4);if(le(t)&&le(i)){var n=r.getFieldValue(t,"__typename"),a=r.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(ne(t)&&Vr(i))return r.merge(t.__ref,i),t;if(Vr(t)&&ne(i))return r.merge(t,i.__ref),i;if(Vr(t)&&Vr(i))return A(A({},t),i)}return i}}function Bu(r,e,t){var i="".concat(e).concat(t),n=r.flavors.get(i);return n||r.flavors.set(i,n=r.clientOnly===e&&r.deferred===t?r:A(A({},r),{clientOnly:e,deferred:t})),n}var ud=function(){function r(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return r.prototype.writeToStore=function(e,t){var i=this,n=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,u=or(n),l=Bf();s=A(A({},Si(u)),s);var d=A(A({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:Tt(s)},cs(n,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:d});if(!ne(f))throw __DEV__?new Z("Could not identify object ".concat(JSON.stringify(a))):new Z(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,y=p.mergeTree,w=p.fieldNodeSet,_=ar(h);if(y&&y.map.size){var S=i.applyMerges(y,_,m,d);if(ne(S))return;m=S}if(__DEV__&&!d.overwrite){var b=Object.create(null);w.forEach(function(E){E.selectionSet&&(b[E.name.value]=!0)});var k=function(E){return b[Zt(E)]===!0},$=function(E){var D=y&&y.map.get(E);return Boolean(D&&D.info&&D.info.merge)};Object.keys(m).forEach(function(E){k(E)&&!$(E)&&Gy(_,m,E,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=i&&c.rootTypenamesById[i]||wa(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof l=="string"&&(u.__typename=l);var d=function(){var S=fs(arguments,u,o.variables);if(ne(S.from)){var b=o.incomingById.get(S.from.__ref);if(b){var k=c.readField(A(A({},S),{from:b.storeObject}),o);if(k!==void 0)return k}}return c.readField(S,o)},f=new Set;this.flattenFields(a,n,o,l).forEach(function(S,b){var k,$=Mt(b),E=n[$];if(f.add(b),E!==void 0){var D=c.getStoreFieldName({typename:l,fieldName:b.name.value,field:b,variables:S.variables}),P=od(s,D),R=t.processFieldValue(E,b,b.selectionSet?Bu(S,!1,!1):S,P),M=void 0;b.selectionSet&&(ne(R)||Vr(R))&&(M=d("__typename",R));var Ae=c.getMergeFunction(l,b.name.value,M);Ae?P.info={field:b,typename:l,merge:Ae}:sd(s,D),u=S.merge(u,(k={},k[D]=R,k))}else __DEV__&&!S.clientOnly&&!S.deferred&&!Ei.added(b)&&!c.getReadFunction(l,b.name.value)&&__DEV__&&L.error("Missing field '".concat(Mt(b),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=c.identify(n,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:d}),h=p[0],m=p[1];i=i||h,m&&(u=o.merge(u,m))}catch(S){if(!i)throw S}if(typeof i=="string"){var y=ar(i),w=o.written[i]||(o.written[i]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(n,y,a,o)))return y;var _=o.incomingById.get(i);return _?(_.storeObject=o.merge(_.storeObject,u),_.mergeTree=Vu(_.mergeTree,s),f.forEach(function(S){return _.fieldNodeSet.add(S)})):o.incomingById.set(i,{storeObject:u,mergeTree:ds(s)?void 0:s,fieldNodeSet:f}),y}return u},r.prototype.processFieldValue=function(e,t,i,n){var a=this;return!t.selectionSet||e===null?__DEV__?Go(e):e:be(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,i,od(n,s));return sd(n,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:n})},r.prototype.flattenFields=function(e,t,i,n){n===void 0&&(n=wa(t,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new sr(!1);return function c(u,l){var d=s.lookup(u,l.clientOnly,l.deferred);d.visited||(d.visited=!0,u.selections.forEach(function(f){if(!!Sr(f,i.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&qe(f.directives)&&f.directives.forEach(function(w){var _=w.name.value;if(_==="client"&&(p=!0),_==="defer"){var S=Er(w,i.variables);(!S||S.if!==!1)&&(h=!0)}}),It(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Bu(i,p,h))}else{var y=bi(f,i.lookupFragment);if(!y&&f.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new Z("No fragment named ".concat(f.name.value)):new Z(8);y&&o.fragmentMatches(y,n,t,i.variables)&&c(y.selectionSet,Bu(i,p,h))}}}))}(e,i),a},r.prototype.applyMerges=function(e,t,i,n,a){var o,s=this;if(e.map.size&&!ne(i)){var c=!be(i)&&(ne(t)||Vr(t))?t:void 0,u=i;c&&!a&&(a=[ne(c)?c.__ref:c]);var l,d=function(f,p){return be(f)?typeof p=="number"?f[p]:void 0:n.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(c,p),m=d(u,p);if(m!==void 0){a&&a.push(p);var y=s.applyMerges(f,h,m,n,a);y!==m&&(l=l||new Map,l.set(p,y)),a&&L(a.pop()===p)}}),l&&(i=be(u)?u.slice(0):A({},u),l.forEach(function(f,p){i[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},r}();var ld=[];function od(r,e){var t=r.map;return t.has(e)||t.set(e,ld.pop()||{map:new Map}),t.get(e)}function Vu(r,e){if(r===e||!e||ds(e))return r;if(!r||ds(r))return e;var t=r.info&&e.info?A(A({},r.info),e.info):r.info||e.info,i=r.map.size&&e.map.size,n=i?new Map:r.map.size?r.map:e.map,a={info:t,map:n};if(i){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Vu(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Vu(e.map.get(s),r.map.get(s)))})}return a}function ds(r){return!r||!(r.info||r.map.size)}function sd(r,e){var t=r.map,i=t.get(e);i&&ds(i)&&(ld.push(i),t.delete(e))}var cd=new Set;function Gy(r,e,t,i){var n=function(d){var f=i.getFieldValue(d,t);return typeof f=="object"&&f},a=n(r);if(!!a){var o=n(e);if(!!o&&!ne(a)&&!Ie(a,o)&&!Object.keys(a).every(function(d){return i.getFieldValue(o,d)!==void 0})){var s=i.getFieldValue(r,"__typename")||i.getFieldValue(e,"__typename"),c=Zt(t),u="".concat(s,".").concat(c);if(!cd.has(u)){cd.add(u);var l=[];!be(a)&&!be(o)&&[a,o].forEach(function(d){var f=i.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
|
|
36
|
+
`):new Z(23)};var gf=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var yf=function(r,e){var t=r.getContext(),i=t.uri;return i||(typeof e=="function"?e(r):e||"/graphql")};function vf(r,e){var t=[],i=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=Oa(e.variables,"Variables map")}catch(d){return{parseError:d}}i("variables",n)}if(e.extensions){var a=void 0;try{a=Oa(e.extensions,"Extensions map")}catch(d){return{parseError:d}}i("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+t.join("&")+o;return{newURI:l}}var bf=We(function(){return fetch}),wf=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,i=r.fetch,n=r.print,a=n===void 0?df:n,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,d=nr(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&mf(i||bf);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Ut(function(p){var h=yf(p,t),m=p.getContext(),g={};if(m.clientAwareness){var w=m.clientAwareness,_=w.name,S=w.version;_&&(g["apollographql-client-name"]=_),S&&(g["apollographql-client-version"]=S)}var b=A(A({},g),m.headers),O={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:b},D=hf(p,a,ff,f,O),E=D.options,$=D.body;if($.variables&&!l){var P=new Set(Object.keys($.variables));ot(p.query,{Variable:function(le,rr,re){re&&re.kind!=="VariableDefinition"&&P.delete(le.name.value)}}),P.size&&($.variables=A({},$.variables),P.forEach(function(le){delete $.variables[le]}))}var R;if(!E.signal){var M=gf(),Ae=M.controller,se=M.signal;R=Ae,R&&(E.signal=se)}var j=function(le){return le.kind==="OperationDefinition"&&le.operation==="mutation"};if(c&&!p.query.definitions.some(j)&&(E.method="GET"),bn(["defer"],p.query)&&(E.headers=E.headers||{},E.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),E.method==="GET"){var we=vf(h,$),_e=we.newURI,ue=we.parseError;if(ue)return Yo(ue);h=_e}else try{E.body=Oa($,"Payload")}catch(le){return Yo(le)}return new ie(function(le){var rr=i||We(function(){return fetch})||bf;return rr(h,E).then(function(re){var ir;p.setContext({response:re});var Pr=(ir=re.headers)===null||ir===void 0?void 0:ir.get("content-type");return Pr!==null&&/^multipart\/mixed/i.test(Pr)?uf(re,le):pf(re,p,le)}).catch(function(re){return ts(re,le)}),function(){R&&R.abort()}})})};var _u=function(r){$e(e,r);function e(t){t===void 0&&(t={});var i=r.call(this,wf(t).request)||this;return i.options=t,i}return e}(Ut);var{toString:_f,hasOwnProperty:my}=Object.prototype,Sf=Function.prototype.toString,Su=new Map;function Ie(r,e){try{return Eu(r,e)}finally{Su.clear()}}function Eu(r,e){if(r===e)return!0;let t=_f.call(r),i=_f.call(e);if(t!==i)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(xf(r,e))return!0;let n=Ef(r),a=Ef(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!my.call(e,n[s]))return!1;for(let s=0;s<o;++s){let c=n[s];if(!Eu(r[c],e[c]))return!1}return!0}case"[object Error]":return r.name===e.name&&r.message===e.message;case"[object Number]":if(r!==r)return e!==e;case"[object Boolean]":case"[object Date]":return+r==+e;case"[object RegExp]":case"[object String]":return r==`${e}`;case"[object Map]":case"[object Set]":{if(r.size!==e.size)return!1;if(xf(r,e))return!0;let n=r.entries(),a=t==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Eu(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let n=r.byteLength;if(n===e.byteLength)for(;n--&&r[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Sf.call(r);return n!==Sf.call(e)?!1:!vy(n,yy)}}return!1}function Ef(r){return Object.keys(r).filter(gy,r)}function gy(r){return this[r]!==void 0}var yy="{ [native code] }";function vy(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function xf(r,e){let t=Su.get(r);if(t){if(t.has(e))return!0}else Su.set(r,t=new Set);return t.add(e),!1}var by=function(){return Object.create(null)},Af=Array.prototype,wy=Af.forEach,_y=Af.slice,sr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=by),this.weakness=e,this.makeData=t}return r.prototype.lookup=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this.lookupArray(e)},r.prototype.lookupArray=function(e){var t=this;return wy.call(e,function(i){return t=t.getChildTrie(i)}),t.data||(t.data=this.makeData(_y.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Sy(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=t.get(e);return i||t.set(e,i=new r(this.weakness,this.makeData)),i},r}();function Sy(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Xe=null,If={},Ey=1,xy=()=>class{constructor(){this.id=["slot",Ey++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Xe;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===If)break;return e!==Xe&&(Xe.slots[this.id]=t),!0}return Xe&&(Xe.slots[this.id]=If),!1}getValue(){if(this.hasValue())return Xe.slots[this.id]}withValue(e,t,i,n){let a={__proto__:null,[this.id]:e},o=Xe;Xe={parent:o,slots:a};try{return t.apply(n,i)}finally{Xe=o}}static bind(e){let t=Xe;return function(){let i=Xe;try{return Xe=t,e.apply(this,arguments)}finally{Xe=i}}}static noContext(e,t,i){if(Xe){let n=Xe;try{return Xe=null,e.apply(i,t)}finally{Xe=n}}else return e.apply(i,t)}};function Tf(r){try{return r()}catch{}}var xu="@wry/context:Slot",Ay=Tf(()=>globalThis)||Tf(()=>global)||Object.create(null),kf=Ay,Tn=kf[xu]||Array[xu]||function(r){try{Object.defineProperty(kf,xu,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(xy());var{bind:Iy,noContext:Ty}=Tn;function ky(){}var Oy=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=ky),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var i=t.older,n=t.newer;n&&(n.older=i),i&&(i.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},r.prototype.set=function(e,t){var i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),is=new Tn,Au,Cy=Object.prototype.hasOwnProperty,Tu=(Au=Array.from,Au===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Au);function rs(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Ca=[],Ny=100;function kn(r,e){if(!r)throw new Error(e||"assertion failure")}function Dy(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Cf(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function $y(r){return r.slice(0)}var Ry=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Br(this))return Of(this),this.value[0]},r.prototype.recompute=function(e){return kn(!this.recomputing,"already recomputing"),Of(this),Br(this)?Py(this,e):Cf(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,Nf(this),rs(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Lf(this),ku(this,function(t,i){t.setDirty(),Ff(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Ca.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Tu(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Ca.push(this.deps),this.deps=null)},r.count=0,r}();function Of(r){var e=is.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Br(r)?$f(e,r):Rf(e,r),e}function Py(r,e){return Lf(r),is.withValue(r,Ly,[r,e]),My(r,e)&&Fy(r),Cf(r.value)}function Ly(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Br(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function Fy(r){r.dirty=!1,!Br(r)&&Df(r)}function Nf(r){ku(r,$f)}function Df(r){ku(r,Rf)}function ku(r,e){var t=r.parents.size;if(t)for(var i=Tu(r.parents),n=0;n<t;++n)e(i[n],r)}function $f(r,e){kn(r.childValues.has(e)),kn(Br(e));var t=!Br(r);if(!r.dirtyChildren)r.dirtyChildren=Ca.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&Nf(r)}function Rf(r,e){kn(r.childValues.has(e)),kn(!Br(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,$y(e.value)):Dy(t,e.value)||r.setDirty(),Pf(r,e),!Br(r)&&Df(r)}function Pf(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ca.length<Ny&&Ca.push(t),r.dirtyChildren=null))}function Lf(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Ff(r,t)}),r.forgetDeps(),kn(r.dirtyChildren===null)}function Ff(r,e){e.parents.delete(r),r.childValues.delete(e),Pf(r,e)}function My(r,e){if(typeof r.subscribe=="function")try{rs(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var jy={setDirty:!0,dispose:!0,forget:!0};function ns(r){var e=new Map,t=r&&r.subscribe;function i(n){var a=is.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof t=="function"&&(rs(o),o.unsubscribe=t(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Cy.call(jy,o)?o:"setDirty";Tu(s).forEach(function(u){return u[c]()}),e.delete(a),rs(s)}},i}function Mf(){var r=new sr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var mA=Mf(),Iu=new Set;function Ai(r,e){e===void 0&&(e=Object.create(null));var t=new Oy(e.max||Math.pow(2,16),function(u){return u.dispose()}),i=e.keyArgs,n=e.makeCacheKey||Mf(),a=function(){var u=n.apply(null,i?i.apply(null,arguments):arguments);if(u===void 0)return r.apply(null,arguments);var l=t.get(u);l||(t.set(u,l=new Ry(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Iu.add(t),is.hasValue()||(Iu.forEach(function(f){return f.clean()}),Iu.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(u){var l=t.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Ou=function(){function r(){this.getFragmentDoc=Ai(Kc)}return r.prototype.batch=function(e){var t=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(t)},i),n},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(A(A({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(A(A({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,i=e.data,n=nr(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:i}))},r.prototype.writeFragment=function(e){var t=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=nr(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:t,result:i}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var n=i.readQuery(e),a=t(n);return a==null?n:(i.writeQuery(A(A({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var n=i.readFragment(e),a=t(n);return a==null?n:(i.writeFragment(A(A({},e),{data:a})),a)}})},r}();var Na=function(r){$e(e,r);function e(t,i,n,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=i,s.query=n,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var Re=Object.prototype.hasOwnProperty;function Da(r){return r==null}function os(r,e){var t=r.__typename,i=r.id,n=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Da(i)?Da(n)?void 0:{_id:n}:{id:i}),Da(i)&&!Da(n)&&(i=n),!Da(i)))return"".concat(t,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var jf={dataIdFromObject:os,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Uf(r){return qr(jf,r)}function ss(r){var e=r.canonizeResults;return e===void 0?jf.canonizeResults:e}function qf(r,e){return ne(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Cu=/^[_a-z][_0-9a-z]*/i;function Zt(r){var e=r.match(Cu);return e?e[0]:r}function as(r,e,t){return pe(e)?be(e)?e.every(function(i){return as(r,i,t)}):r.selections.every(function(i){if(It(i)&&Sr(i,t)){var n=Mt(i);return Re.call(e,n)&&(!i.selectionSet||as(i.selectionSet,e[n],t))}return!0}):!1}function Vr(r){return pe(r)&&!ne(r)&&!be(r)}function Bf(){return new bt}function cs(r,e){var t=vi(wi(r));return{fragmentMap:t,lookupFragment:function(i){var n=t[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var us=Object.create(null),Nu=function(){return us},Vf=Object.create(null),On=function(){function r(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return xa(ne(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return ne(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return ar(n);if(ne(n))return n;var o=i.policies.identify(n)[0];if(o){var s=ar(o);return a&&i.merge(o,n),s}}}return r.prototype.toObject=function(){return A({},this.data)},r.prototype.has=function(e){return this.lookup(e,!0)!==void 0},r.prototype.get=function(e,t){if(this.group.depend(e,t),Re.call(this.data,e)){var i=this.data[e];if(i&&Re.call(i,t))return i[t]}if(t==="__typename"&&Re.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Qr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Re.call(this.data,e))return this.data[e];if(this instanceof Qr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var i=this,n;ne(e)&&(e=e.__ref),ne(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof t=="string"?this.lookup(n=t):t;if(!!o){__DEV__?L(typeof n=="string","store.merge expects a string ID"):L(typeof n=="string",1);var s=new bt(qy).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(u){if(!a||a[u]!==s[u]){c[u]=1;var l=Zt(u);l!==u&&!i.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(i instanceof Qr)&&delete s[u]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(u){return i.group.dirty(n,u)})}}},r.prototype.modify=function(e,t){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,c={DELETE:us,INVALIDATE:Vf,isReference:ne,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return i.policies.readField(typeof u=="string"?{fieldName:u,from:l||ar(e)}:u,{store:i})}};if(Object.keys(n).forEach(function(u){var l=Zt(u),d=n[u];if(d!==void 0){var f=typeof t=="function"?t:t[u]||t[l];if(f){var p=f===Nu?us:f(xa(d),A(A({},c),{fieldName:l,storeFieldName:u,storage:i.getStorage(e,u)}));p===Vf?i.group.dirty(e,u):(p===us&&(p=void 0),p!==d&&(a[u]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Qr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&i?this.policies.getStoreFieldName({typename:o,fieldName:t,args:i}):t;return this.modify(e,s?(n={},n[s]=Nu,n):Nu)}return!1},r.prototype.evict=function(e,t){var i=!1;return e.id&&(Re.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof Qr&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){Re.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(t.__META={extraRootIds:i.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&Re.call(e,a)||t.delete(a)}),e){var i=e.__META,n=nr(e,["__META"]);Object.keys(n).forEach(function(a){t.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Qr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach(function(o){Re.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof Qr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},r.prototype.findChildRefIds=function(e){if(!Re.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var n=new Set([i]);n.forEach(function(a){ne(a)&&(t[a.__ref]=!0),pe(a)&&Object.keys(a).forEach(function(o){var s=a[o];pe(s)&&n.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Qf=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?ns():null,this.keyMaker=new sr(jt)},r.prototype.depend=function(e,t){if(this.d){this.d(Du(e,t));var i=Zt(t);i!==t&&this.d(Du(e,i)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Du(e,t),t==="__exists"?"forget":"setDirty")},r}();function Du(r,e){return e+"#"+r}function $u(r,e){Ii(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){$e(i,t);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,c=n.seed,u=t.call(this,a,new Qf(s))||this;return u.stump=new Uy(u),u.storageTrie=new sr(jt),c&&u.replace(c),u}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(r);r.Root=e})(On||(On={}));var Qr=function(r){$e(e,r);function e(t,i,n,a){var o=r.call(this,i.policies,a)||this;return o.id=t,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(t,i){return new e(t,this,i,this.group)},e.prototype.removeLayer=function(t){var i=this,n=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Ie(o[c],s[c])||i.group.dirty(a,c)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){i.group.dirty(a,c)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return A(A({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return Re.call(this.data,t)?A(A({},i),r.prototype.findChildRefIds.call(this,t)):i},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(On),Uy=function(r){$e(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Qf(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Qr);function qy(r,e,t){var i=r[t],n=e[t];return Ie(i,n)?i:n}function Ii(r){return!!(r instanceof On&&r.group.caching)}function By(r){return pe(r)?be(r)?r.slice(0):A({__proto__:Object.getPrototypeOf(r)},r):r}var ls=function(){function r(){this.known=new(Hp?WeakSet:Set),this.pool=new sr(jt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return pe(e)&&this.known.has(e)},r.prototype.pass=function(e){if(pe(e)){var t=By(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(pe(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),u.sorted.forEach(function(p,h){d[p]=c[l+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var n=JSON.stringify(t);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:t,json:n})}return i.keys},r}();var Tt=Object.assign(function(r){if(pe(r)){Ru===void 0&&zf();var e=Ru.admit(r),t=Pu.get(e);return t===void 0&&Pu.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:zf}),Ru,Pu;function zf(){Ru=new ls,Pu=new(jt?WeakMap:Map)}function Wf(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Hf=function(){function r(e){var t=this;this.knownResults=new(jt?WeakMap:Map),this.config=qr(e,{addTypename:e.addTypename!==!1,canonizeResults:ss(e)}),this.canon=e.canon||new ls,this.executeSelectionSet=Ai(function(i){var n,a=i.context.canonizeResults,o=Wf(i);o[3]=!a;var s=(n=t.executeSelectionSet).peek.apply(n,o);return s?a?A(A({},s),{result:t.canon.admit(s.result)}):s:($u(i.context.store,i.enclosingRef.__ref),t.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:Wf,makeCacheKey:function(i,n,a,o){if(Ii(a.store))return a.store.makeCacheKey(i,ne(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=Ai(function(i){return $u(i.context.store,i.enclosingRef.__ref),t.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(Ii(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new ls},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,d=this.config.cache.policies;o=A(A({},Si(_a(i))),o);var f=ar(a),p=this.executeSelectionSet({selectionSet:_i(i).selectionSet,objectOrReference:f,enclosingRef:f,context:A({store:t,query:i,policies:d,variables:o,varString:Tt(o),canonizeResults:l},cs(i,this.config.fragments))}),h;if(p.missing&&(h=[new Na(Vy(p.missing),p.missing,i,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,i,n){if(Ii(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,t,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(ne(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(n,"__typename"),d=[],f,p=new bt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(S,b){var O;return S.missing&&(f=p.merge(f,(O={},O[b]=S.missing,O))),S.result}var m=new Set(i.selections);m.forEach(function(S){var b,O;if(!!Sr(S,s))if(It(S)){var D=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:n},o),E=Mt(S);D===void 0?Ei.added(S)||(f=p.merge(f,(b={},b[E]="Can't find field '".concat(S.name.value,"' on ").concat(ne(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),b))):be(D)?D=h(t.executeSubSelectedArray({field:S,array:D,enclosingRef:a,context:o}),E):S.selectionSet?D!=null&&(D=h(t.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:D,enclosingRef:ne(D)?D:a,context:o}),E)):o.canonizeResults&&(D=t.canon.pass(D)),D!==void 0&&d.push((O={},O[E]=D,O))}else{var $=bi(S,o.lookupFragment);if(!$&&S.kind===je.FRAGMENT_SPREAD)throw __DEV__?new Z("No fragment named ".concat(S.name.value)):new Z(5);$&&c.fragmentMatches($,l)&&$.selectionSet.selections.forEach(m.add,m)}});var g=Sa(d),w={result:g,missing:f},_=o.canonizeResults?this.canon.admit(w):xa(w);return _.result&&this.knownResults.set(_.result,i),_},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,c=new bt;function u(l,d){var f;return l.missing&&(s=c.merge(s,(f={},f[d]=l.missing,f))),l.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(l,d){return l===null?null:be(l)?u(t.executeSubSelectedArray({field:i,array:l,enclosingRef:a,context:o}),d):i.selectionSet?u(t.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:l,enclosingRef:ne(l)?l:a,context:o}),d):(__DEV__&&Qy(o.store,i,l),l)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},r}();function Vy(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function Qy(r,e,t){if(!e.selectionSet){var i=new Set([t]);i.forEach(function(n){pe(n)&&(__DEV__?L(!ne(n),"Missing selection set for object of type ".concat(qf(r,n)," returned for query field ").concat(e.name.value)):L(!ne(n),6),Object.values(n).forEach(i.add,i))})}}var Cn=new Tn,Gf=new WeakMap;function $a(r){var e=Gf.get(r);return e||Gf.set(r,e={vars:new Set,dep:ns()}),e}function Lu(r){$a(r).vars.forEach(function(e){return e.forgetCache(r)})}function Kf(r){$a(r).vars.forEach(function(e){return e.attachCache(r)})}function ps(r){var e=new Set,t=new Set,i=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){$a(c).dep.dirty(i),zy(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=Cn.getValue();s&&(n(s),$a(s).dep(i))}return r};i.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var n=i.attachCache=function(a){return e.add(a),$a(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function zy(r){r.broadcastWatches&&r.broadcastWatches()}var Jf=Object.create(null);function Fu(r){var e=JSON.stringify(r);return Jf[e]||(Jf[e]=Object.create(null))}function Mu(r){var e=Fu(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=Uu(r,function(o){var s=Nn(i.storeObject,o,n);return s===void 0&&t!==i.storeObject&&Re.call(t,o[0])&&(s=Nn(t,o,Yf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):L(s!==void 0,2),s});return"".concat(i.typename,":").concat(JSON.stringify(a))})}function ju(r){var e=Fu(r);return e.keyArgsFn||(e.keyArgsFn=function(t,i){var n=i.field,a=i.variables,o=i.fieldName,s=Uu(r,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(n&&qe(n.directives)){var f=l.slice(1),p=n.directives.find(function(w){return w.name.value===f}),h=p&&Er(p,a);return h&&Nn(h,u.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&Re.call(a,m)){var g=u.slice(0);return g[0]=m,Nn(a,g)}return}if(t)return Nn(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Uu(r,e){var t=new bt;return Zf(r).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=t.merge(i,o)}return i},Object.create(null))}function Zf(r){var e=Fu(r);if(!e.paths){var t=e.paths=[],i=[];r.forEach(function(n,a){be(n)?(Zf(n).forEach(function(o){return t.push(i.concat(o))}),i.length=0):(i.push(n),be(r[a+1])||(t.push(i.slice(0)),i.length=0))})}return e.paths}function Yf(r,e){return r[e]}function Nn(r,e,t){return t=t||Yf,Xf(e.reduce(function i(n,a){return be(n)?n.map(function(o){return i(o,a)}):n&&t(n,a)},r))}function Xf(r){return pe(r)?be(r)?r.map(Xf):Uu(Object.keys(r).sort(),function(e){return Nn(r,e)}):r}ba.setStringify(Tt);function qu(r){return r.args!==void 0?r.args:r.field?Er(r.field,r.variables):null}var Wy=function(){},ed=function(r,e){return e.fieldName},td=function(r,e,t){var i=t.mergeObjects;return i(r,e)},rd=function(r,e){return e},nd=function(){function r(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=A({dataIdFromObject:os},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var i,n=this,a=t&&(t.typename||((i=t.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=A(A({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=fs(arguments,o);return n.readField(f,{store:n.cache.data,variables:f.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(be(d))l=Mu(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,c=nr(n,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",i),o&&t.setRootTypename("Mutation",i),s&&t.setRootTypename("Subscription",i),Re.call(t.toBeAdded,i)?t.toBeAdded[i].push(c):t.toBeAdded[i]=[c]})},r.prototype.updateTypePolicy=function(e,t){var i=this,n=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?td:u===!1?rd:c.merge}s(n,t.merge),n.keyFn=a===!1?Wy:be(a)?Mu(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(c){var u=i.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var d=l.keyArgs,f=l.read,p=l.merge;u.keyFn=d===!1?ed:be(d)?ju(d):typeof d=="function"?d:u.keyFn,typeof f=="function"&&(u.read=f),s(u,p)}u.read&&u.merge&&(u.keyFn=u.keyFn||ed)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];t!==n&&(__DEV__?L(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):L(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){t.getSupertypeSet(i,!0),e[i].forEach(function(n){t.getSupertypeSet(n,!0).add(i);var a=n.match(Cu);(!a||a[0]!==n)&&t.fuzzySubtypes.set(n,new RegExp(n))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Re.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,u=nr(s,["fields"]);Object.assign(i,u),Object.assign(i.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,i){if(e){var n=this.getTypePolicy(e).fields;return n[t]||i&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},r.prototype.fragmentMatches=function(e,t,i,n){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],u=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},l=!!(i&&this.fuzzySubtypes.size),d=!1,f=0;f<c.length;++f){var p=c[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&L.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(u),l&&f===c.length-1&&as(e.selectionSet,i,n)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var g=t.match(h);g&&g[0]===t&&u(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!!(i&&i.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,i=e.fieldName,n=this.getFieldPolicy(t,i,!1),a,o=n&&n.keyFn;if(o&&t)for(var s={typename:t,fieldName:i,field:e.field||null,variables:e.variables},c=qu(e);o;){var u=o(c,s);if(be(u))o=ju(u);else{a=u||i;break}}return a===void 0&&(a=e.field?Zc(e.field,e.variables):ba(i,qu(e))),a===!1?i:i===Zt(a)?a:i+":"+a},r.prototype.readField=function(e,t){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=t.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Zt(o),c=t.store.getFieldValue(i,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=id(this,i,e,t,t.store.getStorage(ne(i)?i.__ref:i,o));return Cn.withValue(this.cache,l,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},r.prototype.getMergeFunction=function(e,t,i){var n=this.getFieldPolicy(e,t,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},r.prototype.runMergeFunction=function(e,t,i,n,a){var o=i.field,s=i.typename,c=i.merge;return c===td?ad(n.store)(e,t):c===rd?t:(n.overwrite&&(e=void 0),c(e,t,id(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},r}();function id(r,e,t,i,n){var a=r.getStoreFieldName(t),o=Zt(a),s=t.variables||i.variables,c=i.store,u=c.toReference,l=c.canRead;return{args:qu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ne,toReference:u,storage:n,cache:r.cache,canRead:l,readField:function(){return r.readField(fs(arguments,e,s),i)},mergeObjects:ad(i.store)}}function fs(r,e,t){var i=r[0],n=r[1],a=r.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=A({},i),Re.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Zp(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function ad(r){return function(t,i){if(be(t)||be(i))throw __DEV__?new Z("Cannot automatically merge arrays"):new Z(4);if(pe(t)&&pe(i)){var n=r.getFieldValue(t,"__typename"),a=r.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(ne(t)&&Vr(i))return r.merge(t.__ref,i),t;if(Vr(t)&&ne(i))return r.merge(t,i.__ref),i;if(Vr(t)&&Vr(i))return A(A({},t),i)}return i}}function Bu(r,e,t){var i="".concat(e).concat(t),n=r.flavors.get(i);return n||r.flavors.set(i,n=r.clientOnly===e&&r.deferred===t?r:A(A({},r),{clientOnly:e,deferred:t})),n}var ud=function(){function r(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return r.prototype.writeToStore=function(e,t){var i=this,n=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,u=or(n),l=Bf();s=A(A({},Si(u)),s);var d=A(A({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:Tt(s)},cs(n,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:d});if(!ne(f))throw __DEV__?new Z("Could not identify object ".concat(JSON.stringify(a))):new Z(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,g=p.mergeTree,w=p.fieldNodeSet,_=ar(h);if(g&&g.map.size){var S=i.applyMerges(g,_,m,d);if(ne(S))return;m=S}if(__DEV__&&!d.overwrite){var b=Object.create(null);w.forEach(function(E){E.selectionSet&&(b[E.name.value]=!0)});var O=function(E){return b[Zt(E)]===!0},D=function(E){var $=g&&g.map.get(E);return Boolean($&&$.info&&$.info.merge)};Object.keys(m).forEach(function(E){O(E)&&!D(E)&&Hy(_,m,E,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=i&&c.rootTypenamesById[i]||wa(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof l=="string"&&(u.__typename=l);var d=function(){var S=fs(arguments,u,o.variables);if(ne(S.from)){var b=o.incomingById.get(S.from.__ref);if(b){var O=c.readField(A(A({},S),{from:b.storeObject}),o);if(O!==void 0)return O}}return c.readField(S,o)},f=new Set;this.flattenFields(a,n,o,l).forEach(function(S,b){var O,D=Mt(b),E=n[D];if(f.add(b),E!==void 0){var $=c.getStoreFieldName({typename:l,fieldName:b.name.value,field:b,variables:S.variables}),P=od(s,$),R=t.processFieldValue(E,b,b.selectionSet?Bu(S,!1,!1):S,P),M=void 0;b.selectionSet&&(ne(R)||Vr(R))&&(M=d("__typename",R));var Ae=c.getMergeFunction(l,b.name.value,M);Ae?P.info={field:b,typename:l,merge:Ae}:sd(s,$),u=S.merge(u,(O={},O[$]=R,O))}else __DEV__&&!S.clientOnly&&!S.deferred&&!Ei.added(b)&&!c.getReadFunction(l,b.name.value)&&__DEV__&&L.error("Missing field '".concat(Mt(b),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=c.identify(n,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:d}),h=p[0],m=p[1];i=i||h,m&&(u=o.merge(u,m))}catch(S){if(!i)throw S}if(typeof i=="string"){var g=ar(i),w=o.written[i]||(o.written[i]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(n,g,a,o)))return g;var _=o.incomingById.get(i);return _?(_.storeObject=o.merge(_.storeObject,u),_.mergeTree=Vu(_.mergeTree,s),f.forEach(function(S){return _.fieldNodeSet.add(S)})):o.incomingById.set(i,{storeObject:u,mergeTree:ds(s)?void 0:s,fieldNodeSet:f}),g}return u},r.prototype.processFieldValue=function(e,t,i,n){var a=this;return!t.selectionSet||e===null?__DEV__?Ho(e):e:be(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,i,od(n,s));return sd(n,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:n})},r.prototype.flattenFields=function(e,t,i,n){n===void 0&&(n=wa(t,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new sr(!1);return function c(u,l){var d=s.lookup(u,l.clientOnly,l.deferred);d.visited||(d.visited=!0,u.selections.forEach(function(f){if(!!Sr(f,i.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&qe(f.directives)&&f.directives.forEach(function(w){var _=w.name.value;if(_==="client"&&(p=!0),_==="defer"){var S=Er(w,i.variables);(!S||S.if!==!1)&&(h=!0)}}),It(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Bu(i,p,h))}else{var g=bi(f,i.lookupFragment);if(!g&&f.kind===je.FRAGMENT_SPREAD)throw __DEV__?new Z("No fragment named ".concat(f.name.value)):new Z(8);g&&o.fragmentMatches(g,n,t,i.variables)&&c(g.selectionSet,Bu(i,p,h))}}}))}(e,i),a},r.prototype.applyMerges=function(e,t,i,n,a){var o,s=this;if(e.map.size&&!ne(i)){var c=!be(i)&&(ne(t)||Vr(t))?t:void 0,u=i;c&&!a&&(a=[ne(c)?c.__ref:c]);var l,d=function(f,p){return be(f)?typeof p=="number"?f[p]:void 0:n.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(c,p),m=d(u,p);if(m!==void 0){a&&a.push(p);var g=s.applyMerges(f,h,m,n,a);g!==m&&(l=l||new Map,l.set(p,g)),a&&L(a.pop()===p)}}),l&&(i=be(u)?u.slice(0):A({},u),l.forEach(function(f,p){i[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},r}();var ld=[];function od(r,e){var t=r.map;return t.has(e)||t.set(e,ld.pop()||{map:new Map}),t.get(e)}function Vu(r,e){if(r===e||!e||ds(e))return r;if(!r||ds(r))return e;var t=r.info&&e.info?A(A({},r.info),e.info):r.info||e.info,i=r.map.size&&e.map.size,n=i?new Map:r.map.size?r.map:e.map,a={info:t,map:n};if(i){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Vu(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Vu(e.map.get(s),r.map.get(s)))})}return a}function ds(r){return!r||!(r.info||r.map.size)}function sd(r,e){var t=r.map,i=t.get(e);i&&ds(i)&&(ld.push(i),t.delete(e))}var cd=new Set;function Hy(r,e,t,i){var n=function(d){var f=i.getFieldValue(d,t);return typeof f=="object"&&f},a=n(r);if(!!a){var o=n(e);if(!!o&&!ne(a)&&!Ie(a,o)&&!Object.keys(a).every(function(d){return i.getFieldValue(o,d)!==void 0})){var s=i.getFieldValue(r,"__typename")||i.getFieldValue(e,"__typename"),c=Zt(t),u="".concat(s,".").concat(c);if(!cd.has(u)){cd.add(u);var l=[];!be(a)&&!be(o)&&[a,o].forEach(function(d){var f=i.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," 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(u,` field, so InMemoryCache can safely merge these objects:
|
|
39
39
|
|
|
@@ -44,21 +44,21 @@ 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 hs=function(r){
|
|
47
|
+
`))}}}}var hs=function(r){$e(e,r);function e(t){t===void 0&&(t={});var i=r.call(this)||this;return i.watches=new Set,i.typenameDocumentCache=new Map,i.makeVar=ps,i.txCount=0,i.config=Uf(t),i.addTypename=!!i.config.addTypename,i.policies=new nd({cache:i,dataIdFromObject:i.config.dataIdFromObject,possibleTypes:i.config.possibleTypes,typePolicies:i.config.typePolicies}),i.init(),i}return e.prototype.init=function(){var t=this.data=new On.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var i=this,n=this.storeReader,a=this.config.fragments;this.storeWriter=new ud(this,this.storeReader=new Hf({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:ss(this.config),canon:t?void 0:n&&n.canon,fragments:a}),a),this.maybeBroadcastWatch=Ai(function(o,s){return i.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?i.optimisticData:i.data;if(Ii(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,Tt({optimistic:c,id:u,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var i=t.returnPartialData,n=i===void 0?!1:i;try{return this.storeReader.diffQueryAgainstStore(A(A({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:n})).result||null}catch(a){if(a instanceof Na)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if(Re.call(t,"id")&&!t.id)return!1;var i=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,i.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(A(A({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var i=this;return this.watches.size||Kf(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){i.watches.delete(t)&&!i.watches.size&&Lu(i),i.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){Tt.reset();var i=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),i},e.prototype.retain=function(t,i){return(i?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,i){return(i?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(ne(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(i){__DEV__&&L.warn(i)}},e.prototype.evict=function(t){if(!t.id){if(Re.call(t,"id"))return!1;t=A(A({},t),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(t,this.data)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(t){var i=this;return this.init(),Tt.reset(),t&&t.discardWatches?(this.watches.forEach(function(n){return i.maybeBroadcastWatch.forget(n)}),this.watches.clear(),Lu(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var i=this.optimisticData.removeLayer(t);i!==this.optimisticData&&(this.optimisticData=i,this.broadcastWatches())},e.prototype.batch=function(t){var i=this,n=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,u,l=function(f){var p=i,h=p.data,m=p.optimisticData;++i.txCount,f&&(i.data=i.optimisticData=f);try{return u=n(i)}finally{--i.txCount,i.data=h,i.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(A(A({},t),{onWatchUpdated:function(f){return d.add(f),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&d.size?(this.broadcastWatches(A(A({},t),{onWatchUpdated:function(f,p){var h=c.call(this,f,p);return h!==!1&&d.delete(f),h}})),d.size&&d.forEach(function(f){return i.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(t),u},e.prototype.performTransaction=function(t,i){return this.batch({update:t,optimistic:i||i!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var i=this.typenameDocumentCache.get(t);return i||(i=Ei(t),this.typenameDocumentCache.set(t,i),this.typenameDocumentCache.set(i,i)),i}return t},e.prototype.transformForLink=function(t){var i=this.config.fragments;return i?i.transform(t):t},e.prototype.broadcastWatches=function(t){var i=this;this.txCount||this.watches.forEach(function(n){return i.maybeBroadcastWatch(n,t)})},e.prototype.broadcastWatch=function(t,i){var n=t.lastDiff,a=this.diff(t);i&&(t.optimistic&&typeof i.optimistic=="string"&&(a.fromOptimisticTransaction=!0),i.onWatchUpdated&&i.onWatchUpdated.call(this,t,a,n)===!1)||(!n||!Ie(n.result,a.result))&&t.callback(t.lastDiff=a,n)},e}(Ou);function pd(r){return r.hasOwnProperty("graphQLErrors")}var Gy=function(r){var e="";if(qe(r.graphQLErrors)||qe(r.clientErrors)){var t=(r.graphQLErrors||[]).concat(r.clientErrors||[]);t.forEach(function(i){var n=i?i.message:"Error message not found.";e+="".concat(n,`
|
|
48
48
|
`)})}return r.networkError&&(e+="".concat(r.networkError.message,`
|
|
49
|
-
`)),e=e.replace(/\n$/,""),e},xr=function(r){
|
|
50
|
-
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Ie(this.options.variables,t)&&(n.variables=this.options.variables=A(A({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,he.refetch)},e.prototype.fetchMore=function(t){var i=this,n=A(A({},t.query?t:A(A(A(A({},this.options),{query:this.query}),t),{variables:A(A({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=he.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,he.fetchMore).then(function(u){return i.queryManager.removeQuery(a),o.networkStatus===he.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(l){var d=t.updateQuery;d?l.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:u.data,variables:n.variables})}):l.writeQuery({query:n.query,variables:n.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(i.query)||Qu(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&L.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Ie(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},he.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?L(a,"Attempted to start a polling query without a polling interval."):L(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(zr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},he.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=A(A({},this.last),{result:this.queryManager.assumeImmutableResults?t:Go(t),variables:i}),qe(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===he.refetch||i===he.fetchMore||i===he.poll,o=this.options.variables,s=this.options.fetchPolicy,c=qr(this.options,t||{}),u=a?c:Ky(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ie(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),i===void 0&&(i=he.setVariables)));var l=u.variables&&A({},u.variables),d=this.fetch(u,i),f={next:function(p){n.reportResult(p,l)},error:function(p){n.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),xi(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=A(A({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:he.error,loading:!1});this.updateLastResult(n,i),xi(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ie);Ko(ms);function Qu(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function Zy(r){__DEV__&&L.error("Unhandled error",r.message,r.stack)}function zu(r){__DEV__&&r&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var gs=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=nu(t.resolvers,i)}):this.resolvers=nu(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Gt(this,void 0,void 0,function(){return Ht(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(u){return A(A({},i),{data:u.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return bn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return iu(e)},r.prototype.prepareContext=function(e){var t=this.cache;return A(A({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),Gt(this,void 0,void 0,function(){return Ht(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return A(A({},t),a.exportedVariables)})]:[2,A({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return ot(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return yi}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:ru(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Gt(this,void 0,void 0,function(){var s,c,u,l,d,f,p,h,m,y,w;return Ht(this,function(_){return s=_i(e),c=wi(e),u=vi(c),l=this.collectSelectionsToResolve(s,u),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,y={fragmentMap:u,context:A(A({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},w=!1,[2,this.resolveSelectionSet(s.selectionSet,w,t,y).then(function(S){return{result:S,exportedVariables:y.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return Gt(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Ht(this,function(d){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],u=function(f){return Gt(l,void 0,void 0,function(){var p,h;return Ht(this,function(m){return!t&&!n.selectionsToResolve.has(f)?[2]:Sr(f,s)?It(f)?[2,this.resolveField(f,t,i,n).then(function(y){var w;typeof y<"u"&&c.push((w={},w[Mt(f)]=y,w))})]:(Yc(f)?p=f:(p=a[f.name.value],__DEV__?L(p,"No fragment named ".concat(f.name.value)):L(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(y){c.push(y)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Sa(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return Gt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h=this;return Ht(this,function(m){return i?(a=n.variables,o=e.name.value,s=Mt(e),c=o!==s,u=i[s]||i[o],l=Promise.resolve(u),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=i.__typename||n.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(l=Promise.resolve(Cn.withValue(this.cache,p,[i,Er(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,l.then(function(y){var w,_;if(y===void 0&&(y=u),e.directives&&e.directives.forEach(function(b){b.name.value==="export"&&b.arguments&&b.arguments.forEach(function(k){k.name.value==="as"&&k.value.kind==="StringValue"&&(n.exportedVariables[k.value.value]=y)})}),!e.selectionSet||y==null)return y;var S=(_=(w=e.directives)===null||w===void 0?void 0:w.some(function(b){return b.name.value==="client"}))!==null&&_!==void 0?_:!1;if(Array.isArray(y))return h.resolveSubSelectedArray(e,t||S,y,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||S,y,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),ot(o,{Directive:function(c,u,l,d,f){c.name.value==="client"&&f.forEach(function(p){i(p)&&ya(p)&&s.add(p)})},FragmentSpread:function(c,u,l,d,f){var p=t[c.name.value];__DEV__?L(p,"No fragment named ".concat(c.name.value)):L(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){i(m)&&ya(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var Dn=new(jt?WeakMap:Map);function Wu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Dn.set(r,(Dn.get(r)+1)%1e15),t.apply(this,arguments)})}function fd(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var ys=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;Dn.has(i)||(Dn.set(i,0),Wu(i,"evict"),Wu(i,"modify"),Wu(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||he.loading;return this.variables&&this.networkStatus!==he.loading&&!Ie(this.variables,e.variables)&&(t=he.setVariables),Ie(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){fd(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ie(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Ie(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():Qu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;fd(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(zr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=A(A({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ie(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===Dn.get(this.cache)&&Ie(t,i.variables)&&Ie(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new bt,s=qe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&qe(e.incremental)){var c=Jo(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(vs(e,i.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,i.variables))l.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:Dn.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(i.variables),f=l.diff(d);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=he.ready},r.prototype.markError=function(e){return this.networkStatus=he.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function vs(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!An(r);return!i&&t&&r.data&&(i=!0),i}var Yy=Object.prototype.hasOwnProperty,dd=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,d=l===void 0?{}:l,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(jt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new gs({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new Z("QueryManager stopped while query was in flight"):new Z(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,d=l===void 0?!1:l,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,y=e.errorPolicy,w=y===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":y,_=e.keepRootFields,S=e.context;return Gt(this,void 0,void 0,function(){var b,k,$,E,D,P;return Ht(this,function(R){switch(R.label){case 0:return __DEV__?L(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):L(n,15),__DEV__?L(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):L(m==="network-only"||m==="no-cache",16),b=this.generateMutationId(),k=this.transform(n),$=k.document,E=k.hasClientExports,n=this.cache.transformForLink($),a=this.getVariables(n,a),E?[4,this.localState.addExportedVariables(n,a,S)]:[3,2];case 1:a=R.sent(),R.label=2;case 2:return D=this.mutationStore&&(this.mutationStore[b]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:b,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,updateQueries:s,update:f,keepRootFields:_}),this.broadcastQueries(),P=this,[2,new Promise(function(M,Ae){return Ho(P.getObservableFromLink(n,A(A({},S),{optimisticResponse:o}),a,!1),function(oe){if(An(oe)&&w==="none")throw new xr({graphQLErrors:Zo(oe)});D&&(D.loading=!1,D.error=null);var j=A({},oe);return typeof u=="function"&&(u=u(j)),w==="ignore"&&An(j)&&delete j.errors,P.markMutationResult({mutationId:b,result:j,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?b:void 0,onQueryUpdated:p,keepRootFields:_})}).subscribe({next:function(oe){P.broadcastQueries(),(!("hasNext"in oe)||oe.hasNext===!1)&&M(oe)},error:function(oe){D&&(D.loading=!1,D.error=oe),o&&P.cache.removeOptimistic(b),P.broadcastQueries(),Ae(oe instanceof xr?oe:new xr({networkError:oe}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&vs(n,e.errorPolicy)){if(Ur(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Ur(n)&&qe(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=Jo(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!Yy.call(u,h))){var m=u[h],y=i.queries.get(f),w=y.document,_=y.variables,S=t.diff({query:w,variables:_,returnPartialData:!0,optimistic:!1}),b=S.result,k=S.complete;if(k&&b){var $=m(b,{mutationResult:n,queryName:w&&_n(w)||void 0,queryVariables:_});$&&a.push({result:$,dataId:"ROOT_QUERY",query:w,variables:_})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!Kp(n)||Ur(n)&&!n.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=A(A({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&f(d,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,y){var w=y.fieldName,_=y.DELETE;return w==="__typename"?m:_}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(A(A({},t),{result:{data:n}}),a)}catch(o){__DEV__&&L.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=tu(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:Hc(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:Si(or(i)),asQuery:A(A({},i),{definitions:i.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?A(A({},u),{operation:"query"}):u})})},c=function(u){u&&!t.has(u)&&t.set(u,s)};c(e),c(i),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return A(A({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=A(A({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new ys(this),i=new ms({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?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(t,e).finally(function(){return i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new Z("Store reset while query was in flight (not completed in link chain)"):new Z(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=he.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):Jc(o)?n.set(t.transform(o).document,!1):le(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){i.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&n.has(l)||u&&n.has(u))&&(i.set(s,c),l&&n.set(l,!0),u&&n.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Aa("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new ms({queryManager:t,queryInfo:c,options:A(A({},o),{fetchPolicy:"network-only"})});L(u.queryId===s),c.setObservableQuery(u),i.set(s,u)}),__DEV__&&n.size&&n.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"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var u=function(d){return t.getObservableFromLink(i,c,d).map(function(f){if(n!=="no-cache"&&(vs(f,a)&&t.cache.write({query:i,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),An(f))throw new xr({graphQLErrors:f.errors});return f})};if(this.transform(i).hasClientExports){var l=this.localState.addExportedVariables(i,o,c).then(u);return new ie(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,d=u.link,f={query:c,variables:i,operationName:_n(c)||void 0,context:this.prepareContext(A(A({},t),{forceFetch:!n}))};if(t=f.context,n){var p=l.get(c)||new Map;l.set(c,p);var h=Tt(i);if(s=p.get(h),!s){var m=new xn([In(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new xn([In(d,f)])}else s=new xn([ie.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=Ho(s,function(w){return a.localState.runResolvers({document:y,remoteResult:w,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Ho(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Zo(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new xr({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:he.ready};return c&&i.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=he.error),u},function(o){var s=pd(o)?o:new xr({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=he.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,y=m===void 0?!1:m,w=t.context,_=w===void 0?{}:w,S=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:y,context:_}),b=function(E){S.variables=E;var D=n.fetchQueryByPolicy(s,S,i);return S.fetchPolicy!=="standby"&&D.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),D},k=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(E){k(),setTimeout(function(){return $.cancel(E)})});var $=new xn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(b):b(S.variables));return $.promise.then(k,k),$},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Aa("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;n&&this.getObservableQueries(n).forEach(function(f,p){l.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof ys&&f.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var y=u(m,p,h);return y===!0&&(y=m.refetch()),y!==!1&&d.set(m,y),y}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(f,p){var h=f.oq,m=f.lastDiff,y=f.diff,w;if(u){if(!y){var _=h.queryInfo;_.reset(),y=_.getDiff()}w=u(h,y,m)}(!u||w===!0)&&(w=h.refetch()),w!==!1&&d.set(h,w),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(b,k){k===void 0&&(k=e.networkStatus||he.loading);var $=b.result;__DEV__&&!l&&!Ie($,{})&&zu(b.missing);var E=function(D){return ie.of(A({data:D,loading:zr(k),networkStatus:k},b.complete?null:{partial:!0}))};return $&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:$},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(D){return E(D.data||void 0)}):u==="none"&&k===he.refetch&&Array.isArray(b.missing)?E(void 0):E($)},y=s==="no-cache"?0:i===he.refetch&&c!=="merge"?1:2,w=function(){return n.getResultsFromLink(e,y,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},_=f&&typeof p=="number"&&p!==i&&zr(i);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:l||_?[m(S),w()]:[w()]}case"cache-and-network":{var S=h();return S.complete||l||_?[m(S),w()]:[w()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return _?[m(h()),w()]:[w()];case"no-cache":return _?[m(e.getDiff()),w()]:[w()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new ys(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return A(A({},t),{clientAwareness:this.clientAwareness})},r}();var hd=!1;var Gu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,y=e.assumeImmutableResults,w=y===void 0?!1:y,_=e.resolvers,S=e.typeDefs,b=e.fragmentMatcher,k=e.name,$=e.version,E=e.link;if(E||(E=i?new _u({uri:i,credentials:n,headers:a}):Ut.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=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!hd&&f&&__DEV__&&(hd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var D=window.navigator,P=D&&D.userAgent,R=void 0;typeof P=="string"&&(P.indexOf("Chrome/")>-1?R="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":P.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=Xp,this.localState=new gs({cache:o,client:this,resolvers:_,fragmentMatcher:b}),this.queryManager=new dd({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:k,version:$},localState:this.localState,assumeImmutableResults:w,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ia(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=A(A({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ia(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=A(A({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ia(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return In(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&L.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Ap(gi?"log":"silent");function lt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Ar(r){return lt(r)==="object"}function md(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Hu(r,e){return r.length<124?r:e}var gd="graphql-transport-ws";var wt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(wt||(wt={}));var Re;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Re||(Re={}));function yd(r){if(!Ar(r))throw new Error(`Message is expected to be an object, but got ${lt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${lt(r.type)}`);switch(r.type){case Re.ConnectionInit:case Re.ConnectionAck:case Re.Ping:case Re.Pong:{if(r.payload!=null&&!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Re.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${lt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${lt(r.payload.query)}`);if(r.payload.variables!=null&&!Ar(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${lt(r.payload.variables)}`);if(r.payload.operationName!=null&<(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${lt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Ar(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${lt(r.payload.extensions)}`);break}case Re.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${lt(r.payload)}`);break}case Re.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!md(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Re.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function vd(r,e){return yd(typeof r=="string"?JSON.parse(r,e):r)}function $n(r,e){return yd(r),JSON.stringify(r,e)}function Ku(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(we){let _e=1e3;for(let ce=0;ce<we;ce++)_e*=2;await new Promise(ce=>setTimeout(ce,_e+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=bs,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{let _e=Math.random()*16|0;return(we=="x"?_e:_e&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:w}=r,_;if(h){if(!ev(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=_,b=(()=>{let j=(()=>{let _e={};return{on(ce,ue){return _e[ce]=ue,()=>{delete _e[ce]}},emit(ce){var ue;"id"in ce&&((ue=_e[ce.id])===null||ue===void 0||ue.call(_e,ce))}}})(),we={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[j.emit,p.message]:[j.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:j.on,on(_e,ce){let ue=we[_e];return ue.push(ce),()=>{ue.splice(ue.indexOf(ce),1)}},emit(_e,...ce){for(let ue of[...we[_e]])ue(...ce)}}})();function k(j){let we=[b.on("error",_e=>{we.forEach(ce=>ce()),j(_e)}),b.on("closed",_e=>{we.forEach(ce=>ce()),j(_e)})]}let $,E=0,D,P=!1,R=0,M=!1;async function Ae(){clearTimeout(D);let[j,we]=await($??($=new Promise((ue,rr)=>(async()=>{if(P){if(await l(R),!E)return $=void 0,rr({code:1e3,reason:"All Subscriptions Gone"});R++}b.emit("connecting");let re=new S(typeof e=="function"?await e():e,gd),ir,Pr;function Lo(){isFinite(o)&&o>0&&(clearTimeout(Pr),Pr=setTimeout(()=>{re.readyState===S.OPEN&&(re.send($n({type:Re.Ping})),b.emit("ping",!1,void 0))},o))}k(Ze=>{$=void 0,clearTimeout(ir),clearTimeout(Pr),rr(Ze),bs(Ze)&&Ze.code===4499&&(re.close(4499,"Terminated"),re.onerror=null,re.onclose=null)}),re.onerror=Ze=>b.emit("error",Ze),re.onclose=Ze=>b.emit("closed",Ze),re.onopen=async()=>{try{b.emit("opened",re);let Ze=typeof t=="function"?await t():t;if(re.readyState!==S.OPEN)return;re.send($n(Ze?{type:Re.ConnectionInit,payload:Ze}:{type:Re.ConnectionInit},y)),isFinite(c)&&c>0&&(ir=setTimeout(()=>{re.close(wt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Lo()}catch(Ze){b.emit("error",Ze),re.close(wt.InternalClientError,Hu(Ze instanceof Error?Ze.message:new Error(Ze).message,"Internal client error"))}};let yn=!1;re.onmessage=({data:Ze})=>{try{let Ye=vd(Ze,w);if(b.emit("message",Ye),Ye.type==="ping"||Ye.type==="pong"){b.emit(Ye.type,!0,Ye.payload),Ye.type==="pong"?Lo():s||(re.send($n(Ye.payload?{type:Re.Pong,payload:Ye.payload}:{type:Re.Pong})),b.emit("pong",!1,Ye.payload));return}if(yn)return;if(Ye.type!==Re.ConnectionAck)throw new Error(`First message cannot be of type ${Ye.type}`);clearTimeout(ir),yn=!0,b.emit("connected",re,Ye.payload),P=!1,R=0,ue([re,new Promise((R_,ng)=>k(ng))])}catch(Ye){re.onmessage=null,b.emit("error",Ye),re.close(wt.BadResponse,Hu(Ye instanceof Error?Ye.message:new Error(Ye).message,"Bad response"))}}})())));j.readyState===S.CLOSING&&await we;let _e=()=>{},ce=new Promise(ue=>_e=ue);return[j,_e,Promise.race([ce.then(()=>{if(!E){let ue=()=>j.close(1e3,"Normal Closure");isFinite(a)&&a>0?D=setTimeout(()=>{j.readyState===S.OPEN&&ue()},a):ue()}}),we])]}function oe(j){if(bs(j)&&(Xy(j.code)||[wt.InternalServerError,wt.InternalClientError,wt.BadRequest,wt.BadResponse,wt.Unauthorized,wt.SubprotocolNotAcceptable,wt.SubscriberAlreadyExists,wt.TooManyInitialisationRequests].includes(j.code)))throw j;if(M)return!1;if(bs(j)&&j.code===1e3)return E>0;if(!u||R>=u||!d(j)||f?.(j))throw j;return P=!0}return i||(async()=>{for(E++;;)try{let[,,j]=await Ae();await j}catch(j){try{if(!oe(j))return}catch(we){return n?.(we)}}})(),{on:b.on,subscribe(j,we){let _e=m(j),ce=!1,ue=!1,rr=()=>{E--,ce=!0};return(async()=>{for(E++;;)try{let[re,ir,Pr]=await Ae();if(ce)return ir();let Lo=b.onMessage(_e,yn=>{switch(yn.type){case Re.Next:{we.next(yn.payload);return}case Re.Error:{ue=!0,ce=!0,we.error(yn.payload),rr();return}case Re.Complete:{ce=!0,rr();return}}});re.send($n({id:_e,type:Re.Subscribe,payload:j},y)),rr=()=>{!ce&&re.readyState===S.OPEN&&re.send($n({id:_e,type:Re.Complete},y)),E--,ce=!0,ir()},await Pr.finally(Lo);return}catch(re){if(!oe(re))return}})().then(()=>{ue||we.complete()}).catch(re=>{we.error(re)}),()=>{ce||rr()}},async dispose(){if(M=!0,$){let[j]=await $;j.close(1e3,"Normal Closure")}},terminate(){$&&b.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function bs(r){return Ar(r)&&"code"in r&&"reason"in r}function Xy(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function ev(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function tv(r){return le(r)&&"code"in r&&"reason"in r}var bd=function(r){De(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new ie(function(n){return i.client.subscribe(A(A({},t),{query:vn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):tv(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new xr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Ut);var ws="0.11.2-dev";function _s(){return typeof window!="undefined"&&window.self!==window.top}function Ju(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function kt(r,e){Ju()&&localStorage.setItem(`${ws}/${r}`,e)}function Ss(r){return Ju()?localStorage.getItem(`${ws}/${r}`):null}function Ra(r){Ju()&&localStorage.removeItem(`${ws}/${r}`)}function Rn(r,e=1e4){return J(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}var tc=function(){return tc=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},tc.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ls(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ls=function(t){return typeof t}:Ls=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ls(r)}function iv(r){return Ls(r)=="object"&&r!==null}var Fh=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function gl(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function nv(r){return Mh(r.source,gl(r.source,r.start))}function Mh(r,e){var t=r.locationOffset.column-1,i=Fs(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
|
|
52
|
-
`),l=i.split(/\r\n|[\n\r]/g),d=l[n];if(d.length>120){for(var f=Math.floor(c/80),p=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return u+wd([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(
|
|
53
|
-
`)}function Fs(r){return Array(r+1).join(" ")}function av(r,e){return Fs(r-e.length)+e}function Ms(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ms=function(t){return typeof t}:Ms=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ms(r)}function _d(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function ov(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_d(Object(t),!0).forEach(function(i){sv(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_d(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function sv(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Sd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function uv(r,e,t){return e&&Sd(r.prototype,e),t&&Sd(r,t),r}function lv(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&so(r,e)}function pv(r){var e=Uh();return function(){var i=co(r),n;if(e){var a=co(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return jh(this,n)}}function jh(r,e){return e&&(Ms(e)==="object"||typeof e=="function")?e:ja(r)}function ja(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function yl(r){var e=typeof Map=="function"?new Map:void 0;return yl=function(i){if(i===null||!fv(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return js(i,arguments,co(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),so(n,i)},yl(r)}function js(r,e,t){return Uh()?js=Reflect.construct:js=function(n,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(n,s),u=new c;return o&&so(u,o.prototype),u},js.apply(null,arguments)}function Uh(){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 fv(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function so(r,e){return so=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},so(r,e)}function co(r){return co=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},co(r)}var dv=function(r){lv(t,r);var e=pv(t);function t(i,n,a,o,s,c,u){var l,d,f,p;cv(this,t),p=e.call(this,i),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=Ed(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],m=0,
|
|
49
|
+
`)),e=e.replace(/\n$/,""),e},xr=function(r){$e(e,r);function e(t){var i=t.graphQLErrors,n=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=i||[],c.clientErrors=n||[],c.networkError=a||null,c.message=o||Gy(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var me;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(me||(me={}));function zr(r){return r?r<7:!1}var Ky=Object.assign,Jy=Object.hasOwnProperty,ms=function(r){$e(e,r);function e(t){var i=t.queryManager,n=t.queryInfo,a=t.options,o=r.call(this,function(g){try{var w=g._subscription._observer;w&&!w.error&&(w.error=Zy)}catch{}var _=!o.observers.size;o.observers.add(g);var S=o.last;return S&&S.error?g.error&&g.error(S.error):S&&S.result&&g.next&&g.next(S.result),_&&o.reobserve().catch(function(){}),function(){o.observers.delete(g)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=n,o.queryManager=i,o.isTornDown=!1;var s=i.defaultOptions.watchQuery,c=s===void 0?{}:s,u=c.fetchPolicy,l=u===void 0?"cache-first":u,d=a.fetchPolicy,f=d===void 0?l:d,p=a.initialFetchPolicy,h=p===void 0?f==="standby"?l:f:p;o.options=A(A({},a),{initialFetchPolicy:h,fetchPolicy:f}),o.queryId=n.queryId||i.generateQueryId();var m=or(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(i,n){var a={next:function(s){i(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:n},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var i=this.getLastResult(!0),n=this.queryInfo.networkStatus||i&&i.networkStatus||me.ready,a=A(A({},i),{loading:zr(n),networkStatus:n}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(a.data=c.result),Ie(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===me.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=me.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&zu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,i){return!this.last||!Ie(this.last.result,t)||i&&!Ie(this.last.variables,i)},e.prototype.getLast=function(t,i){var n=this.last;if(n&&n[t]&&(!i||Ie(n.variables,this.variables)))return n[t]},e.prototype.getLastResult=function(t){return this.getLast("result",t)},e.prototype.getLastError=function(t){return this.getLast("error",t)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(t){var i,n={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?n.fetchPolicy=a:a==="no-cache"?n.fetchPolicy="no-cache":n.fetchPolicy="network-only",__DEV__&&t&&Jy.call(t,"variables")){var o=_a(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&L.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((i=o.name)===null||i===void 0?void 0:i.value)||JSON.stringify(o),`, which does not declare a $variables variable.
|
|
50
|
+
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Ie(this.options.variables,t)&&(n.variables=this.options.variables=A(A({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,me.refetch)},e.prototype.fetchMore=function(t){var i=this,n=A(A({},t.query?t:A(A(A(A({},this.options),{query:this.query}),t),{variables:A(A({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=me.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,me.fetchMore).then(function(u){return i.queryManager.removeQuery(a),o.networkStatus===me.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(l){var d=t.updateQuery;d?l.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:u.data,variables:n.variables})}):l.writeQuery({query:n.query,variables:n.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(i.query)||Qu(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&L.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return Ie(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},me.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?L(a,"Attempted to start a polling query without a polling interval."):L(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(zr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},me.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=A(A({},this.last),{result:this.queryManager.assumeImmutableResults?t:Ho(t),variables:i}),qe(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===me.refetch||i===me.fetchMore||i===me.poll,o=this.options.variables,s=this.options.fetchPolicy,c=qr(this.options,t||{}),u=a?c:Ky(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ie(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),i===void 0&&(i=me.setVariables)));var l=u.variables&&A({},u.variables),d=this.fetch(u,i),f={next:function(p){n.reportResult(p,l)},error:function(p){n.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),xi(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=A(A({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:me.error,loading:!1});this.updateLastResult(n,i),xi(this.observers,"error",this.last.error=t)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(t){return t.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ie);Ko(ms);function Qu(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function Zy(r){__DEV__&&L.error("Unhandled error",r.message,r.stack)}function zu(r){__DEV__&&r&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var gs=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=nu(t.resolvers,i)}):this.resolvers=nu(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Ht(this,void 0,void 0,function(){return Gt(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(u){return A(A({},i),{data:u.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return bn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return iu(e)},r.prototype.prepareContext=function(e){var t=this.cache;return A(A({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),Ht(this,void 0,void 0,function(){return Gt(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return A(A({},t),a.exportedVariables)})]:[2,A({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return ot(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return yi}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:ru(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Ht(this,void 0,void 0,function(){var s,c,u,l,d,f,p,h,m,g,w;return Gt(this,function(_){return s=_i(e),c=wi(e),u=vi(c),l=this.collectSelectionsToResolve(s,u),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,g={fragmentMap:u,context:A(A({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},w=!1,[2,this.resolveSelectionSet(s.selectionSet,w,t,g).then(function(S){return{result:S,exportedVariables:g.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return Ht(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Gt(this,function(d){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],u=function(f){return Ht(l,void 0,void 0,function(){var p,h;return Gt(this,function(m){return!t&&!n.selectionsToResolve.has(f)?[2]:Sr(f,s)?It(f)?[2,this.resolveField(f,t,i,n).then(function(g){var w;typeof g<"u"&&c.push((w={},w[Mt(f)]=g,w))})]:(Yc(f)?p=f:(p=a[f.name.value],__DEV__?L(p,"No fragment named ".concat(f.name.value)):L(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Sa(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return Ht(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h=this;return Gt(this,function(m){return i?(a=n.variables,o=e.name.value,s=Mt(e),c=o!==s,u=i[s]||i[o],l=Promise.resolve(u),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=i.__typename||n.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(l=Promise.resolve(Cn.withValue(this.cache,p,[i,Er(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,l.then(function(g){var w,_;if(g===void 0&&(g=u),e.directives&&e.directives.forEach(function(b){b.name.value==="export"&&b.arguments&&b.arguments.forEach(function(O){O.name.value==="as"&&O.value.kind==="StringValue"&&(n.exportedVariables[O.value.value]=g)})}),!e.selectionSet||g==null)return g;var S=(_=(w=e.directives)===null||w===void 0?void 0:w.some(function(b){return b.name.value==="client"}))!==null&&_!==void 0?_:!1;if(Array.isArray(g))return h.resolveSubSelectedArray(e,t||S,g,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||S,g,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),ot(o,{Directive:function(c,u,l,d,f){c.name.value==="client"&&f.forEach(function(p){i(p)&&ya(p)&&s.add(p)})},FragmentSpread:function(c,u,l,d,f){var p=t[c.name.value];__DEV__?L(p,"No fragment named ".concat(c.name.value)):L(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){i(m)&&ya(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var Dn=new(jt?WeakMap:Map);function Wu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Dn.set(r,(Dn.get(r)+1)%1e15),t.apply(this,arguments)})}function fd(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var ys=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;Dn.has(i)||(Dn.set(i,0),Wu(i,"evict"),Wu(i,"modify"),Wu(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||me.loading;return this.variables&&this.networkStatus!==me.loading&&!Ie(this.variables,e.variables)&&(t=me.setVariables),Ie(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){fd(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ie(t,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Ie(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():Qu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;fd(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(zr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=A(A({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ie(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===Dn.get(this.cache)&&Ie(t,i.variables)&&Ie(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new bt,s=qe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&qe(e.incremental)){var c=Jo(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(vs(e,i.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,i.variables))l.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:Dn.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(i.variables),f=l.diff(d);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=me.ready},r.prototype.markError=function(e){return this.networkStatus=me.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function vs(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!An(r);return!i&&t&&r.data&&(i=!0),i}var Yy=Object.prototype.hasOwnProperty,dd=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,d=l===void 0?{}:l,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(jt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new gs({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new Z("QueryManager stopped while query was in flight"):new Z(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,d=l===void 0?!1:l,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,g=e.errorPolicy,w=g===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":g,_=e.keepRootFields,S=e.context;return Ht(this,void 0,void 0,function(){var b,O,D,E,$,P;return Gt(this,function(R){switch(R.label){case 0:return __DEV__?L(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):L(n,15),__DEV__?L(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):L(m==="network-only"||m==="no-cache",16),b=this.generateMutationId(),O=this.transform(n),D=O.document,E=O.hasClientExports,n=this.cache.transformForLink(D),a=this.getVariables(n,a),E?[4,this.localState.addExportedVariables(n,a,S)]:[3,2];case 1:a=R.sent(),R.label=2;case 2:return $=this.mutationStore&&(this.mutationStore[b]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:b,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,updateQueries:s,update:f,keepRootFields:_}),this.broadcastQueries(),P=this,[2,new Promise(function(M,Ae){return Go(P.getObservableFromLink(n,A(A({},S),{optimisticResponse:o}),a,!1),function(se){if(An(se)&&w==="none")throw new xr({graphQLErrors:Zo(se)});$&&($.loading=!1,$.error=null);var j=A({},se);return typeof u=="function"&&(u=u(j)),w==="ignore"&&An(j)&&delete j.errors,P.markMutationResult({mutationId:b,result:j,document:n,variables:a,fetchPolicy:m,errorPolicy:w,context:S,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?b:void 0,onQueryUpdated:p,keepRootFields:_})}).subscribe({next:function(se){P.broadcastQueries(),(!("hasNext"in se)||se.hasNext===!1)&&M(se)},error:function(se){$&&($.loading=!1,$.error=se),o&&P.cache.removeOptimistic(b),P.broadcastQueries(),Ae(se instanceof xr?se:new xr({networkError:se}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&vs(n,e.errorPolicy)){if(Ur(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Ur(n)&&qe(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=Jo(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!Yy.call(u,h))){var m=u[h],g=i.queries.get(f),w=g.document,_=g.variables,S=t.diff({query:w,variables:_,returnPartialData:!0,optimistic:!1}),b=S.result,O=S.complete;if(O&&b){var D=m(b,{mutationResult:n,queryName:w&&_n(w)||void 0,queryVariables:_});D&&a.push({result:D,dataId:"ROOT_QUERY",query:w,variables:_})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!Kp(n)||Ur(n)&&!n.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=A(A({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&f(d,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,g){var w=g.fieldName,_=g.DELETE;return w==="__typename"?m:_}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(A(A({},t),{result:{data:n}}),a)}catch(o){__DEV__&&L.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=tu(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:Gc(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:Si(or(i)),asQuery:A(A({},i),{definitions:i.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?A(A({},u),{operation:"query"}):u})})},c=function(u){u&&!t.has(u)&&t.set(u,s)};c(e),c(i),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return A(A({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=A(A({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new ys(this),i=new ms({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?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(t,e).finally(function(){return i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new Z("Store reset while query was in flight (not completed in link chain)"):new Z(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=me.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):Jc(o)?n.set(t.transform(o).document,!1):pe(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){i.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&n.has(l)||u&&n.has(u))&&(i.set(s,c),l&&n.set(l,!0),u&&n.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Aa("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new ms({queryManager:t,queryInfo:c,options:A(A({},o),{fetchPolicy:"network-only"})});L(u.queryId===s),c.setObservableQuery(u),i.set(s,u)}),__DEV__&&n.size&&n.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"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var u=function(d){return t.getObservableFromLink(i,c,d).map(function(f){if(n!=="no-cache"&&(vs(f,a)&&t.cache.write({query:i,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),An(f))throw new xr({graphQLErrors:f.errors});return f})};if(this.transform(i).hasClientExports){var l=this.localState.addExportedVariables(i,o,c).then(u);return new ie(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,d=u.link,f={query:c,variables:i,operationName:_n(c)||void 0,context:this.prepareContext(A(A({},t),{forceFetch:!n}))};if(t=f.context,n){var p=l.get(c)||new Map;l.set(c,p);var h=Tt(i);if(s=p.get(h),!s){var m=new xn([In(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new xn([In(d,f)])}else s=new xn([ie.of({data:{}})]),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(s=Go(s,function(w){return a.localState.runResolvers({document:g,remoteResult:w,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Go(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Zo(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new xr({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:me.ready};return c&&i.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=me.error),u},function(o){var s=pd(o)?o:new xr({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=me.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,g=m===void 0?!1:m,w=t.context,_=w===void 0?{}:w,S=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:g,context:_}),b=function(E){S.variables=E;var $=n.fetchQueryByPolicy(s,S,i);return S.fetchPolicy!=="standby"&&$.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),$},O=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(E){O(),setTimeout(function(){return D.cancel(E)})});var D=new xn(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(b):b(S.variables));return D.promise.then(O,O),D},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Aa("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;n&&this.getObservableQueries(n).forEach(function(f,p){l.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof ys&&f.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var g=u(m,p,h);return g===!0&&(g=m.refetch()),g!==!1&&d.set(m,g),g}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(f,p){var h=f.oq,m=f.lastDiff,g=f.diff,w;if(u){if(!g){var _=h.queryInfo;_.reset(),g=_.getDiff()}w=u(h,g,m)}(!u||w===!0)&&(w=h.refetch()),w!==!1&&d.set(h,w),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(b,O){O===void 0&&(O=e.networkStatus||me.loading);var D=b.result;__DEV__&&!l&&!Ie(D,{})&&zu(b.missing);var E=function($){return ie.of(A({data:$,loading:zr(O),networkStatus:O},b.complete?null:{partial:!0}))};return D&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:D},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function($){return E($.data||void 0)}):u==="none"&&O===me.refetch&&Array.isArray(b.missing)?E(void 0):E(D)},g=s==="no-cache"?0:i===me.refetch&&c!=="merge"?1:2,w=function(){return n.getResultsFromLink(e,g,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},_=f&&typeof p=="number"&&p!==i&&zr(i);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:l||_?[m(S),w()]:[w()]}case"cache-and-network":{var S=h();return S.complete||l||_?[m(S),w()]:[w()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return _?[m(h()),w()]:[w()];case"no-cache":return _?[m(e.getDiff()),w()]:[w()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new ys(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return A(A({},t),{clientAwareness:this.clientAwareness})},r}();var hd=!1;var Hu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,g=e.assumeImmutableResults,w=g===void 0?!1:g,_=e.resolvers,S=e.typeDefs,b=e.fragmentMatcher,O=e.name,D=e.version,E=e.link;if(E||(E=i?new _u({uri:i,credentials:n,headers:a}):Ut.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=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!hd&&f&&__DEV__&&(hd=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var $=window.navigator,P=$&&$.userAgent,R=void 0;typeof P=="string"&&(P.indexOf("Chrome/")>-1?R="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":P.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=Xp,this.localState=new gs({cache:o,client:this,resolvers:_,fragmentMatcher:b}),this.queryManager=new dd({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:O,version:D},localState:this.localState,assumeImmutableResults:w,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ia(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=A(A({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ia(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=A(A({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ia(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return In(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&L.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Ap(gi?"log":"silent");function pt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Ar(r){return pt(r)==="object"}function md(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Gu(r,e){return r.length<124?r:e}var gd="graphql-transport-ws";var wt;(function(r){r[r.InternalServerError=4500]="InternalServerError",r[r.InternalClientError=4005]="InternalClientError",r[r.BadRequest=4400]="BadRequest",r[r.BadResponse=4004]="BadResponse",r[r.Unauthorized=4401]="Unauthorized",r[r.Forbidden=4403]="Forbidden",r[r.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",r[r.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",r[r.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",r[r.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",r[r.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(wt||(wt={}));var Pe;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Pe||(Pe={}));function yd(r){if(!Ar(r))throw new Error(`Message is expected to be an object, but got ${pt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${pt(r.type)}`);switch(r.type){case Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(r.payload!=null&&!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Pe.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${pt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${pt(r.payload.query)}`);if(r.payload.variables!=null&&!Ar(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${pt(r.payload.variables)}`);if(r.payload.operationName!=null&&pt(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${pt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Ar(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${pt(r.payload.extensions)}`);break}case Pe.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${pt(r.payload)}`);break}case Pe.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!md(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Pe.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${pt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function vd(r,e){return yd(typeof r=="string"?JSON.parse(r,e):r)}function $n(r,e){return yd(r),JSON.stringify(r,e)}function Ku(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(we){let _e=1e3;for(let ue=0;ue<we;ue++)_e*=2;await new Promise(ue=>setTimeout(ue,_e+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=bs,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{let _e=Math.random()*16|0;return(we=="x"?_e:_e&3|8).toString(16)})},jsonMessageReplacer:g,jsonMessageReviver:w}=r,_;if(h){if(!ev(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=_,b=(()=>{let j=(()=>{let _e={};return{on(ue,le){return _e[ue]=le,()=>{delete _e[ue]}},emit(ue){var le;"id"in ue&&((le=_e[ue.id])===null||le===void 0||le.call(_e,ue))}}})(),we={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[j.emit,p.message]:[j.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:j.on,on(_e,ue){let le=we[_e];return le.push(ue),()=>{le.splice(le.indexOf(ue),1)}},emit(_e,...ue){for(let le of[...we[_e]])le(...ue)}}})();function O(j){let we=[b.on("error",_e=>{we.forEach(ue=>ue()),j(_e)}),b.on("closed",_e=>{we.forEach(ue=>ue()),j(_e)})]}let D,E=0,$,P=!1,R=0,M=!1;async function Ae(){clearTimeout($);let[j,we]=await(D??(D=new Promise((le,rr)=>(async()=>{if(P){if(await l(R),!E)return D=void 0,rr({code:1e3,reason:"All Subscriptions Gone"});R++}b.emit("connecting");let re=new S(typeof e=="function"?await e():e,gd),ir,Pr;function Lo(){isFinite(o)&&o>0&&(clearTimeout(Pr),Pr=setTimeout(()=>{re.readyState===S.OPEN&&(re.send($n({type:Pe.Ping})),b.emit("ping",!1,void 0))},o))}O(Ze=>{D=void 0,clearTimeout(ir),clearTimeout(Pr),rr(Ze),bs(Ze)&&Ze.code===4499&&(re.close(4499,"Terminated"),re.onerror=null,re.onclose=null)}),re.onerror=Ze=>b.emit("error",Ze),re.onclose=Ze=>b.emit("closed",Ze),re.onopen=async()=>{try{b.emit("opened",re);let Ze=typeof t=="function"?await t():t;if(re.readyState!==S.OPEN)return;re.send($n(Ze?{type:Pe.ConnectionInit,payload:Ze}:{type:Pe.ConnectionInit},g)),isFinite(c)&&c>0&&(ir=setTimeout(()=>{re.close(wt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Lo()}catch(Ze){b.emit("error",Ze),re.close(wt.InternalClientError,Gu(Ze instanceof Error?Ze.message:new Error(Ze).message,"Internal client error"))}};let yn=!1;re.onmessage=({data:Ze})=>{try{let Ye=vd(Ze,w);if(b.emit("message",Ye),Ye.type==="ping"||Ye.type==="pong"){b.emit(Ye.type,!0,Ye.payload),Ye.type==="pong"?Lo():s||(re.send($n(Ye.payload?{type:Pe.Pong,payload:Ye.payload}:{type:Pe.Pong})),b.emit("pong",!1,Ye.payload));return}if(yn)return;if(Ye.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Ye.type}`);clearTimeout(ir),yn=!0,b.emit("connected",re,Ye.payload),P=!1,R=0,le([re,new Promise((R_,ng)=>O(ng))])}catch(Ye){re.onmessage=null,b.emit("error",Ye),re.close(wt.BadResponse,Gu(Ye instanceof Error?Ye.message:new Error(Ye).message,"Bad response"))}}})())));j.readyState===S.CLOSING&&await we;let _e=()=>{},ue=new Promise(le=>_e=le);return[j,_e,Promise.race([ue.then(()=>{if(!E){let le=()=>j.close(1e3,"Normal Closure");isFinite(a)&&a>0?$=setTimeout(()=>{j.readyState===S.OPEN&&le()},a):le()}}),we])]}function se(j){if(bs(j)&&(Xy(j.code)||[wt.InternalServerError,wt.InternalClientError,wt.BadRequest,wt.BadResponse,wt.Unauthorized,wt.SubprotocolNotAcceptable,wt.SubscriberAlreadyExists,wt.TooManyInitialisationRequests].includes(j.code)))throw j;if(M)return!1;if(bs(j)&&j.code===1e3)return E>0;if(!u||R>=u||!d(j)||f?.(j))throw j;return P=!0}return i||(async()=>{for(E++;;)try{let[,,j]=await Ae();await j}catch(j){try{if(!se(j))return}catch(we){return n?.(we)}}})(),{on:b.on,subscribe(j,we){let _e=m(j),ue=!1,le=!1,rr=()=>{E--,ue=!0};return(async()=>{for(E++;;)try{let[re,ir,Pr]=await Ae();if(ue)return ir();let Lo=b.onMessage(_e,yn=>{switch(yn.type){case Pe.Next:{we.next(yn.payload);return}case Pe.Error:{le=!0,ue=!0,we.error(yn.payload),rr();return}case Pe.Complete:{ue=!0,rr();return}}});re.send($n({id:_e,type:Pe.Subscribe,payload:j},g)),rr=()=>{!ue&&re.readyState===S.OPEN&&re.send($n({id:_e,type:Pe.Complete},g)),E--,ue=!0,ir()},await Pr.finally(Lo);return}catch(re){if(!se(re))return}})().then(()=>{le||we.complete()}).catch(re=>{we.error(re)}),()=>{ue||rr()}},async dispose(){if(M=!0,D){let[j]=await D;j.close(1e3,"Normal Closure")}},terminate(){D&&b.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function bs(r){return Ar(r)&&"code"in r&&"reason"in r}function Xy(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function ev(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function tv(r){return pe(r)&&"code"in r&&"reason"in r}var bd=function(r){$e(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new ie(function(n){return i.client.subscribe(A(A({},t),{query:vn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):tv(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new xr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Ut);var ws="0.12.0-rc1";function _s(){return typeof window!="undefined"&&window.self!==window.top}function Ju(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function kt(r,e){Ju()&&localStorage.setItem(`${ws}/${r}`,e)}function Ss(r){return Ju()?localStorage.getItem(`${ws}/${r}`):null}function Ra(r){Ju()&&localStorage.removeItem(`${ws}/${r}`)}function Rn(r,e=1e4){return J(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}var tc=function(){return tc=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},tc.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ls(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ls=function(t){return typeof t}:Ls=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ls(r)}function iv(r){return Ls(r)=="object"&&r!==null}var Fh=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function gl(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function nv(r){return Mh(r.source,gl(r.source,r.start))}function Mh(r,e){var t=r.locationOffset.column-1,i=Fs(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
|
|
52
|
+
`),l=i.split(/\r\n|[\n\r]/g),d=l[n];if(d.length>120){for(var f=Math.floor(c/80),p=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return u+wd([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(g){return["",g]}),[[" ",Fs(p-1)+"^"],["",h[f+1]]]))}return u+wd([["".concat(o-1),l[n-1]],["".concat(o),d],["",Fs(c-1)+"^"],["".concat(o+1),l[n+1]]])}function wd(r){var e=r.filter(function(i){i[0];var n=i[1];return n!==void 0}),t=Math.max.apply(Math,e.map(function(i){var n=i[0];return n.length}));return e.map(function(i){var n=i[0],a=i[1];return av(t,n)+(a?" | "+a:" |")}).join(`
|
|
53
|
+
`)}function Fs(r){return Array(r+1).join(" ")}function av(r,e){return Fs(r-e.length)+e}function Ms(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ms=function(t){return typeof t}:Ms=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ms(r)}function _d(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(r);e&&(i=i.filter(function(n){return Object.getOwnPropertyDescriptor(r,n).enumerable})),t.push.apply(t,i)}return t}function ov(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_d(Object(t),!0).forEach(function(i){sv(r,i,t[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_d(Object(t)).forEach(function(i){Object.defineProperty(r,i,Object.getOwnPropertyDescriptor(t,i))})}return r}function sv(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function cv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Sd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function uv(r,e,t){return e&&Sd(r.prototype,e),t&&Sd(r,t),r}function lv(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(e&&e.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),e&&so(r,e)}function pv(r){var e=Uh();return function(){var i=co(r),n;if(e){var a=co(this).constructor;n=Reflect.construct(i,arguments,a)}else n=i.apply(this,arguments);return jh(this,n)}}function jh(r,e){return e&&(Ms(e)==="object"||typeof e=="function")?e:ja(r)}function ja(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function yl(r){var e=typeof Map=="function"?new Map:void 0;return yl=function(i){if(i===null||!fv(i))return i;if(typeof i!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(i))return e.get(i);e.set(i,n)}function n(){return js(i,arguments,co(this).constructor)}return n.prototype=Object.create(i.prototype,{constructor:{value:n,enumerable:!1,writable:!0,configurable:!0}}),so(n,i)},yl(r)}function js(r,e,t){return Uh()?js=Reflect.construct:js=function(n,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(n,s),u=new c;return o&&so(u,o.prototype),u},js.apply(null,arguments)}function Uh(){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 fv(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function so(r,e){return so=Object.setPrototypeOf||function(i,n){return i.__proto__=n,i},so(r,e)}function co(r){return co=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},co(r)}var dv=function(r){lv(t,r);var e=pv(t);function t(i,n,a,o,s,c,u){var l,d,f,p;cv(this,t),p=e.call(this,i),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=Ed(Array.isArray(n)?n:n?[n]:void 0);for(var h=[],m=0,g=(w=p.nodes)!==null&&w!==void 0?w:[];m<g.length;m++){var w,_=g[m],S=_.loc;S!=null&&h.push(S)}h=Ed(h),p.source=a??((l=h)===null||l===void 0?void 0:l[0].source),p.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(O){return O.start})),p.locations=o&&a?o.map(function(O){return gl(a,O)}):(f=h)===null||f===void 0?void 0:f.map(function(O){return gl(O.source,O.start)}),p.path=s??void 0;var b=c?.extensions;return u==null&&iv(b)?p.extensions=ov({},b):p.extensions=u??{},Object.defineProperties(ja(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(ja(p),"stack",{value:c.stack,writable:!0,configurable:!0}),jh(p)):(Error.captureStackTrace?Error.captureStackTrace(ja(p),t):Object.defineProperty(ja(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return uv(t,[{key:"toString",value:function(){return hv(this)}},{key:Fh,get:function(){return"Object"}}]),t}(yl(Error));function Ed(r){return r===void 0||r.length===0?void 0:r}function hv(r){var e=r.message;if(r.nodes)for(var t=0,i=r.nodes;t<i.length;t++){var n=i[t];n.loc&&(e+=`
|
|
54
54
|
|
|
55
55
|
`+nv(n.loc))}else if(r.source&&r.locations)for(var a=0,o=r.locations;a<o.length;a++){var s=o[a];e+=`
|
|
56
56
|
|
|
57
|
-
`+Mh(r.source,s)}return e}function Ct(r,e,t){return new dv("Syntax Error: ".concat(t),void 0,r,[e])}var
|
|
58
|
-
`)}function Ad(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function Ov(r){for(var e,t=!0,i=!0,n=0,a=null,o=0;o<r.length;++o)switch(r.charCodeAt(o)){case 13:r.charCodeAt(o+1)===10&&++o;case 10:t=!1,i=!0,n=0;break;case 9:case 32:++n;break;default:i&&!t&&(a===null||n<a)&&(a=n),i=!1}return(e=a)!==null&&e!==void 0?e:0}var Cv=function(){function r(t){var i=new
|
|
59
|
-
`;break;case 114:u+="\r";break;case 116:u+=" ";break;case 117:{var l=Mv(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 Ct(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw Ct(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw Ct(r,o,"Unterminated string.")}function Fv(r,e,t,i,n,a){for(var o=r.body,s=e+3,c=s,u=0,l="";s<o.length&&!isNaN(u=o.charCodeAt(s));){if(u===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(c,s),new Fe(C.BLOCK_STRING,e,s+3,t,i,n,kv(l));if(u<32&&u!==9&&u!==10&&u!==13)throw Ct(r,s,"Invalid character within String: ".concat(Vi(u),"."));u===10?(++s,++a.line,a.lineStart=s):u===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):u===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw Ct(r,s,"Unterminated string.")}function Mv(r,e,t,i){return Es(r)<<12|Es(e)<<8|Es(t)<<4|Es(i)}function Es(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function jv(r,e,t,i,n){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Fe(C.NAME,e,s,t,i,n,a.slice(e,s))}function Uv(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function qv(r,e){var t=new Bv(r,e);return t.parseDocument()}var Bv=function(){function r(t,i){var n=Iv(t)?t:new Qh(t);this._lexer=new Cv(n),this._options=i}var e=r.prototype;return e.parseName=function(){var i=this.expectToken(C.NAME);return{kind:G.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:G.DOCUMENT,definitions:this.many(C.SOF,this.parseDefinition,C.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(C.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(C.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(C.BRACE_L))return{kind:G.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(C.NAME)&&(a=this.parseName()),{kind:G.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(C.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(C.PAREN_L,this.parseVariableDefinition,C.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:G.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(C.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(C.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(C.DOLLAR),{kind:G.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:G.SELECTION_SET,selections:this.many(C.BRACE_L,this.parseSelection,C.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(C.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(C.COLON)?(a=n,o=this.parseName()):o=n,{kind:G.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(C.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(C.PAREN_L,n,C.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(C.COLON),{kind:G.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:G.ARGUMENT,name:this.parseName(),value:(this.expectToken(C.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(C.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(C.NAME)?{kind:G.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:G.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind:G.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:G.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(i){var n=this._lexer.token;switch(n.kind){case C.BRACKET_L:return this.parseList(i);case C.BRACE_L:return this.parseObject(i);case C.INT:return this._lexer.advance(),{kind:G.INT,value:n.value,loc:this.loc(n)};case C.FLOAT:return this._lexer.advance(),{kind:G.FLOAT,value:n.value,loc:this.loc(n)};case C.STRING:case C.BLOCK_STRING:return this.parseStringLiteral();case C.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:G.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:G.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:G.NULL,loc:this.loc(n)};default:return{kind:G.ENUM,value:n.value,loc:this.loc(n)}}case C.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:G.STRING,value:i.value,block:i.kind===C.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:G.LIST,values:this.any(C.BRACKET_L,o,C.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:G.OBJECT,fields:this.any(C.BRACE_L,o,C.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(C.COLON),{kind:G.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(C.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(C.AT),{kind:G.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(C.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(C.BRACKET_R),n={kind:G.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(C.BANG)?{kind:G.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:G.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===C.NAME)switch(i.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(i)},e.peekDescription=function(){return this.peek(C.STRING)||this.peek(C.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(C.BRACE_L,this.parseOperationTypeDefinition,C.BRACE_R);return{kind:G.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(C.COLON);var a=this.parseNamedType();return{kind:G.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:G.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:G.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(C.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(C.AMP)||this.peek(C.NAME));return n}return this.delimitedMany(C.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(C.BRACE_L)&&this._lexer.lookahead().kind===C.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(C.BRACE_L,this.parseFieldDefinition,C.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(C.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:G.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:c,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(C.PAREN_L,this.parseInputValueDef,C.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(C.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(C.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:G.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:G.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:G.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(C.EQUALS)?this.delimitedMany(C.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:G.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(C.BRACE_L,this.parseEnumValueDefinition,C.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:G.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:G.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(C.BRACE_L,this.parseInputValueDef,C.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===C.NAME)switch(i.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(C.BRACE_L,this.parseOperationTypeDefinition,C.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:G.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:G.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:G.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:G.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:G.UNION_TYPE_EXTENSION,name:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:G.ENUM_TYPE_EXTENSION,name:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:G.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(C.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:G.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(C.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(Tv[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new Bh(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw Ct(this._lexer.source,n.start,"Expected ".concat(zh(i),", found ").concat(Xu(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===C.NAME&&n.value===i)this._lexer.advance();else throw Ct(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(Xu(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===C.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return Ct(this._lexer.source,n.start,"Unexpected ".concat(Xu(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},r}();function Xu(r){var e=r.value;return zh(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function zh(r){return Nv(r)?'"'.concat(r,'"'):r}var qs=new Map,bl=new Map,Wh=!0,rc=!1;function Gh(r){return r.replace(/[\s,]+/g," ").trim()}function Vv(r){return Gh(r.source.body.substring(r.start,r.end))}function Qv(r){var e=new Set,t=[];return r.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=Vv(i.loc),o=bl.get(n);o&&!o.has(a)?Wh&&console.warn("Warning: fragment with name "+n+` already exists.
|
|
57
|
+
`+Mh(r.source,s)}return e}function Ct(r,e,t){return new dv("Syntax Error: ".concat(t),void 0,r,[e])}var H=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function mv(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var gv=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,vl=gv;function qh(r){var e=r.prototype.toJSON;typeof e=="function"||mv(0),r.prototype.inspect=e,vl&&(r.prototype[vl]=e)}var Bh=function(){function r(t,i,n){this.start=t.start,this.end=i.end,this.startToken=t,this.endToken=i,this.source=n}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();qh(Bh);var Me=function(){function r(t,i,n,a,o,s,c){this.kind=t,this.start=i,this.end=n,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();qh(Me);var C=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 Us(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Us=function(t){return typeof t}:Us=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Us(r)}var yv=10,Vh=2;function vv(r){return xc(r,[])}function xc(r,e){switch(Us(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":bv(r,e);default:return String(r)}}function bv(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),i=Sv(r);if(i!==void 0){var n=i.call(r);if(n!==r)return typeof n=="string"?n:xc(n,t)}else if(Array.isArray(r))return _v(r,t);return wv(r,t)}function wv(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Vh)return"["+Ev(r)+"]";var i=t.map(function(n){var a=xc(r[n],e);return n+": "+a});return"{ "+i.join(", ")+" }"}function _v(r,e){if(r.length===0)return"[]";if(e.length>Vh)return"[Array]";for(var t=Math.min(yv,r.length),i=r.length-t,n=[],a=0;a<t;++a)n.push(xc(r[a],e));return i===1?n.push("... 1 more item"):i>1&&n.push("... ".concat(i," more items")),"["+n.join(", ")+"]"}function Sv(r){var e=r[String(vl)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Ev(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function Zu(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var xv=function(e,t){return e instanceof t};function xd(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function Av(r,e,t){return e&&xd(r.prototype,e),t&&xd(r,t),r}var Qh=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||Zu(0,"Body must be a string. Received: ".concat(vv(e),".")),this.body=e,this.name=t,this.locationOffset=i,this.locationOffset.line>0||Zu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Zu(0,"column in locationOffset is 1-indexed and must be positive.")}return Av(r,[{key:Fh,get:function(){return"Source"}}]),r}();function Iv(r){return xv(r,Qh)}var Tv=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 kv(r){var e=r.split(/\r\n|[\n\r]/g),t=Ov(r);if(t!==0)for(var i=1;i<e.length;i++)e[i]=e[i].slice(t);for(var n=0;n<e.length&&Ad(e[n]);)++n;for(var a=e.length;a>n&&Ad(e[a-1]);)--a;return e.slice(n,a).join(`
|
|
58
|
+
`)}function Ad(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function Ov(r){for(var e,t=!0,i=!0,n=0,a=null,o=0;o<r.length;++o)switch(r.charCodeAt(o)){case 13:r.charCodeAt(o+1)===10&&++o;case 10:t=!1,i=!0,n=0;break;case 9:case 32:++n;break;default:i&&!t&&(a===null||n<a)&&(a=n),i=!1}return(e=a)!==null&&e!==void 0?e:0}var Cv=function(){function r(t){var i=new Me(C.SOF,0,0,0,0,null);this.source=t,this.lastToken=i,this.token=i,this.line=1,this.lineStart=0}var e=r.prototype;return e.advance=function(){this.lastToken=this.token;var i=this.token=this.lookahead();return i},e.lookahead=function(){var i=this.token;if(i.kind!==C.EOF)do{var n;i=(n=i.next)!==null&&n!==void 0?n:i.next=Dv(this,i)}while(i.kind===C.COMMENT);return i},r}();function Nv(r){return r===C.BANG||r===C.DOLLAR||r===C.AMP||r===C.PAREN_L||r===C.PAREN_R||r===C.SPREAD||r===C.COLON||r===C.EQUALS||r===C.AT||r===C.BRACKET_L||r===C.BRACKET_R||r===C.BRACE_L||r===C.PIPE||r===C.BRACE_R}function Vi(r){return isNaN(r)?C.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function Dv(r,e){for(var t=r.source,i=t.body,n=i.length,a=e.end;a<n;){var o=i.charCodeAt(a),s=r.line,c=1+a-r.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++r.line,r.lineStart=a;continue;case 13:i.charCodeAt(a+1)===10?a+=2:++a,++r.line,r.lineStart=a;continue;case 33:return new Me(C.BANG,a,a+1,s,c,e);case 35:return Rv(t,a,s,c,e);case 36:return new Me(C.DOLLAR,a,a+1,s,c,e);case 38:return new Me(C.AMP,a,a+1,s,c,e);case 40:return new Me(C.PAREN_L,a,a+1,s,c,e);case 41:return new Me(C.PAREN_R,a,a+1,s,c,e);case 46:if(i.charCodeAt(a+1)===46&&i.charCodeAt(a+2)===46)return new Me(C.SPREAD,a,a+3,s,c,e);break;case 58:return new Me(C.COLON,a,a+1,s,c,e);case 61:return new Me(C.EQUALS,a,a+1,s,c,e);case 64:return new Me(C.AT,a,a+1,s,c,e);case 91:return new Me(C.BRACKET_L,a,a+1,s,c,e);case 93:return new Me(C.BRACKET_R,a,a+1,s,c,e);case 123:return new Me(C.BRACE_L,a,a+1,s,c,e);case 124:return new Me(C.PIPE,a,a+1,s,c,e);case 125:return new Me(C.BRACE_R,a,a+1,s,c,e);case 34:return i.charCodeAt(a+1)===34&&i.charCodeAt(a+2)===34?Fv(t,a,s,c,e,r):Lv(t,a,s,c,e);case 45:case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return Pv(t,a,o,s,c,e);case 65:case 66:case 67:case 68:case 69:case 70:case 71:case 72:case 73:case 74:case 75:case 76:case 77:case 78:case 79:case 80:case 81:case 82:case 83:case 84:case 85:case 86:case 87:case 88:case 89:case 90:case 95:case 97:case 98:case 99:case 100:case 101:case 102:case 103:case 104:case 105:case 106:case 107:case 108:case 109:case 110:case 111:case 112:case 113:case 114:case 115:case 116:case 117:case 118:case 119:case 120:case 121:case 122:return jv(t,a,s,c,e)}throw Ct(t,a,$v(o))}var u=r.line,l=1+a-r.lineStart;return new Me(C.EOF,n,n,u,l,e)}function $v(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(Vi(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Vi(r),".")}function Rv(r,e,t,i,n){var a=r.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Me(C.COMMENT,e,s,t,i,n,a.slice(e+1,s))}function Pv(r,e,t,i,n,a){var o=r.body,s=t,c=e,u=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw Ct(r,c,"Invalid number, unexpected digit after 0: ".concat(Vi(s),"."))}else c=Yu(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=Yu(r,c,s),s=o.charCodeAt(c)),(s===69||s===101)&&(u=!0,s=o.charCodeAt(++c),(s===43||s===45)&&(s=o.charCodeAt(++c)),c=Yu(r,c,s),s=o.charCodeAt(c)),s===46||Uv(s))throw Ct(r,c,"Invalid number, expected digit but got: ".concat(Vi(s),"."));return new Me(u?C.FLOAT:C.INT,e,c,i,n,a,o.slice(e,c))}function Yu(r,e,t){var i=r.body,n=e,a=t;if(a>=48&&a<=57){do a=i.charCodeAt(++n);while(a>=48&&a<=57);return n}throw Ct(r,n,"Invalid number, expected digit but got: ".concat(Vi(a),"."))}function Lv(r,e,t,i,n){for(var a=r.body,o=e+1,s=o,c=0,u="";o<a.length&&!isNaN(c=a.charCodeAt(o))&&c!==10&&c!==13;){if(c===34)return u+=a.slice(s,o),new Me(C.STRING,e,o+1,t,i,n,u);if(c<32&&c!==9)throw Ct(r,o,"Invalid character within String: ".concat(Vi(c),"."));if(++o,c===92){switch(u+=a.slice(s,o-1),c=a.charCodeAt(o),c){case 34:u+='"';break;case 47:u+="/";break;case 92:u+="\\";break;case 98:u+="\b";break;case 102:u+="\f";break;case 110:u+=`
|
|
59
|
+
`;break;case 114:u+="\r";break;case 116:u+=" ";break;case 117:{var l=Mv(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 Ct(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw Ct(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw Ct(r,o,"Unterminated string.")}function Fv(r,e,t,i,n,a){for(var o=r.body,s=e+3,c=s,u=0,l="";s<o.length&&!isNaN(u=o.charCodeAt(s));){if(u===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(c,s),new Me(C.BLOCK_STRING,e,s+3,t,i,n,kv(l));if(u<32&&u!==9&&u!==10&&u!==13)throw Ct(r,s,"Invalid character within String: ".concat(Vi(u),"."));u===10?(++s,++a.line,a.lineStart=s):u===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):u===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw Ct(r,s,"Unterminated string.")}function Mv(r,e,t,i){return Es(r)<<12|Es(e)<<8|Es(t)<<4|Es(i)}function Es(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function jv(r,e,t,i,n){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Me(C.NAME,e,s,t,i,n,a.slice(e,s))}function Uv(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function qv(r,e){var t=new Bv(r,e);return t.parseDocument()}var Bv=function(){function r(t,i){var n=Iv(t)?t:new Qh(t);this._lexer=new Cv(n),this._options=i}var e=r.prototype;return e.parseName=function(){var i=this.expectToken(C.NAME);return{kind:H.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:H.DOCUMENT,definitions:this.many(C.SOF,this.parseDefinition,C.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(C.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(C.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(C.BRACE_L))return{kind:H.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(C.NAME)&&(a=this.parseName()),{kind:H.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(C.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(C.PAREN_L,this.parseVariableDefinition,C.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:H.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(C.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(C.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(C.DOLLAR),{kind:H.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:H.SELECTION_SET,selections:this.many(C.BRACE_L,this.parseSelection,C.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(C.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(C.COLON)?(a=n,o=this.parseName()):o=n,{kind:H.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(C.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(C.PAREN_L,n,C.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(C.COLON),{kind:H.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:H.ARGUMENT,name:this.parseName(),value:(this.expectToken(C.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(C.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(C.NAME)?{kind:H.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:H.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind:H.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}:{kind:H.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(i){var n=this._lexer.token;switch(n.kind){case C.BRACKET_L:return this.parseList(i);case C.BRACE_L:return this.parseObject(i);case C.INT:return this._lexer.advance(),{kind:H.INT,value:n.value,loc:this.loc(n)};case C.FLOAT:return this._lexer.advance(),{kind:H.FLOAT,value:n.value,loc:this.loc(n)};case C.STRING:case C.BLOCK_STRING:return this.parseStringLiteral();case C.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:H.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:H.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:H.NULL,loc:this.loc(n)};default:return{kind:H.ENUM,value:n.value,loc:this.loc(n)}}case C.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:H.STRING,value:i.value,block:i.kind===C.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:H.LIST,values:this.any(C.BRACKET_L,o,C.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:H.OBJECT,fields:this.any(C.BRACE_L,o,C.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(C.COLON),{kind:H.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(C.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(C.AT),{kind:H.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(C.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(C.BRACKET_R),n={kind:H.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(C.BANG)?{kind:H.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:H.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===C.NAME)switch(i.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(i)},e.peekDescription=function(){return this.peek(C.STRING)||this.peek(C.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(C.BRACE_L,this.parseOperationTypeDefinition,C.BRACE_R);return{kind:H.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(C.COLON);var a=this.parseNamedType();return{kind:H.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:H.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:H.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(C.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(C.AMP)||this.peek(C.NAME));return n}return this.delimitedMany(C.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(C.BRACE_L)&&this._lexer.lookahead().kind===C.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(C.BRACE_L,this.parseFieldDefinition,C.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(C.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:H.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:c,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(C.PAREN_L,this.parseInputValueDef,C.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(C.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(C.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:H.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:H.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:H.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(C.EQUALS)?this.delimitedMany(C.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:H.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(C.BRACE_L,this.parseEnumValueDefinition,C.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:H.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:H.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(C.BRACE_L,this.parseInputValueDef,C.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===C.NAME)switch(i.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(C.BRACE_L,this.parseOperationTypeDefinition,C.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:H.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:H.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:H.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:H.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.UNION_TYPE_EXTENSION,name:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.ENUM_TYPE_EXTENSION,name:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:H.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(C.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:H.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(C.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(Tv[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new Bh(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw Ct(this._lexer.source,n.start,"Expected ".concat(zh(i),", found ").concat(Xu(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===C.NAME&&n.value===i)this._lexer.advance();else throw Ct(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(Xu(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===C.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return Ct(this._lexer.source,n.start,"Unexpected ".concat(Xu(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},r}();function Xu(r){var e=r.value;return zh(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function zh(r){return Nv(r)?'"'.concat(r,'"'):r}var qs=new Map,bl=new Map,Wh=!0,rc=!1;function Hh(r){return r.replace(/[\s,]+/g," ").trim()}function Vv(r){return Hh(r.source.body.substring(r.start,r.end))}function Qv(r){var e=new Set,t=[];return r.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=Vv(i.loc),o=bl.get(n);o&&!o.has(a)?Wh&&console.warn("Warning: fragment with name "+n+` 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||bl.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(i))}else t.push(i)}),tc(tc({},r),{definitions:t})}function zv(r){var e=new Set(r.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function Wv(r){var e=Gh(r);if(!qs.has(e)){var t=qv(r,{experimentalFragmentVariables:rc,allowLegacyFragmentVariables:rc});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");qs.set(e,zv(Qv(t)))}return qs.get(e)}function I(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var i=r[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=r[a+1]}),Wv(i)}function Gv(){qs.clear(),bl.clear()}function Hv(){Wh=!1}function Kv(){rc=!0}function Jv(){rc=!1}var Pa={gql:I,resetCaches:Gv,disableFragmentWarnings:Hv,enableExperimentalFragmentVariables:Kv,disableExperimentalFragmentVariables:Jv};(function(r){r.gql=Pa.gql,r.resetCaches=Pa.resetCaches,r.disableFragmentWarnings=Pa.disableFragmentWarnings,r.enableExperimentalFragmentVariables=Pa.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=Pa.disableExperimentalFragmentVariables})(I||(I={}));I.default=I;function T(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function Zv(){}function pi(){return Zv}var Y=pi,g=pi,Ke=pi,ve=pi,H=pi,Rt=pi,Yv=pi,Vl=pi,Hh=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Kh=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Qi=class{constructor(e){this.code=e}};Hh([g(),Kh("design:type",String)],Qi.prototype,"code",void 0);Qi=Hh([H(),Kh("design:paramtypes",[String])],Qi);var Ql=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},zl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},hr=class{constructor(e,t){this.address=e,this.name=t}};Ql([g(),zl("design:type",String)],hr.prototype,"address",void 0);Ql([g(),zl("design:type",String)],hr.prototype,"name",void 0);hr=Ql([H(),zl("design:paramtypes",[String,String])],hr);var ke=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Qe=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Dr=class{constructor(e,t){this.key=t,this.signature=e}};ke([g(),Qe("design:type",String)],Dr.prototype,"signature",void 0);ke([g(),Qe("design:type",String)],Dr.prototype,"key",void 0);ke([g(),Qe("design:type",Boolean)],Dr.prototype,"valid",void 0);ke([g(),Qe("design:type",Boolean)],Dr.prototype,"invalid",void 0);Dr=ke([H(),Ke(),Qe("design:paramtypes",[String,String])],Dr);var zi=class{};ke([g(),Qe("design:type",String)],zi.prototype,"signature",void 0);ke([g(),Qe("design:type",String)],zi.prototype,"key",void 0);ke([g(),Qe("design:type",Boolean)],zi.prototype,"valid",void 0);ke([g(),Qe("design:type",Boolean)],zi.prototype,"invalid",void 0);zi=ke([Ke()],zi);function fi(r){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return ke([g(),Qe("design:type",String)],e.prototype,"author",void 0),ke([g(),Qe("design:type",String)],e.prototype,"timestamp",void 0),ke([g(),Qe("design:type",Object)],e.prototype,"data",void 0),ke([g(),Qe("design:type",Dr)],e.prototype,"proof",void 0),e=ke([H(),Qe("design:paramtypes",[String,String,Object,Dr])],e),e}function Xv(r){let e=class{};return ke([g(),Qe("design:type",String)],e.prototype,"author",void 0),ke([g(),Qe("design:type",String)],e.prototype,"timestamp",void 0),ke([g(),Qe("design:type",Object)],e.prototype,"data",void 0),ke([g(),Qe("design:type",zi)],e.prototype,"proof",void 0),e=ke([Ke()],e),e}var Id=class extends fi(){};Id=ke([H()],Id);var ic=class extends fi(){};ke([g(),Qe("design:type",hr)],ic.prototype,"language",void 0);ke([g(),Qe("design:type",Qi)],ic.prototype,"icon",void 0);ic=ke([H()],ic);function vk(r){return r&&r.author&&r.timestamp&&r.data}var Ue=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},nt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Wi=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Ue([g(),nt("design:type",String)],Wi.prototype,"source",void 0);Ue([g(),nt("design:type",String)],Wi.prototype,"target",void 0);Ue([g(),nt("design:type",String)],Wi.prototype,"predicate",void 0);Wi=Ue([H(),nt("design:paramtypes",[Object])],Wi);var nc=class{};Ue([g(),nt("design:type",Array)],nc.prototype,"additions",void 0);Ue([g(),nt("design:type",Array)],nc.prototype,"removals",void 0);nc=Ue([Ke()],nc);var ac=class{constructor(e,t){this.additions=e,this.removals=t}};Ue([g(),nt("design:type",Array)],ac.prototype,"additions",void 0);Ue([g(),nt("design:type",Array)],ac.prototype,"removals",void 0);ac=Ue([H(),nt("design:paramtypes",[Array,Array])],ac);var uo=class{};Ue([g(),nt("design:type",String)],uo.prototype,"source",void 0);Ue([g(),nt("design:type",String)],uo.prototype,"target",void 0);Ue([g(),nt("design:type",String)],uo.prototype,"predicate",void 0);uo=Ue([Ke()],uo);var ai=class extends fi(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),t=(t<<5)-t+n,t|=0;return t}};Ue([g(),nt("design:type",String)],ai.prototype,"status",void 0);ai=Ue([H()],ai);var wl=class extends Xv(){};Ue([g(),nt("design:type",String)],wl.prototype,"status",void 0);wl=Ue([Ke()],wl);function Ak(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function Ik(r){return r&&r.source&&r.target}var oc=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Ue([g(),nt("design:type",ai)],oc.prototype,"oldLink",void 0);Ue([g(),nt("design:type",ai)],oc.prototype,"newLink",void 0);oc=Ue([H(),nt("design:paramtypes",[ai,ai])],oc);var tn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Eo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},_l,yr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(i=>i.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};tn([g(),Eo("design:type",Array)],yr.prototype,"links",void 0);yr=tn([H(),Eo("design:paramtypes",[Array])],yr);var sc=class{};tn([g(),Eo("design:type",Array)],sc.prototype,"links",void 0);sc=tn([Ke()],sc);var Sl=_l=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new _l;return t.links.push(e),t}};tn([g(),Eo("design:type",Array)],Sl.prototype,"links",void 0);Sl=_l=tn([Ke(),Eo("design:paramtypes",[Array])],Sl);var Gi=class extends fi(){};Gi=tn([H()],Gi);var q=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},B=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ei=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new yr}};q([g(),B("design:type",String)],ei.prototype,"did",void 0);q([g(),B("design:type",yr)],ei.prototype,"perspective",void 0);q([g(),B("design:type",String)],ei.prototype,"directMessageLanguage",void 0);ei=q([H(),B("design:paramtypes",[String,yr])],ei);var Td=class extends fi(){};Td=q([H()],Td);var oi=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],oi.prototype,"did",void 0);q([g(),B("design:type",String)],oi.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],oi.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],oi.prototype,"didSignedByDeviceKey",void 0);oi=q([H(),B("design:paramtypes",[String,String,String,String,String,String])],oi);var si=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([g(),B("design:type",String)],si.prototype,"did",void 0);q([g(),B("design:type",String)],si.prototype,"didSigningKeyId",void 0);q([g(),B("design:type",String)],si.prototype,"deviceKeyType",void 0);q([g(),B("design:type",String)],si.prototype,"deviceKey",void 0);q([g(),B("design:type",String)],si.prototype,"deviceKeySignedByDid",void 0);q([g(),B("design:type",String)],si.prototype,"didSignedByDeviceKey",void 0);si=q([Ke(),B("design:paramtypes",[String,String,String,String,String,String])],si);var cc=class{constructor(e,t){this.signature=e,this.publicKey=t}};q([g(),B("design:type",String)],cc.prototype,"signature",void 0);q([g(),B("design:type",String)],cc.prototype,"publicKey",void 0);cc=q([H(),B("design:paramtypes",[String,String])],cc);var Gn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([g(),B("design:type",String)],Gn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Gn.prototype,"pointers",void 0);Gn=q([H(),B("design:paramtypes",[String,Array])],Gn);var uc=class{constructor(e,t){this.with=e,this.can=t}};q([g(),B("design:type",Gn)],uc.prototype,"with",void 0);q([g(),B("design:type",Array)],uc.prototype,"can",void 0);uc=q([H(),B("design:paramtypes",[Gn,Array])],uc);var $r=class{constructor(e,t,i,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};q([g(),B("design:type",String)],$r.prototype,"appName",void 0);q([g(),B("design:type",String)],$r.prototype,"appDesc",void 0);q([g(),B("design:type",String)],$r.prototype,"appUrl",void 0);q([g(),B("design:type",String)],$r.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],$r.prototype,"capabilities",void 0);$r=q([H(),B("design:paramtypes",[String,String,String,Array,String])],$r);var Hn=class{constructor(e,t,i,n){this.requestId=e,this.auth=t,this.token=i,this.revoked=n}};q([g(),B("design:type",String)],Hn.prototype,"requestId",void 0);q([g(),B("design:type",String)],Hn.prototype,"token",void 0);q([g(),B("design:type",Boolean)],Hn.prototype,"revoked",void 0);q([g(),B("design:type",$r)],Hn.prototype,"auth",void 0);Hn=q([H(),B("design:paramtypes",[String,$r,String,Boolean])],Hn);var Kn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([g(),B("design:type",String)],Kn.prototype,"domain",void 0);q([g(),B("design:type",Array)],Kn.prototype,"pointers",void 0);Kn=q([Ke(),B("design:paramtypes",[String,Array])],Kn);var lc=class{constructor(e,t){this.with=e,this.can=t}};q([g(),B("design:type",Kn)],lc.prototype,"with",void 0);q([g(),B("design:type",Array)],lc.prototype,"can",void 0);lc=q([Ke(),B("design:paramtypes",[Kn,Array])],lc);var vr=class{constructor(e,t,i,n,a,o){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};q([g(),B("design:type",String)],vr.prototype,"appName",void 0);q([g(),B("design:type",String)],vr.prototype,"appDesc",void 0);q([g(),B("design:type",String)],vr.prototype,"appDomain",void 0);q([g(),B("design:type",String)],vr.prototype,"appUrl",void 0);q([g(),B("design:type",String)],vr.prototype,"appIconPath",void 0);q([g(),B("design:type",Array)],vr.prototype,"capabilities",void 0);vr=q([Ke(),B("design:paramtypes",[String,String,String,String,String,Array])],vr);var Hi=class{constructor(e,t,i){this.did=e,this.success=t,this.error=i}};q([g(),B("design:type",String)],Hi.prototype,"did",void 0);q([g(),B("design:type",Boolean)],Hi.prototype,"success",void 0);q([g(),B("design:type",String)],Hi.prototype,"error",void 0);Hi=q([H(),B("design:paramtypes",[String,Boolean,String])],Hi);var ra=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ia=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Vt=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)}};ra([g(),ia("design:type",Boolean)],Vt.prototype,"isInitialized",void 0);ra([g(),ia("design:type",Boolean)],Vt.prototype,"isUnlocked",void 0);ra([g(),ia("design:type",String)],Vt.prototype,"did",void 0);ra([g(),ia("design:type",String)],Vt.prototype,"didDocument",void 0);ra([g(),ia("design:type",String)],Vt.prototype,"error",void 0);Vt=ra([H(),ia("design:paramtypes",[Object])],Vt);var kd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Pe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_t,St,El=class{constructor(e,t){_t.set(this,void 0),St.set(this,void 0),kd(this,_t,e,"f"),kd(this,St,t,"f")}async otherAgents(){return await Pe(this,_t,"f").otherAgents(Pe(this,St,"f"))}async hasTelepresenceAdapter(){return await Pe(this,_t,"f").hasTelepresenceAdapter(Pe(this,St,"f"))}async onlineAgents(){return await Pe(this,_t,"f").onlineAgents(Pe(this,St,"f"))}async setOnlineStatus(e){return await Pe(this,_t,"f").setOnlineStatus(Pe(this,St,"f"),e)}async setOnlineStatusU(e){return await Pe(this,_t,"f").setOnlineStatusU(Pe(this,St,"f"),e)}async sendSignal(e,t){return await Pe(this,_t,"f").sendSignal(Pe(this,St,"f"),e,t)}async sendSignalU(e,t){return await Pe(this,_t,"f").sendSignalU(Pe(this,St,"f"),e,t)}async sendBroadcast(e,t=!1){return await Pe(this,_t,"f").sendBroadcast(Pe(this,St,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Pe(this,_t,"f").sendBroadcastU(Pe(this,St,"f"),e,t)}async addSignalHandler(e){await Pe(this,_t,"f").addSignalHandler(Pe(this,St,"f"),e)}removeSignalHandler(e){Pe(this,_t,"f").removeSignalHandler(Pe(this,St,"f"),e)}};_t=new WeakMap,St=new WeakMap;var rn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},nn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},rt=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)}};rn([g(),nn("design:type",String)],rt.prototype,"source",void 0);rn([g(),nn("design:type",String)],rt.prototype,"target",void 0);rn([g(),nn("design:type",String)],rt.prototype,"predicate",void 0);rn([g(),nn("design:type",Date)],rt.prototype,"fromDate",void 0);rn([g(),nn("design:type",Date)],rt.prototype,"untilDate",void 0);rn([g(),nn("design:type",Number)],rt.prototype,"limit",void 0);rt=rn([H(),Ke(),nn("design:paramtypes",[Object])],rt);var Od=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},et=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Et,Tr;function xs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var it=class{constructor(){Et.set(this,void 0),Tr.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let t=new it;return Od(t,Tr,e,"f"),t}static from(e){let t=new it;return Od(t,Et,e,"f"),t}toUrl(){if(et(this,Tr,"f")&&!et(this,Et,"f"))return et(this,Tr,"f");if(!et(this,Tr,"f")&&(et(this,Et,"f")===void 0||et(this,Et,"f")===""||et(this,Et,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof et(this,Et,"f")){case"string":e=`string:${xs(et(this,Et,"f"))}`;break;case"number":e=`number:${xs(et(this,Et,"f"))}`;break;case"boolean":e=`boolean:${xs(et(this,Et,"f"))}`;break;case"object":e=`json:${xs(JSON.stringify(et(this,Et,"f")))}`;break}return`literal://${e}`}get(){if(et(this,Et,"f"))return et(this,Et,"f");if(!et(this,Tr,"f"))throw new Error("Can't render empty Literal");if(!et(this,Tr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=et(this,Tr,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};Et=new WeakMap,Tr=new WeakMap;function ti(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Wl(r){return`set${ti(r)}`}function Qn(r){return r.endsWith("y")?r.slice(0,-1)+"ies":r+"s"}function Gl(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function eb(r){return`add${ti(Gl(r))}`}function tb(r){let e=r.substring(3),t=Qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function rb(r){return`remove${ti(Gl(r))}`}function ib(r){let e=r.substring(6),t=Qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function nb(r){let e=r.substring(13),t=Qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function ab(r){return`setCollection${ti(Gl(r))}`}function ki(r){if(Array.isArray(r))return`[${r.map(ki).join(", ")}]`;let e=Object.keys(r),t=[];for(let i of e){let n=JSON.stringify(r[i]),a=`${i}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var el=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ee=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ft,dt,Le,zn=class{constructor(r,e,t){ft.set(this,void 0),dt.set(this,void 0),Le.set(this,void 0),el(this,ft,e,"f"),el(this,dt,t,"f"),el(this,Le,r,"f")}get baseExpression(){return ee(this,ft,"f")}async init(){let isInstance=await ee(this,Le,"f").isSubjectInstance(ee(this,ft,"f"),ee(this,dt,"f"));if(!isInstance)throw`Not a valid subject instance of ${ee(this,dt,"f")} for ${ee(this,ft,"f")}`;let results=await ee(this,Le,"f").infer(`subject_class("${ee(this,dt,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await ee(this,Le,"f").infer(`subject_class("${ee(this,dt,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await ee(this,Le,"f").getPropertyValueViaSurreal(ee(this,ft,"f"),ee(this,dt,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await ee(this,Le,"f").infer(`subject_class("${ee(this,dt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await ee(this,Le,"f").infer(`subject_class("${ee(this,dt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Wl(property)]=async r=>{resolveLanguage&&(r=await ee(this,Le,"f").createExpression(r,resolveLanguage)),await ee(this,Le,"f").executeAction(actions,ee(this,ft,"f"),[{name:"value",value:r}])}}let results2=await ee(this,Le,"f").infer(`subject_class("${ee(this,dt,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(r=>r.Collection);for(let r of collections)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await ee(this,Le,"f").getCollectionValuesViaSurreal(ee(this,ft,"f"),ee(this,dt,"f"),r)}catch(e){return console.warn(`Failed to get collection ${r} via SurrealDB:`,e),[]}}});let adders=await ee(this,Le,"f").infer(`subject_class("${ee(this,dt,"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[eb(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>ee(this,Le,"f").executeAction(actions,ee(this,ft,"f"),[{name:"value",value:e}]))):await ee(this,Le,"f").executeAction(actions,ee(this,ft,"f"),[{name:"value",value:r}])}}let removers=await ee(this,Le,"f").infer(`subject_class("${ee(this,dt,"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[rb(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>ee(this,Le,"f").executeAction(actions,ee(this,ft,"f"),[{name:"value",value:e}]))):await ee(this,Le,"f").executeAction(actions,ee(this,ft,"f"),[{name:"value",value:r}])}}let collectionSetters=await ee(this,Le,"f").infer(`subject_class("${ee(this,dt,"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[ab(collection)]=async r=>{Array.isArray(r)?await ee(this,Le,"f").executeAction(actions,ee(this,ft,"f"),r.map(e=>({name:"value",value:e}))):await ee(this,Le,"f").executeAction(actions,ee(this,ft,"f"),[{name:"value",value:r}])}}}};ft=new WeakMap,dt=new WeakMap,Le=new WeakMap;function Cd(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function Jh(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,i=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${Cd(e)} your ${t} actions, with access to ${Cd(i)}`}function xe(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var ye=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},O=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Bs,kr,ur,lr,Fi,Kr,Jr,Oi,Ua,Vs,Ci,Ni,qt,qn,xl,pe,de,Di,$i,Ri,qa,pc=class{constructor(e,t,i){Bs.add(this),kr.set(this,void 0),ur.set(this,void 0),lr.set(this,void 0),Fi.set(this,void 0),Kr.set(this,void 0),Jr.set(this,void 0),Oi.set(this,void 0),Ua.set(this,!1),Vs.set(this,void 0),Ci.set(this,void 0),Ni.set(this,void 0),qt.set(this,void 0),qn.set(this,void 0),this.isSurrealDB=!1,ye(this,kr,e,"f"),ye(this,qn,t,"f"),ye(this,lr,i,"f"),ye(this,Fi,new Set,"f"),ye(this,Oi,null,"f"),ye(this,Vs,new Promise((n,a)=>{ye(this,Ci,n,"f"),ye(this,Ni,a,"f")}),"f")}async subscribe(){O(this,Jr,"f")&&(O(this,Jr,"f").call(this),ye(this,Jr,void 0,"f")),O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ye(this,qt,void 0,"f")),O(this,Kr,"f")&&(clearTimeout(O(this,Kr,"f")),ye(this,Kr,void 0,"f"));try{let t;this.isSurrealDB?t=await O(this,lr,"f").perspectiveSubscribeSurrealQuery(O(this,kr,"f"),O(this,qn,"f")):t=await O(this,lr,"f").subscribeQuery(O(this,kr,"f"),O(this,qn,"f")),ye(this,ur,t.subscriptionId,"f"),t.result?(ye(this,Oi,t.result,"f"),O(this,Bs,"m",xl).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ye(this,qt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),ye(this,Jr,O(this,lr,"f").subscribeToQueryUpdates(O(this,ur,"f"),i=>{O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ye(this,qt,void 0,"f")),O(this,Ci,"f")&&(O(this,Ci,"f").call(this,!0),ye(this,Ci,void 0,"f"),ye(this,Ni,void 0,"f")),!(i.isInit&&O(this,Oi,"f"))&&(ye(this,Oi,i,"f"),O(this,Bs,"m",xl).call(this,i))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,Ni,"f")&&(O(this,Ni,"f").call(this,t),ye(this,Ci,void 0,"f"),ye(this,Ni,void 0,"f")),t}let e=async()=>{if(!O(this,Ua,"f")){try{this.isSurrealDB?await O(this,lr,"f").perspectiveKeepAliveSurrealQuery(O(this,kr,"f"),O(this,ur,"f")):await O(this,lr,"f").keepAliveQuery(O(this,kr,"f"),O(this,ur,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,qn,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}O(this,Ua,"f")||ye(this,Kr,setTimeout(e,3e4),"f")}};ye(this,Kr,setTimeout(e,3e4),"f")}get id(){return O(this,ur,"f")}get initialized(){return O(this,Vs,"f")}get result(){return O(this,Oi,"f")}onResult(e){return O(this,Fi,"f").add(e),()=>O(this,Fi,"f").delete(e)}dispose(){ye(this,Ua,!0,"f"),clearTimeout(O(this,Kr,"f")),O(this,Jr,"f")&&O(this,Jr,"f").call(this),O(this,Fi,"f").clear(),O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ye(this,qt,void 0,"f")),O(this,ur,"f")&&(this.isSurrealDB?O(this,lr,"f").perspectiveDisposeSurrealQuerySubscription(O(this,kr,"f"),O(this,ur,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,lr,"f").disposeQuerySubscription(O(this,kr,"f"),O(this,ur,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};kr=new WeakMap,ur=new WeakMap,lr=new WeakMap,Fi=new WeakMap,Kr=new WeakMap,Jr=new WeakMap,Oi=new WeakMap,Ua=new WeakMap,Vs=new WeakMap,Ci=new WeakMap,Ni=new WeakMap,qt=new WeakMap,qn=new WeakMap,Bs=new WeakSet,xl=function r(e){for(let t of O(this,Fi,"f"))try{t(e)}catch(i){console.error("Error in query subscription callback:",i)}};var Vn=class{constructor(r,e){pe.set(this,void 0),de.set(this,void 0),Di.set(this,void 0),$i.set(this,void 0),Ri.set(this,void 0),qa.set(this,void 0),ye(this,Di,[],"f"),ye(this,$i,[],"f"),ye(this,Ri,[],"f"),ye(this,qa,[],"f"),ye(this,pe,r,"f"),ye(this,de,e,"f"),this.uuid=O(this,pe,"f").uuid,this.name=O(this,pe,"f").name,this.owners=O(this,pe,"f").owners,this.sharedUrl=O(this,pe,"f").sharedUrl,this.neighbourhood=O(this,pe,"f").neighbourhood,this.state=O(this,pe,"f").state,O(this,de,"f").addPerspectiveLinkAddedListener(O(this,pe,"f").uuid,O(this,Di,"f")),O(this,de,"f").addPerspectiveLinkRemovedListener(O(this,pe,"f").uuid,O(this,$i,"f")),O(this,de,"f").addPerspectiveLinkUpdatedListener(O(this,pe,"f").uuid,O(this,Ri,"f")),O(this,de,"f").addPerspectiveSyncStateChangeListener(O(this,pe,"f").uuid,O(this,qa,"f"))}escapeRegExp(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(r,e,t,i){return await O(this,de,"f").executeCommands(O(this,pe,"f").uuid,JSON.stringify(r),e,JSON.stringify(t),i)}async get(r){return await O(this,de,"f").queryLinks(O(this,pe,"f").uuid,r)}async infer(r){return await O(this,de,"f").queryProlog(O(this,pe,"f").uuid,r)}async querySurrealDB(r){return await O(this,de,"f").querySurrealDB(O(this,pe,"f").uuid,r)}async add(r,e="shared",t){return await O(this,de,"f").addLink(O(this,pe,"f").uuid,r,e,t)}async addLinks(r,e="shared",t){return await O(this,de,"f").addLinks(O(this,pe,"f").uuid,r,e,t)}async removeLinks(r,e){return await O(this,de,"f").removeLinks(O(this,pe,"f").uuid,r,e)}async linkMutations(r,e="shared"){return await O(this,de,"f").linkMutations(O(this,pe,"f").uuid,r,e)}async addLinkExpression(r,e="shared",t){return await O(this,de,"f").addLinkExpression(O(this,pe,"f").uuid,r,e,t)}async update(r,e,t){return await O(this,de,"f").updateLink(O(this,pe,"f").uuid,r,e,t)}async remove(r,e){return await O(this,de,"f").removeLink(O(this,pe,"f").uuid,r,e)}async createBatch(){return await O(this,de,"f").createBatch(O(this,pe,"f").uuid)}async commitBatch(r){return await O(this,de,"f").commitBatch(O(this,pe,"f").uuid,r)}async getExpression(r){return await O(this,de,"f").getExpression(r)}async createExpression(r,e){return await O(this,de,"f").createExpression(r,e)}async addListener(r,e){r==="link-added"?O(this,Di,"f").push(e):r==="link-removed"?O(this,$i,"f").push(e):r==="link-updated"&&O(this,Ri,"f").push(e)}async addSyncStateChangeListener(r){O(this,qa,"f").push(r)}async removeListener(r,e){if(r==="link-added"){let t=O(this,Di,"f").indexOf(e);O(this,Di,"f").splice(t,1)}else if(r==="link-removed"){let t=O(this,$i,"f").indexOf(e);O(this,$i,"f").splice(t,1)}else if(r==="link-updated"){let t=O(this,Ri,"f").indexOf(e);O(this,Ri,"f").splice(t,1)}}async snapshot(){return O(this,de,"f").snapshotByUUID(O(this,pe,"f").uuid)}async loadSnapshot(r){let e=JSON.parse(JSON.stringify(r));delete e.__typename,e.links.forEach(t=>{delete t.data.__typename});for(let t of e.links)await this.addLinkExpression(t)}async getSingleTarget(r){delete r.target;let e=await this.get(r);return e.length?e[0].data.target:null}async setSingleTarget(r,e="shared"){let t=new rt({source:r.source,predicate:r.predicate}),i=await this.get(t),n=[];for(let o of i)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,n.push(o);let a=[r];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(r){return(await this.infer(`flowable("${r}", F), register_sdna_flow(X, F)`)).map(t=>t.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state(X, ${e}, F)`)).map(i=>i.X)}async flowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(r,e){return(await this.infer(`register_sdna_flow("${r}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(i=>i.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let r=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let t of r){let i=await this.get(new rt({source:"ad4m://self",predicate:t}));for(let n of i){let a=n.data.target,o=await this.get(new rt({source:a,predicate:"ad4m://sdna"}));for(let s of o){let c=it.fromUrl(s.data.target).get();typeof c=="string"&&e.push(c)}}}return e}async getSdnaForClass(r){let e=it.from(r);if((await this.get(new rt({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new rt({source:e.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let n=it.fromUrl(i[0].data.target).get();return typeof n=="string"?n:null}async addSdna(r,e,t){return O(this,de,"f").addSdna(O(this,pe,"f").uuid,r,e,t)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(r=>r.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(r){if(typeof r=="string")return r;{let e=await this.subjectClassesByTemplate(r);return e[0]?e[0]:r.className}}async createSubject(r,e,t,i){let n;if(typeof r=="string")n=r,await O(this,de,"f").createSubject(O(this,pe,"f").uuid,JSON.stringify({className:n,initialValues:t}),e,t?JSON.stringify(t):void 0,i);else{let a=this.buildQueryFromTemplate(r);await O(this,de,"f").createSubject(O(this,pe,"f").uuid,JSON.stringify({query:a,initialValues:t}),e,t?JSON.stringify(t):void 0,i)}return i?e:this.getSubjectProxy(e,r)}async getSubjectData(r,e){if(typeof r=="string")return JSON.parse(await O(this,de,"f").getSubjectData(O(this,pe,"f").uuid,JSON.stringify({className:r}),e));let t=this.buildQueryFromTemplate(r);return JSON.parse(await O(this,de,"f").getSubjectData(O(this,pe,"f").uuid,JSON.stringify({query:t}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(r,e){let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)try{let n=t.replace(/"/g,'\\"'),a=r.replace(/"/g,'\\"'),o=await this.infer(`subject_class("${n}", C), instance(C, "${a}")`);return o&&o.length>0}catch(n){return console.warn(`Failed to check instance via Prolog for class ${t}:`,n),!1}if(i.requiredTriples.length===0){let a=`SELECT count() AS count FROM link WHERE in.uri = '${xe(r)}'`,s=(await this.querySurrealDB(a))[0]?.count??0;return(typeof s=="object"&&s?.Int!==void 0?s.Int:s)>0}for(let n of i.requiredTriples){let a=xe(r),o=xe(n.predicate),s;if(n.target){let d=xe(n.target);s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}' AND out.uri = '${d}'`}else s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}'`;let c=await this.querySurrealDB(s);if(!c||c.length===0)return!1;let u=c[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(r,e){if(!await this.isSubjectInstance(r,e))throw`Expression ${r} is not a subject instance of given class: ${JSON.stringify(e)}`;let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=new zn(this,r,t);return await i.init(),i}async getSubjectClassMetadataFromSDNA(r){try{let e=await this.get(new rt({source:it.from(r).toUrl(),predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${r}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${r} has no target:`,e[0]),null;let t=it.fromUrl(e[0].data.target).get(),i=[],n=/instance\([^)]+\)\s*:-\s*([^.]+)\./g,a,o=!1;for(;(a=n.exec(t))!==null;){o=!0;let f=a[1],p=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,h;for(;(h=p.exec(f))!==null;){let m=h[1],y=h[2];i.push({predicate:m,target:y})}}o||console.warn(`No instance rule found in SDNA for ${r}`);let s=i.map(f=>f.predicate),c=new Map,u=await this.infer(`subject_class("${r}", C), property(C, P)`);if(u)for(let f of u){let p=f.P,h=null,m=await this.infer(`subject_class("${r}", C), property_setter(C, "${p}", Setter)`);if(m&&m.length>0){let w=m[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);w&&(h=w[1]||w[2])}if(!h){let y=this.escapeRegExp(p),w=t.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${y}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));w&&(h=w[1])}if(h){let y=await this.infer(`subject_class("${r}", C), property_resolve_language(C, "${p}", Lang)`),w=y&&y.length>0?y[0].Lang:void 0;c.set(p,{predicate:h,resolveLanguage:w})}}let l=new Map,d=await this.infer(`subject_class("${r}", C), collection(C, Coll)`);if(d)for(let f of d){let p=f.Coll,h=null,m,y=await this.infer(`subject_class("${r}", C), collection_adder(C, "${p}", Adder)`);if(y&&y.length>0){let k=y[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);k&&(h=k[1]||k[2])}let w=this.escapeRegExp(p),_=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${w}"[^)]*\\)\\s*:-[^.]+\\.`),S=t.match(_);if(S){let b=S[0],k=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,$=b.match(k);if($){let E=$[1];if(E.startsWith("(")&&E.endsWith(")")&&(E=E.substring(1,E.length-1)),!h){let P=E.match(/triple\([^,]+,\s*"([^"]+)"/);P&&(h=P[1])}let D=E.match(/subject_class\("([^"]+)"/);D&&(m=D[1])}}h&&l.set(p,{predicate:h,instanceFilter:m})}return{requiredPredicates:s,requiredTriples:i,properties:c,collections:l}}catch(e){return console.error(`Error getting metadata for ${r}:`,e),null}}generateSurrealInstanceQuery(r){return r.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${r.requiredTriples.map(t=>{let i=xe(t.predicate);if(t.target){let n=xe(t.target);return`count(->link[WHERE predicate = '${i}' AND out.uri = '${n}']) > 0`}else return`count(->link[WHERE predicate = '${i}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return;let n=i.properties.get(t);if(!n)return;let a=xe(r),o=xe(n.predicate),s=`SELECT out.uri AS value FROM link WHERE in.uri = '${a}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(s);if(!c||c.length===0)return;let u=c[0].value;if(n.resolveLanguage&&u)try{let l=await this.getExpression(u);try{return JSON.parse(l.data)}catch{return l.data}}catch{return u}return u}async getCollectionValuesViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return[];let n=i.collections.get(t);if(!n)return[];let a=xe(r),o=xe(n.predicate),s=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${a}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(s);if(!c||c.length===0)return[];let u=c.map(l=>l.value).filter(l=>l!==""&&l!=="");if(n.instanceFilter)try{let l=await this.getSubjectClassMetadataFromSDNA(n.instanceFilter);return l?await this.batchCheckSubjectInstances(u,l):this.filterInstancesSequential(u,n.instanceFilter)}catch{return this.filterInstancesSequential(u,n.instanceFilter)}return u}async batchCheckSubjectInstances(r,e){if(r.length===0)return[];if(e.requiredTriples.length===0){let a=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${r.map(s=>`'${xe(s)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(a)).map(s=>s.uri)}let t=[];for(let n of e.requiredTriples){let a=r.map(u=>`'${xe(u)}'`).join(", "),o=xe(n.predicate),s;if(n.target){let u=xe(n.target);s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' AND out.uri = '${u}' GROUP BY in.uri`}else s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' GROUP BY in.uri`;let c=await this.querySurrealDB(s);t.push(new Set(c.map(u=>u.uri)))}return t.length===0?r:r.filter(n=>t.every(a=>a.has(n)))}async filterInstancesSequential(r,e){let t=[];for(let i of r)try{await this.isSubjectInstance(i,e)&&t.push(i)}catch{continue}return t}async getAllSubjectInstances(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new zn(this,s.base,i);await c.init(),t.push(c)}catch{}}}return t}async getAllSubjectProxies(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new zn(this,s.base,i);await c.init(),t.push(c)}catch{}}}return t}buildQueryFromTemplate(r){let e;return function(t){let i=[],n=[];Object.getPrototypeOf(t).__properties?Object.keys(Object.getPrototypeOf(t).__properties).forEach(l=>i.push(l)):i.push(...Object.keys(t).filter(l=>!Array.isArray(t[l]))),Object.getPrototypeOf(t).__collections?Object.keys(Object.getPrototypeOf(t).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>{n.includes(l)||n.push(l)}):n.push(...Object.keys(t).filter(l=>Array.isArray(t[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(t).filter(l=>typeof t[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let c=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("setCollection"));c=c.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let u="subject_class(Class, C)";for(let l of i)u+=`, property(C, "${l}")`;for(let l of n)u+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),u+=`, property_setter(C, "${d}", _)`}for(let l of o)u+=`, collection_adder(C, "${tb(l)}", _)`;for(let l of s)u+=`, collection_remover(C, "${ib(l)}", _)`;for(let l of c)u+=`, collection_setter(C, "${nb(l)}", _)`;u+=".",e=u}(r),e}async subjectClassesByTemplate(r){let e=this.buildQueryFromTemplate(r),t=await this.infer(e);return t?t.map(i=>i.Class):[]}async ensureSDNASubjectClass(r){if((await this.subjectClassesByTemplate(new r)).length>0)return;let{name:t,sdna:i}=r.generateSDNA();await this.addSdna(t,i,"subject_class")}getNeighbourhoodProxy(){return O(this,de,"f").getNeighbourhoodProxy(O(this,pe,"f").uuid)}get ai(){return O(this,de,"f").aiClient}async subscribeInfer(r){let e=new pc(this.uuid,r,O(this,de,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(r){let e=new pc(this.uuid,r,O(this,de,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};pe=new WeakMap,de=new WeakMap,Di=new WeakMap,$i=new WeakMap,Ri=new WeakMap,qa=new WeakMap;var Wr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Q=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},te,Ba,Va,Qa,Qs,za,zs,Ws,pt=`
|
|
61
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||bl.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(i))}else t.push(i)}),tc(tc({},r),{definitions:t})}function zv(r){var e=new Set(r.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function Wv(r){var e=Hh(r);if(!qs.has(e)){var t=qv(r,{experimentalFragmentVariables:rc,allowLegacyFragmentVariables:rc});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");qs.set(e,zv(Qv(t)))}return qs.get(e)}function I(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var i=r[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=r[a+1]}),Wv(i)}function Hv(){qs.clear(),bl.clear()}function Gv(){Wh=!1}function Kv(){rc=!0}function Jv(){rc=!1}var Pa={gql:I,resetCaches:Hv,disableFragmentWarnings:Gv,enableExperimentalFragmentVariables:Kv,disableExperimentalFragmentVariables:Jv};(function(r){r.gql=Pa.gql,r.resetCaches=Pa.resetCaches,r.disableFragmentWarnings=Pa.disableFragmentWarnings,r.enableExperimentalFragmentVariables=Pa.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=Pa.disableExperimentalFragmentVariables})(I||(I={}));I.default=I;function T(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function Zv(){}function pi(){return Zv}var Y=pi,y=pi,Ke=pi,ve=pi,G=pi,Rt=pi,Yv=pi,Vl=pi,Gh=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Kh=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Qi=class{constructor(e){this.code=e}};Gh([y(),Kh("design:type",String)],Qi.prototype,"code",void 0);Qi=Gh([G(),Kh("design:paramtypes",[String])],Qi);var Ql=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},zl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},hr=class{constructor(e,t){this.address=e,this.name=t}};Ql([y(),zl("design:type",String)],hr.prototype,"address",void 0);Ql([y(),zl("design:type",String)],hr.prototype,"name",void 0);hr=Ql([G(),zl("design:paramtypes",[String,String])],hr);var Oe=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Qe=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Dr=class{constructor(e,t){this.key=t,this.signature=e}};Oe([y(),Qe("design:type",String)],Dr.prototype,"signature",void 0);Oe([y(),Qe("design:type",String)],Dr.prototype,"key",void 0);Oe([y(),Qe("design:type",Boolean)],Dr.prototype,"valid",void 0);Oe([y(),Qe("design:type",Boolean)],Dr.prototype,"invalid",void 0);Dr=Oe([G(),Ke(),Qe("design:paramtypes",[String,String])],Dr);var zi=class{};Oe([y(),Qe("design:type",String)],zi.prototype,"signature",void 0);Oe([y(),Qe("design:type",String)],zi.prototype,"key",void 0);Oe([y(),Qe("design:type",Boolean)],zi.prototype,"valid",void 0);Oe([y(),Qe("design:type",Boolean)],zi.prototype,"invalid",void 0);zi=Oe([Ke()],zi);function fi(r){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return Oe([y(),Qe("design:type",String)],e.prototype,"author",void 0),Oe([y(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Oe([y(),Qe("design:type",Object)],e.prototype,"data",void 0),Oe([y(),Qe("design:type",Dr)],e.prototype,"proof",void 0),e=Oe([G(),Qe("design:paramtypes",[String,String,Object,Dr])],e),e}function Xv(r){let e=class{};return Oe([y(),Qe("design:type",String)],e.prototype,"author",void 0),Oe([y(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Oe([y(),Qe("design:type",Object)],e.prototype,"data",void 0),Oe([y(),Qe("design:type",zi)],e.prototype,"proof",void 0),e=Oe([Ke()],e),e}var Id=class extends fi(){};Id=Oe([G()],Id);var ic=class extends fi(){};Oe([y(),Qe("design:type",hr)],ic.prototype,"language",void 0);Oe([y(),Qe("design:type",Qi)],ic.prototype,"icon",void 0);ic=Oe([G()],ic);function vk(r){return r&&r.author&&r.timestamp&&r.data}var Ue=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},nt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Wi=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Ue([y(),nt("design:type",String)],Wi.prototype,"source",void 0);Ue([y(),nt("design:type",String)],Wi.prototype,"target",void 0);Ue([y(),nt("design:type",String)],Wi.prototype,"predicate",void 0);Wi=Ue([G(),nt("design:paramtypes",[Object])],Wi);var nc=class{};Ue([y(),nt("design:type",Array)],nc.prototype,"additions",void 0);Ue([y(),nt("design:type",Array)],nc.prototype,"removals",void 0);nc=Ue([Ke()],nc);var ac=class{constructor(e,t){this.additions=e,this.removals=t}};Ue([y(),nt("design:type",Array)],ac.prototype,"additions",void 0);Ue([y(),nt("design:type",Array)],ac.prototype,"removals",void 0);ac=Ue([G(),nt("design:paramtypes",[Array,Array])],ac);var uo=class{};Ue([y(),nt("design:type",String)],uo.prototype,"source",void 0);Ue([y(),nt("design:type",String)],uo.prototype,"target",void 0);Ue([y(),nt("design:type",String)],uo.prototype,"predicate",void 0);uo=Ue([Ke()],uo);var ai=class extends fi(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),t=(t<<5)-t+n,t|=0;return t}};Ue([y(),nt("design:type",String)],ai.prototype,"status",void 0);ai=Ue([G()],ai);var wl=class extends Xv(){};Ue([y(),nt("design:type",String)],wl.prototype,"status",void 0);wl=Ue([Ke()],wl);function Ak(r,e){return r.author==e.author&&r.timestamp==e.timestamp&&r.data.source==e.data.source&&r.data.predicate==e.data.predicate&&r.data.target==e.data.target}function Ik(r){return r&&r.source&&r.target}var oc=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Ue([y(),nt("design:type",ai)],oc.prototype,"oldLink",void 0);Ue([y(),nt("design:type",ai)],oc.prototype,"newLink",void 0);oc=Ue([G(),nt("design:paramtypes",[ai,ai])],oc);var tn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Eo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},_l,yr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(i=>i.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};tn([y(),Eo("design:type",Array)],yr.prototype,"links",void 0);yr=tn([G(),Eo("design:paramtypes",[Array])],yr);var sc=class{};tn([y(),Eo("design:type",Array)],sc.prototype,"links",void 0);sc=tn([Ke()],sc);var Sl=_l=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new _l;return t.links.push(e),t}};tn([y(),Eo("design:type",Array)],Sl.prototype,"links",void 0);Sl=_l=tn([Ke(),Eo("design:paramtypes",[Array])],Sl);var Hi=class extends fi(){};Hi=tn([G()],Hi);var q=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},B=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ei=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new yr}};q([y(),B("design:type",String)],ei.prototype,"did",void 0);q([y(),B("design:type",yr)],ei.prototype,"perspective",void 0);q([y(),B("design:type",String)],ei.prototype,"directMessageLanguage",void 0);ei=q([G(),B("design:paramtypes",[String,yr])],ei);var Td=class extends fi(){};Td=q([G()],Td);var oi=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([y(),B("design:type",String)],oi.prototype,"did",void 0);q([y(),B("design:type",String)],oi.prototype,"didSigningKeyId",void 0);q([y(),B("design:type",String)],oi.prototype,"deviceKeyType",void 0);q([y(),B("design:type",String)],oi.prototype,"deviceKey",void 0);q([y(),B("design:type",String)],oi.prototype,"deviceKeySignedByDid",void 0);q([y(),B("design:type",String)],oi.prototype,"didSignedByDeviceKey",void 0);oi=q([G(),B("design:paramtypes",[String,String,String,String,String,String])],oi);var si=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};q([y(),B("design:type",String)],si.prototype,"did",void 0);q([y(),B("design:type",String)],si.prototype,"didSigningKeyId",void 0);q([y(),B("design:type",String)],si.prototype,"deviceKeyType",void 0);q([y(),B("design:type",String)],si.prototype,"deviceKey",void 0);q([y(),B("design:type",String)],si.prototype,"deviceKeySignedByDid",void 0);q([y(),B("design:type",String)],si.prototype,"didSignedByDeviceKey",void 0);si=q([Ke(),B("design:paramtypes",[String,String,String,String,String,String])],si);var cc=class{constructor(e,t){this.signature=e,this.publicKey=t}};q([y(),B("design:type",String)],cc.prototype,"signature",void 0);q([y(),B("design:type",String)],cc.prototype,"publicKey",void 0);cc=q([G(),B("design:paramtypes",[String,String])],cc);var Hn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([y(),B("design:type",String)],Hn.prototype,"domain",void 0);q([y(),B("design:type",Array)],Hn.prototype,"pointers",void 0);Hn=q([G(),B("design:paramtypes",[String,Array])],Hn);var uc=class{constructor(e,t){this.with=e,this.can=t}};q([y(),B("design:type",Hn)],uc.prototype,"with",void 0);q([y(),B("design:type",Array)],uc.prototype,"can",void 0);uc=q([G(),B("design:paramtypes",[Hn,Array])],uc);var $r=class{constructor(e,t,i,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};q([y(),B("design:type",String)],$r.prototype,"appName",void 0);q([y(),B("design:type",String)],$r.prototype,"appDesc",void 0);q([y(),B("design:type",String)],$r.prototype,"appUrl",void 0);q([y(),B("design:type",String)],$r.prototype,"appIconPath",void 0);q([y(),B("design:type",Array)],$r.prototype,"capabilities",void 0);$r=q([G(),B("design:paramtypes",[String,String,String,Array,String])],$r);var Gn=class{constructor(e,t,i,n){this.requestId=e,this.auth=t,this.token=i,this.revoked=n}};q([y(),B("design:type",String)],Gn.prototype,"requestId",void 0);q([y(),B("design:type",String)],Gn.prototype,"token",void 0);q([y(),B("design:type",Boolean)],Gn.prototype,"revoked",void 0);q([y(),B("design:type",$r)],Gn.prototype,"auth",void 0);Gn=q([G(),B("design:paramtypes",[String,$r,String,Boolean])],Gn);var Kn=class{constructor(e,t){this.domain=e,this.pointers=t}};q([y(),B("design:type",String)],Kn.prototype,"domain",void 0);q([y(),B("design:type",Array)],Kn.prototype,"pointers",void 0);Kn=q([Ke(),B("design:paramtypes",[String,Array])],Kn);var lc=class{constructor(e,t){this.with=e,this.can=t}};q([y(),B("design:type",Kn)],lc.prototype,"with",void 0);q([y(),B("design:type",Array)],lc.prototype,"can",void 0);lc=q([Ke(),B("design:paramtypes",[Kn,Array])],lc);var vr=class{constructor(e,t,i,n,a,o){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};q([y(),B("design:type",String)],vr.prototype,"appName",void 0);q([y(),B("design:type",String)],vr.prototype,"appDesc",void 0);q([y(),B("design:type",String)],vr.prototype,"appDomain",void 0);q([y(),B("design:type",String)],vr.prototype,"appUrl",void 0);q([y(),B("design:type",String)],vr.prototype,"appIconPath",void 0);q([y(),B("design:type",Array)],vr.prototype,"capabilities",void 0);vr=q([Ke(),B("design:paramtypes",[String,String,String,String,String,Array])],vr);var Gi=class{constructor(e,t,i){this.did=e,this.success=t,this.error=i}};q([y(),B("design:type",String)],Gi.prototype,"did",void 0);q([y(),B("design:type",Boolean)],Gi.prototype,"success",void 0);q([y(),B("design:type",String)],Gi.prototype,"error",void 0);Gi=q([G(),B("design:paramtypes",[String,Boolean,String])],Gi);var ra=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ia=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Vt=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)}};ra([y(),ia("design:type",Boolean)],Vt.prototype,"isInitialized",void 0);ra([y(),ia("design:type",Boolean)],Vt.prototype,"isUnlocked",void 0);ra([y(),ia("design:type",String)],Vt.prototype,"did",void 0);ra([y(),ia("design:type",String)],Vt.prototype,"didDocument",void 0);ra([y(),ia("design:type",String)],Vt.prototype,"error",void 0);Vt=ra([G(),ia("design:paramtypes",[Object])],Vt);var kd=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Le=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_t,St,El=class{constructor(e,t){_t.set(this,void 0),St.set(this,void 0),kd(this,_t,e,"f"),kd(this,St,t,"f")}async otherAgents(){return await Le(this,_t,"f").otherAgents(Le(this,St,"f"))}async hasTelepresenceAdapter(){return await Le(this,_t,"f").hasTelepresenceAdapter(Le(this,St,"f"))}async onlineAgents(){return await Le(this,_t,"f").onlineAgents(Le(this,St,"f"))}async setOnlineStatus(e){return await Le(this,_t,"f").setOnlineStatus(Le(this,St,"f"),e)}async setOnlineStatusU(e){return await Le(this,_t,"f").setOnlineStatusU(Le(this,St,"f"),e)}async sendSignal(e,t){return await Le(this,_t,"f").sendSignal(Le(this,St,"f"),e,t)}async sendSignalU(e,t){return await Le(this,_t,"f").sendSignalU(Le(this,St,"f"),e,t)}async sendBroadcast(e,t=!1){return await Le(this,_t,"f").sendBroadcast(Le(this,St,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Le(this,_t,"f").sendBroadcastU(Le(this,St,"f"),e,t)}async addSignalHandler(e){await Le(this,_t,"f").addSignalHandler(Le(this,St,"f"),e)}removeSignalHandler(e){Le(this,_t,"f").removeSignalHandler(Le(this,St,"f"),e)}};_t=new WeakMap,St=new WeakMap;var rn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},nn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},rt=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)}};rn([y(),nn("design:type",String)],rt.prototype,"source",void 0);rn([y(),nn("design:type",String)],rt.prototype,"target",void 0);rn([y(),nn("design:type",String)],rt.prototype,"predicate",void 0);rn([y(),nn("design:type",Date)],rt.prototype,"fromDate",void 0);rn([y(),nn("design:type",Date)],rt.prototype,"untilDate",void 0);rn([y(),nn("design:type",Number)],rt.prototype,"limit",void 0);rt=rn([G(),Ke(),nn("design:paramtypes",[Object])],rt);var Od=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},et=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Et,Tr;function xs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var it=class{constructor(){Et.set(this,void 0),Tr.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let t=new it;return Od(t,Tr,e,"f"),t}static from(e){let t=new it;return Od(t,Et,e,"f"),t}toUrl(){if(et(this,Tr,"f")&&!et(this,Et,"f"))return et(this,Tr,"f");if(!et(this,Tr,"f")&&(et(this,Et,"f")===void 0||et(this,Et,"f")===""||et(this,Et,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof et(this,Et,"f")){case"string":e=`string:${xs(et(this,Et,"f"))}`;break;case"number":e=`number:${xs(et(this,Et,"f"))}`;break;case"boolean":e=`boolean:${xs(et(this,Et,"f"))}`;break;case"object":e=`json:${xs(JSON.stringify(et(this,Et,"f")))}`;break}return`literal://${e}`}get(){if(et(this,Et,"f"))return et(this,Et,"f");if(!et(this,Tr,"f"))throw new Error("Can't render empty Literal");if(!et(this,Tr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=et(this,Tr,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let t=e.substring(7);return parseFloat(t)}if(e.startsWith("json:")){let t=e.substring(5);return JSON.parse(decodeURIComponent(t))}throw new Error(`Can't parse unknown literal: ${e}`)}};Et=new WeakMap,Tr=new WeakMap;function ti(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Wl(r){return`set${ti(r)}`}function Qn(r){return r.endsWith("y")?r.slice(0,-1)+"ies":r+"s"}function Hl(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function eb(r){return`add${ti(Hl(r))}`}function tb(r){let e=r.substring(3),t=Qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function rb(r){return`remove${ti(Hl(r))}`}function ib(r){let e=r.substring(6),t=Qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function nb(r){let e=r.substring(13),t=Qn(e);return t.charAt(0).toLowerCase()+t.slice(1)}function ab(r){return`setCollection${ti(Hl(r))}`}function ki(r){if(Array.isArray(r))return`[${r.map(ki).join(", ")}]`;let e=Object.keys(r),t=[];for(let i of e){let n=JSON.stringify(r[i]),a=`${i}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var el=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ee=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},dt,ht,Fe,zn=class{constructor(r,e,t){dt.set(this,void 0),ht.set(this,void 0),Fe.set(this,void 0),el(this,dt,e,"f"),el(this,ht,t,"f"),el(this,Fe,r,"f")}get baseExpression(){return ee(this,dt,"f")}async init(){let isInstance=await ee(this,Fe,"f").isSubjectInstance(ee(this,dt,"f"),ee(this,ht,"f"));if(!isInstance)throw`Not a valid subject instance of ${ee(this,ht,"f")} for ${ee(this,dt,"f")}`;let results=await ee(this,Fe,"f").infer(`subject_class("${ee(this,ht,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await ee(this,Fe,"f").infer(`subject_class("${ee(this,ht,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await ee(this,Fe,"f").getPropertyValueViaSurreal(ee(this,dt,"f"),ee(this,ht,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await ee(this,Fe,"f").infer(`subject_class("${ee(this,ht,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await ee(this,Fe,"f").infer(`subject_class("${ee(this,ht,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Wl(property)]=async r=>{resolveLanguage&&(r=await ee(this,Fe,"f").createExpression(r,resolveLanguage)),await ee(this,Fe,"f").executeAction(actions,ee(this,dt,"f"),[{name:"value",value:r}])}}let results2=await ee(this,Fe,"f").infer(`subject_class("${ee(this,ht,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(r=>r.Collection);for(let r of collections)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await ee(this,Fe,"f").getCollectionValuesViaSurreal(ee(this,dt,"f"),ee(this,ht,"f"),r)}catch(e){return console.warn(`Failed to get collection ${r} via SurrealDB:`,e),[]}}});let adders=await ee(this,Fe,"f").infer(`subject_class("${ee(this,ht,"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[eb(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>ee(this,Fe,"f").executeAction(actions,ee(this,dt,"f"),[{name:"value",value:e}]))):await ee(this,Fe,"f").executeAction(actions,ee(this,dt,"f"),[{name:"value",value:r}])}}let removers=await ee(this,Fe,"f").infer(`subject_class("${ee(this,ht,"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[rb(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>ee(this,Fe,"f").executeAction(actions,ee(this,dt,"f"),[{name:"value",value:e}]))):await ee(this,Fe,"f").executeAction(actions,ee(this,dt,"f"),[{name:"value",value:r}])}}let collectionSetters=await ee(this,Fe,"f").infer(`subject_class("${ee(this,ht,"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[ab(collection)]=async r=>{Array.isArray(r)?await ee(this,Fe,"f").executeAction(actions,ee(this,dt,"f"),r.map(e=>({name:"value",value:e}))):await ee(this,Fe,"f").executeAction(actions,ee(this,dt,"f"),[{name:"value",value:r}])}}}};dt=new WeakMap,ht=new WeakMap,Fe=new WeakMap;function Cd(r){return r?.length?r.length===1?r.toString():r.length===2?r.join(" and "):r.slice(0,-1).join(", ")+", and "+r.slice(-1):""}function Jh(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,i=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${Cd(e)} your ${t} actions, with access to ${Cd(i)}`}function xe(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var ye=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},k=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Bs,kr,ur,lr,Fi,Kr,Jr,Oi,Ua,Vs,Ci,Ni,qt,qn,xl,fe,he,Di,$i,Ri,qa,pc=class{constructor(e,t,i){Bs.add(this),kr.set(this,void 0),ur.set(this,void 0),lr.set(this,void 0),Fi.set(this,void 0),Kr.set(this,void 0),Jr.set(this,void 0),Oi.set(this,void 0),Ua.set(this,!1),Vs.set(this,void 0),Ci.set(this,void 0),Ni.set(this,void 0),qt.set(this,void 0),qn.set(this,void 0),this.isSurrealDB=!1,ye(this,kr,e,"f"),ye(this,qn,t,"f"),ye(this,lr,i,"f"),ye(this,Fi,new Set,"f"),ye(this,Oi,null,"f"),ye(this,Vs,new Promise((n,a)=>{ye(this,Ci,n,"f"),ye(this,Ni,a,"f")}),"f")}async subscribe(){k(this,Jr,"f")&&(k(this,Jr,"f").call(this),ye(this,Jr,void 0,"f")),k(this,qt,"f")&&(clearTimeout(k(this,qt,"f")),ye(this,qt,void 0,"f")),k(this,Kr,"f")&&(clearTimeout(k(this,Kr,"f")),ye(this,Kr,void 0,"f"));try{let t;this.isSurrealDB?t=await k(this,lr,"f").perspectiveSubscribeSurrealQuery(k(this,kr,"f"),k(this,qn,"f")):t=await k(this,lr,"f").subscribeQuery(k(this,kr,"f"),k(this,qn,"f")),ye(this,ur,t.subscriptionId,"f"),t.result?(ye(this,Oi,t.result,"f"),k(this,Bs,"m",xl).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ye(this,qt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),ye(this,Jr,k(this,lr,"f").subscribeToQueryUpdates(k(this,ur,"f"),i=>{k(this,qt,"f")&&(clearTimeout(k(this,qt,"f")),ye(this,qt,void 0,"f")),k(this,Ci,"f")&&(k(this,Ci,"f").call(this,!0),ye(this,Ci,void 0,"f"),ye(this,Ni,void 0,"f")),!(i.isInit&&k(this,Oi,"f"))&&(ye(this,Oi,i,"f"),k(this,Bs,"m",xl).call(this,i))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),k(this,Ni,"f")&&(k(this,Ni,"f").call(this,t),ye(this,Ci,void 0,"f"),ye(this,Ni,void 0,"f")),t}let e=async()=>{if(!k(this,Ua,"f")){try{this.isSurrealDB?await k(this,lr,"f").perspectiveKeepAliveSurrealQuery(k(this,kr,"f"),k(this,ur,"f")):await k(this,lr,"f").keepAliveQuery(k(this,kr,"f"),k(this,ur,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",k(this,qn,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}k(this,Ua,"f")||ye(this,Kr,setTimeout(e,3e4),"f")}};ye(this,Kr,setTimeout(e,3e4),"f")}get id(){return k(this,ur,"f")}get initialized(){return k(this,Vs,"f")}get result(){return k(this,Oi,"f")}onResult(e){return k(this,Fi,"f").add(e),()=>k(this,Fi,"f").delete(e)}dispose(){ye(this,Ua,!0,"f"),clearTimeout(k(this,Kr,"f")),k(this,Jr,"f")&&k(this,Jr,"f").call(this),k(this,Fi,"f").clear(),k(this,qt,"f")&&(clearTimeout(k(this,qt,"f")),ye(this,qt,void 0,"f")),k(this,ur,"f")&&(this.isSurrealDB?k(this,lr,"f").perspectiveDisposeSurrealQuerySubscription(k(this,kr,"f"),k(this,ur,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):k(this,lr,"f").disposeQuerySubscription(k(this,kr,"f"),k(this,ur,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};kr=new WeakMap,ur=new WeakMap,lr=new WeakMap,Fi=new WeakMap,Kr=new WeakMap,Jr=new WeakMap,Oi=new WeakMap,Ua=new WeakMap,Vs=new WeakMap,Ci=new WeakMap,Ni=new WeakMap,qt=new WeakMap,qn=new WeakMap,Bs=new WeakSet,xl=function r(e){for(let t of k(this,Fi,"f"))try{t(e)}catch(i){console.error("Error in query subscription callback:",i)}};var Vn=class{constructor(r,e){fe.set(this,void 0),he.set(this,void 0),Di.set(this,void 0),$i.set(this,void 0),Ri.set(this,void 0),qa.set(this,void 0),ye(this,Di,[],"f"),ye(this,$i,[],"f"),ye(this,Ri,[],"f"),ye(this,qa,[],"f"),ye(this,fe,r,"f"),ye(this,he,e,"f"),this.uuid=k(this,fe,"f").uuid,this.name=k(this,fe,"f").name,this.owners=k(this,fe,"f").owners,this.sharedUrl=k(this,fe,"f").sharedUrl,this.neighbourhood=k(this,fe,"f").neighbourhood,this.state=k(this,fe,"f").state,k(this,he,"f").addPerspectiveLinkAddedListener(k(this,fe,"f").uuid,k(this,Di,"f")),k(this,he,"f").addPerspectiveLinkRemovedListener(k(this,fe,"f").uuid,k(this,$i,"f")),k(this,he,"f").addPerspectiveLinkUpdatedListener(k(this,fe,"f").uuid,k(this,Ri,"f")),k(this,he,"f").addPerspectiveSyncStateChangeListener(k(this,fe,"f").uuid,k(this,qa,"f"))}escapeRegExp(r){return r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(r,e,t,i){return await k(this,he,"f").executeCommands(k(this,fe,"f").uuid,JSON.stringify(r),e,JSON.stringify(t),i)}async get(r){return await k(this,he,"f").queryLinks(k(this,fe,"f").uuid,r)}async infer(r){return await k(this,he,"f").queryProlog(k(this,fe,"f").uuid,r)}async querySurrealDB(r){return await k(this,he,"f").querySurrealDB(k(this,fe,"f").uuid,r)}async add(r,e="shared",t){return await k(this,he,"f").addLink(k(this,fe,"f").uuid,r,e,t)}async addLinks(r,e="shared",t){return await k(this,he,"f").addLinks(k(this,fe,"f").uuid,r,e,t)}async removeLinks(r,e){return await k(this,he,"f").removeLinks(k(this,fe,"f").uuid,r,e)}async linkMutations(r,e="shared"){return await k(this,he,"f").linkMutations(k(this,fe,"f").uuid,r,e)}async addLinkExpression(r,e="shared",t){return await k(this,he,"f").addLinkExpression(k(this,fe,"f").uuid,r,e,t)}async update(r,e,t){return await k(this,he,"f").updateLink(k(this,fe,"f").uuid,r,e,t)}async remove(r,e){return await k(this,he,"f").removeLink(k(this,fe,"f").uuid,r,e)}async createBatch(){return await k(this,he,"f").createBatch(k(this,fe,"f").uuid)}async commitBatch(r){return await k(this,he,"f").commitBatch(k(this,fe,"f").uuid,r)}async getExpression(r){return await k(this,he,"f").getExpression(r)}async createExpression(r,e){return await k(this,he,"f").createExpression(r,e)}async addListener(r,e){r==="link-added"?k(this,Di,"f").push(e):r==="link-removed"?k(this,$i,"f").push(e):r==="link-updated"&&k(this,Ri,"f").push(e)}async addSyncStateChangeListener(r){k(this,qa,"f").push(r)}async removeListener(r,e){if(r==="link-added"){let t=k(this,Di,"f").indexOf(e);k(this,Di,"f").splice(t,1)}else if(r==="link-removed"){let t=k(this,$i,"f").indexOf(e);k(this,$i,"f").splice(t,1)}else if(r==="link-updated"){let t=k(this,Ri,"f").indexOf(e);k(this,Ri,"f").splice(t,1)}}async snapshot(){return k(this,he,"f").snapshotByUUID(k(this,fe,"f").uuid)}async loadSnapshot(r){let e=JSON.parse(JSON.stringify(r));delete e.__typename,e.links.forEach(t=>{delete t.data.__typename});for(let t of e.links)await this.addLinkExpression(t)}async getSingleTarget(r){delete r.target;let e=await this.get(r);return e.length?e[0].data.target:null}async setSingleTarget(r,e="shared"){let t=new rt({source:r.source,predicate:r.predicate}),i=await this.get(t),n=[];for(let o of i)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,n.push(o);let a=[r];await this.linkMutations({additions:a,removals:n},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(r){return(await this.infer(`flowable("${r}", F), register_sdna_flow(X, F)`)).map(t=>t.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state(X, ${e}, F)`)).map(i=>i.X)}async flowState(r,e){return(await this.infer(`register_sdna_flow("${r}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(r,e){return(await this.infer(`register_sdna_flow("${r}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(i=>i.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let r=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let t of r){let i=await this.get(new rt({source:"ad4m://self",predicate:t}));for(let n of i){let a=n.data.target,o=await this.get(new rt({source:a,predicate:"ad4m://sdna"}));for(let s of o){let c=it.fromUrl(s.data.target).get();typeof c=="string"&&e.push(c)}}}return e}async getSdnaForClass(r){let e=it.from(r);if((await this.get(new rt({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new rt({source:e.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let n=it.fromUrl(i[0].data.target).get();return typeof n=="string"?n:null}async addSdna(r,e,t){return k(this,he,"f").addSdna(k(this,fe,"f").uuid,r,e,t)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(r=>r.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(r){if(typeof r=="string")return r;{let e=await this.subjectClassesByTemplate(r);return e[0]?e[0]:r.className}}async createSubject(r,e,t,i){let n;if(typeof r=="string")n=r,await k(this,he,"f").createSubject(k(this,fe,"f").uuid,JSON.stringify({className:n,initialValues:t}),e,t?JSON.stringify(t):void 0,i);else{let a=this.buildQueryFromTemplate(r);await k(this,he,"f").createSubject(k(this,fe,"f").uuid,JSON.stringify({query:a,initialValues:t}),e,t?JSON.stringify(t):void 0,i)}return i?e:this.getSubjectProxy(e,r)}async getSubjectData(r,e){if(typeof r=="string")return JSON.parse(await k(this,he,"f").getSubjectData(k(this,fe,"f").uuid,JSON.stringify({className:r}),e));let t=this.buildQueryFromTemplate(r);return JSON.parse(await k(this,he,"f").getSubjectData(k(this,fe,"f").uuid,JSON.stringify({query:t}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(r,e){let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)try{let n=t.replace(/"/g,'\\"'),a=r.replace(/"/g,'\\"'),o=await this.infer(`subject_class("${n}", C), instance(C, "${a}")`);return o&&o.length>0}catch(n){return console.warn(`Failed to check instance via Prolog for class ${t}:`,n),!1}if(i.requiredTriples.length===0){let a=`SELECT count() AS count FROM link WHERE in.uri = '${xe(r)}'`,s=(await this.querySurrealDB(a))[0]?.count??0;return(typeof s=="object"&&s?.Int!==void 0?s.Int:s)>0}for(let n of i.requiredTriples){let a=xe(r),o=xe(n.predicate),s;if(n.target){let d=xe(n.target);s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}' AND out.uri = '${d}'`}else s=`SELECT count() AS count FROM link WHERE in.uri = '${a}' AND predicate = '${o}'`;let c=await this.querySurrealDB(s);if(!c||c.length===0)return!1;let u=c[0]?.count??0;if((typeof u=="object"&&u?.Int!==void 0?u.Int:u)===0)return!1}return!0}async getSubjectProxy(r,e){if(!await this.isSubjectInstance(r,e))throw`Expression ${r} is not a subject instance of given class: ${JSON.stringify(e)}`;let t=await this.stringOrTemplateObjectToSubjectClassName(e),i=new zn(this,r,t);return await i.init(),i}async getSubjectClassMetadataFromSDNA(r){try{let e=await this.get(new rt({source:it.from(r).toUrl(),predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${r}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${r} has no target:`,e[0]),null;let t=it.fromUrl(e[0].data.target).get(),i=[],n=/instance\([^)]+\)\s*:-\s*([^.]+)\./g,a,o=!1;for(;(a=n.exec(t))!==null;){o=!0;let f=a[1],p=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,h;for(;(h=p.exec(f))!==null;){let m=h[1],g=h[2];i.push({predicate:m,target:g})}}o||console.warn(`No instance rule found in SDNA for ${r}`);let s=i.map(f=>f.predicate),c=new Map,u=await this.infer(`subject_class("${r}", C), property(C, P)`);if(u)for(let f of u){let p=f.P,h=null,m=await this.infer(`subject_class("${r}", C), property_setter(C, "${p}", Setter)`);if(m&&m.length>0){let w=m[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);w&&(h=w[1]||w[2])}if(!h){let g=this.escapeRegExp(p),w=t.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${g}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));w&&(h=w[1])}if(h){let g=await this.infer(`subject_class("${r}", C), property_resolve_language(C, "${p}", Lang)`),w=g&&g.length>0?g[0].Lang:void 0;c.set(p,{predicate:h,resolveLanguage:w})}}let l=new Map,d=await this.infer(`subject_class("${r}", C), collection(C, Coll)`);if(d)for(let f of d){let p=f.Coll,h=null,m,g,w=await this.infer(`subject_class("${r}", C), collection_adder(C, "${p}", Adder)`);if(w&&w.length>0){let D=w[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);D&&(h=D[1]||D[2])}let _=this.escapeRegExp(p),S=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${_}"[^)]*\\)\\s*:-[^.]+\\.`),b=t.match(S);if(b){let O=b[0],D=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,E=O.match(D);if(E){let $=E[1];if($.startsWith("(")&&$.endsWith(")")&&($=$.substring(1,$.length-1)),!h){let R=$.match(/triple\([^,]+,\s*"([^"]+)"/);R&&(h=R[1])}let P=$.match(/subject_class\("([^"]+)"/);P&&(m=P[1])}}h&&l.set(p,{predicate:h,instanceFilter:m,condition:g})}return{requiredPredicates:s,requiredTriples:i,properties:c,collections:l}}catch(e){return console.error(`Error getting metadata for ${r}:`,e),null}}generateSurrealInstanceQuery(r){return r.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${r.requiredTriples.map(t=>{let i=xe(t.predicate);if(t.target){let n=xe(t.target);return`count(->link[WHERE predicate = '${i}' AND out.uri = '${n}']) > 0`}else return`count(->link[WHERE predicate = '${i}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return;let n=i.properties.get(t);if(!n)return;let a=xe(r),o=xe(n.predicate),s=`SELECT out.uri AS value FROM link WHERE in.uri = '${a}' AND predicate = '${o}' LIMIT 1`,c=await this.querySurrealDB(s);if(!c||c.length===0)return;let u=c[0].value;if(n.resolveLanguage&&u)try{let l=await this.getExpression(u);try{return JSON.parse(l.data)}catch{return l.data}}catch{return u}return u}async getCollectionValuesViaSurreal(r,e,t){let i=await this.getSubjectClassMetadataFromSDNA(e);if(!i)return[];let n=i.collections.get(t);if(!n)return[];let a=xe(r),o=xe(n.predicate),s=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${a}' AND predicate = '${o}' ORDER BY timestamp ASC`,c=await this.querySurrealDB(s);if(!c||c.length===0)return[];let u=c.map(l=>l.value).filter(l=>l!==""&&l!=="");if(n.condition&&u.length>0)try{let l=[];for(let d of u){let f=n.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${r}'`).replace(/Target/g,`'${d.replace(/'/g,"\\'")}'`);f.trim().startsWith("WHERE")&&(f=`array::len(SELECT * FROM link ${f}) > 0`);let p=await this.querySurrealDB(`RETURN ${f}`);(p===!0||Array.isArray(p)&&p.length>0&&p[0]===!0)&&l.push(d)}u=l}catch(l){console.warn(`Failed to apply condition filter for ${t}:`,l)}if(n.instanceFilter)try{let l=await this.getSubjectClassMetadataFromSDNA(n.instanceFilter);return l?await this.batchCheckSubjectInstances(u,l):this.filterInstancesSequential(u,n.instanceFilter)}catch{return this.filterInstancesSequential(u,n.instanceFilter)}return u}async batchCheckSubjectInstances(r,e){if(r.length===0)return[];if(e.requiredTriples.length===0){let a=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${r.map(s=>`'${xe(s)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(a)).map(s=>s.uri)}let t=[];for(let n of e.requiredTriples){let a=r.map(u=>`'${xe(u)}'`).join(", "),o=xe(n.predicate),s;if(n.target){let u=xe(n.target);s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}' AND out.uri = '${u}'`}else s=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${a}] AND predicate = '${o}'`;let c=await this.querySurrealDB(s);t.push(new Set(c.map(u=>u.uri)))}return t.length===0?r:r.filter(n=>t.every(a=>a.has(n)))}async filterInstancesSequential(r,e){let t=[];for(let i of r)try{await this.isSubjectInstance(i,e)&&t.push(i)}catch{continue}return t}async getAllSubjectInstances(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new zn(this,s.base,i);await c.init(),t.push(c)}catch{}}}return t}async getAllSubjectProxies(r){let e=[];typeof r=="string"?e=[r]:e=await this.subjectClassesByTemplate(r);let t=[];for(let i of e){let n=await this.getSubjectClassMetadataFromSDNA(i);if(n){let a=this.generateSurrealInstanceQuery(n),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new zn(this,s.base,i);await c.init(),t.push(c)}catch{}}}return t}buildQueryFromTemplate(r){let e;return function(t){let i=[],n=[];Object.getPrototypeOf(t).__properties?Object.keys(Object.getPrototypeOf(t).__properties).forEach(l=>i.push(l)):i.push(...Object.keys(t).filter(l=>!Array.isArray(t[l]))),Object.getPrototypeOf(t).__collections?Object.keys(Object.getPrototypeOf(t).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>{n.includes(l)||n.push(l)}):n.push(...Object.keys(t).filter(l=>Array.isArray(t[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(t).filter(l=>typeof t[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let c=Object.getOwnPropertyNames(t).filter(l=>Object.prototype.hasOwnProperty.call(t,l)&&typeof t[l]=="function"&&l.startsWith("setCollection"));c=c.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(t)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let u="subject_class(Class, C)";for(let l of i)u+=`, property(C, "${l}")`;for(let l of n)u+=`, collection(C, "${l}")`;for(let l of a){let d=l.substring(3);d=d.charAt(0).toLowerCase()+d.slice(1),u+=`, property_setter(C, "${d}", _)`}for(let l of o)u+=`, collection_adder(C, "${tb(l)}", _)`;for(let l of s)u+=`, collection_remover(C, "${ib(l)}", _)`;for(let l of c)u+=`, collection_setter(C, "${nb(l)}", _)`;u+=".",e=u}(r),e}async subjectClassesByTemplate(r){let e=this.buildQueryFromTemplate(r),t=await this.infer(e);return t?t.map(i=>i.Class):[]}async ensureSDNASubjectClass(r){if((await this.subjectClassesByTemplate(new r)).length>0)return;let{name:t,sdna:i}=r.generateSDNA();await this.addSdna(t,i,"subject_class")}getNeighbourhoodProxy(){return k(this,he,"f").getNeighbourhoodProxy(k(this,fe,"f").uuid)}get ai(){return k(this,he,"f").aiClient}async subscribeInfer(r){let e=new pc(this.uuid,r,k(this,he,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(r){let e=new pc(this.uuid,r,k(this,he,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};fe=new WeakMap,he=new WeakMap,Di=new WeakMap,$i=new WeakMap,Ri=new WeakMap,qa=new WeakMap;var Wr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Q=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},te,Ba,Va,Qa,Qs,za,zs,Ws,ft=`
|
|
62
62
|
author
|
|
63
63
|
timestamp
|
|
64
64
|
status
|
|
@@ -95,13 +95,13 @@ neighbourhood {
|
|
|
95
95
|
}
|
|
96
96
|
}`,variables:{uuid:e}}));return t?new Vn(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=T(await Q(this,te,"f").query({query:I`query perspectiveSnapshot($uuid: String!) {
|
|
97
97
|
perspectiveSnapshot(uuid: $uuid) {
|
|
98
|
-
links { ${
|
|
98
|
+
links { ${ft} }
|
|
99
99
|
}
|
|
100
100
|
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectivePublishSnapshot($uuid: String!) {
|
|
101
101
|
perspectivePublishSnapshot(uuid: $uuid)
|
|
102
102
|
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:i}=T(await Q(this,te,"f").query({query:I`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
103
103
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
104
|
-
${
|
|
104
|
+
${ft}
|
|
105
105
|
}
|
|
106
106
|
}`,variables:{uuid:e,query:t}}));return i}async queryProlog(e,t){let{perspectiveQueryProlog:i}=T(await Q(this,te,"f").query({query:I`query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
107
107
|
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
@@ -141,32 +141,32 @@ neighbourhood {
|
|
|
141
141
|
perspectiveRemove(uuid: $uuid)
|
|
142
142
|
}`,variables:{uuid:e}}))}async addLink(e,t,i="shared",n){let{perspectiveAddLink:a}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
143
143
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
144
|
-
${
|
|
144
|
+
${ft}
|
|
145
145
|
}
|
|
146
146
|
}`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async addLinks(e,t,i="shared",n){let{perspectiveAddLinks:a}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
147
147
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
148
|
-
${
|
|
148
|
+
${ft}
|
|
149
149
|
}
|
|
150
150
|
}`,variables:{uuid:e,links:t,status:i,batchId:n}}));return a}async removeLinks(e,t,i){let{perspectiveRemoveLinks:n}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
151
151
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
152
|
-
${
|
|
152
|
+
${ft}
|
|
153
153
|
}
|
|
154
154
|
}`,variables:{uuid:e,links:t,batchId:i}}));return n}async linkMutations(e,t,i){let{perspectiveLinkMutations:n}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
155
155
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
156
156
|
additions {
|
|
157
|
-
${
|
|
157
|
+
${ft}
|
|
158
158
|
}
|
|
159
159
|
removals {
|
|
160
|
-
${
|
|
160
|
+
${ft}
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
}`,variables:{uuid:e,mutations:t,status:i}}));return n}async addLinkExpression(e,t,i="shared",n){let{perspectiveAddLinkExpression:a}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
164
164
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
165
|
-
${
|
|
165
|
+
${ft}
|
|
166
166
|
}
|
|
167
167
|
}`,variables:{uuid:e,link:t,status:i,batchId:n}}));return a}async updateLink(e,t,i,n){let{perspectiveUpdateLink:a}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
168
168
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
169
|
-
${
|
|
169
|
+
${ft}
|
|
170
170
|
}
|
|
171
171
|
}`,variables:{uuid:e,oldLink:t,newLink:i,batchId:n}}));return a}async removeLink(e,t,i){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:n}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
|
|
172
172
|
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
@@ -191,18 +191,18 @@ neighbourhood {
|
|
|
191
191
|
perspectiveRemoved
|
|
192
192
|
}
|
|
193
193
|
`}).subscribe({next:e=>{Q(this,Qa,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){Q(this,te,"f").subscribe({query:I` subscription {
|
|
194
|
-
perspectiveLinkAdded(uuid: "${e}") { ${
|
|
194
|
+
perspectiveLinkAdded(uuid: "${e}") { ${ft} }
|
|
195
195
|
}
|
|
196
196
|
`}).subscribe({next:i=>{t.forEach(n=>{n(i.data.perspectiveLinkAdded)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkRemovedListener(e,t){Q(this,te,"f").subscribe({query:I` subscription {
|
|
197
|
-
perspectiveLinkRemoved(uuid: "${e}") { ${
|
|
197
|
+
perspectiveLinkRemoved(uuid: "${e}") { ${ft} }
|
|
198
198
|
}
|
|
199
199
|
`}).subscribe({next:i=>{t.forEach(n=>{i.data.perspectiveLinkRemoved.status||delete i.data.perspectiveLinkRemoved.status,n(i.data.perspectiveLinkRemoved)})},error:i=>console.error(i)}),await new Promise(i=>setTimeout(i,500))}async addPerspectiveLinkUpdatedListener(e,t){Q(this,te,"f").subscribe({query:I` subscription {
|
|
200
200
|
perspectiveLinkUpdated(uuid: "${e}") {
|
|
201
201
|
oldLink {
|
|
202
|
-
${
|
|
202
|
+
${ft}
|
|
203
203
|
}
|
|
204
204
|
newLink {
|
|
205
|
-
${
|
|
205
|
+
${ft}
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
}
|
|
@@ -211,13 +211,13 @@ neighbourhood {
|
|
|
211
211
|
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:i}=T(await Q(this,te,"f").mutate({mutation:I`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
212
212
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
213
213
|
additions {
|
|
214
|
-
${
|
|
214
|
+
${ft}
|
|
215
215
|
}
|
|
216
216
|
removals {
|
|
217
|
-
${
|
|
217
|
+
${ft}
|
|
218
218
|
}
|
|
219
219
|
}
|
|
220
|
-
}`,variables:{uuid:e,batchId:t}}));return i}};te=new WeakMap,Ba=new WeakMap,Va=new WeakMap,Qa=new WeakMap,Qs=new WeakMap,za=new WeakMap,zs=new WeakMap,Ws=new WeakMap;var As=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ae=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},
|
|
220
|
+
}`,variables:{uuid:e,batchId:t}}));return i}};te=new WeakMap,Ba=new WeakMap,Va=new WeakMap,Qa=new WeakMap,Qs=new WeakMap,za=new WeakMap,zs=new WeakMap,Ws=new WeakMap;var As=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ae=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},de,Wa,Ha,Ga,La=`
|
|
221
221
|
did
|
|
222
222
|
directMessageLanguage
|
|
223
223
|
perspective {
|
|
@@ -263,17 +263,17 @@ neighbourhood {
|
|
|
263
263
|
`,ob=`
|
|
264
264
|
signature
|
|
265
265
|
publicKey
|
|
266
|
-
`,lo=class{constructor(e,t=!0){
|
|
266
|
+
`,lo=class{constructor(e,t=!0){de.set(this,void 0),Wa.set(this,void 0),Ha.set(this,void 0),Ga.set(this,void 0),As(this,de,e,"f"),As(this,Ha,[],"f"),As(this,Ga,[],"f"),As(this,Wa,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=T(await ae(this,de,"f").query({query:I`query agent { agent { ${La} } }`})),t=new ei(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=T(await ae(this,de,"f").query({query:I`query agentStatus {
|
|
267
267
|
agentStatus {
|
|
268
268
|
${Ln}
|
|
269
269
|
}
|
|
270
|
-
}`}));return new Vt(e)}async generate(e){let{agentGenerate:t}=T(await ae(this,
|
|
270
|
+
}`}));return new Vt(e)}async generate(e){let{agentGenerate:t}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentGenerate(
|
|
271
271
|
$passphrase: String!
|
|
272
272
|
) {
|
|
273
273
|
agentGenerate(passphrase: $passphrase) {
|
|
274
274
|
${Ln}
|
|
275
275
|
}
|
|
276
|
-
}`,variables:{passphrase:e}}));return new Vt(t)}async import(e){let{did:t,didDocument:i,keystore:n,passphrase:a}=e,{agentImport:o}=T(await ae(this,
|
|
276
|
+
}`,variables:{passphrase:e}}));return new Vt(t)}async import(e){let{did:t,didDocument:i,keystore:n,passphrase:a}=e,{agentImport:o}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentImport(
|
|
277
277
|
$did: String!,
|
|
278
278
|
$didDocument: String!,
|
|
279
279
|
$keystore: String!,
|
|
@@ -282,103 +282,103 @@ neighbourhood {
|
|
|
282
282
|
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
283
283
|
${Ln}
|
|
284
284
|
}
|
|
285
|
-
}`,variables:{did:t,didDocument:i,keystore:n,passphrase:a}}));return new Vt(o)}async lock(e){let{agentLock:t}=T(await ae(this,
|
|
285
|
+
}`,variables:{did:t,didDocument:i,keystore:n,passphrase:a}}));return new Vt(o)}async lock(e){let{agentLock:t}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentLock($passphrase: String!) {
|
|
286
286
|
agentLock(passphrase: $passphrase) {
|
|
287
287
|
${Ln}
|
|
288
288
|
}
|
|
289
|
-
}`,variables:{passphrase:e}}));return new Vt(t)}async unlock(e,t=!0){let{agentUnlock:i}=T(await ae(this,
|
|
289
|
+
}`,variables:{passphrase:e}}));return new Vt(t)}async unlock(e,t=!0){let{agentUnlock:i}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
|
|
290
290
|
agentUnlock(passphrase: $passphrase, holochain: $holochain) {
|
|
291
291
|
${Ln}
|
|
292
292
|
}
|
|
293
|
-
}`,variables:{passphrase:e,holochain:t}}));return new Vt(i)}async byDID(e){let{agentByDID:t}=T(await ae(this,
|
|
293
|
+
}`,variables:{passphrase:e,holochain:t}}));return new Vt(i)}async byDID(e){let{agentByDID:t}=T(await ae(this,de,"f").query({query:I`query agentByDID($did: String!) {
|
|
294
294
|
agentByDID(did: $did) {
|
|
295
295
|
${La}
|
|
296
296
|
}
|
|
297
|
-
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:i}=T(await ae(this,
|
|
297
|
+
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:i}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
|
|
298
298
|
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
299
299
|
${La}
|
|
300
300
|
}
|
|
301
|
-
}`,variables:{perspective:t}})),n=i,a=new ei(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new fc(ae(this,
|
|
301
|
+
}`,variables:{perspective:t}})),n=i,a=new ei(n.did,n.perspective);return a.directMessageLanguage=n.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new fc(ae(this,de,"f")),i=new lo(ae(this,de,"f")),n=await t.add("Agent Perspective Proxy"),a=await i.me();a.perspective&&await n.loadSnapshot(a.perspective);for(let c of e.additions)await n.add(c);for(let c of e.removals)await n.remove(c);let o=await n.snapshot(),s=await this.updatePublicPerspective(o);return await t.remove(n.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
|
|
302
302
|
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
303
303
|
${La}
|
|
304
304
|
}
|
|
305
|
-
}`,variables:{directMessageLanguage:e}})),i=t,n=new ei(i.did,i.perspective);return n.directMessageLanguage=i.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=T(await ae(this,
|
|
305
|
+
}`,variables:{directMessageLanguage:e}})),i=t,n=new ei(i.did,i.perspective);return n.directMessageLanguage=i.directMessageLanguage,n}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
306
306
|
agentAddEntanglementProofs(proofs: $proofs) {
|
|
307
307
|
${Ts}
|
|
308
308
|
}
|
|
309
|
-
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=T(await ae(this,
|
|
309
|
+
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
310
310
|
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
311
311
|
${Ts}
|
|
312
312
|
}
|
|
313
|
-
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=T(await ae(this,
|
|
313
|
+
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=T(await ae(this,de,"f").query({query:I`query agentGetEntanglementProofs {
|
|
314
314
|
agentGetEntanglementProofs {
|
|
315
315
|
${Ts}
|
|
316
316
|
}
|
|
317
|
-
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:i}=T(await ae(this,
|
|
317
|
+
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:i}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
|
|
318
318
|
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
319
319
|
${Ts}
|
|
320
320
|
}
|
|
321
|
-
}`,variables:{deviceKey:e,deviceKeyType:t}}));return i}addUpdatedListener(e){ae(this,
|
|
321
|
+
}`,variables:{deviceKey:e,deviceKeyType:t}}));return i}addUpdatedListener(e){ae(this,Ha,"f").push(e)}addAppChangedListener(e){ae(this,Wa,"f").push(e)}subscribeAgentUpdated(){ae(this,de,"f").subscribe({query:I` subscription {
|
|
322
322
|
agentUpdated { ${La} }
|
|
323
323
|
}
|
|
324
|
-
`}).subscribe({next:e=>{let t=e.data.agentUpdated;ae(this,
|
|
324
|
+
`}).subscribe({next:e=>{let t=e.data.agentUpdated;ae(this,Ha,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){ae(this,de,"f").subscribe({query:I` subscription {
|
|
325
325
|
agentAppsChanged {
|
|
326
326
|
${Is}
|
|
327
327
|
}
|
|
328
328
|
}
|
|
329
|
-
`}).subscribe({next:e=>{ae(this,Wa,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){ae(this,
|
|
329
|
+
`}).subscribe({next:e=>{ae(this,Wa,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){ae(this,Ga,"f").push(e)}subscribeAgentStatusChanged(){ae(this,de,"f").subscribe({query:I` subscription {
|
|
330
330
|
agentStatusChanged { ${Ln} }
|
|
331
331
|
}
|
|
332
|
-
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;ae(this,
|
|
332
|
+
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;ae(this,Ga,"f").forEach(i=>{i(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=T(await ae(this,de,"f").mutate({mutation:I`
|
|
333
333
|
mutation agentRequestCapability($authInfo: AuthInfoInput!) {
|
|
334
334
|
agentRequestCapability(authInfo: $authInfo)
|
|
335
335
|
}
|
|
336
|
-
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=T(await ae(this,
|
|
336
|
+
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=T(await ae(this,de,"f").mutate({mutation:I`
|
|
337
337
|
mutation agentPermitCapability($auth: String!) {
|
|
338
338
|
agentPermitCapability(auth: $auth)
|
|
339
339
|
}
|
|
340
|
-
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:i}=T(await ae(this,
|
|
340
|
+
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:i}=T(await ae(this,de,"f").mutate({mutation:I`
|
|
341
341
|
mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
342
342
|
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
343
343
|
}
|
|
344
|
-
`,variables:{requestId:e,rand:t}}));return i}async getApps(){let{agentGetApps:e}=T(await ae(this,
|
|
344
|
+
`,variables:{requestId:e,rand:t}}));return i}async getApps(){let{agentGetApps:e}=T(await ae(this,de,"f").mutate({mutation:I`query agentGetApps {
|
|
345
345
|
agentGetApps {
|
|
346
346
|
${Is}
|
|
347
347
|
}
|
|
348
|
-
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=T(await ae(this,
|
|
348
|
+
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentRemoveApp($requestId: String!) {
|
|
349
349
|
agentRemoveApp(requestId: $requestId) {
|
|
350
350
|
${Is}
|
|
351
351
|
}
|
|
352
|
-
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=T(await ae(this,
|
|
352
|
+
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentRevokeToken($requestId: String!) {
|
|
353
353
|
agentRevokeToken(requestId: $requestId) {
|
|
354
354
|
${Is}
|
|
355
355
|
}
|
|
356
|
-
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=T(await ae(this,
|
|
356
|
+
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=T(await ae(this,de,"f").mutate({mutation:I`
|
|
357
357
|
query agentIsLocked {
|
|
358
358
|
agentIsLocked
|
|
359
359
|
}
|
|
360
|
-
`}));return e}async signMessage(e){let{agentSignMessage:t}=T(await ae(this,
|
|
360
|
+
`}));return e}async signMessage(e){let{agentSignMessage:t}=T(await ae(this,de,"f").mutate({mutation:I`mutation agentSignMessage($message: String!) {
|
|
361
361
|
agentSignMessage(message: $message) {
|
|
362
362
|
${ob}
|
|
363
363
|
}
|
|
364
|
-
}`,variables:{message:e}}));return t}async createUser(e,t,i){let{runtimeCreateUser:n}=T(await ae(this,
|
|
364
|
+
}`,variables:{message:e}}));return t}async createUser(e,t,i){let{runtimeCreateUser:n}=T(await ae(this,de,"f").mutate({mutation:I`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
|
|
365
365
|
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
366
366
|
did
|
|
367
367
|
success
|
|
368
368
|
error
|
|
369
369
|
}
|
|
370
|
-
}`,variables:{email:e,password:t,appInfo:i}}));return n}async loginUser(e,t){let{runtimeLoginUser:i}=T(await ae(this,
|
|
370
|
+
}`,variables:{email:e,password:t,appInfo:i}}));return n}async loginUser(e,t){let{runtimeLoginUser:i}=T(await ae(this,de,"f").mutate({mutation:I`mutation runtimeLoginUser($email: String!, $password: String!) {
|
|
371
371
|
runtimeLoginUser(email: $email, password: $password)
|
|
372
|
-
}`,variables:{email:e,password:t}}));return i}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:i}=T(await ae(this,
|
|
372
|
+
}`,variables:{email:e,password:t}}));return i}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:i}=T(await ae(this,de,"f").mutate({mutation:I`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
|
|
373
373
|
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
374
374
|
success
|
|
375
375
|
message
|
|
376
376
|
requiresPassword
|
|
377
377
|
isExistingUser
|
|
378
378
|
}
|
|
379
|
-
}`,variables:{email:e,appInfo:t}}));return i}async verifyEmailCode(e,t,i){let{runtimeVerifyEmailCode:n}=T(await ae(this,
|
|
379
|
+
}`,variables:{email:e,appInfo:t}}));return i}async verifyEmailCode(e,t,i){let{runtimeVerifyEmailCode:n}=T(await ae(this,de,"f").mutate({mutation:I`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
|
|
380
380
|
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
381
|
-
}`,variables:{email:e,code:t,verificationType:i}}));return n}};
|
|
381
|
+
}`,variables:{email:e,code:t,verificationType:i}}));return n}};de=new WeakMap,Wa=new WeakMap,Ha=new WeakMap,Ga=new WeakMap;var sb=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Hr=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Yt,Nd=`
|
|
382
382
|
name
|
|
383
383
|
address
|
|
384
384
|
settings
|
|
@@ -395,45 +395,45 @@ neighbourhood {
|
|
|
395
395
|
templateAppliedParams
|
|
396
396
|
possibleTemplateParams
|
|
397
397
|
sourceCodeLink
|
|
398
|
-
`,Al=class{constructor(e){Yt.set(this,void 0),sb(this,Yt,e,"f")}async byAddress(e){let{language:t}=T(await
|
|
398
|
+
`,Al=class{constructor(e){Yt.set(this,void 0),sb(this,Yt,e,"f")}async byAddress(e){let{language:t}=T(await Hr(this,Yt,"f").query({query:I`query byAddress($address: String!) {
|
|
399
399
|
language(address: $address) {
|
|
400
400
|
${Nd}
|
|
401
401
|
}
|
|
402
|
-
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=T(await
|
|
402
|
+
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=T(await Hr(this,Yt,"f").query({query:I`query byFilter($filter: String!) {
|
|
403
403
|
languages(filter: $filter) {
|
|
404
404
|
${Nd}
|
|
405
405
|
}
|
|
406
|
-
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:i}=T(await
|
|
406
|
+
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:i}=T(await Hr(this,Yt,"f").mutate({mutation:I`mutation writeSettings($languageAddress: String!, $settings: String!) {
|
|
407
407
|
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
408
|
-
}`,variables:{languageAddress:e,settings:t}}));return i}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:i}=T(await
|
|
408
|
+
}`,variables:{languageAddress:e,settings:t}}));return i}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:i}=T(await Hr(this,Yt,"f").mutate({mutation:I`mutation languageApplyTemplateAndPublish(
|
|
409
409
|
$sourceLanguageHash: String!,
|
|
410
410
|
$templateData: String!,
|
|
411
411
|
) {
|
|
412
412
|
languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
|
|
413
413
|
name, address
|
|
414
414
|
}
|
|
415
|
-
}`,variables:{sourceLanguageHash:e,templateData:t}}));return i}async publish(e,t){let{languagePublish:i}=T(await
|
|
415
|
+
}`,variables:{sourceLanguageHash:e,templateData:t}}));return i}async publish(e,t){let{languagePublish:i}=T(await Hr(this,Yt,"f").mutate({mutation:I`mutation languagePublish(
|
|
416
416
|
$languagePath: String!,
|
|
417
417
|
$languageMeta: LanguageMetaInput!,
|
|
418
418
|
) {
|
|
419
419
|
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
420
420
|
${Dd}
|
|
421
421
|
}
|
|
422
|
-
}`,variables:{languagePath:e,languageMeta:t}}));return i}async meta(e){let{languageMeta:t}=T(await
|
|
422
|
+
}`,variables:{languagePath:e,languageMeta:t}}));return i}async meta(e){let{languageMeta:t}=T(await Hr(this,Yt,"f").query({query:I`query languageMeta(
|
|
423
423
|
$address: String!,
|
|
424
424
|
) {
|
|
425
425
|
languageMeta(address: $address) {
|
|
426
426
|
${Dd}
|
|
427
427
|
}
|
|
428
|
-
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=T(await
|
|
428
|
+
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=T(await Hr(this,Yt,"f").query({query:I`query languageSource(
|
|
429
429
|
$address: String!,
|
|
430
430
|
) {
|
|
431
431
|
languageSource(address: $address)
|
|
432
|
-
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=T(await
|
|
432
|
+
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=T(await Hr(this,Yt,"f").mutate({mutation:I`mutation languageRemove(
|
|
433
433
|
$address: String!,
|
|
434
434
|
) {
|
|
435
435
|
languageRemove(address: $address)
|
|
436
|
-
}`,variables:{address:e}}));return t}};Yt=new WeakMap;var cb=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},st=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},
|
|
436
|
+
}`,variables:{address:e}}));return t}};Yt=new WeakMap;var cb=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},st=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},mt,Bn,Il=class{constructor(e){mt.set(this,void 0),Bn.set(this,new Map),cb(this,mt,e,"f")}async publishFromPerspective(e,t,i){let{neighbourhoodPublishFromPerspective:n}=T(await st(this,mt,"f").mutate({mutation:I`mutation neighbourhoodPublishFromPerspective(
|
|
437
437
|
$linkLanguage: String!,
|
|
438
438
|
$meta: PerspectiveInput!,
|
|
439
439
|
$perspectiveUUID: String!
|
|
@@ -443,7 +443,7 @@ neighbourhood {
|
|
|
443
443
|
meta: $meta,
|
|
444
444
|
perspectiveUUID: $perspectiveUUID
|
|
445
445
|
)
|
|
446
|
-
}`,variables:{perspectiveUUID:e,linkLanguage:t,meta:i}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=T(await st(this,
|
|
446
|
+
}`,variables:{perspectiveUUID:e,linkLanguage:t,meta:i}}));return n}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=T(await st(this,mt,"f").mutate({mutation:I`mutation neighbourhoodJoinFromUrl($url: String!) {
|
|
447
447
|
neighbourhoodJoinFromUrl(url: $url) {
|
|
448
448
|
uuid
|
|
449
449
|
name
|
|
@@ -465,11 +465,11 @@ neighbourhood {
|
|
|
465
465
|
author
|
|
466
466
|
}
|
|
467
467
|
}
|
|
468
|
-
}`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=T(await st(this,
|
|
468
|
+
}`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=T(await st(this,mt,"f").query({query:I`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
|
|
469
469
|
neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
|
|
470
|
-
}`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=T(await st(this,
|
|
470
|
+
}`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=T(await st(this,mt,"f").query({query:I`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
|
|
471
471
|
neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
|
|
472
|
-
}`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=T(await st(this,
|
|
472
|
+
}`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=T(await st(this,mt,"f").query({query:I`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
|
|
473
473
|
neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
|
|
474
474
|
did
|
|
475
475
|
status {
|
|
@@ -486,7 +486,7 @@ neighbourhood {
|
|
|
486
486
|
proof { valid, invalid, signature, key }
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:i}=T(await st(this,
|
|
489
|
+
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:i}=T(await st(this,mt,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatus(
|
|
490
490
|
$perspectiveUUID: String!,
|
|
491
491
|
$status: PerspectiveInput!
|
|
492
492
|
) {
|
|
@@ -494,7 +494,7 @@ neighbourhood {
|
|
|
494
494
|
perspectiveUUID: $perspectiveUUID,
|
|
495
495
|
status: $status
|
|
496
496
|
)
|
|
497
|
-
}`,variables:{perspectiveUUID:e,status:t}}));return i}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:i}=T(await st(this,
|
|
497
|
+
}`,variables:{perspectiveUUID:e,status:t}}));return i}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:i}=T(await st(this,mt,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatusU(
|
|
498
498
|
$perspectiveUUID: String!,
|
|
499
499
|
$status: PerspectiveUnsignedInput!
|
|
500
500
|
) {
|
|
@@ -502,7 +502,7 @@ neighbourhood {
|
|
|
502
502
|
perspectiveUUID: $perspectiveUUID,
|
|
503
503
|
status: $status
|
|
504
504
|
)
|
|
505
|
-
}`,variables:{perspectiveUUID:e,status:t}}));return i}async sendSignal(e,t,i){let{neighbourhoodSendSignal:n}=T(await st(this,
|
|
505
|
+
}`,variables:{perspectiveUUID:e,status:t}}));return i}async sendSignal(e,t,i){let{neighbourhoodSendSignal:n}=T(await st(this,mt,"f").mutate({mutation:I`mutation neighbourhoodSendSignal(
|
|
506
506
|
$perspectiveUUID: String!,
|
|
507
507
|
$remoteAgentDid: String!,
|
|
508
508
|
$payload: PerspectiveInput!
|
|
@@ -512,7 +512,7 @@ neighbourhood {
|
|
|
512
512
|
remoteAgentDid: $remoteAgentDid,
|
|
513
513
|
payload: $payload
|
|
514
514
|
)
|
|
515
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendSignalU(e,t,i){let{neighbourhoodSendSignalU:n}=T(await st(this,
|
|
515
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendSignalU(e,t,i){let{neighbourhoodSendSignalU:n}=T(await st(this,mt,"f").mutate({mutation:I`mutation neighbourhoodSendSignalU(
|
|
516
516
|
$perspectiveUUID: String!,
|
|
517
517
|
$remoteAgentDid: String!,
|
|
518
518
|
$payload: PerspectiveUnsignedInput!
|
|
@@ -522,7 +522,7 @@ neighbourhood {
|
|
|
522
522
|
remoteAgentDid: $remoteAgentDid,
|
|
523
523
|
payload: $payload
|
|
524
524
|
)
|
|
525
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendBroadcast(e,t,i=!1){let{neighbourhoodSendBroadcast:n}=T(await st(this,
|
|
525
|
+
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:i}}));return n}async sendBroadcast(e,t,i=!1){let{neighbourhoodSendBroadcast:n}=T(await st(this,mt,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcast(
|
|
526
526
|
$perspectiveUUID: String!,
|
|
527
527
|
$payload: PerspectiveInput!,
|
|
528
528
|
$loopback: Boolean
|
|
@@ -532,7 +532,7 @@ neighbourhood {
|
|
|
532
532
|
payload: $payload,
|
|
533
533
|
loopback: $loopback
|
|
534
534
|
)
|
|
535
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}async sendBroadcastU(e,t,i=!1){let{neighbourhoodSendBroadcastU:n}=T(await st(this,
|
|
535
|
+
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}async sendBroadcastU(e,t,i=!1){let{neighbourhoodSendBroadcastU:n}=T(await st(this,mt,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcastU(
|
|
536
536
|
$perspectiveUUID: String!,
|
|
537
537
|
$payload: PerspectiveUnsignedInput!,
|
|
538
538
|
$loopback: Boolean
|
|
@@ -542,7 +542,7 @@ neighbourhood {
|
|
|
542
542
|
payload: $payload,
|
|
543
543
|
loopback: $loopback
|
|
544
544
|
)
|
|
545
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}dispatchSignal(e,t){let i=st(this,Bn,"f").get(e);i&&i.forEach(n=>n(t))}async subscribeToSignals(e){let t=this;await st(this,
|
|
545
|
+
}`,variables:{perspectiveUUID:e,payload:t,loopback:i}}));return n}dispatchSignal(e,t){let i=st(this,Bn,"f").get(e);i&&i.forEach(n=>n(t))}async subscribeToSignals(e){let t=this;await st(this,mt,"f").subscribe({query:I`subscription neighbourhoodSignal($perspectiveUUID: String!) {
|
|
546
546
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
547
547
|
author
|
|
548
548
|
timestamp
|
|
@@ -557,7 +557,7 @@ neighbourhood {
|
|
|
557
557
|
}
|
|
558
558
|
proof { valid, invalid, signature, key }
|
|
559
559
|
}
|
|
560
|
-
}`,variables:{perspectiveUUID:e}}).subscribe({next:i=>{let{neighbourhoodSignal:n}=T(i);t.dispatchSignal(e,n)}})}async addSignalHandler(e,t){let i=st(this,Bn,"f").get(e);i||(i=[],st(this,Bn,"f").set(e,i),await this.subscribeToSignals(e)),i.push(t)}removeSignalHandler(e,t){let i=st(this,Bn,"f").get(e);if(i){let n=i.indexOf(t);n>-1&&i.splice(n,1)}}};
|
|
560
|
+
}`,variables:{perspectiveUUID:e}}).subscribe({next:i=>{let{neighbourhoodSignal:n}=T(i);t.dispatchSignal(e,n)}})}async addSignalHandler(e,t){let i=st(this,Bn,"f").get(e);i||(i=[],st(this,Bn,"f").set(e,i),await this.subscribeToSignals(e)),i.push(t)}removeSignalHandler(e,t){let i=st(this,Bn,"f").get(e);if(i){let n=i.indexOf(t);n>-1&&i.splice(n,1)}}};mt=new WeakMap,Bn=new WeakMap;var ks=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},z=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},K,Ka,Ja,Za,Zh,Os=`
|
|
561
561
|
author
|
|
562
562
|
timestamp
|
|
563
563
|
data {
|
|
@@ -739,7 +739,7 @@ triggerMatch
|
|
|
739
739
|
}
|
|
740
740
|
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:i}=T(await Fn(this,Or,"f").mutate({mutation:I`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
|
|
741
741
|
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
742
|
-
}`,variables:{url:e,interactionCall:t}}));return i}};Or=new WeakMap;var Ac={};Ac.byteLength=db;Ac.toByteArray=mb;Ac.fromByteArray=vb;var fr=[],Bt=[],fb=typeof Uint8Array<"u"?Uint8Array:Array,tl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ti=0,$d=tl.length;Ti<$d;++Ti)fr[Ti]=tl[Ti],Bt[tl.charCodeAt(Ti)]=Ti;var Ti,$d;Bt["-".charCodeAt(0)]=62;Bt["_".charCodeAt(0)]=63;function Xh(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function db(r){var e=Xh(r),t=e[0],i=e[1];return(t+i)*3/4-i}function hb(r,e,t){return(e+t)*3/4-t}function mb(r){var e,t=Xh(r),i=t[0],n=t[1],a=new fb(hb(r,i,n)),o=0,s=n>0?i-4:i,c;for(c=0;c<s;c+=4)e=Bt[r.charCodeAt(c)]<<18|Bt[r.charCodeAt(c+1)]<<12|Bt[r.charCodeAt(c+2)]<<6|Bt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Bt[r.charCodeAt(c)]<<2|Bt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),n===1&&(e=Bt[r.charCodeAt(c)]<<10|Bt[r.charCodeAt(c+1)]<<4|Bt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function gb(r){return fr[r>>18&63]+fr[r>>12&63]+fr[r>>6&63]+fr[r&63]}function yb(r,e,t){for(var i,n=[],a=e;a<t;a+=3)i=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),n.push(gb(i));return n.join("")}function vb(r){for(var e,t=r.length,i=t%3,n=[],a=16383,o=0,s=t-i;o<s;o+=a)n.push(yb(r,o,o+a>s?s:o+a));return i===1?(e=r[t-1],n.push(fr[e>>2]+fr[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(fr[e>>10]+fr[e>>4&63]+fr[e<<2&63]+"=")),n.join("")}var bb=4,Rd=0,Pd=1,wb=2;function na(r){let e=r.length;for(;--e>=0;)r[e]=0}var _b=0,em=1,Sb=2,Eb=3,xb=258,Hl=29,xo=256,po=xo+1+Hl,Wn=30,Kl=19,tm=2*po+1,Mi=15,rl=16,Ab=7,Jl=256,rm=16,im=17,nm=18,Ol=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]),Gs=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]),Ib=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),am=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tb=512,Cr=new Array((po+2)*2);na(Cr);var no=new Array(Wn*2);na(no);var fo=new Array(Tb);na(fo);var ho=new Array(xb-Eb+1);na(ho);var Zl=new Array(Hl);na(Zl);var dc=new Array(Wn);na(dc);function il(r,e,t,i,n){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=n,this.has_stree=r&&r.length}var om,sm,cm;function nl(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var um=r=>r<256?fo[r]:fo[256+(r>>>7)],mo=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},xt=(r,e,t)=>{r.bi_valid>rl-t?(r.bi_buf|=e<<r.bi_valid&65535,mo(r,r.bi_buf),r.bi_buf=e>>rl-r.bi_valid,r.bi_valid+=t-rl):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},dr=(r,e,t)=>{xt(r,t[e*2],t[e*2+1])},lm=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},kb=r=>{r.bi_valid===16?(mo(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},Ob=(r,e)=>{let t=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,d,f,p,h,m=0;for(f=0;f<=Mi;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<tm;u++)l=r.heap[u],f=t[t[l*2+1]*2+1]+1,f>c&&(f=c,m++),t[l*2+1]=f,!(l>i)&&(r.bl_count[f]++,p=0,l>=s&&(p=o[l-s]),h=t[l*2],r.opt_len+=h*(f+p),a&&(r.static_len+=h*(n[l*2+1]+p)));if(m!==0){do{for(f=c-1;r.bl_count[f]===0;)f--;r.bl_count[f]--,r.bl_count[f+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(f=c;f!==0;f--)for(l=r.bl_count[f];l!==0;)d=r.heap[--u],!(d>i)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),l--)}},pm=(r,e,t)=>{let i=new Array(Mi+1),n=0,a,o;for(a=1;a<=Mi;a++)n=n+t[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=lm(i[s]++,s))}},Cb=()=>{let r,e,t,i,n,a=new Array(Mi+1);for(t=0,i=0;i<Hl-1;i++)for(Zl[i]=t,r=0;r<1<<Ol[i];r++)ho[t++]=i;for(ho[t-1]=i,n=0,i=0;i<16;i++)for(dc[i]=n,r=0;r<1<<Gs[i];r++)fo[n++]=i;for(n>>=7;i<Wn;i++)for(dc[i]=n<<7,r=0;r<1<<Gs[i]-7;r++)fo[256+n++]=i;for(e=0;e<=Mi;e++)a[e]=0;for(r=0;r<=143;)Cr[r*2+1]=8,r++,a[8]++;for(;r<=255;)Cr[r*2+1]=9,r++,a[9]++;for(;r<=279;)Cr[r*2+1]=7,r++,a[7]++;for(;r<=287;)Cr[r*2+1]=8,r++,a[8]++;for(pm(Cr,po+1,a),r=0;r<Wn;r++)no[r*2+1]=5,no[r*2]=lm(r,5);om=new il(Cr,Ol,xo+1,po,Mi),sm=new il(no,Gs,0,Wn,Mi),cm=new il(new Array(0),Ib,0,Kl,Ab)},fm=r=>{let e;for(e=0;e<po;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Wn;e++)r.dyn_dtree[e*2]=0;for(e=0;e<Kl;e++)r.bl_tree[e*2]=0;r.dyn_ltree[Jl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},dm=r=>{r.bi_valid>8?mo(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Ld=(r,e,t,i)=>{let n=e*2,a=t*2;return r[n]<r[a]||r[n]===r[a]&&i[e]<=i[t]},al=(r,e,t)=>{let i=r.heap[t],n=t<<1;for(;n<=r.heap_len&&(n<r.heap_len&&Ld(e,r.heap[n+1],r.heap[n],r.depth)&&n++,!Ld(e,i,r.heap[n],r.depth));)r.heap[t]=r.heap[n],t=n,n<<=1;r.heap[t]=i},Fd=(r,e,t)=>{let i,n,a=0,o,s;if(r.sym_next!==0)do i=r.pending_buf[r.sym_buf+a++]&255,i+=(r.pending_buf[r.sym_buf+a++]&255)<<8,n=r.pending_buf[r.sym_buf+a++],i===0?dr(r,n,e):(o=ho[n],dr(r,o+xo+1,e),s=Ol[o],s!==0&&(n-=Zl[o],xt(r,n,s)),i--,o=um(i),dr(r,o,t),s=Gs[o],s!==0&&(i-=dc[o],xt(r,i,s)));while(a<r.sym_next);dr(r,Jl,e)},Cl=(r,e)=>{let t=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,u;for(r.heap_len=0,r.heap_max=tm,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)u=r.heap[++r.heap_len]=c<2?++c:0,t[u*2]=1,r.depth[u]=0,r.opt_len--,n&&(r.static_len-=i[u*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)al(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],al(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[u*2]=t[o*2]+t[s*2],r.depth[u]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=u,r.heap[1]=u++,al(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],Ob(r,e),pm(t,c,r.bl_count)},Md=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)&&(s<u?r.bl_tree[a*2]+=s:a!==0?(a!==n&&r.bl_tree[a*2]++,r.bl_tree[rm*2]++):s<=10?r.bl_tree[im*2]++:r.bl_tree[nm*2]++,s=0,n=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},jd=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),i=0;i<=t;i++)if(a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)){if(s<u)do dr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==n&&(dr(r,a,r.bl_tree),s--),dr(r,rm,r.bl_tree),xt(r,s-3,2)):s<=10?(dr(r,im,r.bl_tree),xt(r,s-3,3)):(dr(r,nm,r.bl_tree),xt(r,s-11,7));s=0,n=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Nb=r=>{let e;for(Md(r,r.dyn_ltree,r.l_desc.max_code),Md(r,r.dyn_dtree,r.d_desc.max_code),Cl(r,r.bl_desc),e=Kl-1;e>=3&&r.bl_tree[am[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},Db=(r,e,t,i)=>{let n;for(xt(r,e-257,5),xt(r,t-1,5),xt(r,i-4,4),n=0;n<i;n++)xt(r,r.bl_tree[am[n]*2+1],3);jd(r,r.dyn_ltree,e-1),jd(r,r.dyn_dtree,t-1)},$b=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Rd;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Pd;for(t=32;t<xo;t++)if(r.dyn_ltree[t*2]!==0)return Pd;return Rd},Ud=!1,Rb=r=>{Ud||(Cb(),Ud=!0),r.l_desc=new nl(r.dyn_ltree,om),r.d_desc=new nl(r.dyn_dtree,sm),r.bl_desc=new nl(r.bl_tree,cm),r.bi_buf=0,r.bi_valid=0,fm(r)},hm=(r,e,t,i)=>{xt(r,(_b<<1)+(i?1:0),3),dm(r),mo(r,t),mo(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},Pb=r=>{xt(r,em<<1,3),dr(r,Jl,Cr),kb(r)},Lb=(r,e,t,i)=>{let n,a,o=0;r.level>0?(r.strm.data_type===wb&&(r.strm.data_type=$b(r)),Cl(r,r.l_desc),Cl(r,r.d_desc),o=Nb(r),n=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?hm(r,e,t,i):r.strategy===bb||a===n?(xt(r,(em<<1)+(i?1:0),3),Fd(r,Cr,no)):(xt(r,(Sb<<1)+(i?1:0),3),Db(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Fd(r,r.dyn_ltree,r.dyn_dtree)),fm(r),i&&dm(r)},Fb=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(ho[t]+xo+1)*2]++,r.dyn_dtree[um(e)*2]++),r.sym_next===r.sym_end),Mb=Rb,jb=hm,Ub=Lb,qb=Fb,Bb=Pb,Vb={_tr_init:Mb,_tr_stored_block:jb,_tr_flush_block:Ub,_tr_tally:qb,_tr_align:Bb},Qb=(r,e,t,i)=>{let n=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},go=Qb,zb=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var i=0;i<8;i++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},Wb=new Uint32Array(zb()),Gb=(r,e,t,i)=>{let n=Wb,a=i+t;r^=-1;for(let o=i;o<a;o++)r=r>>>8^n[(r^e[o])&255];return r^-1},Ge=Gb,Ki={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"},an={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:Hb,_tr_stored_block:Nl,_tr_flush_block:Kb,_tr_tally:ri,_tr_align:Jb}=Vb,{Z_NO_FLUSH:ii,Z_PARTIAL_FLUSH:Zb,Z_FULL_FLUSH:Yb,Z_FINISH:Qt,Z_BLOCK:qd,Z_OK:tt,Z_STREAM_END:Bd,Z_STREAM_ERROR:mr,Z_DATA_ERROR:Xb,Z_BUF_ERROR:ol,Z_DEFAULT_COMPRESSION:e0,Z_FILTERED:t0,Z_HUFFMAN_ONLY:Cs,Z_RLE:r0,Z_FIXED:i0,Z_DEFAULT_STRATEGY:n0,Z_UNKNOWN:a0,Z_DEFLATED:Ic}=an,o0=9,s0=15,c0=8,u0=29,l0=256,Dl=l0+1+u0,p0=30,f0=19,d0=2*Dl+1,h0=15,se=3,Yr=258,gr=Yr+se+1,m0=32,Jn=42,Yl=57,$l=69,Rl=73,Pl=91,Ll=103,ji=113,Ya=666,gt=1,aa=2,Ji=3,oa=4,g0=3,Ui=(r,e)=>(r.msg=Ki[e],e),Vd=r=>r*2-(r>4?9:0),Zr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},y0=r=>{let e,t,i,n=r.w_size;e=r.hash_size,i=e;do t=r.head[--i],r.head[i]=t>=n?t-n:0;while(--e);e=n,i=e;do t=r.prev[--i],r.prev[i]=t>=n?t-n:0;while(--e)},v0=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,ni=v0,Ot=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Nt=(r,e)=>{Kb(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,Ot(r.strm)},me=(r,e)=>{r.pending_buf[r.pending++]=e},Fa=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Fl=(r,e,t,i)=>{let n=r.avail_in;return n>i&&(n=i),n===0?0:(r.avail_in-=n,e.set(r.input.subarray(r.next_in,r.next_in+n),t),r.state.wrap===1?r.adler=go(r.adler,e,n,t):r.state.wrap===2&&(r.adler=Ge(r.adler,e,n,t)),r.next_in+=n,r.total_in+=n,n)},mm=(r,e)=>{let t=r.max_chain_length,i=r.strstart,n,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-gr?r.strstart-(r.w_size-gr):0,u=r.window,l=r.w_mask,d=r.prev,f=r.strstart+Yr,p=u[i+o-1],h=u[i+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(n=e,!(u[n+o]!==h||u[n+o-1]!==p||u[n]!==u[i]||u[++n]!==u[i+1])){i+=2,n++;do;while(u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&i<f);if(a=Yr-(f-i),i=f-Yr,a>o){if(r.match_start=e,o=a,a>=s)break;p=u[i+o-1],h=u[i+o]}}while((e=d[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Zn=r=>{let e=r.w_size,t,i,n;do{if(i=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-gr)&&(r.window.set(r.window.subarray(e,e+e-i),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),y0(r),i+=e),r.strm.avail_in===0)break;if(t=Fl(r.strm,r.window,r.strstart+r.lookahead,i),r.lookahead+=t,r.lookahead+r.insert>=se)for(n=r.strstart-r.insert,r.ins_h=r.window[n],r.ins_h=ni(r,r.ins_h,r.window[n+1]);r.insert&&(r.ins_h=ni(r,r.ins_h,r.window[n+se-1]),r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,r.insert--,!(r.lookahead+r.insert<se)););}while(r.lookahead<gr&&r.strm.avail_in!==0)},gm=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,i,n,a,o=0,s=r.strm.avail_in;do{if(i=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,n=r.strstart-r.block_start,i>n+r.strm.avail_in&&(i=n+r.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==Qt||e===ii||i!==n+r.strm.avail_in)))break;o=e===Qt&&i===n+r.strm.avail_in?1:0,Nl(r,0,0,o),r.pending_buf[r.pending-4]=i,r.pending_buf[r.pending-3]=i>>8,r.pending_buf[r.pending-2]=~i,r.pending_buf[r.pending-1]=~i>>8,Ot(r.strm),n&&(n>i&&(n=i),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,i-=n),i&&(Fl(r.strm,r.strm.output,r.strm.next_out,i),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?oa:e!==ii&&e!==Qt&&r.strm.avail_in===0&&r.strstart===r.block_start?aa:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(Fl(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,n=r.strstart-r.block_start,(n>=t||(n||e===Qt)&&e!==ii&&r.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Qt&&r.strm.avail_in===0&&i===n?1:0,Nl(r,r.block_start,i,o),r.block_start+=i,Ot(r.strm)),o?Ji:gt)},sl=(r,e)=>{let t,i;for(;;){if(r.lookahead<gr){if(Zn(r),r.lookahead<gr&&e===ii)return gt;if(r.lookahead===0)break}if(t=0,r.lookahead>=se&&(r.ins_h=ni(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-gr&&(r.match_length=mm(r,t)),r.match_length>=se)if(i=ri(r,r.strstart-r.match_start,r.match_length-se),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=se){r.match_length--;do r.strstart++,r.ins_h=ni(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=ni(r,r.ins_h,r.window[r.strstart+1]);else i=ri(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(i&&(Nt(r,!1),r.strm.avail_out===0))return gt}return r.insert=r.strstart<se-1?r.strstart:se-1,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?gt:aa},Mn=(r,e)=>{let t,i,n;for(;;){if(r.lookahead<gr){if(Zn(r),r.lookahead<gr&&e===ii)return gt;if(r.lookahead===0)break}if(t=0,r.lookahead>=se&&(r.ins_h=ni(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=se-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-gr&&(r.match_length=mm(r,t),r.match_length<=5&&(r.strategy===t0||r.match_length===se&&r.strstart-r.match_start>4096)&&(r.match_length=se-1)),r.prev_length>=se&&r.match_length<=r.prev_length){n=r.strstart+r.lookahead-se,i=ri(r,r.strstart-1-r.prev_match,r.prev_length-se),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=n&&(r.ins_h=ni(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=se-1,r.strstart++,i&&(Nt(r,!1),r.strm.avail_out===0))return gt}else if(r.match_available){if(i=ri(r,0,r.window[r.strstart-1]),i&&Nt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return gt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(i=ri(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<se-1?r.strstart:se-1,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?gt:aa},b0=(r,e)=>{let t,i,n,a,o=r.window;for(;;){if(r.lookahead<=Yr){if(Zn(r),r.lookahead<=Yr&&e===ii)return gt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=se&&r.strstart>0&&(n=r.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=r.strstart+Yr;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);r.match_length=Yr-(a-n),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=se?(t=ri(r,1,r.match_length-se),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=ri(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(Nt(r,!1),r.strm.avail_out===0))return gt}return r.insert=0,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?gt:aa},w0=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Zn(r),r.lookahead===0)){if(e===ii)return gt;break}if(r.match_length=0,t=ri(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(Nt(r,!1),r.strm.avail_out===0))return gt}return r.insert=0,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?gt:aa};function cr(r,e,t,i,n){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=n}var Xa=[new cr(0,0,0,0,gm),new cr(4,4,8,4,sl),new cr(4,5,16,8,sl),new cr(4,6,32,32,sl),new cr(4,4,16,16,Mn),new cr(8,16,32,32,Mn),new cr(8,16,128,128,Mn),new cr(8,32,128,256,Mn),new cr(32,128,258,1024,Mn),new cr(32,258,258,4096,Mn)],_0=r=>{r.window_size=2*r.w_size,Zr(r.head),r.max_lazy_match=Xa[r.level].max_lazy,r.good_match=Xa[r.level].good_length,r.nice_match=Xa[r.level].nice_length,r.max_chain_length=Xa[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=se-1,r.match_available=0,r.ins_h=0};function S0(){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=Ic,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(d0*2),this.dyn_dtree=new Uint16Array((2*p0+1)*2),this.bl_tree=new Uint16Array((2*f0+1)*2),Zr(this.dyn_ltree),Zr(this.dyn_dtree),Zr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(h0+1),this.heap=new Uint16Array(2*Dl+1),Zr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Dl+1),Zr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Ao=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Jn&&e.status!==Yl&&e.status!==$l&&e.status!==Rl&&e.status!==Pl&&e.status!==Ll&&e.status!==ji&&e.status!==Ya?1:0},ym=r=>{if(Ao(r))return Ui(r,mr);r.total_in=r.total_out=0,r.data_type=a0;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Yl:e.wrap?Jn:ji,r.adler=e.wrap===2?0:1,e.last_flush=-2,Hb(e),tt},vm=r=>{let e=ym(r);return e===tt&&_0(r.state),e},E0=(r,e)=>Ao(r)||r.state.wrap!==2?mr:(r.state.gzhead=e,tt),bm=(r,e,t,i,n,a)=>{if(!r)return mr;let o=1;if(e===e0&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>o0||t!==Ic||i<8||i>15||e<0||e>9||a<0||a>i0||i===8&&o!==1)return Ui(r,mr);i===8&&(i=9);let s=new S0;return r.state=s,s.strm=r,s.status=Jn,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+se-1)/se),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,vm(r)},x0=(r,e)=>bm(r,e,Ic,s0,c0,n0),A0=(r,e)=>{if(Ao(r)||e>qd||e<0)return r?Ui(r,mr):mr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Ya&&e!==Qt)return Ui(r,r.avail_out===0?ol:mr);let i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ot(r),r.avail_out===0)return t.last_flush=-1,tt}else if(r.avail_in===0&&Vd(e)<=Vd(i)&&e!==Qt)return Ui(r,ol);if(t.status===Ya&&r.avail_in!==0)return Ui(r,ol);if(t.status===Jn&&t.wrap===0&&(t.status=ji),t.status===Jn){let n=Ic+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Cs||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=m0),n+=31-n%31,Fa(t,n),t.strstart!==0&&(Fa(t,r.adler>>>16),Fa(t,r.adler&65535)),r.adler=1,t.status=ji,Ot(r),t.pending!==0)return t.last_flush=-1,tt}if(t.status===Yl){if(r.adler=0,me(t,31),me(t,139),me(t,8),t.gzhead)me(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),me(t,t.gzhead.time&255),me(t,t.gzhead.time>>8&255),me(t,t.gzhead.time>>16&255),me(t,t.gzhead.time>>24&255),me(t,t.level===9?2:t.strategy>=Cs||t.level<2?4:0),me(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(me(t,t.gzhead.extra.length&255),me(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ge(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=$l;else if(me(t,0),me(t,0),me(t,0),me(t,0),me(t,0),me(t,t.level===9?2:t.strategy>=Cs||t.level<2?4:0),me(t,g0),t.status=ji,Ot(r),t.pending!==0)return t.last_flush=-1,tt}if(t.status===$l){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=s,Ot(r),t.pending!==0)return t.last_flush=-1,tt;n=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Rl}if(t.status===Rl){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),Ot(r),t.pending!==0)return t.last_flush=-1,tt;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,me(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Pl}if(t.status===Pl){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),Ot(r),t.pending!==0)return t.last_flush=-1,tt;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,me(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n))}t.status=Ll}if(t.status===Ll){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ot(r),t.pending!==0))return t.last_flush=-1,tt;me(t,r.adler&255),me(t,r.adler>>8&255),r.adler=0}if(t.status=ji,Ot(r),t.pending!==0)return t.last_flush=-1,tt}if(r.avail_in!==0||t.lookahead!==0||e!==ii&&t.status!==Ya){let n=t.level===0?gm(t,e):t.strategy===Cs?w0(t,e):t.strategy===r0?b0(t,e):Xa[t.level].func(t,e);if((n===Ji||n===oa)&&(t.status=Ya),n===gt||n===Ji)return r.avail_out===0&&(t.last_flush=-1),tt;if(n===aa&&(e===Zb?Jb(t):e!==qd&&(Nl(t,0,0,!1),e===Yb&&(Zr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ot(r),r.avail_out===0))return t.last_flush=-1,tt}return e!==Qt?tt:t.wrap<=0?Bd:(t.wrap===2?(me(t,r.adler&255),me(t,r.adler>>8&255),me(t,r.adler>>16&255),me(t,r.adler>>24&255),me(t,r.total_in&255),me(t,r.total_in>>8&255),me(t,r.total_in>>16&255),me(t,r.total_in>>24&255)):(Fa(t,r.adler>>>16),Fa(t,r.adler&65535)),Ot(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?tt:Bd)},I0=r=>{if(Ao(r))return mr;let e=r.state.status;return r.state=null,e===ji?Ui(r,Xb):tt},T0=(r,e)=>{let t=e.length;if(Ao(r))return mr;let i=r.state,n=i.wrap;if(n===2||n===1&&i.status!==Jn||i.lookahead)return mr;if(n===1&&(r.adler=go(r.adler,e,t,0)),i.wrap=0,t>=i.w_size){n===0&&(Zr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(t-i.w_size,t),0),e=c,t=i.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,Zn(i);i.lookahead>=se;){let c=i.strstart,u=i.lookahead-(se-1);do i.ins_h=ni(i,i.ins_h,i.window[c+se-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--u);i.strstart=c,i.lookahead=se-1,Zn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=se-1,i.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,i.wrap=n,tt},k0=x0,O0=bm,C0=vm,N0=ym,D0=E0,$0=A0,R0=I0,P0=T0,L0="pako deflate (from Nodeca project)",ao={deflateInit:k0,deflateInit2:O0,deflateReset:C0,deflateResetKeep:N0,deflateSetHeader:D0,deflate:$0,deflateEnd:R0,deflateSetDictionary:P0,deflateInfo:L0},F0=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),M0=function(r){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)F0(t,i)&&(r[i]=t[i])}}return r},j0=r=>{let e=0;for(let i=0,n=r.length;i<n;i++)e+=r[i].length;let t=new Uint8Array(e);for(let i=0,n=0,a=r.length;i<a;i++){let o=r[i];t.set(o,n),n+=o.length}return t},Tc={assign:M0,flattenChunks:j0},wm=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){wm=!1}var yo=new Uint8Array(256);for(let r=0;r<256;r++)yo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;yo[254]=yo[254]=1;var U0=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,i,n,a,o=r.length,s=0;for(n=0;n<o;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},q0=(r,e)=>{if(e<65534&&r.subarray&&wm)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(r[i]);return t},B0=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let i,n,a=new Array(t*2);for(n=0,i=0;i<t;){let o=r[i++];if(o<128){a[n++]=o;continue}let s=yo[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<t;)o=o<<6|r[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return q0(a,n)},V0=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+yo[r[t]]>e?t:e},vo={string2buf:U0,buf2string:B0,utf8border:V0};function Q0(){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 _m=Q0,Sm=Object.prototype.toString,{Z_NO_FLUSH:z0,Z_SYNC_FLUSH:W0,Z_FULL_FLUSH:G0,Z_FINISH:H0,Z_OK:hc,Z_STREAM_END:K0,Z_DEFAULT_COMPRESSION:J0,Z_DEFAULT_STRATEGY:Z0,Z_DEFLATED:Y0}=an;function Io(r){this.options=Tc.assign({level:J0,method:Y0,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z0},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _m,this.strm.avail_out=0;let t=ao.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==hc)throw new Error(Ki[t]);if(e.header&&ao.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=vo.string2buf(e.dictionary):Sm.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=ao.deflateSetDictionary(this.strm,i),t!==hc)throw new Error(Ki[t]);this._dict_set=!0}}Io.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?H0:z0,typeof r=="string"?t.input=vo.string2buf(r):Sm.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===W0||a===G0)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=ao.deflate(t,a),n===K0)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=ao.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===hc;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Io.prototype.onData=function(r){this.chunks.push(r)};Io.prototype.onEnd=function(r){r===hc&&(this.result=Tc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Xl(r,e){let t=new Io(e);if(t.push(r,!0),t.err)throw t.msg||Ki[t.err];return t.result}function X0(r,e){return e=e||{},e.raw=!0,Xl(r,e)}function ew(r,e){return e=e||{},e.gzip=!0,Xl(r,e)}var tw=Io,rw=Xl,iw=X0,nw=ew,aw=an,ow={Deflate:tw,deflate:rw,deflateRaw:iw,gzip:nw,constants:aw},Ns=16209,sw=16191,cw=function r(e,t){let i,n,a,o,s,c,u,l,d,f,p,h,m,y,w,_,S,b,k,$,E,D,P,R,M=e.state;i=e.next_in,P=e.input,n=i+(e.avail_in-5),a=e.next_out,R=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=M.dmax,u=M.wsize,l=M.whave,d=M.wnext,f=M.window,p=M.hold,h=M.bits,m=M.lencode,y=M.distcode,w=(1<<M.lenbits)-1,_=(1<<M.distbits)-1;e:do{h<15&&(p+=P[i++]<<h,h+=8,p+=P[i++]<<h,h+=8),S=m[p&w];t:for(;;){if(b=S>>>24,p>>>=b,h-=b,b=S>>>16&255,b===0)R[a++]=S&65535;else if(b&16){k=S&65535,b&=15,b&&(h<b&&(p+=P[i++]<<h,h+=8),k+=p&(1<<b)-1,p>>>=b,h-=b),h<15&&(p+=P[i++]<<h,h+=8,p+=P[i++]<<h,h+=8),S=y[p&_];r:for(;;){if(b=S>>>24,p>>>=b,h-=b,b=S>>>16&255,b&16){if($=S&65535,b&=15,h<b&&(p+=P[i++]<<h,h+=8,h<b&&(p+=P[i++]<<h,h+=8)),$+=p&(1<<b)-1,$>c){e.msg="invalid distance too far back",M.mode=Ns;break e}if(p>>>=b,h-=b,b=a-o,$>b){if(b=$-b,b>l&&M.sane){e.msg="invalid distance too far back",M.mode=Ns;break e}if(E=0,D=f,d===0){if(E+=u-b,b<k){k-=b;do R[a++]=f[E++];while(--b);E=a-$,D=R}}else if(d<b){if(E+=u+d-b,b-=d,b<k){k-=b;do R[a++]=f[E++];while(--b);if(E=0,d<k){b=d,k-=b;do R[a++]=f[E++];while(--b);E=a-$,D=R}}}else if(E+=d-b,b<k){k-=b;do R[a++]=f[E++];while(--b);E=a-$,D=R}for(;k>2;)R[a++]=D[E++],R[a++]=D[E++],R[a++]=D[E++],k-=3;k&&(R[a++]=D[E++],k>1&&(R[a++]=D[E++]))}else{E=a-$;do R[a++]=R[E++],R[a++]=R[E++],R[a++]=R[E++],k-=3;while(k>2);k&&(R[a++]=R[E++],k>1&&(R[a++]=R[E++]))}}else if((b&64)===0){S=y[(S&65535)+(p&(1<<b)-1)];continue r}else{e.msg="invalid distance code",M.mode=Ns;break e}break}}else if((b&64)===0){S=m[(S&65535)+(p&(1<<b)-1)];continue t}else if(b&32){M.mode=sw;break e}else{e.msg="invalid literal/length code",M.mode=Ns;break e}break}}while(i<n&&a<s);k=h>>3,i-=k,h-=k<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),M.hold=p,M.bits=h},jn=15,Qd=852,zd=592,Wd=0,cl=1,Gd=2,uw=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]),lw=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]),pw=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]),fw=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]),dw=(r,e,t,i,n,a,o,s)=>{let c=s.bits,u=0,l=0,d=0,f=0,p=0,h=0,m=0,y=0,w=0,_=0,S,b,k,$,E,D=null,P,R=new Uint16Array(jn+1),M=new Uint16Array(jn+1),Ae=null,oe,j,we;for(u=0;u<=jn;u++)R[u]=0;for(l=0;l<i;l++)R[e[t+l]]++;for(p=c,f=jn;f>=1&&R[f]===0;f--);if(p>f&&(p=f),f===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&R[d]===0;d++);for(p<d&&(p=d),y=1,u=1;u<=jn;u++)if(y<<=1,y-=R[u],y<0)return-1;if(y>0&&(r===Wd||f!==1))return-1;for(M[1]=0,u=1;u<jn;u++)M[u+1]=M[u]+R[u];for(l=0;l<i;l++)e[t+l]!==0&&(o[M[e[t+l]]++]=l);if(r===Wd?(D=Ae=o,P=20):r===cl?(D=uw,Ae=lw,P=257):(D=pw,Ae=fw,P=0),_=0,l=0,u=d,E=a,h=p,m=0,k=-1,w=1<<p,$=w-1,r===cl&&w>Qd||r===Gd&&w>zd)return 1;for(;;){oe=u-m,o[l]+1<P?(j=0,we=o[l]):o[l]>=P?(j=Ae[o[l]-P],we=D[o[l]-P]):(j=32+64,we=0),S=1<<u-m,b=1<<h,d=b;do b-=S,n[E+(_>>m)+b]=oe<<24|j<<16|we|0;while(b!==0);for(S=1<<u-1;_&S;)S>>=1;if(S!==0?(_&=S-1,_+=S):_=0,l++,--R[u]===0){if(u===f)break;u=e[t+o[l]]}if(u>p&&(_&$)!==k){for(m===0&&(m=p),E+=d,h=u-m,y=1<<h;h+m<f&&(y-=R[h+m],!(y<=0));)h++,y<<=1;if(w+=1<<h,r===cl&&w>Qd||r===Gd&&w>zd)return 1;k=_&$,n[k]=p<<24|h<<16|E-a|0}}return _!==0&&(n[E+_]=u-m<<24|64<<16|0),s.bits=p,0},oo=dw,hw=0,Em=1,xm=2,{Z_FINISH:Hd,Z_BLOCK:mw,Z_TREES:Ds,Z_OK:Zi,Z_STREAM_END:gw,Z_NEED_DICT:yw,Z_STREAM_ERROR:zt,Z_DATA_ERROR:Am,Z_MEM_ERROR:Im,Z_BUF_ERROR:vw,Z_DEFLATED:Kd}=an,kc=16180,Jd=16181,Zd=16182,Yd=16183,Xd=16184,eh=16185,th=16186,rh=16187,ih=16188,nh=16189,mc=16190,Ir=16191,ul=16192,ah=16193,ll=16194,oh=16195,sh=16196,ch=16197,uh=16198,$s=16199,Rs=16200,lh=16201,ph=16202,fh=16203,dh=16204,hh=16205,pl=16206,mh=16207,gh=16208,Te=16209,Tm=16210,km=16211,bw=852,ww=592,_w=15,Sw=_w,yh=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Ew(){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 on=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<kc||e.mode>km?1:0},Om=r=>{if(on(r))return zt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=kc,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(bw),e.distcode=e.distdyn=new Int32Array(ww),e.sane=1,e.back=-1,Zi},Cm=r=>{if(on(r))return zt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Om(r)},Nm=(r,e)=>{let t;if(on(r))return zt;let i=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?zt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,Cm(r))},Dm=(r,e)=>{if(!r)return zt;let t=new Ew;r.state=t,t.strm=r,t.window=null,t.mode=kc;let i=Nm(r,e);return i!==Zi&&(r.state=null),i},xw=r=>Dm(r,Sw),vh=!0,fl,dl,Aw=r=>{if(vh){fl=new Int32Array(512),dl=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(oo(Em,r.lens,0,288,fl,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;oo(xm,r.lens,0,32,dl,0,r.work,{bits:5}),vh=!1}r.lencode=fl,r.lenbits=9,r.distcode=dl,r.distbits=5},$m=(r,e,t,i)=>{let n,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),a.window.set(e.subarray(t-i,t-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},Iw=(r,e)=>{let t,i,n,a,o,s,c,u,l,d,f,p,h,m,y=0,w,_,S,b,k,$,E,D,P=new Uint8Array(4),R,M,Ae=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(on(r)||!r.output||!r.input&&r.avail_in!==0)return zt;t=r.state,t.mode===Ir&&(t.mode=ul),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,u=t.hold,l=t.bits,d=s,f=c,D=Zi;e:for(;;)switch(t.mode){case kc:if(t.wrap===0){t.mode=ul;break}for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&2&&u===35615){t.wbits===0&&(t.wbits=15),t.check=0,P[0]=u&255,P[1]=u>>>8&255,t.check=Ge(t.check,P,2,0),u=0,l=0,t.mode=Jd;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((u&255)<<8)+(u>>8))%31){r.msg="incorrect header check",t.mode=Te;break}if((u&15)!==Kd){r.msg="unknown compression method",t.mode=Te;break}if(u>>>=4,l-=4,E=(u&15)+8,t.wbits===0&&(t.wbits=E),E>15||E>t.wbits){r.msg="invalid window size",t.mode=Te;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=u&512?nh:Ir,u=0,l=0;break;case Jd:for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==Kd){r.msg="unknown compression method",t.mode=Te;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=Te;break}t.head&&(t.head.text=u>>8&1),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,t.check=Ge(t.check,P,2,0)),u=0,l=0,t.mode=Zd;case Zd:for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.head&&(t.head.time=u),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,P[2]=u>>>16&255,P[3]=u>>>24&255,t.check=Ge(t.check,P,4,0)),u=0,l=0,t.mode=Yd;case Yd:for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,t.check=Ge(t.check,P,2,0)),u=0,l=0,t.mode=Xd;case Xd:if(t.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,t.check=Ge(t.check,P,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=eh;case eh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(E=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+p),E)),t.flags&512&&t.wrap&4&&(t.check=Ge(t.check,i,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=th;case th:if(t.flags&2048){if(s===0)break e;p=0;do E=i[a+p++],t.head&&E&&t.length<65536&&(t.head.name+=String.fromCharCode(E));while(E&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ge(t.check,i,p,a)),s-=p,a+=p,E)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=rh;case rh:if(t.flags&4096){if(s===0)break e;p=0;do E=i[a+p++],t.head&&E&&t.length<65536&&(t.head.comment+=String.fromCharCode(E));while(E&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ge(t.check,i,p,a)),s-=p,a+=p,E)break e}else t.head&&(t.head.comment=null);t.mode=ih;case ih:if(t.flags&512){for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.check&65535)){r.msg="header crc mismatch",t.mode=Te;break}u=0,l=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=Ir;break;case nh:for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}r.adler=t.check=yh(u),u=0,l=0,t.mode=mc;case mc:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,yw;r.adler=t.check=1,t.mode=Ir;case Ir:if(e===mw||e===Ds)break e;case ul:if(t.last){u>>>=l&7,l-=l&7,t.mode=pl;break}for(;l<3;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}switch(t.last=u&1,u>>>=1,l-=1,u&3){case 0:t.mode=ah;break;case 1:if(Aw(t),t.mode=$s,e===Ds){u>>>=2,l-=2;break e}break;case 2:t.mode=sh;break;case 3:r.msg="invalid block type",t.mode=Te}u>>>=2,l-=2;break;case ah:for(u>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if((u&65535)!==(u>>>16^65535)){r.msg="invalid stored block lengths",t.mode=Te;break}if(t.length=u&65535,u=0,l=0,t.mode=ll,e===Ds)break e;case ll:t.mode=oh;case oh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=Ir;break;case sh:for(;l<14;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.nlen=(u&31)+257,u>>>=5,l-=5,t.ndist=(u&31)+1,u>>>=5,l-=5,t.ncode=(u&15)+4,u>>>=4,l-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=Te;break}t.have=0,t.mode=ch;case ch:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.lens[Ae[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[Ae[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,R={bits:t.lenbits},D=oo(hw,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,D){r.msg="invalid code lengths set",t.mode=Te;break}t.have=0,t.mode=uh;case uh:for(;t.have<t.nlen+t.ndist;){for(;y=t.lencode[u&(1<<t.lenbits)-1],w=y>>>24,_=y>>>16&255,S=y&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(S<16)u>>>=w,l-=w,t.lens[t.have++]=S;else{if(S===16){for(M=w+2;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(u>>>=w,l-=w,t.have===0){r.msg="invalid bit length repeat",t.mode=Te;break}E=t.lens[t.have-1],p=3+(u&3),u>>>=2,l-=2}else if(S===17){for(M=w+3;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=w,l-=w,E=0,p=3+(u&7),u>>>=3,l-=3}else{for(M=w+7;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=w,l-=w,E=0,p=11+(u&127),u>>>=7,l-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Te;break}for(;p--;)t.lens[t.have++]=E}}if(t.mode===Te)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=Te;break}if(t.lenbits=9,R={bits:t.lenbits},D=oo(Em,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,D){r.msg="invalid literal/lengths set",t.mode=Te;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},D=oo(xm,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,D){r.msg="invalid distances set",t.mode=Te;break}if(t.mode=$s,e===Ds)break e;case $s:t.mode=Rs;case Rs:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,cw(r,f),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===Ir&&(t.back=-1);break}for(t.back=0;y=t.lencode[u&(1<<t.lenbits)-1],w=y>>>24,_=y>>>16&255,S=y&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(_&&(_&240)===0){for(b=w,k=_,$=S;y=t.lencode[$+((u&(1<<b+k)-1)>>b)],w=y>>>24,_=y>>>16&255,S=y&65535,!(b+w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=b,l-=b,t.back+=b}if(u>>>=w,l-=w,t.back+=w,t.length=S,_===0){t.mode=hh;break}if(_&32){t.back=-1,t.mode=Ir;break}if(_&64){r.msg="invalid literal/length code",t.mode=Te;break}t.extra=_&15,t.mode=lh;case lh:if(t.extra){for(M=t.extra;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.length+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=ph;case ph:for(;y=t.distcode[u&(1<<t.distbits)-1],w=y>>>24,_=y>>>16&255,S=y&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if((_&240)===0){for(b=w,k=_,$=S;y=t.distcode[$+((u&(1<<b+k)-1)>>b)],w=y>>>24,_=y>>>16&255,S=y&65535,!(b+w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=b,l-=b,t.back+=b}if(u>>>=w,l-=w,t.back+=w,_&64){r.msg="invalid distance code",t.mode=Te;break}t.offset=S,t.extra=_&15,t.mode=fh;case fh:if(t.extra){for(M=t.extra;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.offset+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=Te;break}t.mode=dh;case dh:if(c===0)break e;if(p=f-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Te;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=n,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do n[o++]=m[h++];while(--p);t.length===0&&(t.mode=Rs);break;case hh:if(c===0)break e;n[o++]=t.length,c--,t.mode=Rs;break;case pl:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=i[a++]<<l,l+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ge(t.check,n,f,o-f):go(t.check,n,f,o-f)),f=c,t.wrap&4&&(t.flags?u:yh(u))!==t.check){r.msg="incorrect data check",t.mode=Te;break}u=0,l=0}t.mode=mh;case mh:if(t.wrap&&t.flags){for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=Te;break}u=0,l=0}t.mode=gh;case gh:D=gw;break e;case Te:D=Am;break e;case Tm:return Im;case km:default:return zt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,(t.wsize||f!==r.avail_out&&t.mode<Te&&(t.mode<pl||e!==Hd))&&$m(r,r.output,r.next_out,f-r.avail_out),d-=r.avail_in,f-=r.avail_out,r.total_in+=d,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Ge(t.check,n,f,r.next_out-f):go(t.check,n,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Ir?128:0)+(t.mode===$s||t.mode===ll?256:0),(d===0&&f===0||e===Hd)&&D===Zi&&(D=vw),D},Tw=r=>{if(on(r))return zt;let e=r.state;return e.window&&(e.window=null),r.state=null,Zi},kw=(r,e)=>{if(on(r))return zt;let t=r.state;return(t.wrap&2)===0?zt:(t.head=e,e.done=!1,Zi)},Ow=(r,e)=>{let t=e.length,i,n,a;return on(r)||(i=r.state,i.wrap!==0&&i.mode!==mc)?zt:i.mode===mc&&(n=1,n=go(n,e,t,0),n!==i.check)?Am:(a=$m(r,e,t,t),a?(i.mode=Tm,Im):(i.havedict=1,Zi))},Cw=Cm,Nw=Nm,Dw=Om,$w=xw,Rw=Dm,Pw=Iw,Lw=Tw,Fw=kw,Mw=Ow,jw="pako inflate (from Nodeca project)",Nr={inflateReset:Cw,inflateReset2:Nw,inflateResetKeep:Dw,inflateInit:$w,inflateInit2:Rw,inflate:Pw,inflateEnd:Lw,inflateGetHeader:Fw,inflateSetDictionary:Mw,inflateInfo:jw};function Uw(){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 qw=Uw,Rm=Object.prototype.toString,{Z_NO_FLUSH:Bw,Z_FINISH:Vw,Z_OK:bo,Z_STREAM_END:hl,Z_NEED_DICT:ml,Z_STREAM_ERROR:Qw,Z_DATA_ERROR:bh,Z_MEM_ERROR:zw}=an;function To(r){this.options=Tc.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _m,this.strm.avail_out=0;let t=Nr.inflateInit2(this.strm,e.windowBits);if(t!==bo)throw new Error(Ki[t]);if(this.header=new qw,Nr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=vo.string2buf(e.dictionary):Rm.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Nr.inflateSetDictionary(this.strm,e.dictionary),t!==bo)))throw new Error(Ki[t])}To.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?Vw:Bw,Rm.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=Nr.inflate(t,o),a===ml&&n&&(a=Nr.inflateSetDictionary(t,n),a===bo?a=Nr.inflate(t,o):a===bh&&(a=ml));t.avail_in>0&&a===hl&&t.state.wrap>0&&r[t.next_in]!==0;)Nr.inflateReset(t),a=Nr.inflate(t,o);switch(a){case Qw:case bh:case ml:case zw:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===hl))if(this.options.to==="string"){let c=vo.utf8border(t.output,t.next_out),u=t.next_out-c,l=vo.buf2string(t.output,c);t.next_out=u,t.avail_out=i-u,u&&t.output.set(t.output.subarray(c,c+u),0),this.onData(l)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===bo&&s===0)){if(a===hl)return a=Nr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};To.prototype.onData=function(r){this.chunks.push(r)};To.prototype.onEnd=function(r){r===bo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Tc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ep(r,e){let t=new To(e);if(t.push(r),t.err)throw t.msg||Ki[t.err];return t.result}function Ww(r,e){return e=e||{},e.raw=!0,ep(r,e)}var Gw=To,Hw=ep,Kw=Ww,Jw=ep,Zw=an,Yw={Inflate:Gw,inflate:Hw,inflateRaw:Kw,ungzip:Jw,constants:Zw},{Deflate:Xw,deflate:e_,deflateRaw:t_,gzip:r_}=ow,{Inflate:i_,inflate:n_,inflateRaw:a_,ungzip:o_}=Yw,s_=Xw,c_=e_,u_=t_,l_=r_,p_=i_,f_=n_,d_=a_,h_=o_,m_=an,g_={Deflate:s_,deflate:c_,deflateRaw:u_,gzip:l_,Inflate:p_,inflate:f_,inflateRaw:d_,ungzip:h_,constants:m_},Se=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ee=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},gc=class{constructor(e,t){this.input=e,this.output=t}};Se([g(),Ee("design:type",String)],gc.prototype,"input",void 0);Se([g(),Ee("design:type",String)],gc.prototype,"output",void 0);gc=Se([Ke(),Ee("design:paramtypes",[String,String])],gc);var yc=class{constructor(e,t){this.input=e,this.output=t}};Se([g(),Ee("design:type",String)],yc.prototype,"input",void 0);Se([g(),Ee("design:type",String)],yc.prototype,"output",void 0);yc=Se([H(),Ee("design:paramtypes",[String,String])],yc);var ci=class{constructor(e,t,i,n,a){this.name=e,this.modelId=t,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};Se([g(),Ee("design:type",String)],ci.prototype,"name",void 0);Se([g(),Ee("design:type",String)],ci.prototype,"modelId",void 0);Se([g(),Ee("design:type",String)],ci.prototype,"systemPrompt",void 0);Se([g(),Ee("design:type",Array)],ci.prototype,"promptExamples",void 0);Se([g(),Ee("design:type",String)],ci.prototype,"metaData",void 0);ci=Se([Ke(),Ee("design:paramtypes",[String,String,String,Array,String])],ci);var br=class{constructor(e,t,i,n,a,o,s,c){this.name=e,this.modelId=t,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};Se([g(),Ee("design:type",String)],br.prototype,"name",void 0);Se([g(),Ee("design:type",String)],br.prototype,"modelId",void 0);Se([g(),Ee("design:type",String)],br.prototype,"taskId",void 0);Se([g(),Ee("design:type",String)],br.prototype,"systemPrompt",void 0);Se([g(),Ee("design:type",Array)],br.prototype,"promptExamples",void 0);Se([g(),Ee("design:type",String)],br.prototype,"metaData",void 0);Se([g(),Ee("design:type",String)],br.prototype,"createdAt",void 0);Se([g(),Ee("design:type",String)],br.prototype,"updatedAt",void 0);br=Se([H(),Ee("design:paramtypes",[String,String,String,String,Array,String,String,String])],br);var Yi=class{constructor(e,t,i,n,a){this.model=e,this.status=t,this.progress=i,this.downloaded=n,this.loaded=a}};Se([g(),Ee("design:type",String)],Yi.prototype,"model",void 0);Se([g(),Ee("design:type",String)],Yi.prototype,"status",void 0);Se([g(),Ee("design:type",Number)],Yi.prototype,"progress",void 0);Se([g(),Ee("design:type",Boolean)],Yi.prototype,"downloaded",void 0);Se([g(),Ee("design:type",Boolean)],Yi.prototype,"loaded",void 0);Yi=Se([H(),Ee("design:paramtypes",[String,String,Number,Boolean,Boolean])],Yi);var y_=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ze=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ve,Hs,Ml=class{constructor(e,t=!0){Ve.set(this,void 0),Hs.set(this,new Map),y_(this,Ve,e,"f")}async getModels(){let e=await ze(this,Ve,"f").query({query:I`
|
|
742
|
+
}`,variables:{url:e,interactionCall:t}}));return i}};Or=new WeakMap;var Ac={};Ac.byteLength=db;Ac.toByteArray=mb;Ac.fromByteArray=vb;var fr=[],Bt=[],fb=typeof Uint8Array<"u"?Uint8Array:Array,tl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ti=0,$d=tl.length;Ti<$d;++Ti)fr[Ti]=tl[Ti],Bt[tl.charCodeAt(Ti)]=Ti;var Ti,$d;Bt["-".charCodeAt(0)]=62;Bt["_".charCodeAt(0)]=63;function Xh(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function db(r){var e=Xh(r),t=e[0],i=e[1];return(t+i)*3/4-i}function hb(r,e,t){return(e+t)*3/4-t}function mb(r){var e,t=Xh(r),i=t[0],n=t[1],a=new fb(hb(r,i,n)),o=0,s=n>0?i-4:i,c;for(c=0;c<s;c+=4)e=Bt[r.charCodeAt(c)]<<18|Bt[r.charCodeAt(c+1)]<<12|Bt[r.charCodeAt(c+2)]<<6|Bt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Bt[r.charCodeAt(c)]<<2|Bt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),n===1&&(e=Bt[r.charCodeAt(c)]<<10|Bt[r.charCodeAt(c+1)]<<4|Bt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function gb(r){return fr[r>>18&63]+fr[r>>12&63]+fr[r>>6&63]+fr[r&63]}function yb(r,e,t){for(var i,n=[],a=e;a<t;a+=3)i=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),n.push(gb(i));return n.join("")}function vb(r){for(var e,t=r.length,i=t%3,n=[],a=16383,o=0,s=t-i;o<s;o+=a)n.push(yb(r,o,o+a>s?s:o+a));return i===1?(e=r[t-1],n.push(fr[e>>2]+fr[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(fr[e>>10]+fr[e>>4&63]+fr[e<<2&63]+"=")),n.join("")}var bb=4,Rd=0,Pd=1,wb=2;function na(r){let e=r.length;for(;--e>=0;)r[e]=0}var _b=0,em=1,Sb=2,Eb=3,xb=258,Gl=29,xo=256,po=xo+1+Gl,Wn=30,Kl=19,tm=2*po+1,Mi=15,rl=16,Ab=7,Jl=256,rm=16,im=17,nm=18,Ol=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]),Hs=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]),Ib=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),am=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Tb=512,Cr=new Array((po+2)*2);na(Cr);var no=new Array(Wn*2);na(no);var fo=new Array(Tb);na(fo);var ho=new Array(xb-Eb+1);na(ho);var Zl=new Array(Gl);na(Zl);var dc=new Array(Wn);na(dc);function il(r,e,t,i,n){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=n,this.has_stree=r&&r.length}var om,sm,cm;function nl(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var um=r=>r<256?fo[r]:fo[256+(r>>>7)],mo=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},xt=(r,e,t)=>{r.bi_valid>rl-t?(r.bi_buf|=e<<r.bi_valid&65535,mo(r,r.bi_buf),r.bi_buf=e>>rl-r.bi_valid,r.bi_valid+=t-rl):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},dr=(r,e,t)=>{xt(r,t[e*2],t[e*2+1])},lm=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},kb=r=>{r.bi_valid===16?(mo(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},Ob=(r,e)=>{let t=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,d,f,p,h,m=0;for(f=0;f<=Mi;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<tm;u++)l=r.heap[u],f=t[t[l*2+1]*2+1]+1,f>c&&(f=c,m++),t[l*2+1]=f,!(l>i)&&(r.bl_count[f]++,p=0,l>=s&&(p=o[l-s]),h=t[l*2],r.opt_len+=h*(f+p),a&&(r.static_len+=h*(n[l*2+1]+p)));if(m!==0){do{for(f=c-1;r.bl_count[f]===0;)f--;r.bl_count[f]--,r.bl_count[f+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(f=c;f!==0;f--)for(l=r.bl_count[f];l!==0;)d=r.heap[--u],!(d>i)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),l--)}},pm=(r,e,t)=>{let i=new Array(Mi+1),n=0,a,o;for(a=1;a<=Mi;a++)n=n+t[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=lm(i[s]++,s))}},Cb=()=>{let r,e,t,i,n,a=new Array(Mi+1);for(t=0,i=0;i<Gl-1;i++)for(Zl[i]=t,r=0;r<1<<Ol[i];r++)ho[t++]=i;for(ho[t-1]=i,n=0,i=0;i<16;i++)for(dc[i]=n,r=0;r<1<<Hs[i];r++)fo[n++]=i;for(n>>=7;i<Wn;i++)for(dc[i]=n<<7,r=0;r<1<<Hs[i]-7;r++)fo[256+n++]=i;for(e=0;e<=Mi;e++)a[e]=0;for(r=0;r<=143;)Cr[r*2+1]=8,r++,a[8]++;for(;r<=255;)Cr[r*2+1]=9,r++,a[9]++;for(;r<=279;)Cr[r*2+1]=7,r++,a[7]++;for(;r<=287;)Cr[r*2+1]=8,r++,a[8]++;for(pm(Cr,po+1,a),r=0;r<Wn;r++)no[r*2+1]=5,no[r*2]=lm(r,5);om=new il(Cr,Ol,xo+1,po,Mi),sm=new il(no,Hs,0,Wn,Mi),cm=new il(new Array(0),Ib,0,Kl,Ab)},fm=r=>{let e;for(e=0;e<po;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Wn;e++)r.dyn_dtree[e*2]=0;for(e=0;e<Kl;e++)r.bl_tree[e*2]=0;r.dyn_ltree[Jl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},dm=r=>{r.bi_valid>8?mo(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Ld=(r,e,t,i)=>{let n=e*2,a=t*2;return r[n]<r[a]||r[n]===r[a]&&i[e]<=i[t]},al=(r,e,t)=>{let i=r.heap[t],n=t<<1;for(;n<=r.heap_len&&(n<r.heap_len&&Ld(e,r.heap[n+1],r.heap[n],r.depth)&&n++,!Ld(e,i,r.heap[n],r.depth));)r.heap[t]=r.heap[n],t=n,n<<=1;r.heap[t]=i},Fd=(r,e,t)=>{let i,n,a=0,o,s;if(r.sym_next!==0)do i=r.pending_buf[r.sym_buf+a++]&255,i+=(r.pending_buf[r.sym_buf+a++]&255)<<8,n=r.pending_buf[r.sym_buf+a++],i===0?dr(r,n,e):(o=ho[n],dr(r,o+xo+1,e),s=Ol[o],s!==0&&(n-=Zl[o],xt(r,n,s)),i--,o=um(i),dr(r,o,t),s=Hs[o],s!==0&&(i-=dc[o],xt(r,i,s)));while(a<r.sym_next);dr(r,Jl,e)},Cl=(r,e)=>{let t=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,u;for(r.heap_len=0,r.heap_max=tm,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)u=r.heap[++r.heap_len]=c<2?++c:0,t[u*2]=1,r.depth[u]=0,r.opt_len--,n&&(r.static_len-=i[u*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)al(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],al(r,t,1),s=r.heap[1],r.heap[--r.heap_max]=o,r.heap[--r.heap_max]=s,t[u*2]=t[o*2]+t[s*2],r.depth[u]=(r.depth[o]>=r.depth[s]?r.depth[o]:r.depth[s])+1,t[o*2+1]=t[s*2+1]=u,r.heap[1]=u++,al(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],Ob(r,e),pm(t,c,r.bl_count)},Md=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)&&(s<u?r.bl_tree[a*2]+=s:a!==0?(a!==n&&r.bl_tree[a*2]++,r.bl_tree[rm*2]++):s<=10?r.bl_tree[im*2]++:r.bl_tree[nm*2]++,s=0,n=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},jd=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),i=0;i<=t;i++)if(a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)){if(s<u)do dr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==n&&(dr(r,a,r.bl_tree),s--),dr(r,rm,r.bl_tree),xt(r,s-3,2)):s<=10?(dr(r,im,r.bl_tree),xt(r,s-3,3)):(dr(r,nm,r.bl_tree),xt(r,s-11,7));s=0,n=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Nb=r=>{let e;for(Md(r,r.dyn_ltree,r.l_desc.max_code),Md(r,r.dyn_dtree,r.d_desc.max_code),Cl(r,r.bl_desc),e=Kl-1;e>=3&&r.bl_tree[am[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},Db=(r,e,t,i)=>{let n;for(xt(r,e-257,5),xt(r,t-1,5),xt(r,i-4,4),n=0;n<i;n++)xt(r,r.bl_tree[am[n]*2+1],3);jd(r,r.dyn_ltree,e-1),jd(r,r.dyn_dtree,t-1)},$b=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Rd;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Pd;for(t=32;t<xo;t++)if(r.dyn_ltree[t*2]!==0)return Pd;return Rd},Ud=!1,Rb=r=>{Ud||(Cb(),Ud=!0),r.l_desc=new nl(r.dyn_ltree,om),r.d_desc=new nl(r.dyn_dtree,sm),r.bl_desc=new nl(r.bl_tree,cm),r.bi_buf=0,r.bi_valid=0,fm(r)},hm=(r,e,t,i)=>{xt(r,(_b<<1)+(i?1:0),3),dm(r),mo(r,t),mo(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},Pb=r=>{xt(r,em<<1,3),dr(r,Jl,Cr),kb(r)},Lb=(r,e,t,i)=>{let n,a,o=0;r.level>0?(r.strm.data_type===wb&&(r.strm.data_type=$b(r)),Cl(r,r.l_desc),Cl(r,r.d_desc),o=Nb(r),n=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?hm(r,e,t,i):r.strategy===bb||a===n?(xt(r,(em<<1)+(i?1:0),3),Fd(r,Cr,no)):(xt(r,(Sb<<1)+(i?1:0),3),Db(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Fd(r,r.dyn_ltree,r.dyn_dtree)),fm(r),i&&dm(r)},Fb=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(ho[t]+xo+1)*2]++,r.dyn_dtree[um(e)*2]++),r.sym_next===r.sym_end),Mb=Rb,jb=hm,Ub=Lb,qb=Fb,Bb=Pb,Vb={_tr_init:Mb,_tr_stored_block:jb,_tr_flush_block:Ub,_tr_tally:qb,_tr_align:Bb},Qb=(r,e,t,i)=>{let n=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},go=Qb,zb=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var i=0;i<8;i++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},Wb=new Uint32Array(zb()),Hb=(r,e,t,i)=>{let n=Wb,a=i+t;r^=-1;for(let o=i;o<a;o++)r=r>>>8^n[(r^e[o])&255];return r^-1},He=Hb,Ki={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"},an={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:Gb,_tr_stored_block:Nl,_tr_flush_block:Kb,_tr_tally:ri,_tr_align:Jb}=Vb,{Z_NO_FLUSH:ii,Z_PARTIAL_FLUSH:Zb,Z_FULL_FLUSH:Yb,Z_FINISH:Qt,Z_BLOCK:qd,Z_OK:tt,Z_STREAM_END:Bd,Z_STREAM_ERROR:mr,Z_DATA_ERROR:Xb,Z_BUF_ERROR:ol,Z_DEFAULT_COMPRESSION:e0,Z_FILTERED:t0,Z_HUFFMAN_ONLY:Cs,Z_RLE:r0,Z_FIXED:i0,Z_DEFAULT_STRATEGY:n0,Z_UNKNOWN:a0,Z_DEFLATED:Ic}=an,o0=9,s0=15,c0=8,u0=29,l0=256,Dl=l0+1+u0,p0=30,f0=19,d0=2*Dl+1,h0=15,ce=3,Yr=258,gr=Yr+ce+1,m0=32,Jn=42,Yl=57,$l=69,Rl=73,Pl=91,Ll=103,ji=113,Ya=666,gt=1,aa=2,Ji=3,oa=4,g0=3,Ui=(r,e)=>(r.msg=Ki[e],e),Vd=r=>r*2-(r>4?9:0),Zr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},y0=r=>{let e,t,i,n=r.w_size;e=r.hash_size,i=e;do t=r.head[--i],r.head[i]=t>=n?t-n:0;while(--e);e=n,i=e;do t=r.prev[--i],r.prev[i]=t>=n?t-n:0;while(--e)},v0=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,ni=v0,Ot=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Nt=(r,e)=>{Kb(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,Ot(r.strm)},ge=(r,e)=>{r.pending_buf[r.pending++]=e},Fa=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Fl=(r,e,t,i)=>{let n=r.avail_in;return n>i&&(n=i),n===0?0:(r.avail_in-=n,e.set(r.input.subarray(r.next_in,r.next_in+n),t),r.state.wrap===1?r.adler=go(r.adler,e,n,t):r.state.wrap===2&&(r.adler=He(r.adler,e,n,t)),r.next_in+=n,r.total_in+=n,n)},mm=(r,e)=>{let t=r.max_chain_length,i=r.strstart,n,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-gr?r.strstart-(r.w_size-gr):0,u=r.window,l=r.w_mask,d=r.prev,f=r.strstart+Yr,p=u[i+o-1],h=u[i+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(n=e,!(u[n+o]!==h||u[n+o-1]!==p||u[n]!==u[i]||u[++n]!==u[i+1])){i+=2,n++;do;while(u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&i<f);if(a=Yr-(f-i),i=f-Yr,a>o){if(r.match_start=e,o=a,a>=s)break;p=u[i+o-1],h=u[i+o]}}while((e=d[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Zn=r=>{let e=r.w_size,t,i,n;do{if(i=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-gr)&&(r.window.set(r.window.subarray(e,e+e-i),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),y0(r),i+=e),r.strm.avail_in===0)break;if(t=Fl(r.strm,r.window,r.strstart+r.lookahead,i),r.lookahead+=t,r.lookahead+r.insert>=ce)for(n=r.strstart-r.insert,r.ins_h=r.window[n],r.ins_h=ni(r,r.ins_h,r.window[n+1]);r.insert&&(r.ins_h=ni(r,r.ins_h,r.window[n+ce-1]),r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,r.insert--,!(r.lookahead+r.insert<ce)););}while(r.lookahead<gr&&r.strm.avail_in!==0)},gm=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,i,n,a,o=0,s=r.strm.avail_in;do{if(i=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,n=r.strstart-r.block_start,i>n+r.strm.avail_in&&(i=n+r.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==Qt||e===ii||i!==n+r.strm.avail_in)))break;o=e===Qt&&i===n+r.strm.avail_in?1:0,Nl(r,0,0,o),r.pending_buf[r.pending-4]=i,r.pending_buf[r.pending-3]=i>>8,r.pending_buf[r.pending-2]=~i,r.pending_buf[r.pending-1]=~i>>8,Ot(r.strm),n&&(n>i&&(n=i),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,i-=n),i&&(Fl(r.strm,r.strm.output,r.strm.next_out,i),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?oa:e!==ii&&e!==Qt&&r.strm.avail_in===0&&r.strstart===r.block_start?aa:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(Fl(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,n=r.strstart-r.block_start,(n>=t||(n||e===Qt)&&e!==ii&&r.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Qt&&r.strm.avail_in===0&&i===n?1:0,Nl(r,r.block_start,i,o),r.block_start+=i,Ot(r.strm)),o?Ji:gt)},sl=(r,e)=>{let t,i;for(;;){if(r.lookahead<gr){if(Zn(r),r.lookahead<gr&&e===ii)return gt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ce&&(r.ins_h=ni(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-gr&&(r.match_length=mm(r,t)),r.match_length>=ce)if(i=ri(r,r.strstart-r.match_start,r.match_length-ce),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ce){r.match_length--;do r.strstart++,r.ins_h=ni(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=ni(r,r.ins_h,r.window[r.strstart+1]);else i=ri(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(i&&(Nt(r,!1),r.strm.avail_out===0))return gt}return r.insert=r.strstart<ce-1?r.strstart:ce-1,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?gt:aa},Mn=(r,e)=>{let t,i,n;for(;;){if(r.lookahead<gr){if(Zn(r),r.lookahead<gr&&e===ii)return gt;if(r.lookahead===0)break}if(t=0,r.lookahead>=ce&&(r.ins_h=ni(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=ce-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-gr&&(r.match_length=mm(r,t),r.match_length<=5&&(r.strategy===t0||r.match_length===ce&&r.strstart-r.match_start>4096)&&(r.match_length=ce-1)),r.prev_length>=ce&&r.match_length<=r.prev_length){n=r.strstart+r.lookahead-ce,i=ri(r,r.strstart-1-r.prev_match,r.prev_length-ce),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=n&&(r.ins_h=ni(r,r.ins_h,r.window[r.strstart+ce-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=ce-1,r.strstart++,i&&(Nt(r,!1),r.strm.avail_out===0))return gt}else if(r.match_available){if(i=ri(r,0,r.window[r.strstart-1]),i&&Nt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return gt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(i=ri(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ce-1?r.strstart:ce-1,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?gt:aa},b0=(r,e)=>{let t,i,n,a,o=r.window;for(;;){if(r.lookahead<=Yr){if(Zn(r),r.lookahead<=Yr&&e===ii)return gt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ce&&r.strstart>0&&(n=r.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=r.strstart+Yr;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);r.match_length=Yr-(a-n),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ce?(t=ri(r,1,r.match_length-ce),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=ri(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(Nt(r,!1),r.strm.avail_out===0))return gt}return r.insert=0,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?gt:aa},w0=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Zn(r),r.lookahead===0)){if(e===ii)return gt;break}if(r.match_length=0,t=ri(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(Nt(r,!1),r.strm.avail_out===0))return gt}return r.insert=0,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?gt:aa};function cr(r,e,t,i,n){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=n}var Xa=[new cr(0,0,0,0,gm),new cr(4,4,8,4,sl),new cr(4,5,16,8,sl),new cr(4,6,32,32,sl),new cr(4,4,16,16,Mn),new cr(8,16,32,32,Mn),new cr(8,16,128,128,Mn),new cr(8,32,128,256,Mn),new cr(32,128,258,1024,Mn),new cr(32,258,258,4096,Mn)],_0=r=>{r.window_size=2*r.w_size,Zr(r.head),r.max_lazy_match=Xa[r.level].max_lazy,r.good_match=Xa[r.level].good_length,r.nice_match=Xa[r.level].nice_length,r.max_chain_length=Xa[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ce-1,r.match_available=0,r.ins_h=0};function S0(){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=Ic,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(d0*2),this.dyn_dtree=new Uint16Array((2*p0+1)*2),this.bl_tree=new Uint16Array((2*f0+1)*2),Zr(this.dyn_ltree),Zr(this.dyn_dtree),Zr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(h0+1),this.heap=new Uint16Array(2*Dl+1),Zr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Dl+1),Zr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Ao=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Jn&&e.status!==Yl&&e.status!==$l&&e.status!==Rl&&e.status!==Pl&&e.status!==Ll&&e.status!==ji&&e.status!==Ya?1:0},ym=r=>{if(Ao(r))return Ui(r,mr);r.total_in=r.total_out=0,r.data_type=a0;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Yl:e.wrap?Jn:ji,r.adler=e.wrap===2?0:1,e.last_flush=-2,Gb(e),tt},vm=r=>{let e=ym(r);return e===tt&&_0(r.state),e},E0=(r,e)=>Ao(r)||r.state.wrap!==2?mr:(r.state.gzhead=e,tt),bm=(r,e,t,i,n,a)=>{if(!r)return mr;let o=1;if(e===e0&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>o0||t!==Ic||i<8||i>15||e<0||e>9||a<0||a>i0||i===8&&o!==1)return Ui(r,mr);i===8&&(i=9);let s=new S0;return r.state=s,s.strm=r,s.status=Jn,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ce-1)/ce),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,vm(r)},x0=(r,e)=>bm(r,e,Ic,s0,c0,n0),A0=(r,e)=>{if(Ao(r)||e>qd||e<0)return r?Ui(r,mr):mr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Ya&&e!==Qt)return Ui(r,r.avail_out===0?ol:mr);let i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ot(r),r.avail_out===0)return t.last_flush=-1,tt}else if(r.avail_in===0&&Vd(e)<=Vd(i)&&e!==Qt)return Ui(r,ol);if(t.status===Ya&&r.avail_in!==0)return Ui(r,ol);if(t.status===Jn&&t.wrap===0&&(t.status=ji),t.status===Jn){let n=Ic+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Cs||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=m0),n+=31-n%31,Fa(t,n),t.strstart!==0&&(Fa(t,r.adler>>>16),Fa(t,r.adler&65535)),r.adler=1,t.status=ji,Ot(r),t.pending!==0)return t.last_flush=-1,tt}if(t.status===Yl){if(r.adler=0,ge(t,31),ge(t,139),ge(t,8),t.gzhead)ge(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),ge(t,t.gzhead.time&255),ge(t,t.gzhead.time>>8&255),ge(t,t.gzhead.time>>16&255),ge(t,t.gzhead.time>>24&255),ge(t,t.level===9?2:t.strategy>=Cs||t.level<2?4:0),ge(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(ge(t,t.gzhead.extra.length&255),ge(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=He(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=$l;else if(ge(t,0),ge(t,0),ge(t,0),ge(t,0),ge(t,0),ge(t,t.level===9?2:t.strategy>=Cs||t.level<2?4:0),ge(t,g0),t.status=ji,Ot(r),t.pending!==0)return t.last_flush=-1,tt}if(t.status===$l){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(r.adler=He(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=s,Ot(r),t.pending!==0)return t.last_flush=-1,tt;n=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(r.adler=He(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Rl}if(t.status===Rl){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=He(r.adler,t.pending_buf,t.pending-n,n)),Ot(r),t.pending!==0)return t.last_flush=-1,tt;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,ge(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=He(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Pl}if(t.status===Pl){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=He(r.adler,t.pending_buf,t.pending-n,n)),Ot(r),t.pending!==0)return t.last_flush=-1,tt;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,ge(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=He(r.adler,t.pending_buf,t.pending-n,n))}t.status=Ll}if(t.status===Ll){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ot(r),t.pending!==0))return t.last_flush=-1,tt;ge(t,r.adler&255),ge(t,r.adler>>8&255),r.adler=0}if(t.status=ji,Ot(r),t.pending!==0)return t.last_flush=-1,tt}if(r.avail_in!==0||t.lookahead!==0||e!==ii&&t.status!==Ya){let n=t.level===0?gm(t,e):t.strategy===Cs?w0(t,e):t.strategy===r0?b0(t,e):Xa[t.level].func(t,e);if((n===Ji||n===oa)&&(t.status=Ya),n===gt||n===Ji)return r.avail_out===0&&(t.last_flush=-1),tt;if(n===aa&&(e===Zb?Jb(t):e!==qd&&(Nl(t,0,0,!1),e===Yb&&(Zr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ot(r),r.avail_out===0))return t.last_flush=-1,tt}return e!==Qt?tt:t.wrap<=0?Bd:(t.wrap===2?(ge(t,r.adler&255),ge(t,r.adler>>8&255),ge(t,r.adler>>16&255),ge(t,r.adler>>24&255),ge(t,r.total_in&255),ge(t,r.total_in>>8&255),ge(t,r.total_in>>16&255),ge(t,r.total_in>>24&255)):(Fa(t,r.adler>>>16),Fa(t,r.adler&65535)),Ot(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?tt:Bd)},I0=r=>{if(Ao(r))return mr;let e=r.state.status;return r.state=null,e===ji?Ui(r,Xb):tt},T0=(r,e)=>{let t=e.length;if(Ao(r))return mr;let i=r.state,n=i.wrap;if(n===2||n===1&&i.status!==Jn||i.lookahead)return mr;if(n===1&&(r.adler=go(r.adler,e,t,0)),i.wrap=0,t>=i.w_size){n===0&&(Zr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(t-i.w_size,t),0),e=c,t=i.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,Zn(i);i.lookahead>=ce;){let c=i.strstart,u=i.lookahead-(ce-1);do i.ins_h=ni(i,i.ins_h,i.window[c+ce-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--u);i.strstart=c,i.lookahead=ce-1,Zn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=ce-1,i.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,i.wrap=n,tt},k0=x0,O0=bm,C0=vm,N0=ym,D0=E0,$0=A0,R0=I0,P0=T0,L0="pako deflate (from Nodeca project)",ao={deflateInit:k0,deflateInit2:O0,deflateReset:C0,deflateResetKeep:N0,deflateSetHeader:D0,deflate:$0,deflateEnd:R0,deflateSetDictionary:P0,deflateInfo:L0},F0=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),M0=function(r){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)F0(t,i)&&(r[i]=t[i])}}return r},j0=r=>{let e=0;for(let i=0,n=r.length;i<n;i++)e+=r[i].length;let t=new Uint8Array(e);for(let i=0,n=0,a=r.length;i<a;i++){let o=r[i];t.set(o,n),n+=o.length}return t},Tc={assign:M0,flattenChunks:j0},wm=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){wm=!1}var yo=new Uint8Array(256);for(let r=0;r<256;r++)yo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;yo[254]=yo[254]=1;var U0=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,i,n,a,o=r.length,s=0;for(n=0;n<o;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},q0=(r,e)=>{if(e<65534&&r.subarray&&wm)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(r[i]);return t},B0=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let i,n,a=new Array(t*2);for(n=0,i=0;i<t;){let o=r[i++];if(o<128){a[n++]=o;continue}let s=yo[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<t;)o=o<<6|r[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return q0(a,n)},V0=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+yo[r[t]]>e?t:e},vo={string2buf:U0,buf2string:B0,utf8border:V0};function Q0(){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 _m=Q0,Sm=Object.prototype.toString,{Z_NO_FLUSH:z0,Z_SYNC_FLUSH:W0,Z_FULL_FLUSH:H0,Z_FINISH:G0,Z_OK:hc,Z_STREAM_END:K0,Z_DEFAULT_COMPRESSION:J0,Z_DEFAULT_STRATEGY:Z0,Z_DEFLATED:Y0}=an;function Io(r){this.options=Tc.assign({level:J0,method:Y0,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z0},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _m,this.strm.avail_out=0;let t=ao.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==hc)throw new Error(Ki[t]);if(e.header&&ao.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=vo.string2buf(e.dictionary):Sm.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=ao.deflateSetDictionary(this.strm,i),t!==hc)throw new Error(Ki[t]);this._dict_set=!0}}Io.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?G0:z0,typeof r=="string"?t.input=vo.string2buf(r):Sm.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===W0||a===H0)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=ao.deflate(t,a),n===K0)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=ao.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===hc;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Io.prototype.onData=function(r){this.chunks.push(r)};Io.prototype.onEnd=function(r){r===hc&&(this.result=Tc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Xl(r,e){let t=new Io(e);if(t.push(r,!0),t.err)throw t.msg||Ki[t.err];return t.result}function X0(r,e){return e=e||{},e.raw=!0,Xl(r,e)}function ew(r,e){return e=e||{},e.gzip=!0,Xl(r,e)}var tw=Io,rw=Xl,iw=X0,nw=ew,aw=an,ow={Deflate:tw,deflate:rw,deflateRaw:iw,gzip:nw,constants:aw},Ns=16209,sw=16191,cw=function r(e,t){let i,n,a,o,s,c,u,l,d,f,p,h,m,g,w,_,S,b,O,D,E,$,P,R,M=e.state;i=e.next_in,P=e.input,n=i+(e.avail_in-5),a=e.next_out,R=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=M.dmax,u=M.wsize,l=M.whave,d=M.wnext,f=M.window,p=M.hold,h=M.bits,m=M.lencode,g=M.distcode,w=(1<<M.lenbits)-1,_=(1<<M.distbits)-1;e:do{h<15&&(p+=P[i++]<<h,h+=8,p+=P[i++]<<h,h+=8),S=m[p&w];t:for(;;){if(b=S>>>24,p>>>=b,h-=b,b=S>>>16&255,b===0)R[a++]=S&65535;else if(b&16){O=S&65535,b&=15,b&&(h<b&&(p+=P[i++]<<h,h+=8),O+=p&(1<<b)-1,p>>>=b,h-=b),h<15&&(p+=P[i++]<<h,h+=8,p+=P[i++]<<h,h+=8),S=g[p&_];r:for(;;){if(b=S>>>24,p>>>=b,h-=b,b=S>>>16&255,b&16){if(D=S&65535,b&=15,h<b&&(p+=P[i++]<<h,h+=8,h<b&&(p+=P[i++]<<h,h+=8)),D+=p&(1<<b)-1,D>c){e.msg="invalid distance too far back",M.mode=Ns;break e}if(p>>>=b,h-=b,b=a-o,D>b){if(b=D-b,b>l&&M.sane){e.msg="invalid distance too far back",M.mode=Ns;break e}if(E=0,$=f,d===0){if(E+=u-b,b<O){O-=b;do R[a++]=f[E++];while(--b);E=a-D,$=R}}else if(d<b){if(E+=u+d-b,b-=d,b<O){O-=b;do R[a++]=f[E++];while(--b);if(E=0,d<O){b=d,O-=b;do R[a++]=f[E++];while(--b);E=a-D,$=R}}}else if(E+=d-b,b<O){O-=b;do R[a++]=f[E++];while(--b);E=a-D,$=R}for(;O>2;)R[a++]=$[E++],R[a++]=$[E++],R[a++]=$[E++],O-=3;O&&(R[a++]=$[E++],O>1&&(R[a++]=$[E++]))}else{E=a-D;do R[a++]=R[E++],R[a++]=R[E++],R[a++]=R[E++],O-=3;while(O>2);O&&(R[a++]=R[E++],O>1&&(R[a++]=R[E++]))}}else if((b&64)===0){S=g[(S&65535)+(p&(1<<b)-1)];continue r}else{e.msg="invalid distance code",M.mode=Ns;break e}break}}else if((b&64)===0){S=m[(S&65535)+(p&(1<<b)-1)];continue t}else if(b&32){M.mode=sw;break e}else{e.msg="invalid literal/length code",M.mode=Ns;break e}break}}while(i<n&&a<s);O=h>>3,i-=O,h-=O<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),M.hold=p,M.bits=h},jn=15,Qd=852,zd=592,Wd=0,cl=1,Hd=2,uw=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]),lw=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]),pw=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]),fw=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]),dw=(r,e,t,i,n,a,o,s)=>{let c=s.bits,u=0,l=0,d=0,f=0,p=0,h=0,m=0,g=0,w=0,_=0,S,b,O,D,E,$=null,P,R=new Uint16Array(jn+1),M=new Uint16Array(jn+1),Ae=null,se,j,we;for(u=0;u<=jn;u++)R[u]=0;for(l=0;l<i;l++)R[e[t+l]]++;for(p=c,f=jn;f>=1&&R[f]===0;f--);if(p>f&&(p=f),f===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&R[d]===0;d++);for(p<d&&(p=d),g=1,u=1;u<=jn;u++)if(g<<=1,g-=R[u],g<0)return-1;if(g>0&&(r===Wd||f!==1))return-1;for(M[1]=0,u=1;u<jn;u++)M[u+1]=M[u]+R[u];for(l=0;l<i;l++)e[t+l]!==0&&(o[M[e[t+l]]++]=l);if(r===Wd?($=Ae=o,P=20):r===cl?($=uw,Ae=lw,P=257):($=pw,Ae=fw,P=0),_=0,l=0,u=d,E=a,h=p,m=0,O=-1,w=1<<p,D=w-1,r===cl&&w>Qd||r===Hd&&w>zd)return 1;for(;;){se=u-m,o[l]+1<P?(j=0,we=o[l]):o[l]>=P?(j=Ae[o[l]-P],we=$[o[l]-P]):(j=32+64,we=0),S=1<<u-m,b=1<<h,d=b;do b-=S,n[E+(_>>m)+b]=se<<24|j<<16|we|0;while(b!==0);for(S=1<<u-1;_&S;)S>>=1;if(S!==0?(_&=S-1,_+=S):_=0,l++,--R[u]===0){if(u===f)break;u=e[t+o[l]]}if(u>p&&(_&D)!==O){for(m===0&&(m=p),E+=d,h=u-m,g=1<<h;h+m<f&&(g-=R[h+m],!(g<=0));)h++,g<<=1;if(w+=1<<h,r===cl&&w>Qd||r===Hd&&w>zd)return 1;O=_&D,n[O]=p<<24|h<<16|E-a|0}}return _!==0&&(n[E+_]=u-m<<24|64<<16|0),s.bits=p,0},oo=dw,hw=0,Em=1,xm=2,{Z_FINISH:Gd,Z_BLOCK:mw,Z_TREES:Ds,Z_OK:Zi,Z_STREAM_END:gw,Z_NEED_DICT:yw,Z_STREAM_ERROR:zt,Z_DATA_ERROR:Am,Z_MEM_ERROR:Im,Z_BUF_ERROR:vw,Z_DEFLATED:Kd}=an,kc=16180,Jd=16181,Zd=16182,Yd=16183,Xd=16184,eh=16185,th=16186,rh=16187,ih=16188,nh=16189,mc=16190,Ir=16191,ul=16192,ah=16193,ll=16194,oh=16195,sh=16196,ch=16197,uh=16198,$s=16199,Rs=16200,lh=16201,ph=16202,fh=16203,dh=16204,hh=16205,pl=16206,mh=16207,gh=16208,ke=16209,Tm=16210,km=16211,bw=852,ww=592,_w=15,Sw=_w,yh=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Ew(){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 on=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<kc||e.mode>km?1:0},Om=r=>{if(on(r))return zt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=kc,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(bw),e.distcode=e.distdyn=new Int32Array(ww),e.sane=1,e.back=-1,Zi},Cm=r=>{if(on(r))return zt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Om(r)},Nm=(r,e)=>{let t;if(on(r))return zt;let i=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?zt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,Cm(r))},Dm=(r,e)=>{if(!r)return zt;let t=new Ew;r.state=t,t.strm=r,t.window=null,t.mode=kc;let i=Nm(r,e);return i!==Zi&&(r.state=null),i},xw=r=>Dm(r,Sw),vh=!0,fl,dl,Aw=r=>{if(vh){fl=new Int32Array(512),dl=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(oo(Em,r.lens,0,288,fl,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;oo(xm,r.lens,0,32,dl,0,r.work,{bits:5}),vh=!1}r.lencode=fl,r.lenbits=9,r.distcode=dl,r.distbits=5},$m=(r,e,t,i)=>{let n,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),a.window.set(e.subarray(t-i,t-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},Iw=(r,e)=>{let t,i,n,a,o,s,c,u,l,d,f,p,h,m,g=0,w,_,S,b,O,D,E,$,P=new Uint8Array(4),R,M,Ae=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(on(r)||!r.output||!r.input&&r.avail_in!==0)return zt;t=r.state,t.mode===Ir&&(t.mode=ul),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,u=t.hold,l=t.bits,d=s,f=c,$=Zi;e:for(;;)switch(t.mode){case kc:if(t.wrap===0){t.mode=ul;break}for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&2&&u===35615){t.wbits===0&&(t.wbits=15),t.check=0,P[0]=u&255,P[1]=u>>>8&255,t.check=He(t.check,P,2,0),u=0,l=0,t.mode=Jd;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((u&255)<<8)+(u>>8))%31){r.msg="incorrect header check",t.mode=ke;break}if((u&15)!==Kd){r.msg="unknown compression method",t.mode=ke;break}if(u>>>=4,l-=4,E=(u&15)+8,t.wbits===0&&(t.wbits=E),E>15||E>t.wbits){r.msg="invalid window size",t.mode=ke;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=u&512?nh:Ir,u=0,l=0;break;case Jd:for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==Kd){r.msg="unknown compression method",t.mode=ke;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=ke;break}t.head&&(t.head.text=u>>8&1),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,t.check=He(t.check,P,2,0)),u=0,l=0,t.mode=Zd;case Zd:for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.head&&(t.head.time=u),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,P[2]=u>>>16&255,P[3]=u>>>24&255,t.check=He(t.check,P,4,0)),u=0,l=0,t.mode=Yd;case Yd:for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,t.check=He(t.check,P,2,0)),u=0,l=0,t.mode=Xd;case Xd:if(t.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,t.check=He(t.check,P,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=eh;case eh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(E=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+p),E)),t.flags&512&&t.wrap&4&&(t.check=He(t.check,i,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=th;case th:if(t.flags&2048){if(s===0)break e;p=0;do E=i[a+p++],t.head&&E&&t.length<65536&&(t.head.name+=String.fromCharCode(E));while(E&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=He(t.check,i,p,a)),s-=p,a+=p,E)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=rh;case rh:if(t.flags&4096){if(s===0)break e;p=0;do E=i[a+p++],t.head&&E&&t.length<65536&&(t.head.comment+=String.fromCharCode(E));while(E&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=He(t.check,i,p,a)),s-=p,a+=p,E)break e}else t.head&&(t.head.comment=null);t.mode=ih;case ih:if(t.flags&512){for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.check&65535)){r.msg="header crc mismatch",t.mode=ke;break}u=0,l=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=Ir;break;case nh:for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}r.adler=t.check=yh(u),u=0,l=0,t.mode=mc;case mc:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,yw;r.adler=t.check=1,t.mode=Ir;case Ir:if(e===mw||e===Ds)break e;case ul:if(t.last){u>>>=l&7,l-=l&7,t.mode=pl;break}for(;l<3;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}switch(t.last=u&1,u>>>=1,l-=1,u&3){case 0:t.mode=ah;break;case 1:if(Aw(t),t.mode=$s,e===Ds){u>>>=2,l-=2;break e}break;case 2:t.mode=sh;break;case 3:r.msg="invalid block type",t.mode=ke}u>>>=2,l-=2;break;case ah:for(u>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if((u&65535)!==(u>>>16^65535)){r.msg="invalid stored block lengths",t.mode=ke;break}if(t.length=u&65535,u=0,l=0,t.mode=ll,e===Ds)break e;case ll:t.mode=oh;case oh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=Ir;break;case sh:for(;l<14;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.nlen=(u&31)+257,u>>>=5,l-=5,t.ndist=(u&31)+1,u>>>=5,l-=5,t.ncode=(u&15)+4,u>>>=4,l-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=ke;break}t.have=0,t.mode=ch;case ch:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.lens[Ae[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[Ae[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,R={bits:t.lenbits},$=oo(hw,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,$){r.msg="invalid code lengths set",t.mode=ke;break}t.have=0,t.mode=uh;case uh:for(;t.have<t.nlen+t.ndist;){for(;g=t.lencode[u&(1<<t.lenbits)-1],w=g>>>24,_=g>>>16&255,S=g&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(S<16)u>>>=w,l-=w,t.lens[t.have++]=S;else{if(S===16){for(M=w+2;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(u>>>=w,l-=w,t.have===0){r.msg="invalid bit length repeat",t.mode=ke;break}E=t.lens[t.have-1],p=3+(u&3),u>>>=2,l-=2}else if(S===17){for(M=w+3;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=w,l-=w,E=0,p=3+(u&7),u>>>=3,l-=3}else{for(M=w+7;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=w,l-=w,E=0,p=11+(u&127),u>>>=7,l-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=ke;break}for(;p--;)t.lens[t.have++]=E}}if(t.mode===ke)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=ke;break}if(t.lenbits=9,R={bits:t.lenbits},$=oo(Em,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,$){r.msg="invalid literal/lengths set",t.mode=ke;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},$=oo(xm,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,$){r.msg="invalid distances set",t.mode=ke;break}if(t.mode=$s,e===Ds)break e;case $s:t.mode=Rs;case Rs:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,cw(r,f),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===Ir&&(t.back=-1);break}for(t.back=0;g=t.lencode[u&(1<<t.lenbits)-1],w=g>>>24,_=g>>>16&255,S=g&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(_&&(_&240)===0){for(b=w,O=_,D=S;g=t.lencode[D+((u&(1<<b+O)-1)>>b)],w=g>>>24,_=g>>>16&255,S=g&65535,!(b+w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=b,l-=b,t.back+=b}if(u>>>=w,l-=w,t.back+=w,t.length=S,_===0){t.mode=hh;break}if(_&32){t.back=-1,t.mode=Ir;break}if(_&64){r.msg="invalid literal/length code",t.mode=ke;break}t.extra=_&15,t.mode=lh;case lh:if(t.extra){for(M=t.extra;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.length+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=ph;case ph:for(;g=t.distcode[u&(1<<t.distbits)-1],w=g>>>24,_=g>>>16&255,S=g&65535,!(w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if((_&240)===0){for(b=w,O=_,D=S;g=t.distcode[D+((u&(1<<b+O)-1)>>b)],w=g>>>24,_=g>>>16&255,S=g&65535,!(b+w<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=b,l-=b,t.back+=b}if(u>>>=w,l-=w,t.back+=w,_&64){r.msg="invalid distance code",t.mode=ke;break}t.offset=S,t.extra=_&15,t.mode=fh;case fh:if(t.extra){for(M=t.extra;l<M;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.offset+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=ke;break}t.mode=dh;case dh:if(c===0)break e;if(p=f-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=ke;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=n,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do n[o++]=m[h++];while(--p);t.length===0&&(t.mode=Rs);break;case hh:if(c===0)break e;n[o++]=t.length,c--,t.mode=Rs;break;case pl:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=i[a++]<<l,l+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?He(t.check,n,f,o-f):go(t.check,n,f,o-f)),f=c,t.wrap&4&&(t.flags?u:yh(u))!==t.check){r.msg="incorrect data check",t.mode=ke;break}u=0,l=0}t.mode=mh;case mh:if(t.wrap&&t.flags){for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=ke;break}u=0,l=0}t.mode=gh;case gh:$=gw;break e;case ke:$=Am;break e;case Tm:return Im;case km:default:return zt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,(t.wsize||f!==r.avail_out&&t.mode<ke&&(t.mode<pl||e!==Gd))&&$m(r,r.output,r.next_out,f-r.avail_out),d-=r.avail_in,f-=r.avail_out,r.total_in+=d,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?He(t.check,n,f,r.next_out-f):go(t.check,n,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Ir?128:0)+(t.mode===$s||t.mode===ll?256:0),(d===0&&f===0||e===Gd)&&$===Zi&&($=vw),$},Tw=r=>{if(on(r))return zt;let e=r.state;return e.window&&(e.window=null),r.state=null,Zi},kw=(r,e)=>{if(on(r))return zt;let t=r.state;return(t.wrap&2)===0?zt:(t.head=e,e.done=!1,Zi)},Ow=(r,e)=>{let t=e.length,i,n,a;return on(r)||(i=r.state,i.wrap!==0&&i.mode!==mc)?zt:i.mode===mc&&(n=1,n=go(n,e,t,0),n!==i.check)?Am:(a=$m(r,e,t,t),a?(i.mode=Tm,Im):(i.havedict=1,Zi))},Cw=Cm,Nw=Nm,Dw=Om,$w=xw,Rw=Dm,Pw=Iw,Lw=Tw,Fw=kw,Mw=Ow,jw="pako inflate (from Nodeca project)",Nr={inflateReset:Cw,inflateReset2:Nw,inflateResetKeep:Dw,inflateInit:$w,inflateInit2:Rw,inflate:Pw,inflateEnd:Lw,inflateGetHeader:Fw,inflateSetDictionary:Mw,inflateInfo:jw};function Uw(){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 qw=Uw,Rm=Object.prototype.toString,{Z_NO_FLUSH:Bw,Z_FINISH:Vw,Z_OK:bo,Z_STREAM_END:hl,Z_NEED_DICT:ml,Z_STREAM_ERROR:Qw,Z_DATA_ERROR:bh,Z_MEM_ERROR:zw}=an;function To(r){this.options=Tc.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new _m,this.strm.avail_out=0;let t=Nr.inflateInit2(this.strm,e.windowBits);if(t!==bo)throw new Error(Ki[t]);if(this.header=new qw,Nr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=vo.string2buf(e.dictionary):Rm.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Nr.inflateSetDictionary(this.strm,e.dictionary),t!==bo)))throw new Error(Ki[t])}To.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?Vw:Bw,Rm.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=Nr.inflate(t,o),a===ml&&n&&(a=Nr.inflateSetDictionary(t,n),a===bo?a=Nr.inflate(t,o):a===bh&&(a=ml));t.avail_in>0&&a===hl&&t.state.wrap>0&&r[t.next_in]!==0;)Nr.inflateReset(t),a=Nr.inflate(t,o);switch(a){case Qw:case bh:case ml:case zw:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===hl))if(this.options.to==="string"){let c=vo.utf8border(t.output,t.next_out),u=t.next_out-c,l=vo.buf2string(t.output,c);t.next_out=u,t.avail_out=i-u,u&&t.output.set(t.output.subarray(c,c+u),0),this.onData(l)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===bo&&s===0)){if(a===hl)return a=Nr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};To.prototype.onData=function(r){this.chunks.push(r)};To.prototype.onEnd=function(r){r===bo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Tc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ep(r,e){let t=new To(e);if(t.push(r),t.err)throw t.msg||Ki[t.err];return t.result}function Ww(r,e){return e=e||{},e.raw=!0,ep(r,e)}var Hw=To,Gw=ep,Kw=Ww,Jw=ep,Zw=an,Yw={Inflate:Hw,inflate:Gw,inflateRaw:Kw,ungzip:Jw,constants:Zw},{Deflate:Xw,deflate:e_,deflateRaw:t_,gzip:r_}=ow,{Inflate:i_,inflate:n_,inflateRaw:a_,ungzip:o_}=Yw,s_=Xw,c_=e_,u_=t_,l_=r_,p_=i_,f_=n_,d_=a_,h_=o_,m_=an,g_={Deflate:s_,deflate:c_,deflateRaw:u_,gzip:l_,Inflate:p_,inflate:f_,inflateRaw:d_,ungzip:h_,constants:m_},Se=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ee=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},gc=class{constructor(e,t){this.input=e,this.output=t}};Se([y(),Ee("design:type",String)],gc.prototype,"input",void 0);Se([y(),Ee("design:type",String)],gc.prototype,"output",void 0);gc=Se([Ke(),Ee("design:paramtypes",[String,String])],gc);var yc=class{constructor(e,t){this.input=e,this.output=t}};Se([y(),Ee("design:type",String)],yc.prototype,"input",void 0);Se([y(),Ee("design:type",String)],yc.prototype,"output",void 0);yc=Se([G(),Ee("design:paramtypes",[String,String])],yc);var ci=class{constructor(e,t,i,n,a){this.name=e,this.modelId=t,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};Se([y(),Ee("design:type",String)],ci.prototype,"name",void 0);Se([y(),Ee("design:type",String)],ci.prototype,"modelId",void 0);Se([y(),Ee("design:type",String)],ci.prototype,"systemPrompt",void 0);Se([y(),Ee("design:type",Array)],ci.prototype,"promptExamples",void 0);Se([y(),Ee("design:type",String)],ci.prototype,"metaData",void 0);ci=Se([Ke(),Ee("design:paramtypes",[String,String,String,Array,String])],ci);var br=class{constructor(e,t,i,n,a,o,s,c){this.name=e,this.modelId=t,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};Se([y(),Ee("design:type",String)],br.prototype,"name",void 0);Se([y(),Ee("design:type",String)],br.prototype,"modelId",void 0);Se([y(),Ee("design:type",String)],br.prototype,"taskId",void 0);Se([y(),Ee("design:type",String)],br.prototype,"systemPrompt",void 0);Se([y(),Ee("design:type",Array)],br.prototype,"promptExamples",void 0);Se([y(),Ee("design:type",String)],br.prototype,"metaData",void 0);Se([y(),Ee("design:type",String)],br.prototype,"createdAt",void 0);Se([y(),Ee("design:type",String)],br.prototype,"updatedAt",void 0);br=Se([G(),Ee("design:paramtypes",[String,String,String,String,Array,String,String,String])],br);var Yi=class{constructor(e,t,i,n,a){this.model=e,this.status=t,this.progress=i,this.downloaded=n,this.loaded=a}};Se([y(),Ee("design:type",String)],Yi.prototype,"model",void 0);Se([y(),Ee("design:type",String)],Yi.prototype,"status",void 0);Se([y(),Ee("design:type",Number)],Yi.prototype,"progress",void 0);Se([y(),Ee("design:type",Boolean)],Yi.prototype,"downloaded",void 0);Se([y(),Ee("design:type",Boolean)],Yi.prototype,"loaded",void 0);Yi=Se([G(),Ee("design:paramtypes",[String,String,Number,Boolean,Boolean])],Yi);var y_=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ze=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Ve,Gs,Ml=class{constructor(e,t=!0){Ve.set(this,void 0),Gs.set(this,new Map),y_(this,Ve,e,"f")}async getModels(){let e=await ze(this,Ve,"f").query({query:I`
|
|
743
743
|
query {
|
|
744
744
|
aiGetModels {
|
|
745
745
|
id
|
|
@@ -885,34 +885,35 @@ triggerMatch
|
|
|
885
885
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
886
886
|
aiEmbed(modelId: $modelId, text: $text)
|
|
887
887
|
}
|
|
888
|
-
`,variables:{modelId:e,text:t}})),n=Ac.toByteArray(i);return JSON.parse(g_.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,i){let{aiOpenTranscriptionStream:
|
|
889
|
-
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
|
|
890
|
-
aiOpenTranscriptionStream(modelId: $modelId, params: $params)
|
|
888
|
+
`,variables:{modelId:e,text:t}})),n=Ac.toByteArray(i);return JSON.parse(g_.inflate(n,{to:"string"}))}async openTranscriptionStream(e,t,i,n){let{aiOpenTranscriptionStream:a}=T(await ze(this,Ve,"f").mutate({mutation:I`
|
|
889
|
+
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput, $language: String) {
|
|
890
|
+
aiOpenTranscriptionStream(modelId: $modelId, params: $params, language: $language)
|
|
891
891
|
}
|
|
892
|
-
`,variables:{modelId:e,params:i}})),
|
|
893
|
-
aiTranscriptionText(streamId: "${
|
|
894
|
-
}`}).subscribe({next(
|
|
892
|
+
`,variables:{modelId:e,params:i,language:n}})),o=ze(this,Ve,"f").subscribe({query:I` subscription {
|
|
893
|
+
aiTranscriptionText(streamId: "${a}")
|
|
894
|
+
}`}).subscribe({next(s){return t(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return ze(this,Gs,"f").set(a,o),a}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=T(await ze(this,Ve,"f").mutate({mutation:I`
|
|
895
895
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
896
896
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
897
897
|
}
|
|
898
|
-
`,variables:{streamId:e}})),i=ze(this,
|
|
898
|
+
`,variables:{streamId:e}})),i=ze(this,Gs,"f").get(e);return i.closed||i.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:i}=T(await ze(this,Ve,"f").mutate({mutation:I`
|
|
899
899
|
mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
|
|
900
900
|
aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
|
|
901
901
|
}
|
|
902
|
-
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return i}};Ve=new WeakMap,Hs=new WeakMap;var Hr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Be=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},pr,Ks,eo,Js,to,Pi,Zs,ro,wo=class{constructor(e,t=!0){pr.set(this,void 0),Ks.set(this,void 0),eo.set(this,void 0),Js.set(this,void 0),to.set(this,void 0),Pi.set(this,void 0),Zs.set(this,void 0),ro.set(this,void 0),Hr(this,pr,e,"f"),Hr(this,Ks,new lo(Be(this,pr,"f"),t),"f"),Hr(this,eo,new kl(Be(this,pr,"f")),"f"),Hr(this,Js,new Al(Be(this,pr,"f")),"f"),Hr(this,to,new Il(Be(this,pr,"f")),"f"),Hr(this,ro,new Ml(Be(this,pr,"f"),t),"f"),Hr(this,Pi,new fc(Be(this,pr,"f"),t),"f"),Be(this,Pi,"f").setExpressionClient(Be(this,eo,"f")),Be(this,Pi,"f").setNeighbourhoodClient(Be(this,to,"f")),Be(this,Pi,"f").setAIClient(Be(this,ro,"f")),Hr(this,Zs,new Tl(Be(this,pr,"f"),t),"f")}get agent(){return Be(this,Ks,"f")}get expression(){return Be(this,eo,"f")}get languages(){return Be(this,Js,"f")}get neighbourhood(){return Be(this,to,"f")}get perspective(){return Be(this,Pi,"f")}get runtime(){return Be(this,Zs,"f")}get ai(){return Be(this,ro,"f")}};pr=new WeakMap,Ks=new WeakMap,eo=new WeakMap,Js=new WeakMap,to=new WeakMap,Pi=new WeakMap,Zs=new WeakMap,ro=new WeakMap;var jl;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(jl||(jl={}));var tp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},rp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qi=class{constructor(e,t){this.language=e,this.expression=t}};tp([g(),rp("design:type",hr)],qi.prototype,"language",void 0);tp([g(),rp("design:type",String)],qi.prototype,"expression",void 0);qi=tp([H(),rp("design:paramtypes",[hr,String])],qi);function Xk(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function eO(r){if(r.startsWith("literal://")){let a=new hr;a.address="literal",a.name="literal";let o=r.substring(10);return new qi(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new hr;return s.address=a,new qi(s,o)}let n=/^did:([^\s]+)$/.exec(r);if(n&&n.length==2){let a=new hr;return a.address="did",new qi(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Pt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},wr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},vc=class{};Pt([g(),wr("design:type",String)],vc.prototype,"name",void 0);Pt([g(),wr("design:type",String)],vc.prototype,"type",void 0);vc=Pt([H()],vc);var _o=class{};Pt([g(),wr("design:type",String)],_o.prototype,"label",void 0);Pt([g(),wr("design:type",String)],_o.prototype,"name",void 0);Pt([g(),wr("design:type",Array)],_o.prototype,"parameters",void 0);_o=Pt([H()],_o);var bc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Pt([g(),wr("design:type",String)],bc.prototype,"name",void 0);Pt([g(),wr("design:type",String)],bc.prototype,"parametersStringified",void 0);bc=Pt([Ke(),wr("design:paramtypes",[String,Object])],bc);var wc=class{};Pt([g(),wr("design:type",String)],wc.prototype,"did",void 0);Pt([g(),wr("design:type",Gi)],wc.prototype,"status",void 0);wc=Pt([H()],wc);var wh=class{},sn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},sa=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ui=class{};sn([g(),sa("design:type",String)],ui.prototype,"name",void 0);sn([g(),sa("design:type",String)],ui.prototype,"address",void 0);sn([g(),sa("design:type",String)],ui.prototype,"settings",void 0);sn([g(),sa("design:type",Qi)],ui.prototype,"icon",void 0);sn([g(),sa("design:type",Qi)],ui.prototype,"constructorIcon",void 0);sn([g(),sa("design:type",Qi)],ui.prototype,"settingsIcon",void 0);ui=sn([H()],ui);var yt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},At=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Xt=class{};yt([g(),At("design:type",String)],Xt.prototype,"name",void 0);yt([g(),At("design:type",String)],Xt.prototype,"address",void 0);yt([g(),At("design:type",String)],Xt.prototype,"description",void 0);yt([g(),At("design:type",String)],Xt.prototype,"author",void 0);yt([g(),At("design:type",Boolean)],Xt.prototype,"templated",void 0);yt([g(),At("design:type",String)],Xt.prototype,"templateSourceLanguageAddress",void 0);yt([g(),At("design:type",String)],Xt.prototype,"templateAppliedParams",void 0);yt([g(),At("design:type",Array)],Xt.prototype,"possibleTemplateParams",void 0);yt([g(),At("design:type",String)],Xt.prototype,"sourceCodeLink",void 0);Xt=yt([H()],Xt);var Yn=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};yt([g(),At("design:type",String)],Yn.prototype,"name",void 0);yt([g(),At("design:type",String)],Yn.prototype,"description",void 0);yt([g(),At("design:type",Array)],Yn.prototype,"possibleTemplateParams",void 0);yt([g(),At("design:type",String)],Yn.prototype,"sourceCodeLink",void 0);Yn=yt([Ke(),At("design:paramtypes",[String,String])],Yn);var _h=class{},Sh=class extends fi(){},Eh=class{},Oc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ip=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},_c=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Oc([g(),ip("design:type",String)],_c.prototype,"linkLanguage",void 0);Oc([g(),ip("design:type",yr)],_c.prototype,"meta",void 0);_c=Oc([H(),ip("design:paramtypes",[String,yr])],_c);var Ul=class extends fi(){};Ul=Oc([H()],Ul);var cn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},un=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ql;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(ql||(ql={}));var li=class{constructor(e,t,i){this.uuid=e,this.name=t,i?this.state=i:this.state=ql.Private}};cn([g(),un("design:type",String)],li.prototype,"uuid",void 0);cn([g(),un("design:type",String)],li.prototype,"name",void 0);cn([g(),un("design:type",String)],li.prototype,"state",void 0);cn([g(),un("design:type",String)],li.prototype,"sharedUrl",void 0);cn([g(),un("design:type",Ul)],li.prototype,"neighbourhood",void 0);cn([g(),un("design:type",Array)],li.prototype,"owners",void 0);li=cn([H(),un("design:paramtypes",[String,String,String])],li);var Cc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Pm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Sc=class{};Cc([g(),Pm("design:type",Array)],Sc.prototype,"additions",void 0);Cc([g(),Pm("design:type",Array)],Sc.prototype,"removals",void 0);Sc=Cc([H()],Sc);var xh=class extends fi(){};xh=Cc([H()],xh);var Ah=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Un=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},io,Li,Ps="smart_literal://content";function v_(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}var So=class{constructor(e,t){io.set(this,void 0),Li.set(this,void 0),Ah(this,io,e,"f"),Ah(this,Li,t,"f")}get base(){return Un(this,Li,"f")}static async create(e,t){let i=it.from(v_(10)).toUrl(),n=new So(e,i);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new rt({source:t,predicate:Ps}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new rt({predicate:Ps}))).map(i=>new So(e,i.data.source))}async get(){let e=await Un(this,io,"f").getSingleTarget(new rt({source:Un(this,Li,"f"),predicate:Ps}));if(!e)throw`No content for smart literal ${Un(this,Li,"f")}`;return it.fromUrl(e).get()}async set(e){let t=it.from(e);await Un(this,io,"f").setSingleTarget(new Wi({source:Un(this,Li,"f"),predicate:Ps,target:t.toUrl()}))}};io=new WeakMap,Li=new WeakMap;var Ih=class{};function dO(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function hO(r){return`triple(this, "${r}", _)`}function mO(r){return function(e,t,i){if(typeof i.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");i.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(r&&r.where)for(let l in r.where){let d=r.where[l];c+=`, property_getter(C, Instance, "${l}", "${d}")`}r&&r.condition&&(c+=", "+r.condition);try{let l=await a.infer(c);if(l&&l!==!1&&typeof l!="string"&&l.length>0){for(let d of l){let f=d.Instance,p=new zn(a,f,s);await p.init(),o.push(p)}return o}}catch{}let u=await a.getAllSubjectInstances(s);if(r&&r.where){let l=[];for(let d of u){let f=!0;for(let p in r.where){let h=r.where[p];if(await d[p]!==h){f=!1;break}}f&&l.push(d)}return l}return u}}}function Lm(r){return function(e,t){if(typeof r.writable>"u"&&r.through&&(r.writable=!0),r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.getter)throw new Error("SubjectProperty requires either 'through' or 'getter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...r},r.writable){let i=t;e[`set${ti(i)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function gO(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],through:r.through,required:!0,initial:r.value,flag:!0},e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function yO(r){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=r;let i=t;e[`add${ti(i)}`]=()=>{},e[`remove${ti(i)}`]=()=>{},e[`setCollection${ti(i)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Fm(r){let e="",t="abcdefghijklmnopqrstuvwxyz",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function b_(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",i=r.name,n=e.prototype,a=Fm(8);t+=`subject_class("${i}", ${a}).
|
|
902
|
+
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return i}};Ve=new WeakMap,Gs=new WeakMap;var Gr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Be=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},pr,Ks,eo,Js,to,Pi,Zs,ro,wo=class{constructor(e,t=!0){pr.set(this,void 0),Ks.set(this,void 0),eo.set(this,void 0),Js.set(this,void 0),to.set(this,void 0),Pi.set(this,void 0),Zs.set(this,void 0),ro.set(this,void 0),Gr(this,pr,e,"f"),Gr(this,Ks,new lo(Be(this,pr,"f"),t),"f"),Gr(this,eo,new kl(Be(this,pr,"f")),"f"),Gr(this,Js,new Al(Be(this,pr,"f")),"f"),Gr(this,to,new Il(Be(this,pr,"f")),"f"),Gr(this,ro,new Ml(Be(this,pr,"f"),t),"f"),Gr(this,Pi,new fc(Be(this,pr,"f"),t),"f"),Be(this,Pi,"f").setExpressionClient(Be(this,eo,"f")),Be(this,Pi,"f").setNeighbourhoodClient(Be(this,to,"f")),Be(this,Pi,"f").setAIClient(Be(this,ro,"f")),Gr(this,Zs,new Tl(Be(this,pr,"f"),t),"f")}get agent(){return Be(this,Ks,"f")}get expression(){return Be(this,eo,"f")}get languages(){return Be(this,Js,"f")}get neighbourhood(){return Be(this,to,"f")}get perspective(){return Be(this,Pi,"f")}get runtime(){return Be(this,Zs,"f")}get ai(){return Be(this,ro,"f")}};pr=new WeakMap,Ks=new WeakMap,eo=new WeakMap,Js=new WeakMap,to=new WeakMap,Pi=new WeakMap,Zs=new WeakMap,ro=new WeakMap;var jl;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(jl||(jl={}));var tp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},rp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qi=class{constructor(e,t){this.language=e,this.expression=t}};tp([y(),rp("design:type",hr)],qi.prototype,"language",void 0);tp([y(),rp("design:type",String)],qi.prototype,"expression",void 0);qi=tp([G(),rp("design:paramtypes",[hr,String])],qi);function Xk(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function eO(r){if(r.startsWith("literal://")){let a=new hr;a.address="literal",a.name="literal";let o=r.substring(10);return new qi(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new hr;return s.address=a,new qi(s,o)}let n=/^did:([^\s]+)$/.exec(r);if(n&&n.length==2){let a=new hr;return a.address="did",new qi(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Pt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},wr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},vc=class{};Pt([y(),wr("design:type",String)],vc.prototype,"name",void 0);Pt([y(),wr("design:type",String)],vc.prototype,"type",void 0);vc=Pt([G()],vc);var _o=class{};Pt([y(),wr("design:type",String)],_o.prototype,"label",void 0);Pt([y(),wr("design:type",String)],_o.prototype,"name",void 0);Pt([y(),wr("design:type",Array)],_o.prototype,"parameters",void 0);_o=Pt([G()],_o);var bc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Pt([y(),wr("design:type",String)],bc.prototype,"name",void 0);Pt([y(),wr("design:type",String)],bc.prototype,"parametersStringified",void 0);bc=Pt([Ke(),wr("design:paramtypes",[String,Object])],bc);var wc=class{};Pt([y(),wr("design:type",String)],wc.prototype,"did",void 0);Pt([y(),wr("design:type",Hi)],wc.prototype,"status",void 0);wc=Pt([G()],wc);var wh=class{},sn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},sa=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ui=class{};sn([y(),sa("design:type",String)],ui.prototype,"name",void 0);sn([y(),sa("design:type",String)],ui.prototype,"address",void 0);sn([y(),sa("design:type",String)],ui.prototype,"settings",void 0);sn([y(),sa("design:type",Qi)],ui.prototype,"icon",void 0);sn([y(),sa("design:type",Qi)],ui.prototype,"constructorIcon",void 0);sn([y(),sa("design:type",Qi)],ui.prototype,"settingsIcon",void 0);ui=sn([G()],ui);var yt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},At=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Xt=class{};yt([y(),At("design:type",String)],Xt.prototype,"name",void 0);yt([y(),At("design:type",String)],Xt.prototype,"address",void 0);yt([y(),At("design:type",String)],Xt.prototype,"description",void 0);yt([y(),At("design:type",String)],Xt.prototype,"author",void 0);yt([y(),At("design:type",Boolean)],Xt.prototype,"templated",void 0);yt([y(),At("design:type",String)],Xt.prototype,"templateSourceLanguageAddress",void 0);yt([y(),At("design:type",String)],Xt.prototype,"templateAppliedParams",void 0);yt([y(),At("design:type",Array)],Xt.prototype,"possibleTemplateParams",void 0);yt([y(),At("design:type",String)],Xt.prototype,"sourceCodeLink",void 0);Xt=yt([G()],Xt);var Yn=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};yt([y(),At("design:type",String)],Yn.prototype,"name",void 0);yt([y(),At("design:type",String)],Yn.prototype,"description",void 0);yt([y(),At("design:type",Array)],Yn.prototype,"possibleTemplateParams",void 0);yt([y(),At("design:type",String)],Yn.prototype,"sourceCodeLink",void 0);Yn=yt([Ke(),At("design:paramtypes",[String,String])],Yn);var _h=class{},Sh=class extends fi(){},Eh=class{},Oc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ip=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},_c=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Oc([y(),ip("design:type",String)],_c.prototype,"linkLanguage",void 0);Oc([y(),ip("design:type",yr)],_c.prototype,"meta",void 0);_c=Oc([G(),ip("design:paramtypes",[String,yr])],_c);var Ul=class extends fi(){};Ul=Oc([G()],Ul);var cn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},un=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ql;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(ql||(ql={}));var li=class{constructor(e,t,i){this.uuid=e,this.name=t,i?this.state=i:this.state=ql.Private}};cn([y(),un("design:type",String)],li.prototype,"uuid",void 0);cn([y(),un("design:type",String)],li.prototype,"name",void 0);cn([y(),un("design:type",String)],li.prototype,"state",void 0);cn([y(),un("design:type",String)],li.prototype,"sharedUrl",void 0);cn([y(),un("design:type",Ul)],li.prototype,"neighbourhood",void 0);cn([y(),un("design:type",Array)],li.prototype,"owners",void 0);li=cn([G(),un("design:paramtypes",[String,String,String])],li);var Cc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Pm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Sc=class{};Cc([y(),Pm("design:type",Array)],Sc.prototype,"additions",void 0);Cc([y(),Pm("design:type",Array)],Sc.prototype,"removals",void 0);Sc=Cc([G()],Sc);var xh=class extends fi(){};xh=Cc([G()],xh);var Ah=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Un=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},io,Li,Ps="smart_literal://content";function v_(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}var So=class{constructor(e,t){io.set(this,void 0),Li.set(this,void 0),Ah(this,io,e,"f"),Ah(this,Li,t,"f")}get base(){return Un(this,Li,"f")}static async create(e,t){let i=it.from(v_(10)).toUrl(),n=new So(e,i);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new rt({source:t,predicate:Ps}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new rt({predicate:Ps}))).map(i=>new So(e,i.data.source))}async get(){let e=await Un(this,io,"f").getSingleTarget(new rt({source:Un(this,Li,"f"),predicate:Ps}));if(!e)throw`No content for smart literal ${Un(this,Li,"f")}`;return it.fromUrl(e).get()}async set(e){let t=it.from(e);await Un(this,io,"f").setSingleTarget(new Wi({source:Un(this,Li,"f"),predicate:Ps,target:t.toUrl()}))}};io=new WeakMap,Li=new WeakMap;var Ih=class{};function dO(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function hO(r){return`triple(this, "${r}", _)`}function mO(r){return function(e,t,i){if(typeof i.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");i.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(r&&r.where)for(let l in r.where){let d=r.where[l];c+=`, property_getter(C, Instance, "${l}", "${d}")`}r&&r.prologCondition&&(c+=", "+r.prologCondition);try{let l=await a.infer(c);if(l&&l!==!1&&typeof l!="string"&&l.length>0){for(let d of l){let f=d.Instance,p=new zn(a,f,s);await p.init(),o.push(p)}return o}}catch{}let u=await a.getAllSubjectInstances(s);if(r&&r.where){let l=[];for(let d of u){let f=!0;for(let p in r.where){let h=r.where[p];if(await d[p]!==h){f=!1;break}}f&&l.push(d)}return l}return u}}}function Lm(r){return function(e,t){if(typeof r.writable>"u"&&r.through&&(r.writable=!0),r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...r},r.writable){let i=t;e[`set${ti(i)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function gO(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],through:r.through,required:!0,initial:r.value,flag:!0},e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function yO(r){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=r;let i=t;e[`add${ti(i)}`]=()=>{},e[`remove${ti(i)}`]=()=>{},e[`setCollection${ti(i)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Fm(r){let e="",t="abcdefghijklmnopqrstuvwxyz",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function b_(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",i=r.name,n=e.prototype,a=Fm(8);t+=`subject_class("${i}", ${a}).
|
|
903
903
|
`;let o=[],s=[];n.subjectConstructor&&n.subjectConstructor.length&&(s=s.concat(n.subjectConstructor));let c=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(c=c.concat(n.isSubjectInstance));let u=[],l=n.__properties||{};for(let h in l){let m=`property(${a}, "${h}").
|
|
904
|
-
`,{through:
|
|
904
|
+
`,{through:g,initial:w,required:_,resolveLanguage:S,writable:b,flag:O,prologGetter:D,prologSetter:E,local:$}=l[h];if(S&&(m+=`property_resolve(${a}, "${h}").
|
|
905
905
|
`,m+=`property_resolve_language(${a}, "${h}", "${S}").
|
|
906
|
-
`)
|
|
907
|
-
`:
|
|
908
|
-
`,_&&(
|
|
909
|
-
`;else if(b&&
|
|
910
|
-
`}u.push(m),w&&(s.push({action:"addLink",source:"this",predicate:
|
|
911
|
-
`,{through:
|
|
912
|
-
`}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${
|
|
913
|
-
|
|
906
|
+
`),D?m+=`property_getter(${a}, Base, "${h}", Value) :- ${D}.
|
|
907
|
+
`:g&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${g}", Value).
|
|
908
|
+
`,_&&(O?c.push(`triple(Base, "${g}", "${w}")`):c.push(`triple(Base, "${g}", _)`))),E)m+=`property_setter(${a}, "${h}", Actions) :- ${E}.
|
|
909
|
+
`;else if(b&&g&&typeof n[Wl(h)]=="function"){let R=[{action:"setSingleTarget",source:"this",predicate:g,target:"value",...$&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${ki(R)}').
|
|
910
|
+
`}u.push(m),w&&(s.push({action:"addLink",source:"this",predicate:g,target:w}),o.push({action:"removeLink",source:"this",predicate:g,target:"*"}))}let d=[],f=n.__collections||{};for(let h in f){let m=`collection(${a}, "${h}").
|
|
911
|
+
`,{through:g,where:w,local:_}=f[h];if(g){if(w){if(!w.isInstance&&!w.prologCondition&&!w.condition)throw"'where' needs one of 'isInstance', 'prologCondition', or 'condition'";let D=[];if(w.isInstance){let E;w.isInstance.name?E=w.isInstance.name:E=w.isInstance,D.push(`instance(OtherClass, Target), subject_class("${E}", OtherClass)`)}if(w.prologCondition&&D.push(w.prologCondition),D.length>0){let E=D.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${g}", Target), ${E}), List).
|
|
912
|
+
`}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${g}", C), List).
|
|
913
|
+
`}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${g}", C), List).
|
|
914
|
+
`;let S=[{action:"addLink",source:"this",predicate:g,target:"value",..._&&{local:!0}}],b=[{action:"removeLink",source:"this",predicate:g,target:"value"}],O=[{action:"collectionSetter",source:"this",predicate:g,target:"value",..._&&{local:!0}}];m+=`collection_adder(${a}, "${Qn(h)}", '${ki(S)}').
|
|
914
915
|
`,m+=`collection_remover(${a}, "${Qn(h)}", '${ki(b)}').
|
|
915
|
-
`,m+=`collection_setter(${a}, "${Qn(h)}", '${ki(
|
|
916
|
+
`,m+=`collection_setter(${a}, "${Qn(h)}", '${ki(O)}').
|
|
916
917
|
`}d.push(m)}let p=ki(s);if(t+=`constructor(${a}, '${p}').
|
|
917
918
|
`,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
|
|
918
919
|
`,t+=`
|
|
@@ -1232,7 +1233,7 @@ type Mutation {
|
|
|
1232
1233
|
aiCloseTranscriptionStream(streamId: String!): String!
|
|
1233
1234
|
aiEmbed(modelId: String!, text: String!): String!
|
|
1234
1235
|
aiFeedTranscriptionStream(audio: [Float!]!, streamIds: [String!]!): String!
|
|
1235
|
-
aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
|
|
1236
|
+
aiOpenTranscriptionStream(language: String, modelId: String!, params: VoiceActivityParamsInput): String!
|
|
1236
1237
|
aiPrompt(prompt: String!, taskId: String!): String!
|
|
1237
1238
|
aiRemoveModel(modelId: String!): Boolean!
|
|
1238
1239
|
aiRemoveTask(taskId: String!): AITask!
|
|
@@ -1507,7 +1508,7 @@ input VoiceActivityParamsInput {
|
|
|
1507
1508
|
startWindow: Float
|
|
1508
1509
|
timeBeforeSpeech: Float
|
|
1509
1510
|
}
|
|
1510
|
-
`,N=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},v=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},X=function(r,e){return function(t,i){e(t,i,r)}},ko=new ai;ko.author="did:ad4m:test";ko.timestamp=Date.now();ko.data={source:"root",target:"neighbourhood://Qm12345"};ko.proof={signature:"",key:"",valid:!0};var Xr=new Gi;Xr.author="did:ad4m:test";Xr.timestamp=Date.now().toString();Xr.proof=new Dr("","");Xr.data=new yr([ko]);var Ec=class{};N([g(),v("design:type",String)],Ec.prototype,"recipient",void 0);N([g(),v("design:type",Gi)],Ec.prototype,"message",void 0);Ec=N([H()],Ec);var Xn=class{};N([g(),v("design:type",String)],Xn.prototype,"ad4mExecutorVersion",void 0);N([g(),v("design:type",Boolean)],Xn.prototype,"isInitialized",void 0);N([g(),v("design:type",Boolean)],Xn.prototype,"isUnlocked",void 0);Xn=N([H()],Xn);var Xi=class{};N([g(),v("design:type",String)],Xi.prototype,"title",void 0);N([g(),v("design:type",String)],Xi.prototype,"message",void 0);N([g(),v("design:type",String)],Xi.prototype,"type",void 0);N([g(),v("design:type",String)],Xi.prototype,"addon",void 0);Xi=N([H()],Xi);var Wt=class{};N([g(),v("design:type",String)],Wt.prototype,"description",void 0);N([g(),v("design:type",String)],Wt.prototype,"appName",void 0);N([g(),v("design:type",String)],Wt.prototype,"appUrl",void 0);N([g(),v("design:type",String)],Wt.prototype,"appIconPath",void 0);N([g(),v("design:type",String)],Wt.prototype,"trigger",void 0);N([g(),v("design:type",Array)],Wt.prototype,"perspectiveIds",void 0);N([g(),v("design:type",String)],Wt.prototype,"webhookUrl",void 0);N([g(),v("design:type",String)],Wt.prototype,"webhookAuth",void 0);Wt=N([Ke()],Wt);var Dt=class{};N([g(),v("design:type",String)],Dt.prototype,"id",void 0);N([g(),v("design:type",Boolean)],Dt.prototype,"granted",void 0);N([g(),v("design:type",String)],Dt.prototype,"description",void 0);N([g(),v("design:type",String)],Dt.prototype,"appName",void 0);N([g(),v("design:type",String)],Dt.prototype,"appUrl",void 0);N([g(),v("design:type",String)],Dt.prototype,"appIconPath",void 0);N([g(),v("design:type",String)],Dt.prototype,"trigger",void 0);N([g(),v("design:type",Array)],Dt.prototype,"perspectiveIds",void 0);N([g(),v("design:type",String)],Dt.prototype,"webhookUrl",void 0);N([g(),v("design:type",String)],Dt.prototype,"webhookAuth",void 0);Dt=N([H()],Dt);var ea=class{};N([g(),v("design:type",Dt)],ea.prototype,"notification",void 0);N([g(),v("design:type",String)],ea.prototype,"perspectiveId",void 0);N([g(),v("design:type",String)],ea.prototype,"triggerMatch",void 0);ea=N([H()],ea);var He=class{};N([g(),v("design:type",Number)],He.prototype,"total",void 0);N([g(),v("design:type",Number)],He.prototype,"imported",void 0);N([g(),v("design:type",Number)],He.prototype,"failed",void 0);N([g(),v("design:type",Number)],He.prototype,"omitted",void 0);N([g(),v("design:type",Array)],He.prototype,"errors",void 0);He=N([H()],He);var $t=class{};N([g(),v("design:type",He)],$t.prototype,"perspectives",void 0);N([g(),v("design:type",He)],$t.prototype,"links",void 0);N([g(),v("design:type",He)],$t.prototype,"expressions",void 0);N([g(),v("design:type",He)],$t.prototype,"perspectiveDiffs",void 0);N([g(),v("design:type",He)],$t.prototype,"notifications",void 0);N([g(),v("design:type",He)],$t.prototype,"models",void 0);N([g(),v("design:type",He)],$t.prototype,"defaultModels",void 0);N([g(),v("design:type",He)],$t.prototype,"tasks",void 0);N([g(),v("design:type",He)],$t.prototype,"friends",void 0);N([g(),v("design:type",He)],$t.prototype,"trustedAgents",void 0);N([g(),v("design:type",He)],$t.prototype,"knownLinkLanguages",void 0);$t=N([H()],$t);var ta=class{};N([g(),v("design:type",String)],ta.prototype,"email",void 0);N([g(),v("design:type",String)],ta.prototype,"did",void 0);N([g(),v("design:type",String)],ta.prototype,"lastSeen",void 0);N([g(),v("design:type",Number)],ta.prototype,"perspectiveCount",void 0);ta=N([H()],ta);var en=class{};N([g(),v("design:type",Boolean)],en.prototype,"success",void 0);N([g(),v("design:type",String)],en.prototype,"message",void 0);N([g(),v("design:type",Boolean)],en.prototype,"requiresPassword",void 0);N([g(),v("design:type",Boolean)],en.prototype,"isExistingUser",void 0);en=N([H()],en);var V=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Xr}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Xr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Xr}]}runtimeMessageReceived(){return Xr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:jl.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,i){return new Hi("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,i){return!0}};N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeQuit",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeOpenLink",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Xn)],V.prototype,"runtimeInfo",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"addTrustedAgents",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"deleteTrustedAgents",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"getTrustedAgents",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"runtimeKnownLinkLanguageTemplates",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"runtimeAddKnownLinkLanguageTemplates",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"runtimeFriends",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"runtimeAddFriends",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"runtimeRemoveFriends",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],V.prototype,"runtimeHcAgentInfos",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],V.prototype,"runtimeGetNetworkMetrics",null);N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeRestartHolochain",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Object]),v("design:returntype",Boolean)],V.prototype,"runtimeHcAddAgentInfos",null);N([Rt(),X(0,Y()),X(1,Y()),X(2,Y()),X(3,Y()),v("design:type",Function),v("design:paramtypes",[String,String,String,String]),v("design:returntype",void 0)],V.prototype,"runtimeVerifyStringSignedByDid",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[yr]),v("design:returntype",Boolean)],V.prototype,"runtimeSetStatus",null);N([Rt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Gi)],V.prototype,"runtimeFriendStatus",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,sc]),v("design:returntype",Boolean)],V.prototype,"runtimeFriendSendMessage",null);N([Rt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],V.prototype,"runtimeMessageInbox",null);N([Rt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],V.prototype,"runtimeMessageOutbox",null);N([Vl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Gi)],V.prototype,"runtimeMessageReceived",null);N([Vl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Xi)],V.prototype,"exceptionOccurred",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Wt]),v("design:returntype",String)],V.prototype,"runtimeRequestInstallNotification",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"runtimeNotifications",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,Wt]),v("design:returntype",Boolean)],V.prototype,"runtimeUpdateNotification",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeRemoveNotification",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeGrantNotification",null);N([Vl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",ea)],V.prototype,"runtimeNotificationTriggered",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeExportDb",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeImportDb",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",Boolean)],V.prototype,"runtimeExportPerspective",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeImportPerspective",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeMultiUserEnabled",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",Boolean)],V.prototype,"runtimeSetMultiUserEnabled",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"runtimeListUsers",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,vr]),v("design:returntype",en)],V.prototype,"runtimeRequestLoginVerification",null);N([ve(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,String]),v("design:returntype",String)],V.prototype,"runtimeVerifyEmailCode",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeTestEmail",null);N([ve(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,vr]),v("design:returntype",Hi)],V.prototype,"runtimeCreateUser",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",String)],V.prototype,"runtimeLoginUser",null);N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeEmailTestModeEnable",null);N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeEmailTestModeDisable",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",String)],V.prototype,"runtimeEmailTestGetCode",null);N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeEmailTestClearCodes",null);N([ve(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,Number]),v("design:returntype",Boolean)],V.prototype,"runtimeEmailTestSetExpiry",null);V=N([Yv()],V);var Ma=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ge=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},mt,Ys,Xs,je;function ec(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Th(r){return r?`triple("${r}", "ad4m://has_child", Base)`:""}function kh(){return`
|
|
1511
|
+
`,N=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},v=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},X=function(r,e){return function(t,i){e(t,i,r)}},ko=new ai;ko.author="did:ad4m:test";ko.timestamp=Date.now();ko.data={source:"root",target:"neighbourhood://Qm12345"};ko.proof={signature:"",key:"",valid:!0};var Xr=new Hi;Xr.author="did:ad4m:test";Xr.timestamp=Date.now().toString();Xr.proof=new Dr("","");Xr.data=new yr([ko]);var Ec=class{};N([y(),v("design:type",String)],Ec.prototype,"recipient",void 0);N([y(),v("design:type",Hi)],Ec.prototype,"message",void 0);Ec=N([G()],Ec);var Xn=class{};N([y(),v("design:type",String)],Xn.prototype,"ad4mExecutorVersion",void 0);N([y(),v("design:type",Boolean)],Xn.prototype,"isInitialized",void 0);N([y(),v("design:type",Boolean)],Xn.prototype,"isUnlocked",void 0);Xn=N([G()],Xn);var Xi=class{};N([y(),v("design:type",String)],Xi.prototype,"title",void 0);N([y(),v("design:type",String)],Xi.prototype,"message",void 0);N([y(),v("design:type",String)],Xi.prototype,"type",void 0);N([y(),v("design:type",String)],Xi.prototype,"addon",void 0);Xi=N([G()],Xi);var Wt=class{};N([y(),v("design:type",String)],Wt.prototype,"description",void 0);N([y(),v("design:type",String)],Wt.prototype,"appName",void 0);N([y(),v("design:type",String)],Wt.prototype,"appUrl",void 0);N([y(),v("design:type",String)],Wt.prototype,"appIconPath",void 0);N([y(),v("design:type",String)],Wt.prototype,"trigger",void 0);N([y(),v("design:type",Array)],Wt.prototype,"perspectiveIds",void 0);N([y(),v("design:type",String)],Wt.prototype,"webhookUrl",void 0);N([y(),v("design:type",String)],Wt.prototype,"webhookAuth",void 0);Wt=N([Ke()],Wt);var Dt=class{};N([y(),v("design:type",String)],Dt.prototype,"id",void 0);N([y(),v("design:type",Boolean)],Dt.prototype,"granted",void 0);N([y(),v("design:type",String)],Dt.prototype,"description",void 0);N([y(),v("design:type",String)],Dt.prototype,"appName",void 0);N([y(),v("design:type",String)],Dt.prototype,"appUrl",void 0);N([y(),v("design:type",String)],Dt.prototype,"appIconPath",void 0);N([y(),v("design:type",String)],Dt.prototype,"trigger",void 0);N([y(),v("design:type",Array)],Dt.prototype,"perspectiveIds",void 0);N([y(),v("design:type",String)],Dt.prototype,"webhookUrl",void 0);N([y(),v("design:type",String)],Dt.prototype,"webhookAuth",void 0);Dt=N([G()],Dt);var ea=class{};N([y(),v("design:type",Dt)],ea.prototype,"notification",void 0);N([y(),v("design:type",String)],ea.prototype,"perspectiveId",void 0);N([y(),v("design:type",String)],ea.prototype,"triggerMatch",void 0);ea=N([G()],ea);var Ge=class{};N([y(),v("design:type",Number)],Ge.prototype,"total",void 0);N([y(),v("design:type",Number)],Ge.prototype,"imported",void 0);N([y(),v("design:type",Number)],Ge.prototype,"failed",void 0);N([y(),v("design:type",Number)],Ge.prototype,"omitted",void 0);N([y(),v("design:type",Array)],Ge.prototype,"errors",void 0);Ge=N([G()],Ge);var $t=class{};N([y(),v("design:type",Ge)],$t.prototype,"perspectives",void 0);N([y(),v("design:type",Ge)],$t.prototype,"links",void 0);N([y(),v("design:type",Ge)],$t.prototype,"expressions",void 0);N([y(),v("design:type",Ge)],$t.prototype,"perspectiveDiffs",void 0);N([y(),v("design:type",Ge)],$t.prototype,"notifications",void 0);N([y(),v("design:type",Ge)],$t.prototype,"models",void 0);N([y(),v("design:type",Ge)],$t.prototype,"defaultModels",void 0);N([y(),v("design:type",Ge)],$t.prototype,"tasks",void 0);N([y(),v("design:type",Ge)],$t.prototype,"friends",void 0);N([y(),v("design:type",Ge)],$t.prototype,"trustedAgents",void 0);N([y(),v("design:type",Ge)],$t.prototype,"knownLinkLanguages",void 0);$t=N([G()],$t);var ta=class{};N([y(),v("design:type",String)],ta.prototype,"email",void 0);N([y(),v("design:type",String)],ta.prototype,"did",void 0);N([y(),v("design:type",String)],ta.prototype,"lastSeen",void 0);N([y(),v("design:type",Number)],ta.prototype,"perspectiveCount",void 0);ta=N([G()],ta);var en=class{};N([y(),v("design:type",Boolean)],en.prototype,"success",void 0);N([y(),v("design:type",String)],en.prototype,"message",void 0);N([y(),v("design:type",Boolean)],en.prototype,"requiresPassword",void 0);N([y(),v("design:type",Boolean)],en.prototype,"isExistingUser",void 0);en=N([G()],en);var V=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Xr}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Xr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Xr}]}runtimeMessageReceived(){return Xr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:jl.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,i){return new Gi("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,i){return!0}};N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeQuit",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeOpenLink",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Xn)],V.prototype,"runtimeInfo",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"addTrustedAgents",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"deleteTrustedAgents",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"getTrustedAgents",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"runtimeKnownLinkLanguageTemplates",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"runtimeAddKnownLinkLanguageTemplates",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"runtimeFriends",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"runtimeAddFriends",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],V.prototype,"runtimeRemoveFriends",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],V.prototype,"runtimeHcAgentInfos",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],V.prototype,"runtimeGetNetworkMetrics",null);N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeRestartHolochain",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Object]),v("design:returntype",Boolean)],V.prototype,"runtimeHcAddAgentInfos",null);N([Rt(),X(0,Y()),X(1,Y()),X(2,Y()),X(3,Y()),v("design:type",Function),v("design:paramtypes",[String,String,String,String]),v("design:returntype",void 0)],V.prototype,"runtimeVerifyStringSignedByDid",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[yr]),v("design:returntype",Boolean)],V.prototype,"runtimeSetStatus",null);N([Rt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Hi)],V.prototype,"runtimeFriendStatus",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,sc]),v("design:returntype",Boolean)],V.prototype,"runtimeFriendSendMessage",null);N([Rt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],V.prototype,"runtimeMessageInbox",null);N([Rt(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],V.prototype,"runtimeMessageOutbox",null);N([Vl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Hi)],V.prototype,"runtimeMessageReceived",null);N([Vl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Xi)],V.prototype,"exceptionOccurred",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Wt]),v("design:returntype",String)],V.prototype,"runtimeRequestInstallNotification",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"runtimeNotifications",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,Wt]),v("design:returntype",Boolean)],V.prototype,"runtimeUpdateNotification",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeRemoveNotification",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeGrantNotification",null);N([Vl(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",ea)],V.prototype,"runtimeNotificationTriggered",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeExportDb",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeImportDb",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",Boolean)],V.prototype,"runtimeExportPerspective",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeImportPerspective",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeMultiUserEnabled",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",Boolean)],V.prototype,"runtimeSetMultiUserEnabled",null);N([Rt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],V.prototype,"runtimeListUsers",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,vr]),v("design:returntype",en)],V.prototype,"runtimeRequestLoginVerification",null);N([ve(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,String]),v("design:returntype",String)],V.prototype,"runtimeVerifyEmailCode",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],V.prototype,"runtimeTestEmail",null);N([ve(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,vr]),v("design:returntype",Gi)],V.prototype,"runtimeCreateUser",null);N([ve(),X(0,Y()),X(1,Y()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",String)],V.prototype,"runtimeLoginUser",null);N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeEmailTestModeEnable",null);N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeEmailTestModeDisable",null);N([ve(),X(0,Y()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",String)],V.prototype,"runtimeEmailTestGetCode",null);N([ve(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],V.prototype,"runtimeEmailTestClearCodes",null);N([ve(),X(0,Y()),X(1,Y()),X(2,Y()),v("design:type",Function),v("design:paramtypes",[String,String,Number]),v("design:returntype",Boolean)],V.prototype,"runtimeEmailTestSetExpiry",null);V=N([Yv()],V);var Ma=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},oe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},ct,Ys,Xs,Te;function ec(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Th(r){return r?`triple("${r}", "ad4m://has_child", Base)`:""}function kh(){return`
|
|
1511
1512
|
findall(
|
|
1512
1513
|
[T, A],
|
|
1513
1514
|
link(Base, _, _, T, A),
|
|
@@ -1529,19 +1530,19 @@ input VoiceActivityParamsInput {
|
|
|
1529
1530
|
collection(SubjectClass, CollectionName),
|
|
1530
1531
|
collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
|
|
1531
1532
|
), Collections)
|
|
1532
|
-
`}function Oh(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,i])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=ec(t);if(Array.isArray(i)){let s=i.map(c=>e(c)).join(", ");return n?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof i=="object"&&i!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:f}=i;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return n?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return n?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:f,symbol:">="}];for(let{value:h,symbol:m}of p)if(h!==void 0)return n?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return n?`${o} = ${e(i)}`:`${a}, Value${t} = ${e(i)}`}).join(", ")}function Ch(r){return r?"length(UnsortedInstances, TotalCount)":""}function Nh(r){if(!r)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(r)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function Dh(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function $h(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Rh(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),i=(t||"").replace(/\/+$/,"");return`${e}://${i}`}else return r.replace(/\/+$/,"")}function np(r){if(!!r){if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r.find(t=>t!=="null")||r[0]}}function Mm(r,e){return np(r.type)===e}function Ph(r){return Mm(r,"array")}function Lh(r){return Mm(r,"object")}function S_(r){let e=np(r.type);return e==="number"||e==="integer"}var Bi=class{static async getClassName(e){if(this===Bi)return await e.stringOrTemplateObjectToSubjectClassName(this);let i=this.classNamesByClass.get(this);i||(i={},this.classNamesByClass.set(this,i));let n=e.uuid;return i[n]||(i[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),i[n]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let t=e.className,i={},n=e.__properties||{};for(let[l,d]of Object.entries(n)){let f=d;i[l]={name:l,predicate:f.through||"",required:f.required||!1,writable:f.writable||!1,...f.initial!==void 0&&{initial:f.initial},...f.resolveLanguage!==void 0&&{resolveLanguage:f.resolveLanguage},...f.
|
|
1533
|
+
`}function Oh(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,i])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=ec(t);if(Array.isArray(i)){let s=i.map(c=>e(c)).join(", ");return n?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof i=="object"&&i!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:f}=i;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return n?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return n?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:f,symbol:">="}];for(let{value:h,symbol:m}of p)if(h!==void 0)return n?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return n?`${o} = ${e(i)}`:`${a}, Value${t} = ${e(i)}`}).join(", ")}function Ch(r){return r?"length(UnsortedInstances, TotalCount)":""}function Nh(r){if(!r)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(r)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function Dh(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function $h(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Rh(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),i=(t||"").replace(/\/+$/,"");return`${e}://${i}`}else return r.replace(/\/+$/,"")}function np(r){if(!!r){if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r.find(t=>t!=="null")||r[0]}}function Mm(r,e){return np(r.type)===e}function Ph(r){return Mm(r,"array")}function Lh(r){return Mm(r,"object")}function S_(r){let e=np(r.type);return e==="number"||e==="integer"}var Bi=class{static async getClassName(e){if(this===Bi)return await e.stringOrTemplateObjectToSubjectClassName(this);let i=this.classNamesByClass.get(this);i||(i={},this.classNamesByClass.set(this,i));let n=e.uuid;return i[n]||(i[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),i[n]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let t=e.className,i={},n=e.__properties||{};for(let[l,d]of Object.entries(n)){let f=d;i[l]={name:l,predicate:f.through||"",required:f.required||!1,writable:f.writable||!1,...f.initial!==void 0&&{initial:f.initial},...f.resolveLanguage!==void 0&&{resolveLanguage:f.resolveLanguage},...f.prologGetter!==void 0&&{prologGetter:f.prologGetter},...f.getter!==void 0&&{getter:f.getter},...f.prologSetter!==void 0&&{prologSetter:f.prologSetter},...f.local!==void 0&&{local:f.local},...f.transform!==void 0&&{transform:f.transform},...f.flag!==void 0&&{flag:f.flag}}}let a={},o=e.__collections||{};for(let[l,d]of Object.entries(o)){let f=d;a[l]={name:l,predicate:f.through||"",...f.where!==void 0&&{where:f.where},...f.local!==void 0&&{local:f.local},...f.getter!==void 0&&{getter:f.getter}}}let s=Object.keys(i).length>0,c=Object.keys(a).length>0;if(!(s||c)&&e.__jsonSchema){let l=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(l.properties)for(let[f,p]of Object.entries(l.properties)){let h=Ph(p),m=this.determinePredicate(l,f,p,this.determineNamespace(l,d),d);if(h)a[f]={name:f,predicate:m,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let g=l.required?.includes(f)||!1;i[f]={name:f,predicate:m,required:g,writable:p["x-ad4m"]?.writable!==!1,...p["x-ad4m"]?.resolveLanguage&&{resolveLanguage:p["x-ad4m"].resolveLanguage},...p["x-ad4m"]?.initial&&{initial:p["x-ad4m"].initial},...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}}}}}return{className:t,properties:i,collections:a}}constructor(e,t,i){ct.set(this,void 0),Ys.set(this,void 0),Xs.set(this,void 0),Te.set(this,void 0),Ma(this,ct,t||it.from(Fm(24)).toUrl(),"f"),Ma(this,Te,e,"f"),Ma(this,Xs,i||"ad4m://self","f")}get baseExpression(){return oe(this,ct,"f")}get perspective(){return oe(this,Te,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,t){if(t.writable===!1)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateCollectionAction(e,t){let i=this.getCollectionMetadata(e);if(!i)throw new Error(`Collection "${e}" has no metadata defined`);if(!i.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:i.through,target:"value",...i.local&&{local:!0}}]}static async assignValuesToInstance(e,t,i){let n=Object.fromEntries(await Promise.all(i.map(async([o,s,c])=>{let u=s;if(!c&&typeof s=="string"){let d=Array.from(s,h=>h.codePointAt(0)),f=d.every(h=>h<=255),p=d.some(h=>h>=128);if(f&&p)try{let h=Uint8Array.from(d),m=new TextDecoder("utf-8",{fatal:!0}).decode(h);m!==s&&(u=m)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${o}"`,{value:s,error:h})}}if(c){let d=await e.getExpression(s);if(d)try{u=JSON.parse(d.data)}catch{u=d.data}}let l=t.__properties?.[o]?.transform;return l&&typeof l=="function"&&(u=l(u)),[o,u]}))),a=Object.fromEntries(Object.entries(n).filter(([o])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),o);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(t,a)}async getData(){try{let e=this.constructor,t=e.getModelMetadata(),n=`
|
|
1533
1534
|
SELECT id, predicate, out.uri AS target, author, timestamp
|
|
1534
1535
|
FROM link
|
|
1535
|
-
WHERE in.uri = ${e.formatSurrealValue(
|
|
1536
|
+
WHERE in.uri = ${e.formatSurrealValue(oe(this,ct,"f"))}
|
|
1536
1537
|
ORDER BY timestamp ASC
|
|
1537
|
-
`,a=await
|
|
1538
|
+
`,a=await oe(this,Te,"f").querySurrealDB(n);if(a&&a.length>0){let o=null,s=null,c=null,u=null;for(let[l,d]of Object.entries(t.properties)){if(d.getter)continue;let f=a.filter(p=>p.predicate===d.predicate);if(f.length>0){let p=f[f.length-1],h=p.target;if(p.timestamp&&((!o||p.timestamp<o)&&(o=p.timestamp,u=p.author),(!s||p.timestamp>s)&&(s=p.timestamp,c=p.author)),d.resolveLanguage&&d.resolveLanguage!=="literal")try{let m=await oe(this,Te,"f").getExpression(h);if(m)try{h=JSON.parse(m.data)}catch{h=m.data}}catch(m){console.warn(`Failed to resolve expression for ${l}:`,m)}else if(typeof h=="string"&&h.startsWith("literal://"))try{let m=it.fromUrl(h).get();h=m.data!==void 0?m.data:m}catch{}d.transform&&typeof d.transform=="function"&&(h=d.transform(h)),this[l]=h}}for(let[l,d]of Object.entries(t.collections)){if(d.getter)continue;let p=a.filter(h=>h.predicate===d.predicate).map(h=>h.target);if(d.where?.condition&&p.length>0)try{let h=[];for(let m of p){let g=d.where.condition.replace(/\$perspective/g,`'${oe(this,Te,"f").uuid}'`).replace(/\$base/g,`'${oe(this,ct,"f")}'`).replace(/Target/g,`'${m.replace(/'/g,"\\'")}'`);g.trim().startsWith("WHERE")&&(g=`array::len(SELECT * FROM link ${g}) > 0`);let w=`RETURN ${g}`,_=await oe(this,Te,"f").querySurrealDB(w);(_===!0||Array.isArray(_)&&_.length>0&&_[0]===!0)&&h.push(m)}p=h}catch(h){console.warn(`Failed to apply condition filter for ${l}:`,h)}if(d.where?.isInstance&&p.length>0)try{let h=typeof d.where.isInstance=="string"?d.where.isInstance:d.where.isInstance.name,m=await oe(this,Te,"f").getSubjectClassMetadataFromSDNA(h);m&&(p=await oe(this,Te,"f").batchCheckSubjectInstances(p,m))}catch{}this[l]=p}u&&(this.author=u),o&&(this.createdAt=o),s&&(this.updatedAt=s)}await e.evaluateCustomGettersForInstance(this,oe(this,Te,"f"),t);for(let[o,s]of Object.entries(t.collections))if(s.getter&&s.where?.isInstance&&this[o]?.length>0)try{let c=typeof s.where.isInstance=="string"?s.where.isInstance:s.where.isInstance.name,u=await oe(this,Te,"f").getSubjectClassMetadataFromSDNA(c);if(u){let l=await oe(this,Te,"f").batchCheckSubjectInstances(this[o],u);this[o]=l}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${oe(this,ct,"f")}:`,e)}return this}static async queryToProlog(e,t,i){let{source:n,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:d}=t,f=i||await this.getClassName(e),p=[kh(),Th(n),w_(a),__(o),Oh(s)],h=[Ch(d),Nh(c),Dh(u),$h(l)];return`
|
|
1538
1539
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1539
1540
|
subject_class("${f}", SubjectClass),
|
|
1540
1541
|
instance(SubjectClass, Base),
|
|
1541
|
-
${p.filter(
|
|
1542
|
+
${p.filter(g=>g).join(", ")}
|
|
1542
1543
|
), UnsortedInstances),
|
|
1543
|
-
${h.filter(
|
|
1544
|
-
`}static async
|
|
1544
|
+
${h.filter(g=>g).join(", ")}
|
|
1545
|
+
`}static async evaluateCustomGettersForInstance(e,t,i){let n=this.formatSurrealValue(e.baseExpression);for(let[a,o]of Object.entries(i.properties))if(o.getter)try{let s=o.getter.replace(/Base/g,n),c=await t.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${n}`);c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null&&c[0].value!=="None"&&c[0].value!==""&&(e[a]=c[0].value)}catch(s){console.warn(`Failed to evaluate getter for ${a}:`,s)}for(let[a,o]of Object.entries(i.collections))if(o.getter)try{let s=o.getter.replace(/Base/g,n),c=await t.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${n}`);if(c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null){let u=c[0].value;e[a]=Array.isArray(u)?u.filter(l=>l!=null&&l!==""&&l!=="None"):u}}catch(s){console.warn(`Failed to evaluate getter for ${a}:`,s)}}static async queryToSurrealQL(e,t){let i=this.getModelMetadata(),{source:n,where:a,order:o,offset:s,limit:c}=t,u=[];n&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(n)} AND predicate = 'ad4m://has_child']) > 0`);for(let[p,h]of Object.entries(i.properties))h.required&&(h.flag&&h.initial?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${xe(h.predicate)}' AND out.uri = '${xe(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${xe(h.predicate)}']) > 0`));if(u.length===0){for(let[p,h]of Object.entries(i.properties))if(h.initial){h.flag?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${xe(h.predicate)}' AND out.uri = '${xe(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${xe(h.predicate)}']) > 0`);break}}let l=this.buildGraphTraversalWhereClause(i,a),d=[];return d.push(...u),l&&d.push(l),d.push("count(->link[WHERE perspective = $perspective]) > 0"),`
|
|
1545
1546
|
SELECT
|
|
1546
1547
|
id AS source,
|
|
1547
1548
|
uri AS source_uri,
|
|
@@ -1550,20 +1551,20 @@ FROM node
|
|
|
1550
1551
|
WHERE ${d.join(" AND ")}
|
|
1551
1552
|
`.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let i=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");i.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");i.push(`${s} NOT IN [${u}]`)}else i.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&i.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&i.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&i.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&i.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&i.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&i.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else i.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[n];if(!s)continue;let c=xe(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${l}]]) > 0`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let f=l.not.map(p=>this.formatSurrealValue(p)).join(", ");i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${f}]]) = 0`)}else i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(l.not)}]) = 0`);(l.gt!==void 0||l.gte!==void 0||l.lt!==void 0||l.lte!==void 0||l.between!==void 0||l.contains!==void 0)&&i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else i.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)}]) > 0`)}return i.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let i=[];for(let[n,a]of Object.entries(t))if(["base","author","timestamp"].includes(n)){if(n==="author"||n==="timestamp")continue;let s="source";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");i.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");i.push(`${s} NOT IN [${u}]`)}else i.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&i.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&i.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&i.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&i.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&i.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&i.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else i.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[n];if(!s)continue;let c=xe(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${l}])`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let f=l.not.map(p=>this.formatSurrealValue(p)).join(", ");i.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${f}])`)}else i.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(l.not)})`);(l.gt!==void 0||l.gte!==void 0||l.lt!==void 0||l.lte!==void 0||l.between!==void 0||l.contains!==void 0)&&i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else i.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)})`)}return i.join(" AND ")}static buildSurrealSelectFields(e,t,i){let n=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=xe(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}' LIMIT 1) AS ${s}`)}let o=i||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=xe(c.predicate);n.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}') AS ${s}`)}return n.push("(SELECT VALUE author FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS author"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS createdAt"),n.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp DESC LIMIT 1) AS updatedAt"),n.join(`,
|
|
1552
1553
|
`)}static buildSurrealSelectFieldsWithAggregation(e,t,i){let n=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=xe(c.predicate);n.push(`array::first(target[WHERE predicate = '${u}']) AS ${s}`)}let o=i||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=xe(c.predicate);n.push(`target[WHERE predicate = '${u}'] AS ${s}`)}return n.push("array::first(author) AS author"),n.push("array::first(timestamp) AS createdAt"),n.push("array::last(timestamp) AS updatedAt"),n.join(`,
|
|
1553
|
-
`)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>this.formatSurrealValue(t)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,t,i){if(!i?.[0]?.AllInstances)return{results:[],totalCount:0};let n=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(i[0].AllInstances.map(async([o,s,c,u,l])=>{try{let d=new this(e,o);n.length&&Object.keys(d).forEach(p=>{n.includes(p)||delete d[p]});let f=[...s,...c,["
|
|
1554
|
+
`)}static formatSurrealValue(e){return typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>this.formatSurrealValue(t)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,t,i){if(!i?.[0]?.AllInstances)return{results:[],totalCount:0};let n=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(i[0].AllInstances.map(async([o,s,c,u,l])=>{try{let d=new this(e,o);n.length&&Object.keys(d).forEach(p=>{n.includes(p)||delete d[p]});let f=[...s,...c,["createdAt",u],["author",l]];return await Bi.assignValuesToInstance(e,d,f),d}catch(d){return console.error(`Failed to process instance ${o}:`,d),null}}))).filter(o=>o!==null),totalCount:i[0].TotalCount}}static async instancesFromSurrealResult(e,t,i){if(!i||i.length===0)return{results:[],totalCount:0};let n=this.getModelMetadata(),a=t?.properties||[],o=t?.collections||[],s=[];for(let f of i){let p;try{if(p=f.source_uri,!p)continue;let h=f.links||[],m=new this(e,p),g=null,w=null,_=null,S=null;for(let b=0;b<h.length;b++){let O=h[b],D=O.predicate,E=O.target;if(E==="None")continue;O.timestamp&&((!g||O.timestamp<g)&&(g=O.timestamp,_=O.author),(!w||O.timestamp>w)&&(w=O.timestamp,S=O.author));let $=!1;for(let[P,R]of Object.entries(n.properties))if(!R.getter&&R.predicate===D){let M=m[P],Ae=typeof M=="object"&&M!==null&&!Array.isArray(M)&&Object.keys(M).length===0;if(!M||M===""||M===0||Ae){let se=E;if(E!=null&&E!==""){if(R.resolveLanguage!=null&&R.resolveLanguage!=="literal"&&typeof E=="string")try{let j=await e.getExpression(E);if(j)try{se=JSON.parse(j.data)}catch{se=j.data}}catch(j){console.warn(`Failed to resolve expression for ${P} with target "${E}":`,j),console.warn("Falling back to raw value"),se=E}else if(typeof E=="string"&&E.startsWith("literal://"))try{let j=it.fromUrl(E).get();j.data!==void 0?se=j.data:se=j}catch{se=E}else if(typeof E=="string"){let j=typeof m[P];j==="number"?se=Number(E):j==="boolean"&&(se=E==="true"||E==="1")}}R.transform&&typeof R.transform=="function"&&(se=R.transform(se)),m[P]=se}$=!0;break}if(!$){for(let[P,R]of Object.entries(n.collections))if(!R.getter&&R.predicate===D){m[P]||(m[P]=[]);let M=`__${P}_timestamps`,Ae=`__${P}_indices`;m[M]||(m[M]=[]),m[Ae]||(m[Ae]=[]),m[P].includes(E)||(m[P].push(E),m[M].push(O.timestamp||""),m[Ae].push(b));break}}}if(_&&(m.author=_),g)if(typeof g=="string"&&g.includes("T"))m.createdAt=new Date(g).getTime();else if(typeof g=="string"){let b=parseInt(g,10);m.createdAt=isNaN(b)?g:b}else m.createdAt=g;if(w)if(typeof w=="string"&&w.includes("T"))m.updatedAt=new Date(w).getTime();else if(typeof w=="string"){let b=parseInt(w,10);m.updatedAt=isNaN(b)?w:b}else m.updatedAt=w;for(let[b,O]of Object.entries(n.collections)){let D=`__${b}_timestamps`,E=`__${b}_indices`;if(m[b]&&m[D]){let $=m[b].map((P,R)=>({value:P,timestamp:m[D][R]||"",originalIndex:m[E]?.[R]??R}));$.sort((P,R)=>{let M=String(P.timestamp||""),Ae=String(R.timestamp||""),se=M.localeCompare(Ae);return se!==0?se:P.originalIndex-R.originalIndex}),m[b]=$.map(P=>P.value).filter(P=>P!=null&&P!==""&&P!=="None"),delete m[D],delete m[E]}}if(a.length>0||o.length>0){let b=[...a,...o];Object.keys(m).forEach(O=>{!b.includes(O)&&O!=="createdAt"&&O!=="updatedAt"&&O!=="author"&&O!=="baseExpression"&&delete m[O]})}s.push(m)}catch(h){console.error(`Failed to process SurrealDB instance ${p}:`,h)}}for(let f of s)await this.evaluateCustomGettersForInstance(f,e,n);for(let f of s)for(let[p,h]of Object.entries(n.collections))if(h.where?.isInstance&&f[p]?.length>0)try{let m=h.where.isInstance,g=f[p],w=typeof m=="string"?m:m.prototype?.className||m.name,_=await e.getSubjectClassMetadataFromSDNA(w);if(!_)continue;let S=await e.batchCheckSubjectInstances(g,_);f[p]=S}catch{}let c=s;t.where&&(c=s.filter(f=>{for(let[p,h]of Object.entries(t.where))if(p!=="base"){if(p==="author"||p==="timestamp"){if(!this.matchesCondition(f[p],h))return!1;continue}if(typeof h=="object"&&h!==null&&!Array.isArray(h)){let m=h;if((m.gt!==void 0||m.gte!==void 0||m.lt!==void 0||m.lte!==void 0||m.between!==void 0||m.contains!==void 0)&&!this.matchesCondition(f[p],h))return!1}}return!0}));let u=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(u){let f=Object.keys(u)[0],p=Object.values(u)[0];c.sort((h,m)=>{let g=h[f],w=m[f];if(g===void 0&&w===void 0)return 0;if(g===void 0)return p==="ASC"?1:-1;if(w===void 0)return p==="ASC"?-1:1;let _=0;return typeof g=="number"&&typeof w=="number"?_=g-w:typeof g=="string"&&typeof w=="string"?_=g.localeCompare(w):_=String(g).localeCompare(String(w)),p==="DESC"?-_:_})}let l=c.length,d=c;if(t.offset!==void 0||t.limit!==void 0){let f=t.offset||0,p=t.limit?f+t.limit:void 0;d=c.slice(f,p)}return{results:d,totalCount:l}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let i=t;if(i.not!==void 0)return Array.isArray(i.not)?!i.not.includes(e):e!==i.not;if(i.between!==void 0&&Array.isArray(i.between)&&i.between.length===2)return e>=i.between[0]&&e<=i.between[1];let n=!0;return i.gt!==void 0&&(n=n&&e>i.gt),i.gte!==void 0&&(n=n&&e>=i.gte),i.lt!==void 0&&(n=n&&e<i.lt),i.lte!==void 0&&(n=n&&e<=i.lte),i.contains!==void 0&&(typeof e=="string"?n=n&&e.includes(String(i.contains)):Array.isArray(e)?n=n&&e.includes(i.contains):n=!1),n}return e===t}static async findAll(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{results:o}=await this.instancesFromSurrealResult(e,t,a);return o}else{let n=await this.queryToProlog(e,t),a=await e.infer(n),{results:o}=await this.instancesFromPrologResult(e,t,a);return o}}static async findAllAndCount(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n);return await this.instancesFromSurrealResult(e,t,a)}else{let n=await this.queryToProlog(e,t),a=await e.infer(n);return await this.instancesFromPrologResult(e,t,a)}}static async paginate(e,t,i,n,a=!0){let o={...n||{},limit:t,offset:t*(i-1),count:!0};if(a){let s=await this.queryToSurrealQL(e,o),c=await e.querySurrealDB(s),{results:u,totalCount:l}=await this.instancesFromSurrealResult(e,o,c);return{results:u,totalCount:l,pageSize:t,pageNumber:i}}else{let s=await this.queryToProlog(e,o),c=await e.infer(s),{results:u,totalCount:l}=await this.instancesFromPrologResult(e,o,c);return{results:u,totalCount:l,pageSize:t,pageNumber:i}}}static async countQueryToProlog(e,t={},i){let{source:n,where:a}=t,o=i||await this.getClassName(e),s=[kh(),Th(n),Oh(a)],c=[Ch(!0),Nh(),Dh(),$h()];return`
|
|
1554
1555
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1555
1556
|
subject_class("${o}", SubjectClass),
|
|
1556
1557
|
instance(SubjectClass, Base),
|
|
1557
1558
|
${s.filter(l=>l).join(", ")}
|
|
1558
1559
|
), UnsortedInstances),
|
|
1559
1560
|
${c.filter(l=>l).join(", ")}
|
|
1560
|
-
`}static async countQueryToSurrealQL(e,t){let i={...t};return delete i.limit,delete i.offset,await this.queryToSurrealQL(e,i)}static async count(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:o}=await this.instancesFromSurrealResult(e,t,a);return o}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,i){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),o=n.resolveLanguage;o&&(t=await
|
|
1561
|
+
`}static async countQueryToSurrealQL(e,t){let i={...t};return delete i.limit,delete i.offset,await this.queryToSurrealQL(e,i)}static async count(e,t={},i=!0){if(i){let n=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(n),{totalCount:o}=await this.instancesFromSurrealResult(e,t,a);return o}else return(await e.infer(await this.countQueryToProlog(e,t)))?.[0]?.TotalCount||0}async setProperty(e,t,i){let n=this.getPropertyMetadata(e);if(!n){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,n),o=n.resolveLanguage;o&&(t=await oe(this,Te,"f").createExpression(t,o)),await oe(this,Te,"f").executeAction(a,oe(this,ct,"f"),[{name:"value",value:t}],i)}async setCollectionSetter(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");t!=null&&(Array.isArray(t)?await oe(this,Te,"f").executeAction(a,oe(this,ct,"f"),t.map(o=>({name:"value",value:o})),i):await oe(this,Te,"f").executeAction(a,oe(this,ct,"f"),[{name:"value",value:t}],i))}async setCollectionAdder(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(o=>oe(this,Te,"f").executeAction(a,oe(this,ct,"f"),[{name:"value",value:o}],i))):await oe(this,Te,"f").executeAction(a,oe(this,ct,"f"),[{name:"value",value:t}],i))}async setCollectionRemover(e,t,i){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(o=>oe(this,Te,"f").executeAction(a,oe(this,ct,"f"),[{name:"value",value:o}],i))):await oe(this,Te,"f").executeAction(a,oe(this,ct,"f"),[{name:"value",value:t}],i))}async save(e){let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let i={};for(let[n,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(i[n]=a);await this.perspective.createSubject(this,oe(this,ct,"f"),i,e),await oe(this,Te,"f").add(new Wi({source:oe(this,Xs,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),t&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},t=Object.entries(this);for(let[i,n]of t)n!=null&&i!=="author"&&i!=="timestamp"&&(e[i]=n);return e}async innerUpdate(e=!0,t){Ma(this,Ys,await oe(this,Te,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let i=Object.entries(this);for(let[n,a]of i)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(n,a.value,t);break;case"adder":await this.setCollectionAdder(n,a.value,t);break;case"remover":await this.setCollectionRemover(n,a.value,t);break;default:await this.setCollectionSetter(n,a.value,t);break}else if(Array.isArray(a))await this.setCollectionSetter(n,a,t);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(n))continue;await this.setProperty(n,a,t)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return Ma(this,Ys,await oe(this,Te,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await oe(this,Te,"f").removeSubject(this,oe(this,ct,"f"),e)}static query(e,t){return new Bl(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let i=this.determineNamespace(e,t),n=class extends Bi{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");n.className=t.name,n.prototype.className=t.name;let a={},o={};if(e.properties)for(let[u,l]of Object.entries(e.properties)){let d=this.determinePredicate(e,u,l,i,t),f=e.required?.includes(u)||!1,p=np(l.type);if(Ph(l)){o[u]={through:d,local:this.getPropertyOption(u,l,t,"local")},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:[]});let m=`add${ec(u)}`,g=`remove${ec(u)}`,w=`setCollection${ec(u)}`;n.prototype[m]=function(){},n.prototype[g]=function(){},n.prototype[w]=function(){}}else{let m=this.getPropertyOption(u,l,t,"resolveLanguage");!m&&t.resolveLanguage&&(m=t.resolveLanguage);let g=this.getPropertyOption(u,l,t,"local"),w=this.getPropertyOption(u,l,t,"writable",!0),_=this.getPropertyOption(u,l,t,"initial");if(Lh(l)&&!m&&(m="literal",console.warn(`Property "${u}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),m==null&&S_(l)&&(m="literal"),f&&!_&&(Lh(l)?_="literal://json:{}":_="ad4m://undefined"),a[u]={through:d,required:f,writable:w,...m&&{resolveLanguage:m},...g!==void 0&&{local:g},..._&&{initial:_}},Object.defineProperty(n.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(p)}),w){let S=Wl(u);n.prototype[S]=function(){}}}}if(!Object.values(a).some(u=>u.initial)){let u="ad4m://type",l;if(i.includes("://")){let[d,f]=i.split("://"),p=(f||"").replace(/\/+$/,"");p?l=`${d}://${p}/instance`:l=`${d}://instance`}else l=`${i.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:u,required:!0,writable:!1,initial:l,flag:!0},Object.defineProperty(n.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:l}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${l}`)}return n.prototype.__properties=a,n.prototype.__collections=o,n.prototype.__jsonSchema=e,n.prototype.__jsonSchemaOptions=t,b_({name:t.name})(n),n}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let n=new URL(e.$id).pathname.split("/").filter(a=>a);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
|
|
1561
1562
|
- options.namespace
|
|
1562
1563
|
- schema["x-ad4m"].namespace
|
|
1563
1564
|
- schema.title
|
|
1564
|
-
- valid schema.$id`)}static determinePredicate(e,t,i,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(i["x-ad4m"]?.through)return i["x-ad4m"].through;if(a.predicateTemplate){let s=Rh(n),[c,u]=s.includes("://")?s.split("://"):["",s],l=u||"";return a.predicateTemplate.replace("${namespace}",l).replace("${scheme}",c).replace("${ns}",l).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let o=Rh(n);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,i,n,a){return i.propertyOptions?.[e]?.[n]!==void 0?i.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:i[n]!==void 0?i[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};mt=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,je=new WeakMap;Bi.classNamesByClass=new WeakMap;var Bl=class{constructor(e,t,i){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return i}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,i),a=await this.perspective.querySurrealDB(n),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,i){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);i({results:l,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);i({results:l,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}};var E_=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function Oo(r,{include:e,exclude:t}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of E_(r.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var x_=12e3,Co=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;Oo(this),this.options=t,this.port=t.port||parseInt(Ss("ad4m-port"))||x_,this.url=t.url||Ss("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Ss("ad4m-token")||"",this.embedded=_s(),this.embedded&&this.initializeEmbeddedMode()}connect(){return J(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((t,i)=>{let n=setTimeout(()=>{i(new Error("Timeout waiting for AD4M config from parent window"))},3e4);this.embeddedResolve=a=>{clearTimeout(n),console.log("[Ad4m Connect] Successfully connected in embedded mode"),t(a)},this.embeddedReject=a=>{clearTimeout(n),i(a)},this.ad4mClient&&(this.authState==="authenticated"?(clearTimeout(n),console.log("[Ad4m Connect] Client already initialized in embedded mode"),t(this.ad4mClient)):(clearTimeout(n),i(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield Rn(this.url),kt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(t){throw console.error("[Ad4m Connect] Connection failed:",t),this.notifyConnectionChange("error"),t}})}buildClient(){return J(this,null,function*(){return this.notifyConnectionChange("connecting"),this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=Ku({url:this.url,connectionParams:()=>J(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:t=>{this.activeSocket=t},error:t=>{this.notifyConnectionChange("error")},connected:()=>{this.notifyConnectionChange("connected")},closed:t=>J(this,null,function*(){if(!(t.wasClean||this.requestedRestart))if(!this.token)this.notifyConnectionChange("error");else try{this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(i){console.error("[Ad4m Connect] Reconnection failed:",i),this.notifyConnectionChange("error")}})}}),this.apolloClient=this.createApolloClient(this.wsClient),this.ad4mClient=new wo(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new Gu({link:new bd(t),cache:new hs({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,i){return J(this,null,function*(){let n=Ku({url:t,connectionParams:()=>J(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(n),o=new wo(a);try{return yield i(o)}finally{n.dispose()}})}checkAuth(){return J(this,null,function*(){try{return console.log("[Ad4m Connect] Checking authentication status..."),(yield this.ad4mClient.agent.isLocked())?(console.log("[Ad4m Connect] Agent wallet is locked"),this.notifyAuthChange("locked")):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(t){console.error("[Ad4m Connect] Authentication check failed:",t);let i="Cannot extractByTags from a ciphered wallet. You must unlock first.";return t.message===i?(this.notifyAuthChange("locked"),!0):(t.message==="InvalidSignature"&&(console.log("[Ad4m Connect] Clearing invalid token due to InvalidSignature"),this.token="",Ra("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return J(this,null,function*(){console.log("[Ad4m Connect] Disconnecting..."),this.wsClient&&(this.wsClient.dispose(),this.wsClient=null),this.apolloClient&&(this.apolloClient.stop(),this.apolloClient=null),this.ad4mClient=void 0,this.token="",Ra("ad4m-token"),this.notifyAuthChange("unauthenticated"),this.notifyConnectionChange("not-connected"),console.log("[Ad4m Connect] Disconnected successfully")})}initializeEmbeddedMode(){console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent"),window.addEventListener("message",t=>J(this,null,function*(){var i;if(((i=t.data)==null?void 0:i.type)==="AD4M_CONFIG"){if(t.source!==window.parent){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from invalid source (not parent window)");return}if(this.options.allowedOrigins&&this.options.allowedOrigins.length>0&&(!t.origin||!this.options.allowedOrigins.includes(t.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",t.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${t.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:t.data.port,hasToken:!!t.data.token});let{port:n,token:a}=t.data;if(n==null){let c=new Error("AD4M_CONFIG missing required field: port");console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let o=parseInt(n,10);if(!Number.isFinite(o)||o<=0){let c=new Error(`AD4M_CONFIG invalid port: ${n} (must be a positive integer)`);console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let s=a!=null&&typeof a=="string"?a:"";try{this.port=o,this.token=s,this.url=`ws://localhost:${o}/graphql`,kt("ad4m-port",o.toString()),s?kt("ad4m-token",s):Ra("ad4m-token"),kt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(c){console.error("[Ad4m Connect] Failed to initialize from AD4M_CONFIG:",c),this.rejectEmbedded(c)}}})),console.log("[Ad4m Connect] Requesting AD4M config from parent window"),window.parent.postMessage({type:"REQUEST_AD4M_CONFIG"},"*")}buildAppInfo(){return{appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appDomain:this.options.appInfo.url,appUrl:window.location.origin,appIconPath:this.options.appInfo.iconPath}}requestCapability(t=!1){return J(this,null,function*(){return t&&(this.token="",Ra("ad4m-token"),this.notifyConfigChange("token",this.token)),this.requestId=yield this.ad4mClient.agent.requestCapability({appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appUrl:this.options.appInfo.url,appDomain:this.options.appInfo.url,appIconPath:this.options.appInfo.iconPath,capabilities:this.options.capabilities}),this.requestId})}verifyLocalAd4mCode(t){return J(this,null,function*(){if(!this.requestId)return console.error("[Ad4m Connect] Cannot verify code: requestId is missing. Call requestCapability() first to obtain a requestId."),!1;try{let i=yield this.ad4mClient.agent.generateJwt(this.requestId,t);return this.token=i,kt("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Code verification failed:",i),!1}})}isValidAd4mAPI(){return J(this,null,function*(){try{return yield this.withTempClient(this.url,t=>J(this,null,function*(){return yield t.runtime.info()})),!0}catch(t){return console.error("[Ad4m Connect] Failed to verify AD4M API:",t),!1}})}isMultiUser(){return J(this,null,function*(){try{return yield this.withTempClient(this.url,t=>J(this,null,function*(){return yield t.runtime.multiUserEnabled()}))}catch(t){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",t),!1}})}submitEmail(t){return J(this,null,function*(){try{return yield this.withTempClient(this.url,i=>J(this,null,function*(){return yield i.agent.requestLoginVerification(t,this.buildAppInfo())}))}catch(i){return{success:!1,message:i.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(t,i){return J(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>J(this,null,function*(){return yield a.agent.verifyEmailCode(t,i,"login")}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Email code verification failed:",n),!1}})}loginWithPassword(t,i){return J(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>J(this,null,function*(){return yield a.agent.loginUser(t,i)}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Password login failed:",n),!1}})}createAccount(t,i){return J(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>J(this,null,function*(){let o=yield a.agent.createUser(t,i);if(o.success)return yield a.agent.loginUser(t,i);throw new Error(o.error||"Failed to create account")}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Account creation error:",n),!1}})}resolveEmbedded(t){this.embeddedResolve&&(this.embeddedResolve(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(t){this.embeddedReject&&(this.embeddedReject(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(t){this.connectionState!==t&&(this.connectionState=t,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:t})))}notifyAuthChange(t){if(this.authState=t,this.dispatchEvent(new CustomEvent("authstatechange",{detail:t})),this.embedded&&(t==="authenticated"&&this.resolveEmbedded(this.ad4mClient),t==="unauthenticated"||t==="locked")){let i=t==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(i))}}notifyConfigChange(t,i){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:t,value:i}}))}};var Nc=window,Dc=Nc.ShadowRoot&&(Nc.ShadyCSS===void 0||Nc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ap=Symbol(),jm=new WeakMap,No=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==ap)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Dc&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=jm.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&jm.set(t,e))}return e}toString(){return this.cssText}},Um=r=>new No(typeof r=="string"?r:r+"",void 0,ap),Lt=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new No(t,r,ap)},op=(r,e)=>{Dc?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),n=Nc.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},$c=Dc?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Um(t)})(r):r;var sp,Rc=window,qm=Rc.trustedTypes,A_=qm?qm.emptyScript:"",Bm=Rc.reactiveElementPolyfillSupport,up={toAttribute(r,e){switch(e){case Boolean:r=r?A_:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Vm=(r,e)=>e!==r&&(e==e||r==r),cp={attribute:!0,type:String,converter:up,reflect:!1,hasChanged:Vm},lp="finalized",Rr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=cp){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||cp}static finalize(){if(this.hasOwnProperty(lp))return!1;this[lp]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)t.unshift($c(n))}else e!==void 0&&t.push($c(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return op(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=cp){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:up).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:up;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Vm)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Rr[lp]=!0,Rr.elementProperties=new Map,Rr.elementStyles=[],Rr.shadowRootOptions={mode:"open"},Bm?.({ReactiveElement:Rr}),((sp=Rc.reactiveElementVersions)!==null&&sp!==void 0?sp:Rc.reactiveElementVersions=[]).push("1.6.3");var pp,Pc=window,ca=Pc.trustedTypes,Qm=ca?ca.createPolicy("lit-html",{createHTML:r=>r}):void 0,dp="$lit$",di=`lit$${(Math.random()+"").slice(9)}$`,Zm="?"+di,I_=`<${Zm}>`,fn=document,$o=()=>fn.createComment(""),Ro=r=>r===null||typeof r!="object"&&typeof r!="function",Ym=Array.isArray,T_=r=>Ym(r)||typeof r?.[Symbol.iterator]=="function",fp=`[
|
|
1565
|
+
- valid schema.$id`)}static determinePredicate(e,t,i,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(i["x-ad4m"]?.through)return i["x-ad4m"].through;if(a.predicateTemplate){let s=Rh(n),[c,u]=s.includes("://")?s.split("://"):["",s],l=u||"";return a.predicateTemplate.replace("${namespace}",l).replace("${scheme}",c).replace("${ns}",l).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let o=Rh(n);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,i,n,a){return i.propertyOptions?.[e]?.[n]!==void 0?i.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:i[n]!==void 0?i[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};ct=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,Te=new WeakMap;Bi.classNamesByClass=new WeakMap;var Bl=class{constructor(e,t,i){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return i}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,i),a=await this.perspective.querySurrealDB(n),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,i){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);i({results:l,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);i({results:l,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}};var E_=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function Oo(r,{include:e,exclude:t}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of E_(r.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var x_=12e3,Co=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;Oo(this),this.options=t,this.port=t.port||parseInt(Ss("ad4m-port"))||x_,this.url=t.url||Ss("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Ss("ad4m-token")||"",this.embedded=_s(),this.embedded&&this.initializeEmbeddedMode()}connect(){return J(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((t,i)=>{let n=setTimeout(()=>{i(new Error("Timeout waiting for AD4M config from parent window"))},3e4);this.embeddedResolve=a=>{clearTimeout(n),console.log("[Ad4m Connect] Successfully connected in embedded mode"),t(a)},this.embeddedReject=a=>{clearTimeout(n),i(a)},this.ad4mClient&&(this.authState==="authenticated"?(clearTimeout(n),console.log("[Ad4m Connect] Client already initialized in embedded mode"),t(this.ad4mClient)):(clearTimeout(n),i(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield Rn(this.url),kt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(t){throw console.error("[Ad4m Connect] Connection failed:",t),this.notifyConnectionChange("error"),t}})}buildClient(){return J(this,null,function*(){return this.notifyConnectionChange("connecting"),this.apolloClient&&this.wsClient&&(this.requestedRestart=!0,this.wsClient.dispose(),this.apolloClient.stop(),this.wsClient=null,this.apolloClient=null),this.wsClient=Ku({url:this.url,connectionParams:()=>J(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:t=>{this.activeSocket=t},error:t=>{this.notifyConnectionChange("error")},connected:()=>{this.notifyConnectionChange("connected")},closed:t=>J(this,null,function*(){if(!(t.wasClean||this.requestedRestart))if(!this.token)this.notifyConnectionChange("error");else try{this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(i){console.error("[Ad4m Connect] Reconnection failed:",i),this.notifyConnectionChange("error")}})}}),this.apolloClient=this.createApolloClient(this.wsClient),this.ad4mClient=new wo(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new Hu({link:new bd(t),cache:new hs({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,i){return J(this,null,function*(){let n=Ku({url:t,connectionParams:()=>J(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(n),o=new wo(a);try{return yield i(o)}finally{n.dispose()}})}checkAuth(){return J(this,null,function*(){try{return console.log("[Ad4m Connect] Checking authentication status..."),(yield this.ad4mClient.agent.isLocked())?(console.log("[Ad4m Connect] Agent wallet is locked"),this.notifyAuthChange("locked")):(yield this.ad4mClient.agent.status(),this.notifyAuthChange("authenticated")),!0}catch(t){console.error("[Ad4m Connect] Authentication check failed:",t);let i="Cannot extractByTags from a ciphered wallet. You must unlock first.";return t.message===i?(this.notifyAuthChange("locked"),!0):(t.message==="InvalidSignature"&&(console.log("[Ad4m Connect] Clearing invalid token due to InvalidSignature"),this.token="",Ra("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return J(this,null,function*(){console.log("[Ad4m Connect] Disconnecting..."),this.wsClient&&(this.wsClient.dispose(),this.wsClient=null),this.apolloClient&&(this.apolloClient.stop(),this.apolloClient=null),this.ad4mClient=void 0,this.token="",Ra("ad4m-token"),this.notifyAuthChange("unauthenticated"),this.notifyConnectionChange("not-connected"),console.log("[Ad4m Connect] Disconnected successfully")})}initializeEmbeddedMode(){console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent"),window.addEventListener("message",t=>J(this,null,function*(){var i;if(((i=t.data)==null?void 0:i.type)==="AD4M_CONFIG"){if(t.source!==window.parent){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from invalid source (not parent window)");return}if(this.options.allowedOrigins&&this.options.allowedOrigins.length>0&&(!t.origin||!this.options.allowedOrigins.includes(t.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",t.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${t.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:t.data.port,hasToken:!!t.data.token});let{port:n,token:a}=t.data;if(n==null){let c=new Error("AD4M_CONFIG missing required field: port");console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let o=parseInt(n,10);if(!Number.isFinite(o)||o<=0){let c=new Error(`AD4M_CONFIG invalid port: ${n} (must be a positive integer)`);console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let s=a!=null&&typeof a=="string"?a:"";try{this.port=o,this.token=s,this.url=`ws://localhost:${o}/graphql`,kt("ad4m-port",o.toString()),s?kt("ad4m-token",s):Ra("ad4m-token"),kt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(c){console.error("[Ad4m Connect] Failed to initialize from AD4M_CONFIG:",c),this.rejectEmbedded(c)}}})),console.log("[Ad4m Connect] Requesting AD4M config from parent window"),window.parent.postMessage({type:"REQUEST_AD4M_CONFIG"},"*")}buildAppInfo(){return{appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appDomain:this.options.appInfo.url,appUrl:window.location.origin,appIconPath:this.options.appInfo.iconPath}}requestCapability(t=!1){return J(this,null,function*(){return t&&(this.token="",Ra("ad4m-token"),this.notifyConfigChange("token",this.token)),this.requestId=yield this.ad4mClient.agent.requestCapability({appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appUrl:this.options.appInfo.url,appDomain:this.options.appInfo.url,appIconPath:this.options.appInfo.iconPath,capabilities:this.options.capabilities}),this.requestId})}verifyLocalAd4mCode(t){return J(this,null,function*(){if(!this.requestId)return console.error("[Ad4m Connect] Cannot verify code: requestId is missing. Call requestCapability() first to obtain a requestId."),!1;try{let i=yield this.ad4mClient.agent.generateJwt(this.requestId,t);return this.token=i,kt("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Code verification failed:",i),!1}})}isValidAd4mAPI(){return J(this,null,function*(){try{return yield this.withTempClient(this.url,t=>J(this,null,function*(){return yield t.runtime.info()})),!0}catch(t){return console.error("[Ad4m Connect] Failed to verify AD4M API:",t),!1}})}isMultiUser(){return J(this,null,function*(){try{return yield this.withTempClient(this.url,t=>J(this,null,function*(){return yield t.runtime.multiUserEnabled()}))}catch(t){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",t),!1}})}submitEmail(t){return J(this,null,function*(){try{return yield this.withTempClient(this.url,i=>J(this,null,function*(){return yield i.agent.requestLoginVerification(t,this.buildAppInfo())}))}catch(i){return{success:!1,message:i.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(t,i){return J(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>J(this,null,function*(){return yield a.agent.verifyEmailCode(t,i,"login")}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Email code verification failed:",n),!1}})}loginWithPassword(t,i){return J(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>J(this,null,function*(){return yield a.agent.loginUser(t,i)}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Password login failed:",n),!1}})}createAccount(t,i){return J(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>J(this,null,function*(){let o=yield a.agent.createUser(t,i);if(o.success)return yield a.agent.loginUser(t,i);throw new Error(o.error||"Failed to create account")}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Account creation error:",n),!1}})}resolveEmbedded(t){this.embeddedResolve&&(this.embeddedResolve(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(t){this.embeddedReject&&(this.embeddedReject(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(t){this.connectionState!==t&&(this.connectionState=t,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:t})))}notifyAuthChange(t){if(this.authState=t,this.dispatchEvent(new CustomEvent("authstatechange",{detail:t})),this.embedded&&(t==="authenticated"&&this.resolveEmbedded(this.ad4mClient),t==="unauthenticated"||t==="locked")){let i=t==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(i))}}notifyConfigChange(t,i){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:t,value:i}}))}};var Nc=window,Dc=Nc.ShadowRoot&&(Nc.ShadyCSS===void 0||Nc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ap=Symbol(),jm=new WeakMap,No=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==ap)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Dc&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=jm.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&jm.set(t,e))}return e}toString(){return this.cssText}},Um=r=>new No(typeof r=="string"?r:r+"",void 0,ap),Lt=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new No(t,r,ap)},op=(r,e)=>{Dc?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),n=Nc.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},$c=Dc?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Um(t)})(r):r;var sp,Rc=window,qm=Rc.trustedTypes,A_=qm?qm.emptyScript:"",Bm=Rc.reactiveElementPolyfillSupport,up={toAttribute(r,e){switch(e){case Boolean:r=r?A_:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Vm=(r,e)=>e!==r&&(e==e||r==r),cp={attribute:!0,type:String,converter:up,reflect:!1,hasChanged:Vm},lp="finalized",Rr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=cp){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||cp}static finalize(){if(this.hasOwnProperty(lp))return!1;this[lp]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)t.unshift($c(n))}else e!==void 0&&t.push($c(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return op(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=cp){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:up).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:up;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Vm)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Rr[lp]=!0,Rr.elementProperties=new Map,Rr.elementStyles=[],Rr.shadowRootOptions={mode:"open"},Bm?.({ReactiveElement:Rr}),((sp=Rc.reactiveElementVersions)!==null&&sp!==void 0?sp:Rc.reactiveElementVersions=[]).push("1.6.3");var pp,Pc=window,ca=Pc.trustedTypes,Qm=ca?ca.createPolicy("lit-html",{createHTML:r=>r}):void 0,dp="$lit$",di=`lit$${(Math.random()+"").slice(9)}$`,Zm="?"+di,I_=`<${Zm}>`,fn=document,$o=()=>fn.createComment(""),Ro=r=>r===null||typeof r!="object"&&typeof r!="function",Ym=Array.isArray,T_=r=>Ym(r)||typeof r?.[Symbol.iterator]=="function",fp=`[
|
|
1565
1566
|
\f\r]`,Do=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,zm=/-->/g,Wm=/>/g,ln=RegExp(`>|${fp}(?:([^\\s"'>=/]+)(${fp}*=${fp}*(?:[^
|
|
1566
|
-
\f\r"'\`<>=]|("|')|))|$)`,"g"),
|
|
1567
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Hm=/'/g,Gm=/"/g,Xm=/^(?:script|style|textarea|title)$/i,eg=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),U=eg(1),JO=eg(2),dn=Symbol.for("lit-noChange"),Je=Symbol.for("lit-nothing"),Km=new WeakMap,pn=fn.createTreeWalker(fn,129,null,!1);function tg(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Qm!==void 0?Qm.createHTML(e):e}var k_=(r,e)=>{let t=r.length-1,i=[],n,a=e===2?"<svg>":"",o=Do;for(let s=0;s<t;s++){let c=r[s],u,l,d=-1,f=0;for(;f<c.length&&(o.lastIndex=f,l=o.exec(c),l!==null);)f=o.lastIndex,o===Do?l[1]==="!--"?o=zm:l[1]!==void 0?o=Wm:l[2]!==void 0?(Xm.test(l[2])&&(n=RegExp("</"+l[2],"g")),o=ln):l[3]!==void 0&&(o=ln):o===ln?l[0]===">"?(o=n??Do,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,u=l[1],o=l[3]===void 0?ln:l[3]==='"'?Gm:Hm):o===Gm||o===Hm?o=ln:o===zm||o===Wm?o=Do:(o=ln,n=void 0);let p=o===ln&&r[s+1].startsWith("/>")?" ":"";a+=o===Do?c+I_:d>=0?(i.push(u),c.slice(0,d)+dp+c.slice(d)+di+p):c+di+(d===-2?(i.push(void 0),s):p)}return[tg(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),i]},hn=class{constructor({strings:e,_$litType$:t},i){let n;this.parts=[];let a=0,o=0,s=e.length-1,c=this.parts,[u,l]=k_(e,t);if(this.el=hn.createElement(u,i),pn.currentNode=this.el.content,t===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(n=pn.nextNode())!==null&&c.length<s;){if(n.nodeType===1){if(n.hasAttributes()){let d=[];for(let f of n.getAttributeNames())if(f.endsWith(dp)||f.startsWith(di)){let p=l[o++];if(d.push(f),p!==void 0){let h=n.getAttribute(p.toLowerCase()+dp).split(di),m=/([.?@])?(.*)/.exec(p);c.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?mp:m[1]==="?"?gp:m[1]==="@"?yp:la})}else c.push({type:6,index:a})}for(let f of d)n.removeAttribute(f)}if(Xm.test(n.tagName)){let d=n.textContent.split(di),f=d.length-1;if(f>0){n.textContent=ca?ca.emptyScript:"";for(let p=0;p<f;p++)n.append(d[p],$o()),pn.nextNode(),c.push({type:2,index:++a});n.append(d[f],$o())}}}else if(n.nodeType===8)if(n.data===Zm)c.push({type:2,index:a});else{let d=-1;for(;(d=n.data.indexOf(di,d+1))!==-1;)c.push({type:7,index:a}),d+=di.length-1}a++}}static createElement(e,t){let i=fn.createElement("template");return i.innerHTML=e,i}};function ua(r,e,t=r,i){var n,a,o,s;if(e===dn)return e;let c=i!==void 0?(n=t._$Co)===null||n===void 0?void 0:n[i]:t._$Cl,u=Ro(e)?void 0:e._$litDirective$;return c?.constructor!==u&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),u===void 0?c=void 0:(c=new u(r),c._$AT(r,t,i)),i!==void 0?((o=(s=t)._$Co)!==null&&o!==void 0?o:s._$Co=[])[i]=c:t._$Cl=c),c!==void 0&&(e=ua(r,c._$AS(r,e.values),c,i)),e}var hp=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:i},parts:n}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:fn).importNode(i,!0);pn.currentNode=a;let o=pn.nextNode(),s=0,c=0,u=n[0];for(;u!==void 0;){if(s===u.index){let l;u.type===2?l=new mn(o,o.nextSibling,this,e):u.type===1?l=new u.ctor(o,u.name,u.strings,this,e):u.type===6&&(l=new vp(o,this,e)),this._$AV.push(l),u=n[++c]}s!==u?.index&&(o=pn.nextNode(),s++)}return pn.currentNode=fn,a}v(e){let t=0;for(let i of this._$AV)i!==void 0&&(i.strings!==void 0?(i._$AI(e,i,t),t+=i.strings.length-2):i._$AI(e[t])),t++}},mn=class{constructor(e,t,i,n){var a;this.type=2,this._$AH=Je,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=i,this.options=n,this._$Cp=(a=n?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=ua(this,e,t),Ro(e)?e===Je||e==null||e===""?(this._$AH!==Je&&this._$AR(),this._$AH=Je):e!==this._$AH&&e!==dn&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):T_(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Je&&Ro(this._$AH)?this._$AA.nextSibling.data=e:this.$(fn.createTextNode(e)),this._$AH=e}g(e){var t;let{values:i,_$litType$:n}=e,a=typeof n=="number"?this._$AC(e):(n.el===void 0&&(n.el=hn.createElement(tg(n.h,n.h[0]),this.options)),n);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(i);else{let o=new hp(a,this),s=o.u(this.options);o.v(i),this.$(s),this._$AH=o}}_$AC(e){let t=Km.get(e.strings);return t===void 0&&Km.set(e.strings,t=new hn(e)),t}T(e){Ym(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,i,n=0;for(let a of e)n===t.length?t.push(i=new mn(this.k($o()),this.k($o()),this,this.options)):i=t[n],i._$AI(a),n++;n<t.length&&(this._$AR(i&&i._$AB.nextSibling,n),t.length=n)}_$AR(e=this._$AA.nextSibling,t){var i;for((i=this._$AP)===null||i===void 0||i.call(this,!1,!0,t);e&&e!==this._$AB;){let n=e.nextSibling;e.remove(),e=n}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},la=class{constructor(e,t,i,n,a){this.type=1,this._$AH=Je,this._$AN=void 0,this.element=e,this.name=t,this._$AM=n,this.options=a,i.length>2||i[0]!==""||i[1]!==""?(this._$AH=Array(i.length-1).fill(new String),this.strings=i):this._$AH=Je}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,i,n){let a=this.strings,o=!1;if(a===void 0)e=ua(this,e,t,0),o=!Ro(e)||e!==this._$AH&&e!==dn,o&&(this._$AH=e);else{let s=e,c,u;for(e=a[0],c=0;c<a.length-1;c++)u=ua(this,s[i+c],t,c),u===dn&&(u=this._$AH[c]),o||(o=!Ro(u)||u!==this._$AH[c]),u===Je?e=Je:e!==Je&&(e+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!n&&this.j(e)}j(e){e===Je?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},mp=class extends la{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Je?void 0:e}},O_=ca?ca.emptyScript:"",gp=class extends la{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Je?this.element.setAttribute(this.name,O_):this.element.removeAttribute(this.name)}},yp=class extends la{constructor(e,t,i,n,a){super(e,t,i,n,a),this.type=5}_$AI(e,t=this){var i;if((e=(i=ua(this,e,t,0))!==null&&i!==void 0?i:Je)===dn)return;let n=this._$AH,a=e===Je&&n!==Je||e.capture!==n.capture||e.once!==n.once||e.passive!==n.passive,o=e!==Je&&(n===Je||a);a&&this.element.removeEventListener(this.name,this,n),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,i;typeof this._$AH=="function"?this._$AH.call((i=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&i!==void 0?i:this.element,e):this._$AH.handleEvent(e)}},vp=class{constructor(e,t,i){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=i}get _$AU(){return this._$AM._$AU}_$AI(e){ua(this,e)}};var Jm=Pc.litHtmlPolyfillSupport;Jm?.(hn,mn),((pp=Pc.litHtmlVersions)!==null&&pp!==void 0?pp:Pc.litHtmlVersions=[]).push("2.8.0");var rg=(r,e,t)=>{var i,n;let a=(i=t?.renderBefore)!==null&&i!==void 0?i:e,o=a._$litPart$;if(o===void 0){let s=(n=t?.renderBefore)!==null&&n!==void 0?n:null;a._$litPart$=o=new mn(e.insertBefore($o(),s),s,void 0,t??{})}return o._$AI(r),o};var bp,wp;var ut=class extends Rr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let i=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=i.firstChild),i}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=rg(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return dn}};ut.finalized=!0,ut._$litElement$=!0,(bp=globalThis.litElementHydrateSupport)===null||bp===void 0||bp.call(globalThis,{LitElement:ut});var ig=globalThis.litElementPolyfillSupport;ig?.({LitElement:ut});((wp=globalThis.litElementVersions)!==null&&wp!==void 0?wp:globalThis.litElementVersions=[]).push("3.3.3");var _r=r=>e=>typeof e=="function"?((t,i)=>(customElements.define(t,i),i))(r,e):((t,i)=>{let{kind:n,elements:a}=i;return{kind:n,elements:a,finisher(o){customElements.define(t,o)}}})(r,e);var C_=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},N_=(r,e,t)=>{e.constructor.createProperty(t,r)};function De(r){return(e,t)=>t!==void 0?N_(r,e,t):C_(r,e)}function Ce(r){return De({...r,state:!0})}var _p,EC=((_p=window.HTMLSlotElement)===null||_p===void 0?void 0:_p.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);function gn(){return U`
|
|
1567
1568
|
<svg viewBox="0 0 63.6 60" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1568
1569
|
<path fill="currentColor" d="M63.2781 52.9928C62.4038 47.0393 59.8345 41.4763 55.9242 36.935C55.9403 36.5766 55.951 36.2182 55.951 35.8545C55.951 26.6328 50.7373 18.6039 43.0937 14.5333C41.093 9.35009 37.7352 4.72854 33.2402 1.14469L31.7705 0L30.2793 1.10725L30.2096 1.16074C25.7253 4.74458 22.3729 9.36079 20.3775 14.5386C12.7339 18.6039 7.52021 26.6328 7.52021 35.8599C7.52021 36.2236 7.53094 36.582 7.54703 36.9404C3.6421 41.471 1.06742 47.034 0.198465 52.9874L0 54.9131L1.70036 55.5817C5.40683 57.0313 9.32249 57.7695 13.3401 57.7695C15.668 57.7695 17.9369 57.5127 20.1254 57.0366C23.5744 58.9248 27.533 60 31.7383 60C35.9436 60 39.9022 58.9248 43.3512 57.0366C45.5397 57.5127 47.8086 57.7695 50.1365 57.7695C54.1541 57.7695 58.0698 57.0366 61.7762 55.5817L63.5624 54.881L63.2835 52.9874L63.2781 52.9928ZM42.5734 51.8802C40.0792 51.1581 37.7352 50.0829 35.595 48.7189C39.752 44.675 42.8041 39.5079 44.263 33.7202C46.1297 34.6938 47.8891 35.8866 49.4982 37.288C49.9917 37.716 50.4637 38.1653 50.9197 38.6253C50.1258 44.1294 46.9986 48.8954 42.568 51.8855L42.5734 51.8802ZM12.5516 38.62C13.0075 38.1599 13.4849 37.716 13.973 37.288C15.5822 35.8866 17.3415 34.6938 19.2082 33.7202C20.6672 39.5079 23.7192 44.675 27.8763 48.7189C25.7361 50.0829 23.392 51.1527 20.8978 51.8802C16.4672 48.8901 13.3401 44.1241 12.5462 38.62H12.5516ZM40.3957 25.9802C40.3957 26.3332 40.3903 26.6809 40.3742 27.0286C37.585 26.2477 34.6831 25.8411 31.7383 25.8411C28.7935 25.8411 25.8916 26.2477 23.1024 27.0286C23.0917 26.6809 23.0809 26.3279 23.0809 25.9802C23.0809 23.2362 23.494 20.5563 24.2825 18.0102C26.5782 17.0527 29.0993 16.5231 31.7383 16.5231C34.3773 16.5231 36.8984 17.0527 39.1941 18.0102C39.9826 20.5563 40.3957 23.2362 40.3957 25.9802ZM23.73 31.8641C26.3047 31.0671 29.0027 30.6553 31.7383 30.6553C34.4739 30.6553 37.1719 31.0671 39.7466 31.8641C38.5344 37.2827 35.6808 42.0915 31.7383 45.7395C27.7958 42.0861 24.9422 37.2773 23.73 31.8641ZM50.7641 32.1262C48.9887 30.8104 47.0898 29.6817 45.0998 28.7671C45.1803 27.847 45.2232 26.9163 45.2232 25.9802C45.2232 24.536 45.1266 23.1131 44.9335 21.7063C47.8676 24.4343 49.9595 28.0503 50.7641 32.1262ZM31.7383 6.19417C33.6639 7.97005 35.2946 9.99198 36.6087 12.1904C35.0371 11.8695 33.4065 11.6983 31.7383 11.6983C30.0701 11.6983 28.4395 11.8695 26.8679 12.1904C28.182 9.99198 29.8127 7.97005 31.7383 6.19417ZM18.5431 21.701C18.3553 23.1078 18.2534 24.5306 18.2534 25.9749C18.2534 26.9163 18.2963 27.8417 18.3768 28.7617C16.3868 29.6764 14.4879 30.805 12.7125 32.1209C13.5171 28.0449 15.6036 24.429 18.5377 21.701H18.5431ZM5.33173 51.7518C5.9915 48.7938 7.15547 45.9802 8.74855 43.418C9.95007 47.034 11.9776 50.2808 14.622 52.9179C14.1983 52.9393 13.7692 52.95 13.3401 52.95C10.5991 52.95 7.91178 52.5488 5.32637 51.7465L5.33173 51.7518ZM31.7383 55.1859C30.1506 55.1859 28.6058 54.988 27.1307 54.6296C28.7452 53.854 30.29 52.95 31.7383 51.923C33.1866 52.95 34.7314 53.854 36.3459 54.6296C34.8655 54.988 33.326 55.1859 31.7383 55.1859ZM50.1365 52.95C49.7074 52.95 49.2783 52.9339 48.8546 52.9179C51.499 50.2808 53.5265 47.0393 54.728 43.4234C56.3211 45.9802 57.4851 48.7938 58.1449 51.7518C55.5648 52.5488 52.8775 52.95 50.1365 52.95Z" />
|
|
1569
1570
|
</svg>
|
|
@@ -1868,7 +1869,7 @@ WHERE ${d.join(" AND ")}
|
|
|
1868
1869
|
.state.danger svg {
|
|
1869
1870
|
color: var(--ac-danger-color);
|
|
1870
1871
|
}
|
|
1871
|
-
`;var at=class extends
|
|
1872
|
+
`;var at=class extends ut{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.showMultiUserOption=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl="";this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return J(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return J(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return J(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-remote-node",{detail:{remoteUrl:this.newRemoteUrl},bubbles:!0,composed:!0}))})}clearRemoteNodeError(){this.dispatchEvent(new CustomEvent("clear-remote-node-error",{bubbles:!0,composed:!0}))}detectLocalNode(){return J(this,null,function*(){try{yield Rn(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return J(this,null,function*(){Ep(at.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:U`
|
|
1872
1873
|
<div class="container">
|
|
1873
1874
|
<div class="header">
|
|
1874
1875
|
<h1>Connect AD4M</h1>
|
|
@@ -1990,7 +1991,7 @@ WHERE ${d.join(" AND ")}
|
|
|
1990
1991
|
button {
|
|
1991
1992
|
width: 100%;
|
|
1992
1993
|
}
|
|
1993
|
-
`],W([
|
|
1994
|
+
`],W([De({type:Number})],at.prototype,"port",2),W([De({type:String})],at.prototype,"remoteUrl",2),W([De({type:Boolean})],at.prototype,"connectingToRemoteNode",2),W([De({type:Boolean})],at.prototype,"remoteNodeError",2),W([De({type:Boolean})],at.prototype,"showMultiUserOption",2),W([Ce()],at.prototype,"loading",2),W([Ce()],at.prototype,"localNodeDetected",2),W([Ce()],at.prototype,"newPort",2),W([Ce()],at.prototype,"newRemoteUrl",2),W([Ce()],at.prototype,"isMobile",2),at=W([_r("connection-options")],at);var tr=class extends ut{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let i=t.target,n=i.value.replace(/\D/g,"").slice(0,6);i.value=n,this.securityCode=n,this.securityCode.length===6&&this.verifyCode()}render(){return U`
|
|
1994
1995
|
<div class="container">
|
|
1995
1996
|
<div class="back-button" @click=${this.back}>
|
|
1996
1997
|
${da()}
|
|
@@ -2129,7 +2130,7 @@ WHERE ${d.join(" AND ")}
|
|
|
2129
2130
|
.state {
|
|
2130
2131
|
justify-content: center;
|
|
2131
2132
|
}
|
|
2132
|
-
`],W([
|
|
2133
|
+
`],W([De({type:Array})],tr.prototype,"capabilities",2),W([De({type:String})],tr.prototype,"appname",2),W([De({type:String})],tr.prototype,"appiconpath",2),W([De({type:Boolean})],tr.prototype,"verificationError",2),W([Ce()],tr.prototype,"requestSent",2),W([Ce()],tr.prototype,"securityCode",2),tr=W([_r("local-authentication")],tr);var Ft=class extends ut{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.email="";this.password="";this.emailSecurityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.emailSecurityCode=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let i=t.target,n=i.value.replace(/\D/g,"").slice(0,6);i.value=n,this.emailSecurityCode=n,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,i=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,n=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,o=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return U`
|
|
2133
2134
|
<div class="container">
|
|
2134
2135
|
<div class="back-button" @click=${this.back}>
|
|
2135
2136
|
${da()}
|
|
@@ -2311,7 +2312,7 @@ WHERE ${d.join(" AND ")}
|
|
|
2311
2312
|
.state {
|
|
2312
2313
|
justify-content: center;
|
|
2313
2314
|
}
|
|
2314
|
-
`],W([
|
|
2315
|
+
`],W([De({type:Object})],Ft.prototype,"remoteAuthState",2),W([De({type:Boolean})],Ft.prototype,"remoteAuthLoading",2),W([De({type:Boolean})],Ft.prototype,"emailCodeError",2),W([De({type:Boolean})],Ft.prototype,"passwordError",2),W([De({type:Boolean})],Ft.prototype,"accountCreationError",2),W([Ce()],Ft.prototype,"email",2),W([Ce()],Ft.prototype,"password",2),W([Ce()],Ft.prototype,"emailSecurityCode",2),Ft=W([_r("remote-authentication")],Ft);var mi=class extends ut{constructor(){super(...arguments);this.url="";this.port=12e3;this.authState="unauthenticated"}get connectionType(){return this.url.includes("localhost")||this.url.includes("127.0.0.1")?"local":"remote"}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}render(){let t=this.connectionType==="local";return U`
|
|
2315
2316
|
<div class="container">
|
|
2316
2317
|
<div class="close-button" @click=${this.close}>
|
|
2317
2318
|
${vt()}
|
|
@@ -2391,7 +2392,7 @@ WHERE ${d.join(" AND ")}
|
|
|
2391
2392
|
background: rgba(244, 54, 127, 0.2);
|
|
2392
2393
|
color: var(--ac-danger-color);
|
|
2393
2394
|
}
|
|
2394
|
-
`],W([
|
|
2395
|
+
`],W([De({type:String})],mi.prototype,"url",2),W([De({type:Number})],mi.prototype,"port",2),W([De({type:String})],mi.prototype,"authState",2),mi=W([_r("current-state")],mi);var D_=Lt`
|
|
2395
2396
|
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
|
|
2396
2397
|
|
|
2397
2398
|
:host {
|
|
@@ -2469,14 +2470,14 @@ WHERE ${d.join(" AND ")}
|
|
|
2469
2470
|
padding: 0;
|
|
2470
2471
|
cursor: pointer;
|
|
2471
2472
|
position: fixed;
|
|
2472
|
-
bottom:
|
|
2473
|
-
right:
|
|
2473
|
+
bottom: 10px;
|
|
2474
|
+
right: 10px;
|
|
2474
2475
|
color: var(--ac-primary-color);
|
|
2475
|
-
width:
|
|
2476
|
-
height:
|
|
2476
|
+
width: 34px;
|
|
2477
|
+
height: 34px;
|
|
2477
2478
|
z-index: 99999;
|
|
2478
2479
|
}
|
|
2479
|
-
`,
|
|
2480
|
+
`,lt=class extends ut{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),Oo(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.token?this.core.connect().catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return J(this,null,function*(){this.core.port=t.detail.port,kt("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return J(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,kt("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return J(this,null,function*(){let i=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!i,i&&(this.modalOpen=!1)})}connectRemoteNode(t){return J(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,kt("ad4m-url",this.core.url);try{if(yield Rn(t.detail.remoteUrl),console.log("[Ad4m Connect UI] Remote connection successful"),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");console.log("[Ad4m Connect UI] Remote AD4M API verified");let n=yield this.core.isMultiUser();console.log("[Ad4m Connect UI] Remote multi-user detected:",n),this.currentView="remote-authentication"}catch(i){console.error("[Ad4m Connect UI] Remote connection failed:",i),this.remoteNodeError=!0}finally{this.connectingToRemoteNode=!1}})}emailLogin(t){return J(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return J(this,null,function*(){try{this.remoteAuthLoading=!0;let i=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!i,i&&(this.modalOpen=!1)}catch(i){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return J(this,null,function*(){try{this.remoteAuthLoading=!0;let i=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!i,i&&(this.modalOpen=!1)}catch(i){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return J(this,null,function*(){try{this.remoteAuthLoading=!0;let i=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!i,i&&(this.modalOpen=!1)}catch(i){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return J(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return U`
|
|
2480
2481
|
<connection-options
|
|
2481
2482
|
.port=${this.core.port}
|
|
2482
2483
|
.remoteUrl=${this.core.options.remoteUrl}
|
|
@@ -2542,7 +2543,7 @@ WHERE ${d.join(" AND ")}
|
|
|
2542
2543
|
>
|
|
2543
2544
|
${gn()}
|
|
2544
2545
|
</button>
|
|
2545
|
-
`:null}};
|
|
2546
|
+
`:null}};lt.styles=[D_],W([Ce()],lt.prototype,"modalOpen",2),W([Ce()],lt.prototype,"currentView",2),W([Ce()],lt.prototype,"connectingToRemoteNode",2),W([Ce()],lt.prototype,"remoteNodeError",2),W([Ce()],lt.prototype,"verificationError",2),W([Ce()],lt.prototype,"remoteAuthLoading",2),W([Ce()],lt.prototype,"remoteAuthState",2),W([Ce()],lt.prototype,"emailCodeError",2),W([Ce()],lt.prototype,"passwordError",2),W([Ce()],lt.prototype,"accountCreationError",2),lt=W([_r("ad4m-connect")],lt);function Sp(r){let e=new lt;return e.core=r,r.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),document.body.appendChild(e)),e}function $_(r){let e=new Co(r);if(_s()){let t=e.connect();return{core:e,client:t}}else{Sp(e);let t=new Promise(i=>{e.addEventListener("authstatechange",n=>{n.detail==="authenticated"&&e.ad4mClient&&i(e.ad4mClient)})});return{core:e,client:t}}}function sN(r){return J(this,null,function*(){let{client:e}=$_(r);return e})}export{sN as getAd4mClient,$_ as getAd4mConnect,_s as isEmbedded};
|
|
2546
2547
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
2547
2548
|
/**
|
|
2548
2549
|
* @license
|