@coasys/ad4m-connect 0.12.0 → 0.12.1-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 _e=(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 Ys=function(r,e){return Ys=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])},Ys(r,e)};function Oe(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ys(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(p){o(p)}}function c(l){try{u(n.throw(l))}catch(p){o(p)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(r,e||[])).next())})}function $t(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 Er(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 Xs="Invariant Violation",bl=Object.setPrototypeOf,Wh=bl===void 0?function(r,e){return r.__proto__=e,r}:bl,K=function(r){Oe(e,r);function e(t){t===void 0&&(t=Xs);var n=r.call(this,typeof t=="number"?Xs+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=Xs,Wh(n,e.prototype),n}return e}(Error);function L(r,e){if(!r)throw new K(e)}var io=["debug","log","warn","error","silent"],ec=io.indexOf("log");function no(r){return function(){if(io.indexOf(r)>=ec){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=no("debug"),r.log=no("log"),r.warn=no("warn"),r.error=no("error")})(L||(L={}));function Sl(r){var e=io[ec];return ec=Math.max(0,io.indexOf(r)),e}function Be(r){try{return r()}catch{}}var ao=Be(function(){return globalThis})||Be(function(){return window})||Be(function(){return self})||Be(function(){return global})||Be(function(){return Be.constructor("return this")()});var wl="__",_l=[wl,wl].join("DEV");function Gh(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(ao,_l,{value:Be(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),ao[_l]}}var en=Gh();function xr(r){try{return r()}catch{}}var tc=xr(function(){return globalThis})||xr(function(){return window})||xr(function(){return self})||xr(function(){return global})||xr(function(){return xr.constructor("return this")()}),rc=!1;function Hh(){tc&&!xr(function(){return"production"})&&!xr(function(){return process})&&(Object.defineProperty(tc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),rc=!0)}Hh();function nc(){rc&&(delete tc.process,rc=!1)}var Rw=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",Cw=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",El=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Le=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function ic(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Kh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ji=Kh;function oo(r){var e=r.prototype.toJSON;typeof e=="function"||ic(0),r.prototype.inspect=e,ji&&(r.prototype[ji]=e)}var xl=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}();oo(xl);var kl=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}();oo(kl);function ac(r){return r!=null&&typeof r.kind=="string"}function so(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?so=function(t){return typeof t}:so=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},so(r)}var Jh=10,Il=2;function Ui(r){return co(r,[])}function co(r,e){switch(so(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Zh(r,e);default:return String(r)}}function Zh(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=em(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:co(i,t)}else if(Array.isArray(r))return Xh(r,t);return Yh(r,t)}function Yh(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Il)return"["+tm(r)+"]";var n=t.map(function(i){var a=co(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Xh(r,e){if(r.length===0)return"[]";if(e.length>Il)return"[Array]";for(var t=Math.min(Jh,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(co(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function em(r){var e=r[String(ji)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function tm(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 qi(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function Tl(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 rm(r,e,t){return e&&Tl(r.prototype,e),t&&Tl(r,t),r}var uo=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"||qi(0,"Body must be a string. Received: ".concat(Ui(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||qi(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||qi(0,"column in locationOffset is 1-indexed and must be positive.")}return rm(r,[{key:El,get:function(){return"Source"}}]),r}();function Al(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(`
1
+ var pe=(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 Ys=function(r,e){return Ys=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])},Ys(r,e)};function Oe(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Ys(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 Wt(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 $t(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(p){o(p)}}function c(l){try{u(n.throw(l))}catch(p){o(p)}}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 Ir(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 Xs="Invariant Violation",bl=Object.setPrototypeOf,Gh=bl===void 0?function(r,e){return r.__proto__=e,r}:bl,K=function(r){Oe(e,r);function e(t){t===void 0&&(t=Xs);var n=r.call(this,typeof t=="number"?Xs+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=Xs,Gh(n,e.prototype),n}return e}(Error);function L(r,e){if(!r)throw new K(e)}var ao=["debug","log","warn","error","silent"],ec=ao.indexOf("log");function io(r){return function(){if(ao.indexOf(r)>=ec){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=io("debug"),r.log=io("log"),r.warn=io("warn"),r.error=io("error")})(L||(L={}));function Sl(r){var e=ao[ec];return ec=Math.max(0,ao.indexOf(r)),e}function Be(r){try{return r()}catch{}}var oo=Be(function(){return globalThis})||Be(function(){return window})||Be(function(){return self})||Be(function(){return global})||Be(function(){return Be.constructor("return this")()});var wl="__",_l=[wl,wl].join("DEV");function Kh(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(oo,_l,{value:Be(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),oo[_l]}}var nn=Kh();function kr(r){try{return r()}catch{}}var tc=kr(function(){return globalThis})||kr(function(){return window})||kr(function(){return self})||kr(function(){return global})||kr(function(){return kr.constructor("return this")()}),rc=!1;function Jh(){tc&&!kr(function(){return"production"})&&!kr(function(){return process})&&(Object.defineProperty(tc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),rc=!0)}Jh();function nc(){rc&&(delete tc.process,rc=!1)}var $w=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",Fw=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",El=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Le=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function ic(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Zh=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ji=Zh;function so(r){var e=r.prototype.toJSON;typeof e=="function"||ic(0),r.prototype.inspect=e,ji&&(r.prototype[ji]=e)}var xl=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}();so(xl);var Il=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}();so(Il);function ac(r){return r!=null&&typeof r.kind=="string"}function co(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?co=function(t){return typeof t}:co=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},co(r)}var Yh=10,kl=2;function qi(r){return uo(r,[])}function uo(r,e){switch(co(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Xh(r,e);default:return String(r)}}function Xh(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=rm(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:uo(i,t)}else if(Array.isArray(r))return tm(r,t);return em(r,t)}function em(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>kl)return"["+nm(r)+"]";var n=t.map(function(i){var a=uo(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function tm(r,e){if(r.length===0)return"[]";if(e.length>kl)return"[Array]";for(var t=Math.min(Yh,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(uo(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function rm(r){var e=r[String(ji)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function nm(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 Bi(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function Tl(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 im(r,e,t){return e&&Tl(r.prototype,e),t&&Tl(r,t),r}var lo=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"||Bi(0,"Body must be a string. Received: ".concat(qi(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Bi(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Bi(0,"column in locationOffset is 1-indexed and must be positive.")}return im(r,[{key:El,get:function(){return"Source"}}]),r}();function Al(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
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
3
  `+e),c+=e?r.replace(/\n/g,`
4
4
  `+e):r,s&&(c+=`
5
- `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var nm={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"]},tn=Object.freeze({});function Ye(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:nm,n=void 0,i=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,p=[],d=[],f=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=d.length===0?void 0:p[p.length-1],c=l,l=d.pop(),m){if(i)c=c.slice();else{for(var v={},_=0,y=Object.keys(c);_<y.length;_++){var b=y[_];v[b]=c[b]}c=v}for(var g=0,A=0;A<s.length;A++){var N=s[A][0],I=s[A][1];i&&(N-=g),i&&I===null?(c.splice(N,1),g++):c[N]=I}}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&&p.push(u)}var C=void 0;if(!Array.isArray(c)){if(!ac(c))throw new Error("Invalid AST Node: ".concat(Ui(c),"."));var $=oc(e,c.kind,h);if($){if(C=$.call(e,c,u,l,p,d),C===tn)break;if(C===!1){if(!h){p.pop();continue}}else if(C!==void 0&&(s.push([u,C]),!h))if(ac(C))c=C;else{p.pop();continue}}}if(C===void 0&&m&&s.push([u,c]),h)p.pop();else{var P;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(P=t[c.kind])!==null&&P!==void 0?P:[],o=-1,s=[],l&&d.push(l),l=c}}while(n!==void 0);return s.length!==0&&(f=s[s.length-1][1]),f}function oc(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 Kn(r){return Ye(r,{leave:am})}var im=80,am={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return F(e.definitions,`
5
+ `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var am={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"]},an=Object.freeze({});function Xe(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:am,n=void 0,i=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,p=[],d=[],f=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=d.length===0?void 0:p[p.length-1],c=l,l=d.pop(),m){if(i)c=c.slice();else{for(var b={},_=0,v=Object.keys(c);_<v.length;_++){var S=v[_];b[S]=c[S]}c=b}for(var y=0,O=0;O<s.length;O++){var N=s[O][0],T=s[O][1];i&&(N-=y),i&&T===null?(c.splice(N,1),y++):c[N]=T}}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&&p.push(u)}var C=void 0;if(!Array.isArray(c)){if(!ac(c))throw new Error("Invalid AST Node: ".concat(qi(c),"."));var $=oc(e,c.kind,h);if($){if(C=$.call(e,c,u,l,p,d),C===an)break;if(C===!1){if(!h){p.pop();continue}}else if(C!==void 0&&(s.push([u,C]),!h))if(ac(C))c=C;else{p.pop();continue}}}if(C===void 0&&m&&s.push([u,c]),h)p.pop();else{var P;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(P=t[c.kind])!==null&&P!==void 0?P:[],o=-1,s=[],l&&d.push(l),l=c}}while(n!==void 0);return s.length!==0&&(f=s[s.length-1][1]),f}function oc(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 Zn(r){return Xe(r,{leave:sm})}var om=80,sm={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return F(e.definitions,`
6
6
 
7
7
  `)+`
8
- `},OperationDefinition:function(e){var t=e.operation,n=e.name,i=Ae("(",F(e.variableDefinitions,", "),")"),a=F(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&t==="query"?o:F([t,F([n,i]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return t+": "+n+Ae(" = ",i)+Ae(" ",F(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=Ae("",t,": ")+n,c=s+Ae("(",F(i,", "),")");return c.length>im&&(c=s+Ae(`(
9
- `,lo(F(i,`
8
+ `},OperationDefinition:function(e){var t=e.operation,n=e.name,i=Ae("(",F(e.variableDefinitions,", "),")"),a=F(e.directives," "),o=e.selectionSet;return!n&&!a&&!i&&t==="query"?o:F([t,F([n,i]),a,o]," ")},VariableDefinition:function(e){var t=e.variable,n=e.type,i=e.defaultValue,a=e.directives;return t+": "+n+Ae(" = ",i)+Ae(" ",F(a," "))},SelectionSet:function(e){var t=e.selections;return Ut(t)},Field:function(e){var t=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Ae("",t,": ")+n,c=s+Ae("(",F(i,", "),")");return c.length>om&&(c=s+Ae(`(
9
+ `,fo(F(i,`
10
10
  `)),`
11
- )`)),F([c,F(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+Ae(" ",F(n," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return F(["...",Ae("on ",t),F(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(Ae("(",F(i,", "),")")," ")+"on ".concat(n," ").concat(Ae("",F(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var n=e.value,i=e.block;return i?Al(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"["+F(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+F(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+Ae("(",F(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:Ft(function(r){var e=r.directives,t=r.operationTypes;return F(["schema",F(e," "),Mt(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,n=e.type;return t+": "+n},ScalarTypeDefinition:Ft(function(r){var e=r.name,t=r.directives;return F(["scalar",e,F(t," ")]," ")}),ObjectTypeDefinition:Ft(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["type",e,Ae("implements ",F(t," & ")),F(n," "),Mt(i)]," ")}),FieldDefinition:Ft(function(r){var e=r.name,t=r.arguments,n=r.type,i=r.directives;return e+(Ol(t)?Ae(`(
12
- `,lo(F(t,`
11
+ )`)),F([c,F(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+Ae(" ",F(n," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return F(["...",Ae("on ",t),F(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(Ae("(",F(i,", "),")")," ")+"on ".concat(n," ").concat(Ae("",F(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var n=e.value,i=e.block;return i?Al(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"["+F(t,", ")+"]"},ObjectValue:function(e){var t=e.fields;return"{"+F(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+Ae("(",F(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:Mt(function(r){var e=r.directives,t=r.operationTypes;return F(["schema",F(e," "),Ut(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,n=e.type;return t+": "+n},ScalarTypeDefinition:Mt(function(r){var e=r.name,t=r.directives;return F(["scalar",e,F(t," ")]," ")}),ObjectTypeDefinition:Mt(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["type",e,Ae("implements ",F(t," & ")),F(n," "),Ut(i)]," ")}),FieldDefinition:Mt(function(r){var e=r.name,t=r.arguments,n=r.type,i=r.directives;return e+(Ol(t)?Ae(`(
12
+ `,fo(F(t,`
13
13
  `)),`
14
- )`):Ae("(",F(t,", "),")"))+": "+n+Ae(" ",F(i," "))}),InputValueDefinition:Ft(function(r){var e=r.name,t=r.type,n=r.defaultValue,i=r.directives;return F([e+": "+t,Ae("= ",n),F(i," ")]," ")}),InterfaceTypeDefinition:Ft(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["interface",e,Ae("implements ",F(t," & ")),F(n," "),Mt(i)]," ")}),UnionTypeDefinition:Ft(function(r){var e=r.name,t=r.directives,n=r.types;return F(["union",e,F(t," "),n&&n.length!==0?"= "+F(n," | "):""]," ")}),EnumTypeDefinition:Ft(function(r){var e=r.name,t=r.directives,n=r.values;return F(["enum",e,F(t," "),Mt(n)]," ")}),EnumValueDefinition:Ft(function(r){var e=r.name,t=r.directives;return F([e,F(t," ")]," ")}),InputObjectTypeDefinition:Ft(function(r){var e=r.name,t=r.directives,n=r.fields;return F(["input",e,F(t," "),Mt(n)]," ")}),DirectiveDefinition:Ft(function(r){var e=r.name,t=r.arguments,n=r.repeatable,i=r.locations;return"directive @"+e+(Ol(t)?Ae(`(
15
- `,lo(F(t,`
14
+ )`):Ae("(",F(t,", "),")"))+": "+n+Ae(" ",F(i," "))}),InputValueDefinition:Mt(function(r){var e=r.name,t=r.type,n=r.defaultValue,i=r.directives;return F([e+": "+t,Ae("= ",n),F(i," ")]," ")}),InterfaceTypeDefinition:Mt(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["interface",e,Ae("implements ",F(t," & ")),F(n," "),Ut(i)]," ")}),UnionTypeDefinition:Mt(function(r){var e=r.name,t=r.directives,n=r.types;return F(["union",e,F(t," "),n&&n.length!==0?"= "+F(n," | "):""]," ")}),EnumTypeDefinition:Mt(function(r){var e=r.name,t=r.directives,n=r.values;return F(["enum",e,F(t," "),Ut(n)]," ")}),EnumValueDefinition:Mt(function(r){var e=r.name,t=r.directives;return F([e,F(t," ")]," ")}),InputObjectTypeDefinition:Mt(function(r){var e=r.name,t=r.directives,n=r.fields;return F(["input",e,F(t," "),Ut(n)]," ")}),DirectiveDefinition:Mt(function(r){var e=r.name,t=r.arguments,n=r.repeatable,i=r.locations;return"directive @"+e+(Ol(t)?Ae(`(
15
+ `,fo(F(t,`
16
16
  `)),`
17
- )`):Ae("(",F(t,", "),")"))+(n?" repeatable":"")+" on "+F(i," | ")}),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return F(["extend schema",F(t," "),Mt(n)]," ")},ScalarTypeExtension:function(e){var t=e.name,n=e.directives;return F(["extend scalar",t,F(n," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return F(["extend type",t,Ae("implements ",F(n," & ")),F(i," "),Mt(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return F(["extend interface",t,Ae("implements ",F(n," & ")),F(i," "),Mt(a)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,i=e.types;return F(["extend union",t,F(n," "),i&&i.length!==0?"= "+F(i," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,i=e.values;return F(["extend enum",t,F(n," "),Mt(i)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return F(["extend input",t,F(n," "),Mt(i)]," ")}};function Ft(r){return function(e){return F([e.description,r(e)],`
18
- `)}}function F(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(n){return n}).join(t))!==null&&e!==void 0?e:""}function Mt(r){return Ae(`{
19
- `,lo(F(r,`
17
+ )`):Ae("(",F(t,", "),")"))+(n?" repeatable":"")+" on "+F(i," | ")}),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return F(["extend schema",F(t," "),Ut(n)]," ")},ScalarTypeExtension:function(e){var t=e.name,n=e.directives;return F(["extend scalar",t,F(n," ")]," ")},ObjectTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return F(["extend type",t,Ae("implements ",F(n," & ")),F(i," "),Ut(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return F(["extend interface",t,Ae("implements ",F(n," & ")),F(i," "),Ut(a)]," ")},UnionTypeExtension:function(e){var t=e.name,n=e.directives,i=e.types;return F(["extend union",t,F(n," "),i&&i.length!==0?"= "+F(i," | "):""]," ")},EnumTypeExtension:function(e){var t=e.name,n=e.directives,i=e.values;return F(["extend enum",t,F(n," "),Ut(i)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return F(["extend input",t,F(n," "),Ut(i)]," ")}};function Mt(r){return function(e){return F([e.description,r(e)],`
18
+ `)}}function F(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(n){return n}).join(t))!==null&&e!==void 0?e:""}function Ut(r){return Ae(`{
19
+ `,fo(F(r,`
20
20
  `)),`
21
- }`)}function Ae(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function lo(r){return Ae(" ",r.replace(/\n/g,`
22
- `))}function om(r){return r.indexOf(`
23
- `)!==-1}function Ol(r){return r!=null&&r.some(om)}function Bi(r){return r.kind===Le.FIELD||r.kind===Le.FRAGMENT_SPREAD||r.kind===Le.INLINE_FRAGMENT}function Dl(){return typeof uo=="function"?nc():nc()}function gm(){__DEV__?L(typeof en=="boolean",en):L(typeof en=="boolean",39)}Dl();gm();function ur(r,e){var t=r.directives;return!t||!t.length?!0:Nl(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__?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 Jn(r,e,t){var n=new Set(r),i=n.size;return Ye(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return tn}}),t?!n.size:n.size<i}function sc(r){return r&&Jn(["client","export"],r,!0)}function ym(r){var e=r.name.value;return e==="skip"||e==="include"}function Nl(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!ym(t)){var n=t.arguments,i=t.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:t,ifArgument:a})}}),e}function cc(r,e){var t=e,n=[];r.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 t>"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),t=n[0].name.value);var i=x(x({},r),{definitions:Er([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function rn(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function nn(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__?L(n,"No fragment named ".concat(t)):L(n,46),n||null}default:return null}}function se(r){return r!==null&&typeof r=="object"}function zt(r){return{__ref:String(r)}}function te(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function uc(r){return se(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function vm(r){return r.kind==="StringValue"}function bm(r){return r.kind==="BooleanValue"}function Sm(r){return r.kind==="IntValue"}function wm(r){return r.kind==="FloatValue"}function _m(r){return r.kind==="Variable"}function Em(r){return r.kind==="ObjectValue"}function xm(r){return r.kind==="ListValue"}function km(r){return r.kind==="EnumValue"}function Im(r){return r.kind==="NullValue"}function kr(r,e,t,n){if(Sm(t)||wm(t))r[e.value]=Number(t.value);else if(bm(t)||vm(t))r[e.value]=t.value;else if(Em(t)){var i={};t.fields.map(function(o){return kr(i,o.name,o.value,n)}),r[e.value]=i}else if(_m(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(xm(t))r[e.value]=t.values.map(function(o){var s={};return kr(s,e,o,n),s[e.value]});else if(km(t))r[e.value]=t.value;else if(Im(t))r[e.value]=null;else throw __DEV__?new K('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 K(55)}function lc(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 kr(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 kr(n,a,o,e)})),Qi(r.name.value,n,t)}var Tm=["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(Vi(i),")")}else return t.connection.key;var a=r;if(e){var o=Vi(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){Tm.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(Vi(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=Vi;return Vi=r,e}}),Vi=function(e){return JSON.stringify(e,Am)};function Am(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 lr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return kr(t,i,a,e)}),t}return null}function It(r){return r.alias?r.alias.value:r.name.value}function zi(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(vt(a)){if(a.name.value==="__typename")return r[It(a)]}else{var o=zi(r,nn(a,t).selectionSet,t);if(typeof o=="string")return o}}}function vt(r){return r.kind==="Field"}function fc(r){return r.kind==="InlineFragment"}function Zn(r){__DEV__?L(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new K('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new K(48);return t});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),r}function Wt(r){return Zn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Yn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function an(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Wi(r){var e=Wt(r);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function pc(r){__DEV__?L(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r.kind==="Document",51),__DEV__?L(r.definitions.length<=1,"Fragment must have exactly one definition."):L(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function on(r){Zn(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 K("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new K(54)}function sn(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&kr(e,n.variable.name,n.defaultValue)}),e}var me=Array.isArray;function Fe(r){return Array.isArray(r)&&r.length>0}var Rl={kind:Le.FIELD,name:{kind:Le.NAME,value:"__typename"}};function Pl(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Le.FRAGMENT_SPREAD&&Pl(e[t.name.value],e)})}function Om(r){return Pl(Wt(r)||pc(r),rn(an(r)))?null:r}function Dm(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 Cl(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 dc(r,e){for(var t=Cl(""),n=Cl(""),i=function(y){for(var b=0,g=void 0;b<y.length&&(g=y[b]);++b)if(!me(g)){if(g.kind===Le.OPERATION_DEFINITION)return t(g.name&&g.name.value);if(g.kind===Le.FRAGMENT_DEFINITION)return n(g.name.value)}return __DEV__&&L.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Le.OPERATION_DEFINITION&&++a;var s=Dm(r),c=r.some(function(y){return y.remove}),u=function(y){return c&&y&&y.some(s)},l=new Map,p=!1,d={enter:function(y){if(u(y.directives))return p=!0,null}},f=Ye(e,{Field:d,InlineFragment:d,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(y,b,g,A,N){var I=i(N);I&&I.variables.add(y.name.value)}},FragmentSpread:{enter:function(y,b,g,A,N){if(u(y.directives))return p=!0,null;var I=i(N);I&&I.fragmentSpreads.add(y.name.value)}},FragmentDefinition:{enter:function(y,b,g,A){l.set(JSON.stringify(A),y)},leave:function(y,b,g,A){var N=l.get(JSON.stringify(A));if(y===N)return y;if(a>0&&y.selectionSet.selections.every(function(I){return I.kind===Le.FIELD&&I.name.value==="__typename"}))return n(y.name.value).removed=!0,p=!0,null}},Directive:{leave:function(y){if(s(y))return p=!0,null}}});if(!p)return e;var h=function(y){return y.transitiveVars||(y.transitiveVars=new Set(y.variables),y.removed||y.fragmentSpreads.forEach(function(b){h(n(b)).transitiveVars.forEach(function(g){y.transitiveVars.add(g)})})),y},m=new Set;f.definitions.forEach(function(y){y.kind===Le.OPERATION_DEFINITION?h(t(y.name&&y.name.value)).fragmentSpreads.forEach(function(b){m.add(b)}):y.kind===Le.FRAGMENT_DEFINITION&&a===0&&!n(y.name.value).removed&&m.add(y.name.value)}),m.forEach(function(y){h(n(y)).fragmentSpreads.forEach(function(b){m.add(b)})});var v=function(y){return!!(!m.has(y)||n(y).removed)},_={enter:function(y){if(v(y.name.value))return null}};return Om(Ye(f,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(y){if(y.variableDefinitions){var b=h(t(y.name&&y.name.value)).transitiveVars;if(b.size<y.variableDefinitions.length)return x(x({},y),{variableDefinitions:y.variableDefinitions.filter(function(g){return b.has(g.variable.name.value)})})}}}}))}var cn=Object.assign(function(r){return Ye(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Le.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return vt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(vt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return x(x({},e),{selections:Er(Er([],i,!0),[Rl],!1)})}}}}}})},{added:function(r){return r===Rl}}),Nm={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&L.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function hc(r){return dc([Nm],Zn(r))}function mc(r){var e=on(r),t=e.operation;if(t==="query")return r;var n=Ye(r,{OperationDefinition:{enter:function(i){return x(x({},i),{operation:"query"})}}});return n}function gc(r){Zn(r);var e=dc([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Rm=Object.prototype.hasOwnProperty;function yc(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Gi(r)}function Gi(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 Cm=function(r,e,t){return this.merge(r[t],e[t])},ut=function(){function r(e){e===void 0&&(e=Cm),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(Rm.call(e,o)){var s=e[o];if(t[o]!==s){var c=n.reconciler.apply(n,Er([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 Pm(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=Lm(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 Lm(r,e){if(!!r){if(typeof r=="string")return Ll(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 Ll(r,e)}}function Ll(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 $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 wc(r,e,t){return e&&$l(r.prototype,e),t&&$l(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var _c=function(){return typeof Symbol=="function"},Ec=function(r){return _c()&&Boolean(Symbol[r])},xc=function(r){return Ec(r)?Symbol[r]:"@@"+r};_c()&&!Ec("observable")&&(Symbol.observable=Symbol("observable"));var $m=xc("iterator"),bc=xc("observable"),Fl=xc("species");function po(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Hi(r){var e=r.constructor;return e!==void 0&&(e=e[Fl],e===null&&(e=void 0)),e!==void 0?e:ee}function Fm(r){return r instanceof ee}function Xn(r){Xn.log?Xn.log(r):setTimeout(function(){throw r})}function fo(r){Promise.resolve().then(function(){try{r()}catch(e){Xn(e)}})}function Ml(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=po(e,"unsubscribe");t&&t.call(e)}}catch(n){Xn(n)}}function Sc(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function Mm(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(jl(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function jl(r,e,t){r._state="running";var n=r._observer;try{var i=po(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(Sc(r),i)i.call(n,t);else throw t;break;case"complete":Sc(r),i&&i.call(n);break}}catch(a){Xn(a)}r._state==="closed"?Ml(r):r._state==="running"&&(r._state="ready")}function vc(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}],fo(function(){return Mm(r)});return}jl(r,e,t)}}var jm=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new Um(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"&&(Sc(this),Ml(this))},wc(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),Um=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){vc(this._subscription,"next",n)},e.error=function(n){vc(this._subscription,"error",n)},e.complete=function(){vc(this._subscription,"complete")},wc(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ee=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 jm(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=Hi(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=Hi(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=Hi(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(p){var d=!s;if(s=!0,!d||o)try{u=n(u,p)}catch(f){return l.error(f)}else u=p},error:function(p){l.error(p)},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=Hi(this);return new s(function(c){var u,l=0;function p(d){u=d.subscribe({next:function(f){c.next(f)},error:function(f){c.error(f)},complete:function(){l===a.length?(u=void 0,c.complete()):p(s.from(a[l++]))}})}return p(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=Hi(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(d){return o.error(d)}var p=a.from(l).subscribe({next:function(d){o.next(d)},error:function(d){o.error(d)},complete:function(){var d=s.indexOf(p);d>=0&&s.splice(d,1),u()}});s.push(p)},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[bc]=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=po(n,bc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Fm(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(Ec("iterator")&&(a=po(n,$m),a))return new i(function(s){fo(function(){if(!s.closed){for(var c=Pm(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){fo(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){fo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},wc(r,null,[{key:Fl,get:function(){return this}}]),r}();_c()&&Object.defineProperty(ee,Symbol("extensions"),{value:{symbol:bc,hostReportError:Xn},configurable:!0});function kc(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 ei;typeof self<"u"?ei=self:typeof window<"u"?ei=window:typeof global<"u"?ei=global:typeof module<"u"?ei=module:ei=Function("return this")();var o0=kc(ei);var Ul=ee.prototype,ql="@@observable";Ul[ql]||(Ul[ql]=function(){return this});var qm=Object.prototype.toString;function ho(r){return Ic(r)}function Ic(r,e){switch(qm.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]=Ic(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]=Ic(r[i],e)}),n}default:return r}}function Bm(r){var e=new Set([r]);return e.forEach(function(t){se(t)&&Vm(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){se(t[n])&&e.add(t[n])})}),r}function Vm(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Ki(r){return __DEV__&&Bm(r),r}function un(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function mo(r,e,t){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 v=function(){return f(m)};u=u.then(v,v).then(function(_){--s,i&&i.call(n,_),c&&p.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(n,_)})}:function(m){return h&&h.call(n,m)}}var p={next:l(e,i),error:l(t,a),complete:function(){c=!0,s||o&&o.call(n)}},d=r.subscribe(p);return function(){return d.unsubscribe()}})}var Tt=typeof WeakMap=="function"&&Be(function(){return navigator.product})!=="ReactNative",Bl=typeof WeakSet=="function",Tc=typeof Symbol=="function"&&typeof Symbol.for=="function",Ir=Tc&&Symbol.asyncIterator,b0=typeof Be(function(){return window.document.createElement})=="function",S0=Be(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function go(r){function e(t){Object.defineProperty(r,t,{value:ee})}return Tc&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Vl(r){return r&&typeof r.then=="function"}var ti=function(r){Oe(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),un(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),un(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?Vl(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"),un(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 ee(t)]),Vl(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}(ee);go(ti);function Tr(r){return"incremental"in r}function Qm(r){return"hasNext"in r&&"data"in r}function Ql(r){return Tr(r)||Qm(r)}function yo(r,e){var t=r,n=new ut;return Tr(e)&&Fe(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 ri(r){var e=vo(r);return Fe(e)}function vo(r){var e=Fe(r.errors)?r.errors.slice(0):[];return Tr(r)&&Fe(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Ar(){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 zl=new Map;function Ji(r){var e=zl.get(r)||1;return zl.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Wl(r){var e=Ji("stringifyForDisplay");return JSON.stringify(r,function(t,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Zi(r,e){return Ar(r,e,e.variables&&{variables:x(x({},r&&r.variables),e.variables)})}function bo(r){return new ee(function(e){e.error(r)})}var Yi=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 Ac(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 K("illegal argument: ".concat(i)):new K(27)}return r}function Oc(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 Dc(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Yn(e.query)||void 0:""),e}function Gl(r,e){return e?e(r):ee.of()}function Xi(r){return typeof r=="function"?new At(r):r}function So(r){return r.request.length<=1}var zm=function(r){Oe(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 ee.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Xi).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=Xi(t),a=Xi(n||new r(Gl));return So(i)&&So(a)?new r(function(o){return e(o)?i.request(o)||ee.of():a.request(o)||ee.of()}):new r(function(o,s){return e(o)?i.request(o,s)||ee.of():a.request(o,s)||ee.of()})},r.execute=function(e,t){return e.request(Oc(t.context,Dc(Ac(t))))||ee.of()},r.concat=function(e,t){var n=Xi(e);if(So(n))return __DEV__&&L.warn(new zm("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Xi(t);return So(i)?new r(function(a){return n.request(a,function(o){return i.request(o)||ee.of()})||ee.of()}):new r(function(a,o){return n.request(a,function(s){return i.request(s,o)||ee.of()})||ee.of()})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(Gl)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new K("request is not implemented"):new K(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 ni=At.execute;var Hl="3.7.10";function Kl(r){return!!r.body}function Jl(r){return!!r.getReader}function Zl(r){return!!(Ir&&r[Symbol.asyncIterator])}function Yl(r){return!!r.stream}function Xl(r){return!!r.arrayBuffer}function ef(r){return!!r.pipe}function Nc(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Rc(r){var e=null,t=null,n=!1,i=[],a=[];function o(p){if(!t){if(a.length){var d=a.shift();if(Array.isArray(d)&&d[0])return d[0]({value:p,done:!1})}i.push(p)}}function s(p){t=p;var d=a.slice();d.forEach(function(f){f[1](p)}),!e||e()}function c(){n=!0;var p=a.slice();p.forEach(function(d){d[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(p,d){if(t)return d(t);if(i.length)return p({value:i.shift(),done:!1});if(n)return p({value:void 0,done:!0});a.push([p,d])})}var l={next:function(){return u()}};return Ir&&(l[Symbol.asyncIterator]=function(){return this}),l}function Cc(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 Ir&&(t[Symbol.asyncIterator]=function(){return this}),t}function wo(r){var e={next:function(){return r.read()}};return Ir&&(e[Symbol.asyncIterator]=function(){return this}),e}function tf(r){var e=r;if(Kl(r)&&(e=r.body),Zl(e))return Nc(e);if(Jl(e))return wo(e.getReader());if(Yl(e))return wo(e.stream().getReader());if(Xl(e))return Cc(e.arrayBuffer());if(ef(e))return Rc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var rf=Object.prototype.hasOwnProperty;function nf(r,e){var t,n,i;return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l,p,d,f,h,m,v,_,y,b,g,A,N,I,C;return $t(this,function($){switch($.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="",p=tf(r),d=!0,$.label=1;case 1:return d?[4,p.next()]:[3,3];case 2:for(f=$.sent(),h=f.value,m=f.done,v=typeof h=="string"?h:a.decode(h),d=!m,l+=v,_=l.indexOf(u);_>-1;){if(y=void 0,C=[l.slice(0,_),l.slice(_+u.length)],y=C[0],l=C[1],y.trim()){if(b=y.indexOf(`\r
21
+ }`)}function Ae(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function fo(r){return Ae(" ",r.replace(/\n/g,`
22
+ `))}function cm(r){return r.indexOf(`
23
+ `)!==-1}function Ol(r){return r!=null&&r.some(cm)}function Vi(r){return r.kind===Le.FIELD||r.kind===Le.FRAGMENT_SPREAD||r.kind===Le.INLINE_FRAGMENT}function Dl(){return typeof lo=="function"?nc():nc()}function vm(){__DEV__?L(typeof nn=="boolean",nn):L(typeof nn=="boolean",39)}Dl();vm();function fr(r,e){var t=r.directives;return!t||!t.length?!0:Nl(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__?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 Yn(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 an}}),t?!n.size:n.size<i}function sc(r){return r&&Yn(["client","export"],r,!0)}function bm(r){var e=r.name.value;return e==="skip"||e==="include"}function Nl(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!bm(t)){var n=t.arguments,i=t.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:t,ifArgument:a})}}),e}function cc(r,e){var t=e,n=[];r.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 t>"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),t=n[0].name.value);var i=x(x({},r),{definitions:Ir([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function on(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function sn(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__?L(n,"No fragment named ".concat(t)):L(n,46),n||null}default:return null}}function ce(r){return r!==null&&typeof r=="object"}function zt(r){return{__ref:String(r)}}function re(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function uc(r){return ce(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Sm(r){return r.kind==="StringValue"}function wm(r){return r.kind==="BooleanValue"}function _m(r){return r.kind==="IntValue"}function Em(r){return r.kind==="FloatValue"}function xm(r){return r.kind==="Variable"}function Im(r){return r.kind==="ObjectValue"}function km(r){return r.kind==="ListValue"}function Tm(r){return r.kind==="EnumValue"}function Am(r){return r.kind==="NullValue"}function Tr(r,e,t,n){if(_m(t)||Em(t))r[e.value]=Number(t.value);else if(wm(t)||Sm(t))r[e.value]=t.value;else if(Im(t)){var i={};t.fields.map(function(o){return Tr(i,o.name,o.value,n)}),r[e.value]=i}else if(xm(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(km(t))r[e.value]=t.values.map(function(o){var s={};return Tr(s,e,o,n),s[e.value]});else if(Tm(t))r[e.value]=t.value;else if(Am(t))r[e.value]=null;else throw __DEV__?new K('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 K(55)}function lc(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 Tr(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 Tr(n,a,o,e)})),Wi(r.name.value,n,t)}var Om=["connection","include","skip","client","rest","export"],Wi=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(Qi(i),")")}else return t.connection.key;var a=r;if(e){var o=Qi(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){Om.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(Qi(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=Qi;return Qi=r,e}}),Qi=function(e){return JSON.stringify(e,Dm)};function Dm(r,e){return ce(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})),e}function pr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return Tr(t,i,a,e)}),t}return null}function kt(r){return r.alias?r.alias.value:r.name.value}function zi(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(vt(a)){if(a.name.value==="__typename")return r[kt(a)]}else{var o=zi(r,sn(a,t).selectionSet,t);if(typeof o=="string")return o}}}function vt(r){return r.kind==="Field"}function fc(r){return r.kind==="InlineFragment"}function Xn(r){__DEV__?L(r&&r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r&&r.kind==="Document",47);var e=r.definitions.filter(function(t){return t.kind!=="FragmentDefinition"}).map(function(t){if(t.kind!=="OperationDefinition")throw __DEV__?new K('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new K(48);return t});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),r}function Ht(r){return Xn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function ei(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function cn(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Hi(r){var e=Ht(r);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function pc(r){__DEV__?L(r.kind==="Document",'Expecting a parsed GraphQL document. Perhaps you need to wrap the query string in a "gql" tag? http://docs.apollostack.com/apollo-client/core.html#gql'):L(r.kind==="Document",51),__DEV__?L(r.definitions.length<=1,"Fragment must have exactly one definition."):L(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?L(e.kind==="FragmentDefinition","Must be a fragment definition."):L(e.kind==="FragmentDefinition",53),e}function un(r){Xn(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 K("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new K(54)}function ln(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&Tr(e,n.variable.name,n.defaultValue)}),e}var ge=Array.isArray;function Fe(r){return Array.isArray(r)&&r.length>0}var Rl={kind:Le.FIELD,name:{kind:Le.NAME,value:"__typename"}};function Pl(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Le.FRAGMENT_SPREAD&&Pl(e[t.name.value],e)})}function Nm(r){return Pl(Ht(r)||pc(r),on(cn(r)))?null:r}function Rm(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 Cl(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 dc(r,e){for(var t=Cl(""),n=Cl(""),i=function(v){for(var S=0,y=void 0;S<v.length&&(y=v[S]);++S)if(!ge(y)){if(y.kind===Le.OPERATION_DEFINITION)return t(y.name&&y.name.value);if(y.kind===Le.FRAGMENT_DEFINITION)return n(y.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===Le.OPERATION_DEFINITION&&++a;var s=Rm(r),c=r.some(function(v){return v.remove}),u=function(v){return c&&v&&v.some(s)},l=new Map,p=!1,d={enter:function(v){if(u(v.directives))return p=!0,null}},f=Xe(e,{Field:d,InlineFragment:d,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(v,S,y,O,N){var T=i(N);T&&T.variables.add(v.name.value)}},FragmentSpread:{enter:function(v,S,y,O,N){if(u(v.directives))return p=!0,null;var T=i(N);T&&T.fragmentSpreads.add(v.name.value)}},FragmentDefinition:{enter:function(v,S,y,O){l.set(JSON.stringify(O),v)},leave:function(v,S,y,O){var N=l.get(JSON.stringify(O));if(v===N)return v;if(a>0&&v.selectionSet.selections.every(function(T){return T.kind===Le.FIELD&&T.name.value==="__typename"}))return n(v.name.value).removed=!0,p=!0,null}},Directive:{leave:function(v){if(s(v))return p=!0,null}}});if(!p)return e;var h=function(v){return v.transitiveVars||(v.transitiveVars=new Set(v.variables),v.removed||v.fragmentSpreads.forEach(function(S){h(n(S)).transitiveVars.forEach(function(y){v.transitiveVars.add(y)})})),v},m=new Set;f.definitions.forEach(function(v){v.kind===Le.OPERATION_DEFINITION?h(t(v.name&&v.name.value)).fragmentSpreads.forEach(function(S){m.add(S)}):v.kind===Le.FRAGMENT_DEFINITION&&a===0&&!n(v.name.value).removed&&m.add(v.name.value)}),m.forEach(function(v){h(n(v)).fragmentSpreads.forEach(function(S){m.add(S)})});var b=function(v){return!!(!m.has(v)||n(v).removed)},_={enter:function(v){if(b(v.name.value))return null}};return Nm(Xe(f,{FragmentSpread:_,FragmentDefinition:_,OperationDefinition:{leave:function(v){if(v.variableDefinitions){var S=h(t(v.name&&v.name.value)).transitiveVars;if(S.size<v.variableDefinitions.length)return x(x({},v),{variableDefinitions:v.variableDefinitions.filter(function(y){return S.has(y.variable.name.value)})})}}}}))}var fn=Object.assign(function(r){return Xe(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Le.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return vt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(vt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return x(x({},e),{selections:Ir(Ir([],i,!0),[Rl],!1)})}}}}}})},{added:function(r){return r===Rl}}),Cm={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&L.warn("Removing an @connection directive even though it does not have a key. You may want to use the key parameter to specify a store key."),e}};function hc(r){return dc([Cm],Xn(r))}function mc(r){var e=un(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 gc(r){Xn(r);var e=dc([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Pm=Object.prototype.hasOwnProperty;function yc(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Gi(r)}function Gi(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new lt,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var Lm=function(r,e,t){return this.merge(r[t],e[t])},lt=function(){function r(e){e===void 0&&(e=Lm),this.reconciler=e,this.isObject=ce,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 ce(t)&&ce(e)?(Object.keys(t).forEach(function(o){if(Pm.call(e,o)){var s=e[o];if(t[o]!==s){var c=n.reconciler.apply(n,Ir([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 ce(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=Fm(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 Fm(r,e){if(!!r){if(typeof r=="string")return Ll(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 Ll(r,e)}}function Ll(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 $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 wc(r,e,t){return e&&$l(r.prototype,e),t&&$l(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var _c=function(){return typeof Symbol=="function"},Ec=function(r){return _c()&&Boolean(Symbol[r])},xc=function(r){return Ec(r)?Symbol[r]:"@@"+r};_c()&&!Ec("observable")&&(Symbol.observable=Symbol("observable"));var Mm=xc("iterator"),bc=xc("observable"),Fl=xc("species");function ho(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Ki(r){var e=r.constructor;return e!==void 0&&(e=e[Fl],e===null&&(e=void 0)),e!==void 0?e:te}function Um(r){return r instanceof te}function ti(r){ti.log?ti.log(r):setTimeout(function(){throw r})}function po(r){Promise.resolve().then(function(){try{r()}catch(e){ti(e)}})}function Ml(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=ho(e,"unsubscribe");t&&t.call(e)}}catch(n){ti(n)}}function Sc(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function jm(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Ul(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Ul(r,e,t){r._state="running";var n=r._observer;try{var i=ho(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(Sc(r),i)i.call(n,t);else throw t;break;case"complete":Sc(r),i&&i.call(n);break}}catch(a){ti(a)}r._state==="closed"?Ml(r):r._state==="running"&&(r._state="ready")}function vc(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}],po(function(){return jm(r)});return}Ul(r,e,t)}}var qm=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new Bm(this);try{this._cleanup=n.call(void 0,i)}catch(a){i.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(Sc(this),Ml(this))},wc(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),Bm=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){vc(this._subscription,"next",n)},e.error=function(n){vc(this._subscription,"error",n)},e.complete=function(){vc(this._subscription,"complete")},wc(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),te=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 qm(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=Ki(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=Ki(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=Ki(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(p){var d=!s;if(s=!0,!d||o)try{u=n(u,p)}catch(f){return l.error(f)}else u=p},error:function(p){l.error(p)},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=Ki(this);return new s(function(c){var u,l=0;function p(d){u=d.subscribe({next:function(f){c.next(f)},error:function(f){c.error(f)},complete:function(){l===a.length?(u=void 0,c.complete()):p(s.from(a[l++]))}})}return p(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=Ki(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(d){return o.error(d)}var p=a.from(l).subscribe({next:function(d){o.next(d)},error:function(d){o.error(d)},complete:function(){var d=s.indexOf(p);d>=0&&s.splice(d,1),u()}});s.push(p)},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[bc]=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=ho(n,bc);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return Um(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(Ec("iterator")&&(a=ho(n,Mm),a))return new i(function(s){po(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){po(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){po(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},wc(r,null,[{key:Fl,get:function(){return this}}]),r}();_c()&&Object.defineProperty(te,Symbol("extensions"),{value:{symbol:bc,hostReportError:ti},configurable:!0});function Ic(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 ri;typeof self<"u"?ri=self:typeof window<"u"?ri=window:typeof global<"u"?ri=global:typeof module<"u"?ri=module:ri=Function("return this")();var l0=Ic(ri);var jl=te.prototype,ql="@@observable";jl[ql]||(jl[ql]=function(){return this});var Vm=Object.prototype.toString;function mo(r){return kc(r)}function kc(r,e){switch(Vm.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]=kc(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]=kc(r[i],e)}),n}default:return r}}function Qm(r){var e=new Set([r]);return e.forEach(function(t){ce(t)&&Wm(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){ce(t[n])&&e.add(t[n])})}),r}function Wm(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Ji(r){return __DEV__&&Qm(r),r}function pn(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function go(r,e,t){return new te(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 b=function(){return f(m)};u=u.then(b,b).then(function(_){--s,i&&i.call(n,_),c&&p.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(n,_)})}:function(m){return h&&h.call(n,m)}}var p={next:l(e,i),error:l(t,a),complete:function(){c=!0,s||o&&o.call(n)}},d=r.subscribe(p);return function(){return d.unsubscribe()}})}var Tt=typeof WeakMap=="function"&&Be(function(){return navigator.product})!=="ReactNative",Bl=typeof WeakSet=="function",Tc=typeof Symbol=="function"&&typeof Symbol.for=="function",Ar=Tc&&Symbol.asyncIterator,E0=typeof Be(function(){return window.document.createElement})=="function",x0=Be(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function yo(r){function e(t){Object.defineProperty(r,t,{value:te})}return Tc&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Vl(r){return r&&typeof r.then=="function"}var ni=function(r){Oe(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),pn(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),pn(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?Vl(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"),pn(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 te(t)]),Vl(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}(te);yo(ni);function Or(r){return"incremental"in r}function zm(r){return"hasNext"in r&&"data"in r}function Ql(r){return Or(r)||zm(r)}function vo(r,e){var t=r,n=new lt;return Or(e)&&Fe(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 ii(r){var e=bo(r);return Fe(e)}function bo(r){var e=Fe(r.errors)?r.errors.slice(0):[];return Or(r)&&Fe(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Dr(){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 Wl=new Map;function Zi(r){var e=Wl.get(r)||1;return Wl.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function zl(r){var e=Zi("stringifyForDisplay");return JSON.stringify(r,function(t,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Yi(r,e){return Dr(r,e,e.variables&&{variables:x(x({},r&&r.variables),e.variables)})}function So(r){return new te(function(e){e.error(r)})}var Xi=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 Ac(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 K("illegal argument: ".concat(i)):new K(27)}return r}function Oc(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 Dc(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?ei(e.query)||void 0:""),e}function Hl(r,e){return e?e(r):te.of()}function ea(r){return typeof r=="function"?new At(r):r}function wo(r){return r.request.length<=1}var Hm=function(r){Oe(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 te.of()})},r.from=function(e){return e.length===0?r.empty():e.map(ea).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=ea(t),a=ea(n||new r(Hl));return wo(i)&&wo(a)?new r(function(o){return e(o)?i.request(o)||te.of():a.request(o)||te.of()}):new r(function(o,s){return e(o)?i.request(o,s)||te.of():a.request(o,s)||te.of()})},r.execute=function(e,t){return e.request(Oc(t.context,Dc(Ac(t))))||te.of()},r.concat=function(e,t){var n=ea(e);if(wo(n))return __DEV__&&L.warn(new Hm("You are calling concat on a terminating link, which will have no effect",n)),n;var i=ea(t);return wo(i)?new r(function(a){return n.request(a,function(o){return i.request(o)||te.of()})||te.of()}):new r(function(a,o){return n.request(a,function(s){return i.request(s,o)||te.of()})||te.of()})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(Hl)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new K("request is not implemented"):new K(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 ai=At.execute;var Gl="3.7.10";function Kl(r){return!!r.body}function Jl(r){return!!r.getReader}function Zl(r){return!!(Ar&&r[Symbol.asyncIterator])}function Yl(r){return!!r.stream}function Xl(r){return!!r.arrayBuffer}function ef(r){return!!r.pipe}function Nc(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Rc(r){var e=null,t=null,n=!1,i=[],a=[];function o(p){if(!t){if(a.length){var d=a.shift();if(Array.isArray(d)&&d[0])return d[0]({value:p,done:!1})}i.push(p)}}function s(p){t=p;var d=a.slice();d.forEach(function(f){f[1](p)}),!e||e()}function c(){n=!0;var p=a.slice();p.forEach(function(d){d[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(p,d){if(t)return d(t);if(i.length)return p({value:i.shift(),done:!1});if(n)return p({value:void 0,done:!0});a.push([p,d])})}var l={next:function(){return u()}};return Ar&&(l[Symbol.asyncIterator]=function(){return this}),l}function Cc(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 Ar&&(t[Symbol.asyncIterator]=function(){return this}),t}function _o(r){var e={next:function(){return r.read()}};return Ar&&(e[Symbol.asyncIterator]=function(){return this}),e}function tf(r){var e=r;if(Kl(r)&&(e=r.body),Zl(e))return Nc(e);if(Jl(e))return _o(e.getReader());if(Yl(e))return _o(e.stream().getReader());if(Xl(e))return Cc(e.arrayBuffer());if(ef(e))return Rc(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var rf=Object.prototype.hasOwnProperty;function nf(r,e){var t,n,i;return $t(this,void 0,void 0,function(){var a,o,s,c,u,l,p,d,f,h,m,b,_,v,S,y,O,N,T,C;return Ft(this,function($){switch($.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="",p=tf(r),d=!0,$.label=1;case 1:return d?[4,p.next()]:[3,3];case 2:for(f=$.sent(),h=f.value,m=f.done,b=typeof h=="string"?h:a.decode(h),d=!m,l+=b,_=l.indexOf(u);_>-1;){if(v=void 0,C=[l.slice(0,_),l.slice(_+u.length)],v=C[0],l=C[1],v.trim()){if(S=v.indexOf(`\r
25
25
  \r
26
- `),g=Wm(y.slice(0,b)),A=g["content-type"],A&&A.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");N=y.slice(b);try{I=af(r,N.replace(`\r
27
- `,"")),(Object.keys(I).length>1||"data"in I||"incremental"in I||"errors"in I)&&((n=e.next)===null||n===void 0||n.call(e,I))}catch(P){_o(P,e)}}_=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function Wm(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 af(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Yi(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 _o(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 of(r,e,t){Gm(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 _o(n,t)})}function Gm(r){return function(e){return e.text().then(function(t){return af(e,t)}).then(function(t){return e.status>=300&&Yi(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!rf.call(t,"data")&&!rf.call(t,"errors")&&Yi(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var ea=function(r,e){var t;try{t=JSON.stringify(r)}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 t};var Hm={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Km={accept:"*/*","content-type":"application/json"},Jm={method:"POST"},sf={http:Hm,headers:Km,options:Jm},cf=function(r,e){return e(r)};function uf(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(p){i=x(x(x({},i),p.options),{headers:x(x({},i.headers),p.headers)}),p.credentials&&(i.credentials=p.credentials),a=x(x({},a),p.http)}),i.headers&&(i.headers=Zm(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,Kn)),{options:i,body:l}}function Zm(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 lf=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new K(`
26
+ `),y=Gm(v.slice(0,S)),O=y["content-type"],O&&O.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");N=v.slice(S);try{T=af(r,N.replace(`\r
27
+ `,"")),(Object.keys(T).length>1||"data"in T||"incremental"in T||"errors"in T)&&((n=e.next)===null||n===void 0||n.call(e,T))}catch(P){Eo(P,e)}}_=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function Gm(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 af(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Xi(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 Eo(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 of(r,e,t){Km(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 Eo(n,t)})}function Km(r){return function(e){return e.text().then(function(t){return af(e,t)}).then(function(t){return e.status>=300&&Xi(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!rf.call(t,"data")&&!rf.call(t,"errors")&&Xi(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var ta=function(r,e){var t;try{t=JSON.stringify(r)}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 t};var Jm={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Zm={accept:"*/*","content-type":"application/json"},Ym={method:"POST"},sf={http:Jm,headers:Zm,options:Ym},cf=function(r,e){return e(r)};function uf(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(p){i=x(x(x({},i),p.options),{headers:x(x({},i.headers),p.headers)}),p.credentials&&(i.credentials=p.credentials),a=x(x({},a),p.http)}),i.headers&&(i.headers=Xm(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,Zn)),{options:i,body:l}}function Xm(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 lf=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new K(`
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 ff=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var pf=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function df(r,e){var t=[],n=function(p,d){t.push("".concat(p,"=").concat(encodeURIComponent(d)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=ea(e.variables,"Variables map")}catch(p){return{parseError:p}}n("variables",i)}if(e.extensions){var a=void 0;try{a=ea(e.extensions,"Extensions map")}catch(p){return{parseError:p}}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 hf=Be(function(){return fetch}),mf=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?cf:i,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,p=Qt(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&lf(n||hf);var d={http:{includeExtensions:o,preserveHeaderCase:s},options:p.fetchOptions,credentials:p.credentials,headers:p.headers};return new At(function(f){var h=pf(f,t),m=f.getContext(),v={};if(m.clientAwareness){var _=m.clientAwareness,y=_.name,b=_.version;y&&(v["apollographql-client-name"]=y),b&&(v["apollographql-client-version"]=b)}var g=x(x({},v),m.headers),A={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:g},N=uf(f,a,sf,d,A),I=N.options,C=N.body;if(C.variables&&!l){var $=new Set(Object.keys(C.variables));Ye(f.query,{Variable:function(oe,Bt,X){X&&X.kind!=="VariableDefinition"&&$.delete(oe.name.value)}}),$.size&&(C.variables=x({},C.variables),$.forEach(function(oe){delete C.variables[oe]}))}var P;if(!I.signal){var j=ff(),xe=j.controller,Te=j.signal;P=xe,P&&(I.signal=Te)}var k=function(oe){return oe.kind==="OperationDefinition"&&oe.operation==="mutation"};if(c&&!f.query.definitions.some(k)&&(I.method="GET"),Jn(["defer"],f.query)&&(I.headers=I.headers||{},I.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),I.method==="GET"){var ye=df(h,C),ve=ye.newURI,ae=ye.parseError;if(ae)return bo(ae);h=ve}else try{I.body=ea(C,"Payload")}catch(oe){return bo(oe)}return new ee(function(oe){var Bt=n||Be(function(){return fetch})||hf;return Bt(h,I).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)?nf(X,oe):of(X,f,oe)}).catch(function(X){return _o(X,oe)}),function(){P&&P.abort()}})})};var Pc=function(r){Oe(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,mf(t).request)||this;return n.options=t,n}return e}(At);var{toString:gf,hasOwnProperty:Ym}=Object.prototype,yf=Function.prototype.toString,Lc=new Map;function Ee(r,e){try{return $c(r,e)}finally{Lc.clear()}}function $c(r,e){if(r===e)return!0;let t=gf.call(r),n=gf.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(bf(r,e))return!0;let i=vf(r),a=vf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Ym.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!$c(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(bf(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&&!$c(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=yf.call(r);return i!==yf.call(e)?!1:!tg(i,eg)}}return!1}function vf(r){return Object.keys(r).filter(Xm,r)}function Xm(r){return this[r]!==void 0}var eg="{ [native code] }";function tg(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function bf(r,e){let t=Lc.get(r);if(t){if(t.has(e))return!0}else Lc.set(r,t=new Set);return t.add(e),!1}var rg=function(){return Object.create(null)},Sf=Array.prototype,ng=Sf.forEach,ig=Sf.slice,Gt=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=rg),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 ng.call(e,function(n){return t=t.getChildTrie(n)}),t.data||(t.data=this.makeData(ig.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&ag(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 ag(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var He=null,wf={},og=1,sg=()=>class{constructor(){this.id=["slot",og++,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===wf)break;return e!==He&&(He.slots[this.id]=t),!0}return He&&(He.slots[this.id]=wf),!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 _f(r){try{return r()}catch{}}var Fc="@wry/context:Slot",cg=_f(()=>globalThis)||_f(()=>global)||Object.create(null),Ef=cg,ii=Ef[Fc]||Array[Fc]||function(r){try{Object.defineProperty(Ef,Fc,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(sg());var{bind:ug,noContext:lg}=ii;function fg(){}var pg=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=fg),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}(),xo=new ii,Mc,dg=Object.prototype.hasOwnProperty,Uc=(Mc=Array.from,Mc===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Mc);function Eo(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var ta=[],hg=100;function ai(r,e){if(!r)throw new Error(e||"assertion failure")}function mg(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function kf(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function gg(r){return r.slice(0)}var yg=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Or(this))return xf(this),this.value[0]},r.prototype.recompute=function(e){return ai(!this.recomputing,"already recomputing"),xf(this),Or(this)?vg(this,e):kf(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,If(this),Eo(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Nf(this),qc(this,function(t,n){t.setDirty(),Rf(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=ta.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Uc(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),ta.push(this.deps),this.deps=null)},r.count=0,r}();function xf(r){var e=xo.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Or(r)?Af(e,r):Of(e,r),e}function vg(r,e){return Nf(r),xo.withValue(r,bg,[r,e]),wg(r,e)&&Sg(r),kf(r.value)}function bg(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 Or(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function Sg(r){r.dirty=!1,!Or(r)&&Tf(r)}function If(r){qc(r,Af)}function Tf(r){qc(r,Of)}function qc(r,e){var t=r.parents.size;if(t)for(var n=Uc(r.parents),i=0;i<t;++i)e(n[i],r)}function Af(r,e){ai(r.childValues.has(e)),ai(Or(e));var t=!Or(r);if(!r.dirtyChildren)r.dirtyChildren=ta.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&If(r)}function Of(r,e){ai(r.childValues.has(e)),ai(!Or(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,gg(e.value)):mg(t,e.value)||r.setDirty(),Df(r,e),!Or(r)&&Tf(r)}function Df(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(ta.length<hg&&ta.push(t),r.dirtyChildren=null))}function Nf(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Rf(r,t)}),r.forgetDeps(),ai(r.dirtyChildren===null)}function Rf(r,e){e.parents.delete(r),r.childValues.delete(e),Df(r,e)}function wg(r,e){if(typeof r.subscribe=="function")try{Eo(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var _g={setDirty:!0,dispose:!0,forget:!0};function ko(r){var e=new Map,t=r&&r.subscribe;function n(i){var a=xo.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof t=="function"&&(Eo(o),o.unsubscribe=t(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&dg.call(_g,o)?o:"setDirty";Uc(s).forEach(function(u){return u[c]()}),e.delete(a),Eo(s)}},n}function Cf(){var r=new Gt(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var tx=Cf(),jc=new Set;function ln(r,e){e===void 0&&(e=Object.create(null));var t=new pg(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||Cf(),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 yg(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var p=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),jc.add(t),xo.hasValue()||(jc.forEach(function(d){return d.clean()}),jc.clear()),p};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 Bc=function(){function r(){this.getFragmentDoc=ln(cc)}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 ra=function(r){Oe(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 na(r){return r==null}function To(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=na(n)?na(i)?void 0:{_id:i}:{id:n}),na(n)&&!na(i)&&(n=i),!na(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Pf={dataIdFromObject:To,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Lf(r){return Ar(Pf,r)}function Ao(r){var e=r.canonizeResults;return e===void 0?Pf.canonizeResults:e}function $f(r,e){return te(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Vc=/^[_a-z][_0-9a-z]*/i;function jt(r){var e=r.match(Vc);return e?e[0]:r}function Io(r,e,t){return se(e)?me(e)?e.every(function(n){return Io(r,n,t)}):r.selections.every(function(n){if(vt(n)&&ur(n,t)){var i=It(n);return De.call(e,i)&&(!n.selectionSet||Io(n.selectionSet,e[i],t))}return!0}):!1}function Dr(r){return se(r)&&!te(r)&&!me(r)}function Ff(){return new ut}function Oo(r,e){var t=rn(an(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var Do=Object.create(null),Qc=function(){return Do},Mf=Object.create(null),oi=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 Ki(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 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 Nr)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 Nr)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;te(e)&&(e=e.__ref),te(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__?L(typeof i=="string","store.merge expects a string ID"):L(typeof i=="string",1);var s=new ut(xg).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 Nr)&&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:Do,INVALIDATE:Mf,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),p=i[u];if(p!==void 0){var d=typeof t=="function"?t:t[u]||t[l];if(d){var f=d===Qc?Do:d(Ki(p),x(x({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));f===Mf?n.group.dirty(e,u):(f===Do&&(f=void 0),f!==p&&(a[u]=f,o=!0,p=f))}p!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Nr?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]=Qc,i):Qc)}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 Nr&&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 Nr?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 Nr;)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){te(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 jf=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?ko():null,this.keyMaker=new Gt(Tt)},r.prototype.depend=function(e,t){if(this.d){this.d(zc(e,t));var n=jt(t);n!==t&&this.d(zc(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(zc(e,t),t==="__exists"?"forget":"setDirty")},r}();function zc(r,e){return e+"#"+r}function Wc(r,e){fn(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Oe(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 jf(s))||this;return u.stump=new Eg(u),u.storageTrie=new Gt(Tt),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})(oi||(oi={}));var Nr=function(r){Oe(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){Ee(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}(oi),Eg=function(r){Oe(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new jf(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}(Nr);function xg(r,e,t){var n=r[t],i=e[t];return Ee(n,i)?n:i}function fn(r){return!!(r instanceof oi&&r.group.caching)}function kg(r){return se(r)?me(r)?r.slice(0):x({__proto__:Object.getPrototypeOf(r)},r):r}var No=function(){function r(){this.known=new(Bl?WeakSet:Set),this.pool=new Gt(Tt),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=kg(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(f){c.push(t.admit(e[f]))});var o=this.pool.lookupArray(c);if(!o.object){var p=o.object=Object.create(s);this.known.add(p),u.sorted.forEach(function(f,h){p[f]=c[l+h]}),__DEV__&&Object.freeze(p)}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 bt=Object.assign(function(r){if(se(r)){Gc===void 0&&Uf();var e=Gc.admit(r),t=Hc.get(e);return t===void 0&&Hc.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:Uf}),Gc,Hc;function Uf(){Gc=new No,Hc=new(Tt?WeakMap:Map)}function qf(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Bf=function(){function r(e){var t=this;this.knownResults=new(Tt?WeakMap:Map),this.config=Ar(e,{addTypename:e.addTypename!==!1,canonizeResults:Ao(e)}),this.canon=e.canon||new No,this.executeSelectionSet=ln(function(n){var i,a=n.context.canonizeResults,o=qf(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:(Wc(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:qf,makeCacheKey:function(n,i,a,o){if(fn(a.store))return a.store.makeCacheKey(n,te(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=ln(function(n){return Wc(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(fn(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new No},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,p=this.config.cache.policies;o=x(x({},sn(Wi(n))),o);var d=zt(a),f=this.executeSelectionSet({selectionSet:on(n).selectionSet,objectOrReference:d,enclosingRef:d,context:x({store:t,query:n,policies:p,variables:o,varString:bt(o),canonizeResults:l},Oo(n,this.config.fragments))}),h;if(f.missing&&(h=[new ra(Ig(f.missing),f.missing,n,o)],!c))throw h[0];return{result:f.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,n,i){if(fn(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(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"),p=[],d,f=new ut;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&p.push({__typename:l});function h(b,g){var A;return b.missing&&(d=f.merge(d,(A={},A[g]=b.missing,A))),b.result}var m=new Set(n.selections);m.forEach(function(b){var g,A;if(!!ur(b,s))if(vt(b)){var N=c.readField({fieldName:b.name.value,field:b,variables:o.variables,from:i},o),I=It(b);N===void 0?cn.added(b)||(d=f.merge(d,(g={},g[I]="Can't find field '".concat(b.name.value,"' on ").concat(te(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),g))):me(N)?N=h(t.executeSubSelectedArray({field:b,array:N,enclosingRef:a,context:o}),I):b.selectionSet?N!=null&&(N=h(t.executeSelectionSet({selectionSet:b.selectionSet,objectOrReference:N,enclosingRef:te(N)?N:a,context:o}),I)):o.canonizeResults&&(N=t.canon.pass(N)),N!==void 0&&p.push((A={},A[I]=N,A))}else{var C=nn(b,o.lookupFragment);if(!C&&b.kind===Le.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(b.name.value)):new K(5);C&&c.fragmentMatches(C,l)&&C.selectionSet.selections.forEach(m.add,m)}});var v=Gi(p),_={result:v,missing:d},y=o.canonizeResults?this.canon.admit(_):Ki(_);return y.result&&this.knownResults.set(y.result,n),y},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,p){var d;return l.missing&&(s=c.merge(s,(d={},d[p]=l.missing,d))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,p){return l===null?null:me(l)?u(t.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),p):n.selectionSet?u(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:te(l)?l:a,context:o}),p):(__DEV__&&Tg(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},r}();function Ig(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function Tg(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){se(i)&&(__DEV__?L(!te(i),"Missing selection set for object of type ".concat($f(r,i)," returned for query field ").concat(e.name.value)):L(!te(i),6),Object.values(i).forEach(n.add,n))})}}var si=new ii,Vf=new WeakMap;function ia(r){var e=Vf.get(r);return e||Vf.set(r,e={vars:new Set,dep:ko()}),e}function Kc(r){ia(r).vars.forEach(function(e){return e.forgetCache(r)})}function Qf(r){ia(r).vars.forEach(function(e){return e.attachCache(r)})}function Ro(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){ia(c).dep.dirty(n),Ag(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=si.getValue();s&&(i(s),ia(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),ia(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function Ag(r){r.broadcastWatches&&r.broadcastWatches()}var zf=Object.create(null);function Jc(r){var e=JSON.stringify(r);return zf[e]||(zf[e]=Object.create(null))}function Zc(r){var e=Jc(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Xc(r,function(o){var s=ci(n.storeObject,o,i);return s===void 0&&t!==n.storeObject&&De.call(t,o[0])&&(s=ci(t,o,Gf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):L(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Yc(r){var e=Jc(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,o=n.fieldName,s=Xc(r,function(u){var l=u[0],p=l.charAt(0);if(p==="@"){if(i&&Fe(i.directives)){var d=l.slice(1),f=i.directives.find(function(_){return _.name.value===d}),h=f&&lr(f,a);return h&&ci(h,u.slice(1))}return}if(p==="$"){var m=l.slice(1);if(a&&De.call(a,m)){var v=u.slice(0);return v[0]=m,ci(a,v)}return}if(t)return ci(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Xc(r,e){var t=new ut;return Wf(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 Wf(r){var e=Jc(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){me(i)?(Wf(i).forEach(function(o){return t.push(n.concat(o))}),n.length=0):(n.push(i),me(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function Gf(r,e){return r[e]}function ci(r,e,t){return t=t||Gf,Hf(e.reduce(function n(i,a){return me(i)?i.map(function(o){return n(o,a)}):i&&t(i,a)},r))}function Hf(r){return se(r)?me(r)?r.map(Hf):Xc(Object.keys(r).sort(),function(e){return ci(r,e)}):r}Qi.setStringify(bt);function eu(r){return r.args!==void 0?r.args:r.field?lr(r.field,r.variables):null}var Og=function(){},Kf=function(r,e){return e.fieldName},Jf=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Zf=function(r,e){return e},Xf=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:To},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 d=Co(arguments,o);return i.readField(d,{store:i.cache.data,variables:d.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var p=l(e,s);if(me(p))l=Zc(p);else{c=p;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?Jf:u===!1?Zf:c.merge}s(i,t.merge),i.keyFn=a===!1?Og:me(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 p=l.keyArgs,d=l.read,f=l.merge;u.keyFn=p===!1?Kf:me(p)?Yc(p):typeof p=="function"?p:u.keyFn,typeof d=="function"&&(u.read=d),s(u,f)}u.read&&u.merge&&(u.keyFn=u.keyFn||Kf)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==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[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(Vc);(!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),p=!1,d=0;d<c.length;++d){var f=c[d];if(f.has(o))return s.has(o)||(p&&__DEV__&&L.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;f.forEach(u),l&&d===c.length-1&&Io(e.selectionSet,n,i)&&(l=!1,p=!0,this.fuzzySubtypes.forEach(function(h,m){var v=t.match(h);v&&v[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=eu(e);o;){var u=o(c,s);if(me(u))o=Yc(u);else{a=u||n;break}}return a===void 0&&(a=e.field?lc(e.field,e.variables):Qi(n,eu(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 p=Yf(this,n,e,t,t.store.getStorage(te(n)?n.__ref:n,o));return si.withValue(this.cache,l,[c,p])}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===Jf?ep(i.store)(e,t):c===Zf?t:(i.overwrite&&(e=void 0),c(e,t,Yf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},r}();function Yf(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:eu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:te,toReference:u,storage:i,cache:r.cache,canRead:l,readField:function(){return r.readField(Co(arguments,e,s),n)},mergeObjects:ep(n.store)}}function Co(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__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Wl(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function ep(r){return function(t,n){if(me(t)||me(n))throw __DEV__?new K("Cannot automatically merge arrays"):new K(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(te(t)&&Dr(n))return r.merge(t.__ref,n),t;if(Dr(t)&&te(n))return r.merge(t,n.__ref),n;if(Dr(t)&&Dr(n))return x(x({},t),n)}return n}}function tu(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 ip=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=Ff();s=x(x({},sn(u)),s);var p=x(x({store:e,written:Object.create(null),merge:function(f,h){return l.merge(f,h)},variables:s,varString:bt(s)},Oo(i,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:p});if(!te(d))throw __DEV__?new K("Could not identify object ".concat(JSON.stringify(a))):new K(7);return p.incomingById.forEach(function(f,h){var m=f.storeObject,v=f.mergeTree,_=f.fieldNodeSet,y=zt(h);if(v&&v.map.size){var b=n.applyMerges(v,y,m,p);if(te(b))return;m=b}if(__DEV__&&!p.overwrite){var g=Object.create(null);_.forEach(function(I){I.selectionSet&&(g[I.name.value]=!0)});var A=function(I){return g[jt(I)]===!0},N=function(I){var C=v&&v.map.get(I);return Boolean(C&&C.info&&C.info.merge)};Object.keys(m).forEach(function(I){A(I)&&!N(I)&&Dg(y,m,I,p.store)})}e.merge(h,m)}),e.retain(d.__ref),d},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]||zi(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var p=function(){var b=Co(arguments,u,o.variables);if(te(b.from)){var g=o.incomingById.get(b.from.__ref);if(g){var A=c.readField(x(x({},b),{from:g.storeObject}),o);if(A!==void 0)return A}}return c.readField(b,o)},d=new Set;this.flattenFields(a,i,o,l).forEach(function(b,g){var A,N=It(g),I=i[N];if(d.add(g),I!==void 0){var C=c.getStoreFieldName({typename:l,fieldName:g.name.value,field:g,variables:b.variables}),$=tp(s,C),P=t.processFieldValue(I,g,g.selectionSet?tu(b,!1,!1):b,$),j=void 0;g.selectionSet&&(te(P)||Dr(P))&&(j=p("__typename",P));var xe=c.getMergeFunction(l,g.name.value,j);xe?$.info={field:g,typename:l,merge:xe}:rp(s,C),u=b.merge(u,(A={},A[C]=P,A))}else __DEV__&&!b.clientOnly&&!b.deferred&&!cn.added(g)&&!c.getReadFunction(l,g.name.value)&&__DEV__&&L.error("Missing field '".concat(It(g),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var f=c.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:p}),h=f[0],m=f[1];n=n||h,m&&(u=o.merge(u,m))}catch(b){if(!n)throw b}if(typeof n=="string"){var v=zt(n),_=o.written[n]||(o.written[n]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(i,v,a,o)))return v;var y=o.incomingById.get(n);return y?(y.storeObject=o.merge(y.storeObject,u),y.mergeTree=ru(y.mergeTree,s),d.forEach(function(b){return y.fieldNodeSet.add(b)})):o.incomingById.set(n,{storeObject:u,mergeTree:Po(s)?void 0:s,fieldNodeSet:d}),v}return u},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?__DEV__?ho(e):e:me(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,n,tp(i,s));return rp(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=zi(t,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Gt(!1);return function c(u,l){var p=s.lookup(u,l.clientOnly,l.deferred);p.visited||(p.visited=!0,u.selections.forEach(function(d){if(!!ur(d,n.variables)){var f=l.clientOnly,h=l.deferred;if(!(f&&h)&&Fe(d.directives)&&d.directives.forEach(function(_){var y=_.name.value;if(y==="client"&&(f=!0),y==="defer"){var b=lr(_,n.variables);(!b||b.if!==!1)&&(h=!0)}}),vt(d)){var m=a.get(d);m&&(f=f&&m.clientOnly,h=h&&m.deferred),a.set(d,tu(n,f,h))}else{var v=nn(d,n.lookupFragment);if(!v&&d.kind===Le.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(d.name.value)):new K(8);v&&o.fragmentMatches(v,i,t,n.variables)&&c(v.selectionSet,tu(n,f,h))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var o,s=this;if(e.map.size&&!te(n)){var c=!me(n)&&(te(t)||Dr(t))?t:void 0,u=n;c&&!a&&(a=[te(c)?c.__ref:c]);var l,p=function(d,f){return me(d)?typeof f=="number"?d[f]:void 0:i.store.getFieldValue(d,String(f))};e.map.forEach(function(d,f){var h=p(c,f),m=p(u,f);if(m!==void 0){a&&a.push(f);var v=s.applyMerges(d,h,m,i,a);v!==m&&(l=l||new Map,l.set(f,v)),a&&L(a.pop()===f)}}),l&&(n=me(u)?u.slice(0):x({},u),l.forEach(function(d,f){n[f]=d}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},r}();var ap=[];function tp(r,e){var t=r.map;return t.has(e)||t.set(e,ap.pop()||{map:new Map}),t.get(e)}function ru(r,e){if(r===e||!e||Po(e))return r;if(!r||Po(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,ru(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,ru(e.map.get(s),r.map.get(s)))})}return a}function Po(r){return!r||!(r.info||r.map.size)}function rp(r,e){var t=r.map,n=t.get(e);n&&Po(n)&&(ap.push(n),t.delete(e))}var np=new Set;function Dg(r,e,t,n){var i=function(p){var d=n.getFieldValue(p,t);return typeof d=="object"&&d},a=i(r);if(!!a){var o=i(e);if(!!o&&!te(a)&&!Ee(a,o)&&!Object.keys(a).every(function(p){return n.getFieldValue(o,p)!==void 0})){var s=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),c=jt(t),u="".concat(s,".").concat(c);if(!np.has(u)){np.add(u);var l=[];!me(a)&&!me(o)&&[a,o].forEach(function(p){var d=n.getFieldValue(p,"__typename");typeof d=="string"&&!l.includes(d)&&l.push(d)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
36
+ `):new K(23)};var ff=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var pf=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function df(r,e){var t=[],n=function(p,d){t.push("".concat(p,"=").concat(encodeURIComponent(d)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=ta(e.variables,"Variables map")}catch(p){return{parseError:p}}n("variables",i)}if(e.extensions){var a=void 0;try{a=ta(e.extensions,"Extensions map")}catch(p){return{parseError:p}}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 hf=Be(function(){return fetch}),mf=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?cf:i,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,p=Wt(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&lf(n||hf);var d={http:{includeExtensions:o,preserveHeaderCase:s},options:p.fetchOptions,credentials:p.credentials,headers:p.headers};return new At(function(f){var h=pf(f,t),m=f.getContext(),b={};if(m.clientAwareness){var _=m.clientAwareness,v=_.name,S=_.version;v&&(b["apollographql-client-name"]=v),S&&(b["apollographql-client-version"]=S)}var y=x(x({},b),m.headers),O={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:y},N=uf(f,a,sf,d,O),T=N.options,C=N.body;if(C.variables&&!l){var $=new Set(Object.keys(C.variables));Xe(f.query,{Variable:function(se,Vt,ee){ee&&ee.kind!=="VariableDefinition"&&$.delete(se.name.value)}}),$.size&&(C.variables=x({},C.variables),$.forEach(function(se){delete C.variables[se]}))}var P;if(!T.signal){var B=ff(),xe=B.controller,Te=B.signal;P=xe,P&&(T.signal=Te)}var k=function(se){return se.kind==="OperationDefinition"&&se.operation==="mutation"};if(c&&!f.query.definitions.some(k)&&(T.method="GET"),Yn(["defer"],f.query)&&(T.headers=T.headers||{},T.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),T.method==="GET"){var ve=df(h,C),be=ve.newURI,oe=ve.parseError;if(oe)return So(oe);h=be}else try{T.body=ta(C,"Payload")}catch(se){return So(se)}return new te(function(se){var Vt=n||Be(function(){return fetch})||hf;return Vt(h,T).then(function(ee){var Qt;f.setContext({response:ee});var xr=(Qt=ee.headers)===null||Qt===void 0?void 0:Qt.get("content-type");return xr!==null&&/^multipart\/mixed/i.test(xr)?nf(ee,se):of(ee,f,se)}).catch(function(ee){return Eo(ee,se)}),function(){P&&P.abort()}})})};var Pc=function(r){Oe(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,mf(t).request)||this;return n.options=t,n}return e}(At);var{toString:gf,hasOwnProperty:eg}=Object.prototype,yf=Function.prototype.toString,Lc=new Map;function Ee(r,e){try{return $c(r,e)}finally{Lc.clear()}}function $c(r,e){if(r===e)return!0;let t=gf.call(r),n=gf.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(bf(r,e))return!0;let i=vf(r),a=vf(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!eg.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!$c(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(bf(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&&!$c(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=yf.call(r);return i!==yf.call(e)?!1:!ng(i,rg)}}return!1}function vf(r){return Object.keys(r).filter(tg,r)}function tg(r){return this[r]!==void 0}var rg="{ [native code] }";function ng(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function bf(r,e){let t=Lc.get(r);if(t){if(t.has(e))return!0}else Lc.set(r,t=new Set);return t.add(e),!1}var ig=function(){return Object.create(null)},Sf=Array.prototype,ag=Sf.forEach,og=Sf.slice,Gt=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=ig),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 ag.call(e,function(n){return t=t.getChildTrie(n)}),t.data||(t.data=this.makeData(og.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&sg(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 sg(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Ke=null,wf={},cg=1,ug=()=>class{constructor(){this.id=["slot",cg++,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 t=e.slots[this.id];if(t===wf)break;return e!==Ke&&(Ke.slots[this.id]=t),!0}return Ke&&(Ke.slots[this.id]=wf),!1}getValue(){if(this.hasValue())return Ke.slots[this.id]}withValue(e,t,n,i){let a={__proto__:null,[this.id]:e},o=Ke;Ke={parent:o,slots:a};try{return t.apply(i,n)}finally{Ke=o}}static bind(e){let t=Ke;return function(){let n=Ke;try{return Ke=t,e.apply(this,arguments)}finally{Ke=n}}}static noContext(e,t,n){if(Ke){let i=Ke;try{return Ke=null,e.apply(n,t)}finally{Ke=i}}else return e.apply(n,t)}};function _f(r){try{return r()}catch{}}var Fc="@wry/context:Slot",lg=_f(()=>globalThis)||_f(()=>global)||Object.create(null),Ef=lg,oi=Ef[Fc]||Array[Fc]||function(r){try{Object.defineProperty(Ef,Fc,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(ug());var{bind:fg,noContext:pg}=oi;function dg(){}var hg=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=dg),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}(),Io=new oi,Mc,mg=Object.prototype.hasOwnProperty,jc=(Mc=Array.from,Mc===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Mc);function xo(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var ra=[],gg=100;function si(r,e){if(!r)throw new Error(e||"assertion failure")}function yg(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function If(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function vg(r){return r.slice(0)}var bg=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&&!Nr(this))return xf(this),this.value[0]},r.prototype.recompute=function(e){return si(!this.recomputing,"already recomputing"),xf(this),Nr(this)?Sg(this,e):If(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,kf(this),xo(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Nf(this),qc(this,function(t,n){t.setDirty(),Rf(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=ra.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(jc(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),ra.push(this.deps),this.deps=null)},r.count=0,r}();function xf(r){var e=Io.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Nr(r)?Af(e,r):Of(e,r),e}function Sg(r,e){return Nf(r),Io.withValue(r,wg,[r,e]),Eg(r,e)&&_g(r),If(r.value)}function wg(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 Nr(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function _g(r){r.dirty=!1,!Nr(r)&&Tf(r)}function kf(r){qc(r,Af)}function Tf(r){qc(r,Of)}function qc(r,e){var t=r.parents.size;if(t)for(var n=jc(r.parents),i=0;i<t;++i)e(n[i],r)}function Af(r,e){si(r.childValues.has(e)),si(Nr(e));var t=!Nr(r);if(!r.dirtyChildren)r.dirtyChildren=ra.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&kf(r)}function Of(r,e){si(r.childValues.has(e)),si(!Nr(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,vg(e.value)):yg(t,e.value)||r.setDirty(),Df(r,e),!Nr(r)&&Tf(r)}function Df(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(ra.length<gg&&ra.push(t),r.dirtyChildren=null))}function Nf(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Rf(r,t)}),r.forgetDeps(),si(r.dirtyChildren===null)}function Rf(r,e){e.parents.delete(r),r.childValues.delete(e),Df(r,e)}function Eg(r,e){if(typeof r.subscribe=="function")try{xo(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var xg={setDirty:!0,dispose:!0,forget:!0};function ko(r){var e=new Map,t=r&&r.subscribe;function n(i){var a=Io.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof t=="function"&&(xo(o),o.unsubscribe=t(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&mg.call(xg,o)?o:"setDirty";jc(s).forEach(function(u){return u[c]()}),e.delete(a),xo(s)}},n}function Cf(){var r=new Gt(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var ax=Cf(),Uc=new Set;function dn(r,e){e===void 0&&(e=Object.create(null));var t=new hg(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||Cf(),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 bg(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var p=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Uc.add(t),Io.hasValue()||(Uc.forEach(function(d){return d.clean()}),Uc.clear()),p};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 Bc=function(){function r(){this.getFragmentDoc=dn(cc)}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=Wt(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=Wt(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 na=function(r){Oe(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 ia(r){return r==null}function Ao(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=ia(n)?ia(i)?void 0:{_id:i}:{id:n}),ia(n)&&!ia(i)&&(n=i),!ia(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Pf={dataIdFromObject:Ao,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Lf(r){return Dr(Pf,r)}function Oo(r){var e=r.canonizeResults;return e===void 0?Pf.canonizeResults:e}function $f(r,e){return re(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Vc=/^[_a-z][_0-9a-z]*/i;function jt(r){var e=r.match(Vc);return e?e[0]:r}function To(r,e,t){return ce(e)?ge(e)?e.every(function(n){return To(r,n,t)}):r.selections.every(function(n){if(vt(n)&&fr(n,t)){var i=kt(n);return De.call(e,i)&&(!n.selectionSet||To(n.selectionSet,e[i],t))}return!0}):!1}function Rr(r){return ce(r)&&!re(r)&&!ge(r)}function Ff(){return new lt}function Do(r,e){var t=on(cn(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var No=Object.create(null),Qc=function(){return No},Mf=Object.create(null),ci=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 Ji(re(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return re(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return zt(i);if(re(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 Cr)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 Cr)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;re(e)&&(e=e.__ref),re(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__?L(typeof i=="string","store.merge expects a string ID"):L(typeof i=="string",1);var s=new lt(kg).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 Cr)&&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:No,INVALIDATE:Mf,isReference:re,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),p=i[u];if(p!==void 0){var d=typeof t=="function"?t:t[u]||t[l];if(d){var f=d===Qc?No:d(Ji(p),x(x({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));f===Mf?n.group.dirty(e,u):(f===No&&(f=void 0),f!==p&&(a[u]=f,o=!0,p=f))}p!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Cr?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]=Qc,i):Qc)}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 Cr&&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=Wt(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 Cr?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 Cr;)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){re(a)&&(t[a.__ref]=!0),ce(a)&&Object.keys(a).forEach(function(o){var s=a[o];ce(s)&&i.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Uf=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?ko():null,this.keyMaker=new Gt(Tt)},r.prototype.depend=function(e,t){if(this.d){this.d(Wc(e,t));var n=jt(t);n!==t&&this.d(Wc(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Wc(e,t),t==="__exists"?"forget":"setDirty")},r}();function Wc(r,e){return e+"#"+r}function zc(r,e){hn(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Oe(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 Uf(s))||this;return u.stump=new Ig(u),u.storageTrie=new Gt(Tt),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})(ci||(ci={}));var Cr=function(r){Oe(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){Ee(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}(ci),Ig=function(r){Oe(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Uf(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}(Cr);function kg(r,e,t){var n=r[t],i=e[t];return Ee(n,i)?n:i}function hn(r){return!!(r instanceof ci&&r.group.caching)}function Tg(r){return ce(r)?ge(r)?r.slice(0):x({__proto__:Object.getPrototypeOf(r)},r):r}var Ro=function(){function r(){this.known=new(Bl?WeakSet:Set),this.pool=new Gt(Tt),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return ce(e)&&this.known.has(e)},r.prototype.pass=function(e){if(ce(e)){var t=Tg(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=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(t.admit(e[f]))});var o=this.pool.lookupArray(c);if(!o.object){var p=o.object=Object.create(s);this.known.add(p),u.sorted.forEach(function(f,h){p[f]=c[l+h]}),__DEV__&&Object.freeze(p)}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 bt=Object.assign(function(r){if(ce(r)){Hc===void 0&&jf();var e=Hc.admit(r),t=Gc.get(e);return t===void 0&&Gc.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:jf}),Hc,Gc;function jf(){Hc=new Ro,Gc=new(Tt?WeakMap:Map)}function qf(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Bf=function(){function r(e){var t=this;this.knownResults=new(Tt?WeakMap:Map),this.config=Dr(e,{addTypename:e.addTypename!==!1,canonizeResults:Oo(e)}),this.canon=e.canon||new Ro,this.executeSelectionSet=dn(function(n){var i,a=n.context.canonizeResults,o=qf(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:(zc(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:qf,makeCacheKey:function(n,i,a,o){if(hn(a.store))return a.store.makeCacheKey(n,re(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=dn(function(n){return zc(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(hn(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new Ro},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,p=this.config.cache.policies;o=x(x({},ln(Hi(n))),o);var d=zt(a),f=this.executeSelectionSet({selectionSet:un(n).selectionSet,objectOrReference:d,enclosingRef:d,context:x({store:t,query:n,policies:p,variables:o,varString:bt(o),canonizeResults:l},Do(n,this.config.fragments))}),h;if(f.missing&&(h=[new na(Ag(f.missing),f.missing,n,o)],!c))throw h[0];return{result:f.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,n,i){if(hn(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(re(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"),p=[],d,f=new lt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&p.push({__typename:l});function h(S,y){var O;return S.missing&&(d=f.merge(d,(O={},O[y]=S.missing,O))),S.result}var m=new Set(n.selections);m.forEach(function(S){var y,O;if(!!fr(S,s))if(vt(S)){var N=c.readField({fieldName:S.name.value,field:S,variables:o.variables,from:i},o),T=kt(S);N===void 0?fn.added(S)||(d=f.merge(d,(y={},y[T]="Can't find field '".concat(S.name.value,"' on ").concat(re(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),y))):ge(N)?N=h(t.executeSubSelectedArray({field:S,array:N,enclosingRef:a,context:o}),T):S.selectionSet?N!=null&&(N=h(t.executeSelectionSet({selectionSet:S.selectionSet,objectOrReference:N,enclosingRef:re(N)?N:a,context:o}),T)):o.canonizeResults&&(N=t.canon.pass(N)),N!==void 0&&p.push((O={},O[T]=N,O))}else{var C=sn(S,o.lookupFragment);if(!C&&S.kind===Le.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(S.name.value)):new K(5);C&&c.fragmentMatches(C,l)&&C.selectionSet.selections.forEach(m.add,m)}});var b=Gi(p),_={result:b,missing:d},v=o.canonizeResults?this.canon.admit(_):Ji(_);return v.result&&this.knownResults.set(v.result,n),v},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,n=e.field,i=e.array,a=e.enclosingRef,o=e.context,s,c=new lt;function u(l,p){var d;return l.missing&&(s=c.merge(s,(d={},d[p]=l.missing,d))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,p){return l===null?null:ge(l)?u(t.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),p):n.selectionSet?u(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:re(l)?l:a,context:o}),p):(__DEV__&&Og(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},r}();function Ag(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function Og(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){ce(i)&&(__DEV__?L(!re(i),"Missing selection set for object of type ".concat($f(r,i)," returned for query field ").concat(e.name.value)):L(!re(i),6),Object.values(i).forEach(n.add,n))})}}var ui=new oi,Vf=new WeakMap;function aa(r){var e=Vf.get(r);return e||Vf.set(r,e={vars:new Set,dep:ko()}),e}function Kc(r){aa(r).vars.forEach(function(e){return e.forgetCache(r)})}function Qf(r){aa(r).vars.forEach(function(e){return e.attachCache(r)})}function Co(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){aa(c).dep.dirty(n),Dg(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=ui.getValue();s&&(i(s),aa(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),aa(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function Dg(r){r.broadcastWatches&&r.broadcastWatches()}var Wf=Object.create(null);function Jc(r){var e=JSON.stringify(r);return Wf[e]||(Wf[e]=Object.create(null))}function Zc(r){var e=Jc(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Xc(r,function(o){var s=li(n.storeObject,o,i);return s===void 0&&t!==n.storeObject&&De.call(t,o[0])&&(s=li(t,o,Hf)),__DEV__?L(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):L(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Yc(r){var e=Jc(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,o=n.fieldName,s=Xc(r,function(u){var l=u[0],p=l.charAt(0);if(p==="@"){if(i&&Fe(i.directives)){var d=l.slice(1),f=i.directives.find(function(_){return _.name.value===d}),h=f&&pr(f,a);return h&&li(h,u.slice(1))}return}if(p==="$"){var m=l.slice(1);if(a&&De.call(a,m)){var b=u.slice(0);return b[0]=m,li(a,b)}return}if(t)return li(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Xc(r,e){var t=new lt;return zf(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 zf(r){var e=Jc(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){ge(i)?(zf(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 Hf(r,e){return r[e]}function li(r,e,t){return t=t||Hf,Gf(e.reduce(function n(i,a){return ge(i)?i.map(function(o){return n(o,a)}):i&&t(i,a)},r))}function Gf(r){return ce(r)?ge(r)?r.map(Gf):Xc(Object.keys(r).sort(),function(e){return li(r,e)}):r}Wi.setStringify(bt);function eu(r){return r.args!==void 0?r.args:r.field?pr(r.field,r.variables):null}var Ng=function(){},Kf=function(r,e){return e.fieldName},Jf=function(r,e,t){var n=t.mergeObjects;return n(r,e)},Zf=function(r,e){return e},Xf=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:Ao},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 d=Po(arguments,o);return i.readField(d,{store:i.cache.data,variables:d.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var p=l(e,s);if(ge(p))l=Zc(p);else{c=p;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=Wt(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?Jf:u===!1?Zf:c.merge}s(i,t.merge),i.keyFn=a===!1?Ng: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 p=l.keyArgs,d=l.read,f=l.merge;u.keyFn=p===!1?Kf:ge(p)?Yc(p):typeof p=="function"?p:u.keyFn,typeof d=="function"&&(u.read=d),s(u,f)}u.read&&u.merge&&(u.keyFn=u.keyFn||Kf)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==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[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(Vc);(!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=Wt(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),p=!1,d=0;d<c.length;++d){var f=c[d];if(f.has(o))return s.has(o)||(p&&__DEV__&&L.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;f.forEach(u),l&&d===c.length-1&&To(e.selectionSet,n,i)&&(l=!1,p=!0,this.fuzzySubtypes.forEach(function(h,m){var b=t.match(h);b&&b[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=eu(e);o;){var u=o(c,s);if(ge(u))o=Yc(u);else{a=u||n;break}}return a===void 0&&(a=e.field?lc(e.field,e.variables):Wi(n,eu(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 p=Yf(this,n,e,t,t.store.getStorage(re(n)?n.__ref:n,o));return ui.withValue(this.cache,l,[c,p])}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===Jf?ep(i.store)(e,t):c===Zf?t:(i.overwrite&&(e=void 0),c(e,t,Yf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},r}();function Yf(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:eu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:re,toReference:u,storage:i,cache:r.cache,canRead:l,readField:function(){return r.readField(Po(arguments,e,s),n)},mergeObjects:ep(n.store)}}function Po(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__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(zl(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function ep(r){return function(t,n){if(ge(t)||ge(n))throw __DEV__?new K("Cannot automatically merge arrays"):new K(4);if(ce(t)&&ce(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(re(t)&&Rr(n))return r.merge(t.__ref,n),t;if(Rr(t)&&re(n))return r.merge(t,n.__ref),n;if(Rr(t)&&Rr(n))return x(x({},t),n)}return n}}function tu(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 ip=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=Ht(i),l=Ff();s=x(x({},ln(u)),s);var p=x(x({store:e,written:Object.create(null),merge:function(f,h){return l.merge(f,h)},variables:s,varString:bt(s)},Do(i,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:p});if(!re(d))throw __DEV__?new K("Could not identify object ".concat(JSON.stringify(a))):new K(7);return p.incomingById.forEach(function(f,h){var m=f.storeObject,b=f.mergeTree,_=f.fieldNodeSet,v=zt(h);if(b&&b.map.size){var S=n.applyMerges(b,v,m,p);if(re(S))return;m=S}if(__DEV__&&!p.overwrite){var y=Object.create(null);_.forEach(function(T){T.selectionSet&&(y[T.name.value]=!0)});var O=function(T){return y[jt(T)]===!0},N=function(T){var C=b&&b.map.get(T);return Boolean(C&&C.info&&C.info.merge)};Object.keys(m).forEach(function(T){O(T)&&!N(T)&&Rg(v,m,T,p.store)})}e.merge(h,m)}),e.retain(d.__ref),d},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]||zi(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var p=function(){var S=Po(arguments,u,o.variables);if(re(S.from)){var y=o.incomingById.get(S.from.__ref);if(y){var O=c.readField(x(x({},S),{from:y.storeObject}),o);if(O!==void 0)return O}}return c.readField(S,o)},d=new Set;this.flattenFields(a,i,o,l).forEach(function(S,y){var O,N=kt(y),T=i[N];if(d.add(y),T!==void 0){var C=c.getStoreFieldName({typename:l,fieldName:y.name.value,field:y,variables:S.variables}),$=tp(s,C),P=t.processFieldValue(T,y,y.selectionSet?tu(S,!1,!1):S,$),B=void 0;y.selectionSet&&(re(P)||Rr(P))&&(B=p("__typename",P));var xe=c.getMergeFunction(l,y.name.value,B);xe?$.info={field:y,typename:l,merge:xe}:rp(s,C),u=S.merge(u,(O={},O[C]=P,O))}else __DEV__&&!S.clientOnly&&!S.deferred&&!fn.added(y)&&!c.getReadFunction(l,y.name.value)&&__DEV__&&L.error("Missing field '".concat(kt(y),"' 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:p}),h=f[0],m=f[1];n=n||h,m&&(u=o.merge(u,m))}catch(S){if(!n)throw S}if(typeof n=="string"){var b=zt(n),_=o.written[n]||(o.written[n]=[]);if(_.indexOf(a)>=0||(_.push(a),this.reader&&this.reader.isFresh(i,b,a,o)))return b;var v=o.incomingById.get(n);return v?(v.storeObject=o.merge(v.storeObject,u),v.mergeTree=ru(v.mergeTree,s),d.forEach(function(S){return v.fieldNodeSet.add(S)})):o.incomingById.set(n,{storeObject:u,mergeTree:Lo(s)?void 0:s,fieldNodeSet:d}),b}return u},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?__DEV__?mo(e):e:ge(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,n,tp(i,s));return rp(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=zi(t,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new Gt(!1);return function c(u,l){var p=s.lookup(u,l.clientOnly,l.deferred);p.visited||(p.visited=!0,u.selections.forEach(function(d){if(!!fr(d,n.variables)){var f=l.clientOnly,h=l.deferred;if(!(f&&h)&&Fe(d.directives)&&d.directives.forEach(function(_){var v=_.name.value;if(v==="client"&&(f=!0),v==="defer"){var S=pr(_,n.variables);(!S||S.if!==!1)&&(h=!0)}}),vt(d)){var m=a.get(d);m&&(f=f&&m.clientOnly,h=h&&m.deferred),a.set(d,tu(n,f,h))}else{var b=sn(d,n.lookupFragment);if(!b&&d.kind===Le.FRAGMENT_SPREAD)throw __DEV__?new K("No fragment named ".concat(d.name.value)):new K(8);b&&o.fragmentMatches(b,i,t,n.variables)&&c(b.selectionSet,tu(n,f,h))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var o,s=this;if(e.map.size&&!re(n)){var c=!ge(n)&&(re(t)||Rr(t))?t:void 0,u=n;c&&!a&&(a=[re(c)?c.__ref:c]);var l,p=function(d,f){return ge(d)?typeof f=="number"?d[f]:void 0:i.store.getFieldValue(d,String(f))};e.map.forEach(function(d,f){var h=p(c,f),m=p(u,f);if(m!==void 0){a&&a.push(f);var b=s.applyMerges(d,h,m,i,a);b!==m&&(l=l||new Map,l.set(f,b)),a&&L(a.pop()===f)}}),l&&(n=ge(u)?u.slice(0):x({},u),l.forEach(function(d,f){n[f]=d}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},r}();var ap=[];function tp(r,e){var t=r.map;return t.has(e)||t.set(e,ap.pop()||{map:new Map}),t.get(e)}function ru(r,e){if(r===e||!e||Lo(e))return r;if(!r||Lo(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,ru(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,ru(e.map.get(s),r.map.get(s)))})}return a}function Lo(r){return!r||!(r.info||r.map.size)}function rp(r,e){var t=r.map,n=t.get(e);n&&Lo(n)&&(ap.push(n),t.delete(e))}var np=new Set;function Rg(r,e,t,n){var i=function(p){var d=n.getFieldValue(p,t);return typeof d=="object"&&d},a=i(r);if(!!a){var o=i(e);if(!!o&&!re(a)&&!Ee(a,o)&&!Object.keys(a).every(function(p){return n.getFieldValue(o,p)!==void 0})){var s=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),c=jt(t),u="".concat(s,".").concat(c);if(!np.has(u)){np.add(u);var l=[];!ge(a)&&!ge(o)&&[a,o].forEach(function(p){var d=n.getFieldValue(p,"__typename");typeof d=="string"&&!l.includes(d)&&l.push(d)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
37
37
 
38
38
  To address this problem (which is not a bug in Apollo Client), `).concat(l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(u,` field, so InMemoryCache can safely merge these objects:
39
39
 
@@ -44,42 +44,42 @@ 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 Lo=function(r){Oe(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=Ro,n.txCount=0,n.config=Lf(t),n.addTypename=!!n.config.addTypename,n.policies=new Xf({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 oi.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 ip(this,this.storeReader=new Bf({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Ao(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=ln(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(fn(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,bt({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 ra)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||Qf(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&Kc(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){bt.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(te(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){__DEV__&&L.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(),bt.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Kc(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(d){var f=n,h=f.data,m=f.optimisticData;++n.txCount,d&&(n.data=n.optimisticData=d);try{return u=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},p=new Set;return c&&!this.txCount&&this.broadcastWatches(x(x({},t),{onWatchUpdated:function(d){return p.add(d),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&p.size?(this.broadcastWatches(x(x({},t),{onWatchUpdated:function(d,f){var h=c.call(this,d,f);return h!==!1&&p.delete(d),h}})),p.size&&p.forEach(function(d){return n.maybeBroadcastWatch.dirty(d)})):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=cn(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||!Ee(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(Bc);function op(r){return r.hasOwnProperty("graphQLErrors")}var Ng=function(r){var e="";if(Fe(r.graphQLErrors)||Fe(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,`
47
+ `))}}}}var $o=function(r){Oe(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=Co,n.txCount=0,n.config=Lf(t),n.addTypename=!!n.config.addTypename,n.policies=new Xf({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 ci.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 ip(this,this.storeReader=new Bf({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:Oo(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=dn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(hn(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,bt({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 na)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if(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||Qf(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&Kc(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){bt.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(re(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){__DEV__&&L.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(),bt.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Kc(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(d){var f=n,h=f.data,m=f.optimisticData;++n.txCount,d&&(n.data=n.optimisticData=d);try{return u=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},p=new Set;return c&&!this.txCount&&this.broadcastWatches(x(x({},t),{onWatchUpdated:function(d){return p.add(d),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&p.size?(this.broadcastWatches(x(x({},t),{onWatchUpdated:function(d,f){var h=c.call(this,d,f);return h!==!1&&p.delete(d),h}})),p.size&&p.forEach(function(d){return n.maybeBroadcastWatch.dirty(d)})):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=fn(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||!Ee(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(Bc);function op(r){return r.hasOwnProperty("graphQLErrors")}var Cg=function(r){var e="";if(Fe(r.graphQLErrors)||Fe(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
48
  `)})}return r.networkError&&(e+="".concat(r.networkError.message,`
49
- `)),e=e.replace(/\n$/,""),e},fr=function(r){Oe(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||Ng(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 Rr(r){return r?r<7:!1}var Rg=Object.assign,Cg=Object.hasOwnProperty,$o=function(r){Oe(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,o=r.call(this,function(v){try{var _=v._subscription._observer;_&&!_.error&&(_.error=Pg)}catch{}var y=!o.observers.size;o.observers.add(v);var b=o.last;return b&&b.error?v.error&&v.error(b.error):b&&b.result&&v.next&&v.next(b.result),y&&o.reobserve().catch(function(){}),function(){o.observers.delete(v)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=i,o.queryManager=n,o.isTornDown=!1;var s=n.defaultOptions.watchQuery,c=s===void 0?{}:s,u=c.fetchPolicy,l=u===void 0?"cache-first":u,p=a.fetchPolicy,d=p===void 0?l:p,f=a.initialFetchPolicy,h=f===void 0?d==="standby"?l:d:f;o.options=x(x({},a),{initialFetchPolicy:h,fetchPolicy:d}),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:Rr(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),Ee(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&&iu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){return!this.last||!Ee(this.last.result,t)||n&&!Ee(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Ee(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&&Cg.call(t,"variables")){var o=Wi(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&L.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((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&&!Ee(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 p=t.updateQuery;p?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(d){return p(d,{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)||nu(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__&&L.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 Ee(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__?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(){t.pollingInfo&&(Rr(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:ho(t),variables:n}),Fe(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=Ar(this.options,t||{}),u=a?c:Rg(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ee(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),p=this.fetch(u,n),d={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=p,this.observer=d),p.addObserver(d),p.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),un(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),un(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}(ee);go($o);function nu(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 Pg(r){__DEV__&&L.error("Unhandled error",r.message,r.stack)}function iu(r){__DEV__&&r&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var Fo=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=yc(t.resolvers,n)}):this.resolvers=yc(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 $t(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 Jn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return gc(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 $t(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 Ye(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 tn}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:mc(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,p,d,f,h,m,v,_;return $t(this,function(y){return s=on(e),c=an(e),u=rn(c),l=this.collectSelectionsToResolve(s,u),p=s.operation,d=p?p.charAt(0).toUpperCase()+p.slice(1):"Query",f=this,h=f.cache,m=f.client,v={fragmentMap:u,context:x(x({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:d,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,t,v).then(function(b){return{result:b,exportedVariables:v.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 $t(this,function(p){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(d){return Lt(l,void 0,void 0,function(){var f,h;return $t(this,function(m){return!t&&!i.selectionsToResolve.has(d)?[2]:ur(d,s)?vt(d)?[2,this.resolveField(d,t,n,i).then(function(v){var _;typeof v<"u"&&c.push((_={},_[It(d)]=v,_))})]:(fc(d)?f=d:(f=a[d.name.value],__DEV__?L(f,"No fragment named ".concat(d.name.value)):L(f,11)),f&&f.typeCondition&&(h=f.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(f.selectionSet,t,n,i).then(function(v){c.push(v)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Gi(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return Lt(this,void 0,void 0,function(){var a,o,s,c,u,l,p,d,f,h=this;return $t(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))&&(p=n.__typename||i.defaultOperationType,d=this.resolvers&&this.resolvers[p],d&&(f=d[c?o:s],f&&(l=Promise.resolve(si.withValue(this.cache,f,[n,lr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(v){var _,y;if(v===void 0&&(v=u),e.directives&&e.directives.forEach(function(g){g.name.value==="export"&&g.arguments&&g.arguments.forEach(function(A){A.name.value==="as"&&A.value.kind==="StringValue"&&(i.exportedVariables[A.value.value]=v)})}),!e.selectionSet||v==null)return v;var b=(y=(_=e.directives)===null||_===void 0?void 0:_.some(function(g){return g.name.value==="client"}))!==null&&y!==void 0?y:!1;if(Array.isArray(v))return h.resolveSubSelectedArray(e,t||b,v,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||b,v,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),Ye(o,{Directive:function(c,u,l,p,d){c.name.value==="client"&&d.forEach(function(f){n(f)&&Bi(f)&&s.add(f)})},FragmentSpread:function(c,u,l,p,d){var f=t[c.name.value];__DEV__?L(f,"No fragment named ".concat(c.name.value)):L(f,12);var h=a(f);h.size>0&&(d.forEach(function(m){n(m)&&Bi(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},r}();var ui=new(Tt?WeakMap:Map);function au(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return ui.set(r,(ui.get(r)+1)%1e15),t.apply(this,arguments)})}function sp(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Mo=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;ui.has(n)||(ui.set(n,0),au(n,"evict"),au(n,"modify"),au(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||pe.loading;return this.variables&&this.networkStatus!==pe.loading&&!Ee(this.variables,e.variables)&&(t=pe.setVariables),Ee(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(){sp(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ee(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&&!Ee(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():nu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;sp(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(Rr(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||!Ee(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===ui.get(this.cache)&&Ee(t,n.variables)&&Ee(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new ut,s=Fe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Fe(e.incremental)){var c=yo(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&&(jo(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:ui.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var p=a.getDiffOptions(n.variables),d=l.diff(p);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(d,p),d.complete&&(e.data=d.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 jo(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!ri(r);return!n&&t&&r.data&&(n=!0),n}var Lg=Object.prototype.hasOwnProperty,cp=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,p=l===void 0?{}:l,d=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Tt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=p,this.localState=d||new Fo({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!f,(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 K("QueryManager stopped while query was in flight"):new K(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,p=l===void 0?!1:l,d=e.update,f=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,v=e.errorPolicy,_=v===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":v,y=e.keepRootFields,b=e.context;return Lt(this,void 0,void 0,function(){var g,A,N,I,C,$;return $t(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),g=this.generateMutationId(),A=this.transform(i),N=A.document,I=A.hasClientExports,i=this.cache.transformForLink(N),a=this.getVariables(i,a),I?[4,this.localState.addExportedVariables(i,a,b)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return C=this.mutationStore&&(this.mutationStore[g]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:g,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:b,updateQueries:s,update:d,keepRootFields:y}),this.broadcastQueries(),$=this,[2,new Promise(function(j,xe){return mo($.getObservableFromLink(i,x(x({},b),{optimisticResponse:o}),a,!1),function(Te){if(ri(Te)&&_==="none")throw new fr({graphQLErrors:vo(Te)});C&&(C.loading=!1,C.error=null);var k=x({},Te);return typeof u=="function"&&(u=u(k)),_==="ignore"&&ri(k)&&delete k.errors,$.markMutationResult({mutationId:g,result:k,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:b,update:d,updateQueries:s,awaitRefetchQueries:p,refetchQueries:u,removeOptimistic:o?g:void 0,onQueryUpdated:f,keepRootFields:y})}).subscribe({next:function(Te){$.broadcastQueries(),(!("hasNext"in Te)||Te.hasNext===!1)&&j(Te)},error:function(Te){C&&(C.loading=!1,C.error=Te),o&&$.cache.removeOptimistic(g),$.broadcastQueries(),xe(Te instanceof fr?Te:new fr({networkError:Te}))}})})]}})})},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&&jo(i,e.errorPolicy)){if(Tr(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Tr(i)&&Fe(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=yo(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(p,d){var f=p.observableQuery,h=f&&f.queryName;if(!(!h||!Lg.call(u,h))){var m=u[h],v=n.queries.get(d),_=v.document,y=v.variables,b=t.diff({query:_,variables:y,returnPartialData:!0,optimistic:!1}),g=b.result,A=b.complete;if(A&&g){var N=m(g,{mutationResult:i,queryName:_&&Yn(_)||void 0,queryVariables:y});N&&a.push({result:N,dataId:"ROOT_QUERY",query:_,variables:y})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(p){o||a.forEach(function(m){return p.write(m)});var d=e.update,f=!Ql(i)||Tr(i)&&!i.hasNext;if(d){if(!o){var h=p.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)}f&&d(p,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&f&&p.modify({id:"ROOT_MUTATION",fields:function(m,v){var _=v.fieldName,y=v.DELETE;return _==="__typename"?m:y}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(p){return l.push(p)}),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__&&L.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=hc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:sc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:sn(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 Mo(this),n=new $o({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__?L(e.query,"query option is required. You must specify your GraphQL document in the query option."):L(e.query,17),__DEV__?L(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):L(e.query.kind==="Document",18),__DEV__?L(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):L(!e.returnPartialData,19),__DEV__?L(!e.pollInterval,"pollInterval option only supported on watchQuery."):L(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return 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 K("Store reset while query was in flight (not completed in link chain)"):new K(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):uc(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,p=c.options.fetchPolicy;if(p==="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=Ji("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new $o({queryManager:t,queryInfo:c,options:x(x({},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},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(p){return t.getObservableFromLink(n,c,p).map(function(d){if(i!=="no-cache"&&(jo(d,a)&&t.cache.write({query:n,result:d.data,dataId:"ROOT_SUBSCRIPTION",variables:p}),t.broadcastQueries()),ri(d))throw new fr({graphQLErrors:d.errors});return d})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new ee(function(p){var d=null;return l.then(function(f){return d=f.subscribe(p)},p.error),function(){return d&&d.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,p=u.link,d={query:c,variables:n,operationName:Yn(c)||void 0,context:this.prepareContext(x(x({},t),{forceFetch:!i}))};if(t=d.context,i){var f=l.get(c)||new Map;l.set(c,f);var h=bt(n);if(s=f.get(h),!s){var m=new ti([ni(p,d)]);f.set(h,s=m),m.beforeNext(function(){f.delete(h)&&f.size<1&&l.delete(c)})}}else s=new ti([ni(p,d)])}else s=new ti([ee.of({data:{}})]),t=this.prepareContext(t);var v=this.transform(e).clientQuery;return v&&(s=mo(s,function(_){return a.localState.runResolvers({document:v,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 mo(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=vo(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new fr({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=op(o)?o:new fr({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,p=t.errorPolicy,d=p===void 0?c&&c.errorPolicy||"none":p,f=t.returnPartialData,h=f===void 0?!1:f,m=t.notifyOnNetworkStatusChange,v=m===void 0?!1:m,_=t.context,y=_===void 0?{}:_,b=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:d,returnPartialData:h,notifyOnNetworkStatusChange:v,context:y}),g=function(I){b.variables=I;var C=i.fetchQueryByPolicy(s,b,n);return b.fetchPolicy!=="standby"&&C.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),C},A=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(I){A(),setTimeout(function(){return N.cancel(I)})});var N=new ti(this.transform(b.query).hasClientExports?this.localState.addExportedVariables(b.query,b.variables,b.context).then(g):g(b.variables));return N.promise.then(A,A),N},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?Ji("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(d,f){l.set(f,{oq:d,lastDiff:t.getQuery(f).getDiff()})});var p=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(d,f,h){var m=d.watcher instanceof Mo&&d.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var v=u(m,f,h);return v===!0&&(v=m.refetch()),v!==!1&&p.set(m,v),v}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:f})}}}),l.size&&l.forEach(function(d,f){var h=d.oq,m=d.lastDiff,v=d.diff,_;if(u){if(!v){var y=h.queryInfo;y.reset(),v=y.getDiff()}_=u(h,v,m)}(!u||_===!0)&&(_=h.refetch()),_!==!1&&p.set(h,_),f.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(f)}),c&&this.cache.removeOptimistic(c),p},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,p=t.context,d=t.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},m=function(g,A){A===void 0&&(A=e.networkStatus||pe.loading);var N=g.result;__DEV__&&!l&&!Ee(N,{})&&iu(g.missing);var I=function(C){return ee.of(x({data:C,loading:Rr(A),networkStatus:A},g.complete?null:{partial:!0}))};return N&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:N},context:p,variables:o,onlyRunForcedResolvers:!0}).then(function(C){return I(C.data||void 0)}):u==="none"&&A===pe.refetch&&Array.isArray(g.missing)?I(void 0):I(N)},v=s==="no-cache"?0:n===pe.refetch&&c!=="merge"?1:2,_=function(){return i.getResultsFromLink(e,v,{variables:o,context:p,fetchPolicy:s,errorPolicy:u})},y=d&&typeof f=="number"&&f!==n&&Rr(n);switch(s){default:case"cache-first":{var b=h();return b.complete?[m(b,e.markReady())]:l||y?[m(b),_()]:[_()]}case"cache-and-network":{var b=h();return b.complete||l||y?[m(b),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return y?[m(h()),_()]:[_()];case"no-cache":return y?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Mo(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 up=!1;var ou=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,p=e.connectToDevTools,d=p===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:p,f=e.queryDeduplication,h=f===void 0?!0:f,m=e.defaultOptions,v=e.assumeImmutableResults,_=v===void 0?!1:v,y=e.resolvers,b=e.typeDefs,g=e.fragmentMatcher,A=e.name,N=e.version,I=e.link;if(I||(I=n?new Pc({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=I,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=b,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),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!up&&d&&__DEV__&&(up=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var C=window.navigator,$=C&&C.userAgent,P=void 0;typeof $=="string"&&($.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":$.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=Hl,this.localState=new Fo({cache:o,client:this,resolvers:y,fragmentMatcher:g}),this.queryManager=new cp({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:A,version:N},localState:this.localState,assumeImmutableResults:_,onBroadcast:d?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=Zi(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=Zi(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=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Zi(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 ni(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__&&L.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Sl(en?"log":"silent");function tt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function pr(r){return tt(r)==="object"}function lp(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function su(r,e){return r.length<124?r:e}var fp="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 Ne;(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"})(Ne||(Ne={}));function pp(r){if(!pr(r))throw new Error(`Message is expected to be an object, but got ${tt(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 ${tt(r.type)}`);switch(r.type){case Ne.ConnectionInit:case Ne.ConnectionAck:case Ne.Ping:case Ne.Pong:{if(r.payload!=null&&!pr(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 Ne.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${tt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!pr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${tt(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 ${tt(r.payload.query)}`);if(r.payload.variables!=null&&!pr(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 ${tt(r.payload.variables)}`);if(r.payload.operationName!=null&&tt(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 ${tt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!pr(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 ${tt(r.payload.extensions)}`);break}case Ne.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${tt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!pr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${tt(r.payload)}`);break}case Ne.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${tt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!lp(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 Ne.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${tt(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 dp(r,e){return pp(typeof r=="string"?JSON.parse(r,e):r)}function li(r,e){return pp(r),JSON.stringify(r,e)}function cu(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(ye){let ve=1e3;for(let ae=0;ae<ye;ae++)ve*=2;await new Promise(ae=>setTimeout(ae,ve+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:p=Uo,isFatalConnectionProblem:d,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:v,jsonMessageReviver:_}=r,y;if(h){if(!Fg(h))throw new Error("Invalid WebSocket implementation provided");y=h}else typeof WebSocket<"u"?y=WebSocket:typeof global<"u"?y=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(y=window.WebSocket||window.MozWebSocket);if(!y)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let b=y,g=(()=>{let k=(()=>{let ve={};return{on(ae,oe){return ve[ae]=oe,()=>{delete ve[ae]}},emit(ae){var oe;"id"in ae&&((oe=ve[ae.id])===null||oe===void 0||oe.call(ve,ae))}}})(),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?[k.emit,f.message]:[k.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:k.on,on(ve,ae){let oe=ye[ve];return oe.push(ae),()=>{oe.splice(oe.indexOf(ae),1)}},emit(ve,...ae){for(let oe of[...ye[ve]])oe(...ae)}}})();function A(k){let ye=[g.on("error",ve=>{ye.forEach(ae=>ae()),k(ve)}),g.on("closed",ve=>{ye.forEach(ae=>ae()),k(ve)})]}let N,I=0,C,$=!1,P=0,j=!1;async function xe(){clearTimeout(C);let[k,ye]=await(N??(N=new Promise((oe,Bt)=>(async()=>{if($){if(await l(P),!I)return N=void 0,Bt({code:1e3,reason:"All Subscriptions Gone"});P++}g.emit("connecting");let X=new b(typeof e=="function"?await e():e,fp),Vt,_r;function ro(){isFinite(o)&&o>0&&(clearTimeout(_r),_r=setTimeout(()=>{X.readyState===b.OPEN&&(X.send(li({type:Ne.Ping})),g.emit("ping",!1,void 0))},o))}A(We=>{N=void 0,clearTimeout(Vt),clearTimeout(_r),Bt(We),Uo(We)&&We.code===4499&&(X.close(4499,"Terminated"),X.onerror=null,X.onclose=null)}),X.onerror=We=>g.emit("error",We),X.onclose=We=>g.emit("closed",We),X.onopen=async()=>{try{g.emit("opened",X);let We=typeof t=="function"?await t():t;if(X.readyState!==b.OPEN)return;X.send(li(We?{type:Ne.ConnectionInit,payload:We}:{type:Ne.ConnectionInit},v)),isFinite(c)&&c>0&&(Vt=setTimeout(()=>{X.close(lt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),ro()}catch(We){g.emit("error",We),X.close(lt.InternalClientError,su(We instanceof Error?We.message:new Error(We).message,"Internal client error"))}};let Hn=!1;X.onmessage=({data:We})=>{try{let Ge=dp(We,_);if(g.emit("message",Ge),Ge.type==="ping"||Ge.type==="pong"){g.emit(Ge.type,!0,Ge.payload),Ge.type==="pong"?ro():s||(X.send(li(Ge.payload?{type:Ne.Pong,payload:Ge.payload}:{type:Ne.Pong})),g.emit("pong",!1,Ge.payload));return}if(Hn)return;if(Ge.type!==Ne.ConnectionAck)throw new Error(`First message cannot be of type ${Ge.type}`);clearTimeout(Vt),Hn=!0,g.emit("connected",X,Ge.payload),$=!1,P=0,oe([X,new Promise((Sw,zh)=>A(zh))])}catch(Ge){X.onmessage=null,g.emit("error",Ge),X.close(lt.BadResponse,su(Ge instanceof Error?Ge.message:new Error(Ge).message,"Bad response"))}}})())));k.readyState===b.CLOSING&&await ye;let ve=()=>{},ae=new Promise(oe=>ve=oe);return[k,ve,Promise.race([ae.then(()=>{if(!I){let oe=()=>k.close(1e3,"Normal Closure");isFinite(a)&&a>0?C=setTimeout(()=>{k.readyState===b.OPEN&&oe()},a):oe()}}),ye])]}function Te(k){if(Uo(k)&&($g(k.code)||[lt.InternalServerError,lt.InternalClientError,lt.BadRequest,lt.BadResponse,lt.Unauthorized,lt.SubprotocolNotAcceptable,lt.SubscriberAlreadyExists,lt.TooManyInitialisationRequests].includes(k.code)))throw k;if(j)return!1;if(Uo(k)&&k.code===1e3)return I>0;if(!u||P>=u||!p(k)||d?.(k))throw k;return $=!0}return n||(async()=>{for(I++;;)try{let[,,k]=await xe();await k}catch(k){try{if(!Te(k))return}catch(ye){return i?.(ye)}}})(),{on:g.on,subscribe(k,ye){let ve=m(k),ae=!1,oe=!1,Bt=()=>{I--,ae=!0};return(async()=>{for(I++;;)try{let[X,Vt,_r]=await xe();if(ae)return Vt();let ro=g.onMessage(ve,Hn=>{switch(Hn.type){case Ne.Next:{ye.next(Hn.payload);return}case Ne.Error:{oe=!0,ae=!0,ye.error(Hn.payload),Bt();return}case Ne.Complete:{ae=!0,Bt();return}}});X.send(li({id:ve,type:Ne.Subscribe,payload:k},v)),Bt=()=>{!ae&&X.readyState===b.OPEN&&X.send(li({id:ve,type:Ne.Complete},v)),I--,ae=!0,Vt()},await _r.finally(ro);return}catch(X){if(!Te(X))return}})().then(()=>{oe||ye.complete()}).catch(X=>{ye.error(X)}),()=>{ae||Bt()}},async dispose(){if(j=!0,N){let[k]=await N;k.close(1e3,"Normal Closure")}},terminate(){N&&g.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Uo(r){return pr(r)&&"code"in r&&"reason"in r}function $g(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function Fg(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function Mg(r){return se(r)&&"code"in r&&"reason"in r}var hp=function(r){Oe(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 ee(function(i){return n.client.subscribe(x(x({},t),{query:Kn(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):Mg(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new fr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(At);var qo="0.12.0";function mp(){return typeof window!="undefined"&&window.self!==window.top}function uu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function dr(r,e){uu()&&localStorage.setItem(`${qo}/${r}`,e)}function Bo(r){return uu()?localStorage.getItem(`${qo}/${r}`):null}function aa(r){uu()&&localStorage.removeItem(`${qo}/${r}`)}function gp(r,e=1e4){return _e(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 bs=function(){return bs=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},bs.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function ns(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ns=function(t){return typeof t}:ns=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ns(r)}function Ug(r){return ns(r)=="object"&&r!==null}var jd=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Ou(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 qg(r){return Ud(r.source,Ou(r.source,r.start))}function Ud(r,e){var t=r.locationOffset.column-1,n=is(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),p=l[i];if(p.length>120){for(var d=Math.floor(c/80),f=c%80,h=[],m=0;m<p.length;m+=80)h.push(p.slice(m,m+80));return u+yp([["".concat(o),h[0]]].concat(h.slice(1,d+1).map(function(v){return["",v]}),[[" ",is(f-1)+"^"],["",h[d+1]]]))}return u+yp([["".concat(o-1),l[i-1]],["".concat(o),p],["",is(c-1)+"^"],["".concat(o+1),l[i+1]]])}function yp(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 Bg(t,i)+(a?" | "+a:" |")}).join(`
53
- `)}function is(r){return Array(r+1).join(" ")}function Bg(r,e){return is(r-e.length)+e}function as(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?as=function(t){return typeof t}:as=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},as(r)}function vp(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 Vg(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vp(Object(t),!0).forEach(function(n){Qg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vp(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Qg(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function zg(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function bp(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 Wg(r,e,t){return e&&bp(r.prototype,e),t&&bp(r,t),r}function Gg(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&&La(r,e)}function Hg(r){var e=Bd();return function(){var n=$a(r),i;if(e){var a=$a(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return qd(this,i)}}function qd(r,e){return e&&(as(e)==="object"||typeof e=="function")?e:la(r)}function la(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Du(r){var e=typeof Map=="function"?new Map:void 0;return Du=function(n){if(n===null||!Kg(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 os(n,arguments,$a(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),La(i,n)},Du(r)}function os(r,e,t){return Bd()?os=Reflect.construct:os=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&La(u,o.prototype),u},os.apply(null,arguments)}function Bd(){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 Kg(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function La(r,e){return La=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},La(r,e)}function $a(r){return $a=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},$a(r)}var Jg=function(r){Gg(t,r);var e=Hg(t);function t(n,i,a,o,s,c,u){var l,p,d,f;zg(this,t),f=e.call(this,n),f.name="GraphQLError",f.originalError=c??void 0,f.nodes=Sp(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,v=(_=f.nodes)!==null&&_!==void 0?_:[];m<v.length;m++){var _,y=v[m],b=y.loc;b!=null&&h.push(b)}h=Sp(h),f.source=a??((l=h)===null||l===void 0?void 0:l[0].source),f.positions=o??((p=h)===null||p===void 0?void 0:p.map(function(A){return A.start})),f.locations=o&&a?o.map(function(A){return Ou(a,A)}):(d=h)===null||d===void 0?void 0:d.map(function(A){return Ou(A.source,A.start)}),f.path=s??void 0;var g=c?.extensions;return u==null&&Ug(g)?f.extensions=Vg({},g):f.extensions=u??{},Object.defineProperties(la(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(la(f),"stack",{value:c.stack,writable:!0,configurable:!0}),qd(f)):(Error.captureStackTrace?Error.captureStackTrace(la(f),t):Object.defineProperty(la(f),"stack",{value:Error().stack,writable:!0,configurable:!0}),f)}return Wg(t,[{key:"toString",value:function(){return Zg(this)}},{key:jd,get:function(){return"Object"}}]),t}(Du(Error));function Sp(r){return r===void 0||r.length===0?void 0:r}function Zg(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+=`
49
+ `)),e=e.replace(/\n$/,""),e},dr=function(r){Oe(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||Cg(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var de;(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"})(de||(de={}));function Pr(r){return r?r<7:!1}var Pg=Object.assign,Lg=Object.hasOwnProperty,Fo=function(r){Oe(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,o=r.call(this,function(b){try{var _=b._subscription._observer;_&&!_.error&&(_.error=$g)}catch{}var v=!o.observers.size;o.observers.add(b);var S=o.last;return S&&S.error?b.error&&b.error(S.error):S&&S.result&&b.next&&b.next(S.result),v&&o.reobserve().catch(function(){}),function(){o.observers.delete(b)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=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,p=a.fetchPolicy,d=p===void 0?l:p,f=a.initialFetchPolicy,h=f===void 0?d==="standby"?l:d:f;o.options=x(x({},a),{initialFetchPolicy:h,fetchPolicy:d}),o.queryId=i.queryId||n.generateQueryId();var m=Ht(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||de.ready,a=x(x({},n),{loading:Pr(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),Ee(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===de.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=de.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&iu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){return!this.last||!Ee(this.last.result,t)||n&&!Ee(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Ee(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&&Lg.call(t,"variables")){var o=Hi(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&L.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((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&&!Ee(this.options.variables,t)&&(i.variables=this.options.variables=x(x({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,de.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=de.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,i,de.fetchMore).then(function(u){return n.queryManager.removeQuery(a),o.networkStatus===de.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var p=t.updateQuery;p?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(d){return p(d,{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)||nu(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__&&L.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 Ee(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},de.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__?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(){t.pollingInfo&&(Pr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},de.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:mo(t),variables:n}),Fe(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,n){var i=this;this.isTornDown=!1;var a=n===de.refetch||n===de.fetchMore||n===de.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Dr(this.options,t||{}),u=a?c:Pg(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ee(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=de.setVariables)));var l=u.variables&&x({},u.variables),p=this.fetch(u,n),d={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=p,this.observer=d),p.addObserver(d),p.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),pn(this.observers,"next",t))},e.prototype.reportError=function(t,n){var i=x(x({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:de.error,loading:!1});this.updateLastResult(i,n),pn(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}(te);yo(Fo);function nu(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__&&L.error("Unhandled error",r.message,r.stack)}function iu(r){__DEV__&&r&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var Mo=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=yc(t.resolvers,n)}):this.resolvers=yc(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 $t(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 Yn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return gc(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={}),$t(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 an}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:mc(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),$t(this,void 0,void 0,function(){var s,c,u,l,p,d,f,h,m,b,_;return Ft(this,function(v){return s=un(e),c=cn(e),u=on(c),l=this.collectSelectionsToResolve(s,u),p=s.operation,d=p?p.charAt(0).toUpperCase()+p.slice(1):"Query",f=this,h=f.cache,m=f.client,b={fragmentMap:u,context:x(x({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:d,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,t,b).then(function(S){return{result:S,exportedVariables:b.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return $t(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Ft(this,function(p){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(d){return $t(l,void 0,void 0,function(){var f,h;return Ft(this,function(m){return!t&&!i.selectionsToResolve.has(d)?[2]:fr(d,s)?vt(d)?[2,this.resolveField(d,t,n,i).then(function(b){var _;typeof b<"u"&&c.push((_={},_[kt(d)]=b,_))})]:(fc(d)?f=d:(f=a[d.name.value],__DEV__?L(f,"No fragment named ".concat(d.name.value)):L(f,11)),f&&f.typeCondition&&(h=f.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(f.selectionSet,t,n,i).then(function(b){c.push(b)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Gi(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return $t(this,void 0,void 0,function(){var a,o,s,c,u,l,p,d,f,h=this;return Ft(this,function(m){return n?(a=i.variables,o=e.name.value,s=kt(e),c=o!==s,u=n[s]||n[o],l=Promise.resolve(u),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(p=n.__typename||i.defaultOperationType,d=this.resolvers&&this.resolvers[p],d&&(f=d[c?o:s],f&&(l=Promise.resolve(ui.withValue(this.cache,f,[n,pr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(b){var _,v;if(b===void 0&&(b=u),e.directives&&e.directives.forEach(function(y){y.name.value==="export"&&y.arguments&&y.arguments.forEach(function(O){O.name.value==="as"&&O.value.kind==="StringValue"&&(i.exportedVariables[O.value.value]=b)})}),!e.selectionSet||b==null)return b;var S=(v=(_=e.directives)===null||_===void 0?void 0:_.some(function(y){return y.name.value==="client"}))!==null&&v!==void 0?v:!1;if(Array.isArray(b))return h.resolveSubSelectedArray(e,t||S,b,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||S,b,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,p,d){c.name.value==="client"&&d.forEach(function(f){n(f)&&Vi(f)&&s.add(f)})},FragmentSpread:function(c,u,l,p,d){var f=t[c.name.value];__DEV__?L(f,"No fragment named ".concat(c.name.value)):L(f,12);var h=a(f);h.size>0&&(d.forEach(function(m){n(m)&&Vi(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},r}();var fi=new(Tt?WeakMap:Map);function au(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return fi.set(r,(fi.get(r)+1)%1e15),t.apply(this,arguments)})}function sp(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Uo=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;fi.has(n)||(fi.set(n,0),au(n,"evict"),au(n,"modify"),au(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||de.loading;return this.variables&&this.networkStatus!==de.loading&&!Ee(this.variables,e.variables)&&(t=de.setVariables),Ee(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(){sp(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ee(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&&!Ee(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():nu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;sp(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(Pr(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||!Ee(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===fi.get(this.cache)&&Ee(t,n.variables)&&Ee(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new lt,s=Fe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Fe(e.incremental)){var c=vo(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&&(jo(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:fi.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var p=a.getDiffOptions(n.variables),d=l.diff(p);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(d,p),d.complete&&(e.data=d.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=de.ready},r.prototype.markError=function(e){return this.networkStatus=de.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function jo(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!ii(r);return!n&&t&&r.data&&(n=!0),n}var Fg=Object.prototype.hasOwnProperty,cp=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,p=l===void 0?{}:l,d=e.localState,f=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Tt?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=p,this.localState=d||new Mo({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!f,(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 K("QueryManager stopped while query was in flight"):new K(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,p=l===void 0?!1:l,d=e.update,f=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,b=e.errorPolicy,_=b===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":b,v=e.keepRootFields,S=e.context;return $t(this,void 0,void 0,function(){var y,O,N,T,C,$;return Ft(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),y=this.generateMutationId(),O=this.transform(i),N=O.document,T=O.hasClientExports,i=this.cache.transformForLink(N),a=this.getVariables(i,a),T?[4,this.localState.addExportedVariables(i,a,S)]:[3,2];case 1:a=P.sent(),P.label=2;case 2:return C=this.mutationStore&&(this.mutationStore[y]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:y,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:S,updateQueries:s,update:d,keepRootFields:v}),this.broadcastQueries(),$=this,[2,new Promise(function(B,xe){return go($.getObservableFromLink(i,x(x({},S),{optimisticResponse:o}),a,!1),function(Te){if(ii(Te)&&_==="none")throw new dr({graphQLErrors:bo(Te)});C&&(C.loading=!1,C.error=null);var k=x({},Te);return typeof u=="function"&&(u=u(k)),_==="ignore"&&ii(k)&&delete k.errors,$.markMutationResult({mutationId:y,result:k,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:S,update:d,updateQueries:s,awaitRefetchQueries:p,refetchQueries:u,removeOptimistic:o?y:void 0,onQueryUpdated:f,keepRootFields:v})}).subscribe({next:function(Te){$.broadcastQueries(),(!("hasNext"in Te)||Te.hasNext===!1)&&B(Te)},error:function(Te){C&&(C.loading=!1,C.error=Te),o&&$.cache.removeOptimistic(y),$.broadcastQueries(),xe(Te instanceof dr?Te:new dr({networkError:Te}))}})})]}})})},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&&jo(i,e.errorPolicy)){if(Or(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Or(i)&&Fe(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=vo(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(p,d){var f=p.observableQuery,h=f&&f.queryName;if(!(!h||!Fg.call(u,h))){var m=u[h],b=n.queries.get(d),_=b.document,v=b.variables,S=t.diff({query:_,variables:v,returnPartialData:!0,optimistic:!1}),y=S.result,O=S.complete;if(O&&y){var N=m(y,{mutationResult:i,queryName:_&&ei(_)||void 0,queryVariables:v});N&&a.push({result:N,dataId:"ROOT_QUERY",query:_,variables:v})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(p){o||a.forEach(function(m){return p.write(m)});var d=e.update,f=!Ql(i)||Or(i)&&!i.hasNext;if(d){if(!o){var h=p.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)}f&&d(p,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&f&&p.modify({id:"ROOT_MUTATION",fields:function(m,b){var _=b.fieldName,v=b.DELETE;return _==="__typename"?m:v}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(p){return l.push(p)}),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__&&L.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=hc(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:sc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:ln(Ht(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 Uo(this),n=new Fo({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__?L(e.query,"query option is required. You must specify your GraphQL document in the query option."):L(e.query,17),__DEV__?L(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):L(e.query.kind==="Document",18),__DEV__?L(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):L(!e.returnPartialData,19),__DEV__?L(!e.pollInterval,"pollInterval option only supported on watchQuery."):L(!e.pollInterval,20),this.fetchQuery(t,e).finally(function(){return 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 K("Store reset while query was in flight (not completed in link chain)"):new K(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=de.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):uc(o)?i.set(t.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,p=c.options.fetchPolicy;if(p==="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=Zi("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new Fo({queryManager:t,queryInfo:c,options:x(x({},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},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(p){return t.getObservableFromLink(n,c,p).map(function(d){if(i!=="no-cache"&&(jo(d,a)&&t.cache.write({query:n,result:d.data,dataId:"ROOT_SUBSCRIPTION",variables:p}),t.broadcastQueries()),ii(d))throw new dr({graphQLErrors:d.errors});return d})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new te(function(p){var d=null;return l.then(function(f){return d=f.subscribe(p)},p.error),function(){return d&&d.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,p=u.link,d={query:c,variables:n,operationName:ei(c)||void 0,context:this.prepareContext(x(x({},t),{forceFetch:!i}))};if(t=d.context,i){var f=l.get(c)||new Map;l.set(c,f);var h=bt(n);if(s=f.get(h),!s){var m=new ni([ai(p,d)]);f.set(h,s=m),m.beforeNext(function(){f.delete(h)&&f.size<1&&l.delete(c)})}}else s=new ni([ai(p,d)])}else s=new ni([te.of({data:{}})]),t=this.prepareContext(t);var b=this.transform(e).clientQuery;return b&&(s=go(s,function(_){return a.localState.runResolvers({document:b,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 go(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=bo(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new dr({graphQLErrors:s}));e.markResult(o,a,n,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:de.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=de.error),u},function(o){var s=op(o)?o:new dr({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,n){var i=this;n===void 0&&(n=de.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,p=t.errorPolicy,d=p===void 0?c&&c.errorPolicy||"none":p,f=t.returnPartialData,h=f===void 0?!1:f,m=t.notifyOnNetworkStatusChange,b=m===void 0?!1:m,_=t.context,v=_===void 0?{}:_,S=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:d,returnPartialData:h,notifyOnNetworkStatusChange:b,context:v}),y=function(T){S.variables=T;var C=i.fetchQueryByPolicy(s,S,n);return S.fetchPolicy!=="standby"&&C.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),C},O=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(T){O(),setTimeout(function(){return N.cancel(T)})});var N=new ni(this.transform(S.query).hasClientExports?this.localState.addExportedVariables(S.query,S.variables,S.context).then(y):y(S.variables));return N.promise.then(O,O),N},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?Zi("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(d,f){l.set(f,{oq:d,lastDiff:t.getQuery(f).getDiff()})});var p=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(d,f,h){var m=d.watcher instanceof Uo&&d.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var b=u(m,f,h);return b===!0&&(b=m.refetch()),b!==!1&&p.set(m,b),b}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:f})}}}),l.size&&l.forEach(function(d,f){var h=d.oq,m=d.lastDiff,b=d.diff,_;if(u){if(!b){var v=h.queryInfo;v.reset(),b=v.getDiff()}_=u(h,b,m)}(!u||_===!0)&&(_=h.refetch()),_!==!1&&p.set(h,_),f.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(f)}),c&&this.cache.removeOptimistic(c),p},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,p=t.context,d=t.notifyOnNetworkStatusChange,f=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},m=function(y,O){O===void 0&&(O=e.networkStatus||de.loading);var N=y.result;__DEV__&&!l&&!Ee(N,{})&&iu(y.missing);var T=function(C){return te.of(x({data:C,loading:Pr(O),networkStatus:O},y.complete?null:{partial:!0}))};return N&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:N},context:p,variables:o,onlyRunForcedResolvers:!0}).then(function(C){return T(C.data||void 0)}):u==="none"&&O===de.refetch&&Array.isArray(y.missing)?T(void 0):T(N)},b=s==="no-cache"?0:n===de.refetch&&c!=="merge"?1:2,_=function(){return i.getResultsFromLink(e,b,{variables:o,context:p,fetchPolicy:s,errorPolicy:u})},v=d&&typeof f=="number"&&f!==n&&Pr(n);switch(s){default:case"cache-first":{var S=h();return S.complete?[m(S,e.markReady())]:l||v?[m(S),_()]:[_()]}case"cache-and-network":{var S=h();return S.complete||l||v?[m(S),_()]:[_()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return v?[m(h()),_()]:[_()];case"no-cache":return v?[m(e.getDiff()),_()]:[_()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new Uo(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 up=!1;var ou=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,p=e.connectToDevTools,d=p===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:p,f=e.queryDeduplication,h=f===void 0?!0:f,m=e.defaultOptions,b=e.assumeImmutableResults,_=b===void 0?!1:b,v=e.resolvers,S=e.typeDefs,y=e.fragmentMatcher,O=e.name,N=e.version,T=e.link;if(T||(T=n?new Pc({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=T,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=S,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!up&&d&&__DEV__&&(up=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var C=window.navigator,$=C&&C.userAgent,P=void 0;typeof $=="string"&&($.indexOf("Chrome/")>-1?P="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":$.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=Gl,this.localState=new Mo({cache:o,client:this,resolvers:v,fragmentMatcher:y}),this.queryManager=new cp({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:O,version:N},localState:this.localState,assumeImmutableResults:_,onBroadcast:d?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=Yi(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=Yi(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=x(x({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Yi(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 ai(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__&&L.debug("In client.refetchQueries, Promise.all promise rejected with error ".concat(o))}),a},r.prototype.getObservableQueries=function(e){return e===void 0&&(e="active"),this.queryManager.getObservableQueries(e)},r.prototype.extract=function(e){return this.cache.extract(e)},r.prototype.restore=function(e){return this.cache.restore(e)},r.prototype.addResolvers=function(e){this.localState.addResolvers(e)},r.prototype.setResolvers=function(e){this.localState.setResolvers(e)},r.prototype.getResolvers=function(){return this.localState.getResolvers()},r.prototype.setLocalStateFragmentMatcher=function(e){this.localState.setFragmentMatcher(e)},r.prototype.setLink=function(e){this.link=this.queryManager.link=e},r}();Sl(nn?"log":"silent");function rt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function hr(r){return rt(r)==="object"}function lp(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function su(r,e){return r.length<124?r:e}var fp="graphql-transport-ws";var ft;(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"})(ft||(ft={}));var Ne;(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"})(Ne||(Ne={}));function pp(r){if(!hr(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 Ne.ConnectionInit:case Ne.ConnectionAck:case Ne.Ping:case Ne.Pong:{if(r.payload!=null&&!hr(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 Ne.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(!hr(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&&!hr(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&&!hr(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 Ne.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(!hr(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${rt(r.payload)}`);break}case Ne.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(!lp(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 Ne.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 dp(r,e){return pp(typeof r=="string"?JSON.parse(r,e):r)}function pi(r,e){return pp(r),JSON.stringify(r,e)}function cu(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 oe=0;oe<ve;oe++)be*=2;await new Promise(oe=>setTimeout(oe,be+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:p=qo,isFatalConnectionProblem:d,on:f,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:b,jsonMessageReviver:_}=r,v;if(h){if(!Ug(h))throw new Error("Invalid WebSocket implementation provided");v=h}else typeof WebSocket<"u"?v=WebSocket:typeof global<"u"?v=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(v=window.WebSocket||window.MozWebSocket);if(!v)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let S=v,y=(()=>{let k=(()=>{let be={};return{on(oe,se){return be[oe]=se,()=>{delete be[oe]}},emit(oe){var se;"id"in oe&&((se=be[oe.id])===null||se===void 0||se.call(be,oe))}}})(),ve={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?[k.emit,f.message]:[k.emit],closed:f?.closed?[f.closed]:[],error:f?.error?[f.error]:[]};return{onMessage:k.on,on(be,oe){let se=ve[be];return se.push(oe),()=>{se.splice(se.indexOf(oe),1)}},emit(be,...oe){for(let se of[...ve[be]])se(...oe)}}})();function O(k){let ve=[y.on("error",be=>{ve.forEach(oe=>oe()),k(be)}),y.on("closed",be=>{ve.forEach(oe=>oe()),k(be)})]}let N,T=0,C,$=!1,P=0,B=!1;async function xe(){clearTimeout(C);let[k,ve]=await(N??(N=new Promise((se,Vt)=>(async()=>{if($){if(await l(P),!T)return N=void 0,Vt({code:1e3,reason:"All Subscriptions Gone"});P++}y.emit("connecting");let ee=new S(typeof e=="function"?await e():e,fp),Qt,xr;function no(){isFinite(o)&&o>0&&(clearTimeout(xr),xr=setTimeout(()=>{ee.readyState===S.OPEN&&(ee.send(pi({type:Ne.Ping})),y.emit("ping",!1,void 0))},o))}O(He=>{N=void 0,clearTimeout(Qt),clearTimeout(xr),Vt(He),qo(He)&&He.code===4499&&(ee.close(4499,"Terminated"),ee.onerror=null,ee.onclose=null)}),ee.onerror=He=>y.emit("error",He),ee.onclose=He=>y.emit("closed",He),ee.onopen=async()=>{try{y.emit("opened",ee);let He=typeof t=="function"?await t():t;if(ee.readyState!==S.OPEN)return;ee.send(pi(He?{type:Ne.ConnectionInit,payload:He}:{type:Ne.ConnectionInit},b)),isFinite(c)&&c>0&&(Qt=setTimeout(()=>{ee.close(ft.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),no()}catch(He){y.emit("error",He),ee.close(ft.InternalClientError,su(He instanceof Error?He.message:new Error(He).message,"Internal client error"))}};let Jn=!1;ee.onmessage=({data:He})=>{try{let Ge=dp(He,_);if(y.emit("message",Ge),Ge.type==="ping"||Ge.type==="pong"){y.emit(Ge.type,!0,Ge.payload),Ge.type==="pong"?no():s||(ee.send(pi(Ge.payload?{type:Ne.Pong,payload:Ge.payload}:{type:Ne.Pong})),y.emit("pong",!1,Ge.payload));return}if(Jn)return;if(Ge.type!==Ne.ConnectionAck)throw new Error(`First message cannot be of type ${Ge.type}`);clearTimeout(Qt),Jn=!0,y.emit("connected",ee,Ge.payload),$=!1,P=0,se([ee,new Promise((xw,Hh)=>O(Hh))])}catch(Ge){ee.onmessage=null,y.emit("error",Ge),ee.close(ft.BadResponse,su(Ge instanceof Error?Ge.message:new Error(Ge).message,"Bad response"))}}})())));k.readyState===S.CLOSING&&await ve;let be=()=>{},oe=new Promise(se=>be=se);return[k,be,Promise.race([oe.then(()=>{if(!T){let se=()=>k.close(1e3,"Normal Closure");isFinite(a)&&a>0?C=setTimeout(()=>{k.readyState===S.OPEN&&se()},a):se()}}),ve])]}function Te(k){if(qo(k)&&(Mg(k.code)||[ft.InternalServerError,ft.InternalClientError,ft.BadRequest,ft.BadResponse,ft.Unauthorized,ft.SubprotocolNotAcceptable,ft.SubscriberAlreadyExists,ft.TooManyInitialisationRequests].includes(k.code)))throw k;if(B)return!1;if(qo(k)&&k.code===1e3)return T>0;if(!u||P>=u||!p(k)||d?.(k))throw k;return $=!0}return n||(async()=>{for(T++;;)try{let[,,k]=await xe();await k}catch(k){try{if(!Te(k))return}catch(ve){return i?.(ve)}}})(),{on:y.on,subscribe(k,ve){let be=m(k),oe=!1,se=!1,Vt=()=>{T--,oe=!0};return(async()=>{for(T++;;)try{let[ee,Qt,xr]=await xe();if(oe)return Qt();let no=y.onMessage(be,Jn=>{switch(Jn.type){case Ne.Next:{ve.next(Jn.payload);return}case Ne.Error:{se=!0,oe=!0,ve.error(Jn.payload),Vt();return}case Ne.Complete:{oe=!0,Vt();return}}});ee.send(pi({id:be,type:Ne.Subscribe,payload:k},b)),Vt=()=>{!oe&&ee.readyState===S.OPEN&&ee.send(pi({id:be,type:Ne.Complete},b)),T--,oe=!0,Qt()},await xr.finally(no);return}catch(ee){if(!Te(ee))return}})().then(()=>{se||ve.complete()}).catch(ee=>{ve.error(ee)}),()=>{oe||Vt()}},async dispose(){if(B=!0,N){let[k]=await N;k.close(1e3,"Normal Closure")}},terminate(){N&&y.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function qo(r){return hr(r)&&"code"in r&&"reason"in r}function Mg(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function Ug(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function jg(r){return ce(r)&&"code"in r&&"reason"in r}var hp=function(r){Oe(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 te(function(i){return n.client.subscribe(x(x({},t),{query:Zn(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):jg(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new dr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(At);var Bo="0.12.1-dev";function mp(){return typeof window!="undefined"&&window.self!==window.top}function uu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function Kt(r,e){uu()&&localStorage.setItem(`${Bo}/${r}`,e)}function oa(r){return uu()?localStorage.getItem(`${Bo}/${r}`):null}function di(r){uu()&&localStorage.removeItem(`${Bo}/${r}`)}function gp(r,e=1e4){return pe(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 bs=function(){return bs=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},bs.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function ns(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ns=function(t){return typeof t}:ns=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ns(r)}function Bg(r){return ns(r)=="object"&&r!==null}var Ud=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function Ou(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 Vg(r){return jd(r.source,Ou(r.source,r.start))}function jd(r,e){var t=r.locationOffset.column-1,n=is(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),p=l[i];if(p.length>120){for(var d=Math.floor(c/80),f=c%80,h=[],m=0;m<p.length;m+=80)h.push(p.slice(m,m+80));return u+yp([["".concat(o),h[0]]].concat(h.slice(1,d+1).map(function(b){return["",b]}),[[" ",is(f-1)+"^"],["",h[d+1]]]))}return u+yp([["".concat(o-1),l[i-1]],["".concat(o),p],["",is(c-1)+"^"],["".concat(o+1),l[i+1]]])}function yp(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 Qg(t,i)+(a?" | "+a:" |")}).join(`
53
+ `)}function is(r){return Array(r+1).join(" ")}function Qg(r,e){return is(r-e.length)+e}function as(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?as=function(t){return typeof t}:as=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},as(r)}function vp(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 Wg(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?vp(Object(t),!0).forEach(function(n){zg(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):vp(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function zg(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function Hg(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function bp(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 Gg(r,e,t){return e&&bp(r.prototype,e),t&&bp(r,t),r}function Kg(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&&$a(r,e)}function Jg(r){var e=Bd();return function(){var n=Fa(r),i;if(e){var a=Fa(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return qd(this,i)}}function qd(r,e){return e&&(as(e)==="object"||typeof e=="function")?e:fa(r)}function fa(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Du(r){var e=typeof Map=="function"?new Map:void 0;return Du=function(n){if(n===null||!Zg(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 os(n,arguments,Fa(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),$a(i,n)},Du(r)}function os(r,e,t){return Bd()?os=Reflect.construct:os=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&$a(u,o.prototype),u},os.apply(null,arguments)}function Bd(){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 Zg(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function $a(r,e){return $a=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},$a(r,e)}function Fa(r){return Fa=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},Fa(r)}var Yg=function(r){Kg(t,r);var e=Jg(t);function t(n,i,a,o,s,c,u){var l,p,d,f;Hg(this,t),f=e.call(this,n),f.name="GraphQLError",f.originalError=c??void 0,f.nodes=Sp(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,b=(_=f.nodes)!==null&&_!==void 0?_:[];m<b.length;m++){var _,v=b[m],S=v.loc;S!=null&&h.push(S)}h=Sp(h),f.source=a??((l=h)===null||l===void 0?void 0:l[0].source),f.positions=o??((p=h)===null||p===void 0?void 0:p.map(function(O){return O.start})),f.locations=o&&a?o.map(function(O){return Ou(a,O)}):(d=h)===null||d===void 0?void 0:d.map(function(O){return Ou(O.source,O.start)}),f.path=s??void 0;var y=c?.extensions;return u==null&&Bg(y)?f.extensions=Wg({},y):f.extensions=u??{},Object.defineProperties(fa(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(fa(f),"stack",{value:c.stack,writable:!0,configurable:!0}),qd(f)):(Error.captureStackTrace?Error.captureStackTrace(fa(f),t):Object.defineProperty(fa(f),"stack",{value:Error().stack,writable:!0,configurable:!0}),f)}return Gg(t,[{key:"toString",value:function(){return Xg(this)}},{key:Ud,get:function(){return"Object"}}]),t}(Du(Error));function Sp(r){return r===void 0||r.length===0?void 0:r}function Xg(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
54
 
55
- `+qg(i.loc))}else if(r.source&&r.locations)for(var a=0,o=r.locations;a<o.length;a++){var s=o[a];e+=`
55
+ `+Vg(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
56
 
57
- `+Ud(r.source,s)}return e}function wt(r,e,t){return new Jg("Syntax Error: ".concat(t),void 0,r,[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 Yg(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Xg=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Nu=Xg;function Vd(r){var e=r.prototype.toJSON;typeof e=="function"||Yg(0),r.prototype.inspect=e,Nu&&(r.prototype[Nu]=e)}var Qd=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}();Vd(Qd);var Pe=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}();Vd(Pe);var R=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 ss(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ss=function(t){return typeof t}:ss=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ss(r)}var ey=10,zd=2;function ty(r){return Bs(r,[])}function Bs(r,e){switch(ss(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":ry(r,e);default:return String(r)}}function ry(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=ay(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:Bs(i,t)}else if(Array.isArray(r))return iy(r,t);return ny(r,t)}function ny(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>zd)return"["+oy(r)+"]";var n=t.map(function(i){var a=Bs(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function iy(r,e){if(r.length===0)return"[]";if(e.length>zd)return"[Array]";for(var t=Math.min(ey,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(Bs(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function ay(r){var e=r[String(Nu)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function oy(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 lu(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var sy=function(e,t){return e instanceof t};function wp(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 cy(r,e,t){return e&&wp(r.prototype,e),t&&wp(r,t),r}var Wd=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"||lu(0,"Body must be a string. Received: ".concat(ty(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||lu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||lu(0,"column in locationOffset is 1-indexed and must be positive.")}return cy(r,[{key:jd,get:function(){return"Source"}}]),r}();function uy(r){return sy(r,Wd)}var ly=Object.freeze({QUERY:"QUERY",MUTATION:"MUTATION",SUBSCRIPTION:"SUBSCRIPTION",FIELD:"FIELD",FRAGMENT_DEFINITION:"FRAGMENT_DEFINITION",FRAGMENT_SPREAD:"FRAGMENT_SPREAD",INLINE_FRAGMENT:"INLINE_FRAGMENT",VARIABLE_DEFINITION:"VARIABLE_DEFINITION",SCHEMA:"SCHEMA",SCALAR:"SCALAR",OBJECT:"OBJECT",FIELD_DEFINITION:"FIELD_DEFINITION",ARGUMENT_DEFINITION:"ARGUMENT_DEFINITION",INTERFACE:"INTERFACE",UNION:"UNION",ENUM:"ENUM",ENUM_VALUE:"ENUM_VALUE",INPUT_OBJECT:"INPUT_OBJECT",INPUT_FIELD_DEFINITION:"INPUT_FIELD_DEFINITION"});function fy(r){var e=r.split(/\r\n|[\n\r]/g),t=py(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&&_p(e[i]);)++i;for(var a=e.length;a>i&&_p(e[a-1]);)--a;return e.slice(i,a).join(`
58
- `)}function _p(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function py(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 dy=function(){function r(t){var n=new Pe(R.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!==R.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=my(this,n)}while(n.kind===R.COMMENT);return n},r}();function hy(r){return r===R.BANG||r===R.DOLLAR||r===R.AMP||r===R.PAREN_L||r===R.PAREN_R||r===R.SPREAD||r===R.COLON||r===R.EQUALS||r===R.AT||r===R.BRACKET_L||r===R.BRACKET_R||r===R.BRACE_L||r===R.PIPE||r===R.BRACE_R}function Tn(r){return isNaN(r)?R.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function my(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 Pe(R.BANG,a,a+1,s,c,e);case 35:return yy(t,a,s,c,e);case 36:return new Pe(R.DOLLAR,a,a+1,s,c,e);case 38:return new Pe(R.AMP,a,a+1,s,c,e);case 40:return new Pe(R.PAREN_L,a,a+1,s,c,e);case 41:return new Pe(R.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Pe(R.SPREAD,a,a+3,s,c,e);break;case 58:return new Pe(R.COLON,a,a+1,s,c,e);case 61:return new Pe(R.EQUALS,a,a+1,s,c,e);case 64:return new Pe(R.AT,a,a+1,s,c,e);case 91:return new Pe(R.BRACKET_L,a,a+1,s,c,e);case 93:return new Pe(R.BRACKET_R,a,a+1,s,c,e);case 123:return new Pe(R.BRACE_L,a,a+1,s,c,e);case 124:return new Pe(R.PIPE,a,a+1,s,c,e);case 125:return new Pe(R.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):by(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 vy(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 _y(t,a,s,c,e)}throw wt(t,a,gy(o))}var u=r.line,l=1+a-r.lineStart;return new Pe(R.EOF,i,i,u,l,e)}function gy(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(Tn(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Tn(r),".")}function yy(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 Pe(R.COMMENT,e,s,t,n,i,a.slice(e+1,s))}function vy(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 wt(r,c,"Invalid number, unexpected digit after 0: ".concat(Tn(s),"."))}else c=fu(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=fu(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=fu(r,c,s),s=o.charCodeAt(c)),s===46||Ey(s))throw wt(r,c,"Invalid number, expected digit but got: ".concat(Tn(s),"."));return new Pe(u?R.FLOAT:R.INT,e,c,n,i,a,o.slice(e,c))}function fu(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 wt(r,i,"Invalid number, expected digit but got: ".concat(Tn(a),"."))}function by(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 Pe(R.STRING,e,o+1,t,n,i,u);if(c<32&&c!==9)throw wt(r,o,"Invalid character within String: ".concat(Tn(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=wy(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var p=a.slice(o+1,o+5);throw wt(r,o,"Invalid character escape sequence: \\u".concat(p,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw wt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw wt(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 Pe(R.BLOCK_STRING,e,s+3,t,n,i,fy(l));if(u<32&&u!==9&&u!==10&&u!==13)throw wt(r,s,"Invalid character within String: ".concat(Tn(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 wt(r,s,"Unterminated string.")}function wy(r,e,t,n){return Vo(r)<<12|Vo(e)<<8|Vo(t)<<4|Vo(n)}function Vo(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function _y(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 Pe(R.NAME,e,s,t,n,i,a.slice(e,s))}function Ey(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function xy(r,e){var t=new ky(r,e);return t.parseDocument()}var ky=function(){function r(t,n){var i=uy(t)?t:new Wd(t);this._lexer=new dy(i),this._options=n}var e=r.prototype;return e.parseName=function(){var n=this.expectToken(R.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(R.SOF,this.parseDefinition,R.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(R.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(R.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(R.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(R.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(R.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(R.PAREN_L,this.parseVariableDefinition,R.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:z.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(R.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(R.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(R.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(R.BRACE_L,this.parseSelection,R.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(R.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(R.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(R.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(R.PAREN_L,i,R.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(R.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(R.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(R.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(R.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 R.BRACKET_L:return this.parseList(n);case R.BRACE_L:return this.parseObject(n);case R.INT:return this._lexer.advance(),{kind:z.INT,value:i.value,loc:this.loc(i)};case R.FLOAT:return this._lexer.advance(),{kind:z.FLOAT,value:i.value,loc:this.loc(i)};case R.STRING:case R.BLOCK_STRING:return this.parseStringLiteral();case R.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 R.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===R.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(R.BRACKET_L,o,R.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(R.BRACE_L,o,R.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(R.COLON),{kind:z.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(R.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(R.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(R.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(R.BRACKET_R),i={kind:z.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(R.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===R.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(R.STRING)||this.peek(R.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(R.BRACE_L,this.parseOperationTypeDefinition,R.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(R.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(R.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(R.AMP)||this.peek(R.NAME));return i}return this.delimitedMany(R.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(R.BRACE_L)&&this._lexer.lookahead().kind===R.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(R.BRACE_L,this.parseFieldDefinition,R.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(R.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(R.PAREN_L,this.parseInputValueDef,R.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(R.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(R.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(R.EQUALS)?this.delimitedMany(R.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(R.BRACE_L,this.parseEnumValueDefinition,R.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(R.BRACE_L,this.parseInputValueDef,R.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===R.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(R.BRACE_L,this.parseOperationTypeDefinition,R.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(R.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(R.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(ly[i.value]!==void 0)return i;throw this.unexpected(n)},e.loc=function(n){var i;if(((i=this._options)===null||i===void 0?void 0:i.noLocation)!==!0)return new Qd(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 wt(this._lexer.source,i.start,"Expected ".concat(Gd(n),", found ").concat(pu(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===R.NAME&&i.value===n)this._lexer.advance();else throw wt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(pu(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===R.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return wt(this._lexer.source,i.start,"Unexpected ".concat(pu(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 pu(r){var e=r.value;return Gd(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function Gd(r){return hy(r)?'"'.concat(r,'"'):r}var cs=new Map,Ru=new Map,Hd=!0,Ss=!1;function Kd(r){return r.replace(/[\s,]+/g," ").trim()}function Iy(r){return Kd(r.source.body.substring(r.start,r.end))}function Ty(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=Iy(n.loc),o=Ru.get(i);o&&!o.has(a)?Hd&&console.warn("Warning: fragment with name "+i+` already exists.
57
+ `+jd(r.source,s)}return e}function wt(r,e,t){return new Yg("Syntax Error: ".concat(t),void 0,r,[e])}var G=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function ey(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var ty=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Nu=ty;function Vd(r){var e=r.prototype.toJSON;typeof e=="function"||ey(0),r.prototype.inspect=e,Nu&&(r.prototype[Nu]=e)}var Qd=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}();Vd(Qd);var Pe=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}();Vd(Pe);var R=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 ss(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?ss=function(t){return typeof t}:ss=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},ss(r)}var ry=10,Wd=2;function ny(r){return Bs(r,[])}function Bs(r,e){switch(ss(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":iy(r,e);default:return String(r)}}function iy(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=sy(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:Bs(i,t)}else if(Array.isArray(r))return oy(r,t);return ay(r,t)}function ay(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Wd)return"["+cy(r)+"]";var n=t.map(function(i){var a=Bs(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function oy(r,e){if(r.length===0)return"[]";if(e.length>Wd)return"[Array]";for(var t=Math.min(ry,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(Bs(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function sy(r){var e=r[String(Nu)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function cy(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 lu(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var uy=function(e,t){return e instanceof t};function wp(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 ly(r,e,t){return e&&wp(r.prototype,e),t&&wp(r,t),r}var zd=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"||lu(0,"Body must be a string. Received: ".concat(ny(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||lu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||lu(0,"column in locationOffset is 1-indexed and must be positive.")}return ly(r,[{key:Ud,get:function(){return"Source"}}]),r}();function fy(r){return uy(r,zd)}var py=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 dy(r){var e=r.split(/\r\n|[\n\r]/g),t=hy(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&&_p(e[i]);)++i;for(var a=e.length;a>i&&_p(e[a-1]);)--a;return e.slice(i,a).join(`
58
+ `)}function _p(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function hy(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 my=function(){function r(t){var n=new Pe(R.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!==R.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=yy(this,n)}while(n.kind===R.COMMENT);return n},r}();function gy(r){return r===R.BANG||r===R.DOLLAR||r===R.AMP||r===R.PAREN_L||r===R.PAREN_R||r===R.SPREAD||r===R.COLON||r===R.EQUALS||r===R.AT||r===R.BRACKET_L||r===R.BRACKET_R||r===R.BRACE_L||r===R.PIPE||r===R.BRACE_R}function Dn(r){return isNaN(r)?R.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function yy(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 Pe(R.BANG,a,a+1,s,c,e);case 35:return by(t,a,s,c,e);case 36:return new Pe(R.DOLLAR,a,a+1,s,c,e);case 38:return new Pe(R.AMP,a,a+1,s,c,e);case 40:return new Pe(R.PAREN_L,a,a+1,s,c,e);case 41:return new Pe(R.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Pe(R.SPREAD,a,a+3,s,c,e);break;case 58:return new Pe(R.COLON,a,a+1,s,c,e);case 61:return new Pe(R.EQUALS,a,a+1,s,c,e);case 64:return new Pe(R.AT,a,a+1,s,c,e);case 91:return new Pe(R.BRACKET_L,a,a+1,s,c,e);case 93:return new Pe(R.BRACKET_R,a,a+1,s,c,e);case 123:return new Pe(R.BRACE_L,a,a+1,s,c,e);case 124:return new Pe(R.PIPE,a,a+1,s,c,e);case 125:return new Pe(R.BRACE_R,a,a+1,s,c,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?_y(t,a,s,c,e,r):wy(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 Sy(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 xy(t,a,s,c,e)}throw wt(t,a,vy(o))}var u=r.line,l=1+a-r.lineStart;return new Pe(R.EOF,i,i,u,l,e)}function vy(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(Dn(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Dn(r),".")}function by(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 Pe(R.COMMENT,e,s,t,n,i,a.slice(e+1,s))}function Sy(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 wt(r,c,"Invalid number, unexpected digit after 0: ".concat(Dn(s),"."))}else c=fu(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=fu(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=fu(r,c,s),s=o.charCodeAt(c)),s===46||Iy(s))throw wt(r,c,"Invalid number, expected digit but got: ".concat(Dn(s),"."));return new Pe(u?R.FLOAT:R.INT,e,c,n,i,a,o.slice(e,c))}function fu(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 wt(r,i,"Invalid number, expected digit but got: ".concat(Dn(a),"."))}function wy(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 Pe(R.STRING,e,o+1,t,n,i,u);if(c<32&&c!==9)throw wt(r,o,"Invalid character within String: ".concat(Dn(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=Ey(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var p=a.slice(o+1,o+5);throw wt(r,o,"Invalid character escape sequence: \\u".concat(p,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw wt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw wt(r,o,"Unterminated string.")}function _y(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 Pe(R.BLOCK_STRING,e,s+3,t,n,i,dy(l));if(u<32&&u!==9&&u!==10&&u!==13)throw wt(r,s,"Invalid character within String: ".concat(Dn(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 wt(r,s,"Unterminated string.")}function Ey(r,e,t,n){return Vo(r)<<12|Vo(e)<<8|Vo(t)<<4|Vo(n)}function Vo(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function xy(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 Pe(R.NAME,e,s,t,n,i,a.slice(e,s))}function Iy(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function ky(r,e){var t=new Ty(r,e);return t.parseDocument()}var Ty=function(){function r(t,n){var i=fy(t)?t:new zd(t);this._lexer=new my(i),this._options=n}var e=r.prototype;return e.parseName=function(){var n=this.expectToken(R.NAME);return{kind:G.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:G.DOCUMENT,definitions:this.many(R.SOF,this.parseDefinition,R.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(R.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(R.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(R.BRACE_L))return{kind:G.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(R.NAME)&&(a=this.parseName()),{kind:G.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(R.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(R.PAREN_L,this.parseVariableDefinition,R.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:G.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(R.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(R.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(R.DOLLAR),{kind:G.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:G.SELECTION_SET,selections:this.many(R.BRACE_L,this.parseSelection,R.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(R.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(R.COLON)?(a=i,o=this.parseName()):o=i,{kind:G.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(R.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(R.PAREN_L,i,R.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(R.COLON),{kind:G.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:G.ARGUMENT,name:this.parseName(),value:(this.expectToken(R.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(R.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(R.NAME)?{kind:G.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:G.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:G.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:G.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 R.BRACKET_L:return this.parseList(n);case R.BRACE_L:return this.parseObject(n);case R.INT:return this._lexer.advance(),{kind:G.INT,value:i.value,loc:this.loc(i)};case R.FLOAT:return this._lexer.advance(),{kind:G.FLOAT,value:i.value,loc:this.loc(i)};case R.STRING:case R.BLOCK_STRING:return this.parseStringLiteral();case R.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:G.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:G.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:G.NULL,loc:this.loc(i)};default:return{kind:G.ENUM,value:i.value,loc:this.loc(i)}}case R.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:G.STRING,value:n.value,block:n.kind===R.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:G.LIST,values:this.any(R.BRACKET_L,o,R.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:G.OBJECT,fields:this.any(R.BRACE_L,o,R.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(R.COLON),{kind:G.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(R.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(R.AT),{kind:G.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(R.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(R.BRACKET_R),i={kind:G.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(R.BANG)?{kind:G.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:G.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===R.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(R.STRING)||this.peek(R.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(R.BRACE_L,this.parseOperationTypeDefinition,R.BRACE_R);return{kind:G.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(R.COLON);var a=this.parseNamedType();return{kind:G.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:G.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:G.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(R.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(R.AMP)||this.peek(R.NAME));return i}return this.delimitedMany(R.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(R.BRACE_L)&&this._lexer.lookahead().kind===R.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(R.BRACE_L,this.parseFieldDefinition,R.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(R.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:G.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:c,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(R.PAREN_L,this.parseInputValueDef,R.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(R.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(R.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:G.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:G.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:G.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(R.EQUALS)?this.delimitedMany(R.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:G.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(R.BRACE_L,this.parseEnumValueDefinition,R.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:G.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:G.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(R.BRACE_L,this.parseInputValueDef,R.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===R.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(R.BRACE_L,this.parseOperationTypeDefinition,R.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:G.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:G.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:G.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:G.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:G.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:G.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:G.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(R.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:G.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(R.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(py[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 Qd(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 wt(this._lexer.source,i.start,"Expected ".concat(Hd(n),", found ").concat(pu(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===R.NAME&&i.value===n)this._lexer.advance();else throw wt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(pu(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===R.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return wt(this._lexer.source,i.start,"Unexpected ".concat(pu(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 pu(r){var e=r.value;return Hd(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function Hd(r){return gy(r)?'"'.concat(r,'"'):r}var cs=new Map,Ru=new Map,Gd=!0,Ss=!1;function Kd(r){return r.replace(/[\s,]+/g," ").trim()}function Ay(r){return Kd(r.source.body.substring(r.start,r.end))}function Oy(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=Ay(n.loc),o=Ru.get(i);o&&!o.has(a)?Gd&&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||Ru.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),bs(bs({},r),{definitions:t})}function Ay(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 Oy(r){var e=Kd(r);if(!cs.has(e)){var t=xy(r,{experimentalFragmentVariables:Ss,allowLegacyFragmentVariables:Ss});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");cs.set(e,Ay(Ty(t)))}return cs.get(e)}function E(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]}),Oy(n)}function Dy(){cs.clear(),Ru.clear()}function Ny(){Hd=!1}function Ry(){Ss=!0}function Cy(){Ss=!1}var oa={gql:E,resetCaches:Dy,disableFragmentWarnings:Ny,enableExperimentalFragmentVariables:Ry,disableExperimentalFragmentVariables:Cy};(function(r){r.gql=oa.gql,r.resetCaches=oa.resetCaches,r.disableFragmentWarnings=oa.disableFragmentWarnings,r.enableExperimentalFragmentVariables=oa.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=oa.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function T(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function Py(){}function Yr(){return Py}var W=Yr,S=Yr,ze=Yr,ue=Yr,Q=Yr,gt=Yr,Ly=Yr,rl=Yr,Jd=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},Zd=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},An=class{constructor(e){this.code=e}};Jd([S(),Zd("design:type",String)],An.prototype,"code",void 0);An=Jd([Q(),Zd("design:paramtypes",[String])],An);var nl=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},il=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},tr=class{constructor(e,t){this.address=e,this.name=t}};nl([S(),il("design:type",String)],tr.prototype,"address",void 0);nl([S(),il("design:type",String)],tr.prototype,"name",void 0);tr=nl([Q(),il("design:paramtypes",[String,String])],tr);var Ie=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},Ue=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Sr=class{constructor(e,t){this.key=t,this.signature=e}};Ie([S(),Ue("design:type",String)],Sr.prototype,"signature",void 0);Ie([S(),Ue("design:type",String)],Sr.prototype,"key",void 0);Ie([S(),Ue("design:type",Boolean)],Sr.prototype,"valid",void 0);Ie([S(),Ue("design:type",Boolean)],Sr.prototype,"invalid",void 0);Sr=Ie([Q(),ze(),Ue("design:paramtypes",[String,String])],Sr);var On=class{};Ie([S(),Ue("design:type",String)],On.prototype,"signature",void 0);Ie([S(),Ue("design:type",String)],On.prototype,"key",void 0);Ie([S(),Ue("design:type",Boolean)],On.prototype,"valid",void 0);Ie([S(),Ue("design:type",Boolean)],On.prototype,"invalid",void 0);On=Ie([ze()],On);function Xr(r){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Ie([S(),Ue("design:type",String)],e.prototype,"author",void 0),Ie([S(),Ue("design:type",String)],e.prototype,"timestamp",void 0),Ie([S(),Ue("design:type",Object)],e.prototype,"data",void 0),Ie([S(),Ue("design:type",Sr)],e.prototype,"proof",void 0),e=Ie([Q(),Ue("design:paramtypes",[String,String,Object,Sr])],e),e}function $y(r){let e=class{};return Ie([S(),Ue("design:type",String)],e.prototype,"author",void 0),Ie([S(),Ue("design:type",String)],e.prototype,"timestamp",void 0),Ie([S(),Ue("design:type",Object)],e.prototype,"data",void 0),Ie([S(),Ue("design:type",On)],e.prototype,"proof",void 0),e=Ie([ze()],e),e}var Ep=class extends Xr(){};Ep=Ie([Q()],Ep);var ws=class extends Xr(){};Ie([S(),Ue("design:type",tr)],ws.prototype,"language",void 0);Ie([S(),Ue("design:type",An)],ws.prototype,"icon",void 0);ws=Ie([Q()],ws);function iT(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)},ht=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};$e([S(),Ze("design:type",String)],ht.prototype,"source",void 0);$e([S(),Ze("design:type",String)],ht.prototype,"target",void 0);$e([S(),Ze("design:type",String)],ht.prototype,"predicate",void 0);ht=$e([Q(),Ze("design:paramtypes",[Object])],ht);var _s=class{};$e([S(),Ze("design:type",Array)],_s.prototype,"additions",void 0);$e([S(),Ze("design:type",Array)],_s.prototype,"removals",void 0);_s=$e([ze()],_s);var Es=class{constructor(e,t){this.additions=e,this.removals=t}};$e([S(),Ze("design:type",Array)],Es.prototype,"additions",void 0);$e([S(),Ze("design:type",Array)],Es.prototype,"removals",void 0);Es=$e([Q(),Ze("design:paramtypes",[Array,Array])],Es);var Fa=class{};$e([S(),Ze("design:type",String)],Fa.prototype,"source",void 0);$e([S(),Ze("design:type",String)],Fa.prototype,"target",void 0);$e([S(),Ze("design:type",String)],Fa.prototype,"predicate",void 0);Fa=$e([ze()],Fa);var Wr=class extends Xr(){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([S(),Ze("design:type",String)],Wr.prototype,"status",void 0);Wr=$e([Q()],Wr);var Cu=class extends $y(){};$e([S(),Ze("design:type",String)],Cu.prototype,"status",void 0);Cu=$e([ze()],Cu);function fT(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 pT(r){return r&&r.source&&r.target}var xs=class{constructor(e,t){this.oldLink=e,this.newLink=t}};$e([S(),Ze("design:type",Wr)],xs.prototype,"oldLink",void 0);$e([S(),Ze("design:type",Wr)],xs.prototype,"newLink",void 0);xs=$e([Q(),Ze("design:paramtypes",[Wr,Wr])],xs);var Un=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},Ja=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Pu,ar=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}};Un([S(),Ja("design:type",Array)],ar.prototype,"links",void 0);ar=Un([Q(),Ja("design:paramtypes",[Array])],ar);var ks=class{};Un([S(),Ja("design:type",Array)],ks.prototype,"links",void 0);ks=Un([ze()],ks);var Lu=Pu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Pu;return t.links.push(e),t}};Un([S(),Ja("design:type",Array)],Lu.prototype,"links",void 0);Lu=Pu=Un([ze(),Ja("design:paramtypes",[Array])],Lu);var Dn=class extends Xr(){};Dn=Un([Q()],Dn);var M=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)},qr=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new ar}};M([S(),U("design:type",String)],qr.prototype,"did",void 0);M([S(),U("design:type",ar)],qr.prototype,"perspective",void 0);M([S(),U("design:type",String)],qr.prototype,"directMessageLanguage",void 0);qr=M([Q(),U("design:paramtypes",[String,ar])],qr);var xp=class extends Xr(){};xp=M([Q()],xp);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}};M([S(),U("design:type",String)],Gr.prototype,"did",void 0);M([S(),U("design:type",String)],Gr.prototype,"didSigningKeyId",void 0);M([S(),U("design:type",String)],Gr.prototype,"deviceKeyType",void 0);M([S(),U("design:type",String)],Gr.prototype,"deviceKey",void 0);M([S(),U("design:type",String)],Gr.prototype,"deviceKeySignedByDid",void 0);M([S(),U("design:type",String)],Gr.prototype,"didSignedByDeviceKey",void 0);Gr=M([Q(),U("design:paramtypes",[String,String,String,String,String,String])],Gr);var Hr=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}};M([S(),U("design:type",String)],Hr.prototype,"did",void 0);M([S(),U("design:type",String)],Hr.prototype,"didSigningKeyId",void 0);M([S(),U("design:type",String)],Hr.prototype,"deviceKeyType",void 0);M([S(),U("design:type",String)],Hr.prototype,"deviceKey",void 0);M([S(),U("design:type",String)],Hr.prototype,"deviceKeySignedByDid",void 0);M([S(),U("design:type",String)],Hr.prototype,"didSignedByDeviceKey",void 0);Hr=M([ze(),U("design:paramtypes",[String,String,String,String,String,String])],Hr);var Is=class{constructor(e,t){this.signature=e,this.publicKey=t}};M([S(),U("design:type",String)],Is.prototype,"signature",void 0);M([S(),U("design:type",String)],Is.prototype,"publicKey",void 0);Is=M([Q(),U("design:paramtypes",[String,String])],Is);var wi=class{constructor(e,t){this.domain=e,this.pointers=t}};M([S(),U("design:type",String)],wi.prototype,"domain",void 0);M([S(),U("design:type",Array)],wi.prototype,"pointers",void 0);wi=M([Q(),U("design:paramtypes",[String,Array])],wi);var Ts=class{constructor(e,t){this.with=e,this.can=t}};M([S(),U("design:type",wi)],Ts.prototype,"with",void 0);M([S(),U("design:type",Array)],Ts.prototype,"can",void 0);Ts=M([Q(),U("design:paramtypes",[wi,Array])],Ts);var wr=class{constructor(e,t,n,i,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};M([S(),U("design:type",String)],wr.prototype,"appName",void 0);M([S(),U("design:type",String)],wr.prototype,"appDesc",void 0);M([S(),U("design:type",String)],wr.prototype,"appUrl",void 0);M([S(),U("design:type",String)],wr.prototype,"appIconPath",void 0);M([S(),U("design:type",Array)],wr.prototype,"capabilities",void 0);wr=M([Q(),U("design:paramtypes",[String,String,String,Array,String])],wr);var _i=class{constructor(e,t,n,i){this.requestId=e,this.auth=t,this.token=n,this.revoked=i}};M([S(),U("design:type",String)],_i.prototype,"requestId",void 0);M([S(),U("design:type",String)],_i.prototype,"token",void 0);M([S(),U("design:type",Boolean)],_i.prototype,"revoked",void 0);M([S(),U("design:type",wr)],_i.prototype,"auth",void 0);_i=M([Q(),U("design:paramtypes",[String,wr,String,Boolean])],_i);var Ei=class{constructor(e,t){this.domain=e,this.pointers=t}};M([S(),U("design:type",String)],Ei.prototype,"domain",void 0);M([S(),U("design:type",Array)],Ei.prototype,"pointers",void 0);Ei=M([ze(),U("design:paramtypes",[String,Array])],Ei);var As=class{constructor(e,t){this.with=e,this.can=t}};M([S(),U("design:type",Ei)],As.prototype,"with",void 0);M([S(),U("design:type",Array)],As.prototype,"can",void 0);As=M([ze(),U("design:paramtypes",[Ei,Array])],As);var or=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}};M([S(),U("design:type",String)],or.prototype,"appName",void 0);M([S(),U("design:type",String)],or.prototype,"appDesc",void 0);M([S(),U("design:type",String)],or.prototype,"appDomain",void 0);M([S(),U("design:type",String)],or.prototype,"appUrl",void 0);M([S(),U("design:type",String)],or.prototype,"appIconPath",void 0);M([S(),U("design:type",Array)],or.prototype,"capabilities",void 0);or=M([ze(),U("design:paramtypes",[String,String,String,String,String,Array])],or);var Nn=class{constructor(e,t,n){this.did=e,this.success=t,this.error=n}};M([S(),U("design:type",String)],Nn.prototype,"did",void 0);M([S(),U("design:type",Boolean)],Nn.prototype,"success",void 0);M([S(),U("design:type",String)],Nn.prototype,"error",void 0);Nn=M([Q(),U("design:paramtypes",[String,Boolean,String])],Nn);var Ci=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},Pi=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,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)}};Ci([S(),Pi("design:type",Boolean)],Nt.prototype,"isInitialized",void 0);Ci([S(),Pi("design:type",Boolean)],Nt.prototype,"isUnlocked",void 0);Ci([S(),Pi("design:type",String)],Nt.prototype,"did",void 0);Ci([S(),Pi("design:type",String)],Nt.prototype,"didDocument",void 0);Ci([S(),Pi("design:type",String)],Nt.prototype,"error",void 0);Nt=Ci([Q(),Pi("design:paramtypes",[Object])],Nt);var kp=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)},ft,pt,$u=class{constructor(e,t){ft.set(this,void 0),pt.set(this,void 0),kp(this,ft,e,"f"),kp(this,pt,t,"f")}async otherAgents(){return await Re(this,ft,"f").otherAgents(Re(this,pt,"f"))}async hasTelepresenceAdapter(){return await Re(this,ft,"f").hasTelepresenceAdapter(Re(this,pt,"f"))}async onlineAgents(){return await Re(this,ft,"f").onlineAgents(Re(this,pt,"f"))}async setOnlineStatus(e){return await Re(this,ft,"f").setOnlineStatus(Re(this,pt,"f"),e)}async setOnlineStatusU(e){return await Re(this,ft,"f").setOnlineStatusU(Re(this,pt,"f"),e)}async sendSignal(e,t){return await Re(this,ft,"f").sendSignal(Re(this,pt,"f"),e,t)}async sendSignalU(e,t){return await Re(this,ft,"f").sendSignalU(Re(this,pt,"f"),e,t)}async sendBroadcast(e,t=!1){return await Re(this,ft,"f").sendBroadcast(Re(this,pt,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Re(this,ft,"f").sendBroadcastU(Re(this,pt,"f"),e,t)}async addSignalHandler(e){await Re(this,ft,"f").addSignalHandler(Re(this,pt,"f"),e)}removeSignalHandler(e){Re(this,ft,"f").removeSignalHandler(Re(this,pt,"f"),e)}};ft=new WeakMap,pt=new WeakMap;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},Bn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},fe=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)}};qn([S(),Bn("design:type",String)],fe.prototype,"source",void 0);qn([S(),Bn("design:type",String)],fe.prototype,"target",void 0);qn([S(),Bn("design:type",String)],fe.prototype,"predicate",void 0);qn([S(),Bn("design:type",Date)],fe.prototype,"fromDate",void 0);qn([S(),Bn("design:type",Date)],fe.prototype,"untilDate",void 0);qn([S(),Bn("design:type",Number)],fe.prototype,"limit",void 0);fe=qn([Q(),ze(),Bn("design:paramtypes",[Object])],fe);var Ip=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},Ke=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,mr;function Qo(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var be=class{constructor(){dt.set(this,void 0),mr.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 be;return Ip(t,mr,e,"f"),t}static from(e){let t=new be;return Ip(t,dt,e,"f"),t}toUrl(){if(Ke(this,mr,"f")&&!Ke(this,dt,"f"))return Ke(this,mr,"f");if(!Ke(this,mr,"f")&&(Ke(this,dt,"f")===void 0||Ke(this,dt,"f")===""||Ke(this,dt,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Ke(this,dt,"f")){case"string":e=`string:${Qo(Ke(this,dt,"f"))}`;break;case"number":e=`number:${Qo(Ke(this,dt,"f"))}`;break;case"boolean":e=`boolean:${Qo(Ke(this,dt,"f"))}`;break;case"object":e=`json:${Qo(JSON.stringify(Ke(this,dt,"f")))}`;break}return`literal://${e}`}get(){if(Ke(this,dt,"f"))return Ke(this,dt,"f");if(!Ke(this,mr,"f"))throw new Error("Can't render empty Literal");if(!Ke(this,mr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Ke(this,mr,"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,mr=new WeakMap;function st(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Vs(r){return`set${st(r)}`}function Yd(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function Fy(r){return`add${st(Yd(r))}`}function My(r){return`remove${st(Yd(r))}`}function jy(r){return`set${st(r)}`}function Xd(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 dn(r){if(Array.isArray(r))return`[${r.map(dn).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 du=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)},nt,it,Ce,Da=class{constructor(r,e,t){nt.set(this,void 0),it.set(this,void 0),Ce.set(this,void 0),du(this,nt,e,"f"),du(this,it,t,"f"),du(this,Ce,r,"f")}get baseExpression(){return J(this,nt,"f")}async init(){let isInstance=await J(this,Ce,"f").isSubjectInstance(J(this,nt,"f"),J(this,it,"f"));if(!isInstance)throw`Not a valid subject instance of ${J(this,it,"f")} for ${J(this,nt,"f")}`;let results=await J(this,Ce,"f").infer(`subject_class("${J(this,it,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await J(this,Ce,"f").infer(`subject_class("${J(this,it,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await J(this,Ce,"f").getPropertyValueViaSurreal(J(this,nt,"f"),J(this,it,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await J(this,Ce,"f").infer(`subject_class("${J(this,it,"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,Ce,"f").infer(`subject_class("${J(this,it,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Vs(property)]=async r=>{resolveLanguage&&(r=await J(this,Ce,"f").createExpression(r,resolveLanguage)),await J(this,Ce,"f").executeAction(actions,J(this,nt,"f"),[{name:"value",value:r}])}}let results2=await J(this,Ce,"f").infer(`subject_class("${J(this,it,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(r=>r.Collection);for(let r of relations)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await J(this,Ce,"f").getRelationValuesViaSurreal(J(this,nt,"f"),J(this,it,"f"),r)}catch(e){return console.warn(`Failed to get relation ${r} via SurrealDB:`,e),[]}}});let adders=await J(this,Ce,"f").infer(`subject_class("${J(this,it,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[Fy(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,Ce,"f").executeAction(actions,J(this,nt,"f"),[{name:"value",value:e}]))):await J(this,Ce,"f").executeAction(actions,J(this,nt,"f"),[{name:"value",value:r}])}}let removers=await J(this,Ce,"f").infer(`subject_class("${J(this,it,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[My(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,Ce,"f").executeAction(actions,J(this,nt,"f"),[{name:"value",value:e}]))):await J(this,Ce,"f").executeAction(actions,J(this,nt,"f"),[{name:"value",value:r}])}}let relationSetters=await J(this,Ce,"f").infer(`subject_class("${J(this,it,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[jy(relation)]=async r=>{Array.isArray(r)?await J(this,Ce,"f").executeAction(actions,J(this,nt,"f"),r.map(e=>({name:"value",value:e}))):await J(this,Ce,"f").executeAction(actions,J(this,nt,"f"),[{name:"value",value:r}])}}}};nt=new WeakMap,it=new WeakMap,Ce=new WeakMap;function Uy(r,e,t,n){let i="",a=Xd(8);i+=`subject_class("${r}", ${a}).
61
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Ru.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),bs(bs({},r),{definitions:t})}function Dy(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 Ny(r){var e=Kd(r);if(!cs.has(e)){var t=ky(r,{experimentalFragmentVariables:Ss,allowLegacyFragmentVariables:Ss});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");cs.set(e,Dy(Oy(t)))}return cs.get(e)}function E(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]}),Ny(n)}function Ry(){cs.clear(),Ru.clear()}function Cy(){Gd=!1}function Py(){Ss=!0}function Ly(){Ss=!1}var sa={gql:E,resetCaches:Ry,disableFragmentWarnings:Cy,enableExperimentalFragmentVariables:Py,disableExperimentalFragmentVariables:Ly};(function(r){r.gql=sa.gql,r.resetCaches=sa.resetCaches,r.disableFragmentWarnings=sa.disableFragmentWarnings,r.enableExperimentalFragmentVariables=sa.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=sa.disableExperimentalFragmentVariables})(E||(E={}));E.default=E;function I(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 tn(){return $y}var V=tn,w=tn,We=tn,X=tn,H=tn,ze=tn,Fy=tn,rl=tn,Jd=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},Zd=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Nn=class{constructor(e){this.code=e}};Jd([w(),Zd("design:type",String)],Nn.prototype,"code",void 0);Nn=Jd([H(),Zd("design:paramtypes",[String])],Nn);var nl=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},il=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},nr=class{constructor(e,t){this.address=e,this.name=t}};nl([w(),il("design:type",String)],nr.prototype,"address",void 0);nl([w(),il("design:type",String)],nr.prototype,"name",void 0);nr=nl([H(),il("design:paramtypes",[String,String])],nr);var ke=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},je=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},wr=class{constructor(e,t){this.key=t,this.signature=e}};ke([w(),je("design:type",String)],wr.prototype,"signature",void 0);ke([w(),je("design:type",String)],wr.prototype,"key",void 0);ke([w(),je("design:type",Boolean)],wr.prototype,"valid",void 0);ke([w(),je("design:type",Boolean)],wr.prototype,"invalid",void 0);wr=ke([H(),We(),je("design:paramtypes",[String,String])],wr);var Rn=class{};ke([w(),je("design:type",String)],Rn.prototype,"signature",void 0);ke([w(),je("design:type",String)],Rn.prototype,"key",void 0);ke([w(),je("design:type",Boolean)],Rn.prototype,"valid",void 0);ke([w(),je("design:type",Boolean)],Rn.prototype,"invalid",void 0);Rn=ke([We()],Rn);function rn(r){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return ke([w(),je("design:type",String)],e.prototype,"author",void 0),ke([w(),je("design:type",String)],e.prototype,"timestamp",void 0),ke([w(),je("design:type",Object)],e.prototype,"data",void 0),ke([w(),je("design:type",wr)],e.prototype,"proof",void 0),e=ke([H(),je("design:paramtypes",[String,String,Object,wr])],e),e}function My(r){let e=class{};return ke([w(),je("design:type",String)],e.prototype,"author",void 0),ke([w(),je("design:type",String)],e.prototype,"timestamp",void 0),ke([w(),je("design:type",Object)],e.prototype,"data",void 0),ke([w(),je("design:type",Rn)],e.prototype,"proof",void 0),e=ke([We()],e),e}var Ep=class extends rn(){};Ep=ke([H()],Ep);var ws=class extends rn(){};ke([w(),je("design:type",nr)],ws.prototype,"language",void 0);ke([w(),je("design:type",Nn)],ws.prototype,"icon",void 0);ws=ke([H()],ws);function cT(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},Ye=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},mt=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};$e([w(),Ye("design:type",String)],mt.prototype,"source",void 0);$e([w(),Ye("design:type",String)],mt.prototype,"target",void 0);$e([w(),Ye("design:type",String)],mt.prototype,"predicate",void 0);mt=$e([H(),Ye("design:paramtypes",[Object])],mt);var _s=class{};$e([w(),Ye("design:type",Array)],_s.prototype,"additions",void 0);$e([w(),Ye("design:type",Array)],_s.prototype,"removals",void 0);_s=$e([We()],_s);var Es=class{constructor(e,t){this.additions=e,this.removals=t}};$e([w(),Ye("design:type",Array)],Es.prototype,"additions",void 0);$e([w(),Ye("design:type",Array)],Es.prototype,"removals",void 0);Es=$e([H(),Ye("design:paramtypes",[Array,Array])],Es);var Ma=class{};$e([w(),Ye("design:type",String)],Ma.prototype,"source",void 0);$e([w(),Ye("design:type",String)],Ma.prototype,"target",void 0);$e([w(),Ye("design:type",String)],Ma.prototype,"predicate",void 0);Ma=$e([We()],Ma);var Gr=class extends rn(){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([w(),Ye("design:type",String)],Gr.prototype,"status",void 0);Gr=$e([H()],Gr);var Cu=class extends My(){};$e([w(),Ye("design:type",String)],Cu.prototype,"status",void 0);Cu=$e([We()],Cu);function mT(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 gT(r){return r&&r.source&&r.target}var xs=class{constructor(e,t){this.oldLink=e,this.newLink=t}};$e([w(),Ye("design:type",Gr)],xs.prototype,"oldLink",void 0);$e([w(),Ye("design:type",Gr)],xs.prototype,"newLink",void 0);xs=$e([H(),Ye("design:paramtypes",[Gr,Gr])],xs);var Bn=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},Za=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Pu,sr=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}};Bn([w(),Za("design:type",Array)],sr.prototype,"links",void 0);sr=Bn([H(),Za("design:paramtypes",[Array])],sr);var Is=class{};Bn([w(),Za("design:type",Array)],Is.prototype,"links",void 0);Is=Bn([We()],Is);var Lu=Pu=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Pu;return t.links.push(e),t}};Bn([w(),Za("design:type",Array)],Lu.prototype,"links",void 0);Lu=Pu=Bn([We(),Za("design:paramtypes",[Array])],Lu);var Cn=class extends rn(){};Cn=Bn([H()],Cn);var q=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},W=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Vr=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new sr}};q([w(),W("design:type",String)],Vr.prototype,"did",void 0);q([w(),W("design:type",sr)],Vr.prototype,"perspective",void 0);q([w(),W("design:type",String)],Vr.prototype,"directMessageLanguage",void 0);Vr=q([H(),W("design:paramtypes",[String,sr])],Vr);var xp=class extends rn(){};xp=q([H()],xp);var Kr=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}};q([w(),W("design:type",String)],Kr.prototype,"did",void 0);q([w(),W("design:type",String)],Kr.prototype,"didSigningKeyId",void 0);q([w(),W("design:type",String)],Kr.prototype,"deviceKeyType",void 0);q([w(),W("design:type",String)],Kr.prototype,"deviceKey",void 0);q([w(),W("design:type",String)],Kr.prototype,"deviceKeySignedByDid",void 0);q([w(),W("design:type",String)],Kr.prototype,"didSignedByDeviceKey",void 0);Kr=q([H(),W("design:paramtypes",[String,String,String,String,String,String])],Kr);var Jr=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}};q([w(),W("design:type",String)],Jr.prototype,"did",void 0);q([w(),W("design:type",String)],Jr.prototype,"didSigningKeyId",void 0);q([w(),W("design:type",String)],Jr.prototype,"deviceKeyType",void 0);q([w(),W("design:type",String)],Jr.prototype,"deviceKey",void 0);q([w(),W("design:type",String)],Jr.prototype,"deviceKeySignedByDid",void 0);q([w(),W("design:type",String)],Jr.prototype,"didSignedByDeviceKey",void 0);Jr=q([We(),W("design:paramtypes",[String,String,String,String,String,String])],Jr);var ks=class{constructor(e,t){this.signature=e,this.publicKey=t}};q([w(),W("design:type",String)],ks.prototype,"signature",void 0);q([w(),W("design:type",String)],ks.prototype,"publicKey",void 0);ks=q([H(),W("design:paramtypes",[String,String])],ks);var xi=class{constructor(e,t){this.domain=e,this.pointers=t}};q([w(),W("design:type",String)],xi.prototype,"domain",void 0);q([w(),W("design:type",Array)],xi.prototype,"pointers",void 0);xi=q([H(),W("design:paramtypes",[String,Array])],xi);var Ts=class{constructor(e,t){this.with=e,this.can=t}};q([w(),W("design:type",xi)],Ts.prototype,"with",void 0);q([w(),W("design:type",Array)],Ts.prototype,"can",void 0);Ts=q([H(),W("design:paramtypes",[xi,Array])],Ts);var _r=class{constructor(e,t,n,i,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};q([w(),W("design:type",String)],_r.prototype,"appName",void 0);q([w(),W("design:type",String)],_r.prototype,"appDesc",void 0);q([w(),W("design:type",String)],_r.prototype,"appUrl",void 0);q([w(),W("design:type",String)],_r.prototype,"appIconPath",void 0);q([w(),W("design:type",Array)],_r.prototype,"capabilities",void 0);_r=q([H(),W("design:paramtypes",[String,String,String,Array,String])],_r);var Ii=class{constructor(e,t,n,i){this.requestId=e,this.auth=t,this.token=n,this.revoked=i}};q([w(),W("design:type",String)],Ii.prototype,"requestId",void 0);q([w(),W("design:type",String)],Ii.prototype,"token",void 0);q([w(),W("design:type",Boolean)],Ii.prototype,"revoked",void 0);q([w(),W("design:type",_r)],Ii.prototype,"auth",void 0);Ii=q([H(),W("design:paramtypes",[String,_r,String,Boolean])],Ii);var ki=class{constructor(e,t){this.domain=e,this.pointers=t}};q([w(),W("design:type",String)],ki.prototype,"domain",void 0);q([w(),W("design:type",Array)],ki.prototype,"pointers",void 0);ki=q([We(),W("design:paramtypes",[String,Array])],ki);var As=class{constructor(e,t){this.with=e,this.can=t}};q([w(),W("design:type",ki)],As.prototype,"with",void 0);q([w(),W("design:type",Array)],As.prototype,"can",void 0);As=q([We(),W("design:paramtypes",[ki,Array])],As);var cr=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}};q([w(),W("design:type",String)],cr.prototype,"appName",void 0);q([w(),W("design:type",String)],cr.prototype,"appDesc",void 0);q([w(),W("design:type",String)],cr.prototype,"appDomain",void 0);q([w(),W("design:type",String)],cr.prototype,"appUrl",void 0);q([w(),W("design:type",String)],cr.prototype,"appIconPath",void 0);q([w(),W("design:type",Array)],cr.prototype,"capabilities",void 0);cr=q([We(),W("design:paramtypes",[String,String,String,String,String,Array])],cr);var Pn=class{constructor(e,t,n){this.did=e,this.success=t,this.error=n}};q([w(),W("design:type",String)],Pn.prototype,"did",void 0);q([w(),W("design:type",Boolean)],Pn.prototype,"success",void 0);q([w(),W("design:type",String)],Pn.prototype,"error",void 0);Pn=q([H(),W("design:paramtypes",[String,Boolean,String])],Pn);var Pi=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)},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)}};Pi([w(),Li("design:type",Boolean)],Nt.prototype,"isInitialized",void 0);Pi([w(),Li("design:type",Boolean)],Nt.prototype,"isUnlocked",void 0);Pi([w(),Li("design:type",String)],Nt.prototype,"did",void 0);Pi([w(),Li("design:type",String)],Nt.prototype,"didDocument",void 0);Pi([w(),Li("design:type",String)],Nt.prototype,"error",void 0);Nt=Pi([H(),Li("design:paramtypes",[Object])],Nt);var Ip=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,dt,$u=class{constructor(e,t){pt.set(this,void 0),dt.set(this,void 0),Ip(this,pt,e,"f"),Ip(this,dt,t,"f")}async otherAgents(){return await Re(this,pt,"f").otherAgents(Re(this,dt,"f"))}async hasTelepresenceAdapter(){return await Re(this,pt,"f").hasTelepresenceAdapter(Re(this,dt,"f"))}async onlineAgents(){return await Re(this,pt,"f").onlineAgents(Re(this,dt,"f"))}async setOnlineStatus(e){return await Re(this,pt,"f").setOnlineStatus(Re(this,dt,"f"),e)}async setOnlineStatusU(e){return await Re(this,pt,"f").setOnlineStatusU(Re(this,dt,"f"),e)}async sendSignal(e,t){return await Re(this,pt,"f").sendSignal(Re(this,dt,"f"),e,t)}async sendSignalU(e,t){return await Re(this,pt,"f").sendSignalU(Re(this,dt,"f"),e,t)}async sendBroadcast(e,t=!1){return await Re(this,pt,"f").sendBroadcast(Re(this,dt,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Re(this,pt,"f").sendBroadcastU(Re(this,dt,"f"),e,t)}async addSignalHandler(e){await Re(this,pt,"f").addSignalHandler(Re(this,dt,"f"),e)}removeSignalHandler(e){Re(this,pt,"f").removeSignalHandler(Re(this,dt,"f"),e)}};pt=new WeakMap,dt=new WeakMap;var 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},Qn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},fe=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)}};Vn([w(),Qn("design:type",String)],fe.prototype,"source",void 0);Vn([w(),Qn("design:type",String)],fe.prototype,"target",void 0);Vn([w(),Qn("design:type",String)],fe.prototype,"predicate",void 0);Vn([w(),Qn("design:type",Date)],fe.prototype,"fromDate",void 0);Vn([w(),Qn("design:type",Date)],fe.prototype,"untilDate",void 0);Vn([w(),Qn("design:type",Number)],fe.prototype,"limit",void 0);fe=Vn([H(),We(),Qn("design:paramtypes",[Object])],fe);var kp=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)},ht,gr;function Qo(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Se=class{constructor(){ht.set(this,void 0),gr.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 Se;return kp(t,gr,e,"f"),t}static from(e){let t=new Se;return kp(t,ht,e,"f"),t}toUrl(){if(Je(this,gr,"f")&&!Je(this,ht,"f"))return Je(this,gr,"f");if(!Je(this,gr,"f")&&(Je(this,ht,"f")===void 0||Je(this,ht,"f")===""||Je(this,ht,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Je(this,ht,"f")){case"string":e=`string:${Qo(Je(this,ht,"f"))}`;break;case"number":e=`number:${Qo(Je(this,ht,"f"))}`;break;case"boolean":e=`boolean:${Qo(Je(this,ht,"f"))}`;break;case"object":e=`json:${Qo(JSON.stringify(Je(this,ht,"f")))}`;break}return`literal://${e}`}get(){if(Je(this,ht,"f"))return Je(this,ht,"f");if(!Je(this,gr,"f"))throw new Error("Can't render empty Literal");if(!Je(this,gr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Je(this,gr,"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}`)}};ht=new WeakMap,gr=new WeakMap;function ct(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Vs(r){return`set${ct(r)}`}function Yd(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function Uy(r){return`add${ct(Yd(r))}`}function jy(r){return`remove${ct(Yd(r))}`}function qy(r){return`set${ct(r)}`}function Xd(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 gn(r){if(Array.isArray(r))return`[${r.map(gn).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 du=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,Ce,Na=class{constructor(r,e,t){it.set(this,void 0),at.set(this,void 0),Ce.set(this,void 0),du(this,it,e,"f"),du(this,at,t,"f"),du(this,Ce,r,"f")}get baseExpression(){return J(this,it,"f")}async init(){let isInstance=await J(this,Ce,"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,Ce,"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,Ce,"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,Ce,"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,Ce,"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,Ce,"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[Vs(property)]=async r=>{resolveLanguage&&(r=await J(this,Ce,"f").createExpression(r,resolveLanguage)),await J(this,Ce,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:r}])}}let results2=await J(this,Ce,"f").infer(`subject_class("${J(this,at,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let relations=results2.map(r=>r.Collection);for(let r of relations)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await J(this,Ce,"f").getRelationValuesViaSurreal(J(this,it,"f"),J(this,at,"f"),r)}catch(e){return console.warn(`Failed to get relation ${r} via SurrealDB:`,e),[]}}});let adders=await J(this,Ce,"f").infer(`subject_class("${J(this,at,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let relation=adder.Collection,actions=eval(adder.Adder);this[Uy(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,Ce,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:e}]))):await J(this,Ce,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:r}])}}let removers=await J(this,Ce,"f").infer(`subject_class("${J(this,at,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let relation=remover.Collection,actions=eval(remover.Remover);this[jy(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>J(this,Ce,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:e}]))):await J(this,Ce,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:r}])}}let relationSetters=await J(this,Ce,"f").infer(`subject_class("${J(this,at,"f")}", C), collection_setter(C, Collection, Setter)`);relationSetters||(relationSetters=[]);for(let relationSetter of relationSetters)if(relationSetter){let relation=relationSetter.Collection,actions=eval(relationSetter.Setter);this[qy(relation)]=async r=>{Array.isArray(r)?await J(this,Ce,"f").executeAction(actions,J(this,it,"f"),r.map(e=>({name:"value",value:e}))):await J(this,Ce,"f").executeAction(actions,J(this,it,"f"),[{name:"value",value:r}])}}}};it=new WeakMap,at=new WeakMap,Ce=new WeakMap;function By(r,e,t,n){let i="",a=Xd(8);i+=`subject_class("${r}", ${a}).
62
62
  `;let o=[],s=[];e.subjectConstructor&&e.subjectConstructor.length&&(s=s.concat(e.subjectConstructor));let c=[];e.isSubjectInstance&&e.isSubjectInstance.length&&(c=c.concat(e.isSubjectInstance));let u=[];for(let f in t){let h=`property(${a}, "${f}").
63
- `,{through:m,initial:v,required:_,resolveLanguage:y,writable:b,flag:g,prologGetter:A,prologSetter:N,local:I}=t[f];if(y&&(h+=`property_resolve(${a}, "${f}").
64
- `,h+=`property_resolve_language(${a}, "${f}", "${y}").
65
- `),A?h+=`property_getter(${a}, Base, "${f}", Value) :- ${A}.
63
+ `,{through:m,initial:b,required:_,resolveLanguage:v,writable:S,flag:y,prologGetter:O,prologSetter:N,local:T}=t[f];if(v&&(h+=`property_resolve(${a}, "${f}").
64
+ `,h+=`property_resolve_language(${a}, "${f}", "${v}").
65
+ `),O?h+=`property_getter(${a}, Base, "${f}", Value) :- ${O}.
66
66
  `:m&&(h+=`property_getter(${a}, Base, "${f}", Value) :- triple(Base, "${m}", Value).
67
- `,_&&(g?c.push(`triple(Base, "${m}", "${v}")`):c.push(`triple(Base, "${m}", _)`))),N)h+=`property_setter(${a}, "${f}", Actions) :- ${N}.
68
- `;else if(b&&m&&typeof e[Vs(f)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:m,target:"value",...I&&{local:!0}}];h+=`property_setter(${a}, "${f}", '${dn(P)}').
69
- `}u.push(h);let C=v??(_&&b&&!g&&m?"literal://string:":void 0);C&&(s.push({action:"addLink",source:"this",predicate:m,target:C}),o.push({action:"removeLink",source:"this",predicate:m,target:"*"}))}let l=[],p=Object.fromEntries(Object.entries(n).filter(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany"));for(let f in p){let h=`collection(${a}, "${f}").
70
- `,{predicate:m,local:v}=p[f];if(m){h+=`collection_getter(${a}, Base, "${f}", List) :- findall(C, triple(Base, "${m}", C), List).
71
- `;let _=[{action:"addLink",source:"this",predicate:m,target:"value",...v&&{local:!0}}],y=[{action:"removeLink",source:"this",predicate:m,target:"value"}],b=[{action:"collectionSetter",source:"this",predicate:m,target:"value",...v&&{local:!0}}];h+=`collection_adder(${a}, "${f}", '${dn(_)}').
72
- `,h+=`collection_remover(${a}, "${f}", '${dn(y)}').
73
- `,h+=`collection_setter(${a}, "${f}", '${dn(b)}').
74
- `}l.push(h)}let d=dn(s);if(i+=`constructor(${a}, '${d}').
67
+ `,_&&(y?c.push(`triple(Base, "${m}", "${b}")`):c.push(`triple(Base, "${m}", _)`))),N)h+=`property_setter(${a}, "${f}", Actions) :- ${N}.
68
+ `;else if(S&&m&&typeof e[Vs(f)]=="function"){let P=[{action:"setSingleTarget",source:"this",predicate:m,target:"value",...T&&{local:!0}}];h+=`property_setter(${a}, "${f}", '${gn(P)}').
69
+ `}u.push(h);let C=b??(_&&S&&!y&&m?"literal://string:":void 0);C&&(s.push({action:"addLink",source:"this",predicate:m,target:C}),o.push({action:"removeLink",source:"this",predicate:m,target:"*"}))}let l=[],p=Object.fromEntries(Object.entries(n).filter(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany"));for(let f in p){let h=`collection(${a}, "${f}").
70
+ `,{predicate:m,local:b}=p[f];if(m){h+=`collection_getter(${a}, Base, "${f}", List) :- findall(C, triple(Base, "${m}", C), List).
71
+ `;let _=[{action:"addLink",source:"this",predicate:m,target:"value",...b&&{local:!0}}],v=[{action:"removeLink",source:"this",predicate:m,target:"value"}],S=[{action:"collectionSetter",source:"this",predicate:m,target:"value",...b&&{local:!0}}];h+=`collection_adder(${a}, "${f}", '${gn(_)}').
72
+ `,h+=`collection_remover(${a}, "${f}", '${gn(v)}').
73
+ `,h+=`collection_setter(${a}, "${f}", '${gn(S)}').
74
+ `}l.push(h)}let d=gn(s);if(i+=`constructor(${a}, '${d}').
75
75
  `,c.length>0){let f=c.join(", ");i+=`instance(${a}, Base) :- ${f}.
76
76
  `,i+=`
77
- `}return i+=`destructor(${a}, '${dn(o)}').
77
+ `}return i+=`destructor(${a}, '${gn(o)}').
78
78
  `,i+=`
79
79
  `,i+=u.join(`
80
80
  `),i+=`
81
81
  `,i+=l.join(`
82
- `),{sdna:i,name:r}}function Tp(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 Ap(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 Op(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 Br=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let n=Tp(e),i=Op(e);this.nodeShapeUri=`${n}${i}Shape`}this.properties=[],this.parentShapes=[]}addParentShape(e){this.parentShapes.includes(e)||this.parentShapes.push(e)}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#> .
82
+ `),{sdna:i,name:r}}function Tp(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 Ap(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 Op(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=Tp(e),i=Op(e);this.nodeShapeUri=`${n}${i}Shape`}this.properties=[],this.parentShapes=[]}addParentShape(e){this.parentShapes.includes(e)||this.parentShapes.push(e)}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#> .
83
83
  `;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
84
84
  `,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
85
85
  `,e+=`@prefix ad4m: <ad4m://> .
@@ -103,18 +103,18 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
103
103
  `),e=e.slice(0,-2)+`
104
104
  `,e+=i?` ] .
105
105
  `:` ] ;
106
- `}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&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&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=Tp(this.targetClass),o=Op(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)}`}),n.getter&&e.push({source:i,predicate:"ad4m://getter",target:`literal://string:${n.getter}`}),n.conformanceConditions&&n.conformanceConditions.length>0&&e.push({source:i,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(n.conformanceConditions)}`}),n.class&&e.push({source:i,predicate:"sh://class",target:n.class})}return e}static fromLinks(e,t){let n=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),i=new Br(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(k=>k.source===u&&k.predicate==="sh://path");if(!l)continue;let p;if(!u.startsWith("_:")){let k=u.lastIndexOf(".");k!==-1&&(p=u.substring(k+1))}let d={name:p,path:l.target},f=e.find(k=>k.source===u&&k.predicate==="sh://datatype");f&&(d.datatype=f.target);let h=e.find(k=>k.source===u&&k.predicate==="sh://nodeKind");h&&(d.nodeKind=h.target.replace("sh://",""));let m=e.find(k=>k.source===u&&k.predicate==="sh://minCount");if(m){let k=m.target.replace("literal://","").replace(/\^\^.*$/,"");k.startsWith("number:")&&(k=k.substring(7)),d.minCount=parseInt(k)}let v=e.find(k=>k.source===u&&k.predicate==="sh://maxCount");if(v){let k=v.target.replace("literal://","").replace(/\^\^.*$/,"");k.startsWith("number:")&&(k=k.substring(7)),d.maxCount=parseInt(k)}let _=e.find(k=>k.source===u&&k.predicate==="sh://pattern");_&&(d.pattern=_.target.replace("literal://",""));let y=e.find(k=>k.source===u&&k.predicate==="sh://minInclusive");if(y){let k=y.target.replace("literal://","");k.startsWith("number:")&&(k=k.substring(7)),d.minInclusive=parseFloat(k)}let b=e.find(k=>k.source===u&&k.predicate==="sh://maxInclusive");if(b){let k=b.target.replace("literal://","");k.startsWith("number:")&&(k=k.substring(7)),d.maxInclusive=parseFloat(k)}let g=e.find(k=>k.source===u&&k.predicate==="sh://hasValue");g&&(d.hasValue=g.target.replace("literal://",""));let A=e.find(k=>k.source===u&&k.predicate==="ad4m://local");if(A){let k=A.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),d.local=k==="true"}let N=e.find(k=>k.source===u&&k.predicate==="ad4m://writable");if(N){let k=N.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),d.writable=k==="true"}let I=e.find(k=>k.source===u&&k.predicate==="ad4m://resolveLanguage");I&&(d.resolveLanguage=I.target.replace("literal://string:",""));let C=e.find(k=>k.source===u&&k.predicate==="ad4m://setter");if(C)try{let k=C.target.replace("literal://string:","");d.setter=JSON.parse(k)}catch{}let $=e.find(k=>k.source===u&&k.predicate==="ad4m://adder");if($)try{let k=$.target.replace("literal://string:","");d.adder=JSON.parse(k)}catch{}let P=e.find(k=>k.source===u&&k.predicate==="ad4m://remover");if(P)try{let k=P.target.replace("literal://string:","");d.remover=JSON.parse(k)}catch{}let j=e.find(k=>k.source===u&&k.predicate==="ad4m://getter");j&&(d.getter=j.target.replace("literal://string:",""));let xe=e.find(k=>k.source===u&&k.predicate==="ad4m://conformanceConditions");if(xe)try{let k=xe.target.replace("literal://string:","");d.conformanceConditions=JSON.parse(k)}catch{}let Te=e.find(k=>k.source===u&&k.predicate==="sh://class");Te&&(d.class=Te.target),i.addProperty(d)}return i}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,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,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new Br(e.node_shape_uri,e.target_class):new Br(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,getter:n.getter,conformanceConditions:n.conformance_conditions,class:n.class});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let n of e.parent_shapes)t.addParentShape(n);return t}};function Dp(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 CT(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`${Dp(e)} your ${t} actions, with access to ${Dp(n)}`}function ne(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function ge(r){return typeof r=="string"?`'${r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof r=="number"||typeof r=="boolean"?String(r):Array.isArray(r)?`[${r.map(e=>ge(e)).join(", ")}]`:String(r)}function qy(r,e,t){let n=ne(r),i=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(o=>ge(o)).join(", ");return`count(->link[WHERE predicate = '${n}' AND ${i} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,o=[];if(a.not!==void 0)if(Array.isArray(a.not)){let c=a.not.map(u=>ge(u)).join(", ");o.push(`count(->link[WHERE predicate = '${n}' AND ${i} IN [${c}]]) = 0`)}else o.push(`count(->link[WHERE predicate = '${n}' AND ${i} = ${ge(a.not)}]) = 0`);return(a.gt!==void 0||a.gte!==void 0||a.lt!==void 0||a.lte!==void 0||a.between!==void 0||a.contains!==void 0)&&o.push(`count(->link[WHERE predicate = '${n}']) > 0`),o.join(" AND ")}else return`count(->link[WHERE predicate = '${n}' AND ${i} = ${ge(e)}]) > 0`}function eh(r,e){let t=[];for(let[n,i]of Object.entries(r)){if(["id","author","timestamp"].includes(n))continue;let a,o;if(e){let c=e.properties[n];c?(a=c.predicate,o=c.resolveLanguage):a=n}else a=n;let s=qy(a,i,{resolveLanguage:o});s&&t.push(s)}return t}function By(r,e,t,n,i){let a=e.prototype,o="ad4m://",s=Object.fromEntries(Object.entries(n).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));if(Object.keys(t).length>0){let h=t[Object.keys(t)[0]];if(h.through){let m=h.through.match(/^([^:]+:\/\/)/);m&&(o=m[1])}}else if(Object.keys(s).length>0){let h=s[Object.keys(s)[0]];if(h.predicate){let m=h.predicate.match(/^([^:]+:\/\/)/);m&&(o=m[1])}}let c=`${o}${r}Shape`,u=`${o}${r}`,l=new Br(c,u),p=Object.getPrototypeOf(e);if(p&&typeof p.generateSHACL=="function"){let h=p.generateSHACL();h?.shape?.nodeShapeUri&&l.addParentShape(h.shape.nodeShapeUri)}let d=[];a.subjectConstructor&&a.subjectConstructor.length&&(d=d.concat(a.subjectConstructor));let f=[];for(let h in t){let m=t[h];if(!m.through)continue;let v={name:h,path:m.through};if(m.resolveLanguage==="literal")v.datatype="xsd://string";else if(m.initial){let y=typeof a[h];y==="number"?v.datatype="xsd://integer":y==="boolean"?v.datatype="xsd://boolean":y==="string"&&(v.datatype="xsd://string")}m.required&&(v.minCount=1),v.maxCount=1,m.flag&&m.initial&&(v.hasValue=m.initial),m.local!==void 0&&(v.local=m.local),m.writable!==void 0&&(v.writable=m.writable),m.resolveLanguage&&(v.resolveLanguage=m.resolveLanguage),m.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${h}' in class '${r}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):m.writable&&m.through&&typeof a[Vs(h)]=="function"&&(v.setter=[{action:"setSingleTarget",source:"this",predicate:m.through,target:"value",...m.local&&{local:!0}}]);let _=m.initial??(m.required&&m.writable&&!m.flag&&m.through?"literal://string:":void 0);_&&(d.push({action:"addLink",source:"this",predicate:m.through,target:_}),f.push({action:"removeLink",source:"this",predicate:m.through,target:"*"})),l.addProperty(v)}for(let h in s){let m=s[h];if(!m.predicate)continue;let v={name:h,path:m.predicate};if(v.nodeKind="IRI",m.local!==void 0&&(v.local=m.local),v.adder=[{action:"addLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],v.remover=[{action:"removeLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],m.getter)v.getter=m.getter;else if(m.where)try{let _=m.target?.(),y=_?_.getModelMetadata?.()??null:null,b=eh(m.where,y);if(b.length>0){let g=ne(m.predicate);v.getter=`(->link[WHERE predicate = '${g}'].out[WHERE ${b.join(" AND ")}].uri)`}}catch{}else if(m.target&&m.filter!==!1)try{let _=m.target(),y=i(m.predicate,_);y&&(v.getter=y.getter,v.conformanceConditions=y.conformanceConditions)}catch{}if(m.target)try{let y=m.target().generateSHACL?.();y?.shape?.nodeShapeUri&&(v.class=y.shape.nodeShapeUri)}catch{}l.addProperty(v)}return l.setConstructorActions(d),l.setDestructorActions(f),{shape:l,name:r}}var rr=new WeakMap,et=new WeakMap;function Rn(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=rr.get(i);a&&Object.assign(e,a)}return e}function Yt(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=et.get(i);a&&Object.assign(e,a)}return e}function Vy(r,e,t){rr.has(r)||rr.set(r,{}),rr.get(r)[e]=t}function Qy(r,e,t){et.has(r)||et.set(r,{}),et.get(r)[e]=t}function th(r,e){try{let t=Rn(e),n=[],i=[];for(let[s,c]of Object.entries(t))c.flag&&c.initial&&c.through&&(n.push({type:"flag",predicate:c.through,value:c.initial}),i.push(`count(->link[WHERE predicate = '${ne(c.through)}' AND out.uri = '${ne(c.initial)}']) > 0`));for(let[s,c]of Object.entries(t))c.required&&!c.flag&&!c.getter&&c.through&&(n.push({type:"required",predicate:c.through}),i.push(`count(->link[WHERE predicate = '${ne(c.through)}']) > 0`));return n.length===0?void 0:{getter:`(->link[WHERE predicate = '${ne(r)}'].out[WHERE ${i.join(" AND ")}].uri)`,conformanceConditions:n}}catch{return}}function Qs(r){return function(e,t){let n=r.readOnly?!1:!!r.through;if(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");let i=e.constructor;if(rr.has(i)||rr.set(i,{}),rr.get(i)[t]={...r,writable:n},n){let a=t;e[`set${st(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function PT(r){return Qs({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function LT(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");let n={through:r.through,required:!0,initial:r.value,flag:!0,readOnly:!0,writable:!1},i=e.constructor;rr.has(i)||rr.set(i,{}),rr.get(i)[t]=n,e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function zy(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){return Uy(r.name,e.prototype,Rn(e),Yt(e))},e.generateSHACL=function(){return By(r.name,e,Rn(e),Yt(e),th)},Object.defineProperty(e,"type",{configurable:!0})}}function Wy(r){let e=r.required??!1;return Qs({...r,required:e,readOnly:r.readOnly??!1,resolveLanguage:r.resolveLanguage??"literal",initial:r.initial??(e?"literal://string:uninitialized":void 0)})}function $T(r){return Wy({...r,readOnly:!0})}function zs(r,e){let t=typeof r=="function"?{...e||{},target:r}:r;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw SurrealQL.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function FT(r,e){let t=zs(r,e);return function(n,i){let a=n.constructor;et.has(a)||et.set(a,{});let o=et.get(a);o[i]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let s=i;t.through&&(n[`add${st(s)}`]=async function(c,u){return this.addRelationValue(s,c,u)},n[`remove${st(s)}`]=async function(c,u){return this.removeRelationValue(s,c,u)},n[`set${st(s)}`]=async function(c,u){return this.setRelationValues(s,c,u)}),Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function MT(r,e){let t=zs(r,e);return function(n,i){let a=n.constructor;et.has(a)||et.set(a,{});let o=et.get(a);o[i]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let s=i;t.through?(Qs({through:t.through,readOnly:!1,local:t.local})(n,i),n[`add${st(s)}`]=async function(c){return this.addRelationValue(s,c)},n[`remove${st(s)}`]=async function(c){return this.removeRelationValue(s,c)},n[`set${st(s)}`]=async function(c){return this.setRelationValues(s,c)}):Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function jT(r,e){let t=zs(r,e);return function(n,i){let a=n.constructor;et.has(a)||et.set(a,{});let o=et.get(a);o[i]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?Qs({through:t.through,readOnly:!0,local:t.local})(n,i):Object.defineProperty(n,i,{configurable:!0,writable:!0})}}function UT(r,e){let t=zs(r,e);return function(n,i){let a=n.constructor;et.has(a)||et.set(a,{});let o=et.get(a);o[i]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(n,i,{configurable:!0,writable:!0})}}var xi=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:be.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:be.from(n.name).toUrl()}),e.push({source:i,predicate:"ad4m://stateValue",target:be.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:be.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 xi(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 p=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),d=new Map;for(let h of p){let m=h.target,v=e.find(N=>N.source===m&&N.predicate==="ad4m://stateName"),_=v?be.fromUrl(v.target).get():"";d.set(m,_);let y=e.find(N=>N.source===m&&N.predicate==="ad4m://stateValue"),b=y?be.fromUrl(y.target).get():0,g=e.find(N=>N.source===m&&N.predicate==="ad4m://stateCheck"),A={predicate:"",target:""};if(g)try{let N=g.target.replace("literal://string:","");A=JSON.parse(decodeURIComponent(N))}catch{}c.addState({name:_,value:b,stateCheck:A})}let f=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of f){let m=h.target,v=e.find(P=>P.source===m&&P.predicate==="ad4m://actionName"),_=v?be.fromUrl(v.target).get():"",b=e.find(P=>P.source===m&&P.predicate==="ad4m://fromState")?.target||"",g=d.get(b)||"",N=e.find(P=>P.source===m&&P.predicate==="ad4m://toState")?.target||"",I=d.get(N)||"",C=e.find(P=>P.source===m&&P.predicate==="ad4m://transitionActions"),$=[];if(C)try{let P=C.target.replace("literal://string:","");$=JSON.parse(decodeURIComponent(P))}catch{}c.addTransition({actionName:_,fromState:g,toState:I,actions:$})}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 xi(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}},he=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)},us,gr,Kt,Jt,_n,$r,Fr,hn,fa,ls,mn,gn,Ot,yi,Fu,ce,le,yn,vn,bn,pa,Os=class{constructor(e,t,n){us.add(this),gr.set(this,void 0),Kt.set(this,void 0),Jt.set(this,void 0),_n.set(this,void 0),$r.set(this,void 0),Fr.set(this,void 0),hn.set(this,void 0),fa.set(this,!1),ls.set(this,void 0),mn.set(this,void 0),gn.set(this,void 0),Ot.set(this,void 0),yi.set(this,void 0),this.isSurrealDB=!1,he(this,gr,e,"f"),he(this,yi,t,"f"),he(this,Jt,n,"f"),he(this,_n,new Set,"f"),he(this,hn,null,"f"),he(this,ls,new Promise((i,a)=>{he(this,mn,i,"f"),he(this,gn,a,"f")}),"f")}async subscribe(){O(this,Fr,"f")&&(O(this,Fr,"f").call(this),he(this,Fr,void 0,"f")),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),he(this,Ot,void 0,"f")),O(this,$r,"f")&&(clearTimeout(O(this,$r,"f")),he(this,$r,void 0,"f"));try{let t;this.isSurrealDB?t=await O(this,Jt,"f").perspectiveSubscribeSurrealQuery(O(this,gr,"f"),O(this,yi,"f")):t=await O(this,Jt,"f").subscribeQuery(O(this,gr,"f"),O(this,yi,"f")),he(this,Kt,t.subscriptionId,"f"),t.result?(he(this,hn,t.result,"f"),O(this,us,"m",Fu).call(this,t.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,O(this,Jt,"f").subscribeToQueryUpdates(O(this,Kt,"f"),n=>{O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),he(this,Ot,void 0,"f")),O(this,mn,"f")&&(O(this,mn,"f").call(this,!0),he(this,mn,void 0,"f"),he(this,gn,void 0,"f")),!(n.isInit&&O(this,hn,"f"))&&(he(this,hn,n,"f"),O(this,us,"m",Fu).call(this,n))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,gn,"f")&&(O(this,gn,"f").call(this,t),he(this,mn,void 0,"f"),he(this,gn,void 0,"f")),t}let e=async()=>{if(!O(this,fa,"f")){try{this.isSurrealDB?await O(this,Jt,"f").perspectiveKeepAliveSurrealQuery(O(this,gr,"f"),O(this,Kt,"f")):await O(this,Jt,"f").keepAliveQuery(O(this,gr,"f"),O(this,Kt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,yi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,fa,"f")||he(this,$r,setTimeout(e,3e4),"f")}};he(this,$r,setTimeout(e,3e4),"f")}get id(){return O(this,Kt,"f")}get initialized(){return O(this,ls,"f")}get result(){return O(this,hn,"f")}onResult(e){return O(this,_n,"f").add(e),()=>O(this,_n,"f").delete(e)}dispose(){he(this,fa,!0,"f"),clearTimeout(O(this,$r,"f")),O(this,Fr,"f")&&O(this,Fr,"f").call(this),O(this,_n,"f").clear(),O(this,Ot,"f")&&(clearTimeout(O(this,Ot,"f")),he(this,Ot,void 0,"f")),O(this,Kt,"f")&&(this.isSurrealDB?O(this,Jt,"f").perspectiveDisposeSurrealQuerySubscription(O(this,gr,"f"),O(this,Kt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,Jt,"f").disposeQuerySubscription(O(this,gr,"f"),O(this,Kt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};gr=new WeakMap,Kt=new WeakMap,Jt=new WeakMap,_n=new WeakMap,$r=new WeakMap,Fr=new WeakMap,hn=new WeakMap,fa=new WeakMap,ls=new WeakMap,mn=new WeakMap,gn=new WeakMap,Ot=new WeakMap,yi=new WeakMap,us=new WeakSet,Fu=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 bi=class{constructor(e,t){ce.set(this,void 0),le.set(this,void 0),yn.set(this,void 0),vn.set(this,void 0),bn.set(this,void 0),pa.set(this,void 0),he(this,yn,[],"f"),he(this,vn,[],"f"),he(this,bn,[],"f"),he(this,pa,[],"f"),he(this,ce,e,"f"),he(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,yn,"f")),O(this,le,"f").addPerspectiveLinkRemovedListener(O(this,ce,"f").uuid,O(this,vn,"f")),O(this,le,"f").addPerspectiveLinkUpdatedListener(O(this,ce,"f").uuid,O(this,bn,"f")),O(this,le,"f").addPerspectiveSyncStateChangeListener(O(this,ce,"f").uuid,O(this,pa,"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,yn,"f").push(t):e==="link-removed"?O(this,vn,"f").push(t):e==="link-updated"&&O(this,bn,"f").push(t)}async addSyncStateChangeListener(e){O(this,pa,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let n=O(this,yn,"f").indexOf(t);O(this,yn,"f").splice(n,1)}else if(e==="link-removed"){let n=O(this,vn,"f").indexOf(t);O(this,vn,"f").splice(n,1)}else if(e==="link-updated"){let n=O(this,bn,"f").indexOf(t);O(this,bn,"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 fe({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 fe({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return be.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 fe({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 fe({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 fe({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 fe({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 fe({source:"ad4m://self",predicate:n}));for(let a of i){let o=a.data.target,s=await this.get(new fe({source:o,predicate:"ad4m://sdna"}));for(let c of s){let u=be.fromUrl(c.data.target).get();typeof u=="string"&&t.push(u)}}}return t}async getSdnaForClass(e){let t=be.from(e);if((await this.get(new fe({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new fe({source:t.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let a=be.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=be.fromUrl(`literal://string:shacl://${e}`),a=[...n.map(o=>new ht({source:o.source,predicate:o.predicate,target:o.target})),new ht({source:"ad4m://self",predicate:"ad4m://has_shacl",target:i.toUrl()}),new ht({source:i.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=be.fromUrl(`literal://string:shacl://${e}`),n=await this.get(new fe({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(n.length===0)return null;let i=n[0].data.target;ne(i);let a=await this.get(new fe({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(p=>p.data.target)].map(p=>`'${ne(p)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(p=>({source:p.source,predicate:p.predicate,target:p.target}));return Br.fromLinks(l,i)}async getAllShacl(){let e=await this.get(new fe({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let n of e){let i=n.data.target,o=be.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=be.from(e).toUrl(),a=[...n.map(o=>new ht({source:o.source,predicate:o.predicate,target:o.target})),new ht({source:"ad4m://self",predicate:"ad4m://has_flow",target:i}),new ht({source:i,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=be.from(e).toUrl(),n=await this.get(new fe({source:t,predicate:"ad4m://flow_uri"}));if(n.length===0)return null;let i=n[0].data.target,a=ne(i),o=i.endsWith("Flow")?i.slice(0,-4)+".":i+".",s=ne(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(p=>({source:p.source,predicate:p.predicate,target:p.target}));return xi.fromLinks(l,i)}async subjectClasses(){try{let t=(await this.get(new fe({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 fe({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 = '${ne(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=ne(e),s=ne(a.predicate),c;if(a.target){let d=ne(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${d}'`}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 Da(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,relations: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=ne(n.predicate);if(n.target){let a=ne(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=ne(e),s=ne(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 p=await this.getExpression(l);try{return JSON.parse(p.data)}catch{return p.data}}catch{return l}return l}async getRelationValuesViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return[];let a=i.relations.get(n);if(!a)return[];let o=ne(e),s=ne(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(p=>p.value).filter(p=>p!==""&&p!=="");if(a.condition&&l.length>0)try{let p=[];for(let d of l){let f=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${d.replace(/'/g,"\\'")}'`);f.trim().startsWith("WHERE")&&(f=`array::len(SELECT * FROM link ${f}) > 0`);let h=await this.querySurrealDB(`RETURN ${f}`);(h===!0||Array.isArray(h)&&h.length>0&&h[0]===!0)&&p.push(d)}l=p}catch(p){console.warn(`Failed to apply condition filter for ${n}:`,p)}if(a.instanceFilter)try{let p=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return p?await this.batchCheckSubjectInstances(l,p):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=>`'${ne(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=>`'${ne(l)}'`).join(", "),s=ne(a.predicate),c;if(a.target){let l=ne(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 Da(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 Da(this,c.base,i);await u.init(),n.push(u)}catch{}}}return n}async findClassByProperties(e){let t=[],n=[],a=Object.getPrototypeOf(e)?.constructor,o=a?Rn(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(p=>!Array.isArray(e[p]));let s=a?Object.fromEntries(Object.entries(Yt(a)).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany")):{};if(Object.keys(s).length>0?n=Object.keys(s).filter(p=>p!=="isSubjectInstance"):n=Object.keys(e).filter(p=>Array.isArray(e[p])&&p!=="isSubjectInstance"),t.length===0&&n.length===0)return null;let c=`SELECT
106
+ `}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&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&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=Tp(this.targetClass),o=Op(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)}`}),n.getter&&e.push({source:i,predicate:"ad4m://getter",target:`literal://string:${n.getter}`}),n.conformanceConditions&&n.conformanceConditions.length>0&&e.push({source:i,predicate:"ad4m://conformanceConditions",target:`literal://string:${JSON.stringify(n.conformanceConditions)}`}),n.class&&e.push({source:i,predicate:"sh://class",target:n.class})}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(k=>k.source===u&&k.predicate==="sh://path");if(!l)continue;let p;if(!u.startsWith("_:")){let k=u.lastIndexOf(".");k!==-1&&(p=u.substring(k+1))}let d={name:p,path:l.target},f=e.find(k=>k.source===u&&k.predicate==="sh://datatype");f&&(d.datatype=f.target);let h=e.find(k=>k.source===u&&k.predicate==="sh://nodeKind");h&&(d.nodeKind=h.target.replace("sh://",""));let m=e.find(k=>k.source===u&&k.predicate==="sh://minCount");if(m){let k=m.target.replace("literal://","").replace(/\^\^.*$/,"");k.startsWith("number:")&&(k=k.substring(7)),d.minCount=parseInt(k)}let b=e.find(k=>k.source===u&&k.predicate==="sh://maxCount");if(b){let k=b.target.replace("literal://","").replace(/\^\^.*$/,"");k.startsWith("number:")&&(k=k.substring(7)),d.maxCount=parseInt(k)}let _=e.find(k=>k.source===u&&k.predicate==="sh://pattern");_&&(d.pattern=_.target.replace("literal://",""));let v=e.find(k=>k.source===u&&k.predicate==="sh://minInclusive");if(v){let k=v.target.replace("literal://","");k.startsWith("number:")&&(k=k.substring(7)),d.minInclusive=parseFloat(k)}let S=e.find(k=>k.source===u&&k.predicate==="sh://maxInclusive");if(S){let k=S.target.replace("literal://","");k.startsWith("number:")&&(k=k.substring(7)),d.maxInclusive=parseFloat(k)}let y=e.find(k=>k.source===u&&k.predicate==="sh://hasValue");y&&(d.hasValue=y.target.replace("literal://",""));let O=e.find(k=>k.source===u&&k.predicate==="ad4m://local");if(O){let k=O.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),d.local=k==="true"}let N=e.find(k=>k.source===u&&k.predicate==="ad4m://writable");if(N){let k=N.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),d.writable=k==="true"}let T=e.find(k=>k.source===u&&k.predicate==="ad4m://resolveLanguage");T&&(d.resolveLanguage=T.target.replace("literal://string:",""));let C=e.find(k=>k.source===u&&k.predicate==="ad4m://setter");if(C)try{let k=C.target.replace("literal://string:","");d.setter=JSON.parse(k)}catch{}let $=e.find(k=>k.source===u&&k.predicate==="ad4m://adder");if($)try{let k=$.target.replace("literal://string:","");d.adder=JSON.parse(k)}catch{}let P=e.find(k=>k.source===u&&k.predicate==="ad4m://remover");if(P)try{let k=P.target.replace("literal://string:","");d.remover=JSON.parse(k)}catch{}let B=e.find(k=>k.source===u&&k.predicate==="ad4m://getter");B&&(d.getter=B.target.replace("literal://string:",""));let xe=e.find(k=>k.source===u&&k.predicate==="ad4m://conformanceConditions");if(xe)try{let k=xe.target.replace("literal://string:","");d.conformanceConditions=JSON.parse(k)}catch{}let Te=e.find(k=>k.source===u&&k.predicate==="sh://class");Te&&(d.class=Te.target),i.addProperty(d)}return i}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,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,getter:e.getter,conformance_conditions:e.conformanceConditions,class:e.class})),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,getter:n.getter,conformanceConditions:n.conformance_conditions,class:n.class});if(e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),e.parent_shapes)for(let n of e.parent_shapes)t.addParentShape(n);return t}};function Dp(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 FT(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`${Dp(e)} your ${t} actions, with access to ${Dp(n)}`}function ie(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function ye(r){return typeof r=="string"?`'${r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof r=="number"||typeof r=="boolean"?String(r):Array.isArray(r)?`[${r.map(e=>ye(e)).join(", ")}]`:String(r)}function Vy(r,e,t){let n=ie(r),i=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(o=>ye(o)).join(", ");return`count(->link[WHERE predicate = '${n}' AND ${i} IN [${a}]]) > 0`}else if(typeof e=="object"&&e!==null){let a=e,o=[];if(a.not!==void 0)if(Array.isArray(a.not)){let c=a.not.map(u=>ye(u)).join(", ");o.push(`count(->link[WHERE predicate = '${n}' AND ${i} IN [${c}]]) = 0`)}else o.push(`count(->link[WHERE predicate = '${n}' AND ${i} = ${ye(a.not)}]) = 0`);return(a.gt!==void 0||a.gte!==void 0||a.lt!==void 0||a.lte!==void 0||a.between!==void 0||a.contains!==void 0)&&o.push(`count(->link[WHERE predicate = '${n}']) > 0`),o.join(" AND ")}else return`count(->link[WHERE predicate = '${n}' AND ${i} = ${ye(e)}]) > 0`}function eh(r,e){let t=[];for(let[n,i]of Object.entries(r)){if(["id","author","timestamp"].includes(n))continue;let a,o;if(e){let c=e.properties[n];c?(a=c.predicate,o=c.resolveLanguage):a=n}else a=n;let s=Vy(a,i,{resolveLanguage:o});s&&t.push(s)}return t}function Qy(r,e,t,n,i){let a=e.prototype,o="ad4m://",s=Object.fromEntries(Object.entries(n).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));if(Object.keys(t).length>0){let h=t[Object.keys(t)[0]];if(h.through){let m=h.through.match(/^([^:]+:\/\/)/);m&&(o=m[1])}}else if(Object.keys(s).length>0){let h=s[Object.keys(s)[0]];if(h.predicate){let m=h.predicate.match(/^([^:]+:\/\/)/);m&&(o=m[1])}}let c=`${o}${r}Shape`,u=`${o}${r}`,l=new Qr(c,u),p=Object.getPrototypeOf(e);if(p&&typeof p.generateSHACL=="function"){let h=p.generateSHACL();h?.shape?.nodeShapeUri&&l.addParentShape(h.shape.nodeShapeUri)}let d=[];a.subjectConstructor&&a.subjectConstructor.length&&(d=d.concat(a.subjectConstructor));let f=[];for(let h in t){let m=t[h];if(!m.through)continue;let b={name:h,path:m.through};if(m.resolveLanguage==="literal")b.datatype="xsd://string";else if(m.initial){let v=typeof a[h];v==="number"?b.datatype="xsd://integer":v==="boolean"?b.datatype="xsd://boolean":v==="string"&&(b.datatype="xsd://string")}m.required&&(b.minCount=1),b.maxCount=1,m.flag&&m.initial&&(b.hasValue=m.initial),m.local!==void 0&&(b.local=m.local),m.writable!==void 0&&(b.writable=m.writable),m.resolveLanguage&&(b.resolveLanguage=m.resolveLanguage),m.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${h}' in class '${r}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):m.writable&&m.through&&typeof a[Vs(h)]=="function"&&(b.setter=[{action:"setSingleTarget",source:"this",predicate:m.through,target:"value",...m.local&&{local:!0}}]);let _=m.initial??(m.required&&m.writable&&!m.flag&&m.through?"literal://string:":void 0);_&&(d.push({action:"addLink",source:"this",predicate:m.through,target:_}),f.push({action:"removeLink",source:"this",predicate:m.through,target:"*"})),l.addProperty(b)}for(let h in s){let m=s[h];if(!m.predicate)continue;let b={name:h,path:m.predicate};if(b.nodeKind="IRI",m.local!==void 0&&(b.local=m.local),b.adder=[{action:"addLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],b.remover=[{action:"removeLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],m.getter)b.getter=m.getter;else if(m.where)try{let _=m.target?.(),v=_?_.getModelMetadata?.()??null:null,S=eh(m.where,v);if(S.length>0){let y=ie(m.predicate);b.getter=`(->link[WHERE predicate = '${y}'].out[WHERE ${S.join(" AND ")}].uri)`}}catch{}else if(m.target&&m.filter!==!1)try{let _=m.target(),v=i(m.predicate,_);v&&(b.getter=v.getter,b.conformanceConditions=v.conformanceConditions)}catch{}if(m.target)try{let v=m.target().generateSHACL?.();v?.shape?.nodeShapeUri&&(b.class=v.shape.nodeShapeUri)}catch{}l.addProperty(b)}return l.setConstructorActions(d),l.setDestructorActions(f),{shape:l,name:r}}var ir=new WeakMap,tt=new WeakMap;function Ln(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=ir.get(i);a&&Object.assign(e,a)}return e}function er(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=tt.get(i);a&&Object.assign(e,a)}return e}function Wy(r,e,t){ir.has(r)||ir.set(r,{}),ir.get(r)[e]=t}function zy(r,e,t){tt.has(r)||tt.set(r,{}),tt.get(r)[e]=t}function th(r,e){try{let t=Ln(e),n=[],i=[];for(let[s,c]of Object.entries(t))c.flag&&c.initial&&c.through&&(n.push({type:"flag",predicate:c.through,value:c.initial}),i.push(`count(->link[WHERE predicate = '${ie(c.through)}' AND out.uri = '${ie(c.initial)}']) > 0`));for(let[s,c]of Object.entries(t))c.required&&!c.flag&&!c.getter&&c.through&&(n.push({type:"required",predicate:c.through}),i.push(`count(->link[WHERE predicate = '${ie(c.through)}']) > 0`));return n.length===0?void 0:{getter:`(->link[WHERE predicate = '${ie(r)}'].out[WHERE ${i.join(" AND ")}].uri)`,conformanceConditions:n}}catch{return}}function Qs(r){return function(e,t){let n=r.readOnly?!1:!!r.through;if(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");let i=e.constructor;if(ir.has(i)||ir.set(i,{}),ir.get(i)[t]={...r,writable:n},n){let a=t;e[`set${ct(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function MT(r){return Qs({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function UT(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");let n={through:r.through,required:!0,initial:r.value,flag:!0,readOnly:!0,writable:!1},i=e.constructor;ir.has(i)||ir.set(i,{}),ir.get(i)[t]=n,e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function Hy(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){return By(r.name,e.prototype,Ln(e),er(e))},e.generateSHACL=function(){return Qy(r.name,e,Ln(e),er(e),th)},Object.defineProperty(e,"type",{configurable:!0})}}function Gy(r){let e=r.required??!1;return Qs({...r,required:e,readOnly:r.readOnly??!1,resolveLanguage:r.resolveLanguage??"literal",initial:r.initial??(e?"literal://string:uninitialized":void 0)})}function jT(r){return Gy({...r,readOnly:!0})}function Ws(r,e){let t=typeof r=="function"?{...e||{},target:r}:r;if(t.getter){if(t.through)throw new Error("Relation decorator: `getter` and `through` are mutually exclusive. Use `getter` alone for custom read-only relations, or `through` (with optional `target`) for standard link-based relations.");if(t.target)throw new Error("Relation decorator: `getter` and `target` are mutually exclusive. `target` auto-generates a conformance getter from the model shape; providing both is contradictory.");if(t.where)throw new Error("Relation decorator: `where` and `getter` are mutually exclusive. Use `where` for DSL-based filtering, or `getter` for raw SurrealQL.");return t}if(t.through||(t.through="ad4m://has_child"),t.where&&t.filter===!1)throw new Error("Relation decorator: `where` and `filter: false` are contradictory. `where` adds filtering constraints; `filter: false` disables filtering.");return t}function qT(r,e){let t=Ws(r,e);return function(n,i){let a=n.constructor;tt.has(a)||tt.set(a,{});let o=tt.get(a);o[i]={predicate:t.through,target:t.target,kind:"hasMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let s=i;t.through&&(n[`add${ct(s)}`]=async function(c,u){return this.addRelationValue(s,c,u)},n[`remove${ct(s)}`]=async function(c,u){return this.removeRelationValue(s,c,u)},n[`set${ct(s)}`]=async function(c,u){return this.setRelationValues(s,c,u)}),Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function BT(r,e){let t=Ws(r,e);return function(n,i){let a=n.constructor;tt.has(a)||tt.set(a,{});let o=tt.get(a);o[i]={predicate:t.through,target:t.target,kind:"hasOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}};let s=i;t.through?(Qs({through:t.through,readOnly:!1,local:t.local})(n,i),n[`add${ct(s)}`]=async function(c){return this.addRelationValue(s,c)},n[`remove${ct(s)}`]=async function(c){return this.removeRelationValue(s,c)},n[`set${ct(s)}`]=async function(c){return this.setRelationValues(s,c)}):Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function VT(r,e){let t=Ws(r,e);return function(n,i){let a=n.constructor;tt.has(a)||tt.set(a,{});let o=tt.get(a);o[i]={predicate:t.through,target:t.target,kind:"belongsToOne",maxCount:1,local:t.local,...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},t.through?Qs({through:t.through,readOnly:!0,local:t.local})(n,i):Object.defineProperty(n,i,{configurable:!0,writable:!0})}}function QT(r,e){let t=Ws(r,e);return function(n,i){let a=n.constructor;tt.has(a)||tt.set(a,{});let o=tt.get(a);o[i]={predicate:t.through,target:t.target,kind:"belongsToMany",local:t.local,...t.getter&&{getter:t.getter},...t.filter!==void 0&&{filter:t.filter},...t.where&&{where:t.where}},Object.defineProperty(n,i,{configurable:!0,writable:!0})}}var Ti=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:Se.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:Se.from(n.name).toUrl()}),e.push({source:i,predicate:"ad4m://stateValue",target:Se.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:Se.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 Ti(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 p=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),d=new Map;for(let h of p){let m=h.target,b=e.find(N=>N.source===m&&N.predicate==="ad4m://stateName"),_=b?Se.fromUrl(b.target).get():"";d.set(m,_);let v=e.find(N=>N.source===m&&N.predicate==="ad4m://stateValue"),S=v?Se.fromUrl(v.target).get():0,y=e.find(N=>N.source===m&&N.predicate==="ad4m://stateCheck"),O={predicate:"",target:""};if(y)try{let N=y.target.replace("literal://string:","");O=JSON.parse(decodeURIComponent(N))}catch{}c.addState({name:_,value:S,stateCheck:O})}let f=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of f){let m=h.target,b=e.find(P=>P.source===m&&P.predicate==="ad4m://actionName"),_=b?Se.fromUrl(b.target).get():"",S=e.find(P=>P.source===m&&P.predicate==="ad4m://fromState")?.target||"",y=d.get(S)||"",N=e.find(P=>P.source===m&&P.predicate==="ad4m://toState")?.target||"",T=d.get(N)||"",C=e.find(P=>P.source===m&&P.predicate==="ad4m://transitionActions"),$=[];if(C)try{let P=C.target.replace("literal://string:","");$=JSON.parse(decodeURIComponent(P))}catch{}c.addTransition({actionName:_,fromState:y,toState:T,actions:$})}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 Ti(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}},me=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},D=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)},us,yr,Zt,Yt,In,Mr,Ur,yn,pa,ls,vn,bn,Ot,Si,Fu,ue,le,Sn,wn,_n,da,Os=class{constructor(e,t,n){us.add(this),yr.set(this,void 0),Zt.set(this,void 0),Yt.set(this,void 0),In.set(this,void 0),Mr.set(this,void 0),Ur.set(this,void 0),yn.set(this,void 0),pa.set(this,!1),ls.set(this,void 0),vn.set(this,void 0),bn.set(this,void 0),Ot.set(this,void 0),Si.set(this,void 0),this.isSurrealDB=!1,me(this,yr,e,"f"),me(this,Si,t,"f"),me(this,Yt,n,"f"),me(this,In,new Set,"f"),me(this,yn,null,"f"),me(this,ls,new Promise((i,a)=>{me(this,vn,i,"f"),me(this,bn,a,"f")}),"f")}async subscribe(){D(this,Ur,"f")&&(D(this,Ur,"f").call(this),me(this,Ur,void 0,"f")),D(this,Ot,"f")&&(clearTimeout(D(this,Ot,"f")),me(this,Ot,void 0,"f")),D(this,Mr,"f")&&(clearTimeout(D(this,Mr,"f")),me(this,Mr,void 0,"f"));try{let t;this.isSurrealDB?t=await D(this,Yt,"f").perspectiveSubscribeSurrealQuery(D(this,yr,"f"),D(this,Si,"f")):t=await D(this,Yt,"f").subscribeQuery(D(this,yr,"f"),D(this,Si,"f")),me(this,Zt,t.subscriptionId,"f"),t.result?(me(this,yn,t.result,"f"),D(this,us,"m",Fu).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),me(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"),me(this,Ur,D(this,Yt,"f").subscribeToQueryUpdates(D(this,Zt,"f"),n=>{D(this,Ot,"f")&&(clearTimeout(D(this,Ot,"f")),me(this,Ot,void 0,"f")),D(this,vn,"f")&&(D(this,vn,"f").call(this,!0),me(this,vn,void 0,"f"),me(this,bn,void 0,"f")),!(n.isInit&&D(this,yn,"f"))&&(me(this,yn,n,"f"),D(this,us,"m",Fu).call(this,n))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),D(this,bn,"f")&&(D(this,bn,"f").call(this,t),me(this,vn,void 0,"f"),me(this,bn,void 0,"f")),t}let e=async()=>{if(!D(this,pa,"f")){try{this.isSurrealDB?await D(this,Yt,"f").perspectiveKeepAliveSurrealQuery(D(this,yr,"f"),D(this,Zt,"f")):await D(this,Yt,"f").keepAliveQuery(D(this,yr,"f"),D(this,Zt,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",D(this,Si,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}D(this,pa,"f")||me(this,Mr,setTimeout(e,3e4),"f")}};me(this,Mr,setTimeout(e,3e4),"f")}get id(){return D(this,Zt,"f")}get initialized(){return D(this,ls,"f")}get result(){return D(this,yn,"f")}onResult(e){return D(this,In,"f").add(e),()=>D(this,In,"f").delete(e)}dispose(){me(this,pa,!0,"f"),clearTimeout(D(this,Mr,"f")),D(this,Ur,"f")&&D(this,Ur,"f").call(this),D(this,In,"f").clear(),D(this,Ot,"f")&&(clearTimeout(D(this,Ot,"f")),me(this,Ot,void 0,"f")),D(this,Zt,"f")&&(this.isSurrealDB?D(this,Yt,"f").perspectiveDisposeSurrealQuerySubscription(D(this,yr,"f"),D(this,Zt,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):D(this,Yt,"f").disposeQuerySubscription(D(this,yr,"f"),D(this,Zt,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};yr=new WeakMap,Zt=new WeakMap,Yt=new WeakMap,In=new WeakMap,Mr=new WeakMap,Ur=new WeakMap,yn=new WeakMap,pa=new WeakMap,ls=new WeakMap,vn=new WeakMap,bn=new WeakMap,Ot=new WeakMap,Si=new WeakMap,us=new WeakSet,Fu=function r(e){for(let t of D(this,In,"f"))try{t(e)}catch(n){console.error("Error in query subscription callback:",n)}};var _i=class{constructor(e,t){ue.set(this,void 0),le.set(this,void 0),Sn.set(this,void 0),wn.set(this,void 0),_n.set(this,void 0),da.set(this,void 0),me(this,Sn,[],"f"),me(this,wn,[],"f"),me(this,_n,[],"f"),me(this,da,[],"f"),me(this,ue,e,"f"),me(this,le,t,"f"),this.uuid=D(this,ue,"f").uuid,this.name=D(this,ue,"f").name,this.owners=D(this,ue,"f").owners,this.sharedUrl=D(this,ue,"f").sharedUrl,this.neighbourhood=D(this,ue,"f").neighbourhood,this.state=D(this,ue,"f").state,D(this,le,"f").addPerspectiveLinkAddedListener(D(this,ue,"f").uuid,D(this,Sn,"f")),D(this,le,"f").addPerspectiveLinkRemovedListener(D(this,ue,"f").uuid,D(this,wn,"f")),D(this,le,"f").addPerspectiveLinkUpdatedListener(D(this,ue,"f").uuid,D(this,_n,"f")),D(this,le,"f").addPerspectiveSyncStateChangeListener(D(this,ue,"f").uuid,D(this,da,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,n,i){return await D(this,le,"f").executeCommands(D(this,ue,"f").uuid,JSON.stringify(e),t,JSON.stringify(n),i)}async get(e){return await D(this,le,"f").queryLinks(D(this,ue,"f").uuid,e)}async infer(e){return await D(this,le,"f").queryProlog(D(this,ue,"f").uuid,e)}async querySurrealDB(e){return await D(this,le,"f").querySurrealDB(D(this,ue,"f").uuid,e)}async add(e,t="shared",n){return await D(this,le,"f").addLink(D(this,ue,"f").uuid,e,t,n)}async addLinks(e,t="shared",n){return await D(this,le,"f").addLinks(D(this,ue,"f").uuid,e,t,n)}async removeLinks(e,t){return await D(this,le,"f").removeLinks(D(this,ue,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await D(this,le,"f").linkMutations(D(this,ue,"f").uuid,e,t)}async addLinkExpression(e,t="shared",n){return await D(this,le,"f").addLinkExpression(D(this,ue,"f").uuid,e,t,n)}async update(e,t,n){return await D(this,le,"f").updateLink(D(this,ue,"f").uuid,e,t,n)}async remove(e,t){return await D(this,le,"f").removeLink(D(this,ue,"f").uuid,e,t)}async createBatch(){return await D(this,le,"f").createBatch(D(this,ue,"f").uuid)}async commitBatch(e){return await D(this,le,"f").commitBatch(D(this,ue,"f").uuid,e)}async getExpression(e){return await D(this,le,"f").getExpression(e)}async createExpression(e,t){return await D(this,le,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?D(this,Sn,"f").push(t):e==="link-removed"?D(this,wn,"f").push(t):e==="link-updated"&&D(this,_n,"f").push(t)}async addSyncStateChangeListener(e){D(this,da,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let n=D(this,Sn,"f").indexOf(t);D(this,Sn,"f").splice(n,1)}else if(e==="link-removed"){let n=D(this,wn,"f").indexOf(t);D(this,wn,"f").splice(n,1)}else if(e==="link-updated"){let n=D(this,_n,"f").indexOf(t);D(this,_n,"f").splice(n,1)}}async snapshot(){return D(this,le,"f").snapshotByUUID(D(this,ue,"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 fe({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 fe({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return Se.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 fe({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 fe({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 fe({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 fe({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 fe({source:"ad4m://self",predicate:n}));for(let a of i){let o=a.data.target,s=await this.get(new fe({source:o,predicate:"ad4m://sdna"}));for(let c of s){let u=Se.fromUrl(c.data.target).get();typeof u=="string"&&t.push(u)}}}return t}async getSdnaForClass(e){let t=Se.from(e);if((await this.get(new fe({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new fe({source:t.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let a=Se.fromUrl(i[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,n,i){return D(this,le,"f").addSdna(D(this,ue,"f").uuid,e,t,n,i)}async addShacl(e,t){let n=t.toLinks(),i=Se.fromUrl(`literal://string:shacl://${e}`),a=[...n.map(o=>new mt({source:o.source,predicate:o.predicate,target:o.target})),new mt({source:"ad4m://self",predicate:"ad4m://has_shacl",target:i.toUrl()}),new mt({source:i.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=Se.fromUrl(`literal://string:shacl://${e}`),n=await this.get(new fe({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(n.length===0)return null;let i=n[0].data.target;ie(i);let a=await this.get(new fe({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(p=>p.data.target)].map(p=>`'${ie(p)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(p=>({source:p.source,predicate:p.predicate,target:p.target}));return Qr.fromLinks(l,i)}async getAllShacl(){let e=await this.get(new fe({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let n of e){let i=n.data.target,o=Se.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=Se.from(e).toUrl(),a=[...n.map(o=>new mt({source:o.source,predicate:o.predicate,target:o.target})),new mt({source:"ad4m://self",predicate:"ad4m://has_flow",target:i}),new mt({source:i,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=Se.from(e).toUrl(),n=await this.get(new fe({source:t,predicate:"ad4m://flow_uri"}));if(n.length===0)return null;let i=n[0].data.target,a=ie(i),o=i.endsWith("Flow")?i.slice(0,-4)+".":i+".",s=ie(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(p=>({source:p.source,predicate:p.predicate,target:p.target}));return Ti.fromLinks(l,i)}async subjectClasses(){try{let t=(await this.get(new fe({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 D(this,le,"f").createSubject(D(this,ue,"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 D(this,le,"f").createSubject(D(this,ue,"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 D(this,le,"f").getSubjectData(D(this,ue,"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 D(this,le,"f").getSubjectData(D(this,ue,"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 fe({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 = '${ie(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=ie(e),s=ie(a.predicate),c;if(a.target){let d=ie(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${d}'`}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 Na(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,relations: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=ie(n.predicate);if(n.target){let a=ie(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=ie(e),s=ie(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 p=await this.getExpression(l);try{return JSON.parse(p.data)}catch{return p.data}}catch{return l}return l}async getRelationValuesViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return[];let a=i.relations.get(n);if(!a)return[];let o=ie(e),s=ie(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(p=>p.value).filter(p=>p!==""&&p!=="");if(a.condition&&l.length>0)try{let p=[];for(let d of l){let f=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${d.replace(/'/g,"\\'")}'`);f.trim().startsWith("WHERE")&&(f=`array::len(SELECT * FROM link ${f}) > 0`);let h=await this.querySurrealDB(`RETURN ${f}`);(h===!0||Array.isArray(h)&&h.length>0&&h[0]===!0)&&p.push(d)}l=p}catch(p){console.warn(`Failed to apply condition filter for ${n}:`,p)}if(a.instanceFilter)try{let p=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return p?await this.batchCheckSubjectInstances(l,p):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=>`'${ie(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=>`'${ie(l)}'`).join(", "),s=ie(a.predicate),c;if(a.target){let l=ie(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 Na(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 Na(this,c.base,i);await u.init(),n.push(u)}catch{}}}return n}async findClassByProperties(e){let t=[],n=[],a=Object.getPrototypeOf(e)?.constructor,o=a?Ln(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(p=>!Array.isArray(e[p]));let s=a?Object.fromEntries(Object.entries(er(a)).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany")):{};if(Object.keys(s).length>0?n=Object.keys(s).filter(p=>p!=="isSubjectInstance"):n=Object.keys(e).filter(p=>Array.isArray(e[p])&&p!=="isSubjectInstance"),t.length===0&&n.length===0)return null;let c=`SELECT
107
107
  in.uri AS shape_source,
108
108
  predicate,
109
109
  out.uri AS target
110
110
  FROM link
111
- WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,u=await this.querySurrealDB(c);if(!u||u.length===0)return null;let l=new Map;for(let p of u)if(p.predicate==="rdf://type"&&p.target==="ad4m://SubjectClass"){let d=p.shape_source,f=d.indexOf("://");if(f<0)continue;let h=d.substring(f+3).split("/").pop();if(!h)continue;l.set(h,{shapeUri:d,properties:[],relations:[]})}for(let p of u)if(p.predicate==="sh://property"||p.predicate==="sh://collection"){for(let[d,f]of l)if(p.shape_source.endsWith(`${d}Shape`)){let h=p.target.lastIndexOf(".");if(h<0)continue;let m=p.target.substring(h+1);p.predicate==="sh://property"?f.properties.push(m):f.relations.push(m)}}for(let[p,d]of l){let f=t.every(m=>d.properties.includes(m)),h=n.every(m=>d.relations.includes(m));if(f&&h)return p}return null}async subjectClassesByTemplate(e){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)}try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching 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 @Model 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 Os(this.uuid,e,O(this,le,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new Os(this.uuid,e,O(this,le,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};ce=new WeakMap,le=new WeakMap,yn=new WeakMap,vn=new WeakMap,bn=new WeakMap,pa=new WeakMap;var Cr=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)},Z,da,ha,ma,fs,ga,ps,ds,rt=`
111
+ WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,u=await this.querySurrealDB(c);if(!u||u.length===0)return null;let l=new Map;for(let p of u)if(p.predicate==="rdf://type"&&p.target==="ad4m://SubjectClass"){let d=p.shape_source,f=d.indexOf("://");if(f<0)continue;let h=d.substring(f+3).split("/").pop();if(!h)continue;l.set(h,{shapeUri:d,properties:[],relations:[]})}for(let p of u)if(p.predicate==="sh://property"||p.predicate==="sh://collection"){for(let[d,f]of l)if(p.shape_source.endsWith(`${d}Shape`)){let h=p.target.lastIndexOf(".");if(h<0)continue;let m=p.target.substring(h+1);p.predicate==="sh://property"?f.properties.push(m):f.relations.push(m)}}for(let[p,d]of l){let f=t.every(m=>d.properties.includes(m)),h=n.every(m=>d.relations.includes(m));if(f&&h)return p}return null}async subjectClassesByTemplate(e){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)}try{let t=await this.findClassByProperties(e);if(t)return[t]}catch(t){console.warn("subjectClassesByTemplate: property matching 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 @Model decorator.`);let{shape:n}=e.generateSHACL(),i=JSON.stringify(n.toJSON());await this.addSdna(t,"","subject_class",i)}getNeighbourhoodProxy(){return D(this,le,"f").getNeighbourhoodProxy(D(this,ue,"f").uuid)}get ai(){return D(this,le,"f").aiClient}async subscribeInfer(e){let t=new Os(this.uuid,e,D(this,le,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new Os(this.uuid,e,D(this,le,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};ue=new WeakMap,le=new WeakMap,Sn=new WeakMap,wn=new WeakMap,_n=new WeakMap,da=new WeakMap;var Lr=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},z=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)},Z,ha,ma,ga,fs,ya,ps,ds,nt=`
112
112
  author
113
113
  timestamp
114
114
  status
115
115
  data { source, predicate, target }
116
116
  proof { valid, invalid, signature, key }
117
- `,fi=`
117
+ `,hi=`
118
118
  uuid
119
119
  name
120
120
  sharedUrl
@@ -135,139 +135,139 @@ neighbourhood {
135
135
  }
136
136
  author
137
137
  }
138
- `,Ds=class{constructor(e,t=!0){Z.set(this,void 0),da.set(this,void 0),ha.set(this,void 0),ma.set(this,void 0),fs.set(this,void 0),ga.set(this,void 0),ps.set(this,void 0),ds.set(this,void 0),Cr(this,Z,e,"f"),Cr(this,da,[],"f"),Cr(this,ha,[],"f"),Cr(this,ma,[],"f"),Cr(this,fs,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Cr(this,ga,e,"f")}setNeighbourhoodClient(e){Cr(this,ps,e,"f")}setAIClient(e){Cr(this,ds,e,"f")}get aiClient(){return B(this,ds,"f")}async all(){let{perspectives:e}=T(await B(this,Z,"f").query({query:E`query perspectives {
138
+ `,Ds=class{constructor(e,t=!0){Z.set(this,void 0),ha.set(this,void 0),ma.set(this,void 0),ga.set(this,void 0),fs.set(this,void 0),ya.set(this,void 0),ps.set(this,void 0),ds.set(this,void 0),Lr(this,Z,e,"f"),Lr(this,ha,[],"f"),Lr(this,ma,[],"f"),Lr(this,ga,[],"f"),Lr(this,fs,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Lr(this,ya,e,"f")}setNeighbourhoodClient(e){Lr(this,ps,e,"f")}setAIClient(e){Lr(this,ds,e,"f")}get aiClient(){return z(this,ds,"f")}async all(){let{perspectives:e}=I(await z(this,Z,"f").query({query:E`query perspectives {
139
139
  perspectives {
140
- ${fi}
140
+ ${hi}
141
141
  }
142
- }`}));return e.map(t=>new bi(t,this))}async byUUID(e){let{perspective:t}=T(await B(this,Z,"f").query({query:E`query perspective($uuid: String!) {
142
+ }`}));return e.map(t=>new _i(t,this))}async byUUID(e){let{perspective:t}=I(await z(this,Z,"f").query({query:E`query perspective($uuid: String!) {
143
143
  perspective(uuid: $uuid) {
144
- ${fi}
144
+ ${hi}
145
145
  }
146
- }`,variables:{uuid:e}}));return t?new bi(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=T(await B(this,Z,"f").query({query:E`query perspectiveSnapshot($uuid: String!) {
146
+ }`,variables:{uuid:e}}));return t?new _i(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=I(await z(this,Z,"f").query({query:E`query perspectiveSnapshot($uuid: String!) {
147
147
  perspectiveSnapshot(uuid: $uuid) {
148
- links { ${rt} }
148
+ links { ${nt} }
149
149
  }
150
- }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectivePublishSnapshot($uuid: String!) {
150
+ }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectivePublishSnapshot($uuid: String!) {
151
151
  perspectivePublishSnapshot(uuid: $uuid)
152
- }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:n}=T(await B(this,Z,"f").query({query:E`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
152
+ }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:n}=I(await z(this,Z,"f").query({query:E`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
153
153
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
154
- ${rt}
154
+ ${nt}
155
155
  }
156
- }`,variables:{uuid:e,query:t}}));return n}async queryProlog(e,t){let{perspectiveQueryProlog:n}=T(await B(this,Z,"f").query({query:E`query perspectiveQueryProlog($uuid: String!, $query: String!) {
156
+ }`,variables:{uuid:e,query:t}}));return n}async queryProlog(e,t){let{perspectiveQueryProlog:n}=I(await z(this,Z,"f").query({query:E`query perspectiveQueryProlog($uuid: String!, $query: String!) {
157
157
  perspectiveQueryProlog(uuid: $uuid, query: $query)
158
- }`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:n}=T(await B(this,Z,"f").query({query:E`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
158
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:n}=I(await z(this,Z,"f").query({query:E`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
159
159
  perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
160
- }`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:n}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
160
+ }`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:n}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
161
161
  perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
162
162
  subscriptionId
163
163
  result
164
164
  }
165
- }`,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}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
165
+ }`,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}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
166
166
  perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
167
167
  subscriptionId
168
168
  result
169
169
  }
170
- }`,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}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
170
+ }`,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}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
171
171
  perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
172
- }`,variables:{uuid:e,subscriptionId:t}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:n}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
172
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:n}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
173
173
  perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
174
- }`,variables:{uuid:e,subscriptionId:t}}));return n}subscribeToQueryUpdates(e,t){let n=B(this,Z,"f").subscribe({query:E`
174
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}subscribeToQueryUpdates(e,t){let n=z(this,Z,"f").subscribe({query:E`
175
175
  subscription perspectiveQuerySubscription($subscriptionId: String!) {
176
176
  perspectiveQuerySubscription(subscriptionId: $subscriptionId)
177
177
  }
178
- `,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}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
178
+ `,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}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
179
179
  perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
180
- }`,variables:{uuid:e,subscriptionId:t}}));return n}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:n}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
180
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:n}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
181
181
  perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
182
- }`,variables:{uuid:e,subscriptionId:t}}));return n}async add(e){let{perspectiveAdd:t}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAdd($name: String!) {
182
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async add(e){let{perspectiveAdd:t}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveAdd($name: String!) {
183
183
  perspectiveAdd(name: $name) {
184
- ${fi}
184
+ ${hi}
185
185
  }
186
- }`,variables:{name:e}}));return new bi(t,this)}async update(e,t){let{perspectiveUpdate:n}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveUpdate($uuid: String!, $name: String!) {
186
+ }`,variables:{name:e}}));return new _i(t,this)}async update(e,t){let{perspectiveUpdate:n}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveUpdate($uuid: String!, $name: String!) {
187
187
  perspectiveUpdate(uuid: $uuid, name: $name) {
188
- ${fi}
188
+ ${hi}
189
189
  }
190
- }`,variables:{uuid:e,name:t}}));return new bi(n,this)}async remove(e){return T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveRemove($uuid: String!) {
190
+ }`,variables:{uuid:e,name:t}}));return new _i(n,this)}async remove(e){return I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveRemove($uuid: String!) {
191
191
  perspectiveRemove(uuid: $uuid)
192
- }`,variables:{uuid:e}}))}async addLink(e,t,n="shared",i){let{perspectiveAddLink:a}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
192
+ }`,variables:{uuid:e}}))}async addLink(e,t,n="shared",i){let{perspectiveAddLink:a}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
193
193
  perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
194
- ${rt}
194
+ ${nt}
195
195
  }
196
- }`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async addLinks(e,t,n="shared",i){let{perspectiveAddLinks:a}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
196
+ }`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async addLinks(e,t,n="shared",i){let{perspectiveAddLinks:a}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
197
197
  perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
198
- ${rt}
198
+ ${nt}
199
199
  }
200
- }`,variables:{uuid:e,links:t,status:n,batchId:i}}));return a}async removeLinks(e,t,n){let{perspectiveRemoveLinks:i}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
200
+ }`,variables:{uuid:e,links:t,status:n,batchId:i}}));return a}async removeLinks(e,t,n){let{perspectiveRemoveLinks:i}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
201
201
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
202
- ${rt}
202
+ ${nt}
203
203
  }
204
- }`,variables:{uuid:e,links:t,batchId:n}}));return i}async linkMutations(e,t,n){let{perspectiveLinkMutations:i}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
204
+ }`,variables:{uuid:e,links:t,batchId:n}}));return i}async linkMutations(e,t,n){let{perspectiveLinkMutations:i}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
205
205
  perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
206
206
  additions {
207
- ${rt}
207
+ ${nt}
208
208
  }
209
209
  removals {
210
- ${rt}
210
+ ${nt}
211
211
  }
212
212
  }
213
- }`,variables:{uuid:e,mutations:t,status:n}}));return i}async addLinkExpression(e,t,n="shared",i){let{perspectiveAddLinkExpression:a}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
213
+ }`,variables:{uuid:e,mutations:t,status:n}}));return i}async addLinkExpression(e,t,n="shared",i){let{perspectiveAddLinkExpression:a}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
214
214
  perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
215
- ${rt}
215
+ ${nt}
216
216
  }
217
- }`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async updateLink(e,t,n,i){let{perspectiveUpdateLink:a}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
217
+ }`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async updateLink(e,t,n,i){let{perspectiveUpdateLink:a}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
218
218
  perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
219
- ${rt}
219
+ ${nt}
220
220
  }
221
- }`,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}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
221
+ }`,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}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
222
222
  perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
223
- }`,variables:{uuid:e,link:t,batchId:n}}));return i}async addSdna(e,t,n,i,a){return T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
223
+ }`,variables:{uuid:e,link:t,batchId:n}}));return i}async addSdna(e,t,n,i,a){return I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
224
224
  perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
225
- }`,variables:{uuid:e,name:t,sdnaCode:n||"",sdnaType:i,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,n,i,a){return T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
225
+ }`,variables:{uuid:e,name:t,sdnaCode:n||"",sdnaType:i,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,n,i,a){return I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
226
226
  perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
227
- }`,variables:{uuid:e,commands:t,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,n,i,a){return T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
227
+ }`,variables:{uuid:e,commands:t,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,n,i,a){return I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
228
228
  perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
229
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,n){return T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
229
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,n){return I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
230
230
  perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
231
- }`,variables:{uuid:e,subjectClass:t,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await B(this,ga,"f").get(e)}async createExpression(e,t){return await B(this,ga,"f").create(e,t)}addPerspectiveAddedListener(e){B(this,da,"f").push(e)}subscribePerspectiveAdded(){B(this,Z,"f").subscribe({query:E` subscription {
232
- perspectiveAdded { ${fi} }
231
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await z(this,ya,"f").get(e)}async createExpression(e,t){return await z(this,ya,"f").create(e,t)}addPerspectiveAddedListener(e){z(this,ha,"f").push(e)}subscribePerspectiveAdded(){z(this,Z,"f").subscribe({query:E` subscription {
232
+ perspectiveAdded { ${hi} }
233
233
  }
234
- `}).subscribe({next:e=>{B(this,da,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){B(this,ha,"f").push(e)}subscribePerspectiveUpdated(){B(this,Z,"f").subscribe({query:E` subscription {
235
- perspectiveUpdated { ${fi} }
234
+ `}).subscribe({next:e=>{z(this,ha,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){z(this,ma,"f").push(e)}subscribePerspectiveUpdated(){z(this,Z,"f").subscribe({query:E` subscription {
235
+ perspectiveUpdated { ${hi} }
236
236
  }
237
- `}).subscribe({next:e=>{B(this,ha,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){B(this,fs,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){B(this,Z,"f").subscribe({query:E` subscription {
237
+ `}).subscribe({next:e=>{z(this,ma,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){z(this,fs,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){z(this,Z,"f").subscribe({query:E` subscription {
238
238
  perspectiveSyncStateChange(uuid: "${e}")
239
239
  }
240
- `}).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,ma,"f").push(e)}subscribePerspectiveRemoved(){B(this,Z,"f").subscribe({query:E` subscription {
240
+ `}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){z(this,ga,"f").push(e)}subscribePerspectiveRemoved(){z(this,Z,"f").subscribe({query:E` subscription {
241
241
  perspectiveRemoved
242
242
  }
243
- `}).subscribe({next:e=>{B(this,ma,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){B(this,Z,"f").subscribe({query:E` subscription {
244
- perspectiveLinkAdded(uuid: "${e}") { ${rt} }
243
+ `}).subscribe({next:e=>{z(this,ga,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){z(this,Z,"f").subscribe({query:E` subscription {
244
+ perspectiveLinkAdded(uuid: "${e}") { ${nt} }
245
245
  }
246
- `}).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,Z,"f").subscribe({query:E` subscription {
247
- perspectiveLinkRemoved(uuid: "${e}") { ${rt} }
246
+ `}).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){z(this,Z,"f").subscribe({query:E` subscription {
247
+ perspectiveLinkRemoved(uuid: "${e}") { ${nt} }
248
248
  }
249
- `}).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,Z,"f").subscribe({query:E` subscription {
249
+ `}).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){z(this,Z,"f").subscribe({query:E` subscription {
250
250
  perspectiveLinkUpdated(uuid: "${e}") {
251
251
  oldLink {
252
- ${rt}
252
+ ${nt}
253
253
  }
254
254
  newLink {
255
- ${rt}
255
+ ${nt}
256
256
  }
257
257
  }
258
258
  }
259
- `}).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 $u(B(this,ps,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveCreateBatch($uuid: String!) {
259
+ `}).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 $u(z(this,ps,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveCreateBatch($uuid: String!) {
260
260
  perspectiveCreateBatch(uuid: $uuid)
261
- }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:n}=T(await B(this,Z,"f").mutate({mutation:E`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
261
+ }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:n}=I(await z(this,Z,"f").mutate({mutation:E`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
262
262
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
263
263
  additions {
264
- ${rt}
264
+ ${nt}
265
265
  }
266
266
  removals {
267
- ${rt}
267
+ ${nt}
268
268
  }
269
269
  }
270
- }`,variables:{uuid:e,batchId:t}}));return n}};Z=new WeakMap,da=new WeakMap,ha=new WeakMap,ma=new WeakMap,fs=new WeakMap,ga=new WeakMap,ps=new WeakMap,ds=new WeakMap;var zo=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},Y=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)},re,ya,va,ba,sa=`
270
+ }`,variables:{uuid:e,batchId:t}}));return n}};Z=new WeakMap,ha=new WeakMap,ma=new WeakMap,ga=new WeakMap,fs=new WeakMap,ya=new WeakMap,ps=new WeakMap,ds=new WeakMap;var Wo=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},Y=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)},ne,va,ba,Sa,ca=`
271
271
  did
272
272
  directMessageLanguage
273
273
  perspective {
@@ -281,7 +281,7 @@ neighbourhood {
281
281
  }
282
282
  }
283
283
  }
284
- `,Wo=`
284
+ `,zo=`
285
285
  requestId
286
286
  revoked
287
287
  auth {
@@ -297,151 +297,152 @@ neighbourhood {
297
297
  can
298
298
  }
299
299
  }
300
- `,pi=`
300
+ `,mi=`
301
301
  isInitialized
302
302
  isUnlocked
303
303
  did
304
304
  didDocument
305
305
  error
306
- `,Go=`
306
+ `,Ho=`
307
307
  did
308
308
  didSigningKeyId
309
309
  deviceKeyType
310
310
  deviceKey
311
311
  deviceKeySignedByDid
312
312
  didSignedByDeviceKey
313
- `,Gy=`
313
+ `,Ky=`
314
314
  signature
315
315
  publicKey
316
- `,Ma=class{constructor(e,t=!0){re.set(this,void 0),ya.set(this,void 0),va.set(this,void 0),ba.set(this,void 0),zo(this,re,e,"f"),zo(this,va,[],"f"),zo(this,ba,[],"f"),zo(this,ya,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=T(await Y(this,re,"f").query({query:E`query agent { agent { ${sa} } }`})),t=new qr(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=T(await Y(this,re,"f").query({query:E`query agentStatus {
316
+ `,Ua=class{constructor(e,t=!0){ne.set(this,void 0),va.set(this,void 0),ba.set(this,void 0),Sa.set(this,void 0),Wo(this,ne,e,"f"),Wo(this,ba,[],"f"),Wo(this,Sa,[],"f"),Wo(this,va,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=I(await Y(this,ne,"f").query({query:E`query agent { agent { ${ca} } }`})),t=new Vr(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=I(await Y(this,ne,"f").query({query:E`query agentStatus {
317
317
  agentStatus {
318
- ${pi}
318
+ ${mi}
319
319
  }
320
- }`}));return new Nt(e)}async generate(e){let{agentGenerate:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentGenerate(
320
+ }`}));return new Nt(e)}async generate(e){let{agentGenerate:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentGenerate(
321
321
  $passphrase: String!
322
322
  ) {
323
323
  agentGenerate(passphrase: $passphrase) {
324
- ${pi}
324
+ ${mi}
325
325
  }
326
- }`,variables:{passphrase:e}}));return new Nt(t)}async import(e){let{did:t,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentImport(
326
+ }`,variables:{passphrase:e}}));return new Nt(t)}async import(e){let{did:t,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentImport(
327
327
  $did: String!,
328
328
  $didDocument: String!,
329
329
  $keystore: String!,
330
330
  $passphrase: String!
331
331
  ) {
332
332
  agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
333
- ${pi}
333
+ ${mi}
334
334
  }
335
- }`,variables:{did:t,didDocument:n,keystore:i,passphrase:a}}));return new Nt(o)}async lock(e){let{agentLock:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentLock($passphrase: String!) {
335
+ }`,variables:{did:t,didDocument:n,keystore:i,passphrase:a}}));return new Nt(o)}async lock(e){let{agentLock:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentLock($passphrase: String!) {
336
336
  agentLock(passphrase: $passphrase) {
337
- ${pi}
337
+ ${mi}
338
338
  }
339
- }`,variables:{passphrase:e}}));return new Nt(t)}async unlock(e,t=!0){let{agentUnlock:n}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
339
+ }`,variables:{passphrase:e}}));return new Nt(t)}async unlock(e,t=!0){let{agentUnlock:n}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
340
340
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
341
- ${pi}
341
+ ${mi}
342
342
  }
343
- }`,variables:{passphrase:e,holochain:t}}));return new Nt(n)}async byDID(e){let{agentByDID:t}=T(await Y(this,re,"f").query({query:E`query agentByDID($did: String!) {
343
+ }`,variables:{passphrase:e,holochain:t}}));return new Nt(n)}async byDID(e){let{agentByDID:t}=I(await Y(this,ne,"f").query({query:E`query agentByDID($did: String!) {
344
344
  agentByDID(did: $did) {
345
- ${sa}
345
+ ${ca}
346
346
  }
347
- }`,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}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
347
+ }`,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}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
348
348
  agentUpdatePublicPerspective(perspective: $perspective) {
349
- ${sa}
349
+ ${ca}
350
350
  }
351
- }`,variables:{perspective:t}})),i=n,a=new qr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ds(Y(this,re,"f")),n=new Ma(Y(this,re,"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}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
351
+ }`,variables:{perspective:t}})),i=n,a=new Vr(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new Ds(Y(this,ne,"f")),n=new Ua(Y(this,ne,"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}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
352
352
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
353
- ${sa}
353
+ ${ca}
354
354
  }
355
- }`,variables:{directMessageLanguage:e}})),n=t,i=new qr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
355
+ }`,variables:{directMessageLanguage:e}})),n=t,i=new Vr(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
356
356
  agentAddEntanglementProofs(proofs: $proofs) {
357
- ${Go}
357
+ ${Ho}
358
358
  }
359
- }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
359
+ }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
360
360
  agentDeleteEntanglementProofs(proofs: $proofs) {
361
- ${Go}
361
+ ${Ho}
362
362
  }
363
- }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=T(await Y(this,re,"f").query({query:E`query agentGetEntanglementProofs {
363
+ }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=I(await Y(this,ne,"f").query({query:E`query agentGetEntanglementProofs {
364
364
  agentGetEntanglementProofs {
365
- ${Go}
365
+ ${Ho}
366
366
  }
367
- }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:n}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
367
+ }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:n}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
368
368
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
369
- ${Go}
369
+ ${Ho}
370
370
  }
371
- }`,variables:{deviceKey:e,deviceKeyType:t}}));return n}addUpdatedListener(e){Y(this,va,"f").push(e)}addAppChangedListener(e){Y(this,ya,"f").push(e)}subscribeAgentUpdated(){Y(this,re,"f").subscribe({query:E` subscription {
372
- agentUpdated { ${sa} }
371
+ }`,variables:{deviceKey:e,deviceKeyType:t}}));return n}addUpdatedListener(e){Y(this,ba,"f").push(e)}addAppChangedListener(e){Y(this,va,"f").push(e)}subscribeAgentUpdated(){Y(this,ne,"f").subscribe({query:E` subscription {
372
+ agentUpdated { ${ca} }
373
373
  }
374
- `}).subscribe({next:e=>{let t=e.data.agentUpdated;Y(this,va,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){Y(this,re,"f").subscribe({query:E` subscription {
374
+ `}).subscribe({next:e=>{let t=e.data.agentUpdated;Y(this,ba,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){Y(this,ne,"f").subscribe({query:E` subscription {
375
375
  agentAppsChanged {
376
- ${Wo}
376
+ ${zo}
377
377
  }
378
378
  }
379
- `}).subscribe({next:e=>{Y(this,ya,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){Y(this,ba,"f").push(e)}subscribeAgentStatusChanged(){Y(this,re,"f").subscribe({query:E` subscription {
380
- agentStatusChanged { ${pi} }
379
+ `}).subscribe({next:e=>{Y(this,va,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){Y(this,Sa,"f").push(e)}subscribeAgentStatusChanged(){Y(this,ne,"f").subscribe({query:E` subscription {
380
+ agentStatusChanged { ${mi} }
381
381
  }
382
- `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;Y(this,ba,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=T(await Y(this,re,"f").mutate({mutation:E`
382
+ `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;Y(this,Sa,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=I(await Y(this,ne,"f").mutate({mutation:E`
383
383
  mutation agentRequestCapability($authInfo: AuthInfoInput!) {
384
384
  agentRequestCapability(authInfo: $authInfo)
385
385
  }
386
- `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=T(await Y(this,re,"f").mutate({mutation:E`
386
+ `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=I(await Y(this,ne,"f").mutate({mutation:E`
387
387
  mutation agentPermitCapability($auth: String!) {
388
388
  agentPermitCapability(auth: $auth)
389
389
  }
390
- `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:n}=T(await Y(this,re,"f").mutate({mutation:E`
390
+ `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:n}=I(await Y(this,ne,"f").mutate({mutation:E`
391
391
  mutation agentGenerateJwt($requestId: String!, $rand: String!) {
392
392
  agentGenerateJwt(requestId: $requestId, rand: $rand)
393
393
  }
394
- `,variables:{requestId:e,rand:t}}));return n}async getApps(){let{agentGetApps:e}=T(await Y(this,re,"f").mutate({mutation:E`query agentGetApps {
394
+ `,variables:{requestId:e,rand:t}}));return n}async getApps(){let{agentGetApps:e}=I(await Y(this,ne,"f").mutate({mutation:E`query agentGetApps {
395
395
  agentGetApps {
396
- ${Wo}
396
+ ${zo}
397
397
  }
398
- }`}));return e}async removeApp(e){let{agentRemoveApp:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentRemoveApp($requestId: String!) {
398
+ }`}));return e}async removeApp(e){let{agentRemoveApp:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentRemoveApp($requestId: String!) {
399
399
  agentRemoveApp(requestId: $requestId) {
400
- ${Wo}
400
+ ${zo}
401
401
  }
402
- }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentRevokeToken($requestId: String!) {
402
+ }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentRevokeToken($requestId: String!) {
403
403
  agentRevokeToken(requestId: $requestId) {
404
- ${Wo}
404
+ ${zo}
405
405
  }
406
- }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=T(await Y(this,re,"f").mutate({mutation:E`
406
+ }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=I(await Y(this,ne,"f").mutate({mutation:E`
407
407
  query agentIsLocked {
408
408
  agentIsLocked
409
409
  }
410
- `}));return e}async signMessage(e){let{agentSignMessage:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation agentSignMessage($message: String!) {
410
+ `}));return e}async signMessage(e){let{agentSignMessage:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation agentSignMessage($message: String!) {
411
411
  agentSignMessage(message: $message) {
412
- ${Gy}
412
+ ${Ky}
413
413
  }
414
- }`,variables:{message:e}}));return t}async createUser(e,t,n){let{runtimeCreateUser:i}=T(await Y(this,re,"f").mutate({mutation:E`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
414
+ }`,variables:{message:e}}));return t}async createUser(e,t,n){let{runtimeCreateUser:i}=I(await Y(this,ne,"f").mutate({mutation:E`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
415
415
  runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
416
416
  did
417
417
  success
418
418
  error
419
419
  }
420
- }`,variables:{email:e,password:t,appInfo:n}}));return i}async loginUser(e,t){let{runtimeLoginUser:n}=T(await Y(this,re,"f").mutate({mutation:E`mutation runtimeLoginUser($email: String!, $password: String!) {
420
+ }`,variables:{email:e,password:t,appInfo:n}}));return i}async loginUser(e,t){let{runtimeLoginUser:n}=I(await Y(this,ne,"f").mutate({mutation:E`mutation runtimeLoginUser($email: String!, $password: String!) {
421
421
  runtimeLoginUser(email: $email, password: $password)
422
- }`,variables:{email:e,password:t}}));return n}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:n}=T(await Y(this,re,"f").mutate({mutation:E`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
422
+ }`,variables:{email:e,password:t}}));return n}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:n}=I(await Y(this,ne,"f").mutate({mutation:E`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
423
423
  runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
424
424
  success
425
425
  message
426
426
  requiresPassword
427
427
  isExistingUser
428
428
  }
429
- }`,variables:{email:e,appInfo:t}}));return n}async verifyEmailCode(e,t,n){let{runtimeVerifyEmailCode:i}=T(await Y(this,re,"f").mutate({mutation:E`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
429
+ }`,variables:{email:e,appInfo:t}}));return n}async verifyEmailCode(e,t,n){let{runtimeVerifyEmailCode:i}=I(await Y(this,ne,"f").mutate({mutation:E`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
430
430
  runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
431
- }`,variables:{email:e,code:t,verificationType:n}}));return i}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=T(await Y(this,re,"f").query({query:E`query runtimeHostingUserInfo {
431
+ }`,variables:{email:e,code:t,verificationType:n}}));return i}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=I(await Y(this,ne,"f").query({query:E`query runtimeHostingUserInfo {
432
432
  runtimeHostingUserInfo {
433
433
  email
434
434
  remainingCredits
435
435
  hotWalletAddress
436
+ freeAccess
436
437
  }
437
- }`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation runtimeSetHotWalletAddress($address: String!) {
438
+ }`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation runtimeSetHotWalletAddress($address: String!) {
438
439
  runtimeSetHotWalletAddress(address: $address)
439
- }`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=T(await Y(this,re,"f").mutate({mutation:E`mutation runtimeRequestPayment($amountHOT: String!) {
440
+ }`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=I(await Y(this,ne,"f").mutate({mutation:E`mutation runtimeRequestPayment($amountHOT: String!) {
440
441
  runtimeRequestPayment(amountHOT: $amountHOT) {
441
442
  success
442
443
  message
443
444
  }
444
- }`,variables:{amountHOT:e}}));return t}};re=new WeakMap,ya=new WeakMap,va=new WeakMap,ba=new WeakMap;var Hy=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},Pr=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,Np=`
445
+ }`,variables:{amountHOT:e}}));return t}};ne=new WeakMap,va=new WeakMap,ba=new WeakMap,Sa=new WeakMap;var Jy=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},$r=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)},qt,Np=`
445
446
  name
446
447
  address
447
448
  settings
@@ -458,45 +459,45 @@ neighbourhood {
458
459
  templateAppliedParams
459
460
  possibleTemplateParams
460
461
  sourceCodeLink
461
- `,Mu=class{constructor(e){Ut.set(this,void 0),Hy(this,Ut,e,"f")}async byAddress(e){let{language:t}=T(await Pr(this,Ut,"f").query({query:E`query byAddress($address: String!) {
462
+ `,Mu=class{constructor(e){qt.set(this,void 0),Jy(this,qt,e,"f")}async byAddress(e){let{language:t}=I(await $r(this,qt,"f").query({query:E`query byAddress($address: String!) {
462
463
  language(address: $address) {
463
464
  ${Np}
464
465
  }
465
- }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=T(await Pr(this,Ut,"f").query({query:E`query byFilter($filter: String!) {
466
+ }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=I(await $r(this,qt,"f").query({query:E`query byFilter($filter: String!) {
466
467
  languages(filter: $filter) {
467
468
  ${Np}
468
469
  }
469
- }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:n}=T(await Pr(this,Ut,"f").mutate({mutation:E`mutation writeSettings($languageAddress: String!, $settings: String!) {
470
+ }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:n}=I(await $r(this,qt,"f").mutate({mutation:E`mutation writeSettings($languageAddress: String!, $settings: String!) {
470
471
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
471
- }`,variables:{languageAddress:e,settings:t}}));return n}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:n}=T(await Pr(this,Ut,"f").mutate({mutation:E`mutation languageApplyTemplateAndPublish(
472
+ }`,variables:{languageAddress:e,settings:t}}));return n}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:n}=I(await $r(this,qt,"f").mutate({mutation:E`mutation languageApplyTemplateAndPublish(
472
473
  $sourceLanguageHash: String!,
473
474
  $templateData: String!,
474
475
  ) {
475
476
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
476
477
  name, address
477
478
  }
478
- }`,variables:{sourceLanguageHash:e,templateData:t}}));return n}async publish(e,t){let{languagePublish:n}=T(await Pr(this,Ut,"f").mutate({mutation:E`mutation languagePublish(
479
+ }`,variables:{sourceLanguageHash:e,templateData:t}}));return n}async publish(e,t){let{languagePublish:n}=I(await $r(this,qt,"f").mutate({mutation:E`mutation languagePublish(
479
480
  $languagePath: String!,
480
481
  $languageMeta: LanguageMetaInput!,
481
482
  ) {
482
483
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
483
484
  ${Rp}
484
485
  }
485
- }`,variables:{languagePath:e,languageMeta:t}}));return n}async meta(e){let{languageMeta:t}=T(await Pr(this,Ut,"f").query({query:E`query languageMeta(
486
+ }`,variables:{languagePath:e,languageMeta:t}}));return n}async meta(e){let{languageMeta:t}=I(await $r(this,qt,"f").query({query:E`query languageMeta(
486
487
  $address: String!,
487
488
  ) {
488
489
  languageMeta(address: $address) {
489
490
  ${Rp}
490
491
  }
491
- }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=T(await Pr(this,Ut,"f").query({query:E`query languageSource(
492
+ }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=I(await $r(this,qt,"f").query({query:E`query languageSource(
492
493
  $address: String!,
493
494
  ) {
494
495
  languageSource(address: $address)
495
- }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=T(await Pr(this,Ut,"f").mutate({mutation:E`mutation languageRemove(
496
+ }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=I(await $r(this,qt,"f").mutate({mutation:E`mutation languageRemove(
496
497
  $address: String!,
497
498
  ) {
498
499
  languageRemove(address: $address)
499
- }`,variables:{address:e}}));return t}};Ut=new WeakMap;var Ky=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},Xe=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)},at,vi,ju=class{constructor(e){at.set(this,void 0),vi.set(this,new Map),Ky(this,at,e,"f")}async publishFromPerspective(e,t,n){let{neighbourhoodPublishFromPerspective:i}=T(await Xe(this,at,"f").mutate({mutation:E`mutation neighbourhoodPublishFromPerspective(
500
+ }`,variables:{address:e}}));return t}};qt=new WeakMap;var Zy=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,wi,Uu=class{constructor(e){ot.set(this,void 0),wi.set(this,new Map),Zy(this,ot,e,"f")}async publishFromPerspective(e,t,n){let{neighbourhoodPublishFromPerspective:i}=I(await et(this,ot,"f").mutate({mutation:E`mutation neighbourhoodPublishFromPerspective(
500
501
  $linkLanguage: String!,
501
502
  $meta: PerspectiveInput!,
502
503
  $perspectiveUUID: String!
@@ -506,7 +507,7 @@ neighbourhood {
506
507
  meta: $meta,
507
508
  perspectiveUUID: $perspectiveUUID
508
509
  )
509
- }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=T(await Xe(this,at,"f").mutate({mutation:E`mutation neighbourhoodJoinFromUrl($url: String!) {
510
+ }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=I(await et(this,ot,"f").mutate({mutation:E`mutation neighbourhoodJoinFromUrl($url: String!) {
510
511
  neighbourhoodJoinFromUrl(url: $url) {
511
512
  uuid
512
513
  name
@@ -528,11 +529,11 @@ neighbourhood {
528
529
  author
529
530
  }
530
531
  }
531
- }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=T(await Xe(this,at,"f").query({query:E`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
532
+ }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=I(await et(this,ot,"f").query({query:E`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
532
533
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
533
- }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=T(await Xe(this,at,"f").query({query:E`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
534
+ }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=I(await et(this,ot,"f").query({query:E`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
534
535
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
535
- }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=T(await Xe(this,at,"f").query({query:E`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
536
+ }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=I(await et(this,ot,"f").query({query:E`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
536
537
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
537
538
  did
538
539
  status {
@@ -549,7 +550,7 @@ neighbourhood {
549
550
  proof { valid, invalid, signature, key }
550
551
  }
551
552
  }
552
- }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:n}=T(await Xe(this,at,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatus(
553
+ }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:n}=I(await et(this,ot,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatus(
553
554
  $perspectiveUUID: String!,
554
555
  $status: PerspectiveInput!
555
556
  ) {
@@ -557,7 +558,7 @@ neighbourhood {
557
558
  perspectiveUUID: $perspectiveUUID,
558
559
  status: $status
559
560
  )
560
- }`,variables:{perspectiveUUID:e,status:t}}));return n}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:n}=T(await Xe(this,at,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatusU(
561
+ }`,variables:{perspectiveUUID:e,status:t}}));return n}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:n}=I(await et(this,ot,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatusU(
561
562
  $perspectiveUUID: String!,
562
563
  $status: PerspectiveUnsignedInput!
563
564
  ) {
@@ -565,7 +566,7 @@ neighbourhood {
565
566
  perspectiveUUID: $perspectiveUUID,
566
567
  status: $status
567
568
  )
568
- }`,variables:{perspectiveUUID:e,status:t}}));return n}async sendSignal(e,t,n){let{neighbourhoodSendSignal:i}=T(await Xe(this,at,"f").mutate({mutation:E`mutation neighbourhoodSendSignal(
569
+ }`,variables:{perspectiveUUID:e,status:t}}));return n}async sendSignal(e,t,n){let{neighbourhoodSendSignal:i}=I(await et(this,ot,"f").mutate({mutation:E`mutation neighbourhoodSendSignal(
569
570
  $perspectiveUUID: String!,
570
571
  $remoteAgentDid: String!,
571
572
  $payload: PerspectiveInput!
@@ -575,7 +576,7 @@ neighbourhood {
575
576
  remoteAgentDid: $remoteAgentDid,
576
577
  payload: $payload
577
578
  )
578
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendSignalU(e,t,n){let{neighbourhoodSendSignalU:i}=T(await Xe(this,at,"f").mutate({mutation:E`mutation neighbourhoodSendSignalU(
579
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendSignalU(e,t,n){let{neighbourhoodSendSignalU:i}=I(await et(this,ot,"f").mutate({mutation:E`mutation neighbourhoodSendSignalU(
579
580
  $perspectiveUUID: String!,
580
581
  $remoteAgentDid: String!,
581
582
  $payload: PerspectiveUnsignedInput!
@@ -585,7 +586,7 @@ neighbourhood {
585
586
  remoteAgentDid: $remoteAgentDid,
586
587
  payload: $payload
587
588
  )
588
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendBroadcast(e,t,n=!1){let{neighbourhoodSendBroadcast:i}=T(await Xe(this,at,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
589
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendBroadcast(e,t,n=!1){let{neighbourhoodSendBroadcast:i}=I(await et(this,ot,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
589
590
  $perspectiveUUID: String!,
590
591
  $payload: PerspectiveInput!,
591
592
  $loopback: Boolean
@@ -595,7 +596,7 @@ neighbourhood {
595
596
  payload: $payload,
596
597
  loopback: $loopback
597
598
  )
598
- }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}async sendBroadcastU(e,t,n=!1){let{neighbourhoodSendBroadcastU:i}=T(await Xe(this,at,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
599
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}async sendBroadcastU(e,t,n=!1){let{neighbourhoodSendBroadcastU:i}=I(await et(this,ot,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
599
600
  $perspectiveUUID: String!,
600
601
  $payload: PerspectiveUnsignedInput!,
601
602
  $loopback: Boolean
@@ -605,7 +606,7 @@ neighbourhood {
605
606
  payload: $payload,
606
607
  loopback: $loopback
607
608
  )
608
- }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}dispatchSignal(e,t){let n=Xe(this,vi,"f").get(e);if(n)for(let i of n)try{i(t)}catch(a){console.error("Error in signal handler:",a)}}async subscribeToSignals(e){let t=this;Xe(this,at,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
609
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}dispatchSignal(e,t){let n=et(this,wi,"f").get(e);if(n)for(let i of n)try{i(t)}catch(a){console.error("Error in signal handler:",a)}}async subscribeToSignals(e){let t=this;et(this,ot,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
609
610
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
610
611
  author
611
612
  timestamp
@@ -620,7 +621,7 @@ neighbourhood {
620
621
  }
621
622
  proof { valid, invalid, signature, key }
622
623
  }
623
- }`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{try{let{neighbourhoodSignal:i}=T(n);t.dispatchSignal(e,i)}catch(i){console.error("Error in signal subscription:",i)}},error:n=>{console.error("Signal subscription error for perspective",e,n)}})}async addSignalHandler(e,t){let n=Xe(this,vi,"f").get(e);n?n.push(t):(n=[],Xe(this,vi,"f").set(e,n),n.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let n=Xe(this,vi,"f").get(e);if(n){let i=n.indexOf(t);i>-1&&n.splice(i,1)}}};at=new WeakMap,vi=new WeakMap;var Ho=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)},H,Sa,wa,_a,rh,Ko=`
624
+ }`,variables:{perspectiveUUID:e}}).subscribe({next:n=>{try{let{neighbourhoodSignal:i}=I(n);t.dispatchSignal(e,i)}catch(i){console.error("Error in signal subscription:",i)}},error:n=>{console.error("Signal subscription error for perspective",e,n)}})}async addSignalHandler(e,t){let n=et(this,wi,"f").get(e);n?n.push(t):(n=[],et(this,wi,"f").set(e,n),n.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let n=et(this,wi,"f").get(e);if(n){let i=n.indexOf(t);i>-1&&n.splice(i,1)}}};ot=new WeakMap,wi=new WeakMap;var Go=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},M=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)},j,wa,_a,Ea,rh,Ko=`
624
625
  author
625
626
  timestamp
626
627
  data {
@@ -632,7 +633,7 @@ data {
632
633
  }
633
634
  }
634
635
  proof { valid, invalid, signature, key }
635
- `,Jy=`
636
+ `,Yy=`
636
637
  description
637
638
  appName
638
639
  appUrl
@@ -644,69 +645,71 @@ webhookAuth
644
645
  `,nh=`
645
646
  id
646
647
  granted
647
- ${Jy}
648
- `,Zy=`
648
+ ${Yy}
649
+ `,Xy=`
649
650
  notification { ${nh} }
650
651
  perspectiveId
651
652
  triggerMatch
652
- `,Uu=class{constructor(e,t=!0){H.set(this,void 0),Sa.set(this,void 0),wa.set(this,void 0),_a.set(this,void 0),rh.set(this,void 0),Ho(this,H,e,"f"),Ho(this,Sa,[],"f"),Ho(this,wa,[],"f"),Ho(this,_a,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=T(await V(this,H,"f").query({query:E`query runtimeInfo {
653
+ `,ju=class{constructor(e,t=!0){j.set(this,void 0),wa.set(this,void 0),_a.set(this,void 0),Ea.set(this,void 0),rh.set(this,void 0),Go(this,j,e,"f"),Go(this,wa,[],"f"),Go(this,_a,[],"f"),Go(this,Ea,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=I(await M(this,j,"f").query({query:E`query runtimeInfo {
653
654
  runtimeInfo {
654
655
  ad4mExecutorVersion,
655
656
  isInitialized,
656
657
  isUnlocked
657
658
  }
658
- }`}));return e}async quit(){return T(await V(this,H,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeOpenLink($url: String!) {
659
+ }`}));return e}async tlsDomain(){let{runtimeTlsDomain:e}=I(await M(this,j,"f").query({query:E`query runtimeTlsDomain {
660
+ runtimeTlsDomain
661
+ }`}));return e}async quit(){return I(await M(this,j,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeOpenLink($url: String!) {
659
662
  runtimeOpenLink(url: $url)
660
- }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=T(await V(this,H,"f").mutate({mutation:E`mutation addTrustedAgents($agents: [String!]!) {
663
+ }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=I(await M(this,j,"f").mutate({mutation:E`mutation addTrustedAgents($agents: [String!]!) {
661
664
  addTrustedAgents(agents: $agents)
662
- }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=T(await V(this,H,"f").mutate({mutation:E`mutation deleteTrustedAgents($agents: [String!]!) {
665
+ }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=I(await M(this,j,"f").mutate({mutation:E`mutation deleteTrustedAgents($agents: [String!]!) {
663
666
  deleteTrustedAgents(agents: $agents)
664
- }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=T(await V(this,H,"f").query({query:E`query getTrustedAgents {
667
+ }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=I(await M(this,j,"f").query({query:E`query getTrustedAgents {
665
668
  getTrustedAgents
666
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
669
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
667
670
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
668
- }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
671
+ }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
669
672
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
670
- }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=T(await V(this,H,"f").query({query:E`query runtimeKnownLinkLanguageTemplates {
673
+ }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=I(await M(this,j,"f").query({query:E`query runtimeKnownLinkLanguageTemplates {
671
674
  runtimeKnownLinkLanguageTemplates
672
- }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeAddFriends($dids: [String!]!) {
675
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeAddFriends($dids: [String!]!) {
673
676
  runtimeAddFriends(dids: $dids)
674
- }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeRemoveFriends($dids: [String!]!) {
677
+ }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeRemoveFriends($dids: [String!]!) {
675
678
  runtimeRemoveFriends(dids: $dids)
676
- }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=T(await V(this,H,"f").query({query:E`query runtimeFriends {
679
+ }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=I(await M(this,j,"f").query({query:E`query runtimeFriends {
677
680
  runtimeFriends
678
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=T(await V(this,H,"f").query({query:E`query runtimeHcAgentInfos {
681
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=I(await M(this,j,"f").query({query:E`query runtimeHcAgentInfos {
679
682
  runtimeHcAgentInfos
680
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=T(await V(this,H,"f").query({query:E`query runtimeGetNetworkMetrics {
683
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=I(await M(this,j,"f").query({query:E`query runtimeGetNetworkMetrics {
681
684
  runtimeGetNetworkMetrics
682
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeRestartHolochain {
685
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeRestartHolochain {
683
686
  runtimeRestartHolochain
684
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
687
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
685
688
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
686
- }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,n,i){let{runtimeVerifyStringSignedByDid:a}=T(await V(this,H,"f").mutate({mutation:E`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
689
+ }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,n,i){let{runtimeVerifyStringSignedByDid:a}=I(await M(this,j,"f").mutate({mutation:E`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
687
690
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
688
- }`,variables:{did:e,didSigningKeyId:t,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeSetStatus($status: PerspectiveInput!) {
691
+ }`,variables:{did:e,didSigningKeyId:t,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeSetStatus($status: PerspectiveInput!) {
689
692
  runtimeSetStatus(status: $status)
690
- }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=T(await V(this,H,"f").query({query:E`query runtimeFriendStatus($did: String!) {
693
+ }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=I(await M(this,j,"f").query({query:E`query runtimeFriendStatus($did: String!) {
691
694
  runtimeFriendStatus(did: $did) { ${Ko} }
692
- }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:n}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
695
+ }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:n}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
693
696
  runtimeFriendSendMessage(did: $did, message: $message)
694
- }`,variables:{did:e,message:t}}));return n}async messageInbox(e){let{runtimeMessageInbox:t}=T(await V(this,H,"f").query({query:E`query runtimeMessageInbox($filter: String) {
697
+ }`,variables:{did:e,message:t}}));return n}async messageInbox(e){let{runtimeMessageInbox:t}=I(await M(this,j,"f").query({query:E`query runtimeMessageInbox($filter: String) {
695
698
  runtimeMessageInbox(filter: $filter) { ${Ko} }
696
- }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=T(await V(this,H,"f").query({query:E`query runtimeMessageOutbox($filter: String) {
699
+ }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=I(await M(this,j,"f").query({query:E`query runtimeMessageOutbox($filter: String) {
697
700
  runtimeMessageOutbox(filter: $filter) {
698
701
  recipient,
699
702
  message {
700
703
  ${Ko}
701
704
  }
702
705
  }
703
- }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
706
+ }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
704
707
  runtimeRequestInstallNotification(notification: $notification)
705
- }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeGrantNotification($id: String!) {
708
+ }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeGrantNotification($id: String!) {
706
709
  runtimeGrantNotification(id: $id)
707
- }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeExportDb($filePath: String!) {
710
+ }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeExportDb($filePath: String!) {
708
711
  runtimeExportDb(filePath: $filePath)
709
- }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeImportDb($filePath: String!) {
712
+ }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeImportDb($filePath: String!) {
710
713
  runtimeImportDb(filePath: $filePath) {
711
714
  perspectives { total imported failed omitted errors }
712
715
  links { total imported failed omitted errors }
@@ -720,51 +723,72 @@ triggerMatch
720
723
  trustedAgents { total imported failed omitted errors }
721
724
  knownLinkLanguages { total imported failed omitted errors }
722
725
  }
723
- }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=T(await V(this,H,"f").query({query:E`query runtimeNotifications {
726
+ }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=I(await M(this,j,"f").query({query:E`query runtimeNotifications {
724
727
  runtimeNotifications { ${nh} }
725
- }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:n}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
728
+ }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:n}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
726
729
  runtimeUpdateNotification(id: $id, notification: $notification)
727
- }`,variables:{id:e,notification:t}}));return n}async removeNotification(e){let{runtimeRemoveNotification:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeRemoveNotification($id: String!) {
730
+ }`,variables:{id:e,notification:t}}));return n}async removeNotification(e){let{runtimeRemoveNotification:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeRemoveNotification($id: String!) {
728
731
  runtimeRemoveNotification(id: $id)
729
- }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:n}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
732
+ }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:n}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
730
733
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
731
- }`,variables:{perspectiveUuid:e,filePath:t}}));return n}async importPerspective(e){let{runtimeImportPerspective:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeImportPerspective($filePath: String!) {
734
+ }`,variables:{perspectiveUuid:e,filePath:t}}));return n}async importPerspective(e){let{runtimeImportPerspective:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeImportPerspective($filePath: String!) {
732
735
  runtimeImportPerspective(filePath: $filePath)
733
- }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=T(await V(this,H,"f").query({query:E`query runtimeMultiUserEnabled {
736
+ }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=I(await M(this,j,"f").query({query:E`query runtimeMultiUserEnabled {
734
737
  runtimeMultiUserEnabled
735
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
738
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
736
739
  runtimeSetMultiUserEnabled(enabled: $enabled)
737
- }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=T(await V(this,H,"f").query({query:E`query runtimeListUsers {
740
+ }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=I(await M(this,j,"f").query({query:E`query runtimeListUsers {
738
741
  runtimeListUsers {
739
742
  email
740
743
  did
741
744
  lastSeen
742
745
  perspectiveCount
746
+ remainingCredits
747
+ freeAccess
748
+ hotWalletAddress
743
749
  }
744
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeEmailTestModeEnable {
750
+ }`}));return e}async userWalletAddress(e){let{runtimeUserWalletAddress:t}=I(await M(this,j,"f").query({query:E`query runtimeUserWalletAddress($email: String!) {
751
+ runtimeUserWalletAddress(email: $email)
752
+ }`,variables:{email:e}}));return t}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeEmailTestModeEnable {
745
753
  runtimeEmailTestModeEnable
746
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeEmailTestModeDisable {
754
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeEmailTestModeDisable {
747
755
  runtimeEmailTestModeDisable
748
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeEmailTestGetCode($email: String!) {
756
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeEmailTestGetCode($email: String!) {
749
757
  runtimeEmailTestGetCode(email: $email)
750
- }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeEmailTestClearCodes {
758
+ }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeEmailTestClearCodes {
751
759
  runtimeEmailTestClearCodes
752
- }`}));return e}async emailTestSetExpiry(e,t,n){let{runtimeEmailTestSetExpiry:i}=T(await V(this,H,"f").mutate({mutation:E`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
760
+ }`}));return e}async emailTestSetExpiry(e,t,n){let{runtimeEmailTestSetExpiry:i}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
753
761
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
754
- }`,variables:{email:e,verificationType:t,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){V(this,_a,"f").push(e)}subscribeNotificationTriggered(){V(this,H,"f").subscribe({query:E` subscription {
755
- runtimeNotificationTriggered { ${Zy} }
762
+ }`,variables:{email:e,verificationType:t,expiresAt:n}}));return i}async unytAgentKey(){let{runtimeUnytAgentKey:e}=I(await M(this,j,"f").query({query:E`query runtimeUnytAgentKey { runtimeUnytAgentKey }`,fetchPolicy:"network-only"}));return e}async unytHotAgentPubkey(){let{runtimeHotAgentPubkey:e}=I(await M(this,j,"f").query({query:E`query runtimeHotAgentPubkey { runtimeHotAgentPubkey }`,fetchPolicy:"network-only"}));return e}async unytWalletBalance(){let{runtimeHotWalletBalance:e}=I(await M(this,j,"f").query({query:E`query runtimeHotWalletBalance { runtimeHotWalletBalance }`,fetchPolicy:"network-only"}));return e}async unytWalletHistory(e,t){let{runtimeHotWalletHistory:n}=I(await M(this,j,"f").query({query:E`query runtimeHotWalletHistory($page: Int, $perPage: Int) {
763
+ runtimeHotWalletHistory(page: $page, perPage: $perPage)
764
+ }`,variables:{page:e,perPage:t},fetchPolicy:"network-only"}));return n}async unytVersionInfo(){let{runtimeUnytVersionInfo:e}=I(await M(this,j,"f").query({query:E`query runtimeUnytVersionInfo { runtimeUnytVersionInfo }`,fetchPolicy:"network-only"}));return e}async unytSetMembraneProof(e){let{runtimeSetUnytMembraneProof:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeSetUnytMembraneProof($proof: String!) {
765
+ runtimeSetUnytMembraneProof(proof: $proof) { success message }
766
+ }`,variables:{proof:e}}));return t}async unytReinstallDna(){let{runtimeReinstallUnytDna:e}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeReinstallUnytDna {
767
+ runtimeReinstallUnytDna { success message }
768
+ }`}));return e}async unytSendHot(e,t){let{runtimeSendHot:n}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeSendHot($recipient: String!, $amount: String!) {
769
+ runtimeSendHot(recipient: $recipient, amount: $amount) { success message }
770
+ }`,variables:{recipient:e,amount:t}}));return n}async setUserCredits(e,t){let{runtimeSetUserCredits:n}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeSetUserCredits($email: String!, $amount: Float!) {
771
+ runtimeSetUserCredits(email: $email, amount: $amount)
772
+ }`,variables:{email:e,amount:t}}));return n}async setUserFreeAccess(e,t){let{runtimeSetUserFreeAccess:n}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeSetUserFreeAccess($email: String!, $enabled: Boolean!) {
773
+ runtimeSetUserFreeAccess(email: $email, enabled: $enabled)
774
+ }`,variables:{email:e,enabled:t}}));return n}async setHostRates(e){let{runtimeSetHostRates:t}=I(await M(this,j,"f").mutate({mutation:E`mutation runtimeSetHostRates($ratesJson: String!) {
775
+ runtimeSetHostRates(ratesJson: $ratesJson)
776
+ }`,variables:{ratesJson:e}}));return t}async getHostRates(){let{runtimeHostRates:e}=I(await M(this,j,"f").query({query:E`query runtimeHostRates {
777
+ runtimeHostRates
778
+ }`,fetchPolicy:"network-only"}));try{return JSON.parse(e)}catch{return[]}}addNotificationTriggeredCallback(e){M(this,Ea,"f").push(e)}subscribeNotificationTriggered(){M(this,j,"f").subscribe({query:E` subscription {
779
+ runtimeNotificationTriggered { ${Xy} }
756
780
  }
757
- `}).subscribe({next:e=>{V(this,_a,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){V(this,Sa,"f").push(e)}subscribeMessageReceived(){V(this,H,"f").subscribe({query:E` subscription {
781
+ `}).subscribe({next:e=>{M(this,Ea,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){M(this,wa,"f").push(e)}subscribeMessageReceived(){M(this,j,"f").subscribe({query:E` subscription {
758
782
  runtimeMessageReceived { ${Ko} }
759
783
  }
760
- `}).subscribe({next:e=>{V(this,Sa,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){V(this,wa,"f").push(e)}subscribeExceptionOccurred(){V(this,H,"f").subscribe({query:E` subscription {
784
+ `}).subscribe({next:e=>{M(this,wa,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){M(this,_a,"f").push(e)}subscribeExceptionOccurred(){M(this,j,"f").subscribe({query:E` subscription {
761
785
  exceptionOccurred {
762
786
  title
763
787
  message
764
788
  type
765
789
  addon
766
790
  }
767
- }`}).subscribe({next:e=>{V(this,wa,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};H=new WeakMap,Sa=new WeakMap,wa=new WeakMap,_a=new WeakMap,rh=new WeakMap;var Yy=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},di=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)},yr,qu=class{constructor(e){yr.set(this,void 0),Yy(this,yr,e,"f")}async get(e,t=!1){if(!t)try{let i=be.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}=T(await di(this,yr,"f").query({query:E`query expression($url: String!) {
791
+ }`}).subscribe({next:e=>{M(this,_a,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};j=new WeakMap,wa=new WeakMap,_a=new WeakMap,Ea=new WeakMap,rh=new WeakMap;var ev=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},gi=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)},vr,qu=class{constructor(e){vr.set(this,void 0),ev(this,vr,e,"f")}async get(e,t=!1){if(!t)try{let i=Se.fromUrl(e).get();if(typeof i=="object"&&i!==null&&"author"in i&&"timestamp"in i&&"data"in i&&"proof"in i)return i}catch{}let{expression:n}=I(await gi(this,vr,"f").query({query:E`query expression($url: String!) {
768
792
  expression(url: $url) {
769
793
  author
770
794
  timestamp
@@ -777,7 +801,7 @@ triggerMatch
777
801
  invalid
778
802
  }
779
803
  }
780
- }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:t}=T(await di(this,yr,"f").query({query:E`query expressionMany($urls: [String!]!) {
804
+ }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:t}=I(await gi(this,vr,"f").query({query:E`query expressionMany($urls: [String!]!) {
781
805
  expressionMany(urls: $urls) {
782
806
  author
783
807
  timestamp
@@ -790,19 +814,19 @@ triggerMatch
790
814
  invalid
791
815
  }
792
816
  }
793
- }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=T(await di(this,yr,"f").query({query:E`query expressionRaw($url: String!) {
817
+ }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=I(await gi(this,vr,"f").query({query:E`query expressionRaw($url: String!) {
794
818
  expressionRaw(url: $url)
795
- }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:n}=T(await di(this,yr,"f").mutate({mutation:E`mutation expressionCreate($content: String!, $languageAddress: String!){
819
+ }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:n}=I(await gi(this,vr,"f").mutate({mutation:E`mutation expressionCreate($content: String!, $languageAddress: String!){
796
820
  expressionCreate(content: $content, languageAddress: $languageAddress)
797
- }`,variables:{content:e,languageAddress:t}}));return n}async interactions(e){let{expressionInteractions:t}=T(await di(this,yr,"f").query({query:E`query expressionInteractions($url: String!) {
821
+ }`,variables:{content:e,languageAddress:t}}));return n}async interactions(e){let{expressionInteractions:t}=I(await gi(this,vr,"f").query({query:E`query expressionInteractions($url: String!) {
798
822
  expressionInteractions(url: $url) {
799
823
  label
800
824
  name
801
825
  parameters { name, type }
802
826
  }
803
- }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:n}=T(await di(this,yr,"f").mutate({mutation:E`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
827
+ }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:n}=I(await gi(this,vr,"f").mutate({mutation:E`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
804
828
  expressionInteract(url: $url, interactionCall: $interactionCall)
805
- }`,variables:{url:e,interactionCall:t}}));return n}};yr=new WeakMap;var Ws={};Ws.byteLength=ev;Ws.toByteArray=rv;Ws.fromByteArray=av;var Xt=[],Dt=[],Xy=typeof Uint8Array<"u"?Uint8Array:Array,hu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(pn=0,Cp=hu.length;pn<Cp;++pn)Xt[pn]=hu[pn],Dt[hu.charCodeAt(pn)]=pn;var pn,Cp;Dt["-".charCodeAt(0)]=62;Dt["_".charCodeAt(0)]=63;function ih(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 ev(r){var e=ih(r),t=e[0],n=e[1];return(t+n)*3/4-n}function tv(r,e,t){return(e+t)*3/4-t}function rv(r){var e,t=ih(r),n=t[0],i=t[1],a=new Xy(tv(r,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=Dt[r.charCodeAt(c)]<<18|Dt[r.charCodeAt(c+1)]<<12|Dt[r.charCodeAt(c+2)]<<6|Dt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Dt[r.charCodeAt(c)]<<2|Dt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=Dt[r.charCodeAt(c)]<<10|Dt[r.charCodeAt(c+1)]<<4|Dt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function nv(r){return Xt[r>>18&63]+Xt[r>>12&63]+Xt[r>>6&63]+Xt[r&63]}function iv(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(nv(n));return i.join("")}function av(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(iv(r,o,o+a>s?s:o+a));return n===1?(e=r[t-1],i.push(Xt[e>>2]+Xt[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(Xt[e>>10]+Xt[e>>4&63]+Xt[e<<2&63]+"=")),i.join("")}var ov=4,Pp=0,Lp=1,sv=2;function Li(r){let e=r.length;for(;--e>=0;)r[e]=0}var cv=0,ah=1,uv=2,lv=3,fv=258,al=29,Za=256,ja=Za+1+al,Si=30,ol=19,oh=2*ja+1,En=15,mu=16,pv=7,sl=256,sh=16,ch=17,uh=18,Bu=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),hs=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),dv=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),lh=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),hv=512,vr=new Array((ja+2)*2);Li(vr);var Na=new Array(Si*2);Li(Na);var Ua=new Array(hv);Li(Ua);var qa=new Array(fv-lv+1);Li(qa);var cl=new Array(al);Li(cl);var Ns=new Array(Si);Li(Ns);function gu(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 fh,ph,dh;function yu(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var hh=r=>r<256?Ua[r]:Ua[256+(r>>>7)],Ba=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},mt=(r,e,t)=>{r.bi_valid>mu-t?(r.bi_buf|=e<<r.bi_valid&65535,Ba(r,r.bi_buf),r.bi_buf=e>>mu-r.bi_valid,r.bi_valid+=t-mu):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},er=(r,e,t)=>{mt(r,t[e*2],t[e*2+1])},mh=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},mv=r=>{r.bi_valid===16?(Ba(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)},gv=(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,p,d,f,h,m=0;for(d=0;d<=En;d++)r.bl_count[d]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<oh;u++)l=r.heap[u],d=t[t[l*2+1]*2+1]+1,d>c&&(d=c,m++),t[l*2+1]=d,!(l>n)&&(r.bl_count[d]++,f=0,l>=s&&(f=o[l-s]),h=t[l*2],r.opt_len+=h*(d+f),a&&(r.static_len+=h*(i[l*2+1]+f)));if(m!==0){do{for(d=c-1;r.bl_count[d]===0;)d--;r.bl_count[d]--,r.bl_count[d+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(d=c;d!==0;d--)for(l=r.bl_count[d];l!==0;)p=r.heap[--u],!(p>n)&&(t[p*2+1]!==d&&(r.opt_len+=(d-t[p*2+1])*t[p*2],t[p*2+1]=d),l--)}},gh=(r,e,t)=>{let n=new Array(En+1),i=0,a,o;for(a=1;a<=En;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]=mh(n[s]++,s))}},yv=()=>{let r,e,t,n,i,a=new Array(En+1);for(t=0,n=0;n<al-1;n++)for(cl[n]=t,r=0;r<1<<Bu[n];r++)qa[t++]=n;for(qa[t-1]=n,i=0,n=0;n<16;n++)for(Ns[n]=i,r=0;r<1<<hs[n];r++)Ua[i++]=n;for(i>>=7;n<Si;n++)for(Ns[n]=i<<7,r=0;r<1<<hs[n]-7;r++)Ua[256+i++]=n;for(e=0;e<=En;e++)a[e]=0;for(r=0;r<=143;)vr[r*2+1]=8,r++,a[8]++;for(;r<=255;)vr[r*2+1]=9,r++,a[9]++;for(;r<=279;)vr[r*2+1]=7,r++,a[7]++;for(;r<=287;)vr[r*2+1]=8,r++,a[8]++;for(gh(vr,ja+1,a),r=0;r<Si;r++)Na[r*2+1]=5,Na[r*2]=mh(r,5);fh=new gu(vr,Bu,Za+1,ja,En),ph=new gu(Na,hs,0,Si,En),dh=new gu(new Array(0),dv,0,ol,pv)},yh=r=>{let e;for(e=0;e<ja;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Si;e++)r.dyn_dtree[e*2]=0;for(e=0;e<ol;e++)r.bl_tree[e*2]=0;r.dyn_ltree[sl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},vh=r=>{r.bi_valid>8?Ba(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},$p=(r,e,t,n)=>{let i=e*2,a=t*2;return r[i]<r[a]||r[i]===r[a]&&n[e]<=n[t]},vu=(r,e,t)=>{let n=r.heap[t],i=t<<1;for(;i<=r.heap_len&&(i<r.heap_len&&$p(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!$p(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n},Fp=(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?er(r,i,e):(o=qa[i],er(r,o+Za+1,e),s=Bu[o],s!==0&&(i-=cl[o],mt(r,i,s)),n--,o=hh(n),er(r,o,t),s=hs[o],s!==0&&(n-=Ns[o],mt(r,n,s)));while(a<r.sym_next);er(r,sl,e)},Vu=(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=oh,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--)vu(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],vu(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++,vu(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],gv(r,e),gh(t,c,r.bl_count)},Mp=(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[sh*2]++):s<=10?r.bl_tree[ch*2]++:r.bl_tree[uh*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},jp=(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 er(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==i&&(er(r,a,r.bl_tree),s--),er(r,sh,r.bl_tree),mt(r,s-3,2)):s<=10?(er(r,ch,r.bl_tree),mt(r,s-3,3)):(er(r,uh,r.bl_tree),mt(r,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},vv=r=>{let e;for(Mp(r,r.dyn_ltree,r.l_desc.max_code),Mp(r,r.dyn_dtree,r.d_desc.max_code),Vu(r,r.bl_desc),e=ol-1;e>=3&&r.bl_tree[lh[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},bv=(r,e,t,n)=>{let i;for(mt(r,e-257,5),mt(r,t-1,5),mt(r,n-4,4),i=0;i<n;i++)mt(r,r.bl_tree[lh[i]*2+1],3);jp(r,r.dyn_ltree,e-1),jp(r,r.dyn_dtree,t-1)},Sv=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Pp;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Lp;for(t=32;t<Za;t++)if(r.dyn_ltree[t*2]!==0)return Lp;return Pp},Up=!1,wv=r=>{Up||(yv(),Up=!0),r.l_desc=new yu(r.dyn_ltree,fh),r.d_desc=new yu(r.dyn_dtree,ph),r.bl_desc=new yu(r.bl_tree,dh),r.bi_buf=0,r.bi_valid=0,yh(r)},bh=(r,e,t,n)=>{mt(r,(cv<<1)+(n?1:0),3),vh(r),Ba(r,t),Ba(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},_v=r=>{mt(r,ah<<1,3),er(r,sl,vr),mv(r)},Ev=(r,e,t,n)=>{let i,a,o=0;r.level>0?(r.strm.data_type===sv&&(r.strm.data_type=Sv(r)),Vu(r,r.l_desc),Vu(r,r.d_desc),o=vv(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?bh(r,e,t,n):r.strategy===ov||a===i?(mt(r,(ah<<1)+(n?1:0),3),Fp(r,vr,Na)):(mt(r,(uv<<1)+(n?1:0),3),bv(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Fp(r,r.dyn_ltree,r.dyn_dtree)),yh(r),n&&vh(r)},xv=(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[(qa[t]+Za+1)*2]++,r.dyn_dtree[hh(e)*2]++),r.sym_next===r.sym_end),kv=wv,Iv=bh,Tv=Ev,Av=xv,Ov=_v,Dv={_tr_init:kv,_tr_stored_block:Iv,_tr_flush_block:Tv,_tr_tally:Av,_tr_align:Ov},Nv=(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},Va=Nv,Rv=()=>{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},Cv=new Uint32Array(Rv()),Pv=(r,e,t,n)=>{let i=Cv,a=n+t;r^=-1;for(let o=n;o<a;o++)r=r>>>8^i[(r^e[o])&255];return r^-1},Ve=Pv,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"},Vn={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:Lv,_tr_stored_block:Qu,_tr_flush_block:$v,_tr_tally:Vr,_tr_align:Fv}=Dv,{Z_NO_FLUSH:Qr,Z_PARTIAL_FLUSH:Mv,Z_FULL_FLUSH:jv,Z_FINISH:Rt,Z_BLOCK:qp,Z_OK:Je,Z_STREAM_END:Bp,Z_STREAM_ERROR:nr,Z_DATA_ERROR:Uv,Z_BUF_ERROR:bu,Z_DEFAULT_COMPRESSION:qv,Z_FILTERED:Bv,Z_HUFFMAN_ONLY:Jo,Z_RLE:Vv,Z_FIXED:Qv,Z_DEFAULT_STRATEGY:zv,Z_UNKNOWN:Wv,Z_DEFLATED:Gs}=Vn,Gv=9,Hv=15,Kv=8,Jv=29,Zv=256,zu=Zv+1+Jv,Yv=30,Xv=19,eb=2*zu+1,tb=15,ie=3,jr=258,ir=jr+ie+1,rb=32,ki=42,ul=57,Wu=69,Gu=73,Hu=91,Ku=103,xn=113,Ea=666,ot=1,$i=2,Pn=3,Fi=4,nb=3,kn=(r,e)=>(r.msg=Cn[e],e),Vp=r=>r*2-(r>4?9:0),Mr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},ib=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)},ab=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,zr=ab,St=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)=>{$v(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,St(r.strm)},de=(r,e)=>{r.pending_buf[r.pending++]=e},ca=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Ju=(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=Va(r.adler,e,i,t):r.state.wrap===2&&(r.adler=Ve(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)},Sh=(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-ir?r.strstart-(r.w_size-ir):0,u=r.window,l=r.w_mask,p=r.prev,d=r.strstart+jr,f=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]!==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<d);if(a=jr-(d-n),n=d-jr,a>o){if(r.match_start=e,o=a,a>=s)break;f=u[n+o-1],h=u[n+o]}}while((e=p[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-ir)&&(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),ib(r),n+=e),r.strm.avail_in===0)break;if(t=Ju(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=zr(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=zr(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<ir&&r.strm.avail_in!==0)},wh=(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!==Rt||e===Qr||n!==i+r.strm.avail_in)))break;o=e===Rt&&n===i+r.strm.avail_in?1:0,Qu(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,St(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&&(Ju(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?Fi:e!==Qr&&e!==Rt&&r.strm.avail_in===0&&r.strstart===r.block_start?$i:(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&&(Ju(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===Rt)&&e!==Qr&&r.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Rt&&r.strm.avail_in===0&&n===i?1:0,Qu(r,r.block_start,n,o),r.block_start+=n,St(r.strm)),o?Pn:ot)},Su=(r,e)=>{let t,n;for(;;){if(r.lookahead<ir){if(Ii(r),r.lookahead<ir&&e===Qr)return ot;if(r.lookahead===0)break}if(t=0,r.lookahead>=ie&&(r.ins_h=zr(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-ir&&(r.match_length=Sh(r,t)),r.match_length>=ie)if(n=Vr(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=zr(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=zr(r,r.ins_h,r.window[r.strstart+1]);else n=Vr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(_t(r,!1),r.strm.avail_out===0))return ot}return r.insert=r.strstart<ie-1?r.strstart:ie-1,e===Rt?(_t(r,!0),r.strm.avail_out===0?Pn:Fi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?ot:$i},hi=(r,e)=>{let t,n,i;for(;;){if(r.lookahead<ir){if(Ii(r),r.lookahead<ir&&e===Qr)return ot;if(r.lookahead===0)break}if(t=0,r.lookahead>=ie&&(r.ins_h=zr(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-ir&&(r.match_length=Sh(r,t),r.match_length<=5&&(r.strategy===Bv||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=Vr(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=zr(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 ot}else if(r.match_available){if(n=Vr(r,0,r.window[r.strstart-1]),n&&_t(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return ot}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=Vr(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ie-1?r.strstart:ie-1,e===Rt?(_t(r,!0),r.strm.avail_out===0?Pn:Fi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?ot:$i},ob=(r,e)=>{let t,n,i,a,o=r.window;for(;;){if(r.lookahead<=jr){if(Ii(r),r.lookahead<=jr&&e===Qr)return ot;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+jr;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=jr-(a-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ie?(t=Vr(r,1,r.match_length-ie),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=Vr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(_t(r,!1),r.strm.avail_out===0))return ot}return r.insert=0,e===Rt?(_t(r,!0),r.strm.avail_out===0?Pn:Fi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?ot:$i},sb=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Ii(r),r.lookahead===0)){if(e===Qr)return ot;break}if(r.match_length=0,t=Vr(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(_t(r,!1),r.strm.avail_out===0))return ot}return r.insert=0,e===Rt?(_t(r,!0),r.strm.avail_out===0?Pn:Fi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?ot:$i};function Ht(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 xa=[new Ht(0,0,0,0,wh),new Ht(4,4,8,4,Su),new Ht(4,5,16,8,Su),new Ht(4,6,32,32,Su),new Ht(4,4,16,16,hi),new Ht(8,16,32,32,hi),new Ht(8,16,128,128,hi),new Ht(8,32,128,256,hi),new Ht(32,128,258,1024,hi),new Ht(32,258,258,4096,hi)],cb=r=>{r.window_size=2*r.w_size,Mr(r.head),r.max_lazy_match=xa[r.level].max_lazy,r.good_match=xa[r.level].good_length,r.nice_match=xa[r.level].nice_length,r.max_chain_length=xa[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ie-1,r.match_available=0,r.ins_h=0};function ub(){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=Gs,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(eb*2),this.dyn_dtree=new Uint16Array((2*Yv+1)*2),this.bl_tree=new Uint16Array((2*Xv+1)*2),Mr(this.dyn_ltree),Mr(this.dyn_dtree),Mr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(tb+1),this.heap=new Uint16Array(2*zu+1),Mr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*zu+1),Mr(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 Ya=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==ki&&e.status!==ul&&e.status!==Wu&&e.status!==Gu&&e.status!==Hu&&e.status!==Ku&&e.status!==xn&&e.status!==Ea?1:0},_h=r=>{if(Ya(r))return kn(r,nr);r.total_in=r.total_out=0,r.data_type=Wv;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?ul:e.wrap?ki:xn,r.adler=e.wrap===2?0:1,e.last_flush=-2,Lv(e),Je},Eh=r=>{let e=_h(r);return e===Je&&cb(r.state),e},lb=(r,e)=>Ya(r)||r.state.wrap!==2?nr:(r.state.gzhead=e,Je),xh=(r,e,t,n,i,a)=>{if(!r)return nr;let o=1;if(e===qv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>Gv||t!==Gs||n<8||n>15||e<0||e>9||a<0||a>Qv||n===8&&o!==1)return kn(r,nr);n===8&&(n=9);let s=new ub;return r.state=s,s.strm=r,s.status=ki,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,Eh(r)},fb=(r,e)=>xh(r,e,Gs,Hv,Kv,zv),pb=(r,e)=>{if(Ya(r)||e>qp||e<0)return r?kn(r,nr):nr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Ea&&e!==Rt)return kn(r,r.avail_out===0?bu:nr);let n=t.last_flush;if(t.last_flush=e,t.pending!==0){if(St(r),r.avail_out===0)return t.last_flush=-1,Je}else if(r.avail_in===0&&Vp(e)<=Vp(n)&&e!==Rt)return kn(r,bu);if(t.status===Ea&&r.avail_in!==0)return kn(r,bu);if(t.status===ki&&t.wrap===0&&(t.status=xn),t.status===ki){let i=Gs+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Jo||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=rb),i+=31-i%31,ca(t,i),t.strstart!==0&&(ca(t,r.adler>>>16),ca(t,r.adler&65535)),r.adler=1,t.status=xn,St(r),t.pending!==0)return t.last_flush=-1,Je}if(t.status===ul){if(r.adler=0,de(t,31),de(t,139),de(t,8),t.gzhead)de(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)),de(t,t.gzhead.time&255),de(t,t.gzhead.time>>8&255),de(t,t.gzhead.time>>16&255),de(t,t.gzhead.time>>24&255),de(t,t.level===9?2:t.strategy>=Jo||t.level<2?4:0),de(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(de(t,t.gzhead.extra.length&255),de(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ve(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Wu;else if(de(t,0),de(t,0),de(t,0),de(t,0),de(t,0),de(t,t.level===9?2:t.strategy>=Jo||t.level<2?4:0),de(t,nb),t.status=xn,St(r),t.pending!==0)return t.last_flush=-1,Je}if(t.status===Wu){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=Ve(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=s,St(r),t.pending!==0)return t.last_flush=-1,Je;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=Ve(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Gu}if(t.status===Gu){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=Ve(r.adler,t.pending_buf,t.pending-i,i)),St(r),t.pending!==0)return t.last_flush=-1,Je;i=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,de(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Ve(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Hu}if(t.status===Hu){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=Ve(r.adler,t.pending_buf,t.pending-i,i)),St(r),t.pending!==0)return t.last_flush=-1,Je;i=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,de(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Ve(r.adler,t.pending_buf,t.pending-i,i))}t.status=Ku}if(t.status===Ku){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(St(r),t.pending!==0))return t.last_flush=-1,Je;de(t,r.adler&255),de(t,r.adler>>8&255),r.adler=0}if(t.status=xn,St(r),t.pending!==0)return t.last_flush=-1,Je}if(r.avail_in!==0||t.lookahead!==0||e!==Qr&&t.status!==Ea){let i=t.level===0?wh(t,e):t.strategy===Jo?sb(t,e):t.strategy===Vv?ob(t,e):xa[t.level].func(t,e);if((i===Pn||i===Fi)&&(t.status=Ea),i===ot||i===Pn)return r.avail_out===0&&(t.last_flush=-1),Je;if(i===$i&&(e===Mv?Fv(t):e!==qp&&(Qu(t,0,0,!1),e===jv&&(Mr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),St(r),r.avail_out===0))return t.last_flush=-1,Je}return e!==Rt?Je:t.wrap<=0?Bp:(t.wrap===2?(de(t,r.adler&255),de(t,r.adler>>8&255),de(t,r.adler>>16&255),de(t,r.adler>>24&255),de(t,r.total_in&255),de(t,r.total_in>>8&255),de(t,r.total_in>>16&255),de(t,r.total_in>>24&255)):(ca(t,r.adler>>>16),ca(t,r.adler&65535)),St(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Je:Bp)},db=r=>{if(Ya(r))return nr;let e=r.state.status;return r.state=null,e===xn?kn(r,Uv):Je},hb=(r,e)=>{let t=e.length;if(Ya(r))return nr;let n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==ki||n.lookahead)return nr;if(i===1&&(r.adler=Va(r.adler,e,t,0)),n.wrap=0,t>=n.w_size){i===0&&(Mr(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=zr(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,Je},mb=fb,gb=xh,yb=Eh,vb=_h,bb=lb,Sb=pb,wb=db,_b=hb,Eb="pako deflate (from Nodeca project)",Ra={deflateInit:mb,deflateInit2:gb,deflateReset:yb,deflateResetKeep:vb,deflateSetHeader:bb,deflate:Sb,deflateEnd:wb,deflateSetDictionary:_b,deflateInfo:Eb},xb=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),kb=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)xb(t,n)&&(r[n]=t[n])}}return r},Ib=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},Hs={assign:kb,flattenChunks:Ib},kh=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){kh=!1}var Qa=new Uint8Array(256);for(let r=0;r<256;r++)Qa[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Qa[254]=Qa[254]=1;var Tb=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},Ab=(r,e)=>{if(e<65534&&r.subarray&&kh)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},Ob=(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=Qa[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 Ab(a,i)},Db=(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+Qa[r[t]]>e?t:e},za={string2buf:Tb,buf2string:Ob,utf8border:Db};function Nb(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var Ih=Nb,Th=Object.prototype.toString,{Z_NO_FLUSH:Rb,Z_SYNC_FLUSH:Cb,Z_FULL_FLUSH:Pb,Z_FINISH:Lb,Z_OK:Rs,Z_STREAM_END:$b,Z_DEFAULT_COMPRESSION:Fb,Z_DEFAULT_STRATEGY:Mb,Z_DEFLATED:jb}=Vn;function Xa(r){this.options=Hs.assign({level:Fb,method:jb,chunkSize:16384,windowBits:15,memLevel:8,strategy:Mb},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 Ih,this.strm.avail_out=0;let t=Ra.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Rs)throw new Error(Cn[t]);if(e.header&&Ra.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=za.string2buf(e.dictionary):Th.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=Ra.deflateSetDictionary(this.strm,n),t!==Rs)throw new Error(Cn[t]);this._dict_set=!0}}Xa.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?Lb:Rb,typeof r=="string"?t.input=za.string2buf(r):Th.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===Cb||a===Pb)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=Ra.deflate(t,a),i===$b)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=Ra.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Rs;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};Xa.prototype.onData=function(r){this.chunks.push(r)};Xa.prototype.onEnd=function(r){r===Rs&&(this.result=Hs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ll(r,e){let t=new Xa(e);if(t.push(r,!0),t.err)throw t.msg||Cn[t.err];return t.result}function Ub(r,e){return e=e||{},e.raw=!0,ll(r,e)}function qb(r,e){return e=e||{},e.gzip=!0,ll(r,e)}var Bb=Xa,Vb=ll,Qb=Ub,zb=qb,Wb=Vn,Gb={Deflate:Bb,deflate:Vb,deflateRaw:Qb,gzip:zb,constants:Wb},Zo=16209,Hb=16191,Kb=function r(e,t){let n,i,a,o,s,c,u,l,p,d,f,h,m,v,_,y,b,g,A,N,I,C,$,P,j=e.state;n=e.next_in,$=e.input,i=n+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=j.dmax,u=j.wsize,l=j.whave,p=j.wnext,d=j.window,f=j.hold,h=j.bits,m=j.lencode,v=j.distcode,_=(1<<j.lenbits)-1,y=(1<<j.distbits)-1;e:do{h<15&&(f+=$[n++]<<h,h+=8,f+=$[n++]<<h,h+=8),b=m[f&_];t:for(;;){if(g=b>>>24,f>>>=g,h-=g,g=b>>>16&255,g===0)P[a++]=b&65535;else if(g&16){A=b&65535,g&=15,g&&(h<g&&(f+=$[n++]<<h,h+=8),A+=f&(1<<g)-1,f>>>=g,h-=g),h<15&&(f+=$[n++]<<h,h+=8,f+=$[n++]<<h,h+=8),b=v[f&y];r:for(;;){if(g=b>>>24,f>>>=g,h-=g,g=b>>>16&255,g&16){if(N=b&65535,g&=15,h<g&&(f+=$[n++]<<h,h+=8,h<g&&(f+=$[n++]<<h,h+=8)),N+=f&(1<<g)-1,N>c){e.msg="invalid distance too far back",j.mode=Zo;break e}if(f>>>=g,h-=g,g=a-o,N>g){if(g=N-g,g>l&&j.sane){e.msg="invalid distance too far back",j.mode=Zo;break e}if(I=0,C=d,p===0){if(I+=u-g,g<A){A-=g;do P[a++]=d[I++];while(--g);I=a-N,C=P}}else if(p<g){if(I+=u+p-g,g-=p,g<A){A-=g;do P[a++]=d[I++];while(--g);if(I=0,p<A){g=p,A-=g;do P[a++]=d[I++];while(--g);I=a-N,C=P}}}else if(I+=p-g,g<A){A-=g;do P[a++]=d[I++];while(--g);I=a-N,C=P}for(;A>2;)P[a++]=C[I++],P[a++]=C[I++],P[a++]=C[I++],A-=3;A&&(P[a++]=C[I++],A>1&&(P[a++]=C[I++]))}else{I=a-N;do P[a++]=P[I++],P[a++]=P[I++],P[a++]=P[I++],A-=3;while(A>2);A&&(P[a++]=P[I++],A>1&&(P[a++]=P[I++]))}}else if((g&64)===0){b=v[(b&65535)+(f&(1<<g)-1)];continue r}else{e.msg="invalid distance code",j.mode=Zo;break e}break}}else if((g&64)===0){b=m[(b&65535)+(f&(1<<g)-1)];continue t}else if(g&32){j.mode=Hb;break e}else{e.msg="invalid literal/length code",j.mode=Zo;break e}break}}while(n<i&&a<s);A=h>>3,n-=A,h-=A<<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),j.hold=f,j.bits=h},mi=15,Qp=852,zp=592,Wp=0,wu=1,Gp=2,Jb=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]),Zb=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]),Yb=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]),Xb=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]),eS=(r,e,t,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,p=0,d=0,f=0,h=0,m=0,v=0,_=0,y=0,b,g,A,N,I,C=null,$,P=new Uint16Array(mi+1),j=new Uint16Array(mi+1),xe=null,Te,k,ye;for(u=0;u<=mi;u++)P[u]=0;for(l=0;l<n;l++)P[e[t+l]]++;for(f=c,d=mi;d>=1&&P[d]===0;d--);if(f>d&&(f=d),d===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(p=1;p<d&&P[p]===0;p++);for(f<p&&(f=p),v=1,u=1;u<=mi;u++)if(v<<=1,v-=P[u],v<0)return-1;if(v>0&&(r===Wp||d!==1))return-1;for(j[1]=0,u=1;u<mi;u++)j[u+1]=j[u]+P[u];for(l=0;l<n;l++)e[t+l]!==0&&(o[j[e[t+l]]++]=l);if(r===Wp?(C=xe=o,$=20):r===wu?(C=Jb,xe=Zb,$=257):(C=Yb,xe=Xb,$=0),y=0,l=0,u=p,I=a,h=f,m=0,A=-1,_=1<<f,N=_-1,r===wu&&_>Qp||r===Gp&&_>zp)return 1;for(;;){Te=u-m,o[l]+1<$?(k=0,ye=o[l]):o[l]>=$?(k=xe[o[l]-$],ye=C[o[l]-$]):(k=32+64,ye=0),b=1<<u-m,g=1<<h,p=g;do g-=b,i[I+(y>>m)+g]=Te<<24|k<<16|ye|0;while(g!==0);for(b=1<<u-1;y&b;)b>>=1;if(b!==0?(y&=b-1,y+=b):y=0,l++,--P[u]===0){if(u===d)break;u=e[t+o[l]]}if(u>f&&(y&N)!==A){for(m===0&&(m=f),I+=p,h=u-m,v=1<<h;h+m<d&&(v-=P[h+m],!(v<=0));)h++,v<<=1;if(_+=1<<h,r===wu&&_>Qp||r===Gp&&_>zp)return 1;A=y&N,i[A]=f<<24|h<<16|I-a|0}}return y!==0&&(i[I+y]=u-m<<24|64<<16|0),s.bits=f,0},Ca=eS,tS=0,Ah=1,Oh=2,{Z_FINISH:Hp,Z_BLOCK:rS,Z_TREES:Yo,Z_OK:Ln,Z_STREAM_END:nS,Z_NEED_DICT:iS,Z_STREAM_ERROR:Ct,Z_DATA_ERROR:Dh,Z_MEM_ERROR:Nh,Z_BUF_ERROR:aS,Z_DEFLATED:Kp}=Vn,Ks=16180,Jp=16181,Zp=16182,Yp=16183,Xp=16184,ed=16185,td=16186,rd=16187,nd=16188,id=16189,Cs=16190,hr=16191,_u=16192,ad=16193,Eu=16194,od=16195,sd=16196,cd=16197,ud=16198,Xo=16199,es=16200,ld=16201,fd=16202,pd=16203,dd=16204,hd=16205,xu=16206,md=16207,gd=16208,ke=16209,Rh=16210,Ch=16211,oS=852,sS=592,cS=15,uS=cS,yd=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function lS(){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 Qn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Ks||e.mode>Ch?1:0},Ph=r=>{if(Qn(r))return Ct;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=Ks,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(oS),e.distcode=e.distdyn=new Int32Array(sS),e.sane=1,e.back=-1,Ln},Lh=r=>{if(Qn(r))return Ct;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Ph(r)},$h=(r,e)=>{let t;if(Qn(r))return Ct;let n=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Ct:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,Lh(r))},Fh=(r,e)=>{if(!r)return Ct;let t=new lS;r.state=t,t.strm=r,t.window=null,t.mode=Ks;let n=$h(r,e);return n!==Ln&&(r.state=null),n},fS=r=>Fh(r,uS),vd=!0,ku,Iu,pS=r=>{if(vd){ku=new Int32Array(512),Iu=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(Ca(Ah,r.lens,0,288,ku,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;Ca(Oh,r.lens,0,32,Iu,0,r.work,{bits:5}),vd=!1}r.lencode=ku,r.lenbits=9,r.distcode=Iu,r.distbits=5},Mh=(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},dS=(r,e)=>{let t,n,i,a,o,s,c,u,l,p,d,f,h,m,v=0,_,y,b,g,A,N,I,C,$=new Uint8Array(4),P,j,xe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(Qn(r)||!r.output||!r.input&&r.avail_in!==0)return Ct;t=r.state,t.mode===hr&&(t.mode=_u),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,p=s,d=c,C=Ln;e:for(;;)switch(t.mode){case Ks:if(t.wrap===0){t.mode=_u;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,$[0]=u&255,$[1]=u>>>8&255,t.check=Ve(t.check,$,2,0),u=0,l=0,t.mode=Jp;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)!==Kp){r.msg="unknown compression method",t.mode=ke;break}if(u>>>=4,l-=4,I=(u&15)+8,t.wbits===0&&(t.wbits=I),I>15||I>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?id:hr,u=0,l=0;break;case Jp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==Kp){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&&($[0]=u&255,$[1]=u>>>8&255,t.check=Ve(t.check,$,2,0)),u=0,l=0,t.mode=Zp;case Zp: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&&($[0]=u&255,$[1]=u>>>8&255,$[2]=u>>>16&255,$[3]=u>>>24&255,t.check=Ve(t.check,$,4,0)),u=0,l=0,t.mode=Yp;case Yp: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&&($[0]=u&255,$[1]=u>>>8&255,t.check=Ve(t.check,$,2,0)),u=0,l=0,t.mode=Xp;case Xp: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&&($[0]=u&255,$[1]=u>>>8&255,t.check=Ve(t.check,$,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=ed;case ed:if(t.flags&1024&&(f=t.length,f>s&&(f=s),f&&(t.head&&(I=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+f),I)),t.flags&512&&t.wrap&4&&(t.check=Ve(t.check,n,f,a)),s-=f,a+=f,t.length-=f),t.length))break e;t.length=0,t.mode=td;case td:if(t.flags&2048){if(s===0)break e;f=0;do I=n[a+f++],t.head&&I&&t.length<65536&&(t.head.name+=String.fromCharCode(I));while(I&&f<s);if(t.flags&512&&t.wrap&4&&(t.check=Ve(t.check,n,f,a)),s-=f,a+=f,I)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=rd;case rd:if(t.flags&4096){if(s===0)break e;f=0;do I=n[a+f++],t.head&&I&&t.length<65536&&(t.head.comment+=String.fromCharCode(I));while(I&&f<s);if(t.flags&512&&t.wrap&4&&(t.check=Ve(t.check,n,f,a)),s-=f,a+=f,I)break e}else t.head&&(t.head.comment=null);t.mode=nd;case nd: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=hr;break;case id:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.adler=t.check=yd(u),u=0,l=0,t.mode=Cs;case Cs: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,iS;r.adler=t.check=1,t.mode=hr;case hr:if(e===rS||e===Yo)break e;case _u:if(t.last){u>>>=l&7,l-=l&7,t.mode=xu;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=ad;break;case 1:if(pS(t),t.mode=Xo,e===Yo){u>>>=2,l-=2;break e}break;case 2:t.mode=sd;break;case 3:r.msg="invalid block type",t.mode=ke}u>>>=2,l-=2;break;case ad: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=Eu,e===Yo)break e;case Eu:t.mode=od;case od:if(f=t.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,t.length-=f;break}t.mode=hr;break;case sd: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=cd;case cd: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,P={bits:t.lenbits},C=Ca(tS,t.lens,0,19,t.lencode,0,t.work,P),t.lenbits=P.bits,C){r.msg="invalid code lengths set",t.mode=ke;break}t.have=0,t.mode=ud;case ud:for(;t.have<t.nlen+t.ndist;){for(;v=t.lencode[u&(1<<t.lenbits)-1],_=v>>>24,y=v>>>16&255,b=v&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(b<16)u>>>=_,l-=_,t.lens[t.have++]=b;else{if(b===16){for(j=_+2;l<j;){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}I=t.lens[t.have-1],f=3+(u&3),u>>>=2,l-=2}else if(b===17){for(j=_+3;l<j;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,I=0,f=3+(u&7),u>>>=3,l-=3}else{for(j=_+7;l<j;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,I=0,f=11+(u&127),u>>>=7,l-=7}if(t.have+f>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=ke;break}for(;f--;)t.lens[t.have++]=I}}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,P={bits:t.lenbits},C=Ca(Ah,t.lens,0,t.nlen,t.lencode,0,t.work,P),t.lenbits=P.bits,C){r.msg="invalid literal/lengths set",t.mode=ke;break}if(t.distbits=6,t.distcode=t.distdyn,P={bits:t.distbits},C=Ca(Oh,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,P),t.distbits=P.bits,C){r.msg="invalid distances set",t.mode=ke;break}if(t.mode=Xo,e===Yo)break e;case Xo:t.mode=es;case es: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,Kb(r,d),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===hr&&(t.back=-1);break}for(t.back=0;v=t.lencode[u&(1<<t.lenbits)-1],_=v>>>24,y=v>>>16&255,b=v&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(y&&(y&240)===0){for(g=_,A=y,N=b;v=t.lencode[N+((u&(1<<g+A)-1)>>g)],_=v>>>24,y=v>>>16&255,b=v&65535,!(g+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=g,l-=g,t.back+=g}if(u>>>=_,l-=_,t.back+=_,t.length=b,y===0){t.mode=hd;break}if(y&32){t.back=-1,t.mode=hr;break}if(y&64){r.msg="invalid literal/length code",t.mode=ke;break}t.extra=y&15,t.mode=ld;case ld:if(t.extra){for(j=t.extra;l<j;){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=fd;case fd:for(;v=t.distcode[u&(1<<t.distbits)-1],_=v>>>24,y=v>>>16&255,b=v&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((y&240)===0){for(g=_,A=y,N=b;v=t.distcode[N+((u&(1<<g+A)-1)>>g)],_=v>>>24,y=v>>>16&255,b=v&65535,!(g+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=g,l-=g,t.back+=g}if(u>>>=_,l-=_,t.back+=_,y&64){r.msg="invalid distance code",t.mode=ke;break}t.offset=b,t.extra=y&15,t.mode=pd;case pd:if(t.extra){for(j=t.extra;l<j;){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=dd;case dd:if(c===0)break e;if(f=d-c,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=ke;break}f>t.wnext?(f-=t.wnext,h=t.wsize-f):h=t.wnext-f,f>t.length&&(f=t.length),m=t.window}else m=i,h=o-t.offset,f=t.length;f>c&&(f=c),c-=f,t.length-=f;do i[o++]=m[h++];while(--f);t.length===0&&(t.mode=es);break;case hd:if(c===0)break e;i[o++]=t.length,c--,t.mode=es;break;case xu:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(d-=c,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Ve(t.check,i,d,o-d):Va(t.check,i,d,o-d)),d=c,t.wrap&4&&(t.flags?u:yd(u))!==t.check){r.msg="incorrect data check",t.mode=ke;break}u=0,l=0}t.mode=md;case md: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=gd;case gd:C=nS;break e;case ke:C=Dh;break e;case Rh:return Nh;case Ch:default:return Ct}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||d!==r.avail_out&&t.mode<ke&&(t.mode<xu||e!==Hp))&&Mh(r,r.output,r.next_out,d-r.avail_out),p-=r.avail_in,d-=r.avail_out,r.total_in+=p,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Ve(t.check,i,d,r.next_out-d):Va(t.check,i,d,r.next_out-d)),r.data_type=t.bits+(t.last?64:0)+(t.mode===hr?128:0)+(t.mode===Xo||t.mode===Eu?256:0),(p===0&&d===0||e===Hp)&&C===Ln&&(C=aS),C},hS=r=>{if(Qn(r))return Ct;let e=r.state;return e.window&&(e.window=null),r.state=null,Ln},mS=(r,e)=>{if(Qn(r))return Ct;let t=r.state;return(t.wrap&2)===0?Ct:(t.head=e,e.done=!1,Ln)},gS=(r,e)=>{let t=e.length,n,i,a;return Qn(r)||(n=r.state,n.wrap!==0&&n.mode!==Cs)?Ct:n.mode===Cs&&(i=1,i=Va(i,e,t,0),i!==n.check)?Dh:(a=Mh(r,e,t,t),a?(n.mode=Rh,Nh):(n.havedict=1,Ln))},yS=Lh,vS=$h,bS=Ph,SS=fS,wS=Fh,_S=dS,ES=hS,xS=mS,kS=gS,IS="pako inflate (from Nodeca project)",br={inflateReset:yS,inflateReset2:vS,inflateResetKeep:bS,inflateInit:SS,inflateInit2:wS,inflate:_S,inflateEnd:ES,inflateGetHeader:xS,inflateSetDictionary:kS,inflateInfo:IS};function TS(){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 AS=TS,jh=Object.prototype.toString,{Z_NO_FLUSH:OS,Z_FINISH:DS,Z_OK:Wa,Z_STREAM_END:Tu,Z_NEED_DICT:Au,Z_STREAM_ERROR:NS,Z_DATA_ERROR:bd,Z_MEM_ERROR:RS}=Vn;function eo(r){this.options=Hs.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 Ih,this.strm.avail_out=0;let t=br.inflateInit2(this.strm,e.windowBits);if(t!==Wa)throw new Error(Cn[t]);if(this.header=new AS,br.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=za.string2buf(e.dictionary):jh.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=br.inflateSetDictionary(this.strm,e.dictionary),t!==Wa)))throw new Error(Cn[t])}eo.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?DS:OS,jh.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=br.inflate(t,o),a===Au&&i&&(a=br.inflateSetDictionary(t,i),a===Wa?a=br.inflate(t,o):a===bd&&(a=Au));t.avail_in>0&&a===Tu&&t.state.wrap>0&&r[t.next_in]!==0;)br.inflateReset(t),a=br.inflate(t,o);switch(a){case NS:case bd:case Au:case RS:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===Tu))if(this.options.to==="string"){let c=za.utf8border(t.output,t.next_out),u=t.next_out-c,l=za.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===Wa&&s===0)){if(a===Tu)return a=br.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};eo.prototype.onData=function(r){this.chunks.push(r)};eo.prototype.onEnd=function(r){r===Wa&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Hs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function fl(r,e){let t=new eo(e);if(t.push(r),t.err)throw t.msg||Cn[t.err];return t.result}function CS(r,e){return e=e||{},e.raw=!0,fl(r,e)}var PS=eo,LS=fl,$S=CS,FS=fl,MS=Vn,jS={Inflate:PS,inflate:LS,inflateRaw:$S,ungzip:FS,constants:MS},{Deflate:US,deflate:qS,deflateRaw:BS,gzip:VS}=Gb,{Inflate:QS,inflate:zS,inflateRaw:WS,ungzip:GS}=jS,HS=US,KS=qS,JS=BS,ZS=VS,YS=QS,XS=zS,ew=WS,tw=GS,rw=Vn,nw={Deflate:HS,deflate:KS,deflateRaw:JS,gzip:ZS,Inflate:YS,inflate:XS,inflateRaw:ew,ungzip:tw,constants:rw},Se=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)},Ps=class{constructor(e,t){this.input=e,this.output=t}};Se([S(),we("design:type",String)],Ps.prototype,"input",void 0);Se([S(),we("design:type",String)],Ps.prototype,"output",void 0);Ps=Se([ze(),we("design:paramtypes",[String,String])],Ps);var Ls=class{constructor(e,t){this.input=e,this.output=t}};Se([S(),we("design:type",String)],Ls.prototype,"input",void 0);Se([S(),we("design:type",String)],Ls.prototype,"output",void 0);Ls=Se([Q(),we("design:paramtypes",[String,String])],Ls);var Kr=class{constructor(e,t,n,i,a){this.name=e,this.modelId=t,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};Se([S(),we("design:type",String)],Kr.prototype,"name",void 0);Se([S(),we("design:type",String)],Kr.prototype,"modelId",void 0);Se([S(),we("design:type",String)],Kr.prototype,"systemPrompt",void 0);Se([S(),we("design:type",Array)],Kr.prototype,"promptExamples",void 0);Se([S(),we("design:type",String)],Kr.prototype,"metaData",void 0);Kr=Se([ze(),we("design:paramtypes",[String,String,String,Array,String])],Kr);var sr=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}};Se([S(),we("design:type",String)],sr.prototype,"name",void 0);Se([S(),we("design:type",String)],sr.prototype,"modelId",void 0);Se([S(),we("design:type",String)],sr.prototype,"taskId",void 0);Se([S(),we("design:type",String)],sr.prototype,"systemPrompt",void 0);Se([S(),we("design:type",Array)],sr.prototype,"promptExamples",void 0);Se([S(),we("design:type",String)],sr.prototype,"metaData",void 0);Se([S(),we("design:type",String)],sr.prototype,"createdAt",void 0);Se([S(),we("design:type",String)],sr.prototype,"updatedAt",void 0);sr=Se([Q(),we("design:paramtypes",[String,String,String,String,Array,String,String,String])],sr);var $n=class{constructor(e,t,n,i,a){this.model=e,this.status=t,this.progress=n,this.downloaded=i,this.loaded=a}};Se([S(),we("design:type",String)],$n.prototype,"model",void 0);Se([S(),we("design:type",String)],$n.prototype,"status",void 0);Se([S(),we("design:type",Number)],$n.prototype,"progress",void 0);Se([S(),we("design:type",Boolean)],$n.prototype,"downloaded",void 0);Se([S(),we("design:type",Boolean)],$n.prototype,"loaded",void 0);$n=Se([Q(),we("design:paramtypes",[String,String,Number,Boolean,Boolean])],$n);var iw=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},qe=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)},je,ms,Zu=class{constructor(e,t=!0){je.set(this,void 0),ms.set(this,new Map),iw(this,je,e,"f")}async getModels(){let e=await qe(this,je,"f").query({query:E`
829
+ }`,variables:{url:e,interactionCall:t}}));return n}};vr=new WeakMap;var zs={};zs.byteLength=rv;zs.toByteArray=iv;zs.fromByteArray=sv;var tr=[],Dt=[],tv=typeof Uint8Array<"u"?Uint8Array:Array,hu="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(mn=0,Cp=hu.length;mn<Cp;++mn)tr[mn]=hu[mn],Dt[hu.charCodeAt(mn)]=mn;var mn,Cp;Dt["-".charCodeAt(0)]=62;Dt["_".charCodeAt(0)]=63;function ih(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 rv(r){var e=ih(r),t=e[0],n=e[1];return(t+n)*3/4-n}function nv(r,e,t){return(e+t)*3/4-t}function iv(r){var e,t=ih(r),n=t[0],i=t[1],a=new tv(nv(r,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=Dt[r.charCodeAt(c)]<<18|Dt[r.charCodeAt(c+1)]<<12|Dt[r.charCodeAt(c+2)]<<6|Dt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Dt[r.charCodeAt(c)]<<2|Dt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=Dt[r.charCodeAt(c)]<<10|Dt[r.charCodeAt(c+1)]<<4|Dt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function av(r){return tr[r>>18&63]+tr[r>>12&63]+tr[r>>6&63]+tr[r&63]}function ov(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(av(n));return i.join("")}function sv(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(ov(r,o,o+a>s?s:o+a));return n===1?(e=r[t-1],i.push(tr[e>>2]+tr[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(tr[e>>10]+tr[e>>4&63]+tr[e<<2&63]+"=")),i.join("")}var cv=4,Pp=0,Lp=1,uv=2;function $i(r){let e=r.length;for(;--e>=0;)r[e]=0}var lv=0,ah=1,fv=2,pv=3,dv=258,al=29,Ya=256,ja=Ya+1+al,Ei=30,ol=19,oh=2*ja+1,kn=15,mu=16,hv=7,sl=256,sh=16,ch=17,uh=18,Bu=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),hs=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),mv=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),lh=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),gv=512,br=new Array((ja+2)*2);$i(br);var Ra=new Array(Ei*2);$i(Ra);var qa=new Array(gv);$i(qa);var Ba=new Array(dv-pv+1);$i(Ba);var cl=new Array(al);$i(cl);var Ns=new Array(Ei);$i(Ns);function gu(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 fh,ph,dh;function yu(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var hh=r=>r<256?qa[r]:qa[256+(r>>>7)],Va=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},gt=(r,e,t)=>{r.bi_valid>mu-t?(r.bi_buf|=e<<r.bi_valid&65535,Va(r,r.bi_buf),r.bi_buf=e>>mu-r.bi_valid,r.bi_valid+=t-mu):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},rr=(r,e,t)=>{gt(r,t[e*2],t[e*2+1])},mh=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},yv=r=>{r.bi_valid===16?(Va(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)},vv=(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,p,d,f,h,m=0;for(d=0;d<=kn;d++)r.bl_count[d]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<oh;u++)l=r.heap[u],d=t[t[l*2+1]*2+1]+1,d>c&&(d=c,m++),t[l*2+1]=d,!(l>n)&&(r.bl_count[d]++,f=0,l>=s&&(f=o[l-s]),h=t[l*2],r.opt_len+=h*(d+f),a&&(r.static_len+=h*(i[l*2+1]+f)));if(m!==0){do{for(d=c-1;r.bl_count[d]===0;)d--;r.bl_count[d]--,r.bl_count[d+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(d=c;d!==0;d--)for(l=r.bl_count[d];l!==0;)p=r.heap[--u],!(p>n)&&(t[p*2+1]!==d&&(r.opt_len+=(d-t[p*2+1])*t[p*2],t[p*2+1]=d),l--)}},gh=(r,e,t)=>{let n=new Array(kn+1),i=0,a,o;for(a=1;a<=kn;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]=mh(n[s]++,s))}},bv=()=>{let r,e,t,n,i,a=new Array(kn+1);for(t=0,n=0;n<al-1;n++)for(cl[n]=t,r=0;r<1<<Bu[n];r++)Ba[t++]=n;for(Ba[t-1]=n,i=0,n=0;n<16;n++)for(Ns[n]=i,r=0;r<1<<hs[n];r++)qa[i++]=n;for(i>>=7;n<Ei;n++)for(Ns[n]=i<<7,r=0;r<1<<hs[n]-7;r++)qa[256+i++]=n;for(e=0;e<=kn;e++)a[e]=0;for(r=0;r<=143;)br[r*2+1]=8,r++,a[8]++;for(;r<=255;)br[r*2+1]=9,r++,a[9]++;for(;r<=279;)br[r*2+1]=7,r++,a[7]++;for(;r<=287;)br[r*2+1]=8,r++,a[8]++;for(gh(br,ja+1,a),r=0;r<Ei;r++)Ra[r*2+1]=5,Ra[r*2]=mh(r,5);fh=new gu(br,Bu,Ya+1,ja,kn),ph=new gu(Ra,hs,0,Ei,kn),dh=new gu(new Array(0),mv,0,ol,hv)},yh=r=>{let e;for(e=0;e<ja;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Ei;e++)r.dyn_dtree[e*2]=0;for(e=0;e<ol;e++)r.bl_tree[e*2]=0;r.dyn_ltree[sl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},vh=r=>{r.bi_valid>8?Va(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},$p=(r,e,t,n)=>{let i=e*2,a=t*2;return r[i]<r[a]||r[i]===r[a]&&n[e]<=n[t]},vu=(r,e,t)=>{let n=r.heap[t],i=t<<1;for(;i<=r.heap_len&&(i<r.heap_len&&$p(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!$p(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n},Fp=(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?rr(r,i,e):(o=Ba[i],rr(r,o+Ya+1,e),s=Bu[o],s!==0&&(i-=cl[o],gt(r,i,s)),n--,o=hh(n),rr(r,o,t),s=hs[o],s!==0&&(n-=Ns[o],gt(r,n,s)));while(a<r.sym_next);rr(r,sl,e)},Vu=(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=oh,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--)vu(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],vu(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++,vu(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],vv(r,e),gh(t,c,r.bl_count)},Mp=(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[sh*2]++):s<=10?r.bl_tree[ch*2]++:r.bl_tree[uh*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},Up=(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 rr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==i&&(rr(r,a,r.bl_tree),s--),rr(r,sh,r.bl_tree),gt(r,s-3,2)):s<=10?(rr(r,ch,r.bl_tree),gt(r,s-3,3)):(rr(r,uh,r.bl_tree),gt(r,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Sv=r=>{let e;for(Mp(r,r.dyn_ltree,r.l_desc.max_code),Mp(r,r.dyn_dtree,r.d_desc.max_code),Vu(r,r.bl_desc),e=ol-1;e>=3&&r.bl_tree[lh[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},wv=(r,e,t,n)=>{let i;for(gt(r,e-257,5),gt(r,t-1,5),gt(r,n-4,4),i=0;i<n;i++)gt(r,r.bl_tree[lh[i]*2+1],3);Up(r,r.dyn_ltree,e-1),Up(r,r.dyn_dtree,t-1)},_v=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Pp;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Lp;for(t=32;t<Ya;t++)if(r.dyn_ltree[t*2]!==0)return Lp;return Pp},jp=!1,Ev=r=>{jp||(bv(),jp=!0),r.l_desc=new yu(r.dyn_ltree,fh),r.d_desc=new yu(r.dyn_dtree,ph),r.bl_desc=new yu(r.bl_tree,dh),r.bi_buf=0,r.bi_valid=0,yh(r)},bh=(r,e,t,n)=>{gt(r,(lv<<1)+(n?1:0),3),vh(r),Va(r,t),Va(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},xv=r=>{gt(r,ah<<1,3),rr(r,sl,br),yv(r)},Iv=(r,e,t,n)=>{let i,a,o=0;r.level>0?(r.strm.data_type===uv&&(r.strm.data_type=_v(r)),Vu(r,r.l_desc),Vu(r,r.d_desc),o=Sv(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?bh(r,e,t,n):r.strategy===cv||a===i?(gt(r,(ah<<1)+(n?1:0),3),Fp(r,br,Ra)):(gt(r,(fv<<1)+(n?1:0),3),wv(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Fp(r,r.dyn_ltree,r.dyn_dtree)),yh(r),n&&vh(r)},kv=(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[(Ba[t]+Ya+1)*2]++,r.dyn_dtree[hh(e)*2]++),r.sym_next===r.sym_end),Tv=Ev,Av=bh,Ov=Iv,Dv=kv,Nv=xv,Rv={_tr_init:Tv,_tr_stored_block:Av,_tr_flush_block:Ov,_tr_tally:Dv,_tr_align:Nv},Cv=(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},Qa=Cv,Pv=()=>{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},Lv=new Uint32Array(Pv()),$v=(r,e,t,n)=>{let i=Lv,a=n+t;r^=-1;for(let o=n;o<a;o++)r=r>>>8^i[(r^e[o])&255];return r^-1},Ve=$v,$n={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"},Wn={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:Fv,_tr_stored_block:Qu,_tr_flush_block:Mv,_tr_tally:Wr,_tr_align:Uv}=Rv,{Z_NO_FLUSH:zr,Z_PARTIAL_FLUSH:jv,Z_FULL_FLUSH:qv,Z_FINISH:Rt,Z_BLOCK:qp,Z_OK:Ze,Z_STREAM_END:Bp,Z_STREAM_ERROR:ar,Z_DATA_ERROR:Bv,Z_BUF_ERROR:bu,Z_DEFAULT_COMPRESSION:Vv,Z_FILTERED:Qv,Z_HUFFMAN_ONLY:Jo,Z_RLE:Wv,Z_FIXED:zv,Z_DEFAULT_STRATEGY:Hv,Z_UNKNOWN:Gv,Z_DEFLATED:Hs}=Wn,Kv=9,Jv=15,Zv=8,Yv=29,Xv=256,Wu=Xv+1+Yv,eb=30,tb=19,rb=2*Wu+1,nb=15,ae=3,qr=258,or=qr+ae+1,ib=32,Ai=42,ul=57,zu=69,Hu=73,Gu=91,Ku=103,Tn=113,xa=666,st=1,Fi=2,Fn=3,Mi=4,ab=3,An=(r,e)=>(r.msg=$n[e],e),Vp=r=>r*2-(r>4?9:0),jr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},ob=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)},sb=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,Hr=sb,St=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)=>{Mv(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,St(r.strm)},he=(r,e)=>{r.pending_buf[r.pending++]=e},ua=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Ju=(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=Qa(r.adler,e,i,t):r.state.wrap===2&&(r.adler=Ve(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)},Sh=(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-or?r.strstart-(r.w_size-or):0,u=r.window,l=r.w_mask,p=r.prev,d=r.strstart+qr,f=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]!==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<d);if(a=qr-(d-n),n=d-qr,a>o){if(r.match_start=e,o=a,a>=s)break;f=u[n+o-1],h=u[n+o]}}while((e=p[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Oi=r=>{let e=r.w_size,t,n,i;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-or)&&(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),ob(r),n+=e),r.strm.avail_in===0)break;if(t=Ju(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=t,r.lookahead+r.insert>=ae)for(i=r.strstart-r.insert,r.ins_h=r.window[i],r.ins_h=Hr(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=Hr(r,r.ins_h,r.window[i+ae-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<ae)););}while(r.lookahead<or&&r.strm.avail_in!==0)},wh=(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!==Rt||e===zr||n!==i+r.strm.avail_in)))break;o=e===Rt&&n===i+r.strm.avail_in?1:0,Qu(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,St(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&&(Ju(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?Mi:e!==zr&&e!==Rt&&r.strm.avail_in===0&&r.strstart===r.block_start?Fi:(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&&(Ju(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===Rt)&&e!==zr&&r.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Rt&&r.strm.avail_in===0&&n===i?1:0,Qu(r,r.block_start,n,o),r.block_start+=n,St(r.strm)),o?Fn:st)},Su=(r,e)=>{let t,n;for(;;){if(r.lookahead<or){if(Oi(r),r.lookahead<or&&e===zr)return st;if(r.lookahead===0)break}if(t=0,r.lookahead>=ae&&(r.ins_h=Hr(r,r.ins_h,r.window[r.strstart+ae-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-or&&(r.match_length=Sh(r,t)),r.match_length>=ae)if(n=Wr(r,r.strstart-r.match_start,r.match_length-ae),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ae){r.match_length--;do r.strstart++,r.ins_h=Hr(r,r.ins_h,r.window[r.strstart+ae-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=Hr(r,r.ins_h,r.window[r.strstart+1]);else n=Wr(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<ae-1?r.strstart:ae-1,e===Rt?(_t(r,!0),r.strm.avail_out===0?Fn:Mi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?st:Fi},yi=(r,e)=>{let t,n,i;for(;;){if(r.lookahead<or){if(Oi(r),r.lookahead<or&&e===zr)return st;if(r.lookahead===0)break}if(t=0,r.lookahead>=ae&&(r.ins_h=Hr(r,r.ins_h,r.window[r.strstart+ae-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=ae-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-or&&(r.match_length=Sh(r,t),r.match_length<=5&&(r.strategy===Qv||r.match_length===ae&&r.strstart-r.match_start>4096)&&(r.match_length=ae-1)),r.prev_length>=ae&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-ae,n=Wr(r,r.strstart-1-r.prev_match,r.prev_length-ae),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=Hr(r,r.ins_h,r.window[r.strstart+ae-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=ae-1,r.strstart++,n&&(_t(r,!1),r.strm.avail_out===0))return st}else if(r.match_available){if(n=Wr(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=Wr(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ae-1?r.strstart:ae-1,e===Rt?(_t(r,!0),r.strm.avail_out===0?Fn:Mi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?st:Fi},cb=(r,e)=>{let t,n,i,a,o=r.window;for(;;){if(r.lookahead<=qr){if(Oi(r),r.lookahead<=qr&&e===zr)return st;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ae&&r.strstart>0&&(i=r.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=r.strstart+qr;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=qr-(a-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=ae?(t=Wr(r,1,r.match_length-ae),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=Wr(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===Rt?(_t(r,!0),r.strm.avail_out===0?Fn:Mi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?st:Fi},ub=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Oi(r),r.lookahead===0)){if(e===zr)return st;break}if(r.match_length=0,t=Wr(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===Rt?(_t(r,!0),r.strm.avail_out===0?Fn:Mi):r.sym_next&&(_t(r,!1),r.strm.avail_out===0)?st:Fi};function Jt(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 Ia=[new Jt(0,0,0,0,wh),new Jt(4,4,8,4,Su),new Jt(4,5,16,8,Su),new Jt(4,6,32,32,Su),new Jt(4,4,16,16,yi),new Jt(8,16,32,32,yi),new Jt(8,16,128,128,yi),new Jt(8,32,128,256,yi),new Jt(32,128,258,1024,yi),new Jt(32,258,258,4096,yi)],lb=r=>{r.window_size=2*r.w_size,jr(r.head),r.max_lazy_match=Ia[r.level].max_lazy,r.good_match=Ia[r.level].good_length,r.nice_match=Ia[r.level].nice_length,r.max_chain_length=Ia[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ae-1,r.match_available=0,r.ins_h=0};function fb(){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=Hs,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(rb*2),this.dyn_dtree=new Uint16Array((2*eb+1)*2),this.bl_tree=new Uint16Array((2*tb+1)*2),jr(this.dyn_ltree),jr(this.dyn_dtree),jr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(nb+1),this.heap=new Uint16Array(2*Wu+1),jr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Wu+1),jr(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 Xa=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Ai&&e.status!==ul&&e.status!==zu&&e.status!==Hu&&e.status!==Gu&&e.status!==Ku&&e.status!==Tn&&e.status!==xa?1:0},_h=r=>{if(Xa(r))return An(r,ar);r.total_in=r.total_out=0,r.data_type=Gv;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?ul:e.wrap?Ai:Tn,r.adler=e.wrap===2?0:1,e.last_flush=-2,Fv(e),Ze},Eh=r=>{let e=_h(r);return e===Ze&&lb(r.state),e},pb=(r,e)=>Xa(r)||r.state.wrap!==2?ar:(r.state.gzhead=e,Ze),xh=(r,e,t,n,i,a)=>{if(!r)return ar;let o=1;if(e===Vv&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>Kv||t!==Hs||n<8||n>15||e<0||e>9||a<0||a>zv||n===8&&o!==1)return An(r,ar);n===8&&(n=9);let s=new fb;return r.state=s,s.strm=r,s.status=Ai,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=t,Eh(r)},db=(r,e)=>xh(r,e,Hs,Jv,Zv,Hv),hb=(r,e)=>{if(Xa(r)||e>qp||e<0)return r?An(r,ar):ar;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===xa&&e!==Rt)return An(r,r.avail_out===0?bu:ar);let n=t.last_flush;if(t.last_flush=e,t.pending!==0){if(St(r),r.avail_out===0)return t.last_flush=-1,Ze}else if(r.avail_in===0&&Vp(e)<=Vp(n)&&e!==Rt)return An(r,bu);if(t.status===xa&&r.avail_in!==0)return An(r,bu);if(t.status===Ai&&t.wrap===0&&(t.status=Tn),t.status===Ai){let i=Hs+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Jo||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=ib),i+=31-i%31,ua(t,i),t.strstart!==0&&(ua(t,r.adler>>>16),ua(t,r.adler&65535)),r.adler=1,t.status=Tn,St(r),t.pending!==0)return t.last_flush=-1,Ze}if(t.status===ul){if(r.adler=0,he(t,31),he(t,139),he(t,8),t.gzhead)he(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)),he(t,t.gzhead.time&255),he(t,t.gzhead.time>>8&255),he(t,t.gzhead.time>>16&255),he(t,t.gzhead.time>>24&255),he(t,t.level===9?2:t.strategy>=Jo||t.level<2?4:0),he(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(he(t,t.gzhead.extra.length&255),he(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ve(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=zu;else if(he(t,0),he(t,0),he(t,0),he(t,0),he(t,0),he(t,t.level===9?2:t.strategy>=Jo||t.level<2?4:0),he(t,ab),t.status=Tn,St(r),t.pending!==0)return t.last_flush=-1,Ze}if(t.status===zu){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=Ve(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=s,St(r),t.pending!==0)return t.last_flush=-1,Ze;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=Ve(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Hu}if(t.status===Hu){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=Ve(r.adler,t.pending_buf,t.pending-i,i)),St(r),t.pending!==0)return t.last_flush=-1,Ze;i=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,he(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Ve(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Gu}if(t.status===Gu){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=Ve(r.adler,t.pending_buf,t.pending-i,i)),St(r),t.pending!==0)return t.last_flush=-1,Ze;i=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,he(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=Ve(r.adler,t.pending_buf,t.pending-i,i))}t.status=Ku}if(t.status===Ku){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(St(r),t.pending!==0))return t.last_flush=-1,Ze;he(t,r.adler&255),he(t,r.adler>>8&255),r.adler=0}if(t.status=Tn,St(r),t.pending!==0)return t.last_flush=-1,Ze}if(r.avail_in!==0||t.lookahead!==0||e!==zr&&t.status!==xa){let i=t.level===0?wh(t,e):t.strategy===Jo?ub(t,e):t.strategy===Wv?cb(t,e):Ia[t.level].func(t,e);if((i===Fn||i===Mi)&&(t.status=xa),i===st||i===Fn)return r.avail_out===0&&(t.last_flush=-1),Ze;if(i===Fi&&(e===jv?Uv(t):e!==qp&&(Qu(t,0,0,!1),e===qv&&(jr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),St(r),r.avail_out===0))return t.last_flush=-1,Ze}return e!==Rt?Ze:t.wrap<=0?Bp:(t.wrap===2?(he(t,r.adler&255),he(t,r.adler>>8&255),he(t,r.adler>>16&255),he(t,r.adler>>24&255),he(t,r.total_in&255),he(t,r.total_in>>8&255),he(t,r.total_in>>16&255),he(t,r.total_in>>24&255)):(ua(t,r.adler>>>16),ua(t,r.adler&65535)),St(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?Ze:Bp)},mb=r=>{if(Xa(r))return ar;let e=r.state.status;return r.state=null,e===Tn?An(r,Bv):Ze},gb=(r,e)=>{let t=e.length;if(Xa(r))return ar;let n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==Ai||n.lookahead)return ar;if(i===1&&(r.adler=Qa(r.adler,e,t,0)),n.wrap=0,t>=n.w_size){i===0&&(jr(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,Oi(n);n.lookahead>=ae;){let c=n.strstart,u=n.lookahead-(ae-1);do n.ins_h=Hr(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,Oi(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,r.next_in=o,r.input=s,r.avail_in=a,n.wrap=i,Ze},yb=db,vb=xh,bb=Eh,Sb=_h,wb=pb,_b=hb,Eb=mb,xb=gb,Ib="pako deflate (from Nodeca project)",Ca={deflateInit:yb,deflateInit2:vb,deflateReset:bb,deflateResetKeep:Sb,deflateSetHeader:wb,deflate:_b,deflateEnd:Eb,deflateSetDictionary:xb,deflateInfo:Ib},kb=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),Tb=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)kb(t,n)&&(r[n]=t[n])}}return r},Ab=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},Gs={assign:Tb,flattenChunks:Ab},Ih=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){Ih=!1}var Wa=new Uint8Array(256);for(let r=0;r<256;r++)Wa[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Wa[254]=Wa[254]=1;var Ob=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},Db=(r,e)=>{if(e<65534&&r.subarray&&Ih)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},Nb=(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=Wa[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 Db(a,i)},Rb=(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+Wa[r[t]]>e?t:e},za={string2buf:Ob,buf2string:Nb,utf8border:Rb};function Cb(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var kh=Cb,Th=Object.prototype.toString,{Z_NO_FLUSH:Pb,Z_SYNC_FLUSH:Lb,Z_FULL_FLUSH:$b,Z_FINISH:Fb,Z_OK:Rs,Z_STREAM_END:Mb,Z_DEFAULT_COMPRESSION:Ub,Z_DEFAULT_STRATEGY:jb,Z_DEFLATED:qb}=Wn;function eo(r){this.options=Gs.assign({level:Ub,method:qb,chunkSize:16384,windowBits:15,memLevel:8,strategy:jb},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 kh,this.strm.avail_out=0;let t=Ca.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==Rs)throw new Error($n[t]);if(e.header&&Ca.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=za.string2buf(e.dictionary):Th.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=Ca.deflateSetDictionary(this.strm,n),t!==Rs)throw new Error($n[t]);this._dict_set=!0}}eo.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?Fb:Pb,typeof r=="string"?t.input=za.string2buf(r):Th.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===Lb||a===$b)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=Ca.deflate(t,a),i===Mb)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=Ca.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===Rs;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};eo.prototype.onData=function(r){this.chunks.push(r)};eo.prototype.onEnd=function(r){r===Rs&&(this.result=Gs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ll(r,e){let t=new eo(e);if(t.push(r,!0),t.err)throw t.msg||$n[t.err];return t.result}function Bb(r,e){return e=e||{},e.raw=!0,ll(r,e)}function Vb(r,e){return e=e||{},e.gzip=!0,ll(r,e)}var Qb=eo,Wb=ll,zb=Bb,Hb=Vb,Gb=Wn,Kb={Deflate:Qb,deflate:Wb,deflateRaw:zb,gzip:Hb,constants:Gb},Zo=16209,Jb=16191,Zb=function r(e,t){let n,i,a,o,s,c,u,l,p,d,f,h,m,b,_,v,S,y,O,N,T,C,$,P,B=e.state;n=e.next_in,$=e.input,i=n+(e.avail_in-5),a=e.next_out,P=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=B.dmax,u=B.wsize,l=B.whave,p=B.wnext,d=B.window,f=B.hold,h=B.bits,m=B.lencode,b=B.distcode,_=(1<<B.lenbits)-1,v=(1<<B.distbits)-1;e:do{h<15&&(f+=$[n++]<<h,h+=8,f+=$[n++]<<h,h+=8),S=m[f&_];t:for(;;){if(y=S>>>24,f>>>=y,h-=y,y=S>>>16&255,y===0)P[a++]=S&65535;else if(y&16){O=S&65535,y&=15,y&&(h<y&&(f+=$[n++]<<h,h+=8),O+=f&(1<<y)-1,f>>>=y,h-=y),h<15&&(f+=$[n++]<<h,h+=8,f+=$[n++]<<h,h+=8),S=b[f&v];r:for(;;){if(y=S>>>24,f>>>=y,h-=y,y=S>>>16&255,y&16){if(N=S&65535,y&=15,h<y&&(f+=$[n++]<<h,h+=8,h<y&&(f+=$[n++]<<h,h+=8)),N+=f&(1<<y)-1,N>c){e.msg="invalid distance too far back",B.mode=Zo;break e}if(f>>>=y,h-=y,y=a-o,N>y){if(y=N-y,y>l&&B.sane){e.msg="invalid distance too far back",B.mode=Zo;break e}if(T=0,C=d,p===0){if(T+=u-y,y<O){O-=y;do P[a++]=d[T++];while(--y);T=a-N,C=P}}else if(p<y){if(T+=u+p-y,y-=p,y<O){O-=y;do P[a++]=d[T++];while(--y);if(T=0,p<O){y=p,O-=y;do P[a++]=d[T++];while(--y);T=a-N,C=P}}}else if(T+=p-y,y<O){O-=y;do P[a++]=d[T++];while(--y);T=a-N,C=P}for(;O>2;)P[a++]=C[T++],P[a++]=C[T++],P[a++]=C[T++],O-=3;O&&(P[a++]=C[T++],O>1&&(P[a++]=C[T++]))}else{T=a-N;do P[a++]=P[T++],P[a++]=P[T++],P[a++]=P[T++],O-=3;while(O>2);O&&(P[a++]=P[T++],O>1&&(P[a++]=P[T++]))}}else if((y&64)===0){S=b[(S&65535)+(f&(1<<y)-1)];continue r}else{e.msg="invalid distance code",B.mode=Zo;break e}break}}else if((y&64)===0){S=m[(S&65535)+(f&(1<<y)-1)];continue t}else if(y&32){B.mode=Jb;break e}else{e.msg="invalid literal/length code",B.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),B.hold=f,B.bits=h},vi=15,Qp=852,Wp=592,zp=0,wu=1,Hp=2,Yb=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]),Xb=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]),eS=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]),tS=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]),rS=(r,e,t,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,p=0,d=0,f=0,h=0,m=0,b=0,_=0,v=0,S,y,O,N,T,C=null,$,P=new Uint16Array(vi+1),B=new Uint16Array(vi+1),xe=null,Te,k,ve;for(u=0;u<=vi;u++)P[u]=0;for(l=0;l<n;l++)P[e[t+l]]++;for(f=c,d=vi;d>=1&&P[d]===0;d--);if(f>d&&(f=d),d===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(p=1;p<d&&P[p]===0;p++);for(f<p&&(f=p),b=1,u=1;u<=vi;u++)if(b<<=1,b-=P[u],b<0)return-1;if(b>0&&(r===zp||d!==1))return-1;for(B[1]=0,u=1;u<vi;u++)B[u+1]=B[u]+P[u];for(l=0;l<n;l++)e[t+l]!==0&&(o[B[e[t+l]]++]=l);if(r===zp?(C=xe=o,$=20):r===wu?(C=Yb,xe=Xb,$=257):(C=eS,xe=tS,$=0),v=0,l=0,u=p,T=a,h=f,m=0,O=-1,_=1<<f,N=_-1,r===wu&&_>Qp||r===Hp&&_>Wp)return 1;for(;;){Te=u-m,o[l]+1<$?(k=0,ve=o[l]):o[l]>=$?(k=xe[o[l]-$],ve=C[o[l]-$]):(k=32+64,ve=0),S=1<<u-m,y=1<<h,p=y;do y-=S,i[T+(v>>m)+y]=Te<<24|k<<16|ve|0;while(y!==0);for(S=1<<u-1;v&S;)S>>=1;if(S!==0?(v&=S-1,v+=S):v=0,l++,--P[u]===0){if(u===d)break;u=e[t+o[l]]}if(u>f&&(v&N)!==O){for(m===0&&(m=f),T+=p,h=u-m,b=1<<h;h+m<d&&(b-=P[h+m],!(b<=0));)h++,b<<=1;if(_+=1<<h,r===wu&&_>Qp||r===Hp&&_>Wp)return 1;O=v&N,i[O]=f<<24|h<<16|T-a|0}}return v!==0&&(i[T+v]=u-m<<24|64<<16|0),s.bits=f,0},Pa=rS,nS=0,Ah=1,Oh=2,{Z_FINISH:Gp,Z_BLOCK:iS,Z_TREES:Yo,Z_OK:Mn,Z_STREAM_END:aS,Z_NEED_DICT:oS,Z_STREAM_ERROR:Pt,Z_DATA_ERROR:Dh,Z_MEM_ERROR:Nh,Z_BUF_ERROR:sS,Z_DEFLATED:Kp}=Wn,Ks=16180,Jp=16181,Zp=16182,Yp=16183,Xp=16184,ed=16185,td=16186,rd=16187,nd=16188,id=16189,Cs=16190,mr=16191,_u=16192,ad=16193,Eu=16194,od=16195,sd=16196,cd=16197,ud=16198,Xo=16199,es=16200,ld=16201,fd=16202,pd=16203,dd=16204,hd=16205,xu=16206,md=16207,gd=16208,Ie=16209,Rh=16210,Ch=16211,cS=852,uS=592,lS=15,fS=lS,yd=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function pS(){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 zn=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Ks||e.mode>Ch?1:0},Ph=r=>{if(zn(r))return Pt;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=Ks,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(cS),e.distcode=e.distdyn=new Int32Array(uS),e.sane=1,e.back=-1,Mn},Lh=r=>{if(zn(r))return Pt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Ph(r)},$h=(r,e)=>{let t;if(zn(r))return Pt;let n=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Pt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,Lh(r))},Fh=(r,e)=>{if(!r)return Pt;let t=new pS;r.state=t,t.strm=r,t.window=null,t.mode=Ks;let n=$h(r,e);return n!==Mn&&(r.state=null),n},dS=r=>Fh(r,fS),vd=!0,Iu,ku,hS=r=>{if(vd){Iu=new Int32Array(512),ku=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(Pa(Ah,r.lens,0,288,Iu,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;Pa(Oh,r.lens,0,32,ku,0,r.work,{bits:5}),vd=!1}r.lencode=Iu,r.lenbits=9,r.distcode=ku,r.distbits=5},Mh=(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},mS=(r,e)=>{let t,n,i,a,o,s,c,u,l,p,d,f,h,m,b=0,_,v,S,y,O,N,T,C,$=new Uint8Array(4),P,B,xe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(zn(r)||!r.output||!r.input&&r.avail_in!==0)return Pt;t=r.state,t.mode===mr&&(t.mode=_u),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,p=s,d=c,C=Mn;e:for(;;)switch(t.mode){case Ks:if(t.wrap===0){t.mode=_u;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,$[0]=u&255,$[1]=u>>>8&255,t.check=Ve(t.check,$,2,0),u=0,l=0,t.mode=Jp;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((u&255)<<8)+(u>>8))%31){r.msg="incorrect header check",t.mode=Ie;break}if((u&15)!==Kp){r.msg="unknown compression method",t.mode=Ie;break}if(u>>>=4,l-=4,T=(u&15)+8,t.wbits===0&&(t.wbits=T),T>15||T>t.wbits){r.msg="invalid window size",t.mode=Ie;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=u&512?id:mr,u=0,l=0;break;case Jp:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==Kp){r.msg="unknown compression method",t.mode=Ie;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=Ie;break}t.head&&(t.head.text=u>>8&1),t.flags&512&&t.wrap&4&&($[0]=u&255,$[1]=u>>>8&255,t.check=Ve(t.check,$,2,0)),u=0,l=0,t.mode=Zp;case Zp: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&&($[0]=u&255,$[1]=u>>>8&255,$[2]=u>>>16&255,$[3]=u>>>24&255,t.check=Ve(t.check,$,4,0)),u=0,l=0,t.mode=Yp;case Yp: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&&($[0]=u&255,$[1]=u>>>8&255,t.check=Ve(t.check,$,2,0)),u=0,l=0,t.mode=Xp;case Xp: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&&($[0]=u&255,$[1]=u>>>8&255,t.check=Ve(t.check,$,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=ed;case ed:if(t.flags&1024&&(f=t.length,f>s&&(f=s),f&&(t.head&&(T=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+f),T)),t.flags&512&&t.wrap&4&&(t.check=Ve(t.check,n,f,a)),s-=f,a+=f,t.length-=f),t.length))break e;t.length=0,t.mode=td;case td:if(t.flags&2048){if(s===0)break e;f=0;do T=n[a+f++],t.head&&T&&t.length<65536&&(t.head.name+=String.fromCharCode(T));while(T&&f<s);if(t.flags&512&&t.wrap&4&&(t.check=Ve(t.check,n,f,a)),s-=f,a+=f,T)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=rd;case rd:if(t.flags&4096){if(s===0)break e;f=0;do T=n[a+f++],t.head&&T&&t.length<65536&&(t.head.comment+=String.fromCharCode(T));while(T&&f<s);if(t.flags&512&&t.wrap&4&&(t.check=Ve(t.check,n,f,a)),s-=f,a+=f,T)break e}else t.head&&(t.head.comment=null);t.mode=nd;case nd: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=Ie;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=mr;break;case id:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.adler=t.check=yd(u),u=0,l=0,t.mode=Cs;case Cs: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,oS;r.adler=t.check=1,t.mode=mr;case mr:if(e===iS||e===Yo)break e;case _u:if(t.last){u>>>=l&7,l-=l&7,t.mode=xu;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=ad;break;case 1:if(hS(t),t.mode=Xo,e===Yo){u>>>=2,l-=2;break e}break;case 2:t.mode=sd;break;case 3:r.msg="invalid block type",t.mode=Ie}u>>>=2,l-=2;break;case ad: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=Ie;break}if(t.length=u&65535,u=0,l=0,t.mode=Eu,e===Yo)break e;case Eu:t.mode=od;case od:if(f=t.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,t.length-=f;break}t.mode=mr;break;case sd: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=Ie;break}t.have=0,t.mode=cd;case cd: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,P={bits:t.lenbits},C=Pa(nS,t.lens,0,19,t.lencode,0,t.work,P),t.lenbits=P.bits,C){r.msg="invalid code lengths set",t.mode=Ie;break}t.have=0,t.mode=ud;case ud:for(;t.have<t.nlen+t.ndist;){for(;b=t.lencode[u&(1<<t.lenbits)-1],_=b>>>24,v=b>>>16&255,S=b&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(S<16)u>>>=_,l-=_,t.lens[t.have++]=S;else{if(S===16){for(B=_+2;l<B;){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=Ie;break}T=t.lens[t.have-1],f=3+(u&3),u>>>=2,l-=2}else if(S===17){for(B=_+3;l<B;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,T=0,f=3+(u&7),u>>>=3,l-=3}else{for(B=_+7;l<B;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=_,l-=_,T=0,f=11+(u&127),u>>>=7,l-=7}if(t.have+f>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Ie;break}for(;f--;)t.lens[t.have++]=T}}if(t.mode===Ie)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=Ie;break}if(t.lenbits=9,P={bits:t.lenbits},C=Pa(Ah,t.lens,0,t.nlen,t.lencode,0,t.work,P),t.lenbits=P.bits,C){r.msg="invalid literal/lengths set",t.mode=Ie;break}if(t.distbits=6,t.distcode=t.distdyn,P={bits:t.distbits},C=Pa(Oh,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,P),t.distbits=P.bits,C){r.msg="invalid distances set",t.mode=Ie;break}if(t.mode=Xo,e===Yo)break e;case Xo:t.mode=es;case es: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,Zb(r,d),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===mr&&(t.back=-1);break}for(t.back=0;b=t.lencode[u&(1<<t.lenbits)-1],_=b>>>24,v=b>>>16&255,S=b&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(v&&(v&240)===0){for(y=_,O=v,N=S;b=t.lencode[N+((u&(1<<y+O)-1)>>y)],_=b>>>24,v=b>>>16&255,S=b&65535,!(y+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=_,l-=_,t.back+=_,t.length=S,v===0){t.mode=hd;break}if(v&32){t.back=-1,t.mode=mr;break}if(v&64){r.msg="invalid literal/length code",t.mode=Ie;break}t.extra=v&15,t.mode=ld;case ld:if(t.extra){for(B=t.extra;l<B;){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=fd;case fd:for(;b=t.distcode[u&(1<<t.distbits)-1],_=b>>>24,v=b>>>16&255,S=b&65535,!(_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((v&240)===0){for(y=_,O=v,N=S;b=t.distcode[N+((u&(1<<y+O)-1)>>y)],_=b>>>24,v=b>>>16&255,S=b&65535,!(y+_<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=_,l-=_,t.back+=_,v&64){r.msg="invalid distance code",t.mode=Ie;break}t.offset=S,t.extra=v&15,t.mode=pd;case pd:if(t.extra){for(B=t.extra;l<B;){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=Ie;break}t.mode=dd;case dd:if(c===0)break e;if(f=d-c,t.offset>f){if(f=t.offset-f,f>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Ie;break}f>t.wnext?(f-=t.wnext,h=t.wsize-f):h=t.wnext-f,f>t.length&&(f=t.length),m=t.window}else m=i,h=o-t.offset,f=t.length;f>c&&(f=c),c-=f,t.length-=f;do i[o++]=m[h++];while(--f);t.length===0&&(t.mode=es);break;case hd:if(c===0)break e;i[o++]=t.length,c--,t.mode=es;break;case xu:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(d-=c,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Ve(t.check,i,d,o-d):Qa(t.check,i,d,o-d)),d=c,t.wrap&4&&(t.flags?u:yd(u))!==t.check){r.msg="incorrect data check",t.mode=Ie;break}u=0,l=0}t.mode=md;case md: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=Ie;break}u=0,l=0}t.mode=gd;case gd:C=aS;break e;case Ie:C=Dh;break e;case Rh:return Nh;case Ch:default:return Pt}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||d!==r.avail_out&&t.mode<Ie&&(t.mode<xu||e!==Gp))&&Mh(r,r.output,r.next_out,d-r.avail_out),p-=r.avail_in,d-=r.avail_out,r.total_in+=p,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Ve(t.check,i,d,r.next_out-d):Qa(t.check,i,d,r.next_out-d)),r.data_type=t.bits+(t.last?64:0)+(t.mode===mr?128:0)+(t.mode===Xo||t.mode===Eu?256:0),(p===0&&d===0||e===Gp)&&C===Mn&&(C=sS),C},gS=r=>{if(zn(r))return Pt;let e=r.state;return e.window&&(e.window=null),r.state=null,Mn},yS=(r,e)=>{if(zn(r))return Pt;let t=r.state;return(t.wrap&2)===0?Pt:(t.head=e,e.done=!1,Mn)},vS=(r,e)=>{let t=e.length,n,i,a;return zn(r)||(n=r.state,n.wrap!==0&&n.mode!==Cs)?Pt:n.mode===Cs&&(i=1,i=Qa(i,e,t,0),i!==n.check)?Dh:(a=Mh(r,e,t,t),a?(n.mode=Rh,Nh):(n.havedict=1,Mn))},bS=Lh,SS=$h,wS=Ph,_S=dS,ES=Fh,xS=mS,IS=gS,kS=yS,TS=vS,AS="pako inflate (from Nodeca project)",Sr={inflateReset:bS,inflateReset2:SS,inflateResetKeep:wS,inflateInit:_S,inflateInit2:ES,inflate:xS,inflateEnd:IS,inflateGetHeader:kS,inflateSetDictionary:TS,inflateInfo:AS};function OS(){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 DS=OS,Uh=Object.prototype.toString,{Z_NO_FLUSH:NS,Z_FINISH:RS,Z_OK:Ha,Z_STREAM_END:Tu,Z_NEED_DICT:Au,Z_STREAM_ERROR:CS,Z_DATA_ERROR:bd,Z_MEM_ERROR:PS}=Wn;function to(r){this.options=Gs.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 kh,this.strm.avail_out=0;let t=Sr.inflateInit2(this.strm,e.windowBits);if(t!==Ha)throw new Error($n[t]);if(this.header=new DS,Sr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=za.string2buf(e.dictionary):Uh.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Sr.inflateSetDictionary(this.strm,e.dictionary),t!==Ha)))throw new Error($n[t])}to.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?RS:NS,Uh.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=Sr.inflate(t,o),a===Au&&i&&(a=Sr.inflateSetDictionary(t,i),a===Ha?a=Sr.inflate(t,o):a===bd&&(a=Au));t.avail_in>0&&a===Tu&&t.state.wrap>0&&r[t.next_in]!==0;)Sr.inflateReset(t),a=Sr.inflate(t,o);switch(a){case CS:case bd:case Au:case PS:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===Tu))if(this.options.to==="string"){let c=za.utf8border(t.output,t.next_out),u=t.next_out-c,l=za.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===Ha&&s===0)){if(a===Tu)return a=Sr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};to.prototype.onData=function(r){this.chunks.push(r)};to.prototype.onEnd=function(r){r===Ha&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Gs.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function fl(r,e){let t=new to(e);if(t.push(r),t.err)throw t.msg||$n[t.err];return t.result}function LS(r,e){return e=e||{},e.raw=!0,fl(r,e)}var $S=to,FS=fl,MS=LS,US=fl,jS=Wn,qS={Inflate:$S,inflate:FS,inflateRaw:MS,ungzip:US,constants:jS},{Deflate:BS,deflate:VS,deflateRaw:QS,gzip:WS}=Kb,{Inflate:zS,inflate:HS,inflateRaw:GS,ungzip:KS}=qS,JS=BS,ZS=VS,YS=QS,XS=WS,ew=zS,tw=HS,rw=GS,nw=KS,iw=Wn,aw={Deflate:JS,deflate:ZS,deflateRaw:YS,gzip:XS,Inflate:ew,inflate:tw,inflateRaw:rw,ungzip:nw,constants:iw},we=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},_e=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ps=class{constructor(e,t){this.input=e,this.output=t}};we([w(),_e("design:type",String)],Ps.prototype,"input",void 0);we([w(),_e("design:type",String)],Ps.prototype,"output",void 0);Ps=we([We(),_e("design:paramtypes",[String,String])],Ps);var Ls=class{constructor(e,t){this.input=e,this.output=t}};we([w(),_e("design:type",String)],Ls.prototype,"input",void 0);we([w(),_e("design:type",String)],Ls.prototype,"output",void 0);Ls=we([H(),_e("design:paramtypes",[String,String])],Ls);var Zr=class{constructor(e,t,n,i,a){this.name=e,this.modelId=t,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};we([w(),_e("design:type",String)],Zr.prototype,"name",void 0);we([w(),_e("design:type",String)],Zr.prototype,"modelId",void 0);we([w(),_e("design:type",String)],Zr.prototype,"systemPrompt",void 0);we([w(),_e("design:type",Array)],Zr.prototype,"promptExamples",void 0);we([w(),_e("design:type",String)],Zr.prototype,"metaData",void 0);Zr=we([We(),_e("design:paramtypes",[String,String,String,Array,String])],Zr);var ur=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}};we([w(),_e("design:type",String)],ur.prototype,"name",void 0);we([w(),_e("design:type",String)],ur.prototype,"modelId",void 0);we([w(),_e("design:type",String)],ur.prototype,"taskId",void 0);we([w(),_e("design:type",String)],ur.prototype,"systemPrompt",void 0);we([w(),_e("design:type",Array)],ur.prototype,"promptExamples",void 0);we([w(),_e("design:type",String)],ur.prototype,"metaData",void 0);we([w(),_e("design:type",String)],ur.prototype,"createdAt",void 0);we([w(),_e("design:type",String)],ur.prototype,"updatedAt",void 0);ur=we([H(),_e("design:paramtypes",[String,String,String,String,Array,String,String,String])],ur);var Un=class{constructor(e,t,n,i,a){this.model=e,this.status=t,this.progress=n,this.downloaded=i,this.loaded=a}};we([w(),_e("design:type",String)],Un.prototype,"model",void 0);we([w(),_e("design:type",String)],Un.prototype,"status",void 0);we([w(),_e("design:type",Number)],Un.prototype,"progress",void 0);we([w(),_e("design:type",Boolean)],Un.prototype,"downloaded",void 0);we([w(),_e("design:type",Boolean)],Un.prototype,"loaded",void 0);Un=we([H(),_e("design:paramtypes",[String,String,Number,Boolean,Boolean])],Un);var ow=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},qe=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,ms,Zu=class{constructor(e,t=!0){Ue.set(this,void 0),ms.set(this,new Map),ow(this,Ue,e,"f")}async getModels(){let e=await qe(this,Ue,"f").query({query:E`
806
830
  query {
807
831
  aiGetModels {
808
832
  id
@@ -826,23 +850,23 @@ triggerMatch
826
850
  modelType
827
851
  }
828
852
  }
829
- `});return T(e).aiGetModels}async addModel(e){let t=await qe(this,je,"f").mutate({mutation:E`
853
+ `});return I(e).aiGetModels}async addModel(e){let t=await qe(this,Ue,"f").mutate({mutation:E`
830
854
  mutation($model: ModelInput!) {
831
855
  aiAddModel(model: $model)
832
856
  }
833
- `,variables:{model:e}});return T(t).aiAddModel}async updateModel(e,t){let n=await qe(this,je,"f").mutate({mutation:E`
857
+ `,variables:{model:e}});return I(t).aiAddModel}async updateModel(e,t){let n=await qe(this,Ue,"f").mutate({mutation:E`
834
858
  mutation($modelId: String!, $model: ModelInput!) {
835
859
  aiUpdateModel(modelId: $modelId, model: $model)
836
860
  }
837
- `,variables:{modelId:e,model:t}});return T(n).aiUpdateModel}async removeModel(e){let t=await qe(this,je,"f").mutate({mutation:E`
861
+ `,variables:{modelId:e,model:t}});return I(n).aiUpdateModel}async removeModel(e){let t=await qe(this,Ue,"f").mutate({mutation:E`
838
862
  mutation($modelId: String!) {
839
863
  aiRemoveModel(modelId: $modelId)
840
864
  }
841
- `,variables:{modelId:e}});return T(t).aiRemoveModel}async setDefaultModel(e,t){let n=await qe(this,je,"f").mutate({mutation:E`
865
+ `,variables:{modelId:e}});return I(t).aiRemoveModel}async setDefaultModel(e,t){let n=await qe(this,Ue,"f").mutate({mutation:E`
842
866
  mutation($modelType: ModelType!, $modelId: String!) {
843
867
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
844
868
  }
845
- `,variables:{modelId:t,modelType:e}});return T(n).aiSetDefaultModel}async getDefaultModel(e){let t=await qe(this,je,"f").query({query:E`
869
+ `,variables:{modelId:t,modelType:e}});return I(n).aiSetDefaultModel}async getDefaultModel(e){let t=await qe(this,Ue,"f").query({query:E`
846
870
  query($modelType: ModelType!) {
847
871
  aiGetDefaultModel(modelType: $modelType) {
848
872
  id
@@ -866,7 +890,7 @@ triggerMatch
866
890
  modelType
867
891
  }
868
892
  }
869
- `,variables:{modelType:e}});return T(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=T(await qe(this,je,"f").query({query:E`
893
+ `,variables:{modelType:e}});return I(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=I(await qe(this,Ue,"f").query({query:E`
870
894
  query {
871
895
  aiTasks {
872
896
  name
@@ -882,7 +906,7 @@ triggerMatch
882
906
  updatedAt
883
907
  }
884
908
  }
885
- `}));return e}async addTask(e,t,n,i,a){let o=new Kr(e,t,n,i,a),{aiAddTask:s}=T(await qe(this,je,"f").mutate({mutation:E`
909
+ `}));return e}async addTask(e,t,n,i,a){let o=new Zr(e,t,n,i,a),{aiAddTask:s}=I(await qe(this,Ue,"f").mutate({mutation:E`
886
910
  mutation AiAddTask($task: AITaskInput!) {
887
911
  aiAddTask(task: $task) {
888
912
  name
@@ -898,7 +922,7 @@ triggerMatch
898
922
  updatedAt
899
923
  }
900
924
  }
901
- `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=T(await qe(this,je,"f").mutate({mutation:E`
925
+ `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=I(await qe(this,Ue,"f").mutate({mutation:E`
902
926
  mutation AiRemoveTask($taskId: String!) {
903
927
  aiRemoveTask(taskId: $taskId) {
904
928
  name
@@ -914,7 +938,7 @@ triggerMatch
914
938
  updatedAt
915
939
  }
916
940
  }
917
- `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:n}=T(await qe(this,je,"f").mutate({mutation:E`
941
+ `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:n}=I(await qe(this,Ue,"f").mutate({mutation:E`
918
942
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
919
943
  aiUpdateTask(taskId: $taskId, task: $task) {
920
944
  name
@@ -930,7 +954,7 @@ triggerMatch
930
954
  updatedAt
931
955
  }
932
956
  }
933
- `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=T(await qe(this,je,"f").query({query:E`
957
+ `,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return n}async modelLoadingStatus(e){let{aiModelLoadingStatus:t}=I(await qe(this,Ue,"f").query({query:E`
934
958
  query AiModelLoadingStatus($model: String!) {
935
959
  aiModelLoadingStatus(model: $model) {
936
960
  model
@@ -940,30 +964,30 @@ triggerMatch
940
964
  downloaded
941
965
  }
942
966
  }
943
- `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:n}=T(await qe(this,je,"f").mutate({mutation:E`
967
+ `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:n}=I(await qe(this,Ue,"f").mutate({mutation:E`
944
968
  mutation AiPrompt($taskId: String!, $prompt: String!) {
945
969
  aiPrompt(taskId: $taskId, prompt: $prompt)
946
970
  }
947
- `,variables:{taskId:e,prompt:t}}));return n}async embed(e,t){let{aiEmbed:n}=T(await qe(this,je,"f").mutate({mutation:E`
971
+ `,variables:{taskId:e,prompt:t}}));return n}async embed(e,t){let{aiEmbed:n}=I(await qe(this,Ue,"f").mutate({mutation:E`
948
972
  mutation aiEmbed($modelId: String!, $text: String!) {
949
973
  aiEmbed(modelId: $modelId, text: $text)
950
974
  }
951
- `,variables:{modelId:e,text:t}})),i=Ws.toByteArray(n);return JSON.parse(nw.inflate(i,{to:"string"}))}async openTranscriptionStream(e,t,n){let{aiOpenTranscriptionStream:i}=T(await qe(this,je,"f").mutate({mutation:E`
975
+ `,variables:{modelId:e,text:t}})),i=zs.toByteArray(n);return JSON.parse(aw.inflate(i,{to:"string"}))}async openTranscriptionStream(e,t,n){let{aiOpenTranscriptionStream:i}=I(await qe(this,Ue,"f").mutate({mutation:E`
952
976
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
953
977
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
954
978
  }
955
- `,variables:{modelId:e,params:n}})),a=qe(this,je,"f").subscribe({query:E` subscription {
979
+ `,variables:{modelId:e,params:n}})),a=qe(this,Ue,"f").subscribe({query:E` subscription {
956
980
  aiTranscriptionText(streamId: "${i}")
957
- }`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return qe(this,ms,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=T(await qe(this,je,"f").mutate({mutation:E`
981
+ }`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return qe(this,ms,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=I(await qe(this,Ue,"f").mutate({mutation:E`
958
982
  mutation aiCloseTranscriptionStream($streamId: String!) {
959
983
  aiCloseTranscriptionStream(streamId: $streamId)
960
984
  }
961
- `,variables:{streamId:e}})),n=qe(this,ms,"f").get(e);return n.closed||n.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:n}=T(await qe(this,je,"f").mutate({mutation:E`
985
+ `,variables:{streamId:e}})),n=qe(this,ms,"f").get(e);return n.closed||n.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:n}=I(await qe(this,Ue,"f").mutate({mutation:E`
962
986
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
963
987
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
964
988
  }
965
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return n}};je=new WeakMap,ms=new WeakMap;var Lr=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},Me=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)},Zt,gs,ka,ys,Ia,Sn,vs,Ta,Ga=class{constructor(e,t=!0){Zt.set(this,void 0),gs.set(this,void 0),ka.set(this,void 0),ys.set(this,void 0),Ia.set(this,void 0),Sn.set(this,void 0),vs.set(this,void 0),Ta.set(this,void 0),Lr(this,Zt,e,"f"),Lr(this,gs,new Ma(Me(this,Zt,"f"),t),"f"),Lr(this,ka,new qu(Me(this,Zt,"f")),"f"),Lr(this,ys,new Mu(Me(this,Zt,"f")),"f"),Lr(this,Ia,new ju(Me(this,Zt,"f")),"f"),Lr(this,Ta,new Zu(Me(this,Zt,"f"),t),"f"),Lr(this,Sn,new Ds(Me(this,Zt,"f"),t),"f"),Me(this,Sn,"f").setExpressionClient(Me(this,ka,"f")),Me(this,Sn,"f").setNeighbourhoodClient(Me(this,Ia,"f")),Me(this,Sn,"f").setAIClient(Me(this,Ta,"f")),Lr(this,vs,new Uu(Me(this,Zt,"f"),t),"f")}get agent(){return Me(this,gs,"f")}get expression(){return Me(this,ka,"f")}get languages(){return Me(this,ys,"f")}get neighbourhood(){return Me(this,Ia,"f")}get perspective(){return Me(this,Sn,"f")}get runtime(){return Me(this,vs,"f")}get ai(){return Me(this,Ta,"f")}};Zt=new WeakMap,gs=new WeakMap,ka=new WeakMap,ys=new WeakMap,Ia=new WeakMap,Sn=new WeakMap,vs=new WeakMap,Ta=new WeakMap;var Yu;(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"})(Yu||(Yu={}));var pl=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},dl=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}};pl([S(),dl("design:type",tr)],In.prototype,"language",void 0);pl([S(),dl("design:type",String)],In.prototype,"expression",void 0);In=pl([Q(),dl("design:paramtypes",[tr,String])],In);function GT(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function HT(r){if(r.startsWith("literal://")){let a=new tr;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 tr;return s.address=a,new In(s,o)}let i=/^did:([^\s]+)$/.exec(r);if(i&&i.length==2){let a=new tr;return a.address="did",new In(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var kt=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},cr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},$s=class{};kt([S(),cr("design:type",String)],$s.prototype,"name",void 0);kt([S(),cr("design:type",String)],$s.prototype,"type",void 0);$s=kt([Q()],$s);var Ha=class{};kt([S(),cr("design:type",String)],Ha.prototype,"label",void 0);kt([S(),cr("design:type",String)],Ha.prototype,"name",void 0);kt([S(),cr("design:type",Array)],Ha.prototype,"parameters",void 0);Ha=kt([Q()],Ha);var Fs=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};kt([S(),cr("design:type",String)],Fs.prototype,"name",void 0);kt([S(),cr("design:type",String)],Fs.prototype,"parametersStringified",void 0);Fs=kt([ze(),cr("design:paramtypes",[String,Object])],Fs);var Ms=class{};kt([S(),cr("design:type",String)],Ms.prototype,"did",void 0);kt([S(),cr("design:type",Dn)],Ms.prototype,"status",void 0);Ms=kt([Q()],Ms);var Sd=class{},zn=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},Mi=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Jr=class{};zn([S(),Mi("design:type",String)],Jr.prototype,"name",void 0);zn([S(),Mi("design:type",String)],Jr.prototype,"address",void 0);zn([S(),Mi("design:type",String)],Jr.prototype,"settings",void 0);zn([S(),Mi("design:type",An)],Jr.prototype,"icon",void 0);zn([S(),Mi("design:type",An)],Jr.prototype,"constructorIcon",void 0);zn([S(),Mi("design:type",An)],Jr.prototype,"settingsIcon",void 0);Jr=zn([Q()],Jr);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},yt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qt=class{};ct([S(),yt("design:type",String)],qt.prototype,"name",void 0);ct([S(),yt("design:type",String)],qt.prototype,"address",void 0);ct([S(),yt("design:type",String)],qt.prototype,"description",void 0);ct([S(),yt("design:type",String)],qt.prototype,"author",void 0);ct([S(),yt("design:type",Boolean)],qt.prototype,"templated",void 0);ct([S(),yt("design:type",String)],qt.prototype,"templateSourceLanguageAddress",void 0);ct([S(),yt("design:type",String)],qt.prototype,"templateAppliedParams",void 0);ct([S(),yt("design:type",Array)],qt.prototype,"possibleTemplateParams",void 0);ct([S(),yt("design:type",String)],qt.prototype,"sourceCodeLink",void 0);qt=ct([Q()],qt);var Ti=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ct([S(),yt("design:type",String)],Ti.prototype,"name",void 0);ct([S(),yt("design:type",String)],Ti.prototype,"description",void 0);ct([S(),yt("design:type",Array)],Ti.prototype,"possibleTemplateParams",void 0);ct([S(),yt("design:type",String)],Ti.prototype,"sourceCodeLink",void 0);Ti=ct([ze(),yt("design:paramtypes",[String,String])],Ti);var wd=class{},_d=class extends Xr(){},Ed=class{},Js=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},hl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},js=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Js([S(),hl("design:type",String)],js.prototype,"linkLanguage",void 0);Js([S(),hl("design:type",ar)],js.prototype,"meta",void 0);js=Js([Q(),hl("design:paramtypes",[String,ar])],js);var Xu=class extends Xr(){};Xu=Js([Q()],Xu);var Wn=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},Gn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},el;(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"})(el||(el={}));var Zr=class{constructor(e,t,n){this.uuid=e,this.name=t,n?this.state=n:this.state=el.Private}};Wn([S(),Gn("design:type",String)],Zr.prototype,"uuid",void 0);Wn([S(),Gn("design:type",String)],Zr.prototype,"name",void 0);Wn([S(),Gn("design:type",String)],Zr.prototype,"state",void 0);Wn([S(),Gn("design:type",String)],Zr.prototype,"sharedUrl",void 0);Wn([S(),Gn("design:type",Xu)],Zr.prototype,"neighbourhood",void 0);Wn([S(),Gn("design:type",Array)],Zr.prototype,"owners",void 0);Zr=Wn([Q(),Gn("design:paramtypes",[String,String,String])],Zr);var xd=class{constructor(e){this.proxies=new Map,this.activeSubscriptions=new Map,this.debounceTimers=new Map,this.seenMessages=new Map,this.perspectiveClient=e.perspectiveClient,this.logger=e.logger,this.debounceMs=e.debounceMs??2e3,this.onWake=e.onWake,this.onPersist=e.onPersist,this.QuerySubscriptionProxyCtor=e.QuerySubscriptionProxy??null,this.previousSeenMessages=e.previousSeenMessages??{}}async subscribe(e){if(this.dispose(e.id,!1),!this.QuerySubscriptionProxyCtor)throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");let t=this.QuerySubscriptionProxyCtor;this.logger.info(`[waker] ${e.id}: creating subscription (perspective=${e.perspective}, type=${e.type})`),this.logger.info(`[waker] ${e.id}: SurrealQL query:
966
- ${e.query}`);let n=new t(e.perspective,e.query,this.perspectiveClient);n.isSurrealDB=!0,n.initialized&&typeof n.initialized.catch=="function"&&n.initialized.catch(()=>{});try{await n.subscribe(),await n.initialized}catch(a){let o=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${o}`);try{n.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let i=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,i),i.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${i.size} seen message(s) from persisted state`),n.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let o=this.seenMessages.get(e.id)??new Set,s=[];for(let l of a)l&&l.source&&!o.has(l.source)&&s.push(l.source);if(s.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${s.length} new message(s) out of ${a.length} total`);let c=[];for(let l of s){let p=[];try{let f=`SELECT * FROM link WHERE predicate = 'ad4m://has_child' AND target = '${l.replace(/'/g,"\\'")}'`;this.logger.info(`[waker] ${e.id}: resolving parents for ${l}`);let h=await this.perspectiveClient.querySurrealDB(e.perspective,f);if(Array.isArray(h))for(let m of h)m&&m.source&&p.push(m.source)}catch(d){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${l} \u2014 ${d?.message??d}`)}this.logger.info(`[waker] ${e.id}: message ${l} has ${p.length} parent(s): ${p.join(", ")}`),c.push({address:l,parents:p})}for(let l of s)o.add(l);this.seenMessages.set(e.id,o);let u=this.debounceTimers.get(e.id);u&&clearTimeout(u),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a,c),this.debounceTimers.delete(e.id),this.persist()},this.debounceMs))}else{this.logger.info(`[waker] ${e.id}: channel update (${a.length} items)`);let o=this.debounceTimers.get(e.id);o&&clearTimeout(o),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a),this.debounceTimers.delete(e.id)},this.debounceMs))}}),this.proxies.set(e.id,n),this.activeSubscriptions.set(e.id,e),this.persist(),this.logger.info(`[waker] Subscription ${e.id} active (type=${e.type}, perspective=${e.perspective})`)}dispose(e,t=!0){let n=this.proxies.get(e);if(n){try{n.dispose()}catch{}this.proxies.delete(e)}let i=this.debounceTimers.get(e);i&&(clearTimeout(i),this.debounceTimers.delete(e)),this.activeSubscriptions.delete(e),this.seenMessages.delete(e),t&&this.persist()}disposeAll(){for(let[e]of this.proxies)this.dispose(e,!1)}getActive(){return Array.from(this.activeSubscriptions.values())}has(e){return this.activeSubscriptions.has(e)}persist(){if(this.onPersist){let e={};for(let[t,n]of this.seenMessages)e[t]=Array.from(n);this.onPersist(this.getActive(),e)}}},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},Uh=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Us=class{};Zs([S(),Uh("design:type",Array)],Us.prototype,"additions",void 0);Zs([S(),Uh("design:type",Array)],Us.prototype,"removals",void 0);Us=Zs([Q()],Us);var kd=class extends Xr(){};kd=Zs([Q()],kd);var Id=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},gi=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)},Aa,wn,ts="smart_literal://content";function aw(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 Ka=class{constructor(e,t){Aa.set(this,void 0),wn.set(this,void 0),Id(this,Aa,e,"f"),Id(this,wn,t,"f")}get base(){return gi(this,wn,"f")}static async create(e,t){let n=be.from(aw(10)).toUrl(),i=new Ka(e,n);return await i.set(t),i}static async isSmartLiteralBase(e,t){return(await e.get(new fe({source:t,predicate:ts}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new fe({predicate:ts}))).map(n=>new Ka(e,n.data.source))}async get(){let e=await gi(this,Aa,"f").getSingleTarget(new fe({source:gi(this,wn,"f"),predicate:ts}));if(!e)throw`No content for smart literal ${gi(this,wn,"f")}`;return be.fromUrl(e).get()}async set(e){let t=be.from(e);await gi(this,Aa,"f").setSingleTarget(new ht({source:gi(this,wn,"f"),predicate:ts,target:t.toUrl()}))}};Aa=new WeakMap,wn=new WeakMap;function Oa(r,e){if("predicate"in r)return r.predicate;let{model:t}=r,n=Yt(t);if(r.field){let i=n[r.field];if(!i)throw new Error(`parent(): field "${r.field}" is not a registered relation on ${t.name}`);return i.predicate}for(let[,i]of Object.entries(n))if(i.target&&i.target()===e)return i.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function Td(r,e){return!r||!e?"":`triple("${r.id}", "${e}", Base)`}function Ad(){return`
989
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return n}};Ue=new WeakMap,ms=new WeakMap;var Fr=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},Me=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)},Xt,gs,ka,ys,Ta,En,vs,Aa,Ga=class{constructor(e,t=!0){Xt.set(this,void 0),gs.set(this,void 0),ka.set(this,void 0),ys.set(this,void 0),Ta.set(this,void 0),En.set(this,void 0),vs.set(this,void 0),Aa.set(this,void 0),Fr(this,Xt,e,"f"),Fr(this,gs,new Ua(Me(this,Xt,"f"),t),"f"),Fr(this,ka,new qu(Me(this,Xt,"f")),"f"),Fr(this,ys,new Mu(Me(this,Xt,"f")),"f"),Fr(this,Ta,new Uu(Me(this,Xt,"f")),"f"),Fr(this,Aa,new Zu(Me(this,Xt,"f"),t),"f"),Fr(this,En,new Ds(Me(this,Xt,"f"),t),"f"),Me(this,En,"f").setExpressionClient(Me(this,ka,"f")),Me(this,En,"f").setNeighbourhoodClient(Me(this,Ta,"f")),Me(this,En,"f").setAIClient(Me(this,Aa,"f")),Fr(this,vs,new ju(Me(this,Xt,"f"),t),"f")}get agent(){return Me(this,gs,"f")}get expression(){return Me(this,ka,"f")}get languages(){return Me(this,ys,"f")}get neighbourhood(){return Me(this,Ta,"f")}get perspective(){return Me(this,En,"f")}get runtime(){return Me(this,vs,"f")}get ai(){return Me(this,Aa,"f")}};Xt=new WeakMap,gs=new WeakMap,ka=new WeakMap,ys=new WeakMap,Ta=new WeakMap,En=new WeakMap,vs=new WeakMap,Aa=new WeakMap;var Yu;(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"})(Yu||(Yu={}));var pl=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},dl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},On=class{constructor(e,t){this.language=e,this.expression=t}};pl([w(),dl("design:type",nr)],On.prototype,"language",void 0);pl([w(),dl("design:type",String)],On.prototype,"expression",void 0);On=pl([H(),dl("design:paramtypes",[nr,String])],On);function ZT(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function YT(r){if(r.startsWith("literal://")){let a=new nr;a.address="literal",a.name="literal";let o=r.substring(10);return new On(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new nr;return s.address=a,new On(s,o)}let i=/^did:([^\s]+)$/.exec(r);if(i&&i.length==2){let a=new nr;return a.address="did",new On(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},lr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},$s=class{};It([w(),lr("design:type",String)],$s.prototype,"name",void 0);It([w(),lr("design:type",String)],$s.prototype,"type",void 0);$s=It([H()],$s);var Ka=class{};It([w(),lr("design:type",String)],Ka.prototype,"label",void 0);It([w(),lr("design:type",String)],Ka.prototype,"name",void 0);It([w(),lr("design:type",Array)],Ka.prototype,"parameters",void 0);Ka=It([H()],Ka);var Fs=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};It([w(),lr("design:type",String)],Fs.prototype,"name",void 0);It([w(),lr("design:type",String)],Fs.prototype,"parametersStringified",void 0);Fs=It([We(),lr("design:paramtypes",[String,Object])],Fs);var Ms=class{};It([w(),lr("design:type",String)],Ms.prototype,"did",void 0);It([w(),lr("design:type",Cn)],Ms.prototype,"status",void 0);Ms=It([H()],Ms);var Sd=class{},Hn=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},Ui=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Yr=class{};Hn([w(),Ui("design:type",String)],Yr.prototype,"name",void 0);Hn([w(),Ui("design:type",String)],Yr.prototype,"address",void 0);Hn([w(),Ui("design:type",String)],Yr.prototype,"settings",void 0);Hn([w(),Ui("design:type",Nn)],Yr.prototype,"icon",void 0);Hn([w(),Ui("design:type",Nn)],Yr.prototype,"constructorIcon",void 0);Hn([w(),Ui("design:type",Nn)],Yr.prototype,"settingsIcon",void 0);Yr=Hn([H()],Yr);var ut=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},yt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Bt=class{};ut([w(),yt("design:type",String)],Bt.prototype,"name",void 0);ut([w(),yt("design:type",String)],Bt.prototype,"address",void 0);ut([w(),yt("design:type",String)],Bt.prototype,"description",void 0);ut([w(),yt("design:type",String)],Bt.prototype,"author",void 0);ut([w(),yt("design:type",Boolean)],Bt.prototype,"templated",void 0);ut([w(),yt("design:type",String)],Bt.prototype,"templateSourceLanguageAddress",void 0);ut([w(),yt("design:type",String)],Bt.prototype,"templateAppliedParams",void 0);ut([w(),yt("design:type",Array)],Bt.prototype,"possibleTemplateParams",void 0);ut([w(),yt("design:type",String)],Bt.prototype,"sourceCodeLink",void 0);Bt=ut([H()],Bt);var Di=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ut([w(),yt("design:type",String)],Di.prototype,"name",void 0);ut([w(),yt("design:type",String)],Di.prototype,"description",void 0);ut([w(),yt("design:type",Array)],Di.prototype,"possibleTemplateParams",void 0);ut([w(),yt("design:type",String)],Di.prototype,"sourceCodeLink",void 0);Di=ut([We(),yt("design:paramtypes",[String,String])],Di);var wd=class{},_d=class extends rn(){},Ed=class{},Js=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},hl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Us=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Js([w(),hl("design:type",String)],Us.prototype,"linkLanguage",void 0);Js([w(),hl("design:type",sr)],Us.prototype,"meta",void 0);Us=Js([H(),hl("design:paramtypes",[String,sr])],Us);var Xu=class extends rn(){};Xu=Js([H()],Xu);var Gn=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},Kn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},el;(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"})(el||(el={}));var Xr=class{constructor(e,t,n){this.uuid=e,this.name=t,n?this.state=n:this.state=el.Private}};Gn([w(),Kn("design:type",String)],Xr.prototype,"uuid",void 0);Gn([w(),Kn("design:type",String)],Xr.prototype,"name",void 0);Gn([w(),Kn("design:type",String)],Xr.prototype,"state",void 0);Gn([w(),Kn("design:type",String)],Xr.prototype,"sharedUrl",void 0);Gn([w(),Kn("design:type",Xu)],Xr.prototype,"neighbourhood",void 0);Gn([w(),Kn("design:type",Array)],Xr.prototype,"owners",void 0);Xr=Gn([H(),Kn("design:paramtypes",[String,String,String])],Xr);var xd=class{constructor(e){this.proxies=new Map,this.activeSubscriptions=new Map,this.debounceTimers=new Map,this.seenMessages=new Map,this.perspectiveClient=e.perspectiveClient,this.logger=e.logger,this.debounceMs=e.debounceMs??2e3,this.onWake=e.onWake,this.onPersist=e.onPersist,this.QuerySubscriptionProxyCtor=e.QuerySubscriptionProxy??null,this.previousSeenMessages=e.previousSeenMessages??{}}async subscribe(e){if(this.dispose(e.id,!1),!this.QuerySubscriptionProxyCtor)throw new Error("WakerSubscriptionManager: QuerySubscriptionProxy must be provided via constructor options");let t=this.QuerySubscriptionProxyCtor;this.logger.info(`[waker] ${e.id}: creating subscription (perspective=${e.perspective}, type=${e.type})`),this.logger.info(`[waker] ${e.id}: SurrealQL query:
990
+ ${e.query}`);let n=new t(e.perspective,e.query,this.perspectiveClient);n.isSurrealDB=!0,n.initialized&&typeof n.initialized.catch=="function"&&n.initialized.catch(()=>{});try{await n.subscribe(),await n.initialized}catch(a){let o=a?.message??String(a);this.logger.warn(`[waker] ${e.id}: subscription failed \u2014 ${o}`);try{n.dispose()}catch{}this.activeSubscriptions.delete(e.id),this.seenMessages.delete(e.id),this.persist();return}this.logger.info(`[waker] ${e.id}: subscription initialized successfully`);let i=new Set(this.previousSeenMessages[e.id]??[]);this.seenMessages.set(e.id,i),i.size>0&&this.logger.info(`[waker] ${e.id}: seeded ${i.size} seen message(s) from persisted state`),n.onResult(async a=>{if(this.logger.info(`[waker] ${e.id}: onResult fired \u2014 type=${typeof a}, isArray=${Array.isArray(a)}, value=${String(JSON.stringify(a)).substring(0,500)}`),!Array.isArray(a)){this.logger.warn(`[waker] ${e.id}: ignoring non-array result: ${JSON.stringify(a)}`);return}if(e.type==="mention"){let o=this.seenMessages.get(e.id)??new Set,s=[];for(let l of a)l&&l.source&&!o.has(l.source)&&s.push(l.source);if(s.length===0){this.logger.info(`[waker] ${e.id}: all ${a.length} items already seen, skipping`);return}this.logger.info(`[waker] ${e.id}: ${s.length} new message(s) out of ${a.length} total`);let c=[];for(let l of s){let p=[];try{let f=`SELECT * FROM link WHERE predicate = 'ad4m://has_child' AND target = '${l.replace(/'/g,"\\'")}'`;this.logger.info(`[waker] ${e.id}: resolving parents for ${l}`);let h=await this.perspectiveClient.querySurrealDB(e.perspective,f);if(Array.isArray(h))for(let m of h)m&&m.source&&p.push(m.source)}catch(d){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${l} \u2014 ${d?.message??d}`)}this.logger.info(`[waker] ${e.id}: message ${l} has ${p.length} parent(s): ${p.join(", ")}`),c.push({address:l,parents:p})}for(let l of s)o.add(l);this.seenMessages.set(e.id,o);let u=this.debounceTimers.get(e.id);u&&clearTimeout(u),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a,c),this.debounceTimers.delete(e.id),this.persist()},this.debounceMs))}else{this.logger.info(`[waker] ${e.id}: channel update (${a.length} items)`);let o=this.debounceTimers.get(e.id);o&&clearTimeout(o),this.debounceTimers.set(e.id,setTimeout(()=>{this.onWake(e,a),this.debounceTimers.delete(e.id)},this.debounceMs))}}),this.proxies.set(e.id,n),this.activeSubscriptions.set(e.id,e),this.persist(),this.logger.info(`[waker] Subscription ${e.id} active (type=${e.type}, perspective=${e.perspective})`)}dispose(e,t=!0){let n=this.proxies.get(e);if(n){try{n.dispose()}catch{}this.proxies.delete(e)}let i=this.debounceTimers.get(e);i&&(clearTimeout(i),this.debounceTimers.delete(e)),this.activeSubscriptions.delete(e),this.seenMessages.delete(e),t&&this.persist()}disposeAll(){for(let[e]of this.proxies)this.dispose(e,!1)}getActive(){return Array.from(this.activeSubscriptions.values())}has(e){return this.activeSubscriptions.has(e)}persist(){if(this.onPersist){let e={};for(let[t,n]of this.seenMessages)e[t]=Array.from(n);this.onPersist(this.getActive(),e)}}},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},jh=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},js=class{};Zs([w(),jh("design:type",Array)],js.prototype,"additions",void 0);Zs([w(),jh("design:type",Array)],js.prototype,"removals",void 0);js=Zs([H()],js);var Id=class extends rn(){};Id=Zs([H()],Id);var kd=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},bi=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)},Oa,xn,ts="smart_literal://content";function sw(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 Ja=class{constructor(e,t){Oa.set(this,void 0),xn.set(this,void 0),kd(this,Oa,e,"f"),kd(this,xn,t,"f")}get base(){return bi(this,xn,"f")}static async create(e,t){let n=Se.from(sw(10)).toUrl(),i=new Ja(e,n);return await i.set(t),i}static async isSmartLiteralBase(e,t){return(await e.get(new fe({source:t,predicate:ts}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new fe({predicate:ts}))).map(n=>new Ja(e,n.data.source))}async get(){let e=await bi(this,Oa,"f").getSingleTarget(new fe({source:bi(this,xn,"f"),predicate:ts}));if(!e)throw`No content for smart literal ${bi(this,xn,"f")}`;return Se.fromUrl(e).get()}async set(e){let t=Se.from(e);await bi(this,Oa,"f").setSingleTarget(new mt({source:bi(this,xn,"f"),predicate:ts,target:t.toUrl()}))}};Oa=new WeakMap,xn=new WeakMap;function Da(r,e){if("predicate"in r)return r.predicate;let{model:t}=r,n=er(t);if(r.field){let i=n[r.field];if(!i)throw new Error(`parent(): field "${r.field}" is not a registered relation on ${t.name}`);return i.predicate}for(let[,i]of Object.entries(n))if(i.target&&i.target()===e)return i.predicate;throw new Error(`parent(): could not resolve predicate \u2014 no relation on ${t.name} targets ${e.name||"the queried class"}`)}function Td(r,e){return!r||!e?"":`triple("${r.id}", "${e}", Base)`}function Ad(){return`
967
991
  findall(
968
992
  [T, A],
969
993
  link(Base, _, _, T, A),
@@ -971,18 +995,18 @@ ${e.query}`);let n=new t(e.perspective,e.query,this.perspectiveClient);n.isSurre
971
995
  ),
972
996
  sort(AllLinks, SortedLinks),
973
997
  SortedLinks = [[Timestamp, Author]|_]
974
- `}function ow(r){return`
998
+ `}function cw(r){return`
975
999
  findall([PropertyName, PropertyValue, Resolve], (
976
1000
  % Constrain to specified properties if provided
977
1001
  ${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
978
1002
  resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
979
1003
  ), Properties)
980
- `}function Od(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,n])=>{let i=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=t==="id"?"Base":st(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:p,gte:d}=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 f=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:p,symbol:">"},{value:d,symbol:">="}];for(let{value:h,symbol:m}of f)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 Dd(r){return r?"length(UnsortedInstances, TotalCount)":""}function Nd(r){if(!r)return"SortedInstances = UnsortedInstances";let e=Object.entries(r);if(e.length===1){let[n,i]=e[0];return`sort_instances(UnsortedInstances, "${n}", "${i}", SortedInstances)`}let t=[];for(let n=e.length-1;n>=0;n--){let[i,a]=e[n],o=n===e.length-1?"UnsortedInstances":`MultiSortIntermediate${n+1}`,s=n===0?"SortedInstances":`MultiSortIntermediate${n}`;t.push(`sort_instances(${o}, "${i}", "${a}", ${s})`)}return t.join(`,
981
- `)}function Rd(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function Cd(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Pd(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),n=(t||"").replace(/\/+$/,"");return`${e}://${n}`}else return r.replace(/\/+$/,"")}function ml(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 qh(r,e){return ml(r.type)===e}function Bh(r){return qh(r,"array")}function Ld(r){return qh(r,"object")}function sw(r){let e=ml(r.type);return e==="number"||e==="integer"}function Vh(r,e){if(e.namespace)return e.namespace;if(r["x-ad4m"]?.namespace)return r["x-ad4m"].namespace;if(r.title)return`${r.title.toLowerCase()}://`;if(r.$id)try{let n=new URL(r.$id).pathname.split("/").filter(i=>i);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1004
+ `}function Od(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,n])=>{let i=["id","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=t==="id"?"Base":ct(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:p,gte:d}=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 f=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:p,symbol:">"},{value:d,symbol:">="}];for(let{value:h,symbol:m}of f)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 Dd(r){return r?"length(UnsortedInstances, TotalCount)":""}function Nd(r){if(!r)return"SortedInstances = UnsortedInstances";let e=Object.entries(r);if(e.length===1){let[n,i]=e[0];return`sort_instances(UnsortedInstances, "${n}", "${i}", SortedInstances)`}let t=[];for(let n=e.length-1;n>=0;n--){let[i,a]=e[n],o=n===e.length-1?"UnsortedInstances":`MultiSortIntermediate${n+1}`,s=n===0?"SortedInstances":`MultiSortIntermediate${n}`;t.push(`sort_instances(${o}, "${i}", "${a}", ${s})`)}return t.join(`,
1005
+ `)}function Rd(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function Cd(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Pd(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),n=(t||"").replace(/\/+$/,"");return`${e}://${n}`}else return r.replace(/\/+$/,"")}function ml(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 qh(r,e){return ml(r.type)===e}function Bh(r){return qh(r,"array")}function Ld(r){return qh(r,"object")}function uw(r){let e=ml(r.type);return e==="number"||e==="integer"}function Vh(r,e){if(e.namespace)return e.namespace;if(r["x-ad4m"]?.namespace)return r["x-ad4m"].namespace;if(r.title)return`${r.title.toLowerCase()}://`;if(r.$id)try{let n=new URL(r.$id).pathname.split("/").filter(i=>i);if(n.length>0)return`${n[n.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
982
1006
  - options.namespace
983
1007
  - schema["x-ad4m"].namespace
984
1008
  - schema.title
985
- - valid schema.$id`)}function Qh(r,e,t,n,i){if(i.propertyMapping?.[e])return i.propertyMapping[e];if(t["x-ad4m"]?.through)return t["x-ad4m"].through;if(i.predicateTemplate){let o=Pd(n),[s,c]=o.includes("://")?o.split("://"):["",o],u=c||"";return i.predicateTemplate.replace("${namespace}",u).replace("${scheme}",s).replace("${ns}",u).replace("${title}",r.title||"").replace("${property}",e)}if(i.predicateGenerator)return i.predicateGenerator(r.title||"",e);let a=Pd(n);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function ua(r,e,t,n,i){return t.propertyOptions?.[r]?.[n]!==void 0?t.propertyOptions[r][n]:e["x-ad4m"]?.[n]!==void 0?e["x-ad4m"][n]:t[n]!==void 0?t[n]:i}function cw(r){switch(r){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function uw(r,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=Vh(e,t),i=class extends r{};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[c,u]of Object.entries(e.properties)){let l=Qh(e,c,u,n,t),p=e.required?.includes(c)||!1,d=ml(u.type);if(Bh(u)){o[c]={through:l,local:ua(c,u,t,"local")},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:[]});let h=`add${st(c)}`,m=`remove${st(c)}`,v=`set${st(c)}`;i.prototype[h]=function(){},i.prototype[m]=function(){},i.prototype[v]=function(){}}else{let h=ua(c,u,t,"resolveLanguage");!h&&t.resolveLanguage&&(h=t.resolveLanguage);let m=ua(c,u,t,"local"),v=ua(c,u,t,"readOnly");if(v===void 0){let b=u["x-ad4m"]?.writable;v=b!==void 0?!b:!1}let _=!v,y=ua(c,u,t,"initial");if(Ld(u)&&!h&&(h="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),h==null&&sw(u)&&(h="literal"),h==null&&(h="literal"),p&&!y&&(Ld(u)?y="literal://json:{}":y="ad4m://undefined"),a[c]={through:l,required:p,writable:_,...h&&{resolveLanguage:h},...m!==void 0&&{local:m},...y&&{initial:y}},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:cw(d)}),_){let b=Vs(c);i.prototype[b]=function(){}}}}for(let[c,u]of Object.entries(a))Vy(i,c,u);for(let[c,u]of Object.entries(o))Qy(i,c,{predicate:u.through||"",kind:"hasMany",...u.getter!==void 0&&{getter:u.getter},...u.local!==void 0&&{local:u.local}});return i.prototype.__jsonSchema=e,i.prototype.__jsonSchemaOptions=t,zy({name:t.name})(i),i}function lw(r,e,t){if(!t)return"";let n=[];for(let[i,a]of Object.entries(t))if(["id","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(u=>ge(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=>ge(l)).join(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${ge(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${ge(c.between[0])} AND ${s} <= ${ge(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${ge(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${ge(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${ge(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${ge(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${ge(c.contains)}`)}else n.push(`${s} = ${ge(a)}`)}else{let s=e[i],c=s?.kind==="belongsToOne"||s?.kind==="belongsToMany";if(s){let d=ne(s.predicate);if(Array.isArray(a)){let f=a.map(h=>ge(h)).join(", ");c?n.push(`count(<-link[WHERE predicate = '${d}' AND in.uri IN [${f}]]) > 0`):n.push(`count(->link[WHERE predicate = '${d}' AND out.uri IN [${f}]]) > 0`)}else if(typeof a=="object"&&a!==null){let f=a;if(f.not!==void 0)if(Array.isArray(f.not)){let h=f.not.map(m=>ge(m)).join(", ");c?n.push(`count(<-link[WHERE predicate = '${d}' AND in.uri IN [${h}]]) = 0`):n.push(`count(->link[WHERE predicate = '${d}' AND out.uri IN [${h}]]) = 0`)}else c?n.push(`count(<-link[WHERE predicate = '${d}' AND in.uri = ${ge(f.not)}]) = 0`):n.push(`count(->link[WHERE predicate = '${d}' AND out.uri = ${ge(f.not)}]) = 0`)}else c?n.push(`count(<-link[WHERE predicate = '${d}' AND in.uri = ${ge(a)}]) > 0`):n.push(`count(->link[WHERE predicate = '${d}' AND out.uri = ${ge(a)}]) > 0`);continue}let u=r.properties[i];if(!u)continue;let l=ne(u.predicate),p=u.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let d=a.map(f=>ge(f)).join(", ");n.push(`count(->link[WHERE predicate = '${l}' AND ${p} IN [${d}]]) > 0`)}else if(typeof a=="object"&&a!==null){let d=a;if(d.not!==void 0)if(Array.isArray(d.not)){let h=d.not.map(m=>ge(m)).join(", ");n.push(`count(->link[WHERE predicate = '${l}' AND ${p} IN [${h}]]) = 0`)}else n.push(`count(->link[WHERE predicate = '${l}' AND ${p} = ${ge(d.not)}]) = 0`);(d.gt!==void 0||d.gte!==void 0||d.lt!==void 0||d.lte!==void 0||d.between!==void 0||d.contains!==void 0)&&n.push(`count(->link[WHERE predicate = '${l}']) > 0`)}else n.push(`count(->link[WHERE predicate = '${l}' AND ${p} = ${ge(a)}]) > 0`)}return n.join(" AND ")}function fw(r,e,t,n){let{where:i}=t,a=[];if(t.parent){let u=Oa(t.parent,n);a.push(`count(<-link[WHERE in.uri = ${ge(t.parent.id)} AND predicate = '${ne(u)}']) > 0`)}for(let[,u]of Object.entries(r.properties))if(u.required){if(u.getter)continue;u.flag&&u.initial?a.push(`count(->link[WHERE predicate = '${ne(u.predicate)}' AND out.uri = '${ne(u.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${ne(u.predicate)}']) > 0`)}if(a.length===0){for(let[,u]of Object.entries(r.properties))if(u.initial){u.flag?a.push(`count(->link[WHERE predicate = '${ne(u.predicate)}' AND out.uri = '${ne(u.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${ne(u.predicate)}']) > 0`);break}}if(a.length===0){let u=[];for(let[,l]of Object.entries(r.properties))l.predicate&&u.push(`predicate = '${ne(l.predicate)}'`);if(r.relations)for(let[,l]of Object.entries(r.relations))l.predicate&&u.push(`predicate = '${ne(l.predicate)}'`);u.length>0&&a.push(`count(->link[WHERE (${u.join(" OR ")})]) > 0`)}let o=lw(r,e,i),s=[];return s.push(...a),o&&s.push(o),s.push("count(->link) > 0"),`
1009
+ - valid schema.$id`)}function Qh(r,e,t,n,i){if(i.propertyMapping?.[e])return i.propertyMapping[e];if(t["x-ad4m"]?.through)return t["x-ad4m"].through;if(i.predicateTemplate){let o=Pd(n),[s,c]=o.includes("://")?o.split("://"):["",o],u=c||"";return i.predicateTemplate.replace("${namespace}",u).replace("${scheme}",s).replace("${ns}",u).replace("${title}",r.title||"").replace("${property}",e)}if(i.predicateGenerator)return i.predicateGenerator(r.title||"",e);let a=Pd(n);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function la(r,e,t,n,i){return t.propertyOptions?.[r]?.[n]!==void 0?t.propertyOptions[r][n]:e["x-ad4m"]?.[n]!==void 0?e["x-ad4m"][n]:t[n]!==void 0?t[n]:i}function lw(r){switch(r){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}function fw(r,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=Vh(e,t),i=class extends r{};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[c,u]of Object.entries(e.properties)){let l=Qh(e,c,u,n,t),p=e.required?.includes(c)||!1,d=ml(u.type);if(Bh(u)){o[c]={through:l,local:la(c,u,t,"local")},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:[]});let h=`add${ct(c)}`,m=`remove${ct(c)}`,b=`set${ct(c)}`;i.prototype[h]=function(){},i.prototype[m]=function(){},i.prototype[b]=function(){}}else{let h=la(c,u,t,"resolveLanguage");!h&&t.resolveLanguage&&(h=t.resolveLanguage);let m=la(c,u,t,"local"),b=la(c,u,t,"readOnly");if(b===void 0){let S=u["x-ad4m"]?.writable;b=S!==void 0?!S:!1}let _=!b,v=la(c,u,t,"initial");if(Ld(u)&&!h&&(h="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),h==null&&uw(u)&&(h="literal"),h==null&&(h="literal"),p&&!v&&(Ld(u)?v="literal://json:{}":v="ad4m://undefined"),a[c]={through:l,required:p,writable:_,...h&&{resolveLanguage:h},...m!==void 0&&{local:m},...v&&{initial:v}},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:lw(d)}),_){let S=Vs(c);i.prototype[S]=function(){}}}}for(let[c,u]of Object.entries(a))Wy(i,c,u);for(let[c,u]of Object.entries(o))zy(i,c,{predicate:u.through||"",kind:"hasMany",...u.getter!==void 0&&{getter:u.getter},...u.local!==void 0&&{local:u.local}});return i.prototype.__jsonSchema=e,i.prototype.__jsonSchemaOptions=t,Hy({name:t.name})(i),i}function pw(r,e,t){if(!t)return"";let n=[];for(let[i,a]of Object.entries(t))if(["id","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="uri";if(Array.isArray(a)){let c=a.map(u=>ye(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=>ye(l)).join(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${ye(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${ye(c.between[0])} AND ${s} <= ${ye(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${ye(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${ye(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${ye(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${ye(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${ye(c.contains)}`)}else n.push(`${s} = ${ye(a)}`)}else{let s=e[i],c=s?.kind==="belongsToOne"||s?.kind==="belongsToMany";if(s){let d=ie(s.predicate);if(Array.isArray(a)){let f=a.map(h=>ye(h)).join(", ");c?n.push(`count(<-link[WHERE predicate = '${d}' AND in.uri IN [${f}]]) > 0`):n.push(`count(->link[WHERE predicate = '${d}' AND out.uri IN [${f}]]) > 0`)}else if(typeof a=="object"&&a!==null){let f=a;if(f.not!==void 0)if(Array.isArray(f.not)){let h=f.not.map(m=>ye(m)).join(", ");c?n.push(`count(<-link[WHERE predicate = '${d}' AND in.uri IN [${h}]]) = 0`):n.push(`count(->link[WHERE predicate = '${d}' AND out.uri IN [${h}]]) = 0`)}else c?n.push(`count(<-link[WHERE predicate = '${d}' AND in.uri = ${ye(f.not)}]) = 0`):n.push(`count(->link[WHERE predicate = '${d}' AND out.uri = ${ye(f.not)}]) = 0`)}else c?n.push(`count(<-link[WHERE predicate = '${d}' AND in.uri = ${ye(a)}]) > 0`):n.push(`count(->link[WHERE predicate = '${d}' AND out.uri = ${ye(a)}]) > 0`);continue}let u=r.properties[i];if(!u)continue;let l=ie(u.predicate),p=u.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let d=a.map(f=>ye(f)).join(", ");n.push(`count(->link[WHERE predicate = '${l}' AND ${p} IN [${d}]]) > 0`)}else if(typeof a=="object"&&a!==null){let d=a;if(d.not!==void 0)if(Array.isArray(d.not)){let h=d.not.map(m=>ye(m)).join(", ");n.push(`count(->link[WHERE predicate = '${l}' AND ${p} IN [${h}]]) = 0`)}else n.push(`count(->link[WHERE predicate = '${l}' AND ${p} = ${ye(d.not)}]) = 0`);(d.gt!==void 0||d.gte!==void 0||d.lt!==void 0||d.lte!==void 0||d.between!==void 0||d.contains!==void 0)&&n.push(`count(->link[WHERE predicate = '${l}']) > 0`)}else n.push(`count(->link[WHERE predicate = '${l}' AND ${p} = ${ye(a)}]) > 0`)}return n.join(" AND ")}function dw(r,e,t,n){let{where:i}=t,a=[];if(t.parent){let u=Da(t.parent,n);a.push(`count(<-link[WHERE in.uri = ${ye(t.parent.id)} AND predicate = '${ie(u)}']) > 0`)}for(let[,u]of Object.entries(r.properties))if(u.required){if(u.getter)continue;u.flag&&u.initial?a.push(`count(->link[WHERE predicate = '${ie(u.predicate)}' AND out.uri = '${ie(u.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${ie(u.predicate)}']) > 0`)}if(a.length===0){for(let[,u]of Object.entries(r.properties))if(u.initial){u.flag?a.push(`count(->link[WHERE predicate = '${ie(u.predicate)}' AND out.uri = '${ie(u.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${ie(u.predicate)}']) > 0`);break}}if(a.length===0){let u=[];for(let[,l]of Object.entries(r.properties))l.predicate&&u.push(`predicate = '${ie(l.predicate)}'`);if(r.relations)for(let[,l]of Object.entries(r.relations))l.predicate&&u.push(`predicate = '${ie(l.predicate)}'`);u.length>0&&a.push(`count(->link[WHERE (${u.join(" OR ")})]) > 0`)}let o=pw(r,e,i),s=[];return s.push(...a),o&&s.push(o),s.push("count(->link) > 0"),`
986
1010
  SELECT
987
1011
  id AS source,
988
1012
  uri AS source_uri,
@@ -990,33 +1014,33 @@ SELECT
990
1014
  FROM node
991
1015
  WHERE ${s.join(" AND ")}
992
1016
  FETCH links
993
- `.trim()}var tl=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}parent(e,t,n){let i=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let o=e.constructor;return this.queryParams.parent={id:i,model:o,field:t.field},this}let a=n?.field;if(typeof t=="string")this.queryParams.parent={id:i,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:i,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:i,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){let e;if(this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),n=await this.perspective.querySurrealDB(t);({results:e}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,n))}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),n=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,n))}return e}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.useSurrealDBFlag){let n=await t.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(n);let i=async o=>{let{results:s}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,o);e(s)};this.currentSubscription.onResult(i);let{results:a}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}else{let n=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(n);let i=async o=>{let{results:s}=await t.instancesFromPrologResult(this.perspective,this.queryParams,o);e(s)};this.currentSubscription.onResult(i);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}}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 e(i),i}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let n=async a=>{let o=a?.[0]?.TotalCount||0;e(o)};this.currentSubscription.onResult(n);let i=this.currentSubscription.result?.[0]?.TotalCount||0;return e(i),i}}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 l=>{let{results:p,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,l);n({results:p,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),u={results:s,totalCount:c,pageSize:e,pageNumber:t};return n(u),u}else{let a=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async l=>{let{results:p,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);n({results:p,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),u={results:s,totalCount:c,pageSize:e,pageNumber:t};return n(u),u}}};function rs(r){return Array.isArray(r)?r.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):r}function $d(r,e){if(Array.isArray(e))return e.includes(r);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(r):r!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return r>=t.between[0]&&r<=t.between[1];let n=!0;return t.gt!==void 0&&(n=n&&r>t.gt),t.gte!==void 0&&(n=n&&r>=t.gte),t.lt!==void 0&&(n=n&&r<t.lt),t.lte!==void 0&&(n=n&&r<=t.lte),t.contains!==void 0&&(typeof r=="string"?n=n&&r.includes(String(t.contains)):Array.isArray(r)?n=n&&r.includes(t.contains):n=!1),n}return r===e}async function pw(r,e,t,n){let i=r;if(r!=null&&r!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof r=="string"&&!r.startsWith("literal://"))try{let a=await t.getExpression(r);if(a)try{i=JSON.parse(a.data)}catch{i=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof r=="string"&&r.startsWith("literal://"))try{let a=be.fromUrl(r).get();i=a.data!==void 0?a.data:a}catch{}else typeof r=="string"&&n&&(n==="number"?i=Number(r):n==="boolean"&&(i=r==="true"||r==="1"));return e.transform&&typeof e.transform=="function"&&(i=e.transform(i)),i}async function Fd(r,e,t,n,i){if(!e||e.length===0)return;let a=null,o=null,s=null,c=i&&i.length>0?new Set(i):null,u=new Map;for(let[h,m]of Object.entries(t.properties))m.getter||c&&!c.has(h)||u.set(m.predicate,[h,m]);let l=new Map,p=[];for(let[h,m]of Object.entries(t.relations))if(!m.getter){if(m.target&&m.filter!==!1){p.push([h,m]);continue}l.set(m.predicate,[h,m])}for(let[h,m]of p)l.has(m.predicate)||l.set(m.predicate,[h,m]);let d=new Map,f=new Map;for(let h=0;h<e.length;h++){let m=e[h],{predicate:v,target:_,author:y,timestamp:b}=m;if(_==="None"||_===void 0||_===null)continue;b!=null&&((a==null||b<a)&&(a=b,s=y??null),(o==null||b>o)&&(o=b));let g=u.get(v);if(g){d.get(g[0]),d.set(g[0],{target:_,timestamp:b});continue}let A=l.get(v);if(A){let[N]=A,I=f.get(N);I||(I=[],f.set(N,I)),I.push({target:_,timestamp:b??"",index:h})}}for(let[h,{target:m}]of d){let[,v]=u.get(t.properties[h].predicate),_=typeof r[h];r[h]=await pw(m,v,n,_!=="undefined"?_:void 0)}for(let[h,m]of f)m.sort((v,_)=>{let y=String(v.timestamp).localeCompare(String(_.timestamp));return y!==0?y:v.index-_.index}),r[h]=m.map(v=>v.target).filter(v=>v!=null&&v!==""&&v!=="None");s&&(r.author=s),a!=null&&(r.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),o!=null&&(r.updatedAt=typeof o=="string"&&o.includes("T")?new Date(o).getTime():typeof o=="string"?isNaN(parseInt(o,10))?o:parseInt(o,10):o)}async function dw(r,e,t){let n=Object.fromEntries(await Promise.all(t.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let p=Array.from(o,h=>h.codePointAt(0)),d=p.every(h=>h<=255),f=p.some(h=>h>=128);if(d&&f)try{let h=Uint8Array.from(p),m=new TextDecoder("utf-8",{fatal:!0}).decode(h);m!==o&&(c=m)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:h})}}if(s){let p=await r.getExpression(o);if(p)try{c=JSON.parse(p.data)}catch{c=p.data}}let l=Rn(e.constructor)[a]?.transform;return l&&typeof l=="function"&&(c=l(c)),[a,c]}))),i=Object.fromEntries(Object.entries(n).filter(([a])=>{let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return o?o.get!==void 0||o.set!==void 0?o.set!==void 0:o.writable!==!1:!0}));Object.assign(e,i)}function hw(r,e){let t=th(r,e);if(!t){let n=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${n}".`);return}return t.getter}async function Md(r,e,t,n){let i=ge(r.id),o=n?.requestedProperties&&n.requestedProperties.length>0?new Set(n.requestedProperties):null;for(let[s,c]of Object.entries(t.properties))if(!(o&&!o.has(s))&&c.getter)try{let u=c.getter.replace(/Base/g,i),l=await e.querySurrealDB(`SELECT (${u}) AS value FROM node WHERE uri = ${i}`);l&&l.length>0&&l[0].value!==void 0&&l[0].value!==null&&l[0].value!=="None"&&l[0].value!==""&&(r[s]=l[0].value)}catch(u){console.warn(`Failed to evaluate getter for ${s}:`,u)}for(let[s,c]of Object.entries(t.relations)){if(o&&!o.has(s)&&!(n?.include&&s in n.include))continue;let u=c,l=u.getter;if(!l&&u.where&&u.direction!=="reverse")try{let p=u.target?.(),d=p?p.getModelMetadata?.()??null:null,f=eh(u.where,d);f.length>0&&(l=`(->link[WHERE predicate = '${ne(u.predicate)}'].out[WHERE ${f.join(" AND ")}].uri)`)}catch{}if(!l&&u.target&&u.filter!==!1&&u.direction!=="reverse")try{let p=u.target();l=hw(u.predicate,p),l||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${s}" (predicate: "${u.predicate}")`)}catch(p){console.warn(`[Ad4mModel] auto-generation failed for relation "${s}":`,p)}if(l)try{let d=`SELECT (${l.replace(/Base/g,i)}) AS value FROM node WHERE uri = ${i}`,f=await e.querySurrealDB(d);if(f&&f.length>0&&f[0].value!==void 0&&f[0].value!==null){let h=f[0].value;r[s]=Array.isArray(h)?h.filter(m=>m!=null&&m!==""&&m!=="None"):h}}catch(p){console.warn(`Failed to evaluate getter for ${s}:`,p)}}}async function Pa(r,e,t,n){if(!n||Object.keys(n).length===0)return;let i=Yt(r);for(let[a,o]of Object.entries(n)){let s=i[a];if(!s){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let c=s.target(),u=typeof o=="object"&&o!==null?o:void 0,l=u?.include;if(s.kind==="belongsToOne"||s.kind==="belongsToMany"){for(let _ of e){let b=(await t.get(new fe({predicate:s.predicate,target:_.id}))).filter(g=>g.data.target===_.id).map(g=>g.data.source);if(s.kind==="belongsToOne"){if(b.length===0){_[a]=null;continue}let g=b[b.length-1];try{let A=new c(t,g);await A.get(),_[a]=A}catch{_[a]=null}}else{let g=[];if(u&&(u.where||u.order||u.properties)){let A={id:b,...u.where??{}};g=await c.findAll(t,{where:A,...u.order&&{order:u.order},...u.properties&&{properties:u.properties}})}else await Promise.all(b.map(async A=>{try{let N=new c(t,A);await N.get(u?.properties?{properties:u.properties}:void 0),g.push(N)}catch{}}));if(u?.order&&!(u.where||u.properties)){let A=Object.entries(u.order);g=g.sort((N,I)=>{for(let[C,$]of A){let P=String(N[C]??""),j=String(I[C]??""),xe=P.localeCompare(j);if(xe!==0)return $==="DESC"?-xe:xe}return 0})}if(u?.offset!=null||u?.limit!=null){let A=u.offset??0,N=u.limit!=null?A+u.limit:void 0;g=g.slice(A,N)}_[a]=g,l&&g.length>0&&await Pa(c,g,t,l)}}continue}let p=new Set,d=new Map;for(let _ of e){let y=_[a];if(d.set(_,Array.isArray(y)?[...y]:y),y!=null)if(Array.isArray(y))for(let b of y)typeof b=="string"?p.add(b):b&&typeof b=="object"&&typeof b.id=="string"&&p.add(b.id);else typeof y=="string"?p.add(y):y&&typeof y=="object"&&typeof y.id=="string"&&p.add(y.id)}if(p.size===0)continue;let f=new Map,m={where:{id:Array.from(p),...u?.where??{}},...u?.order&&{order:u.order},...u?.properties&&{properties:u.properties}},v=await c.findAll(t,m);for(let _ of v)f.set(_.id,_);for(let _ of e){let y=d.get(_);if(y!=null)if(Array.isArray(y)){let b=y.map(g=>typeof g=="string"?f.has(g)?f.get(g):null:g&&typeof g=="object"&&typeof g.id=="string"?f.has(g.id)?f.get(g.id):g:null).filter(g=>g!==null);if(u?.order){let g=Object.entries(u.order);b=b.sort((A,N)=>{for(let[I,C]of g){let $=String(A[I]??""),P=String(N[I]??""),j=$.localeCompare(P);if(j!==0)return C==="DESC"?-j:j}return 0})}if(u?.offset!=null||u?.limit!=null){let g=u.offset??0,A=u.limit!=null?g+u.limit:void 0;b=b.slice(g,A)}s.maxCount===1?(b.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${b.length} values found; keeping the last`),_[a]=b.length>0?b[b.length-1]:null):_[a]=b}else typeof y=="string"&&f.has(y)?_[a]=f.get(y):y&&typeof y=="object"&&typeof y.id=="string"&&(_[a]=f.has(y.id)?f.get(y.id):y)}if(l){let _=Array.from(f.values());await Pa(c,_,t,l)}}}var Ai=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===Ai)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 @Model");let t=e.className,n={},i=Rn(this);for(let[p,d]of Object.entries(i)){let f=d;n[p]={name:p,predicate:f.through||"",required:f.required||!1,readOnly:!(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=Yt(this),s=Object.fromEntries(Object.entries(o).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));for(let[p,d]of Object.entries(s)){let f=d;a[p]={name:p,predicate:f.predicate||"",...f.local!==void 0&&{local:f.local},...f.getter!==void 0&&{getter:f.getter},direction:f.kind==="belongsToMany"||f.kind==="belongsToOne"?"reverse":"forward",...f.target!==void 0&&{target:f.target},...f.filter!==void 0&&{filter:f.filter},...f.where!==void 0&&{where:f.where}}}let c=Object.keys(n).length>0,u=Object.keys(a).length>0;if(!(c||u)&&e.__jsonSchema){let p=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(p.properties)for(let[f,h]of Object.entries(p.properties)){let m=Bh(h),v=Qh(p,f,h,Vh(p,d),d);if(m)a[f]={name:f,predicate:v,...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}};else{let _=p.required?.includes(f)||!1;n[f]={name:f,predicate:v,required:_,readOnly:h["x-ad4m"]?.writable===!1,...h["x-ad4m"]?.resolveLanguage&&{resolveLanguage:h["x-ad4m"].resolveLanguage},...h["x-ad4m"]?.initial&&{initial:h["x-ad4m"].initial},...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}}}}}return{className:t,properties:n,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||be.from(Xd(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return Rn(t)[e]}getRelationOptions(e){let t=this.constructor;return Yt(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)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}}]}generateRelationAction(e,t){let n=this.getRelationOptions(e);if(!n)throw new Error(`Relation "${e}" has no metadata defined`);if(!n.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:n.predicate,target:"value",...n.local&&{local:!0}}]}static async assignValuesToInstance(e,t,n){return dw(e,t,n)}takeSnapshot(e){let n=this.constructor.getModelMetadata(),i={};for(let a of Object.keys(n.properties)){let o=this[a];i[a]=rs(Array.isArray(o)?[...o]:o)}if(e===void 0)for(let a of Object.keys(n.relations)){let o=this[a];i[a]=rs(Array.isArray(o)?[...o]:o)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in n.relations){let o=this[a];i[a]=rs(Array.isArray(o)?[...o]:o)}}this._snapshot=i}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let n=[],i=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of i){if(!(a in this._snapshot))continue;let o=rs(this[a]),s=this._snapshot[a];if(Array.isArray(o)||Array.isArray(s)){let c=Array.isArray(o)?[...o].sort():[],u=Array.isArray(s)?[...s].sort():[];(c.length!==u.length||c.some((l,p)=>l!==u[p]))&&n.push(a)}else o!==s&&n.push(a)}return n}async getData(e){try{let t=this.constructor,n=t.getModelMetadata(),a=`
1017
+ `.trim()}var tl=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}parent(e,t,n){let i=typeof e=="string"?e:e.id;if(typeof t=="object"&&t!==null&&!("prototype"in t)){if(typeof e=="string")throw new Error("parent() called with a string id and options object requires a model class as second argument");let o=e.constructor;return this.queryParams.parent={id:i,model:o,field:t.field},this}let a=n?.field;if(typeof t=="string")this.queryParams.parent={id:i,predicate:t};else if(typeof t=="function")this.queryParams.parent={id:i,model:t,...a&&{field:a}};else if(typeof e!="string")this.queryParams.parent={id:i,model:e.constructor,...a&&{field:a}};else throw new Error("parent() called with a string id requires a second argument: either a model class or a predicate string");return this}properties(e){return this.queryParams.properties=e,this}include(e){return this.queryParams.include=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){let e;if(this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),n=await this.perspective.querySurrealDB(t);({results:e}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,n))}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),n=await this.perspective.infer(t);({results:e}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,n))}return e}async first(){return this.queryParams.limit=1,(await this.get())[0]??null}async subscribe(e){this.dispose();let t=this.ctor;if(this.useSurrealDBFlag){let n=await t.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(n);let i=async o=>{let{results:s}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,o);e(s)};this.currentSubscription.onResult(i);let{results:a}=await t.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}else{let n=await t.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(n);let i=async o=>{let{results:s}=await t.instancesFromPrologResult(this.perspective,this.queryParams,o);e(s)};this.currentSubscription.onResult(i);let{results:a}=await t.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return e(a),a}}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 e(i),i}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let n=async a=>{let o=a?.[0]?.TotalCount||0;e(o)};this.currentSubscription.onResult(n);let i=this.currentSubscription.result?.[0]?.TotalCount||0;return e(i),i}}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 l=>{let{results:p,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,l);n({results:p,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),u={results:s,totalCount:c,pageSize:e,pageNumber:t};return n(u),u}else{let a=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async l=>{let{results:p,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);n({results:p,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),u={results:s,totalCount:c,pageSize:e,pageNumber:t};return n(u),u}}};function rs(r){return Array.isArray(r)?r.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):r}function $d(r,e){if(Array.isArray(e))return e.includes(r);if(typeof e=="object"&&e!==null){let t=e;if(t.not!==void 0)return Array.isArray(t.not)?!t.not.includes(r):r!==t.not;if(t.between!==void 0&&Array.isArray(t.between)&&t.between.length===2)return r>=t.between[0]&&r<=t.between[1];let n=!0;return t.gt!==void 0&&(n=n&&r>t.gt),t.gte!==void 0&&(n=n&&r>=t.gte),t.lt!==void 0&&(n=n&&r<t.lt),t.lte!==void 0&&(n=n&&r<=t.lte),t.contains!==void 0&&(typeof r=="string"?n=n&&r.includes(String(t.contains)):Array.isArray(r)?n=n&&r.includes(t.contains):n=!1),n}return r===e}async function hw(r,e,t,n){let i=r;if(r!=null&&r!=="")if(e.resolveLanguage!=null&&e.resolveLanguage!=="literal"&&typeof r=="string"&&!r.startsWith("literal://"))try{let a=await t.getExpression(r);if(a)try{i=JSON.parse(a.data)}catch{i=a.data}}catch(a){console.warn(`hydratePropertyValue: failed to resolve expression for "${e.name}":`,a)}else if(e.resolveLanguage==="literal"&&typeof r=="string"&&r.startsWith("literal://"))try{let a=Se.fromUrl(r).get();i=a.data!==void 0?a.data:a}catch{}else typeof r=="string"&&n&&(n==="number"?i=Number(r):n==="boolean"&&(i=r==="true"||r==="1"));return e.transform&&typeof e.transform=="function"&&(i=e.transform(i)),i}async function Fd(r,e,t,n,i){if(!e||e.length===0)return;let a=null,o=null,s=null,c=i&&i.length>0?new Set(i):null,u=new Map;for(let[h,m]of Object.entries(t.properties))m.getter||c&&!c.has(h)||u.set(m.predicate,[h,m]);let l=new Map,p=[];for(let[h,m]of Object.entries(t.relations))if(!m.getter){if(m.target&&m.filter!==!1){p.push([h,m]);continue}l.set(m.predicate,[h,m])}for(let[h,m]of p)l.has(m.predicate)||l.set(m.predicate,[h,m]);let d=new Map,f=new Map;for(let h=0;h<e.length;h++){let m=e[h],{predicate:b,target:_,author:v,timestamp:S}=m;if(_==="None"||_===void 0||_===null)continue;S!=null&&((a==null||S<a)&&(a=S,s=v??null),(o==null||S>o)&&(o=S));let y=u.get(b);if(y){d.get(y[0]),d.set(y[0],{target:_,timestamp:S});continue}let O=l.get(b);if(O){let[N]=O,T=f.get(N);T||(T=[],f.set(N,T)),T.push({target:_,timestamp:S??"",index:h})}}for(let[h,{target:m}]of d){let[,b]=u.get(t.properties[h].predicate),_=typeof r[h];r[h]=await hw(m,b,n,_!=="undefined"?_:void 0)}for(let[h,m]of f)m.sort((b,_)=>{let v=String(b.timestamp).localeCompare(String(_.timestamp));return v!==0?v:b.index-_.index}),r[h]=m.map(b=>b.target).filter(b=>b!=null&&b!==""&&b!=="None");s&&(r.author=s),a!=null&&(r.createdAt=typeof a=="string"&&a.includes("T")?new Date(a).getTime():typeof a=="string"?isNaN(parseInt(a,10))?a:parseInt(a,10):a),o!=null&&(r.updatedAt=typeof o=="string"&&o.includes("T")?new Date(o).getTime():typeof o=="string"?isNaN(parseInt(o,10))?o:parseInt(o,10):o)}async function mw(r,e,t){let n=Object.fromEntries(await Promise.all(t.map(async([a,o,s])=>{let c=o;if(!s&&typeof o=="string"){let p=Array.from(o,h=>h.codePointAt(0)),d=p.every(h=>h<=255),f=p.some(h=>h>=128);if(d&&f)try{let h=Uint8Array.from(p),m=new TextDecoder("utf-8",{fatal:!0}).decode(h);m!==o&&(c=m)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:h})}}if(s){let p=await r.getExpression(o);if(p)try{c=JSON.parse(p.data)}catch{c=p.data}}let l=Ln(e.constructor)[a]?.transform;return l&&typeof l=="function"&&(c=l(c)),[a,c]}))),i=Object.fromEntries(Object.entries(n).filter(([a])=>{let o=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(e),a);return o?o.get!==void 0||o.set!==void 0?o.set!==void 0:o.writable!==!1:!0}));Object.assign(e,i)}function gw(r,e){let t=th(r,e);if(!t){let n=e?.prototype?.className||e?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${n}".`);return}return t.getter}async function Md(r,e,t,n){let i=ye(r.id),o=n?.requestedProperties&&n.requestedProperties.length>0?new Set(n.requestedProperties):null;for(let[s,c]of Object.entries(t.properties))if(!(o&&!o.has(s))&&c.getter)try{let u=c.getter.replace(/Base/g,i),l=await e.querySurrealDB(`SELECT (${u}) AS value FROM node WHERE uri = ${i}`);l&&l.length>0&&l[0].value!==void 0&&l[0].value!==null&&l[0].value!=="None"&&l[0].value!==""&&(r[s]=l[0].value)}catch(u){console.warn(`Failed to evaluate getter for ${s}:`,u)}for(let[s,c]of Object.entries(t.relations)){if(o&&!o.has(s)&&!(n?.include&&s in n.include))continue;let u=c,l=u.getter;if(!l&&u.where&&u.direction!=="reverse")try{let p=u.target?.(),d=p?p.getModelMetadata?.()??null:null,f=eh(u.where,d);f.length>0&&(l=`(->link[WHERE predicate = '${ie(u.predicate)}'].out[WHERE ${f.join(" AND ")}].uri)`)}catch{}if(!l&&u.target&&u.filter!==!1&&u.direction!=="reverse")try{let p=u.target();l=gw(u.predicate,p),l||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${s}" (predicate: "${u.predicate}")`)}catch(p){console.warn(`[Ad4mModel] auto-generation failed for relation "${s}":`,p)}if(l)try{let d=`SELECT (${l.replace(/Base/g,i)}) AS value FROM node WHERE uri = ${i}`,f=await e.querySurrealDB(d);if(f&&f.length>0&&f[0].value!==void 0&&f[0].value!==null){let h=f[0].value;r[s]=Array.isArray(h)?h.filter(m=>m!=null&&m!==""&&m!=="None"):h}}catch(p){console.warn(`Failed to evaluate getter for ${s}:`,p)}}}async function La(r,e,t,n){if(!n||Object.keys(n).length===0)return;let i=er(r);for(let[a,o]of Object.entries(n)){let s=i[a];if(!s){console.warn(`include: relation "${a}" not found in metadata, skipping`);continue}let c=s.target(),u=typeof o=="object"&&o!==null?o:void 0,l=u?.include;if(s.kind==="belongsToOne"||s.kind==="belongsToMany"){for(let _ of e){let S=(await t.get(new fe({predicate:s.predicate,target:_.id}))).filter(y=>y.data.target===_.id).map(y=>y.data.source);if(s.kind==="belongsToOne"){if(S.length===0){_[a]=null;continue}let y=S[S.length-1];try{let O=new c(t,y);await O.get(),_[a]=O}catch{_[a]=null}}else{let y=[];if(u&&(u.where||u.order||u.properties)){let O={id:S,...u.where??{}};y=await c.findAll(t,{where:O,...u.order&&{order:u.order},...u.properties&&{properties:u.properties}})}else await Promise.all(S.map(async O=>{try{let N=new c(t,O);await N.get(u?.properties?{properties:u.properties}:void 0),y.push(N)}catch{}}));if(u?.order&&!(u.where||u.properties)){let O=Object.entries(u.order);y=y.sort((N,T)=>{for(let[C,$]of O){let P=String(N[C]??""),B=String(T[C]??""),xe=P.localeCompare(B);if(xe!==0)return $==="DESC"?-xe:xe}return 0})}if(u?.offset!=null||u?.limit!=null){let O=u.offset??0,N=u.limit!=null?O+u.limit:void 0;y=y.slice(O,N)}_[a]=y,l&&y.length>0&&await La(c,y,t,l)}}continue}let p=new Set,d=new Map;for(let _ of e){let v=_[a];if(d.set(_,Array.isArray(v)?[...v]:v),v!=null)if(Array.isArray(v))for(let S of v)typeof S=="string"?p.add(S):S&&typeof S=="object"&&typeof S.id=="string"&&p.add(S.id);else typeof v=="string"?p.add(v):v&&typeof v=="object"&&typeof v.id=="string"&&p.add(v.id)}if(p.size===0)continue;let f=new Map,m={where:{id:Array.from(p),...u?.where??{}},...u?.order&&{order:u.order},...u?.properties&&{properties:u.properties}},b=await c.findAll(t,m);for(let _ of b)f.set(_.id,_);for(let _ of e){let v=d.get(_);if(v!=null)if(Array.isArray(v)){let S=v.map(y=>typeof y=="string"?f.has(y)?f.get(y):null:y&&typeof y=="object"&&typeof y.id=="string"?f.has(y.id)?f.get(y.id):y:null).filter(y=>y!==null);if(u?.order){let y=Object.entries(u.order);S=S.sort((O,N)=>{for(let[T,C]of y){let $=String(O[T]??""),P=String(N[T]??""),B=$.localeCompare(P);if(B!==0)return C==="DESC"?-B:B}return 0})}if(u?.offset!=null||u?.limit!=null){let y=u.offset??0,O=u.limit!=null?y+u.limit:void 0;S=S.slice(y,O)}s.maxCount===1?(S.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${S.length} values found; keeping the last`),_[a]=S.length>0?S[S.length-1]:null):_[a]=S}else typeof v=="string"&&f.has(v)?_[a]=f.get(v):v&&typeof v=="object"&&typeof v.id=="string"&&(_[a]=f.has(v.id)?f.get(v.id):v)}if(l){let _=Array.from(f.values());await La(c,_,t,l)}}}var Ni=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===Ni)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 @Model");let t=e.className,n={},i=Ln(this);for(let[p,d]of Object.entries(i)){let f=d;n[p]={name:p,predicate:f.through||"",required:f.required||!1,readOnly:!(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=er(this),s=Object.fromEntries(Object.entries(o).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));for(let[p,d]of Object.entries(s)){let f=d;a[p]={name:p,predicate:f.predicate||"",...f.local!==void 0&&{local:f.local},...f.getter!==void 0&&{getter:f.getter},direction:f.kind==="belongsToMany"||f.kind==="belongsToOne"?"reverse":"forward",...f.target!==void 0&&{target:f.target},...f.filter!==void 0&&{filter:f.filter},...f.where!==void 0&&{where:f.where}}}let c=Object.keys(n).length>0,u=Object.keys(a).length>0;if(!(c||u)&&e.__jsonSchema){let p=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(p.properties)for(let[f,h]of Object.entries(p.properties)){let m=Bh(h),b=Qh(p,f,h,Vh(p,d),d);if(m)a[f]={name:f,predicate:b,...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}};else{let _=p.required?.includes(f)||!1;n[f]={name:f,predicate:b,required:_,readOnly:h["x-ad4m"]?.writable===!1,...h["x-ad4m"]?.resolveLanguage&&{resolveLanguage:h["x-ad4m"].resolveLanguage},...h["x-ad4m"]?.initial&&{initial:h["x-ad4m"].initial},...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}}}}}return{className:t,properties:n,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||Se.from(Xd(24)).toUrl(),this._perspective=e}get id(){return this._baseExpression}get baseExpression(){return this._baseExpression}get perspective(){return this._perspective}getPropertyMetadata(e){let t=this.constructor;return Ln(t)[e]}getRelationOptions(e){let t=this.constructor;return er(t)[e]}generatePropertySetterAction(e,t){if(t.flag)throw new Error(`Property "${e}" is a @Flag and cannot be written. Flags are immutable type markers set at creation time.`);if(t.readOnly)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}}]}generateRelationAction(e,t){let n=this.getRelationOptions(e);if(!n)throw new Error(`Relation "${e}" has no metadata defined`);if(!n.predicate)throw new Error(`Relation "${e}" has no predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:n.predicate,target:"value",...n.local&&{local:!0}}]}static async assignValuesToInstance(e,t,n){return mw(e,t,n)}takeSnapshot(e){let n=this.constructor.getModelMetadata(),i={};for(let a of Object.keys(n.properties)){let o=this[a];i[a]=rs(Array.isArray(o)?[...o]:o)}if(e===void 0)for(let a of Object.keys(n.relations)){let o=this[a];i[a]=rs(Array.isArray(o)?[...o]:o)}else if(e&&Object.keys(e).length>0){for(let a of Object.keys(e))if(a in n.relations){let o=this[a];i[a]=rs(Array.isArray(o)?[...o]:o)}}this._snapshot=i}isDirty(){return this._snapshot?this.changedFields().length>0:!0}changedFields(){let t=this.constructor.getModelMetadata();if(!this._snapshot)return[...Object.keys(t.properties),...Object.keys(t.relations)];let n=[],i=[...Object.keys(t.properties),...Object.keys(t.relations)];for(let a of i){if(!(a in this._snapshot))continue;let o=rs(this[a]),s=this._snapshot[a];if(Array.isArray(o)||Array.isArray(s)){let c=Array.isArray(o)?[...o].sort():[],u=Array.isArray(s)?[...s].sort():[];(c.length!==u.length||c.some((l,p)=>l!==u[p]))&&n.push(a)}else o!==s&&n.push(a)}return n}async getData(e){try{let t=this.constructor,n=t.getModelMetadata(),a=`
994
1018
  SELECT id, predicate, out.uri AS target, author, timestamp
995
1019
  FROM link
996
- WHERE in.uri = ${ge(this._baseExpression)}
1020
+ WHERE in.uri = ${ye(this._baseExpression)}
997
1021
  ORDER BY timestamp ASC
998
- `,o=await this._perspective.querySurrealDB(a);if(o&&o.length>0){let l=e?.properties&&e.properties.length>0?e.properties:void 0;await Fd(this,o,n,this._perspective,l)}let s=Yt(t),c=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[l,p]of Object.entries(s)){if(p.kind!=="belongsToOne"&&p.kind!=="belongsToMany"||c&&!c.has(l))continue;let f=(await this._perspective.get(new fe({predicate:p.predicate,target:this._baseExpression}))).filter(h=>h.data.target===this._baseExpression).map(h=>h.data.source);p.kind==="belongsToOne"?this[l]=f.length>0?f[f.length-1]:null:this[l]=f}let u=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await Md(this,this._perspective,n,u),e?.include&&await Pa(t,[this],this._perspective,e.include)}catch(t){console.error(`SurrealDB getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,n){let{properties:i,where:a,order:o,offset:s,limit:c,count:u}=t,l=n||await this.getClassName(e),p=t.parent?Oa(t.parent,this):void 0,d=[Ad(),Td(t.parent,p),ow(i),Od(a)],f=[Dd(u),Nd(o),Rd(s),Cd(c)];return`
1022
+ `,o=await this._perspective.querySurrealDB(a);if(o&&o.length>0){let l=e?.properties&&e.properties.length>0?e.properties:void 0;await Fd(this,o,n,this._perspective,l)}let s=er(t),c=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[l,p]of Object.entries(s)){if(p.kind!=="belongsToOne"&&p.kind!=="belongsToMany"||c&&!c.has(l))continue;let f=(await this._perspective.get(new fe({predicate:p.predicate,target:this._baseExpression}))).filter(h=>h.data.target===this._baseExpression).map(h=>h.data.source);p.kind==="belongsToOne"?this[l]=f.length>0?f[f.length-1]:null:this[l]=f}let u=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await Md(this,this._perspective,n,u),e?.include&&await La(t,[this],this._perspective,e.include)}catch(t){console.error(`SurrealDB getData also failed for ${this._baseExpression}:`,t)}return this.takeSnapshot(),this}static async queryToProlog(e,t,n){let{properties:i,where:a,order:o,offset:s,limit:c,count:u}=t,l=n||await this.getClassName(e),p=t.parent?Da(t.parent,this):void 0,d=[Ad(),Td(t.parent,p),cw(i),Od(a)],f=[Dd(u),Nd(o),Rd(s),Cd(c)];return`
999
1023
  findall([Base, Properties, Collections, Timestamp, Author], (
1000
1024
  subject_class("${l}", SubjectClass),
1001
1025
  instance(SubjectClass, Base),
1002
1026
  ${d.filter(m=>m).join(", ")}
1003
1027
  ), UnsortedInstances),
1004
1028
  ${f.filter(m=>m).join(", ")}
1005
- `}static async queryToSurrealQL(e,t){let n=this.getModelMetadata(),i=Yt(this);return fw(n,i,t,this)}static async instancesFromPrologResult(e,t,n){if(!n?.[0]?.AllInstances)return{results:[],totalCount:0};let i=t?.properties||[],o=(await Promise.all(n[0].AllInstances.map(async([c,u,l,p,d])=>{try{let f=new this(e,c);i.length&&Object.keys(f).forEach(m=>{!i.includes(m)&&m!=="createdAt"&&m!=="updatedAt"&&m!=="author"&&m!=="id"&&m!=="baseExpression"&&delete f[m]});let h=[...u,...l,["createdAt",p],["author",d]];return await Ai.assignValuesToInstance(e,f,h),f}catch(f){return console.error(`Failed to process instance ${c}:`,f),null}}))).filter(c=>c!==null);t.include&&o.length>0&&await Pa(this,o,e,t.include);let s=t.include;for(let c of o)c.takeSnapshot(s);return{results:o,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=[];for(let m of n){let v;try{if(v=m.source_uri,!v)continue;let _=m.links||[],y=new this(e,v);if(await Fd(y,_,i,e,a.length>0?a:void 0),a.length>0){let b=new Set(a);for(let g of Object.keys(i.properties))b.has(g)||delete y[g];for(let g of Object.keys(i.relations))!b.has(g)&&!(t.include&&g in t.include)&&delete y[g];for(let g of["author","createdAt","updatedAt"])b.has(g)||delete y[g]}o.push(y)}catch(_){console.error(`Failed to process SurrealDB instance ${v}:`,_)}}let s=Yt(this),c=Object.entries(s).filter(([m,v])=>(v.kind==="belongsToOne"||v.kind==="belongsToMany")&&(a.length===0||a.includes(m)));c.length>0&&o.length>0&&await Promise.all(o.map(async m=>{for(let[v,_]of c){let b=(await e.get(new fe({predicate:_.predicate,target:m.id}))).filter(g=>g.data.target===m.id).map(g=>g.data.source);_.kind==="belongsToOne"?m[v]=b.length>0?b[b.length-1]:null:m[v]=b}}));let u=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let m of o)await Md(m,e,i,u);let l=o;t.where&&(l=o.filter(m=>{for(let[v,_]of Object.entries(t.where))if(v!=="base"){if(v==="author"||v==="timestamp"){if(!$d(m[v],_))return!1;continue}if(typeof _=="object"&&_!==null&&!Array.isArray(_)){let y=_;if((y.gt!==void 0||y.gte!==void 0||y.lt!==void 0||y.lte!==void 0||y.between!==void 0||y.contains!==void 0)&&!$d(m[v],_))return!1}}return!0}));let p=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(p){let m=Object.entries(p);l.sort((v,_)=>{for(let[y,b]of m){let g=v[y],A=_[y];if(g===void 0&&A===void 0)continue;if(g===void 0)return b==="ASC"?1:-1;if(A===void 0)return b==="ASC"?-1:1;let N=0;if(typeof g=="number"&&typeof A=="number"?N=g-A:typeof g=="string"&&typeof A=="string"?N=g.localeCompare(A):N=String(g).localeCompare(String(A)),N!==0)return b==="DESC"?-N:N}return 0})}let d=l.length,f=l;if(t.offset!==void 0||t.limit!==void 0){let m=t.offset||0,v=t.limit?m+t.limit:void 0;f=l.slice(m,v)}t.include&&f.length>0&&await Pa(this,f,e,t.include);let h=t.include;for(let m of f)m.takeSnapshot(h);return{results:f,totalCount:d}}static async findAll(e,t={},n=!0){if(t.properties&&t.properties.length===0)throw new Error("properties[] must not be empty \u2014 omit the field to return all properties, or specify at least one field name");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 findOne(e,t={},n=!0){let i={...t,limit:1};return(await this.findAll(e,i,n))[0]??null}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{where:i}=t,a=n||await this.getClassName(e),o=t.parent?Oa(t.parent,this):void 0,s=[Ad(),Td(t.parent,o),Od(i)],c=[Dd(!0),Nd(),Rd(),Cd()];return`
1029
+ `}static async queryToSurrealQL(e,t){let n=this.getModelMetadata(),i=er(this);return dw(n,i,t,this)}static async instancesFromPrologResult(e,t,n){if(!n?.[0]?.AllInstances)return{results:[],totalCount:0};let i=t?.properties||[],o=(await Promise.all(n[0].AllInstances.map(async([c,u,l,p,d])=>{try{let f=new this(e,c);i.length&&Object.keys(f).forEach(m=>{!i.includes(m)&&m!=="createdAt"&&m!=="updatedAt"&&m!=="author"&&m!=="id"&&m!=="baseExpression"&&delete f[m]});let h=[...u,...l,["createdAt",p],["author",d]];return await Ni.assignValuesToInstance(e,f,h),f}catch(f){return console.error(`Failed to process instance ${c}:`,f),null}}))).filter(c=>c!==null);t.include&&o.length>0&&await La(this,o,e,t.include);let s=t.include;for(let c of o)c.takeSnapshot(s);return{results:o,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=[];for(let m of n){let b;try{if(b=m.source_uri,!b)continue;let _=m.links||[],v=new this(e,b);if(await Fd(v,_,i,e,a.length>0?a:void 0),a.length>0){let S=new Set(a);for(let y of Object.keys(i.properties))S.has(y)||delete v[y];for(let y of Object.keys(i.relations))!S.has(y)&&!(t.include&&y in t.include)&&delete v[y];for(let y of["author","createdAt","updatedAt"])S.has(y)||delete v[y]}o.push(v)}catch(_){console.error(`Failed to process SurrealDB instance ${b}:`,_)}}let s=er(this),c=Object.entries(s).filter(([m,b])=>(b.kind==="belongsToOne"||b.kind==="belongsToMany")&&(a.length===0||a.includes(m)));c.length>0&&o.length>0&&await Promise.all(o.map(async m=>{for(let[b,_]of c){let S=(await e.get(new fe({predicate:_.predicate,target:m.id}))).filter(y=>y.data.target===m.id).map(y=>y.data.source);_.kind==="belongsToOne"?m[b]=S.length>0?S[S.length-1]:null:m[b]=S}}));let u=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let m of o)await Md(m,e,i,u);let l=o;t.where&&(l=o.filter(m=>{for(let[b,_]of Object.entries(t.where))if(b!=="base"){if(b==="author"||b==="timestamp"){if(!$d(m[b],_))return!1;continue}if(typeof _=="object"&&_!==null&&!Array.isArray(_)){let v=_;if((v.gt!==void 0||v.gte!==void 0||v.lt!==void 0||v.lte!==void 0||v.between!==void 0||v.contains!==void 0)&&!$d(m[b],_))return!1}}return!0}));let p=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(p){let m=Object.entries(p);l.sort((b,_)=>{for(let[v,S]of m){let y=b[v],O=_[v];if(y===void 0&&O===void 0)continue;if(y===void 0)return S==="ASC"?1:-1;if(O===void 0)return S==="ASC"?-1:1;let N=0;if(typeof y=="number"&&typeof O=="number"?N=y-O:typeof y=="string"&&typeof O=="string"?N=y.localeCompare(O):N=String(y).localeCompare(String(O)),N!==0)return S==="DESC"?-N:N}return 0})}let d=l.length,f=l;if(t.offset!==void 0||t.limit!==void 0){let m=t.offset||0,b=t.limit?m+t.limit:void 0;f=l.slice(m,b)}t.include&&f.length>0&&await La(this,f,e,t.include);let h=t.include;for(let m of f)m.takeSnapshot(h);return{results:f,totalCount:d}}static async findAll(e,t={},n=!0){if(t.properties&&t.properties.length===0)throw new Error("properties[] must not be empty \u2014 omit the field to return all properties, or specify at least one field name");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 findOne(e,t={},n=!0){let i={...t,limit:1};return(await this.findAll(e,i,n))[0]??null}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{where:i}=t,a=n||await this.getClassName(e),o=t.parent?Da(t.parent,this):void 0,s=[Ad(),Td(t.parent,o),Od(i)],c=[Dd(!0),Nd(),Rd(),Cd()];return`
1006
1030
  findall([Base, Properties, Collections, Timestamp, Author], (
1007
1031
  subject_class("${a}", SubjectClass),
1008
1032
  instance(SubjectClass, Base),
1009
1033
  ${s.filter(l=>l).join(", ")}
1010
1034
  ), UnsortedInstances),
1011
1035
  ${c.filter(l=>l).join(", ")}
1012
- `}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 this._perspective.createExpression(t,o)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],n))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,n){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"setter");t!=null&&(Array.isArray(t)?await this._perspective.executeAction(a,this._baseExpression,t.map(o=>({name:"value",value:this.resolveRelationId(o)})),n):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async addRelationValue(e,t,n){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],n))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async removeRelationValue(e,t,n){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],n))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async save(e){if(this._snapshot){await this.innerUpdate(!0,e),e?this.takeSnapshot():await this.getData();return}let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let n=this.constructor.getModelMetadata(),i=Object.values(n.properties).some(o=>o.required||o.flag||o.initial!==void 0),a=[];if(i){let o={};for(let[c,u]of Object.entries(this))if(u!=null&&!(Array.isArray(u)&&u.length>0)&&!u?.action){let l=n.properties[c];if(l?.resolveLanguage&&l.resolveLanguage!=="literal"&&typeof u=="object"){a.push(c);continue}o[c]=u}let s=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(s,this._baseExpression,o,e)}await this.innerUpdate(!i,e);for(let o of a){let s=this[o];s!=null&&await this.setProperty(o,s,e)}t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),n={},i=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of i){let o=this[a];o!=null&&a!=="author"&&a!=="timestamp"&&(n[a]=o)}return n}async innerUpdate(e=!0,t){let n=this.constructor,i=this._snapshot?new Set(this.changedFields()):null,a=n.getModelMetadata(),o=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),s=Object.entries(this);for(let[c,u]of s){if(!o.has(c)||i&&!i.has(c))continue;let l=a.relations[c];if(!(l&&(l.getter||l.target&&l.filter!==!1&&Object.entries(a.relations).some(([d,f])=>d!==c&&f.predicate===l.predicate)))&&u!=null){if(u?.action)switch(u.action){case"setter":await this.setRelationValues(c,u.value,t);break;case"adder":await this.addRelationValue(c,u.value,t);break;case"remover":await this.removeRelationValue(c,u.value,t);break;default:await this.setRelationValues(c,u.value,t);break}else if(Array.isArray(u))await this.setRelationValues(c,u,t);else if(u!=null&&u!==""&&e){if(this.getRelationOptions(c)||this.getPropertyMetadata(c)?.flag)continue;await this.setProperty(c,u,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(i=>i.required||i.flag||i.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let i=new Set;for(let s of Object.values(t.properties))s.predicate&&i.add(s.predicate);for(let s of Object.values(t.relations))s.predicate&&i.add(s.predicate);let o=(await this._perspective.get(new fe({source:this._baseExpression}))).filter(s=>s.data.predicate&&i.has(s.data.predicate));o.length>0&&await this._perspective.removeLinks(o,e)}catch(i){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,i)}try{let i=await this._perspective.get(new fe({target:this._baseExpression}));i.length>0&&await this._perspective.removeLinks(i,e)}catch(i){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,i)}}static async create(e,t={},n){let i=new this(e);if(Object.assign(i,t),n?.parent&&!n?.batchId){let a=await e.createBatch();await i.save(a);let o=Oa(n.parent,this),s=new ht({source:n.parent.id,predicate:o,target:i.id});return await e.add(s,"shared",a),await e.commitBatch(a),await i.get(),i}if(await i.save(n?.batchId),n?.parent){let a=Oa(n.parent,this),o=new ht({source:n.parent.id,predicate:a,target:i.id});await e.add(o,"shared",n?.batchId)}return i}static async update(e,t,n){let i=new this(e,t);return await i.get(),Object.assign(i,n),await i.save(),i}static async remove(e,t){return this.delete(e,t)}static async delete(e,t){await new this(e,t).delete()}static async register(e){await e.ensureSDNASubjectClass(this)}static async transaction(e,t){let n=await e.createBatch(),i=await t({batchId:n});return await e.commitBatch(n),i}static query(e,t){return new tl(e,this,t)}static fromJSONSchema(e,t){return uw(this,e,t)}};Ai.classNamesByClass=new WeakMap;function gl(r){return r.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function mw(r,e){let t=e.properties,n=Object.values(t).filter(o=>o.flag&&o.predicate&&o.initial);if(n.length>0){let o=n.map(s=>`triple(X, '${s.predicate}', '${s.initial}')`).join(`,
1036
+ `}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 this._perspective.createExpression(t,o)),await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:t}],n))}resolveRelationId(e){return typeof e=="string"?e:e&&typeof e=="object"&&typeof e.id=="string"?e.id:String(e)}async setRelationValues(e,t,n){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"setter");t!=null&&(Array.isArray(t)?await this._perspective.executeAction(a,this._baseExpression,t.map(o=>({name:"value",value:this.resolveRelationId(o)})),n):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async addRelationValue(e,t,n){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"adder");t!=null&&(Array.isArray(t)?await Promise.all(t.map(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],n))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async removeRelationValue(e,t,n){if(!this.getRelationOptions(e)){console.warn(`Relation "${e}" has no metadata, skipping`);return}let a=this.generateRelationAction(e,"remover");t!=null&&(Array.isArray(t)?await Promise.all(t.map(o=>this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(o)}],n))):await this._perspective.executeAction(a,this._baseExpression,[{name:"value",value:this.resolveRelationId(t)}],n))}async save(e){if(this._snapshot){await this.innerUpdate(!0,e),e?this.takeSnapshot():await this.getData();return}let t=!1;e||(e=await this.perspective.createBatch(),t=!0);let n=this.constructor.getModelMetadata(),i=Object.values(n.properties).some(o=>o.required||o.flag||o.initial!==void 0),a=[];if(i){let o={};for(let[c,u]of Object.entries(this))if(u!=null&&!(Array.isArray(u)&&u.length>0)&&!u?.action){let l=n.properties[c];if(l?.resolveLanguage&&l.resolveLanguage!=="literal"&&typeof u=="object"){a.push(c);continue}o[c]=u}let s=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(s,this._baseExpression,o,e)}await this.innerUpdate(!i,e);for(let o of a){let s=this[o];s!=null&&await this.setProperty(o,s,e)}t?(await this.perspective.commitBatch(e),await this.getData()):this.takeSnapshot()}cleanCopy(){let t=this.constructor.getModelMetadata(),n={},i=new Set([...Object.keys(t.properties),...Object.keys(t.relations)]);for(let a of i){let o=this[a];o!=null&&a!=="author"&&a!=="timestamp"&&(n[a]=o)}return n}async innerUpdate(e=!0,t){let n=this.constructor,i=this._snapshot?new Set(this.changedFields()):null,a=n.getModelMetadata(),o=new Set([...Object.keys(a.properties),...Object.keys(a.relations)]),s=Object.entries(this);for(let[c,u]of s){if(!o.has(c)||i&&!i.has(c))continue;let l=a.relations[c];if(!(l&&(l.getter||l.target&&l.filter!==!1&&Object.entries(a.relations).some(([d,f])=>d!==c&&f.predicate===l.predicate)))&&u!=null){if(u?.action)switch(u.action){case"setter":await this.setRelationValues(c,u.value,t);break;case"adder":await this.addRelationValue(c,u.value,t);break;case"remover":await this.removeRelationValue(c,u.value,t);break;default:await this.setRelationValues(c,u.value,t);break}else if(Array.isArray(u))await this.setRelationValues(c,u,t);else if(u!=null&&u!==""&&e){if(this.getRelationOptions(c)||this.getPropertyMetadata(c)?.flag)continue;await this.setProperty(c,u,t)}}}}async get(e){let t;return e?"include"in e||"properties"in e?t=e:t={include:e}:t=void 0,await this.getData(t)}async delete(e){let t=this.constructor.getModelMetadata();if(Object.values(t.properties).some(i=>i.required||i.flag||i.initial!==void 0))await this._perspective.removeSubject(this,this._baseExpression,e);else try{let i=new Set;for(let s of Object.values(t.properties))s.predicate&&i.add(s.predicate);for(let s of Object.values(t.relations))s.predicate&&i.add(s.predicate);let o=(await this._perspective.get(new fe({source:this._baseExpression}))).filter(s=>s.data.predicate&&i.has(s.data.predicate));o.length>0&&await this._perspective.removeLinks(o,e)}catch(i){console.warn(`delete(): failed to remove outgoing links for ${this._baseExpression}:`,i)}try{let i=await this._perspective.get(new fe({target:this._baseExpression}));i.length>0&&await this._perspective.removeLinks(i,e)}catch(i){console.warn(`delete(): failed to clean up incoming links for ${this._baseExpression}:`,i)}}static async create(e,t={},n){let i=new this(e);if(Object.assign(i,t),n?.parent&&!n?.batchId){let a=await e.createBatch();await i.save(a);let o=Da(n.parent,this),s=new mt({source:n.parent.id,predicate:o,target:i.id});return await e.add(s,"shared",a),await e.commitBatch(a),await i.get(),i}if(await i.save(n?.batchId),n?.parent){let a=Da(n.parent,this),o=new mt({source:n.parent.id,predicate:a,target:i.id});await e.add(o,"shared",n?.batchId)}return i}static async update(e,t,n){let i=new this(e,t);return await i.get(),Object.assign(i,n),await i.save(),i}static async remove(e,t){return this.delete(e,t)}static async delete(e,t){await new this(e,t).delete()}static async register(e){await e.ensureSDNASubjectClass(this)}static async transaction(e,t){let n=await e.createBatch(),i=await t({batchId:n});return await e.commitBatch(n),i}static query(e,t){return new tl(e,this,t)}static fromJSONSchema(e,t){return fw(this,e,t)}};Ni.classNamesByClass=new WeakMap;function gl(r){return r.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function yw(r,e){let t=e.properties,n=Object.values(t).filter(o=>o.flag&&o.predicate&&o.initial);if(n.length>0){let o=n.map(s=>`triple(X, '${s.predicate}', '${s.initial}')`).join(`,
1013
1037
  `);return`${r}(X) :-
1014
1038
  ${o}.`}let i=Object.values(t).filter(o=>o.required&&o.predicate&&!o.flag);if(i.length>0){let o=i.map(s=>`triple(X, '${s.predicate}', _)`).join(`,
1015
1039
  `);return`${r}(X) :-
1016
1040
  ${o}.`}let a=Object.values(t).filter(o=>o.predicate).map(o=>o.predicate);if(e.relations)for(let o of Object.values(e.relations))o.predicate&&a.push(o.predicate);if(a.length>0){let o=a.map(s=>`triple(X, '${s}', _)`).join(` ;
1017
1041
  `);return`${r}(X) :-
1018
- (${o}).`}return null}function gw(r,e){return e.flag||!e.predicate?null:`${`${r}_${gl(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function yw(r,e){if(!e.predicate)return null;let t=`${r}_${gl(e.name)}`;return e.direction==="reverse"?`${t}(X, Values) :- findall(V, triple(V, '${e.predicate}', X), Values).`:`${t}(X, Values) :- findall(V, triple(X, '${e.predicate}', V), Values).`}function sA(r){let e=r.getModelMetadata(),t=gl(e.className),n=[];n.push(`% ${e.className} \u2014 generated Prolog facts`);let i=mw(t,e);i&&(n.push(""),n.push("% Instance recognizer"),n.push(i));let a=Object.values(e.properties).map(s=>gw(t,s)).filter(s=>s!==null);a.length>0&&(n.push(""),n.push("% Field getters"),n.push(...a));let o=Object.values(e.relations).map(s=>yw(t,s)).filter(s=>s!==null);return o.length>0&&(n.push(""),n.push("% Relation getters"),n.push(...o)),n.join(`
1019
- `)}var cA=`
1042
+ (${o}).`}return null}function vw(r,e){return e.flag||!e.predicate?null:`${`${r}_${gl(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function bw(r,e){if(!e.predicate)return null;let t=`${r}_${gl(e.name)}`;return e.direction==="reverse"?`${t}(X, Values) :- findall(V, triple(V, '${e.predicate}', X), Values).`:`${t}(X, Values) :- findall(V, triple(X, '${e.predicate}', V), Values).`}function fA(r){let e=r.getModelMetadata(),t=gl(e.className),n=[];n.push(`% ${e.className} \u2014 generated Prolog facts`);let i=yw(t,e);i&&(n.push(""),n.push("% Instance recognizer"),n.push(i));let a=Object.values(e.properties).map(s=>vw(t,s)).filter(s=>s!==null);a.length>0&&(n.push(""),n.push("% Field getters"),n.push(...a));let o=Object.values(e.relations).map(s=>bw(t,s)).filter(s=>s!==null);return o.length>0&&(n.push(""),n.push("% Relation getters"),n.push(...o)),n.join(`
1043
+ `)}var pA=`
1020
1044
  type AIModelLoadingStatus {
1021
1045
  downloaded: Boolean!
1022
1046
  loaded: Boolean!
@@ -1159,6 +1183,7 @@ type ExpressionRendered {
1159
1183
 
1160
1184
  type HostingUserInfo {
1161
1185
  email: String!
1186
+ freeAccess: Boolean!
1162
1187
  hotWalletAddress: String
1163
1188
  remainingCredits: String!
1164
1189
  }
@@ -1393,6 +1418,7 @@ type Mutation {
1393
1418
  runtimeLoginUser(email: String!, password: String!): String!
1394
1419
  runtimeOpenLink(url: String!): Boolean!
1395
1420
  runtimeQuit: Boolean!
1421
+ runtimeReinstallUnytDna: PaymentRequestResult!
1396
1422
  runtimeRemoveFriends(dids: [String!]!): [String!]!
1397
1423
  runtimeRemoveKnownLinkLanguageTemplates(addresses: [String!]!): [String!]!
1398
1424
  runtimeRemoveNotification(id: String!): Boolean!
@@ -1400,9 +1426,13 @@ type Mutation {
1400
1426
  runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
1401
1427
  runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
1402
1428
  runtimeRestartHolochain: Boolean!
1429
+ runtimeSendHot(amount: String!, recipient: String!): PaymentRequestResult!
1403
1430
  runtimeSetHotWalletAddress(address: String!): Boolean!
1404
1431
  runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
1405
1432
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
1433
+ runtimeSetUnytMembraneProof(proof: String!): PaymentRequestResult!
1434
+ runtimeSetUserCredits(amount: Float!, email: String!): Boolean!
1435
+ runtimeSetUserFreeAccess(email: String!, enabled: Boolean!): Boolean!
1406
1436
  runtimeTestEmail(to: String!): Boolean!
1407
1437
  runtimeUpdateNotification(id: String!, notification: NotificationInput!): Boolean!
1408
1438
  runtimeVerifyEmailCode(code: String!, email: String!, verificationType: String!): String!
@@ -1516,6 +1546,9 @@ type Query {
1516
1546
  runtimeGetNetworkMetrics: String!
1517
1547
  runtimeHcAgentInfos: String!
1518
1548
  runtimeHostingUserInfo: HostingUserInfo!
1549
+ runtimeHotAgentPubkey: String!
1550
+ runtimeHotWalletBalance: String!
1551
+ runtimeHotWalletHistory(page: Float, perPage: Float): String!
1519
1552
  runtimeInfo: RuntimeInfo!
1520
1553
  runtimeKnownLinkLanguageTemplates: [String!]!
1521
1554
  runtimeListUsers: [UserStatistics!]!
@@ -1523,6 +1556,7 @@ type Query {
1523
1556
  runtimeMessageOutbox(filter: String): [SentMessage!]!
1524
1557
  runtimeMultiUserEnabled: Boolean!
1525
1558
  runtimeNotifications: [Notification!]!
1559
+ runtimeUnytVersionInfo: String!
1526
1560
  runtimeVerifyStringSignedByDid(data: String!, did: String!, didSigningKeyId: String!, signedData: String!): Boolean!
1527
1561
  }
1528
1562
 
@@ -1598,8 +1632,11 @@ type UserCreationResult {
1598
1632
  type UserStatistics {
1599
1633
  did: String!
1600
1634
  email: String!
1635
+ freeAccess: Boolean!
1636
+ hotWalletAddress: String
1601
1637
  lastSeen: String
1602
1638
  perspectiveCount: Int!
1639
+ remainingCredits: String!
1603
1640
  }
1604
1641
 
1605
1642
  type VerificationRequestResult {
@@ -1616,5 +1653,5 @@ input VoiceActivityParamsInput {
1616
1653
  startWindow: Float
1617
1654
  timeBeforeSpeech: Float
1618
1655
  }
1619
- `,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},w=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},G=function(r,e){return function(t,n){e(t,n,r)}},to=new Wr;to.author="did:ad4m:test";to.timestamp=Date.now();to.data={source:"root",target:"neighbourhood://Qm12345"};to.proof={signature:"",key:"",valid:!0};var Ur=new Dn;Ur.author="did:ad4m:test";Ur.timestamp=Date.now().toString();Ur.proof=new Sr("","");Ur.data=new ar([to]);var qs=class{};D([S(),w("design:type",String)],qs.prototype,"recipient",void 0);D([S(),w("design:type",Dn)],qs.prototype,"message",void 0);qs=D([Q()],qs);var Oi=class{};D([S(),w("design:type",String)],Oi.prototype,"ad4mExecutorVersion",void 0);D([S(),w("design:type",Boolean)],Oi.prototype,"isInitialized",void 0);D([S(),w("design:type",Boolean)],Oi.prototype,"isUnlocked",void 0);Oi=D([Q()],Oi);var Fn=class{};D([S(),w("design:type",String)],Fn.prototype,"title",void 0);D([S(),w("design:type",String)],Fn.prototype,"message",void 0);D([S(),w("design:type",String)],Fn.prototype,"type",void 0);D([S(),w("design:type",String)],Fn.prototype,"addon",void 0);Fn=D([Q()],Fn);var Pt=class{};D([S(),w("design:type",String)],Pt.prototype,"description",void 0);D([S(),w("design:type",String)],Pt.prototype,"appName",void 0);D([S(),w("design:type",String)],Pt.prototype,"appUrl",void 0);D([S(),w("design:type",String)],Pt.prototype,"appIconPath",void 0);D([S(),w("design:type",String)],Pt.prototype,"trigger",void 0);D([S(),w("design:type",Array)],Pt.prototype,"perspectiveIds",void 0);D([S(),w("design:type",String)],Pt.prototype,"webhookUrl",void 0);D([S(),w("design:type",String)],Pt.prototype,"webhookAuth",void 0);Pt=D([ze()],Pt);var Et=class{};D([S(),w("design:type",String)],Et.prototype,"id",void 0);D([S(),w("design:type",Boolean)],Et.prototype,"granted",void 0);D([S(),w("design:type",String)],Et.prototype,"description",void 0);D([S(),w("design:type",String)],Et.prototype,"appName",void 0);D([S(),w("design:type",String)],Et.prototype,"appUrl",void 0);D([S(),w("design:type",String)],Et.prototype,"appIconPath",void 0);D([S(),w("design:type",String)],Et.prototype,"trigger",void 0);D([S(),w("design:type",Array)],Et.prototype,"perspectiveIds",void 0);D([S(),w("design:type",String)],Et.prototype,"webhookUrl",void 0);D([S(),w("design:type",String)],Et.prototype,"webhookAuth",void 0);Et=D([Q()],Et);var Di=class{};D([S(),w("design:type",Et)],Di.prototype,"notification",void 0);D([S(),w("design:type",String)],Di.prototype,"perspectiveId",void 0);D([S(),w("design:type",String)],Di.prototype,"triggerMatch",void 0);Di=D([Q()],Di);var Qe=class{};D([S(),w("design:type",Number)],Qe.prototype,"total",void 0);D([S(),w("design:type",Number)],Qe.prototype,"imported",void 0);D([S(),w("design:type",Number)],Qe.prototype,"failed",void 0);D([S(),w("design:type",Number)],Qe.prototype,"omitted",void 0);D([S(),w("design:type",Array)],Qe.prototype,"errors",void 0);Qe=D([Q()],Qe);var xt=class{};D([S(),w("design:type",Qe)],xt.prototype,"perspectives",void 0);D([S(),w("design:type",Qe)],xt.prototype,"links",void 0);D([S(),w("design:type",Qe)],xt.prototype,"expressions",void 0);D([S(),w("design:type",Qe)],xt.prototype,"perspectiveDiffs",void 0);D([S(),w("design:type",Qe)],xt.prototype,"notifications",void 0);D([S(),w("design:type",Qe)],xt.prototype,"models",void 0);D([S(),w("design:type",Qe)],xt.prototype,"defaultModels",void 0);D([S(),w("design:type",Qe)],xt.prototype,"tasks",void 0);D([S(),w("design:type",Qe)],xt.prototype,"friends",void 0);D([S(),w("design:type",Qe)],xt.prototype,"trustedAgents",void 0);D([S(),w("design:type",Qe)],xt.prototype,"knownLinkLanguages",void 0);xt=D([Q()],xt);var Ni=class{};D([S(),w("design:type",String)],Ni.prototype,"email",void 0);D([S(),w("design:type",String)],Ni.prototype,"did",void 0);D([S(),w("design:type",String)],Ni.prototype,"lastSeen",void 0);D([S(),w("design:type",Number)],Ni.prototype,"perspectiveCount",void 0);Ni=D([Q()],Ni);var Mn=class{};D([S(),w("design:type",Boolean)],Mn.prototype,"success",void 0);D([S(),w("design:type",String)],Mn.prototype,"message",void 0);D([S(),w("design:type",Boolean)],Mn.prototype,"requiresPassword",void 0);D([S(),w("design:type",Boolean)],Mn.prototype,"isExistingUser",void 0);Mn=D([Q()],Mn);var jn=class{constructor(e,t,n){this.email=e,this.remainingCredits=t,this.hotWalletAddress=n}};D([S(),w("design:type",String)],jn.prototype,"email",void 0);D([S(),w("design:type",String)],jn.prototype,"remainingCredits",void 0);D([S(),w("design:type",String)],jn.prototype,"hotWalletAddress",void 0);jn=D([Q(),w("design:paramtypes",[String,String,String])],jn);var Ri=class{constructor(e,t){this.success=e,this.message=t}};D([S(),w("design:type",Boolean)],Ri.prototype,"success",void 0);D([S(),w("design:type",String)],Ri.prototype,"message",void 0);Ri=D([Q(),w("design:paramtypes",[Boolean,String])],Ri);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 Ur}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Ur]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Ur}]}runtimeMessageReceived(){return Ur}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Yu.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 Nn("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}runtimeHostingUserInfo(){return new jn("test@example.com","100000000",null)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new Ri(!0,"Mock payment of "+e+" base units credited")}};D([ue(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],q.prototype,"runtimeQuit",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],q.prototype,"runtimeOpenLink",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Oi)],q.prototype,"runtimeInfo",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],q.prototype,"addTrustedAgents",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],q.prototype,"deleteTrustedAgents",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],q.prototype,"getTrustedAgents",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],q.prototype,"runtimeKnownLinkLanguageTemplates",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],q.prototype,"runtimeAddKnownLinkLanguageTemplates",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],q.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],q.prototype,"runtimeFriends",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],q.prototype,"runtimeAddFriends",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Array]),w("design:returntype",Array)],q.prototype,"runtimeRemoveFriends",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",String)],q.prototype,"runtimeHcAgentInfos",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",String)],q.prototype,"runtimeGetNetworkMetrics",null);D([ue(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],q.prototype,"runtimeRestartHolochain",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Object]),w("design:returntype",Boolean)],q.prototype,"runtimeHcAddAgentInfos",null);D([gt(),G(0,W()),G(1,W()),G(2,W()),G(3,W()),w("design:type",Function),w("design:paramtypes",[String,String,String,String]),w("design:returntype",void 0)],q.prototype,"runtimeVerifyStringSignedByDid",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[ar]),w("design:returntype",Boolean)],q.prototype,"runtimeSetStatus",null);D([gt(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Dn)],q.prototype,"runtimeFriendStatus",null);D([ue(),G(0,W()),G(1,W()),w("design:type",Function),w("design:paramtypes",[String,ks]),w("design:returntype",Boolean)],q.prototype,"runtimeFriendSendMessage",null);D([gt(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Array)],q.prototype,"runtimeMessageInbox",null);D([gt(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Array)],q.prototype,"runtimeMessageOutbox",null);D([rl(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Dn)],q.prototype,"runtimeMessageReceived",null);D([rl(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Fn)],q.prototype,"exceptionOccurred",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Pt]),w("design:returntype",String)],q.prototype,"runtimeRequestInstallNotification",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],q.prototype,"runtimeNotifications",null);D([ue(),G(0,W()),G(1,W()),w("design:type",Function),w("design:paramtypes",[String,Pt]),w("design:returntype",Boolean)],q.prototype,"runtimeUpdateNotification",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],q.prototype,"runtimeRemoveNotification",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],q.prototype,"runtimeGrantNotification",null);D([rl(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Di)],q.prototype,"runtimeNotificationTriggered",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],q.prototype,"runtimeExportDb",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],q.prototype,"runtimeImportDb",null);D([ue(),G(0,W()),G(1,W()),w("design:type",Function),w("design:paramtypes",[String,String]),w("design:returntype",Boolean)],q.prototype,"runtimeExportPerspective",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],q.prototype,"runtimeImportPerspective",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],q.prototype,"runtimeMultiUserEnabled",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[Boolean]),w("design:returntype",Boolean)],q.prototype,"runtimeSetMultiUserEnabled",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Array)],q.prototype,"runtimeListUsers",null);D([ue(),G(0,W()),G(1,W()),w("design:type",Function),w("design:paramtypes",[String,or]),w("design:returntype",Mn)],q.prototype,"runtimeRequestLoginVerification",null);D([ue(),G(0,W()),G(1,W()),G(2,W()),w("design:type",Function),w("design:paramtypes",[String,String,String]),w("design:returntype",String)],q.prototype,"runtimeVerifyEmailCode",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],q.prototype,"runtimeTestEmail",null);D([ue(),G(0,W()),G(1,W()),G(2,W()),w("design:type",Function),w("design:paramtypes",[String,String,or]),w("design:returntype",Nn)],q.prototype,"runtimeCreateUser",null);D([ue(),G(0,W()),G(1,W()),w("design:type",Function),w("design:paramtypes",[String,String]),w("design:returntype",String)],q.prototype,"runtimeLoginUser",null);D([ue(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeEnable",null);D([ue(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeDisable",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",String)],q.prototype,"runtimeEmailTestGetCode",null);D([ue(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",Boolean)],q.prototype,"runtimeEmailTestClearCodes",null);D([ue(),G(0,W()),G(1,W()),G(2,W()),w("design:type",Function),w("design:paramtypes",[String,String,Number]),w("design:returntype",Boolean)],q.prototype,"runtimeEmailTestSetExpiry",null);D([gt(),w("design:type",Function),w("design:paramtypes",[]),w("design:returntype",jn)],q.prototype,"runtimeHostingUserInfo",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Boolean)],q.prototype,"runtimeSetHotWalletAddress",null);D([ue(),G(0,W()),w("design:type",Function),w("design:paramtypes",[String]),w("design:returntype",Ri)],q.prototype,"runtimeRequestPayment",null);q=D([Ly()],q);var vw=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 yl(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 vw(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 bw=12e3,vl=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;yl(this),this.options=t,this.port=t.port||parseInt(Bo("ad4m-port"))||bw,this.url=t.url||Bo("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Bo("ad4m-token")||"",this.embedded=mp(),this.embedded&&this.initializeEmbeddedMode()}connect(){return _e(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 gp(this.url),dr("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 _e(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=cu({url:this.url,connectionParams:()=>_e(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=>_e(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 Ga(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new ou({link:new hp(t),cache:new Lo({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,n){return _e(this,null,function*(){let i=cu({url:t,connectionParams:()=>_e(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new Ga(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return _e(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="",aa("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return _e(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="",aa("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=>_e(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`,dr("ad4m-port",o.toString()),s?dr("ad4m-token",s):aa("ad4m-token"),dr("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 _e(this,null,function*(){return t&&(this.token="",aa("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 _e(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,dr("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Code verification failed:",n),!1}})}isValidAd4mAPI(){return _e(this,null,function*(){try{return yield this.withTempClient(this.url,t=>_e(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 _e(this,null,function*(){try{return yield this.withTempClient(this.url,t=>_e(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 _e(this,null,function*(){try{return yield this.withTempClient(this.url,n=>_e(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 _e(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>_e(this,null,function*(){return yield a.agent.verifyEmailCode(t,n,"login")}));return this.token=i,dr("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 _e(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>_e(this,null,function*(){return yield a.agent.loginUser(t,n)}));return this.token=i,dr("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Password login failed:",i),!1}})}createAccount(t,n){return _e(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>_e(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,dr("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{vl as default};
1656
+ `,A=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},g=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Q=function(r,e){return function(t,n){e(t,n,r)}},ro=new Gr;ro.author="did:ad4m:test";ro.timestamp=Date.now();ro.data={source:"root",target:"neighbourhood://Qm12345"};ro.proof={signature:"",key:"",valid:!0};var Br=new Cn;Br.author="did:ad4m:test";Br.timestamp=Date.now().toString();Br.proof=new wr("","");Br.data=new sr([ro]);var qs=class{};A([w(),g("design:type",String)],qs.prototype,"recipient",void 0);A([w(),g("design:type",Cn)],qs.prototype,"message",void 0);qs=A([H()],qs);var Ri=class{};A([w(),g("design:type",String)],Ri.prototype,"ad4mExecutorVersion",void 0);A([w(),g("design:type",Boolean)],Ri.prototype,"isInitialized",void 0);A([w(),g("design:type",Boolean)],Ri.prototype,"isUnlocked",void 0);Ri=A([H()],Ri);var jn=class{};A([w(),g("design:type",String)],jn.prototype,"title",void 0);A([w(),g("design:type",String)],jn.prototype,"message",void 0);A([w(),g("design:type",String)],jn.prototype,"type",void 0);A([w(),g("design:type",String)],jn.prototype,"addon",void 0);jn=A([H()],jn);var Lt=class{};A([w(),g("design:type",String)],Lt.prototype,"description",void 0);A([w(),g("design:type",String)],Lt.prototype,"appName",void 0);A([w(),g("design:type",String)],Lt.prototype,"appUrl",void 0);A([w(),g("design:type",String)],Lt.prototype,"appIconPath",void 0);A([w(),g("design:type",String)],Lt.prototype,"trigger",void 0);A([w(),g("design:type",Array)],Lt.prototype,"perspectiveIds",void 0);A([w(),g("design:type",String)],Lt.prototype,"webhookUrl",void 0);A([w(),g("design:type",String)],Lt.prototype,"webhookAuth",void 0);Lt=A([We()],Lt);var Et=class{};A([w(),g("design:type",String)],Et.prototype,"id",void 0);A([w(),g("design:type",Boolean)],Et.prototype,"granted",void 0);A([w(),g("design:type",String)],Et.prototype,"description",void 0);A([w(),g("design:type",String)],Et.prototype,"appName",void 0);A([w(),g("design:type",String)],Et.prototype,"appUrl",void 0);A([w(),g("design:type",String)],Et.prototype,"appIconPath",void 0);A([w(),g("design:type",String)],Et.prototype,"trigger",void 0);A([w(),g("design:type",Array)],Et.prototype,"perspectiveIds",void 0);A([w(),g("design:type",String)],Et.prototype,"webhookUrl",void 0);A([w(),g("design:type",String)],Et.prototype,"webhookAuth",void 0);Et=A([H()],Et);var Ci=class{};A([w(),g("design:type",Et)],Ci.prototype,"notification",void 0);A([w(),g("design:type",String)],Ci.prototype,"perspectiveId",void 0);A([w(),g("design:type",String)],Ci.prototype,"triggerMatch",void 0);Ci=A([H()],Ci);var Qe=class{};A([w(),g("design:type",Number)],Qe.prototype,"total",void 0);A([w(),g("design:type",Number)],Qe.prototype,"imported",void 0);A([w(),g("design:type",Number)],Qe.prototype,"failed",void 0);A([w(),g("design:type",Number)],Qe.prototype,"omitted",void 0);A([w(),g("design:type",Array)],Qe.prototype,"errors",void 0);Qe=A([H()],Qe);var xt=class{};A([w(),g("design:type",Qe)],xt.prototype,"perspectives",void 0);A([w(),g("design:type",Qe)],xt.prototype,"links",void 0);A([w(),g("design:type",Qe)],xt.prototype,"expressions",void 0);A([w(),g("design:type",Qe)],xt.prototype,"perspectiveDiffs",void 0);A([w(),g("design:type",Qe)],xt.prototype,"notifications",void 0);A([w(),g("design:type",Qe)],xt.prototype,"models",void 0);A([w(),g("design:type",Qe)],xt.prototype,"defaultModels",void 0);A([w(),g("design:type",Qe)],xt.prototype,"tasks",void 0);A([w(),g("design:type",Qe)],xt.prototype,"friends",void 0);A([w(),g("design:type",Qe)],xt.prototype,"trustedAgents",void 0);A([w(),g("design:type",Qe)],xt.prototype,"knownLinkLanguages",void 0);xt=A([H()],xt);var Er=class{};A([w(),g("design:type",String)],Er.prototype,"email",void 0);A([w(),g("design:type",String)],Er.prototype,"did",void 0);A([w(),g("design:type",String)],Er.prototype,"lastSeen",void 0);A([w(),g("design:type",Number)],Er.prototype,"perspectiveCount",void 0);A([w(),g("design:type",String)],Er.prototype,"remainingCredits",void 0);A([w(),g("design:type",Boolean)],Er.prototype,"freeAccess",void 0);A([w(),g("design:type",String)],Er.prototype,"hotWalletAddress",void 0);Er=A([H()],Er);var qn=class{};A([w(),g("design:type",Boolean)],qn.prototype,"success",void 0);A([w(),g("design:type",String)],qn.prototype,"message",void 0);A([w(),g("design:type",Boolean)],qn.prototype,"requiresPassword",void 0);A([w(),g("design:type",Boolean)],qn.prototype,"isExistingUser",void 0);qn=A([H()],qn);var en=class{constructor(e,t,n,i=!1){this.email=e,this.remainingCredits=t,this.hotWalletAddress=n,this.freeAccess=i}};A([w(),g("design:type",String)],en.prototype,"email",void 0);A([w(),g("design:type",String)],en.prototype,"remainingCredits",void 0);A([w(),g("design:type",String)],en.prototype,"hotWalletAddress",void 0);A([w(),g("design:type",Boolean)],en.prototype,"freeAccess",void 0);en=A([H(),g("design:paramtypes",[String,String,String,Boolean])],en);var Ct=class{constructor(e,t){this.success=e,this.message=t}};A([w(),g("design:type",Boolean)],Ct.prototype,"success",void 0);A([w(),g("design:type",String)],Ct.prototype,"message",void 0);Ct=A([H(),g("design:paramtypes",[Boolean,String])],Ct);var U=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 Br}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Br]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Br}]}runtimeMessageReceived(){return Br}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Yu.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,remainingCredits:"0",freeAccess:!1}]}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 Pn("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}runtimeHostingUserInfo(){return new en("test@example.com","100000000",null,!1)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new Ct(!0,"Mock payment of "+e+" base units credited")}runtimeSetUserCredits(e,t){return!0}runtimeSetUserFreeAccess(e,t){return!0}runtimeReinstallUnytDna(){return new Ct(!0,"")}runtimeSendHot(e,t){return new Ct(!0,"")}runtimeSetUnytMembraneProof(e){return new Ct(!0,"")}runtimeHotWalletBalance(){return""}runtimeHotWalletHistory(e,t){return""}runtimeHotAgentPubkey(){return""}runtimeUnytVersionInfo(){return""}};A([X(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeQuit",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeOpenLink",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Ri)],U.prototype,"runtimeInfo",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"addTrustedAgents",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"deleteTrustedAgents",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"getTrustedAgents",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeKnownLinkLanguageTemplates",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeAddKnownLinkLanguageTemplates",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeFriends",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeAddFriends",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Array]),g("design:returntype",Array)],U.prototype,"runtimeRemoveFriends",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeHcAgentInfos",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeGetNetworkMetrics",null);A([X(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeRestartHolochain",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Object]),g("design:returntype",Boolean)],U.prototype,"runtimeHcAddAgentInfos",null);A([ze(),Q(0,V()),Q(1,V()),Q(2,V()),Q(3,V()),g("design:type",Function),g("design:paramtypes",[String,String,String,String]),g("design:returntype",void 0)],U.prototype,"runtimeVerifyStringSignedByDid",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[sr]),g("design:returntype",Boolean)],U.prototype,"runtimeSetStatus",null);A([ze(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Cn)],U.prototype,"runtimeFriendStatus",null);A([X(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[String,Is]),g("design:returntype",Boolean)],U.prototype,"runtimeFriendSendMessage",null);A([ze(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],U.prototype,"runtimeMessageInbox",null);A([ze(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Array)],U.prototype,"runtimeMessageOutbox",null);A([rl(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Cn)],U.prototype,"runtimeMessageReceived",null);A([rl(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",jn)],U.prototype,"exceptionOccurred",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Lt]),g("design:returntype",String)],U.prototype,"runtimeRequestInstallNotification",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeNotifications",null);A([X(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[String,Lt]),g("design:returntype",Boolean)],U.prototype,"runtimeUpdateNotification",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeRemoveNotification",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeGrantNotification",null);A([rl(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Ci)],U.prototype,"runtimeNotificationTriggered",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeExportDb",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeImportDb",null);A([X(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Boolean)],U.prototype,"runtimeExportPerspective",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeImportPerspective",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeMultiUserEnabled",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[Boolean]),g("design:returntype",Boolean)],U.prototype,"runtimeSetMultiUserEnabled",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Array)],U.prototype,"runtimeListUsers",null);A([X(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[String,cr]),g("design:returntype",qn)],U.prototype,"runtimeRequestLoginVerification",null);A([X(),Q(0,V()),Q(1,V()),Q(2,V()),g("design:type",Function),g("design:paramtypes",[String,String,String]),g("design:returntype",String)],U.prototype,"runtimeVerifyEmailCode",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeTestEmail",null);A([X(),Q(0,V()),Q(1,V()),Q(2,V()),g("design:type",Function),g("design:paramtypes",[String,String,cr]),g("design:returntype",Pn)],U.prototype,"runtimeCreateUser",null);A([X(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",String)],U.prototype,"runtimeLoginUser",null);A([X(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeEnable",null);A([X(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestModeDisable",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",String)],U.prototype,"runtimeEmailTestGetCode",null);A([X(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestClearCodes",null);A([X(),Q(0,V()),Q(1,V()),Q(2,V()),g("design:type",Function),g("design:paramtypes",[String,String,Number]),g("design:returntype",Boolean)],U.prototype,"runtimeEmailTestSetExpiry",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",en)],U.prototype,"runtimeHostingUserInfo",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Boolean)],U.prototype,"runtimeSetHotWalletAddress",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Ct)],U.prototype,"runtimeRequestPayment",null);A([X(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[String,Number]),g("design:returntype",Boolean)],U.prototype,"runtimeSetUserCredits",null);A([X(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[String,Boolean]),g("design:returntype",Boolean)],U.prototype,"runtimeSetUserFreeAccess",null);A([X(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",Ct)],U.prototype,"runtimeReinstallUnytDna",null);A([X(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[String,String]),g("design:returntype",Ct)],U.prototype,"runtimeSendHot",null);A([X(),Q(0,V()),g("design:type",Function),g("design:paramtypes",[String]),g("design:returntype",Ct)],U.prototype,"runtimeSetUnytMembraneProof",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeHotWalletBalance",null);A([ze(),Q(0,V()),Q(1,V()),g("design:type",Function),g("design:paramtypes",[Number,Number]),g("design:returntype",String)],U.prototype,"runtimeHotWalletHistory",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeHotAgentPubkey",null);A([ze(),g("design:type",Function),g("design:paramtypes",[]),g("design:returntype",String)],U.prototype,"runtimeUnytVersionInfo",null);U=A([Fy()],U);var Sw=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 yl(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 Sw(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}function Wh(r){return pe(this,null,function*(){let e=yield r.agent.hostingUserInfo();return{email:e.email,remainingCredits:e.remainingCredits==="unlimited"?1/0:parseFloat(e.remainingCredits)||0,hotWalletAddress:e.hotWalletAddress||null,freeAccess:e.remainingCredits==="unlimited"}})}function zh(r,e){return pe(this,null,function*(){return r.agent.requestPayment(e.toString())})}var ww=12e3,_w="https://hosting.ad4m.dev",Ew=3e4,vl=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;this.connectedHost=null;this.userInfo=null;this.creditPollInterval=null;yl(this),this.options=t,this.port=t.port||parseInt(oa("ad4m-port"))||ww,this.url=t.url||oa("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=oa("ad4m-token")||"",this.embedded=mp(),this.hostIndexUrl=t.hostIndexUrl||_w;let n=oa("ad4m-last-host");if(n)try{let i=JSON.parse(n);i&&i.id&&i.url&&i.name&&(this.connectedHost={id:i.id,name:i.name,profilePicUrl:i.profilePicUrl||"",location:i.location||"",url:i.url,rates:i.rates||[],aiModels:i.aiModels||[]})}catch(i){}this.embedded&&this.initializeEmbeddedMode()}connect(){return pe(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 gp(this.url),Kt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(t){throw console.error("[Ad4m Connect] Connection failed:",t),this.notifyConnectionChange("error"),t}})}buildClient(){return pe(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=cu({url:this.url,connectionParams:()=>pe(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=>pe(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 Ga(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new ou({link:new hp(t),cache:new $o({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,n){return pe(this,null,function*(){let i=cu({url:t,connectionParams:()=>pe(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new Ga(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return pe(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="",di("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return pe(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="",di("ad4m-token"),this.notifyAuthChange("unauthenticated"),this.connectedHost=null,this.userInfo=null,this.stopCreditPolling(),di("ad4m-last-host"),this.notifyConnectionChange("not-connected"),console.log("[Ad4m Connect] Disconnected successfully")})}startCreditPolling(){this.stopCreditPolling();let t=()=>pe(this,null,function*(){try{if(!this.ad4mClient)return;let n=yield Wh(this.ad4mClient);this.userInfo=n,this.dispatchEvent(new CustomEvent("userinfochange",{detail:n})),n.remainingCredits<=0&&this.dispatchEvent(new CustomEvent("creditdepleted"))}catch(n){console.error("[Ad4m Connect] Credit polling error:",n)}});t(),this.creditPollInterval=setInterval(t,Ew)}stopCreditPolling(){this.creditPollInterval&&(clearInterval(this.creditPollInterval),this.creditPollInterval=null)}requestTopUp(t){return pe(this,null,function*(){if(!this.ad4mClient)throw new Error("Not connected");return zh(this.ad4mClient,t)})}setConnectedHost(t){this.connectedHost=t,Kt("ad4m-last-host",JSON.stringify({id:t.id,url:t.url,name:t.name}))}initializeEmbeddedMode(){console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent"),window.addEventListener("message",t=>pe(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`,Kt("ad4m-port",o.toString()),s?Kt("ad4m-token",s):di("ad4m-token"),Kt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(c){console.error("[Ad4m Connect] Failed to initialize from AD4M_CONFIG:",c),this.rejectEmbedded(c)}}})),console.log("[Ad4m Connect] Requesting AD4M config from parent window"),window.parent.postMessage({type:"REQUEST_AD4M_CONFIG"},"*")}buildAppInfo(){return{appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appDomain:this.options.appInfo.url,appUrl:window.location.origin,appIconPath:this.options.appInfo.iconPath}}requestCapability(t=!1){return pe(this,null,function*(){return t&&(this.token="",di("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 pe(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,Kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Code verification failed:",n),!1}})}isValidAd4mAPI(){return pe(this,null,function*(){try{return yield this.withTempClient(this.url,t=>pe(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 pe(this,null,function*(){try{return yield this.withTempClient(this.url,t=>pe(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 pe(this,null,function*(){try{return yield this.withTempClient(this.url,n=>pe(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 pe(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>pe(this,null,function*(){return yield a.agent.verifyEmailCode(t,n,"login")}));return this.token=i,Kt("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 pe(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>pe(this,null,function*(){return yield a.agent.loginUser(t,n)}));return this.token=i,Kt("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Password login failed:",i),!1}})}createAccount(t,n){return pe(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>pe(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,Kt("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{vl as default};
1620
1657
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */