@coasys/ad4m-connect 0.12.0-rc1 → 0.12.0-rc1-dev

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 CHANGED
@@ -1,31 +1,31 @@
1
- var Se=(t,e,r)=>new Promise((n,i)=>{var a=c=>{try{s(r.next(c))}catch(u){i(u)}},o=c=>{try{s(r.throw(c))}catch(u){i(u)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(a,o);s((r=r.apply(t,e)).next())});var zs=function(t,e){return zs=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(r[i]=n[i])},zs(t,e)};function Oe(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");zs(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var T=function(){return T=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},T.apply(this,arguments)};function Qt(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(t);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(t,n[i])&&(r[n[i]]=t[n[i]]);return r}function Ft(t,e,r,n){function i(a){return a instanceof r?a:new r(function(o){o(a)})}return new(r||(r=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(d){o(d)}}function c(l){try{u(n.throw(l))}catch(d){o(d)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(t,e||[])).next())})}function Lt(t,e){var r={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(r=0)),r;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=0,a&&(u=[u[0]&2,a.value]),u[0]){case 0:case 1:a=u;break;case 4:return r.label++,{value:u[1],done:!1};case 5:r.label++,i=u[1],u=[0];continue;case 7:u=r.ops.pop(),r.trys.pop();continue;default:if(a=r.trys,!(a=a.length>0&&a[a.length-1])&&(u[0]===6||u[0]===2)){r=0;continue}if(u[0]===3&&(!a||u[1]>a[0]&&u[1]<a[3])){r.label=u[1];break}if(u[0]===6&&r.label<a[1]){r.label=a[1],a=u;break}if(a&&r.label<a[2]){r.label=a[2],r.ops.push(u);break}a[2]&&r.ops.pop(),r.trys.pop();continue}u=e.call(t,r)}catch(l){u=[6,l],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function Sr(t,e,r){if(r||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return t.concat(a||Array.prototype.slice.call(e))}var Ws="Invariant Violation",dl=Object.setPrototypeOf,Dh=dl===void 0?function(t,e){return t.__proto__=e,t}:dl,K=function(t){Oe(e,t);function e(r){r===void 0&&(r=Ws);var n=t.call(this,typeof r=="number"?Ws+": "+r+" (see https://github.com/apollographql/invariant-packages)":r)||this;return n.framesToPop=1,n.name=Ws,Dh(n,e.prototype),n}return e}(Error);function L(t,e){if(!t)throw new K(e)}var Za=["debug","log","warn","error","silent"],Gs=Za.indexOf("log");function Ya(t){return function(){if(Za.indexOf(t)>=Gs){var e=console[t]||console.log;return e.apply(console,arguments)}}}(function(t){t.debug=Ya("debug"),t.log=Ya("log"),t.warn=Ya("warn"),t.error=Ya("error")})(L||(L={}));function hl(t){var e=Za[Gs];return Gs=Math.max(0,Za.indexOf(t)),e}function Be(t){try{return t()}catch{}}var Xa=Be(function(){return globalThis})||Be(function(){return window})||Be(function(){return self})||Be(function(){return global})||Be(function(){return Be.constructor("return this")()});var ml="__",gl=[ml,ml].join("DEV");function Nh(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Xa,gl,{value:Be(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Xa[gl]}}var Zr=Nh();function wr(t){try{return t()}catch{}}var Ks=wr(function(){return globalThis})||wr(function(){return window})||wr(function(){return self})||wr(function(){return global})||wr(function(){return wr.constructor("return this")()}),Hs=!1;function Ch(){Ks&&!wr(function(){return"production"})&&!wr(function(){return process})&&(Object.defineProperty(Ks,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Hs=!0)}Ch();function Js(){Hs&&(delete Ks.process,Hs=!1)}var iS=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",aS=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",yl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Fe=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function Ys(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var Rh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Li=Rh;function eo(t){var e=t.prototype.toJSON;typeof e=="function"||Ys(0),t.prototype.inspect=e,Li&&(t.prototype[Li]=e)}var vl=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();eo(vl);var bl=function(){function t(r,n,i,a,o,s,c){this.kind=r,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();eo(bl);function Zs(t){return t!=null&&typeof t.kind=="string"}function to(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?to=function(r){return typeof r}:to=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},to(t)}var Ph=10,_l=2;function $i(t){return ro(t,[])}function ro(t,e){switch(to(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Fh(t,e);default:return String(t)}}function Fh(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Mh(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:ro(i,r)}else if(Array.isArray(t))return $h(t,r);return Lh(t,r)}function Lh(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>_l)return"["+jh(t)+"]";var n=r.map(function(i){var a=ro(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function $h(t,e){if(t.length===0)return"[]";if(e.length>_l)return"[Array]";for(var r=Math.min(Ph,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(ro(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Mh(t){var e=t[String(Li)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function jh(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function Mi(t,e){var r=Boolean(t);if(!r)throw new Error(e)}function Sl(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Uh(t,e,r){return e&&Sl(t.prototype,e),r&&Sl(t,r),t}var no=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||Mi(0,"Body must be a string. Received: ".concat($i(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||Mi(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Mi(0,"column in locationOffset is 1-indexed and must be positive.")}return Uh(t,[{key:yl,get:function(){return"Source"}}]),t}();function wl(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=t.indexOf(`
2
- `)===-1,i=t[0]===" "||t[0]===" ",a=t[t.length-1]==='"',o=t[t.length-1]==="\\",s=!n||a||o||r,c="";return s&&!(n&&i)&&(c+=`
3
- `+e),c+=e?t.replace(/\n/g,`
4
- `+e):t,s&&(c+=`
5
- `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var qh={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},Xr=Object.freeze({});function et(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:qh,n=void 0,i=Array.isArray(t),a=[t],o=-1,s=[],c=void 0,u=void 0,l=void 0,d=[],p=[],f=t;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=p.length===0?void 0:d[d.length-1],c=l,l=p.pop(),m){if(i)c=c.slice();else{for(var g={},_=0,S=Object.keys(c);_<S.length;_++){var w=S[_];g[w]=c[w]}c=g}for(var b=0,O=0;O<s.length;O++){var C=s[O][0],E=s[O][1];i&&(C-=b),i&&E===null?(c.splice(C,1),b++):c[C]=E}}o=n.index,a=n.keys,s=n.edits,i=n.inArray,n=n.prev}else{if(u=l?i?o:a[o]:void 0,c=l?l[u]:f,c==null)continue;l&&d.push(u)}var R=void 0;if(!Array.isArray(c)){if(!Zs(c))throw new Error("Invalid AST Node: ".concat($i(c),"."));var F=Xs(e,c.kind,h);if(F){if(R=F.call(e,c,u,l,d,p),R===Xr)break;if(R===!1){if(!h){d.pop();continue}}else if(R!==void 0&&(s.push([u,R]),!h))if(Zs(R))c=R;else{d.pop();continue}}}if(R===void 0&&m&&s.push([u,c]),h)d.pop();else{var P;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(P=r[c.kind])!==null&&P!==void 0?P:[],o=-1,s=[],l&&p.push(l),l=c}}while(n!==void 0);return s.length!==0&&(f=s[s.length-1][1]),f}function Xs(t,e,r){var n=t[e];if(n){if(!r&&typeof n=="function")return n;var i=r?n.leave:n.enter;if(typeof i=="function")return i}else{var a=r?t.leave:t.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function Gn(t){return et(t,{leave:Vh})}var Bh=80,Vh={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return $(e.definitions,`
1
+ var Ee=(r,e,t)=>new Promise((n,i)=>{var a=c=>{try{s(t.next(c))}catch(u){i(u)}},o=c=>{try{s(t.throw(c))}catch(u){i(u)}},s=c=>c.done?n(c.value):Promise.resolve(c.value).then(a,o);s((t=t.apply(r,e)).next())});var Ws=function(r,e){return Ws=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,n){t.__proto__=n}||function(t,n){for(var i in n)Object.prototype.hasOwnProperty.call(n,i)&&(t[i]=n[i])},Ws(r,e)};function Ne(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ws(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var x=function(){return x=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},x.apply(this,arguments)};function Qt(r,e){var t={};for(var n in r)Object.prototype.hasOwnProperty.call(r,n)&&e.indexOf(n)<0&&(t[n]=r[n]);if(r!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,n=Object.getOwnPropertySymbols(r);i<n.length;i++)e.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(r,n[i])&&(t[n[i]]=r[n[i]]);return t}function Lt(r,e,t,n){function i(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(n.next(l))}catch(d){o(d)}}function c(l){try{u(n.throw(l))}catch(d){o(d)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(r,e||[])).next())})}function Ft(r,e){var t={label:0,sent:function(){if(a[0]&1)throw a[1];return a[1]},trys:[],ops:[]},n,i,a,o;return o={next:s(0),throw:s(1),return:s(2)},typeof Symbol=="function"&&(o[Symbol.iterator]=function(){return this}),o;function s(u){return function(l){return c([u,l])}}function c(u){if(n)throw new TypeError("Generator is already executing.");for(;o&&(o=0,u[0]&&(t=0)),t;)try{if(n=1,i&&(a=u[0]&2?i.return:u[0]?i.throw||((a=i.return)&&a.call(i),0):i.next)&&!(a=a.call(i,u[1])).done)return a;switch(i=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++,i=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],i=0}finally{n=a=0}if(u[0]&5)throw u[1];return{value:u[0]?u[1]:void 0,done:!0}}}function _r(r,e,t){if(t||arguments.length===2)for(var n=0,i=e.length,a;n<i;n++)(a||!(n in e))&&(a||(a=Array.prototype.slice.call(e,0,n)),a[n]=e[n]);return r.concat(a||Array.prototype.slice.call(e))}var Gs="Invariant Violation",dl=Object.setPrototypeOf,Rh=dl===void 0?function(r,e){return r.__proto__=e,r}:dl,G=function(r){Ne(e,r);function e(t){t===void 0&&(t=Gs);var n=r.call(this,typeof t=="number"?Gs+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=Gs,Rh(n,e.prototype),n}return e}(Error);function F(r,e){if(!r)throw new G(e)}var Za=["debug","log","warn","error","silent"],Ks=Za.indexOf("log");function Ya(r){return function(){if(Za.indexOf(r)>=Ks){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=Ya("debug"),r.log=Ya("log"),r.warn=Ya("warn"),r.error=Ya("error")})(F||(F={}));function hl(r){var e=Za[Ks];return Ks=Math.max(0,Za.indexOf(r)),e}function Ve(r){try{return r()}catch{}}var Xa=Ve(function(){return globalThis})||Ve(function(){return window})||Ve(function(){return self})||Ve(function(){return global})||Ve(function(){return Ve.constructor("return this")()});var ml="__",gl=[ml,ml].join("DEV");function Ph(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(Xa,gl,{value:Ve(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),Xa[gl]}}var Xr=Ph();function wr(r){try{return r()}catch{}}var Hs=wr(function(){return globalThis})||wr(function(){return window})||wr(function(){return self})||wr(function(){return global})||wr(function(){return wr.constructor("return this")()}),Js=!1;function Lh(){Hs&&!wr(function(){return"production"})&&!wr(function(){return process})&&(Object.defineProperty(Hs,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Js=!0)}Lh();function Ys(){Js&&(delete Hs.process,Js=!1)}var i_=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",a_=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",yl=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Fe=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function Zs(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Fh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Fi=Fh;function eo(r){var e=r.prototype.toJSON;typeof e=="function"||Zs(0),r.prototype.inspect=e,Fi&&(r.prototype[Fi]=e)}var vl=function(){function r(t,n,i){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=i}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();eo(vl);var bl=function(){function r(t,n,i,a,o,s,c){this.kind=t,this.start=n,this.end=i,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}();eo(bl);function Xs(r){return r!=null&&typeof r.kind=="string"}function to(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?to=function(t){return typeof t}:to=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},to(r)}var $h=10,Sl=2;function $i(r){return ro(r,[])}function ro(r,e){switch(to(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Mh(r,e);default:return String(r)}}function Mh(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=qh(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:ro(i,t)}else if(Array.isArray(r))return Uh(r,t);return jh(r,t)}function jh(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Sl)return"["+Bh(r)+"]";var n=t.map(function(i){var a=ro(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Uh(r,e){if(r.length===0)return"[]";if(e.length>Sl)return"[Array]";for(var t=Math.min($h,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(ro(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function qh(r){var e=r[String(Fi)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Bh(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 Mi(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function _l(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Vh(r,e,t){return e&&_l(r.prototype,e),t&&_l(r,t),r}var no=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||Mi(0,"Body must be a string. Received: ".concat($i(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Mi(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Mi(0,"column in locationOffset is 1-indexed and must be positive.")}return Vh(r,[{key:yl,get:function(){return"Source"}}]),r}();function wl(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=r.indexOf(`
2
+ `)===-1,i=r[0]===" "||r[0]===" ",a=r[r.length-1]==='"',o=r[r.length-1]==="\\",s=!n||a||o||t,c="";return s&&!(n&&i)&&(c+=`
3
+ `+e),c+=e?r.replace(/\n/g,`
4
+ `+e):r,s&&(c+=`
5
+ `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var Qh={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"]},en=Object.freeze({});function Xe(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Qh,n=void 0,i=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(i)c=c.slice();else{for(var y={},_=0,S=Object.keys(c);_<S.length;_++){var w=S[_];y[w]=c[w]}c=y}for(var v=0,A=0;A<s.length;A++){var R=s[A][0],E=s[A][1];i&&(R-=v),i&&E===null?(c.splice(R,1),v++):c[R]=E}}o=n.index,a=n.keys,s=n.edits,i=n.inArray,n=n.prev}else{if(u=l?i?o:a[o]:void 0,c=l?l[u]:p,c==null)continue;l&&d.push(u)}var P=void 0;if(!Array.isArray(c)){if(!Xs(c))throw new Error("Invalid AST Node: ".concat($i(c),"."));var L=ec(e,c.kind,h);if(L){if(P=L.call(e,c,u,l,d,f),P===en)break;if(P===!1){if(!h){d.pop();continue}}else if(P!==void 0&&(s.push([u,P]),!h))if(Xs(P))c=P;else{d.pop();continue}}}if(P===void 0&&m&&s.push([u,c]),h)d.pop();else{var C;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(C=t[c.kind])!==null&&C!==void 0?C:[],o=-1,s=[],l&&f.push(l),l=c}}while(n!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function ec(r,e,t){var n=r[e];if(n){if(!t&&typeof n=="function")return n;var i=t?n.leave:n.enter;if(typeof i=="function")return i}else{var a=t?r.leave:r.enter;if(a){if(typeof a=="function")return a;var o=a[e];if(typeof o=="function")return o}}}function Gn(r){return Xe(r,{leave:Wh})}var zh=80,Wh={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return $(e.definitions,`
6
6
 
7
7
  `)+`
8
- `},OperationDefinition:function(e){var r=e.operation,n=e.name,i=Ae("(",$(e.variableDefinitions,", "),")"),a=$(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&r==="query"?o:$([r,$([n,i]),a,o]," ")},VariableDefinition:function(e){var r=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return r+": "+n+Ae(" = ",i)+Ae(" ",$(a," "))},SelectionSet:function(e){var r=e.selections;return Mt(r)},Field:function(e){var r=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Ae("",r,": ")+n,c=s+Ae("(",$(i,", "),")");return c.length>Bh&&(c=s+Ae(`(
8
+ `},OperationDefinition:function(e){var t=e.operation,n=e.name,i=Oe("(",$(e.variableDefinitions,", "),")"),a=$(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&t==="query"?o:$([t,$([n,i]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return t+": "+n+Oe(" = ",i)+Oe(" ",$(a," "))},SelectionSet:function(e){var t=e.selections;return Mt(t)},Field:function(e){var t=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Oe("",t,": ")+n,c=s+Oe("(",$(i,", "),")");return c.length>zh&&(c=s+Oe(`(
9
9
  `,io($(i,`
10
10
  `)),`
11
- )`)),$([c,$(a," "),o]," ")},Argument:function(e){var r=e.name,n=e.value;return r+": "+n},FragmentSpread:function(e){var r=e.name,n=e.directives;return"..."+r+Ae(" ",$(n," "))},InlineFragment:function(e){var r=e.typeCondition,n=e.directives,i=e.selectionSet;return $(["...",Ae("on ",r),$(n," "),i]," ")},FragmentDefinition:function(e){var r=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(r).concat(Ae("(",$(i,", "),")")," ")+"on ".concat(n," ").concat(Ae("",$(a," ")," "))+o},IntValue:function(e){var r=e.value;return r},FloatValue:function(e){var r=e.value;return r},StringValue:function(e,r){var n=e.value,i=e.block;return i?wl(n,r==="description"?"":" "):JSON.stringify(n)},BooleanValue:function(e){var r=e.value;return r?"true":"false"},NullValue:function(){return"null"},EnumValue:function(e){var r=e.value;return r},ListValue:function(e){var r=e.values;return"["+$(r,", ")+"]"},ObjectValue:function(e){var r=e.fields;return"{"+$(r,", ")+"}"},ObjectField:function(e){var r=e.name,n=e.value;return r+": "+n},Directive:function(e){var r=e.name,n=e.arguments;return"@"+r+Ae("(",$(n,", "),")")},NamedType:function(e){var r=e.name;return r},ListType:function(e){var r=e.type;return"["+r+"]"},NonNullType:function(e){var r=e.type;return r+"!"},SchemaDefinition:$t(function(t){var e=t.directives,r=t.operationTypes;return $(["schema",$(e," "),Mt(r)]," ")}),OperationTypeDefinition:function(e){var r=e.operation,n=e.type;return r+": "+n},ScalarTypeDefinition:$t(function(t){var e=t.name,r=t.directives;return $(["scalar",e,$(r," ")]," ")}),ObjectTypeDefinition:$t(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return $(["type",e,Ae("implements ",$(r," & ")),$(n," "),Mt(i)]," ")}),FieldDefinition:$t(function(t){var e=t.name,r=t.arguments,n=t.type,i=t.directives;return e+(El(r)?Ae(`(
12
- `,io($(r,`
13
- `)),`
14
- )`):Ae("(",$(r,", "),")"))+": "+n+Ae(" ",$(i," "))}),InputValueDefinition:$t(function(t){var e=t.name,r=t.type,n=t.defaultValue,i=t.directives;return $([e+": "+r,Ae("= ",n),$(i," ")]," ")}),InterfaceTypeDefinition:$t(function(t){var e=t.name,r=t.interfaces,n=t.directives,i=t.fields;return $(["interface",e,Ae("implements ",$(r," & ")),$(n," "),Mt(i)]," ")}),UnionTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.types;return $(["union",e,$(r," "),n&&n.length!==0?"= "+$(n," | "):""]," ")}),EnumTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.values;return $(["enum",e,$(r," "),Mt(n)]," ")}),EnumValueDefinition:$t(function(t){var e=t.name,r=t.directives;return $([e,$(r," ")]," ")}),InputObjectTypeDefinition:$t(function(t){var e=t.name,r=t.directives,n=t.fields;return $(["input",e,$(r," "),Mt(n)]," ")}),DirectiveDefinition:$t(function(t){var e=t.name,r=t.arguments,n=t.repeatable,i=t.locations;return"directive @"+e+(El(r)?Ae(`(
15
- `,io($(r,`
11
+ )`)),$([c,$(a," "),o]," ")},Argument:function(e){var t=e.name,n=e.value;return t+": "+n},FragmentSpread:function(e){var t=e.name,n=e.directives;return"..."+t+Oe(" ",$(n," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return $(["...",Oe("on ",t),$(n," "),i]," ")},FragmentDefinition:function(e){var t=e.name,n=e.typeCondition,i=e.variableDefinitions,a=e.directives,o=e.selectionSet;return"fragment ".concat(t).concat(Oe("(",$(i,", "),")")," ")+"on ".concat(n," ").concat(Oe("",$(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 n=e.value,i=e.block;return i?wl(n,t==="description"?"":" "):JSON.stringify(n)},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"["+$(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+$(t,", ")+"}"},ObjectField:function(e){var t=e.name,n=e.value;return t+": "+n},Directive:function(e){var t=e.name,n=e.arguments;return"@"+t+Oe("(",$(n,", "),")")},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:$t(function(r){var e=r.directives,t=r.operationTypes;return $(["schema",$(e," "),Mt(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,n=e.type;return t+": "+n},ScalarTypeDefinition:$t(function(r){var e=r.name,t=r.directives;return $(["scalar",e,$(t," ")]," ")}),ObjectTypeDefinition:$t(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return $(["type",e,Oe("implements ",$(t," & ")),$(n," "),Mt(i)]," ")}),FieldDefinition:$t(function(r){var e=r.name,t=r.arguments,n=r.type,i=r.directives;return e+(El(t)?Oe(`(
12
+ `,io($(t,`
16
13
  `)),`
17
- )`):Ae("(",$(r,", "),")"))+(n?" repeatable":"")+" on "+$(i," | ")}),SchemaExtension:function(e){var r=e.directives,n=e.operationTypes;return $(["extend schema",$(r," "),Mt(n)]," ")},ScalarTypeExtension:function(e){var r=e.name,n=e.directives;return $(["extend scalar",r,$(n," ")]," ")},ObjectTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend type",r,Ae("implements ",$(n," & ")),$(i," "),Mt(a)]," ")},InterfaceTypeExtension:function(e){var r=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend interface",r,Ae("implements ",$(n," & ")),$(i," "),Mt(a)]," ")},UnionTypeExtension:function(e){var r=e.name,n=e.directives,i=e.types;return $(["extend union",r,$(n," "),i&&i.length!==0?"= "+$(i," | "):""]," ")},EnumTypeExtension:function(e){var r=e.name,n=e.directives,i=e.values;return $(["extend enum",r,$(n," "),Mt(i)]," ")},InputObjectTypeExtension:function(e){var r=e.name,n=e.directives,i=e.fields;return $(["extend input",r,$(n," "),Mt(i)]," ")}};function $t(t){return function(e){return $([e.description,t(e)],`
18
- `)}}function $(t){var e,r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=t?.filter(function(n){return n}).join(r))!==null&&e!==void 0?e:""}function Mt(t){return Ae(`{
14
+ )`):Oe("(",$(t,", "),")"))+": "+n+Oe(" ",$(i," "))}),InputValueDefinition:$t(function(r){var e=r.name,t=r.type,n=r.defaultValue,i=r.directives;return $([e+": "+t,Oe("= ",n),$(i," ")]," ")}),InterfaceTypeDefinition:$t(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return $(["interface",e,Oe("implements ",$(t," & ")),$(n," "),Mt(i)]," ")}),UnionTypeDefinition:$t(function(r){var e=r.name,t=r.directives,n=r.types;return $(["union",e,$(t," "),n&&n.length!==0?"= "+$(n," | "):""]," ")}),EnumTypeDefinition:$t(function(r){var e=r.name,t=r.directives,n=r.values;return $(["enum",e,$(t," "),Mt(n)]," ")}),EnumValueDefinition:$t(function(r){var e=r.name,t=r.directives;return $([e,$(t," ")]," ")}),InputObjectTypeDefinition:$t(function(r){var e=r.name,t=r.directives,n=r.fields;return $(["input",e,$(t," "),Mt(n)]," ")}),DirectiveDefinition:$t(function(r){var e=r.name,t=r.arguments,n=r.repeatable,i=r.locations;return"directive @"+e+(El(t)?Oe(`(
19
15
  `,io($(t,`
20
16
  `)),`
21
- }`)}function Ae(t,e){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?t+e+r:""}function io(t){return Ae(" ",t.replace(/\n/g,`
22
- `))}function Qh(t){return t.indexOf(`
23
- `)!==-1}function El(t){return t!=null&&t.some(Qh)}function ji(t){return t.kind===Fe.FIELD||t.kind===Fe.FRAGMENT_SPREAD||t.kind===Fe.INLINE_FRAGMENT}function xl(){return typeof no=="function"?Js():Js()}function em(){__DEV__?L(typeof Zr=="boolean",Zr):L(typeof Zr=="boolean",39)}xl();em();function sr(t,e){var r=t.directives;return!r||!r.length?!0:Tl(r).every(function(n){var i=n.directive,a=n.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?L(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):L(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function Kn(t,e,r){var n=new Set(t),i=n.size;return et(e,{Directive:function(a){if(n.delete(a.name.value)&&(!r||!n.size))return Xr}}),r?!n.size:n.size<i}function ec(t){return t&&Kn(["client","export"],t,!0)}function tm(t){var e=t.name.value;return e==="skip"||e==="include"}function Tl(t){var e=[];return t&&t.length&&t.forEach(function(r){if(!!tm(r)){var n=r.arguments,i=r.name.value;__DEV__?L(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):L(n&&n.length===1,41);var a=n[0];__DEV__?L(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):L(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):L(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:r,ifArgument:a})}}),e}function tc(t,e){var r=e,n=[];t.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new K("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 K(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof r>"u"&&(__DEV__?L(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):L(n.length===1,45),r=n[0].name.value);var i=T(T({},t),{definitions:Sr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:r}}]}}],t.definitions,!0)});return i}function en(t){t===void 0&&(t=[]);var e={};return t.forEach(function(r){e[r.name.value]=r}),e}function tn(t,e){switch(t.kind){case"InlineFragment":return t;case"FragmentSpread":{var r=t.name.value;if(typeof e=="function")return e(r);var n=e&&e[r];return __DEV__?L(n,"No fragment named ".concat(r)):L(n,46),n||null}default:return null}}function ce(t){return t!==null&&typeof t=="object"}function zt(t){return{__ref:String(t)}}function te(t){return Boolean(t&&typeof t=="object"&&typeof t.__ref=="string")}function rc(t){return ce(t)&&t.kind==="Document"&&Array.isArray(t.definitions)}function rm(t){return t.kind==="StringValue"}function nm(t){return t.kind==="BooleanValue"}function im(t){return t.kind==="IntValue"}function am(t){return t.kind==="FloatValue"}function om(t){return t.kind==="Variable"}function sm(t){return t.kind==="ObjectValue"}function cm(t){return t.kind==="ListValue"}function um(t){return t.kind==="EnumValue"}function lm(t){return t.kind==="NullValue"}function Er(t,e,r,n){if(im(r)||am(r))t[e.value]=Number(r.value);else if(nm(r)||rm(r))t[e.value]=r.value;else if(sm(r)){var i={};r.fields.map(function(o){return Er(i,o.name,o.value,n)}),t[e.value]=i}else if(om(r)){var a=(n||{})[r.name.value];t[e.value]=a}else if(cm(r))t[e.value]=r.values.map(function(o){var s={};return Er(s,e,o,n),s[e.value]});else if(um(r))t[e.value]=r.value;else if(lm(r))t[e.value]=null;else throw __DEV__?new K('The inline argument "'.concat(e.value,'" of kind "').concat(r.kind,'"')+"is not supported. Use variables instead of inline arguments to overcome this limitation."):new K(55)}function nc(t,e){var r=null;t.directives&&(r={},t.directives.forEach(function(i){r[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return Er(r[i.name.value],o,s,e)})}));var n=null;return t.arguments&&t.arguments.length&&(n={},t.arguments.forEach(function(i){var a=i.name,o=i.value;return Er(n,a,o,e)})),qi(t.name.value,n,r)}var fm=["connection","include","skip","client","rest","export"],qi=Object.assign(function(t,e,r){if(e&&r&&r.connection&&r.connection.key)if(r.connection.filter&&r.connection.filter.length>0){var n=r.connection.filter?r.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(r.connection.key,"(").concat(Ui(i),")")}else return r.connection.key;var a=t;if(e){var o=Ui(e);a+="(".concat(o,")")}return r&&Object.keys(r).forEach(function(s){fm.indexOf(s)===-1&&(r[s]&&Object.keys(r[s]).length?a+="@".concat(s,"(").concat(Ui(r[s]),")"):a+="@".concat(s))}),a},{setStringify:function(t){var e=Ui;return Ui=t,e}}),Ui=function(e){return JSON.stringify(e,pm)};function pm(t,e){return ce(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(r,n){return r[n]=e[n],r},{})),e}function cr(t,e){if(t.arguments&&t.arguments.length){var r={};return t.arguments.forEach(function(n){var i=n.name,a=n.value;return Er(r,i,a,e)}),r}return null}function It(t){return t.alias?t.alias.value:t.name.value}function Bi(t,e,r){if(typeof t.__typename=="string")return t.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(yt(a)){if(a.name.value==="__typename")return t[It(a)]}else{var o=Bi(t,tn(a,r).selectionSet,r);if(typeof o=="string")return o}}}function yt(t){return t.kind==="Field"}function ic(t){return t.kind==="InlineFragment"}function Hn(t){__DEV__?L(t&&t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(t&&t.kind==="Document",47);var e=t.definitions.filter(function(r){return r.kind!=="FragmentDefinition"}).map(function(r){if(r.kind!=="OperationDefinition")throw __DEV__?new K('Schema type definitions not allowed in queries. Found: "'.concat(r.kind,'"')):new K(48);return r});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),t}function Wt(t){return Hn(t),t.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Jn(t){return t.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function rn(t){return t.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Vi(t){var e=Wt(t);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function ac(t){__DEV__?L(t.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(t.kind==="Document",51),__DEV__?L(t.definitions.length<=1,"Fragment must have exactly one definition."):L(t.definitions.length<=1,52);var e=t.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function nn(t){Hn(t);for(var e,r=0,n=t.definitions;r<n.length;r++){var i=n[r];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw __DEV__?new K("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new K(54)}function an(t){var e=Object.create(null),r=t&&t.variableDefinitions;return r&&r.length&&r.forEach(function(n){n.defaultValue&&Er(e,n.variable.name,n.defaultValue)}),e}var ge=Array.isArray;function $e(t){return Array.isArray(t)&&t.length>0}var Il={kind:Fe.FIELD,name:{kind:Fe.NAME,value:"__typename"}};function Al(t,e){return!t||t.selectionSet.selections.every(function(r){return r.kind===Fe.FRAGMENT_SPREAD&&Al(e[r.name.value],e)})}function dm(t){return Al(Wt(t)||ac(t),en(rn(t)))?null:t}function hm(t){var e=new Set,r=[];return t.forEach(function(n){n.name?e.add(n.name):n.test&&r.push(n.test)}),function(n){return e.has(n.name.value)||r.some(function(i){return i(n)})}}function kl(t){var e=new Map;return function(n){n===void 0&&(n=t);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function oc(t,e){for(var r=kl(""),n=kl(""),i=function(S){for(var w=0,b=void 0;w<S.length&&(b=S[w]);++w)if(!ge(b)){if(b.kind===Fe.OPERATION_DEFINITION)return r(b.name&&b.name.value);if(b.kind===Fe.FRAGMENT_DEFINITION)return n(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===Fe.OPERATION_DEFINITION&&++a;var s=hm(t),c=t.some(function(S){return S.remove}),u=function(S){return c&&S&&S.some(s)},l=new Map,d=!1,p={enter:function(S){if(u(S.directives))return d=!0,null}},f=et(e,{Field:p,InlineFragment:p,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(S,w,b,O,C){var E=i(C);E&&E.variables.add(S.name.value)}},FragmentSpread:{enter:function(S,w,b,O,C){if(u(S.directives))return d=!0,null;var E=i(C);E&&E.fragmentSpreads.add(S.name.value)}},FragmentDefinition:{enter:function(S,w,b,O){l.set(JSON.stringify(O),S)},leave:function(S,w,b,O){var C=l.get(JSON.stringify(O));if(S===C)return S;if(a>0&&S.selectionSet.selections.every(function(E){return E.kind===Fe.FIELD&&E.name.value==="__typename"}))return n(S.name.value).removed=!0,d=!0,null}},Directive:{leave:function(S){if(s(S))return d=!0,null}}});if(!d)return e;var h=function(S){return S.transitiveVars||(S.transitiveVars=new Set(S.variables),S.removed||S.fragmentSpreads.forEach(function(w){h(n(w)).transitiveVars.forEach(function(b){S.transitiveVars.add(b)})})),S},m=new Set;f.definitions.forEach(function(S){S.kind===Fe.OPERATION_DEFINITION?h(r(S.name&&S.name.value)).fragmentSpreads.forEach(function(w){m.add(w)}):S.kind===Fe.FRAGMENT_DEFINITION&&a===0&&!n(S.name.value).removed&&m.add(S.name.value)}),m.forEach(function(S){h(n(S)).fragmentSpreads.forEach(function(w){m.add(w)})});var g=function(S){return!!(!m.has(S)||n(S).removed)},_={enter:function(S){if(g(S.name.value))return null}};return dm(et(f,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(S){if(S.variableDefinitions){var w=h(r(S.name&&S.name.value)).transitiveVars;if(w.size<S.variableDefinitions.length)return T(T({},S),{variableDefinitions:S.variableDefinitions.filter(function(b){return w.has(b.variable.name.value)})})}}}}))}var on=Object.assign(function(t){return et(t,{SelectionSet:{enter:function(e,r,n){if(!(n&&n.kind===Fe.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return yt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(yt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return T(T({},e),{selections:Sr(Sr([],i,!0),[Il],!1)})}}}}}})},{added:function(t){return t===Il}}),mm={test:function(t){var e=t.name.value==="connection";return e&&(!t.arguments||!t.arguments.some(function(r){return r.name.value==="key"}))&&__DEV__&&L.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function sc(t){return oc([mm],Hn(t))}function cc(t){var e=nn(t),r=e.operation;if(r==="query")return t;var n=et(t,{OperationDefinition:{enter:function(i){return T(T({},i),{operation:"query"})}}});return n}function uc(t){Hn(t);var e=oc([{test:function(r){return r.name.value==="client"},remove:!0}],t);return e}var gm=Object.prototype.hasOwnProperty;function lc(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return Qi(t)}function Qi(t){var e=t[0]||{},r=t.length;if(r>1)for(var n=new lt,i=1;i<r;++i)e=n.merge(e,t[i]);return e}var ym=function(t,e,r){return this.merge(t[r],e[r])},lt=function(){function t(e){e===void 0&&(e=ym),this.reconciler=e,this.isObject=ce,this.pastCopies=new Set}return t.prototype.merge=function(e,r){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return ce(r)&&ce(e)?(Object.keys(r).forEach(function(o){if(gm.call(e,o)){var s=e[o];if(r[o]!==s){var c=n.reconciler.apply(n,Sr([e,r,o],i,!1));c!==s&&(e=n.shallowCopyForMerge(e),e[o]=c)}}else e=n.shallowCopyForMerge(e),e[o]=r[o]}),e):r},t.prototype.shallowCopyForMerge=function(e){return ce(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=T({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},t}();function vm(t,e){var r=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(r)return(r=r.call(t)).next.bind(r);if(Array.isArray(t)||(r=bm(t))||e&&t&&typeof t.length=="number"){r&&(t=r);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
24
- In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function bm(t,e){if(!!t){if(typeof t=="string")return Ol(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);if(r==="Object"&&t.constructor&&(r=t.constructor.name),r==="Map"||r==="Set")return Array.from(t);if(r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Ol(t,e)}}function Ol(t,e){(e==null||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Dl(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function hc(t,e,r){return e&&Dl(t.prototype,e),r&&Dl(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}var mc=function(){return typeof Symbol=="function"},gc=function(t){return mc()&&Boolean(Symbol[t])},yc=function(t){return gc(t)?Symbol[t]:"@@"+t};mc()&&!gc("observable")&&(Symbol.observable=Symbol("observable"));var _m=yc("iterator"),pc=yc("observable"),Nl=yc("species");function oo(t,e){var r=t[e];if(r!=null){if(typeof r!="function")throw new TypeError(r+" is not a function");return r}}function zi(t){var e=t.constructor;return e!==void 0&&(e=e[Nl],e===null&&(e=void 0)),e!==void 0?e:ee}function Sm(t){return t instanceof ee}function Yn(t){Yn.log?Yn.log(t):setTimeout(function(){throw t})}function ao(t){Promise.resolve().then(function(){try{t()}catch(e){Yn(e)}})}function Cl(t){var e=t._cleanup;if(e!==void 0&&(t._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var r=oo(e,"unsubscribe");r&&r.call(e)}}catch(n){Yn(n)}}function dc(t){t._observer=void 0,t._queue=void 0,t._state="closed"}function wm(t){var e=t._queue;if(!!e){t._queue=void 0,t._state="ready";for(var r=0;r<e.length&&(Rl(t,e[r].type,e[r].value),t._state!=="closed");++r);}}function Rl(t,e,r){t._state="running";var n=t._observer;try{var i=oo(n,e);switch(e){case"next":i&&i.call(n,r);break;case"error":if(dc(t),i)i.call(n,r);else throw r;break;case"complete":dc(t),i&&i.call(n);break}}catch(a){Yn(a)}t._state==="closed"?Cl(t):t._state==="running"&&(t._state="ready")}function fc(t,e,r){if(t._state!=="closed"){if(t._state==="buffering"){t._queue.push({type:e,value:r});return}if(t._state!=="ready"){t._state="buffering",t._queue=[{type:e,value:r}],ao(function(){return wm(t)});return}Rl(t,e,r)}}var Em=function(){function t(r,n){this._cleanup=void 0,this._observer=r,this._queue=void 0,this._state="initializing";var i=new xm(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=t.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(dc(this),Cl(this))},hc(t,[{key:"closed",get:function(){return this._state==="closed"}}]),t}(),xm=function(){function t(r){this._subscription=r}var e=t.prototype;return e.next=function(n){fc(this._subscription,"next",n)},e.error=function(n){fc(this._subscription,"error",n)},e.complete=function(){fc(this._subscription,"complete")},hc(t,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),t}(),ee=function(){function t(r){if(!(this instanceof t))throw new TypeError("Observable cannot be called as a function");if(typeof r!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=r}var e=t.prototype;return e.subscribe=function(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new Em(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,o){if(typeof n!="function"){o(new TypeError(n+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=i.subscribe({next:function(u){try{n(u,s)}catch(l){o(l),c.unsubscribe()}},error:o,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){return i.subscribe({next:function(s){try{s=n(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){return i.subscribe({next:function(s){try{if(!n(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(d){var p=!s;if(s=!0,!p||o)try{u=n(u,d)}catch(f){return l.error(f)}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 n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=zi(this);return new s(function(c){var u,l=0;function d(p){u=p.subscribe({next:function(f){c.next(f)},error:function(f){c.error(f)},complete:function(){l===a.length?(u=void 0,c.complete()):d(s.from(a[l++]))}})}return d(n),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(p){return o.error(p)}var d=a.from(l).subscribe({next:function(p){o.next(p)},error:function(p){o.error(p)},complete:function(){var p=s.indexOf(d);p>=0&&s.splice(p,1),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[pc]=function(){return this},t.from=function(n){var i=typeof this=="function"?this:t;if(n==null)throw new TypeError(n+" is not an object");var a=oo(n,pc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Sm(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(gc("iterator")&&(a=oo(n,_m),a))return new i(function(s){ao(function(){if(!s.closed){for(var c=vm(a.call(n)),u;!(u=c()).done;){var l=u.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(n))return new i(function(s){ao(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})});throw new TypeError(n+" is not observable")},t.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=typeof this=="function"?this:t;return new o(function(s){ao(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},hc(t,null,[{key:Nl,get:function(){return this}}]),t}();mc()&&Object.defineProperty(ee,Symbol("extensions"),{value:{symbol:pc,hostReportError:Yn},configurable:!0});function vc(t){var e,r=t.Symbol;if(typeof r=="function")if(r.observable)e=r.observable;else{typeof r.for=="function"?e=r.for("https://github.com/benlesh/symbol-observable"):e=r("https://github.com/benlesh/symbol-observable");try{r.observable=e}catch{}}else e="@@observable";return e}var Zn;typeof self<"u"?Zn=self:typeof window<"u"?Zn=window:typeof global<"u"?Zn=global:typeof module<"u"?Zn=module:Zn=Function("return this")();var Cw=vc(Zn);var Pl=ee.prototype,Fl="@@observable";Pl[Fl]||(Pl[Fl]=function(){return this});var Tm=Object.prototype.toString;function so(t){return bc(t)}function bc(t,e){switch(Tm.call(t)){case"[object Array]":{if(e=e||new Map,e.has(t))return e.get(t);var r=t.slice(0);return e.set(t,r),r.forEach(function(i,a){r[a]=bc(i,e)}),r}case"[object Object]":{if(e=e||new Map,e.has(t))return e.get(t);var n=Object.create(Object.getPrototypeOf(t));return e.set(t,n),Object.keys(t).forEach(function(i){n[i]=bc(t[i],e)}),n}default:return t}}function Im(t){var e=new Set([t]);return e.forEach(function(r){ce(r)&&km(r)===r&&Object.getOwnPropertyNames(r).forEach(function(n){ce(r[n])&&e.add(r[n])})}),t}function km(t){if(__DEV__&&!Object.isFrozen(t))try{Object.freeze(t)}catch(e){if(e instanceof TypeError)return null;throw e}return t}function Wi(t){return __DEV__&&Im(t),t}function sn(t,e,r){var n=[];t.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](r)})}function co(t,e,r){return new ee(function(n){var i=n.next,a=n.error,o=n.complete,s=0,c=!1,u={then:function(f){return new Promise(function(h){return h(f())})}};function l(f,h){return f?function(m){++s;var g=function(){return f(m)};u=u.then(g,g).then(function(_){--s,i&&i.call(n,_),c&&d.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(n,_)})}:function(m){return h&&h.call(n,m)}}var d={next:l(e,i),error:l(r,a),complete:function(){c=!0,s||o&&o.call(n)}},p=t.subscribe(d);return function(){return p.unsubscribe()}})}var kt=typeof WeakMap=="function"&&Be(function(){return navigator.product})!=="ReactNative",Ll=typeof WeakSet=="function",_c=typeof Symbol=="function"&&typeof Symbol.for=="function",xr=_c&&Symbol.asyncIterator,zw=typeof Be(function(){return window.document.createElement})=="function",Ww=Be(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function uo(t){function e(r){Object.defineProperty(t,r,{value:ee})}return _c&&Symbol.species&&e(Symbol.species),e("@@species"),t}function $l(t){return t&&typeof t.then=="function"}var Xn=function(t){Oe(e,t);function e(r){var n=t.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),sn(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),sn(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,o=i.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?$l(c)?c.then(function(u){return n.sub=u.subscribe(n.handlers)}):n.sub=c.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),sn(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof r=="function"&&(r=[new ee(r)]),$l(r)?r.then(function(i){return n.start(i)},n.handlers.error):n.start(r),n}return e.prototype.start=function(r){this.sub===void 0&&(this.sources=Array.from(r),this.handlers.complete())},e.prototype.deliverLastMessage=function(r){if(this.latest){var n=this.latest[0],i=r[n];i&&i.call(r,this.latest[1]),this.sub===null&&n==="next"&&r.complete&&r.complete()}},e.prototype.addObserver=function(r){this.observers.has(r)||(this.deliverLastMessage(r),this.observers.add(r))},e.prototype.removeObserver=function(r){this.observers.delete(r)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(r,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(r,n)}))},e.prototype.beforeNext=function(r){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,r(i,a))})},e}(ee);uo(Xn);function Tr(t){return"incremental"in t}function Am(t){return"hasNext"in t&&"data"in t}function Ml(t){return Tr(t)||Am(t)}function lo(t,e){var r=t,n=new lt;return Tr(e)&&$e(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,o=i.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}r=n.merge(r,a)}),r}function ei(t){var e=fo(t);return $e(e)}function fo(t){var e=$e(t.errors)?t.errors.slice(0):[];return Tr(t)&&$e(t.incremental)&&t.incremental.forEach(function(r){r.errors&&e.push.apply(e,r.errors)}),e}function Ir(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var r=Object.create(null);return t.forEach(function(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(r[i]=a)})}),r}var jl=new Map;function Gi(t){var e=jl.get(t)||1;return jl.set(t,e+1),"".concat(t,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ul(t){var e=Gi("stringifyForDisplay");return JSON.stringify(t,function(r,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Ki(t,e){return Ir(t,e,e.variables&&{variables:T(T({},t&&t.variables),e.variables)})}function po(t){return new ee(function(e){e.error(t)})}var Hi=function(t,e,r){var n=new Error(r);throw n.name="ServerError",n.response=t,n.statusCode=t.status,n.result=e,n};function Sc(t){for(var e=["query","operationName","variables","extensions","context"],r=0,n=Object.keys(t);r<n.length;r++){var i=n[r];if(e.indexOf(i)<0)throw __DEV__?new K("illegal argument: ".concat(i)):new K(27)}return t}function wc(t,e){var r=T({},t),n=function(a){typeof a=="function"?r=T(T({},r),a(r)):r=T(T({},r),a)},i=function(){return T({},r)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function Ec(t){var e={variables:t.variables||{},extensions:t.extensions||{},operationName:t.operationName,query:t.query};return e.operationName||(e.operationName=typeof e.query!="string"?Jn(e.query)||void 0:""),e}function ql(t,e){return e?e(t):ee.of()}function Ji(t){return typeof t=="function"?new At(t):t}function ho(t){return t.request.length<=1}var Om=function(t){Oe(e,t);function e(r,n){var i=t.call(this,r)||this;return i.link=n,i}return e}(Error),At=function(){function t(e){e&&(this.request=e)}return t.empty=function(){return new t(function(){return ee.of()})},t.from=function(e){return e.length===0?t.empty():e.map(Ji).reduce(function(r,n){return r.concat(n)})},t.split=function(e,r,n){var i=Ji(r),a=Ji(n||new t(ql));return ho(i)&&ho(a)?new t(function(o){return e(o)?i.request(o)||ee.of():a.request(o)||ee.of()}):new t(function(o,s){return e(o)?i.request(o,s)||ee.of():a.request(o,s)||ee.of()})},t.execute=function(e,r){return e.request(wc(r.context,Ec(Sc(r))))||ee.of()},t.concat=function(e,r){var n=Ji(e);if(ho(n))return __DEV__&&L.warn(new Om("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Ji(r);return ho(i)?new t(function(a){return n.request(a,function(o){return i.request(o)||ee.of()})||ee.of()}):new t(function(a,o){return n.request(a,function(s){return i.request(s,o)||ee.of()})||ee.of()})},t.prototype.split=function(e,r,n){return this.concat(t.split(e,r,n||new t(ql)))},t.prototype.concat=function(e){return t.concat(this,e)},t.prototype.request=function(e,r){throw __DEV__?new K("request is not implemented"):new K(22)},t.prototype.onError=function(e,r){if(r&&r.error)return r.error(e),!1;throw e},t.prototype.setOnError=function(e){return this.onError=e,this},t}();var ti=At.execute;var Bl="3.7.10";function Vl(t){return!!t.body}function Ql(t){return!!t.getReader}function zl(t){return!!(xr&&t[Symbol.asyncIterator])}function Wl(t){return!!t.stream}function Gl(t){return!!t.arrayBuffer}function Kl(t){return!!t.pipe}function xc(t){var e,r=t[Symbol.asyncIterator]();return e={next:function(){return r.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Tc(t){var e=null,r=null,n=!1,i=[],a=[];function o(d){if(!r){if(a.length){var p=a.shift();if(Array.isArray(p)&&p[0])return p[0]({value:d,done:!1})}i.push(d)}}function s(d){r=d;var p=a.slice();p.forEach(function(f){f[1](d)}),!e||e()}function c(){n=!0;var d=a.slice();d.forEach(function(p){p[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,t.removeListener("data",o),t.removeListener("error",s),t.removeListener("end",c),t.removeListener("finish",c),t.removeListener("close",c)},t.on("data",o),t.on("error",s),t.on("end",c),t.on("finish",c),t.on("close",c);function u(){return new Promise(function(d,p){if(r)return p(r);if(i.length)return d({value:i.shift(),done:!1});if(n)return d({value:void 0,done:!0});a.push([d,p])})}var l={next:function(){return u()}};return xr&&(l[Symbol.asyncIterator]=function(){return this}),l}function Ic(t){var e=!1,r={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){t.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return xr&&(r[Symbol.asyncIterator]=function(){return this}),r}function mo(t){var e={next:function(){return t.read()}};return xr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Hl(t){var e=t;if(Vl(t)&&(e=t.body),zl(e))return xc(e);if(Ql(e))return mo(e.getReader());if(Wl(e))return mo(e.stream().getReader());if(Gl(e))return Ic(e.arrayBuffer());if(Kl(e))return Tc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Jl=Object.prototype.hasOwnProperty;function Yl(t,e){var r,n,i;return Ft(this,void 0,void 0,function(){var a,o,s,c,u,l,d,p,f,h,m,g,_,S,w,b,O,C,E,R;return Lt(this,function(F){switch(F.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(r=t.headers)===null||r===void 0?void 0:r.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=Hl(t),p=!0,F.label=1;case 1:return p?[4,d.next()]:[3,3];case 2:for(f=F.sent(),h=f.value,m=f.done,g=typeof h=="string"?h:a.decode(h),p=!m,l+=g,_=l.indexOf(u);_>-1;){if(S=void 0,R=[l.slice(0,_),l.slice(_+u.length)],S=R[0],l=R[1],S.trim()){if(w=S.indexOf(`\r
17
+ )`):Oe("(",$(t,", "),")"))+(n?" repeatable":"")+" on "+$(i," | ")}),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return $(["extend schema",$(t," "),Mt(n)]," ")},ScalarTypeExtension:function(e){var t=e.name,n=e.directives;return $(["extend scalar",t,$(n," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend type",t,Oe("implements ",$(n," & ")),$(i," "),Mt(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return $(["extend interface",t,Oe("implements ",$(n," & ")),$(i," "),Mt(a)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,i=e.types;return $(["extend union",t,$(n," "),i&&i.length!==0?"= "+$(i," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,i=e.values;return $(["extend enum",t,$(n," "),Mt(i)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return $(["extend input",t,$(n," "),Mt(i)]," ")}};function $t(r){return function(e){return $([e.description,r(e)],`
18
+ `)}}function $(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(n){return n}).join(t))!==null&&e!==void 0?e:""}function Mt(r){return Oe(`{
19
+ `,io($(r,`
20
+ `)),`
21
+ }`)}function Oe(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function io(r){return Oe(" ",r.replace(/\n/g,`
22
+ `))}function Gh(r){return r.indexOf(`
23
+ `)!==-1}function El(r){return r!=null&&r.some(Gh)}function ji(r){return r.kind===Fe.FIELD||r.kind===Fe.FRAGMENT_SPREAD||r.kind===Fe.INLINE_FRAGMENT}function xl(){return typeof no=="function"?Ys():Ys()}function nm(){__DEV__?F(typeof Xr=="boolean",Xr):F(typeof Xr=="boolean",39)}xl();nm();function sr(r,e){var t=r.directives;return!t||!t.length?!0:Il(t).every(function(n){var i=n.directive,a=n.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?F(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):F(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function Kn(r,e,t){var n=new Set(r),i=n.size;return Xe(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return en}}),t?!n.size:n.size<i}function tc(r){return r&&Kn(["client","export"],r,!0)}function im(r){var e=r.name.value;return e==="skip"||e==="include"}function Il(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!im(t)){var n=t.arguments,i=t.name.value;__DEV__?F(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):F(n&&n.length===1,41);var a=n[0];__DEV__?F(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):F(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?F(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):F(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function rc(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new G("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 G(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(__DEV__?F(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):F(n.length===1,45),t=n[0].name.value);var i=x(x({},r),{definitions:_r([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function tn(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function rn(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var n=e&&e[t];return __DEV__?F(n,"No fragment named ".concat(t)):F(n,46),n||null}default:return null}}function se(r){return r!==null&&typeof r=="object"}function zt(r){return{__ref:String(r)}}function ee(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function nc(r){return se(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function am(r){return r.kind==="StringValue"}function om(r){return r.kind==="BooleanValue"}function sm(r){return r.kind==="IntValue"}function cm(r){return r.kind==="FloatValue"}function um(r){return r.kind==="Variable"}function lm(r){return r.kind==="ObjectValue"}function pm(r){return r.kind==="ListValue"}function fm(r){return r.kind==="EnumValue"}function dm(r){return r.kind==="NullValue"}function Er(r,e,t,n){if(sm(t)||cm(t))r[e.value]=Number(t.value);else if(om(t)||am(t))r[e.value]=t.value;else if(lm(t)){var i={};t.fields.map(function(o){return Er(i,o.name,o.value,n)}),r[e.value]=i}else if(um(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(pm(t))r[e.value]=t.values.map(function(o){var s={};return Er(s,e,o,n),s[e.value]});else if(fm(t))r[e.value]=t.value;else if(dm(t))r[e.value]=null;else throw __DEV__?new G('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 G(55)}function ic(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(i){t[i.name.value]={},i.arguments&&i.arguments.forEach(function(a){var o=a.name,s=a.value;return Er(t[i.name.value],o,s,e)})}));var n=null;return r.arguments&&r.arguments.length&&(n={},r.arguments.forEach(function(i){var a=i.name,o=i.value;return Er(n,a,o,e)})),qi(r.name.value,n,t)}var hm=["connection","include","skip","client","rest","export"],qi=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var n=t.connection.filter?t.connection.filter:[];n.sort();var i={};return n.forEach(function(s){i[s]=e[s]}),"".concat(t.connection.key,"(").concat(Ui(i),")")}else return t.connection.key;var a=r;if(e){var o=Ui(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){hm.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(Ui(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=Ui;return Ui=r,e}}),Ui=function(e){return JSON.stringify(e,mm)};function mm(r,e){return se(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})),e}function cr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return Er(t,i,a,e)}),t}return null}function Tt(r){return r.alias?r.alias.value:r.name.value}function Bi(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var n=0,i=e.selections;n<i.length;n++){var a=i[n];if(gt(a)){if(a.name.value==="__typename")return r[Tt(a)]}else{var o=Bi(r,rn(a,t).selectionSet,t);if(typeof o=="string")return o}}}function gt(r){return r.kind==="Field"}function ac(r){return r.kind==="InlineFragment"}function Hn(r){__DEV__?F(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'):F(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 G('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new G(48);return t});return __DEV__?F(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):F(e.length<=1,49),r}function Wt(r){return Hn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Jn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function nn(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Vi(r){var e=Wt(r);return __DEV__?F(e&&e.operation==="query","Must contain a query definition."):F(e&&e.operation==="query",50),e}function oc(r){__DEV__?F(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'):F(r.kind==="Document",51),__DEV__?F(r.definitions.length<=1,"Fragment must have exactly one definition."):F(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?F(e.kind==="FragmentDefinition","Must be a fragment definition."):F(e.kind==="FragmentDefinition",53),e}function an(r){Hn(r);for(var e,t=0,n=r.definitions;t<n.length;t++){var i=n[t];if(i.kind==="OperationDefinition"){var a=i.operation;if(a==="query"||a==="mutation"||a==="subscription")return i}i.kind==="FragmentDefinition"&&!e&&(e=i)}if(e)return e;throw __DEV__?new G("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new G(54)}function on(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&Er(e,n.variable.name,n.defaultValue)}),e}var ge=Array.isArray;function Me(r){return Array.isArray(r)&&r.length>0}var Tl={kind:Fe.FIELD,name:{kind:Fe.NAME,value:"__typename"}};function Al(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Fe.FRAGMENT_SPREAD&&Al(e[t.name.value],e)})}function gm(r){return Al(Wt(r)||oc(r),tn(nn(r)))?null:r}function ym(r){var e=new Set,t=[];return r.forEach(function(n){n.name?e.add(n.name):n.test&&t.push(n.test)}),function(n){return e.has(n.name.value)||t.some(function(i){return i(n)})}}function kl(r){var e=new Map;return function(n){n===void 0&&(n=r);var i=e.get(n);return i||e.set(n,i={variables:new Set,fragmentSpreads:new Set}),i}}function sc(r,e){for(var t=kl(""),n=kl(""),i=function(S){for(var w=0,v=void 0;w<S.length&&(v=S[w]);++w)if(!ge(v)){if(v.kind===Fe.OPERATION_DEFINITION)return t(v.name&&v.name.value);if(v.kind===Fe.FRAGMENT_DEFINITION)return n(v.name.value)}return __DEV__&&F.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Fe.OPERATION_DEFINITION&&++a;var s=ym(r),c=r.some(function(S){return S.remove}),u=function(S){return c&&S&&S.some(s)},l=new Map,d=!1,f={enter:function(S){if(u(S.directives))return d=!0,null}},p=Xe(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(S,w,v,A,R){var E=i(R);E&&E.variables.add(S.name.value)}},FragmentSpread:{enter:function(S,w,v,A,R){if(u(S.directives))return d=!0,null;var E=i(R);E&&E.fragmentSpreads.add(S.name.value)}},FragmentDefinition:{enter:function(S,w,v,A){l.set(JSON.stringify(A),S)},leave:function(S,w,v,A){var R=l.get(JSON.stringify(A));if(S===R)return S;if(a>0&&S.selectionSet.selections.every(function(E){return E.kind===Fe.FIELD&&E.name.value==="__typename"}))return n(S.name.value).removed=!0,d=!0,null}},Directive:{leave:function(S){if(s(S))return d=!0,null}}});if(!d)return e;var h=function(S){return S.transitiveVars||(S.transitiveVars=new Set(S.variables),S.removed||S.fragmentSpreads.forEach(function(w){h(n(w)).transitiveVars.forEach(function(v){S.transitiveVars.add(v)})})),S},m=new Set;p.definitions.forEach(function(S){S.kind===Fe.OPERATION_DEFINITION?h(t(S.name&&S.name.value)).fragmentSpreads.forEach(function(w){m.add(w)}):S.kind===Fe.FRAGMENT_DEFINITION&&a===0&&!n(S.name.value).removed&&m.add(S.name.value)}),m.forEach(function(S){h(n(S)).fragmentSpreads.forEach(function(w){m.add(w)})});var y=function(S){return!!(!m.has(S)||n(S).removed)},_={enter:function(S){if(y(S.name.value))return null}};return gm(Xe(p,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(S){if(S.variableDefinitions){var w=h(t(S.name&&S.name.value)).transitiveVars;if(w.size<S.variableDefinitions.length)return x(x({},S),{variableDefinitions:S.variableDefinitions.filter(function(v){return w.has(v.variable.name.value)})})}}}}))}var sn=Object.assign(function(r){return Xe(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Fe.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return gt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(gt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return x(x({},e),{selections:_r(_r([],i,!0),[Tl],!1)})}}}}}})},{added:function(r){return r===Tl}}),vm={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&F.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 cc(r){return sc([vm],Hn(r))}function uc(r){var e=an(r),t=e.operation;if(t==="query")return r;var n=Xe(r,{OperationDefinition:{enter:function(i){return x(x({},i),{operation:"query"})}}});return n}function lc(r){Hn(r);var e=sc([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var bm=Object.prototype.hasOwnProperty;function pc(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Qi(r)}function Qi(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new ut,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var Sm=function(r,e,t){return this.merge(r[t],e[t])},ut=function(){function r(e){e===void 0&&(e=Sm),this.reconciler=e,this.isObject=se,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return se(t)&&se(e)?(Object.keys(t).forEach(function(o){if(bm.call(e,o)){var s=e[o];if(t[o]!==s){var c=n.reconciler.apply(n,_r([e,t,o],i,!1));c!==s&&(e=n.shallowCopyForMerge(e),e[o]=c)}}else e=n.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return se(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=x({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function _m(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=wm(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var n=0;return function(){return n>=r.length?{done:!0}:{done:!1,value:r[n++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
24
+ In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function wm(r,e){if(!!r){if(typeof r=="string")return Ol(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 Ol(r,e)}}function Ol(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,n=new Array(e);t<e;t++)n[t]=r[t];return n}function Nl(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function mc(r,e,t){return e&&Nl(r.prototype,e),t&&Nl(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var gc=function(){return typeof Symbol=="function"},yc=function(r){return gc()&&Boolean(Symbol[r])},vc=function(r){return yc(r)?Symbol[r]:"@@"+r};gc()&&!yc("observable")&&(Symbol.observable=Symbol("observable"));var Em=vc("iterator"),dc=vc("observable"),Dl=vc("species");function oo(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function zi(r){var e=r.constructor;return e!==void 0&&(e=e[Dl],e===null&&(e=void 0)),e!==void 0?e:X}function xm(r){return r instanceof X}function Yn(r){Yn.log?Yn.log(r):setTimeout(function(){throw r})}function ao(r){Promise.resolve().then(function(){try{r()}catch(e){Yn(e)}})}function Cl(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=oo(e,"unsubscribe");t&&t.call(e)}}catch(n){Yn(n)}}function hc(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function Im(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Rl(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Rl(r,e,t){r._state="running";var n=r._observer;try{var i=oo(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(hc(r),i)i.call(n,t);else throw t;break;case"complete":hc(r),i&&i.call(n);break}}catch(a){Yn(a)}r._state==="closed"?Cl(r):r._state==="running"&&(r._state="ready")}function fc(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}],ao(function(){return Im(r)});return}Rl(r,e,t)}}var Tm=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new km(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(hc(this),Cl(this))},mc(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),km=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){fc(this._subscription,"next",n)},e.error=function(n){fc(this._subscription,"error",n)},e.complete=function(){fc(this._subscription,"complete")},mc(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),X=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(n){return(typeof n!="object"||n===null)&&(n={next:n,error:arguments[1],complete:arguments[2]}),new Tm(n,this._subscriber)},e.forEach=function(n){var i=this;return new Promise(function(a,o){if(typeof n!="function"){o(new TypeError(n+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=i.subscribe({next:function(u){try{n(u,s)}catch(l){o(l),c.unsubscribe()}},error:o,complete:a})})},e.map=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){return i.subscribe({next:function(s){try{s=n(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){return i.subscribe({next:function(s){try{if(!n(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{u=n(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 n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=zi(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(n),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=zi(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(f){return o.error(f)}var d=a.from(l).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),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[dc]=function(){return this},r.from=function(n){var i=typeof this=="function"?this:r;if(n==null)throw new TypeError(n+" is not an object");var a=oo(n,dc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return xm(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(yc("iterator")&&(a=oo(n,Em),a))return new i(function(s){ao(function(){if(!s.closed){for(var c=_m(a.call(n)),u;!(u=c()).done;){var l=u.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(n))return new i(function(s){ao(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})});throw new TypeError(n+" is not observable")},r.of=function(){for(var n=arguments.length,i=new Array(n),a=0;a<n;a++)i[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){ao(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},mc(r,null,[{key:Dl,get:function(){return this}}]),r}();gc()&&Object.defineProperty(X,Symbol("extensions"),{value:{symbol:dc,hostReportError:Yn},configurable:!0});function bc(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 Zn;typeof self<"u"?Zn=self:typeof window<"u"?Zn=window:typeof global<"u"?Zn=global:typeof module<"u"?Zn=module:Zn=Function("return this")();var Cw=bc(Zn);var Pl=X.prototype,Ll="@@observable";Pl[Ll]||(Pl[Ll]=function(){return this});var Am=Object.prototype.toString;function so(r){return Sc(r)}function Sc(r,e){switch(Am.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(i,a){t[a]=Sc(i,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var n=Object.create(Object.getPrototypeOf(r));return e.set(r,n),Object.keys(r).forEach(function(i){n[i]=Sc(r[i],e)}),n}default:return r}}function Om(r){var e=new Set([r]);return e.forEach(function(t){se(t)&&Nm(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){se(t[n])&&e.add(t[n])})}),r}function Nm(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Wi(r){return __DEV__&&Om(r),r}function cn(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function co(r,e,t){return new X(function(n){var i=n.next,a=n.error,o=n.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(_){--s,i&&i.call(n,_),c&&d.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(n,_)})}:function(m){return h&&h.call(n,m)}}var d={next:l(e,i),error:l(t,a),complete:function(){c=!0,s||o&&o.call(n)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var kt=typeof WeakMap=="function"&&Ve(function(){return navigator.product})!=="ReactNative",Fl=typeof WeakSet=="function",_c=typeof Symbol=="function"&&typeof Symbol.for=="function",xr=_c&&Symbol.asyncIterator,zw=typeof Ve(function(){return window.document.createElement})=="function",Ww=Ve(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function uo(r){function e(t){Object.defineProperty(r,t,{value:X})}return _c&&Symbol.species&&e(Symbol.species),e("@@species"),r}function $l(r){return r&&typeof r.then=="function"}var Xn=function(r){Ne(e,r);function e(t){var n=r.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),cn(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),cn(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,o=i.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?$l(c)?c.then(function(u){return n.sub=u.subscribe(n.handlers)}):n.sub=c.subscribe(n.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest&&n.latest[0]==="next"?n.resolve(n.latest[1]):n.resolve(),n.notify("complete"),cn(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new X(t)]),$l(t)?t.then(function(i){return n.start(i)},n.handlers.error):n.start(t),n}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 n=this.latest[0],i=t[n];i&&i.call(t,this.latest[1]),this.sub===null&&n==="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,n){var i=this.nextResultListeners;i.size&&(this.nextResultListeners=new Set,i.forEach(function(a){return a(t,n)}))},e.prototype.beforeNext=function(t){var n=!1;this.nextResultListeners.add(function(i,a){n||(n=!0,t(i,a))})},e}(X);uo(Xn);function Ir(r){return"incremental"in r}function Dm(r){return"hasNext"in r&&"data"in r}function Ml(r){return Ir(r)||Dm(r)}function lo(r,e){var t=r,n=new ut;return Ir(e)&&Me(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,o=i.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}t=n.merge(t,a)}),t}function ei(r){var e=po(r);return Me(e)}function po(r){var e=Me(r.errors)?r.errors.slice(0):[];return Ir(r)&&Me(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Tr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(n){!n||Object.keys(n).forEach(function(i){var a=n[i];a!==void 0&&(t[i]=a)})}),t}var jl=new Map;function Gi(r){var e=jl.get(r)||1;return jl.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Ul(r){var e=Gi("stringifyForDisplay");return JSON.stringify(r,function(t,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Ki(r,e){return Tr(r,e,e.variables&&{variables:x(x({},r&&r.variables),e.variables)})}function fo(r){return new X(function(e){e.error(r)})}var Hi=function(r,e,t){var n=new Error(t);throw n.name="ServerError",n.response=r,n.statusCode=r.status,n.result=e,n};function wc(r){for(var e=["query","operationName","variables","extensions","context"],t=0,n=Object.keys(r);t<n.length;t++){var i=n[t];if(e.indexOf(i)<0)throw __DEV__?new G("illegal argument: ".concat(i)):new G(27)}return r}function Ec(r,e){var t=x({},r),n=function(a){typeof a=="function"?t=x(x({},t),a(t)):t=x(x({},t),a)},i=function(){return x({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function xc(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Jn(e.query)||void 0:""),e}function ql(r,e){return e?e(r):X.of()}function Ji(r){return typeof r=="function"?new At(r):r}function ho(r){return r.request.length<=1}var Cm=function(r){Ne(e,r);function e(t,n){var i=r.call(this,t)||this;return i.link=n,i}return e}(Error),At=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return X.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Ji).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=Ji(t),a=Ji(n||new r(ql));return ho(i)&&ho(a)?new r(function(o){return e(o)?i.request(o)||X.of():a.request(o)||X.of()}):new r(function(o,s){return e(o)?i.request(o,s)||X.of():a.request(o,s)||X.of()})},r.execute=function(e,t){return e.request(Ec(t.context,xc(wc(t))))||X.of()},r.concat=function(e,t){var n=Ji(e);if(ho(n))return __DEV__&&F.warn(new Cm("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Ji(t);return ho(i)?new r(function(a){return n.request(a,function(o){return i.request(o)||X.of()})||X.of()}):new r(function(a,o){return n.request(a,function(s){return i.request(s,o)||X.of()})||X.of()})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(ql)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new G("request is not implemented"):new G(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 ti=At.execute;var Bl="3.7.10";function Vl(r){return!!r.body}function Ql(r){return!!r.getReader}function zl(r){return!!(xr&&r[Symbol.asyncIterator])}function Wl(r){return!!r.stream}function Gl(r){return!!r.arrayBuffer}function Kl(r){return!!r.pipe}function Ic(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Tc(r){var e=null,t=null,n=!1,i=[],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})}i.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){n=!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(i.length)return d({value:i.shift(),done:!1});if(n)return d({value:void 0,done:!0});a.push([d,f])})}var l={next:function(){return u()}};return xr&&(l[Symbol.asyncIterator]=function(){return this}),l}function kc(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(n,i){r.then(function(a){n({value:a,done:!1})}).catch(i)}))}};return xr&&(t[Symbol.asyncIterator]=function(){return this}),t}function mo(r){var e={next:function(){return r.read()}};return xr&&(e[Symbol.asyncIterator]=function(){return this}),e}function Hl(r){var e=r;if(Vl(r)&&(e=r.body),zl(e))return Ic(e);if(Ql(e))return mo(e.getReader());if(Wl(e))return mo(e.stream().getReader());if(Gl(e))return kc(e.arrayBuffer());if(Kl(e))return Tc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var Jl=Object.prototype.hasOwnProperty;function Yl(r,e){var t,n,i;return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h,m,y,_,S,w,v,A,R,E,P;return Ft(this,function(L){switch(L.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=Hl(r),f=!0,L.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=L.sent(),h=p.value,m=p.done,y=typeof h=="string"?h:a.decode(h),f=!m,l+=y,_=l.indexOf(u);_>-1;){if(S=void 0,P=[l.slice(0,_),l.slice(_+u.length)],S=P[0],l=P[1],S.trim()){if(w=S.indexOf(`\r
25
25
  \r
26
- `),b=Dm(S.slice(0,w)),O=b["content-type"],O&&O.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");C=S.slice(w);try{E=Zl(t,C.replace(`\r
27
- `,"")),(Object.keys(E).length>1||"data"in E||"incremental"in E||"errors"in E)&&((n=e.next)===null||n===void 0||n.call(e,E))}catch(P){go(P,e)}}_=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function Dm(t){var e={};return t.split(`
28
- `).forEach(function(r){var n=r.indexOf(":");if(n>-1){var i=r.slice(0,n).trim().toLowerCase(),a=r.slice(n+1).trim();e[i]=a}}),e}function Zl(t,e){if(t.status>=300){var r=function(){try{return JSON.parse(e)}catch{return e}};Hi(t,r(),"Response not successful: Received status code ".concat(t.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=t,n.statusCode=t.status,n.bodyText=e,n}}function go(t,e){var r,n;t.name!=="AbortError"&&(t.result&&t.result.errors&&t.result.data&&((r=e.next)===null||r===void 0||r.call(e,t.result)),(n=e.error)===null||n===void 0||n.call(e,t))}function Xl(t,e,r){Nm(e)(t).then(function(n){var i,a;(i=r.next)===null||i===void 0||i.call(r,n),(a=r.complete)===null||a===void 0||a.call(r)}).catch(function(n){return go(n,r)})}function Nm(t){return function(e){return e.text().then(function(r){return Zl(e,r)}).then(function(r){return e.status>=300&&Hi(e,r,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(r)&&!Jl.call(r,"data")&&!Jl.call(r,"errors")&&Hi(e,r,"Server response was missing for query '".concat(Array.isArray(t)?t.map(function(n){return n.operationName}):t.operationName,"'.")),r})}}var Yi=function(t,e){var r;try{r=JSON.stringify(t)}catch(i){var n=__DEV__?new K("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new K(24);throw n.parseError=i,n}return r};var Cm={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Rm={accept:"*/*","content-type":"application/json"},Pm={method:"POST"},ef={http:Cm,headers:Rm,options:Pm},tf=function(t,e){return e(t)};function rf(t,e){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i={},a={};r.forEach(function(d){i=T(T(T({},i),d.options),{headers:T(T({},i.headers),d.headers)}),d.credentials&&(i.credentials=d.credentials),a=T(T({},a),d.http)}),i.headers&&(i.headers=Fm(i.headers,a.preserveHeaderCase));var o=t.operationName,s=t.extensions,c=t.variables,u=t.query,l={operationName:o,variables:c};return a.includeExtensions&&(l.extensions=s),a.includeQuery&&(l.query=e(u,Gn)),{options:i,body:l}}function Fm(t,e){if(!e){var r=Object.create(null);return Object.keys(Object(t)).forEach(function(a){r[a.toLowerCase()]=t[a]}),r}var n=Object.create(null);Object.keys(Object(t)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:t[a]}});var i=Object.create(null);return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var nf=function(t){if(!t&&typeof fetch>"u")throw __DEV__?new K(`
26
+ `),v=Rm(S.slice(0,w)),A=v["content-type"],A&&A.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");R=S.slice(w);try{E=Zl(r,R.replace(`\r
27
+ `,"")),(Object.keys(E).length>1||"data"in E||"incremental"in E||"errors"in E)&&((n=e.next)===null||n===void 0||n.call(e,E))}catch(C){go(C,e)}}_=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function Rm(r){var e={};return r.split(`
28
+ `).forEach(function(t){var n=t.indexOf(":");if(n>-1){var i=t.slice(0,n).trim().toLowerCase(),a=t.slice(n+1).trim();e[i]=a}}),e}function Zl(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Hi(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=r,n.statusCode=r.status,n.bodyText=e,n}}function go(r,e){var t,n;r.name!=="AbortError"&&(r.result&&r.result.errors&&r.result.data&&((t=e.next)===null||t===void 0||t.call(e,r.result)),(n=e.error)===null||n===void 0||n.call(e,r))}function Xl(r,e,t){Pm(e)(r).then(function(n){var i,a;(i=t.next)===null||i===void 0||i.call(t,n),(a=t.complete)===null||a===void 0||a.call(t)}).catch(function(n){return go(n,t)})}function Pm(r){return function(e){return e.text().then(function(t){return Zl(e,t)}).then(function(t){return e.status>=300&&Hi(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!Jl.call(t,"data")&&!Jl.call(t,"errors")&&Hi(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Yi=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=__DEV__?new G("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new G(24);throw n.parseError=i,n}return t};var Lm={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Fm={accept:"*/*","content-type":"application/json"},$m={method:"POST"},ep={http:Lm,headers:Fm,options:$m},tp=function(r,e){return e(r)};function rp(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(d){i=x(x(x({},i),d.options),{headers:x(x({},i.headers),d.headers)}),d.credentials&&(i.credentials=d.credentials),a=x(x({},a),d.http)}),i.headers&&(i.headers=Mm(i.headers,a.preserveHeaderCase));var o=r.operationName,s=r.extensions,c=r.variables,u=r.query,l={operationName:o,variables:c};return a.includeExtensions&&(l.extensions=s),a.includeQuery&&(l.query=e(u,Gn)),{options:i,body:l}}function Mm(r,e){if(!e){var t=Object.create(null);return Object.keys(Object(r)).forEach(function(a){t[a.toLowerCase()]=r[a]}),t}var n=Object.create(null);Object.keys(Object(r)).forEach(function(a){n[a.toLowerCase()]={originalName:a,value:r[a]}});var i=Object.create(null);return Object.keys(n).forEach(function(a){i[n[a].originalName]=n[a].value}),i}var np=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new G(`
29
29
  "fetch" has not been found globally and no fetcher has been configured. To fix this, install a fetch package (like https://www.npmjs.com/package/cross-fetch), instantiate the fetcher, and pass it into your HttpLink constructor. For example:
30
30
 
31
31
  import fetch from 'cross-fetch';
@@ -33,7 +33,7 @@ import { ApolloClient, HttpLink } from '@apollo/client';
33
33
  const client = new ApolloClient({
34
34
  link: new HttpLink({ uri: '/graphql', fetch })
35
35
  });
36
- `):new K(23)};var af=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var t=new AbortController,e=t.signal;return{controller:t,signal:e}};var of=function(t,e){var r=t.getContext(),n=r.uri;return n||(typeof e=="function"?e(t):e||"/graphql")};function sf(t,e){var r=[],n=function(d,p){r.push("".concat(d,"=").concat(encodeURIComponent(p)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Yi(e.variables,"Variables map")}catch(d){return{parseError:d}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Yi(e.extensions,"Extensions map")}catch(d){return{parseError:d}}n("extensions",a)}var o="",s=t,c=t.indexOf("#");c!==-1&&(o=t.substr(c),s=t.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+r.join("&")+o;return{newURI:l}}var cf=Be(function(){return fetch}),uf=function(t){t===void 0&&(t={});var e=t.uri,r=e===void 0?"/graphql":e,n=t.fetch,i=t.print,a=i===void 0?tf:i,o=t.includeExtensions,s=t.preserveHeaderCase,c=t.useGETForQueries,u=t.includeUnusedVariables,l=u===void 0?!1:u,d=Qt(t,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&nf(n||cf);var p={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new At(function(f){var h=of(f,r),m=f.getContext(),g={};if(m.clientAwareness){var _=m.clientAwareness,S=_.name,w=_.version;S&&(g["apollographql-client-name"]=S),w&&(g["apollographql-client-version"]=w)}var b=T(T({},g),m.headers),O={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:b},C=rf(f,a,ef,p,O),E=C.options,R=C.body;if(R.variables&&!l){var F=new Set(Object.keys(R.variables));et(f.query,{Variable:function(se,Bt,X){X&&X.kind!=="VariableDefinition"&&F.delete(se.name.value)}}),F.size&&(R.variables=T({},R.variables),F.forEach(function(se){delete R.variables[se]}))}var P;if(!E.signal){var M=af(),Ee=M.controller,ie=M.signal;P=Ee,P&&(E.signal=ie)}var j=function(se){return se.kind==="OperationDefinition"&&se.operation==="mutation"};if(c&&!f.query.definitions.some(j)&&(E.method="GET"),Kn(["defer"],f.query)&&(E.headers=E.headers||{},E.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),E.method==="GET"){var ye=sf(h,R),ve=ye.newURI,oe=ye.parseError;if(oe)return po(oe);h=ve}else try{E.body=Yi(R,"Payload")}catch(se){return po(se)}return new ee(function(se){var Bt=n||Be(function(){return fetch})||cf;return Bt(h,E).then(function(X){var Vt;f.setContext({response:X});var _r=(Vt=X.headers)===null||Vt===void 0?void 0:Vt.get("content-type");return _r!==null&&/^multipart\/mixed/i.test(_r)?Yl(X,se):Xl(X,f,se)}).catch(function(X){return go(X,se)}),function(){P&&P.abort()}})})};var kc=function(t){Oe(e,t);function e(r){r===void 0&&(r={});var n=t.call(this,uf(r).request)||this;return n.options=r,n}return e}(At);var{toString:lf,hasOwnProperty:Lm}=Object.prototype,ff=Function.prototype.toString,Ac=new Map;function xe(t,e){try{return Oc(t,e)}finally{Ac.clear()}}function Oc(t,e){if(t===e)return!0;let r=lf.call(t),n=lf.call(e);if(r!==n)return!1;switch(r){case"[object Array]":if(t.length!==e.length)return!1;case"[object Object]":{if(df(t,e))return!0;let i=pf(t),a=pf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Lm.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!Oc(t[c],e[c]))return!1}return!0}case"[object Error]":return t.name===e.name&&t.message===e.message;case"[object Number]":if(t!==t)return e!==e;case"[object Boolean]":case"[object Date]":return+t==+e;case"[object RegExp]":case"[object String]":return t==`${e}`;case"[object Map]":case"[object Set]":{if(t.size!==e.size)return!1;if(df(t,e))return!0;let i=t.entries(),a=r==="[object Map]";for(;;){let o=i.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Oc(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]":t=new Uint8Array(t),e=new Uint8Array(e);case"[object DataView]":{let i=t.byteLength;if(i===e.byteLength)for(;i--&&t[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let i=ff.call(t);return i!==ff.call(e)?!1:!jm(i,Mm)}}return!1}function pf(t){return Object.keys(t).filter($m,t)}function $m(t){return this[t]!==void 0}var Mm="{ [native code] }";function jm(t,e){let r=t.length-e.length;return r>=0&&t.indexOf(e,r)===r}function df(t,e){let r=Ac.get(t);if(r){if(r.has(e))return!0}else Ac.set(t,r=new Set);return r.add(e),!1}var Um=function(){return Object.create(null)},hf=Array.prototype,qm=hf.forEach,Bm=hf.slice,Gt=function(){function t(e,r){e===void 0&&(e=!0),r===void 0&&(r=Um),this.weakness=e,this.makeData=r}return t.prototype.lookup=function(){for(var e=[],r=0;r<arguments.length;r++)e[r]=arguments[r];return this.lookupArray(e)},t.prototype.lookupArray=function(e){var r=this;return qm.call(e,function(n){return r=r.getChildTrie(n)}),r.data||(r.data=this.makeData(Bm.call(e)))},t.prototype.getChildTrie=function(e){var r=this.weakness&&Vm(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=r.get(e);return n||r.set(e,n=new t(this.weakness,this.makeData)),n},t}();function Vm(t){switch(typeof t){case"object":if(t===null)break;case"function":return!0}return!1}var Ke=null,mf={},Qm=1,zm=()=>class{constructor(){this.id=["slot",Qm++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ke;e;e=e.parent)if(this.id in e.slots){let r=e.slots[this.id];if(r===mf)break;return e!==Ke&&(Ke.slots[this.id]=r),!0}return Ke&&(Ke.slots[this.id]=mf),!1}getValue(){if(this.hasValue())return Ke.slots[this.id]}withValue(e,r,n,i){let a={__proto__:null,[this.id]:e},o=Ke;Ke={parent:o,slots:a};try{return r.apply(i,n)}finally{Ke=o}}static bind(e){let r=Ke;return function(){let n=Ke;try{return Ke=r,e.apply(this,arguments)}finally{Ke=n}}}static noContext(e,r,n){if(Ke){let i=Ke;try{return Ke=null,e.apply(n,r)}finally{Ke=i}}else return e.apply(n,r)}};function gf(t){try{return t()}catch{}}var Dc="@wry/context:Slot",Wm=gf(()=>globalThis)||gf(()=>global)||Object.create(null),yf=Wm,ri=yf[Dc]||Array[Dc]||function(t){try{Object.defineProperty(yf,Dc,{value:t,enumerable:!1,writable:!1,configurable:!0})}finally{return t}}(zm());var{bind:Gm,noContext:Km}=ri;function Hm(){}var Jm=function(){function t(e,r){e===void 0&&(e=1/0),r===void 0&&(r=Hm),this.max=e,this.dispose=r,this.map=new Map,this.newest=null,this.oldest=null}return t.prototype.has=function(e){return this.map.has(e)},t.prototype.get=function(e){var r=this.getNode(e);return r&&r.value},t.prototype.getNode=function(e){var r=this.map.get(e);if(r&&r!==this.newest){var n=r.older,i=r.newer;i&&(i.older=n),n&&(n.newer=i),r.older=this.newest,r.older.newer=r,r.newer=null,this.newest=r,r===this.oldest&&(this.oldest=i)}return r},t.prototype.set=function(e,r){var n=this.getNode(e);return n?n.value=r:(n={key:e,value:r,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)},t.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},t.prototype.delete=function(e){var r=this.map.get(e);return r?(r===this.newest&&(this.newest=r.older),r===this.oldest&&(this.oldest=r.newer),r.newer&&(r.newer.older=r.older),r.older&&(r.older.newer=r.newer),this.map.delete(e),this.dispose(r.value,e),!0):!1},t}(),vo=new ri,Nc,Ym=Object.prototype.hasOwnProperty,Rc=(Nc=Array.from,Nc===void 0?function(t){var e=[];return t.forEach(function(r){return e.push(r)}),e}:Nc);function yo(t){var e=t.unsubscribe;typeof e=="function"&&(t.unsubscribe=void 0,e())}var Zi=[],Zm=100;function ni(t,e){if(!t)throw new Error(e||"assertion failure")}function Xm(t,e){var r=t.length;return r>0&&r===e.length&&t[r-1]===e[r-1]}function bf(t){switch(t.length){case 0:throw new Error("unknown value");case 1:return t[0];case 2:throw t[1]}}function eg(t){return t.slice(0)}var tg=function(){function t(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++t.count}return t.prototype.peek=function(){if(this.value.length===1&&!kr(this))return vf(this),this.value[0]},t.prototype.recompute=function(e){return ni(!this.recomputing,"already recomputing"),vf(this),kr(this)?rg(this,e):bf(this.value)},t.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,_f(this),yo(this))},t.prototype.dispose=function(){var e=this;this.setDirty(),Tf(this),Pc(this,function(r,n){r.setDirty(),If(r,e)})},t.prototype.forget=function(){this.dispose()},t.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Zi.pop()||new Set),this.deps.add(e)},t.prototype.forgetDeps=function(){var e=this;this.deps&&(Rc(this.deps).forEach(function(r){return r.delete(e)}),this.deps.clear(),Zi.push(this.deps),this.deps=null)},t.count=0,t}();function vf(t){var e=vo.getValue();if(e)return t.parents.add(e),e.childValues.has(t)||e.childValues.set(t,[]),kr(t)?wf(e,t):Ef(e,t),e}function rg(t,e){return Tf(t),vo.withValue(t,ng,[t,e]),ag(t,e)&&ig(t),bf(t.value)}function ng(t,e){t.recomputing=!0,t.value.length=0;try{t.value[0]=t.fn.apply(null,e)}catch(r){t.value[1]=r}t.recomputing=!1}function kr(t){return t.dirty||!!(t.dirtyChildren&&t.dirtyChildren.size)}function ig(t){t.dirty=!1,!kr(t)&&Sf(t)}function _f(t){Pc(t,wf)}function Sf(t){Pc(t,Ef)}function Pc(t,e){var r=t.parents.size;if(r)for(var n=Rc(t.parents),i=0;i<r;++i)e(n[i],t)}function wf(t,e){ni(t.childValues.has(e)),ni(kr(e));var r=!kr(t);if(!t.dirtyChildren)t.dirtyChildren=Zi.pop()||new Set;else if(t.dirtyChildren.has(e))return;t.dirtyChildren.add(e),r&&_f(t)}function Ef(t,e){ni(t.childValues.has(e)),ni(!kr(e));var r=t.childValues.get(e);r.length===0?t.childValues.set(e,eg(e.value)):Xm(r,e.value)||t.setDirty(),xf(t,e),!kr(t)&&Sf(t)}function xf(t,e){var r=t.dirtyChildren;r&&(r.delete(e),r.size===0&&(Zi.length<Zm&&Zi.push(r),t.dirtyChildren=null))}function Tf(t){t.childValues.size>0&&t.childValues.forEach(function(e,r){If(t,r)}),t.forgetDeps(),ni(t.dirtyChildren===null)}function If(t,e){e.parents.delete(t),t.childValues.delete(e),xf(t,e)}function ag(t,e){if(typeof t.subscribe=="function")try{yo(t),t.unsubscribe=t.subscribe.apply(null,e)}catch{return t.setDirty(),!1}return!0}var og={setDirty:!0,dispose:!0,forget:!0};function bo(t){var e=new Map,r=t&&t.subscribe;function n(i){var a=vo.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof r=="function"&&(yo(o),o.unsubscribe=r(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Ym.call(og,o)?o:"setDirty";Rc(s).forEach(function(u){return u[c]()}),e.delete(a),yo(s)}},n}function kf(){var t=new Gt(typeof WeakMap=="function");return function(){return t.lookupArray(arguments)}}var kE=kf(),Cc=new Set;function cn(t,e){e===void 0&&(e=Object.create(null));var r=new Jm(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||kf(),a=function(){var u=i.apply(null,n?n.apply(null,arguments):arguments);if(u===void 0)return t.apply(null,arguments);var l=r.get(u);l||(r.set(u,l=new tg(t)),l.subscribe=e.subscribe,l.forget=function(){return r.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return r.set(u,l),Cc.add(r),vo.hasValue()||(Cc.forEach(function(p){return p.clean()}),Cc.clear()),d};Object.defineProperty(a,"size",{get:function(){return r.map.size},configurable:!1,enumerable:!1});function o(u){var l=r.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(i.apply(null,arguments))};function s(u){var l=r.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function c(u){return r.delete(u)}return a.forgetKey=c,a.forget=function(){return c(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var Fc=function(){function t(){this.getFragmentDoc=cn(tc)}return t.prototype.batch=function(e){var r=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(r)},n),i},t.prototype.recordOptimisticTransaction=function(e,r){this.performTransaction(e,r)},t.prototype.transformDocument=function(e){return e},t.prototype.transformForLink=function(e){return e},t.prototype.identify=function(e){},t.prototype.gc=function(){return[]},t.prototype.modify=function(e){return!1},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(T(T({},e),{rootId:e.id||"ROOT_QUERY",optimistic:r}))},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!!e.optimistic),this.read(T(T({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:r}))},t.prototype.writeQuery=function(e){var r=e.id,n=e.data,i=Qt(e,["id","data"]);return this.write(Object.assign(i,{dataId:r||"ROOT_QUERY",result:n}))},t.prototype.writeFragment=function(e){var r=e.id,n=e.data,i=e.fragment,a=e.fragmentName,o=Qt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(i,a),dataId:r,result:n}))},t.prototype.updateQuery=function(e,r){return this.batch({update:function(n){var i=n.readQuery(e),a=r(i);return a==null?i:(n.writeQuery(T(T({},e),{data:a})),a)}})},t.prototype.updateFragment=function(e,r){return this.batch({update:function(n){var i=n.readFragment(e),a=r(i);return a==null?i:(n.writeFragment(T(T({},e),{data:a})),a)}})},t}();var Xi=function(t){Oe(e,t);function e(r,n,i,a){var o,s=t.call(this,r)||this;if(s.message=r,s.path=n,s.query=i,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var 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 De=Object.prototype.hasOwnProperty;function ea(t){return t==null}function So(t,e){var r=t.__typename,n=t.id,i=t._id;if(typeof r=="string"&&(e&&(e.keyObject=ea(n)?ea(i)?void 0:{_id:i}:{id:n}),ea(n)&&!ea(i)&&(n=i),!ea(n)))return"".concat(r,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Af={dataIdFromObject:So,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Of(t){return Ir(Af,t)}function wo(t){var e=t.canonizeResults;return e===void 0?Af.canonizeResults:e}function Df(t,e){return te(e)?t.get(e.__ref,"__typename"):e&&e.__typename}var Lc=/^[_a-z][_0-9a-z]*/i;function jt(t){var e=t.match(Lc);return e?e[0]:t}function _o(t,e,r){return ce(e)?ge(e)?e.every(function(n){return _o(t,n,r)}):t.selections.every(function(n){if(yt(n)&&sr(n,r)){var i=It(n);return De.call(e,i)&&(!n.selectionSet||_o(n.selectionSet,e[i],r))}return!0}):!1}function Ar(t){return ce(t)&&!te(t)&&!ge(t)}function Nf(){return new lt}function Eo(t,e){var r=en(rn(t));return{fragmentMap:r,lookupFragment:function(n){var i=r[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var xo=Object.create(null),$c=function(){return xo},Cf=Object.create(null),ii=function(){function t(e,r){var n=this;this.policies=e,this.group=r,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(i,a){return Wi(te(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return te(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return zt(i);if(te(i))return i;var o=n.policies.identify(i)[0];if(o){var s=zt(o);return a&&n.merge(o,i),s}}}return t.prototype.toObject=function(){return T({},this.data)},t.prototype.has=function(e){return this.lookup(e,!0)!==void 0},t.prototype.get=function(e,r){if(this.group.depend(e,r),De.call(this.data,e)){var n=this.data[e];if(n&&De.call(n,r))return n[r]}if(r==="__typename"&&De.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Or)return this.parent.get(e,r)},t.prototype.lookup=function(e,r){if(r&&this.group.depend(e,"__exists"),De.call(this.data,e))return this.data[e];if(this instanceof Or)return this.parent.lookup(e,r);if(this.policies.rootTypenamesById[e])return Object.create(null)},t.prototype.merge=function(e,r){var n=this,i;te(e)&&(e=e.__ref),te(r)&&(r=r.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof r=="string"?this.lookup(i=r):r;if(!!o){__DEV__?L(typeof i=="string","store.merge expects a string ID"):L(typeof i=="string",1);var s=new lt(cg).merge(a,o);if(this.data[i]=s,s!==a&&(delete this.refs[i],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=jt(u);l!==u&&!n.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(n instanceof Or)&&delete s[u]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(u){return n.group.dirty(i,u)})}}},t.prototype.modify=function(e,r){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,c={DELETE:xo,INVALIDATE:Cf,isReference:te,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return n.policies.readField(typeof u=="string"?{fieldName:u,from:l||zt(e)}:u,{store:n})}};if(Object.keys(i).forEach(function(u){var l=jt(u),d=i[u];if(d!==void 0){var p=typeof r=="function"?r:r[u]||r[l];if(p){var f=p===$c?xo:p(Wi(d),T(T({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));f===Cf?n.group.dirty(e,u):(f===xo&&(f=void 0),f!==d&&(a[u]=f,o=!0,d=f))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Or?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},t.prototype.delete=function(e,r,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=r&&n?this.policies.getStoreFieldName({typename:o,fieldName:r,args:n}):r;return this.modify(e,s?(i={},i[s]=$c,i):$c)}return!1},t.prototype.evict=function(e,r){var n=!1;return e.id&&(De.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Or&&this!==r&&(n=this.parent.evict(e,r)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},t.prototype.clear=function(){this.replace(null)},t.prototype.extract=function(){var e=this,r=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){De.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(r.__META={extraRootIds:n.sort()}),r},t.prototype.replace=function(e){var r=this;if(Object.keys(this.data).forEach(function(a){e&&De.call(e,a)||r.delete(a)}),e){var n=e.__META,i=Qt(e,["__META"]);Object.keys(i).forEach(function(a){r.merge(a,i[a])}),n&&n.extraRootIds.forEach(this.retain,this)}},t.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},t.prototype.release=function(e){if(this.rootIds[e]>0){var r=--this.rootIds[e];return r||delete this.rootIds[e],r}return 0},t.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Or?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},t.prototype.gc=function(){var e=this,r=this.getRootIdSet(),n=this.toObject();r.forEach(function(o){De.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(r.add,r),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Or;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},t.prototype.findChildRefIds=function(e){if(!De.call(this.refs,e)){var r=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return r;var i=new Set([n]);i.forEach(function(a){te(a)&&(r[a.__ref]=!0),ce(a)&&Object.keys(a).forEach(function(o){var s=a[o];ce(s)&&i.add(s)})})}return this.refs[e]},t.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},t}();var Rf=function(){function t(e,r){r===void 0&&(r=null),this.caching=e,this.parent=r,this.d=null,this.resetCaching()}return t.prototype.resetCaching=function(){this.d=this.caching?bo():null,this.keyMaker=new Gt(kt)},t.prototype.depend=function(e,r){if(this.d){this.d(Mc(e,r));var n=jt(r);n!==r&&this.d(Mc(e,n)),this.parent&&this.parent.depend(e,r)}},t.prototype.dirty=function(e,r){this.d&&this.d.dirty(Mc(e,r),r==="__exists"?"forget":"setDirty")},t}();function Mc(t,e){return e+"#"+t}function jc(t,e){un(t)&&t.group.depend(e,"__exists")}(function(t){var e=function(r){Oe(n,r);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,c=i.seed,u=r.call(this,a,new Rf(s))||this;return u.stump=new sg(u),u.storageTrie=new Gt(kt),c&&u.replace(c),u}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(t);t.Root=e})(ii||(ii={}));var Or=function(t){Oe(e,t);function e(r,n,i,a){var o=t.call(this,n.policies,a)||this;return o.id=r,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(r,n){return new e(r,this,n,this.group)},e.prototype.removeLayer=function(r){var n=this,i=this.parent.removeLayer(r);return r===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=n.data[a],s=i.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){xe(o[c],s[c])||n.group.dirty(a,c)}):(n.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){n.group.dirty(a,c)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return T(T({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(r){var n=this.parent.findChildRefIds(r);return De.call(this.data,r)?T(T({},n),t.prototype.findChildRefIds.call(this,r)):n},e.prototype.getStorage=function(){for(var r=this.parent;r.parent;)r=r.parent;return r.getStorage.apply(r,arguments)},e}(ii),sg=function(t){Oe(e,t);function e(r){return t.call(this,"EntityStore.Stump",r,function(){},new Rf(r.group.caching,r.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Or);function cg(t,e,r){var n=t[r],i=e[r];return xe(n,i)?n:i}function un(t){return!!(t instanceof ii&&t.group.caching)}function ug(t){return ce(t)?ge(t)?t.slice(0):T({__proto__:Object.getPrototypeOf(t)},t):t}var To=function(){function t(){this.known=new(Ll?WeakSet:Set),this.pool=new Gt(kt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return t.prototype.isKnown=function(e){return ce(e)&&this.known.has(e)},t.prototype.pass=function(e){if(ce(e)){var r=ug(e);return this.passes.set(r,e),r}return e},t.prototype.admit=function(e){var r=this;if(ce(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(f){c.push(r.admit(e[f]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),u.sorted.forEach(function(f,h){d[f]=c[l+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},t.prototype.sortedKeys=function(e){var r=Object.keys(e),n=this.pool.lookupArray(r);if(!n.keys){r.sort();var i=JSON.stringify(r);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:r,json:i})}return n.keys},t}();var vt=Object.assign(function(t){if(ce(t)){Uc===void 0&&Pf();var e=Uc.admit(t),r=qc.get(e);return r===void 0&&qc.set(e,r=JSON.stringify(e)),r}return JSON.stringify(t)},{reset:Pf}),Uc,qc;function Pf(){Uc=new To,qc=new(kt?WeakMap:Map)}function Ff(t){return[t.selectionSet,t.objectOrReference,t.context,t.context.canonizeResults]}var Lf=function(){function t(e){var r=this;this.knownResults=new(kt?WeakMap:Map),this.config=Ir(e,{addTypename:e.addTypename!==!1,canonizeResults:wo(e)}),this.canon=e.canon||new To,this.executeSelectionSet=cn(function(n){var i,a=n.context.canonizeResults,o=Ff(n);o[3]=!a;var s=(i=r.executeSelectionSet).peek.apply(i,o);return s?a?T(T({},s),{result:r.canon.admit(s.result)}):s:(jc(n.context.store,n.enclosingRef.__ref),r.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Ff,makeCacheKey:function(n,i,a,o){if(un(a.store))return a.store.makeCacheKey(n,te(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=cn(function(n){return jc(n.context.store,n.enclosingRef.__ref),r.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(un(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return t.prototype.resetCanon=function(){this.canon=new To},t.prototype.diffQueryAgainstStore=function(e){var r=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,d=this.config.cache.policies;o=T(T({},an(Vi(n))),o);var p=zt(a),f=this.executeSelectionSet({selectionSet:nn(n).selectionSet,objectOrReference:p,enclosingRef:p,context:T({store:r,query:n,policies:d,variables:o,varString:vt(o),canonizeResults:l},Eo(n,this.config.fragments))}),h;if(f.missing&&(h=[new Xi(lg(f.missing),f.missing,n,o)],!c))throw h[0];return{result:f.result,complete:!h,missing:h}},t.prototype.isFresh=function(e,r,n,i){if(un(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,r,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},t.prototype.execSelectionSetImpl=function(e){var r=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,o=e.context;if(te(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(i,"__typename"),d=[],p,f=new lt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(w,b){var O;return w.missing&&(p=f.merge(p,(O={},O[b]=w.missing,O))),w.result}var m=new Set(n.selections);m.forEach(function(w){var b,O;if(!!sr(w,s))if(yt(w)){var C=c.readField({fieldName:w.name.value,field:w,variables:o.variables,from:i},o),E=It(w);C===void 0?on.added(w)||(p=f.merge(p,(b={},b[E]="Can't find field '".concat(w.name.value,"' on ").concat(te(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),b))):ge(C)?C=h(r.executeSubSelectedArray({field:w,array:C,enclosingRef:a,context:o}),E):w.selectionSet?C!=null&&(C=h(r.executeSelectionSet({selectionSet:w.selectionSet,objectOrReference:C,enclosingRef:te(C)?C:a,context:o}),E)):o.canonizeResults&&(C=r.canon.pass(C)),C!==void 0&&d.push((O={},O[E]=C,O))}else{var R=tn(w,o.lookupFragment);if(!R&&w.kind===Fe.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(w.name.value)):new K(5);R&&c.fragmentMatches(R,l)&&R.selectionSet.selections.forEach(m.add,m)}});var g=Qi(d),_={result:g,missing:p},S=o.canonizeResults?this.canon.admit(_):Wi(_);return S.result&&this.knownResults.set(S.result,n),S},t.prototype.execSubSelectedArrayImpl=function(e){var r=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,c=new lt;function u(l,d){var p;return l.missing&&(s=c.merge(s,(p={},p[d]=l.missing,p))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,d){return l===null?null:ge(l)?u(r.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?u(r.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:te(l)?l:a,context:o}),d):(__DEV__&&fg(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},t}();function lg(t){try{JSON.stringify(t,function(e,r){if(typeof r=="string")throw r;return r})}catch(e){return e}}function fg(t,e,r){if(!e.selectionSet){var n=new Set([r]);n.forEach(function(i){ce(i)&&(__DEV__?L(!te(i),"Missing selection set for object of type ".concat(Df(t,i)," returned for query field ").concat(e.name.value)):L(!te(i),6),Object.values(i).forEach(n.add,n))})}}var ai=new ri,$f=new WeakMap;function ta(t){var e=$f.get(t);return e||$f.set(t,e={vars:new Set,dep:bo()}),e}function Bc(t){ta(t).vars.forEach(function(e){return e.forgetCache(t)})}function Mf(t){ta(t).vars.forEach(function(e){return e.attachCache(t)})}function Io(t){var e=new Set,r=new Set,n=function(a){if(arguments.length>0){if(t!==a){t=a,e.forEach(function(c){ta(c).dep.dirty(n),pg(c)});var o=Array.from(r);r.clear(),o.forEach(function(c){return c(t)})}}else{var s=ai.getValue();s&&(i(s),ta(s).dep(n))}return t};n.onNextChange=function(a){return r.add(a),function(){r.delete(a)}};var i=n.attachCache=function(a){return e.add(a),ta(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function pg(t){t.broadcastWatches&&t.broadcastWatches()}var jf=Object.create(null);function Vc(t){var e=JSON.stringify(t);return jf[e]||(jf[e]=Object.create(null))}function Qc(t){var e=Vc(t);return e.keyFieldsFn||(e.keyFieldsFn=function(r,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Wc(t,function(o){var s=oi(n.storeObject,o,i);return s===void 0&&r!==n.storeObject&&De.call(r,o[0])&&(s=oi(r,o,qf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(r))):L(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function zc(t){var e=Vc(t);return e.keyArgsFn||(e.keyArgsFn=function(r,n){var i=n.field,a=n.variables,o=n.fieldName,s=Wc(t,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(i&&$e(i.directives)){var p=l.slice(1),f=i.directives.find(function(_){return _.name.value===p}),h=f&&cr(f,a);return h&&oi(h,u.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&De.call(a,m)){var g=u.slice(0);return g[0]=m,oi(a,g)}return}if(r)return oi(r,u)}),c=JSON.stringify(s);return(r||c!=="{}")&&(o+=":"+c),o})}function Wc(t,e){var r=new lt;return Uf(t).reduce(function(n,i){var a,o=e(i);if(o!==void 0){for(var s=i.length-1;s>=0;--s)o=(a={},a[i[s]]=o,a);n=r.merge(n,o)}return n},Object.create(null))}function Uf(t){var e=Vc(t);if(!e.paths){var r=e.paths=[],n=[];t.forEach(function(i,a){ge(i)?(Uf(i).forEach(function(o){return r.push(n.concat(o))}),n.length=0):(n.push(i),ge(t[a+1])||(r.push(n.slice(0)),n.length=0))})}return e.paths}function qf(t,e){return t[e]}function oi(t,e,r){return r=r||qf,Bf(e.reduce(function n(i,a){return ge(i)?i.map(function(o){return n(o,a)}):i&&r(i,a)},t))}function Bf(t){return ce(t)?ge(t)?t.map(Bf):Wc(Object.keys(t).sort(),function(e){return oi(t,e)}):t}qi.setStringify(vt);function Gc(t){return t.args!==void 0?t.args:t.field?cr(t.field,t.variables):null}var dg=function(){},Vf=function(t,e){return e.fieldName},Qf=function(t,e,r){var n=r.mergeObjects;return n(t,e)},zf=function(t,e){return e},Gf=function(){function t(e){this.config=e,this.typePolicies=Object.create(null),this.toBeAdded=Object.create(null),this.supertypeMap=new Map,this.fuzzySubtypes=new Map,this.rootIdsByTypename=Object.create(null),this.rootTypenamesById=Object.create(null),this.usingPossibleTypes=!1,this.config=T({dataIdFromObject:So},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return t.prototype.identify=function(e,r){var n,i=this,a=r&&(r.typename||((n=r.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=r&&r.storeObject||e,s=T(T({},r),{typename:a,storeObject:o,readField:r&&r.readField||function(){var p=ko(arguments,o);return i.readField(p,{store:i.cache.data,variables:p.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(ge(d))l=Qc(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},t.prototype.addTypePolicies=function(e){var r=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,c=Qt(i,["queryType","mutationType","subscriptionType"]);a&&r.setRootTypename("Query",n),o&&r.setRootTypename("Mutation",n),s&&r.setRootTypename("Subscription",n),De.call(r.toBeAdded,n)?r.toBeAdded[n].push(c):r.toBeAdded[n]=[c]})},t.prototype.updateTypePolicy=function(e,r){var n=this,i=this.getTypePolicy(e),a=r.keyFields,o=r.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?Qf:u===!1?zf:c.merge}s(i,r.merge),i.keyFn=a===!1?dg:ge(a)?Qc(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(c){var u=n.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var d=l.keyArgs,p=l.read,f=l.merge;u.keyFn=d===!1?Vf:ge(d)?zc(d):typeof d=="function"?d:u.keyFn,typeof p=="function"&&(u.read=p),s(u,f)}u.read&&u.merge&&(u.keyFn=u.keyFn||Vf)})},t.prototype.setRootTypename=function(e,r){r===void 0&&(r=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];r!==i&&(__DEV__?L(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):L(!i||i===e,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[r]=n,this.rootTypenamesById[n]=r)},t.prototype.addPossibleTypes=function(e){var r=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){r.getSupertypeSet(n,!0),e[n].forEach(function(i){r.getSupertypeSet(i,!0).add(n);var a=i.match(Lc);(!a||a[0]!==i)&&r.fuzzySubtypes.set(i,new RegExp(i))})})},t.prototype.getTypePolicy=function(e){var r=this;if(!De.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach(function(o){var s=r.getTypePolicy(o),c=s.fields,u=Qt(s,["fields"]);Object.assign(n,u),Object.assign(n.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){r.updateTypePolicy(e,o)}),this.typePolicies[e]},t.prototype.getFieldPolicy=function(e,r,n){if(e){var i=this.getTypePolicy(e).fields;return i[r]||n&&(i[r]=Object.create(null))}},t.prototype.getSupertypeSet=function(e,r){var n=this.supertypeMap.get(e);return!n&&r&&this.supertypeMap.set(e,n=new Set),n},t.prototype.fragmentMatches=function(e,r,n,i){var a=this;if(!e.typeCondition)return!0;if(!r)return!1;var o=e.typeCondition.name.value;if(r===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(r,!0),c=[s],u=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},l=!!(n&&this.fuzzySubtypes.size),d=!1,p=0;p<c.length;++p){var f=c[p];if(f.has(o))return s.has(o)||(d&&__DEV__&&L.warn("Inferring subtype ".concat(r," of supertype ").concat(o)),s.add(o)),!0;f.forEach(u),l&&p===c.length-1&&_o(e.selectionSet,n,i)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(h,m){var g=r.match(h);g&&g[0]===r&&u(m)}))}return!1},t.prototype.hasKeyArgs=function(e,r){var n=this.getFieldPolicy(e,r,!1);return!!(n&&n.keyFn)},t.prototype.getStoreFieldName=function(e){var r=e.typename,n=e.fieldName,i=this.getFieldPolicy(r,n,!1),a,o=i&&i.keyFn;if(o&&r)for(var s={typename:r,fieldName:n,field:e.field||null,variables:e.variables},c=Gc(e);o;){var u=o(c,s);if(ge(u))o=zc(u);else{a=u||n;break}}return a===void 0&&(a=e.field?nc(e.field,e.variables):qi(n,Gc(e))),a===!1?n:n===jt(a)?a:n+":"+a},t.prototype.readField=function(e,r){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=r.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=jt(o),c=r.store.getFieldValue(n,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=Wf(this,n,e,r,r.store.getStorage(te(n)?n.__ref:n,o));return ai.withValue(this.cache,l,[c,d])}return c}}},t.prototype.getReadFunction=function(e,r){var n=this.getFieldPolicy(e,r,!1);return n&&n.read},t.prototype.getMergeFunction=function(e,r,n){var i=this.getFieldPolicy(e,r,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},t.prototype.runMergeFunction=function(e,r,n,i,a){var o=n.field,s=n.typename,c=n.merge;return c===Qf?Kf(i.store)(e,r):c===zf?r:(i.overwrite&&(e=void 0),c(e,r,Wf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},t}();function Wf(t,e,r,n,i){var a=t.getStoreFieldName(r),o=jt(a),s=r.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:Gc(r),field:r.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:te,toReference:u,storage:i,cache:t.cache,canRead:l,readField:function(){return t.readField(ko(arguments,e,s),n)},mergeObjects:Kf(n.store)}}function ko(t,e,r){var n=t[0],i=t[1],a=t.length,o;return typeof n=="string"?o={fieldName:n,from:a>1?i:e}:(o=T({},n),De.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Ul(Array.from(t)))),o.variables===void 0&&(o.variables=r),o}function Kf(t){return function(r,n){if(ge(r)||ge(n))throw __DEV__?new K("Cannot automatically merge arrays"):new K(4);if(ce(r)&&ce(n)){var i=t.getFieldValue(r,"__typename"),a=t.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(te(r)&&Ar(n))return t.merge(r.__ref,n),r;if(Ar(r)&&te(n))return t.merge(r,n.__ref),n;if(Ar(r)&&Ar(n))return T(T({},r),n)}return n}}function Kc(t,e,r){var n="".concat(e).concat(r),i=t.flavors.get(n);return i||t.flavors.set(n,i=t.clientOnly===e&&t.deferred===r?t:T(T({},t),{clientOnly:e,deferred:r})),i}var Zf=function(){function t(e,r,n){this.cache=e,this.reader=r,this.fragments=n}return t.prototype.writeToStore=function(e,r){var n=this,i=r.query,a=r.result,o=r.dataId,s=r.variables,c=r.overwrite,u=Wt(i),l=Nf();s=T(T({},an(u)),s);var d=T(T({store:e,written:Object.create(null),merge:function(f,h){return l.merge(f,h)},variables:s,varString:vt(s)},Eo(i,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),p=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:d});if(!te(p))throw __DEV__?new K("Could not identify object ".concat(JSON.stringify(a))):new K(7);return d.incomingById.forEach(function(f,h){var m=f.storeObject,g=f.mergeTree,_=f.fieldNodeSet,S=zt(h);if(g&&g.map.size){var w=n.applyMerges(g,S,m,d);if(te(w))return;m=w}if(__DEV__&&!d.overwrite){var b=Object.create(null);_.forEach(function(E){E.selectionSet&&(b[E.name.value]=!0)});var O=function(E){return b[jt(E)]===!0},C=function(E){var R=g&&g.map.get(E);return Boolean(R&&R.info&&R.info.merge)};Object.keys(m).forEach(function(E){O(E)&&!C(E)&&hg(S,m,E,d.store)})}e.merge(h,m)}),e.retain(p.__ref),p},t.prototype.processSelectionSet=function(e){var r=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=n&&c.rootTypenamesById[n]||Bi(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var d=function(){var w=ko(arguments,u,o.variables);if(te(w.from)){var b=o.incomingById.get(w.from.__ref);if(b){var O=c.readField(T(T({},w),{from:b.storeObject}),o);if(O!==void 0)return O}}return c.readField(w,o)},p=new Set;this.flattenFields(a,i,o,l).forEach(function(w,b){var O,C=It(b),E=i[C];if(p.add(b),E!==void 0){var R=c.getStoreFieldName({typename:l,fieldName:b.name.value,field:b,variables:w.variables}),F=Hf(s,R),P=r.processFieldValue(E,b,b.selectionSet?Kc(w,!1,!1):w,F),M=void 0;b.selectionSet&&(te(P)||Ar(P))&&(M=d("__typename",P));var Ee=c.getMergeFunction(l,b.name.value,M);Ee?F.info={field:b,typename:l,merge:Ee}:Jf(s,R),u=w.merge(u,(O={},O[R]=P,O))}else __DEV__&&!w.clientOnly&&!w.deferred&&!on.added(b)&&!c.getReadFunction(l,b.name.value)&&__DEV__&&L.error("Missing field '".concat(It(b),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var f=c.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:d}),h=f[0],m=f[1];n=n||h,m&&(u=o.merge(u,m))}catch(w){if(!n)throw w}if(typeof n=="string"){var g=zt(n),_=o.written[n]||(o.written[n]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(i,g,a,o)))return g;var S=o.incomingById.get(n);return S?(S.storeObject=o.merge(S.storeObject,u),S.mergeTree=Hc(S.mergeTree,s),p.forEach(function(w){return S.fieldNodeSet.add(w)})):o.incomingById.set(n,{storeObject:u,mergeTree:Ao(s)?void 0:s,fieldNodeSet:p}),g}return u},t.prototype.processFieldValue=function(e,r,n,i){var a=this;return!r.selectionSet||e===null?__DEV__?so(e):e:ge(e)?e.map(function(o,s){var c=a.processFieldValue(o,r,n,Hf(i,s));return Jf(i,s),c}):this.processSelectionSet({result:e,selectionSet:r.selectionSet,context:n,mergeTree:i})},t.prototype.flattenFields=function(e,r,n,i){i===void 0&&(i=Bi(r,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Gt(!1);return function c(u,l){var d=s.lookup(u,l.clientOnly,l.deferred);d.visited||(d.visited=!0,u.selections.forEach(function(p){if(!!sr(p,n.variables)){var f=l.clientOnly,h=l.deferred;if(!(f&&h)&&$e(p.directives)&&p.directives.forEach(function(_){var S=_.name.value;if(S==="client"&&(f=!0),S==="defer"){var w=cr(_,n.variables);(!w||w.if!==!1)&&(h=!0)}}),yt(p)){var m=a.get(p);m&&(f=f&&m.clientOnly,h=h&&m.deferred),a.set(p,Kc(n,f,h))}else{var g=tn(p,n.lookupFragment);if(!g&&p.kind===Fe.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(p.name.value)):new K(8);g&&o.fragmentMatches(g,i,r,n.variables)&&c(g.selectionSet,Kc(n,f,h))}}}))}(e,n),a},t.prototype.applyMerges=function(e,r,n,i,a){var o,s=this;if(e.map.size&&!te(n)){var c=!ge(n)&&(te(r)||Ar(r))?r:void 0,u=n;c&&!a&&(a=[te(c)?c.__ref:c]);var l,d=function(p,f){return ge(p)?typeof f=="number"?p[f]:void 0:i.store.getFieldValue(p,String(f))};e.map.forEach(function(p,f){var h=d(c,f),m=d(u,f);if(m!==void 0){a&&a.push(f);var g=s.applyMerges(p,h,m,i,a);g!==m&&(l=l||new Map,l.set(f,g)),a&&L(a.pop()===f)}}),l&&(n=ge(u)?u.slice(0):T({},u),l.forEach(function(p,f){n[f]=p}))}return e.info?this.cache.policies.runMergeFunction(r,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},t}();var Xf=[];function Hf(t,e){var r=t.map;return r.has(e)||r.set(e,Xf.pop()||{map:new Map}),r.get(e)}function Hc(t,e){if(t===e||!e||Ao(e))return t;if(!t||Ao(t))return e;var r=t.info&&e.info?T(T({},t.info),e.info):t.info||e.info,n=t.map.size&&e.map.size,i=n?new Map:t.map.size?t.map:e.map,a={info:r,map:i};if(n){var o=new Set(e.map.keys());t.map.forEach(function(s,c){a.map.set(c,Hc(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Hc(e.map.get(s),t.map.get(s)))})}return a}function Ao(t){return!t||!(t.info||t.map.size)}function Jf(t,e){var r=t.map,n=r.get(e);n&&Ao(n)&&(Xf.push(n),r.delete(e))}var Yf=new Set;function hg(t,e,r,n){var i=function(d){var p=n.getFieldValue(d,r);return typeof p=="object"&&p},a=i(t);if(!!a){var o=i(e);if(!!o&&!te(a)&&!xe(a,o)&&!Object.keys(a).every(function(d){return n.getFieldValue(o,d)!==void 0})){var s=n.getFieldValue(t,"__typename")||n.getFieldValue(e,"__typename"),c=jt(r),u="".concat(s,".").concat(c);if(!Yf.has(u)){Yf.add(u);var l=[];!ge(a)&&!ge(o)&&[a,o].forEach(function(d){var p=n.getFieldValue(d,"__typename");typeof p=="string"&&!l.includes(p)&&l.push(p)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
36
+ `):new G(23)};var ip=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var ap=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function op(r,e){var t=[],n=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Yi(e.variables,"Variables map")}catch(d){return{parseError:d}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Yi(e.extensions,"Extensions map")}catch(d){return{parseError:d}}n("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 sp=Ve(function(){return fetch}),cp=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,n=r.fetch,i=r.print,a=i===void 0?tp:i,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,d=Qt(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&np(n||sp);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new At(function(p){var h=ap(p,t),m=p.getContext(),y={};if(m.clientAwareness){var _=m.clientAwareness,S=_.name,w=_.version;S&&(y["apollographql-client-name"]=S),w&&(y["apollographql-client-version"]=w)}var v=x(x({},y),m.headers),A={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:v},R=rp(p,a,ep,f,A),E=R.options,P=R.body;if(P.variables&&!l){var L=new Set(Object.keys(P.variables));Xe(p.query,{Variable:function(oe,Bt,Z){Z&&Z.kind!=="VariableDefinition"&&L.delete(oe.name.value)}}),L.size&&(P.variables=x({},P.variables),L.forEach(function(oe){delete P.variables[oe]}))}var C;if(!E.signal){var T=ip(),xe=T.controller,ne=T.signal;C=xe,C&&(E.signal=ne)}var M=function(oe){return oe.kind==="OperationDefinition"&&oe.operation==="mutation"};if(c&&!p.query.definitions.some(M)&&(E.method="GET"),Kn(["defer"],p.query)&&(E.headers=E.headers||{},E.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),E.method==="GET"){var ve=op(h,P),be=ve.newURI,ae=ve.parseError;if(ae)return fo(ae);h=be}else try{E.body=Yi(P,"Payload")}catch(oe){return fo(oe)}return new X(function(oe){var Bt=n||Ve(function(){return fetch})||sp;return Bt(h,E).then(function(Z){var Vt;p.setContext({response:Z});var Sr=(Vt=Z.headers)===null||Vt===void 0?void 0:Vt.get("content-type");return Sr!==null&&/^multipart\/mixed/i.test(Sr)?Yl(Z,oe):Xl(Z,p,oe)}).catch(function(Z){return go(Z,oe)}),function(){C&&C.abort()}})})};var Ac=function(r){Ne(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,cp(t).request)||this;return n.options=t,n}return e}(At);var{toString:up,hasOwnProperty:jm}=Object.prototype,lp=Function.prototype.toString,Oc=new Map;function Ie(r,e){try{return Nc(r,e)}finally{Oc.clear()}}function Nc(r,e){if(r===e)return!0;let t=up.call(r),n=up.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(fp(r,e))return!0;let i=pp(r),a=pp(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!jm.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!Nc(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(fp(r,e))return!0;let i=r.entries(),a=t==="[object Map]";for(;;){let o=i.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!Nc(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 i=r.byteLength;if(i===e.byteLength)for(;i--&&r[i]===e[i];);return i===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let i=lp.call(r);return i!==lp.call(e)?!1:!Bm(i,qm)}}return!1}function pp(r){return Object.keys(r).filter(Um,r)}function Um(r){return this[r]!==void 0}var qm="{ [native code] }";function Bm(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function fp(r,e){let t=Oc.get(r);if(t){if(t.has(e))return!0}else Oc.set(r,t=new Set);return t.add(e),!1}var Vm=function(){return Object.create(null)},dp=Array.prototype,Qm=dp.forEach,zm=dp.slice,Gt=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Vm),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 Qm.call(e,function(n){return t=t.getChildTrie(n)}),t.data||(t.data=this.makeData(zm.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Wm(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),n=t.get(e);return n||t.set(e,n=new r(this.weakness,this.makeData)),n},r}();function Wm(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var He=null,hp={},Gm=1,Km=()=>class{constructor(){this.id=["slot",Gm++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=He;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===hp)break;return e!==He&&(He.slots[this.id]=t),!0}return He&&(He.slots[this.id]=hp),!1}getValue(){if(this.hasValue())return He.slots[this.id]}withValue(e,t,n,i){let a={__proto__:null,[this.id]:e},o=He;He={parent:o,slots:a};try{return t.apply(i,n)}finally{He=o}}static bind(e){let t=He;return function(){let n=He;try{return He=t,e.apply(this,arguments)}finally{He=n}}}static noContext(e,t,n){if(He){let i=He;try{return He=null,e.apply(n,t)}finally{He=i}}else return e.apply(n,t)}};function mp(r){try{return r()}catch{}}var Dc="@wry/context:Slot",Hm=mp(()=>globalThis)||mp(()=>global)||Object.create(null),gp=Hm,ri=gp[Dc]||Array[Dc]||function(r){try{Object.defineProperty(gp,Dc,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(Km());var{bind:Jm,noContext:Ym}=ri;function Zm(){}var Xm=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=Zm),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 n=t.older,i=t.newer;i&&(i.older=n),n&&(n.newer=i),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=i)}return t},r.prototype.set=function(e,t){var n=this.getNode(e);return n?n.value=t:(n={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=n),this.newest=n,this.oldest=this.oldest||n,this.map.set(e,n),n.value)},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}(),vo=new ri,Cc,eg=Object.prototype.hasOwnProperty,Pc=(Cc=Array.from,Cc===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Cc);function yo(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Zi=[],tg=100;function ni(r,e){if(!r)throw new Error(e||"assertion failure")}function rg(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function vp(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function ng(r){return r.slice(0)}var ig=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&&!kr(this))return yp(this),this.value[0]},r.prototype.recompute=function(e){return ni(!this.recomputing,"already recomputing"),yp(this),kr(this)?ag(this,e):vp(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,bp(this),yo(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),xp(this),Lc(this,function(t,n){t.setDirty(),Ip(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Zi.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Pc(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Zi.push(this.deps),this.deps=null)},r.count=0,r}();function yp(r){var e=vo.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),kr(r)?_p(e,r):wp(e,r),e}function ag(r,e){return xp(r),vo.withValue(r,og,[r,e]),cg(r,e)&&sg(r),vp(r.value)}function og(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 kr(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function sg(r){r.dirty=!1,!kr(r)&&Sp(r)}function bp(r){Lc(r,_p)}function Sp(r){Lc(r,wp)}function Lc(r,e){var t=r.parents.size;if(t)for(var n=Pc(r.parents),i=0;i<t;++i)e(n[i],r)}function _p(r,e){ni(r.childValues.has(e)),ni(kr(e));var t=!kr(r);if(!r.dirtyChildren)r.dirtyChildren=Zi.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&bp(r)}function wp(r,e){ni(r.childValues.has(e)),ni(!kr(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,ng(e.value)):rg(t,e.value)||r.setDirty(),Ep(r,e),!kr(r)&&Sp(r)}function Ep(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Zi.length<tg&&Zi.push(t),r.dirtyChildren=null))}function xp(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Ip(r,t)}),r.forgetDeps(),ni(r.dirtyChildren===null)}function Ip(r,e){e.parents.delete(r),r.childValues.delete(e),Ep(r,e)}function cg(r,e){if(typeof r.subscribe=="function")try{yo(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var ug={setDirty:!0,dispose:!0,forget:!0};function bo(r){var e=new Map,t=r&&r.subscribe;function n(i){var a=vo.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof t=="function"&&(yo(o),o.unsubscribe=t(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&eg.call(ug,o)?o:"setDirty";Pc(s).forEach(function(u){return u[c]()}),e.delete(a),yo(s)}},n}function Tp(){var r=new Gt(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var kE=Tp(),Rc=new Set;function un(r,e){e===void 0&&(e=Object.create(null));var t=new Xm(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||Tp(),a=function(){var u=i.apply(null,n?n.apply(null,arguments):arguments);if(u===void 0)return r.apply(null,arguments);var l=t.get(u);l||(t.set(u,l=new ig(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),Rc.add(t),vo.hasValue()||(Rc.forEach(function(f){return f.clean()}),Rc.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(i.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var Fc=function(){function r(){this.getFragmentDoc=un(rc)}return r.prototype.batch=function(e){var t=this,n=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,i;return this.performTransaction(function(){return i=e.update(t)},n),i},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(x(x({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(x(x({},e),{query:this.getFragmentDoc(e.fragment,e.fragmentName),rootId:e.id,optimistic:t}))},r.prototype.writeQuery=function(e){var t=e.id,n=e.data,i=Qt(e,["id","data"]);return this.write(Object.assign(i,{dataId:t||"ROOT_QUERY",result:n}))},r.prototype.writeFragment=function(e){var t=e.id,n=e.data,i=e.fragment,a=e.fragmentName,o=Qt(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(i,a),dataId:t,result:n}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(n){var i=n.readQuery(e),a=t(i);return a==null?i:(n.writeQuery(x(x({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(n){var i=n.readFragment(e),a=t(i);return a==null?i:(n.writeFragment(x(x({},e),{data:a})),a)}})},r}();var Xi=function(r){Ne(e,r);function e(t,n,i,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=n,s.query=i,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 De=Object.prototype.hasOwnProperty;function ea(r){return r==null}function _o(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=ea(n)?ea(i)?void 0:{_id:i}:{id:n}),ea(n)&&!ea(i)&&(n=i),!ea(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var kp={dataIdFromObject:_o,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Ap(r){return Tr(kp,r)}function wo(r){var e=r.canonizeResults;return e===void 0?kp.canonizeResults:e}function Op(r,e){return ee(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var $c=/^[_a-z][_0-9a-z]*/i;function jt(r){var e=r.match($c);return e?e[0]:r}function So(r,e,t){return se(e)?ge(e)?e.every(function(n){return So(r,n,t)}):r.selections.every(function(n){if(gt(n)&&sr(n,t)){var i=Tt(n);return De.call(e,i)&&(!n.selectionSet||So(n.selectionSet,e[i],t))}return!0}):!1}function Ar(r){return se(r)&&!ee(r)&&!ge(r)}function Np(){return new ut}function Eo(r,e){var t=tn(nn(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var xo=Object.create(null),Mc=function(){return xo},Dp=Object.create(null),ii=function(){function r(e,t){var n=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(i,a){return Wi(ee(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return ee(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return zt(i);if(ee(i))return i;var o=n.policies.identify(i)[0];if(o){var s=zt(o);return a&&n.merge(o,i),s}}}return r.prototype.toObject=function(){return x({},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),De.call(this.data,e)){var n=this.data[e];if(n&&De.call(n,t))return n[t]}if(t==="__typename"&&De.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Or)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),De.call(this.data,e))return this.data[e];if(this instanceof Or)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var n=this,i;ee(e)&&(e=e.__ref),ee(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(i=e):e,o=typeof t=="string"?this.lookup(i=t):t;if(!!o){__DEV__?F(typeof i=="string","store.merge expects a string ID"):F(typeof i=="string",1);var s=new ut(pg).merge(a,o);if(this.data[i]=s,s!==a&&(delete this.refs[i],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=jt(u);l!==u&&!n.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(n instanceof Or)&&delete s[u]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[i]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(u){return n.group.dirty(i,u)})}}},r.prototype.modify=function(e,t){var n=this,i=this.lookup(e);if(i){var a=Object.create(null),o=!1,s=!0,c={DELETE:xo,INVALIDATE:Dp,isReference:ee,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return n.policies.readField(typeof u=="string"?{fieldName:u,from:l||zt(e)}:u,{store:n})}};if(Object.keys(i).forEach(function(u){var l=jt(u),d=i[u];if(d!==void 0){var f=typeof t=="function"?t:t[u]||t[l];if(f){var p=f===Mc?xo:f(Wi(d),x(x({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));p===Dp?n.group.dirty(e,u):(p===xo&&(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 Or?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,n){var i,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&n?this.policies.getStoreFieldName({typename:o,fieldName:t,args:n}):t;return this.modify(e,s?(i={},i[s]=Mc,i):Mc)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(De.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Or&&this!==t&&(n=this.parent.evict(e,t)||n),(e.fieldName||n)&&this.group.dirty(e.id,e.fieldName||"__exists")),n},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),n=[];return this.getRootIdSet().forEach(function(i){De.call(e.policies.rootTypenamesById,i)||n.push(i)}),n.length&&(t.__META={extraRootIds:n.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&De.call(e,a)||t.delete(a)}),e){var n=e.__META,i=Qt(e,["__META"]);Object.keys(i).forEach(function(a){t.merge(a,i[a])}),n&&n.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 Or?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),n=this.toObject();t.forEach(function(o){De.call(n,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete n[o])});var i=Object.keys(n);if(i.length){for(var a=this;a instanceof Or;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},r.prototype.findChildRefIds=function(e){if(!De.call(this.refs,e)){var t=this.refs[e]=Object.create(null),n=this.data[e];if(!n)return t;var i=new Set([n]);i.forEach(function(a){ee(a)&&(t[a.__ref]=!0),se(a)&&Object.keys(a).forEach(function(o){var s=a[o];se(s)&&i.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Cp=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?bo():null,this.keyMaker=new Gt(kt)},r.prototype.depend=function(e,t){if(this.d){this.d(jc(e,t));var n=jt(t);n!==t&&this.d(jc(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(jc(e,t),t==="__exists"?"forget":"setDirty")},r}();function jc(r,e){return e+"#"+r}function Uc(r,e){ln(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Ne(n,t);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,c=i.seed,u=t.call(this,a,new Cp(s))||this;return u.stump=new lg(u),u.storageTrie=new Gt(kt),c&&u.replace(c),u}return n.prototype.addLayer=function(i,a){return this.stump.addLayer(i,a)},n.prototype.removeLayer=function(){return this},n.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},n}(r);r.Root=e})(ii||(ii={}));var Or=function(r){Ne(e,r);function e(t,n,i,a){var o=r.call(this,n.policies,a)||this;return o.id=t,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(t,n){return new e(t,this,n,this.group)},e.prototype.removeLayer=function(t){var n=this,i=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=n.data[a],s=i.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){Ie(o[c],s[c])||n.group.dirty(a,c)}):(n.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){n.group.dirty(a,c)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return x(x({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return De.call(this.data,t)?x(x({},n),r.prototype.findChildRefIds.call(this,t)):n},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(ii),lg=function(r){Ne(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Cp(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}(Or);function pg(r,e,t){var n=r[t],i=e[t];return Ie(n,i)?n:i}function ln(r){return!!(r instanceof ii&&r.group.caching)}function fg(r){return se(r)?ge(r)?r.slice(0):x({__proto__:Object.getPrototypeOf(r)},r):r}var Io=function(){function r(){this.known=new(Fl?WeakSet:Set),this.pool=new Gt(kt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return se(e)&&this.known.has(e)},r.prototype.pass=function(e){if(se(e)){var t=fg(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(se(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),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),n=this.pool.lookupArray(t);if(!n.keys){t.sort();var i=JSON.stringify(t);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:t,json:i})}return n.keys},r}();var yt=Object.assign(function(r){if(se(r)){qc===void 0&&Rp();var e=qc.admit(r),t=Bc.get(e);return t===void 0&&Bc.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:Rp}),qc,Bc;function Rp(){qc=new Io,Bc=new(kt?WeakMap:Map)}function Pp(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Lp=function(){function r(e){var t=this;this.knownResults=new(kt?WeakMap:Map),this.config=Tr(e,{addTypename:e.addTypename!==!1,canonizeResults:wo(e)}),this.canon=e.canon||new Io,this.executeSelectionSet=un(function(n){var i,a=n.context.canonizeResults,o=Pp(n);o[3]=!a;var s=(i=t.executeSelectionSet).peek.apply(i,o);return s?a?x(x({},s),{result:t.canon.admit(s.result)}):s:(Uc(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Pp,makeCacheKey:function(n,i,a,o){if(ln(a.store))return a.store.makeCacheKey(n,ee(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=un(function(n){return Uc(n.context.store,n.enclosingRef.__ref),t.execSubSelectedArrayImpl(n)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(n){var i=n.field,a=n.array,o=n.context;if(ln(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new Io},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,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=x(x({},on(Vi(n))),o);var f=zt(a),p=this.executeSelectionSet({selectionSet:an(n).selectionSet,objectOrReference:f,enclosingRef:f,context:x({store:t,query:n,policies:d,variables:o,varString:yt(o),canonizeResults:l},Eo(n,this.config.fragments))}),h;if(p.missing&&(h=[new Xi(dg(p.missing),p.missing,n,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,n,i){if(ln(i.store)&&this.knownResults.get(e)===n){var a=this.executeSelectionSet.peek(n,t,i,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,n=e.selectionSet,i=e.objectOrReference,a=e.enclosingRef,o=e.context;if(ee(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(i,"__typename"),d=[],f,p=new ut;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(w,v){var A;return w.missing&&(f=p.merge(f,(A={},A[v]=w.missing,A))),w.result}var m=new Set(n.selections);m.forEach(function(w){var v,A;if(!!sr(w,s))if(gt(w)){var R=c.readField({fieldName:w.name.value,field:w,variables:o.variables,from:i},o),E=Tt(w);R===void 0?sn.added(w)||(f=p.merge(f,(v={},v[E]="Can't find field '".concat(w.name.value,"' on ").concat(ee(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),v))):ge(R)?R=h(t.executeSubSelectedArray({field:w,array:R,enclosingRef:a,context:o}),E):w.selectionSet?R!=null&&(R=h(t.executeSelectionSet({selectionSet:w.selectionSet,objectOrReference:R,enclosingRef:ee(R)?R:a,context:o}),E)):o.canonizeResults&&(R=t.canon.pass(R)),R!==void 0&&d.push((A={},A[E]=R,A))}else{var P=rn(w,o.lookupFragment);if(!P&&w.kind===Fe.FRAGMENT_SPREAD)throw __DEV__?new G("No fragment named ".concat(w.name.value)):new G(5);P&&c.fragmentMatches(P,l)&&P.selectionSet.selections.forEach(m.add,m)}});var y=Qi(d),_={result:y,missing:f},S=o.canonizeResults?this.canon.admit(_):Wi(_);return S.result&&this.knownResults.set(S.result,n),S},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,c=new ut;function u(l,d){var f;return l.missing&&(s=c.merge(s,(f={},f[d]=l.missing,f))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,d){return l===null?null:ge(l)?u(t.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?u(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:ee(l)?l:a,context:o}),d):(__DEV__&&hg(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},r}();function dg(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function hg(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){se(i)&&(__DEV__?F(!ee(i),"Missing selection set for object of type ".concat(Op(r,i)," returned for query field ").concat(e.name.value)):F(!ee(i),6),Object.values(i).forEach(n.add,n))})}}var ai=new ri,Fp=new WeakMap;function ta(r){var e=Fp.get(r);return e||Fp.set(r,e={vars:new Set,dep:bo()}),e}function Vc(r){ta(r).vars.forEach(function(e){return e.forgetCache(r)})}function $p(r){ta(r).vars.forEach(function(e){return e.attachCache(r)})}function To(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){ta(c).dep.dirty(n),mg(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=ai.getValue();s&&(i(s),ta(s).dep(n))}return r};n.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var i=n.attachCache=function(a){return e.add(a),ta(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function mg(r){r.broadcastWatches&&r.broadcastWatches()}var Mp=Object.create(null);function Qc(r){var e=JSON.stringify(r);return Mp[e]||(Mp[e]=Object.create(null))}function zc(r){var e=Qc(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Gc(r,function(o){var s=oi(n.storeObject,o,i);return s===void 0&&t!==n.storeObject&&De.call(t,o[0])&&(s=oi(t,o,Up)),__DEV__?F(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):F(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Wc(r){var e=Qc(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,o=n.fieldName,s=Gc(r,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(i&&Me(i.directives)){var f=l.slice(1),p=i.directives.find(function(_){return _.name.value===f}),h=p&&cr(p,a);return h&&oi(h,u.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&De.call(a,m)){var y=u.slice(0);return y[0]=m,oi(a,y)}return}if(t)return oi(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Gc(r,e){var t=new ut;return jp(r).reduce(function(n,i){var a,o=e(i);if(o!==void 0){for(var s=i.length-1;s>=0;--s)o=(a={},a[i[s]]=o,a);n=t.merge(n,o)}return n},Object.create(null))}function jp(r){var e=Qc(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){ge(i)?(jp(i).forEach(function(o){return t.push(n.concat(o))}),n.length=0):(n.push(i),ge(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function Up(r,e){return r[e]}function oi(r,e,t){return t=t||Up,qp(e.reduce(function n(i,a){return ge(i)?i.map(function(o){return n(o,a)}):i&&t(i,a)},r))}function qp(r){return se(r)?ge(r)?r.map(qp):Gc(Object.keys(r).sort(),function(e){return oi(r,e)}):r}qi.setStringify(yt);function Kc(r){return r.args!==void 0?r.args:r.field?cr(r.field,r.variables):null}var gg=function(){},Bp=function(r,e){return e.fieldName},Vp=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Qp=function(r,e){return e},Wp=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=x({dataIdFromObject:_o},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 n,i=this,a=t&&(t.typename||((n=t.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=x(x({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=ko(arguments,o);return i.readField(f,{store:i.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(ge(d))l=zc(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(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,c=Qt(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),o&&t.setRootTypename("Mutation",n),s&&t.setRootTypename("Subscription",n),De.call(t.toBeAdded,n)?t.toBeAdded[n].push(c):t.toBeAdded[n]=[c]})},r.prototype.updateTypePolicy=function(e,t){var n=this,i=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?Vp:u===!1?Qp:c.merge}s(i,t.merge),i.keyFn=a===!1?gg:ge(a)?zc(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(c){var u=n.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?Bp:ge(d)?Wc(d):typeof d=="function"?d:u.keyFn,typeof f=="function"&&(u.read=f),s(u,p)}u.read&&u.merge&&(u.keyFn=u.keyFn||Bp)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(__DEV__?F(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):F(!i||i===e,3),i&&delete this.rootIdsByTypename[i],this.rootIdsByTypename[t]=n,this.rootTypenamesById[n]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(n){t.getSupertypeSet(n,!0),e[n].forEach(function(i){t.getSupertypeSet(i,!0).add(n);var a=i.match($c);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!De.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,u=Qt(s,["fields"]);Object.assign(n,u),Object.assign(n.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,n){if(e){var i=this.getTypePolicy(e).fields;return i[t]||n&&(i[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=new Set),n},r.prototype.fragmentMatches=function(e,t,n,i){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=!!(n&&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__&&F.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(u),l&&f===c.length-1&&So(e.selectionSet,n,i)&&(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 n=this.getFieldPolicy(e,t,!1);return!!(n&&n.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,n=e.fieldName,i=this.getFieldPolicy(t,n,!1),a,o=i&&i.keyFn;if(o&&t)for(var s={typename:t,fieldName:n,field:e.field||null,variables:e.variables},c=Kc(e);o;){var u=o(c,s);if(ge(u))o=Wc(u);else{a=u||n;break}}return a===void 0&&(a=e.field?ic(e.field,e.variables):qi(n,Kc(e))),a===!1?n:n===jt(a)?a:n+":"+a},r.prototype.readField=function(e,t){var n=e.from;if(!!n){var i=e.field||e.fieldName;if(!!i){if(e.typename===void 0){var a=t.store.getFieldValue(n,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=jt(o),c=t.store.getFieldValue(n,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=zp(this,n,e,t,t.store.getStorage(ee(n)?n.__ref:n,o));return ai.withValue(this.cache,l,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var n=this.getFieldPolicy(e,t,!1);return n&&n.read},r.prototype.getMergeFunction=function(e,t,n){var i=this.getFieldPolicy(e,t,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},r.prototype.runMergeFunction=function(e,t,n,i,a){var o=n.field,s=n.typename,c=n.merge;return c===Vp?Gp(i.store)(e,t):c===Qp?t:(i.overwrite&&(e=void 0),c(e,t,zp(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},r}();function zp(r,e,t,n,i){var a=r.getStoreFieldName(t),o=jt(a),s=t.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:Kc(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ee,toReference:u,storage:i,cache:r.cache,canRead:l,readField:function(){return r.readField(ko(arguments,e,s),n)},mergeObjects:Gp(n.store)}}function ko(r,e,t){var n=r[0],i=r[1],a=r.length,o;return typeof n=="string"?o={fieldName:n,from:a>1?i:e}:(o=x({},n),De.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&F.warn("Undefined 'from' passed to readField with arguments ".concat(Ul(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function Gp(r){return function(t,n){if(ge(t)||ge(n))throw __DEV__?new G("Cannot automatically merge arrays"):new G(4);if(se(t)&&se(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(ee(t)&&Ar(n))return r.merge(t.__ref,n),t;if(Ar(t)&&ee(n))return r.merge(t,n.__ref),n;if(Ar(t)&&Ar(n))return x(x({},t),n)}return n}}function Hc(r,e,t){var n="".concat(e).concat(t),i=r.flavors.get(n);return i||r.flavors.set(n,i=r.clientOnly===e&&r.deferred===t?r:x(x({},r),{clientOnly:e,deferred:t})),i}var Yp=function(){function r(e,t,n){this.cache=e,this.reader=t,this.fragments=n}return r.prototype.writeToStore=function(e,t){var n=this,i=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,u=Wt(i),l=Np();s=x(x({},on(u)),s);var d=x(x({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:yt(s)},Eo(i,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(!ee(f))throw __DEV__?new G("Could not identify object ".concat(JSON.stringify(a))):new G(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,y=p.mergeTree,_=p.fieldNodeSet,S=zt(h);if(y&&y.map.size){var w=n.applyMerges(y,S,m,d);if(ee(w))return;m=w}if(__DEV__&&!d.overwrite){var v=Object.create(null);_.forEach(function(E){E.selectionSet&&(v[E.name.value]=!0)});var A=function(E){return v[jt(E)]===!0},R=function(E){var P=y&&y.map.get(E);return Boolean(P&&P.info&&P.info.merge)};Object.keys(m).forEach(function(E){A(E)&&!R(E)&&yg(S,m,E,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=n&&c.rootTypenamesById[n]||Bi(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var d=function(){var w=ko(arguments,u,o.variables);if(ee(w.from)){var v=o.incomingById.get(w.from.__ref);if(v){var A=c.readField(x(x({},w),{from:v.storeObject}),o);if(A!==void 0)return A}}return c.readField(w,o)},f=new Set;this.flattenFields(a,i,o,l).forEach(function(w,v){var A,R=Tt(v),E=i[R];if(f.add(v),E!==void 0){var P=c.getStoreFieldName({typename:l,fieldName:v.name.value,field:v,variables:w.variables}),L=Kp(s,P),C=t.processFieldValue(E,v,v.selectionSet?Hc(w,!1,!1):w,L),T=void 0;v.selectionSet&&(ee(C)||Ar(C))&&(T=d("__typename",C));var xe=c.getMergeFunction(l,v.name.value,T);xe?L.info={field:v,typename:l,merge:xe}:Hp(s,P),u=w.merge(u,(A={},A[P]=C,A))}else __DEV__&&!w.clientOnly&&!w.deferred&&!sn.added(v)&&!c.getReadFunction(l,v.name.value)&&__DEV__&&F.error("Missing field '".concat(Tt(v),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var p=c.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:d}),h=p[0],m=p[1];n=n||h,m&&(u=o.merge(u,m))}catch(w){if(!n)throw w}if(typeof n=="string"){var y=zt(n),_=o.written[n]||(o.written[n]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(i,y,a,o)))return y;var S=o.incomingById.get(n);return S?(S.storeObject=o.merge(S.storeObject,u),S.mergeTree=Jc(S.mergeTree,s),f.forEach(function(w){return S.fieldNodeSet.add(w)})):o.incomingById.set(n,{storeObject:u,mergeTree:Ao(s)?void 0:s,fieldNodeSet:f}),y}return u},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?__DEV__?so(e):e:ge(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,n,Kp(i,s));return Hp(i,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:n,mergeTree:i})},r.prototype.flattenFields=function(e,t,n,i){i===void 0&&(i=Bi(t,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Gt(!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,n.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&Me(f.directives)&&f.directives.forEach(function(_){var S=_.name.value;if(S==="client"&&(p=!0),S==="defer"){var w=cr(_,n.variables);(!w||w.if!==!1)&&(h=!0)}}),gt(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Hc(n,p,h))}else{var y=rn(f,n.lookupFragment);if(!y&&f.kind===Fe.FRAGMENT_SPREAD)throw __DEV__?new G("No fragment named ".concat(f.name.value)):new G(8);y&&o.fragmentMatches(y,i,t,n.variables)&&c(y.selectionSet,Hc(n,p,h))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var o,s=this;if(e.map.size&&!ee(n)){var c=!ge(n)&&(ee(t)||Ar(t))?t:void 0,u=n;c&&!a&&(a=[ee(c)?c.__ref:c]);var l,d=function(f,p){return ge(f)?typeof p=="number"?f[p]:void 0:i.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,i,a);y!==m&&(l=l||new Map,l.set(p,y)),a&&F(a.pop()===p)}}),l&&(n=ge(u)?u.slice(0):x({},u),l.forEach(function(f,p){n[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},r}();var Zp=[];function Kp(r,e){var t=r.map;return t.has(e)||t.set(e,Zp.pop()||{map:new Map}),t.get(e)}function Jc(r,e){if(r===e||!e||Ao(e))return r;if(!r||Ao(r))return e;var t=r.info&&e.info?x(x({},r.info),e.info):r.info||e.info,n=r.map.size&&e.map.size,i=n?new Map:r.map.size?r.map:e.map,a={info:t,map:i};if(n){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Jc(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Jc(e.map.get(s),r.map.get(s)))})}return a}function Ao(r){return!r||!(r.info||r.map.size)}function Hp(r,e){var t=r.map,n=t.get(e);n&&Ao(n)&&(Zp.push(n),t.delete(e))}var Jp=new Set;function yg(r,e,t,n){var i=function(d){var f=n.getFieldValue(d,t);return typeof f=="object"&&f},a=i(r);if(!!a){var o=i(e);if(!!o&&!ee(a)&&!Ie(a,o)&&!Object.keys(a).every(function(d){return n.getFieldValue(o,d)!==void 0})){var s=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),c=jt(t),u="".concat(s,".").concat(c);if(!Jp.has(u)){Jp.add(u);var l=[];!ge(a)&&!ge(o)&&[a,o].forEach(function(d){var f=n.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&F.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,49 @@ 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 Oo=function(t){Oe(e,t);function e(r){r===void 0&&(r={});var n=t.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=Io,n.txCount=0,n.config=Of(r),n.addTypename=!!n.config.addTypename,n.policies=new Gf({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var r=this.data=new ii.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=r.stump,this.resetResultCache()},e.prototype.resetResultCache=function(r){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new Zf(this,this.storeReader=new Lf({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:wo(this.config),canon:r?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=cn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(un(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,vt({optimistic:c,id:u,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(r){return this.init(),r&&this.data.replace(r),this},e.prototype.extract=function(r){return r===void 0&&(r=!1),(r?this.optimisticData:this.data).extract()},e.prototype.read=function(r){var n=r.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(T(T({},r),{store:r.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof Xi)return null;throw a}},e.prototype.write=function(r){try{return++this.txCount,this.storeWriter.writeToStore(this.data,r)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(r){if(De.call(r,"id")&&!r.id)return!1;var n=r.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(r.id||"ROOT_QUERY",r.fields)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(r){return this.storeReader.diffQueryAgainstStore(T(T({},r),{store:r.optimistic?this.optimisticData:this.data,rootId:r.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(r){var n=this;return this.watches.size||Mf(this),this.watches.add(r),r.immediate&&this.maybeBroadcastWatch(r),function(){n.watches.delete(r)&&!n.watches.size&&Bc(n),n.maybeBroadcastWatch.forget(r)}},e.prototype.gc=function(r){vt.reset();var n=this.optimisticData.gc();return r&&!this.txCount&&(r.resetResultCache?this.resetResultCache(r.resetResultIdentities):r.resetResultIdentities&&this.storeReader.resetCanon()),n},e.prototype.retain=function(r,n){return(n?this.optimisticData:this.data).retain(r)},e.prototype.release=function(r,n){return(n?this.optimisticData:this.data).release(r)},e.prototype.identify=function(r){if(te(r))return r.__ref;try{return this.policies.identify(r)[0]}catch(n){__DEV__&&L.warn(n)}},e.prototype.evict=function(r){if(!r.id){if(De.call(r,"id"))return!1;r=T(T({},r),{id:"ROOT_QUERY"})}try{return++this.txCount,this.optimisticData.evict(r,this.data)}finally{!--this.txCount&&r.broadcast!==!1&&this.broadcastWatches()}},e.prototype.reset=function(r){var n=this;return this.init(),vt.reset(),r&&r.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Bc(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(r){var n=this.optimisticData.removeLayer(r);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(r){var n=this,i=r.update,a=r.optimistic,o=a===void 0?!0:a,s=r.removeOptimistic,c=r.onWatchUpdated,u,l=function(p){var f=n,h=f.data,m=f.optimisticData;++n.txCount,p&&(n.data=n.optimisticData=p);try{return u=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(T(T({},r),{onWatchUpdated:function(p){return d.add(p),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&d.size?(this.broadcastWatches(T(T({},r),{onWatchUpdated:function(p,f){var h=c.call(this,p,f);return h!==!1&&d.delete(p),h}})),d.size&&d.forEach(function(p){return n.maybeBroadcastWatch.dirty(p)})):this.broadcastWatches(r),u},e.prototype.performTransaction=function(r,n){return this.batch({update:r,optimistic:n||n!==null})},e.prototype.transformDocument=function(r){if(this.addTypename){var n=this.typenameDocumentCache.get(r);return n||(n=on(r),this.typenameDocumentCache.set(r,n),this.typenameDocumentCache.set(n,n)),n}return r},e.prototype.transformForLink=function(r){var n=this.config.fragments;return n?n.transform(r):r},e.prototype.broadcastWatches=function(r){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,r)})},e.prototype.broadcastWatch=function(r,n){var i=r.lastDiff,a=this.diff(r);n&&(r.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,r,a,i)===!1)||(!i||!xe(i.result,a.result))&&r.callback(r.lastDiff=a,i)},e}(Fc);function ep(t){return t.hasOwnProperty("graphQLErrors")}var mg=function(t){var e="";if($e(t.graphQLErrors)||$e(t.clientErrors)){var r=(t.graphQLErrors||[]).concat(t.clientErrors||[]);r.forEach(function(n){var i=n?n.message:"Error message not found.";e+="".concat(i,`
48
- `)})}return t.networkError&&(e+="".concat(t.networkError.message,`
49
- `)),e=e.replace(/\n$/,""),e},ur=function(t){Oe(e,t);function e(r){var n=r.graphQLErrors,i=r.clientErrors,a=r.networkError,o=r.errorMessage,s=r.extraInfo,c=t.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=n||[],c.clientErrors=i||[],c.networkError=a||null,c.message=o||mg(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var pe;(function(t){t[t.loading=1]="loading",t[t.setVariables=2]="setVariables",t[t.fetchMore=3]="fetchMore",t[t.refetch=4]="refetch",t[t.poll=6]="poll",t[t.ready=7]="ready",t[t.error=8]="error"})(pe||(pe={}));function Dr(t){return t?t<7:!1}var gg=Object.assign,yg=Object.hasOwnProperty,Do=function(t){Oe(e,t);function e(r){var n=r.queryManager,i=r.queryInfo,a=r.options,o=t.call(this,function(g){try{var _=g._subscription._observer;_&&!_.error&&(_.error=vg)}catch{}var S=!o.observers.size;o.observers.add(g);var w=o.last;return w&&w.error?g.error&&g.error(w.error):w&&w.result&&g.next&&g.next(w.result),S&&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=i,o.queryManager=n,o.isTornDown=!1;var s=n.defaultOptions.watchQuery,c=s===void 0?{}:s,u=c.fetchPolicy,l=u===void 0?"cache-first":u,d=a.fetchPolicy,p=d===void 0?l:d,f=a.initialFetchPolicy,h=f===void 0?p==="standby"?l:p:f;o.options=T(T({},a),{initialFetchPolicy:h,fetchPolicy:p}),o.queryId=i.queryId||n.generateQueryId();var m=Wt(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var r=this;return new Promise(function(n,i){var a={next:function(s){n(s),r.observers.delete(a),r.observers.size||r.queryManager.removeQuery(r.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=r.subscribe(a)})},e.prototype.getCurrentResult=function(r){r===void 0&&(r=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||pe.ready,a=T(T({},n),{loading:Dr(i),networkStatus:i}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var c=this.queryInfo.getDiff();(c.complete||this.options.returnPartialData)&&(a.data=c.result),xe(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===pe.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=pe.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Yc(c.missing)}return r&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(r,n){return!this.last||!xe(this.last.result,r)||n&&!xe(this.last.variables,n)},e.prototype.getLast=function(r,n){var i=this.last;if(i&&i[r]&&(!n||xe(i.variables,this.variables)))return i[r]},e.prototype.getLastResult=function(r){return this.getLast("result",r)},e.prototype.getLastError=function(r){return this.getLast("error",r)},e.prototype.resetLastResults=function(){delete this.last,this.isTornDown=!1},e.prototype.resetQueryStoreErrors=function(){this.queryManager.resetErrors(this.queryId)},e.prototype.refetch=function(r){var n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",__DEV__&&r&&yg.call(r,"variables")){var o=Vi(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&L.warn("Called refetch(".concat(JSON.stringify(r),") for query ").concat(((n=o.name)===null||n===void 0?void 0:n.value)||JSON.stringify(o),`, which does not declare a $variables variable.
50
- Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return r&&!xe(this.options.variables,r)&&(i.variables=this.options.variables=T(T({},this.options.variables),r)),this.queryInfo.resetLastWrite(),this.reobserve(i,pe.refetch)},e.prototype.fetchMore=function(r){var n=this,i=T(T({},r.query?r:T(T(T(T({},this.options),{query:this.query}),r),{variables:T(T({},this.options.variables),r.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=pe.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,i,pe.fetchMore).then(function(u){return n.queryManager.removeQuery(a),o.networkStatus===pe.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var d=r.updateQuery;d?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(p){return d(p,{fetchMoreResult:u.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(n.query)||Jc(n)})},e.prototype.subscribeToMore=function(r){var n=this,i=this.queryManager.startGraphQLSubscription({query:r.document,variables:r.variables,context:r.context}).subscribe({next:function(a){var o=r.updateQuery;o&&n.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(r.onError){r.onError(a);return}__DEV__&&L.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.unsubscribe()}},e.prototype.setOptions=function(r){return this.reobserve(r)},e.prototype.setVariables=function(r){return xe(this.variables,r)?this.observers.size?this.result():Promise.resolve():(this.options.variables=r,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:r},pe.setVariables):Promise.resolve())},e.prototype.updateQuery=function(r){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=r(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.broadcastQueries())},e.prototype.startPolling=function(r){this.options.pollInterval=r,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(r,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,o=n.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:r,options:n,observable:this,initialFetchPolicy:s}):r==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(r,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,r,n)},e.prototype.updatePolling=function(){var r=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){__DEV__?L(a,"Attempted to start a polling query without a polling interval."):L(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){r.pollingInfo&&(Dr(r.queryInfo.networkStatus)?c():r.reobserve({fetchPolicy:r.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},pe.poll).then(c,c))},c=function(){var u=r.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(r,n){return n===void 0&&(n=this.variables),this.last=T(T({},this.last),{result:this.queryManager.assumeImmutableResults?r:so(r),variables:n}),$e(r.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(r,n){var i=this;this.isTornDown=!1;var a=n===pe.refetch||n===pe.fetchMore||n===pe.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Ir(this.options,r||{}),u=a?c:gg(this.options,c);a||(this.updatePolling(),r&&r.variables&&!xe(r.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=pe.setVariables)));var l=u.variables&&T({},u.variables),d=this.fetch(u,n),p={next:function(f){i.reportResult(f,l)},error:function(f){i.reportError(f,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=p),d.addObserver(p),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(r,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(r,n))&&((i||!r.partial||this.options.returnPartialData)&&this.updateLastResult(r,n),sn(this.observers,"next",r))},e.prototype.reportError=function(r,n){var i=T(T({},this.getLastResult()),{error:r,errors:r.graphQLErrors,networkStatus:pe.error,loading:!1});this.updateLastResult(i,n),sn(this.observers,"error",this.last.error=r)},e.prototype.hasObservers=function(){return this.observers.size>0},e.prototype.tearDownQuery=function(){this.isTornDown||(this.concast&&this.observer&&(this.concast.removeObserver(this.observer),delete this.concast,delete this.observer),this.stopPolling(),this.subscriptions.forEach(function(r){return r.unsubscribe()}),this.subscriptions.clear(),this.queryManager.stopQuery(this.queryId),this.observers.clear(),this.isTornDown=!0)},e}(ee);uo(Do);function Jc(t){var e=t.options,r=e.fetchPolicy,n=e.nextFetchPolicy;return r==="cache-and-network"||r==="network-only"?t.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):r}}):t.reobserve()}function vg(t){__DEV__&&L.error("Unhandled error",t.message,t.stack)}function Yc(t){__DEV__&&t&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(t)),t)}var No=function(){function t(e){var r=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=r,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return t.prototype.addResolvers=function(e){var r=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){r.resolvers=lc(r.resolvers,n)}):this.resolvers=lc(this.resolvers,e)},t.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},t.prototype.getResolvers=function(){return this.resolvers||{}},t.prototype.runResolvers=function(e){var r=e.document,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Ft(this,void 0,void 0,function(){return Lt(this,function(c){return r?[2,this.resolveDocument(r,n.data,i,a,this.fragmentMatcher,s).then(function(u){return T(T({},n),{data:u.result})})]:[2,n]})})},t.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},t.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},t.prototype.clientQuery=function(e){return Kn(["client"],e)&&this.resolvers?e:null},t.prototype.serverQuery=function(e){return uc(e)},t.prototype.prepareContext=function(e){var r=this.cache;return T(T({},e),{cache:r,getCacheKey:function(n){return r.identify(n)}})},t.prototype.addExportedVariables=function(e,r,n){return r===void 0&&(r={}),n===void 0&&(n={}),Ft(this,void 0,void 0,function(){return Lt(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,r)||{},this.prepareContext(n),r).then(function(a){return T(T({},r),a.exportedVariables)})]:[2,T({},r)]})})},t.prototype.shouldForceResolvers=function(e){var r=!1;return et(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(r=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),r))return Xr}}}),r},t.prototype.buildRootValueFromCache=function(e,r){return this.cache.diff({query:cc(e),variables:r,returnPartialData:!0,optimistic:!1}).result},t.prototype.resolveDocument=function(e,r,n,i,a,o){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Ft(this,void 0,void 0,function(){var s,c,u,l,d,p,f,h,m,g,_;return Lt(this,function(S){return s=nn(e),c=rn(e),u=en(c),l=this.collectSelectionsToResolve(s,u),d=s.operation,p=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",f=this,h=f.cache,m=f.client,g={fragmentMap:u,context:T(T({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:p,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,r,g).then(function(w){return{result:w,exportedVariables:g.exportedVariables}})]})})},t.prototype.resolveSelectionSet=function(e,r,n,i){return Ft(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Lt(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(p){return Ft(l,void 0,void 0,function(){var f,h;return Lt(this,function(m){return!r&&!i.selectionsToResolve.has(p)?[2]:sr(p,s)?yt(p)?[2,this.resolveField(p,r,n,i).then(function(g){var _;typeof g<"u"&&c.push((_={},_[It(p)]=g,_))})]:(ic(p)?f=p:(f=a[p.name.value],__DEV__?L(f,"No fragment named ".concat(p.name.value)):L(f,11)),f&&f.typeCondition&&(h=f.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(f.selectionSet,r,n,i).then(function(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Qi(c)})]})})},t.prototype.resolveField=function(e,r,n,i){return Ft(this,void 0,void 0,function(){var a,o,s,c,u,l,d,p,f,h=this;return Lt(this,function(m){return n?(a=i.variables,o=e.name.value,s=It(e),c=o!==s,u=n[s]||n[o],l=Promise.resolve(u),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,p=this.resolvers&&this.resolvers[d],p&&(f=p[c?o:s],f&&(l=Promise.resolve(ai.withValue(this.cache,f,[n,cr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(g){var _,S;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"&&(i.exportedVariables[O.value.value]=g)})}),!e.selectionSet||g==null)return g;var w=(S=(_=e.directives)===null||_===void 0?void 0:_.some(function(b){return b.name.value==="client"}))!==null&&S!==void 0?S:!1;if(Array.isArray(g))return h.resolveSubSelectedArray(e,r||w,g,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,r||w,g,i)})]):[2,null]})})},t.prototype.resolveSubSelectedArray=function(e,r,n,i){var a=this;return Promise.all(n.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,r,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,r,o,i)}))},t.prototype.collectSelectionsToResolve=function(e,r){var n=function(o){return!Array.isArray(o)},i=this.selectionsToResolveCache;function a(o){if(!i.has(o)){var s=new Set;i.set(o,s),et(o,{Directive:function(c,u,l,d,p){c.name.value==="client"&&p.forEach(function(f){n(f)&&ji(f)&&s.add(f)})},FragmentSpread:function(c,u,l,d,p){var f=r[c.name.value];__DEV__?L(f,"No fragment named ".concat(c.name.value)):L(f,12);var h=a(f);h.size>0&&(p.forEach(function(m){n(m)&&ji(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},t}();var si=new(kt?WeakMap:Map);function Zc(t,e){var r=t[e];typeof r=="function"&&(t[e]=function(){return si.set(t,(si.get(t)+1)%1e15),r.apply(this,arguments)})}function tp(t){t.notifyTimeout&&(clearTimeout(t.notifyTimeout),t.notifyTimeout=void 0)}var Co=function(){function t(e,r){r===void 0&&(r=e.generateQueryId()),this.queryId=r,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var n=this.cache=e.cache;si.has(n)||(si.set(n,0),Zc(n,"evict"),Zc(n,"modify"),Zc(n,"reset"))}return t.prototype.init=function(e){var r=e.networkStatus||pe.loading;return this.variables&&this.networkStatus!==pe.loading&&!xe(this.variables,e.variables)&&(r=pe.setVariables),xe(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:r}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},t.prototype.reset=function(){tp(this),this.dirty=!1},t.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var r=this.getDiffOptions(e);if(this.lastDiff&&xe(r,this.lastDiff.options))return this.lastDiff.diff;this.updateWatch(this.variables=e);var n=this.observableQuery;if(n&&n.options.fetchPolicy==="no-cache")return{complete:!1};var i=this.cache.diff(r);return this.updateLastDiff(i,r),i},t.prototype.updateLastDiff=function(e,r){this.lastDiff=e?{diff:e,options:r||this.getDiffOptions()}:void 0},t.prototype.getDiffOptions=function(e){var r;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(r=this.observableQuery)===null||r===void 0?void 0:r.options.canonizeResults}},t.prototype.setDiff=function(e){var r=this,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!xe(n&&n.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return r.notify()},0)))},t.prototype.setObservableQuery=function(e){var r=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var n=r.getDiff();n.fromOptimisticTransaction?e.observe():Jc(e)})):delete this.oqListener)},t.prototype.notify=function(){var e=this;tp(this),this.shouldNotify()&&this.listeners.forEach(function(r){return r(e)}),this.dirty=!1},t.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(Dr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},t.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=t.prototype.cancel,this.subscriptions.forEach(function(r){return r.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},t.prototype.cancel=function(){},t.prototype.updateWatch=function(e){var r=this;e===void 0&&(e=this.variables);var n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=T(T({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return r.setDiff(a)}});(!this.lastWatch||!xe(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},t.prototype.resetLastWrite=function(){this.lastWrite=void 0},t.prototype.shouldWrite=function(e,r){var n=this.lastWrite;return!(n&&n.dmCount===si.get(this.cache)&&xe(r,n.variables)&&xe(e.data,n.result.data))},t.prototype.markResult=function(e,r,n,i){var a=this,o=new lt,s=$e(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&$e(e.incremental)){var c=lo(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,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(Ro(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:r,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:si.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(n.variables),p=l.diff(d);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(p,d),p.complete&&(e.data=p.result)}):this.lastWrite=void 0)},t.prototype.markReady=function(){return this.networkError=null,this.networkStatus=pe.ready},t.prototype.markError=function(e){return this.networkStatus=pe.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},t}();function Ro(t,e){e===void 0&&(e="none");var r=e==="ignore"||e==="all",n=!ei(t);return!n&&r&&t.data&&(n=!0),n}var bg=Object.prototype.hasOwnProperty,rp=function(){function t(e){var r=e.cache,n=e.link,i=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,d=l===void 0?{}:l,p=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(kt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=r,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=p||new No({cache:r}),this.ssrMode=u,this.assumeImmutableResults=!!f,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return t.prototype.stop=function(){var e=this;this.queries.forEach(function(r,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new K("QueryManager stopped while query was in flight"):new K(14))},t.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(r){return r(e)}),this.fetchCancelFns.clear()},t.prototype.mutate=function(e){var r,n,i=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,d=l===void 0?!1:l,p=e.update,f=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((r=this.defaultOptions.mutate)===null||r===void 0?void 0:r.fetchPolicy)||"network-only":h,g=e.errorPolicy,_=g===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":g,S=e.keepRootFields,w=e.context;return Ft(this,void 0,void 0,function(){var b,O,C,E,R,F;return Lt(this,function(P){switch(P.label){case 0:return __DEV__?L(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):L(i,15),__DEV__?L(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(i),C=O.document,E=O.hasClientExports,i=this.cache.transformForLink(C),a=this.getVariables(i,a),E?[4,this.localState.addExportedVariables(i,a,w)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return R=this.mutationStore&&(this.mutationStore[b]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:b,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:w,updateQueries:s,update:p,keepRootFields:S}),this.broadcastQueries(),F=this,[2,new Promise(function(M,Ee){return co(F.getObservableFromLink(i,T(T({},w),{optimisticResponse:o}),a,!1),function(ie){if(ei(ie)&&_==="none")throw new ur({graphQLErrors:fo(ie)});R&&(R.loading=!1,R.error=null);var j=T({},ie);return typeof u=="function"&&(u=u(j)),_==="ignore"&&ei(j)&&delete j.errors,F.markMutationResult({mutationId:b,result:j,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:w,update:p,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?b:void 0,onQueryUpdated:f,keepRootFields:S})}).subscribe({next:function(ie){F.broadcastQueries(),(!("hasNext"in ie)||ie.hasNext===!1)&&M(ie)},error:function(ie){R&&(R.loading=!1,R.error=ie),o&&F.cache.removeOptimistic(b),F.broadcastQueries(),Ee(ie instanceof ur?ie:new ur({networkError:ie}))}})})]}})})},t.prototype.markMutationResult=function(e,r){var n=this;r===void 0&&(r=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Ro(i,e.errorPolicy)){if(Tr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Tr(i)&&$e(i.incremental)){var s=r.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=lo(s.result,i)),typeof c<"u"&&(i.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,p){var f=d.observableQuery,h=f&&f.queryName;if(!(!h||!bg.call(u,h))){var m=u[h],g=n.queries.get(p),_=g.document,S=g.variables,w=r.diff({query:_,variables:S,returnPartialData:!0,optimistic:!1}),b=w.result,O=w.complete;if(O&&b){var C=m(b,{mutationResult:i,queryName:_&&Jn(_)||void 0,queryVariables:S});C&&a.push({result:C,dataId:"ROOT_QUERY",query:_,variables:S})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var p=e.update,f=!Ml(i)||Tr(i)&&!i.hasNext;if(p){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=T(T({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}f&&p(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&f&&d.modify({id:"ROOT_MUTATION",fields:function(m,g){var _=g.fieldName,S=g.DELETE;return _==="__typename"?m:S}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},t.prototype.markMutationOptimistic=function(e,r){var n=this,i=typeof e=="function"?e(r.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(T(T({},r),{result:{data:i}}),a)}catch(o){__DEV__&&L.error(o)}},r.mutationId)},t.prototype.fetchQuery=function(e,r,n){return this.fetchQueryObservable(e,r,n).promise},t.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(r,n){e[n]={variables:r.variables,networkStatus:r.networkStatus,networkError:r.networkError,graphQLErrors:r.graphQLErrors}}),e},t.prototype.resetErrors=function(e){var r=this.queries.get(e);r&&(r.networkError=void 0,r.graphQLErrors=[])},t.prototype.transform=function(e){var r=this.transformCache;if(!r.has(e)){var n=this.cache.transformDocument(e),i=sc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:ec(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:an(Wt(n)),asQuery:T(T({},n),{definitions:n.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?T(T({},u),{operation:"query"}):u})})},c=function(u){u&&!r.has(u)&&r.set(u,s)};c(e),c(n),c(a),c(o)}return r.get(e)},t.prototype.getVariables=function(e,r){return T(T({},this.transform(e).defaultVars),r)},t.prototype.watchQuery=function(e){e=T(T({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var r=new Co(this),n=new Do({queryManager:this,queryInfo:r,options:e});return this.queries.set(n.queryId,r),r.init({document:n.query,observableQuery:n,variables:n.variables}),n},t.prototype.query=function(e,r){var n=this;return r===void 0&&(r=this.generateQueryId()),__DEV__?L(e.query,"query option is required. You must specify your GraphQL document in the query option."):L(e.query,17),__DEV__?L(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):L(e.query.kind==="Document",18),__DEV__?L(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):L(!e.returnPartialData,19),__DEV__?L(!e.pollInterval,"pollInterval option only supported on watchQuery."):L(!e.pollInterval,20),this.fetchQuery(r,e).finally(function(){return n.stopQuery(r)})},t.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},t.prototype.generateRequestId=function(){return this.requestIdCounter++},t.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},t.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryInStoreNoBroadcast=function(e){var r=this.queries.get(e);r&&r.stop()},t.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new K("Store reset while query was in flight (not completed in link chain)"):new K(21)),this.queries.forEach(function(r){r.observableQuery?r.networkStatus=pe.loading:r.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},t.prototype.getObservableQueries=function(e){var r=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):rc(o)?i.set(r.transform(o).document,!1):ce(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){n.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&i.has(l)||u&&i.has(u))&&(n.set(s,c),l&&i.set(l,!0),u&&i.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Gi("legacyOneTimeQuery"),c=r.getQuery(s).init({document:o.query,variables:o.variables}),u=new Do({queryManager:r,queryInfo:c,options:T(T({},o),{fetchPolicy:"network-only"})});L(u.queryId===s),c.setObservableQuery(u),n.set(s,u)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&L.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},t.prototype.reFetchObservableQueries=function(e){var r=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),r.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},t.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},t.prototype.startGraphQLSubscription=function(e){var r=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var u=function(d){return r.getObservableFromLink(n,c,d).map(function(p){if(i!=="no-cache"&&(Ro(p,a)&&r.cache.write({query:n,result:p.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),r.broadcastQueries()),ei(p))throw new ur({graphQLErrors:p.errors});return p})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new ee(function(d){var p=null;return l.then(function(f){return p=f.subscribe(d)},d.error),function(){return p&&p.unsubscribe()}})}return u(o)},t.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},t.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},t.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},t.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},t.prototype.getLocalState=function(){return this.localState},t.prototype.getObservableFromLink=function(e,r,n,i){var a=this,o;i===void 0&&(i=(o=r?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,d=u.link,p={query:c,variables:n,operationName:Jn(c)||void 0,context:this.prepareContext(T(T({},r),{forceFetch:!i}))};if(r=p.context,i){var f=l.get(c)||new Map;l.set(c,f);var h=vt(n);if(s=f.get(h),!s){var m=new Xn([ti(d,p)]);f.set(h,s=m),m.beforeNext(function(){f.delete(h)&&f.size<1&&l.delete(c)})}}else s=new Xn([ti(d,p)])}else s=new Xn([ee.of({data:{}})]),r=this.prepareContext(r);var g=this.transform(e).clientQuery;return g&&(s=co(s,function(_){return a.localState.runResolvers({document:g,remoteResult:_,context:r,variables:n})})),s},t.prototype.getResultsFromLink=function(e,r,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return co(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=fo(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new ur({graphQLErrors:s}));e.markResult(o,a,n,r),e.markReady()}var u={data:o.data,loading:!1,networkStatus:pe.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=pe.error),u},function(o){var s=ep(o)?o:new ur({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},t.prototype.fetchQueryObservable=function(e,r,n){var i=this;n===void 0&&(n=pe.loading);var a=this.transform(r.query).document,o=this.getVariables(a,r.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=r.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=r.errorPolicy,p=d===void 0?c&&c.errorPolicy||"none":d,f=r.returnPartialData,h=f===void 0?!1:f,m=r.notifyOnNetworkStatusChange,g=m===void 0?!1:m,_=r.context,S=_===void 0?{}:_,w=Object.assign({},r,{query:a,variables:o,fetchPolicy:l,errorPolicy:p,returnPartialData:h,notifyOnNetworkStatusChange:g,context:S}),b=function(E){w.variables=E;var R=i.fetchQueryByPolicy(s,w,n);return w.fetchPolicy!=="standby"&&R.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",r),R},O=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(E){O(),setTimeout(function(){return C.cancel(E)})});var C=new Xn(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(b):b(w.variables));return C.promise.then(O,O),C},t.prototype.refetchQueries=function(e){var r=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Gi("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(p,f){l.set(f,{oq:p,lastDiff:r.getQuery(f).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(p,f,h){var m=p.watcher instanceof Co&&p.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var g=u(m,f,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:f})}}}),l.size&&l.forEach(function(p,f){var h=p.oq,m=p.lastDiff,g=p.diff,_;if(u){if(!g){var S=h.queryInfo;S.reset(),g=S.getDiff()}_=u(h,g,m)}(!u||_===!0)&&(_=h.refetch()),_!==!1&&d.set(h,_),f.indexOf("legacyOneTimeQuery")>=0&&r.stopQueryNoBroadcast(f)}),c&&this.cache.removeOptimistic(c),d},t.prototype.fetchQueryByPolicy=function(e,r,n){var i=this,a=r.query,o=r.variables,s=r.fetchPolicy,c=r.refetchWritePolicy,u=r.errorPolicy,l=r.returnPartialData,d=r.context,p=r.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},m=function(b,O){O===void 0&&(O=e.networkStatus||pe.loading);var C=b.result;__DEV__&&!l&&!xe(C,{})&&Yc(b.missing);var E=function(R){return ee.of(T({data:R,loading:Dr(O),networkStatus:O},b.complete?null:{partial:!0}))};return C&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:C},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(R){return E(R.data||void 0)}):u==="none"&&O===pe.refetch&&Array.isArray(b.missing)?E(void 0):E(C)},g=s==="no-cache"?0:n===pe.refetch&&c!=="merge"?1:2,_=function(){return i.getResultsFromLink(e,g,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},S=p&&typeof f=="number"&&f!==n&&Dr(n);switch(s){default:case"cache-first":{var w=h();return w.complete?[m(w,e.markReady())]:l||S?[m(w),_()]:[_()]}case"cache-and-network":{var w=h();return w.complete||l||S?[m(w),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return S?[m(h()),_()]:[_()];case"no-cache":return S?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},t.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Co(this,e)),this.queries.get(e)},t.prototype.prepareContext=function(e){e===void 0&&(e={});var r=this.localState.prepareContext(e);return T(T({},r),{clientAwareness:this.clientAwareness})},t}();var np=!1;var Xc=function(){function t(e){var r=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,d=e.connectToDevTools,p=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,f=e.queryDeduplication,h=f===void 0?!0:f,m=e.defaultOptions,g=e.assumeImmutableResults,_=g===void 0?!1:g,S=e.resolvers,w=e.typeDefs,b=e.fragmentMatcher,O=e.name,C=e.version,E=e.link;if(E||(E=n?new kc({uri:n,credentials:i,headers:a}):At.empty()),!o)throw __DEV__?new K(`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 K(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=w,l&&setTimeout(function(){return r.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),p&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!np&&p&&__DEV__&&(np=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var R=window.navigator,F=R&&R.userAgent,P=void 0;typeof F=="string"&&(F.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":F.indexOf("Firefox/")>-1&&(P="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),P&&__DEV__&&L.log("Download the Apollo DevTools for a better development experience: "+P)}this.version=Bl,this.localState=new No({cache:o,client:this,resolvers:S,fragmentMatcher:b}),this.queryManager=new rp({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:O,version:C},localState:this.localState,assumeImmutableResults:_,onBroadcast:p?function(){r.devToolsHookCb&&r.devToolsHookCb({action:{},state:{queries:r.queryManager.getQueryStore(),mutations:r.queryManager.mutationStore||{}},dataWithOptimisticResults:r.cache.extract(!0)})}:void 0})}return t.prototype.stop=function(){this.queryManager.stop()},t.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ki(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=T(T({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},t.prototype.query=function(e){return this.defaultOptions.query&&(e=Ki(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=T(T({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},t.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ki(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},t.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},t.prototype.readQuery=function(e,r){return r===void 0&&(r=!1),this.cache.readQuery(e,r)},t.prototype.readFragment=function(e,r){return r===void 0&&(r=!1),this.cache.readFragment(e,r)},t.prototype.writeQuery=function(e){var r=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.writeFragment=function(e){var r=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),r},t.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},t.prototype.__requestRaw=function(e){return ti(this.link,e)},t.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(r){return r()}))}).then(function(){return e.reFetchObservableQueries()})},t.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(r){return r()}))})},t.prototype.onResetStore=function(e){var r=this;return this.resetStoreCallbacks.push(e),function(){r.resetStoreCallbacks=r.resetStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.onClearStore=function(e){var r=this;return this.clearStoreCallbacks.push(e),function(){r.clearStoreCallbacks=r.clearStoreCallbacks.filter(function(n){return n!==e})}},t.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},t.prototype.refetchQueries=function(e){var r=this.queryManager.refetchQueries(e),n=[],i=[];r.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&L.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},t.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},t.prototype.extract=function(e){return this.cache.extract(e)},t.prototype.restore=function(e){return this.cache.restore(e)},t.prototype.addResolvers=function(e){this.localState.addResolvers(e)},t.prototype.setResolvers=function(e){this.localState.setResolvers(e)},t.prototype.getResolvers=function(){return this.localState.getResolvers()},t.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},t.prototype.setLink=function(e){this.link=this.queryManager.link=e},t}();hl(Zr?"log":"silent");function nt(t){return t===null?"null":Array.isArray(t)?"array":typeof t}function lr(t){return nt(t)==="object"}function ip(t){return Array.isArray(t)&&t.length>0&&t.every(e=>"message"in e)}function eu(t,e){return t.length<124?t:e}var ap="graphql-transport-ws";var ft;(function(t){t[t.InternalServerError=4500]="InternalServerError",t[t.InternalClientError=4005]="InternalClientError",t[t.BadRequest=4400]="BadRequest",t[t.BadResponse=4004]="BadResponse",t[t.Unauthorized=4401]="Unauthorized",t[t.Forbidden=4403]="Forbidden",t[t.SubprotocolNotAcceptable=4406]="SubprotocolNotAcceptable",t[t.ConnectionInitialisationTimeout=4408]="ConnectionInitialisationTimeout",t[t.ConnectionAcknowledgementTimeout=4504]="ConnectionAcknowledgementTimeout",t[t.SubscriberAlreadyExists=4409]="SubscriberAlreadyExists",t[t.TooManyInitialisationRequests=4429]="TooManyInitialisationRequests"})(ft||(ft={}));var Ne;(function(t){t.ConnectionInit="connection_init",t.ConnectionAck="connection_ack",t.Ping="ping",t.Pong="pong",t.Subscribe="subscribe",t.Next="next",t.Error="error",t.Complete="complete"})(Ne||(Ne={}));function op(t){if(!lr(t))throw new Error(`Message is expected to be an object, but got ${nt(t)}`);if(!t.type)throw new Error("Message is missing the 'type' property");if(typeof t.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${nt(t.type)}`);switch(t.type){case Ne.ConnectionInit:case Ne.ConnectionAck:case Ne.Ping:case Ne.Pong:{if(t.payload!=null&&!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${t.payload}"`);break}case Ne.Subscribe:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${nt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${nt(t.payload)}`);if(typeof t.payload.query!="string")throw new Error(`"${t.type}" message payload expects the 'query' property to be a string, but got ${nt(t.payload.query)}`);if(t.payload.variables!=null&&!lr(t.payload.variables))throw new Error(`"${t.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${nt(t.payload.variables)}`);if(t.payload.operationName!=null&&nt(t.payload.operationName)!=="string")throw new Error(`"${t.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${nt(t.payload.operationName)}`);if(t.payload.extensions!=null&&!lr(t.payload.extensions))throw new Error(`"${t.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${nt(t.payload.extensions)}`);break}case Ne.Next:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${nt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!lr(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an object, but got ${nt(t.payload)}`);break}case Ne.Error:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${nt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);if(!ip(t.payload))throw new Error(`"${t.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(t.payload)}`);break}case Ne.Complete:{if(typeof t.id!="string")throw new Error(`"${t.type}" message expects the 'id' property to be a string, but got ${nt(t.id)}`);if(!t.id)throw new Error(`"${t.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${t.type}"`)}return t}function sp(t,e){return op(typeof t=="string"?JSON.parse(t,e):t)}function ci(t,e){return op(t),JSON.stringify(t,e)}function tu(t){let{url:e,connectionParams:r,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(ye){let ve=1e3;for(let oe=0;oe<ye;oe++)ve*=2;await new Promise(oe=>setTimeout(oe,ve+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Po,isFatalConnectionProblem:p,on:f,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ye=>{let ve=Math.random()*16|0;return(ye=="x"?ve:ve&3|8).toString(16)})},jsonMessageReplacer:g,jsonMessageReviver:_}=t,S;if(h){if(!Sg(h))throw new Error("Invalid WebSocket implementation provided");S=h}else typeof WebSocket<"u"?S=WebSocket:typeof global<"u"?S=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(S=window.WebSocket||window.MozWebSocket);if(!S)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=S,b=(()=>{let j=(()=>{let ve={};return{on(oe,se){return ve[oe]=se,()=>{delete ve[oe]}},emit(oe){var se;"id"in oe&&((se=ve[oe.id])===null||se===void 0||se.call(ve,oe))}}})(),ye={connecting:f?.connecting?[f.connecting]:[],opened:f?.opened?[f.opened]:[],connected:f?.connected?[f.connected]:[],ping:f?.ping?[f.ping]:[],pong:f?.pong?[f.pong]:[],message:f?.message?[j.emit,f.message]:[j.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:j.on,on(ve,oe){let se=ye[ve];return se.push(oe),()=>{se.splice(se.indexOf(oe),1)}},emit(ve,...oe){for(let se of[...ye[ve]])se(...oe)}}})();function O(j){let ye=[b.on("error",ve=>{ye.forEach(oe=>oe()),j(ve)}),b.on("closed",ve=>{ye.forEach(oe=>oe()),j(ve)})]}let C,E=0,R,F=!1,P=0,M=!1;async function Ee(){clearTimeout(R);let[j,ye]=await(C??(C=new Promise((se,Bt)=>(async()=>{if(F){if(await l(P),!E)return C=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});P++}b.emit("connecting");let X=new w(typeof e=="function"?await e():e,ap),Vt,_r;function Ja(){isFinite(o)&&o>0&&(clearTimeout(_r),_r=setTimeout(()=>{X.readyState===w.OPEN&&(X.send(ci({type:Ne.Ping})),b.emit("ping",!1,void 0))},o))}O(We=>{C=void 0,clearTimeout(Vt),clearTimeout(_r),Bt(We),Po(We)&&We.code===4499&&(X.close(4499,"Terminated"),X.onerror=null,X.onclose=null)}),X.onerror=We=>b.emit("error",We),X.onclose=We=>b.emit("closed",We),X.onopen=async()=>{try{b.emit("opened",X);let We=typeof r=="function"?await r():r;if(X.readyState!==w.OPEN)return;X.send(ci(We?{type:Ne.ConnectionInit,payload:We}:{type:Ne.ConnectionInit},g)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{X.close(ft.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Ja()}catch(We){b.emit("error",We),X.close(ft.InternalClientError,eu(We instanceof Error?We.message:new Error(We).message,"Internal client error"))}};let Wn=!1;X.onmessage=({data:We})=>{try{let Ge=sp(We,_);if(b.emit("message",Ge),Ge.type==="ping"||Ge.type==="pong"){b.emit(Ge.type,!0,Ge.payload),Ge.type==="pong"?Ja():s||(X.send(ci(Ge.payload?{type:Ne.Pong,payload:Ge.payload}:{type:Ne.Pong})),b.emit("pong",!1,Ge.payload));return}if(Wn)return;if(Ge.type!==Ne.ConnectionAck)throw new Error(`First message cannot be of type ${Ge.type}`);clearTimeout(Vt),Wn=!0,b.emit("connected",X,Ge.payload),F=!1,P=0,se([X,new Promise((W_,Oh)=>O(Oh))])}catch(Ge){X.onmessage=null,b.emit("error",Ge),X.close(ft.BadResponse,eu(Ge instanceof Error?Ge.message:new Error(Ge).message,"Bad response"))}}})())));j.readyState===w.CLOSING&&await ye;let ve=()=>{},oe=new Promise(se=>ve=se);return[j,ve,Promise.race([oe.then(()=>{if(!E){let se=()=>j.close(1e3,"Normal Closure");isFinite(a)&&a>0?R=setTimeout(()=>{j.readyState===w.OPEN&&se()},a):se()}}),ye])]}function ie(j){if(Po(j)&&(_g(j.code)||[ft.InternalServerError,ft.InternalClientError,ft.BadRequest,ft.BadResponse,ft.Unauthorized,ft.SubprotocolNotAcceptable,ft.SubscriberAlreadyExists,ft.TooManyInitialisationRequests].includes(j.code)))throw j;if(M)return!1;if(Po(j)&&j.code===1e3)return E>0;if(!u||P>=u||!d(j)||p?.(j))throw j;return F=!0}return n||(async()=>{for(E++;;)try{let[,,j]=await Ee();await j}catch(j){try{if(!ie(j))return}catch(ye){return i?.(ye)}}})(),{on:b.on,subscribe(j,ye){let ve=m(j),oe=!1,se=!1,Bt=()=>{E--,oe=!0};return(async()=>{for(E++;;)try{let[X,Vt,_r]=await Ee();if(oe)return Vt();let Ja=b.onMessage(ve,Wn=>{switch(Wn.type){case Ne.Next:{ye.next(Wn.payload);return}case Ne.Error:{se=!0,oe=!0,ye.error(Wn.payload),Bt();return}case Ne.Complete:{oe=!0,Bt();return}}});X.send(ci({id:ve,type:Ne.Subscribe,payload:j},g)),Bt=()=>{!oe&&X.readyState===w.OPEN&&X.send(ci({id:ve,type:Ne.Complete},g)),E--,oe=!0,Vt()},await _r.finally(Ja);return}catch(X){if(!ie(X))return}})().then(()=>{se||ye.complete()}).catch(X=>{ye.error(X)}),()=>{oe||Bt()}},async dispose(){if(M=!0,C){let[j]=await C;j.close(1e3,"Normal Closure")}},terminate(){C&&b.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Po(t){return lr(t)&&"code"in t&&"reason"in t}function _g(t){return[1e3,1001,1006,1005,1012,1013,1013].includes(t)?!1:t>=1e3&&t<=1999}function Sg(t){return typeof t=="function"&&"constructor"in t&&"CLOSED"in t&&"CLOSING"in t&&"CONNECTING"in t&&"OPEN"in t}function wg(t){return ce(t)&&"code"in t&&"reason"in t}var cp=function(t){Oe(e,t);function e(r){var n=t.call(this)||this;return n.client=r,n}return e.prototype.request=function(r){var n=this;return new ee(function(i){return n.client.subscribe(T(T({},r),{query:Gn(r.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):wg(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new ur({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(At);var Fo="0.12.0-rc1";function up(){return typeof window!="undefined"&&window.self!==window.top}function ru(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(t){return!1}return!0}function fr(t,e){ru()&&localStorage.setItem(`${Fo}/${t}`,e)}function Lo(t){return ru()?localStorage.getItem(`${Fo}/${t}`):null}function ra(t){ru()&&localStorage.removeItem(`${Fo}/${t}`)}function lp(t,e=1e4){return Se(this,null,function*(){return Promise.race([new Promise((r,n)=>{let i;try{i=new WebSocket(t,"graphql-transport-ws"),i.onopen=()=>{i.close(),r(i)},i.onerror=a=>{n(a)},i.onclose=a=>{a.code!==1e3&&n(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){i&&i.close(),n(a)}}),new Promise((r,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}var ms=function(){return ms=Object.assign||function(e){for(var r,n=1,i=arguments.length;n<i;n++){r=arguments[n];for(var a in r)Object.prototype.hasOwnProperty.call(r,a)&&(e[a]=r[a])}return e},ms.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Jo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jo=function(r){return typeof r}:Jo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Jo(t)}function xg(t){return Jo(t)=="object"&&t!==null}var Ad=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function wu(t,e){for(var r=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=r.exec(t.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Tg(t){return Od(t.source,wu(t.source,t.start))}function Od(t,e){var r=t.locationOffset.column-1,n=Yo(r)+t.body,i=e.line-1,a=t.locationOffset.line-1,o=e.line+a,s=e.line===1?r:0,c=e.column+s,u="".concat(t.name,":").concat(o,":").concat(c,`
52
- `),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var p=Math.floor(c/80),f=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return u+fp([["".concat(o),h[0]]].concat(h.slice(1,p+1).map(function(g){return["",g]}),[[" ",Yo(f-1)+"^"],["",h[p+1]]]))}return u+fp([["".concat(o-1),l[i-1]],["".concat(o),d],["",Yo(c-1)+"^"],["".concat(o+1),l[i+1]]])}function fp(t){var e=t.filter(function(n){n[0];var i=n[1];return i!==void 0}),r=Math.max.apply(Math,e.map(function(n){var i=n[0];return i.length}));return e.map(function(n){var i=n[0],a=n[1];return Ig(r,i)+(a?" | "+a:" |")}).join(`
53
- `)}function Yo(t){return Array(t+1).join(" ")}function Ig(t,e){return Yo(t-e.length)+e}function Zo(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zo=function(r){return typeof r}:Zo=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},Zo(t)}function pp(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(t,i).enumerable})),r.push.apply(r,n)}return r}function kg(t){for(var e=1;e<arguments.length;e++){var r=arguments[e]!=null?arguments[e]:{};e%2?pp(Object(r),!0).forEach(function(n){Ag(t,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):pp(Object(r)).forEach(function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(r,n))})}return t}function Ag(t,e,r){return e in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function Og(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function dp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Dg(t,e,r){return e&&dp(t.prototype,e),r&&dp(t,r),t}function Ng(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Oa(t,e)}function Cg(t){var e=Nd();return function(){var n=Da(t),i;if(e){var a=Da(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Dd(this,i)}}function Dd(t,e){return e&&(Zo(e)==="object"||typeof e=="function")?e:sa(t)}function sa(t){if(t===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function Eu(t){var e=typeof Map=="function"?new Map:void 0;return Eu=function(n){if(n===null||!Rg(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return Xo(n,arguments,Da(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Oa(i,n)},Eu(t)}function Xo(t,e,r){return Nd()?Xo=Reflect.construct:Xo=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&Oa(u,o.prototype),u},Xo.apply(null,arguments)}function Nd(){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 Rg(t){return Function.toString.call(t).indexOf("[native code]")!==-1}function Oa(t,e){return Oa=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Oa(t,e)}function Da(t){return Da=Object.setPrototypeOf?Object.getPrototypeOf:function(r){return r.__proto__||Object.getPrototypeOf(r)},Da(t)}var Pg=function(t){Ng(r,t);var e=Cg(r);function r(n,i,a,o,s,c,u){var l,d,p,f;Og(this,r),f=e.call(this,n),f.name="GraphQLError",f.originalError=c??void 0,f.nodes=hp(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,g=(_=f.nodes)!==null&&_!==void 0?_:[];m<g.length;m++){var _,S=g[m],w=S.loc;w!=null&&h.push(w)}h=hp(h),f.source=a??((l=h)===null||l===void 0?void 0:l[0].source),f.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(O){return O.start})),f.locations=o&&a?o.map(function(O){return wu(a,O)}):(p=h)===null||p===void 0?void 0:p.map(function(O){return wu(O.source,O.start)}),f.path=s??void 0;var b=c?.extensions;return u==null&&xg(b)?f.extensions=kg({},b):f.extensions=u??{},Object.defineProperties(sa(f),{message:{enumerable:!0},locations:{enumerable:f.locations!=null},path:{enumerable:f.path!=null},extensions:{enumerable:f.extensions!=null&&Object.keys(f.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(sa(f),"stack",{value:c.stack,writable:!0,configurable:!0}),Dd(f)):(Error.captureStackTrace?Error.captureStackTrace(sa(f),r):Object.defineProperty(sa(f),"stack",{value:Error().stack,writable:!0,configurable:!0}),f)}return Dg(r,[{key:"toString",value:function(){return Fg(this)}},{key:Ad,get:function(){return"Object"}}]),r}(Eu(Error));function hp(t){return t===void 0||t.length===0?void 0:t}function Fg(t){var e=t.message;if(t.nodes)for(var r=0,n=t.nodes;r<n.length;r++){var i=n[r];i.loc&&(e+=`
54
-
55
- `+Tg(i.loc))}else if(t.source&&t.locations)for(var a=0,o=t.locations;a<o.length;a++){var s=o[a];e+=`
56
-
57
- `+Od(t.source,s)}return e}function _t(t,e,r){return new Pg("Syntax Error: ".concat(r),void 0,t,[e])}var z=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 Lg(t,e){var r=Boolean(t);if(!r)throw new Error(e??"Unexpected invariant triggered.")}var $g=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,xu=$g;function Cd(t){var e=t.prototype.toJSON;typeof e=="function"||Lg(0),t.prototype.inspect=e,xu&&(t.prototype[xu]=e)}var Rd=function(){function t(r,n,i){this.start=r.start,this.end=n.end,this.startToken=r,this.endToken=n,this.source=i}var e=t.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},t}();Cd(Rd);var Pe=function(){function t(r,n,i,a,o,s,c){this.kind=r,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=t.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},t}();Cd(Pe);var D=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 es(t){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?es=function(r){return typeof r}:es=function(r){return r&&typeof Symbol=="function"&&r.constructor===Symbol&&r!==Symbol.prototype?"symbol":typeof r},es(t)}var Mg=10,Pd=2;function jg(t){return Ms(t,[])}function Ms(t,e){switch(es(t)){case"string":return JSON.stringify(t);case"function":return t.name?"[function ".concat(t.name,"]"):"[function]";case"object":return t===null?"null":Ug(t,e);default:return String(t)}}function Ug(t,e){if(e.indexOf(t)!==-1)return"[Circular]";var r=[].concat(e,[t]),n=Vg(t);if(n!==void 0){var i=n.call(t);if(i!==t)return typeof i=="string"?i:Ms(i,r)}else if(Array.isArray(t))return Bg(t,r);return qg(t,r)}function qg(t,e){var r=Object.keys(t);if(r.length===0)return"{}";if(e.length>Pd)return"["+Qg(t)+"]";var n=r.map(function(i){var a=Ms(t[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Bg(t,e){if(t.length===0)return"[]";if(e.length>Pd)return"[Array]";for(var r=Math.min(Mg,t.length),n=t.length-r,i=[],a=0;a<r;++a)i.push(Ms(t[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Vg(t){var e=t[String(xu)];if(typeof e=="function")return e;if(typeof t.inspect=="function")return t.inspect}function Qg(t){var e=Object.prototype.toString.call(t).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof t.constructor=="function"){var r=t.constructor.name;if(typeof r=="string"&&r!=="")return r}return e}function nu(t,e){var r=Boolean(t);if(!r)throw new Error(e)}var zg=function(e,r){return e instanceof r};function mp(t,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function Wg(t,e,r){return e&&mp(t.prototype,e),r&&mp(t,r),t}var Fd=function(){function t(e){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||nu(0,"Body must be a string. Received: ".concat(jg(e),".")),this.body=e,this.name=r,this.locationOffset=n,this.locationOffset.line>0||nu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||nu(0,"column in locationOffset is 1-indexed and must be positive.")}return Wg(t,[{key:Ad,get:function(){return"Source"}}]),t}();function Gg(t){return zg(t,Fd)}var Kg=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 Hg(t){var e=t.split(/\r\n|[\n\r]/g),r=Jg(t);if(r!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(r);for(var i=0;i<e.length&&gp(e[i]);)++i;for(var a=e.length;a>i&&gp(e[a-1]);)--a;return e.slice(i,a).join(`
58
- `)}function gp(t){for(var e=0;e<t.length;++e)if(t[e]!==" "&&t[e]!==" ")return!1;return!0}function Jg(t){for(var e,r=!0,n=!0,i=0,a=null,o=0;o<t.length;++o)switch(t.charCodeAt(o)){case 13:t.charCodeAt(o+1)===10&&++o;case 10:r=!1,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!r&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var Yg=function(){function t(r){var n=new Pe(D.SOF,0,0,0,0,null);this.source=r,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=t.prototype;return e.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},e.lookahead=function(){var n=this.token;if(n.kind!==D.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=Xg(this,n)}while(n.kind===D.COMMENT);return n},t}();function Zg(t){return t===D.BANG||t===D.DOLLAR||t===D.AMP||t===D.PAREN_L||t===D.PAREN_R||t===D.SPREAD||t===D.COLON||t===D.EQUALS||t===D.AT||t===D.BRACKET_L||t===D.BRACKET_R||t===D.BRACE_L||t===D.PIPE||t===D.BRACE_R}function In(t){return isNaN(t)?D.EOF:t<127?JSON.stringify(String.fromCharCode(t)):'"\\u'.concat(("00"+t.toString(16).toUpperCase()).slice(-4),'"')}function Xg(t,e){for(var r=t.source,n=r.body,i=n.length,a=e.end;a<i;){var o=n.charCodeAt(a),s=t.line,c=1+a-t.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++t.line,t.lineStart=a;continue;case 13:n.charCodeAt(a+1)===10?a+=2:++a,++t.line,t.lineStart=a;continue;case 33:return new Pe(D.BANG,a,a+1,s,c,e);case 35:return ty(r,a,s,c,e);case 36:return new Pe(D.DOLLAR,a,a+1,s,c,e);case 38:return new Pe(D.AMP,a,a+1,s,c,e);case 40:return new Pe(D.PAREN_L,a,a+1,s,c,e);case 41:return new Pe(D.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Pe(D.SPREAD,a,a+3,s,c,e);break;case 58:return new Pe(D.COLON,a,a+1,s,c,e);case 61:return new Pe(D.EQUALS,a,a+1,s,c,e);case 64:return new Pe(D.AT,a,a+1,s,c,e);case 91:return new Pe(D.BRACKET_L,a,a+1,s,c,e);case 93:return new Pe(D.BRACKET_R,a,a+1,s,c,e);case 123:return new Pe(D.BRACE_L,a,a+1,s,c,e);case 124:return new Pe(D.PIPE,a,a+1,s,c,e);case 125:return new Pe(D.BRACE_R,a,a+1,s,c,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?iy(r,a,s,c,e,t):ny(r,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 ry(r,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 oy(r,a,s,c,e)}throw _t(r,a,ey(o))}var u=t.line,l=1+a-t.lineStart;return new Pe(D.EOF,i,i,u,l,e)}function ey(t){return t<32&&t!==9&&t!==10&&t!==13?"Cannot contain the invalid character ".concat(In(t),"."):t===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(In(t),".")}function ty(t,e,r,n,i){var a=t.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Pe(D.COMMENT,e,s,r,n,i,a.slice(e+1,s))}function ry(t,e,r,n,i,a){var o=t.body,s=r,c=e,u=!1;if(s===45&&(s=o.charCodeAt(++c)),s===48){if(s=o.charCodeAt(++c),s>=48&&s<=57)throw _t(t,c,"Invalid number, unexpected digit after 0: ".concat(In(s),"."))}else c=iu(t,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=iu(t,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=iu(t,c,s),s=o.charCodeAt(c)),s===46||sy(s))throw _t(t,c,"Invalid number, expected digit but got: ".concat(In(s),"."));return new Pe(u?D.FLOAT:D.INT,e,c,n,i,a,o.slice(e,c))}function iu(t,e,r){var n=t.body,i=e,a=r;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw _t(t,i,"Invalid number, expected digit but got: ".concat(In(a),"."))}function ny(t,e,r,n,i){for(var a=t.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 Pe(D.STRING,e,o+1,r,n,i,u);if(c<32&&c!==9)throw _t(t,o,"Invalid character within String: ".concat(In(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=ay(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 _t(t,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw _t(t,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw _t(t,o,"Unterminated string.")}function iy(t,e,r,n,i,a){for(var o=t.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 Pe(D.BLOCK_STRING,e,s+3,r,n,i,Hg(l));if(u<32&&u!==9&&u!==10&&u!==13)throw _t(t,s,"Invalid character within String: ".concat(In(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 _t(t,s,"Unterminated string.")}function ay(t,e,r,n){return $o(t)<<12|$o(e)<<8|$o(r)<<4|$o(n)}function $o(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:-1}function oy(t,e,r,n,i){for(var a=t.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 Pe(D.NAME,e,s,r,n,i,a.slice(e,s))}function sy(t){return t===95||t>=65&&t<=90||t>=97&&t<=122}function cy(t,e){var r=new uy(t,e);return r.parseDocument()}var uy=function(){function t(r,n){var i=Gg(r)?r:new Fd(r);this._lexer=new Yg(i),this._options=n}var e=t.prototype;return e.parseName=function(){var n=this.expectToken(D.NAME);return{kind:z.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:z.DOCUMENT,definitions:this.many(D.SOF,this.parseDefinition,D.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(D.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(D.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(D.BRACE_L))return{kind:z.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(D.NAME)&&(a=this.parseName()),{kind:z.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(D.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(D.PAREN_L,this.parseVariableDefinition,D.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:z.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(D.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(D.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(D.DOLLAR),{kind:z.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:z.SELECTION_SET,selections:this.many(D.BRACE_L,this.parseSelection,D.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(D.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(D.COLON)?(a=i,o=this.parseName()):o=i,{kind:z.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(D.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(D.PAREN_L,i,D.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(D.COLON),{kind:z.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:z.ARGUMENT,name:this.parseName(),value:(this.expectToken(D.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(D.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(D.NAME)?{kind:z.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:z.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:z.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:z.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case D.BRACKET_L:return this.parseList(n);case D.BRACE_L:return this.parseObject(n);case D.INT:return this._lexer.advance(),{kind:z.INT,value:i.value,loc:this.loc(i)};case D.FLOAT:return this._lexer.advance(),{kind:z.FLOAT,value:i.value,loc:this.loc(i)};case D.STRING:case D.BLOCK_STRING:return this.parseStringLiteral();case D.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:z.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:z.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:z.NULL,loc:this.loc(i)};default:return{kind:z.ENUM,value:i.value,loc:this.loc(i)}}case D.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:z.STRING,value:n.value,block:n.kind===D.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:z.LIST,values:this.any(D.BRACKET_L,o,D.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:z.OBJECT,fields:this.any(D.BRACE_L,o,D.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(D.COLON),{kind:z.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(D.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(D.AT),{kind:z.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(D.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(D.BRACKET_R),i={kind:z.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(D.BANG)?{kind:z.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:z.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===D.NAME)switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(n)},e.peekDescription=function(){return this.peek(D.STRING)||this.peek(D.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(D.BRACE_L,this.parseOperationTypeDefinition,D.BRACE_R);return{kind:z.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(D.COLON);var a=this.parseNamedType();return{kind:z.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:z.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:z.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(D.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(D.AMP)||this.peek(D.NAME));return i}return this.delimitedMany(D.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(D.BRACE_L)&&this._lexer.lookahead().kind===D.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(D.BRACE_L,this.parseFieldDefinition,D.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(D.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:z.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:c,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(D.PAREN_L,this.parseInputValueDef,D.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(D.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(D.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:z.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:z.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:z.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(D.EQUALS)?this.delimitedMany(D.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:z.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(D.BRACE_L,this.parseEnumValueDefinition,D.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:z.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:z.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(D.BRACE_L,this.parseInputValueDef,D.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===D.NAME)switch(n.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(D.BRACE_L,this.parseOperationTypeDefinition,D.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:z.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:z.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:z.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:z.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:z.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:z.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:z.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(D.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:z.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(D.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(Kg[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new Rd(n,this._lexer.lastToken,this._lexer.source)},e.peek=function(n){return this._lexer.token.kind===n},e.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw _t(this._lexer.source,i.start,"Expected ".concat(Ld(n),", found ").concat(au(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===D.NAME&&i.value===n)this._lexer.advance();else throw _t(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(au(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===D.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return _t(this._lexer.source,i.start,"Unexpected ".concat(au(i),"."))},e.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},e.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},t}();function au(t){var e=t.value;return Ld(t.kind)+(e!=null?' "'.concat(e,'"'):"")}function Ld(t){return Zg(t)?'"'.concat(t,'"'):t}var ts=new Map,Tu=new Map,$d=!0,gs=!1;function Md(t){return t.replace(/[\s,]+/g," ").trim()}function ly(t){return Md(t.source.body.substring(t.start,t.end))}function fy(t){var e=new Set,r=[];return t.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=ly(n.loc),o=Tu.get(i);o&&!o.has(a)?$d&&console.warn("Warning: fragment with name "+i+` already exists.
47
+ `))}}}}var Oo=function(r){Ne(e,r);function e(t){t===void 0&&(t={});var n=r.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=To,n.txCount=0,n.config=Ap(t),n.addTypename=!!n.config.addTypename,n.policies=new Wp({cache:n,dataIdFromObject:n.config.dataIdFromObject,possibleTypes:n.config.possibleTypes,typePolicies:n.config.typePolicies}),n.init(),n}return e.prototype.init=function(){var t=this.data=new ii.Root({policies:this.policies,resultCaching:this.config.resultCaching});this.optimisticData=t.stump,this.resetResultCache()},e.prototype.resetResultCache=function(t){var n=this,i=this.storeReader,a=this.config.fragments;this.storeWriter=new Yp(this,this.storeReader=new Lp({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:wo(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=un(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(ln(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,yt({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 n=t.returnPartialData,i=n===void 0?!1:n;try{return this.storeReader.diffQueryAgainstStore(x(x({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof Xi)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(De.call(t,"id")&&!t.id)return!1;var n=t.optimistic?this.optimisticData:this.data;try{return++this.txCount,n.modify(t.id||"ROOT_QUERY",t.fields)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.diff=function(t){return this.storeReader.diffQueryAgainstStore(x(x({},t),{store:t.optimistic?this.optimisticData:this.data,rootId:t.id||"ROOT_QUERY",config:this.config}))},e.prototype.watch=function(t){var n=this;return this.watches.size||$p(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&Vc(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){yt.reset();var n=this.optimisticData.gc();return t&&!this.txCount&&(t.resetResultCache?this.resetResultCache(t.resetResultIdentities):t.resetResultIdentities&&this.storeReader.resetCanon()),n},e.prototype.retain=function(t,n){return(n?this.optimisticData:this.data).retain(t)},e.prototype.release=function(t,n){return(n?this.optimisticData:this.data).release(t)},e.prototype.identify=function(t){if(ee(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){__DEV__&&F.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(De.call(t,"id"))return!1;t=x(x({},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 n=this;return this.init(),yt.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Vc(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var n=this.optimisticData.removeLayer(t);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(t){var n=this,i=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,u,l=function(f){var p=n,h=p.data,m=p.optimisticData;++n.txCount,f&&(n.data=n.optimisticData=f);try{return u=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(x(x({},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(x(x({},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 n.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(t),u},e.prototype.performTransaction=function(t,n){return this.batch({update:t,optimistic:n||n!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var n=this.typenameDocumentCache.get(t);return n||(n=sn(t),this.typenameDocumentCache.set(t,n),this.typenameDocumentCache.set(n,n)),n}return t},e.prototype.transformForLink=function(t){var n=this.config.fragments;return n?n.transform(t):t},e.prototype.broadcastWatches=function(t){var n=this;this.txCount||this.watches.forEach(function(i){return n.maybeBroadcastWatch(i,t)})},e.prototype.broadcastWatch=function(t,n){var i=t.lastDiff,a=this.diff(t);n&&(t.optimistic&&typeof n.optimistic=="string"&&(a.fromOptimisticTransaction=!0),n.onWatchUpdated&&n.onWatchUpdated.call(this,t,a,i)===!1)||(!i||!Ie(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(Fc);function Xp(r){return r.hasOwnProperty("graphQLErrors")}var vg=function(r){var e="";if(Me(r.graphQLErrors)||Me(r.clientErrors)){var t=(r.graphQLErrors||[]).concat(r.clientErrors||[]);t.forEach(function(n){var i=n?n.message:"Error message not found.";e+="".concat(i,`
48
+ `)})}return r.networkError&&(e+="".concat(r.networkError.message,`
49
+ `)),e=e.replace(/\n$/,""),e},ur=function(r){Ne(e,r);function e(t){var n=t.graphQLErrors,i=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=n||[],c.clientErrors=i||[],c.networkError=a||null,c.message=o||vg(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var pe;(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"})(pe||(pe={}));function Nr(r){return r?r<7:!1}var bg=Object.assign,Sg=Object.hasOwnProperty,No=function(r){Ne(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,o=r.call(this,function(y){try{var _=y._subscription._observer;_&&!_.error&&(_.error=_g)}catch{}var S=!o.observers.size;o.observers.add(y);var w=o.last;return w&&w.error?y.error&&y.error(w.error):w&&w.result&&y.next&&y.next(w.result),S&&o.reobserve().catch(function(){}),function(){o.observers.delete(y)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=i,o.queryManager=n,o.isTornDown=!1;var s=n.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=x(x({},a),{initialFetchPolicy:h,fetchPolicy:f}),o.queryId=i.queryId||n.generateQueryId();var m=Wt(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(n,i){var a={next:function(s){n(s),t.observers.delete(a),t.observers.size||t.queryManager.removeQuery(t.queryId),setTimeout(function(){o.unsubscribe()},0)},error:i},o=t.subscribe(a)})},e.prototype.getCurrentResult=function(t){t===void 0&&(t=!0);var n=this.getLastResult(!0),i=this.queryInfo.networkStatus||n&&n.networkStatus||pe.ready,a=x(x({},n),{loading:Nr(i),networkStatus:i}),o=this.options.fetchPolicy,s=o===void 0?"cache-first":o;if(!(s==="network-only"||s==="no-cache"||s==="standby"||this.queryManager.transform(this.options.query).hasForcedResolvers)){var 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===pe.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=pe.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Zc(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){return!this.last||!Ie(this.last.result,t)||n&&!Ie(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Ie(i.variables,this.variables)))return i[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 n,i={pollInterval:0},a=this.options.fetchPolicy;if(a==="cache-and-network"?i.fetchPolicy=a:a==="no-cache"?i.fetchPolicy="no-cache":i.fetchPolicy="network-only",__DEV__&&t&&Sg.call(t,"variables")){var o=Vi(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&F.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((n=o.name)===null||n===void 0?void 0:n.value)||JSON.stringify(o),`, which does not declare a $variables variable.
50
+ Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!Ie(this.options.variables,t)&&(i.variables=this.options.variables=x(x({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,pe.refetch)},e.prototype.fetchMore=function(t){var n=this,i=x(x({},t.query?t:x(x(x(x({},this.options),{query:this.query}),t),{variables:x(x({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=pe.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,i,pe.fetchMore).then(function(u){return n.queryManager.removeQuery(a),o.networkStatus===pe.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var d=t.updateQuery;d?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:u.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(n.query)||Yc(n)})},e.prototype.subscribeToMore=function(t){var n=this,i=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&n.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__&&F.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(i),function(){n.subscriptions.delete(i)&&i.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},pe.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var n=this.queryManager,i=n.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(i,{variables:this.variables});a&&(n.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),n.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,n){if(n.nextFetchPolicy){var i=n.fetchPolicy,a=i===void 0?"cache-first":i,o=n.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof n.nextFetchPolicy=="function"?n.fetchPolicy=n.nextFetchPolicy(a,{reason:t,options:n,observable:this,initialFetchPolicy:s}):t==="variables-changed"?n.fetchPolicy=s:n.fetchPolicy=n.nextFetchPolicy)}return n.fetchPolicy},e.prototype.fetch=function(t,n){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,n)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var n=this,i=n.pollingInfo,a=n.options.pollInterval;if(!a){i&&(clearTimeout(i.timeout),delete this.pollingInfo);return}if(!(i&&i.interval===a)){__DEV__?F(a,"Attempted to start a polling query without a polling interval."):F(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Nr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},pe.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,n){return n===void 0&&(n=this.variables),this.last=x(x({},this.last),{result:this.queryManager.assumeImmutableResults?t:so(t),variables:n}),Me(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,n){var i=this;this.isTornDown=!1;var a=n===pe.refetch||n===pe.fetchMore||n===pe.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Tr(this.options,t||{}),u=a?c:bg(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ie(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=pe.setVariables)));var l=u.variables&&x({},u.variables),d=this.fetch(u,n),f={next:function(p){i.reportResult(p,l)},error:function(p){i.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(t,n))&&((i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),cn(this.observers,"next",t))},e.prototype.reportError=function(t,n){var i=x(x({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:pe.error,loading:!1});this.updateLastResult(i,n),cn(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}(X);uo(No);function Yc(r){var e=r.options,t=e.fetchPolicy,n=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=n,typeof n=="function"?n.apply(this,arguments):t}}):r.reobserve()}function _g(r){__DEV__&&F.error("Unhandled error",r.message,r.stack)}function Zc(r){__DEV__&&r&&__DEV__&&F.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var Do=function(){function r(e){var t=e.cache,n=e.client,i=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,n&&(this.client=n),i&&this.addResolvers(i),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(n){t.resolvers=pc(t.resolvers,n)}):this.resolvers=pc(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,n=e.remoteResult,i=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Lt(this,void 0,void 0,function(){return Ft(this,function(c){return t?[2,this.resolveDocument(t,n.data,i,a,this.fragmentMatcher,s).then(function(u){return x(x({},n),{data:u.result})})]:[2,n]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return Kn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return lc(e)},r.prototype.prepareContext=function(e){var t=this.cache;return x(x({},e),{cache:t,getCacheKey:function(n){return t.identify(n)}})},r.prototype.addExportedVariables=function(e,t,n){return t===void 0&&(t={}),n===void 0&&(n={}),Lt(this,void 0,void 0,function(){return Ft(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(n),t).then(function(a){return x(x({},t),a.exportedVariables)})]:[2,x({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return Xe(e,{Directive:{enter:function(n){if(n.name.value==="client"&&n.arguments&&(t=n.arguments.some(function(i){return i.name.value==="always"&&i.value.kind==="BooleanValue"&&i.value.value===!0}),t))return en}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:uc(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,n,i,a,o){return n===void 0&&(n={}),i===void 0&&(i={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Lt(this,void 0,void 0,function(){var s,c,u,l,d,f,p,h,m,y,_;return Ft(this,function(S){return s=an(e),c=nn(e),u=tn(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:x(x({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,t,y).then(function(w){return{result:w,exportedVariables:y.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Ft(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(f){return Lt(l,void 0,void 0,function(){var p,h;return Ft(this,function(m){return!t&&!i.selectionsToResolve.has(f)?[2]:sr(f,s)?gt(f)?[2,this.resolveField(f,t,n,i).then(function(y){var _;typeof y<"u"&&c.push((_={},_[Tt(f)]=y,_))})]:(ac(f)?p=f:(p=a[f.name.value],__DEV__?F(p,"No fragment named ".concat(f.name.value)):F(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,n,i).then(function(y){c.push(y)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Qi(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h=this;return Ft(this,function(m){return n?(a=i.variables,o=e.name.value,s=Tt(e),c=o!==s,u=n[s]||n[o],l=Promise.resolve(u),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(l=Promise.resolve(ai.withValue(this.cache,p,[n,cr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(y){var _,S;if(y===void 0&&(y=u),e.directives&&e.directives.forEach(function(v){v.name.value==="export"&&v.arguments&&v.arguments.forEach(function(A){A.name.value==="as"&&A.value.kind==="StringValue"&&(i.exportedVariables[A.value.value]=y)})}),!e.selectionSet||y==null)return y;var w=(S=(_=e.directives)===null||_===void 0?void 0:_.some(function(v){return v.name.value==="client"}))!==null&&S!==void 0?S:!1;if(Array.isArray(y))return h.resolveSubSelectedArray(e,t||w,y,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||w,y,i)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,n,i){var a=this;return Promise.all(n.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,i);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,i)}))},r.prototype.collectSelectionsToResolve=function(e,t){var n=function(o){return!Array.isArray(o)},i=this.selectionsToResolveCache;function a(o){if(!i.has(o)){var s=new Set;i.set(o,s),Xe(o,{Directive:function(c,u,l,d,f){c.name.value==="client"&&f.forEach(function(p){n(p)&&ji(p)&&s.add(p)})},FragmentSpread:function(c,u,l,d,f){var p=t[c.name.value];__DEV__?F(p,"No fragment named ".concat(c.name.value)):F(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){n(m)&&ji(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},r}();var si=new(kt?WeakMap:Map);function Xc(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return si.set(r,(si.get(r)+1)%1e15),t.apply(this,arguments)})}function ef(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Co=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 n=this.cache=e.cache;si.has(n)||(si.set(n,0),Xc(n,"evict"),Xc(n,"modify"),Xc(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||pe.loading;return this.variables&&this.networkStatus!==pe.loading&&!Ie(this.variables,e.variables)&&(t=pe.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(){ef(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 n=this.observableQuery;if(n&&n.options.fetchPolicy==="no-cache")return{complete:!1};var i=this.cache.diff(t);return this.updateLastDiff(i,t),i},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,n=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!Ie(n&&n.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 n=t.getDiff();n.fromOptimisticTransaction?e.observe():Yc(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;ef(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(Nr(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 n=this.observableQuery;if(!(n&&n.options.fetchPolicy==="no-cache")){var i=x(x({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ie(i,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=i))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var n=this.lastWrite;return!(n&&n.dmCount===si.get(this.cache)&&Ie(t,n.variables)&&Ie(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new ut,s=Me(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Me(e.incremental)){var c=lo(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,n.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(n.variables)):i!==0&&(Ro(e,n.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,n.variables))l.writeQuery({query:t,data:e.data,variables:n.variables,overwrite:i===1}),a.lastWrite={result:e,variables:n.variables,dmCount:si.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(n.variables),f=l.diff(d);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=pe.ready},r.prototype.markError=function(e){return this.networkStatus=pe.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function Ro(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!ei(r);return!n&&t&&r.data&&(n=!0),n}var wg=Object.prototype.hasOwnProperty,tf=function(){function r(e){var t=e.cache,n=e.link,i=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(kt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new Do({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,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new G("QueryManager stopped while query was in flight"):new G(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,n,i=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,_=y===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":y,S=e.keepRootFields,w=e.context;return Lt(this,void 0,void 0,function(){var v,A,R,E,P,L;return Ft(this,function(C){switch(C.label){case 0:return __DEV__?F(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):F(i,15),__DEV__?F(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."):F(m==="network-only"||m==="no-cache",16),v=this.generateMutationId(),A=this.transform(i),R=A.document,E=A.hasClientExports,i=this.cache.transformForLink(R),a=this.getVariables(i,a),E?[4,this.localState.addExportedVariables(i,a,w)]:[3,2];case 1:a=C.sent(),C.label=2;case 2:return P=this.mutationStore&&(this.mutationStore[v]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:v,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:w,updateQueries:s,update:f,keepRootFields:S}),this.broadcastQueries(),L=this,[2,new Promise(function(T,xe){return co(L.getObservableFromLink(i,x(x({},w),{optimisticResponse:o}),a,!1),function(ne){if(ei(ne)&&_==="none")throw new ur({graphQLErrors:po(ne)});P&&(P.loading=!1,P.error=null);var M=x({},ne);return typeof u=="function"&&(u=u(M)),_==="ignore"&&ei(M)&&delete M.errors,L.markMutationResult({mutationId:v,result:M,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:w,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?v:void 0,onQueryUpdated:p,keepRootFields:S})}).subscribe({next:function(ne){L.broadcastQueries(),(!("hasNext"in ne)||ne.hasNext===!1)&&T(ne)},error:function(ne){P&&(P.loading=!1,P.error=ne),o&&L.cache.removeOptimistic(v),L.broadcastQueries(),xe(ne instanceof ur?ne:new ur({networkError:ne}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var n=this;t===void 0&&(t=this.cache);var i=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&Ro(i,e.errorPolicy)){if(Ir(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Ir(i)&&Me(i.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=lo(s.result,i)),typeof c<"u"&&(i.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||!wg.call(u,h))){var m=u[h],y=n.queries.get(f),_=y.document,S=y.variables,w=t.diff({query:_,variables:S,returnPartialData:!0,optimistic:!1}),v=w.result,A=w.complete;if(A&&v){var R=m(v,{mutationResult:i,queryName:_&&Jn(_)||void 0,queryVariables:S});R&&a.push({result:R,dataId:"ROOT_QUERY",query:_,variables:S})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!Ml(i)||Ir(i)&&!i.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=x(x({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}p&&f(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,y){var _=y.fieldName,S=y.DELETE;return _==="__typename"?m:S}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(x(x({},t),{result:{data:i}}),a)}catch(o){__DEV__&&F.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,n){return this.fetchQueryObservable(e,t,n).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,n){e[n]={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 n=this.cache.transformDocument(e),i=cc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:tc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:on(Wt(n)),asQuery:x(x({},n),{definitions:n.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?x(x({},u),{operation:"query"}):u})})},c=function(u){u&&!t.has(u)&&t.set(u,s)};c(e),c(n),c(a),c(o)}return t.get(e)},r.prototype.getVariables=function(e,t){return x(x({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=x(x({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new Co(this),n=new No({queryManager:this,queryInfo:t,options:e});return this.queries.set(n.queryId,t),t.init({document:n.query,observableQuery:n,variables:n.variables}),n},r.prototype.query=function(e,t){var n=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?F(e.query,"query option is required. You must specify your GraphQL document in the query option."):F(e.query,17),__DEV__?F(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):F(e.query.kind==="Document",18),__DEV__?F(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):F(!e.returnPartialData,19),__DEV__?F(!e.pollInterval,"pollInterval option only supported on watchQuery."):F(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return n.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 G("Store reset while query was in flight (not completed in link chain)"):new G(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=pe.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 n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):nc(o)?i.set(t.transform(o).document,!1):se(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){n.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&i.has(l)||u&&i.has(u))&&(n.set(s,c),l&&i.set(l,!0),u&&i.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Gi("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new No({queryManager:t,queryInfo:c,options:x(x({},o),{fetchPolicy:"network-only"})});F(u.queryId===s),c.setObservableQuery(u),n.set(s,u)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&F.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var u=function(d){return t.getObservableFromLink(n,c,d).map(function(f){if(i!=="no-cache"&&(Ro(f,a)&&t.cache.write({query:n,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),ei(f))throw new ur({graphQLErrors:f.errors});return f})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new X(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return 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,n,i){var a=this,o;i===void 0&&(i=(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:n,operationName:Jn(c)||void 0,context:this.prepareContext(x(x({},t),{forceFetch:!i}))};if(t=f.context,i){var p=l.get(c)||new Map;l.set(c,p);var h=yt(n);if(s=p.get(h),!s){var m=new Xn([ti(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new Xn([ti(d,f)])}else s=new Xn([X.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=co(s,function(_){return a.localState.runResolvers({document:y,remoteResult:_,context:t,variables:n})})),s},r.prototype.getResultsFromLink=function(e,t,n){var i=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return co(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=po(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new ur({graphQLErrors:s}));e.markResult(o,a,n,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:pe.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=pe.error),u},function(o){var s=Xp(o)?o:new ur({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,n){var i=this;n===void 0&&(n=pe.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,_=t.context,S=_===void 0?{}:_,w=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:y,context:S}),v=function(E){w.variables=E;var P=i.fetchQueryByPolicy(s,w,n);return w.fetchPolicy!=="standby"&&P.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),P},A=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(E){A(),setTimeout(function(){return R.cancel(E)})});var R=new Xn(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(v):v(w.variables));return R.promise.then(A,A),R},r.prototype.refetchQueries=function(e){var t=this,n=e.updateCache,i=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Gi("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(f,p){l.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof Co&&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,_;if(u){if(!y){var S=h.queryInfo;S.reset(),y=S.getDiff()}_=u(h,y,m)}(!u||_===!0)&&(_=h.refetch()),_!==!1&&d.set(h,_),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=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:n});var h=function(){return e.getDiff(o)},m=function(v,A){A===void 0&&(A=e.networkStatus||pe.loading);var R=v.result;__DEV__&&!l&&!Ie(R,{})&&Zc(v.missing);var E=function(P){return X.of(x({data:P,loading:Nr(A),networkStatus:A},v.complete?null:{partial:!0}))};return R&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:R},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(P){return E(P.data||void 0)}):u==="none"&&A===pe.refetch&&Array.isArray(v.missing)?E(void 0):E(R)},y=s==="no-cache"?0:n===pe.refetch&&c!=="merge"?1:2,_=function(){return i.getResultsFromLink(e,y,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},S=f&&typeof p=="number"&&p!==n&&Nr(n);switch(s){default:case"cache-first":{var w=h();return w.complete?[m(w,e.markReady())]:l||S?[m(w),_()]:[_()]}case"cache-and-network":{var w=h();return w.complete||l||S?[m(w),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return S?[m(h()),_()]:[_()];case"no-cache":return S?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Co(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return x(x({},t),{clientAwareness:this.clientAwareness})},r}();var rf=!1;var eu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=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,_=y===void 0?!1:y,S=e.resolvers,w=e.typeDefs,v=e.fragmentMatcher,A=e.name,R=e.version,E=e.link;if(E||(E=n?new Ac({uri:n,credentials:i,headers:a}):At.empty()),!o)throw __DEV__?new G(`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 G(9);if(this.link=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=w,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),!rf&&f&&__DEV__&&(rf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var P=window.navigator,L=P&&P.userAgent,C=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?C="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(C="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),C&&__DEV__&&F.log("Download the Apollo DevTools for a better development experience: "+C)}this.version=Bl,this.localState=new Do({cache:o,client:this,resolvers:S,fragmentMatcher:v}),this.queryManager=new tf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:A,version:R},localState:this.localState,assumeImmutableResults:_,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=Ki(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ki(this.defaultOptions.query,e)),__DEV__?F(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."):F(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ki(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 ti(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(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&F.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}();hl(Xr?"log":"silent");function rt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function lr(r){return rt(r)==="object"}function nf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function tu(r,e){return r.length<124?r:e}var af="graphql-transport-ws";var lt;(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"})(lt||(lt={}));var Ce;(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"})(Ce||(Ce={}));function of(r){if(!lr(r))throw new Error(`Message is expected to be an object, but got ${rt(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 ${rt(r.type)}`);switch(r.type){case Ce.ConnectionInit:case Ce.ConnectionAck:case Ce.Ping:case Ce.Pong:{if(r.payload!=null&&!lr(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 Ce.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!lr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${rt(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 ${rt(r.payload.query)}`);if(r.payload.variables!=null&&!lr(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 ${rt(r.payload.variables)}`);if(r.payload.operationName!=null&&rt(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 ${rt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!lr(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 ${rt(r.payload.extensions)}`);break}case Ce.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!lr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${rt(r.payload)}`);break}case Ce.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!nf(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 Ce.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${rt(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 sf(r,e){return of(typeof r=="string"?JSON.parse(r,e):r)}function ci(r,e){return of(r),JSON.stringify(r,e)}function ru(r){let{url:e,connectionParams:t,lazy:n=!0,onNonLazyError:i=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(ve){let be=1e3;for(let ae=0;ae<ve;ae++)be*=2;await new Promise(ae=>setTimeout(ae,be+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Po,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,ve=>{let be=Math.random()*16|0;return(ve=="x"?be:be&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:_}=r,S;if(h){if(!xg(h))throw new Error("Invalid WebSocket implementation provided");S=h}else typeof WebSocket<"u"?S=WebSocket:typeof global<"u"?S=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(S=window.WebSocket||window.MozWebSocket);if(!S)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let w=S,v=(()=>{let M=(()=>{let be={};return{on(ae,oe){return be[ae]=oe,()=>{delete be[ae]}},emit(ae){var oe;"id"in ae&&((oe=be[ae.id])===null||oe===void 0||oe.call(be,ae))}}})(),ve={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?[M.emit,p.message]:[M.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:M.on,on(be,ae){let oe=ve[be];return oe.push(ae),()=>{oe.splice(oe.indexOf(ae),1)}},emit(be,...ae){for(let oe of[...ve[be]])oe(...ae)}}})();function A(M){let ve=[v.on("error",be=>{ve.forEach(ae=>ae()),M(be)}),v.on("closed",be=>{ve.forEach(ae=>ae()),M(be)})]}let R,E=0,P,L=!1,C=0,T=!1;async function xe(){clearTimeout(P);let[M,ve]=await(R??(R=new Promise((oe,Bt)=>(async()=>{if(L){if(await l(C),!E)return R=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});C++}v.emit("connecting");let Z=new w(typeof e=="function"?await e():e,af),Vt,Sr;function Ja(){isFinite(o)&&o>0&&(clearTimeout(Sr),Sr=setTimeout(()=>{Z.readyState===w.OPEN&&(Z.send(ci({type:Ce.Ping})),v.emit("ping",!1,void 0))},o))}A(Ge=>{R=void 0,clearTimeout(Vt),clearTimeout(Sr),Bt(Ge),Po(Ge)&&Ge.code===4499&&(Z.close(4499,"Terminated"),Z.onerror=null,Z.onclose=null)}),Z.onerror=Ge=>v.emit("error",Ge),Z.onclose=Ge=>v.emit("closed",Ge),Z.onopen=async()=>{try{v.emit("opened",Z);let Ge=typeof t=="function"?await t():t;if(Z.readyState!==w.OPEN)return;Z.send(ci(Ge?{type:Ce.ConnectionInit,payload:Ge}:{type:Ce.ConnectionInit},y)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{Z.close(lt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Ja()}catch(Ge){v.emit("error",Ge),Z.close(lt.InternalClientError,tu(Ge instanceof Error?Ge.message:new Error(Ge).message,"Internal client error"))}};let Wn=!1;Z.onmessage=({data:Ge})=>{try{let Ke=sf(Ge,_);if(v.emit("message",Ke),Ke.type==="ping"||Ke.type==="pong"){v.emit(Ke.type,!0,Ke.payload),Ke.type==="pong"?Ja():s||(Z.send(ci(Ke.payload?{type:Ce.Pong,payload:Ke.payload}:{type:Ce.Pong})),v.emit("pong",!1,Ke.payload));return}if(Wn)return;if(Ke.type!==Ce.ConnectionAck)throw new Error(`First message cannot be of type ${Ke.type}`);clearTimeout(Vt),Wn=!0,v.emit("connected",Z,Ke.payload),L=!1,C=0,oe([Z,new Promise((WS,Ch)=>A(Ch))])}catch(Ke){Z.onmessage=null,v.emit("error",Ke),Z.close(lt.BadResponse,tu(Ke instanceof Error?Ke.message:new Error(Ke).message,"Bad response"))}}})())));M.readyState===w.CLOSING&&await ve;let be=()=>{},ae=new Promise(oe=>be=oe);return[M,be,Promise.race([ae.then(()=>{if(!E){let oe=()=>M.close(1e3,"Normal Closure");isFinite(a)&&a>0?P=setTimeout(()=>{M.readyState===w.OPEN&&oe()},a):oe()}}),ve])]}function ne(M){if(Po(M)&&(Eg(M.code)||[lt.InternalServerError,lt.InternalClientError,lt.BadRequest,lt.BadResponse,lt.Unauthorized,lt.SubprotocolNotAcceptable,lt.SubscriberAlreadyExists,lt.TooManyInitialisationRequests].includes(M.code)))throw M;if(T)return!1;if(Po(M)&&M.code===1e3)return E>0;if(!u||C>=u||!d(M)||f?.(M))throw M;return L=!0}return n||(async()=>{for(E++;;)try{let[,,M]=await xe();await M}catch(M){try{if(!ne(M))return}catch(ve){return i?.(ve)}}})(),{on:v.on,subscribe(M,ve){let be=m(M),ae=!1,oe=!1,Bt=()=>{E--,ae=!0};return(async()=>{for(E++;;)try{let[Z,Vt,Sr]=await xe();if(ae)return Vt();let Ja=v.onMessage(be,Wn=>{switch(Wn.type){case Ce.Next:{ve.next(Wn.payload);return}case Ce.Error:{oe=!0,ae=!0,ve.error(Wn.payload),Bt();return}case Ce.Complete:{ae=!0,Bt();return}}});Z.send(ci({id:be,type:Ce.Subscribe,payload:M},y)),Bt=()=>{!ae&&Z.readyState===w.OPEN&&Z.send(ci({id:be,type:Ce.Complete},y)),E--,ae=!0,Vt()},await Sr.finally(Ja);return}catch(Z){if(!ne(Z))return}})().then(()=>{oe||ve.complete()}).catch(Z=>{ve.error(Z)}),()=>{ae||Bt()}},async dispose(){if(T=!0,R){let[M]=await R;M.close(1e3,"Normal Closure")}},terminate(){R&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Po(r){return lr(r)&&"code"in r&&"reason"in r}function Eg(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function xg(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function Ig(r){return se(r)&&"code"in r&&"reason"in r}var cf=function(r){Ne(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new X(function(i){return n.client.subscribe(x(x({},t),{query:Gn(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):Ig(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new ur({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(At);var Lo="0.12.0-rc1-dev";function uf(){return typeof window!="undefined"&&window.self!==window.top}function nu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function pr(r,e){nu()&&localStorage.setItem(`${Lo}/${r}`,e)}function Fo(r){return nu()?localStorage.getItem(`${Lo}/${r}`):null}function ra(r){nu()&&localStorage.removeItem(`${Lo}/${r}`)}function lf(r,e=1e4){return Ee(this,null,function*(){return Promise.race([new Promise((t,n)=>{let i;try{i=new WebSocket(r,"graphql-transport-ws"),i.onopen=()=>{i.close(),t(i)},i.onerror=a=>{n(a)},i.onclose=a=>{a.code!==1e3&&n(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){i&&i.close(),n(a)}}),new Promise((t,n)=>{setTimeout(()=>{n(new Error("WebSocket connection timed out"))},e)})])})}var ms=function(){return ms=Object.assign||function(e){for(var t,n=1,i=arguments.length;n<i;n++){t=arguments[n];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},ms.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Jo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Jo=function(t){return typeof t}:Jo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Jo(r)}function kg(r){return Jo(r)=="object"&&r!==null}var Dd=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Eu(r,e){for(var t=/\r\n|[\n\r]/g,n=1,i=e+1,a;(a=t.exec(r.body))&&a.index<e;)n+=1,i=e+1-(a.index+a[0].length);return{line:n,column:i}}function Ag(r){return Cd(r.source,Eu(r.source,r.start))}function Cd(r,e){var t=r.locationOffset.column-1,n=Yo(t)+r.body,i=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=n.split(/\r\n|[\n\r]/g),d=l[i];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+pf([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(y){return["",y]}),[[" ",Yo(p-1)+"^"],["",h[f+1]]]))}return u+pf([["".concat(o-1),l[i-1]],["".concat(o),d],["",Yo(c-1)+"^"],["".concat(o+1),l[i+1]]])}function pf(r){var e=r.filter(function(n){n[0];var i=n[1];return i!==void 0}),t=Math.max.apply(Math,e.map(function(n){var i=n[0];return i.length}));return e.map(function(n){var i=n[0],a=n[1];return Og(t,i)+(a?" | "+a:" |")}).join(`
53
+ `)}function Yo(r){return Array(r+1).join(" ")}function Og(r,e){return Yo(r-e.length)+e}function Zo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Zo=function(t){return typeof t}:Zo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Zo(r)}function ff(r,e){var t=Object.keys(r);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(r);e&&(n=n.filter(function(i){return Object.getOwnPropertyDescriptor(r,i).enumerable})),t.push.apply(t,n)}return t}function Ng(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?ff(Object(t),!0).forEach(function(n){Dg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):ff(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Dg(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Cg(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function df(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Rg(r,e,t){return e&&df(r.prototype,e),t&&df(r,t),r}function Pg(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&&Oa(r,e)}function Lg(r){var e=Pd();return function(){var n=Na(r),i;if(e){var a=Na(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Rd(this,i)}}function Rd(r,e){return e&&(Zo(e)==="object"||typeof e=="function")?e:sa(r)}function sa(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function xu(r){var e=typeof Map=="function"?new Map:void 0;return xu=function(n){if(n===null||!Fg(n))return n;if(typeof n!="function")throw new TypeError("Super expression must either be null or a function");if(typeof e<"u"){if(e.has(n))return e.get(n);e.set(n,i)}function i(){return Xo(n,arguments,Na(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),Oa(i,n)},xu(r)}function Xo(r,e,t){return Pd()?Xo=Reflect.construct:Xo=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&Oa(u,o.prototype),u},Xo.apply(null,arguments)}function Pd(){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 Fg(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function Oa(r,e){return Oa=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},Oa(r,e)}function Na(r){return Na=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Na(r)}var $g=function(r){Pg(t,r);var e=Lg(t);function t(n,i,a,o,s,c,u){var l,d,f,p;Cg(this,t),p=e.call(this,n),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=hf(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,y=(_=p.nodes)!==null&&_!==void 0?_:[];m<y.length;m++){var _,S=y[m],w=S.loc;w!=null&&h.push(w)}h=hf(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(A){return A.start})),p.locations=o&&a?o.map(function(A){return Eu(a,A)}):(f=h)===null||f===void 0?void 0:f.map(function(A){return Eu(A.source,A.start)}),p.path=s??void 0;var v=c?.extensions;return u==null&&kg(v)?p.extensions=Ng({},v):p.extensions=u??{},Object.defineProperties(sa(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(sa(p),"stack",{value:c.stack,writable:!0,configurable:!0}),Rd(p)):(Error.captureStackTrace?Error.captureStackTrace(sa(p),t):Object.defineProperty(sa(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return Rg(t,[{key:"toString",value:function(){return Mg(this)}},{key:Dd,get:function(){return"Object"}}]),t}(xu(Error));function hf(r){return r===void 0||r.length===0?void 0:r}function Mg(r){var e=r.message;if(r.nodes)for(var t=0,n=r.nodes;t<n.length;t++){var i=n[t];i.loc&&(e+=`
54
+
55
+ `+Ag(i.loc))}else if(r.source&&r.locations)for(var a=0,o=r.locations;a<o.length;a++){var s=o[a];e+=`
56
+
57
+ `+Cd(r.source,s)}return e}function St(r,e,t){return new $g("Syntax Error: ".concat(t),void 0,r,[e])}var Q=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function jg(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ug=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Iu=Ug;function Ld(r){var e=r.prototype.toJSON;typeof e=="function"||jg(0),r.prototype.inspect=e,Iu&&(r.prototype[Iu]=e)}var Fd=function(){function r(t,n,i){this.start=t.start,this.end=n.end,this.startToken=t,this.endToken=n,this.source=i}var e=r.prototype;return e.toJSON=function(){return{start:this.start,end:this.end}},r}();Ld(Fd);var Le=function(){function r(t,n,i,a,o,s,c){this.kind=t,this.start=n,this.end=i,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}();Ld(Le);var N=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 es(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?es=function(t){return typeof t}:es=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},es(r)}var qg=10,$d=2;function Bg(r){return js(r,[])}function js(r,e){switch(es(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Vg(r,e);default:return String(r)}}function Vg(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=Wg(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:js(i,t)}else if(Array.isArray(r))return zg(r,t);return Qg(r,t)}function Qg(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>$d)return"["+Gg(r)+"]";var n=t.map(function(i){var a=js(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function zg(r,e){if(r.length===0)return"[]";if(e.length>$d)return"[Array]";for(var t=Math.min(qg,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(js(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Wg(r){var e=r[String(Iu)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Gg(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 iu(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var Kg=function(e,t){return e instanceof t};function mf(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Hg(r,e,t){return e&&mf(r.prototype,e),t&&mf(r,t),r}var Md=function(){function r(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"GraphQL request",n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{line:1,column:1};typeof e=="string"||iu(0,"Body must be a string. Received: ".concat(Bg(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||iu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||iu(0,"column in locationOffset is 1-indexed and must be positive.")}return Hg(r,[{key:Dd,get:function(){return"Source"}}]),r}();function Jg(r){return Kg(r,Md)}var Yg=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 Zg(r){var e=r.split(/\r\n|[\n\r]/g),t=Xg(r);if(t!==0)for(var n=1;n<e.length;n++)e[n]=e[n].slice(t);for(var i=0;i<e.length&&gf(e[i]);)++i;for(var a=e.length;a>i&&gf(e[a-1]);)--a;return e.slice(i,a).join(`
58
+ `)}function gf(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function Xg(r){for(var e,t=!0,n=!0,i=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,n=!0,i=0;break;case 9:case 32:++i;break;default:n&&!t&&(a===null||i<a)&&(a=i),n=!1}return(e=a)!==null&&e!==void 0?e:0}var ey=function(){function r(t){var n=new Le(N.SOF,0,0,0,0,null);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=r.prototype;return e.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},e.lookahead=function(){var n=this.token;if(n.kind!==N.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=ry(this,n)}while(n.kind===N.COMMENT);return n},r}();function ty(r){return r===N.BANG||r===N.DOLLAR||r===N.AMP||r===N.PAREN_L||r===N.PAREN_R||r===N.SPREAD||r===N.COLON||r===N.EQUALS||r===N.AT||r===N.BRACKET_L||r===N.BRACKET_R||r===N.BRACE_L||r===N.PIPE||r===N.BRACE_R}function kn(r){return isNaN(r)?N.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function ry(r,e){for(var t=r.source,n=t.body,i=n.length,a=e.end;a<i;){var o=n.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:n.charCodeAt(a+1)===10?a+=2:++a,++r.line,r.lineStart=a;continue;case 33:return new Le(N.BANG,a,a+1,s,c,e);case 35:return iy(t,a,s,c,e);case 36:return new Le(N.DOLLAR,a,a+1,s,c,e);case 38:return new Le(N.AMP,a,a+1,s,c,e);case 40:return new Le(N.PAREN_L,a,a+1,s,c,e);case 41:return new Le(N.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Le(N.SPREAD,a,a+3,s,c,e);break;case 58:return new Le(N.COLON,a,a+1,s,c,e);case 61:return new Le(N.EQUALS,a,a+1,s,c,e);case 64:return new Le(N.AT,a,a+1,s,c,e);case 91:return new Le(N.BRACKET_L,a,a+1,s,c,e);case 93:return new Le(N.BRACKET_R,a,a+1,s,c,e);case 123:return new Le(N.BRACE_L,a,a+1,s,c,e);case 124:return new Le(N.PIPE,a,a+1,s,c,e);case 125:return new Le(N.BRACE_R,a,a+1,s,c,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?sy(t,a,s,c,e,r):oy(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 ay(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 uy(t,a,s,c,e)}throw St(t,a,ny(o))}var u=r.line,l=1+a-r.lineStart;return new Le(N.EOF,i,i,u,l,e)}function ny(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(kn(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(kn(r),".")}function iy(r,e,t,n,i){var a=r.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Le(N.COMMENT,e,s,t,n,i,a.slice(e+1,s))}function ay(r,e,t,n,i,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 St(r,c,"Invalid number, unexpected digit after 0: ".concat(kn(s),"."))}else c=au(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=au(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=au(r,c,s),s=o.charCodeAt(c)),s===46||ly(s))throw St(r,c,"Invalid number, expected digit but got: ".concat(kn(s),"."));return new Le(u?N.FLOAT:N.INT,e,c,n,i,a,o.slice(e,c))}function au(r,e,t){var n=r.body,i=e,a=t;if(a>=48&&a<=57){do a=n.charCodeAt(++i);while(a>=48&&a<=57);return i}throw St(r,i,"Invalid number, expected digit but got: ".concat(kn(a),"."))}function oy(r,e,t,n,i){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 Le(N.STRING,e,o+1,t,n,i,u);if(c<32&&c!==9)throw St(r,o,"Invalid character within String: ".concat(kn(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=cy(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 St(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw St(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw St(r,o,"Unterminated string.")}function sy(r,e,t,n,i,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 Le(N.BLOCK_STRING,e,s+3,t,n,i,Zg(l));if(u<32&&u!==9&&u!==10&&u!==13)throw St(r,s,"Invalid character within String: ".concat(kn(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 St(r,s,"Unterminated string.")}function cy(r,e,t,n){return $o(r)<<12|$o(e)<<8|$o(t)<<4|$o(n)}function $o(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function uy(r,e,t,n,i){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 Le(N.NAME,e,s,t,n,i,a.slice(e,s))}function ly(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function py(r,e){var t=new fy(r,e);return t.parseDocument()}var fy=function(){function r(t,n){var i=Jg(t)?t:new Md(t);this._lexer=new ey(i),this._options=n}var e=r.prototype;return e.parseName=function(){var n=this.expectToken(N.NAME);return{kind:Q.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:Q.DOCUMENT,definitions:this.many(N.SOF,this.parseDefinition,N.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(N.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(N.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(N.BRACE_L))return{kind:Q.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(N.NAME)&&(a=this.parseName()),{kind:Q.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(N.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(N.PAREN_L,this.parseVariableDefinition,N.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:Q.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(N.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(N.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(N.DOLLAR),{kind:Q.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:Q.SELECTION_SET,selections:this.many(N.BRACE_L,this.parseSelection,N.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(N.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(N.COLON)?(a=i,o=this.parseName()):o=i,{kind:Q.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(N.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(N.PAREN_L,i,N.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(N.COLON),{kind:Q.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:Q.ARGUMENT,name:this.parseName(),value:(this.expectToken(N.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(N.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(N.NAME)?{kind:Q.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:Q.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:Q.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:Q.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case N.BRACKET_L:return this.parseList(n);case N.BRACE_L:return this.parseObject(n);case N.INT:return this._lexer.advance(),{kind:Q.INT,value:i.value,loc:this.loc(i)};case N.FLOAT:return this._lexer.advance(),{kind:Q.FLOAT,value:i.value,loc:this.loc(i)};case N.STRING:case N.BLOCK_STRING:return this.parseStringLiteral();case N.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:Q.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:Q.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:Q.NULL,loc:this.loc(i)};default:return{kind:Q.ENUM,value:i.value,loc:this.loc(i)}}case N.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:Q.STRING,value:n.value,block:n.kind===N.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:Q.LIST,values:this.any(N.BRACKET_L,o,N.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:Q.OBJECT,fields:this.any(N.BRACE_L,o,N.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(N.COLON),{kind:Q.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(N.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(N.AT),{kind:Q.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(N.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(N.BRACKET_R),i={kind:Q.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(N.BANG)?{kind:Q.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:Q.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===N.NAME)switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(n)},e.peekDescription=function(){return this.peek(N.STRING)||this.peek(N.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(N.BRACE_L,this.parseOperationTypeDefinition,N.BRACE_R);return{kind:Q.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(N.COLON);var a=this.parseNamedType();return{kind:Q.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:Q.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:Q.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(N.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(N.AMP)||this.peek(N.NAME));return i}return this.delimitedMany(N.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(N.BRACE_L)&&this._lexer.lookahead().kind===N.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(N.BRACE_L,this.parseFieldDefinition,N.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(N.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:Q.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:c,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(N.PAREN_L,this.parseInputValueDef,N.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(N.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(N.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:Q.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:Q.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:Q.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(N.EQUALS)?this.delimitedMany(N.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:Q.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(N.BRACE_L,this.parseEnumValueDefinition,N.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:Q.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:Q.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(N.BRACE_L,this.parseInputValueDef,N.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===N.NAME)switch(n.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(N.BRACE_L,this.parseOperationTypeDefinition,N.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:Q.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:Q.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:Q.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:Q.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:Q.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(N.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:Q.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(N.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(Yg[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new Fd(n,this._lexer.lastToken,this._lexer.source)},e.peek=function(n){return this._lexer.token.kind===n},e.expectToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i;throw St(this._lexer.source,i.start,"Expected ".concat(jd(n),", found ").concat(ou(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===N.NAME&&i.value===n)this._lexer.advance();else throw St(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(ou(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===N.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return St(this._lexer.source,i.start,"Unexpected ".concat(ou(i),"."))},e.any=function(n,i,a){this.expectToken(n);for(var o=[];!this.expectOptionalToken(a);)o.push(i.call(this));return o},e.optionalMany=function(n,i,a){if(this.expectOptionalToken(n)){var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(n,i,a){this.expectToken(n);var o=[];do o.push(i.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(n,i){this.expectOptionalToken(n);var a=[];do a.push(i.call(this));while(this.expectOptionalToken(n));return a},r}();function ou(r){var e=r.value;return jd(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function jd(r){return ty(r)?'"'.concat(r,'"'):r}var ts=new Map,Tu=new Map,Ud=!0,gs=!1;function qd(r){return r.replace(/[\s,]+/g," ").trim()}function dy(r){return qd(r.source.body.substring(r.start,r.end))}function hy(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=dy(n.loc),o=Tu.get(i);o&&!o.has(a)?Ud&&console.warn("Warning: fragment with name "+i+` already exists.
60
60
  graphql-tag enforces all fragment names across your application to be unique; read more about
61
- this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Tu.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),r.push(n))}else r.push(n)}),ms(ms({},t),{definitions:r})}function py(t){var e=new Set(t.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var r=t.loc;return r&&(delete r.startToken,delete r.endToken),t}function dy(t){var e=Md(t);if(!ts.has(e)){var r=cy(t,{experimentalFragmentVariables:gs,allowLegacyFragmentVariables:gs});if(!r||r.kind!=="Document")throw new Error("Not a valid GraphQL document.");ts.set(e,py(fy(r)))}return ts.get(e)}function I(t){for(var e=[],r=1;r<arguments.length;r++)e[r-1]=arguments[r];typeof t=="string"&&(t=[t]);var n=t[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=t[a+1]}),dy(n)}function hy(){ts.clear(),Tu.clear()}function my(){$d=!1}function gy(){gs=!0}function yy(){gs=!1}var na={gql:I,resetCaches:hy,disableFragmentWarnings:my,enableExperimentalFragmentVariables:gy,disableExperimentalFragmentVariables:yy};(function(t){t.gql=na.gql,t.resetCaches=na.resetCaches,t.disableFragmentWarnings=na.disableFragmentWarnings,t.enableExperimentalFragmentVariables=na.enableExperimentalFragmentVariables,t.disableExperimentalFragmentVariables=na.disableExperimentalFragmentVariables})(I||(I={}));I.default=I;function k(t){if(!t)throw"Got no result from Apollo";if(t.error)throw t.error;if(t.errors)throw t.errors;return t.data}function vy(){}function Jr(){return vy}var H=Jr,y=Jr,ze=Jr,me=Jr,W=Jr,xt=Jr,by=Jr,Hu=Jr,jd=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ud=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},kn=class{constructor(e){this.code=e}};jd([y(),Ud("design:type",String)],kn.prototype,"code",void 0);kn=jd([W(),Ud("design:paramtypes",[String])],kn);var Ju=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Yu=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},er=class{constructor(e,r){this.address=e,this.name=r}};Ju([y(),Yu("design:type",String)],er.prototype,"address",void 0);Ju([y(),Yu("design:type",String)],er.prototype,"name",void 0);er=Ju([W(),Yu("design:paramtypes",[String,String])],er);var ke=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ue=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},vr=class{constructor(e,r){this.key=r,this.signature=e}};ke([y(),Ue("design:type",String)],vr.prototype,"signature",void 0);ke([y(),Ue("design:type",String)],vr.prototype,"key",void 0);ke([y(),Ue("design:type",Boolean)],vr.prototype,"valid",void 0);ke([y(),Ue("design:type",Boolean)],vr.prototype,"invalid",void 0);vr=ke([W(),ze(),Ue("design:paramtypes",[String,String])],vr);var An=class{};ke([y(),Ue("design:type",String)],An.prototype,"signature",void 0);ke([y(),Ue("design:type",String)],An.prototype,"key",void 0);ke([y(),Ue("design:type",Boolean)],An.prototype,"valid",void 0);ke([y(),Ue("design:type",Boolean)],An.prototype,"invalid",void 0);An=ke([ze()],An);function Yr(t){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return ke([y(),Ue("design:type",String)],e.prototype,"author",void 0),ke([y(),Ue("design:type",String)],e.prototype,"timestamp",void 0),ke([y(),Ue("design:type",Object)],e.prototype,"data",void 0),ke([y(),Ue("design:type",vr)],e.prototype,"proof",void 0),e=ke([W(),Ue("design:paramtypes",[String,String,Object,vr])],e),e}function _y(t){let e=class{};return ke([y(),Ue("design:type",String)],e.prototype,"author",void 0),ke([y(),Ue("design:type",String)],e.prototype,"timestamp",void 0),ke([y(),Ue("design:type",Object)],e.prototype,"data",void 0),ke([y(),Ue("design:type",An)],e.prototype,"proof",void 0),e=ke([ze()],e),e}var yp=class extends Yr(){};yp=ke([W()],yp);var ys=class extends Yr(){};ke([y(),Ue("design:type",er)],ys.prototype,"language",void 0);ke([y(),Ue("design:type",kn)],ys.prototype,"icon",void 0);ys=ke([W()],ys);function DI(t){return t&&t.author&&t.timestamp&&t.data}var Le=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Xe=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},On=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};Le([y(),Xe("design:type",String)],On.prototype,"source",void 0);Le([y(),Xe("design:type",String)],On.prototype,"target",void 0);Le([y(),Xe("design:type",String)],On.prototype,"predicate",void 0);On=Le([W(),Xe("design:paramtypes",[Object])],On);var vs=class{};Le([y(),Xe("design:type",Array)],vs.prototype,"additions",void 0);Le([y(),Xe("design:type",Array)],vs.prototype,"removals",void 0);vs=Le([ze()],vs);var bs=class{constructor(e,r){this.additions=e,this.removals=r}};Le([y(),Xe("design:type",Array)],bs.prototype,"additions",void 0);Le([y(),Xe("design:type",Array)],bs.prototype,"removals",void 0);bs=Le([W(),Xe("design:paramtypes",[Array,Array])],bs);var Na=class{};Le([y(),Xe("design:type",String)],Na.prototype,"source",void 0);Le([y(),Xe("design:type",String)],Na.prototype,"target",void 0);Le([y(),Xe("design:type",String)],Na.prototype,"predicate",void 0);Na=Le([ze()],Na);var Qr=class extends Yr(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,r=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),r=(r<<5)-r+i,r|=0;return r}};Le([y(),Xe("design:type",String)],Qr.prototype,"status",void 0);Qr=Le([W()],Qr);var Iu=class extends _y(){};Le([y(),Xe("design:type",String)],Iu.prototype,"status",void 0);Iu=Le([ze()],Iu);function $I(t,e){return t.author==e.author&&t.timestamp==e.timestamp&&t.data.source==e.data.source&&t.data.predicate==e.data.predicate&&t.data.target==e.data.target}function MI(t){return t&&t.source&&t.target}var _s=class{constructor(e,r){this.oldLink=e,this.newLink=r}};Le([y(),Xe("design:type",Qr)],_s.prototype,"oldLink",void 0);Le([y(),Xe("design:type",Qr)],_s.prototype,"newLink",void 0);_s=Le([W(),Xe("design:paramtypes",[Qr,Qr])],_s);var Mn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Qa=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},ku,nr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let r=JSON.parse(JSON.stringify(this.links));return r=r.filter(n=>n.data.predicate===e.predicate),e.limit&&(r=r.slice(0,e.limit)),r}getSingleTarget(e){delete e.target;let r=this.get(e);return r.length?r[0].data.target:null}};Mn([y(),Qa("design:type",Array)],nr.prototype,"links",void 0);nr=Mn([W(),Qa("design:paramtypes",[Array])],nr);var Ss=class{};Mn([y(),Qa("design:type",Array)],Ss.prototype,"links",void 0);Ss=Mn([ze()],Ss);var Au=ku=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let r=new ku;return r.links.push(e),r}};Mn([y(),Qa("design:type",Array)],Au.prototype,"links",void 0);Au=ku=Mn([ze(),Qa("design:paramtypes",[Array])],Au);var Dn=class extends Yr(){};Dn=Mn([W()],Dn);var U=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},q=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},jr=class{constructor(e,r){this.did=e,r?this.perspective=r:this.perspective=new nr}};U([y(),q("design:type",String)],jr.prototype,"did",void 0);U([y(),q("design:type",nr)],jr.prototype,"perspective",void 0);U([y(),q("design:type",String)],jr.prototype,"directMessageLanguage",void 0);jr=U([W(),q("design:paramtypes",[String,nr])],jr);var vp=class extends Yr(){};vp=U([W()],vp);var zr=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};U([y(),q("design:type",String)],zr.prototype,"did",void 0);U([y(),q("design:type",String)],zr.prototype,"didSigningKeyId",void 0);U([y(),q("design:type",String)],zr.prototype,"deviceKeyType",void 0);U([y(),q("design:type",String)],zr.prototype,"deviceKey",void 0);U([y(),q("design:type",String)],zr.prototype,"deviceKeySignedByDid",void 0);U([y(),q("design:type",String)],zr.prototype,"didSignedByDeviceKey",void 0);zr=U([W(),q("design:paramtypes",[String,String,String,String,String,String])],zr);var Wr=class{constructor(e,r,n,i,a,o){this.did=e,this.didSigningKeyId=r,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};U([y(),q("design:type",String)],Wr.prototype,"did",void 0);U([y(),q("design:type",String)],Wr.prototype,"didSigningKeyId",void 0);U([y(),q("design:type",String)],Wr.prototype,"deviceKeyType",void 0);U([y(),q("design:type",String)],Wr.prototype,"deviceKey",void 0);U([y(),q("design:type",String)],Wr.prototype,"deviceKeySignedByDid",void 0);U([y(),q("design:type",String)],Wr.prototype,"didSignedByDeviceKey",void 0);Wr=U([ze(),q("design:paramtypes",[String,String,String,String,String,String])],Wr);var ws=class{constructor(e,r){this.signature=e,this.publicKey=r}};U([y(),q("design:type",String)],ws.prototype,"signature",void 0);U([y(),q("design:type",String)],ws.prototype,"publicKey",void 0);ws=U([W(),q("design:paramtypes",[String,String])],ws);var Si=class{constructor(e,r){this.domain=e,this.pointers=r}};U([y(),q("design:type",String)],Si.prototype,"domain",void 0);U([y(),q("design:type",Array)],Si.prototype,"pointers",void 0);Si=U([W(),q("design:paramtypes",[String,Array])],Si);var Es=class{constructor(e,r){this.with=e,this.can=r}};U([y(),q("design:type",Si)],Es.prototype,"with",void 0);U([y(),q("design:type",Array)],Es.prototype,"can",void 0);Es=U([W(),q("design:paramtypes",[Si,Array])],Es);var br=class{constructor(e,r,n,i,a){this.appName=e,this.appDesc=r,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};U([y(),q("design:type",String)],br.prototype,"appName",void 0);U([y(),q("design:type",String)],br.prototype,"appDesc",void 0);U([y(),q("design:type",String)],br.prototype,"appUrl",void 0);U([y(),q("design:type",String)],br.prototype,"appIconPath",void 0);U([y(),q("design:type",Array)],br.prototype,"capabilities",void 0);br=U([W(),q("design:paramtypes",[String,String,String,Array,String])],br);var wi=class{constructor(e,r,n,i){this.requestId=e,this.auth=r,this.token=n,this.revoked=i}};U([y(),q("design:type",String)],wi.prototype,"requestId",void 0);U([y(),q("design:type",String)],wi.prototype,"token",void 0);U([y(),q("design:type",Boolean)],wi.prototype,"revoked",void 0);U([y(),q("design:type",br)],wi.prototype,"auth",void 0);wi=U([W(),q("design:paramtypes",[String,br,String,Boolean])],wi);var Ei=class{constructor(e,r){this.domain=e,this.pointers=r}};U([y(),q("design:type",String)],Ei.prototype,"domain",void 0);U([y(),q("design:type",Array)],Ei.prototype,"pointers",void 0);Ei=U([ze(),q("design:paramtypes",[String,Array])],Ei);var xs=class{constructor(e,r){this.with=e,this.can=r}};U([y(),q("design:type",Ei)],xs.prototype,"with",void 0);U([y(),q("design:type",Array)],xs.prototype,"can",void 0);xs=U([ze(),q("design:paramtypes",[Ei,Array])],xs);var ir=class{constructor(e,r,n,i,a,o){this.appName=e,this.appDesc=r,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};U([y(),q("design:type",String)],ir.prototype,"appName",void 0);U([y(),q("design:type",String)],ir.prototype,"appDesc",void 0);U([y(),q("design:type",String)],ir.prototype,"appDomain",void 0);U([y(),q("design:type",String)],ir.prototype,"appUrl",void 0);U([y(),q("design:type",String)],ir.prototype,"appIconPath",void 0);U([y(),q("design:type",Array)],ir.prototype,"capabilities",void 0);ir=U([ze(),q("design:paramtypes",[String,String,String,String,String,Array])],ir);var Nn=class{constructor(e,r,n){this.did=e,this.success=r,this.error=n}};U([y(),q("design:type",String)],Nn.prototype,"did",void 0);U([y(),q("design:type",Boolean)],Nn.prototype,"success",void 0);U([y(),q("design:type",String)],Nn.prototype,"error",void 0);Nn=U([W(),q("design:paramtypes",[String,Boolean,String])],Nn);var Di=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Ni=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Nt=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)}};Di([y(),Ni("design:type",Boolean)],Nt.prototype,"isInitialized",void 0);Di([y(),Ni("design:type",Boolean)],Nt.prototype,"isUnlocked",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"did",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"didDocument",void 0);Di([y(),Ni("design:type",String)],Nt.prototype,"error",void 0);Nt=Di([W(),Ni("design:paramtypes",[Object])],Nt);var bp=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Ce=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},pt,dt,Ou=class{constructor(e,r){pt.set(this,void 0),dt.set(this,void 0),bp(this,pt,e,"f"),bp(this,dt,r,"f")}async otherAgents(){return await Ce(this,pt,"f").otherAgents(Ce(this,dt,"f"))}async hasTelepresenceAdapter(){return await Ce(this,pt,"f").hasTelepresenceAdapter(Ce(this,dt,"f"))}async onlineAgents(){return await Ce(this,pt,"f").onlineAgents(Ce(this,dt,"f"))}async setOnlineStatus(e){return await Ce(this,pt,"f").setOnlineStatus(Ce(this,dt,"f"),e)}async setOnlineStatusU(e){return await Ce(this,pt,"f").setOnlineStatusU(Ce(this,dt,"f"),e)}async sendSignal(e,r){return await Ce(this,pt,"f").sendSignal(Ce(this,dt,"f"),e,r)}async sendSignalU(e,r){return await Ce(this,pt,"f").sendSignalU(Ce(this,dt,"f"),e,r)}async sendBroadcast(e,r=!1){return await Ce(this,pt,"f").sendBroadcast(Ce(this,dt,"f"),e,r)}async sendBroadcastU(e,r=!1){return await Ce(this,pt,"f").sendBroadcastU(Ce(this,dt,"f"),e,r)}async addSignalHandler(e){await Ce(this,pt,"f").addSignalHandler(Ce(this,dt,"f"),e)}removeSignalHandler(e){Ce(this,pt,"f").removeSignalHandler(Ce(this,dt,"f"),e)}};pt=new WeakMap,dt=new WeakMap;var jn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Un=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ye=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)}};jn([y(),Un("design:type",String)],Ye.prototype,"source",void 0);jn([y(),Un("design:type",String)],Ye.prototype,"target",void 0);jn([y(),Un("design:type",String)],Ye.prototype,"predicate",void 0);jn([y(),Un("design:type",Date)],Ye.prototype,"fromDate",void 0);jn([y(),Un("design:type",Date)],Ye.prototype,"untilDate",void 0);jn([y(),Un("design:type",Number)],Ye.prototype,"limit",void 0);Ye=jn([W(),ze(),Un("design:paramtypes",[Object])],Ye);var _p=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},He=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},ht,dr;function Mo(t){return encodeURIComponent(t).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Ze=class{constructor(){ht.set(this,void 0),dr.set(this,void 0)}static fromUrl(e){if(!e||!e.startsWith("literal://"))throw new Error("Can't create Literal from non-literal URL");let r=new Ze;return _p(r,dr,e,"f"),r}static from(e){let r=new Ze;return _p(r,ht,e,"f"),r}toUrl(){if(He(this,dr,"f")&&!He(this,ht,"f"))return He(this,dr,"f");if(!He(this,dr,"f")&&(He(this,ht,"f")===void 0||He(this,ht,"f")===""||He(this,ht,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof He(this,ht,"f")){case"string":e=`string:${Mo(He(this,ht,"f"))}`;break;case"number":e=`number:${Mo(He(this,ht,"f"))}`;break;case"boolean":e=`boolean:${Mo(He(this,ht,"f"))}`;break;case"object":e=`json:${Mo(JSON.stringify(He(this,ht,"f")))}`;break}return`literal://${e}`}get(){if(He(this,ht,"f"))return He(this,ht,"f");if(!He(this,dr,"f"))throw new Error("Can't render empty Literal");if(!He(this,dr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=He(this,dr,"f").substring(10);if(e.startsWith("string:"))return decodeURIComponent(e.substring(7));if(e.startsWith("number:")){let r=e.substring(7);return parseFloat(r)}if(e.startsWith("json:")){let r=e.substring(5);return JSON.parse(decodeURIComponent(r))}throw new Error(`Can't parse unknown literal: ${e}`)}};ht=new WeakMap,dr=new WeakMap;function Ur(t){return t.charAt(0).toUpperCase()+t.slice(1)}function Zu(t){return`set${Ur(t)}`}function vi(t){return t.endsWith("y")?t.slice(0,-1)+"ies":t+"s"}function Xu(t){return t.endsWith("ies")?t.slice(0,-3)+"y":t.endsWith("s")?t.slice(0,-1):t}function Sy(t){return`add${Ur(Xu(t))}`}function wy(t){let e=t.substring(3),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Ey(t){return`remove${Ur(Xu(t))}`}function xy(t){let e=t.substring(6),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Ty(t){let e=t.substring(13),r=vi(e);return r.charAt(0).toLowerCase()+r.slice(1)}function Iy(t){return`setCollection${Ur(Xu(t))}`}function fn(t){if(Array.isArray(t))return`[${t.map(fn).join(", ")}]`;let e=Object.keys(t),r=[];for(let n of e){let i=JSON.stringify(t[n]),a=`${n}: ${i}`;r.push(a)}return`{${r.join(", ")}}`}var ou=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Y=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},at,ot,Re,bi=class{constructor(t,e,r){at.set(this,void 0),ot.set(this,void 0),Re.set(this,void 0),ou(this,at,e,"f"),ou(this,ot,r,"f"),ou(this,Re,t,"f")}get baseExpression(){return Y(this,at,"f")}async init(){let isInstance=await Y(this,Re,"f").isSubjectInstance(Y(this,at,"f"),Y(this,ot,"f"));if(!isInstance)throw`Not a valid subject instance of ${Y(this,ot,"f")} for ${Y(this,at,"f")}`;let results=await Y(this,Re,"f").infer(`subject_class("${Y(this,ot,"f")}", C), property(C, Property)`),properties=results.map(t=>t.Property);for(let t of properties)await Y(this,Re,"f").infer(`subject_class("${Y(this,ot,"f")}", C), property_resolve(C, "${t}")`),Object.defineProperty(this,t,{configurable:!0,get:async()=>{try{return await Y(this,Re,"f").getPropertyValueViaSurreal(Y(this,at,"f"),Y(this,ot,"f"),t)}catch(e){console.warn(`Failed to get property ${t} via SurrealDB:`,e);return}}});let setters=await Y(this,Re,"f").infer(`subject_class("${Y(this,ot,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await Y(this,Re,"f").infer(`subject_class("${Y(this,ot,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Zu(property)]=async t=>{resolveLanguage&&(t=await Y(this,Re,"f").createExpression(t,resolveLanguage)),await Y(this,Re,"f").executeAction(actions,Y(this,at,"f"),[{name:"value",value:t}])}}let results2=await Y(this,Re,"f").infer(`subject_class("${Y(this,ot,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(t=>t.Collection);for(let t of collections)Object.defineProperty(this,t,{configurable:!0,get:async()=>{try{return await Y(this,Re,"f").getCollectionValuesViaSurreal(Y(this,at,"f"),Y(this,ot,"f"),t)}catch(e){return console.warn(`Failed to get collection ${t} via SurrealDB:`,e),[]}}});let adders=await Y(this,Re,"f").infer(`subject_class("${Y(this,ot,"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[Sy(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>Y(this,Re,"f").executeAction(actions,Y(this,at,"f"),[{name:"value",value:e}]))):await Y(this,Re,"f").executeAction(actions,Y(this,at,"f"),[{name:"value",value:t}])}}let removers=await Y(this,Re,"f").infer(`subject_class("${Y(this,ot,"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[Ey(collection)]=async t=>{Array.isArray(t)?await Promise.all(t.map(e=>Y(this,Re,"f").executeAction(actions,Y(this,at,"f"),[{name:"value",value:e}]))):await Y(this,Re,"f").executeAction(actions,Y(this,at,"f"),[{name:"value",value:t}])}}let collectionSetters=await Y(this,Re,"f").infer(`subject_class("${Y(this,ot,"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[Iy(collection)]=async t=>{Array.isArray(t)?await Y(this,Re,"f").executeAction(actions,Y(this,at,"f"),t.map(e=>({name:"value",value:e}))):await Y(this,Re,"f").executeAction(actions,Y(this,at,"f"),[{name:"value",value:t}])}}}};at=new WeakMap,ot=new WeakMap,Re=new WeakMap;function Sp(t){return t?.length?t.length===1?t.toString():t.length===2?t.join(" and "):t.slice(0,-1).join(", ")+", and "+t.slice(-1):""}function ak(t){let e=t.can.includes("*")?["READ","WRITE","UPDATE"]:t.can,r=t.with.domain==="*"?"":t.with.domain,n=t.with.pointers.includes("*")?["all AD4M data"]:t.with.pointers;return`${Sp(e)} your ${r} actions, with access to ${Sp(n)}`}function we(t){return t.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var he=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},A=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},rs,hr,Ht,Jt,_n,Pr,Fr,pn,ca,ns,dn,hn,Ot,mi,Du,ue,fe,mn,gn,yn,ua,Ts=class{constructor(e,r,n){rs.add(this),hr.set(this,void 0),Ht.set(this,void 0),Jt.set(this,void 0),_n.set(this,void 0),Pr.set(this,void 0),Fr.set(this,void 0),pn.set(this,void 0),ca.set(this,!1),ns.set(this,void 0),dn.set(this,void 0),hn.set(this,void 0),Ot.set(this,void 0),mi.set(this,void 0),this.isSurrealDB=!1,he(this,hr,e,"f"),he(this,mi,r,"f"),he(this,Jt,n,"f"),he(this,_n,new Set,"f"),he(this,pn,null,"f"),he(this,ns,new Promise((i,a)=>{he(this,dn,i,"f"),he(this,hn,a,"f")}),"f")}async subscribe(){A(this,Fr,"f")&&(A(this,Fr,"f").call(this),he(this,Fr,void 0,"f")),A(this,Ot,"f")&&(clearTimeout(A(this,Ot,"f")),he(this,Ot,void 0,"f")),A(this,Pr,"f")&&(clearTimeout(A(this,Pr,"f")),he(this,Pr,void 0,"f"));try{let r;this.isSurrealDB?r=await A(this,Jt,"f").perspectiveSubscribeSurrealQuery(A(this,hr,"f"),A(this,mi,"f")):r=await A(this,Jt,"f").subscribeQuery(A(this,hr,"f"),A(this,mi,"f")),he(this,Ht,r.subscriptionId,"f"),r.result?(he(this,pn,r.result,"f"),A(this,rs,"m",Du).call(this,r.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),he(this,Ot,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(n=>{console.error("Error during subscription retry after timeout:",n)})},3e4),"f"),he(this,Fr,A(this,Jt,"f").subscribeToQueryUpdates(A(this,Ht,"f"),n=>{A(this,Ot,"f")&&(clearTimeout(A(this,Ot,"f")),he(this,Ot,void 0,"f")),A(this,dn,"f")&&(A(this,dn,"f").call(this,!0),he(this,dn,void 0,"f"),he(this,hn,void 0,"f")),!(n.isInit&&A(this,pn,"f"))&&(he(this,pn,n,"f"),A(this,rs,"m",Du).call(this,n))}),"f")}catch(r){throw console.error("Error setting up subscription:",r),A(this,hn,"f")&&(A(this,hn,"f").call(this,r),he(this,dn,void 0,"f"),he(this,hn,void 0,"f")),r}let e=async()=>{if(!A(this,ca,"f")){try{this.isSurrealDB?await A(this,Jt,"f").perspectiveKeepAliveSurrealQuery(A(this,hr,"f"),A(this,Ht,"f")):await A(this,Jt,"f").keepAliveQuery(A(this,hr,"f"),A(this,Ht,"f"))}catch(r){console.error("Error in keepalive:",r),console.log("Reinitializing subscription for query:",A(this,mi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}A(this,ca,"f")||he(this,Pr,setTimeout(e,3e4),"f")}};he(this,Pr,setTimeout(e,3e4),"f")}get id(){return A(this,Ht,"f")}get initialized(){return A(this,ns,"f")}get result(){return A(this,pn,"f")}onResult(e){return A(this,_n,"f").add(e),()=>A(this,_n,"f").delete(e)}dispose(){he(this,ca,!0,"f"),clearTimeout(A(this,Pr,"f")),A(this,Fr,"f")&&A(this,Fr,"f").call(this),A(this,_n,"f").clear(),A(this,Ot,"f")&&(clearTimeout(A(this,Ot,"f")),he(this,Ot,void 0,"f")),A(this,Ht,"f")&&(this.isSurrealDB?A(this,Jt,"f").perspectiveDisposeSurrealQuerySubscription(A(this,hr,"f"),A(this,Ht,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):A(this,Jt,"f").disposeQuerySubscription(A(this,hr,"f"),A(this,Ht,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};hr=new WeakMap,Ht=new WeakMap,Jt=new WeakMap,_n=new WeakMap,Pr=new WeakMap,Fr=new WeakMap,pn=new WeakMap,ca=new WeakMap,ns=new WeakMap,dn=new WeakMap,hn=new WeakMap,Ot=new WeakMap,mi=new WeakMap,rs=new WeakSet,Du=function t(e){for(let r of A(this,_n,"f"))try{r(e)}catch(n){console.error("Error in query subscription callback:",n)}};var yi=class{constructor(t,e){ue.set(this,void 0),fe.set(this,void 0),mn.set(this,void 0),gn.set(this,void 0),yn.set(this,void 0),ua.set(this,void 0),he(this,mn,[],"f"),he(this,gn,[],"f"),he(this,yn,[],"f"),he(this,ua,[],"f"),he(this,ue,t,"f"),he(this,fe,e,"f"),this.uuid=A(this,ue,"f").uuid,this.name=A(this,ue,"f").name,this.owners=A(this,ue,"f").owners,this.sharedUrl=A(this,ue,"f").sharedUrl,this.neighbourhood=A(this,ue,"f").neighbourhood,this.state=A(this,ue,"f").state,A(this,fe,"f").addPerspectiveLinkAddedListener(A(this,ue,"f").uuid,A(this,mn,"f")),A(this,fe,"f").addPerspectiveLinkRemovedListener(A(this,ue,"f").uuid,A(this,gn,"f")),A(this,fe,"f").addPerspectiveLinkUpdatedListener(A(this,ue,"f").uuid,A(this,yn,"f")),A(this,fe,"f").addPerspectiveSyncStateChangeListener(A(this,ue,"f").uuid,A(this,ua,"f"))}escapeRegExp(t){return t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(t,e,r,n){return await A(this,fe,"f").executeCommands(A(this,ue,"f").uuid,JSON.stringify(t),e,JSON.stringify(r),n)}async get(t){return await A(this,fe,"f").queryLinks(A(this,ue,"f").uuid,t)}async infer(t){return await A(this,fe,"f").queryProlog(A(this,ue,"f").uuid,t)}async querySurrealDB(t){return await A(this,fe,"f").querySurrealDB(A(this,ue,"f").uuid,t)}async add(t,e="shared",r){return await A(this,fe,"f").addLink(A(this,ue,"f").uuid,t,e,r)}async addLinks(t,e="shared",r){return await A(this,fe,"f").addLinks(A(this,ue,"f").uuid,t,e,r)}async removeLinks(t,e){return await A(this,fe,"f").removeLinks(A(this,ue,"f").uuid,t,e)}async linkMutations(t,e="shared"){return await A(this,fe,"f").linkMutations(A(this,ue,"f").uuid,t,e)}async addLinkExpression(t,e="shared",r){return await A(this,fe,"f").addLinkExpression(A(this,ue,"f").uuid,t,e,r)}async update(t,e,r){return await A(this,fe,"f").updateLink(A(this,ue,"f").uuid,t,e,r)}async remove(t,e){return await A(this,fe,"f").removeLink(A(this,ue,"f").uuid,t,e)}async createBatch(){return await A(this,fe,"f").createBatch(A(this,ue,"f").uuid)}async commitBatch(t){return await A(this,fe,"f").commitBatch(A(this,ue,"f").uuid,t)}async getExpression(t){return await A(this,fe,"f").getExpression(t)}async createExpression(t,e){return await A(this,fe,"f").createExpression(t,e)}async addListener(t,e){t==="link-added"?A(this,mn,"f").push(e):t==="link-removed"?A(this,gn,"f").push(e):t==="link-updated"&&A(this,yn,"f").push(e)}async addSyncStateChangeListener(t){A(this,ua,"f").push(t)}async removeListener(t,e){if(t==="link-added"){let r=A(this,mn,"f").indexOf(e);A(this,mn,"f").splice(r,1)}else if(t==="link-removed"){let r=A(this,gn,"f").indexOf(e);A(this,gn,"f").splice(r,1)}else if(t==="link-updated"){let r=A(this,yn,"f").indexOf(e);A(this,yn,"f").splice(r,1)}}async snapshot(){return A(this,fe,"f").snapshotByUUID(A(this,ue,"f").uuid)}async loadSnapshot(t){let e=JSON.parse(JSON.stringify(t));delete e.__typename,e.links.forEach(r=>{delete r.data.__typename});for(let r of e.links)await this.addLinkExpression(r)}async getSingleTarget(t){delete t.target;let e=await this.get(t);return e.length?e[0].data.target:null}async setSingleTarget(t,e="shared"){let r=new Ye({source:t.source,predicate:t.predicate}),n=await this.get(r),i=[];for(let o of n)delete o.__typename,delete o.data.__typename,delete o.proof.__typename,i.push(o);let a=[t];await this.linkMutations({additions:a,removals:i},e)}async sdnaFlows(){return(await this.infer("register_sdna_flow(X, _)")).map(e=>e.X)}async availableFlows(t){return(await this.infer(`flowable("${t}", F), register_sdna_flow(X, F)`)).map(r=>r.X)}async startFlow(flowName,exprAddr){let startAction=await this.infer(`start_action(Action, F), register_sdna_flow("${flowName}", F)`);startAction=eval(startAction[0].Action),await this.executeAction(startAction,exprAddr,void 0)}async expressionsInFlowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state(X, ${e}, F)`)).map(n=>n.X)}async flowState(t,e){return(await this.infer(`register_sdna_flow("${t}", F), flow_state("${e}", X, F)`))[0].X}async flowActions(t,e){return(await this.infer(`register_sdna_flow("${t}", Flow), flow_state("${e}", State, Flow), action(State, Name, _, _)`)).map(n=>n.Name)}async runFlowAction(flowName,exprAddr,actionName){let action=await this.infer(`register_sdna_flow("${flowName}", Flow), flow_state("${exprAddr}", State, Flow), action(State, "${actionName}", _, Action)`);action=eval(action[0].Action),await this.executeAction(action,exprAddr,void 0)}async getSdna(){let t=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],e=[];for(let r of t){let n=await this.get(new Ye({source:"ad4m://self",predicate:r}));for(let i of n){let a=i.data.target,o=await this.get(new Ye({source:a,predicate:"ad4m://sdna"}));for(let s of o){let c=Ze.fromUrl(s.data.target).get();typeof c=="string"&&e.push(c)}}}return e}async getSdnaForClass(t){let e=Ze.from(t);if((await this.get(new Ye({source:"ad4m://self",target:e.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new Ye({source:e.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let i=Ze.fromUrl(n[0].data.target).get();return typeof i=="string"?i:null}async addSdna(t,e,r){return A(this,fe,"f").addSdna(A(this,ue,"f").uuid,t,e,r)}async subjectClasses(){try{return(await this.infer("subject_class(X, _)")).map(t=>t.X)}catch{return[]}}async stringOrTemplateObjectToSubjectClassName(t){if(typeof t=="string")return t;{let e=await this.subjectClassesByTemplate(t);return e[0]?e[0]:t.className}}async createSubject(t,e,r,n){let i;if(typeof t=="string")i=t,await A(this,fe,"f").createSubject(A(this,ue,"f").uuid,JSON.stringify({className:i,initialValues:r}),e,r?JSON.stringify(r):void 0,n);else{let a=this.buildQueryFromTemplate(t);await A(this,fe,"f").createSubject(A(this,ue,"f").uuid,JSON.stringify({query:a,initialValues:r}),e,r?JSON.stringify(r):void 0,n)}return n?e:this.getSubjectProxy(e,t)}async getSubjectData(t,e){if(typeof t=="string")return JSON.parse(await A(this,fe,"f").getSubjectData(A(this,ue,"f").uuid,JSON.stringify({className:t}),e));let r=this.buildQueryFromTemplate(t);return JSON.parse(await A(this,fe,"f").getSubjectData(A(this,ue,"f").uuid,JSON.stringify({query:r}),e))}async removeSubject(subjectClass,exprAddr,batchId){let className=await this.stringOrTemplateObjectToSubjectClassName(subjectClass),result=await this.infer(`subject_class("${className}", C), destructor(C, Actions)`);if(!result.length)throw"No destructor found for given subject class: "+className;let actions=result.map(x=>eval(x.Actions));await this.executeAction(actions[0],exprAddr,void 0,batchId)}async isSubjectInstance(t,e){let r=await this.stringOrTemplateObjectToSubjectClassName(e),n=await this.getSubjectClassMetadataFromSDNA(r);if(!n)try{let i=r.replace(/"/g,'\\"'),a=t.replace(/"/g,'\\"'),o=await this.infer(`subject_class("${i}", C), instance(C, "${a}")`);return o&&o.length>0}catch(i){return console.warn(`Failed to check instance via Prolog for class ${r}:`,i),!1}if(n.requiredTriples.length===0){let a=`SELECT count() AS count FROM link WHERE in.uri = '${we(t)}'`,s=(await this.querySurrealDB(a))[0]?.count??0;return(typeof s=="object"&&s?.Int!==void 0?s.Int:s)>0}for(let i of n.requiredTriples){let a=we(t),o=we(i.predicate),s;if(i.target){let d=we(i.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(t,e){if(!await this.isSubjectInstance(t,e))throw`Expression ${t} is not a subject instance of given class: ${JSON.stringify(e)}`;let r=await this.stringOrTemplateObjectToSubjectClassName(e),n=new bi(this,t,r);return await n.init(),n}async getSubjectClassMetadataFromSDNA(t){try{let e=await this.get(new Ye({source:Ze.from(t).toUrl(),predicate:"ad4m://sdna"}));if(!e||e.length===0)return console.warn(`No SDNA found for class ${t}`),null;if(!e[0].data.target)return console.error(`SDNA link for ${t} has no target:`,e[0]),null;let r=Ze.fromUrl(e[0].data.target).get(),n=[],i=/instance\([^)]+\)\s*:-\s*([^.]+)\./g,a,o=!1;for(;(a=i.exec(r))!==null;){o=!0;let p=a[1],f=/triple\([^,]+,\s*"([^"]+)",\s*(?:"([^"]+)"|_)\)/g,h;for(;(h=f.exec(p))!==null;){let m=h[1],g=h[2];n.push({predicate:m,target:g})}}o||console.warn(`No instance rule found in SDNA for ${t}`);let s=n.map(p=>p.predicate),c=new Map,u=await this.infer(`subject_class("${t}", C), property(C, P)`);if(u)for(let p of u){let f=p.P,h=null,m=await this.infer(`subject_class("${t}", C), property_setter(C, "${f}", Setter)`);if(m&&m.length>0){let _=m[0].Setter.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);_&&(h=_[1]||_[2])}if(!h){let g=this.escapeRegExp(f),_=r.match(new RegExp(`property_getter\\([^,]+,\\s*[^,]+,\\s*"${g}"[^)]*\\)\\s*:-\\s*triple\\([^,]+,\\s*"([^"]+)"`));_&&(h=_[1])}if(h){let g=await this.infer(`subject_class("${t}", C), property_resolve_language(C, "${f}", Lang)`),_=g&&g.length>0?g[0].Lang:void 0;c.set(f,{predicate:h,resolveLanguage:_})}}let l=new Map,d=await this.infer(`subject_class("${t}", C), collection(C, Coll)`);if(d)for(let p of d){let f=p.Coll,h=null,m,g,_=await this.infer(`subject_class("${t}", C), collection_adder(C, "${f}", Adder)`);if(_&&_.length>0){let C=_[0].Adder.match(/predicate:\s*"([^"]+)"|predicate:\s*([^,}\]]+)/);C&&(h=C[1]||C[2])}let S=this.escapeRegExp(f),w=new RegExp(`collection_getter\\([^,]+,\\s*[^,]+,\\s*"${S}"[^)]*\\)\\s*:-[^.]+\\.`),b=r.match(w);if(b){let O=b[0],C=/(?:setof|findall)\([^,]+,\s*(.+),\s*\w+\)\./,E=O.match(C);if(E){let R=E[1];if(R.startsWith("(")&&R.endsWith(")")&&(R=R.substring(1,R.length-1)),!h){let P=R.match(/triple\([^,]+,\s*"([^"]+)"/);P&&(h=P[1])}let F=R.match(/subject_class\("([^"]+)"/);F&&(m=F[1])}}h&&l.set(f,{predicate:h,instanceFilter:m,condition:g})}return{requiredPredicates:s,requiredTriples:n,properties:c,collections:l}}catch(e){return console.error(`Error getting metadata for ${t}:`,e),null}}generateSurrealInstanceQuery(t){return t.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${t.requiredTriples.map(r=>{let n=we(r.predicate);if(r.target){let i=we(r.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${i}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(t,e,r){let n=await this.getSubjectClassMetadataFromSDNA(e);if(!n)return;let i=n.properties.get(r);if(!i)return;let a=we(t),o=we(i.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(i.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(t,e,r){let n=await this.getSubjectClassMetadataFromSDNA(e);if(!n)return[];let i=n.collections.get(r);if(!i)return[];let a=we(t),o=we(i.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(i.condition&&u.length>0)try{let l=[];for(let d of u){let p=i.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${t}'`).replace(/Target/g,`'${d.replace(/'/g,"\\'")}'`);p.trim().startsWith("WHERE")&&(p=`array::len(SELECT * FROM link ${p}) > 0`);let f=await this.querySurrealDB(`RETURN ${p}`);(f===!0||Array.isArray(f)&&f.length>0&&f[0]===!0)&&l.push(d)}u=l}catch(l){console.warn(`Failed to apply condition filter for ${r}:`,l)}if(i.instanceFilter)try{let l=await this.getSubjectClassMetadataFromSDNA(i.instanceFilter);return l?await this.batchCheckSubjectInstances(u,l):this.filterInstancesSequential(u,i.instanceFilter)}catch{return this.filterInstancesSequential(u,i.instanceFilter)}return u}async batchCheckSubjectInstances(t,e){if(t.length===0)return[];if(e.requiredTriples.length===0){let a=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${t.map(s=>`'${we(s)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(a)).map(s=>s.uri)}let r=[];for(let i of e.requiredTriples){let a=t.map(u=>`'${we(u)}'`).join(", "),o=we(i.predicate),s;if(i.target){let u=we(i.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);r.push(new Set(c.map(u=>u.uri)))}return r.length===0?t:t.filter(i=>r.every(a=>a.has(i)))}async filterInstancesSequential(t,e){let r=[];for(let n of t)try{await this.isSubjectInstance(n,e)&&r.push(n)}catch{continue}return r}async getAllSubjectInstances(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.getSubjectClassMetadataFromSDNA(n);if(i){let a=this.generateSurrealInstanceQuery(i),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new bi(this,s.base,n);await c.init(),r.push(c)}catch{}}}return r}async getAllSubjectProxies(t){let e=[];typeof t=="string"?e=[t]:e=await this.subjectClassesByTemplate(t);let r=[];for(let n of e){let i=await this.getSubjectClassMetadataFromSDNA(n);if(i){let a=this.generateSurrealInstanceQuery(i),o=await this.querySurrealDB(a);for(let s of o||[])try{let c=new bi(this,s.base,n);await c.init(),r.push(c)}catch{}}}return r}buildQueryFromTemplate(t){let e;return function(r){let n=[],i=[];Object.getPrototypeOf(r).__properties?Object.keys(Object.getPrototypeOf(r).__properties).forEach(l=>n.push(l)):n.push(...Object.keys(r).filter(l=>!Array.isArray(r[l]))),Object.getPrototypeOf(r).__collections?Object.keys(Object.getPrototypeOf(r).__collections).filter(l=>l!=="isSubjectInstance").forEach(l=>{i.includes(l)||i.push(l)}):i.push(...Object.keys(r).filter(l=>Array.isArray(r[l])).filter(l=>l!=="isSubjectInstance"));let a=Object.getOwnPropertyNames(r).filter(l=>typeof r[l]=="function"&&l.startsWith("set")&&!l.startsWith("setCollection"));a=a.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("set")&&!l.startsWith("setCollection")}));let o=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("add"));o=o.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("add")}));let s=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("remove"));s=s.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("remove")}));let c=Object.getOwnPropertyNames(r).filter(l=>Object.prototype.hasOwnProperty.call(r,l)&&typeof r[l]=="function"&&l.startsWith("setCollection"));c=c.concat(Object.getOwnPropertyNames(Object.getPrototypeOf(r)).filter(l=>{let d=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),l);return d&&typeof d.value=="function"&&l.startsWith("setCollection")}));let u="subject_class(Class, C)";for(let l of n)u+=`, property(C, "${l}")`;for(let l of i)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, "${wy(l)}", _)`;for(let l of s)u+=`, collection_remover(C, "${xy(l)}", _)`;for(let l of c)u+=`, collection_setter(C, "${Ty(l)}", _)`;u+=".",e=u}(t),e}async subjectClassesByTemplate(t){let e=this.buildQueryFromTemplate(t),r=await this.infer(e);return r?r.map(n=>n.Class):[]}async ensureSDNASubjectClass(t){if((await this.subjectClassesByTemplate(new t)).length>0)return;let{name:r,sdna:n}=t.generateSDNA();await this.addSdna(r,n,"subject_class")}getNeighbourhoodProxy(){return A(this,fe,"f").getNeighbourhoodProxy(A(this,ue,"f").uuid)}get ai(){return A(this,fe,"f").aiClient}async subscribeInfer(t){let e=new Ts(this.uuid,t,A(this,fe,"f"));return await e.subscribe(),await e.initialized,e}async subscribeSurrealDB(t){let e=new Ts(this.uuid,t,A(this,fe,"f"));return e.isSurrealDB=!0,await e.subscribe(),await e.initialized,e}};ue=new WeakMap,fe=new WeakMap,mn=new WeakMap,gn=new WeakMap,yn=new WeakMap,ua=new WeakMap;var Nr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},V=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Z,la,fa,pa,is,da,as,os,it=`
61
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Tu.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),ms(ms({},r),{definitions:t})}function my(r){var e=new Set(r.definitions);e.forEach(function(n){n.loc&&delete n.loc,Object.keys(n).forEach(function(i){var a=n[i];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function gy(r){var e=qd(r);if(!ts.has(e)){var t=py(r,{experimentalFragmentVariables:gs,allowLegacyFragmentVariables:gs});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");ts.set(e,my(hy(t)))}return ts.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 n=r[0];return e.forEach(function(i,a){i&&i.kind==="Document"?n+=i.loc.source.body:n+=i,n+=r[a+1]}),gy(n)}function yy(){ts.clear(),Tu.clear()}function vy(){Ud=!1}function by(){gs=!0}function Sy(){gs=!1}var na={gql:I,resetCaches:yy,disableFragmentWarnings:vy,enableExperimentalFragmentVariables:by,disableExperimentalFragmentVariables:Sy};(function(r){r.gql=na.gql,r.resetCaches=na.resetCaches,r.disableFragmentWarnings=na.disableFragmentWarnings,r.enableExperimentalFragmentVariables=na.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=na.disableExperimentalFragmentVariables})(I||(I={}));I.default=I;function k(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function _y(){}function Yr(){return _y}var K=Yr,g=Yr,We=Yr,he=Yr,z=Yr,xt=Yr,wy=Yr,Ju=Yr,Bd=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Vd=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},An=class{constructor(e){this.code=e}};Bd([g(),Vd("design:type",String)],An.prototype,"code",void 0);An=Bd([z(),Vd("design:paramtypes",[String])],An);var Yu=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Zu=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},er=class{constructor(e,t){this.address=e,this.name=t}};Yu([g(),Zu("design:type",String)],er.prototype,"address",void 0);Yu([g(),Zu("design:type",String)],er.prototype,"name",void 0);er=Yu([z(),Zu("design:paramtypes",[String,String])],er);var Ae=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>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)},vr=class{constructor(e,t){this.key=t,this.signature=e}};Ae([g(),qe("design:type",String)],vr.prototype,"signature",void 0);Ae([g(),qe("design:type",String)],vr.prototype,"key",void 0);Ae([g(),qe("design:type",Boolean)],vr.prototype,"valid",void 0);Ae([g(),qe("design:type",Boolean)],vr.prototype,"invalid",void 0);vr=Ae([z(),We(),qe("design:paramtypes",[String,String])],vr);var On=class{};Ae([g(),qe("design:type",String)],On.prototype,"signature",void 0);Ae([g(),qe("design:type",String)],On.prototype,"key",void 0);Ae([g(),qe("design:type",Boolean)],On.prototype,"valid",void 0);Ae([g(),qe("design:type",Boolean)],On.prototype,"invalid",void 0);On=Ae([We()],On);function Zr(r){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Ae([g(),qe("design:type",String)],e.prototype,"author",void 0),Ae([g(),qe("design:type",String)],e.prototype,"timestamp",void 0),Ae([g(),qe("design:type",Object)],e.prototype,"data",void 0),Ae([g(),qe("design:type",vr)],e.prototype,"proof",void 0),e=Ae([z(),qe("design:paramtypes",[String,String,Object,vr])],e),e}function Ey(r){let e=class{};return Ae([g(),qe("design:type",String)],e.prototype,"author",void 0),Ae([g(),qe("design:type",String)],e.prototype,"timestamp",void 0),Ae([g(),qe("design:type",Object)],e.prototype,"data",void 0),Ae([g(),qe("design:type",On)],e.prototype,"proof",void 0),e=Ae([We()],e),e}var yf=class extends Zr(){};yf=Ae([z()],yf);var ys=class extends Zr(){};Ae([g(),qe("design:type",er)],ys.prototype,"language",void 0);Ae([g(),qe("design:type",An)],ys.prototype,"icon",void 0);ys=Ae([z()],ys);function NT(r){return r&&r.author&&r.timestamp&&r.data}var $e=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Ze=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},bt=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};$e([g(),Ze("design:type",String)],bt.prototype,"source",void 0);$e([g(),Ze("design:type",String)],bt.prototype,"target",void 0);$e([g(),Ze("design:type",String)],bt.prototype,"predicate",void 0);bt=$e([z(),Ze("design:paramtypes",[Object])],bt);var vs=class{};$e([g(),Ze("design:type",Array)],vs.prototype,"additions",void 0);$e([g(),Ze("design:type",Array)],vs.prototype,"removals",void 0);vs=$e([We()],vs);var bs=class{constructor(e,t){this.additions=e,this.removals=t}};$e([g(),Ze("design:type",Array)],bs.prototype,"additions",void 0);$e([g(),Ze("design:type",Array)],bs.prototype,"removals",void 0);bs=$e([z(),Ze("design:paramtypes",[Array,Array])],bs);var Da=class{};$e([g(),Ze("design:type",String)],Da.prototype,"source",void 0);$e([g(),Ze("design:type",String)],Da.prototype,"target",void 0);$e([g(),Ze("design:type",String)],Da.prototype,"predicate",void 0);Da=$e([We()],Da);var zr=class extends Zr(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,n,i;for(n=0;n<e.length;n++)i=e.charCodeAt(n),t=(t<<5)-t+i,t|=0;return t}};$e([g(),Ze("design:type",String)],zr.prototype,"status",void 0);zr=$e([z()],zr);var ku=class extends Ey(){};$e([g(),Ze("design:type",String)],ku.prototype,"status",void 0);ku=$e([We()],ku);function $T(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 MT(r){return r&&r.source&&r.target}var Ss=class{constructor(e,t){this.oldLink=e,this.newLink=t}};$e([g(),Ze("design:type",zr)],Ss.prototype,"oldLink",void 0);$e([g(),Ze("design:type",zr)],Ss.prototype,"newLink",void 0);Ss=$e([z(),Ze("design:paramtypes",[zr,zr])],Ss);var Mn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Qa=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Au,nr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let n=JSON.parse(JSON.stringify(this.links));return e.target&&(n=n.filter(i=>i.data.target===e.target)),e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}if(e.target){let n=JSON.parse(JSON.stringify(this.links));return e.predicate&&(n=n.filter(i=>i.data.predicate===e.predicate)),e.fromDate&&(n=n.filter(i=>new Date(i.timestamp)>=e.fromDate)),e.untilDate&&(n=n.filter(i=>new Date(i.timestamp)<=e.untilDate)),e.limit&&(n=n.slice(0,e.limit)),n}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(n=>n.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}};Mn([g(),Qa("design:type",Array)],nr.prototype,"links",void 0);nr=Mn([z(),Qa("design:paramtypes",[Array])],nr);var _s=class{};Mn([g(),Qa("design:type",Array)],_s.prototype,"links",void 0);_s=Mn([We()],_s);var Ou=Au=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Au;return t.links.push(e),t}};Mn([g(),Qa("design:type",Array)],Ou.prototype,"links",void 0);Ou=Au=Mn([We(),Qa("design:paramtypes",[Array])],Ou);var Nn=class extends Zr(){};Nn=Mn([z()],Nn);var j=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},U=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},jr=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new nr}};j([g(),U("design:type",String)],jr.prototype,"did",void 0);j([g(),U("design:type",nr)],jr.prototype,"perspective",void 0);j([g(),U("design:type",String)],jr.prototype,"directMessageLanguage",void 0);jr=j([z(),U("design:paramtypes",[String,nr])],jr);var vf=class extends Zr(){};vf=j([z()],vf);var Wr=class{constructor(e,t,n,i,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};j([g(),U("design:type",String)],Wr.prototype,"did",void 0);j([g(),U("design:type",String)],Wr.prototype,"didSigningKeyId",void 0);j([g(),U("design:type",String)],Wr.prototype,"deviceKeyType",void 0);j([g(),U("design:type",String)],Wr.prototype,"deviceKey",void 0);j([g(),U("design:type",String)],Wr.prototype,"deviceKeySignedByDid",void 0);j([g(),U("design:type",String)],Wr.prototype,"didSignedByDeviceKey",void 0);Wr=j([z(),U("design:paramtypes",[String,String,String,String,String,String])],Wr);var Gr=class{constructor(e,t,n,i,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=n,this.deviceKey=i,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};j([g(),U("design:type",String)],Gr.prototype,"did",void 0);j([g(),U("design:type",String)],Gr.prototype,"didSigningKeyId",void 0);j([g(),U("design:type",String)],Gr.prototype,"deviceKeyType",void 0);j([g(),U("design:type",String)],Gr.prototype,"deviceKey",void 0);j([g(),U("design:type",String)],Gr.prototype,"deviceKeySignedByDid",void 0);j([g(),U("design:type",String)],Gr.prototype,"didSignedByDeviceKey",void 0);Gr=j([We(),U("design:paramtypes",[String,String,String,String,String,String])],Gr);var ws=class{constructor(e,t){this.signature=e,this.publicKey=t}};j([g(),U("design:type",String)],ws.prototype,"signature",void 0);j([g(),U("design:type",String)],ws.prototype,"publicKey",void 0);ws=j([z(),U("design:paramtypes",[String,String])],ws);var Si=class{constructor(e,t){this.domain=e,this.pointers=t}};j([g(),U("design:type",String)],Si.prototype,"domain",void 0);j([g(),U("design:type",Array)],Si.prototype,"pointers",void 0);Si=j([z(),U("design:paramtypes",[String,Array])],Si);var Es=class{constructor(e,t){this.with=e,this.can=t}};j([g(),U("design:type",Si)],Es.prototype,"with",void 0);j([g(),U("design:type",Array)],Es.prototype,"can",void 0);Es=j([z(),U("design:paramtypes",[Si,Array])],Es);var br=class{constructor(e,t,n,i,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};j([g(),U("design:type",String)],br.prototype,"appName",void 0);j([g(),U("design:type",String)],br.prototype,"appDesc",void 0);j([g(),U("design:type",String)],br.prototype,"appUrl",void 0);j([g(),U("design:type",String)],br.prototype,"appIconPath",void 0);j([g(),U("design:type",Array)],br.prototype,"capabilities",void 0);br=j([z(),U("design:paramtypes",[String,String,String,Array,String])],br);var _i=class{constructor(e,t,n,i){this.requestId=e,this.auth=t,this.token=n,this.revoked=i}};j([g(),U("design:type",String)],_i.prototype,"requestId",void 0);j([g(),U("design:type",String)],_i.prototype,"token",void 0);j([g(),U("design:type",Boolean)],_i.prototype,"revoked",void 0);j([g(),U("design:type",br)],_i.prototype,"auth",void 0);_i=j([z(),U("design:paramtypes",[String,br,String,Boolean])],_i);var wi=class{constructor(e,t){this.domain=e,this.pointers=t}};j([g(),U("design:type",String)],wi.prototype,"domain",void 0);j([g(),U("design:type",Array)],wi.prototype,"pointers",void 0);wi=j([We(),U("design:paramtypes",[String,Array])],wi);var xs=class{constructor(e,t){this.with=e,this.can=t}};j([g(),U("design:type",wi)],xs.prototype,"with",void 0);j([g(),U("design:type",Array)],xs.prototype,"can",void 0);xs=j([We(),U("design:paramtypes",[wi,Array])],xs);var ir=class{constructor(e,t,n,i,a,o){this.appName=e,this.appDesc=t,this.appUrl=i,this.appDomain=n,this.capabilities=o,this.appIconPath=a}};j([g(),U("design:type",String)],ir.prototype,"appName",void 0);j([g(),U("design:type",String)],ir.prototype,"appDesc",void 0);j([g(),U("design:type",String)],ir.prototype,"appDomain",void 0);j([g(),U("design:type",String)],ir.prototype,"appUrl",void 0);j([g(),U("design:type",String)],ir.prototype,"appIconPath",void 0);j([g(),U("design:type",Array)],ir.prototype,"capabilities",void 0);ir=j([We(),U("design:paramtypes",[String,String,String,String,String,Array])],ir);var Dn=class{constructor(e,t,n){this.did=e,this.success=t,this.error=n}};j([g(),U("design:type",String)],Dn.prototype,"did",void 0);j([g(),U("design:type",Boolean)],Dn.prototype,"success",void 0);j([g(),U("design:type",String)],Dn.prototype,"error",void 0);Dn=j([z(),U("design:paramtypes",[String,Boolean,String])],Dn);var Ni=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Di=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Dt=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};Ni([g(),Di("design:type",Boolean)],Dt.prototype,"isInitialized",void 0);Ni([g(),Di("design:type",Boolean)],Dt.prototype,"isUnlocked",void 0);Ni([g(),Di("design:type",String)],Dt.prototype,"did",void 0);Ni([g(),Di("design:type",String)],Dt.prototype,"didDocument",void 0);Ni([g(),Di("design:type",String)],Dt.prototype,"error",void 0);Dt=Ni([z(),Di("design:paramtypes",[Object])],Dt);var bf=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Re=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},pt,ft,Nu=class{constructor(e,t){pt.set(this,void 0),ft.set(this,void 0),bf(this,pt,e,"f"),bf(this,ft,t,"f")}async otherAgents(){return await Re(this,pt,"f").otherAgents(Re(this,ft,"f"))}async hasTelepresenceAdapter(){return await Re(this,pt,"f").hasTelepresenceAdapter(Re(this,ft,"f"))}async onlineAgents(){return await Re(this,pt,"f").onlineAgents(Re(this,ft,"f"))}async setOnlineStatus(e){return await Re(this,pt,"f").setOnlineStatus(Re(this,ft,"f"),e)}async setOnlineStatusU(e){return await Re(this,pt,"f").setOnlineStatusU(Re(this,ft,"f"),e)}async sendSignal(e,t){return await Re(this,pt,"f").sendSignal(Re(this,ft,"f"),e,t)}async sendSignalU(e,t){return await Re(this,pt,"f").sendSignalU(Re(this,ft,"f"),e,t)}async sendBroadcast(e,t=!1){return await Re(this,pt,"f").sendBroadcast(Re(this,ft,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Re(this,pt,"f").sendBroadcastU(Re(this,ft,"f"),e,t)}async addSignalHandler(e){await Re(this,pt,"f").addSignalHandler(Re(this,ft,"f"),e)}removeSignalHandler(e){Re(this,pt,"f").removeSignalHandler(Re(this,ft,"f"),e)}};pt=new WeakMap,ft=new WeakMap;var jn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>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)},Se=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)}};jn([g(),Un("design:type",String)],Se.prototype,"source",void 0);jn([g(),Un("design:type",String)],Se.prototype,"target",void 0);jn([g(),Un("design:type",String)],Se.prototype,"predicate",void 0);jn([g(),Un("design:type",Date)],Se.prototype,"fromDate",void 0);jn([g(),Un("design:type",Date)],Se.prototype,"untilDate",void 0);jn([g(),Un("design:type",Number)],Se.prototype,"limit",void 0);Se=jn([z(),We(),Un("design:paramtypes",[Object])],Se);var Sf=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Je=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},dt,dr;function Mo(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var ye=class{constructor(){dt.set(this,void 0),dr.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 ye;return Sf(t,dr,e,"f"),t}static from(e){let t=new ye;return Sf(t,dt,e,"f"),t}toUrl(){if(Je(this,dr,"f")&&!Je(this,dt,"f"))return Je(this,dr,"f");if(!Je(this,dr,"f")&&(Je(this,dt,"f")===void 0||Je(this,dt,"f")===""||Je(this,dt,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Je(this,dt,"f")){case"string":e=`string:${Mo(Je(this,dt,"f"))}`;break;case"number":e=`number:${Mo(Je(this,dt,"f"))}`;break;case"boolean":e=`boolean:${Mo(Je(this,dt,"f"))}`;break;case"object":e=`json:${Mo(JSON.stringify(Je(this,dt,"f")))}`;break}return`literal://${e}`}get(){if(Je(this,dt,"f"))return Je(this,dt,"f");if(!Je(this,dr,"f"))throw new Error("Can't render empty Literal");if(!Je(this,dr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Je(this,dr,"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}`)}};dt=new WeakMap,dr=new WeakMap;function Ur(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Is(r){return`set${Ur(r)}`}function Xu(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function xy(r){return`add${Ur(Xu(r))}`}function Iy(r){return`remove${Ur(Xu(r))}`}function Ty(r){return`setCollection${Ur(Xu(r))}`}function fn(r){if(Array.isArray(r))return`[${r.map(fn).join(", ")}]`;let e=Object.keys(r),t=[];for(let n of e){let i=JSON.stringify(r[n]),a=`${n}: ${i}`;t.push(a)}return`{${t.join(", ")}}`}var su=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},J=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},it,at,Pe,vi=class{constructor(r,e,t){it.set(this,void 0),at.set(this,void 0),Pe.set(this,void 0),su(this,it,e,"f"),su(this,at,t,"f"),su(this,Pe,r,"f")}get baseExpression(){return J(this,it,"f")}async init(){let isInstance=await J(this,Pe,"f").isSubjectInstance(J(this,it,"f"),J(this,at,"f"));if(!isInstance)throw`Not a valid subject instance of ${J(this,at,"f")} for ${J(this,it,"f")}`;let results=await J(this,Pe,"f").infer(`subject_class("${J(this,at,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await J(this,Pe,"f").infer(`subject_class("${J(this,at,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await J(this,Pe,"f").getPropertyValueViaSurreal(J(this,it,"f"),J(this,at,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await J(this,Pe,"f").infer(`subject_class("${J(this,at,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await J(this,Pe,"f").infer(`subject_class("${J(this,at,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Is(property)]=async r=>{resolveLanguage&&(r=await J(this,Pe,"f").createExpression(r,resolveLanguage)),await J(this,Pe,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:r}])}}let results2=await J(this,Pe,"f").infer(`subject_class("${J(this,at,"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 J(this,Pe,"f").getCollectionValuesViaSurreal(J(this,it,"f"),J(this,at,"f"),r)}catch(e){return console.warn(`Failed to get collection ${r} via SurrealDB:`,e),[]}}});let adders=await J(this,Pe,"f").infer(`subject_class("${J(this,at,"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[xy(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,Pe,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:e}]))):await J(this,Pe,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:r}])}}let removers=await J(this,Pe,"f").infer(`subject_class("${J(this,at,"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[Iy(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,Pe,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:e}]))):await J(this,Pe,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:r}])}}let collectionSetters=await J(this,Pe,"f").infer(`subject_class("${J(this,at,"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[Ty(collection)]=async r=>{Array.isArray(r)?await J(this,Pe,"f").executeAction(actions,J(this,it,"f"),r.map(e=>({name:"value",value:e}))):await J(this,Pe,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:r}])}}}};it=new WeakMap,at=new WeakMap,Pe=new WeakMap;function _f(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 ak(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,n=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${_f(e)} your ${t} actions, with access to ${_f(n)}`}function me(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function wf(r){let e=r.lastIndexOf("#");if(e!==-1)return r.substring(0,e+1);let t=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:\/\/)(.*)$/);if(t){let i=t[2],a=i.lastIndexOf("/");return a!==-1?t[1]+i.substring(0,a+1):t[1]}let n=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return n?n[1]:""}function Ef(r){return r.replace(/\\/g,"\\\\").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t").replace(/\b/g,"\\b").replace(/\f/g,"\\f")}function xf(r){let e=r.lastIndexOf("#");if(e!==-1)return r.substring(e+1);let t=r.lastIndexOf("/");if(t!==-1&&t<r.length-1)return r.substring(t+1);let n=r.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return n?n[1]:r}var qr=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let n=wf(e),i=xf(e);this.nodeShapeUri=`${n}${i}Shape`}this.properties=[]}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
62
+ `;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
63
+ `,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
64
+ `,e+=`@prefix ad4m: <ad4m://> .
65
+
66
+ `,e+=`<${this.nodeShapeUri}>
67
+ `,e+=` a sh:NodeShape ;
68
+ `,this.targetClass&&(e+=` sh:targetClass <${this.targetClass}> ;
69
+ `);for(let t=0;t<this.properties.length;t++){let n=this.properties[t],i=t===this.properties.length-1;e+=` sh:property [
70
+ `,e+=` sh:path <${n.path}> ;
71
+ `,n.datatype&&(e+=` sh:datatype <${n.datatype}> ;
72
+ `),n.nodeKind&&(e+=` sh:nodeKind sh:${n.nodeKind} ;
73
+ `),n.minCount!==void 0&&(e+=` sh:minCount ${n.minCount} ;
74
+ `),n.maxCount!==void 0&&(e+=` sh:maxCount ${n.maxCount} ;
75
+ `),n.pattern&&(e+=` sh:pattern "${Ef(n.pattern)}" ;
76
+ `),n.minInclusive!==void 0&&(e+=` sh:minInclusive ${n.minInclusive} ;
77
+ `),n.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${n.maxInclusive} ;
78
+ `),n.hasValue&&(e+=` sh:hasValue "${Ef(n.hasValue)}" ;
79
+ `),n.local!==void 0&&(e+=` ad4m:local ${n.local} ;
80
+ `),n.writable!==void 0&&(e+=` ad4m:writable ${n.writable} ;
81
+ `),e=e.slice(0,-2)+`
82
+ `,e+=i?` ] .
83
+ `:` ] ;
84
+ `}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&this.constructor_actions.length>0&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&this.destructor_actions.length>0&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal://string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let n=this.properties[t],i;if(n.name&&this.targetClass){let a=wf(this.targetClass),o=xf(this.targetClass);i=`${a}${o}.${n.name}`}else i=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:i}),e.push({source:i,predicate:"sh://path",target:n.path}),n.datatype&&e.push({source:i,predicate:"sh://datatype",target:n.datatype}),n.nodeKind&&e.push({source:i,predicate:"sh://nodeKind",target:`sh://${n.nodeKind}`}),n.minCount!==void 0&&e.push({source:i,predicate:"sh://minCount",target:`literal://${n.minCount}^^xsd:integer`}),n.maxCount!==void 0&&e.push({source:i,predicate:"sh://maxCount",target:`literal://${n.maxCount}^^xsd:integer`}),n.pattern&&e.push({source:i,predicate:"sh://pattern",target:`literal://${n.pattern}`}),n.minInclusive!==void 0&&e.push({source:i,predicate:"sh://minInclusive",target:`literal://${n.minInclusive}`}),n.maxInclusive!==void 0&&e.push({source:i,predicate:"sh://maxInclusive",target:`literal://${n.maxInclusive}`}),n.hasValue&&e.push({source:i,predicate:"sh://hasValue",target:`literal://${n.hasValue}`}),n.local!==void 0&&e.push({source:i,predicate:"ad4m://local",target:`literal://${n.local}`}),n.writable!==void 0&&e.push({source:i,predicate:"ad4m://writable",target:`literal://${n.writable}`}),n.resolveLanguage&&e.push({source:i,predicate:"ad4m://resolveLanguage",target:`literal://string:${n.resolveLanguage}`}),n.setter&&n.setter.length>0&&e.push({source:i,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(n.setter)}`}),n.adder&&n.adder.length>0&&e.push({source:i,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(n.adder)}`}),n.remover&&n.remover.length>0&&e.push({source:i,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(n.remover)}`})}return e}static fromLinks(e,t){let n=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),i=new qr(t,n?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace("literal://string:","");i.constructor_actions=JSON.parse(c)}catch{}let o=e.find(c=>c.source===t&&c.predicate==="ad4m://destructor");if(o)try{let c=o.target.replace("literal://string:","");i.destructor_actions=JSON.parse(c)}catch{}let s=e.filter(c=>c.source===t&&c.predicate==="sh://property");for(let c of s){let u=c.target,l=e.find(T=>T.source===u&&T.predicate==="sh://path");if(!l)continue;let d;if(!u.startsWith("_:")){let T=u.lastIndexOf(".");T!==-1&&(d=u.substring(T+1))}let f={name:d,path:l.target},p=e.find(T=>T.source===u&&T.predicate==="sh://datatype");p&&(f.datatype=p.target);let h=e.find(T=>T.source===u&&T.predicate==="sh://nodeKind");h&&(f.nodeKind=h.target.replace("sh://",""));let m=e.find(T=>T.source===u&&T.predicate==="sh://minCount");if(m){let T=m.target.replace("literal://","").replace(/\^\^.*$/,"");T.startsWith("number:")&&(T=T.substring(7)),f.minCount=parseInt(T)}let y=e.find(T=>T.source===u&&T.predicate==="sh://maxCount");if(y){let T=y.target.replace("literal://","").replace(/\^\^.*$/,"");T.startsWith("number:")&&(T=T.substring(7)),f.maxCount=parseInt(T)}let _=e.find(T=>T.source===u&&T.predicate==="sh://pattern");_&&(f.pattern=_.target.replace("literal://",""));let S=e.find(T=>T.source===u&&T.predicate==="sh://minInclusive");if(S){let T=S.target.replace("literal://","");T.startsWith("number:")&&(T=T.substring(7)),f.minInclusive=parseFloat(T)}let w=e.find(T=>T.source===u&&T.predicate==="sh://maxInclusive");if(w){let T=w.target.replace("literal://","");T.startsWith("number:")&&(T=T.substring(7)),f.maxInclusive=parseFloat(T)}let v=e.find(T=>T.source===u&&T.predicate==="sh://hasValue");v&&(f.hasValue=v.target.replace("literal://",""));let A=e.find(T=>T.source===u&&T.predicate==="ad4m://local");if(A){let T=A.target.replace("literal://","");T.startsWith("boolean:")&&(T=T.substring(8)),f.local=T==="true"}let R=e.find(T=>T.source===u&&T.predicate==="ad4m://writable");if(R){let T=R.target.replace("literal://","");T.startsWith("boolean:")&&(T=T.substring(8)),f.writable=T==="true"}let E=e.find(T=>T.source===u&&T.predicate==="ad4m://resolveLanguage");E&&(f.resolveLanguage=E.target.replace("literal://string:",""));let P=e.find(T=>T.source===u&&T.predicate==="ad4m://setter");if(P)try{let T=P.target.replace("literal://string:","");f.setter=JSON.parse(T)}catch{}let L=e.find(T=>T.source===u&&T.predicate==="ad4m://adder");if(L)try{let T=L.target.replace("literal://string:","");f.adder=JSON.parse(T)}catch{}let C=e.find(T=>T.source===u&&T.predicate==="ad4m://remover");if(C)try{let T=C.target.replace("literal://string:","");f.remover=JSON.parse(T)}catch{}i.addProperty(f)}return i}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new qr(e.node_shape_uri,e.target_class):new qr(e.target_class);for(let n of e.properties||[])t.addProperty({path:n.path,name:n.name,datatype:n.datatype,nodeKind:n.node_kind,minCount:n.min_count,maxCount:n.max_count,minInclusive:n.min_inclusive,maxInclusive:n.max_inclusive,pattern:n.pattern,hasValue:n.has_value,local:n.local,writable:n.writable,resolveLanguage:n.resolve_language,setter:n.setter,adder:n.adder,remover:n.remover});return e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),t}},Ei=class{constructor(e,t){this.flowable="any",this.startAction=[],this._states=[],this._transitions=[],this.name=e,this.namespace=t}get states(){return[...this._states]}get transitions(){return[...this._transitions]}addState(e){this._states.push(e)}addTransition(e){this._transitions.push(e)}get flowUri(){return`${this.namespace}${this.name}Flow`}stateUri(e){return`${this.namespace}${this.name}.${e}`}transitionUri(e,t){return`${this.namespace}${this.name}.${e}To${t}`}toLinks(){let e=[],t=this.flowUri;e.push({source:t,predicate:"rdf://type",target:"ad4m://Flow"}),e.push({source:t,predicate:"ad4m://flowName",target:ye.from(this.name).toUrl()}),this.flowable==="any"?e.push({source:t,predicate:"ad4m://flowable",target:"ad4m://any"}):e.push({source:t,predicate:"ad4m://flowable",target:`literal://string:${encodeURIComponent(JSON.stringify(this.flowable))}`}),this.startAction.length>0&&e.push({source:t,predicate:"ad4m://startAction",target:`literal://string:${encodeURIComponent(JSON.stringify(this.startAction))}`});for(let n of this._states){let i=this.stateUri(n.name);e.push({source:t,predicate:"ad4m://hasState",target:i}),e.push({source:i,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:i,predicate:"ad4m://stateName",target:ye.from(n.name).toUrl()}),e.push({source:i,predicate:"ad4m://stateValue",target:ye.from(n.value).toUrl()}),e.push({source:i,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(n.stateCheck))}`})}for(let n of this._transitions){let i=this.transitionUri(n.fromState,n.toState),a=this.stateUri(n.fromState),o=this.stateUri(n.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:i}),e.push({source:i,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:i,predicate:"ad4m://actionName",target:ye.from(n.actionName).toUrl()}),e.push({source:i,predicate:"ad4m://fromState",target:a}),e.push({source:i,predicate:"ad4m://toState",target:o}),e.push({source:i,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(n.actions))}`})}return e}static fromLinks(e,t){let n="Flow";if(!t.endsWith(n))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let i=t.slice(0,-n.length),a=Math.max(i.lastIndexOf("/"),i.lastIndexOf(":")),o=i.slice(0,a+1),s=i.slice(a+1),c=new Ei(s,o),u=e.find(h=>h.source===t&&h.predicate==="ad4m://flowable");if(u)if(u.target==="ad4m://any")c.flowable="any";else try{let h=u.target.replace("literal://string:","");c.flowable=JSON.parse(decodeURIComponent(h))}catch{c.flowable="any"}let l=e.find(h=>h.source===t&&h.predicate==="ad4m://startAction");if(l)try{let h=l.target.replace("literal://string:","");c.startAction=JSON.parse(decodeURIComponent(h))}catch{}let d=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),f=new Map;for(let h of d){let m=h.target,y=e.find(R=>R.source===m&&R.predicate==="ad4m://stateName"),_=y?ye.fromUrl(y.target).get():"";f.set(m,_);let S=e.find(R=>R.source===m&&R.predicate==="ad4m://stateValue"),w=S?ye.fromUrl(S.target).get():0,v=e.find(R=>R.source===m&&R.predicate==="ad4m://stateCheck"),A={predicate:"",target:""};if(v)try{let R=v.target.replace("literal://string:","");A=JSON.parse(decodeURIComponent(R))}catch{}c.addState({name:_,value:w,stateCheck:A})}let p=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of p){let m=h.target,y=e.find(C=>C.source===m&&C.predicate==="ad4m://actionName"),_=y?ye.fromUrl(y.target).get():"",w=e.find(C=>C.source===m&&C.predicate==="ad4m://fromState")?.target||"",v=f.get(w)||"",R=e.find(C=>C.source===m&&C.predicate==="ad4m://toState")?.target||"",E=f.get(R)||"",P=e.find(C=>C.source===m&&C.predicate==="ad4m://transitionActions"),L=[];if(P)try{let C=P.target.replace("literal://string:","");L=JSON.parse(decodeURIComponent(C))}catch{}c.addTransition({actionName:_,fromState:v,toState:E,actions:L})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new Ei(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let n of e.states||[])t.addState(n);for(let n of e.transitions||[])t.addTransition(n);return t}},de=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},O=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},rs,hr,Ht,Jt,_n,Pr,Lr,dn,ca,ns,hn,mn,Ot,mi,Du,ce,le,gn,yn,vn,ua,Ts=class{constructor(e,t,n){rs.add(this),hr.set(this,void 0),Ht.set(this,void 0),Jt.set(this,void 0),_n.set(this,void 0),Pr.set(this,void 0),Lr.set(this,void 0),dn.set(this,void 0),ca.set(this,!1),ns.set(this,void 0),hn.set(this,void 0),mn.set(this,void 0),Ot.set(this,void 0),mi.set(this,void 0),this.isSurrealDB=!1,de(this,hr,e,"f"),de(this,mi,t,"f"),de(this,Jt,n,"f"),de(this,_n,new Set,"f"),de(this,dn,null,"f"),de(this,ns,new Promise((i,a)=>{de(this,hn,i,"f"),de(this,mn,a,"f")}),"f")}async subscribe(){O(this,Lr,"f")&&(O(this,Lr,"f").call(this),de(this,Lr,void 0,"f")),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),de(this,Ot,void 0,"f")),O(this,Pr,"f")&&(clearTimeout(O(this,Pr,"f")),de(this,Pr,void 0,"f"));try{let t;this.isSurrealDB?t=await O(this,Jt,"f").perspectiveSubscribeSurrealQuery(O(this,hr,"f"),O(this,mi,"f")):t=await O(this,Jt,"f").subscribeQuery(O(this,hr,"f"),O(this,mi,"f")),de(this,Ht,t.subscriptionId,"f"),t.result?(de(this,dn,t.result,"f"),O(this,rs,"m",Du).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),de(this,Ot,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(n=>{console.error("Error during subscription retry after timeout:",n)})},3e4),"f"),de(this,Lr,O(this,Jt,"f").subscribeToQueryUpdates(O(this,Ht,"f"),n=>{O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),de(this,Ot,void 0,"f")),O(this,hn,"f")&&(O(this,hn,"f").call(this,!0),de(this,hn,void 0,"f"),de(this,mn,void 0,"f")),!(n.isInit&&O(this,dn,"f"))&&(de(this,dn,n,"f"),O(this,rs,"m",Du).call(this,n))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,mn,"f")&&(O(this,mn,"f").call(this,t),de(this,hn,void 0,"f"),de(this,mn,void 0,"f")),t}let e=async()=>{if(!O(this,ca,"f")){try{this.isSurrealDB?await O(this,Jt,"f").perspectiveKeepAliveSurrealQuery(O(this,hr,"f"),O(this,Ht,"f")):await O(this,Jt,"f").keepAliveQuery(O(this,hr,"f"),O(this,Ht,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,mi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,ca,"f")||de(this,Pr,setTimeout(e,3e4),"f")}};de(this,Pr,setTimeout(e,3e4),"f")}get id(){return O(this,Ht,"f")}get initialized(){return O(this,ns,"f")}get result(){return O(this,dn,"f")}onResult(e){return O(this,_n,"f").add(e),()=>O(this,_n,"f").delete(e)}dispose(){de(this,ca,!0,"f"),clearTimeout(O(this,Pr,"f")),O(this,Lr,"f")&&O(this,Lr,"f").call(this),O(this,_n,"f").clear(),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),de(this,Ot,void 0,"f")),O(this,Ht,"f")&&(this.isSurrealDB?O(this,Jt,"f").perspectiveDisposeSurrealQuerySubscription(O(this,hr,"f"),O(this,Ht,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,Jt,"f").disposeQuerySubscription(O(this,hr,"f"),O(this,Ht,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};hr=new WeakMap,Ht=new WeakMap,Jt=new WeakMap,_n=new WeakMap,Pr=new WeakMap,Lr=new WeakMap,dn=new WeakMap,ca=new WeakMap,ns=new WeakMap,hn=new WeakMap,mn=new WeakMap,Ot=new WeakMap,mi=new WeakMap,rs=new WeakSet,Du=function r(e){for(let t of O(this,_n,"f"))try{t(e)}catch(n){console.error("Error in query subscription callback:",n)}};var yi=class{constructor(e,t){ce.set(this,void 0),le.set(this,void 0),gn.set(this,void 0),yn.set(this,void 0),vn.set(this,void 0),ua.set(this,void 0),de(this,gn,[],"f"),de(this,yn,[],"f"),de(this,vn,[],"f"),de(this,ua,[],"f"),de(this,ce,e,"f"),de(this,le,t,"f"),this.uuid=O(this,ce,"f").uuid,this.name=O(this,ce,"f").name,this.owners=O(this,ce,"f").owners,this.sharedUrl=O(this,ce,"f").sharedUrl,this.neighbourhood=O(this,ce,"f").neighbourhood,this.state=O(this,ce,"f").state,O(this,le,"f").addPerspectiveLinkAddedListener(O(this,ce,"f").uuid,O(this,gn,"f")),O(this,le,"f").addPerspectiveLinkRemovedListener(O(this,ce,"f").uuid,O(this,yn,"f")),O(this,le,"f").addPerspectiveLinkUpdatedListener(O(this,ce,"f").uuid,O(this,vn,"f")),O(this,le,"f").addPerspectiveSyncStateChangeListener(O(this,ce,"f").uuid,O(this,ua,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,n,i){return await O(this,le,"f").executeCommands(O(this,ce,"f").uuid,JSON.stringify(e),t,JSON.stringify(n),i)}async get(e){return await O(this,le,"f").queryLinks(O(this,ce,"f").uuid,e)}async infer(e){return await O(this,le,"f").queryProlog(O(this,ce,"f").uuid,e)}async querySurrealDB(e){return await O(this,le,"f").querySurrealDB(O(this,ce,"f").uuid,e)}async add(e,t="shared",n){return await O(this,le,"f").addLink(O(this,ce,"f").uuid,e,t,n)}async addLinks(e,t="shared",n){return await O(this,le,"f").addLinks(O(this,ce,"f").uuid,e,t,n)}async removeLinks(e,t){return await O(this,le,"f").removeLinks(O(this,ce,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await O(this,le,"f").linkMutations(O(this,ce,"f").uuid,e,t)}async addLinkExpression(e,t="shared",n){return await O(this,le,"f").addLinkExpression(O(this,ce,"f").uuid,e,t,n)}async update(e,t,n){return await O(this,le,"f").updateLink(O(this,ce,"f").uuid,e,t,n)}async remove(e,t){return await O(this,le,"f").removeLink(O(this,ce,"f").uuid,e,t)}async createBatch(){return await O(this,le,"f").createBatch(O(this,ce,"f").uuid)}async commitBatch(e){return await O(this,le,"f").commitBatch(O(this,ce,"f").uuid,e)}async getExpression(e){return await O(this,le,"f").getExpression(e)}async createExpression(e,t){return await O(this,le,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?O(this,gn,"f").push(t):e==="link-removed"?O(this,yn,"f").push(t):e==="link-updated"&&O(this,vn,"f").push(t)}async addSyncStateChangeListener(e){O(this,ua,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let n=O(this,gn,"f").indexOf(t);O(this,gn,"f").splice(n,1)}else if(e==="link-removed"){let n=O(this,yn,"f").indexOf(t);O(this,yn,"f").splice(n,1)}else if(e==="link-updated"){let n=O(this,vn,"f").indexOf(t);O(this,vn,"f").splice(n,1)}}async snapshot(){return O(this,le,"f").snapshotByUUID(O(this,ce,"f").uuid)}async loadSnapshot(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(n=>{delete n.data.__typename});for(let n of t.links)await this.addLinkExpression(n)}async getSingleTarget(e){delete e.target;let t=await this.get(e);return t.length?t[0].data.target:null}async setSingleTarget(e,t="shared"){let n=new Se({source:e.source,predicate:e.predicate}),i=await this.get(n),a=[];for(let s of i)delete s.__typename,delete s.data.__typename,delete s.proof.__typename,a.push(s);let o=[e];await this.linkMutations({additions:o,removals:a},t)}async sdnaFlows(){return(await this.get(new Se({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return ye.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),n=[];for(let i of t){let a=await this.getFlow(i);if(!!a)if(a.flowable==="any")n.push(i);else{let o=a.flowable,s=o.source||e;(await this.get(new Se({source:s,predicate:o.predicate,target:o.target}))).length>0&&n.push(i)}}return n}async startFlow(e,t){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;if(n.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(n.startAction,t,void 0)}async expressionsInFlowState(e,t){let n=await this.getFlow(e);if(!n)return[];let i=n.states.find(s=>s.value===t);if(!i)return[];let a=i.stateCheck;return(await this.get(new Se({predicate:a.predicate,target:a.target}))).map(s=>a.source?s.data.target:s.data.source)}async flowState(e,t){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;for(let i of n.states){let a=i.stateCheck,o=a.source||t;if((await this.get(new Se({source:o,predicate:a.predicate,target:a.target}))).length>0)return i.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let n=await this.getFlow(e);if(!n)return[];let i=null;for(let a of n.states){let o=a.stateCheck,s=o.source||t;if((await this.get(new Se({source:s,predicate:o.predicate,target:o.target}))).length>0){i=a.name;break}}return i?n.transitions.filter(a=>a.fromState===i).map(a=>a.actionName):[]}async runFlowAction(e,t,n){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;let a=i.transitions.find(o=>o.actionName===n);if(!a)throw`Action "${n}" not found in flow "${e}"`;await this.executeAction(a.actions,t,void 0)}async getSdna(){let e=["ad4m://has_subject_class","ad4m://has_flow","ad4m://has_custom_sdna"],t=[];for(let n of e){let i=await this.get(new Se({source:"ad4m://self",predicate:n}));for(let a of i){let o=a.data.target,s=await this.get(new Se({source:o,predicate:"ad4m://sdna"}));for(let c of s){let u=ye.fromUrl(c.data.target).get();typeof u=="string"&&t.push(u)}}}return t}async getSdnaForClass(e){let t=ye.from(e);if((await this.get(new Se({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new Se({source:t.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let a=ye.fromUrl(i[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,n,i){return O(this,le,"f").addSdna(O(this,ce,"f").uuid,e,t,n,i)}async addShacl(e,t){let n=t.toLinks(),i=ye.fromUrl(`literal://string:shacl://${e}`),a=[...n.map(o=>new bt({source:o.source,predicate:o.predicate,target:o.target})),new bt({source:"ad4m://self",predicate:"ad4m://has_shacl",target:i.toUrl()}),new bt({source:i.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=ye.fromUrl(`literal://string:shacl://${e}`),n=await this.get(new Se({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(n.length===0)return null;let i=n[0].data.target;me(i);let a=await this.get(new Se({source:i,predicate:"sh://property"})),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[i,...a.map(d=>d.data.target)].map(d=>`'${me(d)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(d=>({source:d.source,predicate:d.predicate,target:d.target}));return qr.fromLinks(l,i)}async getAllShacl(){let e=await this.get(new Se({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let n of e){let i=n.data.target,o=ye.fromUrl(i).get().replace("shacl://",""),s=await this.getShacl(o);s&&t.push({name:o,shape:s})}return t}async addFlow(e,t){let n=t.toLinks(),i=ye.from(e).toUrl(),a=[...n.map(o=>new bt({source:o.source,predicate:o.predicate,target:o.target})),new bt({source:"ad4m://self",predicate:"ad4m://has_flow",target:i}),new bt({source:i,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=ye.from(e).toUrl(),n=await this.get(new Se({source:t,predicate:"ad4m://flow_uri"}));if(n.length===0)return null;let i=n[0].data.target,a=me(i),o=i.endsWith("Flow")?i.slice(0,-4)+".":i+".",s=me(o),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${s}')`,l=(await this.querySurrealDB(c)||[]).map(d=>({source:d.source,predicate:d.predicate,target:d.target}));return Ei.fromLinks(l,i)}async subjectClasses(){try{let t=(await this.get(new Se({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(n=>{let a=n.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(n=>n.length>0);return[...new Set(t)]}catch(e){return console.warn("subjectClasses: SHACL lookup failed:",e),[]}}async stringOrTemplateObjectToSubjectClassName(e){if(typeof e=="string")return e;{let t=await this.subjectClassesByTemplate(e);return t[0]?t[0]:e.className}}async createSubject(e,t,n,i){let a;if(typeof e=="string")a=e,await O(this,le,"f").createSubject(O(this,ce,"f").uuid,JSON.stringify({className:a,initialValues:n}),t,n?JSON.stringify(n):void 0,i);else{let o=e,s=o.className||o.constructor?.className||o.constructor?.prototype?.className||await this.findClassByProperties(o);if(!s)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");await O(this,le,"f").createSubject(O(this,ce,"f").uuid,JSON.stringify({className:s,initialValues:n}),t,n?JSON.stringify(n):void 0,i)}return i?t:this.getSubjectProxy(t,e)}async getSubjectData(e,t){if(typeof e=="string")return JSON.parse(await O(this,le,"f").getSubjectData(O(this,ce,"f").uuid,JSON.stringify({className:e}),t));let n=e,i=n.className||n.constructor?.className||n.constructor?.prototype?.className||await this.findClassByProperties(n);if(!i)throw new Error("Could not resolve subject class name from object. Use a decorated class or pass a className string.");return JSON.parse(await O(this,le,"f").getSubjectData(O(this,ce,"f").uuid,JSON.stringify({className:i}),t))}async getActionsFromSHACL(e,t){let n=this.escapeRegExp(e),i=new RegExp(`[/:#]${n}Shape$`),a=await this.get(new Se({predicate:t}));for(let o of a)if(i.test(o.data.source)){let s="literal://string:";if(o.data.target.startsWith(s)){let c=o.data.target.slice(s.length),u=c;try{u=decodeURIComponent(c)}catch{}try{return JSON.parse(u)}catch(l){return console.warn(`Failed to parse SHACL actions JSON for ${e}:`,l),null}}}return null}async removeSubject(e,t,n){let i=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(i,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${i}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,n)}async isSubjectInstance(e,t){let n=await this.stringOrTemplateObjectToSubjectClassName(t),i=await this.getSubjectClassMetadataFromSDNA(n);if(!i)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${n}`),!1;if(i.requiredTriples.length===0){let o=`SELECT count() AS count FROM link WHERE in.uri = '${me(e)}'`,c=(await this.querySurrealDB(o))[0]?.count??0;return(typeof c=="object"&&c?.Int!==void 0?c.Int:c)>0}for(let a of i.requiredTriples){let o=me(e),s=me(a.predicate),c;if(a.target){let f=me(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${f}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}'`;let u=await this.querySurrealDB(c);if(!u||u.length===0)return!1;let l=u[0]?.count??0;if((typeof l=="object"&&l?.Int!==void 0?l.Int:l)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let n=await this.stringOrTemplateObjectToSubjectClassName(t),i=new vi(this,e,n);return await i.init(),i}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let n=[],i=[],a=new Map,o=new Map,s=new Set;for(let c of t.properties){if(!c.path||!c.name)continue;c.writable&&s.add(c.path),c.adder&&c.adder.length>0?o.set(c.name,{predicate:c.path}):a.set(c.name,{predicate:c.path,resolveLanguage:c.resolveLanguage})}if(t.constructor_actions){for(let c of t.constructor_actions)if(c.predicate){n.push(c.predicate);let u=s.has(c.predicate);c.target&&c.target!=="value"&&!u?i.push({predicate:c.predicate,target:c.target}):i.push({predicate:c.predicate})}}return{requiredPredicates:n,requiredTriples:i,properties:a,collections:o}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}generateSurrealInstanceQuery(e){return e.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${e.requiredTriples.map(n=>{let i=me(n.predicate);if(n.target){let a=me(n.target);return`count(->link[WHERE predicate = '${i}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${i}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return;let a=i.properties.get(n);if(!a)return;let o=me(e),s=me(a.predicate),c=`SELECT out.uri AS value FROM link WHERE in.uri = '${o}' AND predicate = '${s}' LIMIT 1`,u=await this.querySurrealDB(c);if(!u||u.length===0)return;let l=u[0].value;if(a.resolveLanguage&&l)try{let d=await this.getExpression(l);try{return JSON.parse(d.data)}catch{return d.data}}catch{return l}return l}async getCollectionValuesViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return[];let a=i.collections.get(n);if(!a)return[];let o=me(e),s=me(a.predicate),c=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${o}' AND predicate = '${s}' ORDER BY timestamp ASC`,u=await this.querySurrealDB(c);if(!u||u.length===0)return[];let l=u.map(d=>d.value).filter(d=>d!==""&&d!=="");if(a.condition&&l.length>0)try{let d=[];for(let f of l){let p=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${f.replace(/'/g,"\\'")}'`);p.trim().startsWith("WHERE")&&(p=`array::len(SELECT * FROM link ${p}) > 0`);let h=await this.querySurrealDB(`RETURN ${p}`);(h===!0||Array.isArray(h)&&h.length>0&&h[0]===!0)&&d.push(f)}l=d}catch(d){console.warn(`Failed to apply condition filter for ${n}:`,d)}if(a.instanceFilter)try{let d=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return d?await this.batchCheckSubjectInstances(l,d):this.filterInstancesSequential(l,a.instanceFilter)}catch{return this.filterInstancesSequential(l,a.instanceFilter)}return l}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(c=>`'${me(c)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(o)).map(c=>c.uri)}let n=[];for(let a of t.requiredTriples){let o=e.map(l=>`'${me(l)}'`).join(", "),s=me(a.predicate),c;if(a.target){let l=me(a.target);c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${o}] AND predicate = '${s}' AND out.uri = '${l}'`}else c=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${o}] AND predicate = '${s}'`;let u=await this.querySurrealDB(c);n.push(new Set(u.map(l=>l.uri)))}return n.length===0?e:e.filter(a=>n.every(o=>o.has(a)))}async filterInstancesSequential(e,t){let n=[];for(let i of e)try{await this.isSubjectInstance(i,t)&&n.push(i)}catch{continue}return n}async getAllSubjectInstances(e){let t=[],n=typeof e=="function";typeof e=="string"?t=[e]:n?t=[e.name]:t=await this.subjectClassesByTemplate(e);let i=[];for(let a of t){let o=await this.getSubjectClassMetadataFromSDNA(a);if(o){let s=this.generateSurrealInstanceQuery(o),c=await this.querySurrealDB(s);for(let u of c||[])try{let l;n?(l=new e(this,u.base),await l.get()):(l=new vi(this,u.base,a),await l.init()),i.push(l)}catch{}}}return i}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let n=[];for(let i of t){let a=await this.getSubjectClassMetadataFromSDNA(i);if(a){let o=this.generateSurrealInstanceQuery(a),s=await this.querySurrealDB(o);for(let c of s||[])try{let u=new vi(this,c.base,i);await u.init(),n.push(u)}catch{}}}return n}async findClassByProperties(e){let t=[],n=[],i=Object.getPrototypeOf(e);if(i?.__properties?t=Object.keys(i.__properties):t=Object.keys(e).filter(c=>!Array.isArray(e[c])),i?.__collections?n=Object.keys(i.__collections).filter(c=>c!=="isSubjectInstance"):n=Object.keys(e).filter(c=>Array.isArray(e[c])&&c!=="isSubjectInstance"),t.length===0&&n.length===0)return null;let a=`SELECT
85
+ in.uri AS shape_source,
86
+ predicate,
87
+ out.uri AS target
88
+ FROM link
89
+ WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,o=await this.querySurrealDB(a);if(!o||o.length===0)return null;let s=new Map;for(let c of o)if(c.predicate==="rdf://type"&&c.target==="ad4m://SubjectClass"){let u=c.shape_source,l=u.indexOf("://");if(l<0)continue;let d=u.substring(l+3).split("/").pop();if(!d)continue;s.set(d,{shapeUri:u,properties:[],collections:[]})}for(let c of o)if(c.predicate==="sh://property"||c.predicate==="sh://collection"){for(let[u,l]of s)if(c.shape_source.endsWith(`${u}Shape`)){let d=c.target.lastIndexOf(".");if(d<0)continue;let f=c.target.substring(d+1);c.predicate==="sh://property"?l.properties.push(f):l.collections.push(f)}}for(let[c,u]of s){let l=t.every(f=>u.properties.includes(f)),d=n.every(f=>u.collections.includes(f));if(l&&d)return c}return null}async subjectClassesByTemplate(e){try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching failed:",t)}try{let t=e.className||e.constructor?.className||e.constructor?.prototype?.className;if(t&&(await this.subjectClasses()).includes(t))return[t]}catch(t){console.warn("subjectClassesByTemplate: className lookup failed:",t)}return[]}async ensureSDNASubjectClass(e){let t=e.className||e.prototype?.className||e.name;if(!e.generateSHACL)throw new Error(`Class ${e.name} must have generateSHACL(). Use @ModelOptions decorator.`);let{shape:n}=e.generateSHACL(),i=JSON.stringify(n.toJSON());await this.addSdna(t,"","subject_class",i)}getNeighbourhoodProxy(){return O(this,le,"f").getNeighbourhoodProxy(O(this,ce,"f").uuid)}get ai(){return O(this,le,"f").aiClient}async subscribeInfer(e){let t=new Ts(this.uuid,e,O(this,le,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new Ts(this.uuid,e,O(this,le,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};ce=new WeakMap,le=new WeakMap,gn=new WeakMap,yn=new WeakMap,vn=new WeakMap,ua=new WeakMap;var Dr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},B=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Y,la,pa,fa,is,da,as,os,nt=`
62
90
  author
63
91
  timestamp
64
92
  status
@@ -85,139 +113,139 @@ neighbourhood {
85
113
  }
86
114
  author
87
115
  }
88
- `,Is=class{constructor(e,r=!0){Z.set(this,void 0),la.set(this,void 0),fa.set(this,void 0),pa.set(this,void 0),is.set(this,void 0),da.set(this,void 0),as.set(this,void 0),os.set(this,void 0),Nr(this,Z,e,"f"),Nr(this,la,[],"f"),Nr(this,fa,[],"f"),Nr(this,pa,[],"f"),Nr(this,is,[],"f"),r&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Nr(this,da,e,"f")}setNeighbourhoodClient(e){Nr(this,as,e,"f")}setAIClient(e){Nr(this,os,e,"f")}get aiClient(){return V(this,os,"f")}async all(){let{perspectives:e}=k(await V(this,Z,"f").query({query:I`query perspectives {
116
+ `,ks=class{constructor(e,t=!0){Y.set(this,void 0),la.set(this,void 0),pa.set(this,void 0),fa.set(this,void 0),is.set(this,void 0),da.set(this,void 0),as.set(this,void 0),os.set(this,void 0),Dr(this,Y,e,"f"),Dr(this,la,[],"f"),Dr(this,pa,[],"f"),Dr(this,fa,[],"f"),Dr(this,is,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Dr(this,da,e,"f")}setNeighbourhoodClient(e){Dr(this,as,e,"f")}setAIClient(e){Dr(this,os,e,"f")}get aiClient(){return B(this,os,"f")}async all(){let{perspectives:e}=k(await B(this,Y,"f").query({query:I`query perspectives {
89
117
  perspectives {
90
118
  ${ui}
91
119
  }
92
- }`}));return e.map(r=>new yi(r,this))}async byUUID(e){let{perspective:r}=k(await V(this,Z,"f").query({query:I`query perspective($uuid: String!) {
120
+ }`}));return e.map(t=>new yi(t,this))}async byUUID(e){let{perspective:t}=k(await B(this,Y,"f").query({query:I`query perspective($uuid: String!) {
93
121
  perspective(uuid: $uuid) {
94
122
  ${ui}
95
123
  }
96
- }`,variables:{uuid:e}}));return r?new yi(r,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:r}=k(await V(this,Z,"f").query({query:I`query perspectiveSnapshot($uuid: String!) {
124
+ }`,variables:{uuid:e}}));return t?new yi(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=k(await B(this,Y,"f").query({query:I`query perspectiveSnapshot($uuid: String!) {
97
125
  perspectiveSnapshot(uuid: $uuid) {
98
- links { ${it} }
126
+ links { ${nt} }
99
127
  }
100
- }`,variables:{uuid:e}}));return r}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:r}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectivePublishSnapshot($uuid: String!) {
128
+ }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectivePublishSnapshot($uuid: String!) {
101
129
  perspectivePublishSnapshot(uuid: $uuid)
102
- }`,variables:{uuid:e}}));return r}async queryLinks(e,r){let{perspectiveQueryLinks:n}=k(await V(this,Z,"f").query({query:I`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
130
+ }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:n}=k(await B(this,Y,"f").query({query:I`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
103
131
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
104
- ${it}
132
+ ${nt}
105
133
  }
106
- }`,variables:{uuid:e,query:r}}));return n}async queryProlog(e,r){let{perspectiveQueryProlog:n}=k(await V(this,Z,"f").query({query:I`query perspectiveQueryProlog($uuid: String!, $query: String!) {
134
+ }`,variables:{uuid:e,query:t}}));return n}async queryProlog(e,t){let{perspectiveQueryProlog:n}=k(await B(this,Y,"f").query({query:I`query perspectiveQueryProlog($uuid: String!, $query: String!) {
107
135
  perspectiveQueryProlog(uuid: $uuid, query: $query)
108
- }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async querySurrealDB(e,r){let{perspectiveQuerySurrealDb:n}=k(await V(this,Z,"f").query({query:I`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
136
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:n}=k(await B(this,Y,"f").query({query:I`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
109
137
  perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
110
- }`,variables:{uuid:e,query:r}}));return JSON.parse(n)}async subscribeQuery(e,r){let{perspectiveSubscribeQuery:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
138
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:n}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
111
139
  perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
112
140
  subscriptionId
113
141
  result
114
142
  }
115
- }`,variables:{uuid:e,query:r}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,r){let{perspectiveSubscribeSurrealQuery:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
143
+ }`,variables:{uuid:e,query:t}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:n}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
116
144
  perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
117
145
  subscriptionId
118
146
  result
119
147
  }
120
- }`,variables:{uuid:e,query:r}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,r){let{perspectiveKeepAliveSurrealQuery:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
148
+ }`,variables:{uuid:e,query:t}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:n}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
121
149
  perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
122
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,r){let{perspectiveDisposeSurrealQuerySubscription:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
150
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:n}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
123
151
  perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
124
- }`,variables:{uuid:e,subscriptionId:r}}));return n}subscribeToQueryUpdates(e,r){let n=V(this,Z,"f").subscribe({query:I`
152
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}subscribeToQueryUpdates(e,t){let n=B(this,Y,"f").subscribe({query:I`
125
153
  subscription perspectiveQuerySubscription($subscriptionId: String!) {
126
154
  perspectiveQuerySubscription(subscriptionId: $subscriptionId)
127
155
  }
128
- `,variables:{subscriptionId:e}}).subscribe({next:i=>{if(i.data&&i.data.perspectiveQuerySubscription){let a=i.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}r(a)}},error:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,r){let{perspectiveKeepAliveQuery:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
156
+ `,variables:{subscriptionId:e}}).subscribe({next:i=>{if(i.data&&i.data.perspectiveQuerySubscription){let a=i.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:n}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
129
157
  perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
130
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async disposeQuerySubscription(e,r){let{perspectiveDisposeQuerySubscription:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
158
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:n}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
131
159
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
132
- }`,variables:{uuid:e,subscriptionId:r}}));return n}async add(e){let{perspectiveAdd:r}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAdd($name: String!) {
160
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async add(e){let{perspectiveAdd:t}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveAdd($name: String!) {
133
161
  perspectiveAdd(name: $name) {
134
162
  ${ui}
135
163
  }
136
- }`,variables:{name:e}}));return new yi(r,this)}async update(e,r){let{perspectiveUpdate:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveUpdate($uuid: String!, $name: String!) {
164
+ }`,variables:{name:e}}));return new yi(t,this)}async update(e,t){let{perspectiveUpdate:n}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveUpdate($uuid: String!, $name: String!) {
137
165
  perspectiveUpdate(uuid: $uuid, name: $name) {
138
166
  ${ui}
139
167
  }
140
- }`,variables:{uuid:e,name:r}}));return new yi(n,this)}async remove(e){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveRemove($uuid: String!) {
168
+ }`,variables:{uuid:e,name:t}}));return new yi(n,this)}async remove(e){return k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveRemove($uuid: String!) {
141
169
  perspectiveRemove(uuid: $uuid)
142
- }`,variables:{uuid:e}}))}async addLink(e,r,n="shared",i){let{perspectiveAddLink:a}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
170
+ }`,variables:{uuid:e}}))}async addLink(e,t,n="shared",i){let{perspectiveAddLink:a}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
143
171
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
144
- ${it}
172
+ ${nt}
145
173
  }
146
- }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async addLinks(e,r,n="shared",i){let{perspectiveAddLinks:a}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
174
+ }`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async addLinks(e,t,n="shared",i){let{perspectiveAddLinks:a}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
147
175
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
148
- ${it}
176
+ ${nt}
149
177
  }
150
- }`,variables:{uuid:e,links:r,status:n,batchId:i}}));return a}async removeLinks(e,r,n){let{perspectiveRemoveLinks:i}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
178
+ }`,variables:{uuid:e,links:t,status:n,batchId:i}}));return a}async removeLinks(e,t,n){let{perspectiveRemoveLinks:i}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
151
179
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
152
- ${it}
180
+ ${nt}
153
181
  }
154
- }`,variables:{uuid:e,links:r,batchId:n}}));return i}async linkMutations(e,r,n){let{perspectiveLinkMutations:i}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
182
+ }`,variables:{uuid:e,links:t,batchId:n}}));return i}async linkMutations(e,t,n){let{perspectiveLinkMutations:i}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
155
183
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
156
184
  additions {
157
- ${it}
185
+ ${nt}
158
186
  }
159
187
  removals {
160
- ${it}
188
+ ${nt}
161
189
  }
162
190
  }
163
- }`,variables:{uuid:e,mutations:r,status:n}}));return i}async addLinkExpression(e,r,n="shared",i){let{perspectiveAddLinkExpression:a}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
191
+ }`,variables:{uuid:e,mutations:t,status:n}}));return i}async addLinkExpression(e,t,n="shared",i){let{perspectiveAddLinkExpression:a}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
164
192
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
165
- ${it}
193
+ ${nt}
166
194
  }
167
- }`,variables:{uuid:e,link:r,status:n,batchId:i}}));return a}async updateLink(e,r,n,i){let{perspectiveUpdateLink:a}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
195
+ }`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async updateLink(e,t,n,i){let{perspectiveUpdateLink:a}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
168
196
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
169
- ${it}
197
+ ${nt}
170
198
  }
171
- }`,variables:{uuid:e,oldLink:r,newLink:n,batchId:i}}));return a}async removeLink(e,r,n){delete r.__typename,delete r.data.__typename,delete r.proof.__typename,delete r.status;let{perspectiveRemoveLink:i}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
199
+ }`,variables:{uuid:e,oldLink:t,newLink:n,batchId:i}}));return a}async removeLink(e,t,n){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:i}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
172
200
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
173
- }`,variables:{uuid:e,link:r,batchId:n}}));return i}async addSdna(e,r,n,i){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String!, $sdnaType: String!) {
174
- perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType)
175
- }`,variables:{uuid:e,name:r,sdnaCode:n,sdnaType:i}})).perspectiveAddSdna}async executeCommands(e,r,n,i,a){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
201
+ }`,variables:{uuid:e,link:t,batchId:n}}));return i}async addSdna(e,t,n,i,a){return k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
202
+ perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
203
+ }`,variables:{uuid:e,name:t,sdnaCode:n||"",sdnaType:i,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,n,i,a){return k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
176
204
  perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
177
- }`,variables:{uuid:e,commands:r,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,r,n,i,a){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
205
+ }`,variables:{uuid:e,commands:t,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,n,i,a){return k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
178
206
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
179
- }`,variables:{uuid:e,subjectClass:r,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,r,n){return k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
207
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,n){return k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
180
208
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
181
- }`,variables:{uuid:e,subjectClass:r,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await V(this,da,"f").get(e)}async createExpression(e,r){return await V(this,da,"f").create(e,r)}addPerspectiveAddedListener(e){V(this,la,"f").push(e)}subscribePerspectiveAdded(){V(this,Z,"f").subscribe({query:I` subscription {
209
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await B(this,da,"f").get(e)}async createExpression(e,t){return await B(this,da,"f").create(e,t)}addPerspectiveAddedListener(e){B(this,la,"f").push(e)}subscribePerspectiveAdded(){B(this,Y,"f").subscribe({query:I` subscription {
182
210
  perspectiveAdded { ${ui} }
183
211
  }
184
- `}).subscribe({next:e=>{V(this,la,"f").forEach(r=>{r(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){V(this,fa,"f").push(e)}subscribePerspectiveUpdated(){V(this,Z,"f").subscribe({query:I` subscription {
212
+ `}).subscribe({next:e=>{B(this,la,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){B(this,pa,"f").push(e)}subscribePerspectiveUpdated(){B(this,Y,"f").subscribe({query:I` subscription {
185
213
  perspectiveUpdated { ${ui} }
186
214
  }
187
- `}).subscribe({next:e=>{V(this,fa,"f").forEach(r=>{r(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){V(this,is,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,r){V(this,Z,"f").subscribe({query:I` subscription {
215
+ `}).subscribe({next:e=>{B(this,pa,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){B(this,is,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){B(this,Y,"f").subscribe({query:I` subscription {
188
216
  perspectiveSyncStateChange(uuid: "${e}")
189
217
  }
190
- `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){V(this,pa,"f").push(e)}subscribePerspectiveRemoved(){V(this,Z,"f").subscribe({query:I` subscription {
218
+ `}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){B(this,fa,"f").push(e)}subscribePerspectiveRemoved(){B(this,Y,"f").subscribe({query:I` subscription {
191
219
  perspectiveRemoved
192
220
  }
193
- `}).subscribe({next:e=>{V(this,pa,"f").forEach(r=>{r(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,r){V(this,Z,"f").subscribe({query:I` subscription {
194
- perspectiveLinkAdded(uuid: "${e}") { ${it} }
221
+ `}).subscribe({next:e=>{B(this,fa,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){B(this,Y,"f").subscribe({query:I` subscription {
222
+ perspectiveLinkAdded(uuid: "${e}") { ${nt} }
195
223
  }
196
- `}).subscribe({next:n=>{r.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,r){V(this,Z,"f").subscribe({query:I` subscription {
197
- perspectiveLinkRemoved(uuid: "${e}") { ${it} }
224
+ `}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,t){B(this,Y,"f").subscribe({query:I` subscription {
225
+ perspectiveLinkRemoved(uuid: "${e}") { ${nt} }
198
226
  }
199
- `}).subscribe({next:n=>{r.forEach(i=>{n.data.perspectiveLinkRemoved.status||delete n.data.perspectiveLinkRemoved.status,i(n.data.perspectiveLinkRemoved)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkUpdatedListener(e,r){V(this,Z,"f").subscribe({query:I` subscription {
227
+ `}).subscribe({next:n=>{t.forEach(i=>{n.data.perspectiveLinkRemoved.status||delete n.data.perspectiveLinkRemoved.status,i(n.data.perspectiveLinkRemoved)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkUpdatedListener(e,t){B(this,Y,"f").subscribe({query:I` subscription {
200
228
  perspectiveLinkUpdated(uuid: "${e}") {
201
229
  oldLink {
202
- ${it}
230
+ ${nt}
203
231
  }
204
232
  newLink {
205
- ${it}
233
+ ${nt}
206
234
  }
207
235
  }
208
236
  }
209
- `}).subscribe({next:n=>{r.forEach(i=>{n.data.perspectiveLinkUpdated.newLink.status||delete n.data.perspectiveLinkUpdated.newLink.status,n.data.perspectiveLinkUpdated.oldLink.status||delete n.data.perspectiveLinkUpdated.oldLink.status,i(n.data.perspectiveLinkUpdated)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}getNeighbourhoodProxy(e){return new Ou(V(this,as,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:r}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveCreateBatch($uuid: String!) {
237
+ `}).subscribe({next:n=>{t.forEach(i=>{n.data.perspectiveLinkUpdated.newLink.status||delete n.data.perspectiveLinkUpdated.newLink.status,n.data.perspectiveLinkUpdated.oldLink.status||delete n.data.perspectiveLinkUpdated.oldLink.status,i(n.data.perspectiveLinkUpdated)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}getNeighbourhoodProxy(e){return new Nu(B(this,as,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveCreateBatch($uuid: String!) {
210
238
  perspectiveCreateBatch(uuid: $uuid)
211
- }`,variables:{uuid:e}}));return r}async commitBatch(e,r){let{perspectiveCommitBatch:n}=k(await V(this,Z,"f").mutate({mutation:I`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
239
+ }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:n}=k(await B(this,Y,"f").mutate({mutation:I`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
212
240
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
213
241
  additions {
214
- ${it}
242
+ ${nt}
215
243
  }
216
244
  removals {
217
- ${it}
245
+ ${nt}
218
246
  }
219
247
  }
220
- }`,variables:{uuid:e,batchId:r}}));return n}};Z=new WeakMap,la=new WeakMap,fa=new WeakMap,pa=new WeakMap,is=new WeakMap,da=new WeakMap,as=new WeakMap,os=new WeakMap;var jo=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},re=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},le,ha,ma,ga,ia=`
248
+ }`,variables:{uuid:e,batchId:t}}));return n}};Y=new WeakMap,la=new WeakMap,pa=new WeakMap,fa=new WeakMap,is=new WeakMap,da=new WeakMap,as=new WeakMap,os=new WeakMap;var jo=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},te=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ue,ha,ma,ga,ia=`
221
249
  did
222
250
  directMessageLanguage
223
251
  perspective {
@@ -263,17 +291,17 @@ neighbourhood {
263
291
  `,ky=`
264
292
  signature
265
293
  publicKey
266
- `,Ca=class{constructor(e,r=!0){le.set(this,void 0),ha.set(this,void 0),ma.set(this,void 0),ga.set(this,void 0),jo(this,le,e,"f"),jo(this,ma,[],"f"),jo(this,ga,[],"f"),jo(this,ha,[],"f"),r&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await re(this,le,"f").query({query:I`query agent { agent { ${ia} } }`})),r=new jr(e.did,e.perspective);return r.directMessageLanguage=e.directMessageLanguage,r}async status(){let{agentStatus:e}=k(await re(this,le,"f").query({query:I`query agentStatus {
294
+ `,Ca=class{constructor(e,t=!0){ue.set(this,void 0),ha.set(this,void 0),ma.set(this,void 0),ga.set(this,void 0),jo(this,ue,e,"f"),jo(this,ma,[],"f"),jo(this,ga,[],"f"),jo(this,ha,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=k(await te(this,ue,"f").query({query:I`query agent { agent { ${ia} } }`})),t=new jr(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=k(await te(this,ue,"f").query({query:I`query agentStatus {
267
295
  agentStatus {
268
296
  ${li}
269
297
  }
270
- }`}));return new Nt(e)}async generate(e){let{agentGenerate:r}=k(await re(this,le,"f").mutate({mutation:I`mutation agentGenerate(
298
+ }`}));return new Dt(e)}async generate(e){let{agentGenerate:t}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentGenerate(
271
299
  $passphrase: String!
272
300
  ) {
273
301
  agentGenerate(passphrase: $passphrase) {
274
302
  ${li}
275
303
  }
276
- }`,variables:{passphrase:e}}));return new Nt(r)}async import(e){let{did:r,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=k(await re(this,le,"f").mutate({mutation:I`mutation agentImport(
304
+ }`,variables:{passphrase:e}}));return new Dt(t)}async import(e){let{did:t,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentImport(
277
305
  $did: String!,
278
306
  $didDocument: String!,
279
307
  $keystore: String!,
@@ -282,110 +310,110 @@ neighbourhood {
282
310
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
283
311
  ${li}
284
312
  }
285
- }`,variables:{did:r,didDocument:n,keystore:i,passphrase:a}}));return new Nt(o)}async lock(e){let{agentLock:r}=k(await re(this,le,"f").mutate({mutation:I`mutation agentLock($passphrase: String!) {
313
+ }`,variables:{did:t,didDocument:n,keystore:i,passphrase:a}}));return new Dt(o)}async lock(e){let{agentLock:t}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentLock($passphrase: String!) {
286
314
  agentLock(passphrase: $passphrase) {
287
315
  ${li}
288
316
  }
289
- }`,variables:{passphrase:e}}));return new Nt(r)}async unlock(e,r=!0){let{agentUnlock:n}=k(await re(this,le,"f").mutate({mutation:I`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
317
+ }`,variables:{passphrase:e}}));return new Dt(t)}async unlock(e,t=!0){let{agentUnlock:n}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
290
318
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
291
319
  ${li}
292
320
  }
293
- }`,variables:{passphrase:e,holochain:r}}));return new Nt(n)}async byDID(e){let{agentByDID:r}=k(await re(this,le,"f").query({query:I`query agentByDID($did: String!) {
321
+ }`,variables:{passphrase:e,holochain:t}}));return new Dt(n)}async byDID(e){let{agentByDID:t}=k(await te(this,ue,"f").query({query:I`query agentByDID($did: String!) {
294
322
  agentByDID(did: $did) {
295
323
  ${ia}
296
324
  }
297
- }`,variables:{did:e}}));return r}async updatePublicPerspective(e){let r=JSON.parse(JSON.stringify(e));delete r.__typename,r.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:n}=k(await re(this,le,"f").mutate({mutation:I`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
325
+ }`,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:n}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
298
326
  agentUpdatePublicPerspective(perspective: $perspective) {
299
327
  ${ia}
300
328
  }
301
- }`,variables:{perspective:r}})),i=n,a=new jr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let r=new Is(re(this,le,"f")),n=new Ca(re(this,le,"f")),i=await r.add("Agent Perspective Proxy"),a=await n.me();a.perspective&&await i.loadSnapshot(a.perspective);for(let c of e.additions)await i.add(c);for(let c of e.removals)await i.remove(c);let o=await i.snapshot(),s=await this.updatePublicPerspective(o);return await r.remove(i.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:r}=k(await re(this,le,"f").mutate({mutation:I`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
329
+ }`,variables:{perspective:t}})),i=n,a=new jr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new ks(te(this,ue,"f")),n=new Ca(te(this,ue,"f")),i=await t.add("Agent Perspective Proxy"),a=await n.me();a.perspective&&await i.loadSnapshot(a.perspective);for(let c of e.additions)await i.add(c);for(let c of e.removals)await i.remove(c);let o=await i.snapshot(),s=await this.updatePublicPerspective(o);return await t.remove(i.uuid),s}async updateDirectMessageLanguage(e){let{agentUpdateDirectMessageLanguage:t}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
302
330
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
303
331
  ${ia}
304
332
  }
305
- }`,variables:{directMessageLanguage:e}})),n=r,i=new jr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:r}=k(await re(this,le,"f").mutate({mutation:I`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
333
+ }`,variables:{directMessageLanguage:e}})),n=t,i=new jr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
306
334
  agentAddEntanglementProofs(proofs: $proofs) {
307
335
  ${qo}
308
336
  }
309
- }`,variables:{proofs:e}}));return r}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:r}=k(await re(this,le,"f").mutate({mutation:I`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
337
+ }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
310
338
  agentDeleteEntanglementProofs(proofs: $proofs) {
311
339
  ${qo}
312
340
  }
313
- }`,variables:{proofs:e}}));return r}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await re(this,le,"f").query({query:I`query agentGetEntanglementProofs {
341
+ }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=k(await te(this,ue,"f").query({query:I`query agentGetEntanglementProofs {
314
342
  agentGetEntanglementProofs {
315
343
  ${qo}
316
344
  }
317
- }`}));return e}async entanglementProofPreFlight(e,r){let{agentEntanglementProofPreFlight:n}=k(await re(this,le,"f").mutate({mutation:I`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
345
+ }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:n}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
318
346
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
319
347
  ${qo}
320
348
  }
321
- }`,variables:{deviceKey:e,deviceKeyType:r}}));return n}addUpdatedListener(e){re(this,ma,"f").push(e)}addAppChangedListener(e){re(this,ha,"f").push(e)}subscribeAgentUpdated(){re(this,le,"f").subscribe({query:I` subscription {
349
+ }`,variables:{deviceKey:e,deviceKeyType:t}}));return n}addUpdatedListener(e){te(this,ma,"f").push(e)}addAppChangedListener(e){te(this,ha,"f").push(e)}subscribeAgentUpdated(){te(this,ue,"f").subscribe({query:I` subscription {
322
350
  agentUpdated { ${ia} }
323
351
  }
324
- `}).subscribe({next:e=>{let r=e.data.agentUpdated;re(this,ma,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}subscribeAppsChanged(){re(this,le,"f").subscribe({query:I` subscription {
352
+ `}).subscribe({next:e=>{let t=e.data.agentUpdated;te(this,ma,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){te(this,ue,"f").subscribe({query:I` subscription {
325
353
  agentAppsChanged {
326
354
  ${Uo}
327
355
  }
328
356
  }
329
- `}).subscribe({next:e=>{re(this,ha,"f").forEach(r=>{r()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){re(this,ga,"f").push(e)}subscribeAgentStatusChanged(){re(this,le,"f").subscribe({query:I` subscription {
357
+ `}).subscribe({next:e=>{te(this,ha,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){te(this,ga,"f").push(e)}subscribeAgentStatusChanged(){te(this,ue,"f").subscribe({query:I` subscription {
330
358
  agentStatusChanged { ${li} }
331
359
  }
332
- `}).subscribe({next:e=>{let r=e.data.agentStatusChanged;re(this,ga,"f").forEach(n=>{n(r)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:r}=k(await re(this,le,"f").mutate({mutation:I`
360
+ `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;te(this,ga,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=k(await te(this,ue,"f").mutate({mutation:I`
333
361
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
334
362
  agentRequestCapability(authInfo: $authInfo)
335
363
  }
336
- `,variables:{authInfo:e}}));return r}async permitCapability(e){let{agentPermitCapability:r}=k(await re(this,le,"f").mutate({mutation:I`
364
+ `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=k(await te(this,ue,"f").mutate({mutation:I`
337
365
  mutation agentPermitCapability($auth: String!) {
338
366
  agentPermitCapability(auth: $auth)
339
367
  }
340
- `,variables:{auth:e}}));return r}async generateJwt(e,r){let{agentGenerateJwt:n}=k(await re(this,le,"f").mutate({mutation:I`
368
+ `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:n}=k(await te(this,ue,"f").mutate({mutation:I`
341
369
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
342
370
  agentGenerateJwt(requestId: $requestId, rand: $rand)
343
371
  }
344
- `,variables:{requestId:e,rand:r}}));return n}async getApps(){let{agentGetApps:e}=k(await re(this,le,"f").mutate({mutation:I`query agentGetApps {
372
+ `,variables:{requestId:e,rand:t}}));return n}async getApps(){let{agentGetApps:e}=k(await te(this,ue,"f").mutate({mutation:I`query agentGetApps {
345
373
  agentGetApps {
346
374
  ${Uo}
347
375
  }
348
- }`}));return e}async removeApp(e){let{agentRemoveApp:r}=k(await re(this,le,"f").mutate({mutation:I`mutation agentRemoveApp($requestId: String!) {
376
+ }`}));return e}async removeApp(e){let{agentRemoveApp:t}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentRemoveApp($requestId: String!) {
349
377
  agentRemoveApp(requestId: $requestId) {
350
378
  ${Uo}
351
379
  }
352
- }`,variables:{requestId:e}}));return r}async revokeToken(e){let{agentRevokeToken:r}=k(await re(this,le,"f").mutate({mutation:I`mutation agentRevokeToken($requestId: String!) {
380
+ }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentRevokeToken($requestId: String!) {
353
381
  agentRevokeToken(requestId: $requestId) {
354
382
  ${Uo}
355
383
  }
356
- }`,variables:{requestId:e}}));return r}async isLocked(){let{agentIsLocked:e}=k(await re(this,le,"f").mutate({mutation:I`
384
+ }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=k(await te(this,ue,"f").mutate({mutation:I`
357
385
  query agentIsLocked {
358
386
  agentIsLocked
359
387
  }
360
- `}));return e}async signMessage(e){let{agentSignMessage:r}=k(await re(this,le,"f").mutate({mutation:I`mutation agentSignMessage($message: String!) {
388
+ `}));return e}async signMessage(e){let{agentSignMessage:t}=k(await te(this,ue,"f").mutate({mutation:I`mutation agentSignMessage($message: String!) {
361
389
  agentSignMessage(message: $message) {
362
390
  ${ky}
363
391
  }
364
- }`,variables:{message:e}}));return r}async createUser(e,r,n){let{runtimeCreateUser:i}=k(await re(this,le,"f").mutate({mutation:I`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
392
+ }`,variables:{message:e}}));return t}async createUser(e,t,n){let{runtimeCreateUser:i}=k(await te(this,ue,"f").mutate({mutation:I`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
365
393
  runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
366
394
  did
367
395
  success
368
396
  error
369
397
  }
370
- }`,variables:{email:e,password:r,appInfo:n}}));return i}async loginUser(e,r){let{runtimeLoginUser:n}=k(await re(this,le,"f").mutate({mutation:I`mutation runtimeLoginUser($email: String!, $password: String!) {
398
+ }`,variables:{email:e,password:t,appInfo:n}}));return i}async loginUser(e,t){let{runtimeLoginUser:n}=k(await te(this,ue,"f").mutate({mutation:I`mutation runtimeLoginUser($email: String!, $password: String!) {
371
399
  runtimeLoginUser(email: $email, password: $password)
372
- }`,variables:{email:e,password:r}}));return n}async requestLoginVerification(e,r){let{runtimeRequestLoginVerification:n}=k(await re(this,le,"f").mutate({mutation:I`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
400
+ }`,variables:{email:e,password:t}}));return n}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:n}=k(await te(this,ue,"f").mutate({mutation:I`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
373
401
  runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
374
402
  success
375
403
  message
376
404
  requiresPassword
377
405
  isExistingUser
378
406
  }
379
- }`,variables:{email:e,appInfo:r}}));return n}async verifyEmailCode(e,r,n){let{runtimeVerifyEmailCode:i}=k(await re(this,le,"f").mutate({mutation:I`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
407
+ }`,variables:{email:e,appInfo:t}}));return n}async verifyEmailCode(e,t,n){let{runtimeVerifyEmailCode:i}=k(await te(this,ue,"f").mutate({mutation:I`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
380
408
  runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
381
- }`,variables:{email:e,code:r,verificationType:n}}));return i}};le=new WeakMap,ha=new WeakMap,ma=new WeakMap,ga=new WeakMap;var Ay=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Cr=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ut,wp=`
409
+ }`,variables:{email:e,code:t,verificationType:n}}));return i}};ue=new WeakMap,ha=new WeakMap,ma=new WeakMap,ga=new WeakMap;var Ay=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Cr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ut,If=`
382
410
  name
383
411
  address
384
412
  settings
385
413
  icon { code }
386
414
  constructorIcon { code }
387
415
  settingsIcon { code }
388
- `,Ep=`
416
+ `,Tf=`
389
417
  name
390
418
  address
391
419
  description
@@ -395,45 +423,45 @@ neighbourhood {
395
423
  templateAppliedParams
396
424
  possibleTemplateParams
397
425
  sourceCodeLink
398
- `,Nu=class{constructor(e){Ut.set(this,void 0),Ay(this,Ut,e,"f")}async byAddress(e){let{language:r}=k(await Cr(this,Ut,"f").query({query:I`query byAddress($address: String!) {
426
+ `,Cu=class{constructor(e){Ut.set(this,void 0),Ay(this,Ut,e,"f")}async byAddress(e){let{language:t}=k(await Cr(this,Ut,"f").query({query:I`query byAddress($address: String!) {
399
427
  language(address: $address) {
400
- ${wp}
428
+ ${If}
401
429
  }
402
- }`,variables:{address:e}}));return r}async byFilter(e){let{languages:r}=k(await Cr(this,Ut,"f").query({query:I`query byFilter($filter: String!) {
430
+ }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=k(await Cr(this,Ut,"f").query({query:I`query byFilter($filter: String!) {
403
431
  languages(filter: $filter) {
404
- ${wp}
432
+ ${If}
405
433
  }
406
- }`,variables:{filter:e}}));return r}async all(){return this.byFilter("")}async writeSettings(e,r){let{languageWriteSettings:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation writeSettings($languageAddress: String!, $settings: String!) {
434
+ }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation writeSettings($languageAddress: String!, $settings: String!) {
407
435
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
408
- }`,variables:{languageAddress:e,settings:r}}));return n}async applyTemplateAndPublish(e,r){let{languageApplyTemplateAndPublish:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languageApplyTemplateAndPublish(
436
+ }`,variables:{languageAddress:e,settings:t}}));return n}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languageApplyTemplateAndPublish(
409
437
  $sourceLanguageHash: String!,
410
438
  $templateData: String!,
411
439
  ) {
412
440
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
413
441
  name, address
414
442
  }
415
- }`,variables:{sourceLanguageHash:e,templateData:r}}));return n}async publish(e,r){let{languagePublish:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languagePublish(
443
+ }`,variables:{sourceLanguageHash:e,templateData:t}}));return n}async publish(e,t){let{languagePublish:n}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languagePublish(
416
444
  $languagePath: String!,
417
445
  $languageMeta: LanguageMetaInput!,
418
446
  ) {
419
447
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
420
- ${Ep}
448
+ ${Tf}
421
449
  }
422
- }`,variables:{languagePath:e,languageMeta:r}}));return n}async meta(e){let{languageMeta:r}=k(await Cr(this,Ut,"f").query({query:I`query languageMeta(
450
+ }`,variables:{languagePath:e,languageMeta:t}}));return n}async meta(e){let{languageMeta:t}=k(await Cr(this,Ut,"f").query({query:I`query languageMeta(
423
451
  $address: String!,
424
452
  ) {
425
453
  languageMeta(address: $address) {
426
- ${Ep}
454
+ ${Tf}
427
455
  }
428
- }`,variables:{address:e}}));return r}async source(e){let{languageSource:r}=k(await Cr(this,Ut,"f").query({query:I`query languageSource(
456
+ }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=k(await Cr(this,Ut,"f").query({query:I`query languageSource(
429
457
  $address: String!,
430
458
  ) {
431
459
  languageSource(address: $address)
432
- }`,variables:{address:e}}));return r}async remove(e){let{languageRemove:r}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languageRemove(
460
+ }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=k(await Cr(this,Ut,"f").mutate({mutation:I`mutation languageRemove(
433
461
  $address: String!,
434
462
  ) {
435
463
  languageRemove(address: $address)
436
- }`,variables:{address:e}}));return r}};Ut=new WeakMap;var Oy=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},tt=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},st,gi,Cu=class{constructor(e){st.set(this,void 0),gi.set(this,new Map),Oy(this,st,e,"f")}async publishFromPerspective(e,r,n){let{neighbourhoodPublishFromPerspective:i}=k(await tt(this,st,"f").mutate({mutation:I`mutation neighbourhoodPublishFromPerspective(
464
+ }`,variables:{address:e}}));return t}};Ut=new WeakMap;var Oy=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},et=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ot,gi,Ru=class{constructor(e){ot.set(this,void 0),gi.set(this,new Map),Oy(this,ot,e,"f")}async publishFromPerspective(e,t,n){let{neighbourhoodPublishFromPerspective:i}=k(await et(this,ot,"f").mutate({mutation:I`mutation neighbourhoodPublishFromPerspective(
437
465
  $linkLanguage: String!,
438
466
  $meta: PerspectiveInput!,
439
467
  $perspectiveUUID: String!
@@ -443,7 +471,7 @@ neighbourhood {
443
471
  meta: $meta,
444
472
  perspectiveUUID: $perspectiveUUID
445
473
  )
446
- }`,variables:{perspectiveUUID:e,linkLanguage:r,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:r}=k(await tt(this,st,"f").mutate({mutation:I`mutation neighbourhoodJoinFromUrl($url: String!) {
474
+ }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=k(await et(this,ot,"f").mutate({mutation:I`mutation neighbourhoodJoinFromUrl($url: String!) {
447
475
  neighbourhoodJoinFromUrl(url: $url) {
448
476
  uuid
449
477
  name
@@ -465,11 +493,11 @@ neighbourhood {
465
493
  author
466
494
  }
467
495
  }
468
- }`,variables:{url:e}}));return r}async otherAgents(e){let{neighbourhoodOtherAgents:r}=k(await tt(this,st,"f").query({query:I`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
496
+ }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=k(await et(this,ot,"f").query({query:I`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
469
497
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
470
- }`,variables:{perspectiveUUID:e}}));return r}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:r}=k(await tt(this,st,"f").query({query:I`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
498
+ }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=k(await et(this,ot,"f").query({query:I`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
471
499
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
472
- }`,variables:{perspectiveUUID:e}}));return r}async onlineAgents(e){let{neighbourhoodOnlineAgents:r}=k(await tt(this,st,"f").query({query:I`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
500
+ }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=k(await et(this,ot,"f").query({query:I`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
473
501
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
474
502
  did
475
503
  status {
@@ -486,7 +514,7 @@ neighbourhood {
486
514
  proof { valid, invalid, signature, key }
487
515
  }
488
516
  }
489
- }`,variables:{perspectiveUUID:e}}));return r}async setOnlineStatus(e,r){let{neighbourhoodSetOnlineStatus:n}=k(await tt(this,st,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatus(
517
+ }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:n}=k(await et(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatus(
490
518
  $perspectiveUUID: String!,
491
519
  $status: PerspectiveInput!
492
520
  ) {
@@ -494,7 +522,7 @@ neighbourhood {
494
522
  perspectiveUUID: $perspectiveUUID,
495
523
  status: $status
496
524
  )
497
- }`,variables:{perspectiveUUID:e,status:r}}));return n}async setOnlineStatusU(e,r){let{neighbourhoodSetOnlineStatusU:n}=k(await tt(this,st,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatusU(
525
+ }`,variables:{perspectiveUUID:e,status:t}}));return n}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:n}=k(await et(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSetOnlineStatusU(
498
526
  $perspectiveUUID: String!,
499
527
  $status: PerspectiveUnsignedInput!
500
528
  ) {
@@ -502,7 +530,7 @@ neighbourhood {
502
530
  perspectiveUUID: $perspectiveUUID,
503
531
  status: $status
504
532
  )
505
- }`,variables:{perspectiveUUID:e,status:r}}));return n}async sendSignal(e,r,n){let{neighbourhoodSendSignal:i}=k(await tt(this,st,"f").mutate({mutation:I`mutation neighbourhoodSendSignal(
533
+ }`,variables:{perspectiveUUID:e,status:t}}));return n}async sendSignal(e,t,n){let{neighbourhoodSendSignal:i}=k(await et(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSendSignal(
506
534
  $perspectiveUUID: String!,
507
535
  $remoteAgentDid: String!,
508
536
  $payload: PerspectiveInput!
@@ -512,7 +540,7 @@ neighbourhood {
512
540
  remoteAgentDid: $remoteAgentDid,
513
541
  payload: $payload
514
542
  )
515
- }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendSignalU(e,r,n){let{neighbourhoodSendSignalU:i}=k(await tt(this,st,"f").mutate({mutation:I`mutation neighbourhoodSendSignalU(
543
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendSignalU(e,t,n){let{neighbourhoodSendSignalU:i}=k(await et(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSendSignalU(
516
544
  $perspectiveUUID: String!,
517
545
  $remoteAgentDid: String!,
518
546
  $payload: PerspectiveUnsignedInput!
@@ -522,7 +550,7 @@ neighbourhood {
522
550
  remoteAgentDid: $remoteAgentDid,
523
551
  payload: $payload
524
552
  )
525
- }`,variables:{perspectiveUUID:e,remoteAgentDid:r,payload:n}}));return i}async sendBroadcast(e,r,n=!1){let{neighbourhoodSendBroadcast:i}=k(await tt(this,st,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcast(
553
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendBroadcast(e,t,n=!1){let{neighbourhoodSendBroadcast:i}=k(await et(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcast(
526
554
  $perspectiveUUID: String!,
527
555
  $payload: PerspectiveInput!,
528
556
  $loopback: Boolean
@@ -532,7 +560,7 @@ neighbourhood {
532
560
  payload: $payload,
533
561
  loopback: $loopback
534
562
  )
535
- }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}async sendBroadcastU(e,r,n=!1){let{neighbourhoodSendBroadcastU:i}=k(await tt(this,st,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcastU(
563
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}async sendBroadcastU(e,t,n=!1){let{neighbourhoodSendBroadcastU:i}=k(await et(this,ot,"f").mutate({mutation:I`mutation neighbourhoodSendBroadcastU(
536
564
  $perspectiveUUID: String!,
537
565
  $payload: PerspectiveUnsignedInput!,
538
566
  $loopback: Boolean
@@ -542,7 +570,7 @@ neighbourhood {
542
570
  payload: $payload,
543
571
  loopback: $loopback
544
572
  )
545
- }`,variables:{perspectiveUUID:e,payload:r,loopback:n}}));return i}dispatchSignal(e,r){let n=tt(this,gi,"f").get(e);n&&n.forEach(i=>i(r))}async subscribeToSignals(e){let r=this;await tt(this,st,"f").subscribe({query:I`subscription neighbourhoodSignal($perspectiveUUID: String!) {
573
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}dispatchSignal(e,t){let n=et(this,gi,"f").get(e);n&&n.forEach(i=>i(t))}async subscribeToSignals(e){let t=this;await et(this,ot,"f").subscribe({query:I`subscription neighbourhoodSignal($perspectiveUUID: String!) {
546
574
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
547
575
  author
548
576
  timestamp
@@ -557,7 +585,7 @@ neighbourhood {
557
585
  }
558
586
  proof { valid, invalid, signature, key }
559
587
  }
560
- }`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{let{neighbourhoodSignal:i}=k(n);r.dispatchSignal(e,i)}})}async addSignalHandler(e,r){let n=tt(this,gi,"f").get(e);n||(n=[],tt(this,gi,"f").set(e,n),await this.subscribeToSignals(e)),n.push(r)}removeSignalHandler(e,r){let n=tt(this,gi,"f").get(e);if(n){let i=n.indexOf(r);i>-1&&n.splice(i,1)}}};st=new WeakMap,gi=new WeakMap;var Bo=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Q=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},G,ya,va,ba,qd,Vo=`
588
+ }`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{let{neighbourhoodSignal:i}=k(n);t.dispatchSignal(e,i)}})}async addSignalHandler(e,t){let n=et(this,gi,"f").get(e);n||(n=[],et(this,gi,"f").set(e,n),await this.subscribeToSignals(e)),n.push(t)}removeSignalHandler(e,t){let n=et(this,gi,"f").get(e);if(n){let i=n.indexOf(t);i>-1&&n.splice(i,1)}}};ot=new WeakMap,gi=new WeakMap;var Bo=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},V=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},W,ya,va,ba,Qd,Vo=`
561
589
  author
562
590
  timestamp
563
591
  data {
@@ -569,7 +597,7 @@ data {
569
597
  }
570
598
  }
571
599
  proof { valid, invalid, signature, key }
572
- `,Dy=`
600
+ `,Ny=`
573
601
  description
574
602
  appName
575
603
  appUrl
@@ -578,72 +606,72 @@ trigger
578
606
  perspectiveIds
579
607
  webhookUrl
580
608
  webhookAuth
581
- `,Bd=`
609
+ `,zd=`
582
610
  id
583
611
  granted
584
- ${Dy}
585
- `,Ny=`
586
- notification { ${Bd} }
612
+ ${Ny}
613
+ `,Dy=`
614
+ notification { ${zd} }
587
615
  perspectiveId
588
616
  triggerMatch
589
- `,Ru=class{constructor(e,r=!0){G.set(this,void 0),ya.set(this,void 0),va.set(this,void 0),ba.set(this,void 0),qd.set(this,void 0),Bo(this,G,e,"f"),Bo(this,ya,[],"f"),Bo(this,va,[],"f"),Bo(this,ba,[],"f"),r&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await Q(this,G,"f").query({query:I`query runtimeInfo {
617
+ `,Pu=class{constructor(e,t=!0){W.set(this,void 0),ya.set(this,void 0),va.set(this,void 0),ba.set(this,void 0),Qd.set(this,void 0),Bo(this,W,e,"f"),Bo(this,ya,[],"f"),Bo(this,va,[],"f"),Bo(this,ba,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=k(await V(this,W,"f").query({query:I`query runtimeInfo {
590
618
  runtimeInfo {
591
619
  ad4mExecutorVersion,
592
620
  isInitialized,
593
621
  isUnlocked
594
622
  }
595
- }`}));return e}async quit(){return k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeOpenLink($url: String!) {
623
+ }`}));return e}async quit(){return k(await V(this,W,"f").mutate({mutation:I`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeOpenLink($url: String!) {
596
624
  runtimeOpenLink(url: $url)
597
- }`,variables:{url:e}}));return r}async addTrustedAgents(e){let{addTrustedAgents:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation addTrustedAgents($agents: [String!]!) {
625
+ }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=k(await V(this,W,"f").mutate({mutation:I`mutation addTrustedAgents($agents: [String!]!) {
598
626
  addTrustedAgents(agents: $agents)
599
- }`,variables:{agents:e}}));return r}async deleteTrustedAgents(e){let{deleteTrustedAgents:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation deleteTrustedAgents($agents: [String!]!) {
627
+ }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=k(await V(this,W,"f").mutate({mutation:I`mutation deleteTrustedAgents($agents: [String!]!) {
600
628
  deleteTrustedAgents(agents: $agents)
601
- }`,variables:{agents:e}}));return r}async getTrustedAgents(){let{getTrustedAgents:e}=k(await Q(this,G,"f").query({query:I`query getTrustedAgents {
629
+ }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=k(await V(this,W,"f").query({query:I`query getTrustedAgents {
602
630
  getTrustedAgents
603
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
631
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
604
632
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
605
- }`,variables:{addresses:e}}));return r}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
633
+ }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
606
634
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
607
- }`,variables:{addresses:e}}));return r}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await Q(this,G,"f").query({query:I`query runtimeKnownLinkLanguageTemplates {
635
+ }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=k(await V(this,W,"f").query({query:I`query runtimeKnownLinkLanguageTemplates {
608
636
  runtimeKnownLinkLanguageTemplates
609
- }`}));return e}async addFriends(e){let{runtimeAddFriends:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeAddFriends($dids: [String!]!) {
637
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeAddFriends($dids: [String!]!) {
610
638
  runtimeAddFriends(dids: $dids)
611
- }`,variables:{dids:e}}));return r}async removeFriends(e){let{runtimeRemoveFriends:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeRemoveFriends($dids: [String!]!) {
639
+ }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeRemoveFriends($dids: [String!]!) {
612
640
  runtimeRemoveFriends(dids: $dids)
613
- }`,variables:{dids:e}}));return r}async friends(){let{runtimeFriends:e}=k(await Q(this,G,"f").query({query:I`query runtimeFriends {
641
+ }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=k(await V(this,W,"f").query({query:I`query runtimeFriends {
614
642
  runtimeFriends
615
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await Q(this,G,"f").query({query:I`query runtimeHcAgentInfos {
643
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=k(await V(this,W,"f").query({query:I`query runtimeHcAgentInfos {
616
644
  runtimeHcAgentInfos
617
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await Q(this,G,"f").query({query:I`query runtimeGetNetworkMetrics {
645
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=k(await V(this,W,"f").query({query:I`query runtimeGetNetworkMetrics {
618
646
  runtimeGetNetworkMetrics
619
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeRestartHolochain {
647
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeRestartHolochain {
620
648
  runtimeRestartHolochain
621
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
649
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
622
650
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
623
- }`,variables:{agentInfos:e}}));return r}async verifyStringSignedByDid(e,r,n,i){let{runtimeVerifyStringSignedByDid:a}=k(await Q(this,G,"f").mutate({mutation:I`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
651
+ }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,n,i){let{runtimeVerifyStringSignedByDid:a}=k(await V(this,W,"f").mutate({mutation:I`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
624
652
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
625
- }`,variables:{did:e,didSigningKeyId:r,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeSetStatus($status: PerspectiveInput!) {
653
+ }`,variables:{did:e,didSigningKeyId:t,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeSetStatus($status: PerspectiveInput!) {
626
654
  runtimeSetStatus(status: $status)
627
- }`,variables:{status:e}}));return r}async friendStatus(e){let{runtimeFriendStatus:r}=k(await Q(this,G,"f").query({query:I`query runtimeFriendStatus($did: String!) {
655
+ }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=k(await V(this,W,"f").query({query:I`query runtimeFriendStatus($did: String!) {
628
656
  runtimeFriendStatus(did: $did) { ${Vo} }
629
- }`,variables:{did:e}}));return r}async friendSendMessage(e,r){let{runtimeFriendSendMessage:n}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
657
+ }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:n}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
630
658
  runtimeFriendSendMessage(did: $did, message: $message)
631
- }`,variables:{did:e,message:r}}));return n}async messageInbox(e){let{runtimeMessageInbox:r}=k(await Q(this,G,"f").query({query:I`query runtimeMessageInbox($filter: String) {
659
+ }`,variables:{did:e,message:t}}));return n}async messageInbox(e){let{runtimeMessageInbox:t}=k(await V(this,W,"f").query({query:I`query runtimeMessageInbox($filter: String) {
632
660
  runtimeMessageInbox(filter: $filter) { ${Vo} }
633
- }`,variables:{filter:e}}));return r}async messageOutbox(e){let{runtimeMessageOutbox:r}=k(await Q(this,G,"f").query({query:I`query runtimeMessageOutbox($filter: String) {
661
+ }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=k(await V(this,W,"f").query({query:I`query runtimeMessageOutbox($filter: String) {
634
662
  runtimeMessageOutbox(filter: $filter) {
635
663
  recipient,
636
664
  message {
637
665
  ${Vo}
638
666
  }
639
667
  }
640
- }`,variables:{filter:e}}));return r}async requestInstallNotification(e){let{runtimeRequestInstallNotification:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
668
+ }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
641
669
  runtimeRequestInstallNotification(notification: $notification)
642
- }`,variables:{notification:e}}));return r}async grantNotification(e){let{runtimeGrantNotification:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeGrantNotification($id: String!) {
670
+ }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeGrantNotification($id: String!) {
643
671
  runtimeGrantNotification(id: $id)
644
- }`,variables:{id:e}}));return r}async exportDb(e){let{runtimeExportDb:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeExportDb($filePath: String!) {
672
+ }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeExportDb($filePath: String!) {
645
673
  runtimeExportDb(filePath: $filePath)
646
- }`,variables:{filePath:e}}));return r}async importDb(e){let{runtimeImportDb:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeImportDb($filePath: String!) {
674
+ }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeImportDb($filePath: String!) {
647
675
  runtimeImportDb(filePath: $filePath) {
648
676
  perspectives { total imported failed omitted errors }
649
677
  links { total imported failed omitted errors }
@@ -657,51 +685,51 @@ triggerMatch
657
685
  trustedAgents { total imported failed omitted errors }
658
686
  knownLinkLanguages { total imported failed omitted errors }
659
687
  }
660
- }`,variables:{filePath:e}}));return r}async notifications(){let{runtimeNotifications:e}=k(await Q(this,G,"f").query({query:I`query runtimeNotifications {
661
- runtimeNotifications { ${Bd} }
662
- }`}));return e}async updateNotification(e,r){let{runtimeUpdateNotification:n}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
688
+ }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=k(await V(this,W,"f").query({query:I`query runtimeNotifications {
689
+ runtimeNotifications { ${zd} }
690
+ }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:n}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
663
691
  runtimeUpdateNotification(id: $id, notification: $notification)
664
- }`,variables:{id:e,notification:r}}));return n}async removeNotification(e){let{runtimeRemoveNotification:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeRemoveNotification($id: String!) {
692
+ }`,variables:{id:e,notification:t}}));return n}async removeNotification(e){let{runtimeRemoveNotification:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeRemoveNotification($id: String!) {
665
693
  runtimeRemoveNotification(id: $id)
666
- }`,variables:{id:e}}));return r}async exportPerspective(e,r){let{runtimeExportPerspective:n}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
694
+ }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:n}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
667
695
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
668
- }`,variables:{perspectiveUuid:e,filePath:r}}));return n}async importPerspective(e){let{runtimeImportPerspective:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeImportPerspective($filePath: String!) {
696
+ }`,variables:{perspectiveUuid:e,filePath:t}}));return n}async importPerspective(e){let{runtimeImportPerspective:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeImportPerspective($filePath: String!) {
669
697
  runtimeImportPerspective(filePath: $filePath)
670
- }`,variables:{filePath:e}}));return r}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await Q(this,G,"f").query({query:I`query runtimeMultiUserEnabled {
698
+ }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=k(await V(this,W,"f").query({query:I`query runtimeMultiUserEnabled {
671
699
  runtimeMultiUserEnabled
672
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
700
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
673
701
  runtimeSetMultiUserEnabled(enabled: $enabled)
674
- }`,variables:{enabled:e}}));return r}async listUsers(){let{runtimeListUsers:e}=k(await Q(this,G,"f").query({query:I`query runtimeListUsers {
702
+ }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=k(await V(this,W,"f").query({query:I`query runtimeListUsers {
675
703
  runtimeListUsers {
676
704
  email
677
705
  did
678
706
  lastSeen
679
707
  perspectiveCount
680
708
  }
681
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeEmailTestModeEnable {
709
+ }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestModeEnable {
682
710
  runtimeEmailTestModeEnable
683
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeEmailTestModeDisable {
711
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestModeDisable {
684
712
  runtimeEmailTestModeDisable
685
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:r}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeEmailTestGetCode($email: String!) {
713
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestGetCode($email: String!) {
686
714
  runtimeEmailTestGetCode(email: $email)
687
- }`,variables:{email:e}}));return r}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeEmailTestClearCodes {
715
+ }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestClearCodes {
688
716
  runtimeEmailTestClearCodes
689
- }`}));return e}async emailTestSetExpiry(e,r,n){let{runtimeEmailTestSetExpiry:i}=k(await Q(this,G,"f").mutate({mutation:I`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
717
+ }`}));return e}async emailTestSetExpiry(e,t,n){let{runtimeEmailTestSetExpiry:i}=k(await V(this,W,"f").mutate({mutation:I`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
690
718
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
691
- }`,variables:{email:e,verificationType:r,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){Q(this,ba,"f").push(e)}subscribeNotificationTriggered(){Q(this,G,"f").subscribe({query:I` subscription {
692
- runtimeNotificationTriggered { ${Ny} }
719
+ }`,variables:{email:e,verificationType:t,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){V(this,ba,"f").push(e)}subscribeNotificationTriggered(){V(this,W,"f").subscribe({query:I` subscription {
720
+ runtimeNotificationTriggered { ${Dy} }
693
721
  }
694
- `}).subscribe({next:e=>{Q(this,ba,"f").forEach(r=>{r(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){Q(this,ya,"f").push(e)}subscribeMessageReceived(){Q(this,G,"f").subscribe({query:I` subscription {
722
+ `}).subscribe({next:e=>{V(this,ba,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){V(this,ya,"f").push(e)}subscribeMessageReceived(){V(this,W,"f").subscribe({query:I` subscription {
695
723
  runtimeMessageReceived { ${Vo} }
696
724
  }
697
- `}).subscribe({next:e=>{Q(this,ya,"f").forEach(r=>{r(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){Q(this,va,"f").push(e)}subscribeExceptionOccurred(){Q(this,G,"f").subscribe({query:I` subscription {
725
+ `}).subscribe({next:e=>{V(this,ya,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){V(this,va,"f").push(e)}subscribeExceptionOccurred(){V(this,W,"f").subscribe({query:I` subscription {
698
726
  exceptionOccurred {
699
727
  title
700
728
  message
701
729
  type
702
730
  addon
703
731
  }
704
- }`}).subscribe({next:e=>{Q(this,va,"f").forEach(r=>{r(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};G=new WeakMap,ya=new WeakMap,va=new WeakMap,ba=new WeakMap,qd=new WeakMap;var Cy=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},fi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},mr,Pu=class{constructor(e){mr.set(this,void 0),Cy(this,mr,e,"f")}async get(e,r=!1){if(!r)try{let i=Ze.fromUrl(e).get();if(typeof i=="object"&&i!==null&&"author"in i&&"timestamp"in i&&"data"in i&&"proof"in i)return i}catch{}let{expression:n}=k(await fi(this,mr,"f").query({query:I`query expression($url: String!) {
732
+ }`}).subscribe({next:e=>{V(this,va,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};W=new WeakMap,ya=new WeakMap,va=new WeakMap,ba=new WeakMap,Qd=new WeakMap;var Cy=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},pi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},mr,Lu=class{constructor(e){mr.set(this,void 0),Cy(this,mr,e,"f")}async get(e,t=!1){if(!t)try{let i=ye.fromUrl(e).get();if(typeof i=="object"&&i!==null&&"author"in i&&"timestamp"in i&&"data"in i&&"proof"in i)return i}catch{}let{expression:n}=k(await pi(this,mr,"f").query({query:I`query expression($url: String!) {
705
733
  expression(url: $url) {
706
734
  author
707
735
  timestamp
@@ -714,7 +742,7 @@ triggerMatch
714
742
  invalid
715
743
  }
716
744
  }
717
- }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:r}=k(await fi(this,mr,"f").query({query:I`query expressionMany($urls: [String!]!) {
745
+ }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:t}=k(await pi(this,mr,"f").query({query:I`query expressionMany($urls: [String!]!) {
718
746
  expressionMany(urls: $urls) {
719
747
  author
720
748
  timestamp
@@ -727,19 +755,19 @@ triggerMatch
727
755
  invalid
728
756
  }
729
757
  }
730
- }`,variables:{urls:e}}));return r}async getRaw(e){let{expressionRaw:r}=k(await fi(this,mr,"f").query({query:I`query expressionRaw($url: String!) {
758
+ }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=k(await pi(this,mr,"f").query({query:I`query expressionRaw($url: String!) {
731
759
  expressionRaw(url: $url)
732
- }`,variables:{url:e}}));return r}async create(e,r){e=JSON.stringify(e);let{expressionCreate:n}=k(await fi(this,mr,"f").mutate({mutation:I`mutation expressionCreate($content: String!, $languageAddress: String!){
760
+ }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:n}=k(await pi(this,mr,"f").mutate({mutation:I`mutation expressionCreate($content: String!, $languageAddress: String!){
733
761
  expressionCreate(content: $content, languageAddress: $languageAddress)
734
- }`,variables:{content:e,languageAddress:r}}));return n}async interactions(e){let{expressionInteractions:r}=k(await fi(this,mr,"f").query({query:I`query expressionInteractions($url: String!) {
762
+ }`,variables:{content:e,languageAddress:t}}));return n}async interactions(e){let{expressionInteractions:t}=k(await pi(this,mr,"f").query({query:I`query expressionInteractions($url: String!) {
735
763
  expressionInteractions(url: $url) {
736
764
  label
737
765
  name
738
766
  parameters { name, type }
739
767
  }
740
- }`,variables:{url:e}}));return r}async interact(e,r){let{expressionInteract:n}=k(await fi(this,mr,"f").mutate({mutation:I`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
768
+ }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:n}=k(await pi(this,mr,"f").mutate({mutation:I`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
741
769
  expressionInteract(url: $url, interactionCall: $interactionCall)
742
- }`,variables:{url:e,interactionCall:r}}));return n}};mr=new WeakMap;var js={};js.byteLength=Py;js.toByteArray=Ly;js.fromByteArray=jy;var Zt=[],Dt=[],Ry=typeof Uint8Array<"u"?Uint8Array:Array,su="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(ln=0,xp=su.length;ln<xp;++ln)Zt[ln]=su[ln],Dt[su.charCodeAt(ln)]=ln;var ln,xp;Dt["-".charCodeAt(0)]=62;Dt["_".charCodeAt(0)]=63;function Vd(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");r===-1&&(r=e);var n=r===e?0:4-r%4;return[r,n]}function Py(t){var e=Vd(t),r=e[0],n=e[1];return(r+n)*3/4-n}function Fy(t,e,r){return(e+r)*3/4-r}function Ly(t){var e,r=Vd(t),n=r[0],i=r[1],a=new Ry(Fy(t,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=Dt[t.charCodeAt(c)]<<18|Dt[t.charCodeAt(c+1)]<<12|Dt[t.charCodeAt(c+2)]<<6|Dt[t.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Dt[t.charCodeAt(c)]<<2|Dt[t.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=Dt[t.charCodeAt(c)]<<10|Dt[t.charCodeAt(c+1)]<<4|Dt[t.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function $y(t){return Zt[t>>18&63]+Zt[t>>12&63]+Zt[t>>6&63]+Zt[t&63]}function My(t,e,r){for(var n,i=[],a=e;a<r;a+=3)n=(t[a]<<16&16711680)+(t[a+1]<<8&65280)+(t[a+2]&255),i.push($y(n));return i.join("")}function jy(t){for(var e,r=t.length,n=r%3,i=[],a=16383,o=0,s=r-n;o<s;o+=a)i.push(My(t,o,o+a>s?s:o+a));return n===1?(e=t[r-1],i.push(Zt[e>>2]+Zt[e<<4&63]+"==")):n===2&&(e=(t[r-2]<<8)+t[r-1],i.push(Zt[e>>10]+Zt[e>>4&63]+Zt[e<<2&63]+"=")),i.join("")}var Uy=4,Tp=0,Ip=1,qy=2;function Ci(t){let e=t.length;for(;--e>=0;)t[e]=0}var By=0,Qd=1,Vy=2,Qy=3,zy=258,el=29,za=256,Ra=za+1+el,_i=30,tl=19,zd=2*Ra+1,Sn=15,cu=16,Wy=7,rl=256,Wd=16,Gd=17,Kd=18,Fu=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]),ss=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]),Gy=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Hd=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ky=512,gr=new Array((Ra+2)*2);Ci(gr);var Ia=new Array(_i*2);Ci(Ia);var Pa=new Array(Ky);Ci(Pa);var Fa=new Array(zy-Qy+1);Ci(Fa);var nl=new Array(el);Ci(nl);var ks=new Array(_i);Ci(ks);function uu(t,e,r,n,i){this.static_tree=t,this.extra_bits=e,this.extra_base=r,this.elems=n,this.max_length=i,this.has_stree=t&&t.length}var Jd,Yd,Zd;function lu(t,e){this.dyn_tree=t,this.max_code=0,this.stat_desc=e}var Xd=t=>t<256?Pa[t]:Pa[256+(t>>>7)],La=(t,e)=>{t.pending_buf[t.pending++]=e&255,t.pending_buf[t.pending++]=e>>>8&255},mt=(t,e,r)=>{t.bi_valid>cu-r?(t.bi_buf|=e<<t.bi_valid&65535,La(t,t.bi_buf),t.bi_buf=e>>cu-t.bi_valid,t.bi_valid+=r-cu):(t.bi_buf|=e<<t.bi_valid&65535,t.bi_valid+=r)},Xt=(t,e,r)=>{mt(t,r[e*2],r[e*2+1])},eh=(t,e)=>{let r=0;do r|=t&1,t>>>=1,r<<=1;while(--e>0);return r>>>1},Hy=t=>{t.bi_valid===16?(La(t,t.bi_buf),t.bi_buf=0,t.bi_valid=0):t.bi_valid>=8&&(t.pending_buf[t.pending++]=t.bi_buf&255,t.bi_buf>>=8,t.bi_valid-=8)},Jy=(t,e)=>{let r=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,d,p,f,h,m=0;for(p=0;p<=Sn;p++)t.bl_count[p]=0;for(r[t.heap[t.heap_max]*2+1]=0,u=t.heap_max+1;u<zd;u++)l=t.heap[u],p=r[r[l*2+1]*2+1]+1,p>c&&(p=c,m++),r[l*2+1]=p,!(l>n)&&(t.bl_count[p]++,f=0,l>=s&&(f=o[l-s]),h=r[l*2],t.opt_len+=h*(p+f),a&&(t.static_len+=h*(i[l*2+1]+f)));if(m!==0){do{for(p=c-1;t.bl_count[p]===0;)p--;t.bl_count[p]--,t.bl_count[p+1]+=2,t.bl_count[c]--,m-=2}while(m>0);for(p=c;p!==0;p--)for(l=t.bl_count[p];l!==0;)d=t.heap[--u],!(d>n)&&(r[d*2+1]!==p&&(t.opt_len+=(p-r[d*2+1])*r[d*2],r[d*2+1]=p),l--)}},th=(t,e,r)=>{let n=new Array(Sn+1),i=0,a,o;for(a=1;a<=Sn;a++)i=i+r[a-1]<<1,n[a]=i;for(o=0;o<=e;o++){let s=t[o*2+1];s!==0&&(t[o*2]=eh(n[s]++,s))}},Yy=()=>{let t,e,r,n,i,a=new Array(Sn+1);for(r=0,n=0;n<el-1;n++)for(nl[n]=r,t=0;t<1<<Fu[n];t++)Fa[r++]=n;for(Fa[r-1]=n,i=0,n=0;n<16;n++)for(ks[n]=i,t=0;t<1<<ss[n];t++)Pa[i++]=n;for(i>>=7;n<_i;n++)for(ks[n]=i<<7,t=0;t<1<<ss[n]-7;t++)Pa[256+i++]=n;for(e=0;e<=Sn;e++)a[e]=0;for(t=0;t<=143;)gr[t*2+1]=8,t++,a[8]++;for(;t<=255;)gr[t*2+1]=9,t++,a[9]++;for(;t<=279;)gr[t*2+1]=7,t++,a[7]++;for(;t<=287;)gr[t*2+1]=8,t++,a[8]++;for(th(gr,Ra+1,a),t=0;t<_i;t++)Ia[t*2+1]=5,Ia[t*2]=eh(t,5);Jd=new uu(gr,Fu,za+1,Ra,Sn),Yd=new uu(Ia,ss,0,_i,Sn),Zd=new uu(new Array(0),Gy,0,tl,Wy)},rh=t=>{let e;for(e=0;e<Ra;e++)t.dyn_ltree[e*2]=0;for(e=0;e<_i;e++)t.dyn_dtree[e*2]=0;for(e=0;e<tl;e++)t.bl_tree[e*2]=0;t.dyn_ltree[rl*2]=1,t.opt_len=t.static_len=0,t.sym_next=t.matches=0},nh=t=>{t.bi_valid>8?La(t,t.bi_buf):t.bi_valid>0&&(t.pending_buf[t.pending++]=t.bi_buf),t.bi_buf=0,t.bi_valid=0},kp=(t,e,r,n)=>{let i=e*2,a=r*2;return t[i]<t[a]||t[i]===t[a]&&n[e]<=n[r]},fu=(t,e,r)=>{let n=t.heap[r],i=r<<1;for(;i<=t.heap_len&&(i<t.heap_len&&kp(e,t.heap[i+1],t.heap[i],t.depth)&&i++,!kp(e,n,t.heap[i],t.depth));)t.heap[r]=t.heap[i],r=i,i<<=1;t.heap[r]=n},Ap=(t,e,r)=>{let n,i,a=0,o,s;if(t.sym_next!==0)do n=t.pending_buf[t.sym_buf+a++]&255,n+=(t.pending_buf[t.sym_buf+a++]&255)<<8,i=t.pending_buf[t.sym_buf+a++],n===0?Xt(t,i,e):(o=Fa[i],Xt(t,o+za+1,e),s=Fu[o],s!==0&&(i-=nl[o],mt(t,i,s)),n--,o=Xd(n),Xt(t,o,r),s=ss[o],s!==0&&(n-=ks[o],mt(t,n,s)));while(a<t.sym_next);Xt(t,rl,e)},Lu=(t,e)=>{let r=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,u;for(t.heap_len=0,t.heap_max=zd,o=0;o<a;o++)r[o*2]!==0?(t.heap[++t.heap_len]=c=o,t.depth[o]=0):r[o*2+1]=0;for(;t.heap_len<2;)u=t.heap[++t.heap_len]=c<2?++c:0,r[u*2]=1,t.depth[u]=0,t.opt_len--,i&&(t.static_len-=n[u*2+1]);for(e.max_code=c,o=t.heap_len>>1;o>=1;o--)fu(t,r,o);u=a;do o=t.heap[1],t.heap[1]=t.heap[t.heap_len--],fu(t,r,1),s=t.heap[1],t.heap[--t.heap_max]=o,t.heap[--t.heap_max]=s,r[u*2]=r[o*2]+r[s*2],t.depth[u]=(t.depth[o]>=t.depth[s]?t.depth[o]:t.depth[s])+1,r[o*2+1]=r[s*2+1]=u,t.heap[1]=u++,fu(t,r,1);while(t.heap_len>=2);t.heap[--t.heap_max]=t.heap[1],Jy(t,e),th(r,c,t.bl_count)},Op=(t,e,r)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(r+1)*2+1]=65535,n=0;n<=r;n++)a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)&&(s<u?t.bl_tree[a*2]+=s:a!==0?(a!==i&&t.bl_tree[a*2]++,t.bl_tree[Wd*2]++):s<=10?t.bl_tree[Gd*2]++:t.bl_tree[Kd*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},Dp=(t,e,r)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),n=0;n<=r;n++)if(a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)){if(s<u)do Xt(t,a,t.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Xt(t,a,t.bl_tree),s--),Xt(t,Wd,t.bl_tree),mt(t,s-3,2)):s<=10?(Xt(t,Gd,t.bl_tree),mt(t,s-3,3)):(Xt(t,Kd,t.bl_tree),mt(t,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Zy=t=>{let e;for(Op(t,t.dyn_ltree,t.l_desc.max_code),Op(t,t.dyn_dtree,t.d_desc.max_code),Lu(t,t.bl_desc),e=tl-1;e>=3&&t.bl_tree[Hd[e]*2+1]===0;e--);return t.opt_len+=3*(e+1)+5+5+4,e},Xy=(t,e,r,n)=>{let i;for(mt(t,e-257,5),mt(t,r-1,5),mt(t,n-4,4),i=0;i<n;i++)mt(t,t.bl_tree[Hd[i]*2+1],3);Dp(t,t.dyn_ltree,e-1),Dp(t,t.dyn_dtree,r-1)},ev=t=>{let e=4093624447,r;for(r=0;r<=31;r++,e>>>=1)if(e&1&&t.dyn_ltree[r*2]!==0)return Tp;if(t.dyn_ltree[9*2]!==0||t.dyn_ltree[10*2]!==0||t.dyn_ltree[13*2]!==0)return Ip;for(r=32;r<za;r++)if(t.dyn_ltree[r*2]!==0)return Ip;return Tp},Np=!1,tv=t=>{Np||(Yy(),Np=!0),t.l_desc=new lu(t.dyn_ltree,Jd),t.d_desc=new lu(t.dyn_dtree,Yd),t.bl_desc=new lu(t.bl_tree,Zd),t.bi_buf=0,t.bi_valid=0,rh(t)},ih=(t,e,r,n)=>{mt(t,(By<<1)+(n?1:0),3),nh(t),La(t,r),La(t,~r),r&&t.pending_buf.set(t.window.subarray(e,e+r),t.pending),t.pending+=r},rv=t=>{mt(t,Qd<<1,3),Xt(t,rl,gr),Hy(t)},nv=(t,e,r,n)=>{let i,a,o=0;t.level>0?(t.strm.data_type===qy&&(t.strm.data_type=ev(t)),Lu(t,t.l_desc),Lu(t,t.d_desc),o=Zy(t),i=t.opt_len+3+7>>>3,a=t.static_len+3+7>>>3,a<=i&&(i=a)):i=a=r+5,r+4<=i&&e!==-1?ih(t,e,r,n):t.strategy===Uy||a===i?(mt(t,(Qd<<1)+(n?1:0),3),Ap(t,gr,Ia)):(mt(t,(Vy<<1)+(n?1:0),3),Xy(t,t.l_desc.max_code+1,t.d_desc.max_code+1,o+1),Ap(t,t.dyn_ltree,t.dyn_dtree)),rh(t),n&&nh(t)},iv=(t,e,r)=>(t.pending_buf[t.sym_buf+t.sym_next++]=e,t.pending_buf[t.sym_buf+t.sym_next++]=e>>8,t.pending_buf[t.sym_buf+t.sym_next++]=r,e===0?t.dyn_ltree[r*2]++:(t.matches++,e--,t.dyn_ltree[(Fa[r]+za+1)*2]++,t.dyn_dtree[Xd(e)*2]++),t.sym_next===t.sym_end),av=tv,ov=ih,sv=nv,cv=iv,uv=rv,lv={_tr_init:av,_tr_stored_block:ov,_tr_flush_block:sv,_tr_tally:cv,_tr_align:uv},fv=(t,e,r,n)=>{let i=t&65535|0,a=t>>>16&65535|0,o=0;for(;r!==0;){o=r>2e3?2e3:r,r-=o;do i=i+e[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},$a=fv,pv=()=>{let t,e=[];for(var r=0;r<256;r++){t=r;for(var n=0;n<8;n++)t=t&1?3988292384^t>>>1:t>>>1;e[r]=t}return e},dv=new Uint32Array(pv()),hv=(t,e,r,n)=>{let i=dv,a=n+r;t^=-1;for(let o=n;o<a;o++)t=t>>>8^i[(t^e[o])&255];return t^-1},Ve=hv,Cn={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"},qn={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:mv,_tr_stored_block:$u,_tr_flush_block:gv,_tr_tally:qr,_tr_align:yv}=lv,{Z_NO_FLUSH:Br,Z_PARTIAL_FLUSH:vv,Z_FULL_FLUSH:bv,Z_FINISH:Ct,Z_BLOCK:Cp,Z_OK:Je,Z_STREAM_END:Rp,Z_STREAM_ERROR:tr,Z_DATA_ERROR:_v,Z_BUF_ERROR:pu,Z_DEFAULT_COMPRESSION:Sv,Z_FILTERED:wv,Z_HUFFMAN_ONLY:Qo,Z_RLE:Ev,Z_FIXED:xv,Z_DEFAULT_STRATEGY:Tv,Z_UNKNOWN:Iv,Z_DEFLATED:Us}=qn,kv=9,Av=15,Ov=8,Dv=29,Nv=256,Mu=Nv+1+Dv,Cv=30,Rv=19,Pv=2*Mu+1,Fv=15,ae=3,$r=258,rr=$r+ae+1,Lv=32,xi=42,il=57,ju=69,Uu=73,qu=91,Bu=103,wn=113,_a=666,ct=1,Ri=2,Rn=3,Pi=4,$v=3,En=(t,e)=>(t.msg=Cn[e],e),Pp=t=>t*2-(t>4?9:0),Lr=t=>{let e=t.length;for(;--e>=0;)t[e]=0},Mv=t=>{let e,r,n,i=t.w_size;e=t.hash_size,n=e;do r=t.head[--n],t.head[n]=r>=i?r-i:0;while(--e);e=i,n=e;do r=t.prev[--n],t.prev[n]=r>=i?r-i:0;while(--e)},jv=(t,e,r)=>(e<<t.hash_shift^r)&t.hash_mask,Vr=jv,bt=t=>{let e=t.state,r=e.pending;r>t.avail_out&&(r=t.avail_out),r!==0&&(t.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+r),t.next_out),t.next_out+=r,e.pending_out+=r,t.total_out+=r,t.avail_out-=r,e.pending-=r,e.pending===0&&(e.pending_out=0))},St=(t,e)=>{gv(t,t.block_start>=0?t.block_start:-1,t.strstart-t.block_start,e),t.block_start=t.strstart,bt(t.strm)},de=(t,e)=>{t.pending_buf[t.pending++]=e},aa=(t,e)=>{t.pending_buf[t.pending++]=e>>>8&255,t.pending_buf[t.pending++]=e&255},Vu=(t,e,r,n)=>{let i=t.avail_in;return i>n&&(i=n),i===0?0:(t.avail_in-=i,e.set(t.input.subarray(t.next_in,t.next_in+i),r),t.state.wrap===1?t.adler=$a(t.adler,e,i,r):t.state.wrap===2&&(t.adler=Ve(t.adler,e,i,r)),t.next_in+=i,t.total_in+=i,i)},ah=(t,e)=>{let r=t.max_chain_length,n=t.strstart,i,a,o=t.prev_length,s=t.nice_match,c=t.strstart>t.w_size-rr?t.strstart-(t.w_size-rr):0,u=t.window,l=t.w_mask,d=t.prev,p=t.strstart+$r,f=u[n+o-1],h=u[n+o];t.prev_length>=t.good_match&&(r>>=2),s>t.lookahead&&(s=t.lookahead);do if(i=e,!(u[i+o]!==h||u[i+o-1]!==f||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(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]===u[++i]&&n<p);if(a=$r-(p-n),n=p-$r,a>o){if(t.match_start=e,o=a,a>=s)break;f=u[n+o-1],h=u[n+o]}}while((e=d[e&l])>c&&--r!==0);return o<=t.lookahead?o:t.lookahead},Ti=t=>{let e=t.w_size,r,n,i;do{if(n=t.window_size-t.lookahead-t.strstart,t.strstart>=e+(e-rr)&&(t.window.set(t.window.subarray(e,e+e-n),0),t.match_start-=e,t.strstart-=e,t.block_start-=e,t.insert>t.strstart&&(t.insert=t.strstart),Mv(t),n+=e),t.strm.avail_in===0)break;if(r=Vu(t.strm,t.window,t.strstart+t.lookahead,n),t.lookahead+=r,t.lookahead+t.insert>=ae)for(i=t.strstart-t.insert,t.ins_h=t.window[i],t.ins_h=Vr(t,t.ins_h,t.window[i+1]);t.insert&&(t.ins_h=Vr(t,t.ins_h,t.window[i+ae-1]),t.prev[i&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=i,i++,t.insert--,!(t.lookahead+t.insert<ae)););}while(t.lookahead<rr&&t.strm.avail_in!==0)},oh=(t,e)=>{let r=t.pending_buf_size-5>t.w_size?t.w_size:t.pending_buf_size-5,n,i,a,o=0,s=t.strm.avail_in;do{if(n=65535,a=t.bi_valid+42>>3,t.strm.avail_out<a||(a=t.strm.avail_out-a,i=t.strstart-t.block_start,n>i+t.strm.avail_in&&(n=i+t.strm.avail_in),n>a&&(n=a),n<r&&(n===0&&e!==Ct||e===Br||n!==i+t.strm.avail_in)))break;o=e===Ct&&n===i+t.strm.avail_in?1:0,$u(t,0,0,o),t.pending_buf[t.pending-4]=n,t.pending_buf[t.pending-3]=n>>8,t.pending_buf[t.pending-2]=~n,t.pending_buf[t.pending-1]=~n>>8,bt(t.strm),i&&(i>n&&(i=n),t.strm.output.set(t.window.subarray(t.block_start,t.block_start+i),t.strm.next_out),t.strm.next_out+=i,t.strm.avail_out-=i,t.strm.total_out+=i,t.block_start+=i,n-=i),n&&(Vu(t.strm,t.strm.output,t.strm.next_out,n),t.strm.next_out+=n,t.strm.avail_out-=n,t.strm.total_out+=n)}while(o===0);return s-=t.strm.avail_in,s&&(s>=t.w_size?(t.matches=2,t.window.set(t.strm.input.subarray(t.strm.next_in-t.w_size,t.strm.next_in),0),t.strstart=t.w_size,t.insert=t.strstart):(t.window_size-t.strstart<=s&&(t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,t.insert>t.strstart&&(t.insert=t.strstart)),t.window.set(t.strm.input.subarray(t.strm.next_in-s,t.strm.next_in),t.strstart),t.strstart+=s,t.insert+=s>t.w_size-t.insert?t.w_size-t.insert:s),t.block_start=t.strstart),t.high_water<t.strstart&&(t.high_water=t.strstart),o?Pi:e!==Br&&e!==Ct&&t.strm.avail_in===0&&t.strstart===t.block_start?Ri:(a=t.window_size-t.strstart,t.strm.avail_in>a&&t.block_start>=t.w_size&&(t.block_start-=t.w_size,t.strstart-=t.w_size,t.window.set(t.window.subarray(t.w_size,t.w_size+t.strstart),0),t.matches<2&&t.matches++,a+=t.w_size,t.insert>t.strstart&&(t.insert=t.strstart)),a>t.strm.avail_in&&(a=t.strm.avail_in),a&&(Vu(t.strm,t.window,t.strstart,a),t.strstart+=a,t.insert+=a>t.w_size-t.insert?t.w_size-t.insert:a),t.high_water<t.strstart&&(t.high_water=t.strstart),a=t.bi_valid+42>>3,a=t.pending_buf_size-a>65535?65535:t.pending_buf_size-a,r=a>t.w_size?t.w_size:a,i=t.strstart-t.block_start,(i>=r||(i||e===Ct)&&e!==Br&&t.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Ct&&t.strm.avail_in===0&&n===i?1:0,$u(t,t.block_start,n,o),t.block_start+=n,bt(t.strm)),o?Rn:ct)},du=(t,e)=>{let r,n;for(;;){if(t.lookahead<rr){if(Ti(t),t.lookahead<rr&&e===Br)return ct;if(t.lookahead===0)break}if(r=0,t.lookahead>=ae&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ae-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),r!==0&&t.strstart-r<=t.w_size-rr&&(t.match_length=ah(t,r)),t.match_length>=ae)if(n=qr(t,t.strstart-t.match_start,t.match_length-ae),t.lookahead-=t.match_length,t.match_length<=t.max_lazy_match&&t.lookahead>=ae){t.match_length--;do t.strstart++,t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ae-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart;while(--t.match_length!==0);t.strstart++}else t.strstart+=t.match_length,t.match_length=0,t.ins_h=t.window[t.strstart],t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+1]);else n=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++;if(n&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=t.strstart<ae-1?t.strstart:ae-1,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},pi=(t,e)=>{let r,n,i;for(;;){if(t.lookahead<rr){if(Ti(t),t.lookahead<rr&&e===Br)return ct;if(t.lookahead===0)break}if(r=0,t.lookahead>=ae&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ae-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart),t.prev_length=t.match_length,t.prev_match=t.match_start,t.match_length=ae-1,r!==0&&t.prev_length<t.max_lazy_match&&t.strstart-r<=t.w_size-rr&&(t.match_length=ah(t,r),t.match_length<=5&&(t.strategy===wv||t.match_length===ae&&t.strstart-t.match_start>4096)&&(t.match_length=ae-1)),t.prev_length>=ae&&t.match_length<=t.prev_length){i=t.strstart+t.lookahead-ae,n=qr(t,t.strstart-1-t.prev_match,t.prev_length-ae),t.lookahead-=t.prev_length-1,t.prev_length-=2;do++t.strstart<=i&&(t.ins_h=Vr(t,t.ins_h,t.window[t.strstart+ae-1]),r=t.prev[t.strstart&t.w_mask]=t.head[t.ins_h],t.head[t.ins_h]=t.strstart);while(--t.prev_length!==0);if(t.match_available=0,t.match_length=ae-1,t.strstart++,n&&(St(t,!1),t.strm.avail_out===0))return ct}else if(t.match_available){if(n=qr(t,0,t.window[t.strstart-1]),n&&St(t,!1),t.strstart++,t.lookahead--,t.strm.avail_out===0)return ct}else t.match_available=1,t.strstart++,t.lookahead--}return t.match_available&&(n=qr(t,0,t.window[t.strstart-1]),t.match_available=0),t.insert=t.strstart<ae-1?t.strstart:ae-1,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},Uv=(t,e)=>{let r,n,i,a,o=t.window;for(;;){if(t.lookahead<=$r){if(Ti(t),t.lookahead<=$r&&e===Br)return ct;if(t.lookahead===0)break}if(t.match_length=0,t.lookahead>=ae&&t.strstart>0&&(i=t.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=t.strstart+$r;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);t.match_length=$r-(a-i),t.match_length>t.lookahead&&(t.match_length=t.lookahead)}if(t.match_length>=ae?(r=qr(t,1,t.match_length-ae),t.lookahead-=t.match_length,t.strstart+=t.match_length,t.match_length=0):(r=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++),r&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=0,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri},qv=(t,e)=>{let r;for(;;){if(t.lookahead===0&&(Ti(t),t.lookahead===0)){if(e===Br)return ct;break}if(t.match_length=0,r=qr(t,0,t.window[t.strstart]),t.lookahead--,t.strstart++,r&&(St(t,!1),t.strm.avail_out===0))return ct}return t.insert=0,e===Ct?(St(t,!0),t.strm.avail_out===0?Rn:Pi):t.sym_next&&(St(t,!1),t.strm.avail_out===0)?ct:Ri};function Kt(t,e,r,n,i){this.good_length=t,this.max_lazy=e,this.nice_length=r,this.max_chain=n,this.func=i}var Sa=[new Kt(0,0,0,0,oh),new Kt(4,4,8,4,du),new Kt(4,5,16,8,du),new Kt(4,6,32,32,du),new Kt(4,4,16,16,pi),new Kt(8,16,32,32,pi),new Kt(8,16,128,128,pi),new Kt(8,32,128,256,pi),new Kt(32,128,258,1024,pi),new Kt(32,258,258,4096,pi)],Bv=t=>{t.window_size=2*t.w_size,Lr(t.head),t.max_lazy_match=Sa[t.level].max_lazy,t.good_match=Sa[t.level].good_length,t.nice_match=Sa[t.level].nice_length,t.max_chain_length=Sa[t.level].max_chain,t.strstart=0,t.block_start=0,t.lookahead=0,t.insert=0,t.match_length=t.prev_length=ae-1,t.match_available=0,t.ins_h=0};function Vv(){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=Us,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(Pv*2),this.dyn_dtree=new Uint16Array((2*Cv+1)*2),this.bl_tree=new Uint16Array((2*Rv+1)*2),Lr(this.dyn_ltree),Lr(this.dyn_dtree),Lr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Fv+1),this.heap=new Uint16Array(2*Mu+1),Lr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Mu+1),Lr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Wa=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.status!==xi&&e.status!==il&&e.status!==ju&&e.status!==Uu&&e.status!==qu&&e.status!==Bu&&e.status!==wn&&e.status!==_a?1:0},sh=t=>{if(Wa(t))return En(t,tr);t.total_in=t.total_out=0,t.data_type=Iv;let e=t.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?il:e.wrap?xi:wn,t.adler=e.wrap===2?0:1,e.last_flush=-2,mv(e),Je},ch=t=>{let e=sh(t);return e===Je&&Bv(t.state),e},Qv=(t,e)=>Wa(t)||t.state.wrap!==2?tr:(t.state.gzhead=e,Je),uh=(t,e,r,n,i,a)=>{if(!t)return tr;let o=1;if(e===Sv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>kv||r!==Us||n<8||n>15||e<0||e>9||a<0||a>xv||n===8&&o!==1)return En(t,tr);n===8&&(n=9);let s=new Vv;return t.state=s,s.strm=t,s.status=xi,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ae-1)/ae),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=r,ch(t)},zv=(t,e)=>uh(t,e,Us,Av,Ov,Tv),Wv=(t,e)=>{if(Wa(t)||e>Cp||e<0)return t?En(t,tr):tr;let r=t.state;if(!t.output||t.avail_in!==0&&!t.input||r.status===_a&&e!==Ct)return En(t,t.avail_out===0?pu:tr);let n=r.last_flush;if(r.last_flush=e,r.pending!==0){if(bt(t),t.avail_out===0)return r.last_flush=-1,Je}else if(t.avail_in===0&&Pp(e)<=Pp(n)&&e!==Ct)return En(t,pu);if(r.status===_a&&t.avail_in!==0)return En(t,pu);if(r.status===xi&&r.wrap===0&&(r.status=wn),r.status===xi){let i=Us+(r.w_bits-8<<4)<<8,a=-1;if(r.strategy>=Qo||r.level<2?a=0:r.level<6?a=1:r.level===6?a=2:a=3,i|=a<<6,r.strstart!==0&&(i|=Lv),i+=31-i%31,aa(r,i),r.strstart!==0&&(aa(r,t.adler>>>16),aa(r,t.adler&65535)),t.adler=1,r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(r.status===il){if(t.adler=0,de(r,31),de(r,139),de(r,8),r.gzhead)de(r,(r.gzhead.text?1:0)+(r.gzhead.hcrc?2:0)+(r.gzhead.extra?4:0)+(r.gzhead.name?8:0)+(r.gzhead.comment?16:0)),de(r,r.gzhead.time&255),de(r,r.gzhead.time>>8&255),de(r,r.gzhead.time>>16&255),de(r,r.gzhead.time>>24&255),de(r,r.level===9?2:r.strategy>=Qo||r.level<2?4:0),de(r,r.gzhead.os&255),r.gzhead.extra&&r.gzhead.extra.length&&(de(r,r.gzhead.extra.length&255),de(r,r.gzhead.extra.length>>8&255)),r.gzhead.hcrc&&(t.adler=Ve(t.adler,r.pending_buf,r.pending,0)),r.gzindex=0,r.status=ju;else if(de(r,0),de(r,0),de(r,0),de(r,0),de(r,0),de(r,r.level===9?2:r.strategy>=Qo||r.level<2?4:0),de(r,$v),r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(r.status===ju){if(r.gzhead.extra){let i=r.pending,a=(r.gzhead.extra.length&65535)-r.gzindex;for(;r.pending+a>r.pending_buf_size;){let s=r.pending_buf_size-r.pending;if(r.pending_buf.set(r.gzhead.extra.subarray(r.gzindex,r.gzindex+s),r.pending),r.pending=r.pending_buf_size,r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex+=s,bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0,a-=s}let o=new Uint8Array(r.gzhead.extra);r.pending_buf.set(o.subarray(r.gzindex,r.gzindex+a),r.pending),r.pending+=a,r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=Uu}if(r.status===Uu){if(r.gzhead.name){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0}r.gzindex<r.gzhead.name.length?a=r.gzhead.name.charCodeAt(r.gzindex++)&255:a=0,de(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),r.gzindex=0}r.status=qu}if(r.status===qu){if(r.gzhead.comment){let i=r.pending,a;do{if(r.pending===r.pending_buf_size){if(r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i)),bt(t),r.pending!==0)return r.last_flush=-1,Je;i=0}r.gzindex<r.gzhead.comment.length?a=r.gzhead.comment.charCodeAt(r.gzindex++)&255:a=0,de(r,a)}while(a!==0);r.gzhead.hcrc&&r.pending>i&&(t.adler=Ve(t.adler,r.pending_buf,r.pending-i,i))}r.status=Bu}if(r.status===Bu){if(r.gzhead.hcrc){if(r.pending+2>r.pending_buf_size&&(bt(t),r.pending!==0))return r.last_flush=-1,Je;de(r,t.adler&255),de(r,t.adler>>8&255),t.adler=0}if(r.status=wn,bt(t),r.pending!==0)return r.last_flush=-1,Je}if(t.avail_in!==0||r.lookahead!==0||e!==Br&&r.status!==_a){let i=r.level===0?oh(r,e):r.strategy===Qo?qv(r,e):r.strategy===Ev?Uv(r,e):Sa[r.level].func(r,e);if((i===Rn||i===Pi)&&(r.status=_a),i===ct||i===Rn)return t.avail_out===0&&(r.last_flush=-1),Je;if(i===Ri&&(e===vv?yv(r):e!==Cp&&($u(r,0,0,!1),e===bv&&(Lr(r.head),r.lookahead===0&&(r.strstart=0,r.block_start=0,r.insert=0))),bt(t),t.avail_out===0))return r.last_flush=-1,Je}return e!==Ct?Je:r.wrap<=0?Rp:(r.wrap===2?(de(r,t.adler&255),de(r,t.adler>>8&255),de(r,t.adler>>16&255),de(r,t.adler>>24&255),de(r,t.total_in&255),de(r,t.total_in>>8&255),de(r,t.total_in>>16&255),de(r,t.total_in>>24&255)):(aa(r,t.adler>>>16),aa(r,t.adler&65535)),bt(t),r.wrap>0&&(r.wrap=-r.wrap),r.pending!==0?Je:Rp)},Gv=t=>{if(Wa(t))return tr;let e=t.state.status;return t.state=null,e===wn?En(t,_v):Je},Kv=(t,e)=>{let r=e.length;if(Wa(t))return tr;let n=t.state,i=n.wrap;if(i===2||i===1&&n.status!==xi||n.lookahead)return tr;if(i===1&&(t.adler=$a(t.adler,e,r,0)),n.wrap=0,r>=n.w_size){i===0&&(Lr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let c=new Uint8Array(n.w_size);c.set(e.subarray(r-n.w_size,r),0),e=c,r=n.w_size}let a=t.avail_in,o=t.next_in,s=t.input;for(t.avail_in=r,t.next_in=0,t.input=e,Ti(n);n.lookahead>=ae;){let c=n.strstart,u=n.lookahead-(ae-1);do n.ins_h=Vr(n,n.ins_h,n.window[c+ae-1]),n.prev[c&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=c,c++;while(--u);n.strstart=c,n.lookahead=ae-1,Ti(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ae-1,n.match_available=0,t.next_in=o,t.input=s,t.avail_in=a,n.wrap=i,Je},Hv=zv,Jv=uh,Yv=ch,Zv=sh,Xv=Qv,eb=Wv,tb=Gv,rb=Kv,nb="pako deflate (from Nodeca project)",ka={deflateInit:Hv,deflateInit2:Jv,deflateReset:Yv,deflateResetKeep:Zv,deflateSetHeader:Xv,deflate:eb,deflateEnd:tb,deflateSetDictionary:rb,deflateInfo:nb},ib=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),ab=function(t){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let r=e.shift();if(!!r){if(typeof r!="object")throw new TypeError(r+"must be non-object");for(let n in r)ib(r,n)&&(t[n]=r[n])}}return t},ob=t=>{let e=0;for(let n=0,i=t.length;n<i;n++)e+=t[n].length;let r=new Uint8Array(e);for(let n=0,i=0,a=t.length;n<a;n++){let o=t[n];r.set(o,i),i+=o.length}return r},qs={assign:ab,flattenChunks:ob},lh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(t){lh=!1}var Ma=new Uint8Array(256);for(let t=0;t<256;t++)Ma[t]=t>=252?6:t>=248?5:t>=240?4:t>=224?3:t>=192?2:1;Ma[254]=Ma[254]=1;var sb=t=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(t);let e,r,n,i,a,o=t.length,s=0;for(i=0;i<o;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),s+=r<128?1:r<2048?2:r<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)r=t.charCodeAt(i),(r&64512)===55296&&i+1<o&&(n=t.charCodeAt(i+1),(n&64512)===56320&&(r=65536+(r-55296<<10)+(n-56320),i++)),r<128?e[a++]=r:r<2048?(e[a++]=192|r>>>6,e[a++]=128|r&63):r<65536?(e[a++]=224|r>>>12,e[a++]=128|r>>>6&63,e[a++]=128|r&63):(e[a++]=240|r>>>18,e[a++]=128|r>>>12&63,e[a++]=128|r>>>6&63,e[a++]=128|r&63);return e},cb=(t,e)=>{if(e<65534&&t.subarray&&lh)return String.fromCharCode.apply(null,t.length===e?t:t.subarray(0,e));let r="";for(let n=0;n<e;n++)r+=String.fromCharCode(t[n]);return r},ub=(t,e)=>{let r=e||t.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(t.subarray(0,e));let n,i,a=new Array(r*2);for(i=0,n=0;n<r;){let o=t[n++];if(o<128){a[i++]=o;continue}let s=Ma[o];if(s>4){a[i++]=65533,n+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&n<r;)o=o<<6|t[n++]&63,s--;if(s>1){a[i++]=65533;continue}o<65536?a[i++]=o:(o-=65536,a[i++]=55296|o>>10&1023,a[i++]=56320|o&1023)}return cb(a,i)},lb=(t,e)=>{e=e||t.length,e>t.length&&(e=t.length);let r=e-1;for(;r>=0&&(t[r]&192)===128;)r--;return r<0||r===0?e:r+Ma[t[r]]>e?r:e},ja={string2buf:sb,buf2string:ub,utf8border:lb};function fb(){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 fh=fb,ph=Object.prototype.toString,{Z_NO_FLUSH:pb,Z_SYNC_FLUSH:db,Z_FULL_FLUSH:hb,Z_FINISH:mb,Z_OK:As,Z_STREAM_END:gb,Z_DEFAULT_COMPRESSION:yb,Z_DEFAULT_STRATEGY:vb,Z_DEFLATED:bb}=qn;function Ga(t){this.options=qs.assign({level:yb,method:bb,chunkSize:16384,windowBits:15,memLevel:8,strategy:vb},t||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fh,this.strm.avail_out=0;let r=ka.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(r!==As)throw new Error(Cn[r]);if(e.header&&ka.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=ja.string2buf(e.dictionary):ph.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,r=ka.deflateSetDictionary(this.strm,n),r!==As)throw new Error(Cn[r]);this._dict_set=!0}}Ga.prototype.push=function(t,e){let r=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?mb:pb,typeof t=="string"?r.input=ja.string2buf(t):ph.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){if(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),(a===db||a===hb)&&r.avail_out<=6){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(i=ka.deflate(r,a),i===gb)return r.next_out>0&&this.onData(r.output.subarray(0,r.next_out)),i=ka.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===As;if(r.avail_out===0){this.onData(r.output);continue}if(a>0&&r.next_out>0){this.onData(r.output.subarray(0,r.next_out)),r.avail_out=0;continue}if(r.avail_in===0)break}return!0};Ga.prototype.onData=function(t){this.chunks.push(t)};Ga.prototype.onEnd=function(t){t===As&&(this.result=qs.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function al(t,e){let r=new Ga(e);if(r.push(t,!0),r.err)throw r.msg||Cn[r.err];return r.result}function _b(t,e){return e=e||{},e.raw=!0,al(t,e)}function Sb(t,e){return e=e||{},e.gzip=!0,al(t,e)}var wb=Ga,Eb=al,xb=_b,Tb=Sb,Ib=qn,kb={Deflate:wb,deflate:Eb,deflateRaw:xb,gzip:Tb,constants:Ib},zo=16209,Ab=16191,Ob=function t(e,r){let n,i,a,o,s,c,u,l,d,p,f,h,m,g,_,S,w,b,O,C,E,R,F,P,M=e.state;n=e.next_in,F=e.input,i=n+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(r-e.avail_out),s=a+(e.avail_out-257),c=M.dmax,u=M.wsize,l=M.whave,d=M.wnext,p=M.window,f=M.hold,h=M.bits,m=M.lencode,g=M.distcode,_=(1<<M.lenbits)-1,S=(1<<M.distbits)-1;e:do{h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),w=m[f&_];t:for(;;){if(b=w>>>24,f>>>=b,h-=b,b=w>>>16&255,b===0)P[a++]=w&65535;else if(b&16){O=w&65535,b&=15,b&&(h<b&&(f+=F[n++]<<h,h+=8),O+=f&(1<<b)-1,f>>>=b,h-=b),h<15&&(f+=F[n++]<<h,h+=8,f+=F[n++]<<h,h+=8),w=g[f&S];r:for(;;){if(b=w>>>24,f>>>=b,h-=b,b=w>>>16&255,b&16){if(C=w&65535,b&=15,h<b&&(f+=F[n++]<<h,h+=8,h<b&&(f+=F[n++]<<h,h+=8)),C+=f&(1<<b)-1,C>c){e.msg="invalid distance too far back",M.mode=zo;break e}if(f>>>=b,h-=b,b=a-o,C>b){if(b=C-b,b>l&&M.sane){e.msg="invalid distance too far back",M.mode=zo;break e}if(E=0,R=p,d===0){if(E+=u-b,b<O){O-=b;do P[a++]=p[E++];while(--b);E=a-C,R=P}}else if(d<b){if(E+=u+d-b,b-=d,b<O){O-=b;do P[a++]=p[E++];while(--b);if(E=0,d<O){b=d,O-=b;do P[a++]=p[E++];while(--b);E=a-C,R=P}}}else if(E+=d-b,b<O){O-=b;do P[a++]=p[E++];while(--b);E=a-C,R=P}for(;O>2;)P[a++]=R[E++],P[a++]=R[E++],P[a++]=R[E++],O-=3;O&&(P[a++]=R[E++],O>1&&(P[a++]=R[E++]))}else{E=a-C;do P[a++]=P[E++],P[a++]=P[E++],P[a++]=P[E++],O-=3;while(O>2);O&&(P[a++]=P[E++],O>1&&(P[a++]=P[E++]))}}else if((b&64)===0){w=g[(w&65535)+(f&(1<<b)-1)];continue r}else{e.msg="invalid distance code",M.mode=zo;break e}break}}else if((b&64)===0){w=m[(w&65535)+(f&(1<<b)-1)];continue t}else if(b&32){M.mode=Ab;break e}else{e.msg="invalid literal/length code",M.mode=zo;break e}break}}while(n<i&&a<s);O=h>>3,n-=O,h-=O<<3,f&=(1<<h)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?5+(i-n):5-(n-i),e.avail_out=a<s?257+(s-a):257-(a-s),M.hold=f,M.bits=h},di=15,Fp=852,Lp=592,$p=0,hu=1,Mp=2,Db=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]),Nb=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]),Cb=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]),Rb=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]),Pb=(t,e,r,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,d=0,p=0,f=0,h=0,m=0,g=0,_=0,S=0,w,b,O,C,E,R=null,F,P=new Uint16Array(di+1),M=new Uint16Array(di+1),Ee=null,ie,j,ye;for(u=0;u<=di;u++)P[u]=0;for(l=0;l<n;l++)P[e[r+l]]++;for(f=c,p=di;p>=1&&P[p]===0;p--);if(f>p&&(f=p),p===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<p&&P[d]===0;d++);for(f<d&&(f=d),g=1,u=1;u<=di;u++)if(g<<=1,g-=P[u],g<0)return-1;if(g>0&&(t===$p||p!==1))return-1;for(M[1]=0,u=1;u<di;u++)M[u+1]=M[u]+P[u];for(l=0;l<n;l++)e[r+l]!==0&&(o[M[e[r+l]]++]=l);if(t===$p?(R=Ee=o,F=20):t===hu?(R=Db,Ee=Nb,F=257):(R=Cb,Ee=Rb,F=0),S=0,l=0,u=d,E=a,h=f,m=0,O=-1,_=1<<f,C=_-1,t===hu&&_>Fp||t===Mp&&_>Lp)return 1;for(;;){ie=u-m,o[l]+1<F?(j=0,ye=o[l]):o[l]>=F?(j=Ee[o[l]-F],ye=R[o[l]-F]):(j=32+64,ye=0),w=1<<u-m,b=1<<h,d=b;do b-=w,i[E+(S>>m)+b]=ie<<24|j<<16|ye|0;while(b!==0);for(w=1<<u-1;S&w;)w>>=1;if(w!==0?(S&=w-1,S+=w):S=0,l++,--P[u]===0){if(u===p)break;u=e[r+o[l]]}if(u>f&&(S&C)!==O){for(m===0&&(m=f),E+=d,h=u-m,g=1<<h;h+m<p&&(g-=P[h+m],!(g<=0));)h++,g<<=1;if(_+=1<<h,t===hu&&_>Fp||t===Mp&&_>Lp)return 1;O=S&C,i[O]=f<<24|h<<16|E-a|0}}return S!==0&&(i[E+S]=u-m<<24|64<<16|0),s.bits=f,0},Aa=Pb,Fb=0,dh=1,hh=2,{Z_FINISH:jp,Z_BLOCK:Lb,Z_TREES:Wo,Z_OK:Pn,Z_STREAM_END:$b,Z_NEED_DICT:Mb,Z_STREAM_ERROR:Rt,Z_DATA_ERROR:mh,Z_MEM_ERROR:gh,Z_BUF_ERROR:jb,Z_DEFLATED:Up}=qn,Bs=16180,qp=16181,Bp=16182,Vp=16183,Qp=16184,zp=16185,Wp=16186,Gp=16187,Kp=16188,Hp=16189,Os=16190,pr=16191,mu=16192,Jp=16193,gu=16194,Yp=16195,Zp=16196,Xp=16197,ed=16198,Go=16199,Ko=16200,td=16201,rd=16202,nd=16203,id=16204,ad=16205,yu=16206,od=16207,sd=16208,Ie=16209,yh=16210,vh=16211,Ub=852,qb=592,Bb=15,Vb=Bb,cd=t=>(t>>>24&255)+(t>>>8&65280)+((t&65280)<<8)+((t&255)<<24);function Qb(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var Bn=t=>{if(!t)return 1;let e=t.state;return!e||e.strm!==t||e.mode<Bs||e.mode>vh?1:0},bh=t=>{if(Bn(t))return Rt;let e=t.state;return t.total_in=t.total_out=e.total=0,t.msg="",e.wrap&&(t.adler=e.wrap&1),e.mode=Bs,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(Ub),e.distcode=e.distdyn=new Int32Array(qb),e.sane=1,e.back=-1,Pn},_h=t=>{if(Bn(t))return Rt;let e=t.state;return e.wsize=0,e.whave=0,e.wnext=0,bh(t)},Sh=(t,e)=>{let r;if(Bn(t))return Rt;let n=t.state;return e<0?(r=0,e=-e):(r=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Rt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=r,n.wbits=e,_h(t))},wh=(t,e)=>{if(!t)return Rt;let r=new Qb;t.state=r,r.strm=t,r.window=null,r.mode=Bs;let n=Sh(t,e);return n!==Pn&&(t.state=null),n},zb=t=>wh(t,Vb),ud=!0,vu,bu,Wb=t=>{if(ud){vu=new Int32Array(512),bu=new Int32Array(32);let e=0;for(;e<144;)t.lens[e++]=8;for(;e<256;)t.lens[e++]=9;for(;e<280;)t.lens[e++]=7;for(;e<288;)t.lens[e++]=8;for(Aa(dh,t.lens,0,288,vu,0,t.work,{bits:9}),e=0;e<32;)t.lens[e++]=5;Aa(hh,t.lens,0,32,bu,0,t.work,{bits:5}),ud=!1}t.lencode=vu,t.lenbits=9,t.distcode=bu,t.distbits=5},Eh=(t,e,r,n)=>{let i,a=t.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(e.subarray(r-a.wsize,r),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(e.subarray(r-n,r-n+i),a.wnext),n-=i,n?(a.window.set(e.subarray(r-n,r),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},Gb=(t,e)=>{let r,n,i,a,o,s,c,u,l,d,p,f,h,m,g=0,_,S,w,b,O,C,E,R,F=new Uint8Array(4),P,M,Ee=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Bn(t)||!t.output||!t.input&&t.avail_in!==0)return Rt;r=t.state,r.mode===pr&&(r.mode=mu),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,u=r.hold,l=r.bits,d=s,p=c,R=Pn;e:for(;;)switch(r.mode){case Bs:if(r.wrap===0){r.mode=mu;break}for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&2&&u===35615){r.wbits===0&&(r.wbits=15),r.check=0,F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0),u=0,l=0,r.mode=qp;break}if(r.head&&(r.head.done=!1),!(r.wrap&1)||(((u&255)<<8)+(u>>8))%31){t.msg="incorrect header check",r.mode=Ie;break}if((u&15)!==Up){t.msg="unknown compression method",r.mode=Ie;break}if(u>>>=4,l-=4,E=(u&15)+8,r.wbits===0&&(r.wbits=E),E>15||E>r.wbits){t.msg="invalid window size",r.mode=Ie;break}r.dmax=1<<r.wbits,r.flags=0,t.adler=r.check=1,r.mode=u&512?Hp:pr,u=0,l=0;break;case qp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.flags=u,(r.flags&255)!==Up){t.msg="unknown compression method",r.mode=Ie;break}if(r.flags&57344){t.msg="unknown header flags set",r.mode=Ie;break}r.head&&(r.head.text=u>>8&1),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0,r.mode=Bp;case Bp:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.head&&(r.head.time=u),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,F[2]=u>>>16&255,F[3]=u>>>24&255,r.check=Ve(r.check,F,4,0)),u=0,l=0,r.mode=Vp;case Vp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.head&&(r.head.xflags=u&255,r.head.os=u>>8),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0,r.mode=Qp;case Qp:if(r.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.length=u,r.head&&(r.head.extra_len=u),r.flags&512&&r.wrap&4&&(F[0]=u&255,F[1]=u>>>8&255,r.check=Ve(r.check,F,2,0)),u=0,l=0}else r.head&&(r.head.extra=null);r.mode=zp;case zp:if(r.flags&1024&&(f=r.length,f>s&&(f=s),f&&(r.head&&(E=r.head.extra_len-r.length,r.head.extra||(r.head.extra=new Uint8Array(r.head.extra_len)),r.head.extra.set(n.subarray(a,a+f),E)),r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,r.length-=f),r.length))break e;r.length=0,r.mode=Wp;case Wp:if(r.flags&2048){if(s===0)break e;f=0;do E=n[a+f++],r.head&&E&&r.length<65536&&(r.head.name+=String.fromCharCode(E));while(E&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,E)break e}else r.head&&(r.head.name=null);r.length=0,r.mode=Gp;case Gp:if(r.flags&4096){if(s===0)break e;f=0;do E=n[a+f++],r.head&&E&&r.length<65536&&(r.head.comment+=String.fromCharCode(E));while(E&&f<s);if(r.flags&512&&r.wrap&4&&(r.check=Ve(r.check,n,f,a)),s-=f,a+=f,E)break e}else r.head&&(r.head.comment=null);r.mode=Kp;case Kp:if(r.flags&512){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&4&&u!==(r.check&65535)){t.msg="header crc mismatch",r.mode=Ie;break}u=0,l=0}r.head&&(r.head.hcrc=r.flags>>9&1,r.head.done=!0),t.adler=r.check=0,r.mode=pr;break;case Hp:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.adler=r.check=cd(u),u=0,l=0,r.mode=Os;case Os:if(r.havedict===0)return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,Mb;t.adler=r.check=1,r.mode=pr;case pr:if(e===Lb||e===Wo)break e;case mu:if(r.last){u>>>=l&7,l-=l&7,r.mode=yu;break}for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}switch(r.last=u&1,u>>>=1,l-=1,u&3){case 0:r.mode=Jp;break;case 1:if(Wb(r),r.mode=Go,e===Wo){u>>>=2,l-=2;break e}break;case 2:r.mode=Zp;break;case 3:t.msg="invalid block type",r.mode=Ie}u>>>=2,l-=2;break;case Jp:for(u>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((u&65535)!==(u>>>16^65535)){t.msg="invalid stored block lengths",r.mode=Ie;break}if(r.length=u&65535,u=0,l=0,r.mode=gu,e===Wo)break e;case gu:r.mode=Yp;case Yp:if(f=r.length,f){if(f>s&&(f=s),f>c&&(f=c),f===0)break e;i.set(n.subarray(a,a+f),o),s-=f,a+=f,c-=f,o+=f,r.length-=f;break}r.mode=pr;break;case Zp:for(;l<14;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.nlen=(u&31)+257,u>>>=5,l-=5,r.ndist=(u&31)+1,u>>>=5,l-=5,r.ncode=(u&15)+4,u>>>=4,l-=4,r.nlen>286||r.ndist>30){t.msg="too many length or distance symbols",r.mode=Ie;break}r.have=0,r.mode=Xp;case Xp:for(;r.have<r.ncode;){for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.lens[Ee[r.have++]]=u&7,u>>>=3,l-=3}for(;r.have<19;)r.lens[Ee[r.have++]]=0;if(r.lencode=r.lendyn,r.lenbits=7,P={bits:r.lenbits},R=Aa(Fb,r.lens,0,19,r.lencode,0,r.work,P),r.lenbits=P.bits,R){t.msg="invalid code lengths set",r.mode=Ie;break}r.have=0,r.mode=ed;case ed:for(;r.have<r.nlen+r.ndist;){for(;g=r.lencode[u&(1<<r.lenbits)-1],_=g>>>24,S=g>>>16&255,w=g&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(w<16)u>>>=_,l-=_,r.lens[r.have++]=w;else{if(w===16){for(M=_+2;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(u>>>=_,l-=_,r.have===0){t.msg="invalid bit length repeat",r.mode=Ie;break}E=r.lens[r.have-1],f=3+(u&3),u>>>=2,l-=2}else if(w===17){for(M=_+3;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,E=0,f=3+(u&7),u>>>=3,l-=3}else{for(M=_+7;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,E=0,f=11+(u&127),u>>>=7,l-=7}if(r.have+f>r.nlen+r.ndist){t.msg="invalid bit length repeat",r.mode=Ie;break}for(;f--;)r.lens[r.have++]=E}}if(r.mode===Ie)break;if(r.lens[256]===0){t.msg="invalid code -- missing end-of-block",r.mode=Ie;break}if(r.lenbits=9,P={bits:r.lenbits},R=Aa(dh,r.lens,0,r.nlen,r.lencode,0,r.work,P),r.lenbits=P.bits,R){t.msg="invalid literal/lengths set",r.mode=Ie;break}if(r.distbits=6,r.distcode=r.distdyn,P={bits:r.distbits},R=Aa(hh,r.lens,r.nlen,r.ndist,r.distcode,0,r.work,P),r.distbits=P.bits,R){t.msg="invalid distances set",r.mode=Ie;break}if(r.mode=Go,e===Wo)break e;case Go:r.mode=Ko;case Ko:if(s>=6&&c>=258){t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,Ob(t,p),o=t.next_out,i=t.output,c=t.avail_out,a=t.next_in,n=t.input,s=t.avail_in,u=r.hold,l=r.bits,r.mode===pr&&(r.back=-1);break}for(r.back=0;g=r.lencode[u&(1<<r.lenbits)-1],_=g>>>24,S=g>>>16&255,w=g&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(S&&(S&240)===0){for(b=_,O=S,C=w;g=r.lencode[C+((u&(1<<b+O)-1)>>b)],_=g>>>24,S=g>>>16&255,w=g&65535,!(b+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=b,l-=b,r.back+=b}if(u>>>=_,l-=_,r.back+=_,r.length=w,S===0){r.mode=ad;break}if(S&32){r.back=-1,r.mode=pr;break}if(S&64){t.msg="invalid literal/length code",r.mode=Ie;break}r.extra=S&15,r.mode=td;case td:if(r.extra){for(M=r.extra;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.length+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}r.was=r.length,r.mode=rd;case rd:for(;g=r.distcode[u&(1<<r.distbits)-1],_=g>>>24,S=g>>>16&255,w=g&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((S&240)===0){for(b=_,O=S,C=w;g=r.distcode[C+((u&(1<<b+O)-1)>>b)],_=g>>>24,S=g>>>16&255,w=g&65535,!(b+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=b,l-=b,r.back+=b}if(u>>>=_,l-=_,r.back+=_,S&64){t.msg="invalid distance code",r.mode=Ie;break}r.offset=w,r.extra=S&15,r.mode=nd;case nd:if(r.extra){for(M=r.extra;l<M;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.offset+=u&(1<<r.extra)-1,u>>>=r.extra,l-=r.extra,r.back+=r.extra}if(r.offset>r.dmax){t.msg="invalid distance too far back",r.mode=Ie;break}r.mode=id;case id:if(c===0)break e;if(f=p-c,r.offset>f){if(f=r.offset-f,f>r.whave&&r.sane){t.msg="invalid distance too far back",r.mode=Ie;break}f>r.wnext?(f-=r.wnext,h=r.wsize-f):h=r.wnext-f,f>r.length&&(f=r.length),m=r.window}else m=i,h=o-r.offset,f=r.length;f>c&&(f=c),c-=f,r.length-=f;do i[o++]=m[h++];while(--f);r.length===0&&(r.mode=Ko);break;case ad:if(c===0)break e;i[o++]=r.length,c--,r.mode=Ko;break;case yu:if(r.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(p-=c,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ve(r.check,i,p,o-p):$a(r.check,i,p,o-p)),p=c,r.wrap&4&&(r.flags?u:cd(u))!==r.check){t.msg="incorrect data check",r.mode=Ie;break}u=0,l=0}r.mode=od;case od:if(r.wrap&&r.flags){for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(r.wrap&4&&u!==(r.total&4294967295)){t.msg="incorrect length check",r.mode=Ie;break}u=0,l=0}r.mode=sd;case sd:R=$b;break e;case Ie:R=mh;break e;case yh:return gh;case vh:default:return Rt}return t.next_out=o,t.avail_out=c,t.next_in=a,t.avail_in=s,r.hold=u,r.bits=l,(r.wsize||p!==t.avail_out&&r.mode<Ie&&(r.mode<yu||e!==jp))&&Eh(t,t.output,t.next_out,p-t.avail_out),d-=t.avail_in,p-=t.avail_out,t.total_in+=d,t.total_out+=p,r.total+=p,r.wrap&4&&p&&(t.adler=r.check=r.flags?Ve(r.check,i,p,t.next_out-p):$a(r.check,i,p,t.next_out-p)),t.data_type=r.bits+(r.last?64:0)+(r.mode===pr?128:0)+(r.mode===Go||r.mode===gu?256:0),(d===0&&p===0||e===jp)&&R===Pn&&(R=jb),R},Kb=t=>{if(Bn(t))return Rt;let e=t.state;return e.window&&(e.window=null),t.state=null,Pn},Hb=(t,e)=>{if(Bn(t))return Rt;let r=t.state;return(r.wrap&2)===0?Rt:(r.head=e,e.done=!1,Pn)},Jb=(t,e)=>{let r=e.length,n,i,a;return Bn(t)||(n=t.state,n.wrap!==0&&n.mode!==Os)?Rt:n.mode===Os&&(i=1,i=$a(i,e,r,0),i!==n.check)?mh:(a=Eh(t,e,r,r),a?(n.mode=yh,gh):(n.havedict=1,Pn))},Yb=_h,Zb=Sh,Xb=bh,e_=zb,t_=wh,r_=Gb,n_=Kb,i_=Hb,a_=Jb,o_="pako inflate (from Nodeca project)",yr={inflateReset:Yb,inflateReset2:Zb,inflateResetKeep:Xb,inflateInit:e_,inflateInit2:t_,inflate:r_,inflateEnd:n_,inflateGetHeader:i_,inflateSetDictionary:a_,inflateInfo:o_};function s_(){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 c_=s_,xh=Object.prototype.toString,{Z_NO_FLUSH:u_,Z_FINISH:l_,Z_OK:Ua,Z_STREAM_END:_u,Z_NEED_DICT:Su,Z_STREAM_ERROR:f_,Z_DATA_ERROR:ld,Z_MEM_ERROR:p_}=qn;function Ka(t){this.options=qs.assign({chunkSize:1024*64,windowBits:15,to:""},t||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(t&&t.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new fh,this.strm.avail_out=0;let r=yr.inflateInit2(this.strm,e.windowBits);if(r!==Ua)throw new Error(Cn[r]);if(this.header=new c_,yr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=ja.string2buf(e.dictionary):xh.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(r=yr.inflateSetDictionary(this.strm,e.dictionary),r!==Ua)))throw new Error(Cn[r])}Ka.prototype.push=function(t,e){let r=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?l_:u_,xh.call(t)==="[object ArrayBuffer]"?r.input=new Uint8Array(t):r.input=t,r.next_in=0,r.avail_in=r.input.length;;){for(r.avail_out===0&&(r.output=new Uint8Array(n),r.next_out=0,r.avail_out=n),a=yr.inflate(r,o),a===Su&&i&&(a=yr.inflateSetDictionary(r,i),a===Ua?a=yr.inflate(r,o):a===ld&&(a=Su));r.avail_in>0&&a===_u&&r.state.wrap>0&&t[r.next_in]!==0;)yr.inflateReset(r),a=yr.inflate(r,o);switch(a){case f_:case ld:case Su:case p_:return this.onEnd(a),this.ended=!0,!1}if(s=r.avail_out,r.next_out&&(r.avail_out===0||a===_u))if(this.options.to==="string"){let c=ja.utf8border(r.output,r.next_out),u=r.next_out-c,l=ja.buf2string(r.output,c);r.next_out=u,r.avail_out=n-u,u&&r.output.set(r.output.subarray(c,c+u),0),this.onData(l)}else this.onData(r.output.length===r.next_out?r.output:r.output.subarray(0,r.next_out));if(!(a===Ua&&s===0)){if(a===_u)return a=yr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(r.avail_in===0)break}}return!0};Ka.prototype.onData=function(t){this.chunks.push(t)};Ka.prototype.onEnd=function(t){t===Ua&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=qs.flattenChunks(this.chunks)),this.chunks=[],this.err=t,this.msg=this.strm.msg};function ol(t,e){let r=new Ka(e);if(r.push(t),r.err)throw r.msg||Cn[r.err];return r.result}function d_(t,e){return e=e||{},e.raw=!0,ol(t,e)}var h_=Ka,m_=ol,g_=d_,y_=ol,v_=qn,b_={Inflate:h_,inflate:m_,inflateRaw:g_,ungzip:y_,constants:v_},{Deflate:__,deflate:S_,deflateRaw:w_,gzip:E_}=kb,{Inflate:x_,inflate:T_,inflateRaw:I_,ungzip:k_}=b_,A_=__,O_=S_,D_=w_,N_=E_,C_=x_,R_=T_,P_=I_,F_=k_,L_=qn,$_={Deflate:A_,deflate:O_,deflateRaw:D_,gzip:N_,Inflate:C_,inflate:R_,inflateRaw:P_,ungzip:F_,constants:L_},be=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},_e=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ds=class{constructor(e,r){this.input=e,this.output=r}};be([y(),_e("design:type",String)],Ds.prototype,"input",void 0);be([y(),_e("design:type",String)],Ds.prototype,"output",void 0);Ds=be([ze(),_e("design:paramtypes",[String,String])],Ds);var Ns=class{constructor(e,r){this.input=e,this.output=r}};be([y(),_e("design:type",String)],Ns.prototype,"input",void 0);be([y(),_e("design:type",String)],Ns.prototype,"output",void 0);Ns=be([W(),_e("design:paramtypes",[String,String])],Ns);var Gr=class{constructor(e,r,n,i,a){this.name=e,this.modelId=r,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};be([y(),_e("design:type",String)],Gr.prototype,"name",void 0);be([y(),_e("design:type",String)],Gr.prototype,"modelId",void 0);be([y(),_e("design:type",String)],Gr.prototype,"systemPrompt",void 0);be([y(),_e("design:type",Array)],Gr.prototype,"promptExamples",void 0);be([y(),_e("design:type",String)],Gr.prototype,"metaData",void 0);Gr=be([ze(),_e("design:paramtypes",[String,String,String,Array,String])],Gr);var ar=class{constructor(e,r,n,i,a,o,s,c){this.name=e,this.modelId=r,this.taskId=n,this.systemPrompt=i,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};be([y(),_e("design:type",String)],ar.prototype,"name",void 0);be([y(),_e("design:type",String)],ar.prototype,"modelId",void 0);be([y(),_e("design:type",String)],ar.prototype,"taskId",void 0);be([y(),_e("design:type",String)],ar.prototype,"systemPrompt",void 0);be([y(),_e("design:type",Array)],ar.prototype,"promptExamples",void 0);be([y(),_e("design:type",String)],ar.prototype,"metaData",void 0);be([y(),_e("design:type",String)],ar.prototype,"createdAt",void 0);be([y(),_e("design:type",String)],ar.prototype,"updatedAt",void 0);ar=be([W(),_e("design:paramtypes",[String,String,String,String,Array,String,String,String])],ar);var Fn=class{constructor(e,r,n,i,a){this.model=e,this.status=r,this.progress=n,this.downloaded=i,this.loaded=a}};be([y(),_e("design:type",String)],Fn.prototype,"model",void 0);be([y(),_e("design:type",String)],Fn.prototype,"status",void 0);be([y(),_e("design:type",Number)],Fn.prototype,"progress",void 0);be([y(),_e("design:type",Boolean)],Fn.prototype,"downloaded",void 0);be([y(),_e("design:type",Boolean)],Fn.prototype,"loaded",void 0);Fn=be([W(),_e("design:paramtypes",[String,String,Number,Boolean,Boolean])],Fn);var M_=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},qe=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},je,cs,Qu=class{constructor(e,r=!0){je.set(this,void 0),cs.set(this,new Map),M_(this,je,e,"f")}async getModels(){let e=await qe(this,je,"f").query({query:I`
770
+ }`,variables:{url:e,interactionCall:t}}));return n}};mr=new WeakMap;var Us={};Us.byteLength=Py;Us.toByteArray=Fy;Us.fromByteArray=jy;var Zt=[],Nt=[],Ry=typeof Uint8Array<"u"?Uint8Array:Array,cu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,kf=cu.length;pn<kf;++pn)Zt[pn]=cu[pn],Nt[cu.charCodeAt(pn)]=pn;var pn,kf;Nt["-".charCodeAt(0)]=62;Nt["_".charCodeAt(0)]=63;function Wd(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 n=t===e?0:4-t%4;return[t,n]}function Py(r){var e=Wd(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Ly(r,e,t){return(e+t)*3/4-t}function Fy(r){var e,t=Wd(r),n=t[0],i=t[1],a=new Ry(Ly(r,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=Nt[r.charCodeAt(c)]<<18|Nt[r.charCodeAt(c+1)]<<12|Nt[r.charCodeAt(c+2)]<<6|Nt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Nt[r.charCodeAt(c)]<<2|Nt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=Nt[r.charCodeAt(c)]<<10|Nt[r.charCodeAt(c+1)]<<4|Nt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function $y(r){return Zt[r>>18&63]+Zt[r>>12&63]+Zt[r>>6&63]+Zt[r&63]}function My(r,e,t){for(var n,i=[],a=e;a<t;a+=3)n=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),i.push($y(n));return i.join("")}function jy(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(My(r,o,o+a>s?s:o+a));return n===1?(e=r[t-1],i.push(Zt[e>>2]+Zt[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Zt[e>>10]+Zt[e>>4&63]+Zt[e<<2&63]+"=")),i.join("")}var Uy=4,Af=0,Of=1,qy=2;function Ci(r){let e=r.length;for(;--e>=0;)r[e]=0}var By=0,Gd=1,Vy=2,Qy=3,zy=258,el=29,za=256,Ra=za+1+el,bi=30,tl=19,Kd=2*Ra+1,wn=15,uu=16,Wy=7,rl=256,Hd=16,Jd=17,Yd=18,Fu=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]),ss=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]),Gy=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),Zd=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Ky=512,gr=new Array((Ra+2)*2);Ci(gr);var Ta=new Array(bi*2);Ci(Ta);var Pa=new Array(Ky);Ci(Pa);var La=new Array(zy-Qy+1);Ci(La);var nl=new Array(el);Ci(nl);var As=new Array(bi);Ci(As);function lu(r,e,t,n,i){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=n,this.max_length=i,this.has_stree=r&&r.length}var Xd,eh,th;function pu(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var rh=r=>r<256?Pa[r]:Pa[256+(r>>>7)],Fa=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},ht=(r,e,t)=>{r.bi_valid>uu-t?(r.bi_buf|=e<<r.bi_valid&65535,Fa(r,r.bi_buf),r.bi_buf=e>>uu-r.bi_valid,r.bi_valid+=t-uu):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},Xt=(r,e,t)=>{ht(r,t[e*2],t[e*2+1])},nh=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},Hy=r=>{r.bi_valid===16?(Fa(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)},Jy=(r,e)=>{let t=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,d,f,p,h,m=0;for(f=0;f<=wn;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<Kd;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>n)&&(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*(i[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>n)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),l--)}},ih=(r,e,t)=>{let n=new Array(wn+1),i=0,a,o;for(a=1;a<=wn;a++)i=i+t[a-1]<<1,n[a]=i;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=nh(n[s]++,s))}},Yy=()=>{let r,e,t,n,i,a=new Array(wn+1);for(t=0,n=0;n<el-1;n++)for(nl[n]=t,r=0;r<1<<Fu[n];r++)La[t++]=n;for(La[t-1]=n,i=0,n=0;n<16;n++)for(As[n]=i,r=0;r<1<<ss[n];r++)Pa[i++]=n;for(i>>=7;n<bi;n++)for(As[n]=i<<7,r=0;r<1<<ss[n]-7;r++)Pa[256+i++]=n;for(e=0;e<=wn;e++)a[e]=0;for(r=0;r<=143;)gr[r*2+1]=8,r++,a[8]++;for(;r<=255;)gr[r*2+1]=9,r++,a[9]++;for(;r<=279;)gr[r*2+1]=7,r++,a[7]++;for(;r<=287;)gr[r*2+1]=8,r++,a[8]++;for(ih(gr,Ra+1,a),r=0;r<bi;r++)Ta[r*2+1]=5,Ta[r*2]=nh(r,5);Xd=new lu(gr,Fu,za+1,Ra,wn),eh=new lu(Ta,ss,0,bi,wn),th=new lu(new Array(0),Gy,0,tl,Wy)},ah=r=>{let e;for(e=0;e<Ra;e++)r.dyn_ltree[e*2]=0;for(e=0;e<bi;e++)r.dyn_dtree[e*2]=0;for(e=0;e<tl;e++)r.bl_tree[e*2]=0;r.dyn_ltree[rl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},oh=r=>{r.bi_valid>8?Fa(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Nf=(r,e,t,n)=>{let i=e*2,a=t*2;return r[i]<r[a]||r[i]===r[a]&&n[e]<=n[t]},fu=(r,e,t)=>{let n=r.heap[t],i=t<<1;for(;i<=r.heap_len&&(i<r.heap_len&&Nf(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!Nf(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n},Df=(r,e,t)=>{let n,i,a=0,o,s;if(r.sym_next!==0)do n=r.pending_buf[r.sym_buf+a++]&255,n+=(r.pending_buf[r.sym_buf+a++]&255)<<8,i=r.pending_buf[r.sym_buf+a++],n===0?Xt(r,i,e):(o=La[i],Xt(r,o+za+1,e),s=Fu[o],s!==0&&(i-=nl[o],ht(r,i,s)),n--,o=rh(n),Xt(r,o,t),s=ss[o],s!==0&&(n-=As[o],ht(r,n,s)));while(a<r.sym_next);Xt(r,rl,e)},$u=(r,e)=>{let t=e.dyn_tree,n=e.stat_desc.static_tree,i=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,u;for(r.heap_len=0,r.heap_max=Kd,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--,i&&(r.static_len-=n[u*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)fu(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],fu(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++,fu(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],Jy(r,e),ih(t,c,r.bl_count)},Cf=(r,e,t)=>{let n,i=-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,n=0;n<=t;n++)a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)&&(s<u?r.bl_tree[a*2]+=s:a!==0?(a!==i&&r.bl_tree[a*2]++,r.bl_tree[Hd*2]++):s<=10?r.bl_tree[Jd*2]++:r.bl_tree[Yd*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},Rf=(r,e,t)=>{let n,i=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),n=0;n<=t;n++)if(a=o,o=e[(n+1)*2+1],!(++s<c&&a===o)){if(s<u)do Xt(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==i&&(Xt(r,a,r.bl_tree),s--),Xt(r,Hd,r.bl_tree),ht(r,s-3,2)):s<=10?(Xt(r,Jd,r.bl_tree),ht(r,s-3,3)):(Xt(r,Yd,r.bl_tree),ht(r,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Zy=r=>{let e;for(Cf(r,r.dyn_ltree,r.l_desc.max_code),Cf(r,r.dyn_dtree,r.d_desc.max_code),$u(r,r.bl_desc),e=tl-1;e>=3&&r.bl_tree[Zd[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},Xy=(r,e,t,n)=>{let i;for(ht(r,e-257,5),ht(r,t-1,5),ht(r,n-4,4),i=0;i<n;i++)ht(r,r.bl_tree[Zd[i]*2+1],3);Rf(r,r.dyn_ltree,e-1),Rf(r,r.dyn_dtree,t-1)},ev=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Af;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Of;for(t=32;t<za;t++)if(r.dyn_ltree[t*2]!==0)return Of;return Af},Pf=!1,tv=r=>{Pf||(Yy(),Pf=!0),r.l_desc=new pu(r.dyn_ltree,Xd),r.d_desc=new pu(r.dyn_dtree,eh),r.bl_desc=new pu(r.bl_tree,th),r.bi_buf=0,r.bi_valid=0,ah(r)},sh=(r,e,t,n)=>{ht(r,(By<<1)+(n?1:0),3),oh(r),Fa(r,t),Fa(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},rv=r=>{ht(r,Gd<<1,3),Xt(r,rl,gr),Hy(r)},nv=(r,e,t,n)=>{let i,a,o=0;r.level>0?(r.strm.data_type===qy&&(r.strm.data_type=ev(r)),$u(r,r.l_desc),$u(r,r.d_desc),o=Zy(r),i=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=i&&(i=a)):i=a=t+5,t+4<=i&&e!==-1?sh(r,e,t,n):r.strategy===Uy||a===i?(ht(r,(Gd<<1)+(n?1:0),3),Df(r,gr,Ta)):(ht(r,(Vy<<1)+(n?1:0),3),Xy(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Df(r,r.dyn_ltree,r.dyn_dtree)),ah(r),n&&oh(r)},iv=(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[(La[t]+za+1)*2]++,r.dyn_dtree[rh(e)*2]++),r.sym_next===r.sym_end),av=tv,ov=sh,sv=nv,cv=iv,uv=rv,lv={_tr_init:av,_tr_stored_block:ov,_tr_flush_block:sv,_tr_tally:cv,_tr_align:uv},pv=(r,e,t,n)=>{let i=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do i=i+e[n++]|0,a=a+i|0;while(--o);i%=65521,a%=65521}return i|a<<16|0},$a=pv,fv=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var n=0;n<8;n++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},dv=new Uint32Array(fv()),hv=(r,e,t,n)=>{let i=dv,a=n+t;r^=-1;for(let o=n;o<a;o++)r=r>>>8^i[(r^e[o])&255];return r^-1},Qe=hv,Cn={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"},qn={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:mv,_tr_stored_block:Mu,_tr_flush_block:gv,_tr_tally:Br,_tr_align:yv}=lv,{Z_NO_FLUSH:Vr,Z_PARTIAL_FLUSH:vv,Z_FULL_FLUSH:bv,Z_FINISH:Ct,Z_BLOCK:Lf,Z_OK:Ye,Z_STREAM_END:Ff,Z_STREAM_ERROR:tr,Z_DATA_ERROR:Sv,Z_BUF_ERROR:du,Z_DEFAULT_COMPRESSION:_v,Z_FILTERED:wv,Z_HUFFMAN_ONLY:Qo,Z_RLE:Ev,Z_FIXED:xv,Z_DEFAULT_STRATEGY:Iv,Z_UNKNOWN:Tv,Z_DEFLATED:qs}=qn,kv=9,Av=15,Ov=8,Nv=29,Dv=256,ju=Dv+1+Nv,Cv=30,Rv=19,Pv=2*ju+1,Lv=15,ie=3,$r=258,rr=$r+ie+1,Fv=32,xi=42,il=57,Uu=69,qu=73,Bu=91,Vu=103,En=113,Sa=666,st=1,Ri=2,Rn=3,Pi=4,$v=3,xn=(r,e)=>(r.msg=Cn[e],e),$f=r=>r*2-(r>4?9:0),Fr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},Mv=r=>{let e,t,n,i=r.w_size;e=r.hash_size,n=e;do t=r.head[--n],r.head[n]=t>=i?t-i:0;while(--e);e=i,n=e;do t=r.prev[--n],r.prev[n]=t>=i?t-i:0;while(--e)},jv=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,Qr=jv,vt=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))},_t=(r,e)=>{gv(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,vt(r.strm)},fe=(r,e)=>{r.pending_buf[r.pending++]=e},aa=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Qu=(r,e,t,n)=>{let i=r.avail_in;return i>n&&(i=n),i===0?0:(r.avail_in-=i,e.set(r.input.subarray(r.next_in,r.next_in+i),t),r.state.wrap===1?r.adler=$a(r.adler,e,i,t):r.state.wrap===2&&(r.adler=Qe(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)},ch=(r,e)=>{let t=r.max_chain_length,n=r.strstart,i,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-rr?r.strstart-(r.w_size-rr):0,u=r.window,l=r.w_mask,d=r.prev,f=r.strstart+$r,p=u[n+o-1],h=u[n+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(i=e,!(u[i+o]!==h||u[i+o-1]!==p||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(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]===u[++i]&&n<f);if(a=$r-(f-n),n=f-$r,a>o){if(r.match_start=e,o=a,a>=s)break;p=u[n+o-1],h=u[n+o]}}while((e=d[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Ii=r=>{let e=r.w_size,t,n,i;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-rr)&&(r.window.set(r.window.subarray(e,e+e-n),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),Mv(r),n+=e),r.strm.avail_in===0)break;if(t=Qu(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=t,r.lookahead+r.insert>=ie)for(i=r.strstart-r.insert,r.ins_h=r.window[i],r.ins_h=Qr(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=Qr(r,r.ins_h,r.window[i+ie-1]),r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,r.insert--,!(r.lookahead+r.insert<ie)););}while(r.lookahead<rr&&r.strm.avail_in!==0)},uh=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,n,i,a,o=0,s=r.strm.avail_in;do{if(n=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,i=r.strstart-r.block_start,n>i+r.strm.avail_in&&(n=i+r.strm.avail_in),n>a&&(n=a),n<t&&(n===0&&e!==Ct||e===Vr||n!==i+r.strm.avail_in)))break;o=e===Ct&&n===i+r.strm.avail_in?1:0,Mu(r,0,0,o),r.pending_buf[r.pending-4]=n,r.pending_buf[r.pending-3]=n>>8,r.pending_buf[r.pending-2]=~n,r.pending_buf[r.pending-1]=~n>>8,vt(r.strm),i&&(i>n&&(i=n),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+i),r.strm.next_out),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i,r.block_start+=i,n-=i),n&&(Qu(r.strm,r.strm.output,r.strm.next_out,n),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n)}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?Pi:e!==Vr&&e!==Ct&&r.strm.avail_in===0&&r.strstart===r.block_start?Ri:(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&&(Qu(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,i=r.strstart-r.block_start,(i>=t||(i||e===Ct)&&e!==Vr&&r.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Ct&&r.strm.avail_in===0&&n===i?1:0,Mu(r,r.block_start,n,o),r.block_start+=n,vt(r.strm)),o?Rn:st)},hu=(r,e)=>{let t,n;for(;;){if(r.lookahead<rr){if(Ii(r),r.lookahead<rr&&e===Vr)return st;if(r.lookahead===0)break}if(t=0,r.lookahead>=ie&&(r.ins_h=Qr(r,r.ins_h,r.window[r.strstart+ie-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-rr&&(r.match_length=ch(r,t)),r.match_length>=ie)if(n=Br(r,r.strstart-r.match_start,r.match_length-ie),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ie){r.match_length--;do r.strstart++,r.ins_h=Qr(r,r.ins_h,r.window[r.strstart+ie-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=Qr(r,r.ins_h,r.window[r.strstart+1]);else n=Br(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(_t(r,!1),r.strm.avail_out===0))return st}return r.insert=r.strstart<ie-1?r.strstart:ie-1,e===Ct?(_t(r,!0),r.strm.avail_out===0?Rn:Pi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?st:Ri},fi=(r,e)=>{let t,n,i;for(;;){if(r.lookahead<rr){if(Ii(r),r.lookahead<rr&&e===Vr)return st;if(r.lookahead===0)break}if(t=0,r.lookahead>=ie&&(r.ins_h=Qr(r,r.ins_h,r.window[r.strstart+ie-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=ie-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-rr&&(r.match_length=ch(r,t),r.match_length<=5&&(r.strategy===wv||r.match_length===ie&&r.strstart-r.match_start>4096)&&(r.match_length=ie-1)),r.prev_length>=ie&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-ie,n=Br(r,r.strstart-1-r.prev_match,r.prev_length-ie),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=Qr(r,r.ins_h,r.window[r.strstart+ie-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=ie-1,r.strstart++,n&&(_t(r,!1),r.strm.avail_out===0))return st}else if(r.match_available){if(n=Br(r,0,r.window[r.strstart-1]),n&&_t(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return st}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Br(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ie-1?r.strstart:ie-1,e===Ct?(_t(r,!0),r.strm.avail_out===0?Rn:Pi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?st:Ri},Uv=(r,e)=>{let t,n,i,a,o=r.window;for(;;){if(r.lookahead<=$r){if(Ii(r),r.lookahead<=$r&&e===Vr)return st;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ie&&r.strstart>0&&(i=r.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=r.strstart+$r;do;while(n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&n===o[++i]&&i<a);r.match_length=$r-(a-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ie?(t=Br(r,1,r.match_length-ie),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=Br(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(_t(r,!1),r.strm.avail_out===0))return st}return r.insert=0,e===Ct?(_t(r,!0),r.strm.avail_out===0?Rn:Pi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?st:Ri},qv=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Ii(r),r.lookahead===0)){if(e===Vr)return st;break}if(r.match_length=0,t=Br(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(_t(r,!1),r.strm.avail_out===0))return st}return r.insert=0,e===Ct?(_t(r,!0),r.strm.avail_out===0?Rn:Pi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?st:Ri};function Kt(r,e,t,n,i){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=n,this.func=i}var _a=[new Kt(0,0,0,0,uh),new Kt(4,4,8,4,hu),new Kt(4,5,16,8,hu),new Kt(4,6,32,32,hu),new Kt(4,4,16,16,fi),new Kt(8,16,32,32,fi),new Kt(8,16,128,128,fi),new Kt(8,32,128,256,fi),new Kt(32,128,258,1024,fi),new Kt(32,258,258,4096,fi)],Bv=r=>{r.window_size=2*r.w_size,Fr(r.head),r.max_lazy_match=_a[r.level].max_lazy,r.good_match=_a[r.level].good_length,r.nice_match=_a[r.level].nice_length,r.max_chain_length=_a[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ie-1,r.match_available=0,r.ins_h=0};function Vv(){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=qs,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(Pv*2),this.dyn_dtree=new Uint16Array((2*Cv+1)*2),this.bl_tree=new Uint16Array((2*Rv+1)*2),Fr(this.dyn_ltree),Fr(this.dyn_dtree),Fr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(Lv+1),this.heap=new Uint16Array(2*ju+1),Fr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*ju+1),Fr(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 Wa=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==xi&&e.status!==il&&e.status!==Uu&&e.status!==qu&&e.status!==Bu&&e.status!==Vu&&e.status!==En&&e.status!==Sa?1:0},lh=r=>{if(Wa(r))return xn(r,tr);r.total_in=r.total_out=0,r.data_type=Tv;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?il:e.wrap?xi:En,r.adler=e.wrap===2?0:1,e.last_flush=-2,mv(e),Ye},ph=r=>{let e=lh(r);return e===Ye&&Bv(r.state),e},Qv=(r,e)=>Wa(r)||r.state.wrap!==2?tr:(r.state.gzhead=e,Ye),fh=(r,e,t,n,i,a)=>{if(!r)return tr;let o=1;if(e===_v&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>kv||t!==qs||n<8||n>15||e<0||e>9||a<0||a>xv||n===8&&o!==1)return xn(r,tr);n===8&&(n=9);let s=new Vv;return r.state=s,s.strm=r,s.status=xi,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ie-1)/ie),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,ph(r)},zv=(r,e)=>fh(r,e,qs,Av,Ov,Iv),Wv=(r,e)=>{if(Wa(r)||e>Lf||e<0)return r?xn(r,tr):tr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Sa&&e!==Ct)return xn(r,r.avail_out===0?du:tr);let n=t.last_flush;if(t.last_flush=e,t.pending!==0){if(vt(r),r.avail_out===0)return t.last_flush=-1,Ye}else if(r.avail_in===0&&$f(e)<=$f(n)&&e!==Ct)return xn(r,du);if(t.status===Sa&&r.avail_in!==0)return xn(r,du);if(t.status===xi&&t.wrap===0&&(t.status=En),t.status===xi){let i=qs+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Qo||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=Fv),i+=31-i%31,aa(t,i),t.strstart!==0&&(aa(t,r.adler>>>16),aa(t,r.adler&65535)),r.adler=1,t.status=En,vt(r),t.pending!==0)return t.last_flush=-1,Ye}if(t.status===il){if(r.adler=0,fe(t,31),fe(t,139),fe(t,8),t.gzhead)fe(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)),fe(t,t.gzhead.time&255),fe(t,t.gzhead.time>>8&255),fe(t,t.gzhead.time>>16&255),fe(t,t.gzhead.time>>24&255),fe(t,t.level===9?2:t.strategy>=Qo||t.level<2?4:0),fe(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(fe(t,t.gzhead.extra.length&255),fe(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Qe(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Uu;else if(fe(t,0),fe(t,0),fe(t,0),fe(t,0),fe(t,0),fe(t,t.level===9?2:t.strategy>=Qo||t.level<2?4:0),fe(t,$v),t.status=En,vt(r),t.pending!==0)return t.last_flush=-1,Ye}if(t.status===Uu){if(t.gzhead.extra){let i=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>i&&(r.adler=Qe(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=s,vt(r),t.pending!==0)return t.last_flush=-1,Ye;i=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>i&&(r.adler=Qe(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=qu}if(t.status===qu){if(t.gzhead.name){let i=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(r.adler=Qe(r.adler,t.pending_buf,t.pending-i,i)),vt(r),t.pending!==0)return t.last_flush=-1,Ye;i=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,fe(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Qe(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Bu}if(t.status===Bu){if(t.gzhead.comment){let i=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>i&&(r.adler=Qe(r.adler,t.pending_buf,t.pending-i,i)),vt(r),t.pending!==0)return t.last_flush=-1,Ye;i=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,fe(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Qe(r.adler,t.pending_buf,t.pending-i,i))}t.status=Vu}if(t.status===Vu){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(vt(r),t.pending!==0))return t.last_flush=-1,Ye;fe(t,r.adler&255),fe(t,r.adler>>8&255),r.adler=0}if(t.status=En,vt(r),t.pending!==0)return t.last_flush=-1,Ye}if(r.avail_in!==0||t.lookahead!==0||e!==Vr&&t.status!==Sa){let i=t.level===0?uh(t,e):t.strategy===Qo?qv(t,e):t.strategy===Ev?Uv(t,e):_a[t.level].func(t,e);if((i===Rn||i===Pi)&&(t.status=Sa),i===st||i===Rn)return r.avail_out===0&&(t.last_flush=-1),Ye;if(i===Ri&&(e===vv?yv(t):e!==Lf&&(Mu(t,0,0,!1),e===bv&&(Fr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),vt(r),r.avail_out===0))return t.last_flush=-1,Ye}return e!==Ct?Ye:t.wrap<=0?Ff:(t.wrap===2?(fe(t,r.adler&255),fe(t,r.adler>>8&255),fe(t,r.adler>>16&255),fe(t,r.adler>>24&255),fe(t,r.total_in&255),fe(t,r.total_in>>8&255),fe(t,r.total_in>>16&255),fe(t,r.total_in>>24&255)):(aa(t,r.adler>>>16),aa(t,r.adler&65535)),vt(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Ye:Ff)},Gv=r=>{if(Wa(r))return tr;let e=r.state.status;return r.state=null,e===En?xn(r,Sv):Ye},Kv=(r,e)=>{let t=e.length;if(Wa(r))return tr;let n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==xi||n.lookahead)return tr;if(i===1&&(r.adler=$a(r.adler,e,t,0)),n.wrap=0,t>=n.w_size){i===0&&(Fr(n.head),n.strstart=0,n.block_start=0,n.insert=0);let c=new Uint8Array(n.w_size);c.set(e.subarray(t-n.w_size,t),0),e=c,t=n.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,Ii(n);n.lookahead>=ie;){let c=n.strstart,u=n.lookahead-(ie-1);do n.ins_h=Qr(n,n.ins_h,n.window[c+ie-1]),n.prev[c&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=c,c++;while(--u);n.strstart=c,n.lookahead=ie-1,Ii(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ie-1,n.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,n.wrap=i,Ye},Hv=zv,Jv=fh,Yv=ph,Zv=lh,Xv=Qv,eb=Wv,tb=Gv,rb=Kv,nb="pako deflate (from Nodeca project)",ka={deflateInit:Hv,deflateInit2:Jv,deflateReset:Yv,deflateResetKeep:Zv,deflateSetHeader:Xv,deflate:eb,deflateEnd:tb,deflateSetDictionary:rb,deflateInfo:nb},ib=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),ab=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 n in t)ib(t,n)&&(r[n]=t[n])}}return r},ob=r=>{let e=0;for(let n=0,i=r.length;n<i;n++)e+=r[n].length;let t=new Uint8Array(e);for(let n=0,i=0,a=r.length;n<a;n++){let o=r[n];t.set(o,i),i+=o.length}return t},Bs={assign:ab,flattenChunks:ob},dh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){dh=!1}var Ma=new Uint8Array(256);for(let r=0;r<256;r++)Ma[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Ma[254]=Ma[254]=1;var sb=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,n,i,a,o=r.length,s=0;for(i=0;i<o;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<o&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,i=0;a<s;i++)t=r.charCodeAt(i),(t&64512)===55296&&i+1<o&&(n=r.charCodeAt(i+1),(n&64512)===56320&&(t=65536+(t-55296<<10)+(n-56320),i++)),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},cb=(r,e)=>{if(e<65534&&r.subarray&&dh)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let n=0;n<e;n++)t+=String.fromCharCode(r[n]);return t},ub=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let n,i,a=new Array(t*2);for(i=0,n=0;n<t;){let o=r[n++];if(o<128){a[i++]=o;continue}let s=Ma[o];if(s>4){a[i++]=65533,n+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&n<t;)o=o<<6|r[n++]&63,s--;if(s>1){a[i++]=65533;continue}o<65536?a[i++]=o:(o-=65536,a[i++]=55296|o>>10&1023,a[i++]=56320|o&1023)}return cb(a,i)},lb=(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+Ma[r[t]]>e?t:e},ja={string2buf:sb,buf2string:ub,utf8border:lb};function pb(){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 hh=pb,mh=Object.prototype.toString,{Z_NO_FLUSH:fb,Z_SYNC_FLUSH:db,Z_FULL_FLUSH:hb,Z_FINISH:mb,Z_OK:Os,Z_STREAM_END:gb,Z_DEFAULT_COMPRESSION:yb,Z_DEFAULT_STRATEGY:vb,Z_DEFLATED:bb}=qn;function Ga(r){this.options=Bs.assign({level:yb,method:bb,chunkSize:16384,windowBits:15,memLevel:8,strategy:vb},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 hh,this.strm.avail_out=0;let t=ka.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Os)throw new Error(Cn[t]);if(e.header&&ka.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=ja.string2buf(e.dictionary):mh.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=ka.deflateSetDictionary(this.strm,n),t!==Os)throw new Error(Cn[t]);this._dict_set=!0}}Ga.prototype.push=function(r,e){let t=this.strm,n=this.options.chunkSize,i,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?mb:fb,typeof r=="string"?t.input=ja.string2buf(r):mh.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(n),t.next_out=0,t.avail_out=n),(a===db||a===hb)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=ka.deflate(t,a),i===gb)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=ka.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Os;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};Ga.prototype.onData=function(r){this.chunks.push(r)};Ga.prototype.onEnd=function(r){r===Os&&(this.result=Bs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function al(r,e){let t=new Ga(e);if(t.push(r,!0),t.err)throw t.msg||Cn[t.err];return t.result}function Sb(r,e){return e=e||{},e.raw=!0,al(r,e)}function _b(r,e){return e=e||{},e.gzip=!0,al(r,e)}var wb=Ga,Eb=al,xb=Sb,Ib=_b,Tb=qn,kb={Deflate:wb,deflate:Eb,deflateRaw:xb,gzip:Ib,constants:Tb},zo=16209,Ab=16191,Ob=function r(e,t){let n,i,a,o,s,c,u,l,d,f,p,h,m,y,_,S,w,v,A,R,E,P,L,C,T=e.state;n=e.next_in,L=e.input,i=n+(e.avail_in-5),a=e.next_out,C=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=T.dmax,u=T.wsize,l=T.whave,d=T.wnext,f=T.window,p=T.hold,h=T.bits,m=T.lencode,y=T.distcode,_=(1<<T.lenbits)-1,S=(1<<T.distbits)-1;e:do{h<15&&(p+=L[n++]<<h,h+=8,p+=L[n++]<<h,h+=8),w=m[p&_];t:for(;;){if(v=w>>>24,p>>>=v,h-=v,v=w>>>16&255,v===0)C[a++]=w&65535;else if(v&16){A=w&65535,v&=15,v&&(h<v&&(p+=L[n++]<<h,h+=8),A+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=L[n++]<<h,h+=8,p+=L[n++]<<h,h+=8),w=y[p&S];r:for(;;){if(v=w>>>24,p>>>=v,h-=v,v=w>>>16&255,v&16){if(R=w&65535,v&=15,h<v&&(p+=L[n++]<<h,h+=8,h<v&&(p+=L[n++]<<h,h+=8)),R+=p&(1<<v)-1,R>c){e.msg="invalid distance too far back",T.mode=zo;break e}if(p>>>=v,h-=v,v=a-o,R>v){if(v=R-v,v>l&&T.sane){e.msg="invalid distance too far back",T.mode=zo;break e}if(E=0,P=f,d===0){if(E+=u-v,v<A){A-=v;do C[a++]=f[E++];while(--v);E=a-R,P=C}}else if(d<v){if(E+=u+d-v,v-=d,v<A){A-=v;do C[a++]=f[E++];while(--v);if(E=0,d<A){v=d,A-=v;do C[a++]=f[E++];while(--v);E=a-R,P=C}}}else if(E+=d-v,v<A){A-=v;do C[a++]=f[E++];while(--v);E=a-R,P=C}for(;A>2;)C[a++]=P[E++],C[a++]=P[E++],C[a++]=P[E++],A-=3;A&&(C[a++]=P[E++],A>1&&(C[a++]=P[E++]))}else{E=a-R;do C[a++]=C[E++],C[a++]=C[E++],C[a++]=C[E++],A-=3;while(A>2);A&&(C[a++]=C[E++],A>1&&(C[a++]=C[E++]))}}else if((v&64)===0){w=y[(w&65535)+(p&(1<<v)-1)];continue r}else{e.msg="invalid distance code",T.mode=zo;break e}break}}else if((v&64)===0){w=m[(w&65535)+(p&(1<<v)-1)];continue t}else if(v&32){T.mode=Ab;break e}else{e.msg="invalid literal/length code",T.mode=zo;break e}break}}while(n<i&&a<s);A=h>>3,n-=A,h-=A<<3,p&=(1<<h)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?5+(i-n):5-(n-i),e.avail_out=a<s?257+(s-a):257-(a-s),T.hold=p,T.bits=h},di=15,Mf=852,jf=592,Uf=0,mu=1,qf=2,Nb=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]),Db=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]),Cb=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]),Rb=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]),Pb=(r,e,t,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,d=0,f=0,p=0,h=0,m=0,y=0,_=0,S=0,w,v,A,R,E,P=null,L,C=new Uint16Array(di+1),T=new Uint16Array(di+1),xe=null,ne,M,ve;for(u=0;u<=di;u++)C[u]=0;for(l=0;l<n;l++)C[e[t+l]]++;for(p=c,f=di;f>=1&&C[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&C[d]===0;d++);for(p<d&&(p=d),y=1,u=1;u<=di;u++)if(y<<=1,y-=C[u],y<0)return-1;if(y>0&&(r===Uf||f!==1))return-1;for(T[1]=0,u=1;u<di;u++)T[u+1]=T[u]+C[u];for(l=0;l<n;l++)e[t+l]!==0&&(o[T[e[t+l]]++]=l);if(r===Uf?(P=xe=o,L=20):r===mu?(P=Nb,xe=Db,L=257):(P=Cb,xe=Rb,L=0),S=0,l=0,u=d,E=a,h=p,m=0,A=-1,_=1<<p,R=_-1,r===mu&&_>Mf||r===qf&&_>jf)return 1;for(;;){ne=u-m,o[l]+1<L?(M=0,ve=o[l]):o[l]>=L?(M=xe[o[l]-L],ve=P[o[l]-L]):(M=32+64,ve=0),w=1<<u-m,v=1<<h,d=v;do v-=w,i[E+(S>>m)+v]=ne<<24|M<<16|ve|0;while(v!==0);for(w=1<<u-1;S&w;)w>>=1;if(w!==0?(S&=w-1,S+=w):S=0,l++,--C[u]===0){if(u===f)break;u=e[t+o[l]]}if(u>p&&(S&R)!==A){for(m===0&&(m=p),E+=d,h=u-m,y=1<<h;h+m<f&&(y-=C[h+m],!(y<=0));)h++,y<<=1;if(_+=1<<h,r===mu&&_>Mf||r===qf&&_>jf)return 1;A=S&R,i[A]=p<<24|h<<16|E-a|0}}return S!==0&&(i[E+S]=u-m<<24|64<<16|0),s.bits=p,0},Aa=Pb,Lb=0,gh=1,yh=2,{Z_FINISH:Bf,Z_BLOCK:Fb,Z_TREES:Wo,Z_OK:Pn,Z_STREAM_END:$b,Z_NEED_DICT:Mb,Z_STREAM_ERROR:Rt,Z_DATA_ERROR:vh,Z_MEM_ERROR:bh,Z_BUF_ERROR:jb,Z_DEFLATED:Vf}=qn,Vs=16180,Qf=16181,zf=16182,Wf=16183,Gf=16184,Kf=16185,Hf=16186,Jf=16187,Yf=16188,Zf=16189,Ns=16190,fr=16191,gu=16192,Xf=16193,yu=16194,ed=16195,td=16196,rd=16197,nd=16198,Go=16199,Ko=16200,id=16201,ad=16202,od=16203,sd=16204,cd=16205,vu=16206,ud=16207,ld=16208,ke=16209,Sh=16210,_h=16211,Ub=852,qb=592,Bb=15,Vb=Bb,pd=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Qb(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var Bn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Vs||e.mode>_h?1:0},wh=r=>{if(Bn(r))return Rt;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=Vs,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(Ub),e.distcode=e.distdyn=new Int32Array(qb),e.sane=1,e.back=-1,Pn},Eh=r=>{if(Bn(r))return Rt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,wh(r)},xh=(r,e)=>{let t;if(Bn(r))return Rt;let n=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Rt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,Eh(r))},Ih=(r,e)=>{if(!r)return Rt;let t=new Qb;r.state=t,t.strm=r,t.window=null,t.mode=Vs;let n=xh(r,e);return n!==Pn&&(r.state=null),n},zb=r=>Ih(r,Vb),fd=!0,bu,Su,Wb=r=>{if(fd){bu=new Int32Array(512),Su=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(Aa(gh,r.lens,0,288,bu,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;Aa(yh,r.lens,0,32,Su,0,r.work,{bits:5}),fd=!1}r.lencode=bu,r.lenbits=9,r.distcode=Su,r.distbits=5},Th=(r,e,t,n)=>{let i,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),n>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(i=a.wsize-a.wnext,i>n&&(i=n),a.window.set(e.subarray(t-n,t-n+i),a.wnext),n-=i,n?(a.window.set(e.subarray(t-n,t),0),a.wnext=n,a.whave=a.wsize):(a.wnext+=i,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=i))),0},Gb=(r,e)=>{let t,n,i,a,o,s,c,u,l,d,f,p,h,m,y=0,_,S,w,v,A,R,E,P,L=new Uint8Array(4),C,T,xe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Bn(r)||!r.output||!r.input&&r.avail_in!==0)return Rt;t=r.state,t.mode===fr&&(t.mode=gu),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,d=s,f=c,P=Pn;e:for(;;)switch(t.mode){case Vs:if(t.wrap===0){t.mode=gu;break}for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.wrap&2&&u===35615){t.wbits===0&&(t.wbits=15),t.check=0,L[0]=u&255,L[1]=u>>>8&255,t.check=Qe(t.check,L,2,0),u=0,l=0,t.mode=Qf;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)!==Vf){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?Zf:fr,u=0,l=0;break;case Qf:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==Vf){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&&(L[0]=u&255,L[1]=u>>>8&255,t.check=Qe(t.check,L,2,0)),u=0,l=0,t.mode=zf;case zf:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.head&&(t.head.time=u),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,L[2]=u>>>16&255,L[3]=u>>>24&255,t.check=Qe(t.check,L,4,0)),u=0,l=0,t.mode=Wf;case Wf:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=Qe(t.check,L,2,0)),u=0,l=0,t.mode=Gf;case Gf:if(t.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=Qe(t.check,L,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=Kf;case Kf: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(n.subarray(a,a+p),E)),t.flags&512&&t.wrap&4&&(t.check=Qe(t.check,n,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=Hf;case Hf:if(t.flags&2048){if(s===0)break e;p=0;do E=n[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=Qe(t.check,n,p,a)),s-=p,a+=p,E)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=Jf;case Jf:if(t.flags&4096){if(s===0)break e;p=0;do E=n[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=Qe(t.check,n,p,a)),s-=p,a+=p,E)break e}else t.head&&(t.head.comment=null);t.mode=Yf;case Yf:if(t.flags&512){for(;l<16;){if(s===0)break e;s--,u+=n[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=fr;break;case Zf:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.adler=t.check=pd(u),u=0,l=0,t.mode=Ns;case Ns: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,Mb;r.adler=t.check=1,t.mode=fr;case fr:if(e===Fb||e===Wo)break e;case gu:if(t.last){u>>>=l&7,l-=l&7,t.mode=vu;break}for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}switch(t.last=u&1,u>>>=1,l-=1,u&3){case 0:t.mode=Xf;break;case 1:if(Wb(t),t.mode=Go,e===Wo){u>>>=2,l-=2;break e}break;case 2:t.mode=td;break;case 3:r.msg="invalid block type",t.mode=ke}u>>>=2,l-=2;break;case Xf:for(u>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,u+=n[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=yu,e===Wo)break e;case yu:t.mode=ed;case ed:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;i.set(n.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=fr;break;case td:for(;l<14;){if(s===0)break e;s--,u+=n[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=rd;case rd:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.lens[xe[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[xe[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,C={bits:t.lenbits},P=Aa(Lb,t.lens,0,19,t.lencode,0,t.work,C),t.lenbits=C.bits,P){r.msg="invalid code lengths set",t.mode=ke;break}t.have=0,t.mode=nd;case nd:for(;t.have<t.nlen+t.ndist;){for(;y=t.lencode[u&(1<<t.lenbits)-1],_=y>>>24,S=y>>>16&255,w=y&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(w<16)u>>>=_,l-=_,t.lens[t.have++]=w;else{if(w===16){for(T=_+2;l<T;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(u>>>=_,l-=_,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(w===17){for(T=_+3;l<T;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,E=0,p=3+(u&7),u>>>=3,l-=3}else{for(T=_+7;l<T;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,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,C={bits:t.lenbits},P=Aa(gh,t.lens,0,t.nlen,t.lencode,0,t.work,C),t.lenbits=C.bits,P){r.msg="invalid literal/lengths set",t.mode=ke;break}if(t.distbits=6,t.distcode=t.distdyn,C={bits:t.distbits},P=Aa(yh,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,C),t.distbits=C.bits,P){r.msg="invalid distances set",t.mode=ke;break}if(t.mode=Go,e===Wo)break e;case Go:t.mode=Ko;case Ko: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,Ob(r,f),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===fr&&(t.back=-1);break}for(t.back=0;y=t.lencode[u&(1<<t.lenbits)-1],_=y>>>24,S=y>>>16&255,w=y&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(S&&(S&240)===0){for(v=_,A=S,R=w;y=t.lencode[R+((u&(1<<v+A)-1)>>v)],_=y>>>24,S=y>>>16&255,w=y&65535,!(v+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=v,l-=v,t.back+=v}if(u>>>=_,l-=_,t.back+=_,t.length=w,S===0){t.mode=cd;break}if(S&32){t.back=-1,t.mode=fr;break}if(S&64){r.msg="invalid literal/length code",t.mode=ke;break}t.extra=S&15,t.mode=id;case id:if(t.extra){for(T=t.extra;l<T;){if(s===0)break e;s--,u+=n[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=ad;case ad:for(;y=t.distcode[u&(1<<t.distbits)-1],_=y>>>24,S=y>>>16&255,w=y&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((S&240)===0){for(v=_,A=S,R=w;y=t.distcode[R+((u&(1<<v+A)-1)>>v)],_=y>>>24,S=y>>>16&255,w=y&65535,!(v+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=v,l-=v,t.back+=v}if(u>>>=_,l-=_,t.back+=_,S&64){r.msg="invalid distance code",t.mode=ke;break}t.offset=w,t.extra=S&15,t.mode=od;case od:if(t.extra){for(T=t.extra;l<T;){if(s===0)break e;s--,u+=n[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=sd;case sd: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=i,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do i[o++]=m[h++];while(--p);t.length===0&&(t.mode=Ko);break;case cd:if(c===0)break e;i[o++]=t.length,c--,t.mode=Ko;break;case vu:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?Qe(t.check,i,f,o-f):$a(t.check,i,f,o-f)),f=c,t.wrap&4&&(t.flags?u:pd(u))!==t.check){r.msg="incorrect data check",t.mode=ke;break}u=0,l=0}t.mode=ud;case ud:if(t.wrap&&t.flags){for(;l<32;){if(s===0)break e;s--,u+=n[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=ld;case ld:P=$b;break e;case ke:P=vh;break e;case Sh:return bh;case _h:default:return Rt}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<vu||e!==Bf))&&Th(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?Qe(t.check,i,f,r.next_out-f):$a(t.check,i,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===fr?128:0)+(t.mode===Go||t.mode===yu?256:0),(d===0&&f===0||e===Bf)&&P===Pn&&(P=jb),P},Kb=r=>{if(Bn(r))return Rt;let e=r.state;return e.window&&(e.window=null),r.state=null,Pn},Hb=(r,e)=>{if(Bn(r))return Rt;let t=r.state;return(t.wrap&2)===0?Rt:(t.head=e,e.done=!1,Pn)},Jb=(r,e)=>{let t=e.length,n,i,a;return Bn(r)||(n=r.state,n.wrap!==0&&n.mode!==Ns)?Rt:n.mode===Ns&&(i=1,i=$a(i,e,t,0),i!==n.check)?vh:(a=Th(r,e,t,t),a?(n.mode=Sh,bh):(n.havedict=1,Pn))},Yb=Eh,Zb=xh,Xb=wh,eS=zb,tS=Ih,rS=Gb,nS=Kb,iS=Hb,aS=Jb,oS="pako inflate (from Nodeca project)",yr={inflateReset:Yb,inflateReset2:Zb,inflateResetKeep:Xb,inflateInit:eS,inflateInit2:tS,inflate:rS,inflateEnd:nS,inflateGetHeader:iS,inflateSetDictionary:aS,inflateInfo:oS};function sS(){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 cS=sS,kh=Object.prototype.toString,{Z_NO_FLUSH:uS,Z_FINISH:lS,Z_OK:Ua,Z_STREAM_END:_u,Z_NEED_DICT:wu,Z_STREAM_ERROR:pS,Z_DATA_ERROR:dd,Z_MEM_ERROR:fS}=qn;function Ka(r){this.options=Bs.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 hh,this.strm.avail_out=0;let t=yr.inflateInit2(this.strm,e.windowBits);if(t!==Ua)throw new Error(Cn[t]);if(this.header=new cS,yr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=ja.string2buf(e.dictionary):kh.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=yr.inflateSetDictionary(this.strm,e.dictionary),t!==Ua)))throw new Error(Cn[t])}Ka.prototype.push=function(r,e){let t=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?lS:uS,kh.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(n),t.next_out=0,t.avail_out=n),a=yr.inflate(t,o),a===wu&&i&&(a=yr.inflateSetDictionary(t,i),a===Ua?a=yr.inflate(t,o):a===dd&&(a=wu));t.avail_in>0&&a===_u&&t.state.wrap>0&&r[t.next_in]!==0;)yr.inflateReset(t),a=yr.inflate(t,o);switch(a){case pS:case dd:case wu:case fS:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===_u))if(this.options.to==="string"){let c=ja.utf8border(t.output,t.next_out),u=t.next_out-c,l=ja.buf2string(t.output,c);t.next_out=u,t.avail_out=n-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===Ua&&s===0)){if(a===_u)return a=yr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Ka.prototype.onData=function(r){this.chunks.push(r)};Ka.prototype.onEnd=function(r){r===Ua&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Bs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ol(r,e){let t=new Ka(e);if(t.push(r),t.err)throw t.msg||Cn[t.err];return t.result}function dS(r,e){return e=e||{},e.raw=!0,ol(r,e)}var hS=Ka,mS=ol,gS=dS,yS=ol,vS=qn,bS={Inflate:hS,inflate:mS,inflateRaw:gS,ungzip:yS,constants:vS},{Deflate:SS,deflate:_S,deflateRaw:wS,gzip:ES}=kb,{Inflate:xS,inflate:IS,inflateRaw:TS,ungzip:kS}=bS,AS=SS,OS=_S,NS=wS,DS=ES,CS=xS,RS=IS,PS=TS,LS=kS,FS=qn,$S={Deflate:AS,deflate:OS,deflateRaw:NS,gzip:DS,Inflate:CS,inflate:RS,inflateRaw:PS,ungzip:LS,constants:FS},_e=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},we=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ds=class{constructor(e,t){this.input=e,this.output=t}};_e([g(),we("design:type",String)],Ds.prototype,"input",void 0);_e([g(),we("design:type",String)],Ds.prototype,"output",void 0);Ds=_e([We(),we("design:paramtypes",[String,String])],Ds);var Cs=class{constructor(e,t){this.input=e,this.output=t}};_e([g(),we("design:type",String)],Cs.prototype,"input",void 0);_e([g(),we("design:type",String)],Cs.prototype,"output",void 0);Cs=_e([z(),we("design:paramtypes",[String,String])],Cs);var Kr=class{constructor(e,t,n,i,a){this.name=e,this.modelId=t,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};_e([g(),we("design:type",String)],Kr.prototype,"name",void 0);_e([g(),we("design:type",String)],Kr.prototype,"modelId",void 0);_e([g(),we("design:type",String)],Kr.prototype,"systemPrompt",void 0);_e([g(),we("design:type",Array)],Kr.prototype,"promptExamples",void 0);_e([g(),we("design:type",String)],Kr.prototype,"metaData",void 0);Kr=_e([We(),we("design:paramtypes",[String,String,String,Array,String])],Kr);var ar=class{constructor(e,t,n,i,a,o,s,c){this.name=e,this.modelId=t,this.taskId=n,this.systemPrompt=i,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};_e([g(),we("design:type",String)],ar.prototype,"name",void 0);_e([g(),we("design:type",String)],ar.prototype,"modelId",void 0);_e([g(),we("design:type",String)],ar.prototype,"taskId",void 0);_e([g(),we("design:type",String)],ar.prototype,"systemPrompt",void 0);_e([g(),we("design:type",Array)],ar.prototype,"promptExamples",void 0);_e([g(),we("design:type",String)],ar.prototype,"metaData",void 0);_e([g(),we("design:type",String)],ar.prototype,"createdAt",void 0);_e([g(),we("design:type",String)],ar.prototype,"updatedAt",void 0);ar=_e([z(),we("design:paramtypes",[String,String,String,String,Array,String,String,String])],ar);var Ln=class{constructor(e,t,n,i,a){this.model=e,this.status=t,this.progress=n,this.downloaded=i,this.loaded=a}};_e([g(),we("design:type",String)],Ln.prototype,"model",void 0);_e([g(),we("design:type",String)],Ln.prototype,"status",void 0);_e([g(),we("design:type",Number)],Ln.prototype,"progress",void 0);_e([g(),we("design:type",Boolean)],Ln.prototype,"downloaded",void 0);_e([g(),we("design:type",Boolean)],Ln.prototype,"loaded",void 0);Ln=_e([z(),we("design:paramtypes",[String,String,Number,Boolean,Boolean])],Ln);var MS=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Be=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ue,cs,zu=class{constructor(e,t=!0){Ue.set(this,void 0),cs.set(this,new Map),MS(this,Ue,e,"f")}async getModels(){let e=await Be(this,Ue,"f").query({query:I`
743
771
  query {
744
772
  aiGetModels {
745
773
  id
@@ -763,23 +791,23 @@ triggerMatch
763
791
  modelType
764
792
  }
765
793
  }
766
- `});return k(e).aiGetModels}async addModel(e){let r=await qe(this,je,"f").mutate({mutation:I`
794
+ `});return k(e).aiGetModels}async addModel(e){let t=await Be(this,Ue,"f").mutate({mutation:I`
767
795
  mutation($model: ModelInput!) {
768
796
  aiAddModel(model: $model)
769
797
  }
770
- `,variables:{model:e}});return k(r).aiAddModel}async updateModel(e,r){let n=await qe(this,je,"f").mutate({mutation:I`
798
+ `,variables:{model:e}});return k(t).aiAddModel}async updateModel(e,t){let n=await Be(this,Ue,"f").mutate({mutation:I`
771
799
  mutation($modelId: String!, $model: ModelInput!) {
772
800
  aiUpdateModel(modelId: $modelId, model: $model)
773
801
  }
774
- `,variables:{modelId:e,model:r}});return k(n).aiUpdateModel}async removeModel(e){let r=await qe(this,je,"f").mutate({mutation:I`
802
+ `,variables:{modelId:e,model:t}});return k(n).aiUpdateModel}async removeModel(e){let t=await Be(this,Ue,"f").mutate({mutation:I`
775
803
  mutation($modelId: String!) {
776
804
  aiRemoveModel(modelId: $modelId)
777
805
  }
778
- `,variables:{modelId:e}});return k(r).aiRemoveModel}async setDefaultModel(e,r){let n=await qe(this,je,"f").mutate({mutation:I`
806
+ `,variables:{modelId:e}});return k(t).aiRemoveModel}async setDefaultModel(e,t){let n=await Be(this,Ue,"f").mutate({mutation:I`
779
807
  mutation($modelType: ModelType!, $modelId: String!) {
780
808
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
781
809
  }
782
- `,variables:{modelId:r,modelType:e}});return k(n).aiSetDefaultModel}async getDefaultModel(e){let r=await qe(this,je,"f").query({query:I`
810
+ `,variables:{modelId:t,modelType:e}});return k(n).aiSetDefaultModel}async getDefaultModel(e){let t=await Be(this,Ue,"f").query({query:I`
783
811
  query($modelType: ModelType!) {
784
812
  aiGetDefaultModel(modelType: $modelType) {
785
813
  id
@@ -803,7 +831,7 @@ triggerMatch
803
831
  modelType
804
832
  }
805
833
  }
806
- `,variables:{modelType:e}});return k(r).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await qe(this,je,"f").query({query:I`
834
+ `,variables:{modelType:e}});return k(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=k(await Be(this,Ue,"f").query({query:I`
807
835
  query {
808
836
  aiTasks {
809
837
  name
@@ -819,7 +847,7 @@ triggerMatch
819
847
  updatedAt
820
848
  }
821
849
  }
822
- `}));return e}async addTask(e,r,n,i,a){let o=new Gr(e,r,n,i,a),{aiAddTask:s}=k(await qe(this,je,"f").mutate({mutation:I`
850
+ `}));return e}async addTask(e,t,n,i,a){let o=new Kr(e,t,n,i,a),{aiAddTask:s}=k(await Be(this,Ue,"f").mutate({mutation:I`
823
851
  mutation AiAddTask($task: AITaskInput!) {
824
852
  aiAddTask(task: $task) {
825
853
  name
@@ -835,7 +863,7 @@ triggerMatch
835
863
  updatedAt
836
864
  }
837
865
  }
838
- `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:r}=k(await qe(this,je,"f").mutate({mutation:I`
866
+ `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=k(await Be(this,Ue,"f").mutate({mutation:I`
839
867
  mutation AiRemoveTask($taskId: String!) {
840
868
  aiRemoveTask(taskId: $taskId) {
841
869
  name
@@ -851,7 +879,7 @@ triggerMatch
851
879
  updatedAt
852
880
  }
853
881
  }
854
- `,variables:{taskId:e}}));return r}async updateTask(e,r){let{aiUpdateTask:n}=k(await qe(this,je,"f").mutate({mutation:I`
882
+ `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:n}=k(await Be(this,Ue,"f").mutate({mutation:I`
855
883
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
856
884
  aiUpdateTask(taskId: $taskId, task: $task) {
857
885
  name
@@ -867,7 +895,7 @@ triggerMatch
867
895
  updatedAt
868
896
  }
869
897
  }
870
- `,variables:{taskId:e,task:{name:r.name,modelId:r.modelId,systemPrompt:r.systemPrompt,promptExamples:r.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:r}=k(await qe(this,je,"f").query({query:I`
898
+ `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=k(await Be(this,Ue,"f").query({query:I`
871
899
  query AiModelLoadingStatus($model: String!) {
872
900
  aiModelLoadingStatus(model: $model) {
873
901
  model
@@ -877,52 +905,52 @@ triggerMatch
877
905
  downloaded
878
906
  }
879
907
  }
880
- `,variables:{model:e}}));return r}async prompt(e,r){let{aiPrompt:n}=k(await qe(this,je,"f").mutate({mutation:I`
908
+ `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:n}=k(await Be(this,Ue,"f").mutate({mutation:I`
881
909
  mutation AiPrompt($taskId: String!, $prompt: String!) {
882
910
  aiPrompt(taskId: $taskId, prompt: $prompt)
883
911
  }
884
- `,variables:{taskId:e,prompt:r}}));return n}async embed(e,r){let{aiEmbed:n}=k(await qe(this,je,"f").mutate({mutation:I`
912
+ `,variables:{taskId:e,prompt:t}}));return n}async embed(e,t){let{aiEmbed:n}=k(await Be(this,Ue,"f").mutate({mutation:I`
885
913
  mutation aiEmbed($modelId: String!, $text: String!) {
886
914
  aiEmbed(modelId: $modelId, text: $text)
887
915
  }
888
- `,variables:{modelId:e,text:r}})),i=js.toByteArray(n);return JSON.parse($_.inflate(i,{to:"string"}))}async openTranscriptionStream(e,r,n,i){let{aiOpenTranscriptionStream:a}=k(await qe(this,je,"f").mutate({mutation:I`
889
- mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput, $language: String) {
890
- aiOpenTranscriptionStream(modelId: $modelId, params: $params, language: $language)
916
+ `,variables:{modelId:e,text:t}})),i=Us.toByteArray(n);return JSON.parse($S.inflate(i,{to:"string"}))}async openTranscriptionStream(e,t,n){let{aiOpenTranscriptionStream:i}=k(await Be(this,Ue,"f").mutate({mutation:I`
917
+ mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
918
+ aiOpenTranscriptionStream(modelId: $modelId, params: $params)
891
919
  }
892
- `,variables:{modelId:e,params:n,language:i}})),o=qe(this,je,"f").subscribe({query:I` subscription {
893
- aiTranscriptionText(streamId: "${a}")
894
- }`}).subscribe({next(s){return r(s.data.aiTranscriptionText),s.data.aiTranscriptionText},error(s){console.error(s)}});return qe(this,cs,"f").set(a,o),a}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:r}=k(await qe(this,je,"f").mutate({mutation:I`
920
+ `,variables:{modelId:e,params:n}})),a=Be(this,Ue,"f").subscribe({query:I` subscription {
921
+ aiTranscriptionText(streamId: "${i}")
922
+ }`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Be(this,cs,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=k(await Be(this,Ue,"f").mutate({mutation:I`
895
923
  mutation aiCloseTranscriptionStream($streamId: String!) {
896
924
  aiCloseTranscriptionStream(streamId: $streamId)
897
925
  }
898
- `,variables:{streamId:e}})),n=qe(this,cs,"f").get(e);return n.closed||n.unsubscribe(),r}async feedTranscriptionStream(e,r){let{aiFeedTranscriptionStream:n}=k(await qe(this,je,"f").mutate({mutation:I`
926
+ `,variables:{streamId:e}})),n=Be(this,cs,"f").get(e);return n.closed||n.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:n}=k(await Be(this,Ue,"f").mutate({mutation:I`
899
927
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
900
928
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
901
929
  }
902
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:r}}));return n}};je=new WeakMap,cs=new WeakMap;var Rr=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},Me=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Yt,us,wa,ls,Ea,vn,fs,xa,qa=class{constructor(e,r=!0){Yt.set(this,void 0),us.set(this,void 0),wa.set(this,void 0),ls.set(this,void 0),Ea.set(this,void 0),vn.set(this,void 0),fs.set(this,void 0),xa.set(this,void 0),Rr(this,Yt,e,"f"),Rr(this,us,new Ca(Me(this,Yt,"f"),r),"f"),Rr(this,wa,new Pu(Me(this,Yt,"f")),"f"),Rr(this,ls,new Nu(Me(this,Yt,"f")),"f"),Rr(this,Ea,new Cu(Me(this,Yt,"f")),"f"),Rr(this,xa,new Qu(Me(this,Yt,"f"),r),"f"),Rr(this,vn,new Is(Me(this,Yt,"f"),r),"f"),Me(this,vn,"f").setExpressionClient(Me(this,wa,"f")),Me(this,vn,"f").setNeighbourhoodClient(Me(this,Ea,"f")),Me(this,vn,"f").setAIClient(Me(this,xa,"f")),Rr(this,fs,new Ru(Me(this,Yt,"f"),r),"f")}get agent(){return Me(this,us,"f")}get expression(){return Me(this,wa,"f")}get languages(){return Me(this,ls,"f")}get neighbourhood(){return Me(this,Ea,"f")}get perspective(){return Me(this,vn,"f")}get runtime(){return Me(this,fs,"f")}get ai(){return Me(this,xa,"f")}};Yt=new WeakMap,us=new WeakMap,wa=new WeakMap,ls=new WeakMap,Ea=new WeakMap,vn=new WeakMap,fs=new WeakMap,xa=new WeakMap;var zu;(function(t){t.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",t.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",t.AgentIsUntrusted="AGENT_IS_UNTRUSTED",t.CapabilityRequested="CAPABILITY_REQUESTED",t.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(zu||(zu={}));var sl=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},cl=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},xn=class{constructor(e,r){this.language=e,this.expression=r}};sl([y(),cl("design:type",er)],xn.prototype,"language",void 0);sl([y(),cl("design:type",String)],xn.prototype,"expression",void 0);xn=sl([W(),cl("design:paramtypes",[er,String])],xn);function pk(t){return t.language.address==="did"?t.expression.toString():`${t.language.address}://${t.expression}`}function dk(t){if(t.startsWith("literal://")){let a=new er;a.address="literal",a.name="literal";let o=t.substring(10);return new xn(a,o)}let r=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(t);if(r&&r.length==3){let a=r[1],o=r[2],s=new er;return s.address=a,new xn(s,o)}let i=/^did:([^\s]+)$/.exec(t);if(i&&i.length==2){let a=new er;return a.address="did",new xn(a,t)}throw new Error("Couldn't parse string as expression URL or DID: "+t)}var Tt=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},or=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Cs=class{};Tt([y(),or("design:type",String)],Cs.prototype,"name",void 0);Tt([y(),or("design:type",String)],Cs.prototype,"type",void 0);Cs=Tt([W()],Cs);var Ba=class{};Tt([y(),or("design:type",String)],Ba.prototype,"label",void 0);Tt([y(),or("design:type",String)],Ba.prototype,"name",void 0);Tt([y(),or("design:type",Array)],Ba.prototype,"parameters",void 0);Ba=Tt([W()],Ba);var Rs=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,r){this.name=e,this.parametersStringified=JSON.stringify(r)}};Tt([y(),or("design:type",String)],Rs.prototype,"name",void 0);Tt([y(),or("design:type",String)],Rs.prototype,"parametersStringified",void 0);Rs=Tt([ze(),or("design:paramtypes",[String,Object])],Rs);var Ps=class{};Tt([y(),or("design:type",String)],Ps.prototype,"did",void 0);Tt([y(),or("design:type",Dn)],Ps.prototype,"status",void 0);Ps=Tt([W()],Ps);var fd=class{},Vn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Fi=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Kr=class{};Vn([y(),Fi("design:type",String)],Kr.prototype,"name",void 0);Vn([y(),Fi("design:type",String)],Kr.prototype,"address",void 0);Vn([y(),Fi("design:type",String)],Kr.prototype,"settings",void 0);Vn([y(),Fi("design:type",kn)],Kr.prototype,"icon",void 0);Vn([y(),Fi("design:type",kn)],Kr.prototype,"constructorIcon",void 0);Vn([y(),Fi("design:type",kn)],Kr.prototype,"settingsIcon",void 0);Kr=Vn([W()],Kr);var ut=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},gt=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},qt=class{};ut([y(),gt("design:type",String)],qt.prototype,"name",void 0);ut([y(),gt("design:type",String)],qt.prototype,"address",void 0);ut([y(),gt("design:type",String)],qt.prototype,"description",void 0);ut([y(),gt("design:type",String)],qt.prototype,"author",void 0);ut([y(),gt("design:type",Boolean)],qt.prototype,"templated",void 0);ut([y(),gt("design:type",String)],qt.prototype,"templateSourceLanguageAddress",void 0);ut([y(),gt("design:type",String)],qt.prototype,"templateAppliedParams",void 0);ut([y(),gt("design:type",Array)],qt.prototype,"possibleTemplateParams",void 0);ut([y(),gt("design:type",String)],qt.prototype,"sourceCodeLink",void 0);qt=ut([W()],qt);var Ii=class{constructor(e,r){this.name=e,this.description=r,this.description||(this.description="")}};ut([y(),gt("design:type",String)],Ii.prototype,"name",void 0);ut([y(),gt("design:type",String)],Ii.prototype,"description",void 0);ut([y(),gt("design:type",Array)],Ii.prototype,"possibleTemplateParams",void 0);ut([y(),gt("design:type",String)],Ii.prototype,"sourceCodeLink",void 0);Ii=ut([ze(),gt("design:paramtypes",[String,String])],Ii);var pd=class{},dd=class extends Yr(){},hd=class{},Vs=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},ul=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Fs=class{constructor(e,r){this.linkLanguage=e,this.meta=r}};Vs([y(),ul("design:type",String)],Fs.prototype,"linkLanguage",void 0);Vs([y(),ul("design:type",nr)],Fs.prototype,"meta",void 0);Fs=Vs([W(),ul("design:paramtypes",[String,nr])],Fs);var Wu=class extends Yr(){};Wu=Vs([W()],Wu);var Qn=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},zn=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Gu;(function(t){t.Private="PRIVATE",t.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",t.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",t.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",t.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",t.Synced="SYNCED"})(Gu||(Gu={}));var Hr=class{constructor(e,r,n){this.uuid=e,this.name=r,n?this.state=n:this.state=Gu.Private}};Qn([y(),zn("design:type",String)],Hr.prototype,"uuid",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"name",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"state",void 0);Qn([y(),zn("design:type",String)],Hr.prototype,"sharedUrl",void 0);Qn([y(),zn("design:type",Wu)],Hr.prototype,"neighbourhood",void 0);Qn([y(),zn("design:type",Array)],Hr.prototype,"owners",void 0);Hr=Qn([W(),zn("design:paramtypes",[String,String,String])],Hr);var Qs=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},Th=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},Ls=class{};Qs([y(),Th("design:type",Array)],Ls.prototype,"additions",void 0);Qs([y(),Th("design:type",Array)],Ls.prototype,"removals",void 0);Ls=Qs([W()],Ls);var md=class extends Yr(){};md=Qs([W()],md);var gd=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},hi=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},Ta,bn,Ho="smart_literal://content";function j_(t){let e="",r="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}var Va=class{constructor(e,r){Ta.set(this,void 0),bn.set(this,void 0),gd(this,Ta,e,"f"),gd(this,bn,r,"f")}get base(){return hi(this,bn,"f")}static async create(e,r){let n=Ze.from(j_(10)).toUrl(),i=new Va(e,n);return await i.set(r),i}static async isSmartLiteralBase(e,r){return(await e.get(new Ye({source:r,predicate:Ho}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Ye({predicate:Ho}))).map(n=>new Va(e,n.data.source))}async get(){let e=await hi(this,Ta,"f").getSingleTarget(new Ye({source:hi(this,bn,"f"),predicate:Ho}));if(!e)throw`No content for smart literal ${hi(this,bn,"f")}`;return Ze.fromUrl(e).get()}async set(e){let r=Ze.from(e);await hi(this,Ta,"f").setSingleTarget(new On({source:hi(this,bn,"f"),predicate:Ho,target:r.toUrl()}))}};Ta=new WeakMap,bn=new WeakMap;var yd=class{};function Ik(t,e,r){return{action:"addLink",source:t,predicate:e,target:r}}function kk(t){return`triple(this, "${t}", _)`}function Ak(t){return function(e,r,n){if(typeof n.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");n.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(t&&t.where)for(let l in t.where){let d=t.where[l];c+=`, property_getter(C, Instance, "${l}", "${d}")`}t&&t.prologCondition&&(c+=", "+t.prologCondition);try{let l=await a.infer(c);if(l&&l!==!1&&typeof l!="string"&&l.length>0){for(let d of l){let p=d.Instance,f=new bi(a,p,s);await f.init(),o.push(f)}return o}}catch{}let u=await a.getAllSubjectInstances(s);if(t&&t.where){let l=[];for(let d of u){let p=!0;for(let f in t.where){let h=t.where[f];if(await d[f]!==h){p=!1;break}}p&&l.push(d)}return l}return u}}}function Ih(t){return function(e,r){if(typeof t.writable>"u"&&t.through&&(t.writable=!0),t.required&&!t.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!t.through&&!t.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");if(e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],...t},t.writable){let n=r;e[`set${Ur(n)}`]=()=>{}}Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function Ok(t){return function(e,r){if(!t.through&&!t.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!t.through)throw new Error("SubjectFlag requires a 'through' option");if(!t.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[r]=e.__properties[r]||{},e.__properties[r]={...e.__properties[r],through:t.through,required:!0,initial:t.value,flag:!0},e[r]=t.value,Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function Dk(t){return function(e,r){e.__collections=e.__collections||{},e.__collections[r]=t;let n=r;e[`add${Ur(n)}`]=()=>{},e[`remove${Ur(n)}`]=()=>{},e[`setCollection${Ur(n)}`]=()=>{},Object.defineProperty(e,r,{configurable:!0,writable:!0})}}function kh(t){let e="",r="abcdefghijklmnopqrstuvwxyz",n=r.length;for(let i=0;i<t;i++)e+=r.charAt(Math.floor(Math.random()*n));return e}function U_(t){return function(e){e.prototype.className=t.name,e.className=t.name,e.generateSDNA=function(){let r="",n=t.name,i=e.prototype,a=kh(8);r+=`subject_class("${n}", ${a}).
930
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return n}};Ue=new WeakMap,cs=new WeakMap;var Rr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},je=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Yt,us,wa,ls,Ea,bn,ps,xa,qa=class{constructor(e,t=!0){Yt.set(this,void 0),us.set(this,void 0),wa.set(this,void 0),ls.set(this,void 0),Ea.set(this,void 0),bn.set(this,void 0),ps.set(this,void 0),xa.set(this,void 0),Rr(this,Yt,e,"f"),Rr(this,us,new Ca(je(this,Yt,"f"),t),"f"),Rr(this,wa,new Lu(je(this,Yt,"f")),"f"),Rr(this,ls,new Cu(je(this,Yt,"f")),"f"),Rr(this,Ea,new Ru(je(this,Yt,"f")),"f"),Rr(this,xa,new zu(je(this,Yt,"f"),t),"f"),Rr(this,bn,new ks(je(this,Yt,"f"),t),"f"),je(this,bn,"f").setExpressionClient(je(this,wa,"f")),je(this,bn,"f").setNeighbourhoodClient(je(this,Ea,"f")),je(this,bn,"f").setAIClient(je(this,xa,"f")),Rr(this,ps,new Pu(je(this,Yt,"f"),t),"f")}get agent(){return je(this,us,"f")}get expression(){return je(this,wa,"f")}get languages(){return je(this,ls,"f")}get neighbourhood(){return je(this,Ea,"f")}get perspective(){return je(this,bn,"f")}get runtime(){return je(this,ps,"f")}get ai(){return je(this,xa,"f")}};Yt=new WeakMap,us=new WeakMap,wa=new WeakMap,ls=new WeakMap,Ea=new WeakMap,bn=new WeakMap,ps=new WeakMap,xa=new WeakMap;var Wu;(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"})(Wu||(Wu={}));var sl=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},cl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},In=class{constructor(e,t){this.language=e,this.expression=t}};sl([g(),cl("design:type",er)],In.prototype,"language",void 0);sl([g(),cl("design:type",String)],In.prototype,"expression",void 0);In=sl([z(),cl("design:paramtypes",[er,String])],In);function fk(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function dk(r){if(r.startsWith("literal://")){let a=new er;a.address="literal",a.name="literal";let o=r.substring(10);return new In(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new er;return s.address=a,new In(s,o)}let i=/^did:([^\s]+)$/.exec(r);if(i&&i.length==2){let a=new er;return a.address="did",new In(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var It=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},or=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Rs=class{};It([g(),or("design:type",String)],Rs.prototype,"name",void 0);It([g(),or("design:type",String)],Rs.prototype,"type",void 0);Rs=It([z()],Rs);var Ba=class{};It([g(),or("design:type",String)],Ba.prototype,"label",void 0);It([g(),or("design:type",String)],Ba.prototype,"name",void 0);It([g(),or("design:type",Array)],Ba.prototype,"parameters",void 0);Ba=It([z()],Ba);var Ps=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};It([g(),or("design:type",String)],Ps.prototype,"name",void 0);It([g(),or("design:type",String)],Ps.prototype,"parametersStringified",void 0);Ps=It([We(),or("design:paramtypes",[String,Object])],Ps);var Ls=class{};It([g(),or("design:type",String)],Ls.prototype,"did",void 0);It([g(),or("design:type",Nn)],Ls.prototype,"status",void 0);Ls=It([z()],Ls);var hd=class{},Vn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Li=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hr=class{};Vn([g(),Li("design:type",String)],Hr.prototype,"name",void 0);Vn([g(),Li("design:type",String)],Hr.prototype,"address",void 0);Vn([g(),Li("design:type",String)],Hr.prototype,"settings",void 0);Vn([g(),Li("design:type",An)],Hr.prototype,"icon",void 0);Vn([g(),Li("design:type",An)],Hr.prototype,"constructorIcon",void 0);Vn([g(),Li("design:type",An)],Hr.prototype,"settingsIcon",void 0);Hr=Vn([z()],Hr);var ct=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},mt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qt=class{};ct([g(),mt("design:type",String)],qt.prototype,"name",void 0);ct([g(),mt("design:type",String)],qt.prototype,"address",void 0);ct([g(),mt("design:type",String)],qt.prototype,"description",void 0);ct([g(),mt("design:type",String)],qt.prototype,"author",void 0);ct([g(),mt("design:type",Boolean)],qt.prototype,"templated",void 0);ct([g(),mt("design:type",String)],qt.prototype,"templateSourceLanguageAddress",void 0);ct([g(),mt("design:type",String)],qt.prototype,"templateAppliedParams",void 0);ct([g(),mt("design:type",Array)],qt.prototype,"possibleTemplateParams",void 0);ct([g(),mt("design:type",String)],qt.prototype,"sourceCodeLink",void 0);qt=ct([z()],qt);var Ti=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ct([g(),mt("design:type",String)],Ti.prototype,"name",void 0);ct([g(),mt("design:type",String)],Ti.prototype,"description",void 0);ct([g(),mt("design:type",Array)],Ti.prototype,"possibleTemplateParams",void 0);ct([g(),mt("design:type",String)],Ti.prototype,"sourceCodeLink",void 0);Ti=ct([We(),mt("design:paramtypes",[String,String])],Ti);var md=class{},gd=class extends Zr(){},yd=class{},Qs=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},ul=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Fs=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Qs([g(),ul("design:type",String)],Fs.prototype,"linkLanguage",void 0);Qs([g(),ul("design:type",nr)],Fs.prototype,"meta",void 0);Fs=Qs([z(),ul("design:paramtypes",[String,nr])],Fs);var Gu=class extends Zr(){};Gu=Qs([z()],Gu);var Qn=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},zn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ku;(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"})(Ku||(Ku={}));var Jr=class{constructor(e,t,n){this.uuid=e,this.name=t,n?this.state=n:this.state=Ku.Private}};Qn([g(),zn("design:type",String)],Jr.prototype,"uuid",void 0);Qn([g(),zn("design:type",String)],Jr.prototype,"name",void 0);Qn([g(),zn("design:type",String)],Jr.prototype,"state",void 0);Qn([g(),zn("design:type",String)],Jr.prototype,"sharedUrl",void 0);Qn([g(),zn("design:type",Gu)],Jr.prototype,"neighbourhood",void 0);Qn([g(),zn("design:type",Array)],Jr.prototype,"owners",void 0);Jr=Qn([z(),zn("design:paramtypes",[String,String,String])],Jr);var zs=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Ah=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},$s=class{};zs([g(),Ah("design:type",Array)],$s.prototype,"additions",void 0);zs([g(),Ah("design:type",Array)],$s.prototype,"removals",void 0);$s=zs([z()],$s);var vd=class extends Zr(){};vd=zs([z()],vd);var bd=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},hi=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Ia,Sn,Ho="smart_literal://content";function jS(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=t.length;for(let i=0;i<r;i++)e+=t.charAt(Math.floor(Math.random()*n));return e}var Va=class{constructor(e,t){Ia.set(this,void 0),Sn.set(this,void 0),bd(this,Ia,e,"f"),bd(this,Sn,t,"f")}get base(){return hi(this,Sn,"f")}static async create(e,t){let n=ye.from(jS(10)).toUrl(),i=new Va(e,n);return await i.set(t),i}static async isSmartLiteralBase(e,t){return(await e.get(new Se({source:t,predicate:Ho}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Se({predicate:Ho}))).map(n=>new Va(e,n.data.source))}async get(){let e=await hi(this,Ia,"f").getSingleTarget(new Se({source:hi(this,Sn,"f"),predicate:Ho}));if(!e)throw`No content for smart literal ${hi(this,Sn,"f")}`;return ye.fromUrl(e).get()}async set(e){let t=ye.from(e);await hi(this,Ia,"f").setSingleTarget(new bt({source:hi(this,Sn,"f"),predicate:Ho,target:t.toUrl()}))}};Ia=new WeakMap,Sn=new WeakMap;var Sd=class{};function Tk(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function kk(r){return`triple(this, "${r}", _)`}function Ak(r){return function(e,t,n){if(typeof n.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");n.value=async function(a){let o=[],s=e.name,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 vi(a,f,s);await p.init(),o.push(p)}return o}}catch{}let u=await a.getAllSubjectInstances(e);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 Oh(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 n=t;e[`set${Ur(n)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Ok(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 Nk(r){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=r;let n=t;e[`add${Ur(n)}`]=()=>{},e[`remove${Ur(n)}`]=()=>{},e[`setCollection${Ur(n)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Nh(r){let e="",t="abcdefghijklmnopqrstuvwxyz",n=t.length;for(let i=0;i<r;i++)e+=t.charAt(Math.floor(Math.random()*n));return e}function US(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",n=r.name,i=e.prototype,a=Nh(8);t+=`subject_class("${n}", ${a}).
903
931
  `;let o=[],s=[];i.subjectConstructor&&i.subjectConstructor.length&&(s=s.concat(i.subjectConstructor));let c=[];i.isSubjectInstance&&i.isSubjectInstance.length&&(c=c.concat(i.isSubjectInstance));let u=[],l=i.__properties||{};for(let h in l){let m=`property(${a}, "${h}").
904
- `,{through:g,initial:_,required:S,resolveLanguage:w,writable:b,flag:O,prologGetter:C,prologSetter:E,local:R}=l[h];if(w&&(m+=`property_resolve(${a}, "${h}").
932
+ `,{through:y,initial:_,required:S,resolveLanguage:w,writable:v,flag:A,prologGetter:R,prologSetter:E,local:P}=l[h];if(w&&(m+=`property_resolve(${a}, "${h}").
905
933
  `,m+=`property_resolve_language(${a}, "${h}", "${w}").
906
- `),C?m+=`property_getter(${a}, Base, "${h}", Value) :- ${C}.
907
- `:g&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${g}", Value).
908
- `,S&&(O?c.push(`triple(Base, "${g}", "${_}")`):c.push(`triple(Base, "${g}", _)`))),E)m+=`property_setter(${a}, "${h}", Actions) :- ${E}.
909
- `;else if(b&&g&&typeof i[Zu(h)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:g,target:"value",...R&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${fn(P)}').
910
- `}u.push(m),_&&(s.push({action:"addLink",source:"this",predicate:g,target:_}),o.push({action:"removeLink",source:"this",predicate:g,target:"*"}))}let d=[],p=i.__collections||{};for(let h in p){let m=`collection(${a}, "${h}").
911
- `,{through:g,where:_,local:S}=p[h];if(g){if(_){if(!_.isInstance&&!_.prologCondition&&!_.condition)throw"'where' needs one of 'isInstance', 'prologCondition', or 'condition'";let C=[];if(_.isInstance){let E;_.isInstance.name?E=_.isInstance.name:E=_.isInstance,C.push(`instance(OtherClass, Target), subject_class("${E}", OtherClass)`)}if(_.prologCondition&&C.push(_.prologCondition),C.length>0){let E=C.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 w=[{action:"addLink",source:"this",predicate:g,target:"value",...S&&{local:!0}}],b=[{action:"removeLink",source:"this",predicate:g,target:"value"}],O=[{action:"collectionSetter",source:"this",predicate:g,target:"value",...S&&{local:!0}}];m+=`collection_adder(${a}, "${vi(h)}", '${fn(w)}').
915
- `,m+=`collection_remover(${a}, "${vi(h)}", '${fn(b)}').
916
- `,m+=`collection_setter(${a}, "${vi(h)}", '${fn(O)}').
917
- `}d.push(m)}let f=fn(s);if(r+=`constructor(${a}, '${f}').
918
- `,c.length>0){let h=c.join(", ");r+=`instance(${a}, Base) :- ${h}.
919
- `,r+=`
920
- `}return r+=`destructor(${a}, '${fn(o)}').
921
- `,r+=`
922
- `,r+=u.join(`
923
- `),r+=`
924
- `,r+=d.join(`
925
- `),{sdna:r,name:n}},Object.defineProperty(e,"type",{configurable:!0})}}function Nk(t){return Ih({...t,required:!0,writable:!0,initial:t.initial||"literal://string:uninitialized"})}function Ck(t){return Ih({...t,writable:!1})}var Rk=`
934
+ `),R?m+=`property_getter(${a}, Base, "${h}", Value) :- ${R}.
935
+ `:y&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${y}", Value).
936
+ `,S&&(A?c.push(`triple(Base, "${y}", "${_}")`):c.push(`triple(Base, "${y}", _)`))),E)m+=`property_setter(${a}, "${h}", Actions) :- ${E}.
937
+ `;else if(v&&y&&typeof i[Is(h)]=="function"){let C=[{action:"setSingleTarget",source:"this",predicate:y,target:"value",...P&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${fn(C)}').
938
+ `}u.push(m),_&&(s.push({action:"addLink",source:"this",predicate:y,target:_}),o.push({action:"removeLink",source:"this",predicate:y,target:"*"}))}let d=[],f=i.__collections||{};for(let h in f){let m=`collection(${a}, "${h}").
939
+ `,{through:y,where:_,local:S}=f[h];if(y){if(_){if(!_.isInstance&&!_.prologCondition&&!_.condition)throw"'where' needs one of 'isInstance', 'prologCondition', or 'condition'";let R=[];if(_.isInstance){let E;_.isInstance.name?E=_.isInstance.name:E=_.isInstance,R.push(`instance(OtherClass, Target), subject_class("${E}", OtherClass)`)}if(_.prologCondition&&R.push(_.prologCondition),R.length>0){let E=R.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${y}", Target), ${E}), List).
940
+ `}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${y}", C), List).
941
+ `}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${y}", C), List).
942
+ `;let w=[{action:"addLink",source:"this",predicate:y,target:"value",...S&&{local:!0}}],v=[{action:"removeLink",source:"this",predicate:y,target:"value"}],A=[{action:"collectionSetter",source:"this",predicate:y,target:"value",...S&&{local:!0}}];m+=`collection_adder(${a}, "${h}", '${fn(w)}').
943
+ `,m+=`collection_remover(${a}, "${h}", '${fn(v)}').
944
+ `,m+=`collection_setter(${a}, "${h}", '${fn(A)}').
945
+ `}d.push(m)}let p=fn(s);if(t+=`constructor(${a}, '${p}').
946
+ `,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
947
+ `,t+=`
948
+ `}return t+=`destructor(${a}, '${fn(o)}').
949
+ `,t+=`
950
+ `,t+=u.join(`
951
+ `),t+=`
952
+ `,t+=d.join(`
953
+ `),{sdna:t,name:n}},e.generateSHACL=function(){let t=r.name,n=e.prototype,i="ad4m://",a=n.__properties||{},o=n.__collections||{};if(Object.keys(a).length>0){let f=a[Object.keys(a)[0]];if(f.through){let p=f.through.match(/^([^:]+:\/\/)/);p&&(i=p[1])}}else if(Object.keys(o).length>0){let f=o[Object.keys(o)[0]];if(f.through){let p=f.through.match(/^([^:]+:\/\/)/);p&&(i=p[1])}}let s=`${i}${t}Shape`,c=`${i}${t}`,u=new qr(s,c),l=[];n.subjectConstructor&&n.subjectConstructor.length&&(l=l.concat(n.subjectConstructor));let d=[];for(let f in a){let p=a[f];if(!p.through)continue;let h={name:f,path:p.through};if(p.resolveLanguage==="literal")h.datatype="xsd://string";else if(p.initial){let m=typeof n[f];m==="number"?h.datatype="xsd://integer":m==="boolean"?h.datatype="xsd://boolean":m==="string"&&(h.datatype="xsd://string")}p.required&&(h.minCount=1),p.collection||(h.maxCount=1),p.flag&&p.initial&&(h.hasValue=p.initial),p.local!==void 0&&(h.local=p.local),p.writable!==void 0&&(h.writable=p.writable),p.resolveLanguage&&(h.resolveLanguage=p.resolveLanguage),p.setter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${f}' in class '${t}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):p.writable&&p.through&&typeof n[Is(f)]=="function"&&(h.setter=[{action:"setSingleTarget",source:"this",predicate:p.through,target:"value",...p.local&&{local:!0}}]),p.initial&&(l.push({action:"addLink",source:"this",predicate:p.through,target:p.initial}),d.push({action:"removeLink",source:"this",predicate:p.through,target:"*"})),u.addProperty(h)}for(let f in o){let p=o[f];if(!p.through)continue;let h={name:f,path:p.through};p.where?.isInstance,h.nodeKind="IRI",p.local!==void 0&&(h.local=p.local),p.writable!==void 0&&(h.writable=p.writable),h.adder=[{action:"addLink",source:"this",predicate:p.through,target:"value",...p.local&&{local:!0}}],h.remover=[{action:"removeLink",source:"this",predicate:p.through,target:"value",...p.local&&{local:!0}}],u.addProperty(h)}return l.length>0&&u.setConstructorActions(l),d.length>0&&u.setDestructorActions(d),{shape:u,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function Dk(r){return Oh({...r,required:!0,writable:!0,initial:r.initial||"literal://string:uninitialized"})}function Ck(r){return Oh({...r,writable:!1})}var Rk=`
926
954
  type AIModelLoadingStatus {
927
955
  downloaded: Boolean!
928
956
  loaded: Boolean!
@@ -1233,7 +1261,7 @@ type Mutation {
1233
1261
  aiCloseTranscriptionStream(streamId: String!): String!
1234
1262
  aiEmbed(modelId: String!, text: String!): String!
1235
1263
  aiFeedTranscriptionStream(audio: [Float!]!, streamIds: [String!]!): String!
1236
- aiOpenTranscriptionStream(language: String, modelId: String!, params: VoiceActivityParamsInput): String!
1264
+ aiOpenTranscriptionStream(modelId: String!, params: VoiceActivityParamsInput): String!
1237
1265
  aiPrompt(prompt: String!, taskId: String!): String!
1238
1266
  aiRemoveModel(modelId: String!): Boolean!
1239
1267
  aiRemoveTask(taskId: String!): AITask!
@@ -1259,7 +1287,7 @@ type Mutation {
1259
1287
  perspectiveAddLink(batchId: String, link: LinkInput!, status: String = "shared", uuid: String!): LinkExpression!
1260
1288
  perspectiveAddLinkExpression(batchId: String, link: LinkExpressionInput!, status: String = "shared", uuid: String!): LinkExpression!
1261
1289
  perspectiveAddLinks(batchId: String, links: [LinkInput!]!, status: String = "shared", uuid: String!): [LinkExpression!]!
1262
- perspectiveAddSdna(name: String!, sdnaCode: String!, sdnaType: String!, uuid: String!): Boolean!
1290
+ perspectiveAddSdna(name: String!, sdnaCode: String, sdnaType: String!, shaclJson: String, uuid: String!): Boolean!
1263
1291
  perspectiveCommitBatch(batchId: String!, uuid: String!): LinkExpressionMutations!
1264
1292
  perspectiveCreateBatch(uuid: String!): String!
1265
1293
  perspectiveCreateSubject(batchId: String, expressionAddress: String!, initialValues: String, subjectClass: String!, uuid: String!): Boolean!
@@ -1508,7 +1536,7 @@ input VoiceActivityParamsInput {
1508
1536
  startWindow: Float
1509
1537
  timeBeforeSpeech: Float
1510
1538
  }
1511
- `,N=function(t,e,r,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,r):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(t,e,r,n);else for(var s=t.length-1;s>=0;s--)(o=t[s])&&(a=(i<3?o(a):i>3?o(e,r,a):o(e,r))||a);return i>3&&a&&Object.defineProperty(e,r,a),a},v=function(t,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(t,e)},J=function(t,e){return function(r,n){e(r,n,t)}},Ha=new Qr;Ha.author="did:ad4m:test";Ha.timestamp=Date.now();Ha.data={source:"root",target:"neighbourhood://Qm12345"};Ha.proof={signature:"",key:"",valid:!0};var Mr=new Dn;Mr.author="did:ad4m:test";Mr.timestamp=Date.now().toString();Mr.proof=new vr("","");Mr.data=new nr([Ha]);var $s=class{};N([y(),v("design:type",String)],$s.prototype,"recipient",void 0);N([y(),v("design:type",Dn)],$s.prototype,"message",void 0);$s=N([W()],$s);var ki=class{};N([y(),v("design:type",String)],ki.prototype,"ad4mExecutorVersion",void 0);N([y(),v("design:type",Boolean)],ki.prototype,"isInitialized",void 0);N([y(),v("design:type",Boolean)],ki.prototype,"isUnlocked",void 0);ki=N([W()],ki);var Ln=class{};N([y(),v("design:type",String)],Ln.prototype,"title",void 0);N([y(),v("design:type",String)],Ln.prototype,"message",void 0);N([y(),v("design:type",String)],Ln.prototype,"type",void 0);N([y(),v("design:type",String)],Ln.prototype,"addon",void 0);Ln=N([W()],Ln);var Pt=class{};N([y(),v("design:type",String)],Pt.prototype,"description",void 0);N([y(),v("design:type",String)],Pt.prototype,"appName",void 0);N([y(),v("design:type",String)],Pt.prototype,"appUrl",void 0);N([y(),v("design:type",String)],Pt.prototype,"appIconPath",void 0);N([y(),v("design:type",String)],Pt.prototype,"trigger",void 0);N([y(),v("design:type",Array)],Pt.prototype,"perspectiveIds",void 0);N([y(),v("design:type",String)],Pt.prototype,"webhookUrl",void 0);N([y(),v("design:type",String)],Pt.prototype,"webhookAuth",void 0);Pt=N([ze()],Pt);var wt=class{};N([y(),v("design:type",String)],wt.prototype,"id",void 0);N([y(),v("design:type",Boolean)],wt.prototype,"granted",void 0);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([W()],wt);var Ai=class{};N([y(),v("design:type",wt)],Ai.prototype,"notification",void 0);N([y(),v("design:type",String)],Ai.prototype,"perspectiveId",void 0);N([y(),v("design:type",String)],Ai.prototype,"triggerMatch",void 0);Ai=N([W()],Ai);var Qe=class{};N([y(),v("design:type",Number)],Qe.prototype,"total",void 0);N([y(),v("design:type",Number)],Qe.prototype,"imported",void 0);N([y(),v("design:type",Number)],Qe.prototype,"failed",void 0);N([y(),v("design:type",Number)],Qe.prototype,"omitted",void 0);N([y(),v("design:type",Array)],Qe.prototype,"errors",void 0);Qe=N([W()],Qe);var Et=class{};N([y(),v("design:type",Qe)],Et.prototype,"perspectives",void 0);N([y(),v("design:type",Qe)],Et.prototype,"links",void 0);N([y(),v("design:type",Qe)],Et.prototype,"expressions",void 0);N([y(),v("design:type",Qe)],Et.prototype,"perspectiveDiffs",void 0);N([y(),v("design:type",Qe)],Et.prototype,"notifications",void 0);N([y(),v("design:type",Qe)],Et.prototype,"models",void 0);N([y(),v("design:type",Qe)],Et.prototype,"defaultModels",void 0);N([y(),v("design:type",Qe)],Et.prototype,"tasks",void 0);N([y(),v("design:type",Qe)],Et.prototype,"friends",void 0);N([y(),v("design:type",Qe)],Et.prototype,"trustedAgents",void 0);N([y(),v("design:type",Qe)],Et.prototype,"knownLinkLanguages",void 0);Et=N([W()],Et);var Oi=class{};N([y(),v("design:type",String)],Oi.prototype,"email",void 0);N([y(),v("design:type",String)],Oi.prototype,"did",void 0);N([y(),v("design:type",String)],Oi.prototype,"lastSeen",void 0);N([y(),v("design:type",Number)],Oi.prototype,"perspectiveCount",void 0);Oi=N([W()],Oi);var $n=class{};N([y(),v("design:type",Boolean)],$n.prototype,"success",void 0);N([y(),v("design:type",String)],$n.prototype,"message",void 0);N([y(),v("design:type",Boolean)],$n.prototype,"requiresPassword",void 0);N([y(),v("design:type",Boolean)],$n.prototype,"isExistingUser",void 0);$n=N([W()],$n);var B=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,r,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Mr}runtimeFriendSendMessage(e,r){return!0}runtimeMessageInbox(e){return[Mr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Mr}]}runtimeMessageReceived(){return Mr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:zu.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,r){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,r){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,r){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,r,n){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,r,n){return new Nn("did:key:test123",!0)}runtimeLoginUser(e,r){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,r,n){return!0}};N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeQuit",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeOpenLink",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",ki)],B.prototype,"runtimeInfo",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"addTrustedAgents",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"deleteTrustedAgents",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"getTrustedAgents",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"runtimeKnownLinkLanguageTemplates",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"runtimeAddKnownLinkLanguageTemplates",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"runtimeFriends",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"runtimeAddFriends",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Array]),v("design:returntype",Array)],B.prototype,"runtimeRemoveFriends",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],B.prototype,"runtimeHcAgentInfos",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",String)],B.prototype,"runtimeGetNetworkMetrics",null);N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeRestartHolochain",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Object]),v("design:returntype",Boolean)],B.prototype,"runtimeHcAddAgentInfos",null);N([xt(),J(0,H()),J(1,H()),J(2,H()),J(3,H()),v("design:type",Function),v("design:paramtypes",[String,String,String,String]),v("design:returntype",void 0)],B.prototype,"runtimeVerifyStringSignedByDid",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[nr]),v("design:returntype",Boolean)],B.prototype,"runtimeSetStatus",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Dn)],B.prototype,"runtimeFriendStatus",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,Ss]),v("design:returntype",Boolean)],B.prototype,"runtimeFriendSendMessage",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],B.prototype,"runtimeMessageInbox",null);N([xt(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Array)],B.prototype,"runtimeMessageOutbox",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Dn)],B.prototype,"runtimeMessageReceived",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Ln)],B.prototype,"exceptionOccurred",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Pt]),v("design:returntype",String)],B.prototype,"runtimeRequestInstallNotification",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"runtimeNotifications",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,Pt]),v("design:returntype",Boolean)],B.prototype,"runtimeUpdateNotification",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeRemoveNotification",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeGrantNotification",null);N([Hu(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Ai)],B.prototype,"runtimeNotificationTriggered",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeExportDb",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeImportDb",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",Boolean)],B.prototype,"runtimeExportPerspective",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeImportPerspective",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeMultiUserEnabled",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[Boolean]),v("design:returntype",Boolean)],B.prototype,"runtimeSetMultiUserEnabled",null);N([xt(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Array)],B.prototype,"runtimeListUsers",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,ir]),v("design:returntype",$n)],B.prototype,"runtimeRequestLoginVerification",null);N([me(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,String]),v("design:returntype",String)],B.prototype,"runtimeVerifyEmailCode",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",Boolean)],B.prototype,"runtimeTestEmail",null);N([me(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,ir]),v("design:returntype",Nn)],B.prototype,"runtimeCreateUser",null);N([me(),J(0,H()),J(1,H()),v("design:type",Function),v("design:paramtypes",[String,String]),v("design:returntype",String)],B.prototype,"runtimeLoginUser",null);N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeEnable",null);N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeDisable",null);N([me(),J(0,H()),v("design:type",Function),v("design:paramtypes",[String]),v("design:returntype",String)],B.prototype,"runtimeEmailTestGetCode",null);N([me(),v("design:type",Function),v("design:paramtypes",[]),v("design:returntype",Boolean)],B.prototype,"runtimeEmailTestClearCodes",null);N([me(),J(0,H()),J(1,H()),J(2,H()),v("design:type",Function),v("design:paramtypes",[String,String,Number]),v("design:returntype",Boolean)],B.prototype,"runtimeEmailTestSetExpiry",null);B=N([by()],B);var oa=function(t,e,r,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!i:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(t,r):i?i.value=r:e.set(t,r),r},ne=function(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)},rt,ps,ds,Te;function hs(t){return t.charAt(0).toUpperCase()+t.slice(1)}function vd(t){return t?`triple("${t}", "ad4m://has_child", Base)`:""}function bd(){return`
1539
+ `,D=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>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)},H=function(r,e){return function(t,n){e(t,n,r)}},Ha=new zr;Ha.author="did:ad4m:test";Ha.timestamp=Date.now();Ha.data={source:"root",target:"neighbourhood://Qm12345"};Ha.proof={signature:"",key:"",valid:!0};var Mr=new Nn;Mr.author="did:ad4m:test";Mr.timestamp=Date.now().toString();Mr.proof=new vr("","");Mr.data=new nr([Ha]);var Ms=class{};D([g(),b("design:type",String)],Ms.prototype,"recipient",void 0);D([g(),b("design:type",Nn)],Ms.prototype,"message",void 0);Ms=D([z()],Ms);var ki=class{};D([g(),b("design:type",String)],ki.prototype,"ad4mExecutorVersion",void 0);D([g(),b("design:type",Boolean)],ki.prototype,"isInitialized",void 0);D([g(),b("design:type",Boolean)],ki.prototype,"isUnlocked",void 0);ki=D([z()],ki);var Fn=class{};D([g(),b("design:type",String)],Fn.prototype,"title",void 0);D([g(),b("design:type",String)],Fn.prototype,"message",void 0);D([g(),b("design:type",String)],Fn.prototype,"type",void 0);D([g(),b("design:type",String)],Fn.prototype,"addon",void 0);Fn=D([z()],Fn);var Pt=class{};D([g(),b("design:type",String)],Pt.prototype,"description",void 0);D([g(),b("design:type",String)],Pt.prototype,"appName",void 0);D([g(),b("design:type",String)],Pt.prototype,"appUrl",void 0);D([g(),b("design:type",String)],Pt.prototype,"appIconPath",void 0);D([g(),b("design:type",String)],Pt.prototype,"trigger",void 0);D([g(),b("design:type",Array)],Pt.prototype,"perspectiveIds",void 0);D([g(),b("design:type",String)],Pt.prototype,"webhookUrl",void 0);D([g(),b("design:type",String)],Pt.prototype,"webhookAuth",void 0);Pt=D([We()],Pt);var wt=class{};D([g(),b("design:type",String)],wt.prototype,"id",void 0);D([g(),b("design:type",Boolean)],wt.prototype,"granted",void 0);D([g(),b("design:type",String)],wt.prototype,"description",void 0);D([g(),b("design:type",String)],wt.prototype,"appName",void 0);D([g(),b("design:type",String)],wt.prototype,"appUrl",void 0);D([g(),b("design:type",String)],wt.prototype,"appIconPath",void 0);D([g(),b("design:type",String)],wt.prototype,"trigger",void 0);D([g(),b("design:type",Array)],wt.prototype,"perspectiveIds",void 0);D([g(),b("design:type",String)],wt.prototype,"webhookUrl",void 0);D([g(),b("design:type",String)],wt.prototype,"webhookAuth",void 0);wt=D([z()],wt);var Ai=class{};D([g(),b("design:type",wt)],Ai.prototype,"notification",void 0);D([g(),b("design:type",String)],Ai.prototype,"perspectiveId",void 0);D([g(),b("design:type",String)],Ai.prototype,"triggerMatch",void 0);Ai=D([z()],Ai);var ze=class{};D([g(),b("design:type",Number)],ze.prototype,"total",void 0);D([g(),b("design:type",Number)],ze.prototype,"imported",void 0);D([g(),b("design:type",Number)],ze.prototype,"failed",void 0);D([g(),b("design:type",Number)],ze.prototype,"omitted",void 0);D([g(),b("design:type",Array)],ze.prototype,"errors",void 0);ze=D([z()],ze);var Et=class{};D([g(),b("design:type",ze)],Et.prototype,"perspectives",void 0);D([g(),b("design:type",ze)],Et.prototype,"links",void 0);D([g(),b("design:type",ze)],Et.prototype,"expressions",void 0);D([g(),b("design:type",ze)],Et.prototype,"perspectiveDiffs",void 0);D([g(),b("design:type",ze)],Et.prototype,"notifications",void 0);D([g(),b("design:type",ze)],Et.prototype,"models",void 0);D([g(),b("design:type",ze)],Et.prototype,"defaultModels",void 0);D([g(),b("design:type",ze)],Et.prototype,"tasks",void 0);D([g(),b("design:type",ze)],Et.prototype,"friends",void 0);D([g(),b("design:type",ze)],Et.prototype,"trustedAgents",void 0);D([g(),b("design:type",ze)],Et.prototype,"knownLinkLanguages",void 0);Et=D([z()],Et);var Oi=class{};D([g(),b("design:type",String)],Oi.prototype,"email",void 0);D([g(),b("design:type",String)],Oi.prototype,"did",void 0);D([g(),b("design:type",String)],Oi.prototype,"lastSeen",void 0);D([g(),b("design:type",Number)],Oi.prototype,"perspectiveCount",void 0);Oi=D([z()],Oi);var $n=class{};D([g(),b("design:type",Boolean)],$n.prototype,"success",void 0);D([g(),b("design:type",String)],$n.prototype,"message",void 0);D([g(),b("design:type",Boolean)],$n.prototype,"requiresPassword",void 0);D([g(),b("design:type",Boolean)],$n.prototype,"isExistingUser",void 0);$n=D([z()],$n);var q=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Mr}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Mr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Mr}]}runtimeMessageReceived(){return Mr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Wu.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,n){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,n){return new Dn("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,n){return!0}};D([he(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],q.prototype,"runtimeQuit",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],q.prototype,"runtimeOpenLink",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",ki)],q.prototype,"runtimeInfo",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],q.prototype,"addTrustedAgents",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],q.prototype,"deleteTrustedAgents",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],q.prototype,"getTrustedAgents",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],q.prototype,"runtimeKnownLinkLanguageTemplates",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],q.prototype,"runtimeAddKnownLinkLanguageTemplates",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],q.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],q.prototype,"runtimeFriends",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],q.prototype,"runtimeAddFriends",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],q.prototype,"runtimeRemoveFriends",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",String)],q.prototype,"runtimeHcAgentInfos",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",String)],q.prototype,"runtimeGetNetworkMetrics",null);D([he(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],q.prototype,"runtimeRestartHolochain",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Boolean)],q.prototype,"runtimeHcAddAgentInfos",null);D([xt(),H(0,K()),H(1,K()),H(2,K()),H(3,K()),b("design:type",Function),b("design:paramtypes",[String,String,String,String]),b("design:returntype",void 0)],q.prototype,"runtimeVerifyStringSignedByDid",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[nr]),b("design:returntype",Boolean)],q.prototype,"runtimeSetStatus",null);D([xt(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Nn)],q.prototype,"runtimeFriendStatus",null);D([he(),H(0,K()),H(1,K()),b("design:type",Function),b("design:paramtypes",[String,_s]),b("design:returntype",Boolean)],q.prototype,"runtimeFriendSendMessage",null);D([xt(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Array)],q.prototype,"runtimeMessageInbox",null);D([xt(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Array)],q.prototype,"runtimeMessageOutbox",null);D([Ju(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Nn)],q.prototype,"runtimeMessageReceived",null);D([Ju(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Fn)],q.prototype,"exceptionOccurred",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Pt]),b("design:returntype",String)],q.prototype,"runtimeRequestInstallNotification",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],q.prototype,"runtimeNotifications",null);D([he(),H(0,K()),H(1,K()),b("design:type",Function),b("design:paramtypes",[String,Pt]),b("design:returntype",Boolean)],q.prototype,"runtimeUpdateNotification",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],q.prototype,"runtimeRemoveNotification",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],q.prototype,"runtimeGrantNotification",null);D([Ju(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Ai)],q.prototype,"runtimeNotificationTriggered",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],q.prototype,"runtimeExportDb",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],q.prototype,"runtimeImportDb",null);D([he(),H(0,K()),H(1,K()),b("design:type",Function),b("design:paramtypes",[String,String]),b("design:returntype",Boolean)],q.prototype,"runtimeExportPerspective",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],q.prototype,"runtimeImportPerspective",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],q.prototype,"runtimeMultiUserEnabled",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[Boolean]),b("design:returntype",Boolean)],q.prototype,"runtimeSetMultiUserEnabled",null);D([xt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],q.prototype,"runtimeListUsers",null);D([he(),H(0,K()),H(1,K()),b("design:type",Function),b("design:paramtypes",[String,ir]),b("design:returntype",$n)],q.prototype,"runtimeRequestLoginVerification",null);D([he(),H(0,K()),H(1,K()),H(2,K()),b("design:type",Function),b("design:paramtypes",[String,String,String]),b("design:returntype",String)],q.prototype,"runtimeVerifyEmailCode",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],q.prototype,"runtimeTestEmail",null);D([he(),H(0,K()),H(1,K()),H(2,K()),b("design:type",Function),b("design:paramtypes",[String,String,ir]),b("design:returntype",Dn)],q.prototype,"runtimeCreateUser",null);D([he(),H(0,K()),H(1,K()),b("design:type",Function),b("design:paramtypes",[String,String]),b("design:returntype",String)],q.prototype,"runtimeLoginUser",null);D([he(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeEnable",null);D([he(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeDisable",null);D([he(),H(0,K()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",String)],q.prototype,"runtimeEmailTestGetCode",null);D([he(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],q.prototype,"runtimeEmailTestClearCodes",null);D([he(),H(0,K()),H(1,K()),H(2,K()),b("design:type",Function),b("design:paramtypes",[String,String,Number]),b("design:returntype",Boolean)],q.prototype,"runtimeEmailTestSetExpiry",null);q=D([wy()],q);var oa=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},re=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},tt,fs,ds,Te;function hs(r){return r.charAt(0).toUpperCase()+r.slice(1)}function _d(r){return r?`triple("${r}", "ad4m://has_child", Base)`:""}function wd(){return`
1512
1540
  findall(
1513
1541
  [T, A],
1514
1542
  link(Base, _, _, T, A),
@@ -1516,51 +1544,51 @@ input VoiceActivityParamsInput {
1516
1544
  ),
1517
1545
  sort(AllLinks, SortedLinks),
1518
1546
  SortedLinks = [[Timestamp, Author]|_]
1519
- `}function q_(t){return`
1547
+ `}function qS(r){return`
1520
1548
  findall([PropertyName, PropertyValue, Resolve], (
1521
1549
  % Constrain to specified properties if provided
1522
- ${t?`member(PropertyName, [${t.map(e=>`"${e}"`).join(", ")}]),`:""}
1550
+ ${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
1523
1551
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1524
1552
  ), Properties)
1525
- `}function B_(t){return`
1553
+ `}function BS(r){return`
1526
1554
  findall([CollectionName, CollectionValues], (
1527
1555
  % Constrain to specified collections if provided
1528
- ${t?`member(CollectionName, [${t.map(e=>`"${e}"`).join(", ")}]),`:""}
1556
+ ${r?`member(CollectionName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
1529
1557
 
1530
1558
  collection(SubjectClass, CollectionName),
1531
1559
  collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
1532
1560
  ), Collections)
1533
- `}function _d(t={}){function e(r){return typeof r=="string"?`"${r}"`:r}return Object.entries(t).map(([r,n])=>{let i=["base","author","timestamp"].includes(r),a=`resolve_property(SubjectClass, Base, "${r}", Value${r}, _)`,o=hs(r);if(Array.isArray(n)){let s=n.map(c=>e(c)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${r}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:p}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return i?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${r}, [${h}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${r} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return i?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${r} >= ${c[0]}, Value${r} =< ${c[1]}`;let f=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:p,symbol:">="}];for(let{value:h,symbol:m}of f)if(h!==void 0)return i?`${o} ${m} ${h}`:`${a}, Value${r} ${m} ${h}`}return i?`${o} = ${e(n)}`:`${a}, Value${r} = ${e(n)}`}).join(", ")}function Sd(t){return t?"length(UnsortedInstances, TotalCount)":""}function wd(t){if(!t)return"SortedInstances = UnsortedInstances";let[e,r]=Object.entries(t)[0];return`sort_instances(UnsortedInstances, "${e}", "${r}", SortedInstances)`}function Ed(t){return!t||t<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${t}, InstancesWithOffset)`}function xd(t){return!t||t<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${t}, AllInstances)`}function Td(t){if(!t)return"";if(t.includes("://")){let[e,r]=t.split("://"),n=(r||"").replace(/\/+$/,"");return`${e}://${n}`}else return t.replace(/\/+$/,"")}function ll(t){if(!!t){if(typeof t=="string")return t;if(Array.isArray(t)&&t.length>0)return t.find(r=>r!=="null")||t[0]}}function Ah(t,e){return ll(t.type)===e}function Id(t){return Ah(t,"array")}function kd(t){return Ah(t,"object")}function V_(t){let e=ll(t.type);return e==="number"||e==="integer"}var Tn=class{static async getClassName(e){if(this===Tn)return await e.stringOrTemplateObjectToSubjectClassName(this);let n=this.classNamesByClass.get(this);n||(n={},this.classNamesByClass.set(this,n));let i=e.uuid;return n[i]||(n[i]=await e.stringOrTemplateObjectToSubjectClassName(this)),n[i]}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 r=e.className,n={},i=e.__properties||{};for(let[l,d]of Object.entries(i)){let p=d;n[l]={name:l,predicate:p.through||"",required:p.required||!1,writable:p.writable||!1,...p.initial!==void 0&&{initial:p.initial},...p.resolveLanguage!==void 0&&{resolveLanguage:p.resolveLanguage},...p.prologGetter!==void 0&&{prologGetter:p.prologGetter},...p.getter!==void 0&&{getter:p.getter},...p.prologSetter!==void 0&&{prologSetter:p.prologSetter},...p.local!==void 0&&{local:p.local},...p.transform!==void 0&&{transform:p.transform},...p.flag!==void 0&&{flag:p.flag}}}let a={},o=e.__collections||{};for(let[l,d]of Object.entries(o)){let p=d;a[l]={name:l,predicate:p.through||"",...p.where!==void 0&&{where:p.where},...p.local!==void 0&&{local:p.local},...p.getter!==void 0&&{getter:p.getter}}}let s=Object.keys(n).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[p,f]of Object.entries(l.properties)){let h=Id(f),m=this.determinePredicate(l,p,f,this.determineNamespace(l,d),d);if(h)a[p]={name:p,predicate:m,...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}};else{let g=l.required?.includes(p)||!1;n[p]={name:p,predicate:m,required:g,writable:f["x-ad4m"]?.writable!==!1,...f["x-ad4m"]?.resolveLanguage&&{resolveLanguage:f["x-ad4m"].resolveLanguage},...f["x-ad4m"]?.initial&&{initial:f["x-ad4m"].initial},...f["x-ad4m"]?.local!==void 0&&{local:f["x-ad4m"].local}}}}}return{className:r,properties:n,collections:a}}constructor(e,r,n){rt.set(this,void 0),ps.set(this,void 0),ds.set(this,void 0),Te.set(this,void 0),oa(this,rt,r||Ze.from(kh(24)).toUrl(),"f"),oa(this,Te,e,"f"),oa(this,ds,n||"ad4m://self","f")}get baseExpression(){return ne(this,rt,"f")}get perspective(){return ne(this,Te,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,r){if(r.writable===!1)throw new Error(`Property "${e}" is read-only and cannot be written`);if(r.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(!r.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:r.through,target:"value",...r.local&&{local:!0}}]}generateCollectionAction(e,r){let n=this.getCollectionMetadata(e);if(!n)throw new Error(`Collection "${e}" has no metadata defined`);if(!n.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[r],source:"this",predicate:n.through,target:"value",...n.local&&{local:!0}}]}static async assignValuesToInstance(e,r,n){let i=Object.fromEntries(await Promise.all(n.map(async([o,s,c])=>{let u=s;if(!c&&typeof s=="string"){let d=Array.from(s,h=>h.codePointAt(0)),p=d.every(h=>h<=255),f=d.some(h=>h>=128);if(p&&f)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=r.__properties?.[o]?.transform;return l&&typeof l=="function"&&(u=l(u)),[o,u]}))),a=Object.fromEntries(Object.entries(i).filter(([o])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(r),o);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(r,a)}async getData(){try{let e=this.constructor,r=e.getModelMetadata(),i=`
1561
+ `}function Ed(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,n])=>{let i=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=hs(t);if(Array.isArray(n)){let s=n.map(c=>e(c)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:f}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return i?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return i?`${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 i?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return i?`${o} = ${e(n)}`:`${a}, Value${t} = ${e(n)}`}).join(", ")}function xd(r){return r?"length(UnsortedInstances, TotalCount)":""}function Id(r){if(!r)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(r)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function Td(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function kd(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Ad(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),n=(t||"").replace(/\/+$/,"");return`${e}://${n}`}else return r.replace(/\/+$/,"")}function ll(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 Dh(r,e){return ll(r.type)===e}function Od(r){return Dh(r,"array")}function Nd(r){return Dh(r,"object")}function VS(r){let e=ll(r.type);return e==="number"||e==="integer"}var Tn=class{static async getClassName(e){if(this===Tn)return await e.stringOrTemplateObjectToSubjectClassName(this);let n=this.classNamesByClass.get(this);n||(n={},this.classNamesByClass.set(this,n));let i=e.uuid;return n[i]||(n[i]=await e.stringOrTemplateObjectToSubjectClassName(this)),n[i]}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,n={},i=e.__properties||{};for(let[l,d]of Object.entries(i)){let f=d;n[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(n).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=Od(p),m=this.determinePredicate(l,f,p,this.determineNamespace(l,d),d);if(h)a[f]={name:f,predicate:m,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let y=l.required?.includes(f)||!1;n[f]={name:f,predicate:m,required:y,writable:p["x-ad4m"]?.writable!==!1,...p["x-ad4m"]?.resolveLanguage&&{resolveLanguage:p["x-ad4m"].resolveLanguage},...p["x-ad4m"]?.initial&&{initial:p["x-ad4m"].initial},...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}}}}}return{className:t,properties:n,collections:a}}constructor(e,t,n){tt.set(this,void 0),fs.set(this,void 0),ds.set(this,void 0),Te.set(this,void 0),oa(this,tt,t||ye.from(Nh(24)).toUrl(),"f"),oa(this,Te,e,"f"),oa(this,ds,n||"ad4m://self","f")}get baseExpression(){return re(this,tt,"f")}get perspective(){return re(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 n=this.getCollectionMetadata(e);if(!n)throw new Error(`Collection "${e}" has no metadata defined`);if(!n.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:n.through,target:"value",...n.local&&{local:!0}}]}static async assignValuesToInstance(e,t,n){let i=Object.fromEntries(await Promise.all(n.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(i).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(),i=`
1534
1562
  SELECT id, predicate, out.uri AS target, author, timestamp
1535
1563
  FROM link
1536
- WHERE in.uri = ${e.formatSurrealValue(ne(this,rt,"f"))}
1564
+ WHERE in.uri = ${e.formatSurrealValue(re(this,tt,"f"))}
1537
1565
  ORDER BY timestamp ASC
1538
- `,a=await ne(this,Te,"f").querySurrealDB(i);if(a&&a.length>0){let o=null,s=null,c=null,u=null;for(let[l,d]of Object.entries(r.properties)){if(d.getter)continue;let p=a.filter(f=>f.predicate===d.predicate);if(p.length>0){let f=p[p.length-1],h=f.target;if(f.timestamp&&((!o||f.timestamp<o)&&(o=f.timestamp,u=f.author),(!s||f.timestamp>s)&&(s=f.timestamp,c=f.author)),d.resolveLanguage&&d.resolveLanguage!=="literal")try{let m=await ne(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=Ze.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(r.collections)){if(d.getter)continue;let f=a.filter(h=>h.predicate===d.predicate).map(h=>h.target);if(d.where?.condition&&f.length>0)try{let h=[];for(let m of f){let g=d.where.condition.replace(/\$perspective/g,`'${ne(this,Te,"f").uuid}'`).replace(/\$base/g,`'${ne(this,rt,"f")}'`).replace(/Target/g,`'${m.replace(/'/g,"\\'")}'`);g.trim().startsWith("WHERE")&&(g=`array::len(SELECT * FROM link ${g}) > 0`);let _=`RETURN ${g}`,S=await ne(this,Te,"f").querySurrealDB(_);(S===!0||Array.isArray(S)&&S.length>0&&S[0]===!0)&&h.push(m)}f=h}catch(h){console.warn(`Failed to apply condition filter for ${l}:`,h)}if(d.where?.isInstance&&f.length>0)try{let h=typeof d.where.isInstance=="string"?d.where.isInstance:d.where.isInstance.name,m=await ne(this,Te,"f").getSubjectClassMetadataFromSDNA(h);m&&(f=await ne(this,Te,"f").batchCheckSubjectInstances(f,m))}catch{}this[l]=f}u&&(this.author=u),o&&(this.createdAt=o),s&&(this.updatedAt=s)}await e.evaluateCustomGettersForInstance(this,ne(this,Te,"f"),r);for(let[o,s]of Object.entries(r.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 ne(this,Te,"f").getSubjectClassMetadataFromSDNA(c);if(u){let l=await ne(this,Te,"f").batchCheckSubjectInstances(this[o],u);this[o]=l}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${ne(this,rt,"f")}:`,e)}return this}static async queryToProlog(e,r,n){let{source:i,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:d}=r,p=n||await this.getClassName(e),f=[bd(),vd(i),q_(a),B_(o),_d(s)],h=[Sd(d),wd(c),Ed(u),xd(l)];return`
1566
+ `,a=await re(this,Te,"f").querySurrealDB(i);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 re(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=ye.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 y=d.where.condition.replace(/\$perspective/g,`'${re(this,Te,"f").uuid}'`).replace(/\$base/g,`'${re(this,tt,"f")}'`).replace(/Target/g,`'${m.replace(/'/g,"\\'")}'`);y.trim().startsWith("WHERE")&&(y=`array::len(SELECT * FROM link ${y}) > 0`);let _=`RETURN ${y}`,S=await re(this,Te,"f").querySurrealDB(_);(S===!0||Array.isArray(S)&&S.length>0&&S[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 re(this,Te,"f").getSubjectClassMetadataFromSDNA(h);m&&(p=await re(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,re(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 re(this,Te,"f").getSubjectClassMetadataFromSDNA(c);if(u){let l=await re(this,Te,"f").batchCheckSubjectInstances(this[o],u);this[o]=l}}catch{}}catch(e){console.error(`SurrealDB getData also failed for ${re(this,tt,"f")}:`,e)}return this}static async queryToProlog(e,t,n){let{source:i,properties:a,collections:o,where:s,order:c,offset:u,limit:l,count:d}=t,f=n||await this.getClassName(e),p=[wd(),_d(i),qS(a),BS(o),Ed(s)],h=[xd(d),Id(c),Td(u),kd(l)];return`
1539
1567
  findall([Base, Properties, Collections, Timestamp, Author], (
1540
- subject_class("${p}", SubjectClass),
1568
+ subject_class("${f}", SubjectClass),
1541
1569
  instance(SubjectClass, Base),
1542
- ${f.filter(g=>g).join(", ")}
1570
+ ${p.filter(y=>y).join(", ")}
1543
1571
  ), UnsortedInstances),
1544
- ${h.filter(g=>g).join(", ")}
1545
- `}static async evaluateCustomGettersForInstance(e,r,n){let i=this.formatSurrealValue(e.baseExpression);for(let[a,o]of Object.entries(n.properties))if(o.getter)try{let s=o.getter.replace(/Base/g,i),c=await r.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${i}`);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(n.collections))if(o.getter)try{let s=o.getter.replace(/Base/g,i),c=await r.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${i}`);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,r){let n=this.getModelMetadata(),{source:i,where:a,order:o,offset:s,limit:c}=r,u=[];i&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(i)} AND predicate = 'ad4m://has_child']) > 0`);for(let[f,h]of Object.entries(n.properties))h.required&&(h.flag&&h.initial?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}' AND out.uri = '${we(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}']) > 0`));if(u.length===0){for(let[f,h]of Object.entries(n.properties))if(h.initial){h.flag?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}' AND out.uri = '${we(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${we(h.predicate)}']) > 0`);break}}let l=this.buildGraphTraversalWhereClause(n,a),d=[];return d.push(...u),l&&d.push(l),d.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1572
+ ${h.filter(y=>y).join(", ")}
1573
+ `}static async evaluateCustomGettersForInstance(e,t,n){let i=this.formatSurrealValue(e.baseExpression);for(let[a,o]of Object.entries(n.properties))if(o.getter)try{let s=o.getter.replace(/Base/g,i),c=await t.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${i}`);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(n.collections))if(o.getter)try{let s=o.getter.replace(/Base/g,i),c=await t.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${i}`);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 n=this.getModelMetadata(),{source:i,where:a,order:o,offset:s,limit:c}=t,u=[];i&&u.push(`count(<-link[WHERE perspective = $perspective AND in.uri = ${this.formatSurrealValue(i)} AND predicate = 'ad4m://has_child']) > 0`);for(let[p,h]of Object.entries(n.properties))h.required&&(h.flag&&h.initial?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${me(h.predicate)}' AND out.uri = '${me(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${me(h.predicate)}']) > 0`));if(u.length===0){for(let[p,h]of Object.entries(n.properties))if(h.initial){h.flag?u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${me(h.predicate)}' AND out.uri = '${me(h.initial)}']) > 0`):u.push(`count(->link[WHERE perspective = $perspective AND predicate = '${me(h.predicate)}']) > 0`);break}}let l=this.buildGraphTraversalWhereClause(n,a),d=[];return d.push(...u),l&&d.push(l),d.push("count(->link[WHERE perspective = $perspective]) > 0"),`
1546
1574
  SELECT
1547
1575
  id AS source,
1548
1576
  uri AS source_uri,
1549
1577
  ->link[WHERE perspective = $perspective] AS links
1550
1578
  FROM node
1551
1579
  WHERE ${d.join(" AND ")}
1552
- `.trim()}static buildGraphTraversalWhereClause(e,r){if(!r)return"";let n=[];for(let[i,a]of Object.entries(r))if(["base","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");n.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(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[i];if(!s)continue;let c=we(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(", ");n.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 p=l.not.map(f=>this.formatSurrealValue(f)).join(", ");n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${p}]]) = 0`)}else n.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)&&n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)}]) > 0`)}return n.join(" AND ")}static buildSurrealWhereClause(e,r){if(!r)return"";let n=[];for(let[i,a]of Object.entries(r))if(["base","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="source";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");n.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(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[i];if(!s)continue;let c=we(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");n.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 p=l.not.map(f=>this.formatSurrealValue(f)).join(", ");n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${p}])`)}else n.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)&&n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)})`)}return n.join(" AND ")}static buildSurrealSelectFields(e,r,n){let i=[],a=r||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=we(c.predicate);i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}' LIMIT 1) AS ${s}`)}let o=n||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=we(c.predicate);i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}') AS ${s}`)}return i.push("(SELECT VALUE author FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS author"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS createdAt"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp DESC LIMIT 1) AS updatedAt"),i.join(`,
1553
- `)}static buildSurrealSelectFieldsWithAggregation(e,r,n){let i=[],a=r||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=we(c.predicate);i.push(`array::first(target[WHERE predicate = '${u}']) AS ${s}`)}let o=n||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=we(c.predicate);i.push(`target[WHERE predicate = '${u}'] AS ${s}`)}return i.push("array::first(author) AS author"),i.push("array::first(timestamp) AS createdAt"),i.push("array::last(timestamp) AS updatedAt"),i.join(`,
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(r=>this.formatSurrealValue(r)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,r,n){if(!n?.[0]?.AllInstances)return{results:[],totalCount:0};let i=[...r?.properties||[],...r?.collections||[]];return{results:(await Promise.all(n[0].AllInstances.map(async([o,s,c,u,l])=>{try{let d=new this(e,o);i.length&&Object.keys(d).forEach(f=>{i.includes(f)||delete d[f]});let p=[...s,...c,["createdAt",u],["author",l]];return await Tn.assignValuesToInstance(e,d,p),d}catch(d){return console.error(`Failed to process instance ${o}:`,d),null}}))).filter(o=>o!==null),totalCount:n[0].TotalCount}}static async instancesFromSurrealResult(e,r,n){if(!n||n.length===0)return{results:[],totalCount:0};let i=this.getModelMetadata(),a=r?.properties||[],o=r?.collections||[],s=[];for(let p of n){let f;try{if(f=p.source_uri,!f)continue;let h=p.links||[],m=new this(e,f),g=null,_=null,S=null,w=null;for(let b=0;b<h.length;b++){let O=h[b],C=O.predicate,E=O.target;if(E==="None")continue;O.timestamp&&((!g||O.timestamp<g)&&(g=O.timestamp,S=O.author),(!_||O.timestamp>_)&&(_=O.timestamp,w=O.author));let R=!1;for(let[F,P]of Object.entries(i.properties))if(!P.getter&&P.predicate===C){let M=m[F],Ee=typeof M=="object"&&M!==null&&!Array.isArray(M)&&Object.keys(M).length===0;if(!M||M===""||M===0||Ee){let ie=E;if(E!=null&&E!==""){if(P.resolveLanguage!=null&&P.resolveLanguage!=="literal"&&typeof E=="string")try{let j=await e.getExpression(E);if(j)try{ie=JSON.parse(j.data)}catch{ie=j.data}}catch(j){console.warn(`Failed to resolve expression for ${F} with target "${E}":`,j),console.warn("Falling back to raw value"),ie=E}else if(typeof E=="string"&&E.startsWith("literal://"))try{let j=Ze.fromUrl(E).get();j.data!==void 0?ie=j.data:ie=j}catch{ie=E}else if(typeof E=="string"){let j=typeof m[F];j==="number"?ie=Number(E):j==="boolean"&&(ie=E==="true"||E==="1")}}P.transform&&typeof P.transform=="function"&&(ie=P.transform(ie)),m[F]=ie}R=!0;break}if(!R){for(let[F,P]of Object.entries(i.collections))if(!P.getter&&P.predicate===C){m[F]||(m[F]=[]);let M=`__${F}_timestamps`,Ee=`__${F}_indices`;m[M]||(m[M]=[]),m[Ee]||(m[Ee]=[]),m[F].includes(E)||(m[F].push(E),m[M].push(O.timestamp||""),m[Ee].push(b));break}}}if(S&&(m.author=S),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(_)if(typeof _=="string"&&_.includes("T"))m.updatedAt=new Date(_).getTime();else if(typeof _=="string"){let b=parseInt(_,10);m.updatedAt=isNaN(b)?_:b}else m.updatedAt=_;for(let[b,O]of Object.entries(i.collections)){let C=`__${b}_timestamps`,E=`__${b}_indices`;if(m[b]&&m[C]){let R=m[b].map((F,P)=>({value:F,timestamp:m[C][P]||"",originalIndex:m[E]?.[P]??P}));R.sort((F,P)=>{let M=String(F.timestamp||""),Ee=String(P.timestamp||""),ie=M.localeCompare(Ee);return ie!==0?ie:F.originalIndex-P.originalIndex}),m[b]=R.map(F=>F.value).filter(F=>F!=null&&F!==""&&F!=="None"),delete m[C],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 ${f}:`,h)}}for(let p of s)await this.evaluateCustomGettersForInstance(p,e,i);for(let p of s)for(let[f,h]of Object.entries(i.collections))if(h.where?.isInstance&&p[f]?.length>0)try{let m=h.where.isInstance,g=p[f],_=typeof m=="string"?m:m.prototype?.className||m.name,S=await e.getSubjectClassMetadataFromSDNA(_);if(!S)continue;let w=await e.batchCheckSubjectInstances(g,S);p[f]=w}catch{}let c=s;r.where&&(c=s.filter(p=>{for(let[f,h]of Object.entries(r.where))if(f!=="base"){if(f==="author"||f==="timestamp"){if(!this.matchesCondition(p[f],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(p[f],h))return!1}}return!0}));let u=r.order||(r.limit!==void 0||r.offset!==void 0?{timestamp:"ASC"}:null);if(u){let p=Object.keys(u)[0],f=Object.values(u)[0];c.sort((h,m)=>{let g=h[p],_=m[p];if(g===void 0&&_===void 0)return 0;if(g===void 0)return f==="ASC"?1:-1;if(_===void 0)return f==="ASC"?-1:1;let S=0;return typeof g=="number"&&typeof _=="number"?S=g-_:typeof g=="string"&&typeof _=="string"?S=g.localeCompare(_):S=String(g).localeCompare(String(_)),f==="DESC"?-S:S})}let l=c.length,d=c;if(r.offset!==void 0||r.limit!==void 0){let p=r.offset||0,f=r.limit?p+r.limit:void 0;d=c.slice(p,f)}return{results:d,totalCount:l}}static matchesCondition(e,r){if(Array.isArray(r))return r.includes(e);if(typeof r=="object"&&r!==null){let n=r;if(n.not!==void 0)return Array.isArray(n.not)?!n.not.includes(e):e!==n.not;if(n.between!==void 0&&Array.isArray(n.between)&&n.between.length===2)return e>=n.between[0]&&e<=n.between[1];let i=!0;return n.gt!==void 0&&(i=i&&e>n.gt),n.gte!==void 0&&(i=i&&e>=n.gte),n.lt!==void 0&&(i=i&&e<n.lt),n.lte!==void 0&&(i=i&&e<=n.lte),n.contains!==void 0&&(typeof e=="string"?i=i&&e.includes(String(n.contains)):Array.isArray(e)?i=i&&e.includes(n.contains):i=!1),i}return e===r}static async findAll(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i),{results:o}=await this.instancesFromSurrealResult(e,r,a);return o}else{let i=await this.queryToProlog(e,r),a=await e.infer(i),{results:o}=await this.instancesFromPrologResult(e,r,a);return o}}static async findAllAndCount(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i);return await this.instancesFromSurrealResult(e,r,a)}else{let i=await this.queryToProlog(e,r),a=await e.infer(i);return await this.instancesFromPrologResult(e,r,a)}}static async paginate(e,r,n,i,a=!0){let o={...i||{},limit:r,offset:r*(n-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:r,pageNumber:n}}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:r,pageNumber:n}}}static async countQueryToProlog(e,r={},n){let{source:i,where:a}=r,o=n||await this.getClassName(e),s=[bd(),vd(i),_d(a)],c=[Sd(!0),wd(),Ed(),xd()];return`
1580
+ `.trim()}static buildGraphTraversalWhereClause(e,t){if(!t)return"";let n=[];for(let[i,a]of Object.entries(t))if(["base","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");n.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(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[i];if(!s)continue;let c=me(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(", ");n.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(", ");n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} IN [${f}]]) = 0`)}else n.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)&&n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}']) > 0`)}else n.push(`count(->link[WHERE perspective = $perspective AND predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)}]) > 0`)}return n.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let n=[];for(let[i,a]of Object.entries(t))if(["base","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="source";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");n.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(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[i];if(!s)continue;let c=me(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");n.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(", ");n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${f}])`)}else n.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)&&n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)})`)}return n.join(" AND ")}static buildSurrealSelectFields(e,t,n){let i=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=me(c.predicate);i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}' LIMIT 1) AS ${s}`)}let o=n||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=me(c.predicate);i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}') AS ${s}`)}return i.push("(SELECT VALUE author FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS author"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS createdAt"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp DESC LIMIT 1) AS updatedAt"),i.join(`,
1581
+ `)}static buildSurrealSelectFieldsWithAggregation(e,t,n){let i=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=me(c.predicate);i.push(`array::first(target[WHERE predicate = '${u}']) AS ${s}`)}let o=n||Object.keys(e.collections);for(let s of o){let c=e.collections[s];if(!c)continue;let u=me(c.predicate);i.push(`target[WHERE predicate = '${u}'] AS ${s}`)}return i.push("array::first(author) AS author"),i.push("array::first(timestamp) AS createdAt"),i.push("array::last(timestamp) AS updatedAt"),i.join(`,
1582
+ `)}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,n){if(!n?.[0]?.AllInstances)return{results:[],totalCount:0};let i=[...t?.properties||[],...t?.collections||[]];return{results:(await Promise.all(n[0].AllInstances.map(async([o,s,c,u,l])=>{try{let d=new this(e,o);i.length&&Object.keys(d).forEach(p=>{i.includes(p)||delete d[p]});let f=[...s,...c,["createdAt",u],["author",l]];return await Tn.assignValuesToInstance(e,d,f),d}catch(d){return console.error(`Failed to process instance ${o}:`,d),null}}))).filter(o=>o!==null),totalCount:n[0].TotalCount}}static async instancesFromSurrealResult(e,t,n){if(!n||n.length===0)return{results:[],totalCount:0};let i=this.getModelMetadata(),a=t?.properties||[],o=t?.collections||[],s=[];for(let f of n){let p;try{if(p=f.source_uri,!p)continue;let h=f.links||[],m=new this(e,p),y=null,_=null,S=null,w=null;for(let v=0;v<h.length;v++){let A=h[v],R=A.predicate,E=A.target;if(E==="None")continue;A.timestamp&&((!y||A.timestamp<y)&&(y=A.timestamp,S=A.author),(!_||A.timestamp>_)&&(_=A.timestamp,w=A.author));let P=!1;for(let[L,C]of Object.entries(i.properties))if(!C.getter&&C.predicate===R){let T=m[L],xe=typeof T=="object"&&T!==null&&!Array.isArray(T)&&Object.keys(T).length===0;if(!T||T===""||T===0||xe){let ne=E;if(E!=null&&E!==""){if(C.resolveLanguage!=null&&C.resolveLanguage!=="literal"&&typeof E=="string"&&!E.startsWith("literal://"))try{let M=await e.getExpression(E);if(M)try{ne=JSON.parse(M.data)}catch{ne=M.data}}catch(M){console.warn(`Failed to resolve expression for ${L} with target "${E}":`,M),console.warn("Falling back to raw value"),ne=E}else if(C.resolveLanguage==="literal"&&typeof E=="string"&&E.startsWith("literal://"))try{let M=ye.fromUrl(E).get();M.data!==void 0?ne=M.data:ne=M}catch{ne=E}else if(typeof E=="string"){let M=typeof m[L];M==="number"?ne=Number(E):M==="boolean"&&(ne=E==="true"||E==="1")}}C.transform&&typeof C.transform=="function"&&(ne=C.transform(ne)),m[L]=ne}P=!0;break}if(!P){for(let[L,C]of Object.entries(i.collections))if(!C.getter&&C.predicate===R){m[L]||(m[L]=[]);let T=`__${L}_timestamps`,xe=`__${L}_indices`;m[T]||(m[T]=[]),m[xe]||(m[xe]=[]),m[L].includes(E)||(m[L].push(E),m[T].push(A.timestamp||""),m[xe].push(v));break}}}if(S&&(m.author=S),y)if(typeof y=="string"&&y.includes("T"))m.createdAt=new Date(y).getTime();else if(typeof y=="string"){let v=parseInt(y,10);m.createdAt=isNaN(v)?y:v}else m.createdAt=y;if(_)if(typeof _=="string"&&_.includes("T"))m.updatedAt=new Date(_).getTime();else if(typeof _=="string"){let v=parseInt(_,10);m.updatedAt=isNaN(v)?_:v}else m.updatedAt=_;for(let[v,A]of Object.entries(i.collections)){let R=`__${v}_timestamps`,E=`__${v}_indices`;if(m[v]&&m[R]){let P=m[v].map((L,C)=>({value:L,timestamp:m[R][C]||"",originalIndex:m[E]?.[C]??C}));P.sort((L,C)=>{let T=String(L.timestamp||""),xe=String(C.timestamp||""),ne=T.localeCompare(xe);return ne!==0?ne:L.originalIndex-C.originalIndex}),m[v]=P.map(L=>L.value).filter(L=>L!=null&&L!==""&&L!=="None"),delete m[R],delete m[E]}}if(a.length>0||o.length>0){let v=[...a,...o];Object.keys(m).forEach(A=>{!v.includes(A)&&A!=="createdAt"&&A!=="updatedAt"&&A!=="author"&&A!=="baseExpression"&&delete m[A]})}s.push(m)}catch(h){console.error(`Failed to process SurrealDB instance ${p}:`,h)}}for(let f of s)await this.evaluateCustomGettersForInstance(f,e,i);for(let f of s)for(let[p,h]of Object.entries(i.collections))if(h.where?.isInstance&&f[p]?.length>0)try{let m=h.where.isInstance,y=f[p],_=typeof m=="string"?m:m.prototype?.className||m.name,S=await e.getSubjectClassMetadataFromSDNA(_);if(!S)continue;let w=await e.batchCheckSubjectInstances(y,S);f[p]=w}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 y=h[f],_=m[f];if(y===void 0&&_===void 0)return 0;if(y===void 0)return p==="ASC"?1:-1;if(_===void 0)return p==="ASC"?-1:1;let S=0;return typeof y=="number"&&typeof _=="number"?S=y-_:typeof y=="string"&&typeof _=="string"?S=y.localeCompare(_):S=String(y).localeCompare(String(_)),p==="DESC"?-S:S})}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 n=t;if(n.not!==void 0)return Array.isArray(n.not)?!n.not.includes(e):e!==n.not;if(n.between!==void 0&&Array.isArray(n.between)&&n.between.length===2)return e>=n.between[0]&&e<=n.between[1];let i=!0;return n.gt!==void 0&&(i=i&&e>n.gt),n.gte!==void 0&&(i=i&&e>=n.gte),n.lt!==void 0&&(i=i&&e<n.lt),n.lte!==void 0&&(i=i&&e<=n.lte),n.contains!==void 0&&(typeof e=="string"?i=i&&e.includes(String(n.contains)):Array.isArray(e)?i=i&&e.includes(n.contains):i=!1),i}return e===t}static async findAll(e,t={},n=!0){if(n){let i=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(i),{results:o}=await this.instancesFromSurrealResult(e,t,a);return o}else{let i=await this.queryToProlog(e,t),a=await e.infer(i),{results:o}=await this.instancesFromPrologResult(e,t,a);return o}}static async findAllAndCount(e,t={},n=!0){if(n){let i=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(i);return await this.instancesFromSurrealResult(e,t,a)}else{let i=await this.queryToProlog(e,t),a=await e.infer(i);return await this.instancesFromPrologResult(e,t,a)}}static async paginate(e,t,n,i,a=!0){let o={...i||{},limit:t,offset:t*(n-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:n}}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:n}}}static async countQueryToProlog(e,t={},n){let{source:i,where:a}=t,o=n||await this.getClassName(e),s=[wd(),_d(i),Ed(a)],c=[xd(!0),Id(),Td(),kd()];return`
1555
1583
  findall([Base, Properties, Collections, Timestamp, Author], (
1556
1584
  subject_class("${o}", SubjectClass),
1557
1585
  instance(SubjectClass, Base),
1558
1586
  ${s.filter(l=>l).join(", ")}
1559
1587
  ), UnsortedInstances),
1560
1588
  ${c.filter(l=>l).join(", ")}
1561
- `}static async countQueryToSurrealQL(e,r){let n={...r};return delete n.limit,delete n.offset,await this.queryToSurrealQL(e,n)}static async count(e,r={},n=!0){if(n){let i=await this.queryToSurrealQL(e,r),a=await e.querySurrealDB(i),{totalCount:o}=await this.instancesFromSurrealResult(e,r,a);return o}else return(await e.infer(await this.countQueryToProlog(e,r)))?.[0]?.TotalCount||0}async setProperty(e,r,n){let i=this.getPropertyMetadata(e);if(!i){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,i),o=i.resolveLanguage;o&&(r=await ne(this,Te,"f").createExpression(r,o)),await ne(this,Te,"f").executeAction(a,ne(this,rt,"f"),[{name:"value",value:r}],n)}async setCollectionSetter(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"setter");r!=null&&(Array.isArray(r)?await ne(this,Te,"f").executeAction(a,ne(this,rt,"f"),r.map(o=>({name:"value",value:o})),n):await ne(this,Te,"f").executeAction(a,ne(this,rt,"f"),[{name:"value",value:r}],n))}async setCollectionAdder(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"adder");r!=null&&(Array.isArray(r)?await Promise.all(r.map(o=>ne(this,Te,"f").executeAction(a,ne(this,rt,"f"),[{name:"value",value:o}],n))):await ne(this,Te,"f").executeAction(a,ne(this,rt,"f"),[{name:"value",value:r}],n))}async setCollectionRemover(e,r,n){if(!this.getCollectionMetadata(e)){console.warn(`Collection "${e}" has no metadata, skipping`);return}let a=this.generateCollectionAction(e,"remover");r!=null&&(Array.isArray(r)?await Promise.all(r.map(o=>ne(this,Te,"f").executeAction(a,ne(this,rt,"f"),[{name:"value",value:o}],n))):await ne(this,Te,"f").executeAction(a,ne(this,rt,"f"),[{name:"value",value:r}],n))}async save(e){let r=!1;e||(e=await this.perspective.createBatch(),r=!0);let n={};for(let[i,a]of Object.entries(this))a!=null&&!(Array.isArray(a)&&a.length>0)&&!a?.action&&(n[i]=a);await this.perspective.createSubject(this,ne(this,rt,"f"),n,e),await ne(this,Te,"f").add(new On({source:ne(this,ds,"f"),predicate:"ad4m://has_child",target:this.baseExpression}),"shared",e),await this.innerUpdate(!1,e),r&&(await this.perspective.commitBatch(e),await this.getData())}cleanCopy(){let e={},r=Object.entries(this);for(let[n,i]of r)i!=null&&n!=="author"&&n!=="timestamp"&&(e[n]=i);return e}async innerUpdate(e=!0,r){oa(this,ps,await ne(this,Te,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let n=Object.entries(this);for(let[i,a]of n)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(i,a.value,r);break;case"adder":await this.setCollectionAdder(i,a.value,r);break;case"remover":await this.setCollectionRemover(i,a.value,r);break;default:await this.setCollectionSetter(i,a.value,r);break}else if(Array.isArray(a))await this.setCollectionSetter(i,a,r);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(i))continue;await this.setProperty(i,a,r)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return oa(this,ps,await ne(this,Te,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await ne(this,Te,"f").removeSubject(this,ne(this,rt,"f"),e)}static query(e,r){return new Ku(e,this,r)}static fromJSONSchema(e,r){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 n=this.determineNamespace(e,r),i=class extends Tn{};if(!r.name||r.name.trim()==="")throw new Error("options.name is required and cannot be empty");i.className=r.name,i.prototype.className=r.name;let a={},o={};if(e.properties)for(let[u,l]of Object.entries(e.properties)){let d=this.determinePredicate(e,u,l,n,r),p=e.required?.includes(u)||!1,f=ll(l.type);if(Id(l)){o[u]={through:d,local:this.getPropertyOption(u,l,r,"local")},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:[]});let m=`add${hs(u)}`,g=`remove${hs(u)}`,_=`setCollection${hs(u)}`;i.prototype[m]=function(){},i.prototype[g]=function(){},i.prototype[_]=function(){}}else{let m=this.getPropertyOption(u,l,r,"resolveLanguage");!m&&r.resolveLanguage&&(m=r.resolveLanguage);let g=this.getPropertyOption(u,l,r,"local"),_=this.getPropertyOption(u,l,r,"writable",!0),S=this.getPropertyOption(u,l,r,"initial");if(kd(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&&V_(l)&&(m="literal"),p&&!S&&(kd(l)?S="literal://json:{}":S="ad4m://undefined"),a[u]={through:d,required:p,writable:_,...m&&{resolveLanguage:m},...g!==void 0&&{local:g},...S&&{initial:S}},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(f)}),_){let w=Zu(u);i.prototype[w]=function(){}}}}if(!Object.values(a).some(u=>u.initial)){let u="ad4m://type",l;if(n.includes("://")){let[d,p]=n.split("://"),f=(p||"").replace(/\/+$/,"");f?l=`${d}://${f}/instance`:l=`${d}://instance`}else l=`${n.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:u,required:!0,writable:!1,initial:l,flag:!0},Object.defineProperty(i.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:l}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${l}`)}return i.prototype.__properties=a,i.prototype.__collections=o,i.prototype.__jsonSchema=e,i.prototype.__jsonSchemaOptions=r,U_({name:r.name})(i),i}static determineNamespace(e,r){if(r.namespace)return r.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let i=new URL(e.$id).pathname.split("/").filter(a=>a);if(i.length>0)return`${i[i.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1589
+ `}static async countQueryToSurrealQL(e,t){let n={...t};return delete n.limit,delete n.offset,await this.queryToSurrealQL(e,n)}static async count(e,t={},n=!0){if(n){let i=await this.queryToSurrealQL(e,t),a=await e.querySurrealDB(i),{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,n){let i=this.getPropertyMetadata(e);if(!i){console.warn(`Property "${e}" has no metadata, skipping`);return}let a=this.generatePropertySetterAction(e,i),o=i.resolveLanguage;t==null||t===""||(o&&(t=await re(this,Te,"f").createExpression(t,o)),await re(this,Te,"f").executeAction(a,re(this,tt,"f"),[{name:"value",value:t}],n))}async setCollectionSetter(e,t,n){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 re(this,Te,"f").executeAction(a,re(this,tt,"f"),t.map(o=>({name:"value",value:o})),n):await re(this,Te,"f").executeAction(a,re(this,tt,"f"),[{name:"value",value:t}],n))}async setCollectionAdder(e,t,n){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=>re(this,Te,"f").executeAction(a,re(this,tt,"f"),[{name:"value",value:o}],n))):await re(this,Te,"f").executeAction(a,re(this,tt,"f"),[{name:"value",value:t}],n))}async setCollectionRemover(e,t,n){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=>re(this,Te,"f").executeAction(a,re(this,tt,"f"),[{name:"value",value:o}],n))):await re(this,Te,"f").executeAction(a,re(this,tt,"f"),[{name:"value",value:t}],n))}async save(e){let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let n={};for(let[a,o]of Object.entries(this))o!=null&&!(Array.isArray(o)&&o.length>0)&&!o?.action&&(n[a]=o);let i=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(i,re(this,tt,"f"),n,e),await re(this,Te,"f").add(new bt({source:re(this,ds,"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[n,i]of t)i!=null&&n!=="author"&&n!=="timestamp"&&(e[n]=i);return e}async innerUpdate(e=!0,t){oa(this,fs,await re(this,Te,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f");let n=Object.entries(this);for(let[i,a]of n)if(a!=null){if(a?.action)switch(a.action){case"setter":await this.setCollectionSetter(i,a.value,t);break;case"adder":await this.setCollectionAdder(i,a.value,t);break;case"remover":await this.setCollectionRemover(i,a.value,t);break;default:await this.setCollectionSetter(i,a.value,t);break}else if(Array.isArray(a))await this.setCollectionSetter(i,a,t);else if(a!=null&&a!==""&&e){if(this.getCollectionMetadata(i))continue;await this.setProperty(i,a,t)}}}async update(e){await this.innerUpdate(!0,e),await this.getData()}async get(){return oa(this,fs,await re(this,Te,"f").stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),"f"),await this.getData()}async delete(e){await re(this,Te,"f").removeSubject(this,re(this,tt,"f"),e)}static query(e,t){return new Hu(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 n=this.determineNamespace(e,t),i=class extends Tn{};if(!t.name||t.name.trim()==="")throw new Error("options.name is required and cannot be empty");i.className=t.name,i.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,n,t),f=e.required?.includes(u)||!1,p=ll(l.type);if(Od(l)){o[u]={through:d,local:this.getPropertyOption(u,l,t,"local")},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:[]});let m=`add${hs(u)}`,y=`remove${hs(u)}`,_=`setCollection${hs(u)}`;i.prototype[m]=function(){},i.prototype[y]=function(){},i.prototype[_]=function(){}}else{let m=this.getPropertyOption(u,l,t,"resolveLanguage");!m&&t.resolveLanguage&&(m=t.resolveLanguage);let y=this.getPropertyOption(u,l,t,"local"),_=this.getPropertyOption(u,l,t,"writable",!0),S=this.getPropertyOption(u,l,t,"initial");if(Nd(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&&VS(l)&&(m="literal"),f&&!S&&(Nd(l)?S="literal://json:{}":S="ad4m://undefined"),a[u]={through:d,required:f,writable:_,...m&&{resolveLanguage:m},...y!==void 0&&{local:y},...S&&{initial:S}},Object.defineProperty(i.prototype,u,{configurable:!0,writable:!0,value:this.getDefaultValueForType(p)}),_){let w=Is(u);i.prototype[w]=function(){}}}}if(!Object.values(a).some(u=>u.initial)){let u="ad4m://type",l;if(n.includes("://")){let[d,f]=n.split("://"),p=(f||"").replace(/\/+$/,"");p?l=`${d}://${p}/instance`:l=`${d}://instance`}else l=`${n.replace(/\/+$/,"")}/instance`;a.__ad4m_type={through:u,required:!0,writable:!1,initial:l,flag:!0},Object.defineProperty(i.prototype,"__ad4m_type",{configurable:!0,writable:!1,value:l}),console.warn(`No properties with initial values found. Added automatic type flag: ${u} = ${l}`)}return i.prototype.__properties=a,i.prototype.__collections=o,i.prototype.__jsonSchema=e,i.prototype.__jsonSchemaOptions=t,US({name:t.name})(i),i}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 i=new URL(e.$id).pathname.split("/").filter(a=>a);if(i.length>0)return`${i[i.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1562
1590
  - options.namespace
1563
1591
  - schema["x-ad4m"].namespace
1564
1592
  - schema.title
1565
- - valid schema.$id`)}static determinePredicate(e,r,n,i,a){if(a.propertyMapping?.[r])return a.propertyMapping[r];if(n["x-ad4m"]?.through)return n["x-ad4m"].through;if(a.predicateTemplate){let s=Td(i),[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}",r)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",r);let o=Td(i);return o.includes("://")?`${o}${r}`:`${o}://${r}`}static getPropertyOption(e,r,n,i,a){return n.propertyOptions?.[e]?.[i]!==void 0?n.propertyOptions[e][i]:r["x-ad4m"]?.[i]!==void 0?r["x-ad4m"][i]:n[i]!==void 0?n[i]: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""}}};rt=new WeakMap,ps=new WeakMap,ds=new WeakMap,Te=new WeakMap;Tn.classNamesByClass=new WeakMap;var Ku=class{constructor(e,r,n){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=r,n&&(this.queryParams=n)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return n}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),r=await this.perspective.infer(e),{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,r);return n}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let r=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),r=await this.perspective.querySurrealDB(e),{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,r);return n}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let r=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(r);let n=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let r=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(r);let n=async i=>{let a=i?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(n),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,r){let n={...this.queryParams||{},limit:e,offset:e*(r-1),count:!0};if(this.useSurrealDBFlag){let i=await this.ctor.queryToSurrealQL(this.perspective,n),a=await this.perspective.querySurrealDB(i),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:r}}else{let i=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName),a=await this.perspective.infer(i),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:r}}}async paginateSubscribe(e,r,n){this.dispose();let i={...this.queryParams||{},limit:e,offset:e*(r-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,i);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,u);n({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:r}}else{let a=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);n({results:l,totalCount:d,pageSize:e,pageNumber:r})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:r}}}};var Q_=t=>{let e=new Set;do for(let r of Reflect.ownKeys(t))e.add([t,r]);while((t=Reflect.getPrototypeOf(t))&&t!==Object.prototype);return e};function fl(t,{include:e,exclude:r}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):r?!r.some(a):!0};for(let[i,a]of Q_(t.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(t[a]=t[a].bind(t))}return t}var z_=12e3,pl=class extends EventTarget{constructor(r){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;fl(this),this.options=r,this.port=r.port||parseInt(Lo("ad4m-port"))||z_,this.url=r.url||Lo("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Lo("ad4m-token")||"",this.embedded=up(),this.embedded&&this.initializeEmbeddedMode()}connect(){return Se(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((r,n)=>{let i=setTimeout(()=>{n(new Error("Timeout waiting for AD4M config from parent window"))},3e4);this.embeddedResolve=a=>{clearTimeout(i),console.log("[Ad4m Connect] Successfully connected in embedded mode"),r(a)},this.embeddedReject=a=>{clearTimeout(i),n(a)},this.ad4mClient&&(this.authState==="authenticated"?(clearTimeout(i),console.log("[Ad4m Connect] Client already initialized in embedded mode"),r(this.ad4mClient)):(clearTimeout(i),n(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield lp(this.url),fr("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(r){throw console.error("[Ad4m Connect] Connection failed:",r),this.notifyConnectionChange("error"),r}})}buildClient(){return Se(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=tu({url:this.url,connectionParams:()=>Se(this,null,function*(){return{headers:{authorization:this.token}}}),on:{opened:r=>{this.activeSocket=r},error:r=>{this.notifyConnectionChange("error")},connected:()=>{this.notifyConnectionChange("connected")},closed:r=>Se(this,null,function*(){if(!(r.wasClean||this.requestedRestart))if(!this.token)this.notifyConnectionChange("error");else try{this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(n){console.error("[Ad4m Connect] Reconnection failed:",n),this.notifyConnectionChange("error")}})}}),this.apolloClient=this.createApolloClient(this.wsClient),this.ad4mClient=new qa(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(r){return new Xc({link:new cp(r),cache:new Oo({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(r,n){return Se(this,null,function*(){let i=tu({url:r,connectionParams:()=>Se(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new qa(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return Se(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(r){console.error("[Ad4m Connect] Authentication check failed:",r);let n="Cannot extractByTags from a ciphered wallet. You must unlock first.";return r.message===n?(this.notifyAuthChange("locked"),!0):(r.message==="InvalidSignature"&&(console.log("[Ad4m Connect] Clearing invalid token due to InvalidSignature"),this.token="",ra("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return Se(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",r=>Se(this,null,function*(){var n;if(((n=r.data)==null?void 0:n.type)==="AD4M_CONFIG"){if(r.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&&(!r.origin||!this.options.allowedOrigins.includes(r.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",r.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${r.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:r.data.port,hasToken:!!r.data.token});let{port:i,token:a}=r.data;if(i==null){let c=new Error("AD4M_CONFIG missing required field: port");console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let o=parseInt(i,10);if(!Number.isFinite(o)||o<=0){let c=new Error(`AD4M_CONFIG invalid port: ${i} (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`,fr("ad4m-port",o.toString()),s?fr("ad4m-token",s):ra("ad4m-token"),fr("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(r=!1){return Se(this,null,function*(){return r&&(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(r){return Se(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 n=yield this.ad4mClient.agent.generateJwt(this.requestId,r);return this.token=n,fr("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Code verification failed:",n),!1}})}isValidAd4mAPI(){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,r=>Se(this,null,function*(){return yield r.runtime.info()})),!0}catch(r){return console.error("[Ad4m Connect] Failed to verify AD4M API:",r),!1}})}isMultiUser(){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,r=>Se(this,null,function*(){return yield r.runtime.multiUserEnabled()}))}catch(r){return console.error("[Ad4m Connect] Failed to detect multi-user mode:",r),!1}})}submitEmail(r){return Se(this,null,function*(){try{return yield this.withTempClient(this.url,n=>Se(this,null,function*(){return yield n.agent.requestLoginVerification(r,this.buildAppInfo())}))}catch(n){return{success:!1,message:n.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){return yield a.agent.verifyEmailCode(r,n,"login")}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Email code verification failed:",i),!1}})}loginWithPassword(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){return yield a.agent.loginUser(r,n)}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Password login failed:",i),!1}})}createAccount(r,n){return Se(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Se(this,null,function*(){let o=yield a.agent.createUser(r,n);if(o.success)return yield a.agent.loginUser(r,n);throw new Error(o.error||"Failed to create account")}));return this.token=i,fr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Account creation error:",i),!1}})}resolveEmbedded(r){this.embeddedResolve&&(this.embeddedResolve(r),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(r){this.embeddedReject&&(this.embeddedReject(r),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(r){this.connectionState!==r&&(this.connectionState=r,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:r})))}notifyAuthChange(r){if(this.authState=r,this.dispatchEvent(new CustomEvent("authstatechange",{detail:r})),this.embedded&&(r==="authenticated"&&this.resolveEmbedded(this.ad4mClient),r==="unauthenticated"||r==="locked")){let n=r==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(n))}}notifyConfigChange(r,n){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:r,value:n}}))}};export{pl as default};
1593
+ - valid schema.$id`)}static determinePredicate(e,t,n,i,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(n["x-ad4m"]?.through)return n["x-ad4m"].through;if(a.predicateTemplate){let s=Ad(i),[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=Ad(i);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,n,i,a){return n.propertyOptions?.[e]?.[i]!==void 0?n.propertyOptions[e][i]:t["x-ad4m"]?.[i]!==void 0?t["x-ad4m"][i]:n[i]!==void 0?n[i]: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""}}};tt=new WeakMap,fs=new WeakMap,ds=new WeakMap,Te=new WeakMap;Tn.classNamesByClass=new WeakMap;var Hu=class{constructor(e,t,n){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,n&&(this.queryParams=n)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return n}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return n}}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 n=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let n=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return n}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let n=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(n);let{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return i}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let n=async i=>{let a=i?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(n),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let i=await this.ctor.queryToSurrealQL(this.perspective,n),a=await this.perspective.querySurrealDB(i),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let i=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName),a=await this.perspective.infer(i),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,n,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,n){this.dispose();let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,i);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async u=>{let{results:l,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,u);n({results:l,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,i,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);n({results:l,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,i,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}};var QS=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 pl(r,{include:e,exclude:t}={}){let n=i=>{let a=o=>typeof o=="string"?i===o:o.test(i);return e?e.some(a):t?!t.some(a):!0};for(let[i,a]of QS(r.constructor.prototype)){if(a==="constructor"||!n(a))continue;let o=Reflect.getOwnPropertyDescriptor(i,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var zS=12e3,fl=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;pl(this),this.options=t,this.port=t.port||parseInt(Fo("ad4m-port"))||zS,this.url=t.url||Fo("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Fo("ad4m-token")||"",this.embedded=uf(),this.embedded&&this.initializeEmbeddedMode()}connect(){return Ee(this,null,function*(){if(this.embedded)return console.log("[Ad4m Connect] Embedded mode - waiting for AD4M config via postMessage"),new Promise((t,n)=>{let i=setTimeout(()=>{n(new Error("Timeout waiting for AD4M config from parent window"))},3e4);this.embeddedResolve=a=>{clearTimeout(i),console.log("[Ad4m Connect] Successfully connected in embedded mode"),t(a)},this.embeddedReject=a=>{clearTimeout(i),n(a)},this.ad4mClient&&(this.authState==="authenticated"?(clearTimeout(i),console.log("[Ad4m Connect] Client already initialized in embedded mode"),t(this.ad4mClient)):(clearTimeout(i),n(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield lf(this.url),pr("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 Ee(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=ru({url:this.url,connectionParams:()=>Ee(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=>Ee(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(n){console.error("[Ad4m Connect] Reconnection failed:",n),this.notifyConnectionChange("error")}})}}),this.apolloClient=this.createApolloClient(this.wsClient),this.ad4mClient=new qa(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new eu({link:new cf(t),cache:new Oo({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,n){return Ee(this,null,function*(){let i=ru({url:t,connectionParams:()=>Ee(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new qa(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return Ee(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 n="Cannot extractByTags from a ciphered wallet. You must unlock first.";return t.message===n?(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 Ee(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=>Ee(this,null,function*(){var n;if(((n=t.data)==null?void 0:n.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:i,token:a}=t.data;if(i==null){let c=new Error("AD4M_CONFIG missing required field: port");console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let o=parseInt(i,10);if(!Number.isFinite(o)||o<=0){let c=new Error(`AD4M_CONFIG invalid port: ${i} (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`,pr("ad4m-port",o.toString()),s?pr("ad4m-token",s):ra("ad4m-token"),pr("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 Ee(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 Ee(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 n=yield this.ad4mClient.agent.generateJwt(this.requestId,t);return this.token=n,pr("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Code verification failed:",n),!1}})}isValidAd4mAPI(){return Ee(this,null,function*(){try{return yield this.withTempClient(this.url,t=>Ee(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 Ee(this,null,function*(){try{return yield this.withTempClient(this.url,t=>Ee(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 Ee(this,null,function*(){try{return yield this.withTempClient(this.url,n=>Ee(this,null,function*(){return yield n.agent.requestLoginVerification(t,this.buildAppInfo())}))}catch(n){return{success:!1,message:n.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(t,n){return Ee(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Ee(this,null,function*(){return yield a.agent.verifyEmailCode(t,n,"login")}));return this.token=i,pr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Email code verification failed:",i),!1}})}loginWithPassword(t,n){return Ee(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Ee(this,null,function*(){return yield a.agent.loginUser(t,n)}));return this.token=i,pr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Password login failed:",i),!1}})}createAccount(t,n){return Ee(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Ee(this,null,function*(){let o=yield a.agent.createUser(t,n);if(o.success)return yield a.agent.loginUser(t,n);throw new Error(o.error||"Failed to create account")}));return this.token=i,pr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Account creation error:",i),!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 n=t==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(n))}}notifyConfigChange(t,n){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:t,value:n}}))}};export{fl as default};
1566
1594
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */