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

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.
Files changed (52) hide show
  1. package/dist/components/icons/CreditIcon.d.ts +1 -0
  2. package/dist/components/icons/GlobeIcon.d.ts +1 -0
  3. package/dist/components/icons/WalletIcon.d.ts +1 -0
  4. package/dist/components/shared/avatar.d.ts +8 -0
  5. package/dist/components/views/HostBrowser.d.ts +29 -0
  6. package/dist/components/views/HostDetail.d.ts +17 -0
  7. package/dist/components/views/LoggedInDashboard.d.ts +26 -0
  8. package/dist/core.js +350 -324
  9. package/dist/index.js +392 -366
  10. package/dist/services/hostIndex.d.ts +11 -0
  11. package/dist/utils.js +1 -1
  12. package/dist/web.js +354 -328
  13. package/package.json +15 -15
  14. package/dist/components/icons/CheckCircleIcon.d.ts +0 -1
  15. package/dist/components/icons/TickIcon.d.ts +0 -1
  16. package/dist/components/shared/Ad4mLogo.d.ts +0 -1
  17. package/dist/components/shared/AppLogo.d.ts +0 -1
  18. package/dist/components/shared/Header.d.ts +0 -1
  19. package/dist/components/shared/Logo.d.ts +0 -1
  20. package/dist/components/states/ErrorState.d.ts +0 -6
  21. package/dist/components/views/ConnectionOverview.d.ts +0 -22
  22. package/dist/components/views/Hosting.d.ts +0 -22
  23. package/dist/components/views/MultiUserAuth.d.ts +0 -26
  24. package/dist/components/views/RemoteConnection.d.ts +0 -19
  25. package/dist/components/views/RequestCapability.d.ts +0 -16
  26. package/dist/components/views/ScanQRCode.d.ts +0 -14
  27. package/dist/components/views/Settings.d.ts +0 -19
  28. package/dist/components/views/Start.d.ts +0 -19
  29. package/dist/components/views/old/Hosting.d.ts +0 -22
  30. package/dist/components/views/old/MultiUserAuth.d.ts +0 -26
  31. package/dist/components/views/old/RemoteConnection.d.ts +0 -19
  32. package/dist/components/views/old/RequestCapability.d.ts +0 -16
  33. package/dist/components/views/old/ScanQRCode.d.ts +0 -14
  34. package/dist/components/views/old/Settings.d.ts +0 -19
  35. package/dist/components/views/old/Start.d.ts +0 -19
  36. package/dist/old/components/InvalidToken.d.ts +0 -0
  37. package/dist/old/components/VerifyCode.d.ts +0 -0
  38. package/dist/old/core.d.ts +0 -0
  39. package/dist/old/electron.d.ts +0 -0
  40. package/dist/old/state/ConnectState.d.ts +0 -0
  41. package/dist/old/state/index.d.ts +0 -0
  42. package/dist/old/utils.d.ts +0 -0
  43. package/dist/old/views/Hosting.d.ts +0 -0
  44. package/dist/old/views/MultiUserAuth.d.ts +0 -0
  45. package/dist/old/views/RemoteConnection.d.ts +0 -0
  46. package/dist/old/views/RequestCapability.d.ts +0 -0
  47. package/dist/old/views/ScanQRCode.d.ts +0 -0
  48. package/dist/old/views/Settings.d.ts +0 -0
  49. package/dist/old/views/Start.d.ts +0 -0
  50. package/dist/old/web.d.ts +0 -0
  51. package/dist/state/ConnectState.d.ts +0 -101
  52. package/dist/state/index.d.ts +0 -2
package/dist/index.js CHANGED
@@ -1,31 +1,31 @@
1
- var dg=Object.defineProperty;var fg=Object.getOwnPropertyDescriptor;var hg=Object.getPrototypeOf;var mg=Reflect.get;var z=(r,e,t,n)=>{for(var i=n>1?void 0:n?fg(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&dg(e,t,i),i};var Ap=(r,e,t)=>mg(hg(r),t,e);var K=(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 Bc=function(r,e){return Bc=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])},Bc(r,e)};function $e(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Bc(r,e);function t(){this.constructor=r}r.prototype=e===null?Object.create(e):(t.prototype=e.prototype,new t)}var E=function(){return E=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},E.apply(this,arguments)};function ir(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 zt(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(d){o(d)}}function c(l){try{u(n.throw(l))}catch(d){o(d)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(r,e||[])).next())})}function Wt(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 Mr(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 Vc="Invariant Violation",kp=Object.setPrototypeOf,gg=kp===void 0?function(r,e){return r.__proto__=e,r}:kp,J=function(r){$e(e,r);function e(t){t===void 0&&(t=Vc);var n=r.call(this,typeof t=="number"?Vc+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=Vc,gg(n,e.prototype),n}return e}(Error);function L(r,e){if(!r)throw new J(e)}var Uo=["debug","log","warn","error","silent"],Qc=Uo.indexOf("log");function jo(r){return function(){if(Uo.indexOf(r)>=Qc){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=jo("debug"),r.log=jo("log"),r.warn=jo("warn"),r.error=jo("error")})(L||(L={}));function Ip(r){var e=Uo[Qc];return Qc=Math.max(0,Uo.indexOf(r)),e}function ze(r){try{return r()}catch{}}var qo=ze(function(){return globalThis})||ze(function(){return window})||ze(function(){return self})||ze(function(){return global})||ze(function(){return ze.constructor("return this")()});var Tp="__",Op=[Tp,Tp].join("DEV");function yg(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(qo,Op,{value:ze(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),qo[Op]}}var wn=yg();function jr(r){try{return r()}catch{}}var zc=jr(function(){return globalThis})||jr(function(){return window})||jr(function(){return self})||jr(function(){return global})||jr(function(){return jr.constructor("return this")()}),Wc=!1;function vg(){zc&&!jr(function(){return"production"})&&!jr(function(){return process})&&(Object.defineProperty(zc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Wc=!0)}vg();function Hc(){Wc&&(delete zc.process,Wc=!1)}var r_=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",n_=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",Cp=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Me=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 Gc(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var bg=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ma=bg;function Bo(r){var e=r.prototype.toJSON;typeof e=="function"||Gc(0),r.prototype.inspect=e,ma&&(r.prototype[ma]=e)}var Np=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}();Bo(Np);var $p=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}();Bo($p);function Kc(r){return r!=null&&typeof r.kind=="string"}function Vo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Vo=function(t){return typeof t}:Vo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vo(r)}var wg=10,Dp=2;function ga(r){return Qo(r,[])}function Qo(r,e){switch(Vo(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Sg(r,e);default:return String(r)}}function Sg(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=xg(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:Qo(i,t)}else if(Array.isArray(r))return Eg(r,t);return _g(r,t)}function _g(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Dp)return"["+Ag(r)+"]";var n=t.map(function(i){var a=Qo(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Eg(r,e){if(r.length===0)return"[]";if(e.length>Dp)return"[Array]";for(var t=Math.min(wg,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(Qo(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function xg(r){var e=r[String(ma)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Ag(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 ya(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function Rp(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 kg(r,e,t){return e&&Rp(r.prototype,e),t&&Rp(r,t),r}var zo=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"||ya(0,"Body must be a string. Received: ".concat(ga(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||ya(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ya(0,"column in locationOffset is 1-indexed and must be positive.")}return kg(r,[{key:Cp,get:function(){return"Source"}}]),r}();function Lp(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 Sg=Object.defineProperty;var _g=Object.getOwnPropertyDescriptor;var Eg=Object.getPrototypeOf;var xg=Reflect.get;var H=(r,e,t,n)=>{for(var i=n>1?void 0:n?_g(e,t):e,a=r.length-1,o;a>=0;a--)(o=r[a])&&(i=(n?o(e,t,i):o(i))||i);return n&&i&&Sg(e,t,i),i};var Op=(r,e,t)=>xg(Eg(r),t,e);var Z=(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 Hc=function(r,e){return Hc=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])},Hc(r,e)};function De(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");Hc(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 ir(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 Wt(r,e,t,n){function i(a){return a instanceof t?a:new t(function(o){o(a)})}return new(t||(t=Promise))(function(a,o){function s(l){try{u(n.next(l))}catch(d){o(d)}}function c(l){try{u(n.throw(l))}catch(d){o(d)}}function u(l){l.done?a(l.value):i(l.value).then(s,c)}u((n=n.apply(r,e||[])).next())})}function Gt(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 Mr(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 Wc="Invariant Violation",Cp=Object.setPrototypeOf,kg=Cp===void 0?function(r,e){return r.__proto__=e,r}:Cp,Y=function(r){De(e,r);function e(t){t===void 0&&(t=Wc);var n=r.call(this,typeof t=="number"?Wc+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=Wc,kg(n,e.prototype),n}return e}(Error);function P(r,e){if(!r)throw new Y(e)}var Qo=["debug","log","warn","error","silent"],Gc=Qo.indexOf("log");function Vo(r){return function(){if(Qo.indexOf(r)>=Gc){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=Vo("debug"),r.log=Vo("log"),r.warn=Vo("warn"),r.error=Vo("error")})(P||(P={}));function Np(r){var e=Qo[Gc];return Gc=Math.max(0,Qo.indexOf(r)),e}function He(r){try{return r()}catch{}}var zo=He(function(){return globalThis})||He(function(){return window})||He(function(){return self})||He(function(){return global})||He(function(){return He.constructor("return this")()});var $p="__",Dp=[$p,$p].join("DEV");function Ag(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(zo,Dp,{value:He(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),zo[Dp]}}var bn=Ag();function Ur(r){try{return r()}catch{}}var Kc=Ur(function(){return globalThis})||Ur(function(){return window})||Ur(function(){return self})||Ur(function(){return global})||Ur(function(){return Ur.constructor("return this")()}),Jc=!1;function Ig(){Kc&&!Ur(function(){return"production"})&&!Ur(function(){return process})&&(Object.defineProperty(Kc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),Jc=!0)}Ig();function Zc(){Jc&&(delete Kc.process,Jc=!1)}var w_=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",S_=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",Rp=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Ue=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 Yc(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Tg=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ya=Tg;function Ho(r){var e=r.prototype.toJSON;typeof e=="function"||Yc(0),r.prototype.inspect=e,ya&&(r.prototype[ya]=e)}var Pp=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}();Ho(Pp);var Lp=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}();Ho(Lp);function Xc(r){return r!=null&&typeof r.kind=="string"}function Wo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Wo=function(t){return typeof t}:Wo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Wo(r)}var Og=10,Fp=2;function va(r){return Go(r,[])}function Go(r,e){switch(Wo(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Cg(r,e);default:return String(r)}}function Cg(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=Dg(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:Go(i,t)}else if(Array.isArray(r))return $g(r,t);return Ng(r,t)}function Ng(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Fp)return"["+Rg(r)+"]";var n=t.map(function(i){var a=Go(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function $g(r,e){if(r.length===0)return"[]";if(e.length>Fp)return"[Array]";for(var t=Math.min(Og,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(Go(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Dg(r){var e=r[String(ya)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Rg(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 ba(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function Mp(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 Pg(r,e,t){return e&&Mp(r.prototype,e),t&&Mp(r,t),r}var Ko=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"||ba(0,"Body must be a string. Received: ".concat(va(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||ba(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ba(0,"column in locationOffset is 1-indexed and must be positive.")}return Pg(r,[{key:Rp,get:function(){return"Source"}}]),r}();function Up(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 Ig={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"]},Sn=Object.freeze({});function nt(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Ig,n=void 0,i=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,d=[],f=[],p=r;do{o++;var m=o===a.length,h=m&&s.length!==0;if(m){if(u=f.length===0?void 0:d[d.length-1],c=l,l=f.pop(),h){if(i)c=c.slice();else{for(var g={},b=0,v=Object.keys(c);b<v.length;b++){var w=v[b];g[w]=c[w]}c=g}for(var y=0,k=0;k<s.length;k++){var C=s[k][0],I=s[k][1];i&&(C-=y),i&&I===null?(c.splice(C,1),y++):c[C]=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]:p,c==null)continue;l&&d.push(u)}var D=void 0;if(!Array.isArray(c)){if(!Kc(c))throw new Error("Invalid AST Node: ".concat(ga(c),"."));var P=Jc(e,c.kind,m);if(P){if(D=P.call(e,c,u,l,d,f),D===Sn)break;if(D===!1){if(!m){d.pop();continue}}else if(D!==void 0&&(s.push([u,D]),!m))if(Kc(D))c=D;else{d.pop();continue}}}if(D===void 0&&h&&s.push([u,c]),m)d.pop();else{var R;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(R=t[c.kind])!==null&&R!==void 0?R:[],o=-1,s=[],l&&f.push(l),l=c}}while(n!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function Jc(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 bi(r){return nt(r,{leave:Og})}var Tg=80,Og={Name:function(e){return e.value},Variable:function(e){return"$"+e.name},Document:function(e){return F(e.definitions,`
5
+ `),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var Lg={Name:[],Document:["definitions"],OperationDefinition:["name","variableDefinitions","directives","selectionSet"],VariableDefinition:["variable","type","defaultValue","directives"],Variable:["name"],SelectionSet:["selections"],Field:["alias","name","arguments","directives","selectionSet"],Argument:["name","value"],FragmentSpread:["name","directives"],InlineFragment:["typeCondition","directives","selectionSet"],FragmentDefinition:["name","variableDefinitions","typeCondition","directives","selectionSet"],IntValue:[],FloatValue:[],StringValue:[],BooleanValue:[],NullValue:[],EnumValue:[],ListValue:["values"],ObjectValue:["fields"],ObjectField:["name","value"],Directive:["name","arguments"],NamedType:["name"],ListType:["type"],NonNullType:["type"],SchemaDefinition:["description","directives","operationTypes"],OperationTypeDefinition:["type"],ScalarTypeDefinition:["description","name","directives"],ObjectTypeDefinition:["description","name","interfaces","directives","fields"],FieldDefinition:["description","name","arguments","type","directives"],InputValueDefinition:["description","name","type","defaultValue","directives"],InterfaceTypeDefinition:["description","name","interfaces","directives","fields"],UnionTypeDefinition:["description","name","directives","types"],EnumTypeDefinition:["description","name","directives","values"],EnumValueDefinition:["description","name","directives"],InputObjectTypeDefinition:["description","name","directives","fields"],DirectiveDefinition:["description","name","arguments","locations"],SchemaExtension:["directives","operationTypes"],ScalarTypeExtension:["name","directives"],ObjectTypeExtension:["name","interfaces","directives","fields"],InterfaceTypeExtension:["name","interfaces","directives","fields"],UnionTypeExtension:["name","directives","types"],EnumTypeExtension:["name","directives","values"],InputObjectTypeExtension:["name","directives","fields"]},wn=Object.freeze({});function it(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:Lg,n=void 0,i=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,d=[],f=[],p=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=f.length===0?void 0:d[d.length-1],c=l,l=f.pop(),m){if(i)c=c.slice();else{for(var v={},_=0,y=Object.keys(c);_<y.length;_++){var b=y[_];v[b]=c[b]}c=v}for(var g=0,T=0;T<s.length;T++){var N=s[T][0],A=s[T][1];i&&(N-=g),i&&A===null?(c.splice(N,1),g++):c[N]=A}}o=n.index,a=n.keys,s=n.edits,i=n.inArray,n=n.prev}else{if(u=l?i?o:a[o]:void 0,c=l?l[u]:p,c==null)continue;l&&d.push(u)}var D=void 0;if(!Array.isArray(c)){if(!Xc(c))throw new Error("Invalid AST Node: ".concat(va(c),"."));var L=eu(e,c.kind,h);if(L){if(D=L.call(e,c,u,l,d,f),D===wn)break;if(D===!1){if(!h){d.pop();continue}}else if(D!==void 0&&(s.push([u,D]),!h))if(Xc(D))c=D;else{d.pop();continue}}}if(D===void 0&&m&&s.push([u,c]),h)d.pop();else{var R;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(R=t[c.kind])!==null&&R!==void 0?R:[],o=-1,s=[],l&&f.push(l),l=c}}while(n!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function eu(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 wi(r){return it(r,{leave:Mg})}var Fg=80,Mg={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=Ce("(",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+Ce(" = ",i)+Ce(" ",F(a," "))},SelectionSet:function(e){var t=e.selections;return Gt(t)},Field:function(e){var t=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Ce("",t,": ")+n,c=s+Ce("(",F(i,", "),")");return c.length>Tg&&(c=s+Ce(`(
9
- `,Wo(F(i,`
8
+ `},OperationDefinition:function(e){var t=e.operation,n=e.name,i=Ne("(",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+Ne(" = ",i)+Ne(" ",F(a," "))},SelectionSet:function(e){var t=e.selections;return Jt(t)},Field:function(e){var t=e.alias,n=e.name,i=e.arguments,a=e.directives,o=e.selectionSet,s=Ne("",t,": ")+n,c=s+Ne("(",F(i,", "),")");return c.length>Fg&&(c=s+Ne(`(
9
+ `,Jo(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+Ce(" ",F(n," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return F(["...",Ce("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(Ce("(",F(i,", "),")")," ")+"on ".concat(n," ").concat(Ce("",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?Lp(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+Ce("(",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:Ht(function(r){var e=r.directives,t=r.operationTypes;return F(["schema",F(e," "),Gt(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,n=e.type;return t+": "+n},ScalarTypeDefinition:Ht(function(r){var e=r.name,t=r.directives;return F(["scalar",e,F(t," ")]," ")}),ObjectTypeDefinition:Ht(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["type",e,Ce("implements ",F(t," & ")),F(n," "),Gt(i)]," ")}),FieldDefinition:Ht(function(r){var e=r.name,t=r.arguments,n=r.type,i=r.directives;return e+(Pp(t)?Ce(`(
12
- `,Wo(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+Ne(" ",F(n," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return F(["...",Ne("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(Ne("(",F(i,", "),")")," ")+"on ".concat(n," ").concat(Ne("",F(a," ")," "))+o},IntValue:function(e){var t=e.value;return t},FloatValue:function(e){var t=e.value;return t},StringValue:function(e,t){var n=e.value,i=e.block;return i?Up(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+Ne("(",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:Kt(function(r){var e=r.directives,t=r.operationTypes;return F(["schema",F(e," "),Jt(t)]," ")}),OperationTypeDefinition:function(e){var t=e.operation,n=e.type;return t+": "+n},ScalarTypeDefinition:Kt(function(r){var e=r.name,t=r.directives;return F(["scalar",e,F(t," ")]," ")}),ObjectTypeDefinition:Kt(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["type",e,Ne("implements ",F(t," & ")),F(n," "),Jt(i)]," ")}),FieldDefinition:Kt(function(r){var e=r.name,t=r.arguments,n=r.type,i=r.directives;return e+(jp(t)?Ne(`(
12
+ `,Jo(F(t,`
13
13
  `)),`
14
- )`):Ce("(",F(t,", "),")"))+": "+n+Ce(" ",F(i," "))}),InputValueDefinition:Ht(function(r){var e=r.name,t=r.type,n=r.defaultValue,i=r.directives;return F([e+": "+t,Ce("= ",n),F(i," ")]," ")}),InterfaceTypeDefinition:Ht(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["interface",e,Ce("implements ",F(t," & ")),F(n," "),Gt(i)]," ")}),UnionTypeDefinition:Ht(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:Ht(function(r){var e=r.name,t=r.directives,n=r.values;return F(["enum",e,F(t," "),Gt(n)]," ")}),EnumValueDefinition:Ht(function(r){var e=r.name,t=r.directives;return F([e,F(t," ")]," ")}),InputObjectTypeDefinition:Ht(function(r){var e=r.name,t=r.directives,n=r.fields;return F(["input",e,F(t," "),Gt(n)]," ")}),DirectiveDefinition:Ht(function(r){var e=r.name,t=r.arguments,n=r.repeatable,i=r.locations;return"directive @"+e+(Pp(t)?Ce(`(
15
- `,Wo(F(t,`
14
+ )`):Ne("(",F(t,", "),")"))+": "+n+Ne(" ",F(i," "))}),InputValueDefinition:Kt(function(r){var e=r.name,t=r.type,n=r.defaultValue,i=r.directives;return F([e+": "+t,Ne("= ",n),F(i," ")]," ")}),InterfaceTypeDefinition:Kt(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["interface",e,Ne("implements ",F(t," & ")),F(n," "),Jt(i)]," ")}),UnionTypeDefinition:Kt(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:Kt(function(r){var e=r.name,t=r.directives,n=r.values;return F(["enum",e,F(t," "),Jt(n)]," ")}),EnumValueDefinition:Kt(function(r){var e=r.name,t=r.directives;return F([e,F(t," ")]," ")}),InputObjectTypeDefinition:Kt(function(r){var e=r.name,t=r.directives,n=r.fields;return F(["input",e,F(t," "),Jt(n)]," ")}),DirectiveDefinition:Kt(function(r){var e=r.name,t=r.arguments,n=r.repeatable,i=r.locations;return"directive @"+e+(jp(t)?Ne(`(
15
+ `,Jo(F(t,`
16
16
  `)),`
17
- )`):Ce("(",F(t,", "),")"))+(n?" repeatable":"")+" on "+F(i," | ")}),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return F(["extend schema",F(t," "),Gt(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,Ce("implements ",F(n," & ")),F(i," "),Gt(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return F(["extend interface",t,Ce("implements ",F(n," & ")),F(i," "),Gt(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," "),Gt(i)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return F(["extend input",t,F(n," "),Gt(i)]," ")}};function Ht(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 Gt(r){return Ce(`{
19
- `,Wo(F(r,`
17
+ )`):Ne("(",F(t,", "),")"))+(n?" repeatable":"")+" on "+F(i," | ")}),SchemaExtension:function(e){var t=e.directives,n=e.operationTypes;return F(["extend schema",F(t," "),Jt(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,Ne("implements ",F(n," & ")),F(i," "),Jt(a)]," ")},InterfaceTypeExtension:function(e){var t=e.name,n=e.interfaces,i=e.directives,a=e.fields;return F(["extend interface",t,Ne("implements ",F(n," & ")),F(i," "),Jt(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," "),Jt(i)]," ")},InputObjectTypeExtension:function(e){var t=e.name,n=e.directives,i=e.fields;return F(["extend input",t,F(n," "),Jt(i)]," ")}};function Kt(r){return function(e){return F([e.description,r(e)],`
18
+ `)}}function F(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(n){return n}).join(t))!==null&&e!==void 0?e:""}function Jt(r){return Ne(`{
19
+ `,Jo(F(r,`
20
20
  `)),`
21
- }`)}function Ce(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function Wo(r){return Ce(" ",r.replace(/\n/g,`
22
- `))}function Cg(r){return r.indexOf(`
23
- `)!==-1}function Pp(r){return r!=null&&r.some(Cg)}function va(r){return r.kind===Me.FIELD||r.kind===Me.FRAGMENT_SPREAD||r.kind===Me.INLINE_FRAGMENT}function Fp(){return typeof zo=="function"?Hc():Hc()}function Ug(){__DEV__?L(typeof wn=="boolean",wn):L(typeof wn=="boolean",39)}Fp();Ug();function xr(r,e){var t=r.directives;return!t||!t.length?!0:Mp(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 wi(r,e,t){var n=new Set(r),i=n.size;return nt(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return Sn}}),t?!n.size:n.size<i}function Zc(r){return r&&wi(["client","export"],r,!0)}function qg(r){var e=r.name.value;return e==="skip"||e==="include"}function Mp(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!qg(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 Yc(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new J("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 J(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=E(E({},r),{definitions:Mr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function _n(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function En(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 ue(r){return r!==null&&typeof r=="object"}function ar(r){return{__ref:String(r)}}function ie(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function Xc(r){return ue(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Bg(r){return r.kind==="StringValue"}function Vg(r){return r.kind==="BooleanValue"}function Qg(r){return r.kind==="IntValue"}function zg(r){return r.kind==="FloatValue"}function Wg(r){return r.kind==="Variable"}function Hg(r){return r.kind==="ObjectValue"}function Gg(r){return r.kind==="ListValue"}function Kg(r){return r.kind==="EnumValue"}function Jg(r){return r.kind==="NullValue"}function Ur(r,e,t,n){if(Qg(t)||zg(t))r[e.value]=Number(t.value);else if(Vg(t)||Bg(t))r[e.value]=t.value;else if(Hg(t)){var i={};t.fields.map(function(o){return Ur(i,o.name,o.value,n)}),r[e.value]=i}else if(Wg(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(Gg(t))r[e.value]=t.values.map(function(o){var s={};return Ur(s,e,o,n),s[e.value]});else if(Kg(t))r[e.value]=t.value;else if(Jg(t))r[e.value]=null;else throw __DEV__?new J('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 J(55)}function eu(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 Ur(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 Ur(n,a,o,e)})),wa(r.name.value,n,t)}var Zg=["connection","include","skip","client","rest","export"],wa=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(ba(i),")")}else return t.connection.key;var a=r;if(e){var o=ba(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){Zg.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(ba(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=ba;return ba=r,e}}),ba=function(e){return JSON.stringify(e,Yg)};function Yg(r,e){return ue(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})),e}function Ar(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return Ur(t,i,a,e)}),t}return null}function Pt(r){return r.alias?r.alias.value:r.name.value}function Sa(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(xt(a)){if(a.name.value==="__typename")return r[Pt(a)]}else{var o=Sa(r,En(a,t).selectionSet,t);if(typeof o=="string")return o}}}function xt(r){return r.kind==="Field"}function tu(r){return r.kind==="InlineFragment"}function Si(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 J('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new J(48);return t});return __DEV__?L(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):L(e.length<=1,49),r}function or(r){return Si(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function _i(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function xn(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function _a(r){var e=or(r);return __DEV__?L(e&&e.operation==="query","Must contain a query definition."):L(e&&e.operation==="query",50),e}function ru(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 An(r){Si(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 J("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new J(54)}function kn(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&Ur(e,n.variable.name,n.defaultValue)}),e}var ve=Array.isArray;function Ue(r){return Array.isArray(r)&&r.length>0}var jp={kind:Me.FIELD,name:{kind:Me.NAME,value:"__typename"}};function qp(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Me.FRAGMENT_SPREAD&&qp(e[t.name.value],e)})}function Xg(r){return qp(or(r)||ru(r),_n(xn(r)))?null:r}function ey(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 Up(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 nu(r,e){for(var t=Up(""),n=Up(""),i=function(v){for(var w=0,y=void 0;w<v.length&&(y=v[w]);++w)if(!ve(y)){if(y.kind===Me.OPERATION_DEFINITION)return t(y.name&&y.name.value);if(y.kind===Me.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===Me.OPERATION_DEFINITION&&++a;var s=ey(r),c=r.some(function(v){return v.remove}),u=function(v){return c&&v&&v.some(s)},l=new Map,d=!1,f={enter:function(v){if(u(v.directives))return d=!0,null}},p=nt(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(v,w,y,k,C){var I=i(C);I&&I.variables.add(v.name.value)}},FragmentSpread:{enter:function(v,w,y,k,C){if(u(v.directives))return d=!0,null;var I=i(C);I&&I.fragmentSpreads.add(v.name.value)}},FragmentDefinition:{enter:function(v,w,y,k){l.set(JSON.stringify(k),v)},leave:function(v,w,y,k){var C=l.get(JSON.stringify(k));if(v===C)return v;if(a>0&&v.selectionSet.selections.every(function(I){return I.kind===Me.FIELD&&I.name.value==="__typename"}))return n(v.name.value).removed=!0,d=!0,null}},Directive:{leave:function(v){if(s(v))return d=!0,null}}});if(!d)return e;var m=function(v){return v.transitiveVars||(v.transitiveVars=new Set(v.variables),v.removed||v.fragmentSpreads.forEach(function(w){m(n(w)).transitiveVars.forEach(function(y){v.transitiveVars.add(y)})})),v},h=new Set;p.definitions.forEach(function(v){v.kind===Me.OPERATION_DEFINITION?m(t(v.name&&v.name.value)).fragmentSpreads.forEach(function(w){h.add(w)}):v.kind===Me.FRAGMENT_DEFINITION&&a===0&&!n(v.name.value).removed&&h.add(v.name.value)}),h.forEach(function(v){m(n(v)).fragmentSpreads.forEach(function(w){h.add(w)})});var g=function(v){return!!(!h.has(v)||n(v).removed)},b={enter:function(v){if(g(v.name.value))return null}};return Xg(nt(p,{FragmentSpread:b,FragmentDefinition:b,OperationDefinition:{leave:function(v){if(v.variableDefinitions){var w=m(t(v.name&&v.name.value)).transitiveVars;if(w.size<v.variableDefinitions.length)return E(E({},v),{variableDefinitions:v.variableDefinitions.filter(function(y){return w.has(y.variable.name.value)})})}}}}))}var In=Object.assign(function(r){return nt(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Me.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return xt(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(xt(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return E(E({},e),{selections:Mr(Mr([],i,!0),[jp],!1)})}}}}}})},{added:function(r){return r===jp}}),ty={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 iu(r){return nu([ty],Si(r))}function au(r){var e=An(r),t=e.operation;if(t==="query")return r;var n=nt(r,{OperationDefinition:{enter:function(i){return E(E({},i),{operation:"query"})}}});return n}function ou(r){Si(r);var e=nu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var ry=Object.prototype.hasOwnProperty;function su(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return Ea(r)}function Ea(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new gt,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var ny=function(r,e,t){return this.merge(r[t],e[t])},gt=function(){function r(e){e===void 0&&(e=ny),this.reconciler=e,this.isObject=ue,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 ue(t)&&ue(e)?(Object.keys(t).forEach(function(o){if(ry.call(e,o)){var s=e[o];if(t[o]!==s){var c=n.reconciler.apply(n,Mr([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 ue(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=E({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function iy(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=ay(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 ay(r,e){if(!!r){if(typeof r=="string")return Bp(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 Bp(r,e)}}function Bp(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 Vp(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 pu(r,e,t){return e&&Vp(r.prototype,e),t&&Vp(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var du=function(){return typeof Symbol=="function"},fu=function(r){return du()&&Boolean(Symbol[r])},hu=function(r){return fu(r)?Symbol[r]:"@@"+r};du()&&!fu("observable")&&(Symbol.observable=Symbol("observable"));var oy=hu("iterator"),uu=hu("observable"),Qp=hu("species");function Go(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function xa(r){var e=r.constructor;return e!==void 0&&(e=e[Qp],e===null&&(e=void 0)),e!==void 0?e:ne}function sy(r){return r instanceof ne}function Ei(r){Ei.log?Ei.log(r):setTimeout(function(){throw r})}function Ho(r){Promise.resolve().then(function(){try{r()}catch(e){Ei(e)}})}function zp(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Go(e,"unsubscribe");t&&t.call(e)}}catch(n){Ei(n)}}function lu(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function cy(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Wp(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Wp(r,e,t){r._state="running";var n=r._observer;try{var i=Go(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(lu(r),i)i.call(n,t);else throw t;break;case"complete":lu(r),i&&i.call(n);break}}catch(a){Ei(a)}r._state==="closed"?zp(r):r._state==="running"&&(r._state="ready")}function cu(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}],Ho(function(){return cy(r)});return}Wp(r,e,t)}}var uy=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new ly(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"&&(lu(this),zp(this))},pu(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),ly=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){cu(this._subscription,"next",n)},e.error=function(n){cu(this._subscription,"error",n)},e.complete=function(){cu(this._subscription,"complete")},pu(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ne=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 uy(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=xa(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=xa(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=xa(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{u=n(u,d)}catch(p){return l.error(p)}else u=d},error:function(d){l.error(d)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(u),l.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=xa(this);return new s(function(c){var u,l=0;function d(f){u=f.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){l===a.length?(u=void 0,c.complete()):d(s.from(a[l++]))}})}return d(n),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=xa(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(f){return o.error(f)}var d=a.from(l).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),u()}});s.push(d)},error:function(l){o.error(l)},complete:function(){u()}});function u(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),c.unsubscribe()}})},e[uu]=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=Go(n,uu);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return sy(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(fu("iterator")&&(a=Go(n,oy),a))return new i(function(s){Ho(function(){if(!s.closed){for(var c=iy(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){Ho(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){Ho(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},pu(r,null,[{key:Qp,get:function(){return this}}]),r}();du()&&Object.defineProperty(ne,Symbol("extensions"),{value:{symbol:uu,hostReportError:Ei},configurable:!0});function mu(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 xi;typeof self<"u"?xi=self:typeof window<"u"?xi=window:typeof global<"u"?xi=global:typeof module<"u"?xi=module:xi=Function("return this")();var C1=mu(xi);var Hp=ne.prototype,Gp="@@observable";Hp[Gp]||(Hp[Gp]=function(){return this});var py=Object.prototype.toString;function Ko(r){return gu(r)}function gu(r,e){switch(py.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]=gu(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]=gu(r[i],e)}),n}default:return r}}function dy(r){var e=new Set([r]);return e.forEach(function(t){ue(t)&&fy(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){ue(t[n])&&e.add(t[n])})}),r}function fy(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Aa(r){return __DEV__&&dy(r),r}function Tn(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function Jo(r,e,t){return new ne(function(n){var i=n.next,a=n.error,o=n.complete,s=0,c=!1,u={then:function(p){return new Promise(function(m){return m(p())})}};function l(p,m){return p?function(h){++s;var g=function(){return p(h)};u=u.then(g,g).then(function(b){--s,i&&i.call(n,b),c&&d.complete()},function(b){throw--s,b}).catch(function(b){a&&a.call(n,b)})}:function(h){return m&&m.call(n,h)}}var d={next:l(e,i),error:l(t,a),complete:function(){c=!0,s||o&&o.call(n)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var Ft=typeof WeakMap=="function"&&ze(function(){return navigator.product})!=="ReactNative",Kp=typeof WeakSet=="function",yu=typeof Symbol=="function"&&typeof Symbol.for=="function",qr=yu&&Symbol.asyncIterator,V1=typeof ze(function(){return window.document.createElement})=="function",Q1=ze(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Zo(r){function e(t){Object.defineProperty(r,t,{value:ne})}return yu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Jp(r){return r&&typeof r.then=="function"}var Ai=function(r){$e(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),Tn(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),Tn(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?Jp(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"),Tn(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 ne(t)]),Jp(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}(ne);Zo(Ai);function Br(r){return"incremental"in r}function hy(r){return"hasNext"in r&&"data"in r}function Zp(r){return Br(r)||hy(r)}function Yo(r,e){var t=r,n=new gt;return Br(e)&&Ue(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 ki(r){var e=Xo(r);return Ue(e)}function Xo(r){var e=Ue(r.errors)?r.errors.slice(0):[];return Br(r)&&Ue(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Vr(){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 Yp=new Map;function ka(r){var e=Yp.get(r)||1;return Yp.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Xp(r){var e=ka("stringifyForDisplay");return JSON.stringify(r,function(t,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Ia(r,e){return Vr(r,e,e.variables&&{variables:E(E({},r&&r.variables),e.variables)})}function es(r){return new ne(function(e){e.error(r)})}var Ta=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 vu(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 J("illegal argument: ".concat(i)):new J(27)}return r}function bu(r,e){var t=E({},r),n=function(a){typeof a=="function"?t=E(E({},t),a(t)):t=E(E({},t),a)},i=function(){return E({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:n}),Object.defineProperty(e,"getContext",{enumerable:!1,value:i}),e}function wu(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?_i(e.query)||void 0:""),e}function ed(r,e){return e?e(r):ne.of()}function Oa(r){return typeof r=="function"?new Mt(r):r}function ts(r){return r.request.length<=1}var my=function(r){$e(e,r);function e(t,n){var i=r.call(this,t)||this;return i.link=n,i}return e}(Error),Mt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return ne.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Oa).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=Oa(t),a=Oa(n||new r(ed));return ts(i)&&ts(a)?new r(function(o){return e(o)?i.request(o)||ne.of():a.request(o)||ne.of()}):new r(function(o,s){return e(o)?i.request(o,s)||ne.of():a.request(o,s)||ne.of()})},r.execute=function(e,t){return e.request(bu(t.context,wu(vu(t))))||ne.of()},r.concat=function(e,t){var n=Oa(e);if(ts(n))return __DEV__&&L.warn(new my("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Oa(t);return ts(i)?new r(function(a){return n.request(a,function(o){return i.request(o)||ne.of()})||ne.of()}):new r(function(a,o){return n.request(a,function(s){return i.request(s,o)||ne.of()})||ne.of()})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(ed)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new J("request is not implemented"):new J(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 Ii=Mt.execute;var td="3.7.10";function rd(r){return!!r.body}function nd(r){return!!r.getReader}function id(r){return!!(qr&&r[Symbol.asyncIterator])}function ad(r){return!!r.stream}function od(r){return!!r.arrayBuffer}function sd(r){return!!r.pipe}function Su(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function _u(r){var e=null,t=null,n=!1,i=[],a=[];function o(d){if(!t){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}i.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){n=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(d,f){if(t)return f(t);if(i.length)return d({value:i.shift(),done:!1});if(n)return d({value:void 0,done:!0});a.push([d,f])})}var l={next:function(){return u()}};return qr&&(l[Symbol.asyncIterator]=function(){return this}),l}function Eu(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 qr&&(t[Symbol.asyncIterator]=function(){return this}),t}function rs(r){var e={next:function(){return r.read()}};return qr&&(e[Symbol.asyncIterator]=function(){return this}),e}function cd(r){var e=r;if(rd(r)&&(e=r.body),id(e))return Su(e);if(nd(e))return rs(e.getReader());if(ad(e))return rs(e.stream().getReader());if(od(e))return Eu(e.arrayBuffer());if(sd(e))return _u(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var ud=Object.prototype.hasOwnProperty;function ld(r,e){var t,n,i;return zt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,m,h,g,b,v,w,y,k,C,I,D;return Wt(this,function(P){switch(P.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=cd(r),f=!0,P.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=P.sent(),m=p.value,h=p.done,g=typeof m=="string"?m:a.decode(m),f=!h,l+=g,b=l.indexOf(u);b>-1;){if(v=void 0,D=[l.slice(0,b),l.slice(b+u.length)],v=D[0],l=D[1],v.trim()){if(w=v.indexOf(`\r
21
+ }`)}function Ne(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function Jo(r){return Ne(" ",r.replace(/\n/g,`
22
+ `))}function Ug(r){return r.indexOf(`
23
+ `)!==-1}function jp(r){return r!=null&&r.some(Ug)}function wa(r){return r.kind===Ue.FIELD||r.kind===Ue.FRAGMENT_SPREAD||r.kind===Ue.INLINE_FRAGMENT}function qp(){return typeof Ko=="function"?Zc():Zc()}function Kg(){__DEV__?P(typeof bn=="boolean",bn):P(typeof bn=="boolean",39)}qp();Kg();function xr(r,e){var t=r.directives;return!t||!t.length?!0:Bp(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__?P(o!==void 0,"Invalid variable referenced in @".concat(i.name.value," directive.")):P(o!==void 0,40)):o=a.value.value,i.name.value==="skip"?!o:o})}function Si(r,e,t){var n=new Set(r),i=n.size;return it(e,{Directive:function(a){if(n.delete(a.name.value)&&(!t||!n.size))return wn}}),t?!n.size:n.size<i}function tu(r){return r&&Si(["client","export"],r,!0)}function Jg(r){var e=r.name.value;return e==="skip"||e==="include"}function Bp(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Jg(t)){var n=t.arguments,i=t.name.value;__DEV__?P(n&&n.length===1,"Incorrect number of arguments for the @".concat(i," directive.")):P(n&&n.length===1,41);var a=n[0];__DEV__?P(a.name&&a.name.value==="if","Invalid argument for the @".concat(i," directive.")):P(a.name&&a.name.value==="if",42);var o=a.value;__DEV__?P(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),"Argument for the @".concat(i," directive must be a variable or a boolean value.")):P(o&&(o.kind==="Variable"||o.kind==="BooleanValue"),43),e.push({directive:t,ifArgument:a})}}),e}function ru(r,e){var t=e,n=[];r.definitions.forEach(function(a){if(a.kind==="OperationDefinition")throw __DEV__?new Y("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 Y(44);a.kind==="FragmentDefinition"&&n.push(a)}),typeof t>"u"&&(__DEV__?P(n.length===1,"Found ".concat(n.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):P(n.length===1,45),t=n[0].name.value);var i=x(x({},r),{definitions:Mr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return i}function Sn(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function _n(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__?P(n,"No fragment named ".concat(t)):P(n,46),n||null}default:return null}}function le(r){return r!==null&&typeof r=="object"}function ar(r){return{__ref:String(r)}}function ie(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function nu(r){return le(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Zg(r){return r.kind==="StringValue"}function Yg(r){return r.kind==="BooleanValue"}function Xg(r){return r.kind==="IntValue"}function ey(r){return r.kind==="FloatValue"}function ty(r){return r.kind==="Variable"}function ry(r){return r.kind==="ObjectValue"}function ny(r){return r.kind==="ListValue"}function iy(r){return r.kind==="EnumValue"}function ay(r){return r.kind==="NullValue"}function jr(r,e,t,n){if(Xg(t)||ey(t))r[e.value]=Number(t.value);else if(Yg(t)||Zg(t))r[e.value]=t.value;else if(ry(t)){var i={};t.fields.map(function(o){return jr(i,o.name,o.value,n)}),r[e.value]=i}else if(ty(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(ny(t))r[e.value]=t.values.map(function(o){var s={};return jr(s,e,o,n),s[e.value]});else if(iy(t))r[e.value]=t.value;else if(ay(t))r[e.value]=null;else throw __DEV__?new Y('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 Y(55)}function iu(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 jr(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 jr(n,a,o,e)})),_a(r.name.value,n,t)}var oy=["connection","include","skip","client","rest","export"],_a=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(Sa(i),")")}else return t.connection.key;var a=r;if(e){var o=Sa(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){oy.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(Sa(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=Sa;return Sa=r,e}}),Sa=function(e){return JSON.stringify(e,sy)};function sy(r,e){return le(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})),e}function kr(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(n){var i=n.name,a=n.value;return jr(t,i,a,e)}),t}return null}function Mt(r){return r.alias?r.alias.value:r.name.value}function Ea(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(It(a)){if(a.name.value==="__typename")return r[Mt(a)]}else{var o=Ea(r,_n(a,t).selectionSet,t);if(typeof o=="string")return o}}}function It(r){return r.kind==="Field"}function au(r){return r.kind==="InlineFragment"}function _i(r){__DEV__?P(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'):P(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 Y('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new Y(48);return t});return __DEV__?P(e.length<=1,"Ambiguous GraphQL document: contains ".concat(e.length," operations")):P(e.length<=1,49),r}function or(r){return _i(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 En(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function xa(r){var e=or(r);return __DEV__?P(e&&e.operation==="query","Must contain a query definition."):P(e&&e.operation==="query",50),e}function ou(r){__DEV__?P(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'):P(r.kind==="Document",51),__DEV__?P(r.definitions.length<=1,"Fragment must have exactly one definition."):P(r.definitions.length<=1,52);var e=r.definitions[0];return __DEV__?P(e.kind==="FragmentDefinition","Must be a fragment definition."):P(e.kind==="FragmentDefinition",53),e}function xn(r){_i(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 Y("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new Y(54)}function kn(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(n){n.defaultValue&&jr(e,n.variable.name,n.defaultValue)}),e}var ve=Array.isArray;function qe(r){return Array.isArray(r)&&r.length>0}var Vp={kind:Ue.FIELD,name:{kind:Ue.NAME,value:"__typename"}};function zp(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Ue.FRAGMENT_SPREAD&&zp(e[t.name.value],e)})}function cy(r){return zp(or(r)||ou(r),Sn(En(r)))?null:r}function uy(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 Qp(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 su(r,e){for(var t=Qp(""),n=Qp(""),i=function(y){for(var b=0,g=void 0;b<y.length&&(g=y[b]);++b)if(!ve(g)){if(g.kind===Ue.OPERATION_DEFINITION)return t(g.name&&g.name.value);if(g.kind===Ue.FRAGMENT_DEFINITION)return n(g.name.value)}return __DEV__&&P.error("Could not find operation or fragment"),null},a=0,o=e.definitions.length-1;o>=0;--o)e.definitions[o].kind===Ue.OPERATION_DEFINITION&&++a;var s=uy(r),c=r.some(function(y){return y.remove}),u=function(y){return c&&y&&y.some(s)},l=new Map,d=!1,f={enter:function(y){if(u(y.directives))return d=!0,null}},p=it(e,{Field:f,InlineFragment:f,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(y,b,g,T,N){var A=i(N);A&&A.variables.add(y.name.value)}},FragmentSpread:{enter:function(y,b,g,T,N){if(u(y.directives))return d=!0,null;var A=i(N);A&&A.fragmentSpreads.add(y.name.value)}},FragmentDefinition:{enter:function(y,b,g,T){l.set(JSON.stringify(T),y)},leave:function(y,b,g,T){var N=l.get(JSON.stringify(T));if(y===N)return y;if(a>0&&y.selectionSet.selections.every(function(A){return A.kind===Ue.FIELD&&A.name.value==="__typename"}))return n(y.name.value).removed=!0,d=!0,null}},Directive:{leave:function(y){if(s(y))return d=!0,null}}});if(!d)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;p.definitions.forEach(function(y){y.kind===Ue.OPERATION_DEFINITION?h(t(y.name&&y.name.value)).fragmentSpreads.forEach(function(b){m.add(b)}):y.kind===Ue.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 cy(it(p,{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 An=Object.assign(function(r){return it(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Ue.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return It(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=n;if(!(It(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return x(x({},e),{selections:Mr(Mr([],i,!0),[Vp],!1)})}}}}}})},{added:function(r){return r===Vp}}),ly={test:function(r){var e=r.name.value==="connection";return e&&(!r.arguments||!r.arguments.some(function(t){return t.name.value==="key"}))&&__DEV__&&P.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 cu(r){return su([ly],_i(r))}function uu(r){var e=xn(r),t=e.operation;if(t==="query")return r;var n=it(r,{OperationDefinition:{enter:function(i){return x(x({},i),{operation:"query"})}}});return n}function lu(r){_i(r);var e=su([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var py=Object.prototype.hasOwnProperty;function pu(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return ka(r)}function ka(r){var e=r[0]||{},t=r.length;if(t>1)for(var n=new vt,i=1;i<t;++i)e=n.merge(e,r[i]);return e}var dy=function(r,e,t){return this.merge(r[t],e[t])},vt=function(){function r(e){e===void 0&&(e=dy),this.reconciler=e,this.isObject=le,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 le(t)&&le(e)?(Object.keys(t).forEach(function(o){if(py.call(e,o)){var s=e[o];if(t[o]!==s){var c=n.reconciler.apply(n,Mr([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 le(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 fy(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=hy(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 hy(r,e){if(!!r){if(typeof r=="string")return Hp(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 Hp(r,e)}}function Hp(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 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 mu(r,e,t){return e&&Wp(r.prototype,e),t&&Wp(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var gu=function(){return typeof Symbol=="function"},yu=function(r){return gu()&&Boolean(Symbol[r])},vu=function(r){return yu(r)?Symbol[r]:"@@"+r};gu()&&!yu("observable")&&(Symbol.observable=Symbol("observable"));var my=vu("iterator"),fu=vu("observable"),Gp=vu("species");function Yo(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Aa(r){var e=r.constructor;return e!==void 0&&(e=e[Gp],e===null&&(e=void 0)),e!==void 0?e:ne}function gy(r){return r instanceof ne}function xi(r){xi.log?xi.log(r):setTimeout(function(){throw r})}function Zo(r){Promise.resolve().then(function(){try{r()}catch(e){xi(e)}})}function Kp(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Yo(e,"unsubscribe");t&&t.call(e)}}catch(n){xi(n)}}function hu(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function yy(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Jp(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Jp(r,e,t){r._state="running";var n=r._observer;try{var i=Yo(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(hu(r),i)i.call(n,t);else throw t;break;case"complete":hu(r),i&&i.call(n);break}}catch(a){xi(a)}r._state==="closed"?Kp(r):r._state==="running"&&(r._state="ready")}function du(r,e,t){if(r._state!=="closed"){if(r._state==="buffering"){r._queue.push({type:e,value:t});return}if(r._state!=="ready"){r._state="buffering",r._queue=[{type:e,value:t}],Zo(function(){return yy(r)});return}Jp(r,e,t)}}var vy=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new by(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"&&(hu(this),Kp(this))},mu(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),by=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){du(this._subscription,"next",n)},e.error=function(n){du(this._subscription,"error",n)},e.complete=function(){du(this._subscription,"complete")},mu(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),ne=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 vy(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=Aa(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=Aa(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=Aa(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(d){var f=!s;if(s=!0,!f||o)try{u=n(u,d)}catch(p){return l.error(p)}else u=d},error:function(d){l.error(d)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(u),l.complete()}})})},e.concat=function(){for(var n=this,i=arguments.length,a=new Array(i),o=0;o<i;o++)a[o]=arguments[o];var s=Aa(this);return new s(function(c){var u,l=0;function d(f){u=f.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){l===a.length?(u=void 0,c.complete()):d(s.from(a[l++]))}})}return d(n),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(n){var i=this;if(typeof n!="function")throw new TypeError(n+" is not a function");var a=Aa(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(f){return o.error(f)}var d=a.from(l).subscribe({next:function(f){o.next(f)},error:function(f){o.error(f)},complete:function(){var f=s.indexOf(d);f>=0&&s.splice(f,1),u()}});s.push(d)},error:function(l){o.error(l)},complete:function(){u()}});function u(){c.closed&&s.length===0&&o.complete()}return function(){s.forEach(function(l){return l.unsubscribe()}),c.unsubscribe()}})},e[fu]=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=Yo(n,fu);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return gy(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(yu("iterator")&&(a=Yo(n,my),a))return new i(function(s){Zo(function(){if(!s.closed){for(var c=fy(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){Zo(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){Zo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},mu(r,null,[{key:Gp,get:function(){return this}}]),r}();gu()&&Object.defineProperty(ne,Symbol("extensions"),{value:{symbol:fu,hostReportError:xi},configurable:!0});function bu(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 ki;typeof self<"u"?ki=self:typeof window<"u"?ki=window:typeof global<"u"?ki=global:typeof module<"u"?ki=module:ki=Function("return this")();var G1=bu(ki);var Zp=ne.prototype,Yp="@@observable";Zp[Yp]||(Zp[Yp]=function(){return this});var wy=Object.prototype.toString;function Xo(r){return wu(r)}function wu(r,e){switch(wy.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]=wu(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]=wu(r[i],e)}),n}default:return r}}function Sy(r){var e=new Set([r]);return e.forEach(function(t){le(t)&&_y(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){le(t[n])&&e.add(t[n])})}),r}function _y(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function Ia(r){return __DEV__&&Sy(r),r}function In(r,e,t){var n=[];r.forEach(function(i){return i[e]&&n.push(i)}),n.forEach(function(i){return i[e](t)})}function es(r,e,t){return new ne(function(n){var i=n.next,a=n.error,o=n.complete,s=0,c=!1,u={then:function(p){return new Promise(function(h){return h(p())})}};function l(p,h){return p?function(m){++s;var v=function(){return p(m)};u=u.then(v,v).then(function(_){--s,i&&i.call(n,_),c&&d.complete()},function(_){throw--s,_}).catch(function(_){a&&a.call(n,_)})}:function(m){return h&&h.call(n,m)}}var d={next:l(e,i),error:l(t,a),complete:function(){c=!0,s||o&&o.call(n)}},f=r.subscribe(d);return function(){return f.unsubscribe()}})}var Ut=typeof WeakMap=="function"&&He(function(){return navigator.product})!=="ReactNative",Xp=typeof WeakSet=="function",Su=typeof Symbol=="function"&&typeof Symbol.for=="function",qr=Su&&Symbol.asyncIterator,sE=typeof He(function(){return window.document.createElement})=="function",cE=He(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function ts(r){function e(t){Object.defineProperty(r,t,{value:ne})}return Su&&Symbol.species&&e(Symbol.species),e("@@species"),r}function ed(r){return r&&typeof r.then=="function"}var Ai=function(r){De(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),In(n.observers,"next",i))},error:function(i){var a=n.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),n.sub=null,n.latest=["error",i],n.reject(i),n.notify("error",i),In(n.observers,"error",i))},complete:function(){var i=n,a=i.sub,o=i.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?ed(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"),In(n.observers,"complete"))}}},n.nextResultListeners=new Set,n.cancel=function(i){n.reject(i),n.sources=[],n.handlers.complete()},n.promise.catch(function(i){}),typeof t=="function"&&(t=[new ne(t)]),ed(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}(ne);ts(Ai);function Br(r){return"incremental"in r}function Ey(r){return"hasNext"in r&&"data"in r}function td(r){return Br(r)||Ey(r)}function rs(r,e){var t=r,n=new vt;return Br(e)&&qe(e.incremental)&&e.incremental.forEach(function(i){for(var a=i.data,o=i.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}t=n.merge(t,a)}),t}function Ii(r){var e=ns(r);return qe(e)}function ns(r){var e=qe(r.errors)?r.errors.slice(0):[];return Br(r)&&qe(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function Vr(){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 rd=new Map;function Ta(r){var e=rd.get(r)||1;return rd.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function nd(r){var e=Ta("stringifyForDisplay");return JSON.stringify(r,function(t,n){return n===void 0?e:n}).split(JSON.stringify(e)).join("<undefined>")}function Oa(r,e){return Vr(r,e,e.variables&&{variables:x(x({},r&&r.variables),e.variables)})}function is(r){return new ne(function(e){e.error(r)})}var Ca=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 _u(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 Y("illegal argument: ".concat(i)):new Y(27)}return r}function Eu(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 xu(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 id(r,e){return e?e(r):ne.of()}function Na(r){return typeof r=="function"?new jt(r):r}function as(r){return r.request.length<=1}var xy=function(r){De(e,r);function e(t,n){var i=r.call(this,t)||this;return i.link=n,i}return e}(Error),jt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return ne.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Na).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=Na(t),a=Na(n||new r(id));return as(i)&&as(a)?new r(function(o){return e(o)?i.request(o)||ne.of():a.request(o)||ne.of()}):new r(function(o,s){return e(o)?i.request(o,s)||ne.of():a.request(o,s)||ne.of()})},r.execute=function(e,t){return e.request(Eu(t.context,xu(_u(t))))||ne.of()},r.concat=function(e,t){var n=Na(e);if(as(n))return __DEV__&&P.warn(new xy("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Na(t);return as(i)?new r(function(a){return n.request(a,function(o){return i.request(o)||ne.of()})||ne.of()}):new r(function(a,o){return n.request(a,function(s){return i.request(s,o)||ne.of()})||ne.of()})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(id)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new Y("request is not implemented"):new Y(22)},r.prototype.onError=function(e,t){if(t&&t.error)return t.error(e),!1;throw e},r.prototype.setOnError=function(e){return this.onError=e,this},r}();var Ti=jt.execute;var ad="3.7.10";function od(r){return!!r.body}function sd(r){return!!r.getReader}function cd(r){return!!(qr&&r[Symbol.asyncIterator])}function ud(r){return!!r.stream}function ld(r){return!!r.arrayBuffer}function pd(r){return!!r.pipe}function ku(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Au(r){var e=null,t=null,n=!1,i=[],a=[];function o(d){if(!t){if(a.length){var f=a.shift();if(Array.isArray(f)&&f[0])return f[0]({value:d,done:!1})}i.push(d)}}function s(d){t=d;var f=a.slice();f.forEach(function(p){p[1](d)}),!e||e()}function c(){n=!0;var d=a.slice();d.forEach(function(f){f[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(d,f){if(t)return f(t);if(i.length)return d({value:i.shift(),done:!1});if(n)return d({value:void 0,done:!0});a.push([d,f])})}var l={next:function(){return u()}};return qr&&(l[Symbol.asyncIterator]=function(){return this}),l}function Iu(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 qr&&(t[Symbol.asyncIterator]=function(){return this}),t}function os(r){var e={next:function(){return r.read()}};return qr&&(e[Symbol.asyncIterator]=function(){return this}),e}function dd(r){var e=r;if(od(r)&&(e=r.body),cd(e))return ku(e);if(sd(e))return os(e.getReader());if(ud(e))return os(e.stream().getReader());if(ld(e))return Iu(e.arrayBuffer());if(pd(e))return Au(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var fd=Object.prototype.hasOwnProperty;function hd(r,e){var t,n,i;return Wt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h,m,v,_,y,b,g,T,N,A,D;return Gt(this,function(L){switch(L.label){case 0:if(TextDecoder===void 0)throw new Error("TextDecoder must be defined in the environment: please import a polyfill.");a=new TextDecoder("utf-8"),o=(t=r.headers)===null||t===void 0?void 0:t.get("content-type"),s="boundary=",c=o?.includes(s)?o?.substring(o?.indexOf(s)+s.length).replace(/['"]/g,"").replace(/\;(.*)/gm,"").trim():"-",u="--".concat(c),l="",d=dd(r),f=!0,L.label=1;case 1:return f?[4,d.next()]:[3,3];case 2:for(p=L.sent(),h=p.value,m=p.done,v=typeof h=="string"?h:a.decode(h),f=!m,l+=v,_=l.indexOf(u);_>-1;){if(y=void 0,D=[l.slice(0,_),l.slice(_+u.length)],y=D[0],l=D[1],y.trim()){if(b=y.indexOf(`\r
25
25
  \r
26
- `),y=gy(v.slice(0,w)),k=y["content-type"],k&&k.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");C=v.slice(w);try{I=pd(r,C.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(R){ns(R,e)}}b=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function gy(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 pd(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Ta(r,t(),"Response not successful: Received status code ".concat(r.status))}try{return JSON.parse(e)}catch(i){var n=i;throw n.name="ServerParseError",n.response=r,n.statusCode=r.status,n.bodyText=e,n}}function ns(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 dd(r,e,t){yy(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 ns(n,t)})}function yy(r){return function(e){return e.text().then(function(t){return pd(e,t)}).then(function(t){return e.status>=300&&Ta(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!ud.call(t,"data")&&!ud.call(t,"errors")&&Ta(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Ca=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=__DEV__?new J("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new J(24);throw n.parseError=i,n}return t};var vy={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},by={accept:"*/*","content-type":"application/json"},wy={method:"POST"},fd={http:vy,headers:by,options:wy},hd=function(r,e){return e(r)};function md(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(d){i=E(E(E({},i),d.options),{headers:E(E({},i.headers),d.headers)}),d.credentials&&(i.credentials=d.credentials),a=E(E({},a),d.http)}),i.headers&&(i.headers=Sy(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,bi)),{options:i,body:l}}function Sy(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 gd=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new J(`
26
+ `),g=ky(y.slice(0,b)),T=g["content-type"],T&&T.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");N=y.slice(b);try{A=md(r,N.replace(`\r
27
+ `,"")),(Object.keys(A).length>1||"data"in A||"incremental"in A||"errors"in A)&&((n=e.next)===null||n===void 0||n.call(e,A))}catch(R){ss(R,e)}}_=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function ky(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 md(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Ca(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 ss(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 gd(r,e,t){Ay(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 ss(n,t)})}function Ay(r){return function(e){return e.text().then(function(t){return md(e,t)}).then(function(t){return e.status>=300&&Ca(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!fd.call(t,"data")&&!fd.call(t,"errors")&&Ca(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var $a=function(r,e){var t;try{t=JSON.stringify(r)}catch(i){var n=__DEV__?new Y("Network request failed. ".concat(e," is not serializable: ").concat(i.message)):new Y(24);throw n.parseError=i,n}return t};var Iy={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},Ty={accept:"*/*","content-type":"application/json"},Oy={method:"POST"},yd={http:Iy,headers:Ty,options:Oy},vd=function(r,e){return e(r)};function bd(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(d){i=x(x(x({},i),d.options),{headers:x(x({},i.headers),d.headers)}),d.credentials&&(i.credentials=d.credentials),a=x(x({},a),d.http)}),i.headers&&(i.headers=Cy(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,wi)),{options:i,body:l}}function Cy(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 wd=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new Y(`
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 J(23)};var yd=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var vd=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function bd(r,e){var t=[],n=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Ca(e.variables,"Variables map")}catch(d){return{parseError:d}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Ca(e.extensions,"Extensions map")}catch(d){return{parseError:d}}n("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+t.join("&")+o;return{newURI:l}}var wd=ze(function(){return fetch}),Sd=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?hd:i,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,d=ir(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&gd(n||wd);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new Mt(function(p){var m=vd(p,t),h=p.getContext(),g={};if(h.clientAwareness){var b=h.clientAwareness,v=b.name,w=b.version;v&&(g["apollographql-client-name"]=v),w&&(g["apollographql-client-version"]=w)}var y=E(E({},g),h.headers),k={http:h.http,options:h.fetchOptions,credentials:h.credentials,headers:y},C=md(p,a,fd,f,k),I=C.options,D=C.body;if(D.variables&&!l){var P=new Set(Object.keys(D.variables));nt(p.query,{Variable:function(ce,rr,re){re&&re.kind!=="VariableDefinition"&&P.delete(ce.name.value)}}),P.size&&(D.variables=E({},D.variables),P.forEach(function(ce){delete D.variables[ce]}))}var R;if(!I.signal){var j=yd(),xe=j.controller,Oe=j.signal;R=xe,R&&(I.signal=Oe)}var A=function(ce){return ce.kind==="OperationDefinition"&&ce.operation==="mutation"};if(c&&!p.query.definitions.some(A)&&(I.method="GET"),wi(["defer"],p.query)&&(I.headers=I.headers||{},I.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),I.method==="GET"){var be=bd(m,D),we=be.newURI,se=be.parseError;if(se)return es(se);m=we}else try{I.body=Ca(D,"Payload")}catch(ce){return es(ce)}return new ne(function(ce){var rr=n||ze(function(){return fetch})||wd;return rr(m,I).then(function(re){var nr;p.setContext({response:re});var Fr=(nr=re.headers)===null||nr===void 0?void 0:nr.get("content-type");return Fr!==null&&/^multipart\/mixed/i.test(Fr)?ld(re,ce):dd(re,p,ce)}).catch(function(re){return ns(re,ce)}),function(){R&&R.abort()}})})};var xu=function(r){$e(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,Sd(t).request)||this;return n.options=t,n}return e}(Mt);var{toString:_d,hasOwnProperty:_y}=Object.prototype,Ed=Function.prototype.toString,Au=new Map;function Ae(r,e){try{return ku(r,e)}finally{Au.clear()}}function ku(r,e){if(r===e)return!0;let t=_d.call(r),n=_d.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Ad(r,e))return!0;let i=xd(r),a=xd(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!_y.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!ku(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(Ad(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&&!ku(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=Ed.call(r);return i!==Ed.call(e)?!1:!Ay(i,xy)}}return!1}function xd(r){return Object.keys(r).filter(Ey,r)}function Ey(r){return this[r]!==void 0}var xy="{ [native code] }";function Ay(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Ad(r,e){let t=Au.get(r);if(t){if(t.has(e))return!0}else Au.set(r,t=new Set);return t.add(e),!1}var ky=function(){return Object.create(null)},kd=Array.prototype,Iy=kd.forEach,Ty=kd.slice,sr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=ky),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 Iy.call(e,function(n){return t=t.getChildTrie(n)}),t.data||(t.data=this.makeData(Ty.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Oy(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 Oy(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Ye=null,Id={},Cy=1,Ny=()=>class{constructor(){this.id=["slot",Cy++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Ye;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===Id)break;return e!==Ye&&(Ye.slots[this.id]=t),!0}return Ye&&(Ye.slots[this.id]=Id),!1}getValue(){if(this.hasValue())return Ye.slots[this.id]}withValue(e,t,n,i){let a={__proto__:null,[this.id]:e},o=Ye;Ye={parent:o,slots:a};try{return t.apply(i,n)}finally{Ye=o}}static bind(e){let t=Ye;return function(){let n=Ye;try{return Ye=t,e.apply(this,arguments)}finally{Ye=n}}}static noContext(e,t,n){if(Ye){let i=Ye;try{return Ye=null,e.apply(n,t)}finally{Ye=i}}else return e.apply(n,t)}};function Td(r){try{return r()}catch{}}var Iu="@wry/context:Slot",$y=Td(()=>globalThis)||Td(()=>global)||Object.create(null),Od=$y,Ti=Od[Iu]||Array[Iu]||function(r){try{Object.defineProperty(Od,Iu,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(Ny());var{bind:Dy,noContext:Ry}=Ti;function Ly(){}var Py=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=Ly),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}(),as=new Ti,Tu,Fy=Object.prototype.hasOwnProperty,Cu=(Tu=Array.from,Tu===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Tu);function is(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Na=[],My=100;function Oi(r,e){if(!r)throw new Error(e||"assertion failure")}function jy(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Nd(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Uy(r){return r.slice(0)}var qy=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&&!Qr(this))return Cd(this),this.value[0]},r.prototype.recompute=function(e){return Oi(!this.recomputing,"already recomputing"),Cd(this),Qr(this)?By(this,e):Nd(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,$d(this),is(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Fd(this),Nu(this,function(t,n){t.setDirty(),Md(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Na.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Cu(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Na.push(this.deps),this.deps=null)},r.count=0,r}();function Cd(r){var e=as.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Qr(r)?Rd(e,r):Ld(e,r),e}function By(r,e){return Fd(r),as.withValue(r,Vy,[r,e]),zy(r,e)&&Qy(r),Nd(r.value)}function Vy(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 Qr(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function Qy(r){r.dirty=!1,!Qr(r)&&Dd(r)}function $d(r){Nu(r,Rd)}function Dd(r){Nu(r,Ld)}function Nu(r,e){var t=r.parents.size;if(t)for(var n=Cu(r.parents),i=0;i<t;++i)e(n[i],r)}function Rd(r,e){Oi(r.childValues.has(e)),Oi(Qr(e));var t=!Qr(r);if(!r.dirtyChildren)r.dirtyChildren=Na.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&$d(r)}function Ld(r,e){Oi(r.childValues.has(e)),Oi(!Qr(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Uy(e.value)):jy(t,e.value)||r.setDirty(),Pd(r,e),!Qr(r)&&Dd(r)}function Pd(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Na.length<My&&Na.push(t),r.dirtyChildren=null))}function Fd(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Md(r,t)}),r.forgetDeps(),Oi(r.dirtyChildren===null)}function Md(r,e){e.parents.delete(r),r.childValues.delete(e),Pd(r,e)}function zy(r,e){if(typeof r.subscribe=="function")try{is(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var Wy={setDirty:!0,dispose:!0,forget:!0};function os(r){var e=new Map,t=r&&r.subscribe;function n(i){var a=as.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof t=="function"&&(is(o),o.unsubscribe=t(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Fy.call(Wy,o)?o:"setDirty";Cu(s).forEach(function(u){return u[c]()}),e.delete(a),is(s)}},n}function jd(){var r=new sr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var AA=jd(),Ou=new Set;function On(r,e){e===void 0&&(e=Object.create(null));var t=new Py(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||jd(),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 qy(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Ou.add(t),as.hasValue()||(Ou.forEach(function(f){return f.clean()}),Ou.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(u){var l=t.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(i.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var $u=function(){function r(){this.getFragmentDoc=On(Yc)}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(E(E({},e),{rootId:e.id||"ROOT_QUERY",optimistic:t}))},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(E(E({},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=ir(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=ir(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(E(E({},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(E(E({},e),{data:a})),a)}})},r}();var $a=function(r){$e(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 Da(r){return r==null}function cs(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Da(n)?Da(i)?void 0:{_id:i}:{id:n}),Da(n)&&!Da(i)&&(n=i),!Da(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Ud={dataIdFromObject:cs,addTypename:!0,resultCaching:!0,canonizeResults:!1};function qd(r){return Vr(Ud,r)}function us(r){var e=r.canonizeResults;return e===void 0?Ud.canonizeResults:e}function Bd(r,e){return ie(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Du=/^[_a-z][_0-9a-z]*/i;function Kt(r){var e=r.match(Du);return e?e[0]:r}function ss(r,e,t){return ue(e)?ve(e)?e.every(function(n){return ss(r,n,t)}):r.selections.every(function(n){if(xt(n)&&xr(n,t)){var i=Pt(n);return De.call(e,i)&&(!n.selectionSet||ss(n.selectionSet,e[i],t))}return!0}):!1}function zr(r){return ue(r)&&!ie(r)&&!ve(r)}function Vd(){return new gt}function ls(r,e){var t=_n(xn(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var ps=Object.create(null),Ru=function(){return ps},Qd=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 Aa(ie(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return ie(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return ar(i);if(ie(i))return i;var o=n.policies.identify(i)[0];if(o){var s=ar(o);return a&&n.merge(o,i),s}}}return r.prototype.toObject=function(){return E({},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 Wr)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 Wr)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;ie(e)&&(e=e.__ref),ie(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 gt(Gy).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=Kt(u);l!==u&&!n.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(n instanceof Wr)&&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:ps,INVALIDATE:Qd,isReference:ie,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return n.policies.readField(typeof u=="string"?{fieldName:u,from:l||ar(e)}:u,{store:n})}};if(Object.keys(i).forEach(function(u){var l=Kt(u),d=i[u];if(d!==void 0){var f=typeof t=="function"?t:t[u]||t[l];if(f){var p=f===Ru?ps:f(Aa(d),E(E({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));p===Qd?n.group.dirty(e,u):(p===ps&&(p=void 0),p!==d&&(a[u]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Wr?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]=Ru,i):Ru)}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 Wr&&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=ir(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 Wr?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 Wr;)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){ie(a)&&(t[a.__ref]=!0),ue(a)&&Object.keys(a).forEach(function(o){var s=a[o];ue(s)&&i.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var zd=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?os():null,this.keyMaker=new sr(Ft)},r.prototype.depend=function(e,t){if(this.d){this.d(Lu(e,t));var n=Kt(t);n!==t&&this.d(Lu(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Lu(e,t),t==="__exists"?"forget":"setDirty")},r}();function Lu(r,e){return e+"#"+r}function Pu(r,e){Cn(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){$e(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 zd(s))||this;return u.stump=new Hy(u),u.storageTrie=new sr(Ft),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 Wr=function(r){$e(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){Ae(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 E(E({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return De.call(this.data,t)?E(E({},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),Hy=function(r){$e(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new zd(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}(Wr);function Gy(r,e,t){var n=r[t],i=e[t];return Ae(n,i)?n:i}function Cn(r){return!!(r instanceof Ci&&r.group.caching)}function Ky(r){return ue(r)?ve(r)?r.slice(0):E({__proto__:Object.getPrototypeOf(r)},r):r}var ds=function(){function r(){this.known=new(Kp?WeakSet:Set),this.pool=new sr(Ft),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return ue(e)&&this.known.has(e)},r.prototype.pass=function(e){if(ue(e)){var t=Ky(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(ue(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),u.sorted.forEach(function(p,m){d[p]=c[l+m]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),n=this.pool.lookupArray(t);if(!n.keys){t.sort();var i=JSON.stringify(t);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:t,json:i})}return n.keys},r}();var At=Object.assign(function(r){if(ue(r)){Fu===void 0&&Wd();var e=Fu.admit(r),t=Mu.get(e);return t===void 0&&Mu.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:Wd}),Fu,Mu;function Wd(){Fu=new ds,Mu=new(Ft?WeakMap:Map)}function Hd(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Gd=function(){function r(e){var t=this;this.knownResults=new(Ft?WeakMap:Map),this.config=Vr(e,{addTypename:e.addTypename!==!1,canonizeResults:us(e)}),this.canon=e.canon||new ds,this.executeSelectionSet=On(function(n){var i,a=n.context.canonizeResults,o=Hd(n);o[3]=!a;var s=(i=t.executeSelectionSet).peek.apply(i,o);return s?a?E(E({},s),{result:t.canon.admit(s.result)}):s:(Pu(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Hd,makeCacheKey:function(n,i,a,o){if(Cn(a.store))return a.store.makeCacheKey(n,ie(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=On(function(n){return Pu(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(Cn(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new ds},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,d=this.config.cache.policies;o=E(E({},kn(_a(n))),o);var f=ar(a),p=this.executeSelectionSet({selectionSet:An(n).selectionSet,objectOrReference:f,enclosingRef:f,context:E({store:t,query:n,policies:d,variables:o,varString:At(o),canonizeResults:l},ls(n,this.config.fragments))}),m;if(p.missing&&(m=[new $a(Jy(p.missing),p.missing,n,o)],!c))throw m[0];return{result:p.result,complete:!m,missing:m}},r.prototype.isFresh=function(e,t,n,i){if(Cn(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(ie(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(i,"__typename"),d=[],f,p=new gt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function m(w,y){var k;return w.missing&&(f=p.merge(f,(k={},k[y]=w.missing,k))),w.result}var h=new Set(n.selections);h.forEach(function(w){var y,k;if(!!xr(w,s))if(xt(w)){var C=c.readField({fieldName:w.name.value,field:w,variables:o.variables,from:i},o),I=Pt(w);C===void 0?In.added(w)||(f=p.merge(f,(y={},y[I]="Can't find field '".concat(w.name.value,"' on ").concat(ie(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),y))):ve(C)?C=m(t.executeSubSelectedArray({field:w,array:C,enclosingRef:a,context:o}),I):w.selectionSet?C!=null&&(C=m(t.executeSelectionSet({selectionSet:w.selectionSet,objectOrReference:C,enclosingRef:ie(C)?C:a,context:o}),I)):o.canonizeResults&&(C=t.canon.pass(C)),C!==void 0&&d.push((k={},k[I]=C,k))}else{var D=En(w,o.lookupFragment);if(!D&&w.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(w.name.value)):new J(5);D&&c.fragmentMatches(D,l)&&D.selectionSet.selections.forEach(h.add,h)}});var g=Ea(d),b={result:g,missing:f},v=o.canonizeResults?this.canon.admit(b):Aa(b);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 gt;function u(l,d){var f;return l.missing&&(s=c.merge(s,(f={},f[d]=l.missing,f))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,d){return l===null?null:ve(l)?u(t.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?u(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:ie(l)?l:a,context:o}),d):(__DEV__&&Zy(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},r}();function Jy(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function Zy(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){ue(i)&&(__DEV__?L(!ie(i),"Missing selection set for object of type ".concat(Bd(r,i)," returned for query field ").concat(e.name.value)):L(!ie(i),6),Object.values(i).forEach(n.add,n))})}}var Ni=new Ti,Kd=new WeakMap;function Ra(r){var e=Kd.get(r);return e||Kd.set(r,e={vars:new Set,dep:os()}),e}function ju(r){Ra(r).vars.forEach(function(e){return e.forgetCache(r)})}function Jd(r){Ra(r).vars.forEach(function(e){return e.attachCache(r)})}function fs(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){Ra(c).dep.dirty(n),Yy(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=Ni.getValue();s&&(i(s),Ra(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),Ra(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function Yy(r){r.broadcastWatches&&r.broadcastWatches()}var Zd=Object.create(null);function Uu(r){var e=JSON.stringify(r);return Zd[e]||(Zd[e]=Object.create(null))}function qu(r){var e=Uu(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Vu(r,function(o){var s=$i(n.storeObject,o,i);return s===void 0&&t!==n.storeObject&&De.call(t,o[0])&&(s=$i(t,o,Xd)),__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 Bu(r){var e=Uu(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,o=n.fieldName,s=Vu(r,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(i&&Ue(i.directives)){var f=l.slice(1),p=i.directives.find(function(b){return b.name.value===f}),m=p&&Ar(p,a);return m&&$i(m,u.slice(1))}return}if(d==="$"){var h=l.slice(1);if(a&&De.call(a,h)){var g=u.slice(0);return g[0]=h,$i(a,g)}return}if(t)return $i(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Vu(r,e){var t=new gt;return Yd(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 Yd(r){var e=Uu(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){ve(i)?(Yd(i).forEach(function(o){return t.push(n.concat(o))}),n.length=0):(n.push(i),ve(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function Xd(r,e){return r[e]}function $i(r,e,t){return t=t||Xd,ef(e.reduce(function n(i,a){return ve(i)?i.map(function(o){return n(o,a)}):i&&t(i,a)},r))}function ef(r){return ue(r)?ve(r)?r.map(ef):Vu(Object.keys(r).sort(),function(e){return $i(r,e)}):r}wa.setStringify(At);function Qu(r){return r.args!==void 0?r.args:r.field?Ar(r.field,r.variables):null}var Xy=function(){},tf=function(r,e){return e.fieldName},rf=function(r,e,t){var n=t.mergeObjects;return n(r,e)},nf=function(r,e){return e},of=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=E({dataIdFromObject:cs},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=E(E({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=hs(arguments,o);return i.readField(f,{store:i.cache.data,variables:f.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(ve(d))l=qu(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,c=ir(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?rf:u===!1?nf:c.merge}s(i,t.merge),i.keyFn=a===!1?Xy:ve(a)?qu(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(c){var u=n.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var d=l.keyArgs,f=l.read,p=l.merge;u.keyFn=d===!1?tf:ve(d)?Bu(d):typeof d=="function"?d:u.keyFn,typeof f=="function"&&(u.read=f),s(u,p)}u.read&&u.merge&&(u.keyFn=u.keyFn||tf)})},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(Du);(!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=ir(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(m){var h=a.getSupertypeSet(m,!1);h&&h.size&&c.indexOf(h)<0&&c.push(h)},l=!!(n&&this.fuzzySubtypes.size),d=!1,f=0;f<c.length;++f){var p=c[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&L.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(u),l&&f===c.length-1&&ss(e.selectionSet,n,i)&&(l=!1,d=!0,this.fuzzySubtypes.forEach(function(m,h){var g=t.match(m);g&&g[0]===t&&u(h)}))}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=Qu(e);o;){var u=o(c,s);if(ve(u))o=Bu(u);else{a=u||n;break}}return a===void 0&&(a=e.field?eu(e.field,e.variables):wa(n,Qu(e))),a===!1?n:n===Kt(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=Kt(o),c=t.store.getFieldValue(n,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=af(this,n,e,t,t.store.getStorage(ie(n)?n.__ref:n,o));return Ni.withValue(this.cache,l,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var n=this.getFieldPolicy(e,t,!1);return n&&n.read},r.prototype.getMergeFunction=function(e,t,n){var i=this.getFieldPolicy(e,t,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},r.prototype.runMergeFunction=function(e,t,n,i,a){var o=n.field,s=n.typename,c=n.merge;return c===rf?sf(i.store)(e,t):c===nf?t:(i.overwrite&&(e=void 0),c(e,t,af(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},r}();function af(r,e,t,n,i){var a=r.getStoreFieldName(t),o=Kt(a),s=t.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:Qu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ie,toReference:u,storage:i,cache:r.cache,canRead:l,readField:function(){return r.readField(hs(arguments,e,s),n)},mergeObjects:sf(n.store)}}function hs(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=E({},n),De.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Xp(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function sf(r){return function(t,n){if(ve(t)||ve(n))throw __DEV__?new J("Cannot automatically merge arrays"):new J(4);if(ue(t)&&ue(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(ie(t)&&zr(n))return r.merge(t.__ref,n),t;if(zr(t)&&ie(n))return r.merge(t,n.__ref),n;if(zr(t)&&zr(n))return E(E({},t),n)}return n}}function zu(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:E(E({},r),{clientOnly:e,deferred:t})),i}var pf=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=or(i),l=Vd();s=E(E({},kn(u)),s);var d=E(E({store:e,written:Object.create(null),merge:function(p,m){return l.merge(p,m)},variables:s,varString:At(s)},ls(i,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:d});if(!ie(f))throw __DEV__?new J("Could not identify object ".concat(JSON.stringify(a))):new J(7);return d.incomingById.forEach(function(p,m){var h=p.storeObject,g=p.mergeTree,b=p.fieldNodeSet,v=ar(m);if(g&&g.map.size){var w=n.applyMerges(g,v,h,d);if(ie(w))return;h=w}if(__DEV__&&!d.overwrite){var y=Object.create(null);b.forEach(function(I){I.selectionSet&&(y[I.name.value]=!0)});var k=function(I){return y[Kt(I)]===!0},C=function(I){var D=g&&g.map.get(I);return Boolean(D&&D.info&&D.info.merge)};Object.keys(h).forEach(function(I){k(I)&&!C(I)&&ev(v,h,I,d.store)})}e.merge(m,h)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=n&&c.rootTypenamesById[n]||Sa(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var d=function(){var w=hs(arguments,u,o.variables);if(ie(w.from)){var y=o.incomingById.get(w.from.__ref);if(y){var k=c.readField(E(E({},w),{from:y.storeObject}),o);if(k!==void 0)return k}}return c.readField(w,o)},f=new Set;this.flattenFields(a,i,o,l).forEach(function(w,y){var k,C=Pt(y),I=i[C];if(f.add(y),I!==void 0){var D=c.getStoreFieldName({typename:l,fieldName:y.name.value,field:y,variables:w.variables}),P=cf(s,D),R=t.processFieldValue(I,y,y.selectionSet?zu(w,!1,!1):w,P),j=void 0;y.selectionSet&&(ie(R)||zr(R))&&(j=d("__typename",R));var xe=c.getMergeFunction(l,y.name.value,j);xe?P.info={field:y,typename:l,merge:xe}:uf(s,D),u=w.merge(u,(k={},k[D]=R,k))}else __DEV__&&!w.clientOnly&&!w.deferred&&!In.added(y)&&!c.getReadFunction(l,y.name.value)&&__DEV__&&L.error("Missing field '".concat(Pt(y),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var p=c.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:d}),m=p[0],h=p[1];n=n||m,h&&(u=o.merge(u,h))}catch(w){if(!n)throw w}if(typeof n=="string"){var g=ar(n),b=o.written[n]||(o.written[n]=[]);if(b.indexOf(a)>=0||(b.push(a),this.reader&&this.reader.isFresh(i,g,a,o)))return g;var v=o.incomingById.get(n);return v?(v.storeObject=o.merge(v.storeObject,u),v.mergeTree=Wu(v.mergeTree,s),f.forEach(function(w){return v.fieldNodeSet.add(w)})):o.incomingById.set(n,{storeObject:u,mergeTree:ms(s)?void 0:s,fieldNodeSet:f}),g}return u},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?__DEV__?Ko(e):e:ve(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,n,cf(i,s));return uf(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=Sa(t,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new sr(!1);return function c(u,l){var d=s.lookup(u,l.clientOnly,l.deferred);d.visited||(d.visited=!0,u.selections.forEach(function(f){if(!!xr(f,n.variables)){var p=l.clientOnly,m=l.deferred;if(!(p&&m)&&Ue(f.directives)&&f.directives.forEach(function(b){var v=b.name.value;if(v==="client"&&(p=!0),v==="defer"){var w=Ar(b,n.variables);(!w||w.if!==!1)&&(m=!0)}}),xt(f)){var h=a.get(f);h&&(p=p&&h.clientOnly,m=m&&h.deferred),a.set(f,zu(n,p,m))}else{var g=En(f,n.lookupFragment);if(!g&&f.kind===Me.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(f.name.value)):new J(8);g&&o.fragmentMatches(g,i,t,n.variables)&&c(g.selectionSet,zu(n,p,m))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var o,s=this;if(e.map.size&&!ie(n)){var c=!ve(n)&&(ie(t)||zr(t))?t:void 0,u=n;c&&!a&&(a=[ie(c)?c.__ref:c]);var l,d=function(f,p){return ve(f)?typeof p=="number"?f[p]:void 0:i.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var m=d(c,p),h=d(u,p);if(h!==void 0){a&&a.push(p);var g=s.applyMerges(f,m,h,i,a);g!==h&&(l=l||new Map,l.set(p,g)),a&&L(a.pop()===p)}}),l&&(n=ve(u)?u.slice(0):E({},u),l.forEach(function(f,p){n[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},r}();var df=[];function cf(r,e){var t=r.map;return t.has(e)||t.set(e,df.pop()||{map:new Map}),t.get(e)}function Wu(r,e){if(r===e||!e||ms(e))return r;if(!r||ms(r))return e;var t=r.info&&e.info?E(E({},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,Wu(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Wu(e.map.get(s),r.map.get(s)))})}return a}function ms(r){return!r||!(r.info||r.map.size)}function uf(r,e){var t=r.map,n=t.get(e);n&&ms(n)&&(df.push(n),t.delete(e))}var lf=new Set;function ev(r,e,t,n){var i=function(d){var f=n.getFieldValue(d,t);return typeof f=="object"&&f},a=i(r);if(!!a){var o=i(e);if(!!o&&!ie(a)&&!Ae(a,o)&&!Object.keys(a).every(function(d){return n.getFieldValue(o,d)!==void 0})){var s=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),c=Kt(t),u="".concat(s,".").concat(c);if(!lf.has(u)){lf.add(u);var l=[];!ve(a)&&!ve(o)&&[a,o].forEach(function(d){var f=n.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
36
+ `):new Y(23)};var Sd=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var _d=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function Ed(r,e){var t=[],n=function(d,f){t.push("".concat(d,"=").concat(encodeURIComponent(f)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=$a(e.variables,"Variables map")}catch(d){return{parseError:d}}n("variables",i)}if(e.extensions){var a=void 0;try{a=$a(e.extensions,"Extensions map")}catch(d){return{parseError:d}}n("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+t.join("&")+o;return{newURI:l}}var xd=He(function(){return fetch}),kd=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?vd:i,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,d=ir(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&wd(n||xd);var f={http:{includeExtensions:o,preserveHeaderCase:s},options:d.fetchOptions,credentials:d.credentials,headers:d.headers};return new jt(function(p){var h=_d(p,t),m=p.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),T={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:g},N=bd(p,a,yd,f,T),A=N.options,D=N.body;if(D.variables&&!l){var L=new Set(Object.keys(D.variables));it(p.query,{Variable:function(ue,rr,re){re&&re.kind!=="VariableDefinition"&&L.delete(ue.name.value)}}),L.size&&(D.variables=x({},D.variables),L.forEach(function(ue){delete D.variables[ue]}))}var R;if(!A.signal){var j=Sd(),Ae=j.controller,Ce=j.signal;R=Ae,R&&(A.signal=Ce)}var k=function(ue){return ue.kind==="OperationDefinition"&&ue.operation==="mutation"};if(c&&!p.query.definitions.some(k)&&(A.method="GET"),Si(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var we=Ed(h,D),Se=we.newURI,ce=we.parseError;if(ce)return is(ce);h=Se}else try{A.body=$a(D,"Payload")}catch(ue){return is(ue)}return new ne(function(ue){var rr=n||He(function(){return fetch})||xd;return rr(h,A).then(function(re){var nr;p.setContext({response:re});var Fr=(nr=re.headers)===null||nr===void 0?void 0:nr.get("content-type");return Fr!==null&&/^multipart\/mixed/i.test(Fr)?hd(re,ue):gd(re,p,ue)}).catch(function(re){return ss(re,ue)}),function(){R&&R.abort()}})})};var Tu=function(r){De(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,kd(t).request)||this;return n.options=t,n}return e}(jt);var{toString:Ad,hasOwnProperty:Ny}=Object.prototype,Id=Function.prototype.toString,Ou=new Map;function ke(r,e){try{return Cu(r,e)}finally{Ou.clear()}}function Cu(r,e){if(r===e)return!0;let t=Ad.call(r),n=Ad.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Od(r,e))return!0;let i=Td(r),a=Td(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!Ny.call(e,i[s]))return!1;for(let s=0;s<o;++s){let c=i[s];if(!Cu(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(Od(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&&!Cu(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=Id.call(r);return i!==Id.call(e)?!1:!Ry(i,Dy)}}return!1}function Td(r){return Object.keys(r).filter($y,r)}function $y(r){return this[r]!==void 0}var Dy="{ [native code] }";function Ry(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Od(r,e){let t=Ou.get(r);if(t){if(t.has(e))return!0}else Ou.set(r,t=new Set);return t.add(e),!1}var Py=function(){return Object.create(null)},Cd=Array.prototype,Ly=Cd.forEach,Fy=Cd.slice,sr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Py),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 Ly.call(e,function(n){return t=t.getChildTrie(n)}),t.data||(t.data=this.makeData(Fy.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&My(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 My(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Xe=null,Nd={},Uy=1,jy=()=>class{constructor(){this.id=["slot",Uy++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=Xe;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===Nd)break;return e!==Xe&&(Xe.slots[this.id]=t),!0}return Xe&&(Xe.slots[this.id]=Nd),!1}getValue(){if(this.hasValue())return Xe.slots[this.id]}withValue(e,t,n,i){let a={__proto__:null,[this.id]:e},o=Xe;Xe={parent:o,slots:a};try{return t.apply(i,n)}finally{Xe=o}}static bind(e){let t=Xe;return function(){let n=Xe;try{return Xe=t,e.apply(this,arguments)}finally{Xe=n}}}static noContext(e,t,n){if(Xe){let i=Xe;try{return Xe=null,e.apply(n,t)}finally{Xe=i}}else return e.apply(n,t)}};function $d(r){try{return r()}catch{}}var Nu="@wry/context:Slot",qy=$d(()=>globalThis)||$d(()=>global)||Object.create(null),Dd=qy,Oi=Dd[Nu]||Array[Nu]||function(r){try{Object.defineProperty(Dd,Nu,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(jy());var{bind:By,noContext:Vy}=Oi;function Qy(){}var zy=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=Qy),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}(),us=new Oi,$u,Hy=Object.prototype.hasOwnProperty,Ru=($u=Array.from,$u===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:$u);function cs(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Da=[],Wy=100;function Ci(r,e){if(!r)throw new Error(e||"assertion failure")}function Gy(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Pd(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Ky(r){return r.slice(0)}var Jy=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&&!Qr(this))return Rd(this),this.value[0]},r.prototype.recompute=function(e){return Ci(!this.recomputing,"already recomputing"),Rd(this),Qr(this)?Zy(this,e):Pd(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,Ld(this),cs(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),qd(this),Pu(this,function(t,n){t.setDirty(),Bd(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Da.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Ru(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Da.push(this.deps),this.deps=null)},r.count=0,r}();function Rd(r){var e=us.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Qr(r)?Md(e,r):Ud(e,r),e}function Zy(r,e){return qd(r),us.withValue(r,Yy,[r,e]),ev(r,e)&&Xy(r),Pd(r.value)}function Yy(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 Qr(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function Xy(r){r.dirty=!1,!Qr(r)&&Fd(r)}function Ld(r){Pu(r,Md)}function Fd(r){Pu(r,Ud)}function Pu(r,e){var t=r.parents.size;if(t)for(var n=Ru(r.parents),i=0;i<t;++i)e(n[i],r)}function Md(r,e){Ci(r.childValues.has(e)),Ci(Qr(e));var t=!Qr(r);if(!r.dirtyChildren)r.dirtyChildren=Da.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&Ld(r)}function Ud(r,e){Ci(r.childValues.has(e)),Ci(!Qr(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Ky(e.value)):Gy(t,e.value)||r.setDirty(),jd(r,e),!Qr(r)&&Fd(r)}function jd(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Da.length<Wy&&Da.push(t),r.dirtyChildren=null))}function qd(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Bd(r,t)}),r.forgetDeps(),Ci(r.dirtyChildren===null)}function Bd(r,e){e.parents.delete(r),r.childValues.delete(e),jd(r,e)}function ev(r,e){if(typeof r.subscribe=="function")try{cs(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var tv={setDirty:!0,dispose:!0,forget:!0};function ls(r){var e=new Map,t=r&&r.subscribe;function n(i){var a=us.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof t=="function"&&(cs(o),o.unsubscribe=t(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Hy.call(tv,o)?o:"setDirty";Ru(s).forEach(function(u){return u[c]()}),e.delete(a),cs(s)}},n}function Vd(){var r=new sr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var Vk=Vd(),Du=new Set;function Tn(r,e){e===void 0&&(e=Object.create(null));var t=new zy(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||Vd(),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 Jy(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var d=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Du.add(t),us.hasValue()||(Du.forEach(function(f){return f.clean()}),Du.clear()),d};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(u){var l=t.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(i.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(i.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(i.apply(null,arguments))},a.makeCacheKey=i,a.getKey=n?function(){return i.apply(null,n.apply(null,arguments))}:i,Object.freeze(a)}var Lu=function(){function r(){this.getFragmentDoc=Tn(ru)}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=ir(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=ir(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){De(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 Re=Object.prototype.hasOwnProperty;function Pa(r){return r==null}function ds(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Pa(n)?Pa(i)?void 0:{_id:i}:{id:n}),Pa(n)&&!Pa(i)&&(n=i),!Pa(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Qd={dataIdFromObject:ds,addTypename:!0,resultCaching:!0,canonizeResults:!1};function zd(r){return Vr(Qd,r)}function fs(r){var e=r.canonizeResults;return e===void 0?Qd.canonizeResults:e}function Hd(r,e){return ie(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Fu=/^[_a-z][_0-9a-z]*/i;function Zt(r){var e=r.match(Fu);return e?e[0]:r}function ps(r,e,t){return le(e)?ve(e)?e.every(function(n){return ps(r,n,t)}):r.selections.every(function(n){if(It(n)&&xr(n,t)){var i=Mt(n);return Re.call(e,i)&&(!n.selectionSet||ps(n.selectionSet,e[i],t))}return!0}):!1}function zr(r){return le(r)&&!ie(r)&&!ve(r)}function Wd(){return new vt}function hs(r,e){var t=Sn(En(r));return{fragmentMap:t,lookupFragment:function(n){var i=t[n];return!i&&e&&(i=e.lookup(n)),i||null}}}var ms=Object.create(null),Mu=function(){return ms},Gd=Object.create(null),Ni=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 Ia(ie(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return ie(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return ar(i);if(ie(i))return i;var o=n.policies.identify(i)[0];if(o){var s=ar(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),Re.call(this.data,e)){var n=this.data[e];if(n&&Re.call(n,t))return n[t]}if(t==="__typename"&&Re.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Hr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Re.call(this.data,e))return this.data[e];if(this instanceof Hr)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;ie(e)&&(e=e.__ref),ie(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__?P(typeof i=="string","store.merge expects a string ID"):P(typeof i=="string",1);var s=new vt(nv).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=Zt(u);l!==u&&!n.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(n instanceof Hr)&&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:ms,INVALIDATE:Gd,isReference:ie,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return n.policies.readField(typeof u=="string"?{fieldName:u,from:l||ar(e)}:u,{store:n})}};if(Object.keys(i).forEach(function(u){var l=Zt(u),d=i[u];if(d!==void 0){var f=typeof t=="function"?t:t[u]||t[l];if(f){var p=f===Mu?ms:f(Ia(d),x(x({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));p===Gd?n.group.dirty(e,u):(p===ms&&(p=void 0),p!==d&&(a[u]=p,o=!0,d=p))}d!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Hr?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]=Mu,i):Mu)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&(Re.call(this.data,e.id)&&(n=this.delete(e.id,e.fieldName,e.args)),this instanceof Hr&&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){Re.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&&Re.call(e,a)||t.delete(a)}),e){var n=e.__META,i=ir(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 Hr?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){Re.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 Hr;)a=a.parent;i.forEach(function(o){return a.delete(o)})}return i},r.prototype.findChildRefIds=function(e){if(!Re.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){ie(a)&&(t[a.__ref]=!0),le(a)&&Object.keys(a).forEach(function(o){var s=a[o];le(s)&&i.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Kd=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?ls():null,this.keyMaker=new sr(Ut)},r.prototype.depend=function(e,t){if(this.d){this.d(Uu(e,t));var n=Zt(t);n!==t&&this.d(Uu(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Uu(e,t),t==="__exists"?"forget":"setDirty")},r}();function Uu(r,e){return e+"#"+r}function ju(r,e){On(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){De(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 Kd(s))||this;return u.stump=new rv(u),u.storageTrie=new sr(Ut),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})(Ni||(Ni={}));var Hr=function(r){De(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){ke(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 Re.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}(Ni),rv=function(r){De(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Kd(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}(Hr);function nv(r,e,t){var n=r[t],i=e[t];return ke(n,i)?n:i}function On(r){return!!(r instanceof Ni&&r.group.caching)}function iv(r){return le(r)?ve(r)?r.slice(0):x({__proto__:Object.getPrototypeOf(r)},r):r}var gs=function(){function r(){this.known=new(Xp?WeakSet:Set),this.pool=new sr(Ut),this.passes=new WeakMap,this.keysByJSON=new Map,this.empty=this.admit({})}return r.prototype.isKnown=function(e){return le(e)&&this.known.has(e)},r.prototype.pass=function(e){if(le(e)){var t=iv(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(le(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var d=o.object=Object.create(s);this.known.add(d),u.sorted.forEach(function(p,h){d[p]=c[l+h]}),__DEV__&&Object.freeze(d)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),n=this.pool.lookupArray(t);if(!n.keys){t.sort();var i=JSON.stringify(t);(n.keys=this.keysByJSON.get(i))||this.keysByJSON.set(i,n.keys={sorted:t,json:i})}return n.keys},r}();var Tt=Object.assign(function(r){if(le(r)){qu===void 0&&Jd();var e=qu.admit(r),t=Bu.get(e);return t===void 0&&Bu.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:Jd}),qu,Bu;function Jd(){qu=new gs,Bu=new(Ut?WeakMap:Map)}function Zd(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Yd=function(){function r(e){var t=this;this.knownResults=new(Ut?WeakMap:Map),this.config=Vr(e,{addTypename:e.addTypename!==!1,canonizeResults:fs(e)}),this.canon=e.canon||new gs,this.executeSelectionSet=Tn(function(n){var i,a=n.context.canonizeResults,o=Zd(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:(ju(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Zd,makeCacheKey:function(n,i,a,o){if(On(a.store))return a.store.makeCacheKey(n,ie(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=Tn(function(n){return ju(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(On(o.store))return o.store.makeCacheKey(i,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new gs},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,n=e.query,i=e.rootId,a=i===void 0?"ROOT_QUERY":i,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,d=this.config.cache.policies;o=x(x({},kn(xa(n))),o);var f=ar(a),p=this.executeSelectionSet({selectionSet:xn(n).selectionSet,objectOrReference:f,enclosingRef:f,context:x({store:t,query:n,policies:d,variables:o,varString:Tt(o),canonizeResults:l},hs(n,this.config.fragments))}),h;if(p.missing&&(h=[new Ra(av(p.missing),p.missing,n,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,n,i){if(On(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(ie(i)&&!o.policies.rootTypenamesById[i.__ref]&&!o.store.has(i.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(i.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(i,"__typename"),d=[],f,p=new vt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&d.push({__typename:l});function h(b,g){var T;return b.missing&&(f=p.merge(f,(T={},T[g]=b.missing,T))),b.result}var m=new Set(n.selections);m.forEach(function(b){var g,T;if(!!xr(b,s))if(It(b)){var N=c.readField({fieldName:b.name.value,field:b,variables:o.variables,from:i},o),A=Mt(b);N===void 0?An.added(b)||(f=p.merge(f,(g={},g[A]="Can't find field '".concat(b.name.value,"' on ").concat(ie(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),g))):ve(N)?N=h(t.executeSubSelectedArray({field:b,array:N,enclosingRef:a,context:o}),A):b.selectionSet?N!=null&&(N=h(t.executeSelectionSet({selectionSet:b.selectionSet,objectOrReference:N,enclosingRef:ie(N)?N:a,context:o}),A)):o.canonizeResults&&(N=t.canon.pass(N)),N!==void 0&&d.push((T={},T[A]=N,T))}else{var D=_n(b,o.lookupFragment);if(!D&&b.kind===Ue.FRAGMENT_SPREAD)throw __DEV__?new Y("No fragment named ".concat(b.name.value)):new Y(5);D&&c.fragmentMatches(D,l)&&D.selectionSet.selections.forEach(m.add,m)}});var v=ka(d),_={result:v,missing:f},y=o.canonizeResults?this.canon.admit(_):Ia(_);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 vt;function u(l,d){var f;return l.missing&&(s=c.merge(s,(f={},f[d]=l.missing,f))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,d){return l===null?null:ve(l)?u(t.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),d):n.selectionSet?u(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:ie(l)?l:a,context:o}),d):(__DEV__&&ov(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},r}();function av(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function ov(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){le(i)&&(__DEV__?P(!ie(i),"Missing selection set for object of type ".concat(Hd(r,i)," returned for query field ").concat(e.name.value)):P(!ie(i),6),Object.values(i).forEach(n.add,n))})}}var $i=new Oi,Xd=new WeakMap;function La(r){var e=Xd.get(r);return e||Xd.set(r,e={vars:new Set,dep:ls()}),e}function Vu(r){La(r).vars.forEach(function(e){return e.forgetCache(r)})}function ef(r){La(r).vars.forEach(function(e){return e.attachCache(r)})}function ys(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){La(c).dep.dirty(n),sv(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=$i.getValue();s&&(i(s),La(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),La(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function sv(r){r.broadcastWatches&&r.broadcastWatches()}var tf=Object.create(null);function Qu(r){var e=JSON.stringify(r);return tf[e]||(tf[e]=Object.create(null))}function zu(r){var e=Qu(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,n){var i=function(o,s){return n.readField(s,o)},a=n.keyObject=Wu(r,function(o){var s=Di(n.storeObject,o,i);return s===void 0&&t!==n.storeObject&&Re.call(t,o[0])&&(s=Di(t,o,nf)),__DEV__?P(s!==void 0,"Missing field '".concat(o.join("."),"' while extracting keyFields from ").concat(JSON.stringify(t))):P(s!==void 0,2),s});return"".concat(n.typename,":").concat(JSON.stringify(a))})}function Hu(r){var e=Qu(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,o=n.fieldName,s=Wu(r,function(u){var l=u[0],d=l.charAt(0);if(d==="@"){if(i&&qe(i.directives)){var f=l.slice(1),p=i.directives.find(function(_){return _.name.value===f}),h=p&&kr(p,a);return h&&Di(h,u.slice(1))}return}if(d==="$"){var m=l.slice(1);if(a&&Re.call(a,m)){var v=u.slice(0);return v[0]=m,Di(a,v)}return}if(t)return Di(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Wu(r,e){var t=new vt;return rf(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 rf(r){var e=Qu(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){ve(i)?(rf(i).forEach(function(o){return t.push(n.concat(o))}),n.length=0):(n.push(i),ve(r[a+1])||(t.push(n.slice(0)),n.length=0))})}return e.paths}function nf(r,e){return r[e]}function Di(r,e,t){return t=t||nf,af(e.reduce(function n(i,a){return ve(i)?i.map(function(o){return n(o,a)}):i&&t(i,a)},r))}function af(r){return le(r)?ve(r)?r.map(af):Wu(Object.keys(r).sort(),function(e){return Di(r,e)}):r}_a.setStringify(Tt);function Gu(r){return r.args!==void 0?r.args:r.field?kr(r.field,r.variables):null}var cv=function(){},of=function(r,e){return e.fieldName},sf=function(r,e,t){var n=t.mergeObjects;return n(r,e)},cf=function(r,e){return e},lf=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:ds},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var n,i=this,a=t&&(t.typename||((n=t.storeObject)===null||n===void 0?void 0:n.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=x(x({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var f=vs(arguments,o);return i.readField(f,{store:i.cache.data,variables:f.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var d=l(e,s);if(ve(d))l=zu(d);else{c=d;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(n){var i=e[n],a=i.queryType,o=i.mutationType,s=i.subscriptionType,c=ir(i,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",n),o&&t.setRootTypename("Mutation",n),s&&t.setRootTypename("Subscription",n),Re.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?sf:u===!1?cf:c.merge}s(i,t.merge),i.keyFn=a===!1?cv:ve(a)?zu(a):typeof a=="function"?a:i.keyFn,o&&Object.keys(o).forEach(function(c){var u=n.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var d=l.keyArgs,f=l.read,p=l.merge;u.keyFn=d===!1?of:ve(d)?Hu(d):typeof d=="function"?d:u.keyFn,typeof f=="function"&&(u.read=f),s(u,p)}u.read&&u.merge&&(u.keyFn=u.keyFn||of)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var n="ROOT_"+e.toUpperCase(),i=this.rootTypenamesById[n];t!==i&&(__DEV__?P(!i||i===e,"Cannot change root ".concat(e," __typename more than once")):P(!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(Fu);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Re.call(this.typePolicies,e)){var n=this.typePolicies[e]=Object.create(null);n.fields=Object.create(null);var i=this.supertypeMap.get(e);i&&i.size&&i.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,u=ir(s,["fields"]);Object.assign(n,u),Object.assign(n.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,n){if(e){var i=this.getTypePolicy(e).fields;return i[t]||n&&(i[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var n=this.supertypeMap.get(e);return!n&&t&&this.supertypeMap.set(e,n=new Set),n},r.prototype.fragmentMatches=function(e,t,n,i){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],u=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},l=!!(n&&this.fuzzySubtypes.size),d=!1,f=0;f<c.length;++f){var p=c[f];if(p.has(o))return s.has(o)||(d&&__DEV__&&P.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(u),l&&f===c.length-1&&ps(e.selectionSet,n,i)&&(l=!1,d=!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=Gu(e);o;){var u=o(c,s);if(ve(u))o=Hu(u);else{a=u||n;break}}return a===void 0&&(a=e.field?iu(e.field,e.variables):_a(n,Gu(e))),a===!1?n:n===Zt(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=Zt(o),c=t.store.getFieldValue(n,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var d=uf(this,n,e,t,t.store.getStorage(ie(n)?n.__ref:n,o));return $i.withValue(this.cache,l,[c,d])}return c}}},r.prototype.getReadFunction=function(e,t){var n=this.getFieldPolicy(e,t,!1);return n&&n.read},r.prototype.getMergeFunction=function(e,t,n){var i=this.getFieldPolicy(e,t,!1),a=i&&i.merge;return!a&&n&&(i=this.getTypePolicy(n),a=i&&i.merge),a},r.prototype.runMergeFunction=function(e,t,n,i,a){var o=n.field,s=n.typename,c=n.merge;return c===sf?pf(i.store)(e,t):c===cf?t:(i.overwrite&&(e=void 0),c(e,t,uf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},r}();function uf(r,e,t,n,i){var a=r.getStoreFieldName(t),o=Zt(a),s=t.variables||n.variables,c=n.store,u=c.toReference,l=c.canRead;return{args:Gu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ie,toReference:u,storage:i,cache:r.cache,canRead:l,readField:function(){return r.readField(vs(arguments,e,s),n)},mergeObjects:pf(n.store)}}function vs(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),Re.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&P.warn("Undefined 'from' passed to readField with arguments ".concat(nd(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function pf(r){return function(t,n){if(ve(t)||ve(n))throw __DEV__?new Y("Cannot automatically merge arrays"):new Y(4);if(le(t)&&le(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(ie(t)&&zr(n))return r.merge(t.__ref,n),t;if(zr(t)&&ie(n))return r.merge(t,n.__ref),n;if(zr(t)&&zr(n))return x(x({},t),n)}return n}}function Ku(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 mf=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=or(i),l=Wd();s=x(x({},kn(u)),s);var d=x(x({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:Tt(s)},hs(i,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),f=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:d});if(!ie(f))throw __DEV__?new Y("Could not identify object ".concat(JSON.stringify(a))):new Y(7);return d.incomingById.forEach(function(p,h){var m=p.storeObject,v=p.mergeTree,_=p.fieldNodeSet,y=ar(h);if(v&&v.map.size){var b=n.applyMerges(v,y,m,d);if(ie(b))return;m=b}if(__DEV__&&!d.overwrite){var g=Object.create(null);_.forEach(function(A){A.selectionSet&&(g[A.name.value]=!0)});var T=function(A){return g[Zt(A)]===!0},N=function(A){var D=v&&v.map.get(A);return Boolean(D&&D.info&&D.info.merge)};Object.keys(m).forEach(function(A){T(A)&&!N(A)&&uv(y,m,A,d.store)})}e.merge(h,m)}),e.retain(f.__ref),f},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=n&&c.rootTypenamesById[n]||Ea(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var d=function(){var b=vs(arguments,u,o.variables);if(ie(b.from)){var g=o.incomingById.get(b.from.__ref);if(g){var T=c.readField(x(x({},b),{from:g.storeObject}),o);if(T!==void 0)return T}}return c.readField(b,o)},f=new Set;this.flattenFields(a,i,o,l).forEach(function(b,g){var T,N=Mt(g),A=i[N];if(f.add(g),A!==void 0){var D=c.getStoreFieldName({typename:l,fieldName:g.name.value,field:g,variables:b.variables}),L=df(s,D),R=t.processFieldValue(A,g,g.selectionSet?Ku(b,!1,!1):b,L),j=void 0;g.selectionSet&&(ie(R)||zr(R))&&(j=d("__typename",R));var Ae=c.getMergeFunction(l,g.name.value,j);Ae?L.info={field:g,typename:l,merge:Ae}:ff(s,D),u=b.merge(u,(T={},T[D]=R,T))}else __DEV__&&!b.clientOnly&&!b.deferred&&!An.added(g)&&!c.getReadFunction(l,g.name.value)&&__DEV__&&P.error("Missing field '".concat(Mt(g),"' while writing result ").concat(JSON.stringify(i,null,2)).substring(0,1e3))});try{var p=c.identify(i,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:d}),h=p[0],m=p[1];n=n||h,m&&(u=o.merge(u,m))}catch(b){if(!n)throw b}if(typeof n=="string"){var v=ar(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=Ju(y.mergeTree,s),f.forEach(function(b){return y.fieldNodeSet.add(b)})):o.incomingById.set(n,{storeObject:u,mergeTree:bs(s)?void 0:s,fieldNodeSet:f}),v}return u},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?__DEV__?Xo(e):e:ve(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,n,df(i,s));return ff(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=Ea(t,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new sr(!1);return function c(u,l){var d=s.lookup(u,l.clientOnly,l.deferred);d.visited||(d.visited=!0,u.selections.forEach(function(f){if(!!xr(f,n.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&qe(f.directives)&&f.directives.forEach(function(_){var y=_.name.value;if(y==="client"&&(p=!0),y==="defer"){var b=kr(_,n.variables);(!b||b.if!==!1)&&(h=!0)}}),It(f)){var m=a.get(f);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(f,Ku(n,p,h))}else{var v=_n(f,n.lookupFragment);if(!v&&f.kind===Ue.FRAGMENT_SPREAD)throw __DEV__?new Y("No fragment named ".concat(f.name.value)):new Y(8);v&&o.fragmentMatches(v,i,t,n.variables)&&c(v.selectionSet,Ku(n,p,h))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var o,s=this;if(e.map.size&&!ie(n)){var c=!ve(n)&&(ie(t)||zr(t))?t:void 0,u=n;c&&!a&&(a=[ie(c)?c.__ref:c]);var l,d=function(f,p){return ve(f)?typeof p=="number"?f[p]:void 0:i.store.getFieldValue(f,String(p))};e.map.forEach(function(f,p){var h=d(c,p),m=d(u,p);if(m!==void 0){a&&a.push(p);var v=s.applyMerges(f,h,m,i,a);v!==m&&(l=l||new Map,l.set(p,v)),a&&P(a.pop()===p)}}),l&&(n=ve(u)?u.slice(0):x({},u),l.forEach(function(f,p){n[p]=f}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},r}();var gf=[];function df(r,e){var t=r.map;return t.has(e)||t.set(e,gf.pop()||{map:new Map}),t.get(e)}function Ju(r,e){if(r===e||!e||bs(e))return r;if(!r||bs(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,Ju(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Ju(e.map.get(s),r.map.get(s)))})}return a}function bs(r){return!r||!(r.info||r.map.size)}function ff(r,e){var t=r.map,n=t.get(e);n&&bs(n)&&(gf.push(n),t.delete(e))}var hf=new Set;function uv(r,e,t,n){var i=function(d){var f=n.getFieldValue(d,t);return typeof f=="object"&&f},a=i(r);if(!!a){var o=i(e);if(!!o&&!ie(a)&&!ke(a,o)&&!Object.keys(a).every(function(d){return n.getFieldValue(o,d)!==void 0})){var s=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),c=Zt(t),u="".concat(s,".").concat(c);if(!hf.has(u)){hf.add(u);var l=[];!ve(a)&&!ve(o)&&[a,o].forEach(function(d){var f=n.getFieldValue(d,"__typename");typeof f=="string"&&!l.includes(f)&&l.push(f)}),__DEV__&&P.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
37
37
 
38
38
  To address this problem (which is not a bug in Apollo Client), `).concat(l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(u,` field, so InMemoryCache can safely merge these objects:
39
39
 
@@ -44,21 +44,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 gs=function(r){$e(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=fs,n.txCount=0,n.config=qd(t),n.addTypename=!!n.config.addTypename,n.policies=new of({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 pf(this,this.storeReader=new Gd({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:us(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=On(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(Cn(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,At({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(E(E({},t),{store:t.optimistic?this.optimisticData:this.data,config:this.config,returnPartialData:i})).result||null}catch(a){if(a instanceof $a)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(E(E({},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||Jd(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&ju(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){At.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(ie(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=E(E({},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(),At.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),ju(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var n=this.optimisticData.removeLayer(t);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(t){var n=this,i=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,u,l=function(f){var p=n,m=p.data,h=p.optimisticData;++n.txCount,f&&(n.data=n.optimisticData=f);try{return u=i(n)}finally{--n.txCount,n.data=m,n.optimisticData=h}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(E(E({},t),{onWatchUpdated:function(f){return d.add(f),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&d.size?(this.broadcastWatches(E(E({},t),{onWatchUpdated:function(f,p){var m=c.call(this,f,p);return m!==!1&&d.delete(f),m}})),d.size&&d.forEach(function(f){return n.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(t),u},e.prototype.performTransaction=function(t,n){return this.batch({update:t,optimistic:n||n!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var n=this.typenameDocumentCache.get(t);return n||(n=In(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||!Ae(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}($u);function ff(r){return r.hasOwnProperty("graphQLErrors")}var tv=function(r){var e="";if(Ue(r.graphQLErrors)||Ue(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 ws=function(r){De(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=ys,n.txCount=0,n.config=zd(t),n.addTypename=!!n.config.addTypename,n.policies=new lf({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 Ni.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 mf(this,this.storeReader=new Yd({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:fs(this.config),canon:t?void 0:i&&i.canon,fragments:a}),a),this.maybeBroadcastWatch=Tn(function(o,s){return n.broadcastWatch(o,s)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(o){var s=o.optimistic?n.optimisticData:n.data;if(On(s)){var c=o.optimistic,u=o.id,l=o.variables;return s.makeCacheKey(o.query,o.callback,Tt({optimistic:c,id:u,variables:l}))}}}),new Set([this.data.group,this.optimisticData.group]).forEach(function(o){return o.resetCaching()})},e.prototype.restore=function(t){return this.init(),t&&this.data.replace(t),this},e.prototype.extract=function(t){return t===void 0&&(t=!1),(t?this.optimisticData:this.data).extract()},e.prototype.read=function(t){var 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(Re.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||ef(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&Vu(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){Tt.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(ie(t))return t.__ref;try{return this.policies.identify(t)[0]}catch(n){__DEV__&&P.warn(n)}},e.prototype.evict=function(t){if(!t.id){if(Re.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(),Tt.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Vu(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var n=this.optimisticData.removeLayer(t);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(t){var n=this,i=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,u,l=function(f){var p=n,h=p.data,m=p.optimisticData;++n.txCount,f&&(n.data=n.optimisticData=f);try{return u=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},d=new Set;return c&&!this.txCount&&this.broadcastWatches(x(x({},t),{onWatchUpdated:function(f){return d.add(f),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&d.size?(this.broadcastWatches(x(x({},t),{onWatchUpdated:function(f,p){var h=c.call(this,f,p);return h!==!1&&d.delete(f),h}})),d.size&&d.forEach(function(f){return n.maybeBroadcastWatch.dirty(f)})):this.broadcastWatches(t),u},e.prototype.performTransaction=function(t,n){return this.batch({update:t,optimistic:n||n!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var n=this.typenameDocumentCache.get(t);return n||(n=An(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||!ke(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(Lu);function yf(r){return r.hasOwnProperty("graphQLErrors")}var lv=function(r){var e="";if(qe(r.graphQLErrors)||qe(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},kr=function(r){$e(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||tv(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var he;(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"})(he||(he={}));function Hr(r){return r?r<7:!1}var rv=Object.assign,nv=Object.hasOwnProperty,ys=function(r){$e(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,o=r.call(this,function(g){try{var b=g._subscription._observer;b&&!b.error&&(b.error=iv)}catch{}var v=!o.observers.size;o.observers.add(g);var w=o.last;return w&&w.error?g.error&&g.error(w.error):w&&w.result&&g.next&&g.next(w.result),v&&o.reobserve().catch(function(){}),function(){o.observers.delete(g)&&!o.observers.size&&o.tearDownQuery()}})||this;o.observers=new Set,o.subscriptions=new Set,o.queryInfo=i,o.queryManager=n,o.isTornDown=!1;var s=n.defaultOptions.watchQuery,c=s===void 0?{}:s,u=c.fetchPolicy,l=u===void 0?"cache-first":u,d=a.fetchPolicy,f=d===void 0?l:d,p=a.initialFetchPolicy,m=p===void 0?f==="standby"?l:f:p;o.options=E(E({},a),{initialFetchPolicy:m,fetchPolicy:f}),o.queryId=i.queryId||n.generateQueryId();var h=or(o.query);return o.queryName=h&&h.name&&h.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||he.ready,a=E(E({},n),{loading:Hr(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),Ae(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===he.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=he.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Gu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){return!this.last||!Ae(this.last.result,t)||n&&!Ae(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||Ae(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&&nv.call(t,"variables")){var o=_a(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&L.warn("Called refetch(".concat(JSON.stringify(t),") for query ").concat(((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&&!Ae(this.options.variables,t)&&(i.variables=this.options.variables=E(E({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,he.refetch)},e.prototype.fetchMore=function(t){var n=this,i=E(E({},t.query?t:E(E(E(E({},this.options),{query:this.query}),t),{variables:E(E({},this.options.variables),t.variables)})),{fetchPolicy:"no-cache"}),a=this.queryManager.generateQueryId(),o=this.queryInfo,s=o.networkStatus;o.networkStatus=he.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,i,he.fetchMore).then(function(u){return n.queryManager.removeQuery(a),o.networkStatus===he.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var d=t.updateQuery;d?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:u.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(n.query)||Hu(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 Ae(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},he.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var 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&&(Hr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},he.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,n){return n===void 0&&(n=this.variables),this.last=E(E({},this.last),{result:this.queryManager.assumeImmutableResults?t:Ko(t),variables:n}),Ue(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,n){var i=this;this.isTornDown=!1;var a=n===he.refetch||n===he.fetchMore||n===he.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Vr(this.options,t||{}),u=a?c:rv(this.options,c);a||(this.updatePolling(),t&&t.variables&&!Ae(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=he.setVariables)));var l=u.variables&&E({},u.variables),d=this.fetch(u,n),f={next:function(p){i.reportResult(p,l)},error:function(p){i.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(t,n))&&((i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),Tn(this.observers,"next",t))},e.prototype.reportError=function(t,n){var i=E(E({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:he.error,loading:!1});this.updateLastResult(i,n),Tn(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}(ne);Zo(ys);function Hu(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 iv(r){__DEV__&&L.error("Unhandled error",r.message,r.stack)}function Gu(r){__DEV__&&r&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var vs=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=su(t.resolvers,n)}):this.resolvers=su(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 zt(this,void 0,void 0,function(){return Wt(this,function(c){return t?[2,this.resolveDocument(t,n.data,i,a,this.fragmentMatcher,s).then(function(u){return E(E({},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 wi(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return ou(e)},r.prototype.prepareContext=function(e){var t=this.cache;return E(E({},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={}),zt(this,void 0,void 0,function(){return Wt(this,function(i){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(n),t).then(function(a){return E(E({},t),a.exportedVariables)})]:[2,E({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return nt(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 Sn}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:au(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),zt(this,void 0,void 0,function(){var s,c,u,l,d,f,p,m,h,g,b;return Wt(this,function(v){return s=An(e),c=xn(e),u=_n(c),l=this.collectSelectionsToResolve(s,u),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,m=p.cache,h=p.client,g={fragmentMap:u,context:E(E({},n),{cache:m,client:h}),variables:i,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},b=!1,[2,this.resolveSelectionSet(s.selectionSet,b,t,g).then(function(w){return{result:w,exportedVariables:g.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return zt(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Wt(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(f){return zt(l,void 0,void 0,function(){var p,m;return Wt(this,function(h){return!t&&!i.selectionsToResolve.has(f)?[2]:xr(f,s)?xt(f)?[2,this.resolveField(f,t,n,i).then(function(g){var b;typeof g<"u"&&c.push((b={},b[Pt(f)]=g,b))})]:(tu(f)?p=f:(p=a[f.name.value],__DEV__?L(p,"No fragment named ".concat(f.name.value)):L(p,11)),p&&p.typeCondition&&(m=p.typeCondition.name.value,i.fragmentMatcher(n,m,o))?[2,this.resolveSelectionSet(p.selectionSet,t,n,i).then(function(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return Ea(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return zt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,m=this;return Wt(this,function(h){return n?(a=i.variables,o=e.name.value,s=Pt(e),c=o!==s,u=n[s]||n[o],l=Promise.resolve(u),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(l=Promise.resolve(Ni.withValue(this.cache,p,[n,Ar(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(g){var b,v;if(g===void 0&&(g=u),e.directives&&e.directives.forEach(function(y){y.name.value==="export"&&y.arguments&&y.arguments.forEach(function(k){k.name.value==="as"&&k.value.kind==="StringValue"&&(i.exportedVariables[k.value.value]=g)})}),!e.selectionSet||g==null)return g;var w=(v=(b=e.directives)===null||b===void 0?void 0:b.some(function(y){return y.name.value==="client"}))!==null&&v!==void 0?v:!1;if(Array.isArray(g))return m.resolveSubSelectedArray(e,t||w,g,i);if(e.selectionSet)return m.resolveSelectionSet(e.selectionSet,t||w,g,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),nt(o,{Directive:function(c,u,l,d,f){c.name.value==="client"&&f.forEach(function(p){n(p)&&va(p)&&s.add(p)})},FragmentSpread:function(c,u,l,d,f){var p=t[c.name.value];__DEV__?L(p,"No fragment named ".concat(c.name.value)):L(p,12);var m=a(p);m.size>0&&(f.forEach(function(h){n(h)&&va(h)&&s.add(h)}),s.add(c),m.forEach(function(h){s.add(h)}))}})}return i.get(o)}return a(e)},r}();var Di=new(Ft?WeakMap:Map);function Ku(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Di.set(r,(Di.get(r)+1)%1e15),t.apply(this,arguments)})}function hf(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var bs=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;Di.has(n)||(Di.set(n,0),Ku(n,"evict"),Ku(n,"modify"),Ku(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||he.loading;return this.variables&&this.networkStatus!==he.loading&&!Ae(this.variables,e.variables)&&(t=he.setVariables),Ae(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){hf(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&Ae(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&&!Ae(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():Hu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;hf(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(Hr(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=E(E({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!Ae(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===Di.get(this.cache)&&Ae(t,n.variables)&&Ae(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new gt,s=Ue(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Ue(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&&(ws(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:Di.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(n.variables),f=l.diff(d);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=he.ready},r.prototype.markError=function(e){return this.networkStatus=he.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function ws(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!ki(r);return!n&&t&&r.data&&(n=!0),n}var av=Object.prototype.hasOwnProperty,mf=function(){function r(e){var t=e.cache,n=e.link,i=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,d=l===void 0?{}:l,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Ft?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new vs({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new J("QueryManager stopped while query was in flight"):new J(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,n,i=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,d=l===void 0?!1:l,f=e.update,p=e.onQueryUpdated,m=e.fetchPolicy,h=m===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":m,g=e.errorPolicy,b=g===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":g,v=e.keepRootFields,w=e.context;return zt(this,void 0,void 0,function(){var y,k,C,I,D,P;return Wt(this,function(R){switch(R.label){case 0:return __DEV__?L(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):L(i,15),__DEV__?L(h==="network-only"||h==="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(h==="network-only"||h==="no-cache",16),y=this.generateMutationId(),k=this.transform(i),C=k.document,I=k.hasClientExports,i=this.cache.transformForLink(C),a=this.getVariables(i,a),I?[4,this.localState.addExportedVariables(i,a,w)]:[3,2];case 1:a=R.sent(),R.label=2;case 2:return D=this.mutationStore&&(this.mutationStore[y]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:y,document:i,variables:a,fetchPolicy:h,errorPolicy:b,context:w,updateQueries:s,update:f,keepRootFields:v}),this.broadcastQueries(),P=this,[2,new Promise(function(j,xe){return Jo(P.getObservableFromLink(i,E(E({},w),{optimisticResponse:o}),a,!1),function(Oe){if(ki(Oe)&&b==="none")throw new kr({graphQLErrors:Xo(Oe)});D&&(D.loading=!1,D.error=null);var A=E({},Oe);return typeof u=="function"&&(u=u(A)),b==="ignore"&&ki(A)&&delete A.errors,P.markMutationResult({mutationId:y,result:A,document:i,variables:a,fetchPolicy:h,errorPolicy:b,context:w,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?y:void 0,onQueryUpdated:p,keepRootFields:v})}).subscribe({next:function(Oe){P.broadcastQueries(),(!("hasNext"in Oe)||Oe.hasNext===!1)&&j(Oe)},error:function(Oe){D&&(D.loading=!1,D.error=Oe),o&&P.cache.removeOptimistic(y),P.broadcastQueries(),xe(Oe instanceof kr?Oe:new kr({networkError:Oe}))}})})]}})})},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&&ws(i,e.errorPolicy)){if(Br(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Br(i)&&Ue(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(d,f){var p=d.observableQuery,m=p&&p.queryName;if(!(!m||!av.call(u,m))){var h=u[m],g=n.queries.get(f),b=g.document,v=g.variables,w=t.diff({query:b,variables:v,returnPartialData:!0,optimistic:!1}),y=w.result,k=w.complete;if(k&&y){var C=h(y,{mutationResult:i,queryName:b&&_i(b)||void 0,queryVariables:v});C&&a.push({result:C,dataId:"ROOT_QUERY",query:b,variables:v})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(d){o||a.forEach(function(h){return d.write(h)});var f=e.update,p=!Zp(i)||Br(i)&&!i.hasNext;if(f){if(!o){var m=d.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});m.complete&&(i=E(E({},i),{data:m.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}p&&f(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(h,g){var b=g.fieldName,v=g.DELETE;return b==="__typename"?h:v}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(E(E({},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=iu(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:Zc(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:kn(or(n)),asQuery:E(E({},n),{definitions:n.definitions.map(function(u){return u.kind==="OperationDefinition"&&u.operation!=="query"?E(E({},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 E(E({},this.transform(e).defaultVars),t)},r.prototype.watchQuery=function(e){e=E(E({},e),{variables:this.getVariables(e.query,e.variables)}),typeof e.notifyOnNetworkStatusChange>"u"&&(e.notifyOnNetworkStatusChange=!1);var t=new bs(this),n=new ys({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 J("Store reset while query was in flight (not completed in link chain)"):new J(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=he.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):Xc(o)?i.set(t.transform(o).document,!1):ue(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){n.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&i.has(l)||u&&i.has(u))&&(n.set(s,c),l&&i.set(l,!0),u&&i.set(u,!0))}}),a.size&&a.forEach(function(o){var s=ka("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new ys({queryManager:t,queryInfo:c,options:E(E({},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(d){return t.getObservableFromLink(n,c,d).map(function(f){if(i!=="no-cache"&&(ws(f,a)&&t.cache.write({query:n,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),ki(f))throw new kr({graphQLErrors:f.errors});return f})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new ne(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i){var a=this,o;i===void 0&&(i=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,d=u.link,f={query:c,variables:n,operationName:_i(c)||void 0,context:this.prepareContext(E(E({},t),{forceFetch:!i}))};if(t=f.context,i){var p=l.get(c)||new Map;l.set(c,p);var m=At(n);if(s=p.get(m),!s){var h=new Ai([Ii(d,f)]);p.set(m,s=h),h.beforeNext(function(){p.delete(m)&&p.size<1&&l.delete(c)})}}else s=new Ai([Ii(d,f)])}else s=new Ai([ne.of({data:{}})]),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(s=Jo(s,function(b){return a.localState.runResolvers({document:g,remoteResult:b,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 Jo(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=Xo(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new kr({graphQLErrors:s}));e.markResult(o,a,n,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:he.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=he.error),u},function(o){var s=ff(o)?o:new kr({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,n){var i=this;n===void 0&&(n=he.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,m=p===void 0?!1:p,h=t.notifyOnNetworkStatusChange,g=h===void 0?!1:h,b=t.context,v=b===void 0?{}:b,w=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:m,notifyOnNetworkStatusChange:g,context:v}),y=function(I){w.variables=I;var D=i.fetchQueryByPolicy(s,w,n);return w.fetchPolicy!=="standby"&&D.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),D},k=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(I){k(),setTimeout(function(){return C.cancel(I)})});var C=new Ai(this.transform(w.query).hasClientExports?this.localState.addExportedVariables(w.query,w.variables,w.context).then(y):y(w.variables));return C.promise.then(k,k),C},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?ka("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(f,p){l.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,m){var h=f.watcher instanceof bs&&f.watcher.observableQuery;if(h){if(u){l.delete(h.queryId);var g=u(h,p,m);return g===!0&&(g=h.refetch()),g!==!1&&d.set(h,g),g}u!==null&&l.set(h.queryId,{oq:h,lastDiff:m,diff:p})}}}),l.size&&l.forEach(function(f,p){var m=f.oq,h=f.lastDiff,g=f.diff,b;if(u){if(!g){var v=m.queryInfo;v.reset(),g=v.getDiff()}b=u(m,g,h)}(!u||b===!0)&&(b=m.refetch()),b!==!1&&d.set(m,b),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var m=function(){return e.getDiff(o)},h=function(y,k){k===void 0&&(k=e.networkStatus||he.loading);var C=y.result;__DEV__&&!l&&!Ae(C,{})&&Gu(y.missing);var I=function(D){return ne.of(E({data:D,loading:Hr(k),networkStatus:k},y.complete?null:{partial:!0}))};return C&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:C},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(D){return I(D.data||void 0)}):u==="none"&&k===he.refetch&&Array.isArray(y.missing)?I(void 0):I(C)},g=s==="no-cache"?0:n===he.refetch&&c!=="merge"?1:2,b=function(){return i.getResultsFromLink(e,g,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},v=f&&typeof p=="number"&&p!==n&&Hr(n);switch(s){default:case"cache-first":{var w=m();return w.complete?[h(w,e.markReady())]:l||v?[h(w),b()]:[b()]}case"cache-and-network":{var w=m();return w.complete||l||v?[h(w),b()]:[b()]}case"cache-only":return[h(m(),e.markReady())];case"network-only":return v?[h(m()),b()]:[b()];case"no-cache":return v?[h(e.getDiff()),b()]:[b()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new bs(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return E(E({},t),{clientAwareness:this.clientAwareness})},r}();var gf=!1;var Ju=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,m=p===void 0?!0:p,h=e.defaultOptions,g=e.assumeImmutableResults,b=g===void 0?!1:g,v=e.resolvers,w=e.typeDefs,y=e.fragmentMatcher,k=e.name,C=e.version,I=e.link;if(I||(I=n?new xu({uri:n,credentials:i,headers:a}):Mt.empty()),!o)throw __DEV__?new J(`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 J(9);if(this.link=I,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=m,this.defaultOptions=h||Object.create(null),this.typeDefs=w,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!gf&&f&&__DEV__&&(gf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var D=window.navigator,P=D&&D.userAgent,R=void 0;typeof P=="string"&&(P.indexOf("Chrome/")>-1?R="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":P.indexOf("Firefox/")>-1&&(R="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),R&&__DEV__&&L.log("Download the Apollo DevTools for a better development experience: "+R)}this.version=td,this.localState=new vs({cache:o,client:this,resolvers:v,fragmentMatcher:y}),this.queryManager=new mf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:m,ssrMode:c,clientAwareness:{name:k,version:C},localState:this.localState,assumeImmutableResults:b,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ia(this.defaultOptions.watchQuery,e)),this.disableNetworkFetches&&(e.fetchPolicy==="network-only"||e.fetchPolicy==="cache-and-network")&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.watchQuery(e)},r.prototype.query=function(e){return this.defaultOptions.query&&(e=Ia(this.defaultOptions.query,e)),__DEV__?L(e.fetchPolicy!=="cache-and-network","The cache-and-network fetchPolicy does not work with client.query, because client.query can only return a single result. Please use client.watchQuery to receive multiple results from the cache and the network, or consider using a different fetchPolicy, such as cache-first or network-only."):L(e.fetchPolicy!=="cache-and-network",10),this.disableNetworkFetches&&e.fetchPolicy==="network-only"&&(e=E(E({},e),{fetchPolicy:"cache-first"})),this.queryManager.query(e)},r.prototype.mutate=function(e){return this.defaultOptions.mutate&&(e=Ia(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Ii(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}();Ip(wn?"log":"silent");function ct(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Ir(r){return ct(r)==="object"}function yf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Zu(r,e){return r.length<124?r:e}var vf="graphql-transport-ws";var yt;(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"})(yt||(yt={}));var Re;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Re||(Re={}));function bf(r){if(!Ir(r))throw new Error(`Message is expected to be an object, but got ${ct(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 ${ct(r.type)}`);switch(r.type){case Re.ConnectionInit:case Re.ConnectionAck:case Re.Ping:case Re.Pong:{if(r.payload!=null&&!Ir(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Re.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ct(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ir(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${ct(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 ${ct(r.payload.query)}`);if(r.payload.variables!=null&&!Ir(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 ${ct(r.payload.variables)}`);if(r.payload.operationName!=null&&ct(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 ${ct(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Ir(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 ${ct(r.payload.extensions)}`);break}case Re.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ct(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ir(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${ct(r.payload)}`);break}case Re.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ct(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!yf(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Re.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ct(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 wf(r,e){return bf(typeof r=="string"?JSON.parse(r,e):r)}function Ri(r,e){return bf(r),JSON.stringify(r,e)}function Yu(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(be){let we=1e3;for(let se=0;se<be;se++)we*=2;await new Promise(se=>setTimeout(se,we+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=Ss,isFatalConnectionProblem:f,on:p,webSocketImpl:m,generateID:h=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,be=>{let we=Math.random()*16|0;return(be=="x"?we:we&3|8).toString(16)})},jsonMessageReplacer:g,jsonMessageReviver:b}=r,v;if(m){if(!sv(m))throw new Error("Invalid WebSocket implementation provided");v=m}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 w=v,y=(()=>{let A=(()=>{let we={};return{on(se,ce){return we[se]=ce,()=>{delete we[se]}},emit(se){var ce;"id"in se&&((ce=we[se.id])===null||ce===void 0||ce.call(we,se))}}})(),be={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[A.emit,p.message]:[A.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:A.on,on(we,se){let ce=be[we];return ce.push(se),()=>{ce.splice(ce.indexOf(se),1)}},emit(we,...se){for(let ce of[...be[we]])ce(...se)}}})();function k(A){let be=[y.on("error",we=>{be.forEach(se=>se()),A(we)}),y.on("closed",we=>{be.forEach(se=>se()),A(we)})]}let C,I=0,D,P=!1,R=0,j=!1;async function xe(){clearTimeout(D);let[A,be]=await(C??(C=new Promise((ce,rr)=>(async()=>{if(P){if(await l(R),!I)return C=void 0,rr({code:1e3,reason:"All Subscriptions Gone"});R++}y.emit("connecting");let re=new w(typeof e=="function"?await e():e,vf),nr,Fr;function Mo(){isFinite(o)&&o>0&&(clearTimeout(Fr),Fr=setTimeout(()=>{re.readyState===w.OPEN&&(re.send(Ri({type:Re.Ping})),y.emit("ping",!1,void 0))},o))}k(Je=>{C=void 0,clearTimeout(nr),clearTimeout(Fr),rr(Je),Ss(Je)&&Je.code===4499&&(re.close(4499,"Terminated"),re.onerror=null,re.onclose=null)}),re.onerror=Je=>y.emit("error",Je),re.onclose=Je=>y.emit("closed",Je),re.onopen=async()=>{try{y.emit("opened",re);let Je=typeof t=="function"?await t():t;if(re.readyState!==w.OPEN)return;re.send(Ri(Je?{type:Re.ConnectionInit,payload:Je}:{type:Re.ConnectionInit},g)),isFinite(c)&&c>0&&(nr=setTimeout(()=>{re.close(yt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Mo()}catch(Je){y.emit("error",Je),re.close(yt.InternalClientError,Zu(Je instanceof Error?Je.message:new Error(Je).message,"Internal client error"))}};let vi=!1;re.onmessage=({data:Je})=>{try{let Ze=wf(Je,b);if(y.emit("message",Ze),Ze.type==="ping"||Ze.type==="pong"){y.emit(Ze.type,!0,Ze.payload),Ze.type==="pong"?Mo():s||(re.send(Ri(Ze.payload?{type:Re.Pong,payload:Ze.payload}:{type:Re.Pong})),y.emit("pong",!1,Ze.payload));return}if(vi)return;if(Ze.type!==Re.ConnectionAck)throw new Error(`First message cannot be of type ${Ze.type}`);clearTimeout(nr),vi=!0,y.emit("connected",re,Ze.payload),P=!1,R=0,ce([re,new Promise((QS,pg)=>k(pg))])}catch(Ze){re.onmessage=null,y.emit("error",Ze),re.close(yt.BadResponse,Zu(Ze instanceof Error?Ze.message:new Error(Ze).message,"Bad response"))}}})())));A.readyState===w.CLOSING&&await be;let we=()=>{},se=new Promise(ce=>we=ce);return[A,we,Promise.race([se.then(()=>{if(!I){let ce=()=>A.close(1e3,"Normal Closure");isFinite(a)&&a>0?D=setTimeout(()=>{A.readyState===w.OPEN&&ce()},a):ce()}}),be])]}function Oe(A){if(Ss(A)&&(ov(A.code)||[yt.InternalServerError,yt.InternalClientError,yt.BadRequest,yt.BadResponse,yt.Unauthorized,yt.SubprotocolNotAcceptable,yt.SubscriberAlreadyExists,yt.TooManyInitialisationRequests].includes(A.code)))throw A;if(j)return!1;if(Ss(A)&&A.code===1e3)return I>0;if(!u||R>=u||!d(A)||f?.(A))throw A;return P=!0}return n||(async()=>{for(I++;;)try{let[,,A]=await xe();await A}catch(A){try{if(!Oe(A))return}catch(be){return i?.(be)}}})(),{on:y.on,subscribe(A,be){let we=h(A),se=!1,ce=!1,rr=()=>{I--,se=!0};return(async()=>{for(I++;;)try{let[re,nr,Fr]=await xe();if(se)return nr();let Mo=y.onMessage(we,vi=>{switch(vi.type){case Re.Next:{be.next(vi.payload);return}case Re.Error:{ce=!0,se=!0,be.error(vi.payload),rr();return}case Re.Complete:{se=!0,rr();return}}});re.send(Ri({id:we,type:Re.Subscribe,payload:A},g)),rr=()=>{!se&&re.readyState===w.OPEN&&re.send(Ri({id:we,type:Re.Complete},g)),I--,se=!0,nr()},await Fr.finally(Mo);return}catch(re){if(!Oe(re))return}})().then(()=>{ce||be.complete()}).catch(re=>{be.error(re)}),()=>{se||rr()}},async dispose(){if(j=!0,C){let[A]=await C;A.close(1e3,"Normal Closure")}},terminate(){C&&y.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function Ss(r){return Ir(r)&&"code"in r&&"reason"in r}function ov(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function sv(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function cv(r){return ue(r)&&"code"in r&&"reason"in r}var Sf=function(r){$e(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 ne(function(i){return n.client.subscribe(E(E({},t),{query:bi(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):cv(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new kr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(Mt);var _s="0.12.0-rc1-dev.2";function Es(){return typeof window!="undefined"&&window.self!==window.top}function Xu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function kt(r,e){Xu()&&localStorage.setItem(`${_s}/${r}`,e)}function xs(r){return Xu()?localStorage.getItem(`${_s}/${r}`):null}function La(r){Xu()&&localStorage.removeItem(`${_s}/${r}`)}function Li(r,e=1e4){return K(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 tc=function(){return tc=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},tc.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ms(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ms=function(t){return typeof t}:Ms=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ms(r)}function lv(r){return Ms(r)=="object"&&r!==null}var Bh=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function bl(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 pv(r){return Vh(r.source,bl(r.source,r.start))}function Vh(r,e){var t=r.locationOffset.column-1,n=js(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
52
- `),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var f=Math.floor(c/80),p=c%80,m=[],h=0;h<d.length;h+=80)m.push(d.slice(h,h+80));return u+_f([["".concat(o),m[0]]].concat(m.slice(1,f+1).map(function(g){return["",g]}),[[" ",js(p-1)+"^"],["",m[f+1]]]))}return u+_f([["".concat(o-1),l[i-1]],["".concat(o),d],["",js(c-1)+"^"],["".concat(o+1),l[i+1]]])}function _f(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 dv(t,i)+(a?" | "+a:" |")}).join(`
53
- `)}function js(r){return Array(r+1).join(" ")}function dv(r,e){return js(r-e.length)+e}function Us(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Us=function(t){return typeof t}:Us=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Us(r)}function Ef(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 fv(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?Ef(Object(t),!0).forEach(function(n){hv(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):Ef(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function hv(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function mv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function xf(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 gv(r,e,t){return e&&xf(r.prototype,e),t&&xf(r,t),r}function yv(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&&uo(r,e)}function vv(r){var e=zh();return function(){var n=lo(r),i;if(e){var a=lo(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Qh(this,i)}}function Qh(r,e){return e&&(Us(e)==="object"||typeof e=="function")?e:Ua(r)}function Ua(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function wl(r){var e=typeof Map=="function"?new Map:void 0;return wl=function(n){if(n===null||!bv(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 qs(n,arguments,lo(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),uo(i,n)},wl(r)}function qs(r,e,t){return zh()?qs=Reflect.construct:qs=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&uo(u,o.prototype),u},qs.apply(null,arguments)}function zh(){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 bv(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function uo(r,e){return uo=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},uo(r,e)}function lo(r){return lo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},lo(r)}var wv=function(r){yv(t,r);var e=vv(t);function t(n,i,a,o,s,c,u){var l,d,f,p;mv(this,t),p=e.call(this,n),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=Af(Array.isArray(i)?i:i?[i]:void 0);for(var m=[],h=0,g=(b=p.nodes)!==null&&b!==void 0?b:[];h<g.length;h++){var b,v=g[h],w=v.loc;w!=null&&m.push(w)}m=Af(m),p.source=a??((l=m)===null||l===void 0?void 0:l[0].source),p.positions=o??((d=m)===null||d===void 0?void 0:d.map(function(k){return k.start})),p.locations=o&&a?o.map(function(k){return bl(a,k)}):(f=m)===null||f===void 0?void 0:f.map(function(k){return bl(k.source,k.start)}),p.path=s??void 0;var y=c?.extensions;return u==null&&lv(y)?p.extensions=fv({},y):p.extensions=u??{},Object.defineProperties(Ua(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(Ua(p),"stack",{value:c.stack,writable:!0,configurable:!0}),Qh(p)):(Error.captureStackTrace?Error.captureStackTrace(Ua(p),t):Object.defineProperty(Ua(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return gv(t,[{key:"toString",value:function(){return Sv(this)}},{key:Bh,get:function(){return"Object"}}]),t}(wl(Error));function Af(r){return r===void 0||r.length===0?void 0:r}function Sv(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},Ar=function(r){De(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||lv(c),c.extraInfo=s,c.__proto__=e.prototype,c}return e}(Error);var me;(function(r){r[r.loading=1]="loading",r[r.setVariables=2]="setVariables",r[r.fetchMore=3]="fetchMore",r[r.refetch=4]="refetch",r[r.poll=6]="poll",r[r.ready=7]="ready",r[r.error=8]="error"})(me||(me={}));function Wr(r){return r?r<7:!1}var pv=Object.assign,dv=Object.hasOwnProperty,Ss=function(r){De(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=fv)}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,d=a.fetchPolicy,f=d===void 0?l:d,p=a.initialFetchPolicy,h=p===void 0?f==="standby"?l:f:p;o.options=x(x({},a),{initialFetchPolicy:h,fetchPolicy:f}),o.queryId=i.queryId||n.generateQueryId();var m=or(o.query);return o.queryName=m&&m.name&&m.name.value,o}return Object.defineProperty(e.prototype,"query",{get:function(){return this.queryManager.transform(this.options.query).document},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"variables",{get:function(){return this.options.variables},enumerable:!1,configurable:!0}),e.prototype.result=function(){var t=this;return new Promise(function(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||me.ready,a=x(x({},n),{loading:Wr(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),ke(a.data,{})&&(a.data=void 0),c.complete?(delete a.partial,c.complete&&a.networkStatus===me.loading&&(s==="cache-first"||s==="cache-only")&&(a.networkStatus=me.ready,a.loading=!1)):a.partial=!0,__DEV__&&!c.complete&&!this.options.partialRefetch&&!a.loading&&!a.data&&!a.error&&Yu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){return!this.last||!ke(this.last.result,t)||n&&!ke(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||ke(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&&dv.call(t,"variables")){var o=xa(this.query),s=o.variableDefinitions;(!s||!s.some(function(c){return c.variable.name.value==="variables"}))&&__DEV__&&P.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&&!ke(this.options.variables,t)&&(i.variables=this.options.variables=x(x({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(i,me.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=me.fetchMore,i.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,i,me.fetchMore).then(function(u){return n.queryManager.removeQuery(a),o.networkStatus===me.fetchMore&&(o.networkStatus=s),n.queryManager.cache.batch({update:function(l){var d=t.updateQuery;d?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(f){return d(f,{fetchMoreResult:u.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(n.query)||Zu(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__&&P.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 ke(this.variables,t)?this.observers.size?this.result():Promise.resolve():(this.options.variables=t,this.observers.size?this.reobserve({fetchPolicy:this.options.initialFetchPolicy,variables:t},me.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var 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__?P(a,"Attempted to start a polling query without a polling interval."):P(a,13);var o=i||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(Wr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},me.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,n){return n===void 0&&(n=this.variables),this.last=x(x({},this.last),{result:this.queryManager.assumeImmutableResults?t:Xo(t),variables:n}),qe(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,n){var i=this;this.isTornDown=!1;var a=n===me.refetch||n===me.fetchMore||n===me.poll,o=this.options.variables,s=this.options.fetchPolicy,c=Vr(this.options,t||{}),u=a?c:pv(this.options,c);a||(this.updatePolling(),t&&t.variables&&!ke(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),n===void 0&&(n=me.setVariables)));var l=u.variables&&x({},u.variables),d=this.fetch(u,n),f={next:function(p){i.reportResult(p,l)},error:function(p){i.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=d,this.observer=f),d.addObserver(f),d.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,n){var i=this.getLastError();(i||this.isDifferentFromLastResult(t,n))&&((i||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,n),In(this.observers,"next",t))},e.prototype.reportError=function(t,n){var i=x(x({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:me.error,loading:!1});this.updateLastResult(i,n),In(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}(ne);ts(Ss);function Zu(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 fv(r){__DEV__&&P.error("Unhandled error",r.message,r.stack)}function Yu(r){__DEV__&&r&&__DEV__&&P.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var _s=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=pu(t.resolvers,n)}):this.resolvers=pu(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 Wt(this,void 0,void 0,function(){return Gt(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 Si(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return lu(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={}),Wt(this,void 0,void 0,function(){return Gt(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 it(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 wn}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:uu(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),Wt(this,void 0,void 0,function(){var s,c,u,l,d,f,p,h,m,v,_;return Gt(this,function(y){return s=xn(e),c=En(e),u=Sn(c),l=this.collectSelectionsToResolve(s,u),d=s.operation,f=d?d.charAt(0).toUpperCase()+d.slice(1):"Query",p=this,h=p.cache,m=p.client,v={fragmentMap:u,context:x(x({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:f,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},_=!1,[2,this.resolveSelectionSet(s.selectionSet,_,t,v).then(function(b){return{result:b,exportedVariables:v.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,n,i){return Wt(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Gt(this,function(d){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(f){return Wt(l,void 0,void 0,function(){var p,h;return Gt(this,function(m){return!t&&!i.selectionsToResolve.has(f)?[2]:xr(f,s)?It(f)?[2,this.resolveField(f,t,n,i).then(function(v){var _;typeof v<"u"&&c.push((_={},_[Mt(f)]=v,_))})]:(au(f)?p=f:(p=a[f.name.value],__DEV__?P(p,"No fragment named ".concat(f.name.value)):P(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,i.fragmentMatcher(n,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,n,i).then(function(v){c.push(v)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return ka(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return Wt(this,void 0,void 0,function(){var a,o,s,c,u,l,d,f,p,h=this;return Gt(this,function(m){return n?(a=i.variables,o=e.name.value,s=Mt(e),c=o!==s,u=n[s]||n[o],l=Promise.resolve(u),(!i.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(d=n.__typename||i.defaultOperationType,f=this.resolvers&&this.resolvers[d],f&&(p=f[c?o:s],p&&(l=Promise.resolve($i.withValue(this.cache,p,[n,kr(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(T){T.name.value==="as"&&T.value.kind==="StringValue"&&(i.exportedVariables[T.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),it(o,{Directive:function(c,u,l,d,f){c.name.value==="client"&&f.forEach(function(p){n(p)&&wa(p)&&s.add(p)})},FragmentSpread:function(c,u,l,d,f){var p=t[c.name.value];__DEV__?P(p,"No fragment named ".concat(c.name.value)):P(p,12);var h=a(p);h.size>0&&(f.forEach(function(m){n(m)&&wa(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},r}();var Ri=new(Ut?WeakMap:Map);function Xu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Ri.set(r,(Ri.get(r)+1)%1e15),t.apply(this,arguments)})}function vf(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var Es=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;Ri.has(n)||(Ri.set(n,0),Xu(n,"evict"),Xu(n,"modify"),Xu(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||me.loading;return this.variables&&this.networkStatus!==me.loading&&!ke(this.variables,e.variables)&&(t=me.setVariables),ke(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(){vf(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&ke(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&&!ke(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():Zu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;vf(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(Wr(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||!ke(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===Ri.get(this.cache)&&ke(t,n.variables)&&ke(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new vt,s=qe(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&qe(e.incremental)){var c=rs(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&&(xs(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:Ri.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var d=a.getDiffOptions(n.variables),f=l.diff(d);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(f,d),f.complete&&(e.data=f.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=me.ready},r.prototype.markError=function(e){return this.networkStatus=me.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function xs(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 hv=Object.prototype.hasOwnProperty,bf=function(){function r(e){var t=e.cache,n=e.link,i=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,d=l===void 0?{}:l,f=e.localState,p=e.assumeImmutableResults;this.clientAwareness={},this.queries=new Map,this.fetchCancelFns=new Map,this.transformCache=new(Ut?WeakMap:Map),this.queryIdCounter=1,this.requestIdCounter=1,this.mutationIdCounter=1,this.inFlightLinkObservables=new Map,this.cache=t,this.link=n,this.defaultOptions=i||Object.create(null),this.queryDeduplication=o,this.clientAwareness=d,this.localState=f||new _s({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,n){e.stopQueryNoBroadcast(n)}),this.cancelPendingFetches(__DEV__?new Y("QueryManager stopped while query was in flight"):new Y(14))},r.prototype.cancelPendingFetches=function(e){this.fetchCancelFns.forEach(function(t){return t(e)}),this.fetchCancelFns.clear()},r.prototype.mutate=function(e){var t,n,i=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,d=l===void 0?!1:l,f=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,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 Wt(this,void 0,void 0,function(){var g,T,N,A,D,L;return Gt(this,function(R){switch(R.label){case 0:return __DEV__?P(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):P(i,15),__DEV__?P(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."):P(m==="network-only"||m==="no-cache",16),g=this.generateMutationId(),T=this.transform(i),N=T.document,A=T.hasClientExports,i=this.cache.transformForLink(N),a=this.getVariables(i,a),A?[4,this.localState.addExportedVariables(i,a,b)]:[3,2];case 1:a=R.sent(),R.label=2;case 2:return D=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:f,keepRootFields:y}),this.broadcastQueries(),L=this,[2,new Promise(function(j,Ae){return es(L.getObservableFromLink(i,x(x({},b),{optimisticResponse:o}),a,!1),function(Ce){if(Ii(Ce)&&_==="none")throw new Ar({graphQLErrors:ns(Ce)});D&&(D.loading=!1,D.error=null);var k=x({},Ce);return typeof u=="function"&&(u=u(k)),_==="ignore"&&Ii(k)&&delete k.errors,L.markMutationResult({mutationId:g,result:k,document:i,variables:a,fetchPolicy:m,errorPolicy:_,context:b,update:f,updateQueries:s,awaitRefetchQueries:d,refetchQueries:u,removeOptimistic:o?g:void 0,onQueryUpdated:p,keepRootFields:y})}).subscribe({next:function(Ce){L.broadcastQueries(),(!("hasNext"in Ce)||Ce.hasNext===!1)&&j(Ce)},error:function(Ce){D&&(D.loading=!1,D.error=Ce),o&&L.cache.removeOptimistic(g),L.broadcastQueries(),Ae(Ce instanceof Ar?Ce:new Ar({networkError:Ce}))}})})]}})})},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&&xs(i,e.errorPolicy)){if(Br(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Br(i)&&qe(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=rs(s.result,i)),typeof c<"u"&&(i.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(d,f){var p=d.observableQuery,h=p&&p.queryName;if(!(!h||!hv.call(u,h))){var m=u[h],v=n.queries.get(f),_=v.document,y=v.variables,b=t.diff({query:_,variables:y,returnPartialData:!0,optimistic:!1}),g=b.result,T=b.complete;if(T&&g){var N=m(g,{mutationResult:i,queryName:_&&Ei(_)||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(d){o||a.forEach(function(m){return d.write(m)});var f=e.update,p=!td(i)||Br(i)&&!i.hasNext;if(f){if(!o){var h=d.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=x(x({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}p&&f(d,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&d.modify({id:"ROOT_MUTATION",fields:function(m,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(d){return l.push(d)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return i})}return Promise.resolve(i)},r.prototype.markMutationOptimistic=function(e,t){var n=this,i=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{n.markMutationResult(x(x({},t),{result:{data:i}}),a)}catch(o){__DEV__&&P.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=cu(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:tu(n),hasForcedResolvers:this.localState.shouldForceResolvers(n),clientQuery:a,serverQuery:o,defaultVars:kn(or(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 Es(this),n=new Ss({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__?P(e.query,"query option is required. You must specify your GraphQL document in the query option."):P(e.query,17),__DEV__?P(e.query.kind==="Document",'You must wrap the query string in a "gql" tag.'):P(e.query.kind==="Document",18),__DEV__?P(!e.returnPartialData,"returnPartialData option only supported on watchQuery."):P(!e.returnPartialData,19),__DEV__?P(!e.pollInterval,"pollInterval option only supported on watchQuery."):P(!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 Y("Store reset while query was in flight (not completed in link chain)"):new Y(21)),this.queries.forEach(function(t){t.observableQuery?t.networkStatus=me.loading:t.stop()}),this.mutationStore&&(this.mutationStore=Object.create(null)),this.cache.reset(e)},r.prototype.getObservableQueries=function(e){var t=this;e===void 0&&(e="active");var n=new Map,i=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?i.set(o,!1):nu(o)?i.set(t.transform(o).document,!1):le(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){n.set(s,c);return}var l=c.queryName,d=c.options.fetchPolicy;if(d==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&i.has(l)||u&&i.has(u))&&(n.set(s,c),l&&i.set(l,!0),u&&i.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Ta("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new Ss({queryManager:t,queryInfo:c,options:x(x({},o),{fetchPolicy:"network-only"})});P(u.queryId===s),c.setObservableQuery(u),n.set(s,u)}),__DEV__&&i.size&&i.forEach(function(o,s){o||__DEV__&&P.warn("Unknown query ".concat(typeof s=="string"?"named ":"").concat(JSON.stringify(s,null,2)," requested in refetchQueries options.include array"))}),n},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var n=[];return this.getObservableQueries(e?"all":"active").forEach(function(i,a){var o=i.options.fetchPolicy;i.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&n.push(i.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(n)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,n=e.query,i=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;n=this.transform(n).document,o=this.getVariables(n,o);var u=function(d){return t.getObservableFromLink(n,c,d).map(function(f){if(i!=="no-cache"&&(xs(f,a)&&t.cache.write({query:n,result:f.data,dataId:"ROOT_SUBSCRIPTION",variables:d}),t.broadcastQueries()),Ii(f))throw new Ar({graphQLErrors:f.errors});return f})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new ne(function(d){var f=null;return l.then(function(p){return f=p.subscribe(d)},d.error),function(){return f&&f.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i){var a=this,o;i===void 0&&(i=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,d=u.link,f={query:c,variables:n,operationName:Ei(c)||void 0,context:this.prepareContext(x(x({},t),{forceFetch:!i}))};if(t=f.context,i){var p=l.get(c)||new Map;l.set(c,p);var h=Tt(n);if(s=p.get(h),!s){var m=new Ai([Ti(d,f)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new Ai([Ti(d,f)])}else s=new Ai([ne.of({data:{}})]),t=this.prepareContext(t);var v=this.transform(e).clientQuery;return v&&(s=es(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 es(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=ns(o),c=s.length>0;if(i>=e.lastRequestId){if(c&&n.errorPolicy==="none")throw e.markError(new Ar({graphQLErrors:s}));e.markResult(o,a,n,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:me.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=me.error),u},function(o){var s=yf(o)?o:new Ar({networkError:o});throw i>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,n){var i=this;n===void 0&&(n=me.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,d=t.errorPolicy,f=d===void 0?c&&c.errorPolicy||"none":d,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,v=m===void 0?!1:m,_=t.context,y=_===void 0?{}:_,b=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:f,returnPartialData:h,notifyOnNetworkStatusChange:v,context:y}),g=function(A){b.variables=A;var D=i.fetchQueryByPolicy(s,b,n);return b.fetchPolicy!=="standby"&&D.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),D},T=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){T(),setTimeout(function(){return N.cancel(A)})});var N=new Ai(this.transform(b.query).hasClientExports?this.localState.addExportedVariables(b.query,b.variables,b.context).then(g):g(b.variables));return N.promise.then(T,T),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?Ta("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;i&&this.getObservableQueries(i).forEach(function(f,p){l.set(p,{oq:f,lastDiff:t.getQuery(p).getDiff()})});var d=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(f,p,h){var m=f.watcher instanceof Es&&f.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var v=u(m,p,h);return v===!0&&(v=m.refetch()),v!==!1&&d.set(m,v),v}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(f,p){var h=f.oq,m=f.lastDiff,v=f.diff,_;if(u){if(!v){var y=h.queryInfo;y.reset(),v=y.getDiff()}_=u(h,v,m)}(!u||_===!0)&&(_=h.refetch()),_!==!1&&d.set(h,_),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),d},r.prototype.fetchQueryByPolicy=function(e,t,n){var i=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,d=t.context,f=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:n});var h=function(){return e.getDiff(o)},m=function(g,T){T===void 0&&(T=e.networkStatus||me.loading);var N=g.result;__DEV__&&!l&&!ke(N,{})&&Yu(g.missing);var A=function(D){return ne.of(x({data:D,loading:Wr(T),networkStatus:T},g.complete?null:{partial:!0}))};return N&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:N},context:d,variables:o,onlyRunForcedResolvers:!0}).then(function(D){return A(D.data||void 0)}):u==="none"&&T===me.refetch&&Array.isArray(g.missing)?A(void 0):A(N)},v=s==="no-cache"?0:n===me.refetch&&c!=="merge"?1:2,_=function(){return i.getResultsFromLink(e,v,{variables:o,context:d,fetchPolicy:s,errorPolicy:u})},y=f&&typeof p=="number"&&p!==n&&Wr(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 Es(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 wf=!1;var el=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var n=e.uri,i=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,d=e.connectToDevTools,f=d===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:d,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,v=e.assumeImmutableResults,_=v===void 0?!1:v,y=e.resolvers,b=e.typeDefs,g=e.fragmentMatcher,T=e.name,N=e.version,A=e.link;if(A||(A=n?new Tu({uri:n,credentials:i,headers:a}):jt.empty()),!o)throw __DEV__?new Y(`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 Y(9);if(this.link=A,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),f&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!wf&&f&&__DEV__&&(wf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var D=window.navigator,L=D&&D.userAgent,R=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?R="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(R="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),R&&__DEV__&&P.log("Download the Apollo DevTools for a better development experience: "+R)}this.version=ad,this.localState=new _s({cache:o,client:this,resolvers:y,fragmentMatcher:g}),this.queryManager=new bf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:T,version:N},localState:this.localState,assumeImmutableResults:_,onBroadcast:f?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Oa(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=Oa(this.defaultOptions.query,e)),__DEV__?P(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."):P(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=Oa(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return Ti(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(n){return n!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),n=[],i=[];t.forEach(function(o,s){n.push(s),i.push(o)});var a=Promise.all(i);return a.queries=n,a.results=i,a.catch(function(o){__DEV__&&P.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}();Np(bn?"log":"silent");function ut(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Ir(r){return ut(r)==="object"}function Sf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function tl(r,e){return r.length<124?r:e}var _f="graphql-transport-ws";var bt;(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"})(bt||(bt={}));var Pe;(function(r){r.ConnectionInit="connection_init",r.ConnectionAck="connection_ack",r.Ping="ping",r.Pong="pong",r.Subscribe="subscribe",r.Next="next",r.Error="error",r.Complete="complete"})(Pe||(Pe={}));function Ef(r){if(!Ir(r))throw new Error(`Message is expected to be an object, but got ${ut(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 ${ut(r.type)}`);switch(r.type){case Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(r.payload!=null&&!Ir(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Pe.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ut(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ir(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${ut(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 ${ut(r.payload.query)}`);if(r.payload.variables!=null&&!Ir(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 ${ut(r.payload.variables)}`);if(r.payload.operationName!=null&&ut(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 ${ut(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Ir(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 ${ut(r.payload.extensions)}`);break}case Pe.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ut(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ir(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${ut(r.payload)}`);break}case Pe.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ut(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Sf(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an array of GraphQL errors, but got ${JSON.stringify(r.payload)}`);break}case Pe.Complete:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${ut(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 xf(r,e){return Ef(typeof r=="string"?JSON.parse(r,e):r)}function Pi(r,e){return Ef(r),JSON.stringify(r,e)}function rl(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(we){let Se=1e3;for(let ce=0;ce<we;ce++)Se*=2;await new Promise(ce=>setTimeout(ce,Se+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:d=ks,isFatalConnectionProblem:f,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,we=>{let Se=Math.random()*16|0;return(we=="x"?Se:Se&3|8).toString(16)})},jsonMessageReplacer:v,jsonMessageReviver:_}=r,y;if(h){if(!gv(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 Se={};return{on(ce,ue){return Se[ce]=ue,()=>{delete Se[ce]}},emit(ce){var ue;"id"in ce&&((ue=Se[ce.id])===null||ue===void 0||ue.call(Se,ce))}}})(),we={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[k.emit,p.message]:[k.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:k.on,on(Se,ce){let ue=we[Se];return ue.push(ce),()=>{ue.splice(ue.indexOf(ce),1)}},emit(Se,...ce){for(let ue of[...we[Se]])ue(...ce)}}})();function T(k){let we=[g.on("error",Se=>{we.forEach(ce=>ce()),k(Se)}),g.on("closed",Se=>{we.forEach(ce=>ce()),k(Se)})]}let N,A=0,D,L=!1,R=0,j=!1;async function Ae(){clearTimeout(D);let[k,we]=await(N??(N=new Promise((ue,rr)=>(async()=>{if(L){if(await l(R),!A)return N=void 0,rr({code:1e3,reason:"All Subscriptions Gone"});R++}g.emit("connecting");let re=new b(typeof e=="function"?await e():e,_f),nr,Fr;function Bo(){isFinite(o)&&o>0&&(clearTimeout(Fr),Fr=setTimeout(()=>{re.readyState===b.OPEN&&(re.send(Pi({type:Pe.Ping})),g.emit("ping",!1,void 0))},o))}T(Ze=>{N=void 0,clearTimeout(nr),clearTimeout(Fr),rr(Ze),ks(Ze)&&Ze.code===4499&&(re.close(4499,"Terminated"),re.onerror=null,re.onclose=null)}),re.onerror=Ze=>g.emit("error",Ze),re.onclose=Ze=>g.emit("closed",Ze),re.onopen=async()=>{try{g.emit("opened",re);let Ze=typeof t=="function"?await t():t;if(re.readyState!==b.OPEN)return;re.send(Pi(Ze?{type:Pe.ConnectionInit,payload:Ze}:{type:Pe.ConnectionInit},v)),isFinite(c)&&c>0&&(nr=setTimeout(()=>{re.close(bt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Bo()}catch(Ze){g.emit("error",Ze),re.close(bt.InternalClientError,tl(Ze instanceof Error?Ze.message:new Error(Ze).message,"Internal client error"))}};let bi=!1;re.onmessage=({data:Ze})=>{try{let Ye=xf(Ze,_);if(g.emit("message",Ye),Ye.type==="ping"||Ye.type==="pong"){g.emit(Ye.type,!0,Ye.payload),Ye.type==="pong"?Bo():s||(re.send(Pi(Ye.payload?{type:Pe.Pong,payload:Ye.payload}:{type:Pe.Pong})),g.emit("pong",!1,Ye.payload));return}if(bi)return;if(Ye.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Ye.type}`);clearTimeout(nr),bi=!0,g.emit("connected",re,Ye.payload),L=!1,R=0,ue([re,new Promise((c_,wg)=>T(wg))])}catch(Ye){re.onmessage=null,g.emit("error",Ye),re.close(bt.BadResponse,tl(Ye instanceof Error?Ye.message:new Error(Ye).message,"Bad response"))}}})())));k.readyState===b.CLOSING&&await we;let Se=()=>{},ce=new Promise(ue=>Se=ue);return[k,Se,Promise.race([ce.then(()=>{if(!A){let ue=()=>k.close(1e3,"Normal Closure");isFinite(a)&&a>0?D=setTimeout(()=>{k.readyState===b.OPEN&&ue()},a):ue()}}),we])]}function Ce(k){if(ks(k)&&(mv(k.code)||[bt.InternalServerError,bt.InternalClientError,bt.BadRequest,bt.BadResponse,bt.Unauthorized,bt.SubprotocolNotAcceptable,bt.SubscriberAlreadyExists,bt.TooManyInitialisationRequests].includes(k.code)))throw k;if(j)return!1;if(ks(k)&&k.code===1e3)return A>0;if(!u||R>=u||!d(k)||f?.(k))throw k;return L=!0}return n||(async()=>{for(A++;;)try{let[,,k]=await Ae();await k}catch(k){try{if(!Ce(k))return}catch(we){return i?.(we)}}})(),{on:g.on,subscribe(k,we){let Se=m(k),ce=!1,ue=!1,rr=()=>{A--,ce=!0};return(async()=>{for(A++;;)try{let[re,nr,Fr]=await Ae();if(ce)return nr();let Bo=g.onMessage(Se,bi=>{switch(bi.type){case Pe.Next:{we.next(bi.payload);return}case Pe.Error:{ue=!0,ce=!0,we.error(bi.payload),rr();return}case Pe.Complete:{ce=!0,rr();return}}});re.send(Pi({id:Se,type:Pe.Subscribe,payload:k},v)),rr=()=>{!ce&&re.readyState===b.OPEN&&re.send(Pi({id:Se,type:Pe.Complete},v)),A--,ce=!0,nr()},await Fr.finally(Bo);return}catch(re){if(!Ce(re))return}})().then(()=>{ue||we.complete()}).catch(re=>{we.error(re)}),()=>{ce||rr()}},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 ks(r){return Ir(r)&&"code"in r&&"reason"in r}function mv(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function gv(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function yv(r){return le(r)&&"code"in r&&"reason"in r}var kf=function(r){De(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 ne(function(i){return n.client.subscribe(x(x({},t),{query:wi(t.query)}),{next:i.next.bind(i),complete:i.complete.bind(i),error:function(a){return a instanceof Error?i.error(a):yv(a)?i.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):i.error(new Ar({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(jt);var As="0.12.0";function Is(){return typeof window!="undefined"&&window.self!==window.top}function nl(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function Ot(r,e){nl()&&localStorage.setItem(`${As}/${r}`,e)}function Ts(r){return nl()?localStorage.getItem(`${As}/${r}`):null}function Fa(r){nl()&&localStorage.removeItem(`${As}/${r}`)}function Li(r,e=1e4){return Z(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 ac=function(){return ac=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},ac.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Vs(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Vs=function(t){return typeof t}:Vs=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Vs(r)}function bv(r){return Vs(r)=="object"&&r!==null}var Gh=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function El(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 wv(r){return Kh(r.source,El(r.source,r.start))}function Kh(r,e){var t=r.locationOffset.column-1,n=Qs(t)+r.body,i=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
52
+ `),l=n.split(/\r\n|[\n\r]/g),d=l[i];if(d.length>120){for(var f=Math.floor(c/80),p=c%80,h=[],m=0;m<d.length;m+=80)h.push(d.slice(m,m+80));return u+Af([["".concat(o),h[0]]].concat(h.slice(1,f+1).map(function(v){return["",v]}),[[" ",Qs(p-1)+"^"],["",h[f+1]]]))}return u+Af([["".concat(o-1),l[i-1]],["".concat(o),d],["",Qs(c-1)+"^"],["".concat(o+1),l[i+1]]])}function Af(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 Sv(t,i)+(a?" | "+a:" |")}).join(`
53
+ `)}function Qs(r){return Array(r+1).join(" ")}function Sv(r,e){return Qs(r-e.length)+e}function zs(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?zs=function(t){return typeof t}:zs=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},zs(r)}function If(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 _v(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?If(Object(t),!0).forEach(function(n){Ev(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):If(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function Ev(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function xv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Tf(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 kv(r,e,t){return e&&Tf(r.prototype,e),t&&Tf(r,t),r}function Av(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&&ho(r,e)}function Iv(r){var e=Zh();return function(){var n=mo(r),i;if(e){var a=mo(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Jh(this,i)}}function Jh(r,e){return e&&(zs(e)==="object"||typeof e=="function")?e:Ba(r)}function Ba(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function xl(r){var e=typeof Map=="function"?new Map:void 0;return xl=function(n){if(n===null||!Tv(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 Hs(n,arguments,mo(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),ho(i,n)},xl(r)}function Hs(r,e,t){return Zh()?Hs=Reflect.construct:Hs=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&ho(u,o.prototype),u},Hs.apply(null,arguments)}function Zh(){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 Tv(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function ho(r,e){return ho=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},ho(r,e)}function mo(r){return mo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},mo(r)}var Ov=function(r){Av(t,r);var e=Iv(t);function t(n,i,a,o,s,c,u){var l,d,f,p;xv(this,t),p=e.call(this,n),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=Of(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,v=(_=p.nodes)!==null&&_!==void 0?_:[];m<v.length;m++){var _,y=v[m],b=y.loc;b!=null&&h.push(b)}h=Of(h),p.source=a??((l=h)===null||l===void 0?void 0:l[0].source),p.positions=o??((d=h)===null||d===void 0?void 0:d.map(function(T){return T.start})),p.locations=o&&a?o.map(function(T){return El(a,T)}):(f=h)===null||f===void 0?void 0:f.map(function(T){return El(T.source,T.start)}),p.path=s??void 0;var g=c?.extensions;return u==null&&bv(g)?p.extensions=_v({},g):p.extensions=u??{},Object.defineProperties(Ba(p),{message:{enumerable:!0},locations:{enumerable:p.locations!=null},path:{enumerable:p.path!=null},extensions:{enumerable:p.extensions!=null&&Object.keys(p.extensions).length>0},name:{enumerable:!1},nodes:{enumerable:!1},source:{enumerable:!1},positions:{enumerable:!1},originalError:{enumerable:!1}}),c!=null&&c.stack?(Object.defineProperty(Ba(p),"stack",{value:c.stack,writable:!0,configurable:!0}),Jh(p)):(Error.captureStackTrace?Error.captureStackTrace(Ba(p),t):Object.defineProperty(Ba(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return kv(t,[{key:"toString",value:function(){return Cv(this)}},{key:Gh,get:function(){return"Object"}}]),t}(xl(Error));function Of(r){return r===void 0||r.length===0?void 0:r}function Cv(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
- `+pv(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
+ `+wv(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
- `+Vh(r.source,s)}return e}function Tt(r,e,t){return new wv("Syntax Error: ".concat(t),void 0,r,[e])}var W=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 _v(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var Ev=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,Sl=Ev;function Wh(r){var e=r.prototype.toJSON;typeof e=="function"||_v(0),r.prototype.inspect=e,Sl&&(r.prototype[Sl]=e)}var Hh=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}();Wh(Hh);var Fe=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}();Wh(Fe);var N=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function Bs(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Bs=function(t){return typeof t}:Bs=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bs(r)}var xv=10,Gh=2;function Av(r){return Ac(r,[])}function Ac(r,e){switch(Bs(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":kv(r,e);default:return String(r)}}function kv(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=Ov(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:Ac(i,t)}else if(Array.isArray(r))return Tv(r,t);return Iv(r,t)}function Iv(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Gh)return"["+Cv(r)+"]";var n=t.map(function(i){var a=Ac(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Tv(r,e){if(r.length===0)return"[]";if(e.length>Gh)return"[Array]";for(var t=Math.min(xv,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(Ac(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Ov(r){var e=r[String(Sl)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Cv(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 el(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var Nv=function(e,t){return e instanceof t};function kf(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 $v(r,e,t){return e&&kf(r.prototype,e),t&&kf(r,t),r}var Kh=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"||el(0,"Body must be a string. Received: ".concat(Av(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||el(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||el(0,"column in locationOffset is 1-indexed and must be positive.")}return $v(r,[{key:Bh,get:function(){return"Source"}}]),r}();function Dv(r){return Nv(r,Kh)}var Rv=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 Lv(r){var e=r.split(/\r\n|[\n\r]/g),t=Pv(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&&If(e[i]);)++i;for(var a=e.length;a>i&&If(e[a-1]);)--a;return e.slice(i,a).join(`
58
- `)}function If(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function Pv(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 Fv=function(){function r(t){var n=new Fe(N.SOF,0,0,0,0,null);this.source=t,this.lastToken=n,this.token=n,this.line=1,this.lineStart=0}var e=r.prototype;return e.advance=function(){this.lastToken=this.token;var n=this.token=this.lookahead();return n},e.lookahead=function(){var n=this.token;if(n.kind!==N.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=jv(this,n)}while(n.kind===N.COMMENT);return n},r}();function Mv(r){return r===N.BANG||r===N.DOLLAR||r===N.AMP||r===N.PAREN_L||r===N.PAREN_R||r===N.SPREAD||r===N.COLON||r===N.EQUALS||r===N.AT||r===N.BRACKET_L||r===N.BRACKET_R||r===N.BRACE_L||r===N.PIPE||r===N.BRACE_R}function Wn(r){return isNaN(r)?N.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function jv(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 Fe(N.BANG,a,a+1,s,c,e);case 35:return qv(t,a,s,c,e);case 36:return new Fe(N.DOLLAR,a,a+1,s,c,e);case 38:return new Fe(N.AMP,a,a+1,s,c,e);case 40:return new Fe(N.PAREN_L,a,a+1,s,c,e);case 41:return new Fe(N.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Fe(N.SPREAD,a,a+3,s,c,e);break;case 58:return new Fe(N.COLON,a,a+1,s,c,e);case 61:return new Fe(N.EQUALS,a,a+1,s,c,e);case 64:return new Fe(N.AT,a,a+1,s,c,e);case 91:return new Fe(N.BRACKET_L,a,a+1,s,c,e);case 93:return new Fe(N.BRACKET_R,a,a+1,s,c,e);case 123:return new Fe(N.BRACE_L,a,a+1,s,c,e);case 124:return new Fe(N.PIPE,a,a+1,s,c,e);case 125:return new Fe(N.BRACE_R,a,a+1,s,c,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?Qv(t,a,s,c,e,r):Vv(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 Bv(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 Wv(t,a,s,c,e)}throw Tt(t,a,Uv(o))}var u=r.line,l=1+a-r.lineStart;return new Fe(N.EOF,i,i,u,l,e)}function Uv(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(Wn(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(Wn(r),".")}function qv(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 Fe(N.COMMENT,e,s,t,n,i,a.slice(e+1,s))}function Bv(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 Tt(r,c,"Invalid number, unexpected digit after 0: ".concat(Wn(s),"."))}else c=tl(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=tl(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=tl(r,c,s),s=o.charCodeAt(c)),s===46||Hv(s))throw Tt(r,c,"Invalid number, expected digit but got: ".concat(Wn(s),"."));return new Fe(u?N.FLOAT:N.INT,e,c,n,i,a,o.slice(e,c))}function tl(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 Tt(r,i,"Invalid number, expected digit but got: ".concat(Wn(a),"."))}function Vv(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 Fe(N.STRING,e,o+1,t,n,i,u);if(c<32&&c!==9)throw Tt(r,o,"Invalid character within String: ".concat(Wn(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=zv(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var d=a.slice(o+1,o+5);throw Tt(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw Tt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw Tt(r,o,"Unterminated string.")}function Qv(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 Fe(N.BLOCK_STRING,e,s+3,t,n,i,Lv(l));if(u<32&&u!==9&&u!==10&&u!==13)throw Tt(r,s,"Invalid character within String: ".concat(Wn(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 Tt(r,s,"Unterminated string.")}function zv(r,e,t,n){return As(r)<<12|As(e)<<8|As(t)<<4|As(n)}function As(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function Wv(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 Fe(N.NAME,e,s,t,n,i,a.slice(e,s))}function Hv(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function Gv(r,e){var t=new Kv(r,e);return t.parseDocument()}var Kv=function(){function r(t,n){var i=Dv(t)?t:new Kh(t);this._lexer=new Fv(i),this._options=n}var e=r.prototype;return e.parseName=function(){var n=this.expectToken(N.NAME);return{kind:W.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:W.DOCUMENT,definitions:this.many(N.SOF,this.parseDefinition,N.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(N.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(N.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(N.BRACE_L))return{kind:W.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(N.NAME)&&(a=this.parseName()),{kind:W.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(N.NAME);switch(n.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(n)},e.parseVariableDefinitions=function(){return this.optionalMany(N.PAREN_L,this.parseVariableDefinition,N.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:W.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(N.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(N.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(N.DOLLAR),{kind:W.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:W.SELECTION_SET,selections:this.many(N.BRACE_L,this.parseSelection,N.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(N.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(N.COLON)?(a=i,o=this.parseName()):o=i,{kind:W.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(N.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(N.PAREN_L,i,N.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(N.COLON),{kind:W.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:W.ARGUMENT,name:this.parseName(),value:(this.expectToken(N.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(N.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(N.NAME)?{kind:W.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:W.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:W.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:W.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case N.BRACKET_L:return this.parseList(n);case N.BRACE_L:return this.parseObject(n);case N.INT:return this._lexer.advance(),{kind:W.INT,value:i.value,loc:this.loc(i)};case N.FLOAT:return this._lexer.advance(),{kind:W.FLOAT,value:i.value,loc:this.loc(i)};case N.STRING:case N.BLOCK_STRING:return this.parseStringLiteral();case N.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:W.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:W.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:W.NULL,loc:this.loc(i)};default:return{kind:W.ENUM,value:i.value,loc:this.loc(i)}}case N.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:W.STRING,value:n.value,block:n.kind===N.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:W.LIST,values:this.any(N.BRACKET_L,o,N.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:W.OBJECT,fields:this.any(N.BRACE_L,o,N.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(N.COLON),{kind:W.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(N.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(N.AT),{kind:W.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(N.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(N.BRACKET_R),i={kind:W.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(N.BANG)?{kind:W.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:W.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===N.NAME)switch(n.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(n)},e.peekDescription=function(){return this.peek(N.STRING)||this.peek(N.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(N.BRACE_L,this.parseOperationTypeDefinition,N.BRACE_R);return{kind:W.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(N.COLON);var a=this.parseNamedType();return{kind:W.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:W.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:W.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(N.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(N.AMP)||this.peek(N.NAME));return i}return this.delimitedMany(N.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(N.BRACE_L)&&this._lexer.lookahead().kind===N.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(N.BRACE_L,this.parseFieldDefinition,N.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(N.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:W.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:c,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(N.PAREN_L,this.parseInputValueDef,N.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(N.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(N.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:W.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:W.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:W.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(N.EQUALS)?this.delimitedMany(N.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:W.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(N.BRACE_L,this.parseEnumValueDefinition,N.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:W.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:W.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(N.BRACE_L,this.parseInputValueDef,N.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===N.NAME)switch(n.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(n)},e.parseSchemaExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var i=this.parseDirectives(!0),a=this.optionalMany(N.BRACE_L,this.parseOperationTypeDefinition,N.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:W.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:W.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:W.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:W.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:W.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:W.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:W.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(N.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:W.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(N.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(Rv[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 Hh(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 Tt(this._lexer.source,i.start,"Expected ".concat(Jh(n),", found ").concat(rl(i),"."))},e.expectOptionalToken=function(n){var i=this._lexer.token;if(i.kind===n)return this._lexer.advance(),i},e.expectKeyword=function(n){var i=this._lexer.token;if(i.kind===N.NAME&&i.value===n)this._lexer.advance();else throw Tt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(rl(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===N.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return Tt(this._lexer.source,i.start,"Unexpected ".concat(rl(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 rl(r){var e=r.value;return Jh(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function Jh(r){return Mv(r)?'"'.concat(r,'"'):r}var Vs=new Map,_l=new Map,Zh=!0,rc=!1;function Yh(r){return r.replace(/[\s,]+/g," ").trim()}function Jv(r){return Yh(r.source.body.substring(r.start,r.end))}function Zv(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=Jv(n.loc),o=_l.get(i);o&&!o.has(a)?Zh&&console.warn("Warning: fragment with name "+i+` already exists.
57
+ `+Kh(r.source,s)}return e}function Nt(r,e,t){return new Ov("Syntax Error: ".concat(t),void 0,r,[e])}var W=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 Nv(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var $v=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,kl=$v;function Yh(r){var e=r.prototype.toJSON;typeof e=="function"||Nv(0),r.prototype.inspect=e,kl&&(r.prototype[kl]=e)}var Xh=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}();Yh(Xh);var Me=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}();Yh(Me);var $=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 Ws(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ws=function(t){return typeof t}:Ws=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ws(r)}var Dv=10,em=2;function Rv(r){return Tc(r,[])}function Tc(r,e){switch(Ws(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Pv(r,e);default:return String(r)}}function Pv(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=Mv(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:Tc(i,t)}else if(Array.isArray(r))return Fv(r,t);return Lv(r,t)}function Lv(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>em)return"["+Uv(r)+"]";var n=t.map(function(i){var a=Tc(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function Fv(r,e){if(r.length===0)return"[]";if(e.length>em)return"[Array]";for(var t=Math.min(Dv,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(Tc(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Mv(r){var e=r[String(kl)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Uv(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 il(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var jv=function(e,t){return e instanceof t};function Cf(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 qv(r,e,t){return e&&Cf(r.prototype,e),t&&Cf(r,t),r}var tm=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"||il(0,"Body must be a string. Received: ".concat(Rv(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||il(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||il(0,"column in locationOffset is 1-indexed and must be positive.")}return qv(r,[{key:Gh,get:function(){return"Source"}}]),r}();function Bv(r){return jv(r,tm)}var Vv=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 Qv(r){var e=r.split(/\r\n|[\n\r]/g),t=zv(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&&Nf(e[i]);)++i;for(var a=e.length;a>i&&Nf(e[a-1]);)--a;return e.slice(i,a).join(`
58
+ `)}function Nf(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function zv(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 Hv=function(){function r(t){var n=new Me($.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!==$.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=Gv(this,n)}while(n.kind===$.COMMENT);return n},r}();function Wv(r){return r===$.BANG||r===$.DOLLAR||r===$.AMP||r===$.PAREN_L||r===$.PAREN_R||r===$.SPREAD||r===$.COLON||r===$.EQUALS||r===$.AT||r===$.BRACKET_L||r===$.BRACKET_R||r===$.BRACE_L||r===$.PIPE||r===$.BRACE_R}function zn(r){return isNaN(r)?$.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function Gv(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 Me($.BANG,a,a+1,s,c,e);case 35:return Jv(t,a,s,c,e);case 36:return new Me($.DOLLAR,a,a+1,s,c,e);case 38:return new Me($.AMP,a,a+1,s,c,e);case 40:return new Me($.PAREN_L,a,a+1,s,c,e);case 41:return new Me($.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Me($.SPREAD,a,a+3,s,c,e);break;case 58:return new Me($.COLON,a,a+1,s,c,e);case 61:return new Me($.EQUALS,a,a+1,s,c,e);case 64:return new Me($.AT,a,a+1,s,c,e);case 91:return new Me($.BRACKET_L,a,a+1,s,c,e);case 93:return new Me($.BRACKET_R,a,a+1,s,c,e);case 123:return new Me($.BRACE_L,a,a+1,s,c,e);case 124:return new Me($.PIPE,a,a+1,s,c,e);case 125:return new Me($.BRACE_R,a,a+1,s,c,e);case 34:return n.charCodeAt(a+1)===34&&n.charCodeAt(a+2)===34?Xv(t,a,s,c,e,r):Yv(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 Zv(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 tb(t,a,s,c,e)}throw Nt(t,a,Kv(o))}var u=r.line,l=1+a-r.lineStart;return new Me($.EOF,i,i,u,l,e)}function Kv(r){return r<32&&r!==9&&r!==10&&r!==13?"Cannot contain the invalid character ".concat(zn(r),"."):r===39?`Unexpected single quote character ('), did you mean to use a double quote (")?`:"Cannot parse the unexpected character ".concat(zn(r),".")}function Jv(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 Me($.COMMENT,e,s,t,n,i,a.slice(e+1,s))}function Zv(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 Nt(r,c,"Invalid number, unexpected digit after 0: ".concat(zn(s),"."))}else c=al(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=al(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=al(r,c,s),s=o.charCodeAt(c)),s===46||rb(s))throw Nt(r,c,"Invalid number, expected digit but got: ".concat(zn(s),"."));return new Me(u?$.FLOAT:$.INT,e,c,n,i,a,o.slice(e,c))}function al(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 Nt(r,i,"Invalid number, expected digit but got: ".concat(zn(a),"."))}function Yv(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 Me($.STRING,e,o+1,t,n,i,u);if(c<32&&c!==9)throw Nt(r,o,"Invalid character within String: ".concat(zn(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=eb(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var d=a.slice(o+1,o+5);throw Nt(r,o,"Invalid character escape sequence: \\u".concat(d,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw Nt(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw Nt(r,o,"Unterminated string.")}function Xv(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 Me($.BLOCK_STRING,e,s+3,t,n,i,Qv(l));if(u<32&&u!==9&&u!==10&&u!==13)throw Nt(r,s,"Invalid character within String: ".concat(zn(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 Nt(r,s,"Unterminated string.")}function eb(r,e,t,n){return Os(r)<<12|Os(e)<<8|Os(t)<<4|Os(n)}function Os(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function tb(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 Me($.NAME,e,s,t,n,i,a.slice(e,s))}function rb(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function nb(r,e){var t=new ib(r,e);return t.parseDocument()}var ib=function(){function r(t,n){var i=Bv(t)?t:new tm(t);this._lexer=new Hv(i),this._options=n}var e=r.prototype;return e.parseName=function(){var n=this.expectToken($.NAME);return{kind:W.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:W.DOCUMENT,definitions:this.many($.SOF,this.parseDefinition,$.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek($.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($.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($.BRACE_L))return{kind:W.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek($.NAME)&&(a=this.parseName()),{kind:W.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($.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($.PAREN_L,this.parseVariableDefinition,$.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:W.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken($.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken($.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($.DOLLAR),{kind:W.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:W.SELECTION_SET,selections:this.many($.BRACE_L,this.parseSelection,$.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek($.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken($.COLON)?(a=i,o=this.parseName()):o=i,{kind:W.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek($.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany($.PAREN_L,i,$.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken($.COLON),{kind:W.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:W.ARGUMENT,name:this.parseName(),value:(this.expectToken($.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken($.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek($.NAME)?{kind:W.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:W.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:W.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:W.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 $.BRACKET_L:return this.parseList(n);case $.BRACE_L:return this.parseObject(n);case $.INT:return this._lexer.advance(),{kind:W.INT,value:i.value,loc:this.loc(i)};case $.FLOAT:return this._lexer.advance(),{kind:W.FLOAT,value:i.value,loc:this.loc(i)};case $.STRING:case $.BLOCK_STRING:return this.parseStringLiteral();case $.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:W.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:W.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:W.NULL,loc:this.loc(i)};default:return{kind:W.ENUM,value:i.value,loc:this.loc(i)}}case $.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:W.STRING,value:n.value,block:n.kind===$.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:W.LIST,values:this.any($.BRACKET_L,o,$.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:W.OBJECT,fields:this.any($.BRACE_L,o,$.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken($.COLON),{kind:W.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek($.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken($.AT),{kind:W.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken($.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken($.BRACKET_R),i={kind:W.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken($.BANG)?{kind:W.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:W.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===$.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($.STRING)||this.peek($.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($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);return{kind:W.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($.COLON);var a=this.parseNamedType();return{kind:W.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:W.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:W.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($.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken($.AMP)||this.peek($.NAME));return i}return this.delimitedMany($.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek($.BRACE_L)&&this._lexer.lookahead().kind===$.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany($.BRACE_L,this.parseFieldDefinition,$.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken($.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:W.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:c,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany($.PAREN_L,this.parseInputValueDef,$.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken($.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken($.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:W.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:W.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:W.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken($.EQUALS)?this.delimitedMany($.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:W.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany($.BRACE_L,this.parseEnumValueDefinition,$.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:W.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:W.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany($.BRACE_L,this.parseInputValueDef,$.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===$.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($.BRACE_L,this.parseOperationTypeDefinition,$.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:W.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:W.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:W.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:W.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:W.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:W.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:W.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($.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:W.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany($.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(Vv[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 Xh(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 Nt(this._lexer.source,i.start,"Expected ".concat(rm(n),", found ").concat(ol(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===$.NAME&&i.value===n)this._lexer.advance();else throw Nt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(ol(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===$.NAME&&i.value===n?(this._lexer.advance(),!0):!1},e.unexpected=function(n){var i=n??this._lexer.token;return Nt(this._lexer.source,i.start,"Unexpected ".concat(ol(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 ol(r){var e=r.value;return rm(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function rm(r){return Wv(r)?'"'.concat(r,'"'):r}var Gs=new Map,Al=new Map,nm=!0,oc=!1;function im(r){return r.replace(/[\s,]+/g," ").trim()}function ab(r){return im(r.source.body.substring(r.start,r.end))}function ob(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=ab(n.loc),o=Al.get(i);o&&!o.has(a)?nm&&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||_l.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),tc(tc({},r),{definitions:t})}function Yv(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 Xv(r){var e=Yh(r);if(!Vs.has(e)){var t=Gv(r,{experimentalFragmentVariables:rc,allowLegacyFragmentVariables:rc});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Vs.set(e,Yv(Zv(t)))}return Vs.get(e)}function x(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]}),Xv(n)}function eb(){Vs.clear(),_l.clear()}function tb(){Zh=!1}function rb(){rc=!0}function nb(){rc=!1}var Pa={gql:x,resetCaches:eb,disableFragmentWarnings:tb,enableExperimentalFragmentVariables:rb,disableExperimentalFragmentVariables:nb};(function(r){r.gql=Pa.gql,r.resetCaches=Pa.resetCaches,r.disableFragmentWarnings=Pa.disableFragmentWarnings,r.enableExperimentalFragmentVariables=Pa.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=Pa.disableExperimentalFragmentVariables})(x||(x={}));x.default=x;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 ib(){}function mn(){return ib}var Z=mn,S=mn,Ge=mn,ye=mn,H=mn,$t=mn,ab=mn,Wl=mn,Xh=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},em=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hn=class{constructor(e){this.code=e}};Xh([S(),em("design:type",String)],Hn.prototype,"code",void 0);Hn=Xh([H(),em("design:paramtypes",[String])],Hn);var Hl=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},Gl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},mr=class{constructor(e,t){this.address=e,this.name=t}};Hl([S(),Gl("design:type",String)],mr.prototype,"address",void 0);Hl([S(),Gl("design:type",String)],mr.prototype,"name",void 0);mr=Hl([H(),Gl("design:paramtypes",[String,String])],mr);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},Ve=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Rr=class{constructor(e,t){this.key=t,this.signature=e}};Ie([S(),Ve("design:type",String)],Rr.prototype,"signature",void 0);Ie([S(),Ve("design:type",String)],Rr.prototype,"key",void 0);Ie([S(),Ve("design:type",Boolean)],Rr.prototype,"valid",void 0);Ie([S(),Ve("design:type",Boolean)],Rr.prototype,"invalid",void 0);Rr=Ie([H(),Ge(),Ve("design:paramtypes",[String,String])],Rr);var Gn=class{};Ie([S(),Ve("design:type",String)],Gn.prototype,"signature",void 0);Ie([S(),Ve("design:type",String)],Gn.prototype,"key",void 0);Ie([S(),Ve("design:type",Boolean)],Gn.prototype,"valid",void 0);Ie([S(),Ve("design:type",Boolean)],Gn.prototype,"invalid",void 0);Gn=Ie([Ge()],Gn);function gn(r){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Ie([S(),Ve("design:type",String)],e.prototype,"author",void 0),Ie([S(),Ve("design:type",String)],e.prototype,"timestamp",void 0),Ie([S(),Ve("design:type",Object)],e.prototype,"data",void 0),Ie([S(),Ve("design:type",Rr)],e.prototype,"proof",void 0),e=Ie([H(),Ve("design:paramtypes",[String,String,Object,Rr])],e),e}function ob(r){let e=class{};return Ie([S(),Ve("design:type",String)],e.prototype,"author",void 0),Ie([S(),Ve("design:type",String)],e.prototype,"timestamp",void 0),Ie([S(),Ve("design:type",Object)],e.prototype,"data",void 0),Ie([S(),Ve("design:type",Gn)],e.prototype,"proof",void 0),e=Ie([Ge()],e),e}var Tf=class extends gn(){};Tf=Ie([H()],Tf);var nc=class extends gn(){};Ie([S(),Ve("design:type",mr)],nc.prototype,"language",void 0);Ie([S(),Ve("design:type",Hn)],nc.prototype,"icon",void 0);nc=Ie([H()],nc);function TT(r){return r&&r.author&&r.timestamp&&r.data}var je=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},tt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},St=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};je([S(),tt("design:type",String)],St.prototype,"source",void 0);je([S(),tt("design:type",String)],St.prototype,"target",void 0);je([S(),tt("design:type",String)],St.prototype,"predicate",void 0);St=je([H(),tt("design:paramtypes",[Object])],St);var ic=class{};je([S(),tt("design:type",Array)],ic.prototype,"additions",void 0);je([S(),tt("design:type",Array)],ic.prototype,"removals",void 0);ic=je([Ge()],ic);var ac=class{constructor(e,t){this.additions=e,this.removals=t}};je([S(),tt("design:type",Array)],ac.prototype,"additions",void 0);je([S(),tt("design:type",Array)],ac.prototype,"removals",void 0);ac=je([H(),tt("design:paramtypes",[Array,Array])],ac);var po=class{};je([S(),tt("design:type",String)],po.prototype,"source",void 0);je([S(),tt("design:type",String)],po.prototype,"target",void 0);je([S(),tt("design:type",String)],po.prototype,"predicate",void 0);po=je([Ge()],po);var un=class extends gn(){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}};je([S(),tt("design:type",String)],un.prototype,"status",void 0);un=je([H()],un);var El=class extends ob(){};je([S(),tt("design:type",String)],El.prototype,"status",void 0);El=je([Ge()],El);function LT(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 oc=class{constructor(e,t){this.oldLink=e,this.newLink=t}};je([S(),tt("design:type",un)],oc.prototype,"oldLink",void 0);je([S(),tt("design:type",un)],oc.prototype,"newLink",void 0);oc=je([H(),tt("design:paramtypes",[un,un])],oc);var ni=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Ao=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},xl,br=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}};ni([S(),Ao("design:type",Array)],br.prototype,"links",void 0);br=ni([H(),Ao("design:paramtypes",[Array])],br);var sc=class{};ni([S(),Ao("design:type",Array)],sc.prototype,"links",void 0);sc=ni([Ge()],sc);var Al=xl=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new xl;return t.links.push(e),t}};ni([S(),Ao("design:type",Array)],Al.prototype,"links",void 0);Al=xl=ni([Ge(),Ao("design:paramtypes",[Array])],Al);var Kn=class extends gn(){};Kn=ni([H()],Kn);var U=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},q=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},rn=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new br}};U([S(),q("design:type",String)],rn.prototype,"did",void 0);U([S(),q("design:type",br)],rn.prototype,"perspective",void 0);U([S(),q("design:type",String)],rn.prototype,"directMessageLanguage",void 0);rn=U([H(),q("design:paramtypes",[String,br])],rn);var Of=class extends gn(){};Of=U([H()],Of);var ln=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}};U([S(),q("design:type",String)],ln.prototype,"did",void 0);U([S(),q("design:type",String)],ln.prototype,"didSigningKeyId",void 0);U([S(),q("design:type",String)],ln.prototype,"deviceKeyType",void 0);U([S(),q("design:type",String)],ln.prototype,"deviceKey",void 0);U([S(),q("design:type",String)],ln.prototype,"deviceKeySignedByDid",void 0);U([S(),q("design:type",String)],ln.prototype,"didSignedByDeviceKey",void 0);ln=U([H(),q("design:paramtypes",[String,String,String,String,String,String])],ln);var pn=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}};U([S(),q("design:type",String)],pn.prototype,"did",void 0);U([S(),q("design:type",String)],pn.prototype,"didSigningKeyId",void 0);U([S(),q("design:type",String)],pn.prototype,"deviceKeyType",void 0);U([S(),q("design:type",String)],pn.prototype,"deviceKey",void 0);U([S(),q("design:type",String)],pn.prototype,"deviceKeySignedByDid",void 0);U([S(),q("design:type",String)],pn.prototype,"didSignedByDeviceKey",void 0);pn=U([Ge(),q("design:paramtypes",[String,String,String,String,String,String])],pn);var cc=class{constructor(e,t){this.signature=e,this.publicKey=t}};U([S(),q("design:type",String)],cc.prototype,"signature",void 0);U([S(),q("design:type",String)],cc.prototype,"publicKey",void 0);cc=U([H(),q("design:paramtypes",[String,String])],cc);var Hi=class{constructor(e,t){this.domain=e,this.pointers=t}};U([S(),q("design:type",String)],Hi.prototype,"domain",void 0);U([S(),q("design:type",Array)],Hi.prototype,"pointers",void 0);Hi=U([H(),q("design:paramtypes",[String,Array])],Hi);var uc=class{constructor(e,t){this.with=e,this.can=t}};U([S(),q("design:type",Hi)],uc.prototype,"with",void 0);U([S(),q("design:type",Array)],uc.prototype,"can",void 0);uc=U([H(),q("design:paramtypes",[Hi,Array])],uc);var Lr=class{constructor(e,t,n,i,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};U([S(),q("design:type",String)],Lr.prototype,"appName",void 0);U([S(),q("design:type",String)],Lr.prototype,"appDesc",void 0);U([S(),q("design:type",String)],Lr.prototype,"appUrl",void 0);U([S(),q("design:type",String)],Lr.prototype,"appIconPath",void 0);U([S(),q("design:type",Array)],Lr.prototype,"capabilities",void 0);Lr=U([H(),q("design:paramtypes",[String,String,String,Array,String])],Lr);var Gi=class{constructor(e,t,n,i){this.requestId=e,this.auth=t,this.token=n,this.revoked=i}};U([S(),q("design:type",String)],Gi.prototype,"requestId",void 0);U([S(),q("design:type",String)],Gi.prototype,"token",void 0);U([S(),q("design:type",Boolean)],Gi.prototype,"revoked",void 0);U([S(),q("design:type",Lr)],Gi.prototype,"auth",void 0);Gi=U([H(),q("design:paramtypes",[String,Lr,String,Boolean])],Gi);var Ki=class{constructor(e,t){this.domain=e,this.pointers=t}};U([S(),q("design:type",String)],Ki.prototype,"domain",void 0);U([S(),q("design:type",Array)],Ki.prototype,"pointers",void 0);Ki=U([Ge(),q("design:paramtypes",[String,Array])],Ki);var lc=class{constructor(e,t){this.with=e,this.can=t}};U([S(),q("design:type",Ki)],lc.prototype,"with",void 0);U([S(),q("design:type",Array)],lc.prototype,"can",void 0);lc=U([Ge(),q("design:paramtypes",[Ki,Array])],lc);var wr=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}};U([S(),q("design:type",String)],wr.prototype,"appName",void 0);U([S(),q("design:type",String)],wr.prototype,"appDesc",void 0);U([S(),q("design:type",String)],wr.prototype,"appDomain",void 0);U([S(),q("design:type",String)],wr.prototype,"appUrl",void 0);U([S(),q("design:type",String)],wr.prototype,"appIconPath",void 0);U([S(),q("design:type",Array)],wr.prototype,"capabilities",void 0);wr=U([Ge(),q("design:paramtypes",[String,String,String,String,String,Array])],wr);var Jn=class{constructor(e,t,n){this.did=e,this.success=t,this.error=n}};U([S(),q("design:type",String)],Jn.prototype,"did",void 0);U([S(),q("design:type",Boolean)],Jn.prototype,"success",void 0);U([S(),q("design:type",String)],Jn.prototype,"error",void 0);Jn=U([H(),q("design:paramtypes",[String,Boolean,String])],Jn);var na=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},ia=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},qt=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)}};na([S(),ia("design:type",Boolean)],qt.prototype,"isInitialized",void 0);na([S(),ia("design:type",Boolean)],qt.prototype,"isUnlocked",void 0);na([S(),ia("design:type",String)],qt.prototype,"did",void 0);na([S(),ia("design:type",String)],qt.prototype,"didDocument",void 0);na([S(),ia("design:type",String)],qt.prototype,"error",void 0);qt=na([H(),ia("design:paramtypes",[Object])],qt);var Cf=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},Le=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)},vt,bt,kl=class{constructor(e,t){vt.set(this,void 0),bt.set(this,void 0),Cf(this,vt,e,"f"),Cf(this,bt,t,"f")}async otherAgents(){return await Le(this,vt,"f").otherAgents(Le(this,bt,"f"))}async hasTelepresenceAdapter(){return await Le(this,vt,"f").hasTelepresenceAdapter(Le(this,bt,"f"))}async onlineAgents(){return await Le(this,vt,"f").onlineAgents(Le(this,bt,"f"))}async setOnlineStatus(e){return await Le(this,vt,"f").setOnlineStatus(Le(this,bt,"f"),e)}async setOnlineStatusU(e){return await Le(this,vt,"f").setOnlineStatusU(Le(this,bt,"f"),e)}async sendSignal(e,t){return await Le(this,vt,"f").sendSignal(Le(this,bt,"f"),e,t)}async sendSignalU(e,t){return await Le(this,vt,"f").sendSignalU(Le(this,bt,"f"),e,t)}async sendBroadcast(e,t=!1){return await Le(this,vt,"f").sendBroadcast(Le(this,bt,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Le(this,vt,"f").sendBroadcastU(Le(this,bt,"f"),e,t)}async addSignalHandler(e){await Le(this,vt,"f").addSignalHandler(Le(this,bt,"f"),e)}removeSignalHandler(e){Le(this,vt,"f").removeSignalHandler(Le(this,bt,"f"),e)}};vt=new WeakMap,bt=new WeakMap;var ii=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},ai=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)}};ii([S(),ai("design:type",String)],fe.prototype,"source",void 0);ii([S(),ai("design:type",String)],fe.prototype,"target",void 0);ii([S(),ai("design:type",String)],fe.prototype,"predicate",void 0);ii([S(),ai("design:type",Date)],fe.prototype,"fromDate",void 0);ii([S(),ai("design:type",Date)],fe.prototype,"untilDate",void 0);ii([S(),ai("design:type",Number)],fe.prototype,"limit",void 0);fe=ii([H(),Ge(),ai("design:paramtypes",[Object])],fe);var Nf=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)},wt,Or;function ks(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var Se=class{constructor(){wt.set(this,void 0),Or.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 Nf(t,Or,e,"f"),t}static from(e){let t=new Se;return Nf(t,wt,e,"f"),t}toUrl(){if(Xe(this,Or,"f")&&!Xe(this,wt,"f"))return Xe(this,Or,"f");if(!Xe(this,Or,"f")&&(Xe(this,wt,"f")===void 0||Xe(this,wt,"f")===""||Xe(this,wt,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof Xe(this,wt,"f")){case"string":e=`string:${ks(Xe(this,wt,"f"))}`;break;case"number":e=`number:${ks(Xe(this,wt,"f"))}`;break;case"boolean":e=`boolean:${ks(Xe(this,wt,"f"))}`;break;case"object":e=`json:${ks(JSON.stringify(Xe(this,wt,"f")))}`;break}return`literal://${e}`}get(){if(Xe(this,wt,"f"))return Xe(this,wt,"f");if(!Xe(this,Or,"f"))throw new Error("Can't render empty Literal");if(!Xe(this,Or,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=Xe(this,Or,"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}`)}};wt=new WeakMap,Or=new WeakMap;function Yt(r){return r.charAt(0).toUpperCase()+r.slice(1)}function pc(r){return`set${Yt(r)}`}function tm(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function sb(r){return`add${Yt(tm(r))}`}function cb(r){return`remove${Yt(tm(r))}`}function ub(r){return`set${Yt(r)}`}function $n(r){if(Array.isArray(r))return`[${r.map($n).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 nl=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},X=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)},lt,pt,Pe,ao=class{constructor(r,e,t){lt.set(this,void 0),pt.set(this,void 0),Pe.set(this,void 0),nl(this,lt,e,"f"),nl(this,pt,t,"f"),nl(this,Pe,r,"f")}get baseExpression(){return X(this,lt,"f")}async init(){let isInstance=await X(this,Pe,"f").isSubjectInstance(X(this,lt,"f"),X(this,pt,"f"));if(!isInstance)throw`Not a valid subject instance of ${X(this,pt,"f")} for ${X(this,lt,"f")}`;let results=await X(this,Pe,"f").infer(`subject_class("${X(this,pt,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await X(this,Pe,"f").infer(`subject_class("${X(this,pt,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await X(this,Pe,"f").getPropertyValueViaSurreal(X(this,lt,"f"),X(this,pt,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await X(this,Pe,"f").infer(`subject_class("${X(this,pt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await X(this,Pe,"f").infer(`subject_class("${X(this,pt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[pc(property)]=async r=>{resolveLanguage&&(r=await X(this,Pe,"f").createExpression(r,resolveLanguage)),await X(this,Pe,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:r}])}}let results2=await X(this,Pe,"f").infer(`subject_class("${X(this,pt,"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 X(this,Pe,"f").getRelationValuesViaSurreal(X(this,lt,"f"),X(this,pt,"f"),r)}catch(e){return console.warn(`Failed to get relation ${r} via SurrealDB:`,e),[]}}});let adders=await X(this,Pe,"f").infer(`subject_class("${X(this,pt,"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[sb(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>X(this,Pe,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:e}]))):await X(this,Pe,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:r}])}}let removers=await X(this,Pe,"f").infer(`subject_class("${X(this,pt,"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[cb(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>X(this,Pe,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:e}]))):await X(this,Pe,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:r}])}}let relationSetters=await X(this,Pe,"f").infer(`subject_class("${X(this,pt,"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[ub(relation)]=async r=>{Array.isArray(r)?await X(this,Pe,"f").executeAction(actions,X(this,lt,"f"),r.map(e=>({name:"value",value:e}))):await X(this,Pe,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:r}])}}}};lt=new WeakMap,pt=new WeakMap,Pe=new WeakMap;function $f(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 Df(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 Rf(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 nn=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let n=$f(e),i=Rf(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#> .
61
+ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Al.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),ac(ac({},r),{definitions:t})}function sb(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 cb(r){var e=im(r);if(!Gs.has(e)){var t=nb(r,{experimentalFragmentVariables:oc,allowLegacyFragmentVariables:oc});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Gs.set(e,sb(ob(t)))}return Gs.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]}),cb(n)}function ub(){Gs.clear(),Al.clear()}function lb(){nm=!1}function pb(){oc=!0}function db(){oc=!1}var Ma={gql:E,resetCaches:ub,disableFragmentWarnings:lb,enableExperimentalFragmentVariables:pb,disableExperimentalFragmentVariables:db};(function(r){r.gql=Ma.gql,r.resetCaches=Ma.resetCaches,r.disableFragmentWarnings=Ma.disableFragmentWarnings,r.enableExperimentalFragmentVariables=Ma.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=Ma.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 fb(){}function hn(){return fb}var G=hn,w=hn,Ke=hn,de=hn,z=hn,kt=hn,hb=hn,Jl=hn,am=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},om=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hn=class{constructor(e){this.code=e}};am([w(),om("design:type",String)],Hn.prototype,"code",void 0);Hn=am([z(),om("design:paramtypes",[String])],Hn);var Zl=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},Yl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},mr=class{constructor(e,t){this.address=e,this.name=t}};Zl([w(),Yl("design:type",String)],mr.prototype,"address",void 0);Zl([w(),Yl("design:type",String)],mr.prototype,"name",void 0);mr=Zl([z(),Yl("design:paramtypes",[String,String])],mr);var Te=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Qe=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Rr=class{constructor(e,t){this.key=t,this.signature=e}};Te([w(),Qe("design:type",String)],Rr.prototype,"signature",void 0);Te([w(),Qe("design:type",String)],Rr.prototype,"key",void 0);Te([w(),Qe("design:type",Boolean)],Rr.prototype,"valid",void 0);Te([w(),Qe("design:type",Boolean)],Rr.prototype,"invalid",void 0);Rr=Te([z(),Ke(),Qe("design:paramtypes",[String,String])],Rr);var Wn=class{};Te([w(),Qe("design:type",String)],Wn.prototype,"signature",void 0);Te([w(),Qe("design:type",String)],Wn.prototype,"key",void 0);Te([w(),Qe("design:type",Boolean)],Wn.prototype,"valid",void 0);Te([w(),Qe("design:type",Boolean)],Wn.prototype,"invalid",void 0);Wn=Te([Ke()],Wn);function mn(r){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Te([w(),Qe("design:type",String)],e.prototype,"author",void 0),Te([w(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Te([w(),Qe("design:type",Object)],e.prototype,"data",void 0),Te([w(),Qe("design:type",Rr)],e.prototype,"proof",void 0),e=Te([z(),Qe("design:paramtypes",[String,String,Object,Rr])],e),e}function mb(r){let e=class{};return Te([w(),Qe("design:type",String)],e.prototype,"author",void 0),Te([w(),Qe("design:type",String)],e.prototype,"timestamp",void 0),Te([w(),Qe("design:type",Object)],e.prototype,"data",void 0),Te([w(),Qe("design:type",Wn)],e.prototype,"proof",void 0),e=Te([Ke()],e),e}var $f=class extends mn(){};$f=Te([z()],$f);var sc=class extends mn(){};Te([w(),Qe("design:type",mr)],sc.prototype,"language",void 0);Te([w(),Qe("design:type",Hn)],sc.prototype,"icon",void 0);sc=Te([z()],sc);function HT(r){return r&&r.author&&r.timestamp&&r.data}var je=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},rt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Et=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};je([w(),rt("design:type",String)],Et.prototype,"source",void 0);je([w(),rt("design:type",String)],Et.prototype,"target",void 0);je([w(),rt("design:type",String)],Et.prototype,"predicate",void 0);Et=je([z(),rt("design:paramtypes",[Object])],Et);var cc=class{};je([w(),rt("design:type",Array)],cc.prototype,"additions",void 0);je([w(),rt("design:type",Array)],cc.prototype,"removals",void 0);cc=je([Ke()],cc);var uc=class{constructor(e,t){this.additions=e,this.removals=t}};je([w(),rt("design:type",Array)],uc.prototype,"additions",void 0);je([w(),rt("design:type",Array)],uc.prototype,"removals",void 0);uc=je([z(),rt("design:paramtypes",[Array,Array])],uc);var go=class{};je([w(),rt("design:type",String)],go.prototype,"source",void 0);je([w(),rt("design:type",String)],go.prototype,"target",void 0);je([w(),rt("design:type",String)],go.prototype,"predicate",void 0);go=je([Ke()],go);var cn=class extends mn(){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}};je([w(),rt("design:type",String)],cn.prototype,"status",void 0);cn=je([z()],cn);var Il=class extends mb(){};je([w(),rt("design:type",String)],Il.prototype,"status",void 0);Il=je([Ke()],Il);function XT(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 eO(r){return r&&r.source&&r.target}var lc=class{constructor(e,t){this.oldLink=e,this.newLink=t}};je([w(),rt("design:type",cn)],lc.prototype,"oldLink",void 0);je([w(),rt("design:type",cn)],lc.prototype,"newLink",void 0);lc=je([z(),rt("design:paramtypes",[cn,cn])],lc);var ii=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},Oo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Tl,br=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}};ii([w(),Oo("design:type",Array)],br.prototype,"links",void 0);br=ii([z(),Oo("design:paramtypes",[Array])],br);var pc=class{};ii([w(),Oo("design:type",Array)],pc.prototype,"links",void 0);pc=ii([Ke()],pc);var Ol=Tl=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new Tl;return t.links.push(e),t}};ii([w(),Oo("design:type",Array)],Ol.prototype,"links",void 0);Ol=Tl=ii([Ke(),Oo("design:paramtypes",[Array])],Ol);var Gn=class extends mn(){};Gn=ii([z()],Gn);var U=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},q=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},rn=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new br}};U([w(),q("design:type",String)],rn.prototype,"did",void 0);U([w(),q("design:type",br)],rn.prototype,"perspective",void 0);U([w(),q("design:type",String)],rn.prototype,"directMessageLanguage",void 0);rn=U([z(),q("design:paramtypes",[String,br])],rn);var Df=class extends mn(){};Df=U([z()],Df);var un=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}};U([w(),q("design:type",String)],un.prototype,"did",void 0);U([w(),q("design:type",String)],un.prototype,"didSigningKeyId",void 0);U([w(),q("design:type",String)],un.prototype,"deviceKeyType",void 0);U([w(),q("design:type",String)],un.prototype,"deviceKey",void 0);U([w(),q("design:type",String)],un.prototype,"deviceKeySignedByDid",void 0);U([w(),q("design:type",String)],un.prototype,"didSignedByDeviceKey",void 0);un=U([z(),q("design:paramtypes",[String,String,String,String,String,String])],un);var ln=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}};U([w(),q("design:type",String)],ln.prototype,"did",void 0);U([w(),q("design:type",String)],ln.prototype,"didSigningKeyId",void 0);U([w(),q("design:type",String)],ln.prototype,"deviceKeyType",void 0);U([w(),q("design:type",String)],ln.prototype,"deviceKey",void 0);U([w(),q("design:type",String)],ln.prototype,"deviceKeySignedByDid",void 0);U([w(),q("design:type",String)],ln.prototype,"didSignedByDeviceKey",void 0);ln=U([Ke(),q("design:paramtypes",[String,String,String,String,String,String])],ln);var dc=class{constructor(e,t){this.signature=e,this.publicKey=t}};U([w(),q("design:type",String)],dc.prototype,"signature",void 0);U([w(),q("design:type",String)],dc.prototype,"publicKey",void 0);dc=U([z(),q("design:paramtypes",[String,String])],dc);var Wi=class{constructor(e,t){this.domain=e,this.pointers=t}};U([w(),q("design:type",String)],Wi.prototype,"domain",void 0);U([w(),q("design:type",Array)],Wi.prototype,"pointers",void 0);Wi=U([z(),q("design:paramtypes",[String,Array])],Wi);var fc=class{constructor(e,t){this.with=e,this.can=t}};U([w(),q("design:type",Wi)],fc.prototype,"with",void 0);U([w(),q("design:type",Array)],fc.prototype,"can",void 0);fc=U([z(),q("design:paramtypes",[Wi,Array])],fc);var Pr=class{constructor(e,t,n,i,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=n,this.capabilities=i}};U([w(),q("design:type",String)],Pr.prototype,"appName",void 0);U([w(),q("design:type",String)],Pr.prototype,"appDesc",void 0);U([w(),q("design:type",String)],Pr.prototype,"appUrl",void 0);U([w(),q("design:type",String)],Pr.prototype,"appIconPath",void 0);U([w(),q("design:type",Array)],Pr.prototype,"capabilities",void 0);Pr=U([z(),q("design:paramtypes",[String,String,String,Array,String])],Pr);var Gi=class{constructor(e,t,n,i){this.requestId=e,this.auth=t,this.token=n,this.revoked=i}};U([w(),q("design:type",String)],Gi.prototype,"requestId",void 0);U([w(),q("design:type",String)],Gi.prototype,"token",void 0);U([w(),q("design:type",Boolean)],Gi.prototype,"revoked",void 0);U([w(),q("design:type",Pr)],Gi.prototype,"auth",void 0);Gi=U([z(),q("design:paramtypes",[String,Pr,String,Boolean])],Gi);var Ki=class{constructor(e,t){this.domain=e,this.pointers=t}};U([w(),q("design:type",String)],Ki.prototype,"domain",void 0);U([w(),q("design:type",Array)],Ki.prototype,"pointers",void 0);Ki=U([Ke(),q("design:paramtypes",[String,Array])],Ki);var hc=class{constructor(e,t){this.with=e,this.can=t}};U([w(),q("design:type",Ki)],hc.prototype,"with",void 0);U([w(),q("design:type",Array)],hc.prototype,"can",void 0);hc=U([Ke(),q("design:paramtypes",[Ki,Array])],hc);var wr=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}};U([w(),q("design:type",String)],wr.prototype,"appName",void 0);U([w(),q("design:type",String)],wr.prototype,"appDesc",void 0);U([w(),q("design:type",String)],wr.prototype,"appDomain",void 0);U([w(),q("design:type",String)],wr.prototype,"appUrl",void 0);U([w(),q("design:type",String)],wr.prototype,"appIconPath",void 0);U([w(),q("design:type",Array)],wr.prototype,"capabilities",void 0);wr=U([Ke(),q("design:paramtypes",[String,String,String,String,String,Array])],wr);var Kn=class{constructor(e,t,n){this.did=e,this.success=t,this.error=n}};U([w(),q("design:type",String)],Kn.prototype,"did",void 0);U([w(),q("design:type",Boolean)],Kn.prototype,"success",void 0);U([w(),q("design:type",String)],Kn.prototype,"error",void 0);Kn=U([z(),q("design:paramtypes",[String,Boolean,String])],Kn);var aa=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},oa=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Vt=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};aa([w(),oa("design:type",Boolean)],Vt.prototype,"isInitialized",void 0);aa([w(),oa("design:type",Boolean)],Vt.prototype,"isUnlocked",void 0);aa([w(),oa("design:type",String)],Vt.prototype,"did",void 0);aa([w(),oa("design:type",String)],Vt.prototype,"didDocument",void 0);aa([w(),oa("design:type",String)],Vt.prototype,"error",void 0);Vt=aa([z(),oa("design:paramtypes",[Object])],Vt);var Rf=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},Le=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)},wt,St,Cl=class{constructor(e,t){wt.set(this,void 0),St.set(this,void 0),Rf(this,wt,e,"f"),Rf(this,St,t,"f")}async otherAgents(){return await Le(this,wt,"f").otherAgents(Le(this,St,"f"))}async hasTelepresenceAdapter(){return await Le(this,wt,"f").hasTelepresenceAdapter(Le(this,St,"f"))}async onlineAgents(){return await Le(this,wt,"f").onlineAgents(Le(this,St,"f"))}async setOnlineStatus(e){return await Le(this,wt,"f").setOnlineStatus(Le(this,St,"f"),e)}async setOnlineStatusU(e){return await Le(this,wt,"f").setOnlineStatusU(Le(this,St,"f"),e)}async sendSignal(e,t){return await Le(this,wt,"f").sendSignal(Le(this,St,"f"),e,t)}async sendSignalU(e,t){return await Le(this,wt,"f").sendSignalU(Le(this,St,"f"),e,t)}async sendBroadcast(e,t=!1){return await Le(this,wt,"f").sendBroadcast(Le(this,St,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Le(this,wt,"f").sendBroadcastU(Le(this,St,"f"),e,t)}async addSignalHandler(e){await Le(this,wt,"f").addSignalHandler(Le(this,St,"f"),e)}removeSignalHandler(e){Le(this,wt,"f").removeSignalHandler(Le(this,St,"f"),e)}};wt=new WeakMap,St=new WeakMap;var ai=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},oi=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},he=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)}};ai([w(),oi("design:type",String)],he.prototype,"source",void 0);ai([w(),oi("design:type",String)],he.prototype,"target",void 0);ai([w(),oi("design:type",String)],he.prototype,"predicate",void 0);ai([w(),oi("design:type",Date)],he.prototype,"fromDate",void 0);ai([w(),oi("design:type",Date)],he.prototype,"untilDate",void 0);ai([w(),oi("design:type",Number)],he.prototype,"limit",void 0);he=ai([z(),Ke(),oi("design:paramtypes",[Object])],he);var Pf=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)},_t,Or;function Cs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var _e=class{constructor(){_t.set(this,void 0),Or.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 _e;return Pf(t,Or,e,"f"),t}static from(e){let t=new _e;return Pf(t,_t,e,"f"),t}toUrl(){if(et(this,Or,"f")&&!et(this,_t,"f"))return et(this,Or,"f");if(!et(this,Or,"f")&&(et(this,_t,"f")===void 0||et(this,_t,"f")===""||et(this,_t,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof et(this,_t,"f")){case"string":e=`string:${Cs(et(this,_t,"f"))}`;break;case"number":e=`number:${Cs(et(this,_t,"f"))}`;break;case"boolean":e=`boolean:${Cs(et(this,_t,"f"))}`;break;case"object":e=`json:${Cs(JSON.stringify(et(this,_t,"f")))}`;break}return`literal://${e}`}get(){if(et(this,_t,"f"))return et(this,_t,"f");if(!et(this,Or,"f"))throw new Error("Can't render empty Literal");if(!et(this,Or,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=et(this,Or,"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}`)}};_t=new WeakMap,Or=new WeakMap;function mt(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Oc(r){return`set${mt(r)}`}function sm(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function gb(r){return`add${mt(sm(r))}`}function yb(r){return`remove${mt(sm(r))}`}function vb(r){return`set${mt(r)}`}function cm(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 Nn(r){if(Array.isArray(r))return`[${r.map(Nn).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 sl=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},X=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,Fe,co=class{constructor(r,e,t){pt.set(this,void 0),dt.set(this,void 0),Fe.set(this,void 0),sl(this,pt,e,"f"),sl(this,dt,t,"f"),sl(this,Fe,r,"f")}get baseExpression(){return X(this,pt,"f")}async init(){let isInstance=await X(this,Fe,"f").isSubjectInstance(X(this,pt,"f"),X(this,dt,"f"));if(!isInstance)throw`Not a valid subject instance of ${X(this,dt,"f")} for ${X(this,pt,"f")}`;let results=await X(this,Fe,"f").infer(`subject_class("${X(this,dt,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await X(this,Fe,"f").infer(`subject_class("${X(this,dt,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await X(this,Fe,"f").getPropertyValueViaSurreal(X(this,pt,"f"),X(this,dt,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await X(this,Fe,"f").infer(`subject_class("${X(this,dt,"f")}", C), property_setter(C, Property, Setter)`);for(let setter of setters||[])if(setter){let property=setter.Property,actions=eval(setter.Setter),resolveLanguageResults=await X(this,Fe,"f").infer(`subject_class("${X(this,dt,"f")}", C), property_resolve_language(C, "${property}", Language)`),resolveLanguage;resolveLanguageResults&&resolveLanguageResults.length>0&&(resolveLanguage=resolveLanguageResults[0].Language),this[Oc(property)]=async r=>{resolveLanguage&&(r=await X(this,Fe,"f").createExpression(r,resolveLanguage)),await X(this,Fe,"f").executeAction(actions,X(this,pt,"f"),[{name:"value",value:r}])}}let results2=await X(this,Fe,"f").infer(`subject_class("${X(this,dt,"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 X(this,Fe,"f").getRelationValuesViaSurreal(X(this,pt,"f"),X(this,dt,"f"),r)}catch(e){return console.warn(`Failed to get relation ${r} via SurrealDB:`,e),[]}}});let adders=await X(this,Fe,"f").infer(`subject_class("${X(this,dt,"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[gb(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>X(this,Fe,"f").executeAction(actions,X(this,pt,"f"),[{name:"value",value:e}]))):await X(this,Fe,"f").executeAction(actions,X(this,pt,"f"),[{name:"value",value:r}])}}let removers=await X(this,Fe,"f").infer(`subject_class("${X(this,dt,"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[yb(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>X(this,Fe,"f").executeAction(actions,X(this,pt,"f"),[{name:"value",value:e}]))):await X(this,Fe,"f").executeAction(actions,X(this,pt,"f"),[{name:"value",value:r}])}}let relationSetters=await X(this,Fe,"f").infer(`subject_class("${X(this,dt,"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[vb(relation)]=async r=>{Array.isArray(r)?await X(this,Fe,"f").executeAction(actions,X(this,pt,"f"),r.map(e=>({name:"value",value:e}))):await X(this,Fe,"f").executeAction(actions,X(this,pt,"f"),[{name:"value",value:r}])}}}};pt=new WeakMap,dt=new WeakMap,Fe=new WeakMap;function bb(r,e,t,n){let i="",a=cm(8);i+=`subject_class("${r}", ${a}).
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 p in t){let h=`property(${a}, "${p}").
63
+ `,{through:m,initial:v,required:_,resolveLanguage:y,writable:b,flag:g,prologGetter:T,prologSetter:N,local:A}=t[p];if(y&&(h+=`property_resolve(${a}, "${p}").
64
+ `,h+=`property_resolve_language(${a}, "${p}", "${y}").
65
+ `),T?h+=`property_getter(${a}, Base, "${p}", Value) :- ${T}.
66
+ `:m&&(h+=`property_getter(${a}, Base, "${p}", Value) :- triple(Base, "${m}", Value).
67
+ `,_&&(g?c.push(`triple(Base, "${m}", "${v}")`):c.push(`triple(Base, "${m}", _)`))),N)h+=`property_setter(${a}, "${p}", Actions) :- ${N}.
68
+ `;else if(b&&m&&typeof e[Oc(p)]=="function"){let R=[{action:"setSingleTarget",source:"this",predicate:m,target:"value",...A&&{local:!0}}];h+=`property_setter(${a}, "${p}", '${Nn(R)}').
69
+ `}u.push(h);let D=v??(_&&b&&!g&&m?"literal://string:":void 0);D&&(s.push({action:"addLink",source:"this",predicate:m,target:D}),o.push({action:"removeLink",source:"this",predicate:m,target:"*"}))}let l=[],d=Object.fromEntries(Object.entries(n).filter(([,p])=>p.kind==="hasMany"||p.kind==="belongsToMany"));for(let p in d){let h=`collection(${a}, "${p}").
70
+ `,{predicate:m,local:v}=d[p];if(m){h+=`collection_getter(${a}, Base, "${p}", 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}, "${p}", '${Nn(_)}').
72
+ `,h+=`collection_remover(${a}, "${p}", '${Nn(y)}').
73
+ `,h+=`collection_setter(${a}, "${p}", '${Nn(b)}').
74
+ `}l.push(h)}let f=Nn(s);if(i+=`constructor(${a}, '${f}').
75
+ `,c.length>0){let p=c.join(", ");i+=`instance(${a}, Base) :- ${p}.
76
+ `,i+=`
77
+ `}return i+=`destructor(${a}, '${Nn(o)}').
78
+ `,i+=`
79
+ `,i+=u.join(`
80
+ `),i+=`
81
+ `,i+=l.join(`
82
+ `),{sdna:i,name:r}}function Lf(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 Ff(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 Mf(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 nn=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let n=Lf(e),i=Mf(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#> .
62
83
  `;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
63
84
  `,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
64
85
  `,e+=`@prefix ad4m: <ad4m://> .
@@ -73,48 +94,27 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
73
94
  `),n.nodeKind&&(e+=` sh:nodeKind sh:${n.nodeKind} ;
74
95
  `),n.minCount!==void 0&&(e+=` sh:minCount ${n.minCount} ;
75
96
  `),n.maxCount!==void 0&&(e+=` sh:maxCount ${n.maxCount} ;
76
- `),n.pattern&&(e+=` sh:pattern "${Df(n.pattern)}" ;
97
+ `),n.pattern&&(e+=` sh:pattern "${Ff(n.pattern)}" ;
77
98
  `),n.minInclusive!==void 0&&(e+=` sh:minInclusive ${n.minInclusive} ;
78
99
  `),n.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${n.maxInclusive} ;
79
- `),n.hasValue&&(e+=` sh:hasValue "${Df(n.hasValue)}" ;
100
+ `),n.hasValue&&(e+=` sh:hasValue "${Ff(n.hasValue)}" ;
80
101
  `),n.local!==void 0&&(e+=` ad4m:local ${n.local} ;
81
102
  `),n.writable!==void 0&&(e+=` ad4m:writable ${n.writable} ;
82
103
  `),e=e.slice(0,-2)+`
83
104
  `,e+=i?` ] .
84
105
  `:` ] ;
85
- `}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=$f(this.targetClass),o=Rf(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 nn(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(A=>A.source===u&&A.predicate==="sh://path");if(!l)continue;let d;if(!u.startsWith("_:")){let A=u.lastIndexOf(".");A!==-1&&(d=u.substring(A+1))}let f={name:d,path:l.target},p=e.find(A=>A.source===u&&A.predicate==="sh://datatype");p&&(f.datatype=p.target);let m=e.find(A=>A.source===u&&A.predicate==="sh://nodeKind");m&&(f.nodeKind=m.target.replace("sh://",""));let h=e.find(A=>A.source===u&&A.predicate==="sh://minCount");if(h){let A=h.target.replace("literal://","").replace(/\^\^.*$/,"");A.startsWith("number:")&&(A=A.substring(7)),f.minCount=parseInt(A)}let g=e.find(A=>A.source===u&&A.predicate==="sh://maxCount");if(g){let A=g.target.replace("literal://","").replace(/\^\^.*$/,"");A.startsWith("number:")&&(A=A.substring(7)),f.maxCount=parseInt(A)}let b=e.find(A=>A.source===u&&A.predicate==="sh://pattern");b&&(f.pattern=b.target.replace("literal://",""));let v=e.find(A=>A.source===u&&A.predicate==="sh://minInclusive");if(v){let A=v.target.replace("literal://","");A.startsWith("number:")&&(A=A.substring(7)),f.minInclusive=parseFloat(A)}let w=e.find(A=>A.source===u&&A.predicate==="sh://maxInclusive");if(w){let A=w.target.replace("literal://","");A.startsWith("number:")&&(A=A.substring(7)),f.maxInclusive=parseFloat(A)}let y=e.find(A=>A.source===u&&A.predicate==="sh://hasValue");y&&(f.hasValue=y.target.replace("literal://",""));let k=e.find(A=>A.source===u&&A.predicate==="ad4m://local");if(k){let A=k.target.replace("literal://","");A.startsWith("boolean:")&&(A=A.substring(8)),f.local=A==="true"}let C=e.find(A=>A.source===u&&A.predicate==="ad4m://writable");if(C){let A=C.target.replace("literal://","");A.startsWith("boolean:")&&(A=A.substring(8)),f.writable=A==="true"}let I=e.find(A=>A.source===u&&A.predicate==="ad4m://resolveLanguage");I&&(f.resolveLanguage=I.target.replace("literal://string:",""));let D=e.find(A=>A.source===u&&A.predicate==="ad4m://setter");if(D)try{let A=D.target.replace("literal://string:","");f.setter=JSON.parse(A)}catch{}let P=e.find(A=>A.source===u&&A.predicate==="ad4m://adder");if(P)try{let A=P.target.replace("literal://string:","");f.adder=JSON.parse(A)}catch{}let R=e.find(A=>A.source===u&&A.predicate==="ad4m://remover");if(R)try{let A=R.target.replace("literal://string:","");f.remover=JSON.parse(A)}catch{}let j=e.find(A=>A.source===u&&A.predicate==="ad4m://getter");j&&(f.getter=j.target.replace("literal://string:",""));let xe=e.find(A=>A.source===u&&A.predicate==="ad4m://conformanceConditions");if(xe)try{let A=xe.target.replace("literal://string:","");f.conformanceConditions=JSON.parse(A)}catch{}let Oe=e.find(A=>A.source===u&&A.predicate==="sh://class");Oe&&(f.class=Oe.target),i.addProperty(f)}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 nn(e.node_shape_uri,e.target_class):new nn(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 Lf(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 rm(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`${Lf(e)} your ${t} actions, with access to ${Lf(n)}`}function ee(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function Qi(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=>Qi(e)).join(", ")}]`:String(r)}function lb(r,e,t){let n=ee(r),i=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(o=>Qi(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=>Qi(u)).join(", ");o.push(`count(->link[WHERE predicate = '${n}' AND ${i} IN [${c}]]) = 0`)}else o.push(`count(->link[WHERE predicate = '${n}' AND ${i} = ${Qi(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} = ${Qi(e)}]) > 0`}function nm(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=lb(a,i,{resolveLanguage:o});s&&t.push(s)}return t}var gr=new WeakMap,at=new WeakMap;function an(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=gr.get(i);a&&Object.assign(e,a)}return e}function dr(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=at.get(i);a&&Object.assign(e,a)}return e}function pb(r,e,t){gr.has(r)||gr.set(r,{}),gr.get(r)[e]=t}function db(r,e,t){at.has(r)||at.set(r,{}),at.get(r)[e]=t}function im(r,e){try{let t=an(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 = '${ee(c.through)}' AND out.uri = '${ee(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 = '${ee(c.through)}']) > 0`));return n.length===0?void 0:{getter:`(->link[WHERE predicate = '${ee(r)}'].out[WHERE ${i.join(" AND ")}].uri)`,conformanceConditions:n}}catch{return}}function nO(r){let e=r.constructor,t=an(e),n={};for(let[i,a]of Object.entries(t))n[i]=r[i];return n}function am(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}var Pf=class{};function iO(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function aO(r){return`triple(this, "${r}", _)`}function kc(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(gr.has(i)||gr.set(i,{}),gr.get(i)[t]={...r,writable:n},n){let a=t;e[`set${Yt(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function oO(r){return kc({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function sO(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;gr.has(i)||gr.set(i,{}),gr.get(i)[t]=n,e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function fb(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",n=r.name,i=e.prototype,a=am(8);t+=`subject_class("${n}", ${a}).
86
- `;let o=[],s=[];i.subjectConstructor&&i.subjectConstructor.length&&(s=s.concat(i.subjectConstructor));let c=[];i.isSubjectInstance&&i.isSubjectInstance.length&&(c=c.concat(i.isSubjectInstance));let u=[],l=an(e);for(let h in l){let g=`property(${a}, "${h}").
87
- `,{through:b,initial:v,required:w,resolveLanguage:y,writable:k,flag:C,prologGetter:I,prologSetter:D,local:P}=l[h];if(y&&(g+=`property_resolve(${a}, "${h}").
88
- `,g+=`property_resolve_language(${a}, "${h}", "${y}").
89
- `),I?g+=`property_getter(${a}, Base, "${h}", Value) :- ${I}.
90
- `:b&&(g+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${b}", Value).
91
- `,w&&(C?c.push(`triple(Base, "${b}", "${v}")`):c.push(`triple(Base, "${b}", _)`))),D)g+=`property_setter(${a}, "${h}", Actions) :- ${D}.
92
- `;else if(k&&b&&typeof i[pc(h)]=="function"){let xe=[{action:"setSingleTarget",source:"this",predicate:b,target:"value",...P&&{local:!0}}];g+=`property_setter(${a}, "${h}", '${$n(xe)}').
93
- `}u.push(g);let R=v??(w&&k&&!C&&b?"literal://string:":void 0);R&&(s.push({action:"addLink",source:"this",predicate:b,target:R}),o.push({action:"removeLink",source:"this",predicate:b,target:"*"}))}let d=[],f=dr(e),p=Object.fromEntries(Object.entries(f).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));for(let h in p){let g=`collection(${a}, "${h}").
94
- `,{predicate:b,local:v}=p[h];if(b){g+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${b}", C), List).
95
- `;let w=[{action:"addLink",source:"this",predicate:b,target:"value",...v&&{local:!0}}],y=[{action:"removeLink",source:"this",predicate:b,target:"value"}],k=[{action:"collectionSetter",source:"this",predicate:b,target:"value",...v&&{local:!0}}];g+=`collection_adder(${a}, "${h}", '${$n(w)}').
96
- `,g+=`collection_remover(${a}, "${h}", '${$n(y)}').
97
- `,g+=`collection_setter(${a}, "${h}", '${$n(k)}').
98
- `}d.push(g)}let m=$n(s);if(t+=`constructor(${a}, '${m}').
99
- `,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
100
- `,t+=`
101
- `}return t+=`destructor(${a}, '${$n(o)}').
102
- `,t+=`
103
- `,t+=u.join(`
104
- `),t+=`
105
- `,t+=d.join(`
106
- `),{sdna:t,name:n}},e.generateSHACL=function(){let t=r.name,n=e.prototype,i="ad4m://",a=an(e),o=dr(e),s=Object.fromEntries(Object.entries(o).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany"));if(Object.keys(a).length>0){let m=a[Object.keys(a)[0]];if(m.through){let h=m.through.match(/^([^:]+:\/\/)/);h&&(i=h[1])}}else if(Object.keys(s).length>0){let m=s[Object.keys(s)[0]];if(m.predicate){let h=m.predicate.match(/^([^:]+:\/\/)/);h&&(i=h[1])}}let c=`${i}${t}Shape`,u=`${i}${t}`,l=new nn(c,u),d=Object.getPrototypeOf(e);if(d&&typeof d.generateSHACL=="function"){let m=d.generateSHACL();m?.shape?.nodeShapeUri&&l.addParentShape(m.shape.nodeShapeUri)}let f=[];n.subjectConstructor&&n.subjectConstructor.length&&(f=f.concat(n.subjectConstructor));let p=[];for(let m in a){let h=a[m];if(!h.through)continue;let g={name:m,path:h.through};if(h.resolveLanguage==="literal")g.datatype="xsd://string";else if(h.initial){let v=typeof n[m];v==="number"?g.datatype="xsd://integer":v==="boolean"?g.datatype="xsd://boolean":v==="string"&&(g.datatype="xsd://string")}h.required&&(g.minCount=1),g.maxCount=1,h.flag&&h.initial&&(g.hasValue=h.initial),h.local!==void 0&&(g.local=h.local),h.writable!==void 0&&(g.writable=h.writable),h.resolveLanguage&&(g.resolveLanguage=h.resolveLanguage),h.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${m}' in class '${t}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):h.writable&&h.through&&typeof n[pc(m)]=="function"&&(g.setter=[{action:"setSingleTarget",source:"this",predicate:h.through,target:"value",...h.local&&{local:!0}}]);let b=h.initial??(h.required&&h.writable&&!h.flag&&h.through?"literal://string:":void 0);b&&(f.push({action:"addLink",source:"this",predicate:h.through,target:b}),p.push({action:"removeLink",source:"this",predicate:h.through,target:"*"})),l.addProperty(g)}for(let m in s){let h=s[m];if(!h.predicate)continue;let g={name:m,path:h.predicate};if(g.nodeKind="IRI",h.local!==void 0&&(g.local=h.local),g.adder=[{action:"addLink",source:"this",predicate:h.predicate,target:"value",...h.local&&{local:!0}}],g.remover=[{action:"removeLink",source:"this",predicate:h.predicate,target:"value",...h.local&&{local:!0}}],h.getter)g.getter=h.getter;else if(h.where)try{let b=h.target?.(),v=b?b.getModelMetadata?.()??null:null,w=nm(h.where,v);if(w.length>0){let y=ee(h.predicate);g.getter=`(->link[WHERE predicate = '${y}'].out[WHERE ${w.join(" AND ")}].uri)`}}catch{}else if(h.target&&h.filter!==!1)try{let b=h.target(),v=im(h.predicate,b);v&&(g.getter=v.getter,g.conformanceConditions=v.conformanceConditions)}catch{}if(h.target)try{let v=h.target().generateSHACL?.();v?.shape?.nodeShapeUri&&(g.class=v.shape.nodeShapeUri)}catch{}l.addProperty(g)}return l.setConstructorActions(f),l.setDestructorActions(p),{shape:l,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function hb(r){let e=r.required??!1;return kc({...r,required:e,readOnly:r.readOnly??!1,resolveLanguage:r.resolveLanguage??"literal",initial:r.initial??(e?"literal://string:uninitialized":void 0)})}function cO(r){return hb({...r,readOnly:!0})}function Ic(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 uO(r,e){let t=Ic(r,e);return function(n,i){let a=n.constructor;at.has(a)||at.set(a,{});let o=at.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${Yt(s)}`]=async function(c,u){return this.addRelationValue(s,c,u)},n[`remove${Yt(s)}`]=async function(c,u){return this.removeRelationValue(s,c,u)},n[`set${Yt(s)}`]=async function(c,u){return this.setRelationValues(s,c,u)}),Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function lO(r,e){let t=Ic(r,e);return function(n,i){let a=n.constructor;at.has(a)||at.set(a,{});let o=at.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?(kc({through:t.through,readOnly:!1,local:t.local})(n,i),n[`add${Yt(s)}`]=async function(c){return this.addRelationValue(s,c)},n[`remove${Yt(s)}`]=async function(c){return this.removeRelationValue(s,c)},n[`set${Yt(s)}`]=async function(c){return this.setRelationValues(s,c)}):Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function pO(r,e){let t=Ic(r,e);return function(n,i){let a=n.constructor;at.has(a)||at.set(a,{});let o=at.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?kc({through:t.through,readOnly:!0,local:t.local})(n,i):Object.defineProperty(n,i,{configurable:!0,writable:!0})}}function dO(r,e){let t=Ic(r,e);return function(n,i){let a=n.constructor;at.has(a)||at.set(a,{});let o=at.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 Ji=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 Ji(s,o),u=e.find(m=>m.source===t&&m.predicate==="ad4m://flowable");if(u)if(u.target==="ad4m://any")c.flowable="any";else try{let m=u.target.replace("literal://string:","");c.flowable=JSON.parse(decodeURIComponent(m))}catch{c.flowable="any"}let l=e.find(m=>m.source===t&&m.predicate==="ad4m://startAction");if(l)try{let m=l.target.replace("literal://string:","");c.startAction=JSON.parse(decodeURIComponent(m))}catch{}let d=e.filter(m=>m.source===t&&m.predicate==="ad4m://hasState"),f=new Map;for(let m of d){let h=m.target,g=e.find(C=>C.source===h&&C.predicate==="ad4m://stateName"),b=g?Se.fromUrl(g.target).get():"";f.set(h,b);let v=e.find(C=>C.source===h&&C.predicate==="ad4m://stateValue"),w=v?Se.fromUrl(v.target).get():0,y=e.find(C=>C.source===h&&C.predicate==="ad4m://stateCheck"),k={predicate:"",target:""};if(y)try{let C=y.target.replace("literal://string:","");k=JSON.parse(decodeURIComponent(C))}catch{}c.addState({name:b,value:w,stateCheck:k})}let p=e.filter(m=>m.source===t&&m.predicate==="ad4m://hasTransition");for(let m of p){let h=m.target,g=e.find(R=>R.source===h&&R.predicate==="ad4m://actionName"),b=g?Se.fromUrl(g.target).get():"",w=e.find(R=>R.source===h&&R.predicate==="ad4m://fromState")?.target||"",y=f.get(w)||"",C=e.find(R=>R.source===h&&R.predicate==="ad4m://toState")?.target||"",I=f.get(C)||"",D=e.find(R=>R.source===h&&R.predicate==="ad4m://transitionActions"),P=[];if(D)try{let R=D.target.replace("literal://string:","");P=JSON.parse(decodeURIComponent(R))}catch{}c.addTransition({actionName:b,fromState:y,toState:I,actions:P})}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 Ji(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}},ge=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)},Qs,Cr,ur,lr,qn,Zr,Yr,Dn,qa,zs,Rn,Ln,jt,Bi,Il,le,de,Pn,Fn,Mn,Ba,dc=class{constructor(e,t,n){Qs.add(this),Cr.set(this,void 0),ur.set(this,void 0),lr.set(this,void 0),qn.set(this,void 0),Zr.set(this,void 0),Yr.set(this,void 0),Dn.set(this,void 0),qa.set(this,!1),zs.set(this,void 0),Rn.set(this,void 0),Ln.set(this,void 0),jt.set(this,void 0),Bi.set(this,void 0),this.isSurrealDB=!1,ge(this,Cr,e,"f"),ge(this,Bi,t,"f"),ge(this,lr,n,"f"),ge(this,qn,new Set,"f"),ge(this,Dn,null,"f"),ge(this,zs,new Promise((i,a)=>{ge(this,Rn,i,"f"),ge(this,Ln,a,"f")}),"f")}async subscribe(){O(this,Yr,"f")&&(O(this,Yr,"f").call(this),ge(this,Yr,void 0,"f")),O(this,jt,"f")&&(clearTimeout(O(this,jt,"f")),ge(this,jt,void 0,"f")),O(this,Zr,"f")&&(clearTimeout(O(this,Zr,"f")),ge(this,Zr,void 0,"f"));try{let t;this.isSurrealDB?t=await O(this,lr,"f").perspectiveSubscribeSurrealQuery(O(this,Cr,"f"),O(this,Bi,"f")):t=await O(this,lr,"f").subscribeQuery(O(this,Cr,"f"),O(this,Bi,"f")),ge(this,ur,t.subscriptionId,"f"),t.result?(ge(this,Dn,t.result,"f"),O(this,Qs,"m",Il).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ge(this,jt,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"),ge(this,Yr,O(this,lr,"f").subscribeToQueryUpdates(O(this,ur,"f"),n=>{O(this,jt,"f")&&(clearTimeout(O(this,jt,"f")),ge(this,jt,void 0,"f")),O(this,Rn,"f")&&(O(this,Rn,"f").call(this,!0),ge(this,Rn,void 0,"f"),ge(this,Ln,void 0,"f")),!(n.isInit&&O(this,Dn,"f"))&&(ge(this,Dn,n,"f"),O(this,Qs,"m",Il).call(this,n))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,Ln,"f")&&(O(this,Ln,"f").call(this,t),ge(this,Rn,void 0,"f"),ge(this,Ln,void 0,"f")),t}let e=async()=>{if(!O(this,qa,"f")){try{this.isSurrealDB?await O(this,lr,"f").perspectiveKeepAliveSurrealQuery(O(this,Cr,"f"),O(this,ur,"f")):await O(this,lr,"f").keepAliveQuery(O(this,Cr,"f"),O(this,ur,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,Bi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,qa,"f")||ge(this,Zr,setTimeout(e,3e4),"f")}};ge(this,Zr,setTimeout(e,3e4),"f")}get id(){return O(this,ur,"f")}get initialized(){return O(this,zs,"f")}get result(){return O(this,Dn,"f")}onResult(e){return O(this,qn,"f").add(e),()=>O(this,qn,"f").delete(e)}dispose(){ge(this,qa,!0,"f"),clearTimeout(O(this,Zr,"f")),O(this,Yr,"f")&&O(this,Yr,"f").call(this),O(this,qn,"f").clear(),O(this,jt,"f")&&(clearTimeout(O(this,jt,"f")),ge(this,jt,void 0,"f")),O(this,ur,"f")&&(this.isSurrealDB?O(this,lr,"f").perspectiveDisposeSurrealQuerySubscription(O(this,Cr,"f"),O(this,ur,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,lr,"f").disposeQuerySubscription(O(this,Cr,"f"),O(this,ur,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Cr=new WeakMap,ur=new WeakMap,lr=new WeakMap,qn=new WeakMap,Zr=new WeakMap,Yr=new WeakMap,Dn=new WeakMap,qa=new WeakMap,zs=new WeakMap,Rn=new WeakMap,Ln=new WeakMap,jt=new WeakMap,Bi=new WeakMap,Qs=new WeakSet,Il=function r(e){for(let t of O(this,qn,"f"))try{t(e)}catch(n){console.error("Error in query subscription callback:",n)}};var zi=class{constructor(e,t){le.set(this,void 0),de.set(this,void 0),Pn.set(this,void 0),Fn.set(this,void 0),Mn.set(this,void 0),Ba.set(this,void 0),ge(this,Pn,[],"f"),ge(this,Fn,[],"f"),ge(this,Mn,[],"f"),ge(this,Ba,[],"f"),ge(this,le,e,"f"),ge(this,de,t,"f"),this.uuid=O(this,le,"f").uuid,this.name=O(this,le,"f").name,this.owners=O(this,le,"f").owners,this.sharedUrl=O(this,le,"f").sharedUrl,this.neighbourhood=O(this,le,"f").neighbourhood,this.state=O(this,le,"f").state,O(this,de,"f").addPerspectiveLinkAddedListener(O(this,le,"f").uuid,O(this,Pn,"f")),O(this,de,"f").addPerspectiveLinkRemovedListener(O(this,le,"f").uuid,O(this,Fn,"f")),O(this,de,"f").addPerspectiveLinkUpdatedListener(O(this,le,"f").uuid,O(this,Mn,"f")),O(this,de,"f").addPerspectiveSyncStateChangeListener(O(this,le,"f").uuid,O(this,Ba,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,n,i){return await O(this,de,"f").executeCommands(O(this,le,"f").uuid,JSON.stringify(e),t,JSON.stringify(n),i)}async get(e){return await O(this,de,"f").queryLinks(O(this,le,"f").uuid,e)}async infer(e){return await O(this,de,"f").queryProlog(O(this,le,"f").uuid,e)}async querySurrealDB(e){return await O(this,de,"f").querySurrealDB(O(this,le,"f").uuid,e)}async add(e,t="shared",n){return await O(this,de,"f").addLink(O(this,le,"f").uuid,e,t,n)}async addLinks(e,t="shared",n){return await O(this,de,"f").addLinks(O(this,le,"f").uuid,e,t,n)}async removeLinks(e,t){return await O(this,de,"f").removeLinks(O(this,le,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await O(this,de,"f").linkMutations(O(this,le,"f").uuid,e,t)}async addLinkExpression(e,t="shared",n){return await O(this,de,"f").addLinkExpression(O(this,le,"f").uuid,e,t,n)}async update(e,t,n){return await O(this,de,"f").updateLink(O(this,le,"f").uuid,e,t,n)}async remove(e,t){return await O(this,de,"f").removeLink(O(this,le,"f").uuid,e,t)}async createBatch(){return await O(this,de,"f").createBatch(O(this,le,"f").uuid)}async commitBatch(e){return await O(this,de,"f").commitBatch(O(this,le,"f").uuid,e)}async getExpression(e){return await O(this,de,"f").getExpression(e)}async createExpression(e,t){return await O(this,de,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?O(this,Pn,"f").push(t):e==="link-removed"?O(this,Fn,"f").push(t):e==="link-updated"&&O(this,Mn,"f").push(t)}async addSyncStateChangeListener(e){O(this,Ba,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let n=O(this,Pn,"f").indexOf(t);O(this,Pn,"f").splice(n,1)}else if(e==="link-removed"){let n=O(this,Fn,"f").indexOf(t);O(this,Fn,"f").splice(n,1)}else if(e==="link-updated"){let n=O(this,Mn,"f").indexOf(t);O(this,Mn,"f").splice(n,1)}}async snapshot(){return O(this,de,"f").snapshotByUUID(O(this,le,"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 O(this,de,"f").addSdna(O(this,le,"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 St({source:o.source,predicate:o.predicate,target:o.target})),new St({source:"ad4m://self",predicate:"ad4m://has_shacl",target:i.toUrl()}),new St({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;ee(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(d=>d.data.target)].map(d=>`'${ee(d)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(d=>({source:d.source,predicate:d.predicate,target:d.target}));return nn.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 St({source:o.source,predicate:o.predicate,target:o.target})),new St({source:"ad4m://self",predicate:"ad4m://has_flow",target:i}),new St({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=ee(i),o=i.endsWith("Flow")?i.slice(0,-4)+".":i+".",s=ee(o),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${s}')`,l=(await this.querySurrealDB(c)||[]).map(d=>({source:d.source,predicate:d.predicate,target:d.target}));return Ji.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,de,"f").createSubject(O(this,le,"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,de,"f").createSubject(O(this,le,"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,de,"f").getSubjectData(O(this,le,"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,de,"f").getSubjectData(O(this,le,"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 = '${ee(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=ee(e),s=ee(a.predicate),c;if(a.target){let f=ee(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${f}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}'`;let u=await this.querySurrealDB(c);if(!u||u.length===0)return!1;let l=u[0]?.count??0;if((typeof l=="object"&&l?.Int!==void 0?l.Int:l)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let n=await this.stringOrTemplateObjectToSubjectClassName(t),i=new ao(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=ee(n.predicate);if(n.target){let a=ee(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=ee(e),s=ee(a.predicate),c=`SELECT out.uri AS value FROM link WHERE in.uri = '${o}' AND predicate = '${s}' LIMIT 1`,u=await this.querySurrealDB(c);if(!u||u.length===0)return;let l=u[0].value;if(a.resolveLanguage&&l)try{let d=await this.getExpression(l);try{return JSON.parse(d.data)}catch{return d.data}}catch{return l}return l}async getRelationValuesViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return[];let a=i.relations.get(n);if(!a)return[];let o=ee(e),s=ee(a.predicate),c=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${o}' AND predicate = '${s}' ORDER BY timestamp ASC`,u=await this.querySurrealDB(c);if(!u||u.length===0)return[];let l=u.map(d=>d.value).filter(d=>d!==""&&d!=="");if(a.condition&&l.length>0)try{let d=[];for(let f of l){let p=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${f.replace(/'/g,"\\'")}'`);p.trim().startsWith("WHERE")&&(p=`array::len(SELECT * FROM link ${p}) > 0`);let m=await this.querySurrealDB(`RETURN ${p}`);(m===!0||Array.isArray(m)&&m.length>0&&m[0]===!0)&&d.push(f)}l=d}catch(d){console.warn(`Failed to apply condition filter for ${n}:`,d)}if(a.instanceFilter)try{let d=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return d?await this.batchCheckSubjectInstances(l,d):this.filterInstancesSequential(l,a.instanceFilter)}catch{return this.filterInstancesSequential(l,a.instanceFilter)}return l}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(c=>`'${ee(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=>`'${ee(l)}'`).join(", "),s=ee(a.predicate),c;if(a.target){let l=ee(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 ao(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 ao(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?an(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(d=>!Array.isArray(e[d]));let s=a?Object.fromEntries(Object.entries(dr(a)).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany")):{};if(Object.keys(s).length>0?n=Object.keys(s).filter(d=>d!=="isSubjectInstance"):n=Object.keys(e).filter(d=>Array.isArray(e[d])&&d!=="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=Lf(this.targetClass),o=Mf(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 nn(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 d;if(!u.startsWith("_:")){let k=u.lastIndexOf(".");k!==-1&&(d=u.substring(k+1))}let f={name:d,path:l.target},p=e.find(k=>k.source===u&&k.predicate==="sh://datatype");p&&(f.datatype=p.target);let h=e.find(k=>k.source===u&&k.predicate==="sh://nodeKind");h&&(f.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)),f.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)),f.maxCount=parseInt(k)}let _=e.find(k=>k.source===u&&k.predicate==="sh://pattern");_&&(f.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)),f.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)),f.maxInclusive=parseFloat(k)}let g=e.find(k=>k.source===u&&k.predicate==="sh://hasValue");g&&(f.hasValue=g.target.replace("literal://",""));let T=e.find(k=>k.source===u&&k.predicate==="ad4m://local");if(T){let k=T.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),f.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)),f.writable=k==="true"}let A=e.find(k=>k.source===u&&k.predicate==="ad4m://resolveLanguage");A&&(f.resolveLanguage=A.target.replace("literal://string:",""));let D=e.find(k=>k.source===u&&k.predicate==="ad4m://setter");if(D)try{let k=D.target.replace("literal://string:","");f.setter=JSON.parse(k)}catch{}let L=e.find(k=>k.source===u&&k.predicate==="ad4m://adder");if(L)try{let k=L.target.replace("literal://string:","");f.adder=JSON.parse(k)}catch{}let R=e.find(k=>k.source===u&&k.predicate==="ad4m://remover");if(R)try{let k=R.target.replace("literal://string:","");f.remover=JSON.parse(k)}catch{}let j=e.find(k=>k.source===u&&k.predicate==="ad4m://getter");j&&(f.getter=j.target.replace("literal://string:",""));let Ae=e.find(k=>k.source===u&&k.predicate==="ad4m://conformanceConditions");if(Ae)try{let k=Ae.target.replace("literal://string:","");f.conformanceConditions=JSON.parse(k)}catch{}let Ce=e.find(k=>k.source===u&&k.predicate==="sh://class");Ce&&(f.class=Ce.target),i.addProperty(f)}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 nn(e.node_shape_uri,e.target_class):new nn(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 Uf(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 um(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`${Uf(e)} your ${t} actions, with access to ${Uf(n)}`}function oe(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function be(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=>be(e)).join(", ")}]`:String(r)}function wb(r,e,t){let n=oe(r),i=t?.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(e)){let a=e.map(o=>be(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=>be(u)).join(", ");o.push(`count(->link[WHERE predicate = '${n}' AND ${i} IN [${c}]]) = 0`)}else o.push(`count(->link[WHERE predicate = '${n}' AND ${i} = ${be(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} = ${be(e)}]) > 0`}function lm(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=wb(a,i,{resolveLanguage:o});s&&t.push(s)}return t}function Sb(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 nn(c,u),d=Object.getPrototypeOf(e);if(d&&typeof d.generateSHACL=="function"){let h=d.generateSHACL();h?.shape?.nodeShapeUri&&l.addParentShape(h.shape.nodeShapeUri)}let f=[];a.subjectConstructor&&a.subjectConstructor.length&&(f=f.concat(a.subjectConstructor));let p=[];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[Oc(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);_&&(f.push({action:"addLink",source:"this",predicate:m.through,target:_}),p.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=lm(m.where,y);if(b.length>0){let g=oe(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(f),l.setDestructorActions(p),{shape:l,name:r}}var gr=new WeakMap,ot=new WeakMap;function Jn(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=gr.get(i);a&&Object.assign(e,a)}return e}function dr(r){let e={},t=[],n=r;for(;n&&n!==Object;)t.unshift(n),n=Object.getPrototypeOf(n);for(let i of t){let a=ot.get(i);a&&Object.assign(e,a)}return e}function _b(r,e,t){gr.has(r)||gr.set(r,{}),gr.get(r)[e]=t}function Eb(r,e,t){ot.has(r)||ot.set(r,{}),ot.get(r)[e]=t}function pm(r,e){try{let t=Jn(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 = '${oe(c.through)}' AND out.uri = '${oe(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 = '${oe(c.through)}']) > 0`));return n.length===0?void 0:{getter:`(->link[WHERE predicate = '${oe(r)}'].out[WHERE ${i.join(" AND ")}].uri)`,conformanceConditions:n}}catch{return}}function Cc(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(gr.has(i)||gr.set(i,{}),gr.get(i)[t]={...r,writable:n},n){let a=t;e[`set${mt(a)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function SO(r){return Cc({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function _O(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;gr.has(i)||gr.set(i,{}),gr.get(i)[t]=n,e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function xb(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){return bb(r.name,e.prototype,Jn(e),dr(e))},e.generateSHACL=function(){return Sb(r.name,e,Jn(e),dr(e),pm)},Object.defineProperty(e,"type",{configurable:!0})}}function kb(r){let e=r.required??!1;return Cc({...r,required:e,readOnly:r.readOnly??!1,resolveLanguage:r.resolveLanguage??"literal",initial:r.initial??(e?"literal://string:uninitialized":void 0)})}function EO(r){return kb({...r,readOnly:!0})}function Nc(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 xO(r,e){let t=Nc(r,e);return function(n,i){let a=n.constructor;ot.has(a)||ot.set(a,{});let o=ot.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${mt(s)}`]=async function(c,u){return this.addRelationValue(s,c,u)},n[`remove${mt(s)}`]=async function(c,u){return this.removeRelationValue(s,c,u)},n[`set${mt(s)}`]=async function(c,u){return this.setRelationValues(s,c,u)}),Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function kO(r,e){let t=Nc(r,e);return function(n,i){let a=n.constructor;ot.has(a)||ot.set(a,{});let o=ot.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?(Cc({through:t.through,readOnly:!1,local:t.local})(n,i),n[`add${mt(s)}`]=async function(c){return this.addRelationValue(s,c)},n[`remove${mt(s)}`]=async function(c){return this.removeRelationValue(s,c)},n[`set${mt(s)}`]=async function(c){return this.setRelationValues(s,c)}):Object.defineProperty(n,s,{configurable:!0,writable:!0})}}function AO(r,e){let t=Nc(r,e);return function(n,i){let a=n.constructor;ot.has(a)||ot.set(a,{});let o=ot.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?Cc({through:t.through,readOnly:!0,local:t.local})(n,i):Object.defineProperty(n,i,{configurable:!0,writable:!0})}}function IO(r,e){let t=Nc(r,e);return function(n,i){let a=n.constructor;ot.has(a)||ot.set(a,{});let o=ot.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 Ji=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:_e.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:_e.from(n.name).toUrl()}),e.push({source:i,predicate:"ad4m://stateValue",target:_e.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:_e.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 Ji(s,o),u=e.find(h=>h.source===t&&h.predicate==="ad4m://flowable");if(u)if(u.target==="ad4m://any")c.flowable="any";else try{let h=u.target.replace("literal://string:","");c.flowable=JSON.parse(decodeURIComponent(h))}catch{c.flowable="any"}let l=e.find(h=>h.source===t&&h.predicate==="ad4m://startAction");if(l)try{let h=l.target.replace("literal://string:","");c.startAction=JSON.parse(decodeURIComponent(h))}catch{}let d=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),f=new Map;for(let h of d){let m=h.target,v=e.find(N=>N.source===m&&N.predicate==="ad4m://stateName"),_=v?_e.fromUrl(v.target).get():"";f.set(m,_);let y=e.find(N=>N.source===m&&N.predicate==="ad4m://stateValue"),b=y?_e.fromUrl(y.target).get():0,g=e.find(N=>N.source===m&&N.predicate==="ad4m://stateCheck"),T={predicate:"",target:""};if(g)try{let N=g.target.replace("literal://string:","");T=JSON.parse(decodeURIComponent(N))}catch{}c.addState({name:_,value:b,stateCheck:T})}let p=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of p){let m=h.target,v=e.find(R=>R.source===m&&R.predicate==="ad4m://actionName"),_=v?_e.fromUrl(v.target).get():"",b=e.find(R=>R.source===m&&R.predicate==="ad4m://fromState")?.target||"",g=f.get(b)||"",N=e.find(R=>R.source===m&&R.predicate==="ad4m://toState")?.target||"",A=f.get(N)||"",D=e.find(R=>R.source===m&&R.predicate==="ad4m://transitionActions"),L=[];if(D)try{let R=D.target.replace("literal://string:","");L=JSON.parse(decodeURIComponent(R))}catch{}c.addTransition({actionName:_,fromState:g,toState:A,actions:L})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new Ji(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}},ye=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)},Ks,Cr,ur,lr,jn,Zr,Yr,$n,Va,Js,Dn,Rn,qt,Vi,Nl,pe,fe,Pn,Ln,Fn,Qa,mc=class{constructor(e,t,n){Ks.add(this),Cr.set(this,void 0),ur.set(this,void 0),lr.set(this,void 0),jn.set(this,void 0),Zr.set(this,void 0),Yr.set(this,void 0),$n.set(this,void 0),Va.set(this,!1),Js.set(this,void 0),Dn.set(this,void 0),Rn.set(this,void 0),qt.set(this,void 0),Vi.set(this,void 0),this.isSurrealDB=!1,ye(this,Cr,e,"f"),ye(this,Vi,t,"f"),ye(this,lr,n,"f"),ye(this,jn,new Set,"f"),ye(this,$n,null,"f"),ye(this,Js,new Promise((i,a)=>{ye(this,Dn,i,"f"),ye(this,Rn,a,"f")}),"f")}async subscribe(){O(this,Yr,"f")&&(O(this,Yr,"f").call(this),ye(this,Yr,void 0,"f")),O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ye(this,qt,void 0,"f")),O(this,Zr,"f")&&(clearTimeout(O(this,Zr,"f")),ye(this,Zr,void 0,"f"));try{let t;this.isSurrealDB?t=await O(this,lr,"f").perspectiveSubscribeSurrealQuery(O(this,Cr,"f"),O(this,Vi,"f")):t=await O(this,lr,"f").subscribeQuery(O(this,Cr,"f"),O(this,Vi,"f")),ye(this,ur,t.subscriptionId,"f"),t.result?(ye(this,$n,t.result,"f"),O(this,Ks,"m",Nl).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ye(this,qt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(n=>{console.error("Error during subscription retry after timeout:",n)})},3e4),"f"),ye(this,Yr,O(this,lr,"f").subscribeToQueryUpdates(O(this,ur,"f"),n=>{O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ye(this,qt,void 0,"f")),O(this,Dn,"f")&&(O(this,Dn,"f").call(this,!0),ye(this,Dn,void 0,"f"),ye(this,Rn,void 0,"f")),!(n.isInit&&O(this,$n,"f"))&&(ye(this,$n,n,"f"),O(this,Ks,"m",Nl).call(this,n))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,Rn,"f")&&(O(this,Rn,"f").call(this,t),ye(this,Dn,void 0,"f"),ye(this,Rn,void 0,"f")),t}let e=async()=>{if(!O(this,Va,"f")){try{this.isSurrealDB?await O(this,lr,"f").perspectiveKeepAliveSurrealQuery(O(this,Cr,"f"),O(this,ur,"f")):await O(this,lr,"f").keepAliveQuery(O(this,Cr,"f"),O(this,ur,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,Vi,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(n){console.error("Error during resubscription from keepalive:",n);return}}O(this,Va,"f")||ye(this,Zr,setTimeout(e,3e4),"f")}};ye(this,Zr,setTimeout(e,3e4),"f")}get id(){return O(this,ur,"f")}get initialized(){return O(this,Js,"f")}get result(){return O(this,$n,"f")}onResult(e){return O(this,jn,"f").add(e),()=>O(this,jn,"f").delete(e)}dispose(){ye(this,Va,!0,"f"),clearTimeout(O(this,Zr,"f")),O(this,Yr,"f")&&O(this,Yr,"f").call(this),O(this,jn,"f").clear(),O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ye(this,qt,void 0,"f")),O(this,ur,"f")&&(this.isSurrealDB?O(this,lr,"f").perspectiveDisposeSurrealQuerySubscription(O(this,Cr,"f"),O(this,ur,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,lr,"f").disposeQuerySubscription(O(this,Cr,"f"),O(this,ur,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Cr=new WeakMap,ur=new WeakMap,lr=new WeakMap,jn=new WeakMap,Zr=new WeakMap,Yr=new WeakMap,$n=new WeakMap,Va=new WeakMap,Js=new WeakMap,Dn=new WeakMap,Rn=new WeakMap,qt=new WeakMap,Vi=new WeakMap,Ks=new WeakSet,Nl=function r(e){for(let t of O(this,jn,"f"))try{t(e)}catch(n){console.error("Error in query subscription callback:",n)}};var zi=class{constructor(e,t){pe.set(this,void 0),fe.set(this,void 0),Pn.set(this,void 0),Ln.set(this,void 0),Fn.set(this,void 0),Qa.set(this,void 0),ye(this,Pn,[],"f"),ye(this,Ln,[],"f"),ye(this,Fn,[],"f"),ye(this,Qa,[],"f"),ye(this,pe,e,"f"),ye(this,fe,t,"f"),this.uuid=O(this,pe,"f").uuid,this.name=O(this,pe,"f").name,this.owners=O(this,pe,"f").owners,this.sharedUrl=O(this,pe,"f").sharedUrl,this.neighbourhood=O(this,pe,"f").neighbourhood,this.state=O(this,pe,"f").state,O(this,fe,"f").addPerspectiveLinkAddedListener(O(this,pe,"f").uuid,O(this,Pn,"f")),O(this,fe,"f").addPerspectiveLinkRemovedListener(O(this,pe,"f").uuid,O(this,Ln,"f")),O(this,fe,"f").addPerspectiveLinkUpdatedListener(O(this,pe,"f").uuid,O(this,Fn,"f")),O(this,fe,"f").addPerspectiveSyncStateChangeListener(O(this,pe,"f").uuid,O(this,Qa,"f"))}escapeRegExp(e){return e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")}async executeAction(e,t,n,i){return await O(this,fe,"f").executeCommands(O(this,pe,"f").uuid,JSON.stringify(e),t,JSON.stringify(n),i)}async get(e){return await O(this,fe,"f").queryLinks(O(this,pe,"f").uuid,e)}async infer(e){return await O(this,fe,"f").queryProlog(O(this,pe,"f").uuid,e)}async querySurrealDB(e){return await O(this,fe,"f").querySurrealDB(O(this,pe,"f").uuid,e)}async add(e,t="shared",n){return await O(this,fe,"f").addLink(O(this,pe,"f").uuid,e,t,n)}async addLinks(e,t="shared",n){return await O(this,fe,"f").addLinks(O(this,pe,"f").uuid,e,t,n)}async removeLinks(e,t){return await O(this,fe,"f").removeLinks(O(this,pe,"f").uuid,e,t)}async linkMutations(e,t="shared"){return await O(this,fe,"f").linkMutations(O(this,pe,"f").uuid,e,t)}async addLinkExpression(e,t="shared",n){return await O(this,fe,"f").addLinkExpression(O(this,pe,"f").uuid,e,t,n)}async update(e,t,n){return await O(this,fe,"f").updateLink(O(this,pe,"f").uuid,e,t,n)}async remove(e,t){return await O(this,fe,"f").removeLink(O(this,pe,"f").uuid,e,t)}async createBatch(){return await O(this,fe,"f").createBatch(O(this,pe,"f").uuid)}async commitBatch(e){return await O(this,fe,"f").commitBatch(O(this,pe,"f").uuid,e)}async getExpression(e){return await O(this,fe,"f").getExpression(e)}async createExpression(e,t){return await O(this,fe,"f").createExpression(e,t)}async addListener(e,t){e==="link-added"?O(this,Pn,"f").push(t):e==="link-removed"?O(this,Ln,"f").push(t):e==="link-updated"&&O(this,Fn,"f").push(t)}async addSyncStateChangeListener(e){O(this,Qa,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let n=O(this,Pn,"f").indexOf(t);O(this,Pn,"f").splice(n,1)}else if(e==="link-removed"){let n=O(this,Ln,"f").indexOf(t);O(this,Ln,"f").splice(n,1)}else if(e==="link-updated"){let n=O(this,Fn,"f").indexOf(t);O(this,Fn,"f").splice(n,1)}}async snapshot(){return O(this,fe,"f").snapshotByUUID(O(this,pe,"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 he({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 he({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return _e.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 he({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 he({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 he({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 he({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 he({source:"ad4m://self",predicate:n}));for(let a of i){let o=a.data.target,s=await this.get(new he({source:o,predicate:"ad4m://sdna"}));for(let c of s){let u=_e.fromUrl(c.data.target).get();typeof u=="string"&&t.push(u)}}}return t}async getSdnaForClass(e){let t=_e.from(e);if((await this.get(new he({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let i=await this.get(new he({source:t.toUrl(),predicate:"ad4m://sdna"}));if(i.length===0)return null;let a=_e.fromUrl(i[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,n,i){return O(this,fe,"f").addSdna(O(this,pe,"f").uuid,e,t,n,i)}async addShacl(e,t){let n=t.toLinks(),i=_e.fromUrl(`literal://string:shacl://${e}`),a=[...n.map(o=>new Et({source:o.source,predicate:o.predicate,target:o.target})),new Et({source:"ad4m://self",predicate:"ad4m://has_shacl",target:i.toUrl()}),new Et({source:i.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=_e.fromUrl(`literal://string:shacl://${e}`),n=await this.get(new he({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(n.length===0)return null;let i=n[0].data.target;oe(i);let a=await this.get(new he({source:i,predicate:"sh://property"})),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[i,...a.map(d=>d.data.target)].map(d=>`'${oe(d)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(d=>({source:d.source,predicate:d.predicate,target:d.target}));return nn.fromLinks(l,i)}async getAllShacl(){let e=await this.get(new he({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let n of e){let i=n.data.target,o=_e.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=_e.from(e).toUrl(),a=[...n.map(o=>new Et({source:o.source,predicate:o.predicate,target:o.target})),new Et({source:"ad4m://self",predicate:"ad4m://has_flow",target:i}),new Et({source:i,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=_e.from(e).toUrl(),n=await this.get(new he({source:t,predicate:"ad4m://flow_uri"}));if(n.length===0)return null;let i=n[0].data.target,a=oe(i),o=i.endsWith("Flow")?i.slice(0,-4)+".":i+".",s=oe(o),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri = '${a}' OR string::starts_with(in.uri, '${s}')`,l=(await this.querySurrealDB(c)||[]).map(d=>({source:d.source,predicate:d.predicate,target:d.target}));return Ji.fromLinks(l,i)}async subjectClasses(){try{let t=(await this.get(new he({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,fe,"f").createSubject(O(this,pe,"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,fe,"f").createSubject(O(this,pe,"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,fe,"f").getSubjectData(O(this,pe,"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,fe,"f").getSubjectData(O(this,pe,"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 he({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 = '${oe(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=oe(e),s=oe(a.predicate),c;if(a.target){let f=oe(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${f}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}'`;let u=await this.querySurrealDB(c);if(!u||u.length===0)return!1;let l=u[0]?.count??0;if((typeof l=="object"&&l?.Int!==void 0?l.Int:l)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let n=await this.stringOrTemplateObjectToSubjectClassName(t),i=new co(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=oe(n.predicate);if(n.target){let a=oe(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=oe(e),s=oe(a.predicate),c=`SELECT out.uri AS value FROM link WHERE in.uri = '${o}' AND predicate = '${s}' LIMIT 1`,u=await this.querySurrealDB(c);if(!u||u.length===0)return;let l=u[0].value;if(a.resolveLanguage&&l)try{let d=await this.getExpression(l);try{return JSON.parse(d.data)}catch{return d.data}}catch{return l}return l}async getRelationValuesViaSurreal(e,t,n){let i=await this.getSubjectClassMetadataFromSDNA(t);if(!i)return[];let a=i.relations.get(n);if(!a)return[];let o=oe(e),s=oe(a.predicate),c=`SELECT out.uri AS value, timestamp FROM link WHERE in.uri = '${o}' AND predicate = '${s}' ORDER BY timestamp ASC`,u=await this.querySurrealDB(c);if(!u||u.length===0)return[];let l=u.map(d=>d.value).filter(d=>d!==""&&d!=="");if(a.condition&&l.length>0)try{let d=[];for(let f of l){let p=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${f.replace(/'/g,"\\'")}'`);p.trim().startsWith("WHERE")&&(p=`array::len(SELECT * FROM link ${p}) > 0`);let h=await this.querySurrealDB(`RETURN ${p}`);(h===!0||Array.isArray(h)&&h.length>0&&h[0]===!0)&&d.push(f)}l=d}catch(d){console.warn(`Failed to apply condition filter for ${n}:`,d)}if(a.instanceFilter)try{let d=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return d?await this.batchCheckSubjectInstances(l,d):this.filterInstancesSequential(l,a.instanceFilter)}catch{return this.filterInstancesSequential(l,a.instanceFilter)}return l}async batchCheckSubjectInstances(e,t){if(e.length===0)return[];if(t.requiredTriples.length===0){let o=`SELECT in.uri AS uri FROM link WHERE in.uri IN [${e.map(c=>`'${oe(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=>`'${oe(l)}'`).join(", "),s=oe(a.predicate),c;if(a.target){let l=oe(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 co(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 co(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?Jn(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(d=>!Array.isArray(e[d]));let s=a?Object.fromEntries(Object.entries(dr(a)).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany")):{};if(Object.keys(s).length>0?n=Object.keys(s).filter(d=>d!=="isSubjectInstance"):n=Object.keys(e).filter(d=>Array.isArray(e[d])&&d!=="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 d of u)if(d.predicate==="rdf://type"&&d.target==="ad4m://SubjectClass"){let f=d.shape_source,p=f.indexOf("://");if(p<0)continue;let m=f.substring(p+3).split("/").pop();if(!m)continue;l.set(m,{shapeUri:f,properties:[],relations:[]})}for(let d of u)if(d.predicate==="sh://property"||d.predicate==="sh://collection"){for(let[f,p]of l)if(d.shape_source.endsWith(`${f}Shape`)){let m=d.target.lastIndexOf(".");if(m<0)continue;let h=d.target.substring(m+1);d.predicate==="sh://property"?p.properties.push(h):p.relations.push(h)}}for(let[d,f]of l){let p=t.every(h=>f.properties.includes(h)),m=n.every(h=>f.relations.includes(h));if(p&&m)return d}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,de,"f").getNeighbourhoodProxy(O(this,le,"f").uuid)}get ai(){return O(this,de,"f").aiClient}async subscribeInfer(e){let t=new dc(this.uuid,e,O(this,de,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new dc(this.uuid,e,O(this,de,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};le=new WeakMap,de=new WeakMap,Pn=new WeakMap,Fn=new WeakMap,Mn=new WeakMap,Ba=new WeakMap;var Gr=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)},te,Va,Qa,za,Ws,Wa,Hs,Gs,ut=`
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 d of u)if(d.predicate==="rdf://type"&&d.target==="ad4m://SubjectClass"){let f=d.shape_source,p=f.indexOf("://");if(p<0)continue;let h=f.substring(p+3).split("/").pop();if(!h)continue;l.set(h,{shapeUri:f,properties:[],relations:[]})}for(let d of u)if(d.predicate==="sh://property"||d.predicate==="sh://collection"){for(let[f,p]of l)if(d.shape_source.endsWith(`${f}Shape`)){let h=d.target.lastIndexOf(".");if(h<0)continue;let m=d.target.substring(h+1);d.predicate==="sh://property"?p.properties.push(m):p.relations.push(m)}}for(let[d,f]of l){let p=t.every(m=>f.properties.includes(m)),h=n.every(m=>f.relations.includes(m));if(p&&h)return d}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,fe,"f").getNeighbourhoodProxy(O(this,pe,"f").uuid)}get ai(){return O(this,fe,"f").aiClient}async subscribeInfer(e){let t=new mc(this.uuid,e,O(this,fe,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new mc(this.uuid,e,O(this,fe,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};pe=new WeakMap,fe=new WeakMap,Pn=new WeakMap,Ln=new WeakMap,Fn=new WeakMap,Qa=new WeakMap;var Gr=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)},ee,za,Ha,Wa,Zs,Ga,Ys,Xs,lt=`
112
112
  author
113
113
  timestamp
114
114
  status
115
115
  data { source, predicate, target }
116
116
  proof { valid, invalid, signature, key }
117
- `,Pi=`
117
+ `,Fi=`
118
118
  uuid
119
119
  name
120
120
  sharedUrl
@@ -135,139 +135,139 @@ neighbourhood {
135
135
  }
136
136
  author
137
137
  }
138
- `,fc=class{constructor(e,t=!0){te.set(this,void 0),Va.set(this,void 0),Qa.set(this,void 0),za.set(this,void 0),Ws.set(this,void 0),Wa.set(this,void 0),Hs.set(this,void 0),Gs.set(this,void 0),Gr(this,te,e,"f"),Gr(this,Va,[],"f"),Gr(this,Qa,[],"f"),Gr(this,za,[],"f"),Gr(this,Ws,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Gr(this,Wa,e,"f")}setNeighbourhoodClient(e){Gr(this,Hs,e,"f")}setAIClient(e){Gr(this,Gs,e,"f")}get aiClient(){return V(this,Gs,"f")}async all(){let{perspectives:e}=T(await V(this,te,"f").query({query:x`query perspectives {
138
+ `,gc=class{constructor(e,t=!0){ee.set(this,void 0),za.set(this,void 0),Ha.set(this,void 0),Wa.set(this,void 0),Zs.set(this,void 0),Ga.set(this,void 0),Ys.set(this,void 0),Xs.set(this,void 0),Gr(this,ee,e,"f"),Gr(this,za,[],"f"),Gr(this,Ha,[],"f"),Gr(this,Wa,[],"f"),Gr(this,Zs,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Gr(this,Ga,e,"f")}setNeighbourhoodClient(e){Gr(this,Ys,e,"f")}setAIClient(e){Gr(this,Xs,e,"f")}get aiClient(){return V(this,Xs,"f")}async all(){let{perspectives:e}=I(await V(this,ee,"f").query({query:E`query perspectives {
139
139
  perspectives {
140
- ${Pi}
140
+ ${Fi}
141
141
  }
142
- }`}));return e.map(t=>new zi(t,this))}async byUUID(e){let{perspective:t}=T(await V(this,te,"f").query({query:x`query perspective($uuid: String!) {
142
+ }`}));return e.map(t=>new zi(t,this))}async byUUID(e){let{perspective:t}=I(await V(this,ee,"f").query({query:E`query perspective($uuid: String!) {
143
143
  perspective(uuid: $uuid) {
144
- ${Pi}
144
+ ${Fi}
145
145
  }
146
- }`,variables:{uuid:e}}));return t?new zi(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=T(await V(this,te,"f").query({query:x`query perspectiveSnapshot($uuid: String!) {
146
+ }`,variables:{uuid:e}}));return t?new zi(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=I(await V(this,ee,"f").query({query:E`query perspectiveSnapshot($uuid: String!) {
147
147
  perspectiveSnapshot(uuid: $uuid) {
148
- links { ${ut} }
148
+ links { ${lt} }
149
149
  }
150
- }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=T(await V(this,te,"f").mutate({mutation:x`mutation perspectivePublishSnapshot($uuid: String!) {
150
+ }`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=I(await V(this,ee,"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 V(this,te,"f").query({query:x`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
152
+ }`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:n}=I(await V(this,ee,"f").query({query:E`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
153
153
  perspectiveQueryLinks(query: $query, uuid: $uuid) {
154
- ${ut}
154
+ ${lt}
155
155
  }
156
- }`,variables:{uuid:e,query:t}}));return n}async queryProlog(e,t){let{perspectiveQueryProlog:n}=T(await V(this,te,"f").query({query:x`query perspectiveQueryProlog($uuid: String!, $query: String!) {
156
+ }`,variables:{uuid:e,query:t}}));return n}async queryProlog(e,t){let{perspectiveQueryProlog:n}=I(await V(this,ee,"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 V(this,te,"f").query({query:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
172
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:n}=I(await V(this,ee,"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=V(this,te,"f").subscribe({query:x`
174
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}subscribeToQueryUpdates(e,t){let n=V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
180
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:n}=I(await V(this,ee,"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 V(this,te,"f").mutate({mutation:x`mutation perspectiveAdd($name: String!) {
182
+ }`,variables:{uuid:e,subscriptionId:t}}));return n}async add(e){let{perspectiveAdd:t}=I(await V(this,ee,"f").mutate({mutation:E`mutation perspectiveAdd($name: String!) {
183
183
  perspectiveAdd(name: $name) {
184
- ${Pi}
184
+ ${Fi}
185
185
  }
186
- }`,variables:{name:e}}));return new zi(t,this)}async update(e,t){let{perspectiveUpdate:n}=T(await V(this,te,"f").mutate({mutation:x`mutation perspectiveUpdate($uuid: String!, $name: String!) {
186
+ }`,variables:{name:e}}));return new zi(t,this)}async update(e,t){let{perspectiveUpdate:n}=I(await V(this,ee,"f").mutate({mutation:E`mutation perspectiveUpdate($uuid: String!, $name: String!) {
187
187
  perspectiveUpdate(uuid: $uuid, name: $name) {
188
- ${Pi}
188
+ ${Fi}
189
189
  }
190
- }`,variables:{uuid:e,name:t}}));return new zi(n,this)}async remove(e){return T(await V(this,te,"f").mutate({mutation:x`mutation perspectiveRemove($uuid: String!) {
190
+ }`,variables:{uuid:e,name:t}}));return new zi(n,this)}async remove(e){return I(await V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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
- ${ut}
194
+ ${lt}
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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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
- ${ut}
198
+ ${lt}
199
199
  }
200
- }`,variables:{uuid:e,links:t,status:n,batchId:i}}));return a}async removeLinks(e,t,n){let{perspectiveRemoveLinks:i}=T(await V(this,te,"f").mutate({mutation:x`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 V(this,ee,"f").mutate({mutation:E`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
201
201
  perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
202
- ${ut}
202
+ ${lt}
203
203
  }
204
- }`,variables:{uuid:e,links:t,batchId:n}}));return i}async linkMutations(e,t,n){let{perspectiveLinkMutations:i}=T(await V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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
- ${ut}
207
+ ${lt}
208
208
  }
209
209
  removals {
210
- ${ut}
210
+ ${lt}
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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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
- ${ut}
215
+ ${lt}
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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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
- ${ut}
219
+ ${lt}
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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,te,"f").mutate({mutation:x`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 V(this,ee,"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 V(this,Wa,"f").get(e)}async createExpression(e,t){return await V(this,Wa,"f").create(e,t)}addPerspectiveAddedListener(e){V(this,Va,"f").push(e)}subscribePerspectiveAdded(){V(this,te,"f").subscribe({query:x` subscription {
232
- perspectiveAdded { ${Pi} }
231
+ }`,variables:{uuid:e,subjectClass:t,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await V(this,Ga,"f").get(e)}async createExpression(e,t){return await V(this,Ga,"f").create(e,t)}addPerspectiveAddedListener(e){V(this,za,"f").push(e)}subscribePerspectiveAdded(){V(this,ee,"f").subscribe({query:E` subscription {
232
+ perspectiveAdded { ${Fi} }
233
233
  }
234
- `}).subscribe({next:e=>{V(this,Va,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){V(this,Qa,"f").push(e)}subscribePerspectiveUpdated(){V(this,te,"f").subscribe({query:x` subscription {
235
- perspectiveUpdated { ${Pi} }
234
+ `}).subscribe({next:e=>{V(this,za,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){V(this,Ha,"f").push(e)}subscribePerspectiveUpdated(){V(this,ee,"f").subscribe({query:E` subscription {
235
+ perspectiveUpdated { ${Fi} }
236
236
  }
237
- `}).subscribe({next:e=>{V(this,Qa,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){V(this,Ws,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){V(this,te,"f").subscribe({query:x` subscription {
237
+ `}).subscribe({next:e=>{V(this,Ha,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){V(this,Zs,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){V(this,ee,"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){V(this,za,"f").push(e)}subscribePerspectiveRemoved(){V(this,te,"f").subscribe({query:x` 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){V(this,Wa,"f").push(e)}subscribePerspectiveRemoved(){V(this,ee,"f").subscribe({query:E` subscription {
241
241
  perspectiveRemoved
242
242
  }
243
- `}).subscribe({next:e=>{V(this,za,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){V(this,te,"f").subscribe({query:x` subscription {
244
- perspectiveLinkAdded(uuid: "${e}") { ${ut} }
243
+ `}).subscribe({next:e=>{V(this,Wa,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){V(this,ee,"f").subscribe({query:E` subscription {
244
+ perspectiveLinkAdded(uuid: "${e}") { ${lt} }
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){V(this,te,"f").subscribe({query:x` subscription {
247
- perspectiveLinkRemoved(uuid: "${e}") { ${ut} }
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){V(this,ee,"f").subscribe({query:E` subscription {
247
+ perspectiveLinkRemoved(uuid: "${e}") { ${lt} }
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){V(this,te,"f").subscribe({query:x` 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){V(this,ee,"f").subscribe({query:E` subscription {
250
250
  perspectiveLinkUpdated(uuid: "${e}") {
251
251
  oldLink {
252
- ${ut}
252
+ ${lt}
253
253
  }
254
254
  newLink {
255
- ${ut}
255
+ ${lt}
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 kl(V(this,Hs,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=T(await V(this,te,"f").mutate({mutation:x`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 Cl(V(this,Ys,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=I(await V(this,ee,"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 V(this,te,"f").mutate({mutation:x`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
261
+ }`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:n}=I(await V(this,ee,"f").mutate({mutation:E`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
262
262
  perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
263
263
  additions {
264
- ${ut}
264
+ ${lt}
265
265
  }
266
266
  removals {
267
- ${ut}
267
+ ${lt}
268
268
  }
269
269
  }
270
- }`,variables:{uuid:e,batchId:t}}));return n}};te=new WeakMap,Va=new WeakMap,Qa=new WeakMap,za=new WeakMap,Ws=new WeakMap,Wa=new WeakMap,Hs=new WeakMap,Gs=new WeakMap;var Is=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},ae=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)},pe,Ha,Ga,Ka,Fa=`
270
+ }`,variables:{uuid:e,batchId:t}}));return n}};ee=new WeakMap,za=new WeakMap,Ha=new WeakMap,Wa=new WeakMap,Zs=new WeakMap,Ga=new WeakMap,Ys=new WeakMap,Xs=new WeakMap;var Ns=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},te=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ae,Ka,Ja,Za,Ua=`
271
271
  did
272
272
  directMessageLanguage
273
273
  perspective {
@@ -281,7 +281,7 @@ neighbourhood {
281
281
  }
282
282
  }
283
283
  }
284
- `,Ts=`
284
+ `,$s=`
285
285
  requestId
286
286
  revoked
287
287
  auth {
@@ -297,145 +297,158 @@ neighbourhood {
297
297
  can
298
298
  }
299
299
  }
300
- `,Fi=`
300
+ `,Mi=`
301
301
  isInitialized
302
302
  isUnlocked
303
303
  did
304
304
  didDocument
305
305
  error
306
- `,Os=`
306
+ `,Ds=`
307
307
  did
308
308
  didSigningKeyId
309
309
  deviceKeyType
310
310
  deviceKey
311
311
  deviceKeySignedByDid
312
312
  didSignedByDeviceKey
313
- `,mb=`
313
+ `,Ab=`
314
314
  signature
315
315
  publicKey
316
- `,fo=class{constructor(e,t=!0){pe.set(this,void 0),Ha.set(this,void 0),Ga.set(this,void 0),Ka.set(this,void 0),Is(this,pe,e,"f"),Is(this,Ga,[],"f"),Is(this,Ka,[],"f"),Is(this,Ha,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=T(await ae(this,pe,"f").query({query:x`query agent { agent { ${Fa} } }`})),t=new rn(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=T(await ae(this,pe,"f").query({query:x`query agentStatus {
316
+ `,yo=class{constructor(e,t=!0){ae.set(this,void 0),Ka.set(this,void 0),Ja.set(this,void 0),Za.set(this,void 0),Ns(this,ae,e,"f"),Ns(this,Ja,[],"f"),Ns(this,Za,[],"f"),Ns(this,Ka,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=I(await te(this,ae,"f").query({query:E`query agent { agent { ${Ua} } }`})),t=new rn(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=I(await te(this,ae,"f").query({query:E`query agentStatus {
317
317
  agentStatus {
318
- ${Fi}
318
+ ${Mi}
319
319
  }
320
- }`}));return new qt(e)}async generate(e){let{agentGenerate:t}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentGenerate(
320
+ }`}));return new Vt(e)}async generate(e){let{agentGenerate:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentGenerate(
321
321
  $passphrase: String!
322
322
  ) {
323
323
  agentGenerate(passphrase: $passphrase) {
324
- ${Fi}
324
+ ${Mi}
325
325
  }
326
- }`,variables:{passphrase:e}}));return new qt(t)}async import(e){let{did:t,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentImport(
326
+ }`,variables:{passphrase:e}}));return new Vt(t)}async import(e){let{did:t,didDocument:n,keystore:i,passphrase:a}=e,{agentImport:o}=I(await te(this,ae,"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
- ${Fi}
333
+ ${Mi}
334
334
  }
335
- }`,variables:{did:t,didDocument:n,keystore:i,passphrase:a}}));return new qt(o)}async lock(e){let{agentLock:t}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentLock($passphrase: String!) {
335
+ }`,variables:{did:t,didDocument:n,keystore:i,passphrase:a}}));return new Vt(o)}async lock(e){let{agentLock:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentLock($passphrase: String!) {
336
336
  agentLock(passphrase: $passphrase) {
337
- ${Fi}
337
+ ${Mi}
338
338
  }
339
- }`,variables:{passphrase:e}}));return new qt(t)}async unlock(e,t=!0){let{agentUnlock:n}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
339
+ }`,variables:{passphrase:e}}));return new Vt(t)}async unlock(e,t=!0){let{agentUnlock:n}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
340
340
  agentUnlock(passphrase: $passphrase, holochain: $holochain) {
341
- ${Fi}
341
+ ${Mi}
342
342
  }
343
- }`,variables:{passphrase:e,holochain:t}}));return new qt(n)}async byDID(e){let{agentByDID:t}=T(await ae(this,pe,"f").query({query:x`query agentByDID($did: String!) {
343
+ }`,variables:{passphrase:e,holochain:t}}));return new Vt(n)}async byDID(e){let{agentByDID:t}=I(await te(this,ae,"f").query({query:E`query agentByDID($did: String!) {
344
344
  agentByDID(did: $did) {
345
- ${Fa}
345
+ ${Ua}
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 ae(this,pe,"f").mutate({mutation:x`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 te(this,ae,"f").mutate({mutation:E`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
348
348
  agentUpdatePublicPerspective(perspective: $perspective) {
349
- ${Fa}
349
+ ${Ua}
350
350
  }
351
- }`,variables:{perspective:t}})),i=n,a=new rn(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new fc(ae(this,pe,"f")),n=new fo(ae(this,pe,"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 ae(this,pe,"f").mutate({mutation:x`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
351
+ }`,variables:{perspective:t}})),i=n,a=new rn(i.did,i.perspective);return a.directMessageLanguage=i.directMessageLanguage,a}async mutatePublicPerspective(e){let t=new gc(te(this,ae,"f")),n=new yo(te(this,ae,"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 te(this,ae,"f").mutate({mutation:E`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
352
352
  agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
353
- ${Fa}
353
+ ${Ua}
354
354
  }
355
- }`,variables:{directMessageLanguage:e}})),n=t,i=new rn(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
355
+ }`,variables:{directMessageLanguage:e}})),n=t,i=new rn(n.did,n.perspective);return i.directMessageLanguage=n.directMessageLanguage,i}async addEntanglementProofs(e){let{agentAddEntanglementProofs:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
356
356
  agentAddEntanglementProofs(proofs: $proofs) {
357
- ${Os}
357
+ ${Ds}
358
358
  }
359
- }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
359
+ }`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
360
360
  agentDeleteEntanglementProofs(proofs: $proofs) {
361
- ${Os}
361
+ ${Ds}
362
362
  }
363
- }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=T(await ae(this,pe,"f").query({query:x`query agentGetEntanglementProofs {
363
+ }`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=I(await te(this,ae,"f").query({query:E`query agentGetEntanglementProofs {
364
364
  agentGetEntanglementProofs {
365
- ${Os}
365
+ ${Ds}
366
366
  }
367
- }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:n}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
367
+ }`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:n}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
368
368
  agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
369
- ${Os}
369
+ ${Ds}
370
370
  }
371
- }`,variables:{deviceKey:e,deviceKeyType:t}}));return n}addUpdatedListener(e){ae(this,Ga,"f").push(e)}addAppChangedListener(e){ae(this,Ha,"f").push(e)}subscribeAgentUpdated(){ae(this,pe,"f").subscribe({query:x` subscription {
372
- agentUpdated { ${Fa} }
371
+ }`,variables:{deviceKey:e,deviceKeyType:t}}));return n}addUpdatedListener(e){te(this,Ja,"f").push(e)}addAppChangedListener(e){te(this,Ka,"f").push(e)}subscribeAgentUpdated(){te(this,ae,"f").subscribe({query:E` subscription {
372
+ agentUpdated { ${Ua} }
373
373
  }
374
- `}).subscribe({next:e=>{let t=e.data.agentUpdated;ae(this,Ga,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){ae(this,pe,"f").subscribe({query:x` subscription {
374
+ `}).subscribe({next:e=>{let t=e.data.agentUpdated;te(this,Ja,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){te(this,ae,"f").subscribe({query:E` subscription {
375
375
  agentAppsChanged {
376
- ${Ts}
376
+ ${$s}
377
377
  }
378
378
  }
379
- `}).subscribe({next:e=>{ae(this,Ha,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){ae(this,Ka,"f").push(e)}subscribeAgentStatusChanged(){ae(this,pe,"f").subscribe({query:x` subscription {
380
- agentStatusChanged { ${Fi} }
379
+ `}).subscribe({next:e=>{te(this,Ka,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){te(this,Za,"f").push(e)}subscribeAgentStatusChanged(){te(this,ae,"f").subscribe({query:E` subscription {
380
+ agentStatusChanged { ${Mi} }
381
381
  }
382
- `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;ae(this,Ka,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=T(await ae(this,pe,"f").mutate({mutation:x`
382
+ `}).subscribe({next:e=>{let t=e.data.agentStatusChanged;te(this,Za,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=I(await te(this,ae,"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 ae(this,pe,"f").mutate({mutation:x`
386
+ `,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=I(await te(this,ae,"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 ae(this,pe,"f").mutate({mutation:x`
390
+ `,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:n}=I(await te(this,ae,"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 ae(this,pe,"f").mutate({mutation:x`query agentGetApps {
394
+ `,variables:{requestId:e,rand:t}}));return n}async getApps(){let{agentGetApps:e}=I(await te(this,ae,"f").mutate({mutation:E`query agentGetApps {
395
395
  agentGetApps {
396
- ${Ts}
396
+ ${$s}
397
397
  }
398
- }`}));return e}async removeApp(e){let{agentRemoveApp:t}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentRemoveApp($requestId: String!) {
398
+ }`}));return e}async removeApp(e){let{agentRemoveApp:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentRemoveApp($requestId: String!) {
399
399
  agentRemoveApp(requestId: $requestId) {
400
- ${Ts}
400
+ ${$s}
401
401
  }
402
- }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentRevokeToken($requestId: String!) {
402
+ }`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentRevokeToken($requestId: String!) {
403
403
  agentRevokeToken(requestId: $requestId) {
404
- ${Ts}
404
+ ${$s}
405
405
  }
406
- }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=T(await ae(this,pe,"f").mutate({mutation:x`
406
+ }`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=I(await te(this,ae,"f").mutate({mutation:E`
407
407
  query agentIsLocked {
408
408
  agentIsLocked
409
409
  }
410
- `}));return e}async signMessage(e){let{agentSignMessage:t}=T(await ae(this,pe,"f").mutate({mutation:x`mutation agentSignMessage($message: String!) {
410
+ `}));return e}async signMessage(e){let{agentSignMessage:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation agentSignMessage($message: String!) {
411
411
  agentSignMessage(message: $message) {
412
- ${mb}
412
+ ${Ab}
413
413
  }
414
- }`,variables:{message:e}}));return t}async createUser(e,t,n){let{runtimeCreateUser:i}=T(await ae(this,pe,"f").mutate({mutation:x`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
414
+ }`,variables:{message:e}}));return t}async createUser(e,t,n){let{runtimeCreateUser:i}=I(await te(this,ae,"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 ae(this,pe,"f").mutate({mutation:x`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 te(this,ae,"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 ae(this,pe,"f").mutate({mutation:x`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
422
+ }`,variables:{email:e,password:t}}));return n}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:n}=I(await te(this,ae,"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 ae(this,pe,"f").mutate({mutation:x`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 te(this,ae,"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}};pe=new WeakMap,Ha=new WeakMap,Ga=new WeakMap,Ka=new WeakMap;var gb=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},Kr=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)},Jt,Ff=`
431
+ }`,variables:{email:e,code:t,verificationType:n}}));return i}async hostingUserInfo(){let{runtimeHostingUserInfo:e}=I(await te(this,ae,"f").query({query:E`query runtimeHostingUserInfo {
432
+ runtimeHostingUserInfo {
433
+ email
434
+ remainingCredits
435
+ hotWalletAddress
436
+ }
437
+ }`}));return e}async setHotWalletAddress(e){let{runtimeSetHotWalletAddress:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation runtimeSetHotWalletAddress($address: String!) {
438
+ runtimeSetHotWalletAddress(address: $address)
439
+ }`,variables:{address:e}}));return t}async requestPayment(e){let{runtimeRequestPayment:t}=I(await te(this,ae,"f").mutate({mutation:E`mutation runtimeRequestPayment($amountHOT: String!) {
440
+ runtimeRequestPayment(amountHOT: $amountHOT) {
441
+ success
442
+ message
443
+ }
444
+ }`,variables:{amountHOT:e}}));return t}};ae=new WeakMap,Ka=new WeakMap,Ja=new WeakMap,Za=new WeakMap;var Ib=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},Kr=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},Yt,jf=`
432
445
  name
433
446
  address
434
447
  settings
435
448
  icon { code }
436
449
  constructorIcon { code }
437
450
  settingsIcon { code }
438
- `,Mf=`
451
+ `,qf=`
439
452
  name
440
453
  address
441
454
  description
@@ -445,45 +458,45 @@ neighbourhood {
445
458
  templateAppliedParams
446
459
  possibleTemplateParams
447
460
  sourceCodeLink
448
- `,Tl=class{constructor(e){Jt.set(this,void 0),gb(this,Jt,e,"f")}async byAddress(e){let{language:t}=T(await Kr(this,Jt,"f").query({query:x`query byAddress($address: String!) {
461
+ `,$l=class{constructor(e){Yt.set(this,void 0),Ib(this,Yt,e,"f")}async byAddress(e){let{language:t}=I(await Kr(this,Yt,"f").query({query:E`query byAddress($address: String!) {
449
462
  language(address: $address) {
450
- ${Ff}
463
+ ${jf}
451
464
  }
452
- }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=T(await Kr(this,Jt,"f").query({query:x`query byFilter($filter: String!) {
465
+ }`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=I(await Kr(this,Yt,"f").query({query:E`query byFilter($filter: String!) {
453
466
  languages(filter: $filter) {
454
- ${Ff}
467
+ ${jf}
455
468
  }
456
- }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:n}=T(await Kr(this,Jt,"f").mutate({mutation:x`mutation writeSettings($languageAddress: String!, $settings: String!) {
469
+ }`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:n}=I(await Kr(this,Yt,"f").mutate({mutation:E`mutation writeSettings($languageAddress: String!, $settings: String!) {
457
470
  languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
458
- }`,variables:{languageAddress:e,settings:t}}));return n}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:n}=T(await Kr(this,Jt,"f").mutate({mutation:x`mutation languageApplyTemplateAndPublish(
471
+ }`,variables:{languageAddress:e,settings:t}}));return n}async applyTemplateAndPublish(e,t){let{languageApplyTemplateAndPublish:n}=I(await Kr(this,Yt,"f").mutate({mutation:E`mutation languageApplyTemplateAndPublish(
459
472
  $sourceLanguageHash: String!,
460
473
  $templateData: String!,
461
474
  ) {
462
475
  languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
463
476
  name, address
464
477
  }
465
- }`,variables:{sourceLanguageHash:e,templateData:t}}));return n}async publish(e,t){let{languagePublish:n}=T(await Kr(this,Jt,"f").mutate({mutation:x`mutation languagePublish(
478
+ }`,variables:{sourceLanguageHash:e,templateData:t}}));return n}async publish(e,t){let{languagePublish:n}=I(await Kr(this,Yt,"f").mutate({mutation:E`mutation languagePublish(
466
479
  $languagePath: String!,
467
480
  $languageMeta: LanguageMetaInput!,
468
481
  ) {
469
482
  languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
470
- ${Mf}
483
+ ${qf}
471
484
  }
472
- }`,variables:{languagePath:e,languageMeta:t}}));return n}async meta(e){let{languageMeta:t}=T(await Kr(this,Jt,"f").query({query:x`query languageMeta(
485
+ }`,variables:{languagePath:e,languageMeta:t}}));return n}async meta(e){let{languageMeta:t}=I(await Kr(this,Yt,"f").query({query:E`query languageMeta(
473
486
  $address: String!,
474
487
  ) {
475
488
  languageMeta(address: $address) {
476
- ${Mf}
489
+ ${qf}
477
490
  }
478
- }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=T(await Kr(this,Jt,"f").query({query:x`query languageSource(
491
+ }`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=I(await Kr(this,Yt,"f").query({query:E`query languageSource(
479
492
  $address: String!,
480
493
  ) {
481
494
  languageSource(address: $address)
482
- }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=T(await Kr(this,Jt,"f").mutate({mutation:x`mutation languageRemove(
495
+ }`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=I(await Kr(this,Yt,"f").mutate({mutation:E`mutation languageRemove(
483
496
  $address: String!,
484
497
  ) {
485
498
  languageRemove(address: $address)
486
- }`,variables:{address:e}}));return t}};Jt=new WeakMap;var yb=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},it=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,Vi,Ol=class{constructor(e){dt.set(this,void 0),Vi.set(this,new Map),yb(this,dt,e,"f")}async publishFromPerspective(e,t,n){let{neighbourhoodPublishFromPerspective:i}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodPublishFromPerspective(
499
+ }`,variables:{address:e}}));return t}};Yt=new WeakMap;var Tb=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},at=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,Qi,Dl=class{constructor(e){ft.set(this,void 0),Qi.set(this,new Map),Tb(this,ft,e,"f")}async publishFromPerspective(e,t,n){let{neighbourhoodPublishFromPerspective:i}=I(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodPublishFromPerspective(
487
500
  $linkLanguage: String!,
488
501
  $meta: PerspectiveInput!,
489
502
  $perspectiveUUID: String!
@@ -493,7 +506,7 @@ neighbourhood {
493
506
  meta: $meta,
494
507
  perspectiveUUID: $perspectiveUUID
495
508
  )
496
- }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodJoinFromUrl($url: String!) {
509
+ }`,variables:{perspectiveUUID:e,linkLanguage:t,meta:n}}));return i}async joinFromUrl(e){let{neighbourhoodJoinFromUrl:t}=I(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodJoinFromUrl($url: String!) {
497
510
  neighbourhoodJoinFromUrl(url: $url) {
498
511
  uuid
499
512
  name
@@ -515,11 +528,11 @@ neighbourhood {
515
528
  author
516
529
  }
517
530
  }
518
- }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=T(await it(this,dt,"f").query({query:x`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
531
+ }`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=I(await at(this,ft,"f").query({query:E`query neighbourhoodOtherAgents($perspectiveUUID: String!) {
519
532
  neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
520
- }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=T(await it(this,dt,"f").query({query:x`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
533
+ }`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=I(await at(this,ft,"f").query({query:E`query neighbourhoodHasTelepresenceAdapter($perspectiveUUID: String!) {
521
534
  neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
522
- }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=T(await it(this,dt,"f").query({query:x`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
535
+ }`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=I(await at(this,ft,"f").query({query:E`query neighbourhoodOnlineAgents($perspectiveUUID: String!) {
523
536
  neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
524
537
  did
525
538
  status {
@@ -536,7 +549,7 @@ neighbourhood {
536
549
  proof { valid, invalid, signature, key }
537
550
  }
538
551
  }
539
- }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:n}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodSetOnlineStatus(
552
+ }`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:n}=I(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatus(
540
553
  $perspectiveUUID: String!,
541
554
  $status: PerspectiveInput!
542
555
  ) {
@@ -544,7 +557,7 @@ neighbourhood {
544
557
  perspectiveUUID: $perspectiveUUID,
545
558
  status: $status
546
559
  )
547
- }`,variables:{perspectiveUUID:e,status:t}}));return n}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:n}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodSetOnlineStatusU(
560
+ }`,variables:{perspectiveUUID:e,status:t}}));return n}async setOnlineStatusU(e,t){let{neighbourhoodSetOnlineStatusU:n}=I(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSetOnlineStatusU(
548
561
  $perspectiveUUID: String!,
549
562
  $status: PerspectiveUnsignedInput!
550
563
  ) {
@@ -552,7 +565,7 @@ neighbourhood {
552
565
  perspectiveUUID: $perspectiveUUID,
553
566
  status: $status
554
567
  )
555
- }`,variables:{perspectiveUUID:e,status:t}}));return n}async sendSignal(e,t,n){let{neighbourhoodSendSignal:i}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodSendSignal(
568
+ }`,variables:{perspectiveUUID:e,status:t}}));return n}async sendSignal(e,t,n){let{neighbourhoodSendSignal:i}=I(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSendSignal(
556
569
  $perspectiveUUID: String!,
557
570
  $remoteAgentDid: String!,
558
571
  $payload: PerspectiveInput!
@@ -562,7 +575,7 @@ neighbourhood {
562
575
  remoteAgentDid: $remoteAgentDid,
563
576
  payload: $payload
564
577
  )
565
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendSignalU(e,t,n){let{neighbourhoodSendSignalU:i}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodSendSignalU(
578
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendSignalU(e,t,n){let{neighbourhoodSendSignalU:i}=I(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSendSignalU(
566
579
  $perspectiveUUID: String!,
567
580
  $remoteAgentDid: String!,
568
581
  $payload: PerspectiveUnsignedInput!
@@ -572,7 +585,7 @@ neighbourhood {
572
585
  remoteAgentDid: $remoteAgentDid,
573
586
  payload: $payload
574
587
  )
575
- }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendBroadcast(e,t,n=!1){let{neighbourhoodSendBroadcast:i}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodSendBroadcast(
588
+ }`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:n}}));return i}async sendBroadcast(e,t,n=!1){let{neighbourhoodSendBroadcast:i}=I(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcast(
576
589
  $perspectiveUUID: String!,
577
590
  $payload: PerspectiveInput!,
578
591
  $loopback: Boolean
@@ -582,7 +595,7 @@ neighbourhood {
582
595
  payload: $payload,
583
596
  loopback: $loopback
584
597
  )
585
- }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}async sendBroadcastU(e,t,n=!1){let{neighbourhoodSendBroadcastU:i}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodSendBroadcastU(
598
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}async sendBroadcastU(e,t,n=!1){let{neighbourhoodSendBroadcastU:i}=I(await at(this,ft,"f").mutate({mutation:E`mutation neighbourhoodSendBroadcastU(
586
599
  $perspectiveUUID: String!,
587
600
  $payload: PerspectiveUnsignedInput!,
588
601
  $loopback: Boolean
@@ -592,7 +605,7 @@ neighbourhood {
592
605
  payload: $payload,
593
606
  loopback: $loopback
594
607
  )
595
- }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}dispatchSignal(e,t){let n=it(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;it(this,dt,"f").subscribe({query:x`subscription neighbourhoodSignal($perspectiveUUID: String!) {
608
+ }`,variables:{perspectiveUUID:e,payload:t,loopback:n}}));return i}dispatchSignal(e,t){let n=at(this,Qi,"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;at(this,ft,"f").subscribe({query:E`subscription neighbourhoodSignal($perspectiveUUID: String!) {
596
609
  neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
597
610
  author
598
611
  timestamp
@@ -607,7 +620,7 @@ neighbourhood {
607
620
  }
608
621
  proof { valid, invalid, signature, key }
609
622
  }
610
- }`,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=it(this,Vi,"f").get(e);n?n.push(t):(n=[],it(this,Vi,"f").set(e,n),n.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let n=it(this,Vi,"f").get(e);if(n){let i=n.indexOf(t);i>-1&&n.splice(i,1)}}};dt=new WeakMap,Vi=new WeakMap;var Cs=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},Q=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)},G,Ja,Za,Ya,om,Ns=`
623
+ }`,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=at(this,Qi,"f").get(e);n?n.push(t):(n=[],at(this,Qi,"f").set(e,n),n.push(t),await this.subscribeToSignals(e))}removeSignalHandler(e,t){let n=at(this,Qi,"f").get(e);if(n){let i=n.indexOf(t);i>-1&&n.splice(i,1)}}};ft=new WeakMap,Qi=new WeakMap;var Rs=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},Q=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,Ya,Xa,eo,dm,Ps=`
611
624
  author
612
625
  timestamp
613
626
  data {
@@ -619,7 +632,7 @@ data {
619
632
  }
620
633
  }
621
634
  proof { valid, invalid, signature, key }
622
- `,vb=`
635
+ `,Ob=`
623
636
  description
624
637
  appName
625
638
  appUrl
@@ -628,72 +641,72 @@ trigger
628
641
  perspectiveIds
629
642
  webhookUrl
630
643
  webhookAuth
631
- `,sm=`
644
+ `,fm=`
632
645
  id
633
646
  granted
634
- ${vb}
635
- `,bb=`
636
- notification { ${sm} }
647
+ ${Ob}
648
+ `,Cb=`
649
+ notification { ${fm} }
637
650
  perspectiveId
638
651
  triggerMatch
639
- `,Cl=class{constructor(e,t=!0){G.set(this,void 0),Ja.set(this,void 0),Za.set(this,void 0),Ya.set(this,void 0),om.set(this,void 0),Cs(this,G,e,"f"),Cs(this,Ja,[],"f"),Cs(this,Za,[],"f"),Cs(this,Ya,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=T(await Q(this,G,"f").query({query:x`query runtimeInfo {
652
+ `,Rl=class{constructor(e,t=!0){J.set(this,void 0),Ya.set(this,void 0),Xa.set(this,void 0),eo.set(this,void 0),dm.set(this,void 0),Rs(this,J,e,"f"),Rs(this,Ya,[],"f"),Rs(this,Xa,[],"f"),Rs(this,eo,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=I(await Q(this,J,"f").query({query:E`query runtimeInfo {
640
653
  runtimeInfo {
641
654
  ad4mExecutorVersion,
642
655
  isInitialized,
643
656
  isUnlocked
644
657
  }
645
- }`}));return e}async quit(){return T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeOpenLink($url: String!) {
658
+ }`}));return e}async quit(){return I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeOpenLink($url: String!) {
646
659
  runtimeOpenLink(url: $url)
647
- }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation addTrustedAgents($agents: [String!]!) {
660
+ }`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation addTrustedAgents($agents: [String!]!) {
648
661
  addTrustedAgents(agents: $agents)
649
- }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation deleteTrustedAgents($agents: [String!]!) {
662
+ }`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation deleteTrustedAgents($agents: [String!]!) {
650
663
  deleteTrustedAgents(agents: $agents)
651
- }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=T(await Q(this,G,"f").query({query:x`query getTrustedAgents {
664
+ }`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=I(await Q(this,J,"f").query({query:E`query getTrustedAgents {
652
665
  getTrustedAgents
653
- }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
666
+ }`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
654
667
  runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
655
- }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
668
+ }`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
656
669
  runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
657
- }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=T(await Q(this,G,"f").query({query:x`query runtimeKnownLinkLanguageTemplates {
670
+ }`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=I(await Q(this,J,"f").query({query:E`query runtimeKnownLinkLanguageTemplates {
658
671
  runtimeKnownLinkLanguageTemplates
659
- }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeAddFriends($dids: [String!]!) {
672
+ }`}));return e}async addFriends(e){let{runtimeAddFriends:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeAddFriends($dids: [String!]!) {
660
673
  runtimeAddFriends(dids: $dids)
661
- }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeRemoveFriends($dids: [String!]!) {
674
+ }`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeRemoveFriends($dids: [String!]!) {
662
675
  runtimeRemoveFriends(dids: $dids)
663
- }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=T(await Q(this,G,"f").query({query:x`query runtimeFriends {
676
+ }`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=I(await Q(this,J,"f").query({query:E`query runtimeFriends {
664
677
  runtimeFriends
665
- }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=T(await Q(this,G,"f").query({query:x`query runtimeHcAgentInfos {
678
+ }`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=I(await Q(this,J,"f").query({query:E`query runtimeHcAgentInfos {
666
679
  runtimeHcAgentInfos
667
- }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=T(await Q(this,G,"f").query({query:x`query runtimeGetNetworkMetrics {
680
+ }`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=I(await Q(this,J,"f").query({query:E`query runtimeGetNetworkMetrics {
668
681
  runtimeGetNetworkMetrics
669
- }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeRestartHolochain {
682
+ }`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeRestartHolochain {
670
683
  runtimeRestartHolochain
671
- }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
684
+ }`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
672
685
  runtimeHcAddAgentInfos(agentInfos: $agentInfos)
673
- }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,n,i){let{runtimeVerifyStringSignedByDid:a}=T(await Q(this,G,"f").mutate({mutation:x`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
686
+ }`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,n,i){let{runtimeVerifyStringSignedByDid:a}=I(await Q(this,J,"f").mutate({mutation:E`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
674
687
  runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
675
- }`,variables:{did:e,didSigningKeyId:t,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeSetStatus($status: PerspectiveInput!) {
688
+ }`,variables:{did:e,didSigningKeyId:t,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeSetStatus($status: PerspectiveInput!) {
676
689
  runtimeSetStatus(status: $status)
677
- }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=T(await Q(this,G,"f").query({query:x`query runtimeFriendStatus($did: String!) {
678
- runtimeFriendStatus(did: $did) { ${Ns} }
679
- }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:n}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
690
+ }`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=I(await Q(this,J,"f").query({query:E`query runtimeFriendStatus($did: String!) {
691
+ runtimeFriendStatus(did: $did) { ${Ps} }
692
+ }`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:n}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
680
693
  runtimeFriendSendMessage(did: $did, message: $message)
681
- }`,variables:{did:e,message:t}}));return n}async messageInbox(e){let{runtimeMessageInbox:t}=T(await Q(this,G,"f").query({query:x`query runtimeMessageInbox($filter: String) {
682
- runtimeMessageInbox(filter: $filter) { ${Ns} }
683
- }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=T(await Q(this,G,"f").query({query:x`query runtimeMessageOutbox($filter: String) {
694
+ }`,variables:{did:e,message:t}}));return n}async messageInbox(e){let{runtimeMessageInbox:t}=I(await Q(this,J,"f").query({query:E`query runtimeMessageInbox($filter: String) {
695
+ runtimeMessageInbox(filter: $filter) { ${Ps} }
696
+ }`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=I(await Q(this,J,"f").query({query:E`query runtimeMessageOutbox($filter: String) {
684
697
  runtimeMessageOutbox(filter: $filter) {
685
698
  recipient,
686
699
  message {
687
- ${Ns}
700
+ ${Ps}
688
701
  }
689
702
  }
690
- }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
703
+ }`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
691
704
  runtimeRequestInstallNotification(notification: $notification)
692
- }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeGrantNotification($id: String!) {
705
+ }`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeGrantNotification($id: String!) {
693
706
  runtimeGrantNotification(id: $id)
694
- }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeExportDb($filePath: String!) {
707
+ }`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeExportDb($filePath: String!) {
695
708
  runtimeExportDb(filePath: $filePath)
696
- }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeImportDb($filePath: String!) {
709
+ }`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeImportDb($filePath: String!) {
697
710
  runtimeImportDb(filePath: $filePath) {
698
711
  perspectives { total imported failed omitted errors }
699
712
  links { total imported failed omitted errors }
@@ -707,51 +720,51 @@ triggerMatch
707
720
  trustedAgents { total imported failed omitted errors }
708
721
  knownLinkLanguages { total imported failed omitted errors }
709
722
  }
710
- }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=T(await Q(this,G,"f").query({query:x`query runtimeNotifications {
711
- runtimeNotifications { ${sm} }
712
- }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:n}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
723
+ }`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=I(await Q(this,J,"f").query({query:E`query runtimeNotifications {
724
+ runtimeNotifications { ${fm} }
725
+ }`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:n}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
713
726
  runtimeUpdateNotification(id: $id, notification: $notification)
714
- }`,variables:{id:e,notification:t}}));return n}async removeNotification(e){let{runtimeRemoveNotification:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeRemoveNotification($id: String!) {
727
+ }`,variables:{id:e,notification:t}}));return n}async removeNotification(e){let{runtimeRemoveNotification:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeRemoveNotification($id: String!) {
715
728
  runtimeRemoveNotification(id: $id)
716
- }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:n}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
729
+ }`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:n}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
717
730
  runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
718
- }`,variables:{perspectiveUuid:e,filePath:t}}));return n}async importPerspective(e){let{runtimeImportPerspective:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeImportPerspective($filePath: String!) {
731
+ }`,variables:{perspectiveUuid:e,filePath:t}}));return n}async importPerspective(e){let{runtimeImportPerspective:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeImportPerspective($filePath: String!) {
719
732
  runtimeImportPerspective(filePath: $filePath)
720
- }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=T(await Q(this,G,"f").query({query:x`query runtimeMultiUserEnabled {
733
+ }`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=I(await Q(this,J,"f").query({query:E`query runtimeMultiUserEnabled {
721
734
  runtimeMultiUserEnabled
722
- }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
735
+ }`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
723
736
  runtimeSetMultiUserEnabled(enabled: $enabled)
724
- }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=T(await Q(this,G,"f").query({query:x`query runtimeListUsers {
737
+ }`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=I(await Q(this,J,"f").query({query:E`query runtimeListUsers {
725
738
  runtimeListUsers {
726
739
  email
727
740
  did
728
741
  lastSeen
729
742
  perspectiveCount
730
743
  }
731
- }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestModeEnable {
744
+ }`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeEmailTestModeEnable {
732
745
  runtimeEmailTestModeEnable
733
- }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestModeDisable {
746
+ }`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeEmailTestModeDisable {
734
747
  runtimeEmailTestModeDisable
735
- }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestGetCode($email: String!) {
748
+ }`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeEmailTestGetCode($email: String!) {
736
749
  runtimeEmailTestGetCode(email: $email)
737
- }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestClearCodes {
750
+ }`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeEmailTestClearCodes {
738
751
  runtimeEmailTestClearCodes
739
- }`}));return e}async emailTestSetExpiry(e,t,n){let{runtimeEmailTestSetExpiry:i}=T(await Q(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
752
+ }`}));return e}async emailTestSetExpiry(e,t,n){let{runtimeEmailTestSetExpiry:i}=I(await Q(this,J,"f").mutate({mutation:E`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
740
753
  runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
741
- }`,variables:{email:e,verificationType:t,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){Q(this,Ya,"f").push(e)}subscribeNotificationTriggered(){Q(this,G,"f").subscribe({query:x` subscription {
742
- runtimeNotificationTriggered { ${bb} }
754
+ }`,variables:{email:e,verificationType:t,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){Q(this,eo,"f").push(e)}subscribeNotificationTriggered(){Q(this,J,"f").subscribe({query:E` subscription {
755
+ runtimeNotificationTriggered { ${Cb} }
743
756
  }
744
- `}).subscribe({next:e=>{Q(this,Ya,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){Q(this,Ja,"f").push(e)}subscribeMessageReceived(){Q(this,G,"f").subscribe({query:x` subscription {
745
- runtimeMessageReceived { ${Ns} }
757
+ `}).subscribe({next:e=>{Q(this,eo,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){Q(this,Ya,"f").push(e)}subscribeMessageReceived(){Q(this,J,"f").subscribe({query:E` subscription {
758
+ runtimeMessageReceived { ${Ps} }
746
759
  }
747
- `}).subscribe({next:e=>{Q(this,Ja,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){Q(this,Za,"f").push(e)}subscribeExceptionOccurred(){Q(this,G,"f").subscribe({query:x` subscription {
760
+ `}).subscribe({next:e=>{Q(this,Ya,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){Q(this,Xa,"f").push(e)}subscribeExceptionOccurred(){Q(this,J,"f").subscribe({query:E` subscription {
748
761
  exceptionOccurred {
749
762
  title
750
763
  message
751
764
  type
752
765
  addon
753
766
  }
754
- }`}).subscribe({next:e=>{Q(this,Za,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};G=new WeakMap,Ja=new WeakMap,Za=new WeakMap,Ya=new WeakMap,om=new WeakMap;var wb=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},Mi=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)},Nr,Nl=class{constructor(e){Nr.set(this,void 0),wb(this,Nr,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}=T(await Mi(this,Nr,"f").query({query:x`query expression($url: String!) {
767
+ }`}).subscribe({next:e=>{Q(this,Xa,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};J=new WeakMap,Ya=new WeakMap,Xa=new WeakMap,eo=new WeakMap,dm=new WeakMap;var Nb=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},Ui=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)},Nr,Pl=class{constructor(e){Nr.set(this,void 0),Nb(this,Nr,e,"f")}async get(e,t=!1){if(!t)try{let i=_e.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 Ui(this,Nr,"f").query({query:E`query expression($url: String!) {
755
768
  expression(url: $url) {
756
769
  author
757
770
  timestamp
@@ -764,7 +777,7 @@ triggerMatch
764
777
  invalid
765
778
  }
766
779
  }
767
- }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:t}=T(await Mi(this,Nr,"f").query({query:x`query expressionMany($urls: [String!]!) {
780
+ }`,variables:{url:e}}));return n}async getMany(e){let{expressionMany:t}=I(await Ui(this,Nr,"f").query({query:E`query expressionMany($urls: [String!]!) {
768
781
  expressionMany(urls: $urls) {
769
782
  author
770
783
  timestamp
@@ -777,19 +790,19 @@ triggerMatch
777
790
  invalid
778
791
  }
779
792
  }
780
- }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=T(await Mi(this,Nr,"f").query({query:x`query expressionRaw($url: String!) {
793
+ }`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=I(await Ui(this,Nr,"f").query({query:E`query expressionRaw($url: String!) {
781
794
  expressionRaw(url: $url)
782
- }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:n}=T(await Mi(this,Nr,"f").mutate({mutation:x`mutation expressionCreate($content: String!, $languageAddress: String!){
795
+ }`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:n}=I(await Ui(this,Nr,"f").mutate({mutation:E`mutation expressionCreate($content: String!, $languageAddress: String!){
783
796
  expressionCreate(content: $content, languageAddress: $languageAddress)
784
- }`,variables:{content:e,languageAddress:t}}));return n}async interactions(e){let{expressionInteractions:t}=T(await Mi(this,Nr,"f").query({query:x`query expressionInteractions($url: String!) {
797
+ }`,variables:{content:e,languageAddress:t}}));return n}async interactions(e){let{expressionInteractions:t}=I(await Ui(this,Nr,"f").query({query:E`query expressionInteractions($url: String!) {
785
798
  expressionInteractions(url: $url) {
786
799
  label
787
800
  name
788
801
  parameters { name, type }
789
802
  }
790
- }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:n}=T(await Mi(this,Nr,"f").mutate({mutation:x`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
803
+ }`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:n}=I(await Ui(this,Nr,"f").mutate({mutation:E`mutation expressionInteract($url: String!, $interactionCall: InteractionCall!){
791
804
  expressionInteract(url: $url, interactionCall: $interactionCall)
792
- }`,variables:{url:e,interactionCall:t}}));return n}};Nr=new WeakMap;var Tc={};Tc.byteLength=_b;Tc.toByteArray=xb;Tc.fromByteArray=Ib;var fr=[],Ut=[],Sb=typeof Uint8Array<"u"?Uint8Array:Array,il="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Nn=0,jf=il.length;Nn<jf;++Nn)fr[Nn]=il[Nn],Ut[il.charCodeAt(Nn)]=Nn;var Nn,jf;Ut["-".charCodeAt(0)]=62;Ut["_".charCodeAt(0)]=63;function cm(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 _b(r){var e=cm(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Eb(r,e,t){return(e+t)*3/4-t}function xb(r){var e,t=cm(r),n=t[0],i=t[1],a=new Sb(Eb(r,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=Ut[r.charCodeAt(c)]<<18|Ut[r.charCodeAt(c+1)]<<12|Ut[r.charCodeAt(c+2)]<<6|Ut[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Ut[r.charCodeAt(c)]<<2|Ut[r.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=Ut[r.charCodeAt(c)]<<10|Ut[r.charCodeAt(c+1)]<<4|Ut[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function Ab(r){return fr[r>>18&63]+fr[r>>12&63]+fr[r>>6&63]+fr[r&63]}function kb(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(Ab(n));return i.join("")}function Ib(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(kb(r,o,o+a>s?s:o+a));return n===1?(e=r[t-1],i.push(fr[e>>2]+fr[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(fr[e>>10]+fr[e>>4&63]+fr[e<<2&63]+"=")),i.join("")}var Tb=4,Uf=0,qf=1,Ob=2;function aa(r){let e=r.length;for(;--e>=0;)r[e]=0}var Cb=0,um=1,Nb=2,$b=3,Db=258,Kl=29,ko=256,ho=ko+1+Kl,Wi=30,Jl=19,lm=2*ho+1,Bn=15,al=16,Rb=7,Zl=256,pm=16,dm=17,fm=18,$l=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]),Ks=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]),Lb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),hm=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Pb=512,$r=new Array((ho+2)*2);aa($r);var oo=new Array(Wi*2);aa(oo);var mo=new Array(Pb);aa(mo);var go=new Array(Db-$b+1);aa(go);var Yl=new Array(Kl);aa(Yl);var hc=new Array(Wi);aa(hc);function ol(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 mm,gm,ym;function sl(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var vm=r=>r<256?mo[r]:mo[256+(r>>>7)],yo=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},_t=(r,e,t)=>{r.bi_valid>al-t?(r.bi_buf|=e<<r.bi_valid&65535,yo(r,r.bi_buf),r.bi_buf=e>>al-r.bi_valid,r.bi_valid+=t-al):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},hr=(r,e,t)=>{_t(r,t[e*2],t[e*2+1])},bm=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},Fb=r=>{r.bi_valid===16?(yo(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)},Mb=(r,e)=>{let t=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,d,f,p,m,h=0;for(f=0;f<=Bn;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<lm;u++)l=r.heap[u],f=t[t[l*2+1]*2+1]+1,f>c&&(f=c,h++),t[l*2+1]=f,!(l>n)&&(r.bl_count[f]++,p=0,l>=s&&(p=o[l-s]),m=t[l*2],r.opt_len+=m*(f+p),a&&(r.static_len+=m*(i[l*2+1]+p)));if(h!==0){do{for(f=c-1;r.bl_count[f]===0;)f--;r.bl_count[f]--,r.bl_count[f+1]+=2,r.bl_count[c]--,h-=2}while(h>0);for(f=c;f!==0;f--)for(l=r.bl_count[f];l!==0;)d=r.heap[--u],!(d>n)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),l--)}},wm=(r,e,t)=>{let n=new Array(Bn+1),i=0,a,o;for(a=1;a<=Bn;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]=bm(n[s]++,s))}},jb=()=>{let r,e,t,n,i,a=new Array(Bn+1);for(t=0,n=0;n<Kl-1;n++)for(Yl[n]=t,r=0;r<1<<$l[n];r++)go[t++]=n;for(go[t-1]=n,i=0,n=0;n<16;n++)for(hc[n]=i,r=0;r<1<<Ks[n];r++)mo[i++]=n;for(i>>=7;n<Wi;n++)for(hc[n]=i<<7,r=0;r<1<<Ks[n]-7;r++)mo[256+i++]=n;for(e=0;e<=Bn;e++)a[e]=0;for(r=0;r<=143;)$r[r*2+1]=8,r++,a[8]++;for(;r<=255;)$r[r*2+1]=9,r++,a[9]++;for(;r<=279;)$r[r*2+1]=7,r++,a[7]++;for(;r<=287;)$r[r*2+1]=8,r++,a[8]++;for(wm($r,ho+1,a),r=0;r<Wi;r++)oo[r*2+1]=5,oo[r*2]=bm(r,5);mm=new ol($r,$l,ko+1,ho,Bn),gm=new ol(oo,Ks,0,Wi,Bn),ym=new ol(new Array(0),Lb,0,Jl,Rb)},Sm=r=>{let e;for(e=0;e<ho;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Wi;e++)r.dyn_dtree[e*2]=0;for(e=0;e<Jl;e++)r.bl_tree[e*2]=0;r.dyn_ltree[Zl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},_m=r=>{r.bi_valid>8?yo(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Bf=(r,e,t,n)=>{let i=e*2,a=t*2;return r[i]<r[a]||r[i]===r[a]&&n[e]<=n[t]},cl=(r,e,t)=>{let n=r.heap[t],i=t<<1;for(;i<=r.heap_len&&(i<r.heap_len&&Bf(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!Bf(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n},Vf=(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?hr(r,i,e):(o=go[i],hr(r,o+ko+1,e),s=$l[o],s!==0&&(i-=Yl[o],_t(r,i,s)),n--,o=vm(n),hr(r,o,t),s=Ks[o],s!==0&&(n-=hc[o],_t(r,n,s)));while(a<r.sym_next);hr(r,Zl,e)},Dl=(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=lm,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--)cl(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],cl(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++,cl(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],Mb(r,e),wm(t,c,r.bl_count)},Qf=(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[pm*2]++):s<=10?r.bl_tree[dm*2]++:r.bl_tree[fm*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},zf=(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 hr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==i&&(hr(r,a,r.bl_tree),s--),hr(r,pm,r.bl_tree),_t(r,s-3,2)):s<=10?(hr(r,dm,r.bl_tree),_t(r,s-3,3)):(hr(r,fm,r.bl_tree),_t(r,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Ub=r=>{let e;for(Qf(r,r.dyn_ltree,r.l_desc.max_code),Qf(r,r.dyn_dtree,r.d_desc.max_code),Dl(r,r.bl_desc),e=Jl-1;e>=3&&r.bl_tree[hm[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},qb=(r,e,t,n)=>{let i;for(_t(r,e-257,5),_t(r,t-1,5),_t(r,n-4,4),i=0;i<n;i++)_t(r,r.bl_tree[hm[i]*2+1],3);zf(r,r.dyn_ltree,e-1),zf(r,r.dyn_dtree,t-1)},Bb=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Uf;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return qf;for(t=32;t<ko;t++)if(r.dyn_ltree[t*2]!==0)return qf;return Uf},Wf=!1,Vb=r=>{Wf||(jb(),Wf=!0),r.l_desc=new sl(r.dyn_ltree,mm),r.d_desc=new sl(r.dyn_dtree,gm),r.bl_desc=new sl(r.bl_tree,ym),r.bi_buf=0,r.bi_valid=0,Sm(r)},Em=(r,e,t,n)=>{_t(r,(Cb<<1)+(n?1:0),3),_m(r),yo(r,t),yo(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},Qb=r=>{_t(r,um<<1,3),hr(r,Zl,$r),Fb(r)},zb=(r,e,t,n)=>{let i,a,o=0;r.level>0?(r.strm.data_type===Ob&&(r.strm.data_type=Bb(r)),Dl(r,r.l_desc),Dl(r,r.d_desc),o=Ub(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?Em(r,e,t,n):r.strategy===Tb||a===i?(_t(r,(um<<1)+(n?1:0),3),Vf(r,$r,oo)):(_t(r,(Nb<<1)+(n?1:0),3),qb(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Vf(r,r.dyn_ltree,r.dyn_dtree)),Sm(r),n&&_m(r)},Wb=(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[(go[t]+ko+1)*2]++,r.dyn_dtree[vm(e)*2]++),r.sym_next===r.sym_end),Hb=Vb,Gb=Em,Kb=zb,Jb=Wb,Zb=Qb,Yb={_tr_init:Hb,_tr_stored_block:Gb,_tr_flush_block:Kb,_tr_tally:Jb,_tr_align:Zb},Xb=(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},vo=Xb,e0=()=>{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},t0=new Uint32Array(e0()),r0=(r,e,t,n)=>{let i=t0,a=n+t;r^=-1;for(let o=n;o<a;o++)r=r>>>8^i[(r^e[o])&255];return r^-1},We=r0,Zn={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"},oi={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:n0,_tr_stored_block:Rl,_tr_flush_block:i0,_tr_tally:on,_tr_align:a0}=Yb,{Z_NO_FLUSH:sn,Z_PARTIAL_FLUSH:o0,Z_FULL_FLUSH:s0,Z_FINISH:Bt,Z_BLOCK:Hf,Z_OK:et,Z_STREAM_END:Gf,Z_STREAM_ERROR:yr,Z_DATA_ERROR:c0,Z_BUF_ERROR:ul,Z_DEFAULT_COMPRESSION:u0,Z_FILTERED:l0,Z_HUFFMAN_ONLY:$s,Z_RLE:p0,Z_FIXED:d0,Z_DEFAULT_STRATEGY:f0,Z_UNKNOWN:h0,Z_DEFLATED:Oc}=oi,m0=9,g0=15,y0=8,v0=29,b0=256,Ll=b0+1+v0,w0=30,S0=19,_0=2*Ll+1,E0=15,oe=3,en=258,vr=en+oe+1,x0=32,Zi=42,Xl=57,Pl=69,Fl=73,Ml=91,jl=103,Vn=113,Xa=666,ft=1,oa=2,Yn=3,sa=4,A0=3,Qn=(r,e)=>(r.msg=Zn[e],e),Kf=r=>r*2-(r>4?9:0),Xr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},k0=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)},I0=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,cn=I0,It=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))},Ot=(r,e)=>{i0(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,It(r.strm)},me=(r,e)=>{r.pending_buf[r.pending++]=e},Ma=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Ul=(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=vo(r.adler,e,i,t):r.state.wrap===2&&(r.adler=We(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)},xm=(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-vr?r.strstart-(r.w_size-vr):0,u=r.window,l=r.w_mask,d=r.prev,f=r.strstart+en,p=u[n+o-1],m=u[n+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(i=e,!(u[i+o]!==m||u[i+o-1]!==p||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&n<f);if(a=en-(f-n),n=f-en,a>o){if(r.match_start=e,o=a,a>=s)break;p=u[n+o-1],m=u[n+o]}}while((e=d[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Yi=r=>{let e=r.w_size,t,n,i;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-vr)&&(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),k0(r),n+=e),r.strm.avail_in===0)break;if(t=Ul(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=t,r.lookahead+r.insert>=oe)for(i=r.strstart-r.insert,r.ins_h=r.window[i],r.ins_h=cn(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=cn(r,r.ins_h,r.window[i+oe-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<oe)););}while(r.lookahead<vr&&r.strm.avail_in!==0)},Am=(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!==Bt||e===sn||n!==i+r.strm.avail_in)))break;o=e===Bt&&n===i+r.strm.avail_in?1:0,Rl(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,It(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&&(Ul(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?sa:e!==sn&&e!==Bt&&r.strm.avail_in===0&&r.strstart===r.block_start?oa:(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&&(Ul(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===Bt)&&e!==sn&&r.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Bt&&r.strm.avail_in===0&&n===i?1:0,Rl(r,r.block_start,n,o),r.block_start+=n,It(r.strm)),o?Yn:ft)},ll=(r,e)=>{let t,n;for(;;){if(r.lookahead<vr){if(Yi(r),r.lookahead<vr&&e===sn)return ft;if(r.lookahead===0)break}if(t=0,r.lookahead>=oe&&(r.ins_h=cn(r,r.ins_h,r.window[r.strstart+oe-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-vr&&(r.match_length=xm(r,t)),r.match_length>=oe)if(n=on(r,r.strstart-r.match_start,r.match_length-oe),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=oe){r.match_length--;do r.strstart++,r.ins_h=cn(r,r.ins_h,r.window[r.strstart+oe-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=cn(r,r.ins_h,r.window[r.strstart+1]);else n=on(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&(Ot(r,!1),r.strm.avail_out===0))return ft}return r.insert=r.strstart<oe-1?r.strstart:oe-1,e===Bt?(Ot(r,!0),r.strm.avail_out===0?Yn:sa):r.sym_next&&(Ot(r,!1),r.strm.avail_out===0)?ft:oa},ji=(r,e)=>{let t,n,i;for(;;){if(r.lookahead<vr){if(Yi(r),r.lookahead<vr&&e===sn)return ft;if(r.lookahead===0)break}if(t=0,r.lookahead>=oe&&(r.ins_h=cn(r,r.ins_h,r.window[r.strstart+oe-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=oe-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-vr&&(r.match_length=xm(r,t),r.match_length<=5&&(r.strategy===l0||r.match_length===oe&&r.strstart-r.match_start>4096)&&(r.match_length=oe-1)),r.prev_length>=oe&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-oe,n=on(r,r.strstart-1-r.prev_match,r.prev_length-oe),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=cn(r,r.ins_h,r.window[r.strstart+oe-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=oe-1,r.strstart++,n&&(Ot(r,!1),r.strm.avail_out===0))return ft}else if(r.match_available){if(n=on(r,0,r.window[r.strstart-1]),n&&Ot(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return ft}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=on(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<oe-1?r.strstart:oe-1,e===Bt?(Ot(r,!0),r.strm.avail_out===0?Yn:sa):r.sym_next&&(Ot(r,!1),r.strm.avail_out===0)?ft:oa},T0=(r,e)=>{let t,n,i,a,o=r.window;for(;;){if(r.lookahead<=en){if(Yi(r),r.lookahead<=en&&e===sn)return ft;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=oe&&r.strstart>0&&(i=r.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=r.strstart+en;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=en-(a-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=oe?(t=on(r,1,r.match_length-oe),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=on(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(Ot(r,!1),r.strm.avail_out===0))return ft}return r.insert=0,e===Bt?(Ot(r,!0),r.strm.avail_out===0?Yn:sa):r.sym_next&&(Ot(r,!1),r.strm.avail_out===0)?ft:oa},O0=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Yi(r),r.lookahead===0)){if(e===sn)return ft;break}if(r.match_length=0,t=on(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(Ot(r,!1),r.strm.avail_out===0))return ft}return r.insert=0,e===Bt?(Ot(r,!0),r.strm.avail_out===0?Yn:sa):r.sym_next&&(Ot(r,!1),r.strm.avail_out===0)?ft:oa};function cr(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 eo=[new cr(0,0,0,0,Am),new cr(4,4,8,4,ll),new cr(4,5,16,8,ll),new cr(4,6,32,32,ll),new cr(4,4,16,16,ji),new cr(8,16,32,32,ji),new cr(8,16,128,128,ji),new cr(8,32,128,256,ji),new cr(32,128,258,1024,ji),new cr(32,258,258,4096,ji)],C0=r=>{r.window_size=2*r.w_size,Xr(r.head),r.max_lazy_match=eo[r.level].max_lazy,r.good_match=eo[r.level].good_length,r.nice_match=eo[r.level].nice_length,r.max_chain_length=eo[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=oe-1,r.match_available=0,r.ins_h=0};function N0(){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=Oc,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(_0*2),this.dyn_dtree=new Uint16Array((2*w0+1)*2),this.bl_tree=new Uint16Array((2*S0+1)*2),Xr(this.dyn_ltree),Xr(this.dyn_dtree),Xr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(E0+1),this.heap=new Uint16Array(2*Ll+1),Xr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Ll+1),Xr(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 Io=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Zi&&e.status!==Xl&&e.status!==Pl&&e.status!==Fl&&e.status!==Ml&&e.status!==jl&&e.status!==Vn&&e.status!==Xa?1:0},km=r=>{if(Io(r))return Qn(r,yr);r.total_in=r.total_out=0,r.data_type=h0;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Xl:e.wrap?Zi:Vn,r.adler=e.wrap===2?0:1,e.last_flush=-2,n0(e),et},Im=r=>{let e=km(r);return e===et&&C0(r.state),e},$0=(r,e)=>Io(r)||r.state.wrap!==2?yr:(r.state.gzhead=e,et),Tm=(r,e,t,n,i,a)=>{if(!r)return yr;let o=1;if(e===u0&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>m0||t!==Oc||n<8||n>15||e<0||e>9||a<0||a>d0||n===8&&o!==1)return Qn(r,yr);n===8&&(n=9);let s=new N0;return r.state=s,s.strm=r,s.status=Zi,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+oe-1)/oe),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,Im(r)},D0=(r,e)=>Tm(r,e,Oc,g0,y0,f0),R0=(r,e)=>{if(Io(r)||e>Hf||e<0)return r?Qn(r,yr):yr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Xa&&e!==Bt)return Qn(r,r.avail_out===0?ul:yr);let n=t.last_flush;if(t.last_flush=e,t.pending!==0){if(It(r),r.avail_out===0)return t.last_flush=-1,et}else if(r.avail_in===0&&Kf(e)<=Kf(n)&&e!==Bt)return Qn(r,ul);if(t.status===Xa&&r.avail_in!==0)return Qn(r,ul);if(t.status===Zi&&t.wrap===0&&(t.status=Vn),t.status===Zi){let i=Oc+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=$s||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=x0),i+=31-i%31,Ma(t,i),t.strstart!==0&&(Ma(t,r.adler>>>16),Ma(t,r.adler&65535)),r.adler=1,t.status=Vn,It(r),t.pending!==0)return t.last_flush=-1,et}if(t.status===Xl){if(r.adler=0,me(t,31),me(t,139),me(t,8),t.gzhead)me(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),me(t,t.gzhead.time&255),me(t,t.gzhead.time>>8&255),me(t,t.gzhead.time>>16&255),me(t,t.gzhead.time>>24&255),me(t,t.level===9?2:t.strategy>=$s||t.level<2?4:0),me(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(me(t,t.gzhead.extra.length&255),me(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=We(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Pl;else if(me(t,0),me(t,0),me(t,0),me(t,0),me(t,0),me(t,t.level===9?2:t.strategy>=$s||t.level<2?4:0),me(t,A0),t.status=Vn,It(r),t.pending!==0)return t.last_flush=-1,et}if(t.status===Pl){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=We(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=s,It(r),t.pending!==0)return t.last_flush=-1,et;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=We(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Fl}if(t.status===Fl){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=We(r.adler,t.pending_buf,t.pending-i,i)),It(r),t.pending!==0)return t.last_flush=-1,et;i=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,me(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=We(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Ml}if(t.status===Ml){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=We(r.adler,t.pending_buf,t.pending-i,i)),It(r),t.pending!==0)return t.last_flush=-1,et;i=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,me(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=We(r.adler,t.pending_buf,t.pending-i,i))}t.status=jl}if(t.status===jl){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(It(r),t.pending!==0))return t.last_flush=-1,et;me(t,r.adler&255),me(t,r.adler>>8&255),r.adler=0}if(t.status=Vn,It(r),t.pending!==0)return t.last_flush=-1,et}if(r.avail_in!==0||t.lookahead!==0||e!==sn&&t.status!==Xa){let i=t.level===0?Am(t,e):t.strategy===$s?O0(t,e):t.strategy===p0?T0(t,e):eo[t.level].func(t,e);if((i===Yn||i===sa)&&(t.status=Xa),i===ft||i===Yn)return r.avail_out===0&&(t.last_flush=-1),et;if(i===oa&&(e===o0?a0(t):e!==Hf&&(Rl(t,0,0,!1),e===s0&&(Xr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),It(r),r.avail_out===0))return t.last_flush=-1,et}return e!==Bt?et:t.wrap<=0?Gf:(t.wrap===2?(me(t,r.adler&255),me(t,r.adler>>8&255),me(t,r.adler>>16&255),me(t,r.adler>>24&255),me(t,r.total_in&255),me(t,r.total_in>>8&255),me(t,r.total_in>>16&255),me(t,r.total_in>>24&255)):(Ma(t,r.adler>>>16),Ma(t,r.adler&65535)),It(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?et:Gf)},L0=r=>{if(Io(r))return yr;let e=r.state.status;return r.state=null,e===Vn?Qn(r,c0):et},P0=(r,e)=>{let t=e.length;if(Io(r))return yr;let n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==Zi||n.lookahead)return yr;if(i===1&&(r.adler=vo(r.adler,e,t,0)),n.wrap=0,t>=n.w_size){i===0&&(Xr(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,Yi(n);n.lookahead>=oe;){let c=n.strstart,u=n.lookahead-(oe-1);do n.ins_h=cn(n,n.ins_h,n.window[c+oe-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=oe-1,Yi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=oe-1,n.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,n.wrap=i,et},F0=D0,M0=Tm,j0=Im,U0=km,q0=$0,B0=R0,V0=L0,Q0=P0,z0="pako deflate (from Nodeca project)",so={deflateInit:F0,deflateInit2:M0,deflateReset:j0,deflateResetKeep:U0,deflateSetHeader:q0,deflate:B0,deflateEnd:V0,deflateSetDictionary:Q0,deflateInfo:z0},W0=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),H0=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)W0(t,n)&&(r[n]=t[n])}}return r},G0=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},Cc={assign:H0,flattenChunks:G0},Om=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){Om=!1}var bo=new Uint8Array(256);for(let r=0;r<256;r++)bo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;bo[254]=bo[254]=1;var K0=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},J0=(r,e)=>{if(e<65534&&r.subarray&&Om)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},Z0=(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=bo[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 J0(a,i)},Y0=(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+bo[r[t]]>e?t:e},wo={string2buf:K0,buf2string:Z0,utf8border:Y0};function X0(){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 Cm=X0,Nm=Object.prototype.toString,{Z_NO_FLUSH:ew,Z_SYNC_FLUSH:tw,Z_FULL_FLUSH:rw,Z_FINISH:nw,Z_OK:mc,Z_STREAM_END:iw,Z_DEFAULT_COMPRESSION:aw,Z_DEFAULT_STRATEGY:ow,Z_DEFLATED:sw}=oi;function To(r){this.options=Cc.assign({level:aw,method:sw,chunkSize:16384,windowBits:15,memLevel:8,strategy:ow},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 Cm,this.strm.avail_out=0;let t=so.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==mc)throw new Error(Zn[t]);if(e.header&&so.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=wo.string2buf(e.dictionary):Nm.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=so.deflateSetDictionary(this.strm,n),t!==mc)throw new Error(Zn[t]);this._dict_set=!0}}To.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?nw:ew,typeof r=="string"?t.input=wo.string2buf(r):Nm.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===tw||a===rw)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=so.deflate(t,a),i===iw)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=so.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===mc;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};To.prototype.onData=function(r){this.chunks.push(r)};To.prototype.onEnd=function(r){r===mc&&(this.result=Cc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ep(r,e){let t=new To(e);if(t.push(r,!0),t.err)throw t.msg||Zn[t.err];return t.result}function cw(r,e){return e=e||{},e.raw=!0,ep(r,e)}function uw(r,e){return e=e||{},e.gzip=!0,ep(r,e)}var lw=To,pw=ep,dw=cw,fw=uw,hw=oi,mw={Deflate:lw,deflate:pw,deflateRaw:dw,gzip:fw,constants:hw},Ds=16209,gw=16191,yw=function r(e,t){let n,i,a,o,s,c,u,l,d,f,p,m,h,g,b,v,w,y,k,C,I,D,P,R,j=e.state;n=e.next_in,P=e.input,i=n+(e.avail_in-5),a=e.next_out,R=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=j.dmax,u=j.wsize,l=j.whave,d=j.wnext,f=j.window,p=j.hold,m=j.bits,h=j.lencode,g=j.distcode,b=(1<<j.lenbits)-1,v=(1<<j.distbits)-1;e:do{m<15&&(p+=P[n++]<<m,m+=8,p+=P[n++]<<m,m+=8),w=h[p&b];t:for(;;){if(y=w>>>24,p>>>=y,m-=y,y=w>>>16&255,y===0)R[a++]=w&65535;else if(y&16){k=w&65535,y&=15,y&&(m<y&&(p+=P[n++]<<m,m+=8),k+=p&(1<<y)-1,p>>>=y,m-=y),m<15&&(p+=P[n++]<<m,m+=8,p+=P[n++]<<m,m+=8),w=g[p&v];r:for(;;){if(y=w>>>24,p>>>=y,m-=y,y=w>>>16&255,y&16){if(C=w&65535,y&=15,m<y&&(p+=P[n++]<<m,m+=8,m<y&&(p+=P[n++]<<m,m+=8)),C+=p&(1<<y)-1,C>c){e.msg="invalid distance too far back",j.mode=Ds;break e}if(p>>>=y,m-=y,y=a-o,C>y){if(y=C-y,y>l&&j.sane){e.msg="invalid distance too far back",j.mode=Ds;break e}if(I=0,D=f,d===0){if(I+=u-y,y<k){k-=y;do R[a++]=f[I++];while(--y);I=a-C,D=R}}else if(d<y){if(I+=u+d-y,y-=d,y<k){k-=y;do R[a++]=f[I++];while(--y);if(I=0,d<k){y=d,k-=y;do R[a++]=f[I++];while(--y);I=a-C,D=R}}}else if(I+=d-y,y<k){k-=y;do R[a++]=f[I++];while(--y);I=a-C,D=R}for(;k>2;)R[a++]=D[I++],R[a++]=D[I++],R[a++]=D[I++],k-=3;k&&(R[a++]=D[I++],k>1&&(R[a++]=D[I++]))}else{I=a-C;do R[a++]=R[I++],R[a++]=R[I++],R[a++]=R[I++],k-=3;while(k>2);k&&(R[a++]=R[I++],k>1&&(R[a++]=R[I++]))}}else if((y&64)===0){w=g[(w&65535)+(p&(1<<y)-1)];continue r}else{e.msg="invalid distance code",j.mode=Ds;break e}break}}else if((y&64)===0){w=h[(w&65535)+(p&(1<<y)-1)];continue t}else if(y&32){j.mode=gw;break e}else{e.msg="invalid literal/length code",j.mode=Ds;break e}break}}while(n<i&&a<s);k=m>>3,n-=k,m-=k<<3,p&=(1<<m)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?5+(i-n):5-(n-i),e.avail_out=a<s?257+(s-a):257-(a-s),j.hold=p,j.bits=m},Ui=15,Jf=852,Zf=592,Yf=0,pl=1,Xf=2,vw=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]),bw=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]),ww=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]),Sw=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]),_w=(r,e,t,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,d=0,f=0,p=0,m=0,h=0,g=0,b=0,v=0,w,y,k,C,I,D=null,P,R=new Uint16Array(Ui+1),j=new Uint16Array(Ui+1),xe=null,Oe,A,be;for(u=0;u<=Ui;u++)R[u]=0;for(l=0;l<n;l++)R[e[t+l]]++;for(p=c,f=Ui;f>=1&&R[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&R[d]===0;d++);for(p<d&&(p=d),g=1,u=1;u<=Ui;u++)if(g<<=1,g-=R[u],g<0)return-1;if(g>0&&(r===Yf||f!==1))return-1;for(j[1]=0,u=1;u<Ui;u++)j[u+1]=j[u]+R[u];for(l=0;l<n;l++)e[t+l]!==0&&(o[j[e[t+l]]++]=l);if(r===Yf?(D=xe=o,P=20):r===pl?(D=vw,xe=bw,P=257):(D=ww,xe=Sw,P=0),v=0,l=0,u=d,I=a,m=p,h=0,k=-1,b=1<<p,C=b-1,r===pl&&b>Jf||r===Xf&&b>Zf)return 1;for(;;){Oe=u-h,o[l]+1<P?(A=0,be=o[l]):o[l]>=P?(A=xe[o[l]-P],be=D[o[l]-P]):(A=32+64,be=0),w=1<<u-h,y=1<<m,d=y;do y-=w,i[I+(v>>h)+y]=Oe<<24|A<<16|be|0;while(y!==0);for(w=1<<u-1;v&w;)w>>=1;if(w!==0?(v&=w-1,v+=w):v=0,l++,--R[u]===0){if(u===f)break;u=e[t+o[l]]}if(u>p&&(v&C)!==k){for(h===0&&(h=p),I+=d,m=u-h,g=1<<m;m+h<f&&(g-=R[m+h],!(g<=0));)m++,g<<=1;if(b+=1<<m,r===pl&&b>Jf||r===Xf&&b>Zf)return 1;k=v&C,i[k]=p<<24|m<<16|I-a|0}}return v!==0&&(i[I+v]=u-h<<24|64<<16|0),s.bits=p,0},co=_w,Ew=0,$m=1,Dm=2,{Z_FINISH:eh,Z_BLOCK:xw,Z_TREES:Rs,Z_OK:Xn,Z_STREAM_END:Aw,Z_NEED_DICT:kw,Z_STREAM_ERROR:Vt,Z_DATA_ERROR:Rm,Z_MEM_ERROR:Lm,Z_BUF_ERROR:Iw,Z_DEFLATED:th}=oi,Nc=16180,rh=16181,nh=16182,ih=16183,ah=16184,oh=16185,sh=16186,ch=16187,uh=16188,lh=16189,gc=16190,Tr=16191,dl=16192,ph=16193,fl=16194,dh=16195,fh=16196,hh=16197,mh=16198,Ls=16199,Ps=16200,gh=16201,yh=16202,vh=16203,bh=16204,wh=16205,hl=16206,Sh=16207,_h=16208,ke=16209,Pm=16210,Fm=16211,Tw=852,Ow=592,Cw=15,Nw=Cw,Eh=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function $w(){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 si=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Nc||e.mode>Fm?1:0},Mm=r=>{if(si(r))return Vt;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=Nc,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(Tw),e.distcode=e.distdyn=new Int32Array(Ow),e.sane=1,e.back=-1,Xn},jm=r=>{if(si(r))return Vt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Mm(r)},Um=(r,e)=>{let t;if(si(r))return Vt;let n=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?Vt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,jm(r))},qm=(r,e)=>{if(!r)return Vt;let t=new $w;r.state=t,t.strm=r,t.window=null,t.mode=Nc;let n=Um(r,e);return n!==Xn&&(r.state=null),n},Dw=r=>qm(r,Nw),xh=!0,ml,gl,Rw=r=>{if(xh){ml=new Int32Array(512),gl=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(co($m,r.lens,0,288,ml,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;co(Dm,r.lens,0,32,gl,0,r.work,{bits:5}),xh=!1}r.lencode=ml,r.lenbits=9,r.distcode=gl,r.distbits=5},Bm=(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},Lw=(r,e)=>{let t,n,i,a,o,s,c,u,l,d,f,p,m,h,g=0,b,v,w,y,k,C,I,D,P=new Uint8Array(4),R,j,xe=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(si(r)||!r.output||!r.input&&r.avail_in!==0)return Vt;t=r.state,t.mode===Tr&&(t.mode=dl),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,d=s,f=c,D=Xn;e:for(;;)switch(t.mode){case Nc:if(t.wrap===0){t.mode=dl;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,P[0]=u&255,P[1]=u>>>8&255,t.check=We(t.check,P,2,0),u=0,l=0,t.mode=rh;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)!==th){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?lh:Tr,u=0,l=0;break;case rh:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==th){r.msg="unknown compression method",t.mode=ke;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=ke;break}t.head&&(t.head.text=u>>8&1),t.flags&512&&t.wrap&4&&(P[0]=u&255,P[1]=u>>>8&255,t.check=We(t.check,P,2,0)),u=0,l=0,t.mode=nh;case nh: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&&(P[0]=u&255,P[1]=u>>>8&255,P[2]=u>>>16&255,P[3]=u>>>24&255,t.check=We(t.check,P,4,0)),u=0,l=0,t.mode=ih;case ih: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&&(P[0]=u&255,P[1]=u>>>8&255,t.check=We(t.check,P,2,0)),u=0,l=0,t.mode=ah;case ah: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&&(P[0]=u&255,P[1]=u>>>8&255,t.check=We(t.check,P,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=oh;case oh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(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+p),I)),t.flags&512&&t.wrap&4&&(t.check=We(t.check,n,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=sh;case sh:if(t.flags&2048){if(s===0)break e;p=0;do I=n[a+p++],t.head&&I&&t.length<65536&&(t.head.name+=String.fromCharCode(I));while(I&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=We(t.check,n,p,a)),s-=p,a+=p,I)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=ch;case ch:if(t.flags&4096){if(s===0)break e;p=0;do I=n[a+p++],t.head&&I&&t.length<65536&&(t.head.comment+=String.fromCharCode(I));while(I&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=We(t.check,n,p,a)),s-=p,a+=p,I)break e}else t.head&&(t.head.comment=null);t.mode=uh;case uh: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=Tr;break;case lh:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.adler=t.check=Eh(u),u=0,l=0,t.mode=gc;case gc: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,kw;r.adler=t.check=1,t.mode=Tr;case Tr:if(e===xw||e===Rs)break e;case dl:if(t.last){u>>>=l&7,l-=l&7,t.mode=hl;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=ph;break;case 1:if(Rw(t),t.mode=Ls,e===Rs){u>>>=2,l-=2;break e}break;case 2:t.mode=fh;break;case 3:r.msg="invalid block type",t.mode=ke}u>>>=2,l-=2;break;case ph: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=fl,e===Rs)break e;case fl:t.mode=dh;case dh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;i.set(n.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=Tr;break;case fh: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=hh;case hh: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,R={bits:t.lenbits},D=co(Ew,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,D){r.msg="invalid code lengths set",t.mode=ke;break}t.have=0,t.mode=mh;case mh:for(;t.have<t.nlen+t.ndist;){for(;g=t.lencode[u&(1<<t.lenbits)-1],b=g>>>24,v=g>>>16&255,w=g&65535,!(b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(w<16)u>>>=b,l-=b,t.lens[t.have++]=w;else{if(w===16){for(j=b+2;l<j;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(u>>>=b,l-=b,t.have===0){r.msg="invalid bit length repeat",t.mode=ke;break}I=t.lens[t.have-1],p=3+(u&3),u>>>=2,l-=2}else if(w===17){for(j=b+3;l<j;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=b,l-=b,I=0,p=3+(u&7),u>>>=3,l-=3}else{for(j=b+7;l<j;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=b,l-=b,I=0,p=11+(u&127),u>>>=7,l-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=ke;break}for(;p--;)t.lens[t.have++]=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,R={bits:t.lenbits},D=co($m,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,D){r.msg="invalid literal/lengths set",t.mode=ke;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},D=co(Dm,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,D){r.msg="invalid distances set",t.mode=ke;break}if(t.mode=Ls,e===Rs)break e;case Ls:t.mode=Ps;case Ps: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,yw(r,f),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===Tr&&(t.back=-1);break}for(t.back=0;g=t.lencode[u&(1<<t.lenbits)-1],b=g>>>24,v=g>>>16&255,w=g&65535,!(b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(v&&(v&240)===0){for(y=b,k=v,C=w;g=t.lencode[C+((u&(1<<y+k)-1)>>y)],b=g>>>24,v=g>>>16&255,w=g&65535,!(y+b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=b,l-=b,t.back+=b,t.length=w,v===0){t.mode=wh;break}if(v&32){t.back=-1,t.mode=Tr;break}if(v&64){r.msg="invalid literal/length code",t.mode=ke;break}t.extra=v&15,t.mode=gh;case gh: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=yh;case yh:for(;g=t.distcode[u&(1<<t.distbits)-1],b=g>>>24,v=g>>>16&255,w=g&65535,!(b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((v&240)===0){for(y=b,k=v,C=w;g=t.distcode[C+((u&(1<<y+k)-1)>>y)],b=g>>>24,v=g>>>16&255,w=g&65535,!(y+b<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=b,l-=b,t.back+=b,v&64){r.msg="invalid distance code",t.mode=ke;break}t.offset=w,t.extra=v&15,t.mode=vh;case vh: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=bh;case bh:if(c===0)break e;if(p=f-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=ke;break}p>t.wnext?(p-=t.wnext,m=t.wsize-p):m=t.wnext-p,p>t.length&&(p=t.length),h=t.window}else h=i,m=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do i[o++]=h[m++];while(--p);t.length===0&&(t.mode=Ps);break;case wh:if(c===0)break e;i[o++]=t.length,c--,t.mode=Ps;break;case hl:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?We(t.check,i,f,o-f):vo(t.check,i,f,o-f)),f=c,t.wrap&4&&(t.flags?u:Eh(u))!==t.check){r.msg="incorrect data check",t.mode=ke;break}u=0,l=0}t.mode=Sh;case Sh: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=_h;case _h:D=Aw;break e;case ke:D=Rm;break e;case Pm:return Lm;case Fm:default:return Vt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,(t.wsize||f!==r.avail_out&&t.mode<ke&&(t.mode<hl||e!==eh))&&Bm(r,r.output,r.next_out,f-r.avail_out),d-=r.avail_in,f-=r.avail_out,r.total_in+=d,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?We(t.check,i,f,r.next_out-f):vo(t.check,i,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Tr?128:0)+(t.mode===Ls||t.mode===fl?256:0),(d===0&&f===0||e===eh)&&D===Xn&&(D=Iw),D},Pw=r=>{if(si(r))return Vt;let e=r.state;return e.window&&(e.window=null),r.state=null,Xn},Fw=(r,e)=>{if(si(r))return Vt;let t=r.state;return(t.wrap&2)===0?Vt:(t.head=e,e.done=!1,Xn)},Mw=(r,e)=>{let t=e.length,n,i,a;return si(r)||(n=r.state,n.wrap!==0&&n.mode!==gc)?Vt:n.mode===gc&&(i=1,i=vo(i,e,t,0),i!==n.check)?Rm:(a=Bm(r,e,t,t),a?(n.mode=Pm,Lm):(n.havedict=1,Xn))},jw=jm,Uw=Um,qw=Mm,Bw=Dw,Vw=qm,Qw=Lw,zw=Pw,Ww=Fw,Hw=Mw,Gw="pako inflate (from Nodeca project)",Dr={inflateReset:jw,inflateReset2:Uw,inflateResetKeep:qw,inflateInit:Bw,inflateInit2:Vw,inflate:Qw,inflateEnd:zw,inflateGetHeader:Ww,inflateSetDictionary:Hw,inflateInfo:Gw};function Kw(){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 Jw=Kw,Vm=Object.prototype.toString,{Z_NO_FLUSH:Zw,Z_FINISH:Yw,Z_OK:So,Z_STREAM_END:yl,Z_NEED_DICT:vl,Z_STREAM_ERROR:Xw,Z_DATA_ERROR:Ah,Z_MEM_ERROR:eS}=oi;function Oo(r){this.options=Cc.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 Cm,this.strm.avail_out=0;let t=Dr.inflateInit2(this.strm,e.windowBits);if(t!==So)throw new Error(Zn[t]);if(this.header=new Jw,Dr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=wo.string2buf(e.dictionary):Vm.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Dr.inflateSetDictionary(this.strm,e.dictionary),t!==So)))throw new Error(Zn[t])}Oo.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?Yw:Zw,Vm.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=Dr.inflate(t,o),a===vl&&i&&(a=Dr.inflateSetDictionary(t,i),a===So?a=Dr.inflate(t,o):a===Ah&&(a=vl));t.avail_in>0&&a===yl&&t.state.wrap>0&&r[t.next_in]!==0;)Dr.inflateReset(t),a=Dr.inflate(t,o);switch(a){case Xw:case Ah:case vl:case eS:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===yl))if(this.options.to==="string"){let c=wo.utf8border(t.output,t.next_out),u=t.next_out-c,l=wo.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===So&&s===0)){if(a===yl)return a=Dr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Oo.prototype.onData=function(r){this.chunks.push(r)};Oo.prototype.onEnd=function(r){r===So&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Cc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function tp(r,e){let t=new Oo(e);if(t.push(r),t.err)throw t.msg||Zn[t.err];return t.result}function tS(r,e){return e=e||{},e.raw=!0,tp(r,e)}var rS=Oo,nS=tp,iS=tS,aS=tp,oS=oi,sS={Inflate:rS,inflate:nS,inflateRaw:iS,ungzip:aS,constants:oS},{Deflate:cS,deflate:uS,deflateRaw:lS,gzip:pS}=mw,{Inflate:dS,inflate:fS,inflateRaw:hS,ungzip:mS}=sS,gS=cS,yS=uS,vS=lS,bS=pS,wS=dS,SS=fS,_S=hS,ES=mS,xS=oi,AS={Deflate:gS,deflate:yS,deflateRaw:vS,gzip:bS,Inflate:wS,inflate:SS,inflateRaw:_S,ungzip:ES,constants:xS},_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},Ee=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},yc=class{constructor(e,t){this.input=e,this.output=t}};_e([S(),Ee("design:type",String)],yc.prototype,"input",void 0);_e([S(),Ee("design:type",String)],yc.prototype,"output",void 0);yc=_e([Ge(),Ee("design:paramtypes",[String,String])],yc);var vc=class{constructor(e,t){this.input=e,this.output=t}};_e([S(),Ee("design:type",String)],vc.prototype,"input",void 0);_e([S(),Ee("design:type",String)],vc.prototype,"output",void 0);vc=_e([H(),Ee("design:paramtypes",[String,String])],vc);var dn=class{constructor(e,t,n,i,a){this.name=e,this.modelId=t,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};_e([S(),Ee("design:type",String)],dn.prototype,"name",void 0);_e([S(),Ee("design:type",String)],dn.prototype,"modelId",void 0);_e([S(),Ee("design:type",String)],dn.prototype,"systemPrompt",void 0);_e([S(),Ee("design:type",Array)],dn.prototype,"promptExamples",void 0);_e([S(),Ee("design:type",String)],dn.prototype,"metaData",void 0);dn=_e([Ge(),Ee("design:paramtypes",[String,String,String,Array,String])],dn);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}};_e([S(),Ee("design:type",String)],Sr.prototype,"name",void 0);_e([S(),Ee("design:type",String)],Sr.prototype,"modelId",void 0);_e([S(),Ee("design:type",String)],Sr.prototype,"taskId",void 0);_e([S(),Ee("design:type",String)],Sr.prototype,"systemPrompt",void 0);_e([S(),Ee("design:type",Array)],Sr.prototype,"promptExamples",void 0);_e([S(),Ee("design:type",String)],Sr.prototype,"metaData",void 0);_e([S(),Ee("design:type",String)],Sr.prototype,"createdAt",void 0);_e([S(),Ee("design:type",String)],Sr.prototype,"updatedAt",void 0);Sr=_e([H(),Ee("design:paramtypes",[String,String,String,String,Array,String,String,String])],Sr);var ei=class{constructor(e,t,n,i,a){this.model=e,this.status=t,this.progress=n,this.downloaded=i,this.loaded=a}};_e([S(),Ee("design:type",String)],ei.prototype,"model",void 0);_e([S(),Ee("design:type",String)],ei.prototype,"status",void 0);_e([S(),Ee("design:type",Number)],ei.prototype,"progress",void 0);_e([S(),Ee("design:type",Boolean)],ei.prototype,"downloaded",void 0);_e([S(),Ee("design:type",Boolean)],ei.prototype,"loaded",void 0);ei=_e([H(),Ee("design:paramtypes",[String,String,Number,Boolean,Boolean])],ei);var kS=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)},Be,Js,ql=class{constructor(e,t=!0){Be.set(this,void 0),Js.set(this,new Map),kS(this,Be,e,"f")}async getModels(){let e=await Qe(this,Be,"f").query({query:x`
805
+ }`,variables:{url:e,interactionCall:t}}));return n}};Nr=new WeakMap;var $c={};$c.byteLength=Db;$c.toByteArray=Pb;$c.fromByteArray=Mb;var fr=[],Bt=[],$b=typeof Uint8Array<"u"?Uint8Array:Array,cl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Cn=0,Bf=cl.length;Cn<Bf;++Cn)fr[Cn]=cl[Cn],Bt[cl.charCodeAt(Cn)]=Cn;var Cn,Bf;Bt["-".charCodeAt(0)]=62;Bt["_".charCodeAt(0)]=63;function hm(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 Db(r){var e=hm(r),t=e[0],n=e[1];return(t+n)*3/4-n}function Rb(r,e,t){return(e+t)*3/4-t}function Pb(r){var e,t=hm(r),n=t[0],i=t[1],a=new $b(Rb(r,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=Bt[r.charCodeAt(c)]<<18|Bt[r.charCodeAt(c+1)]<<12|Bt[r.charCodeAt(c+2)]<<6|Bt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=Bt[r.charCodeAt(c)]<<2|Bt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=Bt[r.charCodeAt(c)]<<10|Bt[r.charCodeAt(c+1)]<<4|Bt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function Lb(r){return fr[r>>18&63]+fr[r>>12&63]+fr[r>>6&63]+fr[r&63]}function Fb(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(Lb(n));return i.join("")}function Mb(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(Fb(r,o,o+a>s?s:o+a));return n===1?(e=r[t-1],i.push(fr[e>>2]+fr[e<<4&63]+"==")):n===2&&(e=(r[t-2]<<8)+r[t-1],i.push(fr[e>>10]+fr[e>>4&63]+fr[e<<2&63]+"=")),i.join("")}var Ub=4,Vf=0,Qf=1,jb=2;function sa(r){let e=r.length;for(;--e>=0;)r[e]=0}var qb=0,mm=1,Bb=2,Vb=3,Qb=258,Xl=29,Co=256,vo=Co+1+Xl,Hi=30,ep=19,gm=2*vo+1,qn=15,ul=16,zb=7,tp=256,ym=16,vm=17,bm=18,Ll=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]),ec=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]),Hb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),wm=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wb=512,$r=new Array((vo+2)*2);sa($r);var uo=new Array(Hi*2);sa(uo);var bo=new Array(Wb);sa(bo);var wo=new Array(Qb-Vb+1);sa(wo);var rp=new Array(Xl);sa(rp);var yc=new Array(Hi);sa(yc);function ll(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 Sm,_m,Em;function pl(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var xm=r=>r<256?bo[r]:bo[256+(r>>>7)],So=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},xt=(r,e,t)=>{r.bi_valid>ul-t?(r.bi_buf|=e<<r.bi_valid&65535,So(r,r.bi_buf),r.bi_buf=e>>ul-r.bi_valid,r.bi_valid+=t-ul):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},hr=(r,e,t)=>{xt(r,t[e*2],t[e*2+1])},km=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},Gb=r=>{r.bi_valid===16?(So(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)},Kb=(r,e)=>{let t=e.dyn_tree,n=e.max_code,i=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,d,f,p,h,m=0;for(f=0;f<=qn;f++)r.bl_count[f]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<gm;u++)l=r.heap[u],f=t[t[l*2+1]*2+1]+1,f>c&&(f=c,m++),t[l*2+1]=f,!(l>n)&&(r.bl_count[f]++,p=0,l>=s&&(p=o[l-s]),h=t[l*2],r.opt_len+=h*(f+p),a&&(r.static_len+=h*(i[l*2+1]+p)));if(m!==0){do{for(f=c-1;r.bl_count[f]===0;)f--;r.bl_count[f]--,r.bl_count[f+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(f=c;f!==0;f--)for(l=r.bl_count[f];l!==0;)d=r.heap[--u],!(d>n)&&(t[d*2+1]!==f&&(r.opt_len+=(f-t[d*2+1])*t[d*2],t[d*2+1]=f),l--)}},Am=(r,e,t)=>{let n=new Array(qn+1),i=0,a,o;for(a=1;a<=qn;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]=km(n[s]++,s))}},Jb=()=>{let r,e,t,n,i,a=new Array(qn+1);for(t=0,n=0;n<Xl-1;n++)for(rp[n]=t,r=0;r<1<<Ll[n];r++)wo[t++]=n;for(wo[t-1]=n,i=0,n=0;n<16;n++)for(yc[n]=i,r=0;r<1<<ec[n];r++)bo[i++]=n;for(i>>=7;n<Hi;n++)for(yc[n]=i<<7,r=0;r<1<<ec[n]-7;r++)bo[256+i++]=n;for(e=0;e<=qn;e++)a[e]=0;for(r=0;r<=143;)$r[r*2+1]=8,r++,a[8]++;for(;r<=255;)$r[r*2+1]=9,r++,a[9]++;for(;r<=279;)$r[r*2+1]=7,r++,a[7]++;for(;r<=287;)$r[r*2+1]=8,r++,a[8]++;for(Am($r,vo+1,a),r=0;r<Hi;r++)uo[r*2+1]=5,uo[r*2]=km(r,5);Sm=new ll($r,Ll,Co+1,vo,qn),_m=new ll(uo,ec,0,Hi,qn),Em=new ll(new Array(0),Hb,0,ep,zb)},Im=r=>{let e;for(e=0;e<vo;e++)r.dyn_ltree[e*2]=0;for(e=0;e<Hi;e++)r.dyn_dtree[e*2]=0;for(e=0;e<ep;e++)r.bl_tree[e*2]=0;r.dyn_ltree[tp*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},Tm=r=>{r.bi_valid>8?So(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},zf=(r,e,t,n)=>{let i=e*2,a=t*2;return r[i]<r[a]||r[i]===r[a]&&n[e]<=n[t]},dl=(r,e,t)=>{let n=r.heap[t],i=t<<1;for(;i<=r.heap_len&&(i<r.heap_len&&zf(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!zf(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n},Hf=(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?hr(r,i,e):(o=wo[i],hr(r,o+Co+1,e),s=Ll[o],s!==0&&(i-=rp[o],xt(r,i,s)),n--,o=xm(n),hr(r,o,t),s=ec[o],s!==0&&(n-=yc[o],xt(r,n,s)));while(a<r.sym_next);hr(r,tp,e)},Fl=(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=gm,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--)dl(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],dl(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++,dl(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],Kb(r,e),Am(t,c,r.bl_count)},Wf=(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[ym*2]++):s<=10?r.bl_tree[vm*2]++:r.bl_tree[bm*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},Gf=(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 hr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==i&&(hr(r,a,r.bl_tree),s--),hr(r,ym,r.bl_tree),xt(r,s-3,2)):s<=10?(hr(r,vm,r.bl_tree),xt(r,s-3,3)):(hr(r,bm,r.bl_tree),xt(r,s-11,7));s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Zb=r=>{let e;for(Wf(r,r.dyn_ltree,r.l_desc.max_code),Wf(r,r.dyn_dtree,r.d_desc.max_code),Fl(r,r.bl_desc),e=ep-1;e>=3&&r.bl_tree[wm[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},Yb=(r,e,t,n)=>{let i;for(xt(r,e-257,5),xt(r,t-1,5),xt(r,n-4,4),i=0;i<n;i++)xt(r,r.bl_tree[wm[i]*2+1],3);Gf(r,r.dyn_ltree,e-1),Gf(r,r.dyn_dtree,t-1)},Xb=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Vf;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Qf;for(t=32;t<Co;t++)if(r.dyn_ltree[t*2]!==0)return Qf;return Vf},Kf=!1,e0=r=>{Kf||(Jb(),Kf=!0),r.l_desc=new pl(r.dyn_ltree,Sm),r.d_desc=new pl(r.dyn_dtree,_m),r.bl_desc=new pl(r.bl_tree,Em),r.bi_buf=0,r.bi_valid=0,Im(r)},Om=(r,e,t,n)=>{xt(r,(qb<<1)+(n?1:0),3),Tm(r),So(r,t),So(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},t0=r=>{xt(r,mm<<1,3),hr(r,tp,$r),Gb(r)},r0=(r,e,t,n)=>{let i,a,o=0;r.level>0?(r.strm.data_type===jb&&(r.strm.data_type=Xb(r)),Fl(r,r.l_desc),Fl(r,r.d_desc),o=Zb(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?Om(r,e,t,n):r.strategy===Ub||a===i?(xt(r,(mm<<1)+(n?1:0),3),Hf(r,$r,uo)):(xt(r,(Bb<<1)+(n?1:0),3),Yb(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Hf(r,r.dyn_ltree,r.dyn_dtree)),Im(r),n&&Tm(r)},n0=(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[(wo[t]+Co+1)*2]++,r.dyn_dtree[xm(e)*2]++),r.sym_next===r.sym_end),i0=e0,a0=Om,o0=r0,s0=n0,c0=t0,u0={_tr_init:i0,_tr_stored_block:a0,_tr_flush_block:o0,_tr_tally:s0,_tr_align:c0},l0=(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},_o=l0,p0=()=>{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},d0=new Uint32Array(p0()),f0=(r,e,t,n)=>{let i=d0,a=n+t;r^=-1;for(let o=n;o<a;o++)r=r>>>8^i[(r^e[o])&255];return r^-1},We=f0,Zn={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"},si={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:h0,_tr_stored_block:Ml,_tr_flush_block:m0,_tr_tally:an,_tr_align:g0}=u0,{Z_NO_FLUSH:on,Z_PARTIAL_FLUSH:y0,Z_FULL_FLUSH:v0,Z_FINISH:Qt,Z_BLOCK:Jf,Z_OK:tt,Z_STREAM_END:Zf,Z_STREAM_ERROR:yr,Z_DATA_ERROR:b0,Z_BUF_ERROR:fl,Z_DEFAULT_COMPRESSION:w0,Z_FILTERED:S0,Z_HUFFMAN_ONLY:Ls,Z_RLE:_0,Z_FIXED:E0,Z_DEFAULT_STRATEGY:x0,Z_UNKNOWN:k0,Z_DEFLATED:Dc}=si,A0=9,I0=15,T0=8,O0=29,C0=256,Ul=C0+1+O0,N0=30,$0=19,D0=2*Ul+1,R0=15,se=3,en=258,vr=en+se+1,P0=32,Zi=42,np=57,jl=69,ql=73,Bl=91,Vl=103,Bn=113,to=666,ht=1,ca=2,Yn=3,ua=4,L0=3,Vn=(r,e)=>(r.msg=Zn[e],e),Yf=r=>r*2-(r>4?9:0),Xr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},F0=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)},M0=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,sn=M0,Ct=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)=>{m0(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,Ct(r.strm)},ge=(r,e)=>{r.pending_buf[r.pending++]=e},ja=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Ql=(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=_o(r.adler,e,i,t):r.state.wrap===2&&(r.adler=We(r.adler,e,i,t)),r.next_in+=i,r.total_in+=i,i)},Cm=(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-vr?r.strstart-(r.w_size-vr):0,u=r.window,l=r.w_mask,d=r.prev,f=r.strstart+en,p=u[n+o-1],h=u[n+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(i=e,!(u[i+o]!==h||u[i+o-1]!==p||u[i]!==u[n]||u[++i]!==u[n+1])){n+=2,i++;do;while(u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&u[++n]===u[++i]&&n<f);if(a=en-(f-n),n=f-en,a>o){if(r.match_start=e,o=a,a>=s)break;p=u[n+o-1],h=u[n+o]}}while((e=d[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Yi=r=>{let e=r.w_size,t,n,i;do{if(n=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-vr)&&(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),F0(r),n+=e),r.strm.avail_in===0)break;if(t=Ql(r.strm,r.window,r.strstart+r.lookahead,n),r.lookahead+=t,r.lookahead+r.insert>=se)for(i=r.strstart-r.insert,r.ins_h=r.window[i],r.ins_h=sn(r,r.ins_h,r.window[i+1]);r.insert&&(r.ins_h=sn(r,r.ins_h,r.window[i+se-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<se)););}while(r.lookahead<vr&&r.strm.avail_in!==0)},Nm=(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!==Qt||e===on||n!==i+r.strm.avail_in)))break;o=e===Qt&&n===i+r.strm.avail_in?1:0,Ml(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,Ct(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&&(Ql(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?ua:e!==on&&e!==Qt&&r.strm.avail_in===0&&r.strstart===r.block_start?ca:(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&&(Ql(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===Qt)&&e!==on&&r.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Qt&&r.strm.avail_in===0&&n===i?1:0,Ml(r,r.block_start,n,o),r.block_start+=n,Ct(r.strm)),o?Yn:ht)},hl=(r,e)=>{let t,n;for(;;){if(r.lookahead<vr){if(Yi(r),r.lookahead<vr&&e===on)return ht;if(r.lookahead===0)break}if(t=0,r.lookahead>=se&&(r.ins_h=sn(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-vr&&(r.match_length=Cm(r,t)),r.match_length>=se)if(n=an(r,r.strstart-r.match_start,r.match_length-se),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=se){r.match_length--;do r.strstart++,r.ins_h=sn(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=sn(r,r.ins_h,r.window[r.strstart+1]);else n=an(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(n&&($t(r,!1),r.strm.avail_out===0))return ht}return r.insert=r.strstart<se-1?r.strstart:se-1,e===Qt?($t(r,!0),r.strm.avail_out===0?Yn:ua):r.sym_next&&($t(r,!1),r.strm.avail_out===0)?ht:ca},ji=(r,e)=>{let t,n,i;for(;;){if(r.lookahead<vr){if(Yi(r),r.lookahead<vr&&e===on)return ht;if(r.lookahead===0)break}if(t=0,r.lookahead>=se&&(r.ins_h=sn(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=se-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-vr&&(r.match_length=Cm(r,t),r.match_length<=5&&(r.strategy===S0||r.match_length===se&&r.strstart-r.match_start>4096)&&(r.match_length=se-1)),r.prev_length>=se&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-se,n=an(r,r.strstart-1-r.prev_match,r.prev_length-se),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=sn(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=se-1,r.strstart++,n&&($t(r,!1),r.strm.avail_out===0))return ht}else if(r.match_available){if(n=an(r,0,r.window[r.strstart-1]),n&&$t(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return ht}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(n=an(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<se-1?r.strstart:se-1,e===Qt?($t(r,!0),r.strm.avail_out===0?Yn:ua):r.sym_next&&($t(r,!1),r.strm.avail_out===0)?ht:ca},U0=(r,e)=>{let t,n,i,a,o=r.window;for(;;){if(r.lookahead<=en){if(Yi(r),r.lookahead<=en&&e===on)return ht;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=se&&r.strstart>0&&(i=r.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=r.strstart+en;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=en-(a-i),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=se?(t=an(r,1,r.match_length-se),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=an(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&($t(r,!1),r.strm.avail_out===0))return ht}return r.insert=0,e===Qt?($t(r,!0),r.strm.avail_out===0?Yn:ua):r.sym_next&&($t(r,!1),r.strm.avail_out===0)?ht:ca},j0=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Yi(r),r.lookahead===0)){if(e===on)return ht;break}if(r.match_length=0,t=an(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&($t(r,!1),r.strm.avail_out===0))return ht}return r.insert=0,e===Qt?($t(r,!0),r.strm.avail_out===0?Yn:ua):r.sym_next&&($t(r,!1),r.strm.avail_out===0)?ht:ca};function cr(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 ro=[new cr(0,0,0,0,Nm),new cr(4,4,8,4,hl),new cr(4,5,16,8,hl),new cr(4,6,32,32,hl),new cr(4,4,16,16,ji),new cr(8,16,32,32,ji),new cr(8,16,128,128,ji),new cr(8,32,128,256,ji),new cr(32,128,258,1024,ji),new cr(32,258,258,4096,ji)],q0=r=>{r.window_size=2*r.w_size,Xr(r.head),r.max_lazy_match=ro[r.level].max_lazy,r.good_match=ro[r.level].good_length,r.nice_match=ro[r.level].nice_length,r.max_chain_length=ro[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=se-1,r.match_available=0,r.ins_h=0};function B0(){this.strm=null,this.status=0,this.pending_buf=null,this.pending_buf_size=0,this.pending_out=0,this.pending=0,this.wrap=0,this.gzhead=null,this.gzindex=0,this.method=Dc,this.last_flush=-1,this.w_size=0,this.w_bits=0,this.w_mask=0,this.window=null,this.window_size=0,this.prev=null,this.head=null,this.ins_h=0,this.hash_size=0,this.hash_bits=0,this.hash_mask=0,this.hash_shift=0,this.block_start=0,this.match_length=0,this.prev_match=0,this.match_available=0,this.strstart=0,this.match_start=0,this.lookahead=0,this.prev_length=0,this.max_chain_length=0,this.max_lazy_match=0,this.level=0,this.strategy=0,this.good_match=0,this.nice_match=0,this.dyn_ltree=new Uint16Array(D0*2),this.dyn_dtree=new Uint16Array((2*N0+1)*2),this.bl_tree=new Uint16Array((2*$0+1)*2),Xr(this.dyn_ltree),Xr(this.dyn_dtree),Xr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(R0+1),this.heap=new Uint16Array(2*Ul+1),Xr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Ul+1),Xr(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 No=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Zi&&e.status!==np&&e.status!==jl&&e.status!==ql&&e.status!==Bl&&e.status!==Vl&&e.status!==Bn&&e.status!==to?1:0},$m=r=>{if(No(r))return Vn(r,yr);r.total_in=r.total_out=0,r.data_type=k0;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?np:e.wrap?Zi:Bn,r.adler=e.wrap===2?0:1,e.last_flush=-2,h0(e),tt},Dm=r=>{let e=$m(r);return e===tt&&q0(r.state),e},V0=(r,e)=>No(r)||r.state.wrap!==2?yr:(r.state.gzhead=e,tt),Rm=(r,e,t,n,i,a)=>{if(!r)return yr;let o=1;if(e===w0&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>A0||t!==Dc||n<8||n>15||e<0||e>9||a<0||a>E0||n===8&&o!==1)return Vn(r,yr);n===8&&(n=9);let s=new B0;return r.state=s,s.strm=r,s.status=Zi,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+se-1)/se),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<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,Dm(r)},Q0=(r,e)=>Rm(r,e,Dc,I0,T0,x0),z0=(r,e)=>{if(No(r)||e>Jf||e<0)return r?Vn(r,yr):yr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===to&&e!==Qt)return Vn(r,r.avail_out===0?fl:yr);let n=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Ct(r),r.avail_out===0)return t.last_flush=-1,tt}else if(r.avail_in===0&&Yf(e)<=Yf(n)&&e!==Qt)return Vn(r,fl);if(t.status===to&&r.avail_in!==0)return Vn(r,fl);if(t.status===Zi&&t.wrap===0&&(t.status=Bn),t.status===Zi){let i=Dc+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Ls||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=P0),i+=31-i%31,ja(t,i),t.strstart!==0&&(ja(t,r.adler>>>16),ja(t,r.adler&65535)),r.adler=1,t.status=Bn,Ct(r),t.pending!==0)return t.last_flush=-1,tt}if(t.status===np){if(r.adler=0,ge(t,31),ge(t,139),ge(t,8),t.gzhead)ge(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),ge(t,t.gzhead.time&255),ge(t,t.gzhead.time>>8&255),ge(t,t.gzhead.time>>16&255),ge(t,t.gzhead.time>>24&255),ge(t,t.level===9?2:t.strategy>=Ls||t.level<2?4:0),ge(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(ge(t,t.gzhead.extra.length&255),ge(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=We(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=jl;else if(ge(t,0),ge(t,0),ge(t,0),ge(t,0),ge(t,0),ge(t,t.level===9?2:t.strategy>=Ls||t.level<2?4:0),ge(t,L0),t.status=Bn,Ct(r),t.pending!==0)return t.last_flush=-1,tt}if(t.status===jl){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=We(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex+=s,Ct(r),t.pending!==0)return t.last_flush=-1,tt;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=We(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=ql}if(t.status===ql){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=We(r.adler,t.pending_buf,t.pending-i,i)),Ct(r),t.pending!==0)return t.last_flush=-1,tt;i=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,ge(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=We(r.adler,t.pending_buf,t.pending-i,i)),t.gzindex=0}t.status=Bl}if(t.status===Bl){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=We(r.adler,t.pending_buf,t.pending-i,i)),Ct(r),t.pending!==0)return t.last_flush=-1,tt;i=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,ge(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>i&&(r.adler=We(r.adler,t.pending_buf,t.pending-i,i))}t.status=Vl}if(t.status===Vl){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Ct(r),t.pending!==0))return t.last_flush=-1,tt;ge(t,r.adler&255),ge(t,r.adler>>8&255),r.adler=0}if(t.status=Bn,Ct(r),t.pending!==0)return t.last_flush=-1,tt}if(r.avail_in!==0||t.lookahead!==0||e!==on&&t.status!==to){let i=t.level===0?Nm(t,e):t.strategy===Ls?j0(t,e):t.strategy===_0?U0(t,e):ro[t.level].func(t,e);if((i===Yn||i===ua)&&(t.status=to),i===ht||i===Yn)return r.avail_out===0&&(t.last_flush=-1),tt;if(i===ca&&(e===y0?g0(t):e!==Jf&&(Ml(t,0,0,!1),e===v0&&(Xr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Ct(r),r.avail_out===0))return t.last_flush=-1,tt}return e!==Qt?tt:t.wrap<=0?Zf:(t.wrap===2?(ge(t,r.adler&255),ge(t,r.adler>>8&255),ge(t,r.adler>>16&255),ge(t,r.adler>>24&255),ge(t,r.total_in&255),ge(t,r.total_in>>8&255),ge(t,r.total_in>>16&255),ge(t,r.total_in>>24&255)):(ja(t,r.adler>>>16),ja(t,r.adler&65535)),Ct(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?tt:Zf)},H0=r=>{if(No(r))return yr;let e=r.state.status;return r.state=null,e===Bn?Vn(r,b0):tt},W0=(r,e)=>{let t=e.length;if(No(r))return yr;let n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==Zi||n.lookahead)return yr;if(i===1&&(r.adler=_o(r.adler,e,t,0)),n.wrap=0,t>=n.w_size){i===0&&(Xr(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,Yi(n);n.lookahead>=se;){let c=n.strstart,u=n.lookahead-(se-1);do n.ins_h=sn(n,n.ins_h,n.window[c+se-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=se-1,Yi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=se-1,n.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,n.wrap=i,tt},G0=Q0,K0=Rm,J0=Dm,Z0=$m,Y0=V0,X0=z0,ew=H0,tw=W0,rw="pako deflate (from Nodeca project)",lo={deflateInit:G0,deflateInit2:K0,deflateReset:J0,deflateResetKeep:Z0,deflateSetHeader:Y0,deflate:X0,deflateEnd:ew,deflateSetDictionary:tw,deflateInfo:rw},nw=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),iw=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)nw(t,n)&&(r[n]=t[n])}}return r},aw=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},Rc={assign:iw,flattenChunks:aw},Pm=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){Pm=!1}var Eo=new Uint8Array(256);for(let r=0;r<256;r++)Eo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;Eo[254]=Eo[254]=1;var ow=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},sw=(r,e)=>{if(e<65534&&r.subarray&&Pm)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},cw=(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=Eo[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 sw(a,i)},uw=(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+Eo[r[t]]>e?t:e},xo={string2buf:ow,buf2string:cw,utf8border:uw};function lw(){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 Lm=lw,Fm=Object.prototype.toString,{Z_NO_FLUSH:pw,Z_SYNC_FLUSH:dw,Z_FULL_FLUSH:fw,Z_FINISH:hw,Z_OK:vc,Z_STREAM_END:mw,Z_DEFAULT_COMPRESSION:gw,Z_DEFAULT_STRATEGY:yw,Z_DEFLATED:vw}=si;function $o(r){this.options=Rc.assign({level:gw,method:vw,chunkSize:16384,windowBits:15,memLevel:8,strategy:yw},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 Lm,this.strm.avail_out=0;let t=lo.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==vc)throw new Error(Zn[t]);if(e.header&&lo.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=xo.string2buf(e.dictionary):Fm.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=lo.deflateSetDictionary(this.strm,n),t!==vc)throw new Error(Zn[t]);this._dict_set=!0}}$o.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?hw:pw,typeof r=="string"?t.input=xo.string2buf(r):Fm.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===dw||a===fw)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=lo.deflate(t,a),i===mw)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=lo.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===vc;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};$o.prototype.onData=function(r){this.chunks.push(r)};$o.prototype.onEnd=function(r){r===vc&&(this.result=Rc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ip(r,e){let t=new $o(e);if(t.push(r,!0),t.err)throw t.msg||Zn[t.err];return t.result}function bw(r,e){return e=e||{},e.raw=!0,ip(r,e)}function ww(r,e){return e=e||{},e.gzip=!0,ip(r,e)}var Sw=$o,_w=ip,Ew=bw,xw=ww,kw=si,Aw={Deflate:Sw,deflate:_w,deflateRaw:Ew,gzip:xw,constants:kw},Fs=16209,Iw=16191,Tw=function r(e,t){let n,i,a,o,s,c,u,l,d,f,p,h,m,v,_,y,b,g,T,N,A,D,L,R,j=e.state;n=e.next_in,L=e.input,i=n+(e.avail_in-5),a=e.next_out,R=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=j.dmax,u=j.wsize,l=j.whave,d=j.wnext,f=j.window,p=j.hold,h=j.bits,m=j.lencode,v=j.distcode,_=(1<<j.lenbits)-1,y=(1<<j.distbits)-1;e:do{h<15&&(p+=L[n++]<<h,h+=8,p+=L[n++]<<h,h+=8),b=m[p&_];t:for(;;){if(g=b>>>24,p>>>=g,h-=g,g=b>>>16&255,g===0)R[a++]=b&65535;else if(g&16){T=b&65535,g&=15,g&&(h<g&&(p+=L[n++]<<h,h+=8),T+=p&(1<<g)-1,p>>>=g,h-=g),h<15&&(p+=L[n++]<<h,h+=8,p+=L[n++]<<h,h+=8),b=v[p&y];r:for(;;){if(g=b>>>24,p>>>=g,h-=g,g=b>>>16&255,g&16){if(N=b&65535,g&=15,h<g&&(p+=L[n++]<<h,h+=8,h<g&&(p+=L[n++]<<h,h+=8)),N+=p&(1<<g)-1,N>c){e.msg="invalid distance too far back",j.mode=Fs;break e}if(p>>>=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=Fs;break e}if(A=0,D=f,d===0){if(A+=u-g,g<T){T-=g;do R[a++]=f[A++];while(--g);A=a-N,D=R}}else if(d<g){if(A+=u+d-g,g-=d,g<T){T-=g;do R[a++]=f[A++];while(--g);if(A=0,d<T){g=d,T-=g;do R[a++]=f[A++];while(--g);A=a-N,D=R}}}else if(A+=d-g,g<T){T-=g;do R[a++]=f[A++];while(--g);A=a-N,D=R}for(;T>2;)R[a++]=D[A++],R[a++]=D[A++],R[a++]=D[A++],T-=3;T&&(R[a++]=D[A++],T>1&&(R[a++]=D[A++]))}else{A=a-N;do R[a++]=R[A++],R[a++]=R[A++],R[a++]=R[A++],T-=3;while(T>2);T&&(R[a++]=R[A++],T>1&&(R[a++]=R[A++]))}}else if((g&64)===0){b=v[(b&65535)+(p&(1<<g)-1)];continue r}else{e.msg="invalid distance code",j.mode=Fs;break e}break}}else if((g&64)===0){b=m[(b&65535)+(p&(1<<g)-1)];continue t}else if(g&32){j.mode=Iw;break e}else{e.msg="invalid literal/length code",j.mode=Fs;break e}break}}while(n<i&&a<s);T=h>>3,n-=T,h-=T<<3,p&=(1<<h)-1,e.next_in=n,e.next_out=a,e.avail_in=n<i?5+(i-n):5-(n-i),e.avail_out=a<s?257+(s-a):257-(a-s),j.hold=p,j.bits=h},qi=15,Xf=852,eh=592,th=0,ml=1,rh=2,Ow=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]),Cw=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]),Nw=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]),$w=new Uint8Array([16,16,16,16,17,17,18,18,19,19,20,20,21,21,22,22,23,23,24,24,25,25,26,26,27,27,28,28,29,29,64,64]),Dw=(r,e,t,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,d=0,f=0,p=0,h=0,m=0,v=0,_=0,y=0,b,g,T,N,A,D=null,L,R=new Uint16Array(qi+1),j=new Uint16Array(qi+1),Ae=null,Ce,k,we;for(u=0;u<=qi;u++)R[u]=0;for(l=0;l<n;l++)R[e[t+l]]++;for(p=c,f=qi;f>=1&&R[f]===0;f--);if(p>f&&(p=f),f===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(d=1;d<f&&R[d]===0;d++);for(p<d&&(p=d),v=1,u=1;u<=qi;u++)if(v<<=1,v-=R[u],v<0)return-1;if(v>0&&(r===th||f!==1))return-1;for(j[1]=0,u=1;u<qi;u++)j[u+1]=j[u]+R[u];for(l=0;l<n;l++)e[t+l]!==0&&(o[j[e[t+l]]++]=l);if(r===th?(D=Ae=o,L=20):r===ml?(D=Ow,Ae=Cw,L=257):(D=Nw,Ae=$w,L=0),y=0,l=0,u=d,A=a,h=p,m=0,T=-1,_=1<<p,N=_-1,r===ml&&_>Xf||r===rh&&_>eh)return 1;for(;;){Ce=u-m,o[l]+1<L?(k=0,we=o[l]):o[l]>=L?(k=Ae[o[l]-L],we=D[o[l]-L]):(k=32+64,we=0),b=1<<u-m,g=1<<h,d=g;do g-=b,i[A+(y>>m)+g]=Ce<<24|k<<16|we|0;while(g!==0);for(b=1<<u-1;y&b;)b>>=1;if(b!==0?(y&=b-1,y+=b):y=0,l++,--R[u]===0){if(u===f)break;u=e[t+o[l]]}if(u>p&&(y&N)!==T){for(m===0&&(m=p),A+=d,h=u-m,v=1<<h;h+m<f&&(v-=R[h+m],!(v<=0));)h++,v<<=1;if(_+=1<<h,r===ml&&_>Xf||r===rh&&_>eh)return 1;T=y&N,i[T]=p<<24|h<<16|A-a|0}}return y!==0&&(i[A+y]=u-m<<24|64<<16|0),s.bits=p,0},po=Dw,Rw=0,Mm=1,Um=2,{Z_FINISH:nh,Z_BLOCK:Pw,Z_TREES:Ms,Z_OK:Xn,Z_STREAM_END:Lw,Z_NEED_DICT:Fw,Z_STREAM_ERROR:zt,Z_DATA_ERROR:jm,Z_MEM_ERROR:qm,Z_BUF_ERROR:Mw,Z_DEFLATED:ih}=si,Pc=16180,ah=16181,oh=16182,sh=16183,ch=16184,uh=16185,lh=16186,ph=16187,dh=16188,fh=16189,bc=16190,Tr=16191,gl=16192,hh=16193,yl=16194,mh=16195,gh=16196,yh=16197,vh=16198,Us=16199,js=16200,bh=16201,wh=16202,Sh=16203,_h=16204,Eh=16205,vl=16206,xh=16207,kh=16208,Ie=16209,Bm=16210,Vm=16211,Uw=852,jw=592,qw=15,Bw=qw,Ah=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Vw(){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 ci=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Pc||e.mode>Vm?1:0},Qm=r=>{if(ci(r))return zt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=Pc,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(Uw),e.distcode=e.distdyn=new Int32Array(jw),e.sane=1,e.back=-1,Xn},zm=r=>{if(ci(r))return zt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Qm(r)},Hm=(r,e)=>{let t;if(ci(r))return zt;let n=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?zt:(n.window!==null&&n.wbits!==e&&(n.window=null),n.wrap=t,n.wbits=e,zm(r))},Wm=(r,e)=>{if(!r)return zt;let t=new Vw;r.state=t,t.strm=r,t.window=null,t.mode=Pc;let n=Hm(r,e);return n!==Xn&&(r.state=null),n},Qw=r=>Wm(r,Bw),Ih=!0,bl,wl,zw=r=>{if(Ih){bl=new Int32Array(512),wl=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(po(Mm,r.lens,0,288,bl,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;po(Um,r.lens,0,32,wl,0,r.work,{bits:5}),Ih=!1}r.lencode=bl,r.lenbits=9,r.distcode=wl,r.distbits=5},Gm=(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},Hw=(r,e)=>{let t,n,i,a,o,s,c,u,l,d,f,p,h,m,v=0,_,y,b,g,T,N,A,D,L=new Uint8Array(4),R,j,Ae=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(ci(r)||!r.output||!r.input&&r.avail_in!==0)return zt;t=r.state,t.mode===Tr&&(t.mode=gl),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,d=s,f=c,D=Xn;e:for(;;)switch(t.mode){case Pc:if(t.wrap===0){t.mode=gl;break}for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.wrap&2&&u===35615){t.wbits===0&&(t.wbits=15),t.check=0,L[0]=u&255,L[1]=u>>>8&255,t.check=We(t.check,L,2,0),u=0,l=0,t.mode=ah;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)!==ih){r.msg="unknown compression method",t.mode=Ie;break}if(u>>>=4,l-=4,A=(u&15)+8,t.wbits===0&&(t.wbits=A),A>15||A>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?fh:Tr,u=0,l=0;break;case ah:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==ih){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&&(L[0]=u&255,L[1]=u>>>8&255,t.check=We(t.check,L,2,0)),u=0,l=0,t.mode=oh;case oh:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.head&&(t.head.time=u),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,L[2]=u>>>16&255,L[3]=u>>>24&255,t.check=We(t.check,L,4,0)),u=0,l=0,t.mode=sh;case sh:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=We(t.check,L,2,0)),u=0,l=0,t.mode=ch;case ch:if(t.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=We(t.check,L,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=uh;case uh:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(A=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(n.subarray(a,a+p),A)),t.flags&512&&t.wrap&4&&(t.check=We(t.check,n,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=lh;case lh:if(t.flags&2048){if(s===0)break e;p=0;do A=n[a+p++],t.head&&A&&t.length<65536&&(t.head.name+=String.fromCharCode(A));while(A&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=We(t.check,n,p,a)),s-=p,a+=p,A)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=ph;case ph:if(t.flags&4096){if(s===0)break e;p=0;do A=n[a+p++],t.head&&A&&t.length<65536&&(t.head.comment+=String.fromCharCode(A));while(A&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=We(t.check,n,p,a)),s-=p,a+=p,A)break e}else t.head&&(t.head.comment=null);t.mode=dh;case dh: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=Tr;break;case fh:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.adler=t.check=Ah(u),u=0,l=0,t.mode=bc;case bc: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,Fw;r.adler=t.check=1,t.mode=Tr;case Tr:if(e===Pw||e===Ms)break e;case gl:if(t.last){u>>>=l&7,l-=l&7,t.mode=vl;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=hh;break;case 1:if(zw(t),t.mode=Us,e===Ms){u>>>=2,l-=2;break e}break;case 2:t.mode=gh;break;case 3:r.msg="invalid block type",t.mode=Ie}u>>>=2,l-=2;break;case hh: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=yl,e===Ms)break e;case yl:t.mode=mh;case mh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;i.set(n.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=Tr;break;case gh: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=yh;case yh:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.lens[Ae[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[Ae[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,R={bits:t.lenbits},D=po(Rw,t.lens,0,19,t.lencode,0,t.work,R),t.lenbits=R.bits,D){r.msg="invalid code lengths set",t.mode=Ie;break}t.have=0,t.mode=vh;case vh: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=Ie;break}A=t.lens[t.have-1],p=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-=_,A=0,p=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-=_,A=0,p=11+(u&127),u>>>=7,l-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Ie;break}for(;p--;)t.lens[t.have++]=A}}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,R={bits:t.lenbits},D=po(Mm,t.lens,0,t.nlen,t.lencode,0,t.work,R),t.lenbits=R.bits,D){r.msg="invalid literal/lengths set",t.mode=Ie;break}if(t.distbits=6,t.distcode=t.distdyn,R={bits:t.distbits},D=po(Um,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,R),t.distbits=R.bits,D){r.msg="invalid distances set",t.mode=Ie;break}if(t.mode=Us,e===Ms)break e;case Us:t.mode=js;case js: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,Tw(r,f),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===Tr&&(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=_,T=y,N=b;v=t.lencode[N+((u&(1<<g+T)-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=Eh;break}if(y&32){t.back=-1,t.mode=Tr;break}if(y&64){r.msg="invalid literal/length code",t.mode=Ie;break}t.extra=y&15,t.mode=bh;case bh: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=wh;case wh: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=_,T=y,N=b;v=t.distcode[N+((u&(1<<g+T)-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=Ie;break}t.offset=b,t.extra=y&15,t.mode=Sh;case Sh: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=Ie;break}t.mode=_h;case _h:if(c===0)break e;if(p=f-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Ie;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=i,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do i[o++]=m[h++];while(--p);t.length===0&&(t.mode=js);break;case Eh:if(c===0)break e;i[o++]=t.length,c--,t.mode=js;break;case vl:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(f-=c,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?We(t.check,i,f,o-f):_o(t.check,i,f,o-f)),f=c,t.wrap&4&&(t.flags?u:Ah(u))!==t.check){r.msg="incorrect data check",t.mode=Ie;break}u=0,l=0}t.mode=xh;case xh: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=kh;case kh:D=Lw;break e;case Ie:D=jm;break e;case Bm:return qm;case Vm:default:return zt}return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,(t.wsize||f!==r.avail_out&&t.mode<Ie&&(t.mode<vl||e!==nh))&&Gm(r,r.output,r.next_out,f-r.avail_out),d-=r.avail_in,f-=r.avail_out,r.total_in+=d,r.total_out+=f,t.total+=f,t.wrap&4&&f&&(r.adler=t.check=t.flags?We(t.check,i,f,r.next_out-f):_o(t.check,i,f,r.next_out-f)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Tr?128:0)+(t.mode===Us||t.mode===yl?256:0),(d===0&&f===0||e===nh)&&D===Xn&&(D=Mw),D},Ww=r=>{if(ci(r))return zt;let e=r.state;return e.window&&(e.window=null),r.state=null,Xn},Gw=(r,e)=>{if(ci(r))return zt;let t=r.state;return(t.wrap&2)===0?zt:(t.head=e,e.done=!1,Xn)},Kw=(r,e)=>{let t=e.length,n,i,a;return ci(r)||(n=r.state,n.wrap!==0&&n.mode!==bc)?zt:n.mode===bc&&(i=1,i=_o(i,e,t,0),i!==n.check)?jm:(a=Gm(r,e,t,t),a?(n.mode=Bm,qm):(n.havedict=1,Xn))},Jw=zm,Zw=Hm,Yw=Qm,Xw=Qw,eS=Wm,tS=Hw,rS=Ww,nS=Gw,iS=Kw,aS="pako inflate (from Nodeca project)",Dr={inflateReset:Jw,inflateReset2:Zw,inflateResetKeep:Yw,inflateInit:Xw,inflateInit2:eS,inflate:tS,inflateEnd:rS,inflateGetHeader:nS,inflateSetDictionary:iS,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 sS=oS,Km=Object.prototype.toString,{Z_NO_FLUSH:cS,Z_FINISH:uS,Z_OK:ko,Z_STREAM_END:Sl,Z_NEED_DICT:_l,Z_STREAM_ERROR:lS,Z_DATA_ERROR:Th,Z_MEM_ERROR:pS}=si;function Do(r){this.options=Rc.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 Lm,this.strm.avail_out=0;let t=Dr.inflateInit2(this.strm,e.windowBits);if(t!==ko)throw new Error(Zn[t]);if(this.header=new sS,Dr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=xo.string2buf(e.dictionary):Km.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Dr.inflateSetDictionary(this.strm,e.dictionary),t!==ko)))throw new Error(Zn[t])}Do.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?uS:cS,Km.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=Dr.inflate(t,o),a===_l&&i&&(a=Dr.inflateSetDictionary(t,i),a===ko?a=Dr.inflate(t,o):a===Th&&(a=_l));t.avail_in>0&&a===Sl&&t.state.wrap>0&&r[t.next_in]!==0;)Dr.inflateReset(t),a=Dr.inflate(t,o);switch(a){case lS:case Th:case _l:case pS:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===Sl))if(this.options.to==="string"){let c=xo.utf8border(t.output,t.next_out),u=t.next_out-c,l=xo.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===ko&&s===0)){if(a===Sl)return a=Dr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};Do.prototype.onData=function(r){this.chunks.push(r)};Do.prototype.onEnd=function(r){r===ko&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Rc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ap(r,e){let t=new Do(e);if(t.push(r),t.err)throw t.msg||Zn[t.err];return t.result}function dS(r,e){return e=e||{},e.raw=!0,ap(r,e)}var fS=Do,hS=ap,mS=dS,gS=ap,yS=si,vS={Inflate:fS,inflate:hS,inflateRaw:mS,ungzip:gS,constants:yS},{Deflate:bS,deflate:wS,deflateRaw:SS,gzip:_S}=Aw,{Inflate:ES,inflate:xS,inflateRaw:kS,ungzip:AS}=vS,IS=bS,TS=wS,OS=SS,CS=_S,NS=ES,$S=xS,DS=kS,RS=AS,PS=si,LS={Deflate:IS,deflate:TS,deflateRaw:OS,gzip:CS,Inflate:NS,inflate:$S,inflateRaw:DS,ungzip:RS,constants:PS},Ee=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},xe=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},wc=class{constructor(e,t){this.input=e,this.output=t}};Ee([w(),xe("design:type",String)],wc.prototype,"input",void 0);Ee([w(),xe("design:type",String)],wc.prototype,"output",void 0);wc=Ee([Ke(),xe("design:paramtypes",[String,String])],wc);var Sc=class{constructor(e,t){this.input=e,this.output=t}};Ee([w(),xe("design:type",String)],Sc.prototype,"input",void 0);Ee([w(),xe("design:type",String)],Sc.prototype,"output",void 0);Sc=Ee([z(),xe("design:paramtypes",[String,String])],Sc);var pn=class{constructor(e,t,n,i,a){this.name=e,this.modelId=t,this.systemPrompt=n,this.promptExamples=i,this.metaData=a}};Ee([w(),xe("design:type",String)],pn.prototype,"name",void 0);Ee([w(),xe("design:type",String)],pn.prototype,"modelId",void 0);Ee([w(),xe("design:type",String)],pn.prototype,"systemPrompt",void 0);Ee([w(),xe("design:type",Array)],pn.prototype,"promptExamples",void 0);Ee([w(),xe("design:type",String)],pn.prototype,"metaData",void 0);pn=Ee([Ke(),xe("design:paramtypes",[String,String,String,Array,String])],pn);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}};Ee([w(),xe("design:type",String)],Sr.prototype,"name",void 0);Ee([w(),xe("design:type",String)],Sr.prototype,"modelId",void 0);Ee([w(),xe("design:type",String)],Sr.prototype,"taskId",void 0);Ee([w(),xe("design:type",String)],Sr.prototype,"systemPrompt",void 0);Ee([w(),xe("design:type",Array)],Sr.prototype,"promptExamples",void 0);Ee([w(),xe("design:type",String)],Sr.prototype,"metaData",void 0);Ee([w(),xe("design:type",String)],Sr.prototype,"createdAt",void 0);Ee([w(),xe("design:type",String)],Sr.prototype,"updatedAt",void 0);Sr=Ee([z(),xe("design:paramtypes",[String,String,String,String,Array,String,String,String])],Sr);var ei=class{constructor(e,t,n,i,a){this.model=e,this.status=t,this.progress=n,this.downloaded=i,this.loaded=a}};Ee([w(),xe("design:type",String)],ei.prototype,"model",void 0);Ee([w(),xe("design:type",String)],ei.prototype,"status",void 0);Ee([w(),xe("design:type",Number)],ei.prototype,"progress",void 0);Ee([w(),xe("design:type",Boolean)],ei.prototype,"downloaded",void 0);Ee([w(),xe("design:type",Boolean)],ei.prototype,"loaded",void 0);ei=Ee([z(),xe("design:paramtypes",[String,String,Number,Boolean,Boolean])],ei);var FS=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},ze=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)},Ve,tc,zl=class{constructor(e,t=!0){Ve.set(this,void 0),tc.set(this,new Map),FS(this,Ve,e,"f")}async getModels(){let e=await ze(this,Ve,"f").query({query:E`
793
806
  query {
794
807
  aiGetModels {
795
808
  id
@@ -813,23 +826,23 @@ triggerMatch
813
826
  modelType
814
827
  }
815
828
  }
816
- `});return T(e).aiGetModels}async addModel(e){let t=await Qe(this,Be,"f").mutate({mutation:x`
829
+ `});return I(e).aiGetModels}async addModel(e){let t=await ze(this,Ve,"f").mutate({mutation:E`
817
830
  mutation($model: ModelInput!) {
818
831
  aiAddModel(model: $model)
819
832
  }
820
- `,variables:{model:e}});return T(t).aiAddModel}async updateModel(e,t){let n=await Qe(this,Be,"f").mutate({mutation:x`
833
+ `,variables:{model:e}});return I(t).aiAddModel}async updateModel(e,t){let n=await ze(this,Ve,"f").mutate({mutation:E`
821
834
  mutation($modelId: String!, $model: ModelInput!) {
822
835
  aiUpdateModel(modelId: $modelId, model: $model)
823
836
  }
824
- `,variables:{modelId:e,model:t}});return T(n).aiUpdateModel}async removeModel(e){let t=await Qe(this,Be,"f").mutate({mutation:x`
837
+ `,variables:{modelId:e,model:t}});return I(n).aiUpdateModel}async removeModel(e){let t=await ze(this,Ve,"f").mutate({mutation:E`
825
838
  mutation($modelId: String!) {
826
839
  aiRemoveModel(modelId: $modelId)
827
840
  }
828
- `,variables:{modelId:e}});return T(t).aiRemoveModel}async setDefaultModel(e,t){let n=await Qe(this,Be,"f").mutate({mutation:x`
841
+ `,variables:{modelId:e}});return I(t).aiRemoveModel}async setDefaultModel(e,t){let n=await ze(this,Ve,"f").mutate({mutation:E`
829
842
  mutation($modelType: ModelType!, $modelId: String!) {
830
843
  aiSetDefaultModel(modelType: $modelType modelId: $modelId)
831
844
  }
832
- `,variables:{modelId:t,modelType:e}});return T(n).aiSetDefaultModel}async getDefaultModel(e){let t=await Qe(this,Be,"f").query({query:x`
845
+ `,variables:{modelId:t,modelType:e}});return I(n).aiSetDefaultModel}async getDefaultModel(e){let t=await ze(this,Ve,"f").query({query:E`
833
846
  query($modelType: ModelType!) {
834
847
  aiGetDefaultModel(modelType: $modelType) {
835
848
  id
@@ -853,7 +866,7 @@ triggerMatch
853
866
  modelType
854
867
  }
855
868
  }
856
- `,variables:{modelType:e}});return T(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=T(await Qe(this,Be,"f").query({query:x`
869
+ `,variables:{modelType:e}});return I(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=I(await ze(this,Ve,"f").query({query:E`
857
870
  query {
858
871
  aiTasks {
859
872
  name
@@ -869,7 +882,7 @@ triggerMatch
869
882
  updatedAt
870
883
  }
871
884
  }
872
- `}));return e}async addTask(e,t,n,i,a){let o=new dn(e,t,n,i,a),{aiAddTask:s}=T(await Qe(this,Be,"f").mutate({mutation:x`
885
+ `}));return e}async addTask(e,t,n,i,a){let o=new pn(e,t,n,i,a),{aiAddTask:s}=I(await ze(this,Ve,"f").mutate({mutation:E`
873
886
  mutation AiAddTask($task: AITaskInput!) {
874
887
  aiAddTask(task: $task) {
875
888
  name
@@ -885,7 +898,7 @@ triggerMatch
885
898
  updatedAt
886
899
  }
887
900
  }
888
- `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=T(await Qe(this,Be,"f").mutate({mutation:x`
901
+ `,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=I(await ze(this,Ve,"f").mutate({mutation:E`
889
902
  mutation AiRemoveTask($taskId: String!) {
890
903
  aiRemoveTask(taskId: $taskId) {
891
904
  name
@@ -901,7 +914,7 @@ triggerMatch
901
914
  updatedAt
902
915
  }
903
916
  }
904
- `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:n}=T(await Qe(this,Be,"f").mutate({mutation:x`
917
+ `,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:n}=I(await ze(this,Ve,"f").mutate({mutation:E`
905
918
  mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
906
919
  aiUpdateTask(taskId: $taskId, task: $task) {
907
920
  name
@@ -917,7 +930,7 @@ triggerMatch
917
930
  updatedAt
918
931
  }
919
932
  }
920
- `,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,Be,"f").query({query:x`
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}=I(await ze(this,Ve,"f").query({query:E`
921
934
  query AiModelLoadingStatus($model: String!) {
922
935
  aiModelLoadingStatus(model: $model) {
923
936
  model
@@ -927,29 +940,83 @@ triggerMatch
927
940
  downloaded
928
941
  }
929
942
  }
930
- `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:n}=T(await Qe(this,Be,"f").mutate({mutation:x`
943
+ `,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:n}=I(await ze(this,Ve,"f").mutate({mutation:E`
931
944
  mutation AiPrompt($taskId: String!, $prompt: String!) {
932
945
  aiPrompt(taskId: $taskId, prompt: $prompt)
933
946
  }
934
- `,variables:{taskId:e,prompt:t}}));return n}async embed(e,t){let{aiEmbed:n}=T(await Qe(this,Be,"f").mutate({mutation:x`
947
+ `,variables:{taskId:e,prompt:t}}));return n}async embed(e,t){let{aiEmbed:n}=I(await ze(this,Ve,"f").mutate({mutation:E`
935
948
  mutation aiEmbed($modelId: String!, $text: String!) {
936
949
  aiEmbed(modelId: $modelId, text: $text)
937
950
  }
938
- `,variables:{modelId:e,text:t}})),i=Tc.toByteArray(n);return JSON.parse(AS.inflate(i,{to:"string"}))}async openTranscriptionStream(e,t,n){let{aiOpenTranscriptionStream:i}=T(await Qe(this,Be,"f").mutate({mutation:x`
951
+ `,variables:{modelId:e,text:t}})),i=$c.toByteArray(n);return JSON.parse(LS.inflate(i,{to:"string"}))}async openTranscriptionStream(e,t,n){let{aiOpenTranscriptionStream:i}=I(await ze(this,Ve,"f").mutate({mutation:E`
939
952
  mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
940
953
  aiOpenTranscriptionStream(modelId: $modelId, params: $params)
941
954
  }
942
- `,variables:{modelId:e,params:n}})),a=Qe(this,Be,"f").subscribe({query:x` subscription {
955
+ `,variables:{modelId:e,params:n}})),a=ze(this,Ve,"f").subscribe({query:E` subscription {
943
956
  aiTranscriptionText(streamId: "${i}")
944
- }`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Qe(this,Js,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=T(await Qe(this,Be,"f").mutate({mutation:x`
957
+ }`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return ze(this,tc,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=I(await ze(this,Ve,"f").mutate({mutation:E`
945
958
  mutation aiCloseTranscriptionStream($streamId: String!) {
946
959
  aiCloseTranscriptionStream(streamId: $streamId)
947
960
  }
948
- `,variables:{streamId:e}})),n=Qe(this,Js,"f").get(e);return n.closed||n.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:n}=T(await Qe(this,Be,"f").mutate({mutation:x`
961
+ `,variables:{streamId:e}})),n=ze(this,tc,"f").get(e);return n.closed||n.unsubscribe(),t}async feedTranscriptionStream(e,t){let{aiFeedTranscriptionStream:n}=I(await ze(this,Ve,"f").mutate({mutation:E`
949
962
  mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
950
963
  aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
951
964
  }
952
- `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return n}};Be=new WeakMap,Js=new WeakMap;var Jr=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)},pr,Zs,to,Ys,ro,jn,Xs,no,_o=class{constructor(e,t=!0){pr.set(this,void 0),Zs.set(this,void 0),to.set(this,void 0),Ys.set(this,void 0),ro.set(this,void 0),jn.set(this,void 0),Xs.set(this,void 0),no.set(this,void 0),Jr(this,pr,e,"f"),Jr(this,Zs,new fo(qe(this,pr,"f"),t),"f"),Jr(this,to,new Nl(qe(this,pr,"f")),"f"),Jr(this,Ys,new Tl(qe(this,pr,"f")),"f"),Jr(this,ro,new Ol(qe(this,pr,"f")),"f"),Jr(this,no,new ql(qe(this,pr,"f"),t),"f"),Jr(this,jn,new fc(qe(this,pr,"f"),t),"f"),qe(this,jn,"f").setExpressionClient(qe(this,to,"f")),qe(this,jn,"f").setNeighbourhoodClient(qe(this,ro,"f")),qe(this,jn,"f").setAIClient(qe(this,no,"f")),Jr(this,Xs,new Cl(qe(this,pr,"f"),t),"f")}get agent(){return qe(this,Zs,"f")}get expression(){return qe(this,to,"f")}get languages(){return qe(this,Ys,"f")}get neighbourhood(){return qe(this,ro,"f")}get perspective(){return qe(this,jn,"f")}get runtime(){return qe(this,Xs,"f")}get ai(){return qe(this,no,"f")}};pr=new WeakMap,Zs=new WeakMap,to=new WeakMap,Ys=new WeakMap,ro=new WeakMap,jn=new WeakMap,Xs=new WeakMap,no=new WeakMap;var Bl;(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"})(Bl||(Bl={}));var rp=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},np=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},zn=class{constructor(e,t){this.language=e,this.expression=t}};rp([S(),np("design:type",mr)],zn.prototype,"language",void 0);rp([S(),np("design:type",String)],zn.prototype,"expression",void 0);zn=rp([H(),np("design:paramtypes",[mr,String])],zn);function bO(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function wO(r){if(r.startsWith("literal://")){let a=new mr;a.address="literal",a.name="literal";let o=r.substring(10);return new zn(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new mr;return s.address=a,new zn(s,o)}let i=/^did:([^\s]+)$/.exec(r);if(i&&i.length==2){let a=new mr;return a.address="did",new zn(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Dt=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},_r=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},bc=class{};Dt([S(),_r("design:type",String)],bc.prototype,"name",void 0);Dt([S(),_r("design:type",String)],bc.prototype,"type",void 0);bc=Dt([H()],bc);var Eo=class{};Dt([S(),_r("design:type",String)],Eo.prototype,"label",void 0);Dt([S(),_r("design:type",String)],Eo.prototype,"name",void 0);Dt([S(),_r("design:type",Array)],Eo.prototype,"parameters",void 0);Eo=Dt([H()],Eo);var wc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Dt([S(),_r("design:type",String)],wc.prototype,"name",void 0);Dt([S(),_r("design:type",String)],wc.prototype,"parametersStringified",void 0);wc=Dt([Ge(),_r("design:paramtypes",[String,Object])],wc);var Sc=class{};Dt([S(),_r("design:type",String)],Sc.prototype,"did",void 0);Dt([S(),_r("design:type",Kn)],Sc.prototype,"status",void 0);Sc=Dt([H()],Sc);var kh=class{},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},ca=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},fn=class{};ci([S(),ca("design:type",String)],fn.prototype,"name",void 0);ci([S(),ca("design:type",String)],fn.prototype,"address",void 0);ci([S(),ca("design:type",String)],fn.prototype,"settings",void 0);ci([S(),ca("design:type",Hn)],fn.prototype,"icon",void 0);ci([S(),ca("design:type",Hn)],fn.prototype,"constructorIcon",void 0);ci([S(),ca("design:type",Hn)],fn.prototype,"settingsIcon",void 0);fn=ci([H()],fn);var ht=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},Et=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Xt=class{};ht([S(),Et("design:type",String)],Xt.prototype,"name",void 0);ht([S(),Et("design:type",String)],Xt.prototype,"address",void 0);ht([S(),Et("design:type",String)],Xt.prototype,"description",void 0);ht([S(),Et("design:type",String)],Xt.prototype,"author",void 0);ht([S(),Et("design:type",Boolean)],Xt.prototype,"templated",void 0);ht([S(),Et("design:type",String)],Xt.prototype,"templateSourceLanguageAddress",void 0);ht([S(),Et("design:type",String)],Xt.prototype,"templateAppliedParams",void 0);ht([S(),Et("design:type",Array)],Xt.prototype,"possibleTemplateParams",void 0);ht([S(),Et("design:type",String)],Xt.prototype,"sourceCodeLink",void 0);Xt=ht([H()],Xt);var Xi=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ht([S(),Et("design:type",String)],Xi.prototype,"name",void 0);ht([S(),Et("design:type",String)],Xi.prototype,"description",void 0);ht([S(),Et("design:type",Array)],Xi.prototype,"possibleTemplateParams",void 0);ht([S(),Et("design:type",String)],Xi.prototype,"sourceCodeLink",void 0);Xi=ht([Ge(),Et("design:paramtypes",[String,String])],Xi);var Ih=class{},Th=class extends gn(){},Oh=class{},$c=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},ip=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},_c=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};$c([S(),ip("design:type",String)],_c.prototype,"linkLanguage",void 0);$c([S(),ip("design:type",br)],_c.prototype,"meta",void 0);_c=$c([H(),ip("design:paramtypes",[String,br])],_c);var Vl=class extends gn(){};Vl=$c([H()],Vl);var ui=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)},Ql;(function(r){r.Private="PRIVATE",r.NeighboudhoodCreationInitiated="NEIGHBOURHOOD_CREATION_INITIATED",r.NeighbourhoodJoinInitiated="NEIGHBOURHOOD_JOIN_INITIATED",r.LinkLanguageFailedToInstall="LINK_LANGUAGE_FAILED_TO_INSTALL",r.LinkLanguageInstalledButNotSynced="LINK_LANGUAGE_INSTALLED_BUT_NOT_SYNCED",r.Synced="SYNCED"})(Ql||(Ql={}));var hn=class{constructor(e,t,n){this.uuid=e,this.name=t,n?this.state=n:this.state=Ql.Private}};ui([S(),li("design:type",String)],hn.prototype,"uuid",void 0);ui([S(),li("design:type",String)],hn.prototype,"name",void 0);ui([S(),li("design:type",String)],hn.prototype,"state",void 0);ui([S(),li("design:type",String)],hn.prototype,"sharedUrl",void 0);ui([S(),li("design:type",Vl)],hn.prototype,"neighbourhood",void 0);ui([S(),li("design:type",Array)],hn.prototype,"owners",void 0);hn=ui([H(),li("design:paramtypes",[String,String,String])],hn);var Dc=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},Qm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ec=class{};Dc([S(),Qm("design:type",Array)],Ec.prototype,"additions",void 0);Dc([S(),Qm("design:type",Array)],Ec.prototype,"removals",void 0);Ec=Dc([H()],Ec);var Ch=class extends gn(){};Ch=Dc([H()],Ch);var Nh=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},qi=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)},io,Un,Fs="smart_literal://content";function IS(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 xo=class{constructor(e,t){io.set(this,void 0),Un.set(this,void 0),Nh(this,io,e,"f"),Nh(this,Un,t,"f")}get base(){return qi(this,Un,"f")}static async create(e,t){let n=Se.from(IS(10)).toUrl(),i=new xo(e,n);return await i.set(t),i}static async isSmartLiteralBase(e,t){return(await e.get(new fe({source:t,predicate:Fs}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new fe({predicate:Fs}))).map(n=>new xo(e,n.data.source))}async get(){let e=await qi(this,io,"f").getSingleTarget(new fe({source:qi(this,Un,"f"),predicate:Fs}));if(!e)throw`No content for smart literal ${qi(this,Un,"f")}`;return Se.fromUrl(e).get()}async set(e){let t=Se.from(e);await qi(this,io,"f").setSingleTarget(new St({source:qi(this,Un,"f"),predicate:Fs,target:t.toUrl()}))}};io=new WeakMap,Un=new WeakMap;var DO=`
965
+ `,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return n}};Ve=new WeakMap,tc=new WeakMap;var Jr=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Be=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},pr,rc,no,nc,io,Mn,ic,ao,Ao=class{constructor(e,t=!0){pr.set(this,void 0),rc.set(this,void 0),no.set(this,void 0),nc.set(this,void 0),io.set(this,void 0),Mn.set(this,void 0),ic.set(this,void 0),ao.set(this,void 0),Jr(this,pr,e,"f"),Jr(this,rc,new yo(Be(this,pr,"f"),t),"f"),Jr(this,no,new Pl(Be(this,pr,"f")),"f"),Jr(this,nc,new $l(Be(this,pr,"f")),"f"),Jr(this,io,new Dl(Be(this,pr,"f")),"f"),Jr(this,ao,new zl(Be(this,pr,"f"),t),"f"),Jr(this,Mn,new gc(Be(this,pr,"f"),t),"f"),Be(this,Mn,"f").setExpressionClient(Be(this,no,"f")),Be(this,Mn,"f").setNeighbourhoodClient(Be(this,io,"f")),Be(this,Mn,"f").setAIClient(Be(this,ao,"f")),Jr(this,ic,new Rl(Be(this,pr,"f"),t),"f")}get agent(){return Be(this,rc,"f")}get expression(){return Be(this,no,"f")}get languages(){return Be(this,nc,"f")}get neighbourhood(){return Be(this,io,"f")}get perspective(){return Be(this,Mn,"f")}get runtime(){return Be(this,ic,"f")}get ai(){return Be(this,ao,"f")}};pr=new WeakMap,rc=new WeakMap,no=new WeakMap,nc=new WeakMap,io=new WeakMap,Mn=new WeakMap,ic=new WeakMap,ao=new WeakMap;var Hl;(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"})(Hl||(Hl={}));var op=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},sp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Qn=class{constructor(e,t){this.language=e,this.expression=t}};op([w(),sp("design:type",mr)],Qn.prototype,"language",void 0);op([w(),sp("design:type",String)],Qn.prototype,"expression",void 0);Qn=op([z(),sp("design:paramtypes",[mr,String])],Qn);function RO(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function PO(r){if(r.startsWith("literal://")){let a=new mr;a.address="literal",a.name="literal";let o=r.substring(10);return new Qn(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new mr;return s.address=a,new Qn(s,o)}let i=/^did:([^\s]+)$/.exec(r);if(i&&i.length==2){let a=new mr;return a.address="did",new Qn(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Pt=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},_r=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},_c=class{};Pt([w(),_r("design:type",String)],_c.prototype,"name",void 0);Pt([w(),_r("design:type",String)],_c.prototype,"type",void 0);_c=Pt([z()],_c);var Io=class{};Pt([w(),_r("design:type",String)],Io.prototype,"label",void 0);Pt([w(),_r("design:type",String)],Io.prototype,"name",void 0);Pt([w(),_r("design:type",Array)],Io.prototype,"parameters",void 0);Io=Pt([z()],Io);var Ec=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Pt([w(),_r("design:type",String)],Ec.prototype,"name",void 0);Pt([w(),_r("design:type",String)],Ec.prototype,"parametersStringified",void 0);Ec=Pt([Ke(),_r("design:paramtypes",[String,Object])],Ec);var xc=class{};Pt([w(),_r("design:type",String)],xc.prototype,"did",void 0);Pt([w(),_r("design:type",Gn)],xc.prototype,"status",void 0);xc=Pt([z()],xc);var Oh=class{},ui=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},la=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},dn=class{};ui([w(),la("design:type",String)],dn.prototype,"name",void 0);ui([w(),la("design:type",String)],dn.prototype,"address",void 0);ui([w(),la("design:type",String)],dn.prototype,"settings",void 0);ui([w(),la("design:type",Hn)],dn.prototype,"icon",void 0);ui([w(),la("design:type",Hn)],dn.prototype,"constructorIcon",void 0);ui([w(),la("design:type",Hn)],dn.prototype,"settingsIcon",void 0);dn=ui([z()],dn);var gt=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},At=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Xt=class{};gt([w(),At("design:type",String)],Xt.prototype,"name",void 0);gt([w(),At("design:type",String)],Xt.prototype,"address",void 0);gt([w(),At("design:type",String)],Xt.prototype,"description",void 0);gt([w(),At("design:type",String)],Xt.prototype,"author",void 0);gt([w(),At("design:type",Boolean)],Xt.prototype,"templated",void 0);gt([w(),At("design:type",String)],Xt.prototype,"templateSourceLanguageAddress",void 0);gt([w(),At("design:type",String)],Xt.prototype,"templateAppliedParams",void 0);gt([w(),At("design:type",Array)],Xt.prototype,"possibleTemplateParams",void 0);gt([w(),At("design:type",String)],Xt.prototype,"sourceCodeLink",void 0);Xt=gt([z()],Xt);var Xi=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};gt([w(),At("design:type",String)],Xi.prototype,"name",void 0);gt([w(),At("design:type",String)],Xi.prototype,"description",void 0);gt([w(),At("design:type",Array)],Xi.prototype,"possibleTemplateParams",void 0);gt([w(),At("design:type",String)],Xi.prototype,"sourceCodeLink",void 0);Xi=gt([Ke(),At("design:paramtypes",[String,String])],Xi);var Ch=class{},Nh=class extends mn(){},$h=class{},Lc=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},cp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},kc=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Lc([w(),cp("design:type",String)],kc.prototype,"linkLanguage",void 0);Lc([w(),cp("design:type",br)],kc.prototype,"meta",void 0);kc=Lc([z(),cp("design:paramtypes",[String,br])],kc);var Wl=class extends mn(){};Wl=Lc([z()],Wl);var li=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)},Gl;(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"})(Gl||(Gl={}));var fn=class{constructor(e,t,n){this.uuid=e,this.name=t,n?this.state=n:this.state=Gl.Private}};li([w(),pi("design:type",String)],fn.prototype,"uuid",void 0);li([w(),pi("design:type",String)],fn.prototype,"name",void 0);li([w(),pi("design:type",String)],fn.prototype,"state",void 0);li([w(),pi("design:type",String)],fn.prototype,"sharedUrl",void 0);li([w(),pi("design:type",Wl)],fn.prototype,"neighbourhood",void 0);li([w(),pi("design:type",Array)],fn.prototype,"owners",void 0);fn=li([z(),pi("design:paramtypes",[String,String,String])],fn);var Dh=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 d=[];try{let p=`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,p);if(Array.isArray(h))for(let m of h)m&&m.source&&d.push(m.source)}catch(f){this.logger.warn(`[waker] ${e.id}: parent resolution failed for ${l} \u2014 ${f?.message??f}`)}this.logger.info(`[waker] ${e.id}: message ${l} has ${d.length} parent(s): ${d.join(", ")}`),c.push({address:l,parents:d})}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)}}},Fc=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},Jm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ac=class{};Fc([w(),Jm("design:type",Array)],Ac.prototype,"additions",void 0);Fc([w(),Jm("design:type",Array)],Ac.prototype,"removals",void 0);Ac=Fc([z()],Ac);var Rh=class extends mn(){};Rh=Fc([z()],Rh);var Ph=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)},oo,Un,qs="smart_literal://content";function MS(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 To=class{constructor(e,t){oo.set(this,void 0),Un.set(this,void 0),Ph(this,oo,e,"f"),Ph(this,Un,t,"f")}get base(){return Bi(this,Un,"f")}static async create(e,t){let n=_e.from(MS(10)).toUrl(),i=new To(e,n);return await i.set(t),i}static async isSmartLiteralBase(e,t){return(await e.get(new he({source:t,predicate:qs}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new he({predicate:qs}))).map(n=>new To(e,n.data.source))}async get(){let e=await Bi(this,oo,"f").getSingleTarget(new he({source:Bi(this,Un,"f"),predicate:qs}));if(!e)throw`No content for smart literal ${Bi(this,Un,"f")}`;return _e.fromUrl(e).get()}async set(e){let t=_e.from(e);await Bi(this,oo,"f").setSingleTarget(new Et({source:Bi(this,Un,"f"),predicate:qs,target:t.toUrl()}))}};oo=new WeakMap,Un=new WeakMap;function so(r,e){if("predicate"in r)return r.predicate;let{model:t}=r,n=dr(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 Lh(r,e){return!r||!e?"":`triple("${r.id}", "${e}", Base)`}function Fh(){return`
967
+ findall(
968
+ [T, A],
969
+ link(Base, _, _, T, A),
970
+ AllLinks
971
+ ),
972
+ sort(AllLinks, SortedLinks),
973
+ SortedLinks = [[Timestamp, Author]|_]
974
+ `}function US(r){return`
975
+ findall([PropertyName, PropertyValue, Resolve], (
976
+ % Constrain to specified properties if provided
977
+ ${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
978
+ resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
979
+ ), Properties)
980
+ `}function Mh(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":mt(t);if(Array.isArray(n)){let s=n.map(c=>e(c)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:f}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return i?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return i?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:f,symbol:">="}];for(let{value:h,symbol:m}of p)if(h!==void 0)return i?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return i?`${o} = ${e(n)}`:`${a}, Value${t} = ${e(n)}`}).join(", ")}function Uh(r){return r?"length(UnsortedInstances, TotalCount)":""}function jh(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 qh(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function Bh(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Vh(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),n=(t||"").replace(/\/+$/,"");return`${e}://${n}`}else return r.replace(/\/+$/,"")}function up(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 Zm(r,e){return up(r.type)===e}function Ym(r){return Zm(r,"array")}function Qh(r){return Zm(r,"object")}function jS(r){let e=up(r.type);return e==="number"||e==="integer"}function Xm(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
+ - options.namespace
983
+ - schema["x-ad4m"].namespace
984
+ - schema.title
985
+ - valid schema.$id`)}function eg(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=Vh(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=Vh(n);return a.includes("://")?`${a}${e}`:`${a}://${e}`}function qa(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 qS(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 BS(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=Xm(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=eg(e,c,u,n,t),d=e.required?.includes(c)||!1,f=up(u.type);if(Ym(u)){o[c]={through:l,local:qa(c,u,t,"local")},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:[]});let h=`add${mt(c)}`,m=`remove${mt(c)}`,v=`set${mt(c)}`;i.prototype[h]=function(){},i.prototype[m]=function(){},i.prototype[v]=function(){}}else{let h=qa(c,u,t,"resolveLanguage");!h&&t.resolveLanguage&&(h=t.resolveLanguage);let m=qa(c,u,t,"local"),v=qa(c,u,t,"readOnly");if(v===void 0){let b=u["x-ad4m"]?.writable;v=b!==void 0?!b:!1}let _=!v,y=qa(c,u,t,"initial");if(Qh(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&&jS(u)&&(h="literal"),h==null&&(h="literal"),d&&!y&&(Qh(u)?y="literal://json:{}":y="ad4m://undefined"),a[c]={through:l,required:d,writable:_,...h&&{resolveLanguage:h},...m!==void 0&&{local:m},...y&&{initial:y}},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:qS(f)}),_){let b=Oc(c);i.prototype[b]=function(){}}}}for(let[c,u]of Object.entries(a))_b(i,c,u);for(let[c,u]of Object.entries(o))Eb(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,xb({name:t.name})(i),i}function VS(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=>be(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=>be(l)).join(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${be(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${be(c.between[0])} AND ${s} <= ${be(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${be(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${be(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${be(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${be(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${be(c.contains)}`)}else n.push(`${s} = ${be(a)}`)}else{let s=e[i],c=s?.kind==="belongsToOne"||s?.kind==="belongsToMany";if(s){let f=oe(s.predicate);if(Array.isArray(a)){let p=a.map(h=>be(h)).join(", ");c?n.push(`count(<-link[WHERE predicate = '${f}' AND in.uri IN [${p}]]) > 0`):n.push(`count(->link[WHERE predicate = '${f}' AND out.uri IN [${p}]]) > 0`)}else if(typeof a=="object"&&a!==null){let p=a;if(p.not!==void 0)if(Array.isArray(p.not)){let h=p.not.map(m=>be(m)).join(", ");c?n.push(`count(<-link[WHERE predicate = '${f}' AND in.uri IN [${h}]]) = 0`):n.push(`count(->link[WHERE predicate = '${f}' AND out.uri IN [${h}]]) = 0`)}else c?n.push(`count(<-link[WHERE predicate = '${f}' AND in.uri = ${be(p.not)}]) = 0`):n.push(`count(->link[WHERE predicate = '${f}' AND out.uri = ${be(p.not)}]) = 0`)}else c?n.push(`count(<-link[WHERE predicate = '${f}' AND in.uri = ${be(a)}]) > 0`):n.push(`count(->link[WHERE predicate = '${f}' AND out.uri = ${be(a)}]) > 0`);continue}let u=r.properties[i];if(!u)continue;let l=oe(u.predicate),d=u.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let f=a.map(p=>be(p)).join(", ");n.push(`count(->link[WHERE predicate = '${l}' AND ${d} 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=>be(m)).join(", ");n.push(`count(->link[WHERE predicate = '${l}' AND ${d} IN [${h}]]) = 0`)}else n.push(`count(->link[WHERE predicate = '${l}' AND ${d} = ${be(f.not)}]) = 0`);(f.gt!==void 0||f.gte!==void 0||f.lt!==void 0||f.lte!==void 0||f.between!==void 0||f.contains!==void 0)&&n.push(`count(->link[WHERE predicate = '${l}']) > 0`)}else n.push(`count(->link[WHERE predicate = '${l}' AND ${d} = ${be(a)}]) > 0`)}return n.join(" AND ")}function QS(r,e,t,n){let{where:i}=t,a=[];if(t.parent){let u=so(t.parent,n);a.push(`count(<-link[WHERE in.uri = ${be(t.parent.id)} AND predicate = '${oe(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 = '${oe(u.predicate)}' AND out.uri = '${oe(u.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${oe(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 = '${oe(u.predicate)}' AND out.uri = '${oe(u.initial)}']) > 0`):a.push(`count(->link[WHERE predicate = '${oe(u.predicate)}']) > 0`);break}}if(a.length===0){let u=[];for(let[,l]of Object.entries(r.properties))l.predicate&&u.push(`predicate = '${oe(l.predicate)}'`);if(r.relations)for(let[,l]of Object.entries(r.relations))l.predicate&&u.push(`predicate = '${oe(l.predicate)}'`);u.length>0&&a.push(`count(->link[WHERE (${u.join(" OR ")})]) > 0`)}let o=VS(r,e,i),s=[];return s.push(...a),o&&s.push(o),s.push("count(->link) > 0"),`
986
+ SELECT
987
+ id AS source,
988
+ uri AS source_uri,
989
+ ->link AS links
990
+ FROM node
991
+ WHERE ${s.join(" AND ")}
992
+ FETCH links
993
+ `.trim()}var Kl=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:d,totalCount:f}=await this.ctor.instancesFromSurrealResult(this.perspective,i,l);n({results:d,totalCount:f,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:d,totalCount:f}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);n({results:d,totalCount:f,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 Bs(r){return Array.isArray(r)?r.map(e=>e&&typeof e=="object"&&typeof e.id=="string"?e.id:e):r}function zh(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 zS(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=_e.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 Hh(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,d=[];for(let[h,m]of Object.entries(t.relations))if(!m.getter){if(m.target&&m.filter!==!1){d.push([h,m]);continue}l.set(m.predicate,[h,m])}for(let[h,m]of d)l.has(m.predicate)||l.set(m.predicate,[h,m]);let f=new Map,p=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){f.get(g[0]),f.set(g[0],{target:_,timestamp:b});continue}let T=l.get(v);if(T){let[N]=T,A=p.get(N);A||(A=[],p.set(N,A)),A.push({target:_,timestamp:b??"",index:h})}}for(let[h,{target:m}]of f){let[,v]=u.get(t.properties[h].predicate),_=typeof r[h];r[h]=await zS(m,v,n,_!=="undefined"?_:void 0)}for(let[h,m]of p)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 HS(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 d=Array.from(o,h=>h.codePointAt(0)),f=d.every(h=>h<=255),p=d.some(h=>h>=128);if(f&&p)try{let h=Uint8Array.from(d),m=new TextDecoder("utf-8",{fatal:!0}).decode(h);m!==o&&(c=m)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${a}"`,{value:o,error:h})}}if(s){let d=await r.getExpression(o);if(d)try{c=JSON.parse(d.data)}catch{c=d.data}}let l=Jn(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 WS(r,e){let t=pm(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 Wh(r,e,t,n){let i=be(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 d=u.target?.(),f=d?d.getModelMetadata?.()??null:null,p=lm(u.where,f);p.length>0&&(l=`(->link[WHERE predicate = '${oe(u.predicate)}'].out[WHERE ${p.join(" AND ")}].uri)`)}catch{}if(!l&&u.target&&u.filter!==!1&&u.direction!=="reverse")try{let d=u.target();l=WS(u.predicate,d),l||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${s}" (predicate: "${u.predicate}")`)}catch(d){console.warn(`[Ad4mModel] auto-generation failed for relation "${s}":`,d)}if(l)try{let f=`SELECT (${l.replace(/Base/g,i)}) AS value FROM node WHERE uri = ${i}`,p=await e.querySurrealDB(f);if(p&&p.length>0&&p[0].value!==void 0&&p[0].value!==null){let h=p[0].value;r[s]=Array.isArray(h)?h.filter(m=>m!=null&&m!==""&&m!=="None"):h}}catch(d){console.warn(`Failed to evaluate getter for ${s}:`,d)}}}async function fo(r,e,t,n){if(!n||Object.keys(n).length===0)return;let i=dr(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 he({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 T=new c(t,g);await T.get(),_[a]=T}catch{_[a]=null}}else{let g=[];if(u&&(u.where||u.order||u.properties)){let T={id:b,...u.where??{}};g=await c.findAll(t,{where:T,...u.order&&{order:u.order},...u.properties&&{properties:u.properties}})}else await Promise.all(b.map(async T=>{try{let N=new c(t,T);await N.get(u?.properties?{properties:u.properties}:void 0),g.push(N)}catch{}}));if(u?.order&&!(u.where||u.properties)){let T=Object.entries(u.order);g=g.sort((N,A)=>{for(let[D,L]of T){let R=String(N[D]??""),j=String(A[D]??""),Ae=R.localeCompare(j);if(Ae!==0)return L==="DESC"?-Ae:Ae}return 0})}if(u?.offset!=null||u?.limit!=null){let T=u.offset??0,N=u.limit!=null?T+u.limit:void 0;g=g.slice(T,N)}_[a]=g,l&&g.length>0&&await fo(c,g,t,l)}}continue}let d=new Set,f=new Map;for(let _ of e){let y=_[a];if(f.set(_,Array.isArray(y)?[...y]:y),y!=null)if(Array.isArray(y))for(let b of y)typeof b=="string"?d.add(b):b&&typeof b=="object"&&typeof b.id=="string"&&d.add(b.id);else typeof y=="string"?d.add(y):y&&typeof y=="object"&&typeof y.id=="string"&&d.add(y.id)}if(d.size===0)continue;let p=new Map,m={where:{id:Array.from(d),...u?.where??{}},...u?.order&&{order:u.order},...u?.properties&&{properties:u.properties}},v=await c.findAll(t,m);for(let _ of v)p.set(_.id,_);for(let _ of e){let y=f.get(_);if(y!=null)if(Array.isArray(y)){let b=y.map(g=>typeof g=="string"?p.has(g)?p.get(g):null:g&&typeof g=="object"&&typeof g.id=="string"?p.has(g.id)?p.get(g.id):g:null).filter(g=>g!==null);if(u?.order){let g=Object.entries(u.order);b=b.sort((T,N)=>{for(let[A,D]of g){let L=String(T[A]??""),R=String(N[A]??""),j=L.localeCompare(R);if(j!==0)return D==="DESC"?-j:j}return 0})}if(u?.offset!=null||u?.limit!=null){let g=u.offset??0,T=u.limit!=null?g+u.limit:void 0;b=b.slice(g,T)}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"&&p.has(y)?_[a]=p.get(y):y&&typeof y=="object"&&typeof y.id=="string"&&(_[a]=p.has(y.id)?p.get(y.id):y)}if(l){let _=Array.from(p.values());await fo(c,_,t,l)}}}var ea=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===ea)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=Jn(this);for(let[d,f]of Object.entries(i)){let p=f;n[d]={name:d,predicate:p.through||"",required:p.required||!1,readOnly:!(p.writable??!1),...p.initial!==void 0&&{initial:p.initial},...p.resolveLanguage!==void 0&&{resolveLanguage:p.resolveLanguage},...p.prologGetter!==void 0&&{prologGetter:p.prologGetter},...p.getter!==void 0&&{getter:p.getter},...p.prologSetter!==void 0&&{prologSetter:p.prologSetter},...p.local!==void 0&&{local:p.local},...p.transform!==void 0&&{transform:p.transform},...p.flag!==void 0&&{flag:p.flag}}}let a={},o=dr(this),s=Object.fromEntries(Object.entries(o).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany"));for(let[d,f]of Object.entries(s)){let p=f;a[d]={name:d,predicate:p.predicate||"",...p.local!==void 0&&{local:p.local},...p.getter!==void 0&&{getter:p.getter},direction:p.kind==="belongsToMany"||p.kind==="belongsToOne"?"reverse":"forward",...p.target!==void 0&&{target:p.target},...p.filter!==void 0&&{filter:p.filter},...p.where!==void 0&&{where:p.where}}}let c=Object.keys(n).length>0,u=Object.keys(a).length>0;if(!(c||u)&&e.__jsonSchema){let d=e.__jsonSchema,f=e.__jsonSchemaOptions||{};if(d.properties)for(let[p,h]of Object.entries(d.properties)){let m=Ym(h),v=eg(d,p,h,Xm(d,f),f);if(m)a[p]={name:p,predicate:v,...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}};else{let _=d.required?.includes(p)||!1;n[p]={name:p,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||_e.from(cm(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 Jn(t)[e]}getRelationOptions(e){let t=this.constructor;return dr(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 HS(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]=Bs(Array.isArray(o)?[...o]:o)}if(e===void 0)for(let a of Object.keys(n.relations)){let o=this[a];i[a]=Bs(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]=Bs(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=Bs(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,d)=>l!==u[d]))&&n.push(a)}else o!==s&&n.push(a)}return n}async getData(e){try{let t=this.constructor,n=t.getModelMetadata(),a=`
994
+ SELECT id, predicate, out.uri AS target, author, timestamp
995
+ FROM link
996
+ WHERE in.uri = ${be(this._baseExpression)}
997
+ 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 Hh(this,o,n,this._perspective,l)}let s=dr(t),c=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[l,d]of Object.entries(s)){if(d.kind!=="belongsToOne"&&d.kind!=="belongsToMany"||c&&!c.has(l))continue;let p=(await this._perspective.get(new he({predicate:d.predicate,target:this._baseExpression}))).filter(h=>h.data.target===this._baseExpression).map(h=>h.data.source);d.kind==="belongsToOne"?this[l]=p.length>0?p[p.length-1]:null:this[l]=p}let u=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await Wh(this,this._perspective,n,u),e?.include&&await fo(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),d=t.parent?so(t.parent,this):void 0,f=[Fh(),Lh(t.parent,d),US(i),Mh(a)],p=[Uh(u),jh(o),qh(s),Bh(c)];return`
999
+ findall([Base, Properties, Collections, Timestamp, Author], (
1000
+ subject_class("${l}", SubjectClass),
1001
+ instance(SubjectClass, Base),
1002
+ ${f.filter(m=>m).join(", ")}
1003
+ ), UnsortedInstances),
1004
+ ${p.filter(m=>m).join(", ")}
1005
+ `}static async queryToSurrealQL(e,t){let n=this.getModelMetadata(),i=dr(this);return QS(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,d,f])=>{try{let p=new this(e,c);i.length&&Object.keys(p).forEach(m=>{!i.includes(m)&&m!=="createdAt"&&m!=="updatedAt"&&m!=="author"&&m!=="id"&&m!=="baseExpression"&&delete p[m]});let h=[...u,...l,["createdAt",d],["author",f]];return await ea.assignValuesToInstance(e,p,h),p}catch(p){return console.error(`Failed to process instance ${c}:`,p),null}}))).filter(c=>c!==null);t.include&&o.length>0&&await fo(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 Hh(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=dr(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 he({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 Wh(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(!zh(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)&&!zh(m[v],_))return!1}}return!0}));let d=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(d){let m=Object.entries(d);l.sort((v,_)=>{for(let[y,b]of m){let g=v[y],T=_[y];if(g===void 0&&T===void 0)continue;if(g===void 0)return b==="ASC"?1:-1;if(T===void 0)return b==="ASC"?-1:1;let N=0;if(typeof g=="number"&&typeof T=="number"?N=g-T:typeof g=="string"&&typeof T=="string"?N=g.localeCompare(T):N=String(g).localeCompare(String(T)),N!==0)return b==="DESC"?-N:N}return 0})}let f=l.length,p=l;if(t.offset!==void 0||t.limit!==void 0){let m=t.offset||0,v=t.limit?m+t.limit:void 0;p=l.slice(m,v)}t.include&&p.length>0&&await fo(this,p,e,t.include);let h=t.include;for(let m of p)m.takeSnapshot(h);return{results:p,totalCount:f}}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?so(t.parent,this):void 0,s=[Fh(),Lh(t.parent,o),Mh(i)],c=[Uh(!0),jh(),qh(),Bh()];return`
1006
+ findall([Base, Properties, Collections, Timestamp, Author], (
1007
+ subject_class("${a}", SubjectClass),
1008
+ instance(SubjectClass, Base),
1009
+ ${s.filter(l=>l).join(", ")}
1010
+ ), UnsortedInstances),
1011
+ ${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(([f,p])=>f!==c&&p.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 he({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 he({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=so(n.parent,this),s=new Et({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=so(n.parent,this),o=new Et({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 Kl(e,this,t)}static fromJSONSchema(e,t){return BS(this,e,t)}};ea.classNamesByClass=new WeakMap;function lp(r){return r.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function GS(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
+ `);return`${r}(X) :-
1014
+ ${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
+ `);return`${r}(X) :-
1016
+ ${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
+ `);return`${r}(X) :-
1018
+ (${o}).`}return null}function KS(r,e){return e.flag||!e.predicate?null:`${`${r}_${lp(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function JS(r,e){if(!e.predicate)return null;let t=`${r}_${lp(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 GO(r){let e=r.getModelMetadata(),t=lp(e.className),n=[];n.push(`% ${e.className} \u2014 generated Prolog facts`);let i=GS(t,e);i&&(n.push(""),n.push("% Instance recognizer"),n.push(i));let a=Object.values(e.properties).map(s=>KS(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=>JS(t,s)).filter(s=>s!==null);return o.length>0&&(n.push(""),n.push("% Relation getters"),n.push(...o)),n.join(`
1019
+ `)}var KO=`
953
1020
  type AIModelLoadingStatus {
954
1021
  downloaded: Boolean!
955
1022
  loaded: Boolean!
@@ -1090,6 +1157,12 @@ type ExpressionRendered {
1090
1157
  timestamp: String!
1091
1158
  }
1092
1159
 
1160
+ type HostingUserInfo {
1161
+ email: String!
1162
+ hotWalletAddress: String
1163
+ remainingCredits: String!
1164
+ }
1165
+
1093
1166
  type Icon {
1094
1167
  code: String!
1095
1168
  }
@@ -1325,7 +1398,9 @@ type Mutation {
1325
1398
  runtimeRemoveNotification(id: String!): Boolean!
1326
1399
  runtimeRequestInstallNotification(notification: NotificationInput!): String!
1327
1400
  runtimeRequestLoginVerification(appInfo: AuthInfoInput, email: String!): VerificationRequestResult!
1401
+ runtimeRequestPayment(amountHOT: String!): PaymentRequestResult!
1328
1402
  runtimeRestartHolochain: Boolean!
1403
+ runtimeSetHotWalletAddress(address: String!): Boolean!
1329
1404
  runtimeSetMultiUserEnabled(enabled: Boolean!): Boolean!
1330
1405
  runtimeSetStatus(status: PerspectiveInput!): Boolean!
1331
1406
  runtimeTestEmail(to: String!): Boolean!
@@ -1374,6 +1449,11 @@ type OnlineAgent {
1374
1449
  status: PerspectiveExpression!
1375
1450
  }
1376
1451
 
1452
+ type PaymentRequestResult {
1453
+ message: String!
1454
+ success: Boolean!
1455
+ }
1456
+
1377
1457
  type Perspective {
1378
1458
  links: [LinkExpression!]!
1379
1459
  }
@@ -1435,6 +1515,7 @@ type Query {
1435
1515
  runtimeFriends: [String!]!
1436
1516
  runtimeGetNetworkMetrics: String!
1437
1517
  runtimeHcAgentInfos: String!
1518
+ runtimeHostingUserInfo: HostingUserInfo!
1438
1519
  runtimeInfo: RuntimeInfo!
1439
1520
  runtimeKnownLinkLanguageTemplates: [String!]!
1440
1521
  runtimeListUsers: [UserStatistics!]!
@@ -1535,79 +1616,24 @@ input VoiceActivityParamsInput {
1535
1616
  startWindow: Float
1536
1617
  timeBeforeSpeech: Float
1537
1618
  }
1538
- `,$=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},_=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Y=function(r,e){return function(t,n){e(t,n,r)}},Co=new un;Co.author="did:ad4m:test";Co.timestamp=Date.now();Co.data={source:"root",target:"neighbourhood://Qm12345"};Co.proof={signature:"",key:"",valid:!0};var tn=new Kn;tn.author="did:ad4m:test";tn.timestamp=Date.now().toString();tn.proof=new Rr("","");tn.data=new br([Co]);var xc=class{};$([S(),_("design:type",String)],xc.prototype,"recipient",void 0);$([S(),_("design:type",Kn)],xc.prototype,"message",void 0);xc=$([H()],xc);var ea=class{};$([S(),_("design:type",String)],ea.prototype,"ad4mExecutorVersion",void 0);$([S(),_("design:type",Boolean)],ea.prototype,"isInitialized",void 0);$([S(),_("design:type",Boolean)],ea.prototype,"isUnlocked",void 0);ea=$([H()],ea);var ti=class{};$([S(),_("design:type",String)],ti.prototype,"title",void 0);$([S(),_("design:type",String)],ti.prototype,"message",void 0);$([S(),_("design:type",String)],ti.prototype,"type",void 0);$([S(),_("design:type",String)],ti.prototype,"addon",void 0);ti=$([H()],ti);var Qt=class{};$([S(),_("design:type",String)],Qt.prototype,"description",void 0);$([S(),_("design:type",String)],Qt.prototype,"appName",void 0);$([S(),_("design:type",String)],Qt.prototype,"appUrl",void 0);$([S(),_("design:type",String)],Qt.prototype,"appIconPath",void 0);$([S(),_("design:type",String)],Qt.prototype,"trigger",void 0);$([S(),_("design:type",Array)],Qt.prototype,"perspectiveIds",void 0);$([S(),_("design:type",String)],Qt.prototype,"webhookUrl",void 0);$([S(),_("design:type",String)],Qt.prototype,"webhookAuth",void 0);Qt=$([Ge()],Qt);var Ct=class{};$([S(),_("design:type",String)],Ct.prototype,"id",void 0);$([S(),_("design:type",Boolean)],Ct.prototype,"granted",void 0);$([S(),_("design:type",String)],Ct.prototype,"description",void 0);$([S(),_("design:type",String)],Ct.prototype,"appName",void 0);$([S(),_("design:type",String)],Ct.prototype,"appUrl",void 0);$([S(),_("design:type",String)],Ct.prototype,"appIconPath",void 0);$([S(),_("design:type",String)],Ct.prototype,"trigger",void 0);$([S(),_("design:type",Array)],Ct.prototype,"perspectiveIds",void 0);$([S(),_("design:type",String)],Ct.prototype,"webhookUrl",void 0);$([S(),_("design:type",String)],Ct.prototype,"webhookAuth",void 0);Ct=$([H()],Ct);var ta=class{};$([S(),_("design:type",Ct)],ta.prototype,"notification",void 0);$([S(),_("design:type",String)],ta.prototype,"perspectiveId",void 0);$([S(),_("design:type",String)],ta.prototype,"triggerMatch",void 0);ta=$([H()],ta);var He=class{};$([S(),_("design:type",Number)],He.prototype,"total",void 0);$([S(),_("design:type",Number)],He.prototype,"imported",void 0);$([S(),_("design:type",Number)],He.prototype,"failed",void 0);$([S(),_("design:type",Number)],He.prototype,"omitted",void 0);$([S(),_("design:type",Array)],He.prototype,"errors",void 0);He=$([H()],He);var Nt=class{};$([S(),_("design:type",He)],Nt.prototype,"perspectives",void 0);$([S(),_("design:type",He)],Nt.prototype,"links",void 0);$([S(),_("design:type",He)],Nt.prototype,"expressions",void 0);$([S(),_("design:type",He)],Nt.prototype,"perspectiveDiffs",void 0);$([S(),_("design:type",He)],Nt.prototype,"notifications",void 0);$([S(),_("design:type",He)],Nt.prototype,"models",void 0);$([S(),_("design:type",He)],Nt.prototype,"defaultModels",void 0);$([S(),_("design:type",He)],Nt.prototype,"tasks",void 0);$([S(),_("design:type",He)],Nt.prototype,"friends",void 0);$([S(),_("design:type",He)],Nt.prototype,"trustedAgents",void 0);$([S(),_("design:type",He)],Nt.prototype,"knownLinkLanguages",void 0);Nt=$([H()],Nt);var ra=class{};$([S(),_("design:type",String)],ra.prototype,"email",void 0);$([S(),_("design:type",String)],ra.prototype,"did",void 0);$([S(),_("design:type",String)],ra.prototype,"lastSeen",void 0);$([S(),_("design:type",Number)],ra.prototype,"perspectiveCount",void 0);ra=$([H()],ra);var ri=class{};$([S(),_("design:type",Boolean)],ri.prototype,"success",void 0);$([S(),_("design:type",String)],ri.prototype,"message",void 0);$([S(),_("design:type",Boolean)],ri.prototype,"requiresPassword",void 0);$([S(),_("design:type",Boolean)],ri.prototype,"isExistingUser",void 0);ri=$([H()],ri);var B=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return tn}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[tn]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:tn}]}runtimeMessageReceived(){return tn}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Bl.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 Jn("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}};$([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],B.prototype,"runtimeQuit",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],B.prototype,"runtimeOpenLink",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",ea)],B.prototype,"runtimeInfo",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],B.prototype,"addTrustedAgents",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],B.prototype,"deleteTrustedAgents",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],B.prototype,"getTrustedAgents",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],B.prototype,"runtimeKnownLinkLanguageTemplates",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],B.prototype,"runtimeAddKnownLinkLanguageTemplates",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],B.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],B.prototype,"runtimeFriends",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],B.prototype,"runtimeAddFriends",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],B.prototype,"runtimeRemoveFriends",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",String)],B.prototype,"runtimeHcAgentInfos",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",String)],B.prototype,"runtimeGetNetworkMetrics",null);$([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],B.prototype,"runtimeRestartHolochain",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Object]),_("design:returntype",Boolean)],B.prototype,"runtimeHcAddAgentInfos",null);$([$t(),Y(0,Z()),Y(1,Z()),Y(2,Z()),Y(3,Z()),_("design:type",Function),_("design:paramtypes",[String,String,String,String]),_("design:returntype",void 0)],B.prototype,"runtimeVerifyStringSignedByDid",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[br]),_("design:returntype",Boolean)],B.prototype,"runtimeSetStatus",null);$([$t(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Kn)],B.prototype,"runtimeFriendStatus",null);$([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,sc]),_("design:returntype",Boolean)],B.prototype,"runtimeFriendSendMessage",null);$([$t(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Array)],B.prototype,"runtimeMessageInbox",null);$([$t(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Array)],B.prototype,"runtimeMessageOutbox",null);$([Wl(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Kn)],B.prototype,"runtimeMessageReceived",null);$([Wl(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",ti)],B.prototype,"exceptionOccurred",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Qt]),_("design:returntype",String)],B.prototype,"runtimeRequestInstallNotification",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],B.prototype,"runtimeNotifications",null);$([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,Qt]),_("design:returntype",Boolean)],B.prototype,"runtimeUpdateNotification",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],B.prototype,"runtimeRemoveNotification",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],B.prototype,"runtimeGrantNotification",null);$([Wl(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",ta)],B.prototype,"runtimeNotificationTriggered",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],B.prototype,"runtimeExportDb",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],B.prototype,"runtimeImportDb",null);$([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",Boolean)],B.prototype,"runtimeExportPerspective",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],B.prototype,"runtimeImportPerspective",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],B.prototype,"runtimeMultiUserEnabled",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Boolean]),_("design:returntype",Boolean)],B.prototype,"runtimeSetMultiUserEnabled",null);$([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],B.prototype,"runtimeListUsers",null);$([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,wr]),_("design:returntype",ri)],B.prototype,"runtimeRequestLoginVerification",null);$([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),_("design:type",Function),_("design:paramtypes",[String,String,String]),_("design:returntype",String)],B.prototype,"runtimeVerifyEmailCode",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],B.prototype,"runtimeTestEmail",null);$([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),_("design:type",Function),_("design:paramtypes",[String,String,wr]),_("design:returntype",Jn)],B.prototype,"runtimeCreateUser",null);$([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",String)],B.prototype,"runtimeLoginUser",null);$([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeEnable",null);$([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeDisable",null);$([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",String)],B.prototype,"runtimeEmailTestGetCode",null);$([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],B.prototype,"runtimeEmailTestClearCodes",null);$([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),_("design:type",Function),_("design:paramtypes",[String,String,Number]),_("design:returntype",Boolean)],B.prototype,"runtimeEmailTestSetExpiry",null);B=$([ab()],B);function ec(r){return r.charAt(0).toUpperCase()+r.slice(1)}function ja(r,e){if("predicate"in r)return r.predicate;let{model:t}=r,n=dr(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 $h(r,e){return!r||!e?"":`triple("${r.id}", "${e}", Base)`}function Dh(){return`
1539
- findall(
1540
- [T, A],
1541
- link(Base, _, _, T, A),
1542
- AllLinks
1543
- ),
1544
- sort(AllLinks, SortedLinks),
1545
- SortedLinks = [[Timestamp, Author]|_]
1546
- `}function TS(r){return`
1547
- findall([PropertyName, PropertyValue, Resolve], (
1548
- % Constrain to specified properties if provided
1549
- ${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
1550
- resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
1551
- ), Properties)
1552
- `}function Rh(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":ec(t);if(Array.isArray(n)){let s=n.map(c=>e(c)).join(", ");return i?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof n=="object"&&n!==null){let{not:s,between:c,lt:u,lte:l,gt:d,gte:f}=n;if(s!==void 0)if(Array.isArray(s)){let m=s.map(h=>e(h)).join(", ");return i?`\\+ member(${o}, [${m}])`:`${a}, \\+ member(Value${t}, [${m}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return i?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:d,symbol:">"},{value:f,symbol:">="}];for(let{value:m,symbol:h}of p)if(m!==void 0)return i?`${o} ${h} ${m}`:`${a}, Value${t} ${h} ${m}`}return i?`${o} = ${e(n)}`:`${a}, Value${t} = ${e(n)}`}).join(", ")}function Lh(r){return r?"length(UnsortedInstances, TotalCount)":""}function Ph(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(`,
1553
- `)}function Fh(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function Mh(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function jh(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),n=(t||"").replace(/\/+$/,"");return`${e}://${n}`}else return r.replace(/\/+$/,"")}function ap(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 zm(r,e){return ap(r.type)===e}function Uh(r){return zm(r,"array")}function qh(r){return zm(r,"object")}function OS(r){let e=ap(r.type);return e==="number"||e==="integer"}var Zt=class{static generateSDNA(){return{sdna:"",name:""}}static generateSHACL(){return{shape:null,name:""}}static async getClassName(e){if(this===Zt)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=an(this);for(let[d,f]of Object.entries(i)){let p=f;n[d]={name:d,predicate:p.through||"",required:p.required||!1,readOnly:!(p.writable??!1),...p.initial!==void 0&&{initial:p.initial},...p.resolveLanguage!==void 0&&{resolveLanguage:p.resolveLanguage},...p.prologGetter!==void 0&&{prologGetter:p.prologGetter},...p.getter!==void 0&&{getter:p.getter},...p.prologSetter!==void 0&&{prologSetter:p.prologSetter},...p.local!==void 0&&{local:p.local},...p.transform!==void 0&&{transform:p.transform},...p.flag!==void 0&&{flag:p.flag}}}let a={},o=dr(this),s=Object.fromEntries(Object.entries(o).filter(([,d])=>d.kind==="hasMany"||d.kind==="belongsToMany"));for(let[d,f]of Object.entries(s)){let p=f;a[d]={name:d,predicate:p.predicate||"",...p.local!==void 0&&{local:p.local},...p.getter!==void 0&&{getter:p.getter},direction:p.kind==="belongsToMany"||p.kind==="belongsToOne"?"reverse":"forward",...p.target!==void 0&&{target:p.target},...p.filter!==void 0&&{filter:p.filter},...p.where!==void 0&&{where:p.where}}}let c=Object.keys(n).length>0,u=Object.keys(a).length>0;if(!(c||u)&&e.__jsonSchema){let d=e.__jsonSchema,f=e.__jsonSchemaOptions||{};if(d.properties)for(let[p,m]of Object.entries(d.properties)){let h=Uh(m),g=this.determinePredicate(d,p,m,this.determineNamespace(d,f),f);if(h)a[p]={name:p,predicate:g,...m["x-ad4m"]?.local!==void 0&&{local:m["x-ad4m"].local}};else{let b=d.required?.includes(p)||!1;n[p]={name:p,predicate:g,required:b,readOnly:m["x-ad4m"]?.writable===!1,...m["x-ad4m"]?.resolveLanguage&&{resolveLanguage:m["x-ad4m"].resolveLanguage},...m["x-ad4m"]?.initial&&{initial:m["x-ad4m"].initial},...m["x-ad4m"]?.local!==void 0&&{local:m["x-ad4m"].local}}}}}return{className:t,properties:n,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||Se.from(am(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 an(t)[e]}getRelationOptions(e){let t=this.constructor;return dr(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 hydratePropertyValue(e,t,n,i){let a=e;if(e!=null&&e!=="")if(t.resolveLanguage!=null&&t.resolveLanguage!=="literal"&&typeof e=="string"&&!e.startsWith("literal://"))try{let o=await n.getExpression(e);if(o)try{a=JSON.parse(o.data)}catch{a=o.data}}catch(o){console.warn(`hydratePropertyValue: failed to resolve expression for "${t.name}":`,o)}else if(t.resolveLanguage==="literal"&&typeof e=="string"&&e.startsWith("literal://"))try{let o=Se.fromUrl(e).get();a=o.data!==void 0?o.data:o}catch{}else typeof e=="string"&&i&&(i==="number"?a=Number(e):i==="boolean"&&(a=e==="true"||e==="1"));return t.transform&&typeof t.transform=="function"&&(a=t.transform(a)),a}static async hydrateFromLinks(e,t,n,i,a){if(!t||t.length===0)return;let o=null,s=null,c=null,u=a&&a.length>0?new Set(a):null,l=new Map;for(let[h,g]of Object.entries(n.properties))g.getter||u&&!u.has(h)||l.set(g.predicate,[h,g]);let d=new Map,f=[];for(let[h,g]of Object.entries(n.relations))if(!g.getter){if(g.target&&g.filter!==!1){f.push([h,g]);continue}d.set(g.predicate,[h,g])}for(let[h,g]of f)d.has(g.predicate)||d.set(g.predicate,[h,g]);let p=new Map,m=new Map;for(let h=0;h<t.length;h++){let g=t[h],{predicate:b,target:v,author:w,timestamp:y}=g;if(v==="None"||v===void 0||v===null)continue;y!=null&&((o==null||y<o)&&(o=y,c=w??null),(s==null||y>s)&&(s=y));let k=l.get(b);if(k){p.get(k[0]),p.set(k[0],{target:v,timestamp:y});continue}let C=d.get(b);if(C){let[I]=C,D=m.get(I);D||(D=[],m.set(I,D)),D.push({target:v,timestamp:y??"",index:h})}}for(let[h,{target:g}]of p){let[,b]=l.get(n.properties[h].predicate),v=typeof e[h];e[h]=await this.hydratePropertyValue(g,b,i,v!=="undefined"?v:void 0)}for(let[h,g]of m)g.sort((b,v)=>{let w=String(b.timestamp).localeCompare(String(v.timestamp));return w!==0?w:b.index-v.index}),e[h]=g.map(b=>b.target).filter(b=>b!=null&&b!==""&&b!=="None");c&&(e.author=c),o!=null&&(e.createdAt=typeof o=="string"&&o.includes("T")?new Date(o).getTime():typeof o=="string"?isNaN(parseInt(o,10))?o:parseInt(o,10):o),s!=null&&(e.updatedAt=typeof s=="string"&&s.includes("T")?new Date(s).getTime():typeof s=="string"?isNaN(parseInt(s,10))?s:parseInt(s,10):s)}static async assignValuesToInstance(e,t,n){let i=Object.fromEntries(await Promise.all(n.map(async([o,s,c])=>{let u=s;if(!c&&typeof s=="string"){let f=Array.from(s,h=>h.codePointAt(0)),p=f.every(h=>h<=255),m=f.some(h=>h>=128);if(p&&m)try{let h=Uint8Array.from(f),g=new TextDecoder("utf-8",{fatal:!0}).decode(h);g!==s&&(u=g)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${o}"`,{value:s,error:h})}}if(c){let f=await e.getExpression(s);if(f)try{u=JSON.parse(f.data)}catch{u=f.data}}let d=an(t.constructor)[o]?.transform;return d&&typeof d=="function"&&(u=d(u)),[o,u]}))),a=Object.fromEntries(Object.entries(i).filter(([o])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),o);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(t,a)}static normalizeValue(e){return Array.isArray(e)?e.map(t=>t&&typeof t=="object"&&typeof t.id=="string"?t.id:t):e}takeSnapshot(e){let n=this.constructor.getModelMetadata(),i={};for(let a of Object.keys(n.properties)){let o=this[a];i[a]=Zt.normalizeValue(Array.isArray(o)?[...o]:o)}if(e===void 0)for(let a of Object.keys(n.relations)){let o=this[a];i[a]=Zt.normalizeValue(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]=Zt.normalizeValue(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=Zt.normalizeValue(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,d)=>l!==u[d]))&&n.push(a)}else o!==s&&n.push(a)}return n}async getData(e){try{let t=this.constructor,n=t.getModelMetadata(),a=`
1554
- SELECT id, predicate, out.uri AS target, author, timestamp
1555
- FROM link
1556
- WHERE in.uri = ${t.formatSurrealValue(this._baseExpression)}
1557
- ORDER BY timestamp ASC
1558
- `,o=await this._perspective.querySurrealDB(a);if(o&&o.length>0){let l=e?.properties&&e.properties.length>0?e.properties:void 0;await t.hydrateFromLinks(this,o,n,this._perspective,l)}let s=dr(t),c=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[l,d]of Object.entries(s)){if(d.kind!=="belongsToOne"&&d.kind!=="belongsToMany"||c&&!c.has(l))continue;let p=(await this._perspective.get(new fe({predicate:d.predicate,target:this._baseExpression}))).filter(m=>m.data.target===this._baseExpression).map(m=>m.data.source);d.kind==="belongsToOne"?this[l]=p.length>0?p[p.length-1]:null:this[l]=p}let u=e?.properties||e?.include?{requestedProperties:e?.properties,include:e?.include}:void 0;await t.evaluateCustomGettersForInstance(this,this._perspective,n,u),e?.include&&await t.hydrateRelations([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),d=t.parent?ja(t.parent,this):void 0,f=[Dh(),$h(t.parent,d),TS(i),Rh(a)],p=[Lh(u),Ph(o),Fh(s),Mh(c)];return`
1559
- findall([Base, Properties, Collections, Timestamp, Author], (
1560
- subject_class("${l}", SubjectClass),
1561
- instance(SubjectClass, Base),
1562
- ${f.filter(h=>h).join(", ")}
1563
- ), UnsortedInstances),
1564
- ${p.filter(h=>h).join(", ")}
1565
- `}static buildConformanceGetter(e,t){let n=im(e,t);if(!n){let i=t?.prototype?.className||t?.name||"unknown";console.warn(`[Ad4mModel] buildConformanceGetter: no conditions found for target "${i}".`);return}return n.getter}static async evaluateCustomGettersForInstance(e,t,n,i){let a=this.formatSurrealValue(e.id),s=i?.requestedProperties&&i.requestedProperties.length>0?new Set(i.requestedProperties):null;for(let[c,u]of Object.entries(n.properties))if(!(s&&!s.has(c))&&u.getter)try{let l=u.getter.replace(/Base/g,a),d=await t.querySurrealDB(`SELECT (${l}) AS value FROM node WHERE uri = ${a}`);d&&d.length>0&&d[0].value!==void 0&&d[0].value!==null&&d[0].value!=="None"&&d[0].value!==""&&(e[c]=d[0].value)}catch(l){console.warn(`Failed to evaluate getter for ${c}:`,l)}for(let[c,u]of Object.entries(n.relations)){if(s&&!s.has(c)&&!(i?.include&&c in i.include))continue;let l=u,d=l.getter;if(!d&&l.where&&l.direction!=="reverse")try{let f=l.target?.(),p=f?f.getModelMetadata?.()??null:null,m=nm(l.where,p);m.length>0&&(d=`(->link[WHERE predicate = '${ee(l.predicate)}'].out[WHERE ${m.join(" AND ")}].uri)`)}catch{}if(!d&&l.target&&l.filter!==!1&&l.direction!=="reverse")try{let f=l.target();d=this.buildConformanceGetter(l.predicate,f),d||console.warn(`[Ad4mModel] buildConformanceGetter returned undefined for relation "${c}" (predicate: "${l.predicate}")`)}catch(f){console.warn(`[Ad4mModel] auto-generation failed for relation "${c}":`,f)}if(d)try{let p=`SELECT (${d.replace(/Base/g,a)}) AS value FROM node WHERE uri = ${a}`,m=await t.querySurrealDB(p);if(m&&m.length>0&&m[0].value!==void 0&&m[0].value!==null){let h=m[0].value;e[c]=Array.isArray(h)?h.filter(g=>g!=null&&g!==""&&g!=="None"):h}}catch(f){console.warn(`Failed to evaluate getter for ${c}:`,f)}}}static async hydrateRelations(e,t,n){if(!n||Object.keys(n).length===0)return;let i=dr(this);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 b of e){let w=(await t.get(new fe({predicate:s.predicate,target:b.id}))).filter(y=>y.data.target===b.id).map(y=>y.data.source);if(s.kind==="belongsToOne"){if(w.length===0){b[a]=null;continue}let y=w[w.length-1];try{let k=new c(t,y);await k.get(),b[a]=k}catch{b[a]=null}}else{let y=[];if(u&&(u.where||u.order||u.properties)){let k={id:w,...u.where??{}};y=await c.findAll(t,{where:k,...u.order&&{order:u.order},...u.properties&&{properties:u.properties}})}else await Promise.all(w.map(async k=>{try{let C=new c(t,k);await C.get(u?.properties?{properties:u.properties}:void 0),y.push(C)}catch{}}));if(u?.order&&!(u.where||u.properties)){let k=Object.entries(u.order);y=y.sort((C,I)=>{for(let[D,P]of k){let R=String(C[D]??""),j=String(I[D]??""),xe=R.localeCompare(j);if(xe!==0)return P==="DESC"?-xe:xe}return 0})}if(u?.offset!=null||u?.limit!=null){let k=u.offset??0,C=u.limit!=null?k+u.limit:void 0;y=y.slice(k,C)}b[a]=y,l&&y.length>0&&await c.hydrateRelations(y,t,l)}}continue}let d=new Set,f=new Map;for(let b of e){let v=b[a];if(f.set(b,Array.isArray(v)?[...v]:v),v!=null)if(Array.isArray(v))for(let w of v)typeof w=="string"?d.add(w):w&&typeof w=="object"&&typeof w.id=="string"&&d.add(w.id);else typeof v=="string"?d.add(v):v&&typeof v=="object"&&typeof v.id=="string"&&d.add(v.id)}if(d.size===0)continue;let p=new Map,h={where:{id:Array.from(d),...u?.where??{}},...u?.order&&{order:u.order},...u?.properties&&{properties:u.properties}},g=await c.findAll(t,h);for(let b of g)p.set(b.id,b);for(let b of e){let v=f.get(b);if(v!=null)if(Array.isArray(v)){let w=v.map(y=>typeof y=="string"?p.has(y)?p.get(y):null:y&&typeof y=="object"&&typeof y.id=="string"?p.has(y.id)?p.get(y.id):y:null).filter(y=>y!==null);if(u?.order){let y=Object.entries(u.order);w=w.sort((k,C)=>{for(let[I,D]of y){let P=String(k[I]??""),R=String(C[I]??""),j=P.localeCompare(R);if(j!==0)return D==="DESC"?-j:j}return 0})}if(u?.offset!=null||u?.limit!=null){let y=u.offset??0,k=u.limit!=null?y+u.limit:void 0;w=w.slice(y,k)}s.maxCount===1?(w.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${w.length} values found; keeping the last`),b[a]=w.length>0?w[w.length-1]:null):b[a]=w}else typeof v=="string"&&p.has(v)?b[a]=p.get(v):v&&typeof v=="object"&&typeof v.id=="string"&&(b[a]=p.has(v.id)?p.get(v.id):v)}if(l){let b=Array.from(p.values());await c.hydrateRelations(b,t,l)}}}static async queryToSurrealQL(e,t){let n=this.getModelMetadata(),{where:i,order:a,offset:o,limit:s}=t,c=[];if(t.parent){let f=ja(t.parent,this);c.push(`count(<-link[WHERE in.uri = ${this.formatSurrealValue(t.parent.id)} AND predicate = '${ee(f)}']) > 0`)}for(let[f,p]of Object.entries(n.properties))if(p.required){if(p.getter)continue;p.flag&&p.initial?c.push(`count(->link[WHERE predicate = '${ee(p.predicate)}' AND out.uri = '${ee(p.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${ee(p.predicate)}']) > 0`)}if(c.length===0){for(let[f,p]of Object.entries(n.properties))if(p.initial){p.flag?c.push(`count(->link[WHERE predicate = '${ee(p.predicate)}' AND out.uri = '${ee(p.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${ee(p.predicate)}']) > 0`);break}}if(c.length===0){let f=[];for(let[,p]of Object.entries(n.properties))p.predicate&&f.push(`predicate = '${ee(p.predicate)}'`);if(n.relations)for(let[,p]of Object.entries(n.relations))p.predicate&&f.push(`predicate = '${ee(p.predicate)}'`);f.length>0&&c.push(`count(->link[WHERE (${f.join(" OR ")})]) > 0`)}let u=this.buildGraphTraversalWhereClause(n,i),l=[];return l.push(...c),u&&l.push(u),l.push("count(->link) > 0"),`
1566
- SELECT
1567
- id AS source,
1568
- uri AS source_uri,
1569
- ->link AS links
1570
- FROM node
1571
- WHERE ${l.join(" AND ")}
1572
- FETCH links
1573
- `.trim()}static buildGraphTraversalWhereClause(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=>this.formatSurrealValue(u)).join(", ");n.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let c=dr(this)[i],u=c?.kind==="belongsToOne"||c?.kind==="belongsToMany";if(c){let p=ee(c.predicate);if(Array.isArray(a)){let m=a.map(h=>this.formatSurrealValue(h)).join(", ");u?n.push(`count(<-link[WHERE predicate = '${p}' AND in.uri IN [${m}]]) > 0`):n.push(`count(->link[WHERE predicate = '${p}' AND out.uri IN [${m}]]) > 0`)}else if(typeof a=="object"&&a!==null){let m=a;if(m.not!==void 0)if(Array.isArray(m.not)){let h=m.not.map(g=>this.formatSurrealValue(g)).join(", ");u?n.push(`count(<-link[WHERE predicate = '${p}' AND in.uri IN [${h}]]) = 0`):n.push(`count(->link[WHERE predicate = '${p}' AND out.uri IN [${h}]]) = 0`)}else u?n.push(`count(<-link[WHERE predicate = '${p}' AND in.uri = ${this.formatSurrealValue(m.not)}]) = 0`):n.push(`count(->link[WHERE predicate = '${p}' AND out.uri = ${this.formatSurrealValue(m.not)}]) = 0`)}else u?n.push(`count(<-link[WHERE predicate = '${p}' AND in.uri = ${this.formatSurrealValue(a)}]) > 0`):n.push(`count(->link[WHERE predicate = '${p}' AND out.uri = ${this.formatSurrealValue(a)}]) > 0`);continue}let l=e.properties[i];if(!l)continue;let d=ee(l.predicate),f=l.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let p=a.map(m=>this.formatSurrealValue(m)).join(", ");n.push(`count(->link[WHERE predicate = '${d}' AND ${f} IN [${p}]]) > 0`)}else if(typeof a=="object"&&a!==null){let p=a;if(p.not!==void 0)if(Array.isArray(p.not)){let h=p.not.map(g=>this.formatSurrealValue(g)).join(", ");n.push(`count(->link[WHERE predicate = '${d}' AND ${f} IN [${h}]]) = 0`)}else n.push(`count(->link[WHERE predicate = '${d}' AND ${f} = ${this.formatSurrealValue(p.not)}]) = 0`);(p.gt!==void 0||p.gte!==void 0||p.lt!==void 0||p.lte!==void 0||p.between!==void 0||p.contains!==void 0)&&n.push(`count(->link[WHERE predicate = '${d}']) > 0`)}else n.push(`count(->link[WHERE predicate = '${d}' AND ${f} = ${this.formatSurrealValue(a)}]) > 0`)}return n.join(" AND ")}static buildSurrealWhereClause(e,t){if(!t)return"";let n=[];for(let[i,a]of Object.entries(t))if(["id","author","timestamp"].includes(i)){if(i==="author"||i==="timestamp")continue;let s="source";if(Array.isArray(a)){let c=a.map(u=>this.formatSurrealValue(u)).join(", ");n.push(`${s} IN [${c}]`)}else if(typeof a=="object"&&a!==null){let c=a;if(c.not!==void 0)if(Array.isArray(c.not)){let u=c.not.map(l=>this.formatSurrealValue(l)).join(", ");n.push(`${s} NOT IN [${u}]`)}else n.push(`${s} != ${this.formatSurrealValue(c.not)}`);c.between!==void 0&&Array.isArray(c.between)&&c.between.length===2&&n.push(`${s} >= ${this.formatSurrealValue(c.between[0])} AND ${s} <= ${this.formatSurrealValue(c.between[1])}`),c.gt!==void 0&&n.push(`${s} > ${this.formatSurrealValue(c.gt)}`),c.gte!==void 0&&n.push(`${s} >= ${this.formatSurrealValue(c.gte)}`),c.lt!==void 0&&n.push(`${s} < ${this.formatSurrealValue(c.lt)}`),c.lte!==void 0&&n.push(`${s} <= ${this.formatSurrealValue(c.lte)}`),c.contains!==void 0&&n.push(`${s} CONTAINS ${this.formatSurrealValue(c.contains)}`)}else n.push(`${s} = ${this.formatSurrealValue(a)}`)}else{let s=e.properties[i];if(!s)continue;let c=ee(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(d=>this.formatSurrealValue(d)).join(", ");n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${l}])`)}else if(typeof a=="object"&&a!==null){let l=a;if(l.not!==void 0)if(Array.isArray(l.not)){let f=l.not.map(p=>this.formatSurrealValue(p)).join(", ");n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${f}])`)}else n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(l.not)})`);(l.gt!==void 0||l.gte!==void 0||l.lt!==void 0||l.lte!==void 0||l.between!==void 0||l.contains!==void 0)&&n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}')`)}else n.push(`source IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} = ${this.formatSurrealValue(a)})`)}return n.join(" AND ")}static buildSurrealSelectFields(e,t,n){let i=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=ee(c.predicate);i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}' LIMIT 1) AS ${s}`)}let o=n||Object.keys(e.relations);for(let s of o){let c=e.relations[s];if(!c)continue;let u=ee(c.predicate);i.push(`(SELECT VALUE target FROM link WHERE source = source AND predicate = '${u}') AS ${s}`)}return i.push("(SELECT VALUE author FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS author"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp ASC LIMIT 1) AS createdAt"),i.push("(SELECT VALUE timestamp FROM link WHERE source = source ORDER BY timestamp DESC LIMIT 1) AS updatedAt"),i.join(`,
1574
- `)}static buildSurrealSelectFieldsWithAggregation(e,t,n){let i=[],a=t||Object.keys(e.properties);for(let s of a){let c=e.properties[s];if(!c)continue;let u=ee(c.predicate);i.push(`array::first(target[WHERE predicate = '${u}']) AS ${s}`)}let o=n||Object.keys(e.relations);for(let s of o){let c=e.relations[s];if(!c)continue;let u=ee(c.predicate);i.push(`target[WHERE predicate = '${u}'] AS ${s}`)}return i.push("array::first(author) AS author"),i.push("array::first(timestamp) AS createdAt"),i.push("array::last(timestamp) AS updatedAt"),i.join(`,
1575
- `)}static formatSurrealValue(e){return Qi(e)}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,d,f])=>{try{let p=new this(e,c);i.length&&Object.keys(p).forEach(h=>{!i.includes(h)&&h!=="createdAt"&&h!=="updatedAt"&&h!=="author"&&h!=="id"&&h!=="baseExpression"&&delete p[h]});let m=[...u,...l,["createdAt",d],["author",f]];return await Zt.assignValuesToInstance(e,p,m),p}catch(p){return console.error(`Failed to process instance ${c}:`,p),null}}))).filter(c=>c!==null);t.include&&o.length>0&&await this.hydrateRelations(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 h of n){let g;try{if(g=h.source_uri,!g)continue;let b=h.links||[],v=new this(e,g);if(await this.hydrateFromLinks(v,b,i,e,a.length>0?a:void 0),a.length>0){let w=new Set(a);for(let y of Object.keys(i.properties))w.has(y)||delete v[y];for(let y of Object.keys(i.relations))!w.has(y)&&!(t.include&&y in t.include)&&delete v[y];for(let y of["author","createdAt","updatedAt"])w.has(y)||delete v[y]}o.push(v)}catch(b){console.error(`Failed to process SurrealDB instance ${g}:`,b)}}let s=dr(this),c=Object.entries(s).filter(([h,g])=>(g.kind==="belongsToOne"||g.kind==="belongsToMany")&&(a.length===0||a.includes(h)));c.length>0&&o.length>0&&await Promise.all(o.map(async h=>{for(let[g,b]of c){let w=(await e.get(new fe({predicate:b.predicate,target:h.id}))).filter(y=>y.data.target===h.id).map(y=>y.data.source);b.kind==="belongsToOne"?h[g]=w.length>0?w[w.length-1]:null:h[g]=w}}));let u=a.length>0||t.include?{requestedProperties:a,include:t.include}:void 0;for(let h of o)await this.evaluateCustomGettersForInstance(h,e,i,u);let l=o;t.where&&(l=o.filter(h=>{for(let[g,b]of Object.entries(t.where))if(g!=="base"){if(g==="author"||g==="timestamp"){if(!this.matchesCondition(h[g],b))return!1;continue}if(typeof b=="object"&&b!==null&&!Array.isArray(b)){let v=b;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)&&!this.matchesCondition(h[g],b))return!1}}return!0}));let d=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(d){let h=Object.entries(d);l.sort((g,b)=>{for(let[v,w]of h){let y=g[v],k=b[v];if(y===void 0&&k===void 0)continue;if(y===void 0)return w==="ASC"?1:-1;if(k===void 0)return w==="ASC"?-1:1;let C=0;if(typeof y=="number"&&typeof k=="number"?C=y-k:typeof y=="string"&&typeof k=="string"?C=y.localeCompare(k):C=String(y).localeCompare(String(k)),C!==0)return w==="DESC"?-C:C}return 0})}let f=l.length,p=l;if(t.offset!==void 0||t.limit!==void 0){let h=t.offset||0,g=t.limit?h+t.limit:void 0;p=l.slice(h,g)}t.include&&p.length>0&&await this.hydrateRelations(p,e,t.include);let m=t.include;for(let h of p)h.takeSnapshot(m);return{results:p,totalCount:f}}static matchesCondition(e,t){if(Array.isArray(t))return t.includes(e);if(typeof t=="object"&&t!==null){let n=t;if(n.not!==void 0)return Array.isArray(n.not)?!n.not.includes(e):e!==n.not;if(n.between!==void 0&&Array.isArray(n.between)&&n.between.length===2)return e>=n.between[0]&&e<=n.between[1];let i=!0;return n.gt!==void 0&&(i=i&&e>n.gt),n.gte!==void 0&&(i=i&&e>=n.gte),n.lt!==void 0&&(i=i&&e<n.lt),n.lte!==void 0&&(i=i&&e<=n.lte),n.contains!==void 0&&(typeof e=="string"?i=i&&e.includes(String(n.contains)):Array.isArray(e)?i=i&&e.includes(n.contains):i=!1),i}return e===t}static async findAll(e,t={},n=!0){if(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?ja(t.parent,this):void 0,s=[Dh(),$h(t.parent,o),Rh(i)],c=[Lh(!0),Ph(),Fh(),Mh()];return`
1576
- findall([Base, Properties, Collections, Timestamp, Author], (
1577
- subject_class("${a}", SubjectClass),
1578
- instance(SubjectClass, Base),
1579
- ${s.filter(l=>l).join(", ")}
1580
- ), UnsortedInstances),
1581
- ${c.filter(l=>l).join(", ")}
1582
- `}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;this._subjectClassName=await this._perspective.stringOrTemplateObjectToSubjectClassName(this.cleanCopy());let 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(([f,p])=>f!==c&&p.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,this._subjectClassName=await this._perspective.stringOrTemplateObjectToSubjectClassName(this.cleanCopy()),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=ja(n.parent,this),s=new St({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=ja(n.parent,this),o=new St({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 zl(e,this,t)}static fromJSONSchema(e,t){if(e?.properties&&Object.prototype.hasOwnProperty.call(e.properties,"author"))throw new Error('JSON Schema must not define a top-level "author" property because Ad4mModel already exposes it. Please rename the property (e.g., "writer").');let n=this.determineNamespace(e,t),i=class extends Zt{};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=this.determinePredicate(e,c,u,n,t),d=e.required?.includes(c)||!1,f=ap(u.type);if(Uh(u)){o[c]={through:l,local:this.getPropertyOption(c,u,t,"local")},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:[]});let m=`add${ec(c)}`,h=`remove${ec(c)}`,g=`set${ec(c)}`;i.prototype[m]=function(){},i.prototype[h]=function(){},i.prototype[g]=function(){}}else{let m=this.getPropertyOption(c,u,t,"resolveLanguage");!m&&t.resolveLanguage&&(m=t.resolveLanguage);let h=this.getPropertyOption(c,u,t,"local"),g=this.getPropertyOption(c,u,t,"readOnly");if(g===void 0){let w=u["x-ad4m"]?.writable;g=w!==void 0?!w:!1}let b=!g,v=this.getPropertyOption(c,u,t,"initial");if(qh(u)&&!m&&(m="literal",console.warn(`Property "${c}" is an object type. It will be stored as JSON. Consider flattening complex objects for better semantic querying.`)),m==null&&OS(u)&&(m="literal"),m==null&&(m="literal"),d&&!v&&(qh(u)?v="literal://json:{}":v="ad4m://undefined"),a[c]={through:l,required:d,writable:b,...m&&{resolveLanguage:m},...h!==void 0&&{local:h},...v&&{initial:v}},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:this.getDefaultValueForType(f)}),b){let w=pc(c);i.prototype[w]=function(){}}}}for(let[c,u]of Object.entries(a))pb(i,c,u);for(let[c,u]of Object.entries(o))db(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,fb({name:t.name})(i),i}static determineNamespace(e,t){if(t.namespace)return t.namespace;if(e["x-ad4m"]?.namespace)return e["x-ad4m"].namespace;if(e.title)return`${e.title.toLowerCase()}://`;if(e.$id)try{let i=new URL(e.$id).pathname.split("/").filter(a=>a);if(i.length>0)return`${i[i.length-1].replace(/\.schema\.json$/,"").replace(/\.json$/,"").toLowerCase()}://`}catch{}throw new Error(`Cannot infer namespace for JSON Schema. Please provide one of:
1583
- - options.namespace
1584
- - schema["x-ad4m"].namespace
1585
- - schema.title
1586
- - valid schema.$id`)}static determinePredicate(e,t,n,i,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(n["x-ad4m"]?.through)return n["x-ad4m"].through;if(a.predicateTemplate){let s=jh(i),[c,u]=s.includes("://")?s.split("://"):["",s],l=u||"";return a.predicateTemplate.replace("${namespace}",l).replace("${scheme}",c).replace("${ns}",l).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let o=jh(i);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,n,i,a){return n.propertyOptions?.[e]?.[i]!==void 0?n.propertyOptions[e][i]:t["x-ad4m"]?.[i]!==void 0?t["x-ad4m"][i]:n[i]!==void 0?n[i]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};Zt.classNamesByClass=new WeakMap;var zl=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:d,totalCount:f}=await this.ctor.instancesFromSurrealResult(this.perspective,i,l);n({results:d,totalCount:f,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:d,totalCount:f}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);n({results:d,totalCount:f,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 op(r){return r.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function CS(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(`,
1587
- `);return`${r}(X) :-
1588
- ${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(`,
1589
- `);return`${r}(X) :-
1590
- ${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(` ;
1591
- `);return`${r}(X) :-
1592
- (${o}).`}return null}function NS(r,e){return e.flag||!e.predicate?null:`${`${r}_${op(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function $S(r,e){if(!e.predicate)return null;let t=`${r}_${op(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 zO(r){let e=r.getModelMetadata(),t=op(e.className),n=[];n.push(`% ${e.className} \u2014 generated Prolog facts`);let i=CS(t,e);i&&(n.push(""),n.push("% Instance recognizer"),n.push(i));let a=Object.values(e.properties).map(s=>NS(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=>$S(t,s)).filter(s=>s!==null);return o.length>0&&(n.push(""),n.push("% Relation getters"),n.push(...o)),n.join(`
1593
- `)}var DS=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 No(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 DS(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 RS=12e3,$o=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;No(this),this.options=t,this.port=t.port||parseInt(xs("ad4m-port"))||RS,this.url=t.url||xs("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=xs("ad4m-token")||"",this.embedded=Es(),this.embedded&&this.initializeEmbeddedMode()}connect(){return K(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 Li(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 K(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=Yu({url:this.url,connectionParams:()=>K(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=>K(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 _o(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new Ju({link:new Sf(t),cache:new gs({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,n){return K(this,null,function*(){let i=Yu({url:t,connectionParams:()=>K(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new _o(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return K(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="",La("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return K(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="",La("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=>K(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):La("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 K(this,null,function*(){return t&&(this.token="",La("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 K(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 K(this,null,function*(){try{return yield this.withTempClient(this.url,t=>K(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 K(this,null,function*(){try{return yield this.withTempClient(this.url,t=>K(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 K(this,null,function*(){try{return yield this.withTempClient(this.url,n=>K(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 K(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>K(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 K(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>K(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 K(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>K(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}}))}};var Rc=window,Lc=Rc.ShadowRoot&&(Rc.ShadyCSS===void 0||Rc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,sp=Symbol(),Wm=new WeakMap,Do=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==sp)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Lc&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Wm.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Wm.set(t,e))}return e}toString(){return this.cssText}},Hm=r=>new Do(typeof r=="string"?r:r+"",void 0,sp),Rt=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,a)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[a+1],r[0]);return new Do(t,r,sp)},cp=(r,e)=>{Lc?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let n=document.createElement("style"),i=Rc.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)})},Pc=Lc?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Hm(t)})(r):r;var up,Fc=window,Gm=Fc.trustedTypes,LS=Gm?Gm.emptyScript:"",Km=Fc.reactiveElementPolyfillSupport,pp={toAttribute(r,e){switch(e){case Boolean:r=r?LS:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},Jm=(r,e)=>e!==r&&(e==e||r==r),lp={attribute:!0,type:String,converter:pp,reflect:!1,hasChanged:Jm},dp="finalized",Pr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,n)=>{let i=this._$Ep(n,t);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,t=lp){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){let a=this[e];this[t]=i,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||lp}static finalize(){if(this.hasOwnProperty(dp))return!1;this[dp]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let i of n)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(Pc(i))}else e!==void 0&&t.push(Pc(e));return t}static _$Ep(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return cp(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=lp){var i;let a=this.constructor._$Ep(e,n);if(a!==void 0&&n.reflect===!0){let o=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:pp).toAttribute(t,n.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var n;let i=this.constructor,a=i._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=i.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?o.converter:pp;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||Jm)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((i,a)=>this[a]=i),this._$Ei=void 0);let t=!1,n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var a;return(a=i.hostUpdate)===null||a===void 0?void 0:a.call(i)}),this.update(n)):this._$Ek()}catch(i){throw t=!1,this._$Ek(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,n)=>this._$EO(n,this[n],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Pr[dp]=!0,Pr.elementProperties=new Map,Pr.elementStyles=[],Pr.shadowRootOptions={mode:"open"},Km?.({ReactiveElement:Pr}),((up=Fc.reactiveElementVersions)!==null&&up!==void 0?up:Fc.reactiveElementVersions=[]).push("1.6.3");var fp,Mc=window,ua=Mc.trustedTypes,Zm=ua?ua.createPolicy("lit-html",{createHTML:r=>r}):void 0,mp="$lit$",yn=`lit$${(Math.random()+"").slice(9)}$`,ig="?"+yn,PS=`<${ig}>`,fi=document,Lo=()=>fi.createComment(""),Po=r=>r===null||typeof r!="object"&&typeof r!="function",ag=Array.isArray,FS=r=>ag(r)||typeof r?.[Symbol.iterator]=="function",hp=`[
1594
- \f\r]`,Ro=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Ym=/-->/g,Xm=/>/g,pi=RegExp(`>|${hp}(?:([^\\s"'>=/]+)(${hp}*=${hp}*(?:[^
1595
- \f\r"'\`<>=]|("|')|))|$)`,"g"),eg=/'/g,tg=/"/g,og=/^(?:script|style|textarea|title)$/i,sg=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),M=sg(1),lC=sg(2),hi=Symbol.for("lit-noChange"),Ke=Symbol.for("lit-nothing"),rg=new WeakMap,di=fi.createTreeWalker(fi,129,null,!1);function cg(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Zm!==void 0?Zm.createHTML(e):e}var MS=(r,e)=>{let t=r.length-1,n=[],i,a=e===2?"<svg>":"",o=Ro;for(let s=0;s<t;s++){let c=r[s],u,l,d=-1,f=0;for(;f<c.length&&(o.lastIndex=f,l=o.exec(c),l!==null);)f=o.lastIndex,o===Ro?l[1]==="!--"?o=Ym:l[1]!==void 0?o=Xm:l[2]!==void 0?(og.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=pi):l[3]!==void 0&&(o=pi):o===pi?l[0]===">"?(o=i??Ro,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,u=l[1],o=l[3]===void 0?pi:l[3]==='"'?tg:eg):o===tg||o===eg?o=pi:o===Ym||o===Xm?o=Ro:(o=pi,i=void 0);let p=o===pi&&r[s+1].startsWith("/>")?" ":"";a+=o===Ro?c+PS:d>=0?(n.push(u),c.slice(0,d)+mp+c.slice(d)+yn+p):c+yn+(d===-2?(n.push(void 0),s):p)}return[cg(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),n]},mi=class{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let a=0,o=0,s=e.length-1,c=this.parts,[u,l]=MS(e,t);if(this.el=mi.createElement(u,n),di.currentNode=this.el.content,t===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(i=di.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes()){let d=[];for(let f of i.getAttributeNames())if(f.endsWith(mp)||f.startsWith(yn)){let p=l[o++];if(d.push(f),p!==void 0){let m=i.getAttribute(p.toLowerCase()+mp).split(yn),h=/([.?@])?(.*)/.exec(p);c.push({type:1,index:a,name:h[2],strings:m,ctor:h[1]==="."?yp:h[1]==="?"?vp:h[1]==="@"?bp:pa})}else c.push({type:6,index:a})}for(let f of d)i.removeAttribute(f)}if(og.test(i.tagName)){let d=i.textContent.split(yn),f=d.length-1;if(f>0){i.textContent=ua?ua.emptyScript:"";for(let p=0;p<f;p++)i.append(d[p],Lo()),di.nextNode(),c.push({type:2,index:++a});i.append(d[f],Lo())}}}else if(i.nodeType===8)if(i.data===ig)c.push({type:2,index:a});else{let d=-1;for(;(d=i.data.indexOf(yn,d+1))!==-1;)c.push({type:7,index:a}),d+=yn.length-1}a++}}static createElement(e,t){let n=fi.createElement("template");return n.innerHTML=e,n}};function la(r,e,t=r,n){var i,a,o,s;if(e===hi)return e;let c=n!==void 0?(i=t._$Co)===null||i===void 0?void 0:i[n]:t._$Cl,u=Po(e)?void 0:e._$litDirective$;return c?.constructor!==u&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),u===void 0?c=void 0:(c=new u(r),c._$AT(r,t,n)),n!==void 0?((o=(s=t)._$Co)!==null&&o!==void 0?o:s._$Co=[])[n]=c:t._$Cl=c),c!==void 0&&(e=la(r,c._$AS(r,e.values),c,n)),e}var gp=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:n},parts:i}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:fi).importNode(n,!0);di.currentNode=a;let o=di.nextNode(),s=0,c=0,u=i[0];for(;u!==void 0;){if(s===u.index){let l;u.type===2?l=new gi(o,o.nextSibling,this,e):u.type===1?l=new u.ctor(o,u.name,u.strings,this,e):u.type===6&&(l=new wp(o,this,e)),this._$AV.push(l),u=i[++c]}s!==u?.index&&(o=di.nextNode(),s++)}return di.currentNode=fi,a}v(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},gi=class{constructor(e,t,n,i){var a;this.type=2,this._$AH=Ke,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cp=(a=i?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=la(this,e,t),Po(e)?e===Ke||e==null||e===""?(this._$AH!==Ke&&this._$AR(),this._$AH=Ke):e!==this._$AH&&e!==hi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):FS(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Ke&&Po(this._$AH)?this._$AA.nextSibling.data=e:this.$(fi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:n,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=mi.createElement(cg(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(n);else{let o=new gp(a,this),s=o.u(this.options);o.v(n),this.$(s),this._$AH=o}}_$AC(e){let t=rg.get(e.strings);return t===void 0&&rg.set(e.strings,t=new mi(e)),t}T(e){ag(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let a of e)i===t.length?t.push(n=new gi(this.k(Lo()),this.k(Lo()),this,this.options)):n=t[i],n._$AI(a),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,t);e&&e!==this._$AB;){let i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},pa=class{constructor(e,t,n,i,a){this.type=1,this._$AH=Ke,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Ke}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,n,i){let a=this.strings,o=!1;if(a===void 0)e=la(this,e,t,0),o=!Po(e)||e!==this._$AH&&e!==hi,o&&(this._$AH=e);else{let s=e,c,u;for(e=a[0],c=0;c<a.length-1;c++)u=la(this,s[n+c],t,c),u===hi&&(u=this._$AH[c]),o||(o=!Po(u)||u!==this._$AH[c]),u===Ke?e=Ke:e!==Ke&&(e+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===Ke?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},yp=class extends pa{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ke?void 0:e}},jS=ua?ua.emptyScript:"",vp=class extends pa{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ke?this.element.setAttribute(this.name,jS):this.element.removeAttribute(this.name)}},bp=class extends pa{constructor(e,t,n,i,a){super(e,t,n,i,a),this.type=5}_$AI(e,t=this){var n;if((e=(n=la(this,e,t,0))!==null&&n!==void 0?n:Ke)===hi)return;let i=this._$AH,a=e===Ke&&i!==Ke||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==Ke&&(i===Ke||a);a&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;typeof this._$AH=="function"?this._$AH.call((n=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},wp=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){la(this,e)}};var ng=Mc.litHtmlPolyfillSupport;ng?.(mi,gi),((fp=Mc.litHtmlVersions)!==null&&fp!==void 0?fp:Mc.litHtmlVersions=[]).push("2.8.0");var ug=(r,e,t)=>{var n,i;let a=(n=t?.renderBefore)!==null&&n!==void 0?n:e,o=a._$litPart$;if(o===void 0){let s=(i=t?.renderBefore)!==null&&i!==void 0?i:null;a._$litPart$=o=new gi(e.insertBefore(Lo(),s),s,void 0,t??{})}return o._$AI(r),o};var Sp,_p;var ot=class extends Pr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=ug(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return hi}};ot.finalized=!0,ot._$litElement$=!0,(Sp=globalThis.litElementHydrateSupport)===null||Sp===void 0||Sp.call(globalThis,{LitElement:ot});var lg=globalThis.litElementPolyfillSupport;lg?.({LitElement:ot});((_p=globalThis.litElementVersions)!==null&&_p!==void 0?_p:globalThis.litElementVersions=[]).push("3.3.3");var Er=r=>e=>typeof e=="function"?((t,n)=>(customElements.define(t,n),n))(r,e):((t,n)=>{let{kind:i,elements:a}=n;return{kind:i,elements:a,finisher(o){customElements.define(t,o)}}})(r,e);var US=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},qS=(r,e,t)=>{e.constructor.createProperty(t,r)};function Ne(r){return(e,t)=>t!==void 0?qS(r,e,t):US(r,e)}function Te(r){return Ne({...r,state:!0})}var Ep,FC=((Ep=window.HTMLSlotElement)===null||Ep===void 0?void 0:Ep.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);function yi(){return M`
1619
+ `,C=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},S=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},K=function(r,e){return function(t,n){e(t,n,r)}},Ro=new cn;Ro.author="did:ad4m:test";Ro.timestamp=Date.now();Ro.data={source:"root",target:"neighbourhood://Qm12345"};Ro.proof={signature:"",key:"",valid:!0};var tn=new Gn;tn.author="did:ad4m:test";tn.timestamp=Date.now().toString();tn.proof=new Rr("","");tn.data=new br([Ro]);var Ic=class{};C([w(),S("design:type",String)],Ic.prototype,"recipient",void 0);C([w(),S("design:type",Gn)],Ic.prototype,"message",void 0);Ic=C([z()],Ic);var ta=class{};C([w(),S("design:type",String)],ta.prototype,"ad4mExecutorVersion",void 0);C([w(),S("design:type",Boolean)],ta.prototype,"isInitialized",void 0);C([w(),S("design:type",Boolean)],ta.prototype,"isUnlocked",void 0);ta=C([z()],ta);var ti=class{};C([w(),S("design:type",String)],ti.prototype,"title",void 0);C([w(),S("design:type",String)],ti.prototype,"message",void 0);C([w(),S("design:type",String)],ti.prototype,"type",void 0);C([w(),S("design:type",String)],ti.prototype,"addon",void 0);ti=C([z()],ti);var Ht=class{};C([w(),S("design:type",String)],Ht.prototype,"description",void 0);C([w(),S("design:type",String)],Ht.prototype,"appName",void 0);C([w(),S("design:type",String)],Ht.prototype,"appUrl",void 0);C([w(),S("design:type",String)],Ht.prototype,"appIconPath",void 0);C([w(),S("design:type",String)],Ht.prototype,"trigger",void 0);C([w(),S("design:type",Array)],Ht.prototype,"perspectiveIds",void 0);C([w(),S("design:type",String)],Ht.prototype,"webhookUrl",void 0);C([w(),S("design:type",String)],Ht.prototype,"webhookAuth",void 0);Ht=C([Ke()],Ht);var Dt=class{};C([w(),S("design:type",String)],Dt.prototype,"id",void 0);C([w(),S("design:type",Boolean)],Dt.prototype,"granted",void 0);C([w(),S("design:type",String)],Dt.prototype,"description",void 0);C([w(),S("design:type",String)],Dt.prototype,"appName",void 0);C([w(),S("design:type",String)],Dt.prototype,"appUrl",void 0);C([w(),S("design:type",String)],Dt.prototype,"appIconPath",void 0);C([w(),S("design:type",String)],Dt.prototype,"trigger",void 0);C([w(),S("design:type",Array)],Dt.prototype,"perspectiveIds",void 0);C([w(),S("design:type",String)],Dt.prototype,"webhookUrl",void 0);C([w(),S("design:type",String)],Dt.prototype,"webhookAuth",void 0);Dt=C([z()],Dt);var ra=class{};C([w(),S("design:type",Dt)],ra.prototype,"notification",void 0);C([w(),S("design:type",String)],ra.prototype,"perspectiveId",void 0);C([w(),S("design:type",String)],ra.prototype,"triggerMatch",void 0);ra=C([z()],ra);var Ge=class{};C([w(),S("design:type",Number)],Ge.prototype,"total",void 0);C([w(),S("design:type",Number)],Ge.prototype,"imported",void 0);C([w(),S("design:type",Number)],Ge.prototype,"failed",void 0);C([w(),S("design:type",Number)],Ge.prototype,"omitted",void 0);C([w(),S("design:type",Array)],Ge.prototype,"errors",void 0);Ge=C([z()],Ge);var Rt=class{};C([w(),S("design:type",Ge)],Rt.prototype,"perspectives",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"links",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"expressions",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"perspectiveDiffs",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"notifications",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"models",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"defaultModels",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"tasks",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"friends",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"trustedAgents",void 0);C([w(),S("design:type",Ge)],Rt.prototype,"knownLinkLanguages",void 0);Rt=C([z()],Rt);var na=class{};C([w(),S("design:type",String)],na.prototype,"email",void 0);C([w(),S("design:type",String)],na.prototype,"did",void 0);C([w(),S("design:type",String)],na.prototype,"lastSeen",void 0);C([w(),S("design:type",Number)],na.prototype,"perspectiveCount",void 0);na=C([z()],na);var ri=class{};C([w(),S("design:type",Boolean)],ri.prototype,"success",void 0);C([w(),S("design:type",String)],ri.prototype,"message",void 0);C([w(),S("design:type",Boolean)],ri.prototype,"requiresPassword",void 0);C([w(),S("design:type",Boolean)],ri.prototype,"isExistingUser",void 0);ri=C([z()],ri);var ni=class{constructor(e,t,n){this.email=e,this.remainingCredits=t,this.hotWalletAddress=n}};C([w(),S("design:type",String)],ni.prototype,"email",void 0);C([w(),S("design:type",String)],ni.prototype,"remainingCredits",void 0);C([w(),S("design:type",String)],ni.prototype,"hotWalletAddress",void 0);ni=C([z(),S("design:paramtypes",[String,String,String])],ni);var ia=class{constructor(e,t){this.success=e,this.message=t}};C([w(),S("design:type",Boolean)],ia.prototype,"success",void 0);C([w(),S("design:type",String)],ia.prototype,"message",void 0);ia=C([z(),S("design:paramtypes",[Boolean,String])],ia);var B=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return tn}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[tn]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:tn}]}runtimeMessageReceived(){return tn}exceptionOccurred(){return{title:"Test title",message:"Test message",type:Hl.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 Kn("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 ni("test@example.com","100000000",null)}runtimeSetHotWalletAddress(e){return!0}runtimeRequestPayment(e){return new ia(!0,"Mock payment of "+e+" base units credited")}};C([de(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],B.prototype,"runtimeQuit",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],B.prototype,"runtimeOpenLink",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",ta)],B.prototype,"runtimeInfo",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],B.prototype,"addTrustedAgents",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],B.prototype,"deleteTrustedAgents",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],B.prototype,"getTrustedAgents",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],B.prototype,"runtimeKnownLinkLanguageTemplates",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],B.prototype,"runtimeAddKnownLinkLanguageTemplates",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],B.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],B.prototype,"runtimeFriends",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],B.prototype,"runtimeAddFriends",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Array]),S("design:returntype",Array)],B.prototype,"runtimeRemoveFriends",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",String)],B.prototype,"runtimeHcAgentInfos",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",String)],B.prototype,"runtimeGetNetworkMetrics",null);C([de(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],B.prototype,"runtimeRestartHolochain",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Object]),S("design:returntype",Boolean)],B.prototype,"runtimeHcAddAgentInfos",null);C([kt(),K(0,G()),K(1,G()),K(2,G()),K(3,G()),S("design:type",Function),S("design:paramtypes",[String,String,String,String]),S("design:returntype",void 0)],B.prototype,"runtimeVerifyStringSignedByDid",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[br]),S("design:returntype",Boolean)],B.prototype,"runtimeSetStatus",null);C([kt(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Gn)],B.prototype,"runtimeFriendStatus",null);C([de(),K(0,G()),K(1,G()),S("design:type",Function),S("design:paramtypes",[String,pc]),S("design:returntype",Boolean)],B.prototype,"runtimeFriendSendMessage",null);C([kt(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Array)],B.prototype,"runtimeMessageInbox",null);C([kt(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Array)],B.prototype,"runtimeMessageOutbox",null);C([Jl(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Gn)],B.prototype,"runtimeMessageReceived",null);C([Jl(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",ti)],B.prototype,"exceptionOccurred",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Ht]),S("design:returntype",String)],B.prototype,"runtimeRequestInstallNotification",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],B.prototype,"runtimeNotifications",null);C([de(),K(0,G()),K(1,G()),S("design:type",Function),S("design:paramtypes",[String,Ht]),S("design:returntype",Boolean)],B.prototype,"runtimeUpdateNotification",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],B.prototype,"runtimeRemoveNotification",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],B.prototype,"runtimeGrantNotification",null);C([Jl(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",ra)],B.prototype,"runtimeNotificationTriggered",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],B.prototype,"runtimeExportDb",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],B.prototype,"runtimeImportDb",null);C([de(),K(0,G()),K(1,G()),S("design:type",Function),S("design:paramtypes",[String,String]),S("design:returntype",Boolean)],B.prototype,"runtimeExportPerspective",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],B.prototype,"runtimeImportPerspective",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],B.prototype,"runtimeMultiUserEnabled",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[Boolean]),S("design:returntype",Boolean)],B.prototype,"runtimeSetMultiUserEnabled",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Array)],B.prototype,"runtimeListUsers",null);C([de(),K(0,G()),K(1,G()),S("design:type",Function),S("design:paramtypes",[String,wr]),S("design:returntype",ri)],B.prototype,"runtimeRequestLoginVerification",null);C([de(),K(0,G()),K(1,G()),K(2,G()),S("design:type",Function),S("design:paramtypes",[String,String,String]),S("design:returntype",String)],B.prototype,"runtimeVerifyEmailCode",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],B.prototype,"runtimeTestEmail",null);C([de(),K(0,G()),K(1,G()),K(2,G()),S("design:type",Function),S("design:paramtypes",[String,String,wr]),S("design:returntype",Kn)],B.prototype,"runtimeCreateUser",null);C([de(),K(0,G()),K(1,G()),S("design:type",Function),S("design:paramtypes",[String,String]),S("design:returntype",String)],B.prototype,"runtimeLoginUser",null);C([de(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeEnable",null);C([de(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeDisable",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",String)],B.prototype,"runtimeEmailTestGetCode",null);C([de(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",Boolean)],B.prototype,"runtimeEmailTestClearCodes",null);C([de(),K(0,G()),K(1,G()),K(2,G()),S("design:type",Function),S("design:paramtypes",[String,String,Number]),S("design:returntype",Boolean)],B.prototype,"runtimeEmailTestSetExpiry",null);C([kt(),S("design:type",Function),S("design:paramtypes",[]),S("design:returntype",ni)],B.prototype,"runtimeHostingUserInfo",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",Boolean)],B.prototype,"runtimeSetHotWalletAddress",null);C([de(),K(0,G()),S("design:type",Function),S("design:paramtypes",[String]),S("design:returntype",ia)],B.prototype,"runtimeRequestPayment",null);B=C([hb()],B);var ZS=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 Po(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 ZS(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 YS=12e3,Lo=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;Po(this),this.options=t,this.port=t.port||parseInt(Ts("ad4m-port"))||YS,this.url=t.url||Ts("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Ts("ad4m-token")||"",this.embedded=Is(),this.embedded&&this.initializeEmbeddedMode()}connect(){return Z(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 Li(this.url),Ot("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 Z(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=rl({url:this.url,connectionParams:()=>Z(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=>Z(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 Ao(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new el({link:new kf(t),cache:new ws({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,n){return Z(this,null,function*(){let i=rl({url:t,connectionParams:()=>Z(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new Ao(a);try{return yield n(o)}finally{i.dispose()}})}checkAuth(){return Z(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="",Fa("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return Z(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="",Fa("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=>Z(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`,Ot("ad4m-port",o.toString()),s?Ot("ad4m-token",s):Fa("ad4m-token"),Ot("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 Z(this,null,function*(){return t&&(this.token="",Fa("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 Z(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,Ot("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Code verification failed:",n),!1}})}isValidAd4mAPI(){return Z(this,null,function*(){try{return yield this.withTempClient(this.url,t=>Z(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 Z(this,null,function*(){try{return yield this.withTempClient(this.url,t=>Z(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 Z(this,null,function*(){try{return yield this.withTempClient(this.url,n=>Z(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 Z(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Z(this,null,function*(){return yield a.agent.verifyEmailCode(t,n,"login")}));return this.token=i,Ot("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 Z(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Z(this,null,function*(){return yield a.agent.loginUser(t,n)}));return this.token=i,Ot("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Password login failed:",i),!1}})}createAccount(t,n){return Z(this,null,function*(){try{let i=yield this.withTempClient(this.url,a=>Z(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,Ot("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}}))}};var Mc=window,Uc=Mc.ShadowRoot&&(Mc.ShadyCSS===void 0||Mc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,pp=Symbol(),tg=new WeakMap,Fo=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==pp)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(Uc&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=tg.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&tg.set(t,e))}return e}toString(){return this.cssText}},rg=r=>new Fo(typeof r=="string"?r:r+"",void 0,pp),Lt=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((n,i,a)=>n+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(i)+r[a+1],r[0]);return new Fo(t,r,pp)},dp=(r,e)=>{Uc?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let n=document.createElement("style"),i=Mc.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)})},jc=Uc?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return rg(t)})(r):r;var fp,qc=window,ng=qc.trustedTypes,XS=ng?ng.emptyScript:"",ig=qc.reactiveElementPolyfillSupport,mp={toAttribute(r,e){switch(e){case Boolean:r=r?XS:null;break;case Object:case Array:r=r==null?r:JSON.stringify(r)}return r},fromAttribute(r,e){let t=r;switch(e){case Boolean:t=r!==null;break;case Number:t=r===null?null:Number(r);break;case Object:case Array:try{t=JSON.parse(r)}catch{t=null}}return t}},ag=(r,e)=>e!==r&&(e==e||r==r),hp={attribute:!0,type:String,converter:mp,reflect:!1,hasChanged:ag},gp="finalized",Lr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,n)=>{let i=this._$Ep(n,t);i!==void 0&&(this._$Ev.set(i,n),e.push(i))}),e}static createProperty(e,t=hp){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let n=typeof e=="symbol"?Symbol():"__"+e,i=this.getPropertyDescriptor(e,n,t);i!==void 0&&Object.defineProperty(this.prototype,e,i)}}static getPropertyDescriptor(e,t,n){return{get(){return this[t]},set(i){let a=this[e];this[t]=i,this.requestUpdate(e,a,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||hp}static finalize(){if(this.hasOwnProperty(gp))return!1;this[gp]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,n=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let i of n)this.createProperty(i,t[i])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let n=new Set(e.flat(1/0).reverse());for(let i of n)t.unshift(jc(i))}else e!==void 0&&t.push(jc(e));return t}static _$Ep(e,t){let n=t.attribute;return n===!1?void 0:typeof n=="string"?n:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,n;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((n=e.hostConnected)===null||n===void 0||n.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return dp(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostConnected)===null||n===void 0?void 0:n.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var n;return(n=t.hostDisconnected)===null||n===void 0?void 0:n.call(t)})}attributeChangedCallback(e,t,n){this._$AK(e,n)}_$EO(e,t,n=hp){var i;let a=this.constructor._$Ep(e,n);if(a!==void 0&&n.reflect===!0){let o=(((i=n.converter)===null||i===void 0?void 0:i.toAttribute)!==void 0?n.converter:mp).toAttribute(t,n.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var n;let i=this.constructor,a=i._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=i.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((n=o.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?o.converter:mp;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,n){let i=!0;e!==void 0&&(((n=n||this.constructor.getPropertyOptions(e)).hasChanged||ag)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),n.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,n))):i=!1),!this.isUpdatePending&&i&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((i,a)=>this[a]=i),this._$Ei=void 0);let t=!1,n=this._$AL;try{t=this.shouldUpdate(n),t?(this.willUpdate(n),(e=this._$ES)===null||e===void 0||e.forEach(i=>{var a;return(a=i.hostUpdate)===null||a===void 0?void 0:a.call(i)}),this.update(n)):this._$Ek()}catch(i){throw t=!1,this._$Ek(),i}t&&this._$AE(n)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(n=>{var i;return(i=n.hostUpdated)===null||i===void 0?void 0:i.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,n)=>this._$EO(n,this[n],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Lr[gp]=!0,Lr.elementProperties=new Map,Lr.elementStyles=[],Lr.shadowRootOptions={mode:"open"},ig?.({ReactiveElement:Lr}),((fp=qc.reactiveElementVersions)!==null&&fp!==void 0?fp:qc.reactiveElementVersions=[]).push("1.6.3");var yp,Bc=window,pa=Bc.trustedTypes,og=pa?pa.createPolicy("lit-html",{createHTML:r=>r}):void 0,bp="$lit$",gn=`lit$${(Math.random()+"").slice(9)}$`,fg="?"+gn,e_=`<${fg}>`,hi=document,Uo=()=>hi.createComment(""),jo=r=>r===null||typeof r!="object"&&typeof r!="function",hg=Array.isArray,t_=r=>hg(r)||typeof r?.[Symbol.iterator]=="function",vp=`[
1620
+ \f\r]`,Mo=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,sg=/-->/g,cg=/>/g,di=RegExp(`>|${vp}(?:([^\\s"'>=/]+)(${vp}*=${vp}*(?:[^
1621
+ \f\r"'\`<>=]|("|')|))|$)`,"g"),ug=/'/g,lg=/"/g,mg=/^(?:script|style|textarea|title)$/i,gg=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),M=gg(1),IC=gg(2),mi=Symbol.for("lit-noChange"),Je=Symbol.for("lit-nothing"),pg=new WeakMap,fi=hi.createTreeWalker(hi,129,null,!1);function yg(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return og!==void 0?og.createHTML(e):e}var r_=(r,e)=>{let t=r.length-1,n=[],i,a=e===2?"<svg>":"",o=Mo;for(let s=0;s<t;s++){let c=r[s],u,l,d=-1,f=0;for(;f<c.length&&(o.lastIndex=f,l=o.exec(c),l!==null);)f=o.lastIndex,o===Mo?l[1]==="!--"?o=sg:l[1]!==void 0?o=cg:l[2]!==void 0?(mg.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=di):l[3]!==void 0&&(o=di):o===di?l[0]===">"?(o=i??Mo,d=-1):l[1]===void 0?d=-2:(d=o.lastIndex-l[2].length,u=l[1],o=l[3]===void 0?di:l[3]==='"'?lg:ug):o===lg||o===ug?o=di:o===sg||o===cg?o=Mo:(o=di,i=void 0);let p=o===di&&r[s+1].startsWith("/>")?" ":"";a+=o===Mo?c+e_:d>=0?(n.push(u),c.slice(0,d)+bp+c.slice(d)+gn+p):c+gn+(d===-2?(n.push(void 0),s):p)}return[yg(r,a+(r[t]||"<?>")+(e===2?"</svg>":"")),n]},gi=class{constructor({strings:e,_$litType$:t},n){let i;this.parts=[];let a=0,o=0,s=e.length-1,c=this.parts,[u,l]=r_(e,t);if(this.el=gi.createElement(u,n),fi.currentNode=this.el.content,t===2){let d=this.el.content,f=d.firstChild;f.remove(),d.append(...f.childNodes)}for(;(i=fi.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes()){let d=[];for(let f of i.getAttributeNames())if(f.endsWith(bp)||f.startsWith(gn)){let p=l[o++];if(d.push(f),p!==void 0){let h=i.getAttribute(p.toLowerCase()+bp).split(gn),m=/([.?@])?(.*)/.exec(p);c.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?Sp:m[1]==="?"?_p:m[1]==="@"?Ep:fa})}else c.push({type:6,index:a})}for(let f of d)i.removeAttribute(f)}if(mg.test(i.tagName)){let d=i.textContent.split(gn),f=d.length-1;if(f>0){i.textContent=pa?pa.emptyScript:"";for(let p=0;p<f;p++)i.append(d[p],Uo()),fi.nextNode(),c.push({type:2,index:++a});i.append(d[f],Uo())}}}else if(i.nodeType===8)if(i.data===fg)c.push({type:2,index:a});else{let d=-1;for(;(d=i.data.indexOf(gn,d+1))!==-1;)c.push({type:7,index:a}),d+=gn.length-1}a++}}static createElement(e,t){let n=hi.createElement("template");return n.innerHTML=e,n}};function da(r,e,t=r,n){var i,a,o,s;if(e===mi)return e;let c=n!==void 0?(i=t._$Co)===null||i===void 0?void 0:i[n]:t._$Cl,u=jo(e)?void 0:e._$litDirective$;return c?.constructor!==u&&((a=c?._$AO)===null||a===void 0||a.call(c,!1),u===void 0?c=void 0:(c=new u(r),c._$AT(r,t,n)),n!==void 0?((o=(s=t)._$Co)!==null&&o!==void 0?o:s._$Co=[])[n]=c:t._$Cl=c),c!==void 0&&(e=da(r,c._$AS(r,e.values),c,n)),e}var wp=class{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){var t;let{el:{content:n},parts:i}=this._$AD,a=((t=e?.creationScope)!==null&&t!==void 0?t:hi).importNode(n,!0);fi.currentNode=a;let o=fi.nextNode(),s=0,c=0,u=i[0];for(;u!==void 0;){if(s===u.index){let l;u.type===2?l=new yi(o,o.nextSibling,this,e):u.type===1?l=new u.ctor(o,u.name,u.strings,this,e):u.type===6&&(l=new xp(o,this,e)),this._$AV.push(l),u=i[++c]}s!==u?.index&&(o=fi.nextNode(),s++)}return fi.currentNode=hi,a}v(e){let t=0;for(let n of this._$AV)n!==void 0&&(n.strings!==void 0?(n._$AI(e,n,t),t+=n.strings.length-2):n._$AI(e[t])),t++}},yi=class{constructor(e,t,n,i){var a;this.type=2,this._$AH=Je,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=n,this.options=i,this._$Cp=(a=i?.isConnected)===null||a===void 0||a}get _$AU(){var e,t;return(t=(e=this._$AM)===null||e===void 0?void 0:e._$AU)!==null&&t!==void 0?t:this._$Cp}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return t!==void 0&&e?.nodeType===11&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){e=da(this,e,t),jo(e)?e===Je||e==null||e===""?(this._$AH!==Je&&this._$AR(),this._$AH=Je):e!==this._$AH&&e!==mi&&this._(e):e._$litType$!==void 0?this.g(e):e.nodeType!==void 0?this.$(e):t_(e)?this.T(e):this._(e)}k(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}$(e){this._$AH!==e&&(this._$AR(),this._$AH=this.k(e))}_(e){this._$AH!==Je&&jo(this._$AH)?this._$AA.nextSibling.data=e:this.$(hi.createTextNode(e)),this._$AH=e}g(e){var t;let{values:n,_$litType$:i}=e,a=typeof i=="number"?this._$AC(e):(i.el===void 0&&(i.el=gi.createElement(yg(i.h,i.h[0]),this.options)),i);if(((t=this._$AH)===null||t===void 0?void 0:t._$AD)===a)this._$AH.v(n);else{let o=new wp(a,this),s=o.u(this.options);o.v(n),this.$(s),this._$AH=o}}_$AC(e){let t=pg.get(e.strings);return t===void 0&&pg.set(e.strings,t=new gi(e)),t}T(e){hg(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,n,i=0;for(let a of e)i===t.length?t.push(n=new yi(this.k(Uo()),this.k(Uo()),this,this.options)):n=t[i],n._$AI(a),i++;i<t.length&&(this._$AR(n&&n._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){var n;for((n=this._$AP)===null||n===void 0||n.call(this,!1,!0,t);e&&e!==this._$AB;){let i=e.nextSibling;e.remove(),e=i}}setConnected(e){var t;this._$AM===void 0&&(this._$Cp=e,(t=this._$AP)===null||t===void 0||t.call(this,e))}},fa=class{constructor(e,t,n,i,a){this.type=1,this._$AH=Je,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=a,n.length>2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=Je}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(e,t=this,n,i){let a=this.strings,o=!1;if(a===void 0)e=da(this,e,t,0),o=!jo(e)||e!==this._$AH&&e!==mi,o&&(this._$AH=e);else{let s=e,c,u;for(e=a[0],c=0;c<a.length-1;c++)u=da(this,s[n+c],t,c),u===mi&&(u=this._$AH[c]),o||(o=!jo(u)||u!==this._$AH[c]),u===Je?e=Je:e!==Je&&(e+=(u??"")+a[c+1]),this._$AH[c]=u}o&&!i&&this.j(e)}j(e){e===Je?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}},Sp=class extends fa{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Je?void 0:e}},n_=pa?pa.emptyScript:"",_p=class extends fa{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Je?this.element.setAttribute(this.name,n_):this.element.removeAttribute(this.name)}},Ep=class extends fa{constructor(e,t,n,i,a){super(e,t,n,i,a),this.type=5}_$AI(e,t=this){var n;if((e=(n=da(this,e,t,0))!==null&&n!==void 0?n:Je)===mi)return;let i=this._$AH,a=e===Je&&i!==Je||e.capture!==i.capture||e.once!==i.once||e.passive!==i.passive,o=e!==Je&&(i===Je||a);a&&this.element.removeEventListener(this.name,this,i),o&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){var t,n;typeof this._$AH=="function"?this._$AH.call((n=(t=this.options)===null||t===void 0?void 0:t.host)!==null&&n!==void 0?n:this.element,e):this._$AH.handleEvent(e)}},xp=class{constructor(e,t,n){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=n}get _$AU(){return this._$AM._$AU}_$AI(e){da(this,e)}};var dg=Bc.litHtmlPolyfillSupport;dg?.(gi,yi),((yp=Bc.litHtmlVersions)!==null&&yp!==void 0?yp:Bc.litHtmlVersions=[]).push("2.8.0");var vg=(r,e,t)=>{var n,i;let a=(n=t?.renderBefore)!==null&&n!==void 0?n:e,o=a._$litPart$;if(o===void 0){let s=(i=t?.renderBefore)!==null&&i!==void 0?i:null;a._$litPart$=o=new yi(e.insertBefore(Uo(),s),s,void 0,t??{})}return o._$AI(r),o};var kp,Ap;var st=class extends Lr{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var e,t;let n=super.createRenderRoot();return(e=(t=this.renderOptions).renderBefore)!==null&&e!==void 0||(t.renderBefore=n.firstChild),n}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=vg(t,this.renderRoot,this.renderOptions)}connectedCallback(){var e;super.connectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!0)}disconnectedCallback(){var e;super.disconnectedCallback(),(e=this._$Do)===null||e===void 0||e.setConnected(!1)}render(){return mi}};st.finalized=!0,st._$litElement$=!0,(kp=globalThis.litElementHydrateSupport)===null||kp===void 0||kp.call(globalThis,{LitElement:st});var bg=globalThis.litElementPolyfillSupport;bg?.({LitElement:st});((Ap=globalThis.litElementVersions)!==null&&Ap!==void 0?Ap:globalThis.litElementVersions=[]).push("3.3.3");var Er=r=>e=>typeof e=="function"?((t,n)=>(customElements.define(t,n),n))(r,e):((t,n)=>{let{kind:i,elements:a}=n;return{kind:i,elements:a,finisher(o){customElements.define(t,o)}}})(r,e);var i_=(r,e)=>e.kind==="method"&&e.descriptor&&!("value"in e.descriptor)?{...e,finisher(t){t.createProperty(e.key,r)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:e.key,initializer(){typeof e.initializer=="function"&&(this[e.key]=e.initializer.call(this))},finisher(t){t.createProperty(e.key,r)}},a_=(r,e,t)=>{e.constructor.createProperty(t,r)};function $e(r){return(e,t)=>t!==void 0?a_(r,e,t):i_(r,e)}function Oe(r){return $e({...r,state:!0})}var Ip,eN=((Ip=window.HTMLSlotElement)===null||Ip===void 0?void 0:Ip.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);function vi(){return M`
1596
1622
  <svg viewBox="0 0 63.6 60" fill="none" xmlns="http://www.w3.org/2000/svg">
1597
1623
  <path fill="currentColor" d="M63.2781 52.9928C62.4038 47.0393 59.8345 41.4763 55.9242 36.935C55.9403 36.5766 55.951 36.2182 55.951 35.8545C55.951 26.6328 50.7373 18.6039 43.0937 14.5333C41.093 9.35009 37.7352 4.72854 33.2402 1.14469L31.7705 0L30.2793 1.10725L30.2096 1.16074C25.7253 4.74458 22.3729 9.36079 20.3775 14.5386C12.7339 18.6039 7.52021 26.6328 7.52021 35.8599C7.52021 36.2236 7.53094 36.582 7.54703 36.9404C3.6421 41.471 1.06742 47.034 0.198465 52.9874L0 54.9131L1.70036 55.5817C5.40683 57.0313 9.32249 57.7695 13.3401 57.7695C15.668 57.7695 17.9369 57.5127 20.1254 57.0366C23.5744 58.9248 27.533 60 31.7383 60C35.9436 60 39.9022 58.9248 43.3512 57.0366C45.5397 57.5127 47.8086 57.7695 50.1365 57.7695C54.1541 57.7695 58.0698 57.0366 61.7762 55.5817L63.5624 54.881L63.2835 52.9874L63.2781 52.9928ZM42.5734 51.8802C40.0792 51.1581 37.7352 50.0829 35.595 48.7189C39.752 44.675 42.8041 39.5079 44.263 33.7202C46.1297 34.6938 47.8891 35.8866 49.4982 37.288C49.9917 37.716 50.4637 38.1653 50.9197 38.6253C50.1258 44.1294 46.9986 48.8954 42.568 51.8855L42.5734 51.8802ZM12.5516 38.62C13.0075 38.1599 13.4849 37.716 13.973 37.288C15.5822 35.8866 17.3415 34.6938 19.2082 33.7202C20.6672 39.5079 23.7192 44.675 27.8763 48.7189C25.7361 50.0829 23.392 51.1527 20.8978 51.8802C16.4672 48.8901 13.3401 44.1241 12.5462 38.62H12.5516ZM40.3957 25.9802C40.3957 26.3332 40.3903 26.6809 40.3742 27.0286C37.585 26.2477 34.6831 25.8411 31.7383 25.8411C28.7935 25.8411 25.8916 26.2477 23.1024 27.0286C23.0917 26.6809 23.0809 26.3279 23.0809 25.9802C23.0809 23.2362 23.494 20.5563 24.2825 18.0102C26.5782 17.0527 29.0993 16.5231 31.7383 16.5231C34.3773 16.5231 36.8984 17.0527 39.1941 18.0102C39.9826 20.5563 40.3957 23.2362 40.3957 25.9802ZM23.73 31.8641C26.3047 31.0671 29.0027 30.6553 31.7383 30.6553C34.4739 30.6553 37.1719 31.0671 39.7466 31.8641C38.5344 37.2827 35.6808 42.0915 31.7383 45.7395C27.7958 42.0861 24.9422 37.2773 23.73 31.8641ZM50.7641 32.1262C48.9887 30.8104 47.0898 29.6817 45.0998 28.7671C45.1803 27.847 45.2232 26.9163 45.2232 25.9802C45.2232 24.536 45.1266 23.1131 44.9335 21.7063C47.8676 24.4343 49.9595 28.0503 50.7641 32.1262ZM31.7383 6.19417C33.6639 7.97005 35.2946 9.99198 36.6087 12.1904C35.0371 11.8695 33.4065 11.6983 31.7383 11.6983C30.0701 11.6983 28.4395 11.8695 26.8679 12.1904C28.182 9.99198 29.8127 7.97005 31.7383 6.19417ZM18.5431 21.701C18.3553 23.1078 18.2534 24.5306 18.2534 25.9749C18.2534 26.9163 18.2963 27.8417 18.3768 28.7617C16.3868 29.6764 14.4879 30.805 12.7125 32.1209C13.5171 28.0449 15.6036 24.429 18.5377 21.701H18.5431ZM5.33173 51.7518C5.9915 48.7938 7.15547 45.9802 8.74855 43.418C9.95007 47.034 11.9776 50.2808 14.622 52.9179C14.1983 52.9393 13.7692 52.95 13.3401 52.95C10.5991 52.95 7.91178 52.5488 5.32637 51.7465L5.33173 51.7518ZM31.7383 55.1859C30.1506 55.1859 28.6058 54.988 27.1307 54.6296C28.7452 53.854 30.29 52.95 31.7383 51.923C33.1866 52.95 34.7314 53.854 36.3459 54.6296C34.8655 54.988 33.326 55.1859 31.7383 55.1859ZM50.1365 52.95C49.7074 52.95 49.2783 52.9339 48.8546 52.9179C51.499 50.2808 53.5265 47.0393 54.728 43.4234C56.3211 45.9802 57.4851 48.7938 58.1449 51.7518C55.5648 52.5488 52.8775 52.95 50.1365 52.95Z" />
1598
1624
  </svg>
1599
- `}function da(){return M`
1625
+ `}function ha(){return M`
1600
1626
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
1601
1627
  <circle cx="12" cy="12" r="10"></circle>
1602
1628
  <circle cx="12" cy="12" r="3" fill="currentColor"></circle>
1603
1629
  </svg>
1604
- `}function fa(){return M`
1630
+ `}function ma(){return M`
1605
1631
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
1606
1632
  <circle cx="12" cy="12" r="10"></circle>
1607
1633
  <path d="M2 12h20"></path>
1608
1634
  <path d="M12 2a15.3 15.3 0 0 1 4 10 15.3 15.3 0 0 1-4 10 15.3 15.3 0 0 1-4-10 15.3 15.3 0 0 1 4-10z"></path>
1609
1635
  </svg>
1610
- `}function jc(){return M`
1636
+ `}function Vc(){return M`
1611
1637
  <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
1612
1638
  <path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
1613
1639
  <polyline points="7 10 12 15 17 10"></polyline>
@@ -1618,24 +1644,24 @@ FETCH links
1618
1644
  <rect width="256" height="256" fill="none"/>
1619
1645
  <polyline points="40 144 96 200 224 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
1620
1646
  </svg>
1621
- `}function mt(){return M`
1647
+ `}function yt(){return M`
1622
1648
  <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256">
1623
1649
  <path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
1624
1650
  </svg>
1625
- `}function Uc(){return M`
1651
+ `}function Qc(){return M`
1626
1652
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-clockwise" viewBox="0 0 16 16">
1627
1653
  <path fill-rule="evenodd" d="M8 3a5 5 0 1 0 4.546 2.914.5.5 0 0 1 .908-.417A6 6 0 1 1 8 2z"/>
1628
1654
  <path d="M8 4.466V.534a.25.25 0 0 1 .41-.192l2.36 1.966c.12.1.12.284 0 .384L8.41 4.658A.25.25 0 0 1 8 4.466"/>
1629
1655
  </svg>
1630
- `}function qc(){return M`
1656
+ `}function zc(){return M`
1631
1657
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left-right" viewBox="0 0 16 16">
1632
1658
  <path fill-rule="evenodd" d="M1 11.5a.5.5 0 0 0 .5.5h11.793l-3.147 3.146a.5.5 0 0 0 .708.708l4-4a.5.5 0 0 0 0-.708l-4-4a.5.5 0 0 0-.708.708L13.293 11H1.5a.5.5 0 0 0-.5.5m14-7a.5.5 0 0 1-.5.5H2.707l3.147 3.146a.5.5 0 1 1-.708.708l-4-4a.5.5 0 0 1 0-.708l4-4a.5.5 0 1 1 .708.708L2.707 4H14.5a.5.5 0 0 1 .5.5"/>
1633
1659
  </svg>
1634
- `}function ha(){return M`
1660
+ `}function ga(){return M`
1635
1661
  <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-arrow-left" viewBox="0 0 16 16">
1636
1662
  <path fill-rule="evenodd" d="M15 8a.5.5 0 0 0-.5-.5H2.707l3.147-3.146a.5.5 0 1 0-.708-.708l-4 4a.5.5 0 0 0 0 .708l4 4a.5.5 0 0 0 .708-.708L2.707 8.5H14.5A.5.5 0 0 0 15 8"/>
1637
1663
  </svg>
1638
- `}var vn=Rt`
1664
+ `}var yn=Lt`
1639
1665
  * {
1640
1666
  box-sizing: border-box;
1641
1667
  }
@@ -1897,7 +1923,7 @@ FETCH links
1897
1923
  .state.danger svg {
1898
1924
  color: var(--ac-danger-color);
1899
1925
  }
1900
- `;var rt=class extends ot{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.showMultiUserOption=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl="";this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return K(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return K(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return K(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-remote-node",{detail:{remoteUrl:this.newRemoteUrl},bubbles:!0,composed:!0}))})}clearRemoteNodeError(){this.dispatchEvent(new CustomEvent("clear-remote-node-error",{bubbles:!0,composed:!0}))}detectLocalNode(){return K(this,null,function*(){try{yield Li(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return K(this,null,function*(){Ap(rt.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:M`
1926
+ `;var nt=class extends st{constructor(){super(...arguments);this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.showMultiUserOption=!1;this.loading=!0;this.localNodeDetected=!1;this.newPort=0;this.newRemoteUrl="";this.isMobile=!1;this.checkMobile=()=>{this.isMobile=window.innerWidth<800}}changePort(){return Z(this,null,function*(){this.dispatchEvent(new CustomEvent("change-port",{detail:{port:this.newPort},bubbles:!0,composed:!0}))})}connectLocalNode(){return Z(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-local-node",{bubbles:!0,composed:!0}))})}connectRemoteNode(){return Z(this,null,function*(){this.dispatchEvent(new CustomEvent("connect-remote-node",{detail:{remoteUrl:this.newRemoteUrl},bubbles:!0,composed:!0}))})}clearRemoteNodeError(){this.dispatchEvent(new CustomEvent("clear-remote-node-error",{bubbles:!0,composed:!0}))}detectLocalNode(){return Z(this,null,function*(){try{yield Li(`ws://localhost:${this.newPort}/graphql`,3e3),this.localNodeDetected=!0}catch(t){console.log("[Ad4m Connect] Local detection failed:",t),this.localNodeDetected=!1}})}refreshPort(){this.changePort(),this.detectLocalNode()}connectedCallback(){return Z(this,null,function*(){Op(nt.prototype,this,"connectedCallback").call(this),this.newPort=this.port,this.newRemoteUrl=this.remoteUrl||"",this.checkMobile(),window.addEventListener("resize",this.checkMobile),yield this.detectLocalNode(),this.loading=!1})}disconnectedCallback(){super.disconnectedCallback(),window.removeEventListener("resize",this.checkMobile)}willUpdate(t){t.has("port")&&(this.newPort=this.port),t.has("remoteUrl")&&(this.newRemoteUrl=this.remoteUrl||"")}render(){return this.loading?null:M`
1901
1927
  <div class="container">
1902
1928
  <div class="header">
1903
1929
  <h1>Connect AD4M</h1>
@@ -1908,7 +1934,7 @@ FETCH links
1908
1934
  ${this.isMobile?"":M`
1909
1935
  <div class="box">
1910
1936
  <div class="box-header">
1911
- ${da()}
1937
+ ${ha()}
1912
1938
  <h3>Local Node</h3>
1913
1939
  </div>
1914
1940
 
@@ -1923,13 +1949,13 @@ FETCH links
1923
1949
  </button>
1924
1950
  `:M`
1925
1951
  <div class="state danger">
1926
- ${mt()}
1952
+ ${yt()}
1927
1953
  <p>No local node detected on port ${this.port}</p>
1928
1954
  </div>
1929
1955
 
1930
1956
  <p style="margin-bottom: -12px">Download and install AD4M</p>
1931
1957
  <button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
1932
- ${jc()} Download AD4M
1958
+ ${Vc()} Download AD4M
1933
1959
  </button>
1934
1960
  `}
1935
1961
 
@@ -1943,7 +1969,7 @@ FETCH links
1943
1969
  @keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
1944
1970
  />
1945
1971
  <button class="primary" @click=${this.refreshPort}>
1946
- ${Uc()}
1972
+ ${Qc()}
1947
1973
  </button>
1948
1974
  </div>
1949
1975
  </div>
@@ -1952,7 +1978,7 @@ FETCH links
1952
1978
  ${this.showMultiUserOption?M`
1953
1979
  <div class="box">
1954
1980
  <div class="box-header">
1955
- ${fa()}
1981
+ ${ma()}
1956
1982
  <h3>Remote Node</h3>
1957
1983
  </div>
1958
1984
 
@@ -1974,7 +2000,7 @@ FETCH links
1974
2000
 
1975
2001
  ${this.remoteNodeError?M`
1976
2002
  <div class="state danger">
1977
- ${mt()}
2003
+ ${yt()}
1978
2004
  <p>Unable to connect to remote node</p>
1979
2005
  </div>
1980
2006
  `:""}
@@ -1990,7 +2016,7 @@ FETCH links
1990
2016
  `:""}
1991
2017
  </div>
1992
2018
  </div>
1993
- `}};rt.styles=[vn,Rt`
2019
+ `}};nt.styles=[yn,Lt`
1994
2020
  .options {
1995
2021
  display: flex;
1996
2022
  flex-direction: column;
@@ -2019,10 +2045,10 @@ FETCH links
2019
2045
  button {
2020
2046
  width: 100%;
2021
2047
  }
2022
- `],z([Ne({type:Number})],rt.prototype,"port",2),z([Ne({type:String})],rt.prototype,"remoteUrl",2),z([Ne({type:Boolean})],rt.prototype,"connectingToRemoteNode",2),z([Ne({type:Boolean})],rt.prototype,"remoteNodeError",2),z([Ne({type:Boolean})],rt.prototype,"showMultiUserOption",2),z([Te()],rt.prototype,"loading",2),z([Te()],rt.prototype,"localNodeDetected",2),z([Te()],rt.prototype,"newPort",2),z([Te()],rt.prototype,"newRemoteUrl",2),z([Te()],rt.prototype,"isMobile",2),rt=z([Er("connection-options")],rt);var tr=class extends ot{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let n=t.target,i=n.value.replace(/\D/g,"").slice(0,6);n.value=i,this.securityCode=i,this.securityCode.length===6&&this.verifyCode()}render(){return M`
2048
+ `],H([$e({type:Number})],nt.prototype,"port",2),H([$e({type:String})],nt.prototype,"remoteUrl",2),H([$e({type:Boolean})],nt.prototype,"connectingToRemoteNode",2),H([$e({type:Boolean})],nt.prototype,"remoteNodeError",2),H([$e({type:Boolean})],nt.prototype,"showMultiUserOption",2),H([Oe()],nt.prototype,"loading",2),H([Oe()],nt.prototype,"localNodeDetected",2),H([Oe()],nt.prototype,"newPort",2),H([Oe()],nt.prototype,"newRemoteUrl",2),H([Oe()],nt.prototype,"isMobile",2),nt=H([Er("connection-options")],nt);var tr=class extends st{constructor(){super(...arguments);this.capabilities=[];this.appname="";this.appiconpath="";this.verificationError=!1;this.requestSent=!1;this.securityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}))}requestCapability(){this.dispatchEvent(new CustomEvent("request-capability",{bubbles:!0,composed:!0})),this.requestSent=!0}verifyCode(){this.dispatchEvent(new CustomEvent("verify-code",{detail:{code:this.securityCode},bubbles:!0,composed:!0}))}onInputChange(t){this.dispatchEvent(new CustomEvent("clear-verification-error",{bubbles:!0,composed:!0}));let n=t.target,i=n.value.replace(/\D/g,"").slice(0,6);n.value=i,this.securityCode=i,this.securityCode.length===6&&this.verifyCode()}render(){return M`
2023
2049
  <div class="container">
2024
2050
  <div class="back-button" @click=${this.back}>
2025
- ${ha()}
2051
+ ${ga()}
2026
2052
  </div>
2027
2053
 
2028
2054
  <div class="header">
@@ -2032,8 +2058,8 @@ FETCH links
2032
2058
 
2033
2059
  <div class="connection-icons">
2034
2060
  ${this.appiconpath?M`<img class="app-image" src=${this.appiconpath} alt="App Logo" />`:M`<div class="app-initial">${this.appname.charAt(0).toUpperCase()}</div>`}
2035
- <div class="arrow-icon">${qc()}</div>
2036
- <div class="ad4m-logo">${yi()}</div>
2061
+ <div class="arrow-icon">${zc()}</div>
2062
+ <div class="ad4m-logo">${vi()}</div>
2037
2063
  </div>
2038
2064
 
2039
2065
  ${this.requestSent?M`
@@ -2058,7 +2084,7 @@ FETCH links
2058
2084
 
2059
2085
  ${this.verificationError?M`
2060
2086
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2061
- ${mt()}
2087
+ ${yt()}
2062
2088
  <p>Verification failed. Please try again.</p>
2063
2089
  </div>
2064
2090
  `:""}
@@ -2066,7 +2092,7 @@ FETCH links
2066
2092
  <p>This will allow ${this.appname} to</p>
2067
2093
 
2068
2094
  <ul class="box">
2069
- ${this.capabilities.map(t=>M`<li>${er()}<p>${rm(t)}</p></li>`)}
2095
+ ${this.capabilities.map(t=>M`<li>${er()}<p>${um(t)}</p></li>`)}
2070
2096
  </ul>
2071
2097
 
2072
2098
  <div class="row center">
@@ -2076,7 +2102,7 @@ FETCH links
2076
2102
  </div>
2077
2103
  `}
2078
2104
  </div>
2079
- `}};tr.styles=[vn,Rt`
2105
+ `}};tr.styles=[yn,Lt`
2080
2106
  h1 {
2081
2107
  font-size: 34px;
2082
2108
  }
@@ -2158,10 +2184,10 @@ FETCH links
2158
2184
  .state {
2159
2185
  justify-content: center;
2160
2186
  }
2161
- `],z([Ne({type:Array})],tr.prototype,"capabilities",2),z([Ne({type:String})],tr.prototype,"appname",2),z([Ne({type:String})],tr.prototype,"appiconpath",2),z([Ne({type:Boolean})],tr.prototype,"verificationError",2),z([Te()],tr.prototype,"requestSent",2),z([Te()],tr.prototype,"securityCode",2),tr=z([Er("local-authentication")],tr);var Lt=class extends ot{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.email="";this.password="";this.emailSecurityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.emailSecurityCode=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let n=t.target,i=n.value.replace(/\D/g,"").slice(0,6);n.value=i,this.emailSecurityCode=i,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,n=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,i=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,o=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return M`
2187
+ `],H([$e({type:Array})],tr.prototype,"capabilities",2),H([$e({type:String})],tr.prototype,"appname",2),H([$e({type:String})],tr.prototype,"appiconpath",2),H([$e({type:Boolean})],tr.prototype,"verificationError",2),H([Oe()],tr.prototype,"requestSent",2),H([Oe()],tr.prototype,"securityCode",2),tr=H([Er("local-authentication")],tr);var Ft=class extends st{constructor(){super(...arguments);this.remoteAuthState=null;this.remoteAuthLoading=!1;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1;this.email="";this.password="";this.emailSecurityCode=""}back(){this.dispatchEvent(new CustomEvent("back",{bubbles:!0,composed:!0})),this.remoteAuthState=null,this.password="",this.emailSecurityCode=""}emailLogin(){this.dispatchEvent(new CustomEvent("email-login",{detail:{email:this.email.trim()},bubbles:!0,composed:!0}))}verifyEmailCode(){this.dispatchEvent(new CustomEvent("verify-email-code",{detail:{email:this.email.trim(),code:this.emailSecurityCode},bubbles:!0,composed:!0}))}passwordLogin(){this.dispatchEvent(new CustomEvent("password-login",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}createAccount(){this.dispatchEvent(new CustomEvent("create-account",{detail:{email:this.email.trim(),password:this.password},bubbles:!0,composed:!0}))}onEmailSecurityCodeChange(t){this.dispatchEvent(new CustomEvent("clear-email-code-error",{bubbles:!0,composed:!0}));let n=t.target,i=n.value.replace(/\D/g,"").slice(0,6);n.value=i,this.emailSecurityCode=i,this.emailSecurityCode.length===6&&!this.remoteAuthLoading&&this.verifyEmailCode()}isValidEmail(){return/^[^\s@]+@[^\s@]+\.[^\s@]+$/.test(this.email.trim())}render(){let t=!this.remoteAuthState,n=this.remoteAuthState&&this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword,i=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&this.remoteAuthState.isExistingUser,a=this.remoteAuthState&&this.remoteAuthState.requiresPassword&&!this.remoteAuthState.isExistingUser,o=this.remoteAuthState&&!this.remoteAuthState.success&&!this.remoteAuthState.requiresPassword;return M`
2162
2188
  <div class="container">
2163
2189
  <div class="back-button" @click=${this.back}>
2164
- ${ha()}
2190
+ ${ga()}
2165
2191
  </div>
2166
2192
 
2167
2193
  <div class="header">
@@ -2190,7 +2216,7 @@ FETCH links
2190
2216
 
2191
2217
  ${o?M`
2192
2218
  <div class="state danger">
2193
- ${mt()}
2219
+ ${yt()}
2194
2220
  <p>${this.remoteAuthState.message||"Failed to process email. Please try again."}</p>
2195
2221
  </div>
2196
2222
 
@@ -2223,7 +2249,7 @@ FETCH links
2223
2249
 
2224
2250
  ${this.emailCodeError?M`
2225
2251
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2226
- ${mt()}
2252
+ ${yt()}
2227
2253
  <p>Verification failed. Please try again.</p>
2228
2254
  </div>
2229
2255
  `:""}
@@ -2255,7 +2281,7 @@ FETCH links
2255
2281
 
2256
2282
  ${this.passwordError?M`
2257
2283
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2258
- ${mt()}
2284
+ ${yt()}
2259
2285
  <p>Incorrect password. Please try again.</p>
2260
2286
  </div>
2261
2287
  `:""}
@@ -2263,7 +2289,7 @@ FETCH links
2263
2289
 
2264
2290
  ${a?M`
2265
2291
  <div class="state danger">
2266
- ${mt()}
2292
+ ${yt()}
2267
2293
  <p>Email not found</p>
2268
2294
  </div>
2269
2295
 
@@ -2287,14 +2313,14 @@ FETCH links
2287
2313
 
2288
2314
  ${this.accountCreationError?M`
2289
2315
  <div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
2290
- ${mt()}
2316
+ ${yt()}
2291
2317
  <p>Failed to create account. Please try again.</p>
2292
2318
  </div>
2293
2319
  `:""}
2294
2320
  `:""}
2295
2321
 
2296
2322
  </div>
2297
- `}};Lt.styles=[vn,Rt`
2323
+ `}};Ft.styles=[yn,Lt`
2298
2324
  .header h1 {
2299
2325
  font-size: 32px;
2300
2326
  margin-bottom: 0;
@@ -2340,10 +2366,10 @@ FETCH links
2340
2366
  .state {
2341
2367
  justify-content: center;
2342
2368
  }
2343
- `],z([Ne({type:Object})],Lt.prototype,"remoteAuthState",2),z([Ne({type:Boolean})],Lt.prototype,"remoteAuthLoading",2),z([Ne({type:Boolean})],Lt.prototype,"emailCodeError",2),z([Ne({type:Boolean})],Lt.prototype,"passwordError",2),z([Ne({type:Boolean})],Lt.prototype,"accountCreationError",2),z([Te()],Lt.prototype,"email",2),z([Te()],Lt.prototype,"password",2),z([Te()],Lt.prototype,"emailSecurityCode",2),Lt=z([Er("remote-authentication")],Lt);var bn=class extends ot{constructor(){super(...arguments);this.url="";this.port=12e3;this.authState="unauthenticated"}get connectionType(){return this.url.includes("localhost")||this.url.includes("127.0.0.1")?"local":"remote"}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}render(){let t=this.connectionType==="local";return M`
2369
+ `],H([$e({type:Object})],Ft.prototype,"remoteAuthState",2),H([$e({type:Boolean})],Ft.prototype,"remoteAuthLoading",2),H([$e({type:Boolean})],Ft.prototype,"emailCodeError",2),H([$e({type:Boolean})],Ft.prototype,"passwordError",2),H([$e({type:Boolean})],Ft.prototype,"accountCreationError",2),H([Oe()],Ft.prototype,"email",2),H([Oe()],Ft.prototype,"password",2),H([Oe()],Ft.prototype,"emailSecurityCode",2),Ft=H([Er("remote-authentication")],Ft);var vn=class extends st{constructor(){super(...arguments);this.url="";this.port=12e3;this.authState="unauthenticated"}get connectionType(){return this.url.includes("localhost")||this.url.includes("127.0.0.1")?"local":"remote"}close(){this.dispatchEvent(new CustomEvent("close",{bubbles:!0,composed:!0}))}disconnect(){this.dispatchEvent(new CustomEvent("disconnect",{bubbles:!0,composed:!0}))}render(){let t=this.connectionType==="local";return M`
2344
2370
  <div class="container">
2345
2371
  <div class="close-button" @click=${this.close}>
2346
- ${mt()}
2372
+ ${yt()}
2347
2373
  </div>
2348
2374
 
2349
2375
  <div class="header">
@@ -2353,7 +2379,7 @@ FETCH links
2353
2379
 
2354
2380
  <div class="box">
2355
2381
  <div class="box-header">
2356
- ${t?da():fa()}
2382
+ ${t?ha():ma()}
2357
2383
  <h3>${t?"Local Node":"Remote Node"}</h3>
2358
2384
  </div>
2359
2385
 
@@ -2385,7 +2411,7 @@ FETCH links
2385
2411
  </button>
2386
2412
  </div>
2387
2413
  </div>
2388
- `}};bn.styles=[vn,Rt`
2414
+ `}};vn.styles=[yn,Lt`
2389
2415
  .box {
2390
2416
  gap: 15px;
2391
2417
  }
@@ -2420,7 +2446,7 @@ FETCH links
2420
2446
  background: rgba(244, 54, 127, 0.2);
2421
2447
  color: var(--ac-danger-color);
2422
2448
  }
2423
- `],z([Ne({type:String})],bn.prototype,"url",2),z([Ne({type:Number})],bn.prototype,"port",2),z([Ne({type:String})],bn.prototype,"authState",2),bn=z([Er("current-state")],bn);var BS=Rt`
2449
+ `],H([$e({type:String})],vn.prototype,"url",2),H([$e({type:Number})],vn.prototype,"port",2),H([$e({type:String})],vn.prototype,"authState",2),vn=H([Er("current-state")],vn);var o_=Lt`
2424
2450
  @import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
2425
2451
 
2426
2452
  :host {
@@ -2505,7 +2531,7 @@ FETCH links
2505
2531
  height: 34px;
2506
2532
  z-index: 99999;
2507
2533
  }
2508
- `,st=class extends ot{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),No(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.token?this.core.connect().catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return K(this,null,function*(){this.core.port=t.detail.port,kt("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return K(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,kt("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return K(this,null,function*(){let n=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!n,n&&(this.modalOpen=!1)})}connectRemoteNode(t){return K(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,kt("ad4m-url",this.core.url);try{if(yield Li(t.detail.remoteUrl),console.log("[Ad4m Connect UI] Remote connection successful"),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");console.log("[Ad4m Connect UI] Remote AD4M API verified");let i=yield this.core.isMultiUser();console.log("[Ad4m Connect UI] Remote multi-user detected:",i),this.currentView="remote-authentication"}catch(n){console.error("[Ad4m Connect UI] Remote connection failed:",n),this.remoteNodeError=!0}finally{this.connectingToRemoteNode=!1}})}emailLogin(t){return K(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return K(this,null,function*(){try{this.remoteAuthLoading=!0;let n=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!n,n&&(this.modalOpen=!1)}catch(n){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return K(this,null,function*(){try{this.remoteAuthLoading=!0;let n=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!n,n&&(this.modalOpen=!1)}catch(n){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return K(this,null,function*(){try{this.remoteAuthLoading=!0;let n=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!n,n&&(this.modalOpen=!1)}catch(n){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return K(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return M`
2534
+ `,ct=class extends st{constructor(){super(...arguments);this.modalOpen=!1;this.currentView="connection-options";this.connectingToRemoteNode=!1;this.remoteNodeError=!1;this.verificationError=!1;this.remoteAuthLoading=!1;this.remoteAuthState=null;this.emailCodeError=!1;this.passwordError=!1;this.accountCreationError=!1}connectedCallback(){super.connectedCallback(),Po(this),this.core.addEventListener("authstatechange",t=>{t.detail==="unauthenticated"&&(this.currentView="connection-options",this.modalOpen=!0),this.requestUpdate()}),this.core.token?this.core.connect().catch(t=>{console.error("[Ad4m Connect UI] Auto-connect failed:",t),this.currentView="connection-options",this.modalOpen=!0}):(this.currentView="connection-options",this.modalOpen=!0)}changePort(t){return Z(this,null,function*(){this.core.port=t.detail.port,Ot("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return Z(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,Ot("ad4m-url",this.core.url);try{yield this.core.connect(),this.currentView="local-authentication"}catch(t){console.error("[Ad4m Connect UI] Local node connection failed:",t),this.currentView="connection-options"}})}verifyLocalAd4mCode(t){return Z(this,null,function*(){let n=yield this.core.verifyLocalAd4mCode(t.detail.code);this.verificationError=!n,n&&(this.modalOpen=!1)})}connectRemoteNode(t){return Z(this,null,function*(){this.remoteNodeError=!1,this.connectingToRemoteNode=!0,this.core.url=t.detail.remoteUrl,Ot("ad4m-url",this.core.url);try{if(yield Li(t.detail.remoteUrl),console.log("[Ad4m Connect UI] Remote connection successful"),!(yield this.core.isValidAd4mAPI()))throw new Error("Server is reachable but doesn't appear to be an AD4M executor");console.log("[Ad4m Connect UI] Remote AD4M API verified");let i=yield this.core.isMultiUser();console.log("[Ad4m Connect UI] Remote multi-user detected:",i),this.currentView="remote-authentication"}catch(n){console.error("[Ad4m Connect UI] Remote connection failed:",n),this.remoteNodeError=!0}finally{this.connectingToRemoteNode=!1}})}emailLogin(t){return Z(this,null,function*(){try{this.remoteAuthLoading=!0,this.remoteAuthState=yield this.core.submitEmail(t.detail.email)}finally{this.remoteAuthLoading=!1}})}verifyEmailCode(t){return Z(this,null,function*(){try{this.remoteAuthLoading=!0;let n=yield this.core.verifyEmailCode(t.detail.email,t.detail.code);this.emailCodeError=!n,n&&(this.modalOpen=!1)}catch(n){this.emailCodeError=!0}finally{this.remoteAuthLoading=!1}})}passwordLogin(t){return Z(this,null,function*(){try{this.remoteAuthLoading=!0;let n=yield this.core.loginWithPassword(t.detail.email,t.detail.password);this.passwordError=!n,n&&(this.modalOpen=!1)}catch(n){this.passwordError=!0}finally{this.remoteAuthLoading=!1}})}createAccount(t){return Z(this,null,function*(){try{this.remoteAuthLoading=!0;let n=yield this.core.createAccount(t.detail.email,t.detail.password);this.accountCreationError=!n,n&&(this.modalOpen=!1)}catch(n){this.accountCreationError=!0}finally{this.remoteAuthLoading=!1}})}disconnect(){return Z(this,null,function*(){yield this.core.disconnect(),window.location.reload()})}renderViews(){if(this.currentView==="connection-options")return M`
2509
2535
  <connection-options
2510
2536
  .port=${this.core.port}
2511
2537
  .remoteUrl=${this.core.options.remoteUrl}
@@ -2554,7 +2580,7 @@ FETCH links
2554
2580
  <div class="wrapper">
2555
2581
  <div class="modal">
2556
2582
  <header class="modal-header">
2557
- ${yi()}
2583
+ ${vi()}
2558
2584
  </header>
2559
2585
  <main class="modal-content">
2560
2586
  ${this.renderViews()}
@@ -2569,9 +2595,9 @@ FETCH links
2569
2595
  aria-label="Open settings"
2570
2596
  @click=${()=>{this.currentView="current-state",this.modalOpen=!0}}
2571
2597
  >
2572
- ${yi()}
2598
+ ${vi()}
2573
2599
  </button>
2574
- `:null}};st.styles=[BS],z([Te()],st.prototype,"modalOpen",2),z([Te()],st.prototype,"currentView",2),z([Te()],st.prototype,"connectingToRemoteNode",2),z([Te()],st.prototype,"remoteNodeError",2),z([Te()],st.prototype,"verificationError",2),z([Te()],st.prototype,"remoteAuthLoading",2),z([Te()],st.prototype,"remoteAuthState",2),z([Te()],st.prototype,"emailCodeError",2),z([Te()],st.prototype,"passwordError",2),z([Te()],st.prototype,"accountCreationError",2),st=z([Er("ad4m-connect")],st);function xp(r){let e=new st;return e.core=r,r.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),document.body.appendChild(e)),e}function VS(r){let e=new $o(r);if(Es()){let t=e.connect();return{core:e,client:t}}else{xp(e);let t=new Promise(n=>{e.addEventListener("authstatechange",i=>{i.detail==="authenticated"&&e.ad4mClient&&n(e.ad4mClient)})});return{core:e,client:t}}}function S$(r){return K(this,null,function*(){let{client:e}=VS(r);return e})}export{S$ as getAd4mClient,VS as getAd4mConnect,Es as isEmbedded};
2600
+ `:null}};ct.styles=[o_],H([Oe()],ct.prototype,"modalOpen",2),H([Oe()],ct.prototype,"currentView",2),H([Oe()],ct.prototype,"connectingToRemoteNode",2),H([Oe()],ct.prototype,"remoteNodeError",2),H([Oe()],ct.prototype,"verificationError",2),H([Oe()],ct.prototype,"remoteAuthLoading",2),H([Oe()],ct.prototype,"remoteAuthState",2),H([Oe()],ct.prototype,"emailCodeError",2),H([Oe()],ct.prototype,"passwordError",2),H([Oe()],ct.prototype,"accountCreationError",2),ct=H([Er("ad4m-connect")],ct);function Tp(r){let e=new ct;return e.core=r,r.embedded?console.log("[Ad4m Connect] Running in embedded mode - UI will not be shown"):(console.log("[Ad4m Connect UI] Mounting UI to DOM"),document.body.appendChild(e)),e}function s_(r){let e=new Lo(r);if(Is()){let t=e.connect();return{core:e,client:t}}else{Tp(e);let t=new Promise(n=>{e.addEventListener("authstatechange",i=>{i.detail==="authenticated"&&e.ad4mClient&&n(e.ad4mClient)})});return{core:e,client:t}}}function M$(r){return Z(this,null,function*(){let{client:e}=s_(r);return e})}export{M$ as getAd4mClient,s_ as getAd4mConnect,Is as isEmbedded};
2575
2601
  /*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
2576
2602
  /**
2577
2603
  * @license