@coasys/ad4m-connect 0.12.0-rc1-dev.1 → 0.12.0-rc1-dev.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/icons/CheckCircleIcon.d.ts +1 -0
- package/dist/components/icons/TickIcon.d.ts +1 -0
- package/dist/components/shared/Ad4mLogo.d.ts +1 -0
- package/dist/components/shared/AppLogo.d.ts +1 -0
- package/dist/components/shared/Header.d.ts +1 -0
- package/dist/components/shared/Logo.d.ts +1 -0
- package/dist/components/states/ErrorState.d.ts +6 -0
- package/dist/components/views/ConnectionOverview.d.ts +22 -0
- package/dist/components/views/Hosting.d.ts +22 -0
- package/dist/components/views/MultiUserAuth.d.ts +26 -0
- package/dist/components/views/RemoteConnection.d.ts +19 -0
- package/dist/components/views/RequestCapability.d.ts +16 -0
- package/dist/components/views/ScanQRCode.d.ts +14 -0
- package/dist/components/views/Settings.d.ts +19 -0
- package/dist/components/views/Start.d.ts +19 -0
- package/dist/components/views/old/Hosting.d.ts +22 -0
- package/dist/components/views/old/MultiUserAuth.d.ts +26 -0
- package/dist/components/views/old/RemoteConnection.d.ts +19 -0
- package/dist/components/views/old/RequestCapability.d.ts +16 -0
- package/dist/components/views/old/ScanQRCode.d.ts +14 -0
- package/dist/components/views/old/Settings.d.ts +19 -0
- package/dist/components/views/old/Start.d.ts +19 -0
- package/dist/core.js +299 -299
- package/dist/index.js +371 -371
- package/dist/old/components/InvalidToken.d.ts +0 -0
- package/dist/old/components/VerifyCode.d.ts +0 -0
- package/dist/old/core.d.ts +0 -0
- package/dist/old/electron.d.ts +0 -0
- package/dist/old/state/ConnectState.d.ts +0 -0
- package/dist/old/state/index.d.ts +0 -0
- package/dist/old/utils.d.ts +0 -0
- package/dist/old/views/Hosting.d.ts +0 -0
- package/dist/old/views/MultiUserAuth.d.ts +0 -0
- package/dist/old/views/RemoteConnection.d.ts +0 -0
- package/dist/old/views/RequestCapability.d.ts +0 -0
- package/dist/old/views/ScanQRCode.d.ts +0 -0
- package/dist/old/views/Settings.d.ts +0 -0
- package/dist/old/views/Start.d.ts +0 -0
- package/dist/old/web.d.ts +0 -0
- package/dist/state/ConnectState.d.ts +101 -0
- package/dist/state/index.d.ts +2 -0
- package/dist/utils.js +1 -1
- package/dist/web.js +340 -340
- package/package.json +14 -14
package/dist/index.js
CHANGED
|
@@ -1,31 +1,31 @@
|
|
|
1
|
-
var
|
|
2
|
-
`)===-1,
|
|
1
|
+
var ug=Object.defineProperty;var lg=Object.getOwnPropertyDescriptor;var pg=Object.getPrototypeOf;var dg=Reflect.get;var Q=(r,e,t,n)=>{for(var i=n>1?void 0:n?lg(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&&ug(e,t,i),i};var xp=(r,e,t)=>dg(pg(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 qc=function(r,e){return qc=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])},qc(r,e)};function Ne(r,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");qc(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(f){o(f)}}function c(l){try{u(n.throw(l))}catch(f){o(f)}}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 Bc="Invariant Violation",kp=Object.setPrototypeOf,fg=kp===void 0?function(r,e){return r.__proto__=e,r}:kp,J=function(r){Ne(e,r);function e(t){t===void 0&&(t=Bc);var n=r.call(this,typeof t=="number"?Bc+": "+t+" (see https://github.com/apollographql/invariant-packages)":t)||this;return n.framesToPop=1,n.name=Bc,fg(n,e.prototype),n}return e}(Error);function L(r,e){if(!r)throw new J(e)}var Uo=["debug","log","warn","error","silent"],Vc=Uo.indexOf("log");function Mo(r){return function(){if(Uo.indexOf(r)>=Vc){var e=console[r]||console.log;return e.apply(console,arguments)}}}(function(r){r.debug=Mo("debug"),r.log=Mo("log"),r.warn=Mo("warn"),r.error=Mo("error")})(L||(L={}));function Ap(r){var e=Uo[Vc];return Vc=Math.max(0,Uo.indexOf(r)),e}function ze(r){try{return r()}catch{}}var jo=ze(function(){return globalThis})||ze(function(){return window})||ze(function(){return self})||ze(function(){return global})||ze(function(){return ze.constructor("return this")()});var Ip="__",Tp=[Ip,Ip].join("DEV");function hg(){try{return Boolean(__DEV__)}catch{return Object.defineProperty(jo,Tp,{value:ze(function(){return"production"})!=="production",enumerable:!1,configurable:!0,writable:!0}),jo[Tp]}}var bn=hg();function Ur(r){try{return r()}catch{}}var Qc=Ur(function(){return globalThis})||Ur(function(){return window})||Ur(function(){return self})||Ur(function(){return global})||Ur(function(){return Ur.constructor("return this")()}),zc=!1;function mg(){Qc&&!Ur(function(){return"production"})&&!Ur(function(){return process})&&(Object.defineProperty(Qc,"process",{value:{env:{NODE_ENV:"production"}},configurable:!0,enumerable:!1,writable:!0}),zc=!0)}mg();function Wc(){zc&&(delete Qc.process,zc=!1)}var YS=typeof Symbol=="function"&&Symbol.iterator!=null?Symbol.iterator:"@@iterator",XS=typeof Symbol=="function"&&Symbol.asyncIterator!=null?Symbol.asyncIterator:"@@asyncIterator",Op=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";var Fe=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function Hc(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var gg=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,ha=gg;function qo(r){var e=r.prototype.toJSON;typeof e=="function"||Hc(0),r.prototype.inspect=e,ha&&(r.prototype[ha]=e)}var Cp=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}();qo(Cp);var Np=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}();qo(Np);function Gc(r){return r!=null&&typeof r.kind=="string"}function Bo(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Bo=function(t){return typeof t}:Bo=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Bo(r)}var yg=10,$p=2;function ma(r){return Vo(r,[])}function Vo(r,e){switch(Bo(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":vg(r,e);default:return String(r)}}function vg(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=Sg(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:Vo(i,t)}else if(Array.isArray(r))return wg(r,t);return bg(r,t)}function bg(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>$p)return"["+_g(r)+"]";var n=t.map(function(i){var a=Vo(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function wg(r,e){if(r.length===0)return"[]";if(e.length>$p)return"[Array]";for(var t=Math.min(yg,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(Vo(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Sg(r){var e=r[String(ha)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function _g(r){var e=Object.prototype.toString.call(r).replace(/^\[object /,"").replace(/]$/,"");if(e==="Object"&&typeof r.constructor=="function"){var t=r.constructor.name;if(typeof t=="string"&&t!=="")return t}return e}function ga(r,e){var t=Boolean(r);if(!t)throw new Error(e)}function Dp(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function Eg(r,e,t){return e&&Dp(r.prototype,e),t&&Dp(r,t),r}var Qo=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"||ga(0,"Body must be a string. Received: ".concat(ma(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||ga(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||ga(0,"column in locationOffset is 1-indexed and must be positive.")}return Eg(r,[{key:Op,get:function(){return"Source"}}]),r}();function Rp(r){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"",t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,n=r.indexOf(`
|
|
2
|
+
`)===-1,i=r[0]===" "||r[0]===" ",a=r[r.length-1]==='"',o=r[r.length-1]==="\\",s=!n||a||o||t,c="";return s&&!(n&&i)&&(c+=`
|
|
3
3
|
`+e),c+=e?r.replace(/\n/g,`
|
|
4
4
|
`+e):r,s&&(c+=`
|
|
5
|
-
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var
|
|
5
|
+
`),'"""'+c.replace(/"""/g,'\\"""')+'"""'}var xg={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 nt(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:xg,n=void 0,i=Array.isArray(r),a=[r],o=-1,s=[],c=void 0,u=void 0,l=void 0,f=[],d=[],p=r;do{o++;var h=o===a.length,m=h&&s.length!==0;if(h){if(u=d.length===0?void 0:f[f.length-1],c=l,l=d.pop(),m){if(i)c=c.slice();else{for(var g={},w=0,b=Object.keys(c);w<b.length;w++){var v=b[w];g[v]=c[v]}c=g}for(var y=0,I=0;I<s.length;I++){var $=s[I][0],A=s[I][1];i&&($-=y),i&&A===null?(c.splice($,1),y++):c[$]=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&&f.push(u)}var R=void 0;if(!Array.isArray(c)){if(!Gc(c))throw new Error("Invalid AST Node: ".concat(ma(c),"."));var P=Kc(e,c.kind,h);if(P){if(R=P.call(e,c,u,l,f,d),R===wn)break;if(R===!1){if(!h){f.pop();continue}}else if(R!==void 0&&(s.push([u,R]),!h))if(Gc(R))c=R;else{f.pop();continue}}}if(R===void 0&&m&&s.push([u,c]),h)f.pop();else{var D;n={inArray:i,index:o,keys:a,edits:s,prev:n},i=Array.isArray(c),a=i?c:(D=t[c.kind])!==null&&D!==void 0?D:[],o=-1,s=[],l&&d.push(l),l=c}}while(n!==void 0);return s.length!==0&&(p=s[s.length-1][1]),p}function Kc(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:Ag})}var kg=80,Ag={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,
|
|
9
|
-
`,
|
|
8
|
+
`},OperationDefinition:function(e){var t=e.operation,n=e.name,i=Oe("(",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+Oe(" = ",i)+Oe(" ",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=Oe("",t,": ")+n,c=s+Oe("(",F(i,", "),")");return c.length>kg&&(c=s+Oe(`(
|
|
9
|
+
`,zo(F(i,`
|
|
10
10
|
`)),`
|
|
11
|
-
)`)),F([c,F(a," "),o]," ")},Argument:function(e){var t=e.name,
|
|
12
|
-
`,
|
|
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+Oe(" ",F(n," "))},InlineFragment:function(e){var t=e.typeCondition,n=e.directives,i=e.selectionSet;return F(["...",Oe("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(Oe("(",F(i,", "),")")," ")+"on ".concat(n," ").concat(Oe("",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?Rp(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+Oe("(",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,Oe("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+(Lp(t)?Oe(`(
|
|
12
|
+
`,zo(F(t,`
|
|
13
13
|
`)),`
|
|
14
|
-
)`):
|
|
15
|
-
`,
|
|
14
|
+
)`):Oe("(",F(t,", "),")"))+": "+n+Oe(" ",F(i," "))}),InputValueDefinition:Ht(function(r){var e=r.name,t=r.type,n=r.defaultValue,i=r.directives;return F([e+": "+t,Oe("= ",n),F(i," ")]," ")}),InterfaceTypeDefinition:Ht(function(r){var e=r.name,t=r.interfaces,n=r.directives,i=r.fields;return F(["interface",e,Oe("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+(Lp(t)?Oe(`(
|
|
15
|
+
`,zo(F(t,`
|
|
16
16
|
`)),`
|
|
17
|
-
)`):
|
|
18
|
-
`)}}function F(r){var e,t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"";return(e=r?.filter(function(
|
|
19
|
-
`,
|
|
17
|
+
)`):Oe("(",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,Oe("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,Oe("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 Oe(`{
|
|
19
|
+
`,zo(F(r,`
|
|
20
20
|
`)),`
|
|
21
|
-
}`)}function
|
|
21
|
+
}`)}function Oe(r,e){var t=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"";return e!=null&&e!==""?r+e+t:""}function zo(r){return Oe(" ",r.replace(/\n/g,`
|
|
22
22
|
`))}function Ig(r){return r.indexOf(`
|
|
23
|
-
`)!==-1}function Rp(r){return r!=null&&r.some(Ig)}function ya(r){return r.kind===je.FIELD||r.kind===je.FRAGMENT_SPREAD||r.kind===je.INLINE_FRAGMENT}function Lp(){return typeof Vo=="function"?zc():zc()}function Pg(){__DEV__?P(typeof yi=="boolean",yi):P(typeof yi=="boolean",39)}Lp();Pg();function _r(r,e){var t=r.directives;return!t||!t.length?!0:Pp(t).every(function(i){var n=i.directive,a=i.ifArgument,o=!1;return a.value.kind==="Variable"?(o=e&&e[a.value.name.value],__DEV__?P(o!==void 0,"Invalid variable referenced in @".concat(n.name.value," directive.")):P(o!==void 0,40)):o=a.value.value,n.name.value==="skip"?!o:o})}function bn(r,e,t){var i=new Set(r),n=i.size;return at(e,{Directive:function(a){if(i.delete(a.name.value)&&(!t||!i.size))return vi}}),t?!i.size:i.size<n}function Kc(r){return r&&bn(["client","export"],r,!0)}function Fg(r){var e=r.name.value;return e==="skip"||e==="include"}function Pp(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Fg(t)){var i=t.arguments,n=t.name.value;__DEV__?P(i&&i.length===1,"Incorrect number of arguments for the @".concat(n," directive.")):P(i&&i.length===1,41);var a=i[0];__DEV__?P(a.name&&a.name.value==="if","Invalid argument for the @".concat(n," 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(n," 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 Jc(r,e){var t=e,i=[];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"&&i.push(a)}),typeof t>"u"&&(__DEV__?P(i.length===1,"Found ".concat(i.length," fragments. `fragmentName` must be provided when there is not exactly 1 fragment.")):P(i.length===1,45),t=i[0].name.value);var n=x(x({},r),{definitions:Pr([{kind:"OperationDefinition",operation:"query",selectionSet:{kind:"SelectionSet",selections:[{kind:"FragmentSpread",name:{kind:"Name",value:t}}]}}],r.definitions,!0)});return n}function bi(r){r===void 0&&(r=[]);var e={};return r.forEach(function(t){e[t.name.value]=t}),e}function wi(r,e){switch(r.kind){case"InlineFragment":return r;case"FragmentSpread":{var t=r.name.value;if(typeof e=="function")return e(t);var i=e&&e[t];return __DEV__?P(i,"No fragment named ".concat(t)):P(i,46),i||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 Zc(r){return le(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Mg(r){return r.kind==="StringValue"}function Ug(r){return r.kind==="BooleanValue"}function jg(r){return r.kind==="IntValue"}function qg(r){return r.kind==="FloatValue"}function Bg(r){return r.kind==="Variable"}function Vg(r){return r.kind==="ObjectValue"}function Qg(r){return r.kind==="ListValue"}function zg(r){return r.kind==="EnumValue"}function Wg(r){return r.kind==="NullValue"}function Mr(r,e,t,i){if(jg(t)||qg(t))r[e.value]=Number(t.value);else if(Ug(t)||Mg(t))r[e.value]=t.value;else if(Vg(t)){var n={};t.fields.map(function(o){return Mr(n,o.name,o.value,i)}),r[e.value]=n}else if(Bg(t)){var a=(i||{})[t.name.value];r[e.value]=a}else if(Qg(t))r[e.value]=t.values.map(function(o){var s={};return Mr(s,e,o,i),s[e.value]});else if(zg(t))r[e.value]=t.value;else if(Wg(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 Yc(r,e){var t=null;r.directives&&(t={},r.directives.forEach(function(n){t[n.name.value]={},n.arguments&&n.arguments.forEach(function(a){var o=a.name,s=a.value;return Mr(t[n.name.value],o,s,e)})}));var i=null;return r.arguments&&r.arguments.length&&(i={},r.arguments.forEach(function(n){var a=n.name,o=n.value;return Mr(i,a,o,e)})),ba(r.name.value,i,t)}var Hg=["connection","include","skip","client","rest","export"],ba=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var i=t.connection.filter?t.connection.filter:[];i.sort();var n={};return i.forEach(function(s){n[s]=e[s]}),"".concat(t.connection.key,"(").concat(va(n),")")}else return t.connection.key;var a=r;if(e){var o=va(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){Hg.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(va(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=va;return va=r,e}}),va=function(e){return JSON.stringify(e,Gg)};function Gg(r,e){return le(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,i){return t[i]=e[i],t},{})),e}function Er(r,e){if(r.arguments&&r.arguments.length){var t={};return r.arguments.forEach(function(i){var n=i.name,a=i.value;return Mr(t,n,a,e)}),t}return null}function Mt(r){return r.alias?r.alias.value:r.name.value}function wa(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var i=0,n=e.selections;i<n.length;i++){var a=n[i];if(At(a)){if(a.name.value==="__typename")return r[Mt(a)]}else{var o=wa(r,wi(a,t).selectionSet,t);if(typeof o=="string")return o}}}function At(r){return r.kind==="Field"}function Xc(r){return r.kind==="InlineFragment"}function wn(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 J('Schema type definitions not allowed in queries. Found: "'.concat(t.kind,'"')):new J(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 wn(r),r.definitions.filter(function(e){return e.kind==="OperationDefinition"})[0]}function Sn(r){return r.definitions.filter(function(e){return e.kind==="OperationDefinition"&&!!e.name}).map(function(e){return e.name.value})[0]||null}function Si(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Sa(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 eu(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 _i(r){wn(r);for(var e,t=0,i=r.definitions;t<i.length;t++){var n=i[t];if(n.kind==="OperationDefinition"){var a=n.operation;if(a==="query"||a==="mutation"||a==="subscription")return n}n.kind==="FragmentDefinition"&&!e&&(e=n)}if(e)return e;throw __DEV__?new J("Expected a parsed GraphQL query with a query, mutation, subscription, or a fragment."):new J(54)}function Ei(r){var e=Object.create(null),t=r&&r.variableDefinitions;return t&&t.length&&t.forEach(function(i){i.defaultValue&&Mr(e,i.variable.name,i.defaultValue)}),e}var be=Array.isArray;function Be(r){return Array.isArray(r)&&r.length>0}var Fp={kind:je.FIELD,name:{kind:je.NAME,value:"__typename"}};function Up(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===je.FRAGMENT_SPREAD&&Up(e[t.name.value],e)})}function Kg(r){return Up(or(r)||eu(r),bi(Si(r)))?null:r}function Jg(r){var e=new Set,t=[];return r.forEach(function(i){i.name?e.add(i.name):i.test&&t.push(i.test)}),function(i){return e.has(i.name.value)||t.some(function(n){return n(i)})}}function Mp(r){var e=new Map;return function(i){i===void 0&&(i=r);var n=e.get(i);return n||e.set(i,n={variables:new Set,fragmentSpreads:new Set}),n}}function tu(r,e){for(var t=Mp(""),i=Mp(""),n=function(w){for(var _=0,v=void 0;_<w.length&&(v=w[_]);++_)if(!be(v)){if(v.kind===je.OPERATION_DEFINITION)return t(v.name&&v.name.value);if(v.kind===je.FRAGMENT_DEFINITION)return i(v.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===je.OPERATION_DEFINITION&&++a;var s=Jg(r),c=r.some(function(w){return w.remove}),u=function(w){return c&&w&&w.some(s)},l=new Map,f=!1,d={enter:function(w){if(u(w.directives))return f=!0,null}},p=at(e,{Field:d,InlineFragment:d,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(w,_,v,T,$){var E=n($);E&&E.variables.add(w.name.value)}},FragmentSpread:{enter:function(w,_,v,T,$){if(u(w.directives))return f=!0,null;var E=n($);E&&E.fragmentSpreads.add(w.name.value)}},FragmentDefinition:{enter:function(w,_,v,T){l.set(JSON.stringify(T),w)},leave:function(w,_,v,T){var $=l.get(JSON.stringify(T));if(w===$)return w;if(a>0&&w.selectionSet.selections.every(function(E){return E.kind===je.FIELD&&E.name.value==="__typename"}))return i(w.name.value).removed=!0,f=!0,null}},Directive:{leave:function(w){if(s(w))return f=!0,null}}});if(!f)return e;var h=function(w){return w.transitiveVars||(w.transitiveVars=new Set(w.variables),w.removed||w.fragmentSpreads.forEach(function(_){h(i(_)).transitiveVars.forEach(function(v){w.transitiveVars.add(v)})})),w},m=new Set;p.definitions.forEach(function(w){w.kind===je.OPERATION_DEFINITION?h(t(w.name&&w.name.value)).fragmentSpreads.forEach(function(_){m.add(_)}):w.kind===je.FRAGMENT_DEFINITION&&a===0&&!i(w.name.value).removed&&m.add(w.name.value)}),m.forEach(function(w){h(i(w)).fragmentSpreads.forEach(function(_){m.add(_)})});var y=function(w){return!!(!m.has(w)||i(w).removed)},S={enter:function(w){if(y(w.name.value))return null}};return Kg(at(p,{FragmentSpread:S,FragmentDefinition:S,OperationDefinition:{leave:function(w){if(w.variableDefinitions){var _=h(t(w.name&&w.name.value)).transitiveVars;if(_.size<w.variableDefinitions.length)return x(x({},w),{variableDefinitions:w.variableDefinitions.filter(function(v){return _.has(v.variable.name.value)})})}}}}))}var xi=Object.assign(function(r){return at(r,{SelectionSet:{enter:function(e,t,i){if(!(i&&i.kind===je.OPERATION_DEFINITION)){var n=e.selections;if(!!n){var a=n.some(function(s){return At(s)&&(s.name.value==="__typename"||s.name.value.lastIndexOf("__",0)===0)});if(!a){var o=i;if(!(At(o)&&o.directives&&o.directives.some(function(s){return s.name.value==="export"})))return x(x({},e),{selections:Pr(Pr([],n,!0),[Fp],!1)})}}}}}})},{added:function(r){return r===Fp}}),Zg={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 ru(r){return tu([Zg],wn(r))}function iu(r){var e=_i(r),t=e.operation;if(t==="query")return r;var i=at(r,{OperationDefinition:{enter:function(n){return x(x({},n),{operation:"query"})}}});return i}function nu(r){wn(r);var e=tu([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Yg=Object.prototype.hasOwnProperty;function au(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return _a(r)}function _a(r){var e=r[0]||{},t=r.length;if(t>1)for(var i=new vt,n=1;n<t;++n)e=i.merge(e,r[n]);return e}var Xg=function(r,e,t){return this.merge(r[t],e[t])},vt=function(){function r(e){e===void 0&&(e=Xg),this.reconciler=e,this.isObject=le,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var i=this,n=[],a=2;a<arguments.length;a++)n[a-2]=arguments[a];return le(t)&&le(e)?(Object.keys(t).forEach(function(o){if(Yg.call(e,o)){var s=e[o];if(t[o]!==s){var c=i.reconciler.apply(i,Pr([e,t,o],n,!1));c!==s&&(e=i.shallowCopyForMerge(e),e[o]=c)}}else e=i.shallowCopyForMerge(e),e[o]=t[o]}),e):t},r.prototype.shallowCopyForMerge=function(e){return le(e)&&(this.pastCopies.has(e)||(Array.isArray(e)?e=e.slice(0):e=x({__proto__:Object.getPrototypeOf(e)},e),this.pastCopies.add(e))),e},r}();function ey(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=ty(r))||e&&r&&typeof r.length=="number"){t&&(r=t);var i=0;return function(){return i>=r.length?{done:!0}:{done:!1,value:r[i++]}}}throw new TypeError(`Invalid attempt to iterate non-iterable instance.
|
|
24
|
-
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function ty(r,e){if(!!r){if(typeof r=="string")return jp(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 jp(r,e)}}function jp(r,e){(e==null||e>r.length)&&(e=r.length);for(var t=0,i=new Array(e);t<e;t++)i[t]=r[t];return i}function qp(r,e){for(var t=0;t<e.length;t++){var i=e[t];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(r,i.key,i)}}function uu(r,e,t){return e&&qp(r.prototype,e),t&&qp(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var lu=function(){return typeof Symbol=="function"},pu=function(r){return lu()&&Boolean(Symbol[r])},du=function(r){return pu(r)?Symbol[r]:"@@"+r};lu()&&!pu("observable")&&(Symbol.observable=Symbol("observable"));var ry=du("iterator"),su=du("observable"),Bp=du("species");function Wo(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Ea(r){var e=r.constructor;return e!==void 0&&(e=e[Bp],e===null&&(e=void 0)),e!==void 0?e:re}function iy(r){return r instanceof re}function _n(r){_n.log?_n.log(r):setTimeout(function(){throw r})}function zo(r){Promise.resolve().then(function(){try{r()}catch(e){_n(e)}})}function Vp(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Wo(e,"unsubscribe");t&&t.call(e)}}catch(i){_n(i)}}function cu(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function ny(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(Qp(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function Qp(r,e,t){r._state="running";var i=r._observer;try{var n=Wo(i,e);switch(e){case"next":n&&n.call(i,t);break;case"error":if(cu(r),n)n.call(i,t);else throw t;break;case"complete":cu(r),n&&n.call(i);break}}catch(a){_n(a)}r._state==="closed"?Vp(r):r._state==="running"&&(r._state="ready")}function ou(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 ny(r)});return}Qp(r,e,t)}}var ay=function(){function r(t,i){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var n=new oy(this);try{this._cleanup=i.call(void 0,n)}catch(a){n.error(a)}this._state==="initializing"&&(this._state="ready")}var e=r.prototype;return e.unsubscribe=function(){this._state!=="closed"&&(cu(this),Vp(this))},uu(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),oy=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(i){ou(this._subscription,"next",i)},e.error=function(i){ou(this._subscription,"error",i)},e.complete=function(){ou(this._subscription,"complete")},uu(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),re=function(){function r(t){if(!(this instanceof r))throw new TypeError("Observable cannot be called as a function");if(typeof t!="function")throw new TypeError("Observable initializer must be a function");this._subscriber=t}var e=r.prototype;return e.subscribe=function(i){return(typeof i!="object"||i===null)&&(i={next:i,error:arguments[1],complete:arguments[2]}),new ay(i,this._subscriber)},e.forEach=function(i){var n=this;return new Promise(function(a,o){if(typeof i!="function"){o(new TypeError(i+" is not a function"));return}function s(){c.unsubscribe(),a()}var c=n.subscribe({next:function(u){try{i(u,s)}catch(l){o(l),c.unsubscribe()}},error:o,complete:a})})},e.map=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){return n.subscribe({next:function(s){try{s=i(s)}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.filter=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){return n.subscribe({next:function(s){try{if(!i(s))return}catch(c){return o.error(c)}o.next(s)},error:function(s){o.error(s)},complete:function(){o.complete()}})})},e.reduce=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return n.subscribe({next:function(f){var d=!s;if(s=!0,!d||o)try{u=i(u,f)}catch(p){return l.error(p)}else u=f},error:function(f){l.error(f)},complete:function(){if(!s&&!o)return l.error(new TypeError("Cannot reduce an empty sequence"));l.next(u),l.complete()}})})},e.concat=function(){for(var i=this,n=arguments.length,a=new Array(n),o=0;o<n;o++)a[o]=arguments[o];var s=Ea(this);return new s(function(c){var u,l=0;function f(d){u=d.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){l===a.length?(u=void 0,c.complete()):f(s.from(a[l++]))}})}return f(i),function(){u&&(u.unsubscribe(),u=void 0)}})},e.flatMap=function(i){var n=this;if(typeof i!="function")throw new TypeError(i+" is not a function");var a=Ea(this);return new a(function(o){var s=[],c=n.subscribe({next:function(l){if(i)try{l=i(l)}catch(d){return o.error(d)}var f=a.from(l).subscribe({next:function(d){o.next(d)},error:function(d){o.error(d)},complete:function(){var d=s.indexOf(f);d>=0&&s.splice(d,1),u()}});s.push(f)},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[su]=function(){return this},r.from=function(i){var n=typeof this=="function"?this:r;if(i==null)throw new TypeError(i+" is not an object");var a=Wo(i,su);if(a){var o=a.call(i);if(Object(o)!==o)throw new TypeError(o+" is not an object");return iy(o)&&o.constructor===n?o:new n(function(s){return o.subscribe(s)})}if(pu("iterator")&&(a=Wo(i,ry),a))return new n(function(s){zo(function(){if(!s.closed){for(var c=ey(a.call(i)),u;!(u=c()).done;){var l=u.value;if(s.next(l),s.closed)return}s.complete()}})});if(Array.isArray(i))return new n(function(s){zo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})});throw new TypeError(i+" is not observable")},r.of=function(){for(var i=arguments.length,n=new Array(i),a=0;a<i;a++)n[a]=arguments[a];var o=typeof this=="function"?this:r;return new o(function(s){zo(function(){if(!s.closed){for(var c=0;c<n.length;++c)if(s.next(n[c]),s.closed)return;s.complete()}})})},uu(r,null,[{key:Bp,get:function(){return this}}]),r}();lu()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:su,hostReportError:_n},configurable:!0});function fu(r){var e,t=r.Symbol;if(typeof t=="function")if(t.observable)e=t.observable;else{typeof t.for=="function"?e=t.for("https://github.com/benlesh/symbol-observable"):e=t("https://github.com/benlesh/symbol-observable");try{t.observable=e}catch{}}else e="@@observable";return e}var En;typeof self<"u"?En=self:typeof window<"u"?En=window:typeof global<"u"?En=global:typeof module<"u"?En=module:En=Function("return this")();var w1=fu(En);var zp=re.prototype,Wp="@@observable";zp[Wp]||(zp[Wp]=function(){return this});var sy=Object.prototype.toString;function Ho(r){return hu(r)}function hu(r,e){switch(sy.call(r)){case"[object Array]":{if(e=e||new Map,e.has(r))return e.get(r);var t=r.slice(0);return e.set(r,t),t.forEach(function(n,a){t[a]=hu(n,e)}),t}case"[object Object]":{if(e=e||new Map,e.has(r))return e.get(r);var i=Object.create(Object.getPrototypeOf(r));return e.set(r,i),Object.keys(r).forEach(function(n){i[n]=hu(r[n],e)}),i}default:return r}}function cy(r){var e=new Set([r]);return e.forEach(function(t){le(t)&&uy(t)===t&&Object.getOwnPropertyNames(t).forEach(function(i){le(t[i])&&e.add(t[i])})}),r}function uy(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function xa(r){return __DEV__&&cy(r),r}function Ai(r,e,t){var i=[];r.forEach(function(n){return n[e]&&i.push(n)}),i.forEach(function(n){return n[e](t)})}function Go(r,e,t){return new re(function(i){var n=i.next,a=i.error,o=i.complete,s=0,c=!1,u={then:function(p){return new Promise(function(h){return h(p())})}};function l(p,h){return p?function(m){++s;var y=function(){return p(m)};u=u.then(y,y).then(function(S){--s,n&&n.call(i,S),c&&f.complete()},function(S){throw--s,S}).catch(function(S){a&&a.call(i,S)})}:function(m){return h&&h.call(i,m)}}var f={next:l(e,n),error:l(t,a),complete:function(){c=!0,s||o&&o.call(i)}},d=r.subscribe(f);return function(){return d.unsubscribe()}})}var Ut=typeof WeakMap=="function"&&He(function(){return navigator.product})!=="ReactNative",Hp=typeof WeakSet=="function",mu=typeof Symbol=="function"&&typeof Symbol.for=="function",Ur=mu&&Symbol.asyncIterator,$1=typeof He(function(){return window.document.createElement})=="function",R1=He(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Ko(r){function e(t){Object.defineProperty(r,t,{value:re})}return mu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Gp(r){return r&&typeof r.then=="function"}var xn=function(r){Re(e,r);function e(t){var i=r.call(this,function(n){return i.addObserver(n),function(){return i.removeObserver(n)}})||this;return i.observers=new Set,i.promise=new Promise(function(n,a){i.resolve=n,i.reject=a}),i.handlers={next:function(n){i.sub!==null&&(i.latest=["next",n],i.notify("next",n),Ai(i.observers,"next",n))},error:function(n){var a=i.sub;a!==null&&(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest=["error",n],i.reject(n),i.notify("error",n),Ai(i.observers,"error",n))},complete:function(){var n=i,a=n.sub,o=n.sources,s=o===void 0?[]:o;if(a!==null){var c=s.shift();c?Gp(c)?c.then(function(u){return i.sub=u.subscribe(i.handlers)}):i.sub=c.subscribe(i.handlers):(a&&setTimeout(function(){return a.unsubscribe()}),i.sub=null,i.latest&&i.latest[0]==="next"?i.resolve(i.latest[1]):i.resolve(),i.notify("complete"),Ai(i.observers,"complete"))}}},i.nextResultListeners=new Set,i.cancel=function(n){i.reject(n),i.sources=[],i.handlers.complete()},i.promise.catch(function(n){}),typeof t=="function"&&(t=[new re(t)]),Gp(t)?t.then(function(n){return i.start(n)},i.handlers.error):i.start(t),i}return e.prototype.start=function(t){this.sub===void 0&&(this.sources=Array.from(t),this.handlers.complete())},e.prototype.deliverLastMessage=function(t){if(this.latest){var i=this.latest[0],n=t[i];n&&n.call(t,this.latest[1]),this.sub===null&&i==="next"&&t.complete&&t.complete()}},e.prototype.addObserver=function(t){this.observers.has(t)||(this.deliverLastMessage(t),this.observers.add(t))},e.prototype.removeObserver=function(t){this.observers.delete(t)&&this.observers.size<1&&this.handlers.complete()},e.prototype.notify=function(t,i){var n=this.nextResultListeners;n.size&&(this.nextResultListeners=new Set,n.forEach(function(a){return a(t,i)}))},e.prototype.beforeNext=function(t){var i=!1;this.nextResultListeners.add(function(n,a){i||(i=!0,t(n,a))})},e}(re);Ko(xn);function jr(r){return"incremental"in r}function ly(r){return"hasNext"in r&&"data"in r}function Kp(r){return jr(r)||ly(r)}function Jo(r,e){var t=r,i=new vt;return jr(e)&&Be(e.incremental)&&e.incremental.forEach(function(n){for(var a=n.data,o=n.path,s=o.length-1;s>=0;--s){var c=o[s],u=!isNaN(+c),l=u?[]:{};l[c]=a,a=l}t=i.merge(t,a)}),t}function An(r){var e=Zo(r);return Be(e)}function Zo(r){var e=Be(r.errors)?r.errors.slice(0):[];return jr(r)&&Be(r.incremental)&&r.incremental.forEach(function(t){t.errors&&e.push.apply(e,t.errors)}),e}function qr(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];var t=Object.create(null);return r.forEach(function(i){!i||Object.keys(i).forEach(function(n){var a=i[n];a!==void 0&&(t[n]=a)})}),t}var Jp=new Map;function Aa(r){var e=Jp.get(r)||1;return Jp.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Zp(r){var e=Aa("stringifyForDisplay");return JSON.stringify(r,function(t,i){return i===void 0?e:i}).split(JSON.stringify(e)).join("<undefined>")}function Ia(r,e){return qr(r,e,e.variables&&{variables:x(x({},r&&r.variables),e.variables)})}function Yo(r){return new re(function(e){e.error(r)})}var ka=function(r,e,t){var i=new Error(t);throw i.name="ServerError",i.response=r,i.statusCode=r.status,i.result=e,i};function gu(r){for(var e=["query","operationName","variables","extensions","context"],t=0,i=Object.keys(r);t<i.length;t++){var n=i[t];if(e.indexOf(n)<0)throw __DEV__?new J("illegal argument: ".concat(n)):new J(27)}return r}function yu(r,e){var t=x({},r),i=function(a){typeof a=="function"?t=x(x({},t),a(t)):t=x(x({},t),a)},n=function(){return x({},t)};return Object.defineProperty(e,"setContext",{enumerable:!1,value:i}),Object.defineProperty(e,"getContext",{enumerable:!1,value:n}),e}function vu(r){var e={variables:r.variables||{},extensions:r.extensions||{},operationName:r.operationName,query:r.query};return e.operationName||(e.operationName=typeof e.query!="string"?Sn(e.query)||void 0:""),e}function Yp(r,e){return e?e(r):re.of()}function Ta(r){return typeof r=="function"?new jt(r):r}function Xo(r){return r.request.length<=1}var py=function(r){Re(e,r);function e(t,i){var n=r.call(this,t)||this;return n.link=i,n}return e}(Error),jt=function(){function r(e){e&&(this.request=e)}return r.empty=function(){return new r(function(){return re.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Ta).reduce(function(t,i){return t.concat(i)})},r.split=function(e,t,i){var n=Ta(t),a=Ta(i||new r(Yp));return Xo(n)&&Xo(a)?new r(function(o){return e(o)?n.request(o)||re.of():a.request(o)||re.of()}):new r(function(o,s){return e(o)?n.request(o,s)||re.of():a.request(o,s)||re.of()})},r.execute=function(e,t){return e.request(yu(t.context,vu(gu(t))))||re.of()},r.concat=function(e,t){var i=Ta(e);if(Xo(i))return __DEV__&&P.warn(new py("You are calling concat on a terminating link, which will have no effect",i)),i;var n=Ta(t);return Xo(n)?new r(function(a){return i.request(a,function(o){return n.request(o)||re.of()})||re.of()}):new r(function(a,o){return i.request(a,function(s){return n.request(s,o)||re.of()})||re.of()})},r.prototype.split=function(e,t,i){return this.concat(r.split(e,t,i||new r(Yp)))},r.prototype.concat=function(e){return r.concat(this,e)},r.prototype.request=function(e,t){throw __DEV__?new 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 In=jt.execute;var Xp="3.7.10";function ed(r){return!!r.body}function td(r){return!!r.getReader}function rd(r){return!!(Ur&&r[Symbol.asyncIterator])}function id(r){return!!r.stream}function nd(r){return!!r.arrayBuffer}function ad(r){return!!r.pipe}function bu(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function wu(r){var e=null,t=null,i=!1,n=[],a=[];function o(f){if(!t){if(a.length){var d=a.shift();if(Array.isArray(d)&&d[0])return d[0]({value:f,done:!1})}n.push(f)}}function s(f){t=f;var d=a.slice();d.forEach(function(p){p[1](f)}),!e||e()}function c(){i=!0;var f=a.slice();f.forEach(function(d){d[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(f,d){if(t)return d(t);if(n.length)return f({value:n.shift(),done:!1});if(i)return f({value:void 0,done:!0});a.push([f,d])})}var l={next:function(){return u()}};return Ur&&(l[Symbol.asyncIterator]=function(){return this}),l}function Su(r){var e=!1,t={next:function(){return e?Promise.resolve({value:void 0,done:!0}):(e=!0,new Promise(function(i,n){r.then(function(a){i({value:a,done:!1})}).catch(n)}))}};return Ur&&(t[Symbol.asyncIterator]=function(){return this}),t}function es(r){var e={next:function(){return r.read()}};return Ur&&(e[Symbol.asyncIterator]=function(){return this}),e}function od(r){var e=r;if(ed(r)&&(e=r.body),rd(e))return bu(e);if(td(e))return es(e.getReader());if(id(e))return es(e.stream().getReader());if(nd(e))return Su(e.arrayBuffer());if(ad(e))return wu(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var sd=Object.prototype.hasOwnProperty;function cd(r,e){var t,i,n;return Ht(this,void 0,void 0,function(){var a,o,s,c,u,l,f,d,p,h,m,y,S,w,_,v,T,$,E,R;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="",f=od(r),d=!0,L.label=1;case 1:return d?[4,f.next()]:[3,3];case 2:for(p=L.sent(),h=p.value,m=p.done,y=typeof h=="string"?h:a.decode(h),d=!m,l+=y,S=l.indexOf(u);S>-1;){if(w=void 0,R=[l.slice(0,S),l.slice(S+u.length)],w=R[0],l=R[1],w.trim()){if(_=w.indexOf(`\r
|
|
23
|
+
`)!==-1}function Lp(r){return r!=null&&r.some(Ig)}function ya(r){return r.kind===Fe.FIELD||r.kind===Fe.FRAGMENT_SPREAD||r.kind===Fe.INLINE_FRAGMENT}function Pp(){return typeof Qo=="function"?Wc():Wc()}function Fg(){__DEV__?L(typeof bn=="boolean",bn):L(typeof bn=="boolean",39)}Pp();Fg();function xr(r,e){var t=r.directives;return!t||!t.length?!0:Fp(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 wn}}),t?!n.size:n.size<i}function Jc(r){return r&&wi(["client","export"],r,!0)}function Mg(r){var e=r.name.value;return e==="skip"||e==="include"}function Fp(r){var e=[];return r&&r.length&&r.forEach(function(t){if(!!Mg(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 Zc(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 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__?L(n,"No fragment named ".concat(t)):L(n,46),n||null}default:return null}}function ce(r){return r!==null&&typeof r=="object"}function ar(r){return{__ref:String(r)}}function ne(r){return Boolean(r&&typeof r=="object"&&typeof r.__ref=="string")}function Yc(r){return ce(r)&&r.kind==="Document"&&Array.isArray(r.definitions)}function Ug(r){return r.kind==="StringValue"}function jg(r){return r.kind==="BooleanValue"}function qg(r){return r.kind==="IntValue"}function Bg(r){return r.kind==="FloatValue"}function Vg(r){return r.kind==="Variable"}function Qg(r){return r.kind==="ObjectValue"}function zg(r){return r.kind==="ListValue"}function Wg(r){return r.kind==="EnumValue"}function Hg(r){return r.kind==="NullValue"}function jr(r,e,t,n){if(qg(t)||Bg(t))r[e.value]=Number(t.value);else if(jg(t)||Ug(t))r[e.value]=t.value;else if(Qg(t)){var i={};t.fields.map(function(o){return jr(i,o.name,o.value,n)}),r[e.value]=i}else if(Vg(t)){var a=(n||{})[t.name.value];r[e.value]=a}else if(zg(t))r[e.value]=t.values.map(function(o){var s={};return jr(s,e,o,n),s[e.value]});else if(Wg(t))r[e.value]=t.value;else if(Hg(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 Xc(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)})),ba(r.name.value,n,t)}var Gg=["connection","include","skip","client","rest","export"],ba=Object.assign(function(r,e,t){if(e&&t&&t.connection&&t.connection.key)if(t.connection.filter&&t.connection.filter.length>0){var 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(va(i),")")}else return t.connection.key;var a=r;if(e){var o=va(e);a+="(".concat(o,")")}return t&&Object.keys(t).forEach(function(s){Gg.indexOf(s)===-1&&(t[s]&&Object.keys(t[s]).length?a+="@".concat(s,"(").concat(va(t[s]),")"):a+="@".concat(s))}),a},{setStringify:function(r){var e=va;return va=r,e}}),va=function(e){return JSON.stringify(e,Kg)};function Kg(r,e){return ce(e)&&!Array.isArray(e)&&(e=Object.keys(e).sort().reduce(function(t,n){return t[n]=e[n],t},{})),e}function 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 Pt(r){return r.alias?r.alias.value:r.name.value}function wa(r,e,t){if(typeof r.__typename=="string")return r.__typename;for(var 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=wa(r,_n(a,t).selectionSet,t);if(typeof o=="string")return o}}}function xt(r){return r.kind==="Field"}function eu(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 En(r){return r.definitions.filter(function(e){return e.kind==="FragmentDefinition"})}function Sa(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 tu(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 xn(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&&jr(e,n.variable.name,n.defaultValue)}),e}var ve=Array.isArray;function je(r){return Array.isArray(r)&&r.length>0}var Mp={kind:Fe.FIELD,name:{kind:Fe.NAME,value:"__typename"}};function jp(r,e){return!r||r.selectionSet.selections.every(function(t){return t.kind===Fe.FRAGMENT_SPREAD&&jp(e[t.name.value],e)})}function Jg(r){return jp(or(r)||tu(r),Sn(En(r)))?null:r}function Zg(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 ru(r,e){for(var t=Up(""),n=Up(""),i=function(b){for(var v=0,y=void 0;v<b.length&&(y=b[v]);++v)if(!ve(y)){if(y.kind===Fe.OPERATION_DEFINITION)return t(y.name&&y.name.value);if(y.kind===Fe.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===Fe.OPERATION_DEFINITION&&++a;var s=Zg(r),c=r.some(function(b){return b.remove}),u=function(b){return c&&b&&b.some(s)},l=new Map,f=!1,d={enter:function(b){if(u(b.directives))return f=!0,null}},p=nt(e,{Field:d,InlineFragment:d,VariableDefinition:{enter:function(){return!1}},Variable:{enter:function(b,v,y,I,$){var A=i($);A&&A.variables.add(b.name.value)}},FragmentSpread:{enter:function(b,v,y,I,$){if(u(b.directives))return f=!0,null;var A=i($);A&&A.fragmentSpreads.add(b.name.value)}},FragmentDefinition:{enter:function(b,v,y,I){l.set(JSON.stringify(I),b)},leave:function(b,v,y,I){var $=l.get(JSON.stringify(I));if(b===$)return b;if(a>0&&b.selectionSet.selections.every(function(A){return A.kind===Fe.FIELD&&A.name.value==="__typename"}))return n(b.name.value).removed=!0,f=!0,null}},Directive:{leave:function(b){if(s(b))return f=!0,null}}});if(!f)return e;var h=function(b){return b.transitiveVars||(b.transitiveVars=new Set(b.variables),b.removed||b.fragmentSpreads.forEach(function(v){h(n(v)).transitiveVars.forEach(function(y){b.transitiveVars.add(y)})})),b},m=new Set;p.definitions.forEach(function(b){b.kind===Fe.OPERATION_DEFINITION?h(t(b.name&&b.name.value)).fragmentSpreads.forEach(function(v){m.add(v)}):b.kind===Fe.FRAGMENT_DEFINITION&&a===0&&!n(b.name.value).removed&&m.add(b.name.value)}),m.forEach(function(b){h(n(b)).fragmentSpreads.forEach(function(v){m.add(v)})});var g=function(b){return!!(!m.has(b)||n(b).removed)},w={enter:function(b){if(g(b.name.value))return null}};return Jg(nt(p,{FragmentSpread:w,FragmentDefinition:w,OperationDefinition:{leave:function(b){if(b.variableDefinitions){var v=h(t(b.name&&b.name.value)).transitiveVars;if(v.size<b.variableDefinitions.length)return E(E({},b),{variableDefinitions:b.variableDefinitions.filter(function(y){return v.has(y.variable.name.value)})})}}}}))}var An=Object.assign(function(r){return nt(r,{SelectionSet:{enter:function(e,t,n){if(!(n&&n.kind===Fe.OPERATION_DEFINITION)){var i=e.selections;if(!!i){var a=i.some(function(s){return 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),[Mp],!1)})}}}}}})},{added:function(r){return r===Mp}}),Yg={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 nu(r){return ru([Yg],Si(r))}function iu(r){var e=xn(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 au(r){Si(r);var e=ru([{test:function(t){return t.name.value==="client"},remove:!0}],r);return e}var Xg=Object.prototype.hasOwnProperty;function ou(){for(var r=[],e=0;e<arguments.length;e++)r[e]=arguments[e];return _a(r)}function _a(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 ey=function(r,e,t){return this.merge(r[t],e[t])},gt=function(){function r(e){e===void 0&&(e=ey),this.reconciler=e,this.isObject=ce,this.pastCopies=new Set}return r.prototype.merge=function(e,t){for(var n=this,i=[],a=2;a<arguments.length;a++)i[a-2]=arguments[a];return ce(t)&&ce(e)?(Object.keys(t).forEach(function(o){if(Xg.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 ce(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 ty(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=ry(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 ry(r,e){if(!!r){if(typeof r=="string")return qp(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 qp(r,e)}}function qp(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 Bp(r,e){for(var t=0;t<e.length;t++){var n=e[t];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(r,n.key,n)}}function lu(r,e,t){return e&&Bp(r.prototype,e),t&&Bp(r,t),Object.defineProperty(r,"prototype",{writable:!1}),r}var pu=function(){return typeof Symbol=="function"},du=function(r){return pu()&&Boolean(Symbol[r])},fu=function(r){return du(r)?Symbol[r]:"@@"+r};pu()&&!du("observable")&&(Symbol.observable=Symbol("observable"));var ny=fu("iterator"),cu=fu("observable"),Vp=fu("species");function Ho(r,e){var t=r[e];if(t!=null){if(typeof t!="function")throw new TypeError(t+" is not a function");return t}}function Ea(r){var e=r.constructor;return e!==void 0&&(e=e[Vp],e===null&&(e=void 0)),e!==void 0?e:re}function iy(r){return r instanceof re}function Ei(r){Ei.log?Ei.log(r):setTimeout(function(){throw r})}function Wo(r){Promise.resolve().then(function(){try{r()}catch(e){Ei(e)}})}function Qp(r){var e=r._cleanup;if(e!==void 0&&(r._cleanup=void 0,!!e))try{if(typeof e=="function")e();else{var t=Ho(e,"unsubscribe");t&&t.call(e)}}catch(n){Ei(n)}}function uu(r){r._observer=void 0,r._queue=void 0,r._state="closed"}function ay(r){var e=r._queue;if(!!e){r._queue=void 0,r._state="ready";for(var t=0;t<e.length&&(zp(r,e[t].type,e[t].value),r._state!=="closed");++t);}}function zp(r,e,t){r._state="running";var n=r._observer;try{var i=Ho(n,e);switch(e){case"next":i&&i.call(n,t);break;case"error":if(uu(r),i)i.call(n,t);else throw t;break;case"complete":uu(r),i&&i.call(n);break}}catch(a){Ei(a)}r._state==="closed"?Qp(r):r._state==="running"&&(r._state="ready")}function su(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}],Wo(function(){return ay(r)});return}zp(r,e,t)}}var oy=function(){function r(t,n){this._cleanup=void 0,this._observer=t,this._queue=void 0,this._state="initializing";var i=new sy(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"&&(uu(this),Qp(this))},lu(r,[{key:"closed",get:function(){return this._state==="closed"}}]),r}(),sy=function(){function r(t){this._subscription=t}var e=r.prototype;return e.next=function(n){su(this._subscription,"next",n)},e.error=function(n){su(this._subscription,"error",n)},e.complete=function(){su(this._subscription,"complete")},lu(r,[{key:"closed",get:function(){return this._subscription._state==="closed"}}]),r}(),re=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 oy(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=Ea(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=Ea(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=Ea(this),o=arguments.length>1,s=!1,c=arguments[1],u=c;return new a(function(l){return i.subscribe({next:function(f){var d=!s;if(s=!0,!d||o)try{u=n(u,f)}catch(p){return l.error(p)}else u=f},error:function(f){l.error(f)},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=Ea(this);return new s(function(c){var u,l=0;function f(d){u=d.subscribe({next:function(p){c.next(p)},error:function(p){c.error(p)},complete:function(){l===a.length?(u=void 0,c.complete()):f(s.from(a[l++]))}})}return f(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=Ea(this);return new a(function(o){var s=[],c=i.subscribe({next:function(l){if(n)try{l=n(l)}catch(d){return o.error(d)}var f=a.from(l).subscribe({next:function(d){o.next(d)},error:function(d){o.error(d)},complete:function(){var d=s.indexOf(f);d>=0&&s.splice(d,1),u()}});s.push(f)},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[cu]=function(){return this},r.from=function(n){var i=typeof this=="function"?this:r;if(n==null)throw new TypeError(n+" is not an object");var a=Ho(n,cu);if(a){var o=a.call(n);if(Object(o)!==o)throw new TypeError(o+" is not an object");return iy(o)&&o.constructor===i?o:new i(function(s){return o.subscribe(s)})}if(du("iterator")&&(a=Ho(n,ny),a))return new i(function(s){Wo(function(){if(!s.closed){for(var c=ty(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){Wo(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){Wo(function(){if(!s.closed){for(var c=0;c<i.length;++c)if(s.next(i[c]),s.closed)return;s.complete()}})})},lu(r,null,[{key:Vp,get:function(){return this}}]),r}();pu()&&Object.defineProperty(re,Symbol("extensions"),{value:{symbol:cu,hostReportError:Ei},configurable:!0});function hu(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 A1=hu(xi);var Wp=re.prototype,Hp="@@observable";Wp[Hp]||(Wp[Hp]=function(){return this});var cy=Object.prototype.toString;function Go(r){return mu(r)}function mu(r,e){switch(cy.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]=mu(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]=mu(r[i],e)}),n}default:return r}}function uy(r){var e=new Set([r]);return e.forEach(function(t){ce(t)&&ly(t)===t&&Object.getOwnPropertyNames(t).forEach(function(n){ce(t[n])&&e.add(t[n])})}),r}function ly(r){if(__DEV__&&!Object.isFrozen(r))try{Object.freeze(r)}catch(e){if(e instanceof TypeError)return null;throw e}return r}function xa(r){return __DEV__&&uy(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 Ko(r,e,t){return new re(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 g=function(){return p(m)};u=u.then(g,g).then(function(w){--s,i&&i.call(n,w),c&&f.complete()},function(w){throw--s,w}).catch(function(w){a&&a.call(n,w)})}:function(m){return h&&h.call(n,m)}}var f={next:l(e,i),error:l(t,a),complete:function(){c=!0,s||o&&o.call(n)}},d=r.subscribe(f);return function(){return d.unsubscribe()}})}var Ft=typeof WeakMap=="function"&&ze(function(){return navigator.product})!=="ReactNative",Gp=typeof WeakSet=="function",gu=typeof Symbol=="function"&&typeof Symbol.for=="function",qr=gu&&Symbol.asyncIterator,U1=typeof ze(function(){return window.document.createElement})=="function",j1=ze(function(){return navigator.userAgent.indexOf("jsdom")>=0})||!1;function Jo(r){function e(t){Object.defineProperty(r,t,{value:re})}return gu&&Symbol.species&&e(Symbol.species),e("@@species"),r}function Kp(r){return r&&typeof r.then=="function"}var ki=function(r){Ne(e,r);function e(t){var n=r.call(this,function(i){return n.addObserver(i),function(){return n.removeObserver(i)}})||this;return n.observers=new Set,n.promise=new Promise(function(i,a){n.resolve=i,n.reject=a}),n.handlers={next:function(i){n.sub!==null&&(n.latest=["next",i],n.notify("next",i),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?Kp(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 re(t)]),Kp(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}(re);Jo(ki);function Br(r){return"incremental"in r}function py(r){return"hasNext"in r&&"data"in r}function Jp(r){return Br(r)||py(r)}function Zo(r,e){var t=r,n=new gt;return Br(e)&&je(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 Ai(r){var e=Yo(r);return je(e)}function Yo(r){var e=je(r.errors)?r.errors.slice(0):[];return Br(r)&&je(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 Zp=new Map;function ka(r){var e=Zp.get(r)||1;return Zp.set(r,e+1),"".concat(r,":").concat(e,":").concat(Math.random().toString(36).slice(2))}function Yp(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 Aa(r,e){return Vr(r,e,e.variables&&{variables:E(E({},r&&r.variables),e.variables)})}function Xo(r){return new re(function(e){e.error(r)})}var Ia=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 yu(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 vu(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 bu(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 Xp(r,e){return e?e(r):re.of()}function Ta(r){return typeof r=="function"?new Mt(r):r}function es(r){return r.request.length<=1}var dy=function(r){Ne(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 re.of()})},r.from=function(e){return e.length===0?r.empty():e.map(Ta).reduce(function(t,n){return t.concat(n)})},r.split=function(e,t,n){var i=Ta(t),a=Ta(n||new r(Xp));return es(i)&&es(a)?new r(function(o){return e(o)?i.request(o)||re.of():a.request(o)||re.of()}):new r(function(o,s){return e(o)?i.request(o,s)||re.of():a.request(o,s)||re.of()})},r.execute=function(e,t){return e.request(vu(t.context,bu(yu(t))))||re.of()},r.concat=function(e,t){var n=Ta(e);if(es(n))return __DEV__&&L.warn(new dy("You are calling concat on a terminating link, which will have no effect",n)),n;var i=Ta(t);return es(i)?new r(function(a){return n.request(a,function(o){return i.request(o)||re.of()})||re.of()}):new r(function(a,o){return n.request(a,function(s){return i.request(s,o)||re.of()})||re.of()})},r.prototype.split=function(e,t,n){return this.concat(r.split(e,t,n||new r(Xp)))},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 ed="3.7.10";function td(r){return!!r.body}function rd(r){return!!r.getReader}function nd(r){return!!(qr&&r[Symbol.asyncIterator])}function id(r){return!!r.stream}function ad(r){return!!r.arrayBuffer}function od(r){return!!r.pipe}function wu(r){var e,t=r[Symbol.asyncIterator]();return e={next:function(){return t.next()}},e[Symbol.asyncIterator]=function(){return this},e}function Su(r){var e=null,t=null,n=!1,i=[],a=[];function o(f){if(!t){if(a.length){var d=a.shift();if(Array.isArray(d)&&d[0])return d[0]({value:f,done:!1})}i.push(f)}}function s(f){t=f;var d=a.slice();d.forEach(function(p){p[1](f)}),!e||e()}function c(){n=!0;var f=a.slice();f.forEach(function(d){d[0]({value:void 0,done:!0})}),!e||e()}e=function(){e=null,r.removeListener("data",o),r.removeListener("error",s),r.removeListener("end",c),r.removeListener("finish",c),r.removeListener("close",c)},r.on("data",o),r.on("error",s),r.on("end",c),r.on("finish",c),r.on("close",c);function u(){return new Promise(function(f,d){if(t)return d(t);if(i.length)return f({value:i.shift(),done:!1});if(n)return f({value:void 0,done:!0});a.push([f,d])})}var l={next:function(){return u()}};return qr&&(l[Symbol.asyncIterator]=function(){return this}),l}function _u(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 ts(r){var e={next:function(){return r.read()}};return qr&&(e[Symbol.asyncIterator]=function(){return this}),e}function sd(r){var e=r;if(td(r)&&(e=r.body),nd(e))return wu(e);if(rd(e))return ts(e.getReader());if(id(e))return ts(e.stream().getReader());if(ad(e))return _u(e.arrayBuffer());if(od(e))return Su(e);throw new Error("Unknown body type for responseIterator. Please pass a streamable response.")}var cd=Object.prototype.hasOwnProperty;function ud(r,e){var t,n,i;return zt(this,void 0,void 0,function(){var a,o,s,c,u,l,f,d,p,h,m,g,w,b,v,y,I,$,A,R;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="",f=sd(r),d=!0,P.label=1;case 1:return d?[4,f.next()]:[3,3];case 2:for(p=P.sent(),h=p.value,m=p.done,g=typeof h=="string"?h:a.decode(h),d=!m,l+=g,w=l.indexOf(u);w>-1;){if(b=void 0,R=[l.slice(0,w),l.slice(w+u.length)],b=R[0],l=R[1],b.trim()){if(v=b.indexOf(`\r
|
|
25
25
|
\r
|
|
26
|
-
`),
|
|
27
|
-
`,"")),(Object.keys(
|
|
28
|
-
`).forEach(function(t){var
|
|
26
|
+
`),y=fy(b.slice(0,v)),I=y["content-type"],I&&I.toLowerCase().indexOf("application/json")===-1)throw new Error("Unsupported patch content type: application/json is required.");$=b.slice(v);try{A=ld(r,$.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(D){rs(D,e)}}w=l.indexOf(u)}return[3,1];case 3:return(i=e.complete)===null||i===void 0||i.call(e),[2]}})})}function fy(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 ld(r,e){if(r.status>=300){var t=function(){try{return JSON.parse(e)}catch{return e}};Ia(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 rs(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 pd(r,e,t){hy(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 rs(n,t)})}function hy(r){return function(e){return e.text().then(function(t){return ld(e,t)}).then(function(t){return e.status>=300&&Ia(e,t,"Response not successful: Received status code ".concat(e.status)),!Array.isArray(t)&&!cd.call(t,"data")&&!cd.call(t,"errors")&&Ia(e,t,"Server response was missing for query '".concat(Array.isArray(r)?r.map(function(n){return n.operationName}):r.operationName,"'.")),t})}}var Oa=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 my={includeQuery:!0,includeExtensions:!1,preserveHeaderCase:!1},gy={accept:"*/*","content-type":"application/json"},yy={method:"POST"},dd={http:my,headers:gy,options:yy},fd=function(r,e){return e(r)};function hd(r,e){for(var t=[],n=2;n<arguments.length;n++)t[n-2]=arguments[n];var i={},a={};t.forEach(function(f){i=E(E(E({},i),f.options),{headers:E(E({},i.headers),f.headers)}),f.credentials&&(i.credentials=f.credentials),a=E(E({},a),f.http)}),i.headers&&(i.headers=vy(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 vy(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 md=function(r){if(!r&&typeof fetch>"u")throw __DEV__?new J(`
|
|
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 md=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var gd=function(r,e){var t=r.getContext(),i=t.uri;return i||(typeof e=="function"?e(r):e||"/graphql")};function yd(r,e){var t=[],i=function(f,d){t.push("".concat(f,"=").concat(encodeURIComponent(d)))};if("query"in e&&i("query",e.query),e.operationName&&i("operationName",e.operationName),e.variables){var n=void 0;try{n=Oa(e.variables,"Variables map")}catch(f){return{parseError:f}}i("variables",n)}if(e.extensions){var a=void 0;try{a=Oa(e.extensions,"Extensions map")}catch(f){return{parseError:f}}i("extensions",a)}var o="",s=r,c=r.indexOf("#");c!==-1&&(o=r.substr(c),s=r.substr(0,c));var u=s.indexOf("?")===-1?"?":"&",l=s+u+t.join("&")+o;return{newURI:l}}var vd=He(function(){return fetch}),bd=function(r){r===void 0&&(r={});var e=r.uri,t=e===void 0?"/graphql":e,i=r.fetch,n=r.print,a=n===void 0?dd:n,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,f=nr(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&hd(i||vd);var d={http:{includeExtensions:o,preserveHeaderCase:s},options:f.fetchOptions,credentials:f.credentials,headers:f.headers};return new jt(function(p){var h=gd(p,t),m=p.getContext(),y={};if(m.clientAwareness){var S=m.clientAwareness,w=S.name,_=S.version;w&&(y["apollographql-client-name"]=w),_&&(y["apollographql-client-version"]=_)}var v=x(x({},y),m.headers),T={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:v},$=fd(p,a,pd,d,T),E=$.options,R=$.body;if(R.variables&&!l){var L=new Set(Object.keys(R.variables));at(p.query,{Variable:function(ue,rr,te){te&&te.kind!=="VariableDefinition"&&L.delete(ue.name.value)}}),L.size&&(R.variables=x({},R.variables),L.forEach(function(ue){delete R.variables[ue]}))}var D;if(!E.signal){var I=md(),Ie=I.controller,oe=I.signal;D=Ie,D&&(E.signal=oe)}var M=function(ue){return ue.kind==="OperationDefinition"&&ue.operation==="mutation"};if(c&&!p.query.definitions.some(M)&&(E.method="GET"),bn(["defer"],p.query)&&(E.headers=E.headers||{},E.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),E.method==="GET"){var Se=yd(h,R),_e=Se.newURI,ce=Se.parseError;if(ce)return Yo(ce);h=_e}else try{E.body=Oa(R,"Payload")}catch(ue){return Yo(ue)}return new re(function(ue){var rr=i||He(function(){return fetch})||vd;return rr(h,E).then(function(te){var ir;p.setContext({response:te});var Lr=(ir=te.headers)===null||ir===void 0?void 0:ir.get("content-type");return Lr!==null&&/^multipart\/mixed/i.test(Lr)?cd(te,ue):ld(te,p,ue)}).catch(function(te){return ts(te,ue)}),function(){D&&D.abort()}})})};var _u=function(r){Re(e,r);function e(t){t===void 0&&(t={});var i=r.call(this,bd(t).request)||this;return i.options=t,i}return e}(jt);var{toString:wd,hasOwnProperty:vy}=Object.prototype,Sd=Function.prototype.toString,Eu=new Map;function ke(r,e){try{return xu(r,e)}finally{Eu.clear()}}function xu(r,e){if(r===e)return!0;let t=wd.call(r),i=wd.call(e);if(t!==i)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(Ed(r,e))return!0;let n=_d(r),a=_d(e),o=n.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!vy.call(e,n[s]))return!1;for(let s=0;s<o;++s){let c=n[s];if(!xu(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(Ed(r,e))return!0;let n=r.entries(),a=t==="[object Map]";for(;;){let o=n.next();if(o.done)break;let[s,c]=o.value;if(!e.has(s)||a&&!xu(c,e.get(s)))return!1}return!0}case"[object Uint16Array]":case"[object Uint8Array]":case"[object Uint32Array]":case"[object Int32Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object ArrayBuffer]":r=new Uint8Array(r),e=new Uint8Array(e);case"[object DataView]":{let n=r.byteLength;if(n===e.byteLength)for(;n--&&r[n]===e[n];);return n===-1}case"[object AsyncFunction]":case"[object GeneratorFunction]":case"[object AsyncGeneratorFunction]":case"[object Function]":{let n=Sd.call(r);return n!==Sd.call(e)?!1:!Sy(n,wy)}}return!1}function _d(r){return Object.keys(r).filter(by,r)}function by(r){return this[r]!==void 0}var wy="{ [native code] }";function Sy(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function Ed(r,e){let t=Eu.get(r);if(t){if(t.has(e))return!0}else Eu.set(r,t=new Set);return t.add(e),!1}var _y=function(){return Object.create(null)},xd=Array.prototype,Ey=xd.forEach,xy=xd.slice,sr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=_y),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 Ey.call(e,function(i){return t=t.getChildTrie(i)}),t.data||(t.data=this.makeData(xy.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Ay(e)?this.weak||(this.weak=new WeakMap):this.strong||(this.strong=new Map),i=t.get(e);return i||t.set(e,i=new r(this.weakness,this.makeData)),i},r}();function Ay(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var et=null,Ad={},Iy=1,ky=()=>class{constructor(){this.id=["slot",Iy++,Date.now(),Math.random().toString(36).slice(2)].join(":")}hasValue(){for(let e=et;e;e=e.parent)if(this.id in e.slots){let t=e.slots[this.id];if(t===Ad)break;return e!==et&&(et.slots[this.id]=t),!0}return et&&(et.slots[this.id]=Ad),!1}getValue(){if(this.hasValue())return et.slots[this.id]}withValue(e,t,i,n){let a={__proto__:null,[this.id]:e},o=et;et={parent:o,slots:a};try{return t.apply(n,i)}finally{et=o}}static bind(e){let t=et;return function(){let i=et;try{return et=t,e.apply(this,arguments)}finally{et=i}}}static noContext(e,t,i){if(et){let n=et;try{return et=null,e.apply(i,t)}finally{et=n}}else return e.apply(i,t)}};function Id(r){try{return r()}catch{}}var Au="@wry/context:Slot",Ty=Id(()=>globalThis)||Id(()=>global)||Object.create(null),kd=Ty,kn=kd[Au]||Array[Au]||function(r){try{Object.defineProperty(kd,Au,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(ky());var{bind:Oy,noContext:Cy}=kn;function Ny(){}var Dy=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=Ny),this.max=e,this.dispose=t,this.map=new Map,this.newest=null,this.oldest=null}return r.prototype.has=function(e){return this.map.has(e)},r.prototype.get=function(e){var t=this.getNode(e);return t&&t.value},r.prototype.getNode=function(e){var t=this.map.get(e);if(t&&t!==this.newest){var i=t.older,n=t.newer;n&&(n.older=i),i&&(i.newer=n),t.older=this.newest,t.older.newer=t,t.newer=null,this.newest=t,t===this.oldest&&(this.oldest=n)}return t},r.prototype.set=function(e,t){var i=this.getNode(e);return i?i.value=t:(i={key:e,value:t,newer:null,older:this.newest},this.newest&&(this.newest.newer=i),this.newest=i,this.oldest=this.oldest||i,this.map.set(e,i),i.value)},r.prototype.clean=function(){for(;this.oldest&&this.map.size>this.max;)this.delete(this.oldest.key)},r.prototype.delete=function(e){var t=this.map.get(e);return t?(t===this.newest&&(this.newest=t.older),t===this.oldest&&(this.oldest=t.newer),t.newer&&(t.newer.older=t.older),t.older&&(t.older.newer=t.newer),this.map.delete(e),this.dispose(t.value,e),!0):!1},r}(),is=new kn,Iu,$y=Object.prototype.hasOwnProperty,Tu=(Iu=Array.from,Iu===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Iu);function rs(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Ca=[],Ry=100;function Tn(r,e){if(!r)throw new Error(e||"assertion failure")}function Ly(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Od(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Py(r){return r.slice(0)}var Fy=function(){function r(e){this.fn=e,this.parents=new Set,this.childValues=new Map,this.dirtyChildren=null,this.dirty=!0,this.recomputing=!1,this.value=[],this.deps=null,++r.count}return r.prototype.peek=function(){if(this.value.length===1&&!Br(this))return Td(this),this.value[0]},r.prototype.recompute=function(e){return Tn(!this.recomputing,"already recomputing"),Td(this),Br(this)?My(this,e):Od(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,Cd(this),rs(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Ld(this),Ou(this,function(t,i){t.setDirty(),Pd(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Ca.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Tu(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Ca.push(this.deps),this.deps=null)},r.count=0,r}();function Td(r){var e=is.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Br(r)?Dd(e,r):$d(e,r),e}function My(r,e){return Ld(r),is.withValue(r,Uy,[r,e]),qy(r,e)&&jy(r),Od(r.value)}function Uy(r,e){r.recomputing=!0,r.value.length=0;try{r.value[0]=r.fn.apply(null,e)}catch(t){r.value[1]=t}r.recomputing=!1}function Br(r){return r.dirty||!!(r.dirtyChildren&&r.dirtyChildren.size)}function jy(r){r.dirty=!1,!Br(r)&&Nd(r)}function Cd(r){Ou(r,Dd)}function Nd(r){Ou(r,$d)}function Ou(r,e){var t=r.parents.size;if(t)for(var i=Tu(r.parents),n=0;n<t;++n)e(i[n],r)}function Dd(r,e){Tn(r.childValues.has(e)),Tn(Br(e));var t=!Br(r);if(!r.dirtyChildren)r.dirtyChildren=Ca.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&Cd(r)}function $d(r,e){Tn(r.childValues.has(e)),Tn(!Br(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Py(e.value)):Ly(t,e.value)||r.setDirty(),Rd(r,e),!Br(r)&&Nd(r)}function Rd(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ca.length<Ry&&Ca.push(t),r.dirtyChildren=null))}function Ld(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Pd(r,t)}),r.forgetDeps(),Tn(r.dirtyChildren===null)}function Pd(r,e){e.parents.delete(r),r.childValues.delete(e),Rd(r,e)}function qy(r,e){if(typeof r.subscribe=="function")try{rs(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var By={setDirty:!0,dispose:!0,forget:!0};function ns(r){var e=new Map,t=r&&r.subscribe;function i(n){var a=is.getValue();if(a){var o=e.get(n);o||e.set(n,o=new Set),a.dependOn(o),typeof t=="function"&&(rs(o),o.unsubscribe=t(n))}}return i.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&$y.call(By,o)?o:"setDirty";Tu(s).forEach(function(u){return u[c]()}),e.delete(a),rs(s)}},i}function Fd(){var r=new sr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var mA=Fd(),ku=new Set;function Ii(r,e){e===void 0&&(e=Object.create(null));var t=new Dy(e.max||Math.pow(2,16),function(u){return u.dispose()}),i=e.keyArgs,n=e.makeCacheKey||Fd(),a=function(){var u=n.apply(null,i?i.apply(null,arguments):arguments);if(u===void 0)return r.apply(null,arguments);var l=t.get(u);l||(t.set(u,l=new Fy(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var f=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),ku.add(t),is.hasValue()||(ku.forEach(function(d){return d.clean()}),ku.clear()),f};Object.defineProperty(a,"size",{get:function(){return t.map.size},configurable:!1,enumerable:!1});function o(u){var l=t.get(u);l&&l.setDirty()}a.dirtyKey=o,a.dirty=function(){o(n.apply(null,arguments))};function s(u){var l=t.get(u);if(l)return l.peek()}a.peekKey=s,a.peek=function(){return s(n.apply(null,arguments))};function c(u){return t.delete(u)}return a.forgetKey=c,a.forget=function(){return c(n.apply(null,arguments))},a.makeCacheKey=n,a.getKey=i?function(){return n.apply(null,i.apply(null,arguments))}:n,Object.freeze(a)}var Cu=function(){function r(){this.getFragmentDoc=Ii(Jc)}return r.prototype.batch=function(e){var t=this,i=typeof e.optimistic=="string"?e.optimistic:e.optimistic===!1?null:void 0,n;return this.performTransaction(function(){return n=e.update(t)},i),n},r.prototype.recordOptimisticTransaction=function(e,t){this.performTransaction(e,t)},r.prototype.transformDocument=function(e){return e},r.prototype.transformForLink=function(e){return e},r.prototype.identify=function(e){},r.prototype.gc=function(){return[]},r.prototype.modify=function(e){return!1},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!!e.optimistic),this.read(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,i=e.data,n=nr(e,["id","data"]);return this.write(Object.assign(n,{dataId:t||"ROOT_QUERY",result:i}))},r.prototype.writeFragment=function(e){var t=e.id,i=e.data,n=e.fragment,a=e.fragmentName,o=nr(e,["id","data","fragment","fragmentName"]);return this.write(Object.assign(o,{query:this.getFragmentDoc(n,a),dataId:t,result:i}))},r.prototype.updateQuery=function(e,t){return this.batch({update:function(i){var n=i.readQuery(e),a=t(n);return a==null?n:(i.writeQuery(x(x({},e),{data:a})),a)}})},r.prototype.updateFragment=function(e,t){return this.batch({update:function(i){var n=i.readFragment(e),a=t(n);return a==null?n:(i.writeFragment(x(x({},e),{data:a})),a)}})},r}();var Na=function(r){Re(e,r);function e(t,i,n,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=i,s.query=n,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var Le=Object.prototype.hasOwnProperty;function Da(r){return r==null}function os(r,e){var t=r.__typename,i=r.id,n=r._id;if(typeof t=="string"&&(e&&(e.keyObject=Da(i)?Da(n)?void 0:{_id:n}:{id:i}),Da(i)&&!Da(n)&&(i=n),!Da(i)))return"".concat(t,":").concat(typeof i=="number"||typeof i=="string"?i:JSON.stringify(i))}var Md={dataIdFromObject:os,addTypename:!0,resultCaching:!0,canonizeResults:!1};function Ud(r){return qr(Md,r)}function ss(r){var e=r.canonizeResults;return e===void 0?Md.canonizeResults:e}function jd(r,e){return ie(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var Nu=/^[_a-z][_0-9a-z]*/i;function Zt(r){var e=r.match(Nu);return e?e[0]:r}function as(r,e,t){return le(e)?be(e)?e.every(function(i){return as(r,i,t)}):r.selections.every(function(i){if(At(i)&&_r(i,t)){var n=Mt(i);return Le.call(e,n)&&(!i.selectionSet||as(i.selectionSet,e[n],t))}return!0}):!1}function Vr(r){return le(r)&&!ie(r)&&!be(r)}function qd(){return new vt}function cs(r,e){var t=bi(Si(r));return{fragmentMap:t,lookupFragment:function(i){var n=t[i];return!n&&e&&(n=e.lookup(i)),n||null}}}var us=Object.create(null),Du=function(){return us},Bd=Object.create(null),On=function(){function r(e,t){var i=this;this.policies=e,this.group=t,this.data=Object.create(null),this.rootIds=Object.create(null),this.refs=Object.create(null),this.getFieldValue=function(n,a){return xa(ie(n)?i.get(n.__ref,a):n&&n[a])},this.canRead=function(n){return ie(n)?i.has(n.__ref):typeof n=="object"},this.toReference=function(n,a){if(typeof n=="string")return ar(n);if(ie(n))return n;var o=i.policies.identify(n)[0];if(o){var s=ar(o);return a&&i.merge(o,n),s}}}return r.prototype.toObject=function(){return 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),Le.call(this.data,e)){var i=this.data[e];if(i&&Le.call(i,t))return i[t]}if(t==="__typename"&&Le.call(this.policies.rootTypenamesById,e))return this.policies.rootTypenamesById[e];if(this instanceof Qr)return this.parent.get(e,t)},r.prototype.lookup=function(e,t){if(t&&this.group.depend(e,"__exists"),Le.call(this.data,e))return this.data[e];if(this instanceof Qr)return this.parent.lookup(e,t);if(this.policies.rootTypenamesById[e])return Object.create(null)},r.prototype.merge=function(e,t){var i=this,n;ie(e)&&(e=e.__ref),ie(t)&&(t=t.__ref);var a=typeof e=="string"?this.lookup(n=e):e,o=typeof t=="string"?this.lookup(n=t):t;if(!!o){__DEV__?P(typeof n=="string","store.merge expects a string ID"):P(typeof n=="string",1);var s=new vt(Qy).merge(a,o);if(this.data[n]=s,s!==a&&(delete this.refs[n],this.group.caching)){var c=Object.create(null);a||(c.__exists=1),Object.keys(o).forEach(function(u){if(!a||a[u]!==s[u]){c[u]=1;var l=Zt(u);l!==u&&!i.policies.hasKeyArgs(s.__typename,l)&&(c[l]=1),s[u]===void 0&&!(i instanceof Qr)&&delete s[u]}}),c.__typename&&!(a&&a.__typename)&&this.policies.rootTypenamesById[n]===s.__typename&&delete c.__typename,Object.keys(c).forEach(function(u){return i.group.dirty(n,u)})}}},r.prototype.modify=function(e,t){var i=this,n=this.lookup(e);if(n){var a=Object.create(null),o=!1,s=!0,c={DELETE:us,INVALIDATE:Bd,isReference:ie,toReference:this.toReference,canRead:this.canRead,readField:function(u,l){return i.policies.readField(typeof u=="string"?{fieldName:u,from:l||ar(e)}:u,{store:i})}};if(Object.keys(n).forEach(function(u){var l=Zt(u),f=n[u];if(f!==void 0){var d=typeof t=="function"?t:t[u]||t[l];if(d){var p=d===Du?us:d(xa(f),x(x({},c),{fieldName:l,storeFieldName:u,storage:i.getStorage(e,u)}));p===Bd?i.group.dirty(e,u):(p===us&&(p=void 0),p!==f&&(a[u]=p,o=!0,f=p))}f!==void 0&&(s=!1)}}),o)return this.merge(e,a),s&&(this instanceof Qr?this.data[e]=void 0:delete this.data[e],this.group.dirty(e,"__exists")),!0}return!1},r.prototype.delete=function(e,t,i){var n,a=this.lookup(e);if(a){var o=this.getFieldValue(a,"__typename"),s=t&&i?this.policies.getStoreFieldName({typename:o,fieldName:t,args:i}):t;return this.modify(e,s?(n={},n[s]=Du,n):Du)}return!1},r.prototype.evict=function(e,t){var i=!1;return e.id&&(Le.call(this.data,e.id)&&(i=this.delete(e.id,e.fieldName,e.args)),this instanceof Qr&&this!==t&&(i=this.parent.evict(e,t)||i),(e.fieldName||i)&&this.group.dirty(e.id,e.fieldName||"__exists")),i},r.prototype.clear=function(){this.replace(null)},r.prototype.extract=function(){var e=this,t=this.toObject(),i=[];return this.getRootIdSet().forEach(function(n){Le.call(e.policies.rootTypenamesById,n)||i.push(n)}),i.length&&(t.__META={extraRootIds:i.sort()}),t},r.prototype.replace=function(e){var t=this;if(Object.keys(this.data).forEach(function(a){e&&Le.call(e,a)||t.delete(a)}),e){var i=e.__META,n=nr(e,["__META"]);Object.keys(n).forEach(function(a){t.merge(a,n[a])}),i&&i.extraRootIds.forEach(this.retain,this)}},r.prototype.retain=function(e){return this.rootIds[e]=(this.rootIds[e]||0)+1},r.prototype.release=function(e){if(this.rootIds[e]>0){var t=--this.rootIds[e];return t||delete this.rootIds[e],t}return 0},r.prototype.getRootIdSet=function(e){return e===void 0&&(e=new Set),Object.keys(this.rootIds).forEach(e.add,e),this instanceof Qr?this.parent.getRootIdSet(e):Object.keys(this.policies.rootTypenamesById).forEach(e.add,e),e},r.prototype.gc=function(){var e=this,t=this.getRootIdSet(),i=this.toObject();t.forEach(function(o){Le.call(i,o)&&(Object.keys(e.findChildRefIds(o)).forEach(t.add,t),delete i[o])});var n=Object.keys(i);if(n.length){for(var a=this;a instanceof Qr;)a=a.parent;n.forEach(function(o){return a.delete(o)})}return n},r.prototype.findChildRefIds=function(e){if(!Le.call(this.refs,e)){var t=this.refs[e]=Object.create(null),i=this.data[e];if(!i)return t;var n=new Set([i]);n.forEach(function(a){ie(a)&&(t[a.__ref]=!0),le(a)&&Object.keys(a).forEach(function(o){var s=a[o];le(s)&&n.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Vd=function(){function r(e,t){t===void 0&&(t=null),this.caching=e,this.parent=t,this.d=null,this.resetCaching()}return r.prototype.resetCaching=function(){this.d=this.caching?ns():null,this.keyMaker=new sr(Ut)},r.prototype.depend=function(e,t){if(this.d){this.d($u(e,t));var i=Zt(t);i!==t&&this.d($u(e,i)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty($u(e,t),t==="__exists"?"forget":"setDirty")},r}();function $u(r,e){return e+"#"+r}function Ru(r,e){ki(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Re(i,t);function i(n){var a=n.policies,o=n.resultCaching,s=o===void 0?!0:o,c=n.seed,u=t.call(this,a,new Vd(s))||this;return u.stump=new Vy(u),u.storageTrie=new sr(Ut),c&&u.replace(c),u}return i.prototype.addLayer=function(n,a){return this.stump.addLayer(n,a)},i.prototype.removeLayer=function(){return this},i.prototype.getStorage=function(){return this.storageTrie.lookupArray(arguments)},i}(r);r.Root=e})(On||(On={}));var Qr=function(r){Re(e,r);function e(t,i,n,a){var o=r.call(this,i.policies,a)||this;return o.id=t,o.parent=i,o.replay=n,o.group=a,n(o),o}return e.prototype.addLayer=function(t,i){return new e(t,this,i,this.group)},e.prototype.removeLayer=function(t){var i=this,n=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=i.data[a],s=n.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){ke(o[c],s[c])||i.group.dirty(a,c)}):(i.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){i.group.dirty(a,c)})):i.delete(a)}),n):n===this.parent?this:n.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return x(x({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var i=this.parent.findChildRefIds(t);return Le.call(this.data,t)?x(x({},i),r.prototype.findChildRefIds.call(this,t)):i},e.prototype.getStorage=function(){for(var t=this.parent;t.parent;)t=t.parent;return t.getStorage.apply(t,arguments)},e}(On),Vy=function(r){Re(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Vd(t.group.caching,t.group))||this}return e.prototype.removeLayer=function(){return this},e.prototype.merge=function(){return this.parent.merge.apply(this.parent,arguments)},e}(Qr);function Qy(r,e,t){var i=r[t],n=e[t];return ke(i,n)?i:n}function ki(r){return!!(r instanceof On&&r.group.caching)}function zy(r){return le(r)?be(r)?r.slice(0):x({__proto__:Object.getPrototypeOf(r)},r):r}var ls=function(){function r(){this.known=new(Hp?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=zy(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(le(e)){var i=this.passes.get(e);if(i)return i;var n=Object.getPrototypeOf(e);switch(n){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var f=o.object=Object.create(s);this.known.add(f),u.sorted.forEach(function(p,h){f[p]=c[l+h]}),__DEV__&&Object.freeze(f)}return o.object}}}return e},r.prototype.sortedKeys=function(e){var t=Object.keys(e),i=this.pool.lookupArray(t);if(!i.keys){t.sort();var n=JSON.stringify(t);(i.keys=this.keysByJSON.get(n))||this.keysByJSON.set(n,i.keys={sorted:t,json:n})}return i.keys},r}();var It=Object.assign(function(r){if(le(r)){Lu===void 0&&Qd();var e=Lu.admit(r),t=Pu.get(e);return t===void 0&&Pu.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:Qd}),Lu,Pu;function Qd(){Lu=new ls,Pu=new(Ut?WeakMap:Map)}function zd(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Wd=function(){function r(e){var t=this;this.knownResults=new(Ut?WeakMap:Map),this.config=qr(e,{addTypename:e.addTypename!==!1,canonizeResults:ss(e)}),this.canon=e.canon||new ls,this.executeSelectionSet=Ii(function(i){var n,a=i.context.canonizeResults,o=zd(i);o[3]=!a;var s=(n=t.executeSelectionSet).peek.apply(n,o);return s?a?x(x({},s),{result:t.canon.admit(s.result)}):s:(Ru(i.context.store,i.enclosingRef.__ref),t.execSelectionSetImpl(i))},{max:this.config.resultCacheMaxSize,keyArgs:zd,makeCacheKey:function(i,n,a,o){if(ki(a.store))return a.store.makeCacheKey(i,ie(n)?n.__ref:n,a.varString,o)}}),this.executeSubSelectedArray=Ii(function(i){return Ru(i.context.store,i.enclosingRef.__ref),t.execSubSelectedArrayImpl(i)},{max:this.config.resultCacheMaxSize,makeCacheKey:function(i){var n=i.field,a=i.array,o=i.context;if(ki(o.store))return o.store.makeCacheKey(n,a,o.varString)}})}return r.prototype.resetCanon=function(){this.canon=new ls},r.prototype.diffQueryAgainstStore=function(e){var t=e.store,i=e.query,n=e.rootId,a=n===void 0?"ROOT_QUERY":n,o=e.variables,s=e.returnPartialData,c=s===void 0?!0:s,u=e.canonizeResults,l=u===void 0?this.config.canonizeResults:u,f=this.config.cache.policies;o=x(x({},Ei(Sa(i))),o);var d=ar(a),p=this.executeSelectionSet({selectionSet:_i(i).selectionSet,objectOrReference:d,enclosingRef:d,context:x({store:t,query:i,policies:f,variables:o,varString:It(o),canonizeResults:l},cs(i,this.config.fragments))}),h;if(p.missing&&(h=[new Na(Wy(p.missing),p.missing,i,o)],!c))throw h[0];return{result:p.result,complete:!h,missing:h}},r.prototype.isFresh=function(e,t,i,n){if(ki(n.store)&&this.knownResults.get(e)===i){var a=this.executeSelectionSet.peek(i,t,n,this.canon.isKnown(e));if(a&&e===a.result)return!0}return!1},r.prototype.execSelectionSetImpl=function(e){var t=this,i=e.selectionSet,n=e.objectOrReference,a=e.enclosingRef,o=e.context;if(ie(n)&&!o.policies.rootTypenamesById[n.__ref]&&!o.store.has(n.__ref))return{result:this.canon.empty,missing:"Dangling reference to missing ".concat(n.__ref," object")};var s=o.variables,c=o.policies,u=o.store,l=u.getFieldValue(n,"__typename"),f=[],d,p=new vt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&f.push({__typename:l});function h(_,v){var T;return _.missing&&(d=p.merge(d,(T={},T[v]=_.missing,T))),_.result}var m=new Set(i.selections);m.forEach(function(_){var v,T;if(!!_r(_,s))if(At(_)){var $=c.readField({fieldName:_.name.value,field:_,variables:o.variables,from:n},o),E=Mt(_);$===void 0?xi.added(_)||(d=p.merge(d,(v={},v[E]="Can't find field '".concat(_.name.value,"' on ").concat(ie(n)?n.__ref+" object":"object "+JSON.stringify(n,null,2)),v))):be($)?$=h(t.executeSubSelectedArray({field:_,array:$,enclosingRef:a,context:o}),E):_.selectionSet?$!=null&&($=h(t.executeSelectionSet({selectionSet:_.selectionSet,objectOrReference:$,enclosingRef:ie($)?$:a,context:o}),E)):o.canonizeResults&&($=t.canon.pass($)),$!==void 0&&f.push((T={},T[E]=$,T))}else{var R=wi(_,o.lookupFragment);if(!R&&_.kind===je.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(_.name.value)):new J(5);R&&c.fragmentMatches(R,l)&&R.selectionSet.selections.forEach(m.add,m)}});var y=_a(f),S={result:y,missing:d},w=o.canonizeResults?this.canon.admit(S):xa(S);return w.result&&this.knownResults.set(w.result,i),w},r.prototype.execSubSelectedArrayImpl=function(e){var t=this,i=e.field,n=e.array,a=e.enclosingRef,o=e.context,s,c=new vt;function u(l,f){var d;return l.missing&&(s=c.merge(s,(d={},d[f]=l.missing,d))),l.result}return i.selectionSet&&(n=n.filter(o.store.canRead)),n=n.map(function(l,f){return l===null?null:be(l)?u(t.executeSubSelectedArray({field:i,array:l,enclosingRef:a,context:o}),f):i.selectionSet?u(t.executeSelectionSet({selectionSet:i.selectionSet,objectOrReference:l,enclosingRef:ie(l)?l:a,context:o}),f):(__DEV__&&Hy(o.store,i,l),l)}),{result:o.canonizeResults?this.canon.admit(n):n,missing:s}},r}();function Wy(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function Hy(r,e,t){if(!e.selectionSet){var i=new Set([t]);i.forEach(function(n){le(n)&&(__DEV__?P(!ie(n),"Missing selection set for object of type ".concat(jd(r,n)," returned for query field ").concat(e.name.value)):P(!ie(n),6),Object.values(n).forEach(i.add,i))})}}var Cn=new kn,Hd=new WeakMap;function $a(r){var e=Hd.get(r);return e||Hd.set(r,e={vars:new Set,dep:ns()}),e}function Fu(r){$a(r).vars.forEach(function(e){return e.forgetCache(r)})}function Gd(r){$a(r).vars.forEach(function(e){return e.attachCache(r)})}function ps(r){var e=new Set,t=new Set,i=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){$a(c).dep.dirty(i),Gy(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=Cn.getValue();s&&(n(s),$a(s).dep(i))}return r};i.onNextChange=function(a){return t.add(a),function(){t.delete(a)}};var n=i.attachCache=function(a){return e.add(a),$a(a).vars.add(i),i};return i.forgetCache=function(a){return e.delete(a)},i}function Gy(r){r.broadcastWatches&&r.broadcastWatches()}var Kd=Object.create(null);function Mu(r){var e=JSON.stringify(r);return Kd[e]||(Kd[e]=Object.create(null))}function Uu(r){var e=Mu(r);return e.keyFieldsFn||(e.keyFieldsFn=function(t,i){var n=function(o,s){return i.readField(s,o)},a=i.keyObject=qu(r,function(o){var s=Nn(i.storeObject,o,n);return s===void 0&&t!==i.storeObject&&Le.call(t,o[0])&&(s=Nn(t,o,Zd)),__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(i.typename,":").concat(JSON.stringify(a))})}function ju(r){var e=Mu(r);return e.keyArgsFn||(e.keyArgsFn=function(t,i){var n=i.field,a=i.variables,o=i.fieldName,s=qu(r,function(u){var l=u[0],f=l.charAt(0);if(f==="@"){if(n&&Be(n.directives)){var d=l.slice(1),p=n.directives.find(function(S){return S.name.value===d}),h=p&&Er(p,a);return h&&Nn(h,u.slice(1))}return}if(f==="$"){var m=l.slice(1);if(a&&Le.call(a,m)){var y=u.slice(0);return y[0]=m,Nn(a,y)}return}if(t)return Nn(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function qu(r,e){var t=new vt;return Jd(r).reduce(function(i,n){var a,o=e(n);if(o!==void 0){for(var s=n.length-1;s>=0;--s)o=(a={},a[n[s]]=o,a);i=t.merge(i,o)}return i},Object.create(null))}function Jd(r){var e=Mu(r);if(!e.paths){var t=e.paths=[],i=[];r.forEach(function(n,a){be(n)?(Jd(n).forEach(function(o){return t.push(i.concat(o))}),i.length=0):(i.push(n),be(r[a+1])||(t.push(i.slice(0)),i.length=0))})}return e.paths}function Zd(r,e){return r[e]}function Nn(r,e,t){return t=t||Zd,Yd(e.reduce(function i(n,a){return be(n)?n.map(function(o){return i(o,a)}):n&&t(n,a)},r))}function Yd(r){return le(r)?be(r)?r.map(Yd):qu(Object.keys(r).sort(),function(e){return Nn(r,e)}):r}ba.setStringify(It);function Bu(r){return r.args!==void 0?r.args:r.field?Er(r.field,r.variables):null}var Ky=function(){},Xd=function(r,e){return e.fieldName},ef=function(r,e,t){var i=t.mergeObjects;return i(r,e)},tf=function(r,e){return e},nf=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:os},e),this.cache=this.config.cache,this.setRootTypename("Query"),this.setRootTypename("Mutation"),this.setRootTypename("Subscription"),e.possibleTypes&&this.addPossibleTypes(e.possibleTypes),e.typePolicies&&this.addTypePolicies(e.typePolicies)}return r.prototype.identify=function(e,t){var i,n=this,a=t&&(t.typename||((i=t.storeObject)===null||i===void 0?void 0:i.__typename))||e.__typename;if(a===this.rootTypenamesById.ROOT_QUERY)return["ROOT_QUERY"];for(var o=t&&t.storeObject||e,s=x(x({},t),{typename:a,storeObject:o,readField:t&&t.readField||function(){var d=ds(arguments,o);return n.readField(d,{store:n.cache.data,variables:d.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var f=l(e,s);if(be(f))l=Uu(f);else{c=f;break}}return c=c?String(c):void 0,s.keyObject?[c,s.keyObject]:[c]},r.prototype.addTypePolicies=function(e){var t=this;Object.keys(e).forEach(function(i){var n=e[i],a=n.queryType,o=n.mutationType,s=n.subscriptionType,c=nr(n,["queryType","mutationType","subscriptionType"]);a&&t.setRootTypename("Query",i),o&&t.setRootTypename("Mutation",i),s&&t.setRootTypename("Subscription",i),Le.call(t.toBeAdded,i)?t.toBeAdded[i].push(c):t.toBeAdded[i]=[c]})},r.prototype.updateTypePolicy=function(e,t){var i=this,n=this.getTypePolicy(e),a=t.keyFields,o=t.fields;function s(c,u){c.merge=typeof u=="function"?u:u===!0?ef:u===!1?tf:c.merge}s(n,t.merge),n.keyFn=a===!1?Ky:be(a)?Uu(a):typeof a=="function"?a:n.keyFn,o&&Object.keys(o).forEach(function(c){var u=i.getFieldPolicy(e,c,!0),l=o[c];if(typeof l=="function")u.read=l;else{var f=l.keyArgs,d=l.read,p=l.merge;u.keyFn=f===!1?Xd:be(f)?ju(f):typeof f=="function"?f:u.keyFn,typeof d=="function"&&(u.read=d),s(u,p)}u.read&&u.merge&&(u.keyFn=u.keyFn||Xd)})},r.prototype.setRootTypename=function(e,t){t===void 0&&(t=e);var i="ROOT_"+e.toUpperCase(),n=this.rootTypenamesById[i];t!==n&&(__DEV__?P(!n||n===e,"Cannot change root ".concat(e," __typename more than once")):P(!n||n===e,3),n&&delete this.rootIdsByTypename[n],this.rootIdsByTypename[t]=i,this.rootTypenamesById[i]=t)},r.prototype.addPossibleTypes=function(e){var t=this;this.usingPossibleTypes=!0,Object.keys(e).forEach(function(i){t.getSupertypeSet(i,!0),e[i].forEach(function(n){t.getSupertypeSet(n,!0).add(i);var a=n.match(Nu);(!a||a[0]!==n)&&t.fuzzySubtypes.set(n,new RegExp(n))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!Le.call(this.typePolicies,e)){var i=this.typePolicies[e]=Object.create(null);i.fields=Object.create(null);var n=this.supertypeMap.get(e);n&&n.size&&n.forEach(function(o){var s=t.getTypePolicy(o),c=s.fields,u=nr(s,["fields"]);Object.assign(i,u),Object.assign(i.fields,c)})}var a=this.toBeAdded[e];return a&&a.length&&a.splice(0).forEach(function(o){t.updateTypePolicy(e,o)}),this.typePolicies[e]},r.prototype.getFieldPolicy=function(e,t,i){if(e){var n=this.getTypePolicy(e).fields;return n[t]||i&&(n[t]=Object.create(null))}},r.prototype.getSupertypeSet=function(e,t){var i=this.supertypeMap.get(e);return!i&&t&&this.supertypeMap.set(e,i=new Set),i},r.prototype.fragmentMatches=function(e,t,i,n){var a=this;if(!e.typeCondition)return!0;if(!t)return!1;var o=e.typeCondition.name.value;if(t===o)return!0;if(this.usingPossibleTypes&&this.supertypeMap.has(o))for(var s=this.getSupertypeSet(t,!0),c=[s],u=function(h){var m=a.getSupertypeSet(h,!1);m&&m.size&&c.indexOf(m)<0&&c.push(m)},l=!!(i&&this.fuzzySubtypes.size),f=!1,d=0;d<c.length;++d){var p=c[d];if(p.has(o))return s.has(o)||(f&&__DEV__&&P.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(u),l&&d===c.length-1&&as(e.selectionSet,i,n)&&(l=!1,f=!0,this.fuzzySubtypes.forEach(function(h,m){var y=t.match(h);y&&y[0]===t&&u(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var i=this.getFieldPolicy(e,t,!1);return!!(i&&i.keyFn)},r.prototype.getStoreFieldName=function(e){var t=e.typename,i=e.fieldName,n=this.getFieldPolicy(t,i,!1),a,o=n&&n.keyFn;if(o&&t)for(var s={typename:t,fieldName:i,field:e.field||null,variables:e.variables},c=Bu(e);o;){var u=o(c,s);if(be(u))o=ju(u);else{a=u||i;break}}return a===void 0&&(a=e.field?Yc(e.field,e.variables):ba(i,Bu(e))),a===!1?i:i===Zt(a)?a:i+":"+a},r.prototype.readField=function(e,t){var i=e.from;if(!!i){var n=e.field||e.fieldName;if(!!n){if(e.typename===void 0){var a=t.store.getFieldValue(i,"__typename");a&&(e.typename=a)}var o=this.getStoreFieldName(e),s=Zt(o),c=t.store.getFieldValue(i,o),u=this.getFieldPolicy(e.typename,s,!1),l=u&&u.read;if(l){var f=rf(this,i,e,t,t.store.getStorage(ie(i)?i.__ref:i,o));return Cn.withValue(this.cache,l,[c,f])}return c}}},r.prototype.getReadFunction=function(e,t){var i=this.getFieldPolicy(e,t,!1);return i&&i.read},r.prototype.getMergeFunction=function(e,t,i){var n=this.getFieldPolicy(e,t,!1),a=n&&n.merge;return!a&&i&&(n=this.getTypePolicy(i),a=n&&n.merge),a},r.prototype.runMergeFunction=function(e,t,i,n,a){var o=i.field,s=i.typename,c=i.merge;return c===ef?af(n.store)(e,t):c===tf?t:(n.overwrite&&(e=void 0),c(e,t,rf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:n.variables},n,a||Object.create(null))))},r}();function rf(r,e,t,i,n){var a=r.getStoreFieldName(t),o=Zt(a),s=t.variables||i.variables,c=i.store,u=c.toReference,l=c.canRead;return{args:Bu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ie,toReference:u,storage:n,cache:r.cache,canRead:l,readField:function(){return r.readField(ds(arguments,e,s),i)},mergeObjects:af(i.store)}}function ds(r,e,t){var i=r[0],n=r[1],a=r.length,o;return typeof i=="string"?o={fieldName:i,from:a>1?n:e}:(o=x({},i),Le.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&P.warn("Undefined 'from' passed to readField with arguments ".concat(Zp(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function af(r){return function(t,i){if(be(t)||be(i))throw __DEV__?new J("Cannot automatically merge arrays"):new J(4);if(le(t)&&le(i)){var n=r.getFieldValue(t,"__typename"),a=r.getFieldValue(i,"__typename"),o=n&&a&&n!==a;if(o)return i;if(ie(t)&&Vr(i))return r.merge(t.__ref,i),t;if(Vr(t)&&ie(i))return r.merge(t,i.__ref),i;if(Vr(t)&&Vr(i))return x(x({},t),i)}return i}}function Vu(r,e,t){var i="".concat(e).concat(t),n=r.flavors.get(i);return n||r.flavors.set(i,n=r.clientOnly===e&&r.deferred===t?r:x(x({},r),{clientOnly:e,deferred:t})),n}var uf=function(){function r(e,t,i){this.cache=e,this.reader=t,this.fragments=i}return r.prototype.writeToStore=function(e,t){var i=this,n=t.query,a=t.result,o=t.dataId,s=t.variables,c=t.overwrite,u=or(n),l=qd();s=x(x({},Ei(u)),s);var f=x(x({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:It(s)},cs(n,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:f});if(!ie(d))throw __DEV__?new J("Could not identify object ".concat(JSON.stringify(a))):new J(7);return f.incomingById.forEach(function(p,h){var m=p.storeObject,y=p.mergeTree,S=p.fieldNodeSet,w=ar(h);if(y&&y.map.size){var _=i.applyMerges(y,w,m,f);if(ie(_))return;m=_}if(__DEV__&&!f.overwrite){var v=Object.create(null);S.forEach(function(E){E.selectionSet&&(v[E.name.value]=!0)});var T=function(E){return v[Zt(E)]===!0},$=function(E){var R=y&&y.map.get(E);return Boolean(R&&R.info&&R.info.merge)};Object.keys(m).forEach(function(E){T(E)&&!$(E)&&Jy(w,m,E,f.store)})}e.merge(h,m)}),e.retain(d.__ref),d},r.prototype.processSelectionSet=function(e){var t=this,i=e.dataId,n=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=i&&c.rootTypenamesById[i]||wa(n,a,o.fragmentMap)||i&&o.store.get(i,"__typename");typeof l=="string"&&(u.__typename=l);var f=function(){var _=ds(arguments,u,o.variables);if(ie(_.from)){var v=o.incomingById.get(_.from.__ref);if(v){var T=c.readField(x(x({},_),{from:v.storeObject}),o);if(T!==void 0)return T}}return c.readField(_,o)},d=new Set;this.flattenFields(a,n,o,l).forEach(function(_,v){var T,$=Mt(v),E=n[$];if(d.add(v),E!==void 0){var R=c.getStoreFieldName({typename:l,fieldName:v.name.value,field:v,variables:_.variables}),L=of(s,R),D=t.processFieldValue(E,v,v.selectionSet?Vu(_,!1,!1):_,L),I=void 0;v.selectionSet&&(ie(D)||Vr(D))&&(I=f("__typename",D));var Ie=c.getMergeFunction(l,v.name.value,I);Ie?L.info={field:v,typename:l,merge:Ie}:sf(s,R),u=_.merge(u,(T={},T[R]=D,T))}else __DEV__&&!_.clientOnly&&!_.deferred&&!xi.added(v)&&!c.getReadFunction(l,v.name.value)&&__DEV__&&P.error("Missing field '".concat(Mt(v),"' while writing result ").concat(JSON.stringify(n,null,2)).substring(0,1e3))});try{var p=c.identify(n,{typename:l,selectionSet:a,fragmentMap:o.fragmentMap,storeObject:u,readField:f}),h=p[0],m=p[1];i=i||h,m&&(u=o.merge(u,m))}catch(_){if(!i)throw _}if(typeof i=="string"){var y=ar(i),S=o.written[i]||(o.written[i]=[]);if(S.indexOf(a)>=0||(S.push(a),this.reader&&this.reader.isFresh(n,y,a,o)))return y;var w=o.incomingById.get(i);return w?(w.storeObject=o.merge(w.storeObject,u),w.mergeTree=Qu(w.mergeTree,s),d.forEach(function(_){return w.fieldNodeSet.add(_)})):o.incomingById.set(i,{storeObject:u,mergeTree:fs(s)?void 0:s,fieldNodeSet:d}),y}return u},r.prototype.processFieldValue=function(e,t,i,n){var a=this;return!t.selectionSet||e===null?__DEV__?Ho(e):e:be(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,i,of(n,s));return sf(n,s),c}):this.processSelectionSet({result:e,selectionSet:t.selectionSet,context:i,mergeTree:n})},r.prototype.flattenFields=function(e,t,i,n){n===void 0&&(n=wa(t,e,i.fragmentMap));var a=new Map,o=this.cache.policies,s=new sr(!1);return function c(u,l){var f=s.lookup(u,l.clientOnly,l.deferred);f.visited||(f.visited=!0,u.selections.forEach(function(d){if(!!_r(d,i.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&Be(d.directives)&&d.directives.forEach(function(S){var w=S.name.value;if(w==="client"&&(p=!0),w==="defer"){var _=Er(S,i.variables);(!_||_.if!==!1)&&(h=!0)}}),At(d)){var m=a.get(d);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(d,Vu(i,p,h))}else{var y=wi(d,i.lookupFragment);if(!y&&d.kind===je.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(d.name.value)):new J(8);y&&o.fragmentMatches(y,n,t,i.variables)&&c(y.selectionSet,Vu(i,p,h))}}}))}(e,i),a},r.prototype.applyMerges=function(e,t,i,n,a){var o,s=this;if(e.map.size&&!ie(i)){var c=!be(i)&&(ie(t)||Vr(t))?t:void 0,u=i;c&&!a&&(a=[ie(c)?c.__ref:c]);var l,f=function(d,p){return be(d)?typeof p=="number"?d[p]:void 0:n.store.getFieldValue(d,String(p))};e.map.forEach(function(d,p){var h=f(c,p),m=f(u,p);if(m!==void 0){a&&a.push(p);var y=s.applyMerges(d,h,m,n,a);y!==m&&(l=l||new Map,l.set(p,y)),a&&P(a.pop()===p)}}),l&&(i=be(u)?u.slice(0):x({},u),l.forEach(function(d,p){i[p]=d}))}return e.info?this.cache.policies.runMergeFunction(t,i,e.info,n,a&&(o=n.store).getStorage.apply(o,a)):i},r}();var lf=[];function of(r,e){var t=r.map;return t.has(e)||t.set(e,lf.pop()||{map:new Map}),t.get(e)}function Qu(r,e){if(r===e||!e||fs(e))return r;if(!r||fs(r))return e;var t=r.info&&e.info?x(x({},r.info),e.info):r.info||e.info,i=r.map.size&&e.map.size,n=i?new Map:r.map.size?r.map:e.map,a={info:t,map:n};if(i){var o=new Set(e.map.keys());r.map.forEach(function(s,c){a.map.set(c,Qu(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,Qu(e.map.get(s),r.map.get(s)))})}return a}function fs(r){return!r||!(r.info||r.map.size)}function sf(r,e){var t=r.map,i=t.get(e);i&&fs(i)&&(lf.push(i),t.delete(e))}var cf=new Set;function Jy(r,e,t,i){var n=function(f){var d=i.getFieldValue(f,t);return typeof d=="object"&&d},a=n(r);if(!!a){var o=n(e);if(!!o&&!ie(a)&&!ke(a,o)&&!Object.keys(a).every(function(f){return i.getFieldValue(o,f)!==void 0})){var s=i.getFieldValue(r,"__typename")||i.getFieldValue(e,"__typename"),c=Zt(t),u="".concat(s,".").concat(c);if(!cf.has(u)){cf.add(u);var l=[];!be(a)&&!be(o)&&[a,o].forEach(function(f){var d=i.getFieldValue(f,"__typename");typeof d=="string"&&!l.includes(d)&&l.push(d)}),__DEV__&&P.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
|
|
36
|
+
`):new J(23)};var gd=function(){if(typeof AbortController>"u")return{controller:!1,signal:!1};var r=new AbortController,e=r.signal;return{controller:r,signal:e}};var yd=function(r,e){var t=r.getContext(),n=t.uri;return n||(typeof e=="function"?e(r):e||"/graphql")};function vd(r,e){var t=[],n=function(f,d){t.push("".concat(f,"=").concat(encodeURIComponent(d)))};if("query"in e&&n("query",e.query),e.operationName&&n("operationName",e.operationName),e.variables){var i=void 0;try{i=Oa(e.variables,"Variables map")}catch(f){return{parseError:f}}n("variables",i)}if(e.extensions){var a=void 0;try{a=Oa(e.extensions,"Extensions map")}catch(f){return{parseError:f}}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 bd=ze(function(){return fetch}),wd=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?fd:i,o=r.includeExtensions,s=r.preserveHeaderCase,c=r.useGETForQueries,u=r.includeUnusedVariables,l=u===void 0?!1:u,f=ir(r,["uri","fetch","print","includeExtensions","preserveHeaderCase","useGETForQueries","includeUnusedVariables"]);__DEV__&&md(n||bd);var d={http:{includeExtensions:o,preserveHeaderCase:s},options:f.fetchOptions,credentials:f.credentials,headers:f.headers};return new Mt(function(p){var h=yd(p,t),m=p.getContext(),g={};if(m.clientAwareness){var w=m.clientAwareness,b=w.name,v=w.version;b&&(g["apollographql-client-name"]=b),v&&(g["apollographql-client-version"]=v)}var y=E(E({},g),m.headers),I={http:m.http,options:m.fetchOptions,credentials:m.credentials,headers:y},$=hd(p,a,dd,d,I),A=$.options,R=$.body;if(R.variables&&!l){var P=new Set(Object.keys(R.variables));nt(p.query,{Variable:function(se,rr,te){te&&te.kind!=="VariableDefinition"&&P.delete(se.name.value)}}),P.size&&(R.variables=E({},R.variables),P.forEach(function(se){delete R.variables[se]}))}var D;if(!A.signal){var k=gd(),Te=k.controller,Ue=k.signal;D=Te,D&&(A.signal=Ue)}var W=function(se){return se.kind==="OperationDefinition"&&se.operation==="mutation"};if(c&&!p.query.definitions.some(W)&&(A.method="GET"),wi(["defer"],p.query)&&(A.headers=A.headers||{},A.headers.accept="multipart/mixed; deferSpec=20220824, application/json"),A.method==="GET"){var be=vd(h,R),we=be.newURI,oe=be.parseError;if(oe)return Xo(oe);h=we}else try{A.body=Oa(R,"Payload")}catch(se){return Xo(se)}return new re(function(se){var rr=n||ze(function(){return fetch})||bd;return rr(h,A).then(function(te){var nr;p.setContext({response:te});var Fr=(nr=te.headers)===null||nr===void 0?void 0:nr.get("content-type");return Fr!==null&&/^multipart\/mixed/i.test(Fr)?ud(te,se):pd(te,p,se)}).catch(function(te){return rs(te,se)}),function(){D&&D.abort()}})})};var Eu=function(r){Ne(e,r);function e(t){t===void 0&&(t={});var n=r.call(this,wd(t).request)||this;return n.options=t,n}return e}(Mt);var{toString:Sd,hasOwnProperty:by}=Object.prototype,_d=Function.prototype.toString,xu=new Map;function xe(r,e){try{return ku(r,e)}finally{xu.clear()}}function ku(r,e){if(r===e)return!0;let t=Sd.call(r),n=Sd.call(e);if(t!==n)return!1;switch(t){case"[object Array]":if(r.length!==e.length)return!1;case"[object Object]":{if(xd(r,e))return!0;let i=Ed(r),a=Ed(e),o=i.length;if(o!==a.length)return!1;for(let s=0;s<o;++s)if(!by.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(xd(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=_d.call(r);return i!==_d.call(e)?!1:!_y(i,Sy)}}return!1}function Ed(r){return Object.keys(r).filter(wy,r)}function wy(r){return this[r]!==void 0}var Sy="{ [native code] }";function _y(r,e){let t=r.length-e.length;return t>=0&&r.indexOf(e,t)===t}function xd(r,e){let t=xu.get(r);if(t){if(t.has(e))return!0}else xu.set(r,t=new Set);return t.add(e),!1}var Ey=function(){return Object.create(null)},kd=Array.prototype,xy=kd.forEach,ky=kd.slice,sr=function(){function r(e,t){e===void 0&&(e=!0),t===void 0&&(t=Ey),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 xy.call(e,function(n){return t=t.getChildTrie(n)}),t.data||(t.data=this.makeData(ky.call(e)))},r.prototype.getChildTrie=function(e){var t=this.weakness&&Ay(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 Ay(r){switch(typeof r){case"object":if(r===null)break;case"function":return!0}return!1}var Ye=null,Ad={},Iy=1,Ty=()=>class{constructor(){this.id=["slot",Iy++,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===Ad)break;return e!==Ye&&(Ye.slots[this.id]=t),!0}return Ye&&(Ye.slots[this.id]=Ad),!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 Id(r){try{return r()}catch{}}var Au="@wry/context:Slot",Oy=Id(()=>globalThis)||Id(()=>global)||Object.create(null),Td=Oy,Ti=Td[Au]||Array[Au]||function(r){try{Object.defineProperty(Td,Au,{value:r,enumerable:!1,writable:!1,configurable:!0})}finally{return r}}(Ty());var{bind:Cy,noContext:Ny}=Ti;function $y(){}var Dy=function(){function r(e,t){e===void 0&&(e=1/0),t===void 0&&(t=$y),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}(),is=new Ti,Iu,Ry=Object.prototype.hasOwnProperty,Ou=(Iu=Array.from,Iu===void 0?function(r){var e=[];return r.forEach(function(t){return e.push(t)}),e}:Iu);function ns(r){var e=r.unsubscribe;typeof e=="function"&&(r.unsubscribe=void 0,e())}var Ca=[],Ly=100;function Oi(r,e){if(!r)throw new Error(e||"assertion failure")}function Py(r,e){var t=r.length;return t>0&&t===e.length&&r[t-1]===e[t-1]}function Cd(r){switch(r.length){case 0:throw new Error("unknown value");case 1:return r[0];case 2:throw r[1]}}function Fy(r){return r.slice(0)}var My=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 Od(this),this.value[0]},r.prototype.recompute=function(e){return Oi(!this.recomputing,"already recomputing"),Od(this),Qr(this)?Uy(this,e):Cd(this.value)},r.prototype.setDirty=function(){this.dirty||(this.dirty=!0,this.value.length=0,Nd(this),ns(this))},r.prototype.dispose=function(){var e=this;this.setDirty(),Pd(this),Cu(this,function(t,n){t.setDirty(),Fd(t,e)})},r.prototype.forget=function(){this.dispose()},r.prototype.dependOn=function(e){e.add(this),this.deps||(this.deps=Ca.pop()||new Set),this.deps.add(e)},r.prototype.forgetDeps=function(){var e=this;this.deps&&(Ou(this.deps).forEach(function(t){return t.delete(e)}),this.deps.clear(),Ca.push(this.deps),this.deps=null)},r.count=0,r}();function Od(r){var e=is.getValue();if(e)return r.parents.add(e),e.childValues.has(r)||e.childValues.set(r,[]),Qr(r)?Dd(e,r):Rd(e,r),e}function Uy(r,e){return Pd(r),is.withValue(r,jy,[r,e]),By(r,e)&&qy(r),Cd(r.value)}function jy(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)&&$d(r)}function Nd(r){Cu(r,Dd)}function $d(r){Cu(r,Rd)}function Cu(r,e){var t=r.parents.size;if(t)for(var n=Ou(r.parents),i=0;i<t;++i)e(n[i],r)}function Dd(r,e){Oi(r.childValues.has(e)),Oi(Qr(e));var t=!Qr(r);if(!r.dirtyChildren)r.dirtyChildren=Ca.pop()||new Set;else if(r.dirtyChildren.has(e))return;r.dirtyChildren.add(e),t&&Nd(r)}function Rd(r,e){Oi(r.childValues.has(e)),Oi(!Qr(e));var t=r.childValues.get(e);t.length===0?r.childValues.set(e,Fy(e.value)):Py(t,e.value)||r.setDirty(),Ld(r,e),!Qr(r)&&$d(r)}function Ld(r,e){var t=r.dirtyChildren;t&&(t.delete(e),t.size===0&&(Ca.length<Ly&&Ca.push(t),r.dirtyChildren=null))}function Pd(r){r.childValues.size>0&&r.childValues.forEach(function(e,t){Fd(r,t)}),r.forgetDeps(),Oi(r.dirtyChildren===null)}function Fd(r,e){e.parents.delete(r),r.childValues.delete(e),Ld(r,e)}function By(r,e){if(typeof r.subscribe=="function")try{ns(r),r.unsubscribe=r.subscribe.apply(null,e)}catch{return r.setDirty(),!1}return!0}var Vy={setDirty:!0,dispose:!0,forget:!0};function as(r){var e=new Map,t=r&&r.subscribe;function n(i){var a=is.getValue();if(a){var o=e.get(i);o||e.set(i,o=new Set),a.dependOn(o),typeof t=="function"&&(ns(o),o.unsubscribe=t(i))}}return n.dirty=function(a,o){var s=e.get(a);if(s){var c=o&&Ry.call(Vy,o)?o:"setDirty";Ou(s).forEach(function(u){return u[c]()}),e.delete(a),ns(s)}},n}function Md(){var r=new sr(typeof WeakMap=="function");return function(){return r.lookupArray(arguments)}}var Sk=Md(),Tu=new Set;function Tn(r,e){e===void 0&&(e=Object.create(null));var t=new Dy(e.max||Math.pow(2,16),function(u){return u.dispose()}),n=e.keyArgs,i=e.makeCacheKey||Md(),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 My(r)),l.subscribe=e.subscribe,l.forget=function(){return t.delete(u)});var f=l.recompute(Array.prototype.slice.call(arguments));return t.set(u,l),Tu.add(t),is.hasValue()||(Tu.forEach(function(d){return d.clean()}),Tu.clear()),f};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 Nu=function(){function r(){this.getFragmentDoc=Tn(Zc)}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 Na=function(r){Ne(e,r);function e(t,n,i,a){var o,s=r.call(this,t)||this;if(s.message=t,s.path=n,s.query=i,s.variables=a,Array.isArray(s.path)){s.missing=s.message;for(var c=s.path.length-1;c>=0;--c)s.missing=(o={},o[s.path[c]]=s.missing,o)}else s.missing=s.path;return s.__proto__=e.prototype,s}return e}(Error);var $e=Object.prototype.hasOwnProperty;function $a(r){return r==null}function ss(r,e){var t=r.__typename,n=r.id,i=r._id;if(typeof t=="string"&&(e&&(e.keyObject=$a(n)?$a(i)?void 0:{_id:i}:{id:n}),$a(n)&&!$a(i)&&(n=i),!$a(n)))return"".concat(t,":").concat(typeof n=="number"||typeof n=="string"?n:JSON.stringify(n))}var Ud={dataIdFromObject:ss,addTypename:!0,resultCaching:!0,canonizeResults:!1};function jd(r){return Vr(Ud,r)}function cs(r){var e=r.canonizeResults;return e===void 0?Ud.canonizeResults:e}function qd(r,e){return ne(e)?r.get(e.__ref,"__typename"):e&&e.__typename}var $u=/^[_a-z][_0-9a-z]*/i;function Kt(r){var e=r.match($u);return e?e[0]:r}function os(r,e,t){return ce(e)?ve(e)?e.every(function(n){return os(r,n,t)}):r.selections.every(function(n){if(xt(n)&&xr(n,t)){var i=Pt(n);return $e.call(e,i)&&(!n.selectionSet||os(n.selectionSet,e[i],t))}return!0}):!1}function zr(r){return ce(r)&&!ne(r)&&!ve(r)}function Bd(){return new gt}function us(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 ls=Object.create(null),Du=function(){return ls},Vd=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 xa(ne(i)?n.get(i.__ref,a):i&&i[a])},this.canRead=function(i){return ne(i)?n.has(i.__ref):typeof i=="object"},this.toReference=function(i,a){if(typeof i=="string")return ar(i);if(ne(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),$e.call(this.data,e)){var n=this.data[e];if(n&&$e.call(n,t))return n[t]}if(t==="__typename"&&$e.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"),$e.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;ne(e)&&(e=e.__ref),ne(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(zy).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:ls,INVALIDATE:Vd,isReference:ne,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),f=i[u];if(f!==void 0){var d=typeof t=="function"?t:t[u]||t[l];if(d){var p=d===Du?ls:d(xa(f),E(E({},c),{fieldName:l,storeFieldName:u,storage:n.getStorage(e,u)}));p===Vd?n.group.dirty(e,u):(p===ls&&(p=void 0),p!==f&&(a[u]=p,o=!0,f=p))}f!==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]=Du,i):Du)}return!1},r.prototype.evict=function(e,t){var n=!1;return e.id&&($e.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){$e.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&&$e.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){$e.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(!$e.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){ne(a)&&(t[a.__ref]=!0),ce(a)&&Object.keys(a).forEach(function(o){var s=a[o];ce(s)&&i.add(s)})})}return this.refs[e]},r.prototype.makeCacheKey=function(){return this.group.keyMaker.lookupArray(arguments)},r}();var Qd=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?as():null,this.keyMaker=new sr(Ft)},r.prototype.depend=function(e,t){if(this.d){this.d(Ru(e,t));var n=Kt(t);n!==t&&this.d(Ru(e,n)),this.parent&&this.parent.depend(e,t)}},r.prototype.dirty=function(e,t){this.d&&this.d.dirty(Ru(e,t),t==="__exists"?"forget":"setDirty")},r}();function Ru(r,e){return e+"#"+r}function Lu(r,e){On(r)&&r.group.depend(e,"__exists")}(function(r){var e=function(t){Ne(n,t);function n(i){var a=i.policies,o=i.resultCaching,s=o===void 0?!0:o,c=i.seed,u=t.call(this,a,new Qd(s))||this;return u.stump=new Qy(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){Ne(e,r);function e(t,n,i,a){var o=r.call(this,n.policies,a)||this;return o.id=t,o.parent=n,o.replay=i,o.group=a,i(o),o}return e.prototype.addLayer=function(t,n){return new e(t,this,n,this.group)},e.prototype.removeLayer=function(t){var n=this,i=this.parent.removeLayer(t);return t===this.id?(this.group.caching&&Object.keys(this.data).forEach(function(a){var o=n.data[a],s=i.lookup(a);s?o?o!==s&&Object.keys(o).forEach(function(c){xe(o[c],s[c])||n.group.dirty(a,c)}):(n.group.dirty(a,"__exists"),Object.keys(s).forEach(function(c){n.group.dirty(a,c)})):n.delete(a)}),i):i===this.parent?this:i.addLayer(this.id,this.replay)},e.prototype.toObject=function(){return E(E({},this.parent.toObject()),this.data)},e.prototype.findChildRefIds=function(t){var n=this.parent.findChildRefIds(t);return $e.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),Qy=function(r){Ne(e,r);function e(t){return r.call(this,"EntityStore.Stump",t,function(){},new Qd(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 zy(r,e,t){var n=r[t],i=e[t];return xe(n,i)?n:i}function On(r){return!!(r instanceof Ci&&r.group.caching)}function Wy(r){return ce(r)?ve(r)?r.slice(0):E({__proto__:Object.getPrototypeOf(r)},r):r}var ps=function(){function r(){this.known=new(Gp?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 ce(e)&&this.known.has(e)},r.prototype.pass=function(e){if(ce(e)){var t=Wy(e);return this.passes.set(t,e),t}return e},r.prototype.admit=function(e){var t=this;if(ce(e)){var n=this.passes.get(e);if(n)return n;var i=Object.getPrototypeOf(e);switch(i){case Array.prototype:{if(this.known.has(e))return e;var a=e.map(this.admit,this),o=this.pool.lookupArray(a);return o.array||(this.known.add(o.array=a),__DEV__&&Object.freeze(a)),o.array}case null:case Object.prototype:{if(this.known.has(e))return e;var s=Object.getPrototypeOf(e),c=[s],u=this.sortedKeys(e);c.push(u.json);var l=c.length;u.sorted.forEach(function(p){c.push(t.admit(e[p]))});var o=this.pool.lookupArray(c);if(!o.object){var f=o.object=Object.create(s);this.known.add(f),u.sorted.forEach(function(p,h){f[p]=c[l+h]}),__DEV__&&Object.freeze(f)}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 kt=Object.assign(function(r){if(ce(r)){Pu===void 0&&zd();var e=Pu.admit(r),t=Fu.get(e);return t===void 0&&Fu.set(e,t=JSON.stringify(e)),t}return JSON.stringify(r)},{reset:zd}),Pu,Fu;function zd(){Pu=new ps,Fu=new(Ft?WeakMap:Map)}function Wd(r){return[r.selectionSet,r.objectOrReference,r.context,r.context.canonizeResults]}var Hd=function(){function r(e){var t=this;this.knownResults=new(Ft?WeakMap:Map),this.config=Vr(e,{addTypename:e.addTypename!==!1,canonizeResults:cs(e)}),this.canon=e.canon||new ps,this.executeSelectionSet=Tn(function(n){var i,a=n.context.canonizeResults,o=Wd(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:(Lu(n.context.store,n.enclosingRef.__ref),t.execSelectionSetImpl(n))},{max:this.config.resultCacheMaxSize,keyArgs:Wd,makeCacheKey:function(n,i,a,o){if(On(a.store))return a.store.makeCacheKey(n,ne(i)?i.__ref:i,a.varString,o)}}),this.executeSubSelectedArray=Tn(function(n){return Lu(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 ps},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,f=this.config.cache.policies;o=E(E({},kn(Sa(n))),o);var d=ar(a),p=this.executeSelectionSet({selectionSet:xn(n).selectionSet,objectOrReference:d,enclosingRef:d,context:E({store:t,query:n,policies:f,variables:o,varString:kt(o),canonizeResults:l},us(n,this.config.fragments))}),h;if(p.missing&&(h=[new Na(Hy(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(ne(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"),f=[],d,p=new gt;this.config.addTypename&&typeof l=="string"&&!c.rootIdsByTypename[l]&&f.push({__typename:l});function h(v,y){var I;return v.missing&&(d=p.merge(d,(I={},I[y]=v.missing,I))),v.result}var m=new Set(n.selections);m.forEach(function(v){var y,I;if(!!xr(v,s))if(xt(v)){var $=c.readField({fieldName:v.name.value,field:v,variables:o.variables,from:i},o),A=Pt(v);$===void 0?An.added(v)||(d=p.merge(d,(y={},y[A]="Can't find field '".concat(v.name.value,"' on ").concat(ne(i)?i.__ref+" object":"object "+JSON.stringify(i,null,2)),y))):ve($)?$=h(t.executeSubSelectedArray({field:v,array:$,enclosingRef:a,context:o}),A):v.selectionSet?$!=null&&($=h(t.executeSelectionSet({selectionSet:v.selectionSet,objectOrReference:$,enclosingRef:ne($)?$:a,context:o}),A)):o.canonizeResults&&($=t.canon.pass($)),$!==void 0&&f.push((I={},I[A]=$,I))}else{var R=_n(v,o.lookupFragment);if(!R&&v.kind===Fe.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(v.name.value)):new J(5);R&&c.fragmentMatches(R,l)&&R.selectionSet.selections.forEach(m.add,m)}});var g=_a(f),w={result:g,missing:d},b=o.canonizeResults?this.canon.admit(w):xa(w);return b.result&&this.knownResults.set(b.result,n),b},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,f){var d;return l.missing&&(s=c.merge(s,(d={},d[f]=l.missing,d))),l.result}return n.selectionSet&&(i=i.filter(o.store.canRead)),i=i.map(function(l,f){return l===null?null:ve(l)?u(t.executeSubSelectedArray({field:n,array:l,enclosingRef:a,context:o}),f):n.selectionSet?u(t.executeSelectionSet({selectionSet:n.selectionSet,objectOrReference:l,enclosingRef:ne(l)?l:a,context:o}),f):(__DEV__&&Gy(o.store,n,l),l)}),{result:o.canonizeResults?this.canon.admit(i):i,missing:s}},r}();function Hy(r){try{JSON.stringify(r,function(e,t){if(typeof t=="string")throw t;return t})}catch(e){return e}}function Gy(r,e,t){if(!e.selectionSet){var n=new Set([t]);n.forEach(function(i){ce(i)&&(__DEV__?L(!ne(i),"Missing selection set for object of type ".concat(qd(r,i)," returned for query field ").concat(e.name.value)):L(!ne(i),6),Object.values(i).forEach(n.add,n))})}}var Ni=new Ti,Gd=new WeakMap;function Da(r){var e=Gd.get(r);return e||Gd.set(r,e={vars:new Set,dep:as()}),e}function Mu(r){Da(r).vars.forEach(function(e){return e.forgetCache(r)})}function Kd(r){Da(r).vars.forEach(function(e){return e.attachCache(r)})}function ds(r){var e=new Set,t=new Set,n=function(a){if(arguments.length>0){if(r!==a){r=a,e.forEach(function(c){Da(c).dep.dirty(n),Ky(c)});var o=Array.from(t);t.clear(),o.forEach(function(c){return c(r)})}}else{var s=Ni.getValue();s&&(i(s),Da(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),Da(a).vars.add(n),n};return n.forgetCache=function(a){return e.delete(a)},n}function Ky(r){r.broadcastWatches&&r.broadcastWatches()}var Jd=Object.create(null);function Uu(r){var e=JSON.stringify(r);return Jd[e]||(Jd[e]=Object.create(null))}function ju(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=Bu(r,function(o){var s=$i(n.storeObject,o,i);return s===void 0&&t!==n.storeObject&&$e.call(t,o[0])&&(s=$i(t,o,Yd)),__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 qu(r){var e=Uu(r);return e.keyArgsFn||(e.keyArgsFn=function(t,n){var i=n.field,a=n.variables,o=n.fieldName,s=Bu(r,function(u){var l=u[0],f=l.charAt(0);if(f==="@"){if(i&&je(i.directives)){var d=l.slice(1),p=i.directives.find(function(w){return w.name.value===d}),h=p&&kr(p,a);return h&&$i(h,u.slice(1))}return}if(f==="$"){var m=l.slice(1);if(a&&$e.call(a,m)){var g=u.slice(0);return g[0]=m,$i(a,g)}return}if(t)return $i(t,u)}),c=JSON.stringify(s);return(t||c!=="{}")&&(o+=":"+c),o})}function Bu(r,e){var t=new gt;return Zd(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 Zd(r){var e=Uu(r);if(!e.paths){var t=e.paths=[],n=[];r.forEach(function(i,a){ve(i)?(Zd(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 Yd(r,e){return r[e]}function $i(r,e,t){return t=t||Yd,Xd(e.reduce(function n(i,a){return ve(i)?i.map(function(o){return n(o,a)}):i&&t(i,a)},r))}function Xd(r){return ce(r)?ve(r)?r.map(Xd):Bu(Object.keys(r).sort(),function(e){return $i(r,e)}):r}ba.setStringify(kt);function Vu(r){return r.args!==void 0?r.args:r.field?kr(r.field,r.variables):null}var Jy=function(){},ef=function(r,e){return e.fieldName},tf=function(r,e,t){var n=t.mergeObjects;return n(r,e)},rf=function(r,e){return e},af=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:ss},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 d=fs(arguments,o);return i.readField(d,{store:i.cache.data,variables:d.variables})}}),c,u=a&&this.getTypePolicy(a),l=u&&u.keyFn||this.config.dataIdFromObject;l;){var f=l(e,s);if(ve(f))l=ju(f);else{c=f;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),$e.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?tf:u===!1?rf:c.merge}s(i,t.merge),i.keyFn=a===!1?Jy:ve(a)?ju(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 f=l.keyArgs,d=l.read,p=l.merge;u.keyFn=f===!1?ef:ve(f)?qu(f):typeof f=="function"?f:u.keyFn,typeof d=="function"&&(u.read=d),s(u,p)}u.read&&u.merge&&(u.keyFn=u.keyFn||ef)})},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($u);(!a||a[0]!==i)&&t.fuzzySubtypes.set(i,new RegExp(i))})})},r.prototype.getTypePolicy=function(e){var t=this;if(!$e.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),f=!1,d=0;d<c.length;++d){var p=c[d];if(p.has(o))return s.has(o)||(f&&__DEV__&&L.warn("Inferring subtype ".concat(t," of supertype ").concat(o)),s.add(o)),!0;p.forEach(u),l&&d===c.length-1&&os(e.selectionSet,n,i)&&(l=!1,f=!0,this.fuzzySubtypes.forEach(function(h,m){var g=t.match(h);g&&g[0]===t&&u(m)}))}return!1},r.prototype.hasKeyArgs=function(e,t){var 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=Vu(e);o;){var u=o(c,s);if(ve(u))o=qu(u);else{a=u||n;break}}return a===void 0&&(a=e.field?Xc(e.field,e.variables):ba(n,Vu(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 f=nf(this,n,e,t,t.store.getStorage(ne(n)?n.__ref:n,o));return Ni.withValue(this.cache,l,[c,f])}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===tf?of(i.store)(e,t):c===rf?t:(i.overwrite&&(e=void 0),c(e,t,nf(this,void 0,{typename:s,fieldName:o.name.value,field:o,variables:i.variables},i,a||Object.create(null))))},r}();function nf(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:Vu(t),field:t.field||null,fieldName:o,storeFieldName:a,variables:s,isReference:ne,toReference:u,storage:i,cache:r.cache,canRead:l,readField:function(){return r.readField(fs(arguments,e,s),n)},mergeObjects:of(n.store)}}function fs(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),$e.call(o,"from")||(o.from=e)),__DEV__&&o.from===void 0&&__DEV__&&L.warn("Undefined 'from' passed to readField with arguments ".concat(Yp(Array.from(r)))),o.variables===void 0&&(o.variables=t),o}function of(r){return function(t,n){if(ve(t)||ve(n))throw __DEV__?new J("Cannot automatically merge arrays"):new J(4);if(ce(t)&&ce(n)){var i=r.getFieldValue(t,"__typename"),a=r.getFieldValue(n,"__typename"),o=i&&a&&i!==a;if(o)return n;if(ne(t)&&zr(n))return r.merge(t.__ref,n),t;if(zr(t)&&ne(n))return r.merge(t,n.__ref),n;if(zr(t)&&zr(n))return E(E({},t),n)}return n}}function Qu(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 lf=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=Bd();s=E(E({},kn(u)),s);var f=E(E({store:e,written:Object.create(null),merge:function(p,h){return l.merge(p,h)},variables:s,varString:kt(s)},us(i,this.fragments)),{overwrite:!!c,incomingById:new Map,clientOnly:!1,deferred:!1,flavors:new Map}),d=this.processSelectionSet({result:a||Object.create(null),dataId:o,selectionSet:u.selectionSet,mergeTree:{map:new Map},context:f});if(!ne(d))throw __DEV__?new J("Could not identify object ".concat(JSON.stringify(a))):new J(7);return f.incomingById.forEach(function(p,h){var m=p.storeObject,g=p.mergeTree,w=p.fieldNodeSet,b=ar(h);if(g&&g.map.size){var v=n.applyMerges(g,b,m,f);if(ne(v))return;m=v}if(__DEV__&&!f.overwrite){var y=Object.create(null);w.forEach(function(A){A.selectionSet&&(y[A.name.value]=!0)});var I=function(A){return y[Kt(A)]===!0},$=function(A){var R=g&&g.map.get(A);return Boolean(R&&R.info&&R.info.merge)};Object.keys(m).forEach(function(A){I(A)&&!$(A)&&Zy(b,m,A,f.store)})}e.merge(h,m)}),e.retain(d.__ref),d},r.prototype.processSelectionSet=function(e){var t=this,n=e.dataId,i=e.result,a=e.selectionSet,o=e.context,s=e.mergeTree,c=this.cache.policies,u=Object.create(null),l=n&&c.rootTypenamesById[n]||wa(i,a,o.fragmentMap)||n&&o.store.get(n,"__typename");typeof l=="string"&&(u.__typename=l);var f=function(){var v=fs(arguments,u,o.variables);if(ne(v.from)){var y=o.incomingById.get(v.from.__ref);if(y){var I=c.readField(E(E({},v),{from:y.storeObject}),o);if(I!==void 0)return I}}return c.readField(v,o)},d=new Set;this.flattenFields(a,i,o,l).forEach(function(v,y){var I,$=Pt(y),A=i[$];if(d.add(y),A!==void 0){var R=c.getStoreFieldName({typename:l,fieldName:y.name.value,field:y,variables:v.variables}),P=sf(s,R),D=t.processFieldValue(A,y,y.selectionSet?Qu(v,!1,!1):v,P),k=void 0;y.selectionSet&&(ne(D)||zr(D))&&(k=f("__typename",D));var Te=c.getMergeFunction(l,y.name.value,k);Te?P.info={field:y,typename:l,merge:Te}:cf(s,R),u=v.merge(u,(I={},I[R]=D,I))}else __DEV__&&!v.clientOnly&&!v.deferred&&!An.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:f}),h=p[0],m=p[1];n=n||h,m&&(u=o.merge(u,m))}catch(v){if(!n)throw v}if(typeof n=="string"){var g=ar(n),w=o.written[n]||(o.written[n]=[]);if(w.indexOf(a)>=0||(w.push(a),this.reader&&this.reader.isFresh(i,g,a,o)))return g;var b=o.incomingById.get(n);return b?(b.storeObject=o.merge(b.storeObject,u),b.mergeTree=zu(b.mergeTree,s),d.forEach(function(v){return b.fieldNodeSet.add(v)})):o.incomingById.set(n,{storeObject:u,mergeTree:hs(s)?void 0:s,fieldNodeSet:d}),g}return u},r.prototype.processFieldValue=function(e,t,n,i){var a=this;return!t.selectionSet||e===null?__DEV__?Go(e):e:ve(e)?e.map(function(o,s){var c=a.processFieldValue(o,t,n,sf(i,s));return cf(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=wa(t,e,n.fragmentMap));var a=new Map,o=this.cache.policies,s=new sr(!1);return function c(u,l){var f=s.lookup(u,l.clientOnly,l.deferred);f.visited||(f.visited=!0,u.selections.forEach(function(d){if(!!xr(d,n.variables)){var p=l.clientOnly,h=l.deferred;if(!(p&&h)&&je(d.directives)&&d.directives.forEach(function(w){var b=w.name.value;if(b==="client"&&(p=!0),b==="defer"){var v=kr(w,n.variables);(!v||v.if!==!1)&&(h=!0)}}),xt(d)){var m=a.get(d);m&&(p=p&&m.clientOnly,h=h&&m.deferred),a.set(d,Qu(n,p,h))}else{var g=_n(d,n.lookupFragment);if(!g&&d.kind===Fe.FRAGMENT_SPREAD)throw __DEV__?new J("No fragment named ".concat(d.name.value)):new J(8);g&&o.fragmentMatches(g,i,t,n.variables)&&c(g.selectionSet,Qu(n,p,h))}}}))}(e,n),a},r.prototype.applyMerges=function(e,t,n,i,a){var o,s=this;if(e.map.size&&!ne(n)){var c=!ve(n)&&(ne(t)||zr(t))?t:void 0,u=n;c&&!a&&(a=[ne(c)?c.__ref:c]);var l,f=function(d,p){return ve(d)?typeof p=="number"?d[p]:void 0:i.store.getFieldValue(d,String(p))};e.map.forEach(function(d,p){var h=f(c,p),m=f(u,p);if(m!==void 0){a&&a.push(p);var g=s.applyMerges(d,h,m,i,a);g!==m&&(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(d,p){n[p]=d}))}return e.info?this.cache.policies.runMergeFunction(t,n,e.info,i,a&&(o=i.store).getStorage.apply(o,a)):n},r}();var pf=[];function sf(r,e){var t=r.map;return t.has(e)||t.set(e,pf.pop()||{map:new Map}),t.get(e)}function zu(r,e){if(r===e||!e||hs(e))return r;if(!r||hs(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,zu(s,e.map.get(c))),o.delete(c)}),o.forEach(function(s){a.map.set(s,zu(e.map.get(s),r.map.get(s)))})}return a}function hs(r){return!r||!(r.info||r.map.size)}function cf(r,e){var t=r.map,n=t.get(e);n&&hs(n)&&(pf.push(n),t.delete(e))}var uf=new Set;function Zy(r,e,t,n){var i=function(f){var d=n.getFieldValue(f,t);return typeof d=="object"&&d},a=i(r);if(!!a){var o=i(e);if(!!o&&!ne(a)&&!xe(a,o)&&!Object.keys(a).every(function(f){return n.getFieldValue(o,f)!==void 0})){var s=n.getFieldValue(r,"__typename")||n.getFieldValue(e,"__typename"),c=Kt(t),u="".concat(s,".").concat(c);if(!uf.has(u)){uf.add(u);var l=[];!ve(a)&&!ve(o)&&[a,o].forEach(function(f){var d=n.getFieldValue(f,"__typename");typeof d=="string"&&!l.includes(d)&&l.push(d)}),__DEV__&&L.warn("Cache data may be lost when replacing the ".concat(c," field of a ").concat(s,` object.
|
|
37
37
|
|
|
38
38
|
To address this problem (which is not a bug in Apollo Client), `).concat(l.length?"either ensure all objects of type "+l.join(" and ")+" have an ID or a custom merge function, or ":"","define a custom merge function for the ").concat(u,` field, so InMemoryCache can safely merge these objects:
|
|
39
39
|
|
|
@@ -44,21 +44,21 @@ For more information about these options, please refer to the documentation:
|
|
|
44
44
|
|
|
45
45
|
* Ensuring entity objects have IDs: https://go.apollo.dev/c/generating-unique-identifiers
|
|
46
46
|
* Defining custom merge functions: https://go.apollo.dev/c/merging-non-normalized-objects
|
|
47
|
-
`))}}}}var
|
|
47
|
+
`))}}}}var ms=function(r){Ne(e,r);function e(t){t===void 0&&(t={});var n=r.call(this)||this;return n.watches=new Set,n.typenameDocumentCache=new Map,n.makeVar=ds,n.txCount=0,n.config=jd(t),n.addTypename=!!n.config.addTypename,n.policies=new af({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 lf(this,this.storeReader=new Hd({cache:this,addTypename:this.addTypename,resultCacheMaxSize:this.config.resultCacheMaxSize,canonizeResults:cs(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,kt({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 Na)return null;throw a}},e.prototype.write=function(t){try{return++this.txCount,this.storeWriter.writeToStore(this.data,t)}finally{!--this.txCount&&t.broadcast!==!1&&this.broadcastWatches()}},e.prototype.modify=function(t){if($e.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||Kd(this),this.watches.add(t),t.immediate&&this.maybeBroadcastWatch(t),function(){n.watches.delete(t)&&!n.watches.size&&Mu(n),n.maybeBroadcastWatch.forget(t)}},e.prototype.gc=function(t){kt.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(ne(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($e.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(),kt.reset(),t&&t.discardWatches?(this.watches.forEach(function(i){return n.maybeBroadcastWatch.forget(i)}),this.watches.clear(),Mu(this)):this.broadcastWatches(),Promise.resolve()},e.prototype.removeOptimistic=function(t){var n=this.optimisticData.removeLayer(t);n!==this.optimisticData&&(this.optimisticData=n,this.broadcastWatches())},e.prototype.batch=function(t){var n=this,i=t.update,a=t.optimistic,o=a===void 0?!0:a,s=t.removeOptimistic,c=t.onWatchUpdated,u,l=function(d){var p=n,h=p.data,m=p.optimisticData;++n.txCount,d&&(n.data=n.optimisticData=d);try{return u=i(n)}finally{--n.txCount,n.data=h,n.optimisticData=m}},f=new Set;return c&&!this.txCount&&this.broadcastWatches(E(E({},t),{onWatchUpdated:function(d){return f.add(d),!1}})),typeof o=="string"?this.optimisticData=this.optimisticData.addLayer(o,l):o===!1?l(this.data):l(),typeof s=="string"&&(this.optimisticData=this.optimisticData.removeLayer(s)),c&&f.size?(this.broadcastWatches(E(E({},t),{onWatchUpdated:function(d,p){var h=c.call(this,d,p);return h!==!1&&f.delete(d),h}})),f.size&&f.forEach(function(d){return n.maybeBroadcastWatch.dirty(d)})):this.broadcastWatches(t),u},e.prototype.performTransaction=function(t,n){return this.batch({update:t,optimistic:n||n!==null})},e.prototype.transformDocument=function(t){if(this.addTypename){var n=this.typenameDocumentCache.get(t);return n||(n=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||!xe(i.result,a.result))&&t.callback(t.lastDiff=a,i)},e}(Nu);function df(r){return r.hasOwnProperty("graphQLErrors")}var Yy=function(r){var e="";if(je(r.graphQLErrors)||je(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},
|
|
50
|
-
Did you mean to call refetch(variables) instead of refetch({ variables })?`))}return t&&!ke(this.options.variables,t)&&(n.variables=this.options.variables=x(x({},this.options.variables),t)),this.queryInfo.resetLastWrite(),this.reobserve(n,he.refetch)},e.prototype.fetchMore=function(t){var i=this,n=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=he.fetchMore,n.notifyOnNetworkStatusChange&&this.observe();var c=new Set;return this.queryManager.fetchQuery(a,n,he.fetchMore).then(function(u){return i.queryManager.removeQuery(a),o.networkStatus===he.fetchMore&&(o.networkStatus=s),i.queryManager.cache.batch({update:function(l){var f=t.updateQuery;f?l.updateQuery({query:i.query,variables:i.variables,returnPartialData:!0,optimistic:!1},function(d){return f(d,{fetchMoreResult:u.data,variables:n.variables})}):l.writeQuery({query:n.query,variables:n.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(i.query)||zu(i)})},e.prototype.subscribeToMore=function(t){var i=this,n=this.queryManager.startGraphQLSubscription({query:t.document,variables:t.variables,context:t.context}).subscribe({next:function(a){var o=t.updateQuery;o&&i.updateQuery(function(s,c){var u=c.variables;return o(s,{subscriptionData:a,variables:u})})},error:function(a){if(t.onError){t.onError(a);return}__DEV__&&P.error("Unhandled GraphQL subscription error",a)}});return this.subscriptions.add(n),function(){i.subscriptions.delete(n)&&n.unsubscribe()}},e.prototype.setOptions=function(t){return this.reobserve(t)},e.prototype.setVariables=function(t){return 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},he.setVariables):Promise.resolve())},e.prototype.updateQuery=function(t){var i=this.queryManager,n=i.cache.diff({query:this.options.query,variables:this.variables,returnPartialData:!0,optimistic:!1}).result,a=t(n,{variables:this.variables});a&&(i.cache.writeQuery({query:this.options.query,data:a,variables:this.variables}),i.broadcastQueries())},e.prototype.startPolling=function(t){this.options.pollInterval=t,this.updatePolling()},e.prototype.stopPolling=function(){this.options.pollInterval=0,this.updatePolling()},e.prototype.applyNextFetchPolicy=function(t,i){if(i.nextFetchPolicy){var n=i.fetchPolicy,a=n===void 0?"cache-first":n,o=i.initialFetchPolicy,s=o===void 0?a:o;a==="standby"||(typeof i.nextFetchPolicy=="function"?i.fetchPolicy=i.nextFetchPolicy(a,{reason:t,options:i,observable:this,initialFetchPolicy:s}):t==="variables-changed"?i.fetchPolicy=s:i.fetchPolicy=i.nextFetchPolicy)}return i.fetchPolicy},e.prototype.fetch=function(t,i){return this.queryManager.setObservableQuery(this),this.queryManager.fetchQueryObservable(this.queryId,t,i)},e.prototype.updatePolling=function(){var t=this;if(!this.queryManager.ssrMode){var i=this,n=i.pollingInfo,a=i.options.pollInterval;if(!a){n&&(clearTimeout(n.timeout),delete this.pollingInfo);return}if(!(n&&n.interval===a)){__DEV__?P(a,"Attempted to start a polling query without a polling interval."):P(a,13);var o=n||(this.pollingInfo={});o.interval=a;var s=function(){t.pollingInfo&&(zr(t.queryInfo.networkStatus)?c():t.reobserve({fetchPolicy:t.options.initialFetchPolicy==="no-cache"?"no-cache":"network-only"},he.poll).then(c,c))},c=function(){var u=t.pollingInfo;u&&(clearTimeout(u.timeout),u.timeout=setTimeout(s,u.interval))};c()}}},e.prototype.updateLastResult=function(t,i){return i===void 0&&(i=this.variables),this.last=x(x({},this.last),{result:this.queryManager.assumeImmutableResults?t:Ho(t),variables:i}),Be(t.errors)||delete this.last.error,this.last},e.prototype.reobserve=function(t,i){var n=this;this.isTornDown=!1;var a=i===he.refetch||i===he.fetchMore||i===he.poll,o=this.options.variables,s=this.options.fetchPolicy,c=qr(this.options,t||{}),u=a?c:Yy(this.options,c);a||(this.updatePolling(),t&&t.variables&&!ke(t.variables,o)&&u.fetchPolicy!=="standby"&&u.fetchPolicy===s&&(this.applyNextFetchPolicy("variables-changed",u),i===void 0&&(i=he.setVariables)));var l=u.variables&&x({},u.variables),f=this.fetch(u,i),d={next:function(p){n.reportResult(p,l)},error:function(p){n.reportError(p,l)}};return a||(this.concast&&this.observer&&this.concast.removeObserver(this.observer),this.concast=f,this.observer=d),f.addObserver(d),f.promise},e.prototype.observe=function(){this.reportResult(this.getCurrentResult(!1),this.variables)},e.prototype.reportResult=function(t,i){var n=this.getLastError();(n||this.isDifferentFromLastResult(t,i))&&((n||!t.partial||this.options.returnPartialData)&&this.updateLastResult(t,i),Ai(this.observers,"next",t))},e.prototype.reportError=function(t,i){var n=x(x({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:he.error,loading:!1});this.updateLastResult(n,i),Ai(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}(re);Ko(ms);function zu(r){var e=r.options,t=e.fetchPolicy,i=e.nextFetchPolicy;return t==="cache-and-network"||t==="network-only"?r.reobserve({fetchPolicy:"cache-first",nextFetchPolicy:function(){return this.nextFetchPolicy=i,typeof i=="function"?i.apply(this,arguments):t}}):r.reobserve()}function ev(r){__DEV__&&P.error("Unhandled error",r.message,r.stack)}function Wu(r){__DEV__&&r&&__DEV__&&P.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var gs=function(){function r(e){var t=e.cache,i=e.client,n=e.resolvers,a=e.fragmentMatcher;this.selectionsToResolveCache=new WeakMap,this.cache=t,i&&(this.client=i),n&&this.addResolvers(n),a&&this.setFragmentMatcher(a)}return r.prototype.addResolvers=function(e){var t=this;this.resolvers=this.resolvers||{},Array.isArray(e)?e.forEach(function(i){t.resolvers=au(t.resolvers,i)}):this.resolvers=au(this.resolvers,e)},r.prototype.setResolvers=function(e){this.resolvers={},this.addResolvers(e)},r.prototype.getResolvers=function(){return this.resolvers||{}},r.prototype.runResolvers=function(e){var t=e.document,i=e.remoteResult,n=e.context,a=e.variables,o=e.onlyRunForcedResolvers,s=o===void 0?!1:o;return Ht(this,void 0,void 0,function(){return Gt(this,function(c){return t?[2,this.resolveDocument(t,i.data,n,a,this.fragmentMatcher,s).then(function(u){return x(x({},i),{data:u.result})})]:[2,i]})})},r.prototype.setFragmentMatcher=function(e){this.fragmentMatcher=e},r.prototype.getFragmentMatcher=function(){return this.fragmentMatcher},r.prototype.clientQuery=function(e){return bn(["client"],e)&&this.resolvers?e:null},r.prototype.serverQuery=function(e){return nu(e)},r.prototype.prepareContext=function(e){var t=this.cache;return x(x({},e),{cache:t,getCacheKey:function(i){return t.identify(i)}})},r.prototype.addExportedVariables=function(e,t,i){return t===void 0&&(t={}),i===void 0&&(i={}),Ht(this,void 0,void 0,function(){return Gt(this,function(n){return e?[2,this.resolveDocument(e,this.buildRootValueFromCache(e,t)||{},this.prepareContext(i),t).then(function(a){return x(x({},t),a.exportedVariables)})]:[2,x({},t)]})})},r.prototype.shouldForceResolvers=function(e){var t=!1;return at(e,{Directive:{enter:function(i){if(i.name.value==="client"&&i.arguments&&(t=i.arguments.some(function(n){return n.name.value==="always"&&n.value.kind==="BooleanValue"&&n.value.value===!0}),t))return vi}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:iu(e),variables:t,returnPartialData:!0,optimistic:!1}).result},r.prototype.resolveDocument=function(e,t,i,n,a,o){return i===void 0&&(i={}),n===void 0&&(n={}),a===void 0&&(a=function(){return!0}),o===void 0&&(o=!1),Ht(this,void 0,void 0,function(){var s,c,u,l,f,d,p,h,m,y,S;return Gt(this,function(w){return s=_i(e),c=Si(e),u=bi(c),l=this.collectSelectionsToResolve(s,u),f=s.operation,d=f?f.charAt(0).toUpperCase()+f.slice(1):"Query",p=this,h=p.cache,m=p.client,y={fragmentMap:u,context:x(x({},i),{cache:h,client:m}),variables:n,fragmentMatcher:a,defaultOperationType:d,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},S=!1,[2,this.resolveSelectionSet(s.selectionSet,S,t,y).then(function(_){return{result:_,exportedVariables:y.exportedVariables}})]})})},r.prototype.resolveSelectionSet=function(e,t,i,n){return Ht(this,void 0,void 0,function(){var a,o,s,c,u,l=this;return Gt(this,function(f){return a=n.fragmentMap,o=n.context,s=n.variables,c=[i],u=function(d){return Ht(l,void 0,void 0,function(){var p,h;return Gt(this,function(m){return!t&&!n.selectionsToResolve.has(d)?[2]:_r(d,s)?At(d)?[2,this.resolveField(d,t,i,n).then(function(y){var S;typeof y<"u"&&c.push((S={},S[Mt(d)]=y,S))})]:(Xc(d)?p=d:(p=a[d.name.value],__DEV__?P(p,"No fragment named ".concat(d.name.value)):P(p,11)),p&&p.typeCondition&&(h=p.typeCondition.name.value,n.fragmentMatcher(i,h,o))?[2,this.resolveSelectionSet(p.selectionSet,t,i,n).then(function(y){c.push(y)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return _a(c)})]})})},r.prototype.resolveField=function(e,t,i,n){return Ht(this,void 0,void 0,function(){var a,o,s,c,u,l,f,d,p,h=this;return Gt(this,function(m){return i?(a=n.variables,o=e.name.value,s=Mt(e),c=o!==s,u=i[s]||i[o],l=Promise.resolve(u),(!n.onlyRunForcedResolvers||this.shouldForceResolvers(e))&&(f=i.__typename||n.defaultOperationType,d=this.resolvers&&this.resolvers[f],d&&(p=d[c?o:s],p&&(l=Promise.resolve(Cn.withValue(this.cache,p,[i,Er(e,a),n.context,{field:e,fragmentMap:n.fragmentMap}]))))),[2,l.then(function(y){var S,w;if(y===void 0&&(y=u),e.directives&&e.directives.forEach(function(v){v.name.value==="export"&&v.arguments&&v.arguments.forEach(function(T){T.name.value==="as"&&T.value.kind==="StringValue"&&(n.exportedVariables[T.value.value]=y)})}),!e.selectionSet||y==null)return y;var _=(w=(S=e.directives)===null||S===void 0?void 0:S.some(function(v){return v.name.value==="client"}))!==null&&w!==void 0?w:!1;if(Array.isArray(y))return h.resolveSubSelectedArray(e,t||_,y,n);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||_,y,n)})]):[2,null]})})},r.prototype.resolveSubSelectedArray=function(e,t,i,n){var a=this;return Promise.all(i.map(function(o){if(o===null)return null;if(Array.isArray(o))return a.resolveSubSelectedArray(e,t,o,n);if(e.selectionSet)return a.resolveSelectionSet(e.selectionSet,t,o,n)}))},r.prototype.collectSelectionsToResolve=function(e,t){var i=function(o){return!Array.isArray(o)},n=this.selectionsToResolveCache;function a(o){if(!n.has(o)){var s=new Set;n.set(o,s),at(o,{Directive:function(c,u,l,f,d){c.name.value==="client"&&d.forEach(function(p){i(p)&&ya(p)&&s.add(p)})},FragmentSpread:function(c,u,l,f,d){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&&(d.forEach(function(m){i(m)&&ya(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return n.get(o)}return a(e)},r}();var Dn=new(Ut?WeakMap:Map);function Hu(r,e){var t=r[e];typeof t=="function"&&(r[e]=function(){return Dn.set(r,(Dn.get(r)+1)%1e15),t.apply(this,arguments)})}function df(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var ys=function(){function r(e,t){t===void 0&&(t=e.generateQueryId()),this.queryId=t,this.listeners=new Set,this.document=null,this.lastRequestId=1,this.subscriptions=new Set,this.stopped=!1,this.dirty=!1,this.observableQuery=null;var i=this.cache=e.cache;Dn.has(i)||(Dn.set(i,0),Hu(i,"evict"),Hu(i,"modify"),Hu(i,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||he.loading;return this.variables&&this.networkStatus!==he.loading&&!ke(this.variables,e.variables)&&(t=he.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(){df(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 i=this.observableQuery;if(i&&i.options.fetchPolicy==="no-cache")return{complete:!1};var n=this.cache.diff(t);return this.updateLastDiff(n,t),n},r.prototype.updateLastDiff=function(e,t){this.lastDiff=e?{diff:e,options:t||this.getDiffOptions()}:void 0},r.prototype.getDiffOptions=function(e){var t;return e===void 0&&(e=this.variables),{query:this.document,variables:e,returnPartialData:!0,optimistic:!0,canonizeResults:(t=this.observableQuery)===null||t===void 0?void 0:t.options.canonizeResults}},r.prototype.setDiff=function(e){var t=this,i=this.lastDiff&&this.lastDiff.diff;this.updateLastDiff(e),!this.dirty&&!ke(i&&i.result,e&&e.result)&&(this.dirty=!0,this.notifyTimeout||(this.notifyTimeout=setTimeout(function(){return t.notify()},0)))},r.prototype.setObservableQuery=function(e){var t=this;e!==this.observableQuery&&(this.oqListener&&this.listeners.delete(this.oqListener),this.observableQuery=e,e?(e.queryInfo=this,this.listeners.add(this.oqListener=function(){var i=t.getDiff();i.fromOptimisticTransaction?e.observe():zu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;df(this),this.shouldNotify()&&this.listeners.forEach(function(t){return t(e)}),this.dirty=!1},r.prototype.shouldNotify=function(){if(!this.dirty||!this.listeners.size)return!1;if(zr(this.networkStatus)&&this.observableQuery){var e=this.observableQuery.options.fetchPolicy;if(e!=="cache-only"&&e!=="cache-and-network")return!1}return!0},r.prototype.stop=function(){if(!this.stopped){this.stopped=!0,this.reset(),this.cancel(),this.cancel=r.prototype.cancel,this.subscriptions.forEach(function(t){return t.unsubscribe()});var e=this.observableQuery;e&&e.stopPolling()}},r.prototype.cancel=function(){},r.prototype.updateWatch=function(e){var t=this;e===void 0&&(e=this.variables);var i=this.observableQuery;if(!(i&&i.options.fetchPolicy==="no-cache")){var n=x(x({},this.getDiffOptions(e)),{watcher:this,callback:function(a){return t.setDiff(a)}});(!this.lastWatch||!ke(n,this.lastWatch))&&(this.cancel(),this.cancel=this.cache.watch(this.lastWatch=n))}},r.prototype.resetLastWrite=function(){this.lastWrite=void 0},r.prototype.shouldWrite=function(e,t){var i=this.lastWrite;return!(i&&i.dmCount===Dn.get(this.cache)&&ke(t,i.variables)&&ke(e.data,i.result.data))},r.prototype.markResult=function(e,t,i,n){var a=this,o=new vt,s=Be(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&Be(e.incremental)){var c=Jo(this.getDiff().result,e);e.data=c}else if("hasNext"in e&&e.hasNext){var u=this.getDiff();e.data=o.merge(u.result,e.data)}this.graphQLErrors=s,i.fetchPolicy==="no-cache"?this.updateLastDiff({result:e.data,complete:!0},this.getDiffOptions(i.variables)):n!==0&&(vs(e,i.errorPolicy)?this.cache.performTransaction(function(l){if(a.shouldWrite(e,i.variables))l.writeQuery({query:t,data:e.data,variables:i.variables,overwrite:n===1}),a.lastWrite={result:e,variables:i.variables,dmCount:Dn.get(a.cache)};else if(a.lastDiff&&a.lastDiff.diff.complete){e.data=a.lastDiff.diff.result;return}var f=a.getDiffOptions(i.variables),d=l.diff(f);a.stopped||a.updateWatch(i.variables),a.updateLastDiff(d,f),d.complete&&(e.data=d.result)}):this.lastWrite=void 0)},r.prototype.markReady=function(){return this.networkError=null,this.networkStatus=he.ready},r.prototype.markError=function(e){return this.networkStatus=he.error,this.lastWrite=void 0,this.reset(),e.graphQLErrors&&(this.graphQLErrors=e.graphQLErrors),e.networkError&&(this.networkError=e.networkError),e},r}();function vs(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",i=!An(r);return!i&&t&&r.data&&(i=!0),i}var tv=Object.prototype.hasOwnProperty,ff=function(){function r(e){var t=e.cache,i=e.link,n=e.defaultOptions,a=e.queryDeduplication,o=a===void 0?!1:a,s=e.onBroadcast,c=e.ssrMode,u=c===void 0?!1:c,l=e.clientAwareness,f=l===void 0?{}:l,d=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=i,this.defaultOptions=n||Object.create(null),this.queryDeduplication=o,this.clientAwareness=f,this.localState=d||new gs({cache:t}),this.ssrMode=u,this.assumeImmutableResults=!!p,(this.onBroadcast=s)&&(this.mutationStore=Object.create(null))}return r.prototype.stop=function(){var e=this;this.queries.forEach(function(t,i){e.stopQueryNoBroadcast(i)}),this.cancelPendingFetches(__DEV__?new 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,i,n=e.mutation,a=e.variables,o=e.optimisticResponse,s=e.updateQueries,c=e.refetchQueries,u=c===void 0?[]:c,l=e.awaitRefetchQueries,f=l===void 0?!1:l,d=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,y=e.errorPolicy,S=y===void 0?((i=this.defaultOptions.mutate)===null||i===void 0?void 0:i.errorPolicy)||"none":y,w=e.keepRootFields,_=e.context;return Ht(this,void 0,void 0,function(){var v,T,$,E,R,L;return Gt(this,function(D){switch(D.label){case 0:return __DEV__?P(n,"mutation option is required. You must specify your GraphQL document in the mutation option."):P(n,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),v=this.generateMutationId(),T=this.transform(n),$=T.document,E=T.hasClientExports,n=this.cache.transformForLink($),a=this.getVariables(n,a),E?[4,this.localState.addExportedVariables(n,a,_)]:[3,2];case 1:a=D.sent(),D.label=2;case 2:return R=this.mutationStore&&(this.mutationStore[v]={mutation:n,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:v,document:n,variables:a,fetchPolicy:m,errorPolicy:S,context:_,updateQueries:s,update:d,keepRootFields:w}),this.broadcastQueries(),L=this,[2,new Promise(function(I,Ie){return Go(L.getObservableFromLink(n,x(x({},_),{optimisticResponse:o}),a,!1),function(oe){if(An(oe)&&S==="none")throw new xr({graphQLErrors:Zo(oe)});R&&(R.loading=!1,R.error=null);var M=x({},oe);return typeof u=="function"&&(u=u(M)),S==="ignore"&&An(M)&&delete M.errors,L.markMutationResult({mutationId:v,result:M,document:n,variables:a,fetchPolicy:m,errorPolicy:S,context:_,update:d,updateQueries:s,awaitRefetchQueries:f,refetchQueries:u,removeOptimistic:o?v:void 0,onQueryUpdated:p,keepRootFields:w})}).subscribe({next:function(oe){L.broadcastQueries(),(!("hasNext"in oe)||oe.hasNext===!1)&&I(oe)},error:function(oe){R&&(R.loading=!1,R.error=oe),o&&L.cache.removeOptimistic(v),L.broadcastQueries(),Ie(oe instanceof xr?oe:new xr({networkError:oe}))}})})]}})})},r.prototype.markMutationResult=function(e,t){var i=this;t===void 0&&(t=this.cache);var n=e.result,a=[],o=e.fetchPolicy==="no-cache";if(!o&&vs(n,e.errorPolicy)){if(jr(n)||a.push({result:n.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),jr(n)&&Be(n.incremental)){var s=t.diff({id:"ROOT_MUTATION",query:this.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0}),c=void 0;s.result&&(c=Jo(s.result,n)),typeof c<"u"&&(n.data=c,a.push({result:c,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}))}var u=e.updateQueries;u&&this.queries.forEach(function(f,d){var p=f.observableQuery,h=p&&p.queryName;if(!(!h||!tv.call(u,h))){var m=u[h],y=i.queries.get(d),S=y.document,w=y.variables,_=t.diff({query:S,variables:w,returnPartialData:!0,optimistic:!1}),v=_.result,T=_.complete;if(T&&v){var $=m(v,{mutationResult:n,queryName:S&&Sn(S)||void 0,queryVariables:w});$&&a.push({result:$,dataId:"ROOT_QUERY",query:S,variables:w})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(f){o||a.forEach(function(m){return f.write(m)});var d=e.update,p=!Kp(n)||jr(n)&&!n.hasNext;if(d){if(!o){var h=f.diff({id:"ROOT_MUTATION",query:i.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(n=x(x({},n),{data:h.result}),"incremental"in n&&delete n.incremental,"hasNext"in n&&delete n.hasNext)}p&&d(f,n,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&f.modify({id:"ROOT_MUTATION",fields:function(m,y){var S=y.fieldName,w=y.DELETE;return S==="__typename"?m:w}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(f){return l.push(f)}),e.awaitRefetchQueries||e.onQueryUpdated)return Promise.all(l).then(function(){return n})}return Promise.resolve(n)},r.prototype.markMutationOptimistic=function(e,t){var i=this,n=typeof e=="function"?e(t.variables):e;return this.cache.recordOptimisticTransaction(function(a){try{i.markMutationResult(x(x({},t),{result:{data:n}}),a)}catch(o){__DEV__&&P.error(o)}},t.mutationId)},r.prototype.fetchQuery=function(e,t,i){return this.fetchQueryObservable(e,t,i).promise},r.prototype.getQueryStore=function(){var e=Object.create(null);return this.queries.forEach(function(t,i){e[i]={variables:t.variables,networkStatus:t.networkStatus,networkError:t.networkError,graphQLErrors:t.graphQLErrors}}),e},r.prototype.resetErrors=function(e){var t=this.queries.get(e);t&&(t.networkError=void 0,t.graphQLErrors=[])},r.prototype.transform=function(e){var t=this.transformCache;if(!t.has(e)){var i=this.cache.transformDocument(e),n=ru(i),a=this.localState.clientQuery(i),o=n&&this.localState.serverQuery(n),s={document:i,hasClientExports:Kc(i),hasForcedResolvers:this.localState.shouldForceResolvers(i),clientQuery:a,serverQuery:o,defaultVars:Ei(or(i)),asQuery:x(x({},i),{definitions:i.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(i),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 ys(this),i=new ms({queryManager:this,queryInfo:t,options:e});return this.queries.set(i.queryId,t),t.init({document:i.query,observableQuery:i,variables:i.variables}),i},r.prototype.query=function(e,t){var i=this;return t===void 0&&(t=this.generateQueryId()),__DEV__?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 i.stopQuery(t)})},r.prototype.generateQueryId=function(){return String(this.queryIdCounter++)},r.prototype.generateRequestId=function(){return this.requestIdCounter++},r.prototype.generateMutationId=function(){return String(this.mutationIdCounter++)},r.prototype.stopQueryInStore=function(e){this.stopQueryInStoreNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryInStoreNoBroadcast=function(e){var t=this.queries.get(e);t&&t.stop()},r.prototype.clearStore=function(e){return e===void 0&&(e={discardWatches:!0}),this.cancelPendingFetches(__DEV__?new 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 i=new Map,n=new Map,a=new Set;return Array.isArray(e)&&e.forEach(function(o){typeof o=="string"?n.set(o,!1):Zc(o)?n.set(t.transform(o).document,!1):le(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){i.set(s,c);return}var l=c.queryName,f=c.options.fetchPolicy;if(f==="standby"||e==="active"&&!c.hasObservers())return;(e==="active"||l&&n.has(l)||u&&n.has(u))&&(i.set(s,c),l&&n.set(l,!0),u&&n.set(u,!0))}}),a.size&&a.forEach(function(o){var s=Aa("legacyOneTimeQuery"),c=t.getQuery(s).init({document:o.query,variables:o.variables}),u=new ms({queryManager:t,queryInfo:c,options:x(x({},o),{fetchPolicy:"network-only"})});P(u.queryId===s),c.setObservableQuery(u),i.set(s,u)}),__DEV__&&n.size&&n.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"))}),i},r.prototype.reFetchObservableQueries=function(e){var t=this;e===void 0&&(e=!1);var i=[];return this.getObservableQueries(e?"all":"active").forEach(function(n,a){var o=n.options.fetchPolicy;n.resetLastResults(),(e||o!=="standby"&&o!=="cache-only")&&i.push(n.refetch()),t.getQuery(a).setDiff(null)}),this.broadcastQueries(),Promise.all(i)},r.prototype.setObservableQuery=function(e){this.getQuery(e.queryId).setObservableQuery(e)},r.prototype.startGraphQLSubscription=function(e){var t=this,i=e.query,n=e.fetchPolicy,a=e.errorPolicy,o=e.variables,s=e.context,c=s===void 0?{}:s;i=this.transform(i).document,o=this.getVariables(i,o);var u=function(f){return t.getObservableFromLink(i,c,f).map(function(d){if(n!=="no-cache"&&(vs(d,a)&&t.cache.write({query:i,result:d.data,dataId:"ROOT_SUBSCRIPTION",variables:f}),t.broadcastQueries()),An(d))throw new xr({graphQLErrors:d.errors});return d})};if(this.transform(i).hasClientExports){var l=this.localState.addExportedVariables(i,o,c).then(u);return new re(function(f){var d=null;return l.then(function(p){return d=p.subscribe(f)},f.error),function(){return d&&d.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,i,n){var a=this,o;n===void 0&&(n=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,f=u.link,d={query:c,variables:i,operationName:Sn(c)||void 0,context:this.prepareContext(x(x({},t),{forceFetch:!n}))};if(t=d.context,n){var p=l.get(c)||new Map;l.set(c,p);var h=It(i);if(s=p.get(h),!s){var m=new xn([In(f,d)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new xn([In(f,d)])}else s=new xn([re.of({data:{}})]),t=this.prepareContext(t);var y=this.transform(e).clientQuery;return y&&(s=Go(s,function(S){return a.localState.runResolvers({document:y,remoteResult:S,context:t,variables:i})})),s},r.prototype.getResultsFromLink=function(e,t,i){var n=e.lastRequestId=this.generateRequestId(),a=this.cache.transformForLink(this.transform(e.document).document);return Go(this.getObservableFromLink(a,i.context,i.variables),function(o){var s=Zo(o),c=s.length>0;if(n>=e.lastRequestId){if(c&&i.errorPolicy==="none")throw e.markError(new xr({graphQLErrors:s}));e.markResult(o,a,i,t),e.markReady()}var u={data:o.data,loading:!1,networkStatus:he.ready};return c&&i.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=he.error),u},function(o){var s=pf(o)?o:new xr({networkError:o});throw n>=e.lastRequestId&&e.markError(s),s})},r.prototype.fetchQueryObservable=function(e,t,i){var n=this;i===void 0&&(i=he.loading);var a=this.transform(t.query).document,o=this.getVariables(a,t.variables),s=this.getQuery(e),c=this.defaultOptions.watchQuery,u=t.fetchPolicy,l=u===void 0?c&&c.fetchPolicy||"cache-first":u,f=t.errorPolicy,d=f===void 0?c&&c.errorPolicy||"none":f,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,y=m===void 0?!1:m,S=t.context,w=S===void 0?{}:S,_=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:d,returnPartialData:h,notifyOnNetworkStatusChange:y,context:w}),v=function(E){_.variables=E;var R=n.fetchQueryByPolicy(s,_,i);return _.fetchPolicy!=="standby"&&R.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),R},T=function(){return n.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(E){T(),setTimeout(function(){return $.cancel(E)})});var $=new xn(this.transform(_.query).hasClientExports?this.localState.addExportedVariables(_.query,_.variables,_.context).then(v):v(_.variables));return $.promise.then(T,T),$},r.prototype.refetchQueries=function(e){var t=this,i=e.updateCache,n=e.include,a=e.optimistic,o=a===void 0?!1:a,s=e.removeOptimistic,c=s===void 0?o?Aa("refetchQueries"):void 0:s,u=e.onQueryUpdated,l=new Map;n&&this.getObservableQueries(n).forEach(function(d,p){l.set(p,{oq:d,lastDiff:t.getQuery(p).getDiff()})});var f=new Map;return i&&this.cache.batch({update:i,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(d,p,h){var m=d.watcher instanceof ys&&d.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var y=u(m,p,h);return y===!0&&(y=m.refetch()),y!==!1&&f.set(m,y),y}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(d,p){var h=d.oq,m=d.lastDiff,y=d.diff,S;if(u){if(!y){var w=h.queryInfo;w.reset(),y=w.getDiff()}S=u(h,y,m)}(!u||S===!0)&&(S=h.refetch()),S!==!1&&f.set(h,S),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),f},r.prototype.fetchQueryByPolicy=function(e,t,i){var n=this,a=t.query,o=t.variables,s=t.fetchPolicy,c=t.refetchWritePolicy,u=t.errorPolicy,l=t.returnPartialData,f=t.context,d=t.notifyOnNetworkStatusChange,p=e.networkStatus;e.init({document:this.transform(a).document,variables:o,networkStatus:i});var h=function(){return e.getDiff(o)},m=function(v,T){T===void 0&&(T=e.networkStatus||he.loading);var $=v.result;__DEV__&&!l&&!ke($,{})&&Wu(v.missing);var E=function(R){return re.of(x({data:R,loading:zr(T),networkStatus:T},v.complete?null:{partial:!0}))};return $&&n.transform(a).hasForcedResolvers?n.localState.runResolvers({document:a,remoteResult:{data:$},context:f,variables:o,onlyRunForcedResolvers:!0}).then(function(R){return E(R.data||void 0)}):u==="none"&&T===he.refetch&&Array.isArray(v.missing)?E(void 0):E($)},y=s==="no-cache"?0:i===he.refetch&&c!=="merge"?1:2,S=function(){return n.getResultsFromLink(e,y,{variables:o,context:f,fetchPolicy:s,errorPolicy:u})},w=d&&typeof p=="number"&&p!==i&&zr(i);switch(s){default:case"cache-first":{var _=h();return _.complete?[m(_,e.markReady())]:l||w?[m(_),S()]:[S()]}case"cache-and-network":{var _=h();return _.complete||l||w?[m(_),S()]:[S()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return w?[m(h()),S()]:[S()];case"no-cache":return w?[m(e.getDiff()),S()]:[S()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new ys(this,e)),this.queries.get(e)},r.prototype.prepareContext=function(e){e===void 0&&(e={});var t=this.localState.prepareContext(e);return x(x({},t),{clientAwareness:this.clientAwareness})},r}();var hf=!1;var Gu=function(){function r(e){var t=this;this.resetStoreCallbacks=[],this.clearStoreCallbacks=[];var i=e.uri,n=e.credentials,a=e.headers,o=e.cache,s=e.ssrMode,c=s===void 0?!1:s,u=e.ssrForceFetchDelay,l=u===void 0?0:u,f=e.connectToDevTools,d=f===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:f,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,y=e.assumeImmutableResults,S=y===void 0?!1:y,w=e.resolvers,_=e.typeDefs,v=e.fragmentMatcher,T=e.name,$=e.version,E=e.link;if(E||(E=i?new _u({uri:i,credentials:n,headers:a}):jt.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=E,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=_,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!hf&&d&&__DEV__&&(hf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var R=window.navigator,L=R&&R.userAgent,D=void 0;typeof L=="string"&&(L.indexOf("Chrome/")>-1?D="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":L.indexOf("Firefox/")>-1&&(D="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),D&&__DEV__&&P.log("Download the Apollo DevTools for a better development experience: "+D)}this.version=Xp,this.localState=new gs({cache:o,client:this,resolvers:w,fragmentMatcher:v}),this.queryManager=new ff({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:T,version:$},localState:this.localState,assumeImmutableResults:S,onBroadcast:d?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Ia(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=Ia(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=Ia(this.defaultOptions.mutate,e)),this.queryManager.mutate(e)},r.prototype.subscribe=function(e){return this.queryManager.startGraphQLSubscription(e)},r.prototype.readQuery=function(e,t){return t===void 0&&(t=!1),this.cache.readQuery(e,t)},r.prototype.readFragment=function(e,t){return t===void 0&&(t=!1),this.cache.readFragment(e,t)},r.prototype.writeQuery=function(e){var t=this.cache.writeQuery(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.writeFragment=function(e){var t=this.cache.writeFragment(e);return e.broadcast!==!1&&this.queryManager.broadcastQueries(),t},r.prototype.__actionHookForDevTools=function(e){this.devToolsHookCb=e},r.prototype.__requestRaw=function(e){return In(this.link,e)},r.prototype.resetStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!1})}).then(function(){return Promise.all(e.resetStoreCallbacks.map(function(t){return t()}))}).then(function(){return e.reFetchObservableQueries()})},r.prototype.clearStore=function(){var e=this;return Promise.resolve().then(function(){return e.queryManager.clearStore({discardWatches:!0})}).then(function(){return Promise.all(e.clearStoreCallbacks.map(function(t){return t()}))})},r.prototype.onResetStore=function(e){var t=this;return this.resetStoreCallbacks.push(e),function(){t.resetStoreCallbacks=t.resetStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.onClearStore=function(e){var t=this;return this.clearStoreCallbacks.push(e),function(){t.clearStoreCallbacks=t.clearStoreCallbacks.filter(function(i){return i!==e})}},r.prototype.reFetchObservableQueries=function(e){return this.queryManager.reFetchObservableQueries(e)},r.prototype.refetchQueries=function(e){var t=this.queryManager.refetchQueries(e),i=[],n=[];t.forEach(function(o,s){i.push(s),n.push(o)});var a=Promise.all(n);return a.queries=i,a.results=n,a.catch(function(o){__DEV__&&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}();Ap(yi?"log":"silent");function lt(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Ar(r){return lt(r)==="object"}function mf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Ku(r,e){return r.length<124?r:e}var gf="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 yf(r){if(!Ar(r))throw new Error(`Message is expected to be an object, but got ${lt(r)}`);if(!r.type)throw new Error("Message is missing the 'type' property");if(typeof r.type!="string")throw new Error(`Message is expects the 'type' property to be a string, but got ${lt(r.type)}`);switch(r.type){case Pe.ConnectionInit:case Pe.ConnectionAck:case Pe.Ping:case Pe.Pong:{if(r.payload!=null&&!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object or nullish or missing, but got "${r.payload}"`);break}case Pe.Subscribe:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${lt(r.payload)}`);if(typeof r.payload.query!="string")throw new Error(`"${r.type}" message payload expects the 'query' property to be a string, but got ${lt(r.payload.query)}`);if(r.payload.variables!=null&&!Ar(r.payload.variables))throw new Error(`"${r.type}" message payload expects the 'variables' property to be a an object or nullish or missing, but got ${lt(r.payload.variables)}`);if(r.payload.operationName!=null&<(r.payload.operationName)!=="string")throw new Error(`"${r.type}" message payload expects the 'operationName' property to be a string or nullish or missing, but got ${lt(r.payload.operationName)}`);if(r.payload.extensions!=null&&!Ar(r.payload.extensions))throw new Error(`"${r.type}" message payload expects the 'extensions' property to be a an object or nullish or missing, but got ${lt(r.payload.extensions)}`);break}case Pe.Next:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!Ar(r.payload))throw new Error(`"${r.type}" message expects the 'payload' property to be an object, but got ${lt(r.payload)}`);break}case Pe.Error:{if(typeof r.id!="string")throw new Error(`"${r.type}" message expects the 'id' property to be a string, but got ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);if(!mf(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 ${lt(r.id)}`);if(!r.id)throw new Error(`"${r.type}" message requires a non-empty 'id' property`);break}default:throw new Error(`Invalid message 'type' property "${r.type}"`)}return r}function vf(r,e){return yf(typeof r=="string"?JSON.parse(r,e):r)}function $n(r,e){return yf(r),JSON.stringify(r,e)}function Ju(r){let{url:e,connectionParams:t,lazy:i=!0,onNonLazyError:n=console.error,lazyCloseTimeout:a=0,keepAlive:o=0,disablePong:s,connectionAckWaitTimeout:c=0,retryAttempts:u=5,retryWait:l=async function(Se){let _e=1e3;for(let ce=0;ce<Se;ce++)_e*=2;await new Promise(ce=>setTimeout(ce,_e+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:f=bs,isFatalConnectionProblem:d,on:p,webSocketImpl:h,generateID:m=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,Se=>{let _e=Math.random()*16|0;return(Se=="x"?_e:_e&3|8).toString(16)})},jsonMessageReplacer:y,jsonMessageReviver:S}=r,w;if(h){if(!iv(h))throw new Error("Invalid WebSocket implementation provided");w=h}else typeof WebSocket<"u"?w=WebSocket:typeof global<"u"?w=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(w=window.WebSocket||window.MozWebSocket);if(!w)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let _=w,v=(()=>{let M=(()=>{let _e={};return{on(ce,ue){return _e[ce]=ue,()=>{delete _e[ce]}},emit(ce){var ue;"id"in ce&&((ue=_e[ce.id])===null||ue===void 0||ue.call(_e,ce))}}})(),Se={connecting:p?.connecting?[p.connecting]:[],opened:p?.opened?[p.opened]:[],connected:p?.connected?[p.connected]:[],ping:p?.ping?[p.ping]:[],pong:p?.pong?[p.pong]:[],message:p?.message?[M.emit,p.message]:[M.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:M.on,on(_e,ce){let ue=Se[_e];return ue.push(ce),()=>{ue.splice(ue.indexOf(ce),1)}},emit(_e,...ce){for(let ue of[...Se[_e]])ue(...ce)}}})();function T(M){let Se=[v.on("error",_e=>{Se.forEach(ce=>ce()),M(_e)}),v.on("closed",_e=>{Se.forEach(ce=>ce()),M(_e)})]}let $,E=0,R,L=!1,D=0,I=!1;async function Ie(){clearTimeout(R);let[M,Se]=await($??($=new Promise((ue,rr)=>(async()=>{if(L){if(await l(D),!E)return $=void 0,rr({code:1e3,reason:"All Subscriptions Gone"});D++}v.emit("connecting");let te=new _(typeof e=="function"?await e():e,gf),ir,Lr;function Po(){isFinite(o)&&o>0&&(clearTimeout(Lr),Lr=setTimeout(()=>{te.readyState===_.OPEN&&(te.send($n({type:Pe.Ping})),v.emit("ping",!1,void 0))},o))}T(Ye=>{$=void 0,clearTimeout(ir),clearTimeout(Lr),rr(Ye),bs(Ye)&&Ye.code===4499&&(te.close(4499,"Terminated"),te.onerror=null,te.onclose=null)}),te.onerror=Ye=>v.emit("error",Ye),te.onclose=Ye=>v.emit("closed",Ye),te.onopen=async()=>{try{v.emit("opened",te);let Ye=typeof t=="function"?await t():t;if(te.readyState!==_.OPEN)return;te.send($n(Ye?{type:Pe.ConnectionInit,payload:Ye}:{type:Pe.ConnectionInit},y)),isFinite(c)&&c>0&&(ir=setTimeout(()=>{te.close(bt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Po()}catch(Ye){v.emit("error",Ye),te.close(bt.InternalClientError,Ku(Ye instanceof Error?Ye.message:new Error(Ye).message,"Internal client error"))}};let yn=!1;te.onmessage=({data:Ye})=>{try{let Xe=vf(Ye,S);if(v.emit("message",Xe),Xe.type==="ping"||Xe.type==="pong"){v.emit(Xe.type,!0,Xe.payload),Xe.type==="pong"?Po():s||(te.send($n(Xe.payload?{type:Pe.Pong,payload:Xe.payload}:{type:Pe.Pong})),v.emit("pong",!1,Xe.payload));return}if(yn)return;if(Xe.type!==Pe.ConnectionAck)throw new Error(`First message cannot be of type ${Xe.type}`);clearTimeout(ir),yn=!0,v.emit("connected",te,Xe.payload),L=!1,D=0,ue([te,new Promise((RS,sg)=>T(sg))])}catch(Xe){te.onmessage=null,v.emit("error",Xe),te.close(bt.BadResponse,Ku(Xe instanceof Error?Xe.message:new Error(Xe).message,"Bad response"))}}})())));M.readyState===_.CLOSING&&await Se;let _e=()=>{},ce=new Promise(ue=>_e=ue);return[M,_e,Promise.race([ce.then(()=>{if(!E){let ue=()=>M.close(1e3,"Normal Closure");isFinite(a)&&a>0?R=setTimeout(()=>{M.readyState===_.OPEN&&ue()},a):ue()}}),Se])]}function oe(M){if(bs(M)&&(rv(M.code)||[bt.InternalServerError,bt.InternalClientError,bt.BadRequest,bt.BadResponse,bt.Unauthorized,bt.SubprotocolNotAcceptable,bt.SubscriberAlreadyExists,bt.TooManyInitialisationRequests].includes(M.code)))throw M;if(I)return!1;if(bs(M)&&M.code===1e3)return E>0;if(!u||D>=u||!f(M)||d?.(M))throw M;return L=!0}return i||(async()=>{for(E++;;)try{let[,,M]=await Ie();await M}catch(M){try{if(!oe(M))return}catch(Se){return n?.(Se)}}})(),{on:v.on,subscribe(M,Se){let _e=m(M),ce=!1,ue=!1,rr=()=>{E--,ce=!0};return(async()=>{for(E++;;)try{let[te,ir,Lr]=await Ie();if(ce)return ir();let Po=v.onMessage(_e,yn=>{switch(yn.type){case Pe.Next:{Se.next(yn.payload);return}case Pe.Error:{ue=!0,ce=!0,Se.error(yn.payload),rr();return}case Pe.Complete:{ce=!0,rr();return}}});te.send($n({id:_e,type:Pe.Subscribe,payload:M},y)),rr=()=>{!ce&&te.readyState===_.OPEN&&te.send($n({id:_e,type:Pe.Complete},y)),E--,ce=!0,ir()},await Lr.finally(Po);return}catch(te){if(!oe(te))return}})().then(()=>{ue||Se.complete()}).catch(te=>{Se.error(te)}),()=>{ce||rr()}},async dispose(){if(I=!0,$){let[M]=await $;M.close(1e3,"Normal Closure")}},terminate(){$&&v.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function bs(r){return Ar(r)&&"code"in r&&"reason"in r}function rv(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function iv(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function nv(r){return le(r)&&"code"in r&&"reason"in r}var bf=function(r){Re(e,r);function e(t){var i=r.call(this)||this;return i.client=t,i}return e.prototype.request=function(t){var i=this;return new re(function(n){return i.client.subscribe(x(x({},t),{query:vn(t.query)}),{next:n.next.bind(n),complete:n.complete.bind(n),error:function(a){return a instanceof Error?n.error(a):nv(a)?n.error(new Error("Socket closed with event ".concat(a.code," ").concat(a.reason||""))):n.error(new xr({graphQLErrors:Array.isArray(a)?a:[a]}))}})})},e}(jt);var ws="0.12.0-rc1-dev.1";function Ss(){return typeof window!="undefined"&&window.self!==window.top}function Zu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function kt(r,e){Zu()&&localStorage.setItem(`${ws}/${r}`,e)}function _s(r){return Zu()?localStorage.getItem(`${ws}/${r}`):null}function Ra(r){Zu()&&localStorage.removeItem(`${ws}/${r}`)}function Rn(r,e=1e4){return K(this,null,function*(){return Promise.race([new Promise((t,i)=>{let n;try{n=new WebSocket(r,"graphql-transport-ws"),n.onopen=()=>{n.close(),t(n)},n.onerror=a=>{i(a)},n.onclose=a=>{a.code!==1e3&&i(new Error(`WebSocket closed with code ${a.code}: ${a.reason}`))}}catch(a){n&&n.close(),i(a)}}),new Promise((t,i)=>{setTimeout(()=>{i(new Error("WebSocket connection timed out"))},e)})])})}var tc=function(){return tc=Object.assign||function(e){for(var t,i=1,n=arguments.length;i<n;i++){t=arguments[i];for(var a in t)Object.prototype.hasOwnProperty.call(t,a)&&(e[a]=t[a])}return e},tc.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Ps(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Ps=function(t){return typeof t}:Ps=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Ps(r)}function ov(r){return Ps(r)=="object"&&r!==null}var jh=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function yl(r,e){for(var t=/\r\n|[\n\r]/g,i=1,n=e+1,a;(a=t.exec(r.body))&&a.index<e;)i+=1,n=e+1-(a.index+a[0].length);return{line:i,column:n}}function sv(r){return qh(r.source,yl(r.source,r.start))}function qh(r,e){var t=r.locationOffset.column-1,i=Fs(t)+r.body,n=e.line-1,a=r.locationOffset.line-1,o=e.line+a,s=e.line===1?t:0,c=e.column+s,u="".concat(r.name,":").concat(o,":").concat(c,`
|
|
52
|
-
`),l=
|
|
53
|
-
`)}function
|
|
49
|
+
`)),e=e.replace(/\n$/,""),e},Ar=function(r){Ne(e,r);function e(t){var n=t.graphQLErrors,i=t.clientErrors,a=t.networkError,o=t.errorMessage,s=t.extraInfo,c=r.call(this,o)||this;return c.name="ApolloError",c.graphQLErrors=n||[],c.clientErrors=i||[],c.networkError=a||null,c.message=o||Yy(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 Xy=Object.assign,ev=Object.hasOwnProperty,gs=function(r){Ne(e,r);function e(t){var n=t.queryManager,i=t.queryInfo,a=t.options,o=r.call(this,function(g){try{var w=g._subscription._observer;w&&!w.error&&(w.error=tv)}catch{}var b=!o.observers.size;o.observers.add(g);var v=o.last;return v&&v.error?g.error&&g.error(v.error):v&&v.result&&g.next&&g.next(v.result),b&&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,f=a.fetchPolicy,d=f===void 0?l:f,p=a.initialFetchPolicy,h=p===void 0?d==="standby"?l:d:p;o.options=E(E({},a),{initialFetchPolicy:h,fetchPolicy:d}),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||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),xe(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&&Hu(c.missing)}return t&&this.updateLastResult(a),a},e.prototype.isDifferentFromLastResult=function(t,n){return!this.last||!xe(this.last.result,t)||n&&!xe(this.last.variables,n)},e.prototype.getLast=function(t,n){var i=this.last;if(i&&i[t]&&(!n||xe(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&&ev.call(t,"variables")){var o=Sa(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&&!xe(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 f=t.updateQuery;f?l.updateQuery({query:n.query,variables:n.variables,returnPartialData:!0,optimistic:!1},function(d){return f(d,{fetchMoreResult:u.data,variables:i.variables})}):l.writeQuery({query:i.query,variables:i.variables,data:u.data})},onWatchUpdated:function(l){c.add(l.query)}}),u}).finally(function(){c.has(n.query)||Wu(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 xe(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:Go(t),variables:n}),je(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:Xy(this.options,c);a||(this.updatePolling(),t&&t.variables&&!xe(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),f=this.fetch(u,n),d={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=f,this.observer=d),f.addObserver(d),f.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=E(E({},this.getLastResult()),{error:t,errors:t.graphQLErrors,networkStatus:he.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}(re);Jo(gs);function Wu(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 tv(r){__DEV__&&L.error("Unhandled error",r.message,r.stack)}function Hu(r){__DEV__&&r&&__DEV__&&L.debug("Missing cache result fields: ".concat(JSON.stringify(r)),r)}var ys=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=ou(t.resolvers,n)}):this.resolvers=ou(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 au(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 wn}}}),t},r.prototype.buildRootValueFromCache=function(e,t){return this.cache.diff({query:iu(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,f,d,p,h,m,g,w;return Wt(this,function(b){return s=xn(e),c=En(e),u=Sn(c),l=this.collectSelectionsToResolve(s,u),f=s.operation,d=f?f.charAt(0).toUpperCase()+f.slice(1):"Query",p=this,h=p.cache,m=p.client,g={fragmentMap:u,context:E(E({},n),{cache:h,client:m}),variables:i,fragmentMatcher:a,defaultOperationType:d,exportedVariables:{},selectionsToResolve:l,onlyRunForcedResolvers:o},w=!1,[2,this.resolveSelectionSet(s.selectionSet,w,t,g).then(function(v){return{result:v,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(f){return a=i.fragmentMap,o=i.context,s=i.variables,c=[n],u=function(d){return zt(l,void 0,void 0,function(){var p,h;return Wt(this,function(m){return!t&&!i.selectionsToResolve.has(d)?[2]:xr(d,s)?xt(d)?[2,this.resolveField(d,t,n,i).then(function(g){var w;typeof g<"u"&&c.push((w={},w[Pt(d)]=g,w))})]:(eu(d)?p=d:(p=a[d.name.value],__DEV__?L(p,"No fragment named ".concat(d.name.value)):L(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(g){c.push(g)})]:[2]):[2]})})},[2,Promise.all(e.selections.map(u)).then(function(){return _a(c)})]})})},r.prototype.resolveField=function(e,t,n,i){return zt(this,void 0,void 0,function(){var a,o,s,c,u,l,f,d,p,h=this;return Wt(this,function(m){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))&&(f=n.__typename||i.defaultOperationType,d=this.resolvers&&this.resolvers[f],d&&(p=d[c?o:s],p&&(l=Promise.resolve(Ni.withValue(this.cache,p,[n,kr(e,a),i.context,{field:e,fragmentMap:i.fragmentMap}]))))),[2,l.then(function(g){var w,b;if(g===void 0&&(g=u),e.directives&&e.directives.forEach(function(y){y.name.value==="export"&&y.arguments&&y.arguments.forEach(function(I){I.name.value==="as"&&I.value.kind==="StringValue"&&(i.exportedVariables[I.value.value]=g)})}),!e.selectionSet||g==null)return g;var v=(b=(w=e.directives)===null||w===void 0?void 0:w.some(function(y){return y.name.value==="client"}))!==null&&b!==void 0?b:!1;if(Array.isArray(g))return h.resolveSubSelectedArray(e,t||v,g,i);if(e.selectionSet)return h.resolveSelectionSet(e.selectionSet,t||v,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,f,d){c.name.value==="client"&&d.forEach(function(p){n(p)&&ya(p)&&s.add(p)})},FragmentSpread:function(c,u,l,f,d){var p=t[c.name.value];__DEV__?L(p,"No fragment named ".concat(c.name.value)):L(p,12);var h=a(p);h.size>0&&(d.forEach(function(m){n(m)&&ya(m)&&s.add(m)}),s.add(c),h.forEach(function(m){s.add(m)}))}})}return i.get(o)}return a(e)},r}();var Di=new(Ft?WeakMap:Map);function Gu(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 ff(r){r.notifyTimeout&&(clearTimeout(r.notifyTimeout),r.notifyTimeout=void 0)}var vs=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),Gu(n,"evict"),Gu(n,"modify"),Gu(n,"reset"))}return r.prototype.init=function(e){var t=e.networkStatus||he.loading;return this.variables&&this.networkStatus!==he.loading&&!xe(this.variables,e.variables)&&(t=he.setVariables),xe(e.variables,this.variables)||(this.lastDiff=void 0),Object.assign(this,{document:e.document,variables:e.variables,networkError:null,graphQLErrors:this.graphQLErrors||[],networkStatus:t}),e.observableQuery&&this.setObservableQuery(e.observableQuery),e.lastRequestId&&(this.lastRequestId=e.lastRequestId),this},r.prototype.reset=function(){ff(this),this.dirty=!1},r.prototype.getDiff=function(e){e===void 0&&(e=this.variables);var t=this.getDiffOptions(e);if(this.lastDiff&&xe(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&&!xe(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():Wu(e)})):delete this.oqListener)},r.prototype.notify=function(){var e=this;ff(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||!xe(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)&&xe(t,n.variables)&&xe(e.data,n.result.data))},r.prototype.markResult=function(e,t,n,i){var a=this,o=new gt,s=je(e.errors)?e.errors.slice(0):[];if(this.reset(),"incremental"in e&&je(e.incremental)){var c=Zo(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&&(bs(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 f=a.getDiffOptions(n.variables),d=l.diff(f);a.stopped||a.updateWatch(n.variables),a.updateLastDiff(d,f),d.complete&&(e.data=d.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 bs(r,e){e===void 0&&(e="none");var t=e==="ignore"||e==="all",n=!Ai(r);return!n&&t&&r.data&&(n=!0),n}var rv=Object.prototype.hasOwnProperty,hf=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,f=l===void 0?{}:l,d=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=f,this.localState=d||new ys({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,f=l===void 0?!1:l,d=e.update,p=e.onQueryUpdated,h=e.fetchPolicy,m=h===void 0?((t=this.defaultOptions.mutate)===null||t===void 0?void 0:t.fetchPolicy)||"network-only":h,g=e.errorPolicy,w=g===void 0?((n=this.defaultOptions.mutate)===null||n===void 0?void 0:n.errorPolicy)||"none":g,b=e.keepRootFields,v=e.context;return zt(this,void 0,void 0,function(){var y,I,$,A,R,P;return Wt(this,function(D){switch(D.label){case 0:return __DEV__?L(i,"mutation option is required. You must specify your GraphQL document in the mutation option."):L(i,15),__DEV__?L(m==="network-only"||m==="no-cache","Mutations support only 'network-only' or 'no-cache' fetchPolicy strings. The default `network-only` behavior automatically writes mutation results to the cache. Passing `no-cache` skips the cache write."):L(m==="network-only"||m==="no-cache",16),y=this.generateMutationId(),I=this.transform(i),$=I.document,A=I.hasClientExports,i=this.cache.transformForLink($),a=this.getVariables(i,a),A?[4,this.localState.addExportedVariables(i,a,v)]:[3,2];case 1:a=D.sent(),D.label=2;case 2:return R=this.mutationStore&&(this.mutationStore[y]={mutation:i,variables:a,loading:!0,error:null}),o&&this.markMutationOptimistic(o,{mutationId:y,document:i,variables:a,fetchPolicy:m,errorPolicy:w,context:v,updateQueries:s,update:d,keepRootFields:b}),this.broadcastQueries(),P=this,[2,new Promise(function(k,Te){return Ko(P.getObservableFromLink(i,E(E({},v),{optimisticResponse:o}),a,!1),function(Ue){if(Ai(Ue)&&w==="none")throw new Ar({graphQLErrors:Yo(Ue)});R&&(R.loading=!1,R.error=null);var W=E({},Ue);return typeof u=="function"&&(u=u(W)),w==="ignore"&&Ai(W)&&delete W.errors,P.markMutationResult({mutationId:y,result:W,document:i,variables:a,fetchPolicy:m,errorPolicy:w,context:v,update:d,updateQueries:s,awaitRefetchQueries:f,refetchQueries:u,removeOptimistic:o?y:void 0,onQueryUpdated:p,keepRootFields:b})}).subscribe({next:function(Ue){P.broadcastQueries(),(!("hasNext"in Ue)||Ue.hasNext===!1)&&k(Ue)},error:function(Ue){R&&(R.loading=!1,R.error=Ue),o&&P.cache.removeOptimistic(y),P.broadcastQueries(),Te(Ue instanceof Ar?Ue:new Ar({networkError:Ue}))}})})]}})})},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&&bs(i,e.errorPolicy)){if(Br(i)||a.push({result:i.data,dataId:"ROOT_MUTATION",query:e.document,variables:e.variables}),Br(i)&&je(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=Zo(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(f,d){var p=f.observableQuery,h=p&&p.queryName;if(!(!h||!rv.call(u,h))){var m=u[h],g=n.queries.get(d),w=g.document,b=g.variables,v=t.diff({query:w,variables:b,returnPartialData:!0,optimistic:!1}),y=v.result,I=v.complete;if(I&&y){var $=m(y,{mutationResult:i,queryName:w&&_i(w)||void 0,queryVariables:b});$&&a.push({result:$,dataId:"ROOT_QUERY",query:w,variables:b})}}})}if(a.length>0||e.refetchQueries||e.update||e.onQueryUpdated||e.removeOptimistic){var l=[];if(this.refetchQueries({updateCache:function(f){o||a.forEach(function(m){return f.write(m)});var d=e.update,p=!Jp(i)||Br(i)&&!i.hasNext;if(d){if(!o){var h=f.diff({id:"ROOT_MUTATION",query:n.transform(e.document).asQuery,variables:e.variables,optimistic:!1,returnPartialData:!0});h.complete&&(i=E(E({},i),{data:h.result}),"incremental"in i&&delete i.incremental,"hasNext"in i&&delete i.hasNext)}p&&d(f,i,{context:e.context,variables:e.variables})}!o&&!e.keepRootFields&&p&&f.modify({id:"ROOT_MUTATION",fields:function(m,g){var w=g.fieldName,b=g.DELETE;return w==="__typename"?m:b}})},include:e.refetchQueries,optimistic:!1,removeOptimistic:e.removeOptimistic,onQueryUpdated:e.onQueryUpdated||null}).forEach(function(f){return l.push(f)}),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=nu(n),a=this.localState.clientQuery(n),o=i&&this.localState.serverQuery(i),s={document:n,hasClientExports:Jc(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 vs(this),n=new gs({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):Yc(o)?i.set(t.transform(o).document,!1):ce(o)&&o.query&&a.add(o)}),this.queries.forEach(function(o,s){var c=o.observableQuery,u=o.document;if(c){if(e==="all"){n.set(s,c);return}var l=c.queryName,f=c.options.fetchPolicy;if(f==="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 gs({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(f){return t.getObservableFromLink(n,c,f).map(function(d){if(i!=="no-cache"&&(bs(d,a)&&t.cache.write({query:n,result:d.data,dataId:"ROOT_SUBSCRIPTION",variables:f}),t.broadcastQueries()),Ai(d))throw new Ar({graphQLErrors:d.errors});return d})};if(this.transform(n).hasClientExports){var l=this.localState.addExportedVariables(n,o,c).then(u);return new re(function(f){var d=null;return l.then(function(p){return d=p.subscribe(f)},f.error),function(){return d&&d.unsubscribe()}})}return u(o)},r.prototype.stopQuery=function(e){this.stopQueryNoBroadcast(e),this.broadcastQueries()},r.prototype.stopQueryNoBroadcast=function(e){this.stopQueryInStoreNoBroadcast(e),this.removeQuery(e)},r.prototype.removeQuery=function(e){this.fetchCancelFns.delete(e),this.queries.has(e)&&(this.getQuery(e).stop(),this.queries.delete(e))},r.prototype.broadcastQueries=function(){this.onBroadcast&&this.onBroadcast(),this.queries.forEach(function(e){return e.notify()})},r.prototype.getLocalState=function(){return this.localState},r.prototype.getObservableFromLink=function(e,t,n,i){var a=this,o;i===void 0&&(i=(o=t?.queryDeduplication)!==null&&o!==void 0?o:this.queryDeduplication);var s,c=this.transform(e).serverQuery;if(c){var u=this,l=u.inFlightLinkObservables,f=u.link,d={query:c,variables:n,operationName:_i(c)||void 0,context:this.prepareContext(E(E({},t),{forceFetch:!i}))};if(t=d.context,i){var p=l.get(c)||new Map;l.set(c,p);var h=kt(n);if(s=p.get(h),!s){var m=new ki([Ii(f,d)]);p.set(h,s=m),m.beforeNext(function(){p.delete(h)&&p.size<1&&l.delete(c)})}}else s=new ki([Ii(f,d)])}else s=new ki([re.of({data:{}})]),t=this.prepareContext(t);var g=this.transform(e).clientQuery;return g&&(s=Ko(s,function(w){return a.localState.runResolvers({document:g,remoteResult:w,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 Ko(this.getObservableFromLink(a,n.context,n.variables),function(o){var s=Yo(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:he.ready};return c&&n.errorPolicy!=="ignore"&&(u.errors=s,u.networkStatus=he.error),u},function(o){var s=df(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=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,f=t.errorPolicy,d=f===void 0?c&&c.errorPolicy||"none":f,p=t.returnPartialData,h=p===void 0?!1:p,m=t.notifyOnNetworkStatusChange,g=m===void 0?!1:m,w=t.context,b=w===void 0?{}:w,v=Object.assign({},t,{query:a,variables:o,fetchPolicy:l,errorPolicy:d,returnPartialData:h,notifyOnNetworkStatusChange:g,context:b}),y=function(A){v.variables=A;var R=i.fetchQueryByPolicy(s,v,n);return v.fetchPolicy!=="standby"&&R.length>0&&s.observableQuery&&s.observableQuery.applyNextFetchPolicy("after-fetch",t),R},I=function(){return i.fetchCancelFns.delete(e)};this.fetchCancelFns.set(e,function(A){I(),setTimeout(function(){return $.cancel(A)})});var $=new ki(this.transform(v.query).hasClientExports?this.localState.addExportedVariables(v.query,v.variables,v.context).then(y):y(v.variables));return $.promise.then(I,I),$},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(d,p){l.set(p,{oq:d,lastDiff:t.getQuery(p).getDiff()})});var f=new Map;return n&&this.cache.batch({update:n,optimistic:o&&c||!1,removeOptimistic:c,onWatchUpdated:function(d,p,h){var m=d.watcher instanceof vs&&d.watcher.observableQuery;if(m){if(u){l.delete(m.queryId);var g=u(m,p,h);return g===!0&&(g=m.refetch()),g!==!1&&f.set(m,g),g}u!==null&&l.set(m.queryId,{oq:m,lastDiff:h,diff:p})}}}),l.size&&l.forEach(function(d,p){var h=d.oq,m=d.lastDiff,g=d.diff,w;if(u){if(!g){var b=h.queryInfo;b.reset(),g=b.getDiff()}w=u(h,g,m)}(!u||w===!0)&&(w=h.refetch()),w!==!1&&f.set(h,w),p.indexOf("legacyOneTimeQuery")>=0&&t.stopQueryNoBroadcast(p)}),c&&this.cache.removeOptimistic(c),f},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,f=t.context,d=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(y,I){I===void 0&&(I=e.networkStatus||he.loading);var $=y.result;__DEV__&&!l&&!xe($,{})&&Hu(y.missing);var A=function(R){return re.of(E({data:R,loading:Hr(I),networkStatus:I},y.complete?null:{partial:!0}))};return $&&i.transform(a).hasForcedResolvers?i.localState.runResolvers({document:a,remoteResult:{data:$},context:f,variables:o,onlyRunForcedResolvers:!0}).then(function(R){return A(R.data||void 0)}):u==="none"&&I===he.refetch&&Array.isArray(y.missing)?A(void 0):A($)},g=s==="no-cache"?0:n===he.refetch&&c!=="merge"?1:2,w=function(){return i.getResultsFromLink(e,g,{variables:o,context:f,fetchPolicy:s,errorPolicy:u})},b=d&&typeof p=="number"&&p!==n&&Hr(n);switch(s){default:case"cache-first":{var v=h();return v.complete?[m(v,e.markReady())]:l||b?[m(v),w()]:[w()]}case"cache-and-network":{var v=h();return v.complete||l||b?[m(v),w()]:[w()]}case"cache-only":return[m(h(),e.markReady())];case"network-only":return b?[m(h()),w()]:[w()];case"no-cache":return b?[m(e.getDiff()),w()]:[w()];case"standby":return[]}},r.prototype.getQuery=function(e){return e&&!this.queries.has(e)&&this.queries.set(e,new vs(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 mf=!1;var Ku=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,f=e.connectToDevTools,d=f===void 0?typeof window=="object"&&!window.__APOLLO_CLIENT__&&__DEV__:f,p=e.queryDeduplication,h=p===void 0?!0:p,m=e.defaultOptions,g=e.assumeImmutableResults,w=g===void 0?!1:g,b=e.resolvers,v=e.typeDefs,y=e.fragmentMatcher,I=e.name,$=e.version,A=e.link;if(A||(A=n?new Eu({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=A,this.cache=o,this.disableNetworkFetches=c||l>0,this.queryDeduplication=h,this.defaultOptions=m||Object.create(null),this.typeDefs=v,l&&setTimeout(function(){return t.disableNetworkFetches=!1},l),this.watchQuery=this.watchQuery.bind(this),this.query=this.query.bind(this),this.mutate=this.mutate.bind(this),this.resetStore=this.resetStore.bind(this),this.reFetchObservableQueries=this.reFetchObservableQueries.bind(this),d&&typeof window=="object"&&(window.__APOLLO_CLIENT__=this),!mf&&d&&__DEV__&&(mf=!0,typeof window<"u"&&window.document&&window.top===window.self&&!window.__APOLLO_DEVTOOLS_GLOBAL_HOOK__)){var R=window.navigator,P=R&&R.userAgent,D=void 0;typeof P=="string"&&(P.indexOf("Chrome/")>-1?D="https://chrome.google.com/webstore/detail/apollo-client-developer-t/jdkknkkbebbapilgoeccciglkfbmbnfm":P.indexOf("Firefox/")>-1&&(D="https://addons.mozilla.org/en-US/firefox/addon/apollo-developer-tools/")),D&&__DEV__&&L.log("Download the Apollo DevTools for a better development experience: "+D)}this.version=ed,this.localState=new ys({cache:o,client:this,resolvers:b,fragmentMatcher:y}),this.queryManager=new hf({cache:this.cache,link:this.link,defaultOptions:this.defaultOptions,queryDeduplication:h,ssrMode:c,clientAwareness:{name:I,version:$},localState:this.localState,assumeImmutableResults:w,onBroadcast:d?function(){t.devToolsHookCb&&t.devToolsHookCb({action:{},state:{queries:t.queryManager.getQueryStore(),mutations:t.queryManager.mutationStore||{}},dataWithOptimisticResults:t.cache.extract(!0)})}:void 0})}return r.prototype.stop=function(){this.queryManager.stop()},r.prototype.watchQuery=function(e){return this.defaultOptions.watchQuery&&(e=Aa(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=Aa(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=Aa(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}();Ap(bn?"log":"silent");function ct(r){return r===null?"null":Array.isArray(r)?"array":typeof r}function Ir(r){return ct(r)==="object"}function gf(r){return Array.isArray(r)&&r.length>0&&r.every(e=>"message"in e)}function Ju(r,e){return r.length<124?r:e}var yf="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 De;(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"})(De||(De={}));function vf(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 De.ConnectionInit:case De.ConnectionAck:case De.Ping:case De.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 De.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 De.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 De.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(!gf(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 De.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 bf(r,e){return vf(typeof r=="string"?JSON.parse(r,e):r)}function Ri(r,e){return vf(r),JSON.stringify(r,e)}function Zu(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 oe=0;oe<be;oe++)we*=2;await new Promise(oe=>setTimeout(oe,we+Math.floor(Math.random()*(3e3-300)+300)))},shouldRetry:f=ws,isFatalConnectionProblem:d,on:p,webSocketImpl:h,generateID:m=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:w}=r,b;if(h){if(!iv(h))throw new Error("Invalid WebSocket implementation provided");b=h}else typeof WebSocket<"u"?b=WebSocket:typeof global<"u"?b=global.WebSocket||global.MozWebSocket:typeof window<"u"&&(b=window.WebSocket||window.MozWebSocket);if(!b)throw new Error("WebSocket implementation missing; on Node you can `import WebSocket from 'ws';` and pass `webSocketImpl: WebSocket` to `createClient`");let v=b,y=(()=>{let W=(()=>{let we={};return{on(oe,se){return we[oe]=se,()=>{delete we[oe]}},emit(oe){var se;"id"in oe&&((se=we[oe.id])===null||se===void 0||se.call(we,oe))}}})(),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?[W.emit,p.message]:[W.emit],closed:p?.closed?[p.closed]:[],error:p?.error?[p.error]:[]};return{onMessage:W.on,on(we,oe){let se=be[we];return se.push(oe),()=>{se.splice(se.indexOf(oe),1)}},emit(we,...oe){for(let se of[...be[we]])se(...oe)}}})();function I(W){let be=[y.on("error",we=>{be.forEach(oe=>oe()),W(we)}),y.on("closed",we=>{be.forEach(oe=>oe()),W(we)})]}let $,A=0,R,P=!1,D=0,k=!1;async function Te(){clearTimeout(R);let[W,be]=await($??($=new Promise((se,rr)=>(async()=>{if(P){if(await l(D),!A)return $=void 0,rr({code:1e3,reason:"All Subscriptions Gone"});D++}y.emit("connecting");let te=new v(typeof e=="function"?await e():e,yf),nr,Fr;function Fo(){isFinite(o)&&o>0&&(clearTimeout(Fr),Fr=setTimeout(()=>{te.readyState===v.OPEN&&(te.send(Ri({type:De.Ping})),y.emit("ping",!1,void 0))},o))}I(Je=>{$=void 0,clearTimeout(nr),clearTimeout(Fr),rr(Je),ws(Je)&&Je.code===4499&&(te.close(4499,"Terminated"),te.onerror=null,te.onclose=null)}),te.onerror=Je=>y.emit("error",Je),te.onclose=Je=>y.emit("closed",Je),te.onopen=async()=>{try{y.emit("opened",te);let Je=typeof t=="function"?await t():t;if(te.readyState!==v.OPEN)return;te.send(Ri(Je?{type:De.ConnectionInit,payload:Je}:{type:De.ConnectionInit},g)),isFinite(c)&&c>0&&(nr=setTimeout(()=>{te.close(yt.ConnectionAcknowledgementTimeout,"Connection acknowledgement timeout")},c)),Fo()}catch(Je){y.emit("error",Je),te.close(yt.InternalClientError,Ju(Je instanceof Error?Je.message:new Error(Je).message,"Internal client error"))}};let vi=!1;te.onmessage=({data:Je})=>{try{let Ze=bf(Je,w);if(y.emit("message",Ze),Ze.type==="ping"||Ze.type==="pong"){y.emit(Ze.type,!0,Ze.payload),Ze.type==="pong"?Fo():s||(te.send(Ri(Ze.payload?{type:De.Pong,payload:Ze.payload}:{type:De.Pong})),y.emit("pong",!1,Ze.payload));return}if(vi)return;if(Ze.type!==De.ConnectionAck)throw new Error(`First message cannot be of type ${Ze.type}`);clearTimeout(nr),vi=!0,y.emit("connected",te,Ze.payload),P=!1,D=0,se([te,new Promise((jS,cg)=>I(cg))])}catch(Ze){te.onmessage=null,y.emit("error",Ze),te.close(yt.BadResponse,Ju(Ze instanceof Error?Ze.message:new Error(Ze).message,"Bad response"))}}})())));W.readyState===v.CLOSING&&await be;let we=()=>{},oe=new Promise(se=>we=se);return[W,we,Promise.race([oe.then(()=>{if(!A){let se=()=>W.close(1e3,"Normal Closure");isFinite(a)&&a>0?R=setTimeout(()=>{W.readyState===v.OPEN&&se()},a):se()}}),be])]}function Ue(W){if(ws(W)&&(nv(W.code)||[yt.InternalServerError,yt.InternalClientError,yt.BadRequest,yt.BadResponse,yt.Unauthorized,yt.SubprotocolNotAcceptable,yt.SubscriberAlreadyExists,yt.TooManyInitialisationRequests].includes(W.code)))throw W;if(k)return!1;if(ws(W)&&W.code===1e3)return A>0;if(!u||D>=u||!f(W)||d?.(W))throw W;return P=!0}return n||(async()=>{for(A++;;)try{let[,,W]=await Te();await W}catch(W){try{if(!Ue(W))return}catch(be){return i?.(be)}}})(),{on:y.on,subscribe(W,be){let we=m(W),oe=!1,se=!1,rr=()=>{A--,oe=!0};return(async()=>{for(A++;;)try{let[te,nr,Fr]=await Te();if(oe)return nr();let Fo=y.onMessage(we,vi=>{switch(vi.type){case De.Next:{be.next(vi.payload);return}case De.Error:{se=!0,oe=!0,be.error(vi.payload),rr();return}case De.Complete:{oe=!0,rr();return}}});te.send(Ri({id:we,type:De.Subscribe,payload:W},g)),rr=()=>{!oe&&te.readyState===v.OPEN&&te.send(Ri({id:we,type:De.Complete},g)),A--,oe=!0,nr()},await Fr.finally(Fo);return}catch(te){if(!Ue(te))return}})().then(()=>{se||be.complete()}).catch(te=>{be.error(te)}),()=>{oe||rr()}},async dispose(){if(k=!0,$){let[W]=await $;W.close(1e3,"Normal Closure")}},terminate(){$&&y.emit("closed",{code:4499,reason:"Terminated",wasClean:!1})}}}function ws(r){return Ir(r)&&"code"in r&&"reason"in r}function nv(r){return[1e3,1001,1006,1005,1012,1013,1013].includes(r)?!1:r>=1e3&&r<=1999}function iv(r){return typeof r=="function"&&"constructor"in r&&"CLOSED"in r&&"CLOSING"in r&&"CONNECTING"in r&&"OPEN"in r}function av(r){return ce(r)&&"code"in r&&"reason"in r}var wf=function(r){Ne(e,r);function e(t){var n=r.call(this)||this;return n.client=t,n}return e.prototype.request=function(t){var n=this;return new re(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):av(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}(Mt);var Ss="0.12.0-rc1-dev.2";function _s(){return typeof window!="undefined"&&window.self!==window.top}function Yu(){try{localStorage.setItem("test",""),localStorage.removeItem("test")}catch(r){return!1}return!0}function At(r,e){Yu()&&localStorage.setItem(`${Ss}/${r}`,e)}function Es(r){return Yu()?localStorage.getItem(`${Ss}/${r}`):null}function Ra(r){Yu()&&localStorage.removeItem(`${Ss}/${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 ec=function(){return ec=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},ec.apply(this,arguments)};typeof SuppressedError=="function"&&SuppressedError;function Fs(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?Fs=function(t){return typeof t}:Fs=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},Fs(r)}function sv(r){return Fs(r)=="object"&&r!==null}var qh=typeof Symbol=="function"&&Symbol.toStringTag!=null?Symbol.toStringTag:"@@toStringTag";function vl(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 cv(r){return Bh(r.source,vl(r.source,r.start))}function Bh(r,e){var t=r.locationOffset.column-1,n=Ms(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),f=l[i];if(f.length>120){for(var d=Math.floor(c/80),p=c%80,h=[],m=0;m<f.length;m+=80)h.push(f.slice(m,m+80));return u+Sf([["".concat(o),h[0]]].concat(h.slice(1,d+1).map(function(g){return["",g]}),[[" ",Ms(p-1)+"^"],["",h[d+1]]]))}return u+Sf([["".concat(o-1),l[i-1]],["".concat(o),f],["",Ms(c-1)+"^"],["".concat(o+1),l[i+1]]])}function Sf(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 uv(t,i)+(a?" | "+a:" |")}).join(`
|
|
53
|
+
`)}function Ms(r){return Array(r+1).join(" ")}function uv(r,e){return Ms(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 _f(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 lv(r){for(var e=1;e<arguments.length;e++){var t=arguments[e]!=null?arguments[e]:{};e%2?_f(Object(t),!0).forEach(function(n){pv(r,n,t[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(t)):_f(Object(t)).forEach(function(n){Object.defineProperty(r,n,Object.getOwnPropertyDescriptor(t,n))})}return r}function pv(r,e,t){return e in r?Object.defineProperty(r,e,{value:t,enumerable:!0,configurable:!0,writable:!0}):r[e]=t,r}function dv(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Ef(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 fv(r,e,t){return e&&Ef(r.prototype,e),t&&Ef(r,t),r}function hv(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&&co(r,e)}function mv(r){var e=Qh();return function(){var n=uo(r),i;if(e){var a=uo(this).constructor;i=Reflect.construct(n,arguments,a)}else i=n.apply(this,arguments);return Vh(this,i)}}function Vh(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 bl(r){var e=typeof Map=="function"?new Map:void 0;return bl=function(n){if(n===null||!gv(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 js(n,arguments,uo(this).constructor)}return i.prototype=Object.create(n.prototype,{constructor:{value:i,enumerable:!1,writable:!0,configurable:!0}}),co(i,n)},bl(r)}function js(r,e,t){return Qh()?js=Reflect.construct:js=function(i,a,o){var s=[null];s.push.apply(s,a);var c=Function.bind.apply(i,s),u=new c;return o&&co(u,o.prototype),u},js.apply(null,arguments)}function Qh(){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 gv(r){return Function.toString.call(r).indexOf("[native code]")!==-1}function co(r,e){return co=Object.setPrototypeOf||function(n,i){return n.__proto__=i,n},co(r,e)}function uo(r){return uo=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)},uo(r)}var yv=function(r){hv(t,r);var e=mv(t);function t(n,i,a,o,s,c,u){var l,f,d,p;dv(this,t),p=e.call(this,n),p.name="GraphQLError",p.originalError=c??void 0,p.nodes=xf(Array.isArray(i)?i:i?[i]:void 0);for(var h=[],m=0,g=(w=p.nodes)!==null&&w!==void 0?w:[];m<g.length;m++){var w,b=g[m],v=b.loc;v!=null&&h.push(v)}h=xf(h),p.source=a??((l=h)===null||l===void 0?void 0:l[0].source),p.positions=o??((f=h)===null||f===void 0?void 0:f.map(function(I){return I.start})),p.locations=o&&a?o.map(function(I){return vl(a,I)}):(d=h)===null||d===void 0?void 0:d.map(function(I){return vl(I.source,I.start)}),p.path=s??void 0;var y=c?.extensions;return u==null&&sv(y)?p.extensions=lv({},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}),Vh(p)):(Error.captureStackTrace?Error.captureStackTrace(Ua(p),t):Object.defineProperty(Ua(p),"stack",{value:Error().stack,writable:!0,configurable:!0}),p)}return fv(t,[{key:"toString",value:function(){return vv(this)}},{key:qh,get:function(){return"Object"}}]),t}(bl(Error));function xf(r){return r===void 0||r.length===0?void 0:r}function vv(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
|
-
`+
|
|
55
|
+
`+cv(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
|
-
`+
|
|
58
|
-
`)}function Af(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function Dv(r){for(var e,t=!0,
|
|
59
|
-
`;break;case 114:u+="\r";break;case 116:u+=" ";break;case 117:{var l=qv(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var f=a.slice(o+1,o+5);throw Ct(r,o,"Invalid character escape sequence: \\u".concat(f,"."))}u+=String.fromCharCode(l),o+=4;break}default:throw Ct(r,o,"Invalid character escape sequence: \\".concat(String.fromCharCode(c),"."))}++o,s=o}}throw Ct(r,o,"Unterminated string.")}function jv(r,e,t,i,n,a){for(var o=r.body,s=e+3,c=s,u=0,l="";s<o.length&&!isNaN(u=o.charCodeAt(s));){if(u===34&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34)return l+=o.slice(c,s),new Ue(C.BLOCK_STRING,e,s+3,t,i,n,Nv(l));if(u<32&&u!==9&&u!==10&&u!==13)throw Ct(r,s,"Invalid character within String: ".concat(Qi(u),"."));u===10?(++s,++a.line,a.lineStart=s):u===13?(o.charCodeAt(s+1)===10?s+=2:++s,++a.line,a.lineStart=s):u===92&&o.charCodeAt(s+1)===34&&o.charCodeAt(s+2)===34&&o.charCodeAt(s+3)===34?(l+=o.slice(c,s)+'"""',s+=4,c=s):++s}throw Ct(r,s,"Unterminated string.")}function qv(r,e,t,i){return Es(r)<<12|Es(e)<<8|Es(t)<<4|Es(i)}function Es(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function Bv(r,e,t,i,n){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Ue(C.NAME,e,s,t,i,n,a.slice(e,s))}function Vv(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function Qv(r,e){var t=new zv(r,e);return t.parseDocument()}var zv=function(){function r(t,i){var n=Ov(t)?t:new Hh(t);this._lexer=new $v(n),this._options=i}var e=r.prototype;return e.parseName=function(){var i=this.expectToken(C.NAME);return{kind:W.NAME,value:i.value,loc:this.loc(i)}},e.parseDocument=function(){var i=this._lexer.token;return{kind:W.DOCUMENT,definitions:this.many(C.SOF,this.parseDefinition,C.EOF),loc:this.loc(i)}},e.parseDefinition=function(){if(this.peek(C.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(C.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var i=this._lexer.token;if(this.peek(C.BRACE_L))return{kind:W.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(i)};var n=this.parseOperationType(),a;return this.peek(C.NAME)&&(a=this.parseName()),{kind:W.OPERATION_DEFINITION,operation:n,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseOperationType=function(){var i=this.expectToken(C.NAME);switch(i.value){case"query":return"query";case"mutation":return"mutation";case"subscription":return"subscription"}throw this.unexpected(i)},e.parseVariableDefinitions=function(){return this.optionalMany(C.PAREN_L,this.parseVariableDefinition,C.PAREN_R)},e.parseVariableDefinition=function(){var i=this._lexer.token;return{kind:W.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(C.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(C.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(i)}},e.parseVariable=function(){var i=this._lexer.token;return this.expectToken(C.DOLLAR),{kind:W.VARIABLE,name:this.parseName(),loc:this.loc(i)}},e.parseSelectionSet=function(){var i=this._lexer.token;return{kind:W.SELECTION_SET,selections:this.many(C.BRACE_L,this.parseSelection,C.BRACE_R),loc:this.loc(i)}},e.parseSelection=function(){return this.peek(C.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var i=this._lexer.token,n=this.parseName(),a,o;return this.expectOptionalToken(C.COLON)?(a=n,o=this.parseName()):o=n,{kind:W.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(C.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(i)}},e.parseArguments=function(i){var n=i?this.parseConstArgument:this.parseArgument;return this.optionalMany(C.PAREN_L,n,C.PAREN_R)},e.parseArgument=function(){var i=this._lexer.token,n=this.parseName();return this.expectToken(C.COLON),{kind:W.ARGUMENT,name:n,value:this.parseValueLiteral(!1),loc:this.loc(i)}},e.parseConstArgument=function(){var i=this._lexer.token;return{kind:W.ARGUMENT,name:this.parseName(),value:(this.expectToken(C.COLON),this.parseValueLiteral(!0)),loc:this.loc(i)}},e.parseFragment=function(){var i=this._lexer.token;this.expectToken(C.SPREAD);var n=this.expectOptionalKeyword("on");return!n&&this.peek(C.NAME)?{kind:W.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(i)}:{kind:W.INLINE_FRAGMENT,typeCondition:n?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentDefinition=function(){var i,n=this._lexer.token;return this.expectKeyword("fragment"),((i=this._options)===null||i===void 0?void 0:i.experimentalFragmentVariables)===!0?{kind: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(n)}:{kind:W.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(i){var n=this._lexer.token;switch(n.kind){case C.BRACKET_L:return this.parseList(i);case C.BRACE_L:return this.parseObject(i);case C.INT:return this._lexer.advance(),{kind:W.INT,value:n.value,loc:this.loc(n)};case C.FLOAT:return this._lexer.advance(),{kind:W.FLOAT,value:n.value,loc:this.loc(n)};case C.STRING:case C.BLOCK_STRING:return this.parseStringLiteral();case C.NAME:switch(this._lexer.advance(),n.value){case"true":return{kind:W.BOOLEAN,value:!0,loc:this.loc(n)};case"false":return{kind:W.BOOLEAN,value:!1,loc:this.loc(n)};case"null":return{kind:W.NULL,loc:this.loc(n)};default:return{kind:W.ENUM,value:n.value,loc:this.loc(n)}}case C.DOLLAR:if(!i)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var i=this._lexer.token;return this._lexer.advance(),{kind:W.STRING,value:i.value,block:i.kind===C.BLOCK_STRING,loc:this.loc(i)}},e.parseList=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseValueLiteral(i)};return{kind:W.LIST,values:this.any(C.BRACKET_L,o,C.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(i){var n=this,a=this._lexer.token,o=function(){return n.parseObjectField(i)};return{kind:W.OBJECT,fields:this.any(C.BRACE_L,o,C.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(i){var n=this._lexer.token,a=this.parseName();return this.expectToken(C.COLON),{kind:W.OBJECT_FIELD,name:a,value:this.parseValueLiteral(i),loc:this.loc(n)}},e.parseDirectives=function(i){for(var n=[];this.peek(C.AT);)n.push(this.parseDirective(i));return n},e.parseDirective=function(i){var n=this._lexer.token;return this.expectToken(C.AT),{kind:W.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(i),loc:this.loc(n)}},e.parseTypeReference=function(){var i=this._lexer.token,n;return this.expectOptionalToken(C.BRACKET_L)?(n=this.parseTypeReference(),this.expectToken(C.BRACKET_R),n={kind:W.LIST_TYPE,type:n,loc:this.loc(i)}):n=this.parseNamedType(),this.expectOptionalToken(C.BANG)?{kind:W.NON_NULL_TYPE,type:n,loc:this.loc(i)}:n},e.parseNamedType=function(){var i=this._lexer.token;return{kind:W.NAMED_TYPE,name:this.parseName(),loc:this.loc(i)}},e.parseTypeSystemDefinition=function(){var i=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(i.kind===C.NAME)switch(i.value){case"schema":return this.parseSchemaDefinition();case"scalar":return this.parseScalarTypeDefinition();case"type":return this.parseObjectTypeDefinition();case"interface":return this.parseInterfaceTypeDefinition();case"union":return this.parseUnionTypeDefinition();case"enum":return this.parseEnumTypeDefinition();case"input":return this.parseInputObjectTypeDefinition();case"directive":return this.parseDirectiveDefinition()}throw this.unexpected(i)},e.peekDescription=function(){return this.peek(C.STRING)||this.peek(C.BLOCK_STRING)},e.parseDescription=function(){if(this.peekDescription())return this.parseStringLiteral()},e.parseSchemaDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("schema");var a=this.parseDirectives(!0),o=this.many(C.BRACE_L,this.parseOperationTypeDefinition,C.BRACE_R);return{kind:W.SCHEMA_DEFINITION,description:n,directives:a,operationTypes:o,loc:this.loc(i)}},e.parseOperationTypeDefinition=function(){var i=this._lexer.token,n=this.parseOperationType();this.expectToken(C.COLON);var a=this.parseNamedType();return{kind:W.OPERATION_TYPE_DEFINITION,operation:n,type:a,loc:this.loc(i)}},e.parseScalarTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:W.SCALAR_TYPE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:W.OBJECT_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseImplementsInterfaces=function(){var i;if(!this.expectOptionalKeyword("implements"))return[];if(((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLImplementsInterfaces)===!0){var n=[];this.expectOptionalToken(C.AMP);do n.push(this.parseNamedType());while(this.expectOptionalToken(C.AMP)||this.peek(C.NAME));return n}return this.delimitedMany(C.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var i;return((i=this._options)===null||i===void 0?void 0:i.allowLegacySDLEmptyFields)===!0&&this.peek(C.BRACE_L)&&this._lexer.lookahead().kind===C.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(C.BRACE_L,this.parseFieldDefinition,C.BRACE_R)},e.parseFieldDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(C.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:W.FIELD_DEFINITION,description:n,name:a,arguments:o,type:s,directives:c,loc:this.loc(i)}},e.parseArgumentDefs=function(){return this.optionalMany(C.PAREN_L,this.parseInputValueDef,C.PAREN_R)},e.parseInputValueDef=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName();this.expectToken(C.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(C.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:W.INPUT_VALUE_DEFINITION,description:n,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(i)}},e.parseInterfaceTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:W.INTERFACE_TYPE_DEFINITION,description:n,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(i)}},e.parseUnionTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:W.UNION_TYPE_DEFINITION,description:n,name:a,directives:o,types:s,loc:this.loc(i)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(C.EQUALS)?this.delimitedMany(C.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:W.ENUM_TYPE_DEFINITION,description:n,name:a,directives:o,values:s,loc:this.loc(i)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(C.BRACE_L,this.parseEnumValueDefinition,C.BRACE_R)},e.parseEnumValueDefinition=function(){var i=this._lexer.token,n=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:W.ENUM_VALUE_DEFINITION,description:n,name:a,directives:o,loc:this.loc(i)}},e.parseInputObjectTypeDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:W.INPUT_OBJECT_TYPE_DEFINITION,description:n,name:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(C.BRACE_L,this.parseInputValueDef,C.BRACE_R)},e.parseTypeSystemExtension=function(){var i=this._lexer.lookahead();if(i.kind===C.NAME)switch(i.value){case"schema":return this.parseSchemaExtension();case"scalar":return this.parseScalarTypeExtension();case"type":return this.parseObjectTypeExtension();case"interface":return this.parseInterfaceTypeExtension();case"union":return this.parseUnionTypeExtension();case"enum":return this.parseEnumTypeExtension();case"input":return this.parseInputObjectTypeExtension()}throw this.unexpected(i)},e.parseSchemaExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("schema");var n=this.parseDirectives(!0),a=this.optionalMany(C.BRACE_L,this.parseOperationTypeDefinition,C.BRACE_R);if(n.length===0&&a.length===0)throw this.unexpected();return{kind:W.SCHEMA_EXTENSION,directives:n,operationTypes:a,loc:this.loc(i)}},e.parseScalarTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var n=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:W.SCALAR_TYPE_EXTENSION,name:n,directives:a,loc:this.loc(i)}},e.parseObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:W.OBJECT_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseInterfaceTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var n=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:W.INTERFACE_TYPE_EXTENSION,name:n,interfaces:a,directives:o,fields:s,loc:this.loc(i)}},e.parseUnionTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:W.UNION_TYPE_EXTENSION,name:n,directives:a,types:o,loc:this.loc(i)}},e.parseEnumTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:W.ENUM_TYPE_EXTENSION,name:n,directives:a,values:o,loc:this.loc(i)}},e.parseInputObjectTypeExtension=function(){var i=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var n=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:W.INPUT_OBJECT_TYPE_EXTENSION,name:n,directives:a,fields:o,loc:this.loc(i)}},e.parseDirectiveDefinition=function(){var i=this._lexer.token,n=this.parseDescription();this.expectKeyword("directive"),this.expectToken(C.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:W.DIRECTIVE_DEFINITION,description:n,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(i)}},e.parseDirectiveLocations=function(){return this.delimitedMany(C.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var i=this._lexer.token,n=this.parseName();if(Cv[n.value]!==void 0)return n;throw this.unexpected(i)},e.loc=function(i){var n;if(((n=this._options)===null||n===void 0?void 0:n.noLocation)!==!0)return new zh(i,this._lexer.lastToken,this._lexer.source)},e.peek=function(i){return this._lexer.token.kind===i},e.expectToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n;throw Ct(this._lexer.source,n.start,"Expected ".concat(Gh(i),", found ").concat(el(n),"."))},e.expectOptionalToken=function(i){var n=this._lexer.token;if(n.kind===i)return this._lexer.advance(),n},e.expectKeyword=function(i){var n=this._lexer.token;if(n.kind===C.NAME&&n.value===i)this._lexer.advance();else throw Ct(this._lexer.source,n.start,'Expected "'.concat(i,'", found ').concat(el(n),"."))},e.expectOptionalKeyword=function(i){var n=this._lexer.token;return n.kind===C.NAME&&n.value===i?(this._lexer.advance(),!0):!1},e.unexpected=function(i){var n=i??this._lexer.token;return Ct(this._lexer.source,n.start,"Unexpected ".concat(el(n),"."))},e.any=function(i,n,a){this.expectToken(i);for(var o=[];!this.expectOptionalToken(a);)o.push(n.call(this));return o},e.optionalMany=function(i,n,a){if(this.expectOptionalToken(i)){var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o}return[]},e.many=function(i,n,a){this.expectToken(i);var o=[];do o.push(n.call(this));while(!this.expectOptionalToken(a));return o},e.delimitedMany=function(i,n){this.expectOptionalToken(i);var a=[];do a.push(n.call(this));while(this.expectOptionalToken(i));return a},r}();function el(r){var e=r.value;return Gh(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function Gh(r){return Rv(r)?'"'.concat(r,'"'):r}var qs=new Map,wl=new Map,Kh=!0,rc=!1;function Jh(r){return r.replace(/[\s,]+/g," ").trim()}function Wv(r){return Jh(r.source.body.substring(r.start,r.end))}function Hv(r){var e=new Set,t=[];return r.definitions.forEach(function(i){if(i.kind==="FragmentDefinition"){var n=i.name.value,a=Wv(i.loc),o=wl.get(n);o&&!o.has(a)?Kh&&console.warn("Warning: fragment with name "+n+` already exists.
|
|
57
|
+
`+Bh(r.source,s)}return e}function Tt(r,e,t){return new yv("Syntax Error: ".concat(t),void 0,r,[e])}var z=Object.freeze({NAME:"Name",DOCUMENT:"Document",OPERATION_DEFINITION:"OperationDefinition",VARIABLE_DEFINITION:"VariableDefinition",SELECTION_SET:"SelectionSet",FIELD:"Field",ARGUMENT:"Argument",FRAGMENT_SPREAD:"FragmentSpread",INLINE_FRAGMENT:"InlineFragment",FRAGMENT_DEFINITION:"FragmentDefinition",VARIABLE:"Variable",INT:"IntValue",FLOAT:"FloatValue",STRING:"StringValue",BOOLEAN:"BooleanValue",NULL:"NullValue",ENUM:"EnumValue",LIST:"ListValue",OBJECT:"ObjectValue",OBJECT_FIELD:"ObjectField",DIRECTIVE:"Directive",NAMED_TYPE:"NamedType",LIST_TYPE:"ListType",NON_NULL_TYPE:"NonNullType",SCHEMA_DEFINITION:"SchemaDefinition",OPERATION_TYPE_DEFINITION:"OperationTypeDefinition",SCALAR_TYPE_DEFINITION:"ScalarTypeDefinition",OBJECT_TYPE_DEFINITION:"ObjectTypeDefinition",FIELD_DEFINITION:"FieldDefinition",INPUT_VALUE_DEFINITION:"InputValueDefinition",INTERFACE_TYPE_DEFINITION:"InterfaceTypeDefinition",UNION_TYPE_DEFINITION:"UnionTypeDefinition",ENUM_TYPE_DEFINITION:"EnumTypeDefinition",ENUM_VALUE_DEFINITION:"EnumValueDefinition",INPUT_OBJECT_TYPE_DEFINITION:"InputObjectTypeDefinition",DIRECTIVE_DEFINITION:"DirectiveDefinition",SCHEMA_EXTENSION:"SchemaExtension",SCALAR_TYPE_EXTENSION:"ScalarTypeExtension",OBJECT_TYPE_EXTENSION:"ObjectTypeExtension",INTERFACE_TYPE_EXTENSION:"InterfaceTypeExtension",UNION_TYPE_EXTENSION:"UnionTypeExtension",ENUM_TYPE_EXTENSION:"EnumTypeExtension",INPUT_OBJECT_TYPE_EXTENSION:"InputObjectTypeExtension"});function bv(r,e){var t=Boolean(r);if(!t)throw new Error(e??"Unexpected invariant triggered.")}var wv=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):void 0,wl=wv;function zh(r){var e=r.prototype.toJSON;typeof e=="function"||bv(0),r.prototype.inspect=e,wl&&(r.prototype[wl]=e)}var Wh=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}();zh(Wh);var Pe=function(){function r(t,n,i,a,o,s,c){this.kind=t,this.start=n,this.end=i,this.line=a,this.column=o,this.value=c,this.prev=s,this.next=null}var e=r.prototype;return e.toJSON=function(){return{kind:this.kind,value:this.value,line:this.line,column:this.column}},r}();zh(Pe);var C=Object.freeze({SOF:"<SOF>",EOF:"<EOF>",BANG:"!",DOLLAR:"$",AMP:"&",PAREN_L:"(",PAREN_R:")",SPREAD:"...",COLON:":",EQUALS:"=",AT:"@",BRACKET_L:"[",BRACKET_R:"]",BRACE_L:"{",PIPE:"|",BRACE_R:"}",NAME:"Name",INT:"Int",FLOAT:"Float",STRING:"String",BLOCK_STRING:"BlockString",COMMENT:"Comment"});function qs(r){return typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?qs=function(t){return typeof t}:qs=function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},qs(r)}var Sv=10,Hh=2;function _v(r){return xc(r,[])}function xc(r,e){switch(qs(r)){case"string":return JSON.stringify(r);case"function":return r.name?"[function ".concat(r.name,"]"):"[function]";case"object":return r===null?"null":Ev(r,e);default:return String(r)}}function Ev(r,e){if(e.indexOf(r)!==-1)return"[Circular]";var t=[].concat(e,[r]),n=Av(r);if(n!==void 0){var i=n.call(r);if(i!==r)return typeof i=="string"?i:xc(i,t)}else if(Array.isArray(r))return kv(r,t);return xv(r,t)}function xv(r,e){var t=Object.keys(r);if(t.length===0)return"{}";if(e.length>Hh)return"["+Iv(r)+"]";var n=t.map(function(i){var a=xc(r[i],e);return i+": "+a});return"{ "+n.join(", ")+" }"}function kv(r,e){if(r.length===0)return"[]";if(e.length>Hh)return"[Array]";for(var t=Math.min(Sv,r.length),n=r.length-t,i=[],a=0;a<t;++a)i.push(xc(r[a],e));return n===1?i.push("... 1 more item"):n>1&&i.push("... ".concat(n," more items")),"["+i.join(", ")+"]"}function Av(r){var e=r[String(wl)];if(typeof e=="function")return e;if(typeof r.inspect=="function")return r.inspect}function Iv(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 Xu(r,e){var t=Boolean(r);if(!t)throw new Error(e)}var Tv=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 Ov(r,e,t){return e&&kf(r.prototype,e),t&&kf(r,t),r}var Gh=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"||Xu(0,"Body must be a string. Received: ".concat(_v(e),".")),this.body=e,this.name=t,this.locationOffset=n,this.locationOffset.line>0||Xu(0,"line in locationOffset is 1-indexed and must be positive."),this.locationOffset.column>0||Xu(0,"column in locationOffset is 1-indexed and must be positive.")}return Ov(r,[{key:qh,get:function(){return"Source"}}]),r}();function Cv(r){return Tv(r,Gh)}var Nv=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 $v(r){var e=r.split(/\r\n|[\n\r]/g),t=Dv(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&&Af(e[i]);)++i;for(var a=e.length;a>i&&Af(e[a-1]);)--a;return e.slice(i,a).join(`
|
|
58
|
+
`)}function Af(r){for(var e=0;e<r.length;++e)if(r[e]!==" "&&r[e]!==" ")return!1;return!0}function Dv(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 Rv=function(){function r(t){var n=new Pe(C.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!==C.EOF)do{var i;n=(i=n.next)!==null&&i!==void 0?i:n.next=Pv(this,n)}while(n.kind===C.COMMENT);return n},r}();function Lv(r){return r===C.BANG||r===C.DOLLAR||r===C.AMP||r===C.PAREN_L||r===C.PAREN_R||r===C.SPREAD||r===C.COLON||r===C.EQUALS||r===C.AT||r===C.BRACKET_L||r===C.BRACKET_R||r===C.BRACE_L||r===C.PIPE||r===C.BRACE_R}function Wn(r){return isNaN(r)?C.EOF:r<127?JSON.stringify(String.fromCharCode(r)):'"\\u'.concat(("00"+r.toString(16).toUpperCase()).slice(-4),'"')}function Pv(r,e){for(var t=r.source,n=t.body,i=n.length,a=e.end;a<i;){var o=n.charCodeAt(a),s=r.line,c=1+a-r.lineStart;switch(o){case 65279:case 9:case 32:case 44:++a;continue;case 10:++a,++r.line,r.lineStart=a;continue;case 13:n.charCodeAt(a+1)===10?a+=2:++a,++r.line,r.lineStart=a;continue;case 33:return new Pe(C.BANG,a,a+1,s,c,e);case 35:return Mv(t,a,s,c,e);case 36:return new Pe(C.DOLLAR,a,a+1,s,c,e);case 38:return new Pe(C.AMP,a,a+1,s,c,e);case 40:return new Pe(C.PAREN_L,a,a+1,s,c,e);case 41:return new Pe(C.PAREN_R,a,a+1,s,c,e);case 46:if(n.charCodeAt(a+1)===46&&n.charCodeAt(a+2)===46)return new Pe(C.SPREAD,a,a+3,s,c,e);break;case 58:return new Pe(C.COLON,a,a+1,s,c,e);case 61:return new Pe(C.EQUALS,a,a+1,s,c,e);case 64:return new Pe(C.AT,a,a+1,s,c,e);case 91:return new Pe(C.BRACKET_L,a,a+1,s,c,e);case 93:return new Pe(C.BRACKET_R,a,a+1,s,c,e);case 123:return new Pe(C.BRACE_L,a,a+1,s,c,e);case 124:return new Pe(C.PIPE,a,a+1,s,c,e);case 125:return new Pe(C.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):jv(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 Uv(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 Vv(t,a,s,c,e)}throw Tt(t,a,Fv(o))}var u=r.line,l=1+a-r.lineStart;return new Pe(C.EOF,i,i,u,l,e)}function Fv(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 Mv(r,e,t,n,i){var a=r.body,o,s=e;do o=a.charCodeAt(++s);while(!isNaN(o)&&(o>31||o===9));return new Pe(C.COMMENT,e,s,t,n,i,a.slice(e+1,s))}function Uv(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=el(r,c,s),s=o.charCodeAt(c);if(s===46&&(u=!0,s=o.charCodeAt(++c),c=el(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=el(r,c,s),s=o.charCodeAt(c)),s===46||Qv(s))throw Tt(r,c,"Invalid number, expected digit but got: ".concat(Wn(s),"."));return new Pe(u?C.FLOAT:C.INT,e,c,n,i,a,o.slice(e,c))}function el(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 jv(r,e,t,n,i){for(var a=r.body,o=e+1,s=o,c=0,u="";o<a.length&&!isNaN(c=a.charCodeAt(o))&&c!==10&&c!==13;){if(c===34)return u+=a.slice(s,o),new Pe(C.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=Bv(a.charCodeAt(o+1),a.charCodeAt(o+2),a.charCodeAt(o+3),a.charCodeAt(o+4));if(l<0){var f=a.slice(o+1,o+5);throw Tt(r,o,"Invalid character escape sequence: \\u".concat(f,"."))}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 Pe(C.BLOCK_STRING,e,s+3,t,n,i,$v(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 Bv(r,e,t,n){return xs(r)<<12|xs(e)<<8|xs(t)<<4|xs(n)}function xs(r){return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:-1}function Vv(r,e,t,n,i){for(var a=r.body,o=a.length,s=e+1,c=0;s!==o&&!isNaN(c=a.charCodeAt(s))&&(c===95||c>=48&&c<=57||c>=65&&c<=90||c>=97&&c<=122);)++s;return new Pe(C.NAME,e,s,t,n,i,a.slice(e,s))}function Qv(r){return r===95||r>=65&&r<=90||r>=97&&r<=122}function zv(r,e){var t=new Wv(r,e);return t.parseDocument()}var Wv=function(){function r(t,n){var i=Cv(t)?t:new Gh(t);this._lexer=new Rv(i),this._options=n}var e=r.prototype;return e.parseName=function(){var n=this.expectToken(C.NAME);return{kind:z.NAME,value:n.value,loc:this.loc(n)}},e.parseDocument=function(){var n=this._lexer.token;return{kind:z.DOCUMENT,definitions:this.many(C.SOF,this.parseDefinition,C.EOF),loc:this.loc(n)}},e.parseDefinition=function(){if(this.peek(C.NAME))switch(this._lexer.token.value){case"query":case"mutation":case"subscription":return this.parseOperationDefinition();case"fragment":return this.parseFragmentDefinition();case"schema":case"scalar":case"type":case"interface":case"union":case"enum":case"input":case"directive":return this.parseTypeSystemDefinition();case"extend":return this.parseTypeSystemExtension()}else{if(this.peek(C.BRACE_L))return this.parseOperationDefinition();if(this.peekDescription())return this.parseTypeSystemDefinition()}throw this.unexpected()},e.parseOperationDefinition=function(){var n=this._lexer.token;if(this.peek(C.BRACE_L))return{kind:z.OPERATION_DEFINITION,operation:"query",name:void 0,variableDefinitions:[],directives:[],selectionSet:this.parseSelectionSet(),loc:this.loc(n)};var i=this.parseOperationType(),a;return this.peek(C.NAME)&&(a=this.parseName()),{kind:z.OPERATION_DEFINITION,operation:i,name:a,variableDefinitions:this.parseVariableDefinitions(),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseOperationType=function(){var n=this.expectToken(C.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(C.PAREN_L,this.parseVariableDefinition,C.PAREN_R)},e.parseVariableDefinition=function(){var n=this._lexer.token;return{kind:z.VARIABLE_DEFINITION,variable:this.parseVariable(),type:(this.expectToken(C.COLON),this.parseTypeReference()),defaultValue:this.expectOptionalToken(C.EQUALS)?this.parseValueLiteral(!0):void 0,directives:this.parseDirectives(!0),loc:this.loc(n)}},e.parseVariable=function(){var n=this._lexer.token;return this.expectToken(C.DOLLAR),{kind:z.VARIABLE,name:this.parseName(),loc:this.loc(n)}},e.parseSelectionSet=function(){var n=this._lexer.token;return{kind:z.SELECTION_SET,selections:this.many(C.BRACE_L,this.parseSelection,C.BRACE_R),loc:this.loc(n)}},e.parseSelection=function(){return this.peek(C.SPREAD)?this.parseFragment():this.parseField()},e.parseField=function(){var n=this._lexer.token,i=this.parseName(),a,o;return this.expectOptionalToken(C.COLON)?(a=i,o=this.parseName()):o=i,{kind:z.FIELD,alias:a,name:o,arguments:this.parseArguments(!1),directives:this.parseDirectives(!1),selectionSet:this.peek(C.BRACE_L)?this.parseSelectionSet():void 0,loc:this.loc(n)}},e.parseArguments=function(n){var i=n?this.parseConstArgument:this.parseArgument;return this.optionalMany(C.PAREN_L,i,C.PAREN_R)},e.parseArgument=function(){var n=this._lexer.token,i=this.parseName();return this.expectToken(C.COLON),{kind:z.ARGUMENT,name:i,value:this.parseValueLiteral(!1),loc:this.loc(n)}},e.parseConstArgument=function(){var n=this._lexer.token;return{kind:z.ARGUMENT,name:this.parseName(),value:(this.expectToken(C.COLON),this.parseValueLiteral(!0)),loc:this.loc(n)}},e.parseFragment=function(){var n=this._lexer.token;this.expectToken(C.SPREAD);var i=this.expectOptionalKeyword("on");return!i&&this.peek(C.NAME)?{kind:z.FRAGMENT_SPREAD,name:this.parseFragmentName(),directives:this.parseDirectives(!1),loc:this.loc(n)}:{kind:z.INLINE_FRAGMENT,typeCondition:i?this.parseNamedType():void 0,directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(n)}},e.parseFragmentDefinition=function(){var n,i=this._lexer.token;return this.expectKeyword("fragment"),((n=this._options)===null||n===void 0?void 0:n.experimentalFragmentVariables)===!0?{kind:z.FRAGMENT_DEFINITION,name:this.parseFragmentName(),variableDefinitions:this.parseVariableDefinitions(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}:{kind:z.FRAGMENT_DEFINITION,name:this.parseFragmentName(),typeCondition:(this.expectKeyword("on"),this.parseNamedType()),directives:this.parseDirectives(!1),selectionSet:this.parseSelectionSet(),loc:this.loc(i)}},e.parseFragmentName=function(){if(this._lexer.token.value==="on")throw this.unexpected();return this.parseName()},e.parseValueLiteral=function(n){var i=this._lexer.token;switch(i.kind){case C.BRACKET_L:return this.parseList(n);case C.BRACE_L:return this.parseObject(n);case C.INT:return this._lexer.advance(),{kind:z.INT,value:i.value,loc:this.loc(i)};case C.FLOAT:return this._lexer.advance(),{kind:z.FLOAT,value:i.value,loc:this.loc(i)};case C.STRING:case C.BLOCK_STRING:return this.parseStringLiteral();case C.NAME:switch(this._lexer.advance(),i.value){case"true":return{kind:z.BOOLEAN,value:!0,loc:this.loc(i)};case"false":return{kind:z.BOOLEAN,value:!1,loc:this.loc(i)};case"null":return{kind:z.NULL,loc:this.loc(i)};default:return{kind:z.ENUM,value:i.value,loc:this.loc(i)}}case C.DOLLAR:if(!n)return this.parseVariable();break}throw this.unexpected()},e.parseStringLiteral=function(){var n=this._lexer.token;return this._lexer.advance(),{kind:z.STRING,value:n.value,block:n.kind===C.BLOCK_STRING,loc:this.loc(n)}},e.parseList=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseValueLiteral(n)};return{kind:z.LIST,values:this.any(C.BRACKET_L,o,C.BRACKET_R),loc:this.loc(a)}},e.parseObject=function(n){var i=this,a=this._lexer.token,o=function(){return i.parseObjectField(n)};return{kind:z.OBJECT,fields:this.any(C.BRACE_L,o,C.BRACE_R),loc:this.loc(a)}},e.parseObjectField=function(n){var i=this._lexer.token,a=this.parseName();return this.expectToken(C.COLON),{kind:z.OBJECT_FIELD,name:a,value:this.parseValueLiteral(n),loc:this.loc(i)}},e.parseDirectives=function(n){for(var i=[];this.peek(C.AT);)i.push(this.parseDirective(n));return i},e.parseDirective=function(n){var i=this._lexer.token;return this.expectToken(C.AT),{kind:z.DIRECTIVE,name:this.parseName(),arguments:this.parseArguments(n),loc:this.loc(i)}},e.parseTypeReference=function(){var n=this._lexer.token,i;return this.expectOptionalToken(C.BRACKET_L)?(i=this.parseTypeReference(),this.expectToken(C.BRACKET_R),i={kind:z.LIST_TYPE,type:i,loc:this.loc(n)}):i=this.parseNamedType(),this.expectOptionalToken(C.BANG)?{kind:z.NON_NULL_TYPE,type:i,loc:this.loc(n)}:i},e.parseNamedType=function(){var n=this._lexer.token;return{kind:z.NAMED_TYPE,name:this.parseName(),loc:this.loc(n)}},e.parseTypeSystemDefinition=function(){var n=this.peekDescription()?this._lexer.lookahead():this._lexer.token;if(n.kind===C.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(C.STRING)||this.peek(C.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(C.BRACE_L,this.parseOperationTypeDefinition,C.BRACE_R);return{kind:z.SCHEMA_DEFINITION,description:i,directives:a,operationTypes:o,loc:this.loc(n)}},e.parseOperationTypeDefinition=function(){var n=this._lexer.token,i=this.parseOperationType();this.expectToken(C.COLON);var a=this.parseNamedType();return{kind:z.OPERATION_TYPE_DEFINITION,operation:i,type:a,loc:this.loc(n)}},e.parseScalarTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("scalar");var a=this.parseName(),o=this.parseDirectives(!0);return{kind:z.SCALAR_TYPE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("type");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:z.OBJECT_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseImplementsInterfaces=function(){var n;if(!this.expectOptionalKeyword("implements"))return[];if(((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLImplementsInterfaces)===!0){var i=[];this.expectOptionalToken(C.AMP);do i.push(this.parseNamedType());while(this.expectOptionalToken(C.AMP)||this.peek(C.NAME));return i}return this.delimitedMany(C.AMP,this.parseNamedType)},e.parseFieldsDefinition=function(){var n;return((n=this._options)===null||n===void 0?void 0:n.allowLegacySDLEmptyFields)===!0&&this.peek(C.BRACE_L)&&this._lexer.lookahead().kind===C.BRACE_R?(this._lexer.advance(),this._lexer.advance(),[]):this.optionalMany(C.BRACE_L,this.parseFieldDefinition,C.BRACE_R)},e.parseFieldDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseArgumentDefs();this.expectToken(C.COLON);var s=this.parseTypeReference(),c=this.parseDirectives(!0);return{kind:z.FIELD_DEFINITION,description:i,name:a,arguments:o,type:s,directives:c,loc:this.loc(n)}},e.parseArgumentDefs=function(){return this.optionalMany(C.PAREN_L,this.parseInputValueDef,C.PAREN_R)},e.parseInputValueDef=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName();this.expectToken(C.COLON);var o=this.parseTypeReference(),s;this.expectOptionalToken(C.EQUALS)&&(s=this.parseValueLiteral(!0));var c=this.parseDirectives(!0);return{kind:z.INPUT_VALUE_DEFINITION,description:i,name:a,type:o,defaultValue:s,directives:c,loc:this.loc(n)}},e.parseInterfaceTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("interface");var a=this.parseName(),o=this.parseImplementsInterfaces(),s=this.parseDirectives(!0),c=this.parseFieldsDefinition();return{kind:z.INTERFACE_TYPE_DEFINITION,description:i,name:a,interfaces:o,directives:s,fields:c,loc:this.loc(n)}},e.parseUnionTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("union");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseUnionMemberTypes();return{kind:z.UNION_TYPE_DEFINITION,description:i,name:a,directives:o,types:s,loc:this.loc(n)}},e.parseUnionMemberTypes=function(){return this.expectOptionalToken(C.EQUALS)?this.delimitedMany(C.PIPE,this.parseNamedType):[]},e.parseEnumTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("enum");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseEnumValuesDefinition();return{kind:z.ENUM_TYPE_DEFINITION,description:i,name:a,directives:o,values:s,loc:this.loc(n)}},e.parseEnumValuesDefinition=function(){return this.optionalMany(C.BRACE_L,this.parseEnumValueDefinition,C.BRACE_R)},e.parseEnumValueDefinition=function(){var n=this._lexer.token,i=this.parseDescription(),a=this.parseName(),o=this.parseDirectives(!0);return{kind:z.ENUM_VALUE_DEFINITION,description:i,name:a,directives:o,loc:this.loc(n)}},e.parseInputObjectTypeDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("input");var a=this.parseName(),o=this.parseDirectives(!0),s=this.parseInputFieldsDefinition();return{kind:z.INPUT_OBJECT_TYPE_DEFINITION,description:i,name:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInputFieldsDefinition=function(){return this.optionalMany(C.BRACE_L,this.parseInputValueDef,C.BRACE_R)},e.parseTypeSystemExtension=function(){var n=this._lexer.lookahead();if(n.kind===C.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(C.BRACE_L,this.parseOperationTypeDefinition,C.BRACE_R);if(i.length===0&&a.length===0)throw this.unexpected();return{kind:z.SCHEMA_EXTENSION,directives:i,operationTypes:a,loc:this.loc(n)}},e.parseScalarTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("scalar");var i=this.parseName(),a=this.parseDirectives(!0);if(a.length===0)throw this.unexpected();return{kind:z.SCALAR_TYPE_EXTENSION,name:i,directives:a,loc:this.loc(n)}},e.parseObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("type");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:z.OBJECT_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseInterfaceTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("interface");var i=this.parseName(),a=this.parseImplementsInterfaces(),o=this.parseDirectives(!0),s=this.parseFieldsDefinition();if(a.length===0&&o.length===0&&s.length===0)throw this.unexpected();return{kind:z.INTERFACE_TYPE_EXTENSION,name:i,interfaces:a,directives:o,fields:s,loc:this.loc(n)}},e.parseUnionTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("union");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseUnionMemberTypes();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:z.UNION_TYPE_EXTENSION,name:i,directives:a,types:o,loc:this.loc(n)}},e.parseEnumTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("enum");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseEnumValuesDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:z.ENUM_TYPE_EXTENSION,name:i,directives:a,values:o,loc:this.loc(n)}},e.parseInputObjectTypeExtension=function(){var n=this._lexer.token;this.expectKeyword("extend"),this.expectKeyword("input");var i=this.parseName(),a=this.parseDirectives(!0),o=this.parseInputFieldsDefinition();if(a.length===0&&o.length===0)throw this.unexpected();return{kind:z.INPUT_OBJECT_TYPE_EXTENSION,name:i,directives:a,fields:o,loc:this.loc(n)}},e.parseDirectiveDefinition=function(){var n=this._lexer.token,i=this.parseDescription();this.expectKeyword("directive"),this.expectToken(C.AT);var a=this.parseName(),o=this.parseArgumentDefs(),s=this.expectOptionalKeyword("repeatable");this.expectKeyword("on");var c=this.parseDirectiveLocations();return{kind:z.DIRECTIVE_DEFINITION,description:i,name:a,arguments:o,repeatable:s,locations:c,loc:this.loc(n)}},e.parseDirectiveLocations=function(){return this.delimitedMany(C.PIPE,this.parseDirectiveLocation)},e.parseDirectiveLocation=function(){var n=this._lexer.token,i=this.parseName();if(Nv[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 Wh(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(Kh(n),", found ").concat(tl(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===C.NAME&&i.value===n)this._lexer.advance();else throw Tt(this._lexer.source,i.start,'Expected "'.concat(n,'", found ').concat(tl(i),"."))},e.expectOptionalKeyword=function(n){var i=this._lexer.token;return i.kind===C.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(tl(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 tl(r){var e=r.value;return Kh(r.kind)+(e!=null?' "'.concat(e,'"'):"")}function Kh(r){return Lv(r)?'"'.concat(r,'"'):r}var Bs=new Map,Sl=new Map,Jh=!0,tc=!1;function Zh(r){return r.replace(/[\s,]+/g," ").trim()}function Hv(r){return Zh(r.source.body.substring(r.start,r.end))}function Gv(r){var e=new Set,t=[];return r.definitions.forEach(function(n){if(n.kind==="FragmentDefinition"){var i=n.name.value,a=Hv(n.loc),o=Sl.get(i);o&&!o.has(a)?Jh&&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||wl.set(n,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(i))}else t.push(i)}),tc(tc({},r),{definitions:t})}function Gv(r){var e=new Set(r.definitions);e.forEach(function(i){i.loc&&delete i.loc,Object.keys(i).forEach(function(n){var a=i[n];a&&typeof a=="object"&&e.add(a)})});var t=r.loc;return t&&(delete t.startToken,delete t.endToken),r}function Kv(r){var e=Jh(r);if(!qs.has(e)){var t=Qv(r,{experimentalFragmentVariables:rc,allowLegacyFragmentVariables:rc});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");qs.set(e,Gv(Hv(t)))}return qs.get(e)}function A(r){for(var e=[],t=1;t<arguments.length;t++)e[t-1]=arguments[t];typeof r=="string"&&(r=[r]);var i=r[0];return e.forEach(function(n,a){n&&n.kind==="Document"?i+=n.loc.source.body:i+=n,i+=r[a+1]}),Kv(i)}function Jv(){qs.clear(),wl.clear()}function Zv(){Kh=!1}function Yv(){rc=!0}function Xv(){rc=!1}var La={gql:A,resetCaches:Jv,disableFragmentWarnings:Zv,enableExperimentalFragmentVariables:Yv,disableExperimentalFragmentVariables:Xv};(function(r){r.gql=La.gql,r.resetCaches=La.resetCaches,r.disableFragmentWarnings=La.disableFragmentWarnings,r.enableExperimentalFragmentVariables=La.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=La.disableExperimentalFragmentVariables})(A||(A={}));A.default=A;function k(r){if(!r)throw"Got no result from Apollo";if(r.error)throw r.error;if(r.errors)throw r.errors;return r.data}function eb(){}function di(){return eb}var Z=di,g=di,Je=di,ye=di,H=di,Rt=di,tb=di,Ql=di,Zh=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Yh=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},zi=class{constructor(e){this.code=e}};Zh([g(),Yh("design:type",String)],zi.prototype,"code",void 0);zi=Zh([H(),Yh("design:paramtypes",[String])],zi);var zl=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Wl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},hr=class{constructor(e,t){this.address=e,this.name=t}};zl([g(),Wl("design:type",String)],hr.prototype,"address",void 0);zl([g(),Wl("design:type",String)],hr.prototype,"name",void 0);hr=zl([H(),Wl("design:paramtypes",[String,String])],hr);var Ce=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ze=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Dr=class{constructor(e,t){this.key=t,this.signature=e}};Ce([g(),ze("design:type",String)],Dr.prototype,"signature",void 0);Ce([g(),ze("design:type",String)],Dr.prototype,"key",void 0);Ce([g(),ze("design:type",Boolean)],Dr.prototype,"valid",void 0);Ce([g(),ze("design:type",Boolean)],Dr.prototype,"invalid",void 0);Dr=Ce([H(),Je(),ze("design:paramtypes",[String,String])],Dr);var Wi=class{};Ce([g(),ze("design:type",String)],Wi.prototype,"signature",void 0);Ce([g(),ze("design:type",String)],Wi.prototype,"key",void 0);Ce([g(),ze("design:type",Boolean)],Wi.prototype,"valid",void 0);Ce([g(),ze("design:type",Boolean)],Wi.prototype,"invalid",void 0);Wi=Ce([Je()],Wi);function fi(r){let e=class{constructor(i,n,a,o){this.author=i,this.timestamp=n,this.data=a,this.proof=o}};return Ce([g(),ze("design:type",String)],e.prototype,"author",void 0),Ce([g(),ze("design:type",String)],e.prototype,"timestamp",void 0),Ce([g(),ze("design:type",Object)],e.prototype,"data",void 0),Ce([g(),ze("design:type",Dr)],e.prototype,"proof",void 0),e=Ce([H(),ze("design:paramtypes",[String,String,Object,Dr])],e),e}function rb(r){let e=class{};return Ce([g(),ze("design:type",String)],e.prototype,"author",void 0),Ce([g(),ze("design:type",String)],e.prototype,"timestamp",void 0),Ce([g(),ze("design:type",Object)],e.prototype,"data",void 0),Ce([g(),ze("design:type",Wi)],e.prototype,"proof",void 0),e=Ce([Je()],e),e}var If=class extends fi(){};If=Ce([H()],If);var ic=class extends fi(){};Ce([g(),ze("design:type",hr)],ic.prototype,"language",void 0);Ce([g(),ze("design:type",zi)],ic.prototype,"icon",void 0);ic=Ce([H()],ic);function vT(r){return r&&r.author&&r.timestamp&&r.data}var qe=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},it=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ot=class{constructor(e){this.source=e.source?e.source:"",this.target=e.target?e.target:"",this.predicate=e.predicate?e.predicate:""}};qe([g(),it("design:type",String)],Ot.prototype,"source",void 0);qe([g(),it("design:type",String)],Ot.prototype,"target",void 0);qe([g(),it("design:type",String)],Ot.prototype,"predicate",void 0);Ot=qe([H(),it("design:paramtypes",[Object])],Ot);var nc=class{};qe([g(),it("design:type",Array)],nc.prototype,"additions",void 0);qe([g(),it("design:type",Array)],nc.prototype,"removals",void 0);nc=qe([Je()],nc);var ac=class{constructor(e,t){this.additions=e,this.removals=t}};qe([g(),it("design:type",Array)],ac.prototype,"additions",void 0);qe([g(),it("design:type",Array)],ac.prototype,"removals",void 0);ac=qe([H(),it("design:paramtypes",[Array,Array])],ac);var uo=class{};qe([g(),it("design:type",String)],uo.prototype,"source",void 0);qe([g(),it("design:type",String)],uo.prototype,"target",void 0);qe([g(),it("design:type",String)],uo.prototype,"predicate",void 0);uo=qe([Je()],uo);var oi=class extends fi(){hash(){let e=JSON.stringify(this.data,Object.keys(this.data).sort())+JSON.stringify(this.author)+this.timestamp,t=0,i,n;for(i=0;i<e.length;i++)n=e.charCodeAt(i),t=(t<<5)-t+n,t|=0;return t}};qe([g(),it("design:type",String)],oi.prototype,"status",void 0);oi=qe([H()],oi);var Sl=class extends rb(){};qe([g(),it("design:type",String)],Sl.prototype,"status",void 0);Sl=qe([Je()],Sl);function AT(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 IT(r){return r&&r.source&&r.target}var oc=class{constructor(e,t){this.oldLink=e,this.newLink=t}};qe([g(),it("design:type",oi)],oc.prototype,"oldLink",void 0);qe([g(),it("design:type",oi)],oc.prototype,"newLink",void 0);oc=qe([H(),it("design:paramtypes",[oi,oi])],oc);var tn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Eo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},_l,yr=class{constructor(e){e?this.links=e:this.links=[]}get(e){if(!e||!e.source&&!e.predicate&&!e.target)return this.links;if(e.source){let i=JSON.parse(JSON.stringify(this.links));return e.target&&(i=i.filter(n=>n.data.target===e.target)),e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}if(e.target){let i=JSON.parse(JSON.stringify(this.links));return e.predicate&&(i=i.filter(n=>n.data.predicate===e.predicate)),e.fromDate&&(i=i.filter(n=>new Date(n.timestamp)>=e.fromDate)),e.untilDate&&(i=i.filter(n=>new Date(n.timestamp)<=e.untilDate)),e.limit&&(i=i.slice(0,e.limit)),i}let t=JSON.parse(JSON.stringify(this.links));return t=t.filter(i=>i.data.predicate===e.predicate),e.limit&&(t=t.slice(0,e.limit)),t}getSingleTarget(e){delete e.target;let t=this.get(e);return t.length?t[0].data.target:null}};tn([g(),Eo("design:type",Array)],yr.prototype,"links",void 0);yr=tn([H(),Eo("design:paramtypes",[Array])],yr);var sc=class{};tn([g(),Eo("design:type",Array)],sc.prototype,"links",void 0);sc=tn([Je()],sc);var El=_l=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new _l;return t.links.push(e),t}};tn([g(),Eo("design:type",Array)],El.prototype,"links",void 0);El=_l=tn([Je(),Eo("design:paramtypes",[Array])],El);var Hi=class extends fi(){};Hi=tn([H()],Hi);var j=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},q=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},ei=class{constructor(e,t){this.did=e,t?this.perspective=t:this.perspective=new yr}};j([g(),q("design:type",String)],ei.prototype,"did",void 0);j([g(),q("design:type",yr)],ei.prototype,"perspective",void 0);j([g(),q("design:type",String)],ei.prototype,"directMessageLanguage",void 0);ei=j([H(),q("design:paramtypes",[String,yr])],ei);var kf=class extends fi(){};kf=j([H()],kf);var si=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};j([g(),q("design:type",String)],si.prototype,"did",void 0);j([g(),q("design:type",String)],si.prototype,"didSigningKeyId",void 0);j([g(),q("design:type",String)],si.prototype,"deviceKeyType",void 0);j([g(),q("design:type",String)],si.prototype,"deviceKey",void 0);j([g(),q("design:type",String)],si.prototype,"deviceKeySignedByDid",void 0);j([g(),q("design:type",String)],si.prototype,"didSignedByDeviceKey",void 0);si=j([H(),q("design:paramtypes",[String,String,String,String,String,String])],si);var ci=class{constructor(e,t,i,n,a,o){this.did=e,this.didSigningKeyId=t,this.deviceKeyType=i,this.deviceKey=n,this.deviceKeySignedByDid=a,this.didSignedByDeviceKey=o}};j([g(),q("design:type",String)],ci.prototype,"did",void 0);j([g(),q("design:type",String)],ci.prototype,"didSigningKeyId",void 0);j([g(),q("design:type",String)],ci.prototype,"deviceKeyType",void 0);j([g(),q("design:type",String)],ci.prototype,"deviceKey",void 0);j([g(),q("design:type",String)],ci.prototype,"deviceKeySignedByDid",void 0);j([g(),q("design:type",String)],ci.prototype,"didSignedByDeviceKey",void 0);ci=j([Je(),q("design:paramtypes",[String,String,String,String,String,String])],ci);var cc=class{constructor(e,t){this.signature=e,this.publicKey=t}};j([g(),q("design:type",String)],cc.prototype,"signature",void 0);j([g(),q("design:type",String)],cc.prototype,"publicKey",void 0);cc=j([H(),q("design:paramtypes",[String,String])],cc);var Wn=class{constructor(e,t){this.domain=e,this.pointers=t}};j([g(),q("design:type",String)],Wn.prototype,"domain",void 0);j([g(),q("design:type",Array)],Wn.prototype,"pointers",void 0);Wn=j([H(),q("design:paramtypes",[String,Array])],Wn);var uc=class{constructor(e,t){this.with=e,this.can=t}};j([g(),q("design:type",Wn)],uc.prototype,"with",void 0);j([g(),q("design:type",Array)],uc.prototype,"can",void 0);uc=j([H(),q("design:paramtypes",[Wn,Array])],uc);var $r=class{constructor(e,t,i,n,a){this.appName=e,this.appDesc=t,this.appIconPath=a,this.appUrl=i,this.capabilities=n}};j([g(),q("design:type",String)],$r.prototype,"appName",void 0);j([g(),q("design:type",String)],$r.prototype,"appDesc",void 0);j([g(),q("design:type",String)],$r.prototype,"appUrl",void 0);j([g(),q("design:type",String)],$r.prototype,"appIconPath",void 0);j([g(),q("design:type",Array)],$r.prototype,"capabilities",void 0);$r=j([H(),q("design:paramtypes",[String,String,String,Array,String])],$r);var Hn=class{constructor(e,t,i,n){this.requestId=e,this.auth=t,this.token=i,this.revoked=n}};j([g(),q("design:type",String)],Hn.prototype,"requestId",void 0);j([g(),q("design:type",String)],Hn.prototype,"token",void 0);j([g(),q("design:type",Boolean)],Hn.prototype,"revoked",void 0);j([g(),q("design:type",$r)],Hn.prototype,"auth",void 0);Hn=j([H(),q("design:paramtypes",[String,$r,String,Boolean])],Hn);var Gn=class{constructor(e,t){this.domain=e,this.pointers=t}};j([g(),q("design:type",String)],Gn.prototype,"domain",void 0);j([g(),q("design:type",Array)],Gn.prototype,"pointers",void 0);Gn=j([Je(),q("design:paramtypes",[String,Array])],Gn);var lc=class{constructor(e,t){this.with=e,this.can=t}};j([g(),q("design:type",Gn)],lc.prototype,"with",void 0);j([g(),q("design:type",Array)],lc.prototype,"can",void 0);lc=j([Je(),q("design:paramtypes",[Gn,Array])],lc);var vr=class{constructor(e,t,i,n,a,o){this.appName=e,this.appDesc=t,this.appUrl=n,this.appDomain=i,this.capabilities=o,this.appIconPath=a}};j([g(),q("design:type",String)],vr.prototype,"appName",void 0);j([g(),q("design:type",String)],vr.prototype,"appDesc",void 0);j([g(),q("design:type",String)],vr.prototype,"appDomain",void 0);j([g(),q("design:type",String)],vr.prototype,"appUrl",void 0);j([g(),q("design:type",String)],vr.prototype,"appIconPath",void 0);j([g(),q("design:type",Array)],vr.prototype,"capabilities",void 0);vr=j([Je(),q("design:paramtypes",[String,String,String,String,String,Array])],vr);var Gi=class{constructor(e,t,i){this.did=e,this.success=t,this.error=i}};j([g(),q("design:type",String)],Gi.prototype,"did",void 0);j([g(),q("design:type",Boolean)],Gi.prototype,"success",void 0);j([g(),q("design:type",String)],Gi.prototype,"error",void 0);Gi=j([H(),q("design:paramtypes",[String,Boolean,String])],Gi);var ra=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},ia=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Vt=class{constructor(e){e?(this.isInitialized=e.isInitialized,this.isInitialized||(this.isInitialized=!1),this.isUnlocked=e.isUnlocked,this.isUnlocked||(this.isUnlocked=!1),this.did=e.did,this.didDocument=e.didDocument,this.error=e.error):(this.isInitialized=!1,this.isUnlocked=!1)}};ra([g(),ia("design:type",Boolean)],Vt.prototype,"isInitialized",void 0);ra([g(),ia("design:type",Boolean)],Vt.prototype,"isUnlocked",void 0);ra([g(),ia("design:type",String)],Vt.prototype,"did",void 0);ra([g(),ia("design:type",String)],Vt.prototype,"didDocument",void 0);ra([g(),ia("design:type",String)],Vt.prototype,"error",void 0);Vt=ra([H(),ia("design:paramtypes",[Object])],Vt);var Tf=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Fe=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},wt,St,xl=class{constructor(e,t){wt.set(this,void 0),St.set(this,void 0),Tf(this,wt,e,"f"),Tf(this,St,t,"f")}async otherAgents(){return await Fe(this,wt,"f").otherAgents(Fe(this,St,"f"))}async hasTelepresenceAdapter(){return await Fe(this,wt,"f").hasTelepresenceAdapter(Fe(this,St,"f"))}async onlineAgents(){return await Fe(this,wt,"f").onlineAgents(Fe(this,St,"f"))}async setOnlineStatus(e){return await Fe(this,wt,"f").setOnlineStatus(Fe(this,St,"f"),e)}async setOnlineStatusU(e){return await Fe(this,wt,"f").setOnlineStatusU(Fe(this,St,"f"),e)}async sendSignal(e,t){return await Fe(this,wt,"f").sendSignal(Fe(this,St,"f"),e,t)}async sendSignalU(e,t){return await Fe(this,wt,"f").sendSignalU(Fe(this,St,"f"),e,t)}async sendBroadcast(e,t=!1){return await Fe(this,wt,"f").sendBroadcast(Fe(this,St,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Fe(this,wt,"f").sendBroadcastU(Fe(this,St,"f"),e,t)}async addSignalHandler(e){await Fe(this,wt,"f").addSignalHandler(Fe(this,St,"f"),e)}removeSignalHandler(e){Fe(this,wt,"f").removeSignalHandler(Fe(this,St,"f"),e)}};wt=new WeakMap,St=new WeakMap;var rn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},nn=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ee=class{constructor(e){e&&(this.source=e.source,this.predicate=e.predicate,this.target=e.target,e.fromDate&&(this.fromDate=e.fromDate),e.untilDate&&(this.untilDate=e.untilDate),e.limit&&(this.limit=e.limit))}isMatch(e){return!(this.source&&this.source!==e.source||this.predicate&&this.predicate!==e.predicate||this.target&&this.target!==e.target)}};rn([g(),nn("design:type",String)],Ee.prototype,"source",void 0);rn([g(),nn("design:type",String)],Ee.prototype,"target",void 0);rn([g(),nn("design:type",String)],Ee.prototype,"predicate",void 0);rn([g(),nn("design:type",Date)],Ee.prototype,"fromDate",void 0);rn([g(),nn("design:type",Date)],Ee.prototype,"untilDate",void 0);rn([g(),nn("design:type",Number)],Ee.prototype,"limit",void 0);Ee=rn([H(),Je(),nn("design:paramtypes",[Object])],Ee);var Of=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},tt=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},_t,kr;function xs(r){return encodeURIComponent(r).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`)}var we=class{constructor(){_t.set(this,void 0),kr.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 we;return Of(t,kr,e,"f"),t}static from(e){let t=new we;return Of(t,_t,e,"f"),t}toUrl(){if(tt(this,kr,"f")&&!tt(this,_t,"f"))return tt(this,kr,"f");if(!tt(this,kr,"f")&&(tt(this,_t,"f")===void 0||tt(this,_t,"f")===""||tt(this,_t,"f")===null))throw new Error("Can't turn empty Literal into URL");let e;switch(typeof tt(this,_t,"f")){case"string":e=`string:${xs(tt(this,_t,"f"))}`;break;case"number":e=`number:${xs(tt(this,_t,"f"))}`;break;case"boolean":e=`boolean:${xs(tt(this,_t,"f"))}`;break;case"object":e=`json:${xs(JSON.stringify(tt(this,_t,"f")))}`;break}return`literal://${e}`}get(){if(tt(this,_t,"f"))return tt(this,_t,"f");if(!tt(this,kr,"f"))throw new Error("Can't render empty Literal");if(!tt(this,kr,"f").startsWith("literal://"))throw new Error("Can't render Literal from non-literal URL");let e=tt(this,kr,"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,kr=new WeakMap;function ti(r){return r.charAt(0).toUpperCase()+r.slice(1)}function pc(r){return`set${ti(r)}`}function Hl(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function ib(r){return`add${ti(Hl(r))}`}function nb(r){return`remove${ti(Hl(r))}`}function ab(r){return`setCollection${ti(Hl(r))}`}function Oi(r){if(Array.isArray(r))return`[${r.map(Oi).join(", ")}]`;let e=Object.keys(r),t=[];for(let i of e){let n=JSON.stringify(r[i]),a=`${i}: ${n}`;t.push(a)}return`{${t.join(", ")}}`}var tl=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},X=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},dt,ft,Me,Qn=class{constructor(r,e,t){dt.set(this,void 0),ft.set(this,void 0),Me.set(this,void 0),tl(this,dt,e,"f"),tl(this,ft,t,"f"),tl(this,Me,r,"f")}get baseExpression(){return X(this,dt,"f")}async init(){let isInstance=await X(this,Me,"f").isSubjectInstance(X(this,dt,"f"),X(this,ft,"f"));if(!isInstance)throw`Not a valid subject instance of ${X(this,ft,"f")} for ${X(this,dt,"f")}`;let results=await X(this,Me,"f").infer(`subject_class("${X(this,ft,"f")}", C), property(C, Property)`),properties=results.map(r=>r.Property);for(let r of properties)await X(this,Me,"f").infer(`subject_class("${X(this,ft,"f")}", C), property_resolve(C, "${r}")`),Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await X(this,Me,"f").getPropertyValueViaSurreal(X(this,dt,"f"),X(this,ft,"f"),r)}catch(e){console.warn(`Failed to get property ${r} via SurrealDB:`,e);return}}});let setters=await X(this,Me,"f").infer(`subject_class("${X(this,ft,"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,Me,"f").infer(`subject_class("${X(this,ft,"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,Me,"f").createExpression(r,resolveLanguage)),await X(this,Me,"f").executeAction(actions,X(this,dt,"f"),[{name:"value",value:r}])}}let results2=await X(this,Me,"f").infer(`subject_class("${X(this,ft,"f")}", C), collection(C, Collection)`);results2||(results2=[]);let collections=results2.map(r=>r.Collection);for(let r of collections)Object.defineProperty(this,r,{configurable:!0,get:async()=>{try{return await X(this,Me,"f").getCollectionValuesViaSurreal(X(this,dt,"f"),X(this,ft,"f"),r)}catch(e){return console.warn(`Failed to get collection ${r} via SurrealDB:`,e),[]}}});let adders=await X(this,Me,"f").infer(`subject_class("${X(this,ft,"f")}", C), collection_adder(C, Collection, Adder)`);adders||(adders=[]);for(let adder of adders)if(adder){let collection=adder.Collection,actions=eval(adder.Adder);this[ib(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>X(this,Me,"f").executeAction(actions,X(this,dt,"f"),[{name:"value",value:e}]))):await X(this,Me,"f").executeAction(actions,X(this,dt,"f"),[{name:"value",value:r}])}}let removers=await X(this,Me,"f").infer(`subject_class("${X(this,ft,"f")}", C), collection_remover(C, Collection, Remover)`);removers||(removers=[]);for(let remover of removers)if(remover){let collection=remover.Collection,actions=eval(remover.Remover);this[nb(collection)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>X(this,Me,"f").executeAction(actions,X(this,dt,"f"),[{name:"value",value:e}]))):await X(this,Me,"f").executeAction(actions,X(this,dt,"f"),[{name:"value",value:r}])}}let collectionSetters=await X(this,Me,"f").infer(`subject_class("${X(this,ft,"f")}", C), collection_setter(C, Collection, Setter)`);collectionSetters||(collectionSetters=[]);for(let collectionSetter of collectionSetters)if(collectionSetter){let collection=collectionSetter.Collection,actions=eval(collectionSetter.Setter);this[ab(collection)]=async r=>{Array.isArray(r)?await X(this,Me,"f").executeAction(actions,X(this,dt,"f"),r.map(e=>({name:"value",value:e}))):await X(this,Me,"f").executeAction(actions,X(this,dt,"f"),[{name:"value",value:r}])}}}};dt=new WeakMap,ft=new WeakMap,Me=new WeakMap;function Cf(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 Xh(r){let e=r.can.includes("*")?["READ","WRITE","UPDATE"]:r.can,t=r.with.domain==="*"?"":r.with.domain,i=r.with.pointers.includes("*")?["all AD4M data"]:r.with.pointers;return`${Cf(e)} your ${t} actions, with access to ${Cf(i)}`}function ve(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}function Nf(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 n=t[2],a=n.lastIndexOf("/");return a!==-1?t[1]+n.substring(0,a+1):t[1]}let i=r.match(/^([a-zA-Z][a-zA-Z0-9+.-]*:)/);return i?i[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 $f(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 i=r.match(/^[a-zA-Z][a-zA-Z0-9+.-]*:(.+)$/);return i?i[1]:r}var ri=class{constructor(e,t){if(t!==void 0)this.nodeShapeUri=e,this.targetClass=t;else{this.targetClass=e;let i=Nf(e),n=$f(e);this.nodeShapeUri=`${i}${n}Shape`}this.properties=[]}addProperty(e){this.properties.push(e)}setConstructorActions(e){this.constructor_actions=e}setDestructorActions(e){this.destructor_actions=e}toTurtle(){let e=`@prefix sh: <http://www.w3.org/ns/shacl#> .
|
|
61
|
+
this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o||Sl.set(i,o=new Set),o.add(a),e.has(a)||(e.add(a),t.push(n))}else t.push(n)}),ec(ec({},r),{definitions:t})}function Kv(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 Jv(r){var e=Zh(r);if(!Bs.has(e)){var t=zv(r,{experimentalFragmentVariables:tc,allowLegacyFragmentVariables:tc});if(!t||t.kind!=="Document")throw new Error("Not a valid GraphQL document.");Bs.set(e,Kv(Gv(t)))}return Bs.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]}),Jv(n)}function Zv(){Bs.clear(),Sl.clear()}function Yv(){Jh=!1}function Xv(){tc=!0}function eb(){tc=!1}var La={gql:x,resetCaches:Zv,disableFragmentWarnings:Yv,enableExperimentalFragmentVariables:Xv,disableExperimentalFragmentVariables:eb};(function(r){r.gql=La.gql,r.resetCaches=La.resetCaches,r.disableFragmentWarnings=La.disableFragmentWarnings,r.enableExperimentalFragmentVariables=La.enableExperimentalFragmentVariables,r.disableExperimentalFragmentVariables=La.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 tb(){}function hn(){return tb}var Z=hn,S=hn,Ge=hn,ye=hn,H=hn,$t=hn,rb=hn,zl=hn,Yh=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},Xh=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Hn=class{constructor(e){this.code=e}};Yh([S(),Xh("design:type",String)],Hn.prototype,"code",void 0);Hn=Yh([H(),Xh("design:paramtypes",[String])],Hn);var Wl=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},Hl=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},mr=class{constructor(e,t){this.address=e,this.name=t}};Wl([S(),Hl("design:type",String)],mr.prototype,"address",void 0);Wl([S(),Hl("design:type",String)],mr.prototype,"name",void 0);mr=Wl([H(),Hl("design:paramtypes",[String,String])],mr);var Ae=function(r,e,t,n){var i=arguments.length,a=i<3?e:n===null?n=Object.getOwnPropertyDescriptor(e,t):n,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,n);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(i<3?o(a):i>3?o(e,t,a):o(e,t))||a);return i>3&&a&&Object.defineProperty(e,t,a),a},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}};Ae([S(),Ve("design:type",String)],Rr.prototype,"signature",void 0);Ae([S(),Ve("design:type",String)],Rr.prototype,"key",void 0);Ae([S(),Ve("design:type",Boolean)],Rr.prototype,"valid",void 0);Ae([S(),Ve("design:type",Boolean)],Rr.prototype,"invalid",void 0);Rr=Ae([H(),Ge(),Ve("design:paramtypes",[String,String])],Rr);var Gn=class{};Ae([S(),Ve("design:type",String)],Gn.prototype,"signature",void 0);Ae([S(),Ve("design:type",String)],Gn.prototype,"key",void 0);Ae([S(),Ve("design:type",Boolean)],Gn.prototype,"valid",void 0);Ae([S(),Ve("design:type",Boolean)],Gn.prototype,"invalid",void 0);Gn=Ae([Ge()],Gn);function mn(r){let e=class{constructor(n,i,a,o){this.author=n,this.timestamp=i,this.data=a,this.proof=o}};return Ae([S(),Ve("design:type",String)],e.prototype,"author",void 0),Ae([S(),Ve("design:type",String)],e.prototype,"timestamp",void 0),Ae([S(),Ve("design:type",Object)],e.prototype,"data",void 0),Ae([S(),Ve("design:type",Rr)],e.prototype,"proof",void 0),e=Ae([H(),Ve("design:paramtypes",[String,String,Object,Rr])],e),e}function nb(r){let e=class{};return Ae([S(),Ve("design:type",String)],e.prototype,"author",void 0),Ae([S(),Ve("design:type",String)],e.prototype,"timestamp",void 0),Ae([S(),Ve("design:type",Object)],e.prototype,"data",void 0),Ae([S(),Ve("design:type",Gn)],e.prototype,"proof",void 0),e=Ae([Ge()],e),e}var If=class extends mn(){};If=Ae([H()],If);var rc=class extends mn(){};Ae([S(),Ve("design:type",mr)],rc.prototype,"language",void 0);Ae([S(),Ve("design:type",Hn)],rc.prototype,"icon",void 0);rc=Ae([H()],rc);function xT(r){return r&&r.author&&r.timestamp&&r.data}var Me=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:""}};Me([S(),tt("design:type",String)],St.prototype,"source",void 0);Me([S(),tt("design:type",String)],St.prototype,"target",void 0);Me([S(),tt("design:type",String)],St.prototype,"predicate",void 0);St=Me([H(),tt("design:paramtypes",[Object])],St);var nc=class{};Me([S(),tt("design:type",Array)],nc.prototype,"additions",void 0);Me([S(),tt("design:type",Array)],nc.prototype,"removals",void 0);nc=Me([Ge()],nc);var ic=class{constructor(e,t){this.additions=e,this.removals=t}};Me([S(),tt("design:type",Array)],ic.prototype,"additions",void 0);Me([S(),tt("design:type",Array)],ic.prototype,"removals",void 0);ic=Me([H(),tt("design:paramtypes",[Array,Array])],ic);var lo=class{};Me([S(),tt("design:type",String)],lo.prototype,"source",void 0);Me([S(),tt("design:type",String)],lo.prototype,"target",void 0);Me([S(),tt("design:type",String)],lo.prototype,"predicate",void 0);lo=Me([Ge()],lo);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}};Me([S(),tt("design:type",String)],cn.prototype,"status",void 0);cn=Me([H()],cn);var _l=class extends nb(){};Me([S(),tt("design:type",String)],_l.prototype,"status",void 0);_l=Me([Ge()],_l);function NT(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 $T(r){return r&&r.source&&r.target}var ac=class{constructor(e,t){this.oldLink=e,this.newLink=t}};Me([S(),tt("design:type",cn)],ac.prototype,"oldLink",void 0);Me([S(),tt("design:type",cn)],ac.prototype,"newLink",void 0);ac=Me([H(),tt("design:paramtypes",[cn,cn])],ac);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},xo=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},El,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(),xo("design:type",Array)],br.prototype,"links",void 0);br=ni([H(),xo("design:paramtypes",[Array])],br);var oc=class{};ni([S(),xo("design:type",Array)],oc.prototype,"links",void 0);oc=ni([Ge()],oc);var xl=El=class{constructor(e){e?this.links=e:this.links=[]}static fromLink(e){let t=new El;return t.links.push(e),t}};ni([S(),xo("design:type",Array)],xl.prototype,"links",void 0);xl=El=ni([Ge(),xo("design:paramtypes",[Array])],xl);var Kn=class extends mn(){};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},j=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(),j("design:type",String)],rn.prototype,"did",void 0);U([S(),j("design:type",br)],rn.prototype,"perspective",void 0);U([S(),j("design:type",String)],rn.prototype,"directMessageLanguage",void 0);rn=U([H(),j("design:paramtypes",[String,br])],rn);var Tf=class extends mn(){};Tf=U([H()],Tf);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([S(),j("design:type",String)],un.prototype,"did",void 0);U([S(),j("design:type",String)],un.prototype,"didSigningKeyId",void 0);U([S(),j("design:type",String)],un.prototype,"deviceKeyType",void 0);U([S(),j("design:type",String)],un.prototype,"deviceKey",void 0);U([S(),j("design:type",String)],un.prototype,"deviceKeySignedByDid",void 0);U([S(),j("design:type",String)],un.prototype,"didSignedByDeviceKey",void 0);un=U([H(),j("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([S(),j("design:type",String)],ln.prototype,"did",void 0);U([S(),j("design:type",String)],ln.prototype,"didSigningKeyId",void 0);U([S(),j("design:type",String)],ln.prototype,"deviceKeyType",void 0);U([S(),j("design:type",String)],ln.prototype,"deviceKey",void 0);U([S(),j("design:type",String)],ln.prototype,"deviceKeySignedByDid",void 0);U([S(),j("design:type",String)],ln.prototype,"didSignedByDeviceKey",void 0);ln=U([Ge(),j("design:paramtypes",[String,String,String,String,String,String])],ln);var sc=class{constructor(e,t){this.signature=e,this.publicKey=t}};U([S(),j("design:type",String)],sc.prototype,"signature",void 0);U([S(),j("design:type",String)],sc.prototype,"publicKey",void 0);sc=U([H(),j("design:paramtypes",[String,String])],sc);var Wi=class{constructor(e,t){this.domain=e,this.pointers=t}};U([S(),j("design:type",String)],Wi.prototype,"domain",void 0);U([S(),j("design:type",Array)],Wi.prototype,"pointers",void 0);Wi=U([H(),j("design:paramtypes",[String,Array])],Wi);var cc=class{constructor(e,t){this.with=e,this.can=t}};U([S(),j("design:type",Wi)],cc.prototype,"with",void 0);U([S(),j("design:type",Array)],cc.prototype,"can",void 0);cc=U([H(),j("design:paramtypes",[Wi,Array])],cc);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(),j("design:type",String)],Lr.prototype,"appName",void 0);U([S(),j("design:type",String)],Lr.prototype,"appDesc",void 0);U([S(),j("design:type",String)],Lr.prototype,"appUrl",void 0);U([S(),j("design:type",String)],Lr.prototype,"appIconPath",void 0);U([S(),j("design:type",Array)],Lr.prototype,"capabilities",void 0);Lr=U([H(),j("design:paramtypes",[String,String,String,Array,String])],Lr);var Hi=class{constructor(e,t,n,i){this.requestId=e,this.auth=t,this.token=n,this.revoked=i}};U([S(),j("design:type",String)],Hi.prototype,"requestId",void 0);U([S(),j("design:type",String)],Hi.prototype,"token",void 0);U([S(),j("design:type",Boolean)],Hi.prototype,"revoked",void 0);U([S(),j("design:type",Lr)],Hi.prototype,"auth",void 0);Hi=U([H(),j("design:paramtypes",[String,Lr,String,Boolean])],Hi);var Gi=class{constructor(e,t){this.domain=e,this.pointers=t}};U([S(),j("design:type",String)],Gi.prototype,"domain",void 0);U([S(),j("design:type",Array)],Gi.prototype,"pointers",void 0);Gi=U([Ge(),j("design:paramtypes",[String,Array])],Gi);var uc=class{constructor(e,t){this.with=e,this.can=t}};U([S(),j("design:type",Gi)],uc.prototype,"with",void 0);U([S(),j("design:type",Array)],uc.prototype,"can",void 0);uc=U([Ge(),j("design:paramtypes",[Gi,Array])],uc);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(),j("design:type",String)],wr.prototype,"appName",void 0);U([S(),j("design:type",String)],wr.prototype,"appDesc",void 0);U([S(),j("design:type",String)],wr.prototype,"appDomain",void 0);U([S(),j("design:type",String)],wr.prototype,"appUrl",void 0);U([S(),j("design:type",String)],wr.prototype,"appIconPath",void 0);U([S(),j("design:type",Array)],wr.prototype,"capabilities",void 0);wr=U([Ge(),j("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(),j("design:type",String)],Jn.prototype,"did",void 0);U([S(),j("design:type",Boolean)],Jn.prototype,"success",void 0);U([S(),j("design:type",String)],Jn.prototype,"error",void 0);Jn=U([H(),j("design:paramtypes",[String,Boolean,String])],Jn);var ra=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},na=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)}};ra([S(),na("design:type",Boolean)],qt.prototype,"isInitialized",void 0);ra([S(),na("design:type",Boolean)],qt.prototype,"isUnlocked",void 0);ra([S(),na("design:type",String)],qt.prototype,"did",void 0);ra([S(),na("design:type",String)],qt.prototype,"didDocument",void 0);ra([S(),na("design:type",String)],qt.prototype,"error",void 0);qt=ra([H(),na("design:paramtypes",[Object])],qt);var Of=function(r,e,t,n,i){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!i)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?i.call(r,t):i?i.value=t:e.set(r,t),t},Re=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},vt,bt,kl=class{constructor(e,t){vt.set(this,void 0),bt.set(this,void 0),Of(this,vt,e,"f"),Of(this,bt,t,"f")}async otherAgents(){return await Re(this,vt,"f").otherAgents(Re(this,bt,"f"))}async hasTelepresenceAdapter(){return await Re(this,vt,"f").hasTelepresenceAdapter(Re(this,bt,"f"))}async onlineAgents(){return await Re(this,vt,"f").onlineAgents(Re(this,bt,"f"))}async setOnlineStatus(e){return await Re(this,vt,"f").setOnlineStatus(Re(this,bt,"f"),e)}async setOnlineStatusU(e){return await Re(this,vt,"f").setOnlineStatusU(Re(this,bt,"f"),e)}async sendSignal(e,t){return await Re(this,vt,"f").sendSignal(Re(this,bt,"f"),e,t)}async sendSignalU(e,t){return await Re(this,vt,"f").sendSignalU(Re(this,bt,"f"),e,t)}async sendBroadcast(e,t=!1){return await Re(this,vt,"f").sendBroadcast(Re(this,bt,"f"),e,t)}async sendBroadcastU(e,t=!1){return await Re(this,vt,"f").sendBroadcastU(Re(this,bt,"f"),e,t)}async addSignalHandler(e){await Re(this,vt,"f").addSignalHandler(Re(this,bt,"f"),e)}removeSignalHandler(e){Re(this,vt,"f").removeSignalHandler(Re(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 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},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 Cf(t,Or,e,"f"),t}static from(e){let t=new Se;return Cf(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 lc(r){return`set${Yt(r)}`}function em(r){return r.endsWith("ies")?r.slice(0,-3)+"y":r.endsWith("s")?r.slice(0,-1):r}function ib(r){return`add${Yt(em(r))}`}function ab(r){return`remove${Yt(em(r))}`}function ob(r){return`set${Yt(r)}`}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 rl=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,Le,io=class{constructor(r,e,t){lt.set(this,void 0),pt.set(this,void 0),Le.set(this,void 0),rl(this,lt,e,"f"),rl(this,pt,t,"f"),rl(this,Le,r,"f")}get baseExpression(){return X(this,lt,"f")}async init(){let isInstance=await X(this,Le,"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,Le,"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,Le,"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,Le,"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,Le,"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,Le,"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[lc(property)]=async r=>{resolveLanguage&&(r=await X(this,Le,"f").createExpression(r,resolveLanguage)),await X(this,Le,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:r}])}}let results2=await X(this,Le,"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,Le,"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,Le,"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[ib(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>X(this,Le,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:e}]))):await X(this,Le,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:r}])}}let removers=await X(this,Le,"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[ab(relation)]=async r=>{Array.isArray(r)?await Promise.all(r.map(e=>X(this,Le,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:e}]))):await X(this,Le,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:r}])}}let relationSetters=await X(this,Le,"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[ob(relation)]=async r=>{Array.isArray(r)?await X(this,Le,"f").executeAction(actions,X(this,lt,"f"),r.map(e=>({name:"value",value:e}))):await X(this,Le,"f").executeAction(actions,X(this,lt,"f"),[{name:"value",value:r}])}}}};lt=new WeakMap,pt=new WeakMap,Le=new WeakMap;function Nf(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 $f(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 Df(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=Nf(e),i=Df(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
62
|
`;e+=`@prefix xsd: <http://www.w3.org/2001/XMLSchema#> .
|
|
63
63
|
`,e+=`@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
|
64
64
|
`,e+=`@prefix ad4m: <ad4m://> .
|
|
@@ -66,33 +66,55 @@ this in the docs: http://dev.apollodata.com/core/fragments.html#unique-names`):o
|
|
|
66
66
|
`,e+=`<${this.nodeShapeUri}>
|
|
67
67
|
`,e+=` a sh:NodeShape ;
|
|
68
68
|
`,this.targetClass&&(e+=` sh:targetClass <${this.targetClass}> ;
|
|
69
|
-
`);for(let t
|
|
70
|
-
|
|
71
|
-
`,
|
|
72
|
-
|
|
73
|
-
`),
|
|
74
|
-
`),
|
|
75
|
-
`),
|
|
76
|
-
`),
|
|
77
|
-
`),
|
|
78
|
-
`),
|
|
79
|
-
`),
|
|
80
|
-
`),
|
|
69
|
+
`);for(let t of this.parentShapes)e+=` sh:node <${t}> ;
|
|
70
|
+
`;for(let t=0;t<this.properties.length;t++){let n=this.properties[t],i=t===this.properties.length-1;e+=` sh:property [
|
|
71
|
+
`,e+=` sh:path <${n.path}> ;
|
|
72
|
+
`,n.datatype&&(e+=` sh:datatype <${n.datatype}> ;
|
|
73
|
+
`),n.nodeKind&&(e+=` sh:nodeKind sh:${n.nodeKind} ;
|
|
74
|
+
`),n.minCount!==void 0&&(e+=` sh:minCount ${n.minCount} ;
|
|
75
|
+
`),n.maxCount!==void 0&&(e+=` sh:maxCount ${n.maxCount} ;
|
|
76
|
+
`),n.pattern&&(e+=` sh:pattern "${$f(n.pattern)}" ;
|
|
77
|
+
`),n.minInclusive!==void 0&&(e+=` sh:minInclusive ${n.minInclusive} ;
|
|
78
|
+
`),n.maxInclusive!==void 0&&(e+=` sh:maxInclusive ${n.maxInclusive} ;
|
|
79
|
+
`),n.hasValue&&(e+=` sh:hasValue "${$f(n.hasValue)}" ;
|
|
80
|
+
`),n.local!==void 0&&(e+=` ad4m:local ${n.local} ;
|
|
81
|
+
`),n.writable!==void 0&&(e+=` ad4m:writable ${n.writable} ;
|
|
81
82
|
`),e=e.slice(0,-2)+`
|
|
82
|
-
`,e+=
|
|
83
|
+
`,e+=i?` ] .
|
|
83
84
|
`:` ] ;
|
|
84
|
-
`}return e}toLinks(){let e=[];e.push({source:this.nodeShapeUri,predicate:"rdf://type",target:"sh://NodeShape"}),this.targetClass&&e.push({source:this.nodeShapeUri,predicate:"sh://targetClass",target:this.targetClass}),this.constructor_actions&&this.constructor_actions.length>0&&e.push({source:this.nodeShapeUri,predicate:"ad4m://constructor",target:`literal://string:${JSON.stringify(this.constructor_actions)}`}),this.destructor_actions&&this.destructor_actions.length>0&&e.push({source:this.nodeShapeUri,predicate:"ad4m://destructor",target:`literal://string:${JSON.stringify(this.destructor_actions)}`});for(let t=0;t<this.properties.length;t++){let i=this.properties[t],n;if(i.name&&this.targetClass){let a=Nf(this.targetClass),o=$f(this.targetClass);n=`${a}${o}.${i.name}`}else n=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:n}),e.push({source:n,predicate:"sh://path",target:i.path}),i.datatype&&e.push({source:n,predicate:"sh://datatype",target:i.datatype}),i.nodeKind&&e.push({source:n,predicate:"sh://nodeKind",target:`sh://${i.nodeKind}`}),i.minCount!==void 0&&e.push({source:n,predicate:"sh://minCount",target:`literal://${i.minCount}^^xsd:integer`}),i.maxCount!==void 0&&e.push({source:n,predicate:"sh://maxCount",target:`literal://${i.maxCount}^^xsd:integer`}),i.pattern&&e.push({source:n,predicate:"sh://pattern",target:`literal://${i.pattern}`}),i.minInclusive!==void 0&&e.push({source:n,predicate:"sh://minInclusive",target:`literal://${i.minInclusive}`}),i.maxInclusive!==void 0&&e.push({source:n,predicate:"sh://maxInclusive",target:`literal://${i.maxInclusive}`}),i.hasValue&&e.push({source:n,predicate:"sh://hasValue",target:`literal://${i.hasValue}`}),i.local!==void 0&&e.push({source:n,predicate:"ad4m://local",target:`literal://${i.local}`}),i.writable!==void 0&&e.push({source:n,predicate:"ad4m://writable",target:`literal://${i.writable}`}),i.resolveLanguage&&e.push({source:n,predicate:"ad4m://resolveLanguage",target:`literal://string:${i.resolveLanguage}`}),i.setter&&i.setter.length>0&&e.push({source:n,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(i.setter)}`}),i.adder&&i.adder.length>0&&e.push({source:n,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(i.adder)}`}),i.remover&&i.remover.length>0&&e.push({source:n,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(i.remover)}`})}return e}static fromLinks(e,t){let i=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),n=new ri(t,i?.target),a=e.find(c=>c.source===t&&c.predicate==="ad4m://constructor");if(a)try{let c=a.target.replace("literal://string:","");n.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:","");n.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(I=>I.source===u&&I.predicate==="sh://path");if(!l)continue;let f;if(!u.startsWith("_:")){let I=u.lastIndexOf(".");I!==-1&&(f=u.substring(I+1))}let d={name:f,path:l.target},p=e.find(I=>I.source===u&&I.predicate==="sh://datatype");p&&(d.datatype=p.target);let h=e.find(I=>I.source===u&&I.predicate==="sh://nodeKind");h&&(d.nodeKind=h.target.replace("sh://",""));let m=e.find(I=>I.source===u&&I.predicate==="sh://minCount");if(m){let I=m.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),d.minCount=parseInt(I)}let y=e.find(I=>I.source===u&&I.predicate==="sh://maxCount");if(y){let I=y.target.replace("literal://","").replace(/\^\^.*$/,"");I.startsWith("number:")&&(I=I.substring(7)),d.maxCount=parseInt(I)}let S=e.find(I=>I.source===u&&I.predicate==="sh://pattern");S&&(d.pattern=S.target.replace("literal://",""));let w=e.find(I=>I.source===u&&I.predicate==="sh://minInclusive");if(w){let I=w.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),d.minInclusive=parseFloat(I)}let _=e.find(I=>I.source===u&&I.predicate==="sh://maxInclusive");if(_){let I=_.target.replace("literal://","");I.startsWith("number:")&&(I=I.substring(7)),d.maxInclusive=parseFloat(I)}let v=e.find(I=>I.source===u&&I.predicate==="sh://hasValue");v&&(d.hasValue=v.target.replace("literal://",""));let T=e.find(I=>I.source===u&&I.predicate==="ad4m://local");if(T){let I=T.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),d.local=I==="true"}let $=e.find(I=>I.source===u&&I.predicate==="ad4m://writable");if($){let I=$.target.replace("literal://","");I.startsWith("boolean:")&&(I=I.substring(8)),d.writable=I==="true"}let E=e.find(I=>I.source===u&&I.predicate==="ad4m://resolveLanguage");E&&(d.resolveLanguage=E.target.replace("literal://string:",""));let R=e.find(I=>I.source===u&&I.predicate==="ad4m://setter");if(R)try{let I=R.target.replace("literal://string:","");d.setter=JSON.parse(I)}catch{}let L=e.find(I=>I.source===u&&I.predicate==="ad4m://adder");if(L)try{let I=L.target.replace("literal://string:","");d.adder=JSON.parse(I)}catch{}let D=e.find(I=>I.source===u&&I.predicate==="ad4m://remover");if(D)try{let I=D.target.replace("literal://string:","");d.remover=JSON.parse(I)}catch{}n.addProperty(d)}return n}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover})),constructor_actions:this.constructor_actions,destructor_actions:this.destructor_actions}}static fromJSON(e){let t=e.node_shape_uri?new ri(e.node_shape_uri,e.target_class):new ri(e.target_class);for(let i of e.properties||[])t.addProperty({path:i.path,name:i.name,datatype:i.datatype,nodeKind:i.node_kind,minCount:i.min_count,maxCount:i.max_count,minInclusive:i.min_inclusive,maxInclusive:i.max_inclusive,pattern:i.pattern,hasValue:i.has_value,local:i.local,writable:i.writable,resolveLanguage:i.resolve_language,setter:i.setter,adder:i.adder,remover:i.remover});return e.constructor_actions&&(t.constructor_actions=e.constructor_actions),e.destructor_actions&&(t.destructor_actions=e.destructor_actions),t}},Kn=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:we.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 i of this._states){let n=this.stateUri(i.name);e.push({source:t,predicate:"ad4m://hasState",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowState"}),e.push({source:n,predicate:"ad4m://stateName",target:we.from(i.name).toUrl()}),e.push({source:n,predicate:"ad4m://stateValue",target:we.from(i.value).toUrl()}),e.push({source:n,predicate:"ad4m://stateCheck",target:`literal://string:${encodeURIComponent(JSON.stringify(i.stateCheck))}`})}for(let i of this._transitions){let n=this.transitionUri(i.fromState,i.toState),a=this.stateUri(i.fromState),o=this.stateUri(i.toState);e.push({source:t,predicate:"ad4m://hasTransition",target:n}),e.push({source:n,predicate:"rdf://type",target:"ad4m://FlowTransition"}),e.push({source:n,predicate:"ad4m://actionName",target:we.from(i.actionName).toUrl()}),e.push({source:n,predicate:"ad4m://fromState",target:a}),e.push({source:n,predicate:"ad4m://toState",target:o}),e.push({source:n,predicate:"ad4m://transitionActions",target:`literal://string:${encodeURIComponent(JSON.stringify(i.actions))}`})}return e}static fromLinks(e,t){let i="Flow";if(!t.endsWith(i))throw new Error(`Invalid flow URI: ${t} (must end with 'Flow')`);let n=t.slice(0,-i.length),a=Math.max(n.lastIndexOf("/"),n.lastIndexOf(":")),o=n.slice(0,a+1),s=n.slice(a+1),c=new Kn(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 f=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),d=new Map;for(let h of f){let m=h.target,y=e.find($=>$.source===m&&$.predicate==="ad4m://stateName"),S=y?we.fromUrl(y.target).get():"";d.set(m,S);let w=e.find($=>$.source===m&&$.predicate==="ad4m://stateValue"),_=w?we.fromUrl(w.target).get():0,v=e.find($=>$.source===m&&$.predicate==="ad4m://stateCheck"),T={predicate:"",target:""};if(v)try{let $=v.target.replace("literal://string:","");T=JSON.parse(decodeURIComponent($))}catch{}c.addState({name:S,value:_,stateCheck:T})}let p=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of p){let m=h.target,y=e.find(D=>D.source===m&&D.predicate==="ad4m://actionName"),S=y?we.fromUrl(y.target).get():"",_=e.find(D=>D.source===m&&D.predicate==="ad4m://fromState")?.target||"",v=d.get(_)||"",$=e.find(D=>D.source===m&&D.predicate==="ad4m://toState")?.target||"",E=d.get($)||"",R=e.find(D=>D.source===m&&D.predicate==="ad4m://transitionActions"),L=[];if(R)try{let D=R.target.replace("literal://string:","");L=JSON.parse(decodeURIComponent(D))}catch{}c.addTransition({actionName:S,fromState:v,toState:E,actions:L})}return c}toJSON(){return{name:this.name,namespace:this.namespace,flowable:this.flowable,startAction:this.startAction,states:this._states,transitions:this._transitions}}static fromJSON(e){let t=new Kn(e.name,e.namespace);t.flowable=e.flowable||"any",t.startAction=e.startAction||[];for(let i of e.states||[])t.addState(i);for(let i of e.transitions||[])t.addTransition(i);return t}},ge=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},O=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Bs,Tr,ur,lr,Mi,Kr,Jr,Ci,ja,Vs,Ni,Di,qt,qn,Al,pe,fe,$i,Ri,Li,qa,dc=class{constructor(e,t,i){Bs.add(this),Tr.set(this,void 0),ur.set(this,void 0),lr.set(this,void 0),Mi.set(this,void 0),Kr.set(this,void 0),Jr.set(this,void 0),Ci.set(this,void 0),ja.set(this,!1),Vs.set(this,void 0),Ni.set(this,void 0),Di.set(this,void 0),qt.set(this,void 0),qn.set(this,void 0),this.isSurrealDB=!1,ge(this,Tr,e,"f"),ge(this,qn,t,"f"),ge(this,lr,i,"f"),ge(this,Mi,new Set,"f"),ge(this,Ci,null,"f"),ge(this,Vs,new Promise((n,a)=>{ge(this,Ni,n,"f"),ge(this,Di,a,"f")}),"f")}async subscribe(){O(this,Jr,"f")&&(O(this,Jr,"f").call(this),ge(this,Jr,void 0,"f")),O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ge(this,qt,void 0,"f")),O(this,Kr,"f")&&(clearTimeout(O(this,Kr,"f")),ge(this,Kr,void 0,"f"));try{let t;this.isSurrealDB?t=await O(this,lr,"f").perspectiveSubscribeSurrealQuery(O(this,Tr,"f"),O(this,qn,"f")):t=await O(this,lr,"f").subscribeQuery(O(this,Tr,"f"),O(this,qn,"f")),ge(this,ur,t.subscriptionId,"f"),t.result?(ge(this,Ci,t.result,"f"),O(this,Bs,"m",Al).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ge(this,qt,setTimeout(()=>{console.error("Subscription initialization timed out after 30 seconds. Resubscribing..."),this.subscribe().catch(i=>{console.error("Error during subscription retry after timeout:",i)})},3e4),"f"),ge(this,Jr,O(this,lr,"f").subscribeToQueryUpdates(O(this,ur,"f"),i=>{O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ge(this,qt,void 0,"f")),O(this,Ni,"f")&&(O(this,Ni,"f").call(this,!0),ge(this,Ni,void 0,"f"),ge(this,Di,void 0,"f")),!(i.isInit&&O(this,Ci,"f"))&&(ge(this,Ci,i,"f"),O(this,Bs,"m",Al).call(this,i))}),"f")}catch(t){throw console.error("Error setting up subscription:",t),O(this,Di,"f")&&(O(this,Di,"f").call(this,t),ge(this,Ni,void 0,"f"),ge(this,Di,void 0,"f")),t}let e=async()=>{if(!O(this,ja,"f")){try{this.isSurrealDB?await O(this,lr,"f").perspectiveKeepAliveSurrealQuery(O(this,Tr,"f"),O(this,ur,"f")):await O(this,lr,"f").keepAliveQuery(O(this,Tr,"f"),O(this,ur,"f"))}catch(t){console.error("Error in keepalive:",t),console.log("Reinitializing subscription for query:",O(this,qn,"f"));try{await this.subscribe(),console.log("Subscription reinitialized")}catch(i){console.error("Error during resubscription from keepalive:",i);return}}O(this,ja,"f")||ge(this,Kr,setTimeout(e,3e4),"f")}};ge(this,Kr,setTimeout(e,3e4),"f")}get id(){return O(this,ur,"f")}get initialized(){return O(this,Vs,"f")}get result(){return O(this,Ci,"f")}onResult(e){return O(this,Mi,"f").add(e),()=>O(this,Mi,"f").delete(e)}dispose(){ge(this,ja,!0,"f"),clearTimeout(O(this,Kr,"f")),O(this,Jr,"f")&&O(this,Jr,"f").call(this),O(this,Mi,"f").clear(),O(this,qt,"f")&&(clearTimeout(O(this,qt,"f")),ge(this,qt,void 0,"f")),O(this,ur,"f")&&(this.isSurrealDB?O(this,lr,"f").perspectiveDisposeSurrealQuerySubscription(O(this,Tr,"f"),O(this,ur,"f")).catch(e=>console.error("Error disposing surreal query subscription:",e)):O(this,lr,"f").disposeQuerySubscription(O(this,Tr,"f"),O(this,ur,"f")).catch(e=>console.error("Error disposing query subscription:",e)))}};Tr=new WeakMap,ur=new WeakMap,lr=new WeakMap,Mi=new WeakMap,Kr=new WeakMap,Jr=new WeakMap,Ci=new WeakMap,ja=new WeakMap,Vs=new WeakMap,Ni=new WeakMap,Di=new WeakMap,qt=new WeakMap,qn=new WeakMap,Bs=new WeakSet,Al=function r(e){for(let t of O(this,Mi,"f"))try{t(e)}catch(i){console.error("Error in query subscription callback:",i)}};var Vn=class{constructor(e,t){pe.set(this,void 0),fe.set(this,void 0),$i.set(this,void 0),Ri.set(this,void 0),Li.set(this,void 0),qa.set(this,void 0),ge(this,$i,[],"f"),ge(this,Ri,[],"f"),ge(this,Li,[],"f"),ge(this,qa,[],"f"),ge(this,pe,e,"f"),ge(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,$i,"f")),O(this,fe,"f").addPerspectiveLinkRemovedListener(O(this,pe,"f").uuid,O(this,Ri,"f")),O(this,fe,"f").addPerspectiveLinkUpdatedListener(O(this,pe,"f").uuid,O(this,Li,"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,i,n){return await O(this,fe,"f").executeCommands(O(this,pe,"f").uuid,JSON.stringify(e),t,JSON.stringify(i),n)}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",i){return await O(this,fe,"f").addLink(O(this,pe,"f").uuid,e,t,i)}async addLinks(e,t="shared",i){return await O(this,fe,"f").addLinks(O(this,pe,"f").uuid,e,t,i)}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",i){return await O(this,fe,"f").addLinkExpression(O(this,pe,"f").uuid,e,t,i)}async update(e,t,i){return await O(this,fe,"f").updateLink(O(this,pe,"f").uuid,e,t,i)}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,$i,"f").push(t):e==="link-removed"?O(this,Ri,"f").push(t):e==="link-updated"&&O(this,Li,"f").push(t)}async addSyncStateChangeListener(e){O(this,qa,"f").push(e)}async removeListener(e,t){if(e==="link-added"){let i=O(this,$i,"f").indexOf(t);O(this,$i,"f").splice(i,1)}else if(e==="link-removed"){let i=O(this,Ri,"f").indexOf(t);O(this,Ri,"f").splice(i,1)}else if(e==="link-updated"){let i=O(this,Li,"f").indexOf(t);O(this,Li,"f").splice(i,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(i=>{delete i.data.__typename});for(let i of t.links)await this.addLinkExpression(i)}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 i=new Ee({source:e.source,predicate:e.predicate}),n=await this.get(i),a=[];for(let s of n)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 Ee({source:"ad4m://self",predicate:"ad4m://has_flow"}))).map(t=>{try{return we.fromUrl(t.data.target).get()}catch{return t.data.target}})}async availableFlows(e){let t=await this.sdnaFlows(),i=[];for(let n of t){let a=await this.getFlow(n);if(!!a)if(a.flowable==="any")i.push(n);else{let o=a.flowable,s=o.source||e;(await this.get(new Ee({source:s,predicate:o.predicate,target:o.target}))).length>0&&i.push(n)}}return i}async startFlow(e,t){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;if(i.startAction.length===0)throw`Flow "${e}" has no start action`;await this.executeAction(i.startAction,t,void 0)}async expressionsInFlowState(e,t){let i=await this.getFlow(e);if(!i)return[];let n=i.states.find(s=>s.value===t);if(!n)return[];let a=n.stateCheck;return(await this.get(new Ee({predicate:a.predicate,target:a.target}))).map(s=>a.source?s.data.target:s.data.source)}async flowState(e,t){let i=await this.getFlow(e);if(!i)throw`Flow "${e}" not found`;for(let n of i.states){let a=n.stateCheck,o=a.source||t;if((await this.get(new Ee({source:o,predicate:a.predicate,target:a.target}))).length>0)return n.value}throw`Expression "${t}" is not in any state of flow "${e}"`}async flowActions(e,t){let i=await this.getFlow(e);if(!i)return[];let n=null;for(let a of i.states){let o=a.stateCheck,s=o.source||t;if((await this.get(new Ee({source:s,predicate:o.predicate,target:o.target}))).length>0){n=a.name;break}}return n?i.transitions.filter(a=>a.fromState===n).map(a=>a.actionName):[]}async runFlowAction(e,t,i){let n=await this.getFlow(e);if(!n)throw`Flow "${e}" not found`;let a=n.transitions.find(o=>o.actionName===i);if(!a)throw`Action "${i}" 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 i of e){let n=await this.get(new Ee({source:"ad4m://self",predicate:i}));for(let a of n){let o=a.data.target,s=await this.get(new Ee({source:o,predicate:"ad4m://sdna"}));for(let c of s){let u=we.fromUrl(c.data.target).get();typeof u=="string"&&t.push(u)}}}return t}async getSdnaForClass(e){let t=we.from(e);if((await this.get(new Ee({source:"ad4m://self",target:t.toUrl(),predicate:"ad4m://has_subject_class"}))).length===0)return null;let n=await this.get(new Ee({source:t.toUrl(),predicate:"ad4m://sdna"}));if(n.length===0)return null;let a=we.fromUrl(n[0].data.target).get();return typeof a=="string"?a:null}async addSdna(e,t,i,n){return O(this,fe,"f").addSdna(O(this,pe,"f").uuid,e,t,i,n)}async addShacl(e,t){let i=t.toLinks(),n=we.fromUrl(`literal://string:shacl://${e}`),a=[...i.map(o=>new Ot({source:o.source,predicate:o.predicate,target:o.target})),new Ot({source:"ad4m://self",predicate:"ad4m://has_shacl",target:n.toUrl()}),new Ot({source:n.toUrl(),predicate:"ad4m://shacl_shape_uri",target:t.nodeShapeUri})];await this.addLinks(a)}async getShacl(e){let t=we.fromUrl(`literal://string:shacl://${e}`),i=await this.get(new Ee({source:t.toUrl(),predicate:"ad4m://shacl_shape_uri"}));if(i.length===0)return null;let n=i[0].data.target;ve(n);let a=await this.get(new Ee({source:n,predicate:"sh://property"})),c=`SELECT in.uri AS source, predicate, out.uri AS target FROM link WHERE in.uri IN [${[n,...a.map(f=>f.data.target)].map(f=>`'${ve(f)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(f=>({source:f.source,predicate:f.predicate,target:f.target}));return ri.fromLinks(l,n)}async getAllShacl(){let e=await this.get(new Ee({source:"ad4m://self",predicate:"ad4m://has_shacl"})),t=[];for(let i of e){let n=i.data.target,o=we.fromUrl(n).get().replace("shacl://",""),s=await this.getShacl(o);s&&t.push({name:o,shape:s})}return t}async addFlow(e,t){let i=t.toLinks(),n=we.from(e).toUrl(),a=[...i.map(o=>new Ot({source:o.source,predicate:o.predicate,target:o.target})),new Ot({source:"ad4m://self",predicate:"ad4m://has_flow",target:n}),new Ot({source:n,predicate:"ad4m://flow_uri",target:t.flowUri})];await this.addLinks(a)}async getFlow(e){let t=we.from(e).toUrl(),i=await this.get(new Ee({source:t,predicate:"ad4m://flow_uri"}));if(i.length===0)return null;let n=i[0].data.target,a=ve(n),o=n.endsWith("Flow")?n.slice(0,-4)+".":n+".",s=ve(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(f=>({source:f.source,predicate:f.predicate,target:f.target}));return Kn.fromLinks(l,n)}async subjectClasses(){try{let t=(await this.get(new Ee({predicate:"rdf://type",target:"ad4m://SubjectClass"}))).map(i=>{let a=i.data.source.split("://");return a[a.length-1].split("/").pop()||""}).filter(i=>i.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,i,n){let a;if(typeof e=="string")a=e,await O(this,fe,"f").createSubject(O(this,pe,"f").uuid,JSON.stringify({className:a,initialValues:i}),t,i?JSON.stringify(i):void 0,n);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:i}),t,i?JSON.stringify(i):void 0,n)}return n?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 i=e,n=i.className||i.constructor?.className||i.constructor?.prototype?.className||await this.findClassByProperties(i);if(!n)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:n}),t))}async getActionsFromSHACL(e,t){let i=this.escapeRegExp(e),n=new RegExp(`[/:#]${i}Shape$`),a=await this.get(new Ee({predicate:t}));for(let o of a)if(n.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,i){let n=await this.stringOrTemplateObjectToSubjectClassName(e),a=await this.getActionsFromSHACL(n,"ad4m://destructor");if(!a)throw`No destructor found for subject class: ${n}. Make sure the class was registered with SHACL.`;await this.executeAction(a,t,void 0,i)}async isSubjectInstance(e,t){let i=await this.stringOrTemplateObjectToSubjectClassName(t),n=await this.getSubjectClassMetadataFromSDNA(i);if(!n)return console.warn(`isSubjectInstance: No SHACL metadata found for class ${i}`),!1;if(n.requiredTriples.length===0){let o=`SELECT count() AS count FROM link WHERE in.uri = '${ve(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 n.requiredTriples){let o=ve(e),s=ve(a.predicate),c;if(a.target){let d=ve(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${d}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}'`;let u=await this.querySurrealDB(c);if(!u||u.length===0)return!1;let l=u[0]?.count??0;if((typeof l=="object"&&l?.Int!==void 0?l.Int:l)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let i=await this.stringOrTemplateObjectToSubjectClassName(t),n=new Qn(this,e,i);return await n.init(),n}async getSubjectClassMetadataFromSDNA(e){try{let t=await this.getShacl(e);if(!t)return console.warn(`No SHACL metadata found for ${e}`),null;let i=[],n=[],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){i.push(c.predicate);let u=s.has(c.predicate);c.target&&c.target!=="value"&&!u?n.push({predicate:c.predicate,target:c.target}):n.push({predicate:c.predicate})}}return{requiredPredicates:i,requiredTriples:n,properties:a,collections:o}}catch(t){return console.error(`Error getting SHACL metadata for ${e}:`,t),null}}generateSurrealInstanceQuery(e){return e.requiredTriples.length===0?"SELECT DISTINCT uri AS base FROM node WHERE count(->link) > 0":`SELECT uri AS base FROM node WHERE ${e.requiredTriples.map(i=>{let n=ve(i.predicate);if(i.target){let a=ve(i.target);return`count(->link[WHERE predicate = '${n}' AND out.uri = '${a}']) > 0`}else return`count(->link[WHERE predicate = '${n}']) > 0`}).join(" AND ")}`}async getPropertyValueViaSurreal(e,t,i){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return;let a=n.properties.get(i);if(!a)return;let o=ve(e),s=ve(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 f=await this.getExpression(l);try{return JSON.parse(f.data)}catch{return f.data}}catch{return l}return l}async getCollectionValuesViaSurreal(e,t,i){let n=await this.getSubjectClassMetadataFromSDNA(t);if(!n)return[];let a=n.collections.get(i);if(!a)return[];let o=ve(e),s=ve(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(f=>f.value).filter(f=>f!==""&&f!=="");if(a.condition&&l.length>0)try{let f=[];for(let d of l){let p=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${d.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)&&f.push(d)}l=f}catch(f){console.warn(`Failed to apply condition filter for ${i}:`,f)}if(a.instanceFilter)try{let f=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return f?await this.batchCheckSubjectInstances(l,f):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=>`'${ve(c)}'`).join(", ")}] GROUP BY in.uri HAVING count() > 0`;return(await this.querySurrealDB(o)).map(c=>c.uri)}let i=[];for(let a of t.requiredTriples){let o=e.map(l=>`'${ve(l)}'`).join(", "),s=ve(a.predicate),c;if(a.target){let l=ve(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);i.push(new Set(u.map(l=>l.uri)))}return i.length===0?e:e.filter(a=>i.every(o=>o.has(a)))}async filterInstancesSequential(e,t){let i=[];for(let n of e)try{await this.isSubjectInstance(n,t)&&i.push(n)}catch{continue}return i}async getAllSubjectInstances(e){let t=[],i=typeof e=="function";typeof e=="string"?t=[e]:i?t=[e.name]:t=await this.subjectClassesByTemplate(e);let n=[];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;i?(l=new e(this,u.base),await l.get()):(l=new Qn(this,u.base,a),await l.init()),n.push(l)}catch{}}}return n}async getAllSubjectProxies(e){let t=[];typeof e=="string"?t=[e]:t=await this.subjectClassesByTemplate(e);let i=[];for(let n of t){let a=await this.getSubjectClassMetadataFromSDNA(n);if(a){let o=this.generateSurrealInstanceQuery(a),s=await this.querySurrealDB(o);for(let c of s||[])try{let u=new Qn(this,c.base,n);await u.init(),i.push(u)}catch{}}}return i}async findClassByProperties(e){let t=[],i=[],n=Object.getPrototypeOf(e);if(n?.__properties?t=Object.keys(n.__properties):t=Object.keys(e).filter(c=>!Array.isArray(e[c])),n?.__collections?i=Object.keys(n.__collections).filter(c=>c!=="isSubjectInstance"):i=Object.keys(e).filter(c=>Array.isArray(e[c])&&c!=="isSubjectInstance"),t.length===0&&i.length===0)return null;let a=`SELECT
|
|
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=Nf(this.targetClass),o=Df(this.targetClass);i=`${a}${o}.${n.name}`}else i=`_:propShape${t}`;e.push({source:this.nodeShapeUri,predicate:"sh://property",target:i}),e.push({source:i,predicate:"sh://path",target:n.path}),n.datatype&&e.push({source:i,predicate:"sh://datatype",target:n.datatype}),n.nodeKind&&e.push({source:i,predicate:"sh://nodeKind",target:`sh://${n.nodeKind}`}),n.minCount!==void 0&&e.push({source:i,predicate:"sh://minCount",target:`literal://${n.minCount}^^xsd:integer`}),n.maxCount!==void 0&&e.push({source:i,predicate:"sh://maxCount",target:`literal://${n.maxCount}^^xsd:integer`}),n.pattern&&e.push({source:i,predicate:"sh://pattern",target:`literal://${n.pattern}`}),n.minInclusive!==void 0&&e.push({source:i,predicate:"sh://minInclusive",target:`literal://${n.minInclusive}`}),n.maxInclusive!==void 0&&e.push({source:i,predicate:"sh://maxInclusive",target:`literal://${n.maxInclusive}`}),n.hasValue&&e.push({source:i,predicate:"sh://hasValue",target:`literal://${n.hasValue}`}),n.local!==void 0&&e.push({source:i,predicate:"ad4m://local",target:`literal://${n.local}`}),n.writable!==void 0&&e.push({source:i,predicate:"ad4m://writable",target:`literal://${n.writable}`}),n.resolveLanguage&&e.push({source:i,predicate:"ad4m://resolveLanguage",target:`literal://string:${n.resolveLanguage}`}),n.setter&&n.setter.length>0&&e.push({source:i,predicate:"ad4m://setter",target:`literal://string:${JSON.stringify(n.setter)}`}),n.adder&&n.adder.length>0&&e.push({source:i,predicate:"ad4m://adder",target:`literal://string:${JSON.stringify(n.adder)}`}),n.remover&&n.remover.length>0&&e.push({source:i,predicate:"ad4m://remover",target:`literal://string:${JSON.stringify(n.remover)}`})}return e}static fromLinks(e,t){let n=e.find(c=>c.source===t&&c.predicate==="sh://targetClass"),i=new 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 f;if(!u.startsWith("_:")){let k=u.lastIndexOf(".");k!==-1&&(f=u.substring(k+1))}let d={name:f,path:l.target},p=e.find(k=>k.source===u&&k.predicate==="sh://datatype");p&&(d.datatype=p.target);let h=e.find(k=>k.source===u&&k.predicate==="sh://nodeKind");h&&(d.nodeKind=h.target.replace("sh://",""));let m=e.find(k=>k.source===u&&k.predicate==="sh://minCount");if(m){let k=m.target.replace("literal://","").replace(/\^\^.*$/,"");k.startsWith("number:")&&(k=k.substring(7)),d.minCount=parseInt(k)}let g=e.find(k=>k.source===u&&k.predicate==="sh://maxCount");if(g){let k=g.target.replace("literal://","").replace(/\^\^.*$/,"");k.startsWith("number:")&&(k=k.substring(7)),d.maxCount=parseInt(k)}let w=e.find(k=>k.source===u&&k.predicate==="sh://pattern");w&&(d.pattern=w.target.replace("literal://",""));let b=e.find(k=>k.source===u&&k.predicate==="sh://minInclusive");if(b){let k=b.target.replace("literal://","");k.startsWith("number:")&&(k=k.substring(7)),d.minInclusive=parseFloat(k)}let v=e.find(k=>k.source===u&&k.predicate==="sh://maxInclusive");if(v){let k=v.target.replace("literal://","");k.startsWith("number:")&&(k=k.substring(7)),d.maxInclusive=parseFloat(k)}let y=e.find(k=>k.source===u&&k.predicate==="sh://hasValue");y&&(d.hasValue=y.target.replace("literal://",""));let I=e.find(k=>k.source===u&&k.predicate==="ad4m://local");if(I){let k=I.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),d.local=k==="true"}let $=e.find(k=>k.source===u&&k.predicate==="ad4m://writable");if($){let k=$.target.replace("literal://","");k.startsWith("boolean:")&&(k=k.substring(8)),d.writable=k==="true"}let A=e.find(k=>k.source===u&&k.predicate==="ad4m://resolveLanguage");A&&(d.resolveLanguage=A.target.replace("literal://string:",""));let R=e.find(k=>k.source===u&&k.predicate==="ad4m://setter");if(R)try{let k=R.target.replace("literal://string:","");d.setter=JSON.parse(k)}catch{}let P=e.find(k=>k.source===u&&k.predicate==="ad4m://adder");if(P)try{let k=P.target.replace("literal://string:","");d.adder=JSON.parse(k)}catch{}let D=e.find(k=>k.source===u&&k.predicate==="ad4m://remover");if(D)try{let k=D.target.replace("literal://string:","");d.remover=JSON.parse(k)}catch{}i.addProperty(d)}return i}toJSON(){return{node_shape_uri:this.nodeShapeUri,target_class:this.targetClass,parent_shapes:this.parentShapes.length>0?this.parentShapes:void 0,properties:this.properties.map(e=>({path:e.path,name:e.name,datatype:e.datatype,node_kind:e.nodeKind,min_count:e.minCount,max_count:e.maxCount,min_inclusive:e.minInclusive,max_inclusive:e.maxInclusive,pattern:e.pattern,has_value:e.hasValue,local:e.local,writable:e.writable,resolve_language:e.resolveLanguage,setter:e.setter,adder:e.adder,remover:e.remover})),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});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}},gr=new WeakMap,at=new WeakMap;function Qn(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 sb(r,e,t){gr.has(r)||gr.set(r,{}),gr.get(r)[e]=t}function cb(r,e,t){at.has(r)||at.set(r,{}),at.get(r)[e]=t}function XT(r){let e=r.constructor,t=Qn(e),n={};for(let[i,a]of Object.entries(t))n[i]=r[i];return n}function tm(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 Rf=class{};function eO(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function tO(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 rO(r){return kc({...r,required:r.required??!1,readOnly:r.readOnly??!1})}function nO(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 ub(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=tm(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=Qn(e);for(let m in l){let g=`property(${a}, "${m}").
|
|
87
|
+
`,{through:w,initial:b,required:v,resolveLanguage:y,writable:I,flag:$,prologGetter:A,prologSetter:R,local:P}=l[m];if(y&&(g+=`property_resolve(${a}, "${m}").
|
|
88
|
+
`,g+=`property_resolve_language(${a}, "${m}", "${y}").
|
|
89
|
+
`),A?g+=`property_getter(${a}, Base, "${m}", Value) :- ${A}.
|
|
90
|
+
`:w&&(g+=`property_getter(${a}, Base, "${m}", Value) :- triple(Base, "${w}", Value).
|
|
91
|
+
`,v&&($?c.push(`triple(Base, "${w}", "${b}")`):c.push(`triple(Base, "${w}", _)`))),R)g+=`property_setter(${a}, "${m}", Actions) :- ${R}.
|
|
92
|
+
`;else if(I&&w&&typeof i[lc(m)]=="function"){let Te=[{action:"setSingleTarget",source:"this",predicate:w,target:"value",...P&&{local:!0}}];g+=`property_setter(${a}, "${m}", '${Nn(Te)}').
|
|
93
|
+
`}u.push(g);let D=b??(v&&I&&!$&&w?"literal://string:":void 0);D&&(s.push({action:"addLink",source:"this",predicate:w,target:D}),o.push({action:"removeLink",source:"this",predicate:w,target:"*"}))}let f=[],d=dr(e),p=Object.fromEntries(Object.entries(d).filter(([,m])=>m.kind==="hasMany"||m.kind==="belongsToMany"));for(let m in p){let g=`collection(${a}, "${m}").
|
|
94
|
+
`,{predicate:w,local:b}=p[m];if(w){g+=`collection_getter(${a}, Base, "${m}", List) :- findall(C, triple(Base, "${w}", C), List).
|
|
95
|
+
`;let v=[{action:"addLink",source:"this",predicate:w,target:"value",...b&&{local:!0}}],y=[{action:"removeLink",source:"this",predicate:w,target:"value"}],I=[{action:"collectionSetter",source:"this",predicate:w,target:"value",...b&&{local:!0}}];g+=`collection_adder(${a}, "${m}", '${Nn(v)}').
|
|
96
|
+
`,g+=`collection_remover(${a}, "${m}", '${Nn(y)}').
|
|
97
|
+
`,g+=`collection_setter(${a}, "${m}", '${Nn(I)}').
|
|
98
|
+
`}f.push(g)}let h=Nn(s);if(t+=`constructor(${a}, '${h}').
|
|
99
|
+
`,c.length>0){let m=c.join(", ");t+=`instance(${a}, Base) :- ${m}.
|
|
100
|
+
`,t+=`
|
|
101
|
+
`}return t+=`destructor(${a}, '${Nn(o)}').
|
|
102
|
+
`,t+=`
|
|
103
|
+
`,t+=u.join(`
|
|
104
|
+
`),t+=`
|
|
105
|
+
`,t+=f.join(`
|
|
106
|
+
`),{sdna:t,name:n}},e.generateSHACL=function(){let t=r.name,n=e.prototype,i="ad4m://",a=Qn(e),o=dr(e),s=Object.fromEntries(Object.entries(o).filter(([,h])=>h.kind==="hasMany"||h.kind==="belongsToMany"));if(Object.keys(a).length>0){let h=a[Object.keys(a)[0]];if(h.through){let m=h.through.match(/^([^:]+:\/\/)/);m&&(i=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&&(i=m[1])}}let c=`${i}${t}Shape`,u=`${i}${t}`,l=new nn(c,u),f=Object.getPrototypeOf(e);if(f&&typeof f.generateSHACL=="function"){let h=f.generateSHACL();h?.shape?.nodeShapeUri&&l.addParentShape(h.shape.nodeShapeUri)}let d=[];n.subjectConstructor&&n.subjectConstructor.length&&(d=d.concat(n.subjectConstructor));let p=[];for(let h in a){let m=a[h];if(!m.through)continue;let g={name:h,path:m.through};if(m.resolveLanguage==="literal")g.datatype="xsd://string";else if(m.initial){let b=typeof n[h];b==="number"?g.datatype="xsd://integer":b==="boolean"?g.datatype="xsd://boolean":b==="string"&&(g.datatype="xsd://string")}m.required&&(g.minCount=1),g.maxCount=1,m.flag&&m.initial&&(g.hasValue=m.initial),m.local!==void 0&&(g.local=m.local),m.writable!==void 0&&(g.writable=m.writable),m.resolveLanguage&&(g.resolveLanguage=m.resolveLanguage),m.prologSetter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${h}' 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.`):m.writable&&m.through&&typeof n[lc(h)]=="function"&&(g.setter=[{action:"setSingleTarget",source:"this",predicate:m.through,target:"value",...m.local&&{local:!0}}]);let w=m.initial??(m.required&&m.writable&&!m.flag&&m.through?"literal://string:":void 0);w&&(d.push({action:"addLink",source:"this",predicate:m.through,target:w}),p.push({action:"removeLink",source:"this",predicate:m.through,target:"*"})),l.addProperty(g)}for(let h in s){let m=s[h];if(!m.predicate)continue;let g={name:h,path:m.predicate};g.nodeKind="IRI",m.local!==void 0&&(g.local=m.local),g.adder=[{action:"addLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],g.remover=[{action:"removeLink",source:"this",predicate:m.predicate,target:"value",...m.local&&{local:!0}}],l.addProperty(g)}return l.setConstructorActions(d),l.setDestructorActions(p),{shape:l,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function lb(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 iO(r){return lb({...r,readOnly:!0})}function Ac(r,e){let t=typeof r=="function"?{...e,target:r}:r;if(!t.through)throw new Error("Relation decorator requires a { through: '...' } option specifying the predicate URI.");return t}function aO(r,e){let t=Ac(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}};let s=i;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 oO(r,e){let t=Ac(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},kc({through:t.through,readOnly:!1,local:t.local})(n,i);let s=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)}}}function sO(r,e){let t=Ac(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},kc({through:t.through,readOnly:!0,local:t.local})(n,i)}}function cO(r,e){let t=Ac(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}},Object.defineProperty(n,i,{configurable:!0,writable:!0})}}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 ue(r){return r.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}var Ki=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 Ki(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 f=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasState"),d=new Map;for(let h of f){let m=h.target,g=e.find($=>$.source===m&&$.predicate==="ad4m://stateName"),w=g?Se.fromUrl(g.target).get():"";d.set(m,w);let b=e.find($=>$.source===m&&$.predicate==="ad4m://stateValue"),v=b?Se.fromUrl(b.target).get():0,y=e.find($=>$.source===m&&$.predicate==="ad4m://stateCheck"),I={predicate:"",target:""};if(y)try{let $=y.target.replace("literal://string:","");I=JSON.parse(decodeURIComponent($))}catch{}c.addState({name:w,value:v,stateCheck:I})}let p=e.filter(h=>h.source===t&&h.predicate==="ad4m://hasTransition");for(let h of p){let m=h.target,g=e.find(D=>D.source===m&&D.predicate==="ad4m://actionName"),w=g?Se.fromUrl(g.target).get():"",v=e.find(D=>D.source===m&&D.predicate==="ad4m://fromState")?.target||"",y=d.get(v)||"",$=e.find(D=>D.source===m&&D.predicate==="ad4m://toState")?.target||"",A=d.get($)||"",R=e.find(D=>D.source===m&&D.predicate==="ad4m://transitionActions"),P=[];if(R)try{let D=R.target.replace("literal://string:","");P=JSON.parse(decodeURIComponent(D))}catch{}c.addTransition({actionName:w,fromState:y,toState:A,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 Ki(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)},Vs,Cr,ur,lr,jn,Zr,Yr,$n,ja,Qs,Dn,Rn,Ut,Bi,Al,le,de,Ln,Pn,Fn,qa,pc=class{constructor(e,t,n){Vs.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),ja.set(this,!1),Qs.set(this,void 0),Dn.set(this,void 0),Rn.set(this,void 0),Ut.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,jn,new Set,"f"),ge(this,$n,null,"f"),ge(this,Qs,new Promise((i,a)=>{ge(this,Dn,i,"f"),ge(this,Rn,a,"f")}),"f")}async subscribe(){O(this,Yr,"f")&&(O(this,Yr,"f").call(this),ge(this,Yr,void 0,"f")),O(this,Ut,"f")&&(clearTimeout(O(this,Ut,"f")),ge(this,Ut,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,$n,t.result,"f"),O(this,Vs,"m",Al).call(this,t.result)):console.warn("\u26A0\uFE0F No initial result returned from subscribeQuery!"),ge(this,Ut,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,Ut,"f")&&(clearTimeout(O(this,Ut,"f")),ge(this,Ut,void 0,"f")),O(this,Dn,"f")&&(O(this,Dn,"f").call(this,!0),ge(this,Dn,void 0,"f"),ge(this,Rn,void 0,"f")),!(n.isInit&&O(this,$n,"f"))&&(ge(this,$n,n,"f"),O(this,Vs,"m",Al).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),ge(this,Dn,void 0,"f"),ge(this,Rn,void 0,"f")),t}let e=async()=>{if(!O(this,ja,"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,ja,"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,Qs,"f")}get result(){return O(this,$n,"f")}onResult(e){return O(this,jn,"f").add(e),()=>O(this,jn,"f").delete(e)}dispose(){ge(this,ja,!0,"f"),clearTimeout(O(this,Zr,"f")),O(this,Yr,"f")&&O(this,Yr,"f").call(this),O(this,jn,"f").clear(),O(this,Ut,"f")&&(clearTimeout(O(this,Ut,"f")),ge(this,Ut,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,ja=new WeakMap,Qs=new WeakMap,Dn=new WeakMap,Rn=new WeakMap,Ut=new WeakMap,Bi=new WeakMap,Vs=new WeakSet,Al=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 Qi=class{constructor(e,t){le.set(this,void 0),de.set(this,void 0),Ln.set(this,void 0),Pn.set(this,void 0),Fn.set(this,void 0),qa.set(this,void 0),ge(this,Ln,[],"f"),ge(this,Pn,[],"f"),ge(this,Fn,[],"f"),ge(this,qa,[],"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,Ln,"f")),O(this,de,"f").addPerspectiveLinkRemovedListener(O(this,le,"f").uuid,O(this,Pn,"f")),O(this,de,"f").addPerspectiveLinkUpdatedListener(O(this,le,"f").uuid,O(this,Fn,"f")),O(this,de,"f").addPerspectiveSyncStateChangeListener(O(this,le,"f").uuid,O(this,qa,"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,Ln,"f").push(t):e==="link-removed"?O(this,Pn,"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,Ln,"f").indexOf(t);O(this,Ln,"f").splice(n,1)}else if(e==="link-removed"){let n=O(this,Pn,"f").indexOf(t);O(this,Pn,"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,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;ue(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(f=>f.data.target)].map(f=>`'${ue(f)}'`).join(", ")}]`,l=(await this.querySurrealDB(c)||[]).map(f=>({source:f.source,predicate:f.predicate,target:f.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=ue(i),o=i.endsWith("Flow")?i.slice(0,-4)+".":i+".",s=ue(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(f=>({source:f.source,predicate:f.predicate,target:f.target}));return Ki.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 = '${ue(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=ue(e),s=ue(a.predicate),c;if(a.target){let d=ue(a.target);c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}' AND out.uri = '${d}'`}else c=`SELECT count() AS count FROM link WHERE in.uri = '${o}' AND predicate = '${s}'`;let u=await this.querySurrealDB(c);if(!u||u.length===0)return!1;let l=u[0]?.count??0;if((typeof l=="object"&&l?.Int!==void 0?l.Int:l)===0)return!1}return!0}async getSubjectProxy(e,t){if(!await this.isSubjectInstance(e,t))throw`Expression ${e} is not a subject instance of given class: ${JSON.stringify(t)}`;let n=await this.stringOrTemplateObjectToSubjectClassName(t),i=new io(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=ue(n.predicate);if(n.target){let a=ue(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=ue(e),s=ue(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 f=await this.getExpression(l);try{return JSON.parse(f.data)}catch{return f.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=ue(e),s=ue(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(f=>f.value).filter(f=>f!==""&&f!=="");if(a.condition&&l.length>0)try{let f=[];for(let d of l){let p=a.condition.replace(/\$perspective/g,`'${this.uuid}'`).replace(/\$base/g,`'${e}'`).replace(/Target/g,`'${d.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)&&f.push(d)}l=f}catch(f){console.warn(`Failed to apply condition filter for ${n}:`,f)}if(a.instanceFilter)try{let f=await this.getSubjectClassMetadataFromSDNA(a.instanceFilter);return f?await this.batchCheckSubjectInstances(l,f):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=>`'${ue(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=>`'${ue(l)}'`).join(", "),s=ue(a.predicate),c;if(a.target){let l=ue(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 io(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 io(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?Qn(a):{};Object.keys(o).length>0?t=Object.keys(o):t=Object.keys(e).filter(f=>!Array.isArray(e[f]));let s=a?Object.fromEntries(Object.entries(dr(a)).filter(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany")):{};if(Object.keys(s).length>0?n=Object.keys(s).filter(f=>f!=="isSubjectInstance"):n=Object.keys(e).filter(f=>Array.isArray(e[f])&&f!=="isSubjectInstance"),t.length===0&&n.length===0)return null;let c=`SELECT
|
|
85
107
|
in.uri AS shape_source,
|
|
86
108
|
predicate,
|
|
87
109
|
out.uri AS target
|
|
88
110
|
FROM link
|
|
89
|
-
WHERE predicate IN ['rdf://type', 'sh://property', 'sh://collection']`,
|
|
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 f of u)if(f.predicate==="rdf://type"&&f.target==="ad4m://SubjectClass"){let d=f.shape_source,p=d.indexOf("://");if(p<0)continue;let h=d.substring(p+3).split("/").pop();if(!h)continue;l.set(h,{shapeUri:d,properties:[],relations:[]})}for(let f of u)if(f.predicate==="sh://property"||f.predicate==="sh://collection"){for(let[d,p]of l)if(f.shape_source.endsWith(`${d}Shape`)){let h=f.target.lastIndexOf(".");if(h<0)continue;let m=f.target.substring(h+1);f.predicate==="sh://property"?p.properties.push(m):p.relations.push(m)}}for(let[f,d]of l){let p=t.every(m=>d.properties.includes(m)),h=n.every(m=>d.relations.includes(m));if(p&&h)return f}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 pc(this.uuid,e,O(this,de,"f"));return await t.subscribe(),await t.initialized,t}async subscribeSurrealDB(e){let t=new pc(this.uuid,e,O(this,de,"f"));return t.isSurrealDB=!0,await t.subscribe(),await t.initialized,t}};le=new WeakMap,de=new WeakMap,Ln=new WeakMap,Pn=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},B=function(r,e,t,n){if(t==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?n:t==="a"?n.call(r):n?n.value:e.get(r)},ee,Ba,Va,Qa,zs,za,Ws,Hs,ut=`
|
|
90
112
|
author
|
|
91
113
|
timestamp
|
|
92
114
|
status
|
|
93
115
|
data { source, predicate, target }
|
|
94
116
|
proof { valid, invalid, signature, key }
|
|
95
|
-
`,
|
|
117
|
+
`,Pi=`
|
|
96
118
|
uuid
|
|
97
119
|
name
|
|
98
120
|
sharedUrl
|
|
@@ -113,139 +135,139 @@ neighbourhood {
|
|
|
113
135
|
}
|
|
114
136
|
author
|
|
115
137
|
}
|
|
116
|
-
`,
|
|
138
|
+
`,dc=class{constructor(e,t=!0){ee.set(this,void 0),Ba.set(this,void 0),Va.set(this,void 0),Qa.set(this,void 0),zs.set(this,void 0),za.set(this,void 0),Ws.set(this,void 0),Hs.set(this,void 0),Gr(this,ee,e,"f"),Gr(this,Ba,[],"f"),Gr(this,Va,[],"f"),Gr(this,Qa,[],"f"),Gr(this,zs,[],"f"),t&&(this.subscribePerspectiveAdded(),this.subscribePerspectiveUpdated(),this.subscribePerspectiveRemoved())}setExpressionClient(e){Gr(this,za,e,"f")}setNeighbourhoodClient(e){Gr(this,Ws,e,"f")}setAIClient(e){Gr(this,Hs,e,"f")}get aiClient(){return B(this,Hs,"f")}async all(){let{perspectives:e}=T(await B(this,ee,"f").query({query:x`query perspectives {
|
|
117
139
|
perspectives {
|
|
118
|
-
${
|
|
140
|
+
${Pi}
|
|
119
141
|
}
|
|
120
|
-
}`}));return e.map(t=>new
|
|
142
|
+
}`}));return e.map(t=>new Qi(t,this))}async byUUID(e){let{perspective:t}=T(await B(this,ee,"f").query({query:x`query perspective($uuid: String!) {
|
|
121
143
|
perspective(uuid: $uuid) {
|
|
122
|
-
${
|
|
144
|
+
${Pi}
|
|
123
145
|
}
|
|
124
|
-
}`,variables:{uuid:e}}));return t?new
|
|
146
|
+
}`,variables:{uuid:e}}));return t?new Qi(t,this):null}async snapshotByUUID(e){let{perspectiveSnapshot:t}=T(await B(this,ee,"f").query({query:x`query perspectiveSnapshot($uuid: String!) {
|
|
125
147
|
perspectiveSnapshot(uuid: $uuid) {
|
|
126
|
-
links { ${
|
|
148
|
+
links { ${ut} }
|
|
127
149
|
}
|
|
128
|
-
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=
|
|
150
|
+
}`,variables:{uuid:e}}));return t}async publishSnapshotByUUID(e){let{perspectivePublishSnapshot:t}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectivePublishSnapshot($uuid: String!) {
|
|
129
151
|
perspectivePublishSnapshot(uuid: $uuid)
|
|
130
|
-
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:
|
|
152
|
+
}`,variables:{uuid:e}}));return t}async queryLinks(e,t){let{perspectiveQueryLinks:n}=T(await B(this,ee,"f").query({query:x`query perspectiveQueryLinks($uuid: String!, $query: LinkQuery!) {
|
|
131
153
|
perspectiveQueryLinks(query: $query, uuid: $uuid) {
|
|
132
|
-
${
|
|
154
|
+
${ut}
|
|
133
155
|
}
|
|
134
|
-
}`,variables:{uuid:e,query:t}}));return
|
|
156
|
+
}`,variables:{uuid:e,query:t}}));return n}async queryProlog(e,t){let{perspectiveQueryProlog:n}=T(await B(this,ee,"f").query({query:x`query perspectiveQueryProlog($uuid: String!, $query: String!) {
|
|
135
157
|
perspectiveQueryProlog(uuid: $uuid, query: $query)
|
|
136
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(
|
|
158
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async querySurrealDB(e,t){let{perspectiveQuerySurrealDb:n}=T(await B(this,ee,"f").query({query:x`query perspectiveQuerySurrealDb($uuid: String!, $query: String!) {
|
|
137
159
|
perspectiveQuerySurrealDb(uuid: $uuid, query: $query)
|
|
138
|
-
}`,variables:{uuid:e,query:t}}));return JSON.parse(
|
|
160
|
+
}`,variables:{uuid:e,query:t}}));return JSON.parse(n)}async subscribeQuery(e,t){let{perspectiveSubscribeQuery:n}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveSubscribeQuery($uuid: String!, $query: String!) {
|
|
139
161
|
perspectiveSubscribeQuery(uuid: $uuid, query: $query) {
|
|
140
162
|
subscriptionId
|
|
141
163
|
result
|
|
142
164
|
}
|
|
143
|
-
}`,variables:{uuid:e,query:t}})),{subscriptionId:
|
|
165
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveSubscribeSurrealQuery(e,t){let{perspectiveSubscribeSurrealQuery:n}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveSubscribeSurrealQuery($uuid: String!, $query: String!) {
|
|
144
166
|
perspectiveSubscribeSurrealQuery(uuid: $uuid, query: $query) {
|
|
145
167
|
subscriptionId
|
|
146
168
|
result
|
|
147
169
|
}
|
|
148
|
-
}`,variables:{uuid:e,query:t}})),{subscriptionId:
|
|
170
|
+
}`,variables:{uuid:e,query:t}})),{subscriptionId:i,result:a}=n,o=a,s=!1;o.startsWith("#init#")&&(o=o.substring(6),s=!0);try{o=JSON.parse(o)}catch(c){console.error("Error parsing perspectiveSubscribeSurrealQuery result:",c)}return{subscriptionId:i,result:o,isInit:s}}async perspectiveKeepAliveSurrealQuery(e,t){let{perspectiveKeepAliveSurrealQuery:n}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveKeepAliveSurrealQuery($uuid: String!, $subscriptionId: String!) {
|
|
149
171
|
perspectiveKeepAliveSurrealQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
150
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return
|
|
172
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return n}async perspectiveDisposeSurrealQuerySubscription(e,t){let{perspectiveDisposeSurrealQuerySubscription:n}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveDisposeSurrealQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
151
173
|
perspectiveDisposeSurrealQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
152
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return
|
|
174
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return n}subscribeToQueryUpdates(e,t){let n=B(this,ee,"f").subscribe({query:x`
|
|
153
175
|
subscription perspectiveQuerySubscription($subscriptionId: String!) {
|
|
154
176
|
perspectiveQuerySubscription(subscriptionId: $subscriptionId)
|
|
155
177
|
}
|
|
156
|
-
`,variables:{subscriptionId:e}}).subscribe({next:
|
|
178
|
+
`,variables:{subscriptionId:e}}).subscribe({next:i=>{if(i.data&&i.data.perspectiveQuerySubscription){let a=i.data.perspectiveQuerySubscription,o=!1;a.startsWith("#init#")&&(a=a.substring(6),o=!0);try{a=JSON.parse(a),o&&typeof a=="object"&&(a.isInit=!0)}catch(s){console.error("Error parsing perspectiveQuerySubscription:",s)}t(a)}},error:i=>console.error("Error in query subscription:",i)});return()=>n.unsubscribe()}async keepAliveQuery(e,t){let{perspectiveKeepAliveQuery:n}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveKeepAliveQuery($uuid: String!, $subscriptionId: String!) {
|
|
157
179
|
perspectiveKeepAliveQuery(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
158
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return
|
|
180
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return n}async disposeQuerySubscription(e,t){let{perspectiveDisposeQuerySubscription:n}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveDisposeQuerySubscription($uuid: String!, $subscriptionId: String!) {
|
|
159
181
|
perspectiveDisposeQuerySubscription(uuid: $uuid, subscriptionId: $subscriptionId)
|
|
160
|
-
}`,variables:{uuid:e,subscriptionId:t}}));return
|
|
182
|
+
}`,variables:{uuid:e,subscriptionId:t}}));return n}async add(e){let{perspectiveAdd:t}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveAdd($name: String!) {
|
|
161
183
|
perspectiveAdd(name: $name) {
|
|
162
|
-
${
|
|
184
|
+
${Pi}
|
|
163
185
|
}
|
|
164
|
-
}`,variables:{name:e}}));return new
|
|
186
|
+
}`,variables:{name:e}}));return new Qi(t,this)}async update(e,t){let{perspectiveUpdate:n}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveUpdate($uuid: String!, $name: String!) {
|
|
165
187
|
perspectiveUpdate(uuid: $uuid, name: $name) {
|
|
166
|
-
${
|
|
188
|
+
${Pi}
|
|
167
189
|
}
|
|
168
|
-
}`,variables:{uuid:e,name:t}}));return new
|
|
190
|
+
}`,variables:{uuid:e,name:t}}));return new Qi(n,this)}async remove(e){return T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveRemove($uuid: String!) {
|
|
169
191
|
perspectiveRemove(uuid: $uuid)
|
|
170
|
-
}`,variables:{uuid:e}}))}async addLink(e,t,
|
|
192
|
+
}`,variables:{uuid:e}}))}async addLink(e,t,n="shared",i){let{perspectiveAddLink:a}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveAddLink($uuid: String!, $link: LinkInput!, $status: String!, $batchId: String) {
|
|
171
193
|
perspectiveAddLink(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
172
|
-
${
|
|
194
|
+
${ut}
|
|
173
195
|
}
|
|
174
|
-
}`,variables:{uuid:e,link:t,status:
|
|
196
|
+
}`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async addLinks(e,t,n="shared",i){let{perspectiveAddLinks:a}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveAddLinks($uuid: String!, $links: [LinkInput!]!, $status: String!, $batchId: String) {
|
|
175
197
|
perspectiveAddLinks(uuid: $uuid, links: $links, status: $status, batchId: $batchId) {
|
|
176
|
-
${
|
|
198
|
+
${ut}
|
|
177
199
|
}
|
|
178
|
-
}`,variables:{uuid:e,links:t,status:
|
|
200
|
+
}`,variables:{uuid:e,links:t,status:n,batchId:i}}));return a}async removeLinks(e,t,n){let{perspectiveRemoveLinks:i}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveRemoveLinks($uuid: String!, $links: [LinkExpressionInput!]!, $batchId: String) {
|
|
179
201
|
perspectiveRemoveLinks(uuid: $uuid, links: $links, batchId: $batchId) {
|
|
180
|
-
${
|
|
202
|
+
${ut}
|
|
181
203
|
}
|
|
182
|
-
}`,variables:{uuid:e,links:t,batchId:
|
|
204
|
+
}`,variables:{uuid:e,links:t,batchId:n}}));return i}async linkMutations(e,t,n){let{perspectiveLinkMutations:i}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveLinkMutations($uuid: String!, $mutations: LinkMutations!, $status: String){
|
|
183
205
|
perspectiveLinkMutations(mutations: $mutations, uuid: $uuid, status: $status) {
|
|
184
206
|
additions {
|
|
185
|
-
${
|
|
207
|
+
${ut}
|
|
186
208
|
}
|
|
187
209
|
removals {
|
|
188
|
-
${
|
|
210
|
+
${ut}
|
|
189
211
|
}
|
|
190
212
|
}
|
|
191
|
-
}`,variables:{uuid:e,mutations:t,status:
|
|
213
|
+
}`,variables:{uuid:e,mutations:t,status:n}}));return i}async addLinkExpression(e,t,n="shared",i){let{perspectiveAddLinkExpression:a}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveAddLinkExpression($uuid: String!, $link: LinkExpressionInput!, $status: String!, $batchId: String) {
|
|
192
214
|
perspectiveAddLinkExpression(uuid: $uuid, link: $link, status: $status, batchId: $batchId) {
|
|
193
|
-
${
|
|
215
|
+
${ut}
|
|
194
216
|
}
|
|
195
|
-
}`,variables:{uuid:e,link:t,status:
|
|
217
|
+
}`,variables:{uuid:e,link:t,status:n,batchId:i}}));return a}async updateLink(e,t,n,i){let{perspectiveUpdateLink:a}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveUpdateLink($uuid: String!, $oldLink: LinkExpressionInput!, $newLink: LinkInput!, $batchId: String) {
|
|
196
218
|
perspectiveUpdateLink(uuid: $uuid, oldLink: $oldLink, newLink: $newLink, batchId: $batchId) {
|
|
197
|
-
${
|
|
219
|
+
${ut}
|
|
198
220
|
}
|
|
199
|
-
}`,variables:{uuid:e,oldLink:t,newLink:
|
|
221
|
+
}`,variables:{uuid:e,oldLink:t,newLink:n,batchId:i}}));return a}async removeLink(e,t,n){delete t.__typename,delete t.data.__typename,delete t.proof.__typename,delete t.status;let{perspectiveRemoveLink:i}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveRemoveLink($link: LinkExpressionInput!, $uuid: String!, $batchId: String) {
|
|
200
222
|
perspectiveRemoveLink(link: $link, uuid: $uuid, batchId: $batchId)
|
|
201
|
-
}`,variables:{uuid:e,link:t,batchId:
|
|
223
|
+
}`,variables:{uuid:e,link:t,batchId:n}}));return i}async addSdna(e,t,n,i,a){return T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveAddSdna($uuid: String!, $name: String!, $sdnaCode: String, $sdnaType: String!, $shaclJson: String) {
|
|
202
224
|
perspectiveAddSdna(uuid: $uuid, name: $name, sdnaCode: $sdnaCode, sdnaType: $sdnaType, shaclJson: $shaclJson)
|
|
203
|
-
}`,variables:{uuid:e,name:t,sdnaCode:
|
|
225
|
+
}`,variables:{uuid:e,name:t,sdnaCode:n||"",sdnaType:i,shaclJson:a}})).perspectiveAddSdna}async executeCommands(e,t,n,i,a){return T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveExecuteCommands($uuid: String!, $commands: String!, $expression: String!, $parameters: String, $batchId: String) {
|
|
204
226
|
perspectiveExecuteCommands(uuid: $uuid, commands: $commands, expression: $expression, parameters: $parameters, batchId: $batchId)
|
|
205
|
-
}`,variables:{uuid:e,commands:t,expression:
|
|
227
|
+
}`,variables:{uuid:e,commands:t,expression:n,parameters:i,batchId:a}})).perspectiveExecuteCommands}async createSubject(e,t,n,i,a){return T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveCreateSubject($uuid: String!, $subjectClass: String!, $expressionAddress: String!, $initialValues: String, $batchId: String) {
|
|
206
228
|
perspectiveCreateSubject(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress, initialValues: $initialValues, batchId: $batchId)
|
|
207
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:
|
|
229
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:n,initialValues:i,batchId:a}})).perspectiveCreateSubject}async getSubjectData(e,t,n){return T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveGetSubjectData($uuid: String!, $subjectClass: String!, $expressionAddress: String!) {
|
|
208
230
|
perspectiveGetSubjectData(uuid: $uuid, subjectClass: $subjectClass, expressionAddress: $expressionAddress)
|
|
209
|
-
}`,variables:{uuid:e,subjectClass:t,expressionAddress:
|
|
210
|
-
perspectiveAdded { ${
|
|
231
|
+
}`,variables:{uuid:e,subjectClass:t,expressionAddress:n}})).perspectiveGetSubjectData}async getExpression(e){return await B(this,za,"f").get(e)}async createExpression(e,t){return await B(this,za,"f").create(e,t)}addPerspectiveAddedListener(e){B(this,Ba,"f").push(e)}subscribePerspectiveAdded(){B(this,ee,"f").subscribe({query:x` subscription {
|
|
232
|
+
perspectiveAdded { ${Pi} }
|
|
211
233
|
}
|
|
212
|
-
`}).subscribe({next:e=>{
|
|
213
|
-
perspectiveUpdated { ${
|
|
234
|
+
`}).subscribe({next:e=>{B(this,Ba,"f").forEach(t=>{t(e.data.perspectiveAdded)})},error:e=>console.error(e)})}addPerspectiveUpdatedListener(e){B(this,Va,"f").push(e)}subscribePerspectiveUpdated(){B(this,ee,"f").subscribe({query:x` subscription {
|
|
235
|
+
perspectiveUpdated { ${Pi} }
|
|
214
236
|
}
|
|
215
|
-
`}).subscribe({next:e=>{
|
|
237
|
+
`}).subscribe({next:e=>{B(this,Va,"f").forEach(t=>{t(e.data.perspectiveUpdated)})},error:e=>console.error(e)})}addPerspectiveSyncedListener(e){B(this,zs,"f").push(e)}async addPerspectiveSyncStateChangeListener(e,t){B(this,ee,"f").subscribe({query:x` subscription {
|
|
216
238
|
perspectiveSyncStateChange(uuid: "${e}")
|
|
217
239
|
}
|
|
218
|
-
`}).subscribe({next:
|
|
240
|
+
`}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveSyncStateChange)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}addPerspectiveRemovedListener(e){B(this,Qa,"f").push(e)}subscribePerspectiveRemoved(){B(this,ee,"f").subscribe({query:x` subscription {
|
|
219
241
|
perspectiveRemoved
|
|
220
242
|
}
|
|
221
|
-
`}).subscribe({next:e=>{
|
|
222
|
-
perspectiveLinkAdded(uuid: "${e}") { ${
|
|
243
|
+
`}).subscribe({next:e=>{B(this,Qa,"f").forEach(t=>{t(e.data.perspectiveRemoved)})},error:e=>console.error(e)})}async addPerspectiveLinkAddedListener(e,t){B(this,ee,"f").subscribe({query:x` subscription {
|
|
244
|
+
perspectiveLinkAdded(uuid: "${e}") { ${ut} }
|
|
223
245
|
}
|
|
224
|
-
`}).subscribe({next:
|
|
225
|
-
perspectiveLinkRemoved(uuid: "${e}") { ${
|
|
246
|
+
`}).subscribe({next:n=>{t.forEach(i=>{i(n.data.perspectiveLinkAdded)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkRemovedListener(e,t){B(this,ee,"f").subscribe({query:x` subscription {
|
|
247
|
+
perspectiveLinkRemoved(uuid: "${e}") { ${ut} }
|
|
226
248
|
}
|
|
227
|
-
`}).subscribe({next:
|
|
249
|
+
`}).subscribe({next:n=>{t.forEach(i=>{n.data.perspectiveLinkRemoved.status||delete n.data.perspectiveLinkRemoved.status,i(n.data.perspectiveLinkRemoved)})},error:n=>console.error(n)}),await new Promise(n=>setTimeout(n,500))}async addPerspectiveLinkUpdatedListener(e,t){B(this,ee,"f").subscribe({query:x` subscription {
|
|
228
250
|
perspectiveLinkUpdated(uuid: "${e}") {
|
|
229
251
|
oldLink {
|
|
230
|
-
${
|
|
252
|
+
${ut}
|
|
231
253
|
}
|
|
232
254
|
newLink {
|
|
233
|
-
${
|
|
255
|
+
${ut}
|
|
234
256
|
}
|
|
235
257
|
}
|
|
236
258
|
}
|
|
237
|
-
`}).subscribe({next:
|
|
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(B(this,Ws,"f"),e)}async createBatch(e){let{perspectiveCreateBatch:t}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveCreateBatch($uuid: String!) {
|
|
238
260
|
perspectiveCreateBatch(uuid: $uuid)
|
|
239
|
-
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:
|
|
261
|
+
}`,variables:{uuid:e}}));return t}async commitBatch(e,t){let{perspectiveCommitBatch:n}=T(await B(this,ee,"f").mutate({mutation:x`mutation perspectiveCommitBatch($uuid: String!, $batchId: String!) {
|
|
240
262
|
perspectiveCommitBatch(uuid: $uuid, batchId: $batchId) {
|
|
241
263
|
additions {
|
|
242
|
-
${
|
|
264
|
+
${ut}
|
|
243
265
|
}
|
|
244
266
|
removals {
|
|
245
|
-
${
|
|
267
|
+
${ut}
|
|
246
268
|
}
|
|
247
269
|
}
|
|
248
|
-
}`,variables:{uuid:e,batchId:t}}));return
|
|
270
|
+
}`,variables:{uuid:e,batchId:t}}));return n}};ee=new WeakMap,Ba=new WeakMap,Va=new WeakMap,Qa=new WeakMap,zs=new WeakMap,za=new WeakMap,Ws=new WeakMap,Hs=new WeakMap;var As=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},ie=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,Wa,Ha,Ga,Pa=`
|
|
249
271
|
did
|
|
250
272
|
directMessageLanguage
|
|
251
273
|
perspective {
|
|
@@ -275,145 +297,145 @@ neighbourhood {
|
|
|
275
297
|
can
|
|
276
298
|
}
|
|
277
299
|
}
|
|
278
|
-
`,
|
|
300
|
+
`,Fi=`
|
|
279
301
|
isInitialized
|
|
280
302
|
isUnlocked
|
|
281
303
|
did
|
|
282
304
|
didDocument
|
|
283
305
|
error
|
|
284
|
-
`,
|
|
306
|
+
`,Ts=`
|
|
285
307
|
did
|
|
286
308
|
didSigningKeyId
|
|
287
309
|
deviceKeyType
|
|
288
310
|
deviceKey
|
|
289
311
|
deviceKeySignedByDid
|
|
290
312
|
didSignedByDeviceKey
|
|
291
|
-
`,
|
|
313
|
+
`,pb=`
|
|
292
314
|
signature
|
|
293
315
|
publicKey
|
|
294
|
-
`,
|
|
316
|
+
`,po=class{constructor(e,t=!0){pe.set(this,void 0),Wa.set(this,void 0),Ha.set(this,void 0),Ga.set(this,void 0),As(this,pe,e,"f"),As(this,Ha,[],"f"),As(this,Ga,[],"f"),As(this,Wa,[],"f"),t&&(this.subscribeAgentUpdated(),this.subscribeAgentStatusChanged(),this.subscribeAppsChanged())}async me(){let{agent:e}=T(await ie(this,pe,"f").query({query:x`query agent { agent { ${Pa} } }`})),t=new rn(e.did,e.perspective);return t.directMessageLanguage=e.directMessageLanguage,t}async status(){let{agentStatus:e}=T(await ie(this,pe,"f").query({query:x`query agentStatus {
|
|
295
317
|
agentStatus {
|
|
296
|
-
${
|
|
318
|
+
${Fi}
|
|
297
319
|
}
|
|
298
|
-
}`}));return new
|
|
320
|
+
}`}));return new qt(e)}async generate(e){let{agentGenerate:t}=T(await ie(this,pe,"f").mutate({mutation:x`mutation agentGenerate(
|
|
299
321
|
$passphrase: String!
|
|
300
322
|
) {
|
|
301
323
|
agentGenerate(passphrase: $passphrase) {
|
|
302
|
-
${
|
|
324
|
+
${Fi}
|
|
303
325
|
}
|
|
304
|
-
}`,variables:{passphrase:e}}));return new
|
|
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 ie(this,pe,"f").mutate({mutation:x`mutation agentImport(
|
|
305
327
|
$did: String!,
|
|
306
328
|
$didDocument: String!,
|
|
307
329
|
$keystore: String!,
|
|
308
330
|
$passphrase: String!
|
|
309
331
|
) {
|
|
310
332
|
agentImport(did: $did, didDocument: $didDocument, keystore: $keystore, passphrase: $passphrase) {
|
|
311
|
-
${
|
|
333
|
+
${Fi}
|
|
312
334
|
}
|
|
313
|
-
}`,variables:{did:t,didDocument:
|
|
335
|
+
}`,variables:{did:t,didDocument:n,keystore:i,passphrase:a}}));return new qt(o)}async lock(e){let{agentLock:t}=T(await ie(this,pe,"f").mutate({mutation:x`mutation agentLock($passphrase: String!) {
|
|
314
336
|
agentLock(passphrase: $passphrase) {
|
|
315
|
-
${
|
|
337
|
+
${Fi}
|
|
316
338
|
}
|
|
317
|
-
}`,variables:{passphrase:e}}));return new
|
|
339
|
+
}`,variables:{passphrase:e}}));return new qt(t)}async unlock(e,t=!0){let{agentUnlock:n}=T(await ie(this,pe,"f").mutate({mutation:x`mutation agentUnlock($passphrase: String!, $holochain: Boolean!) {
|
|
318
340
|
agentUnlock(passphrase: $passphrase, holochain: $holochain) {
|
|
319
|
-
${
|
|
341
|
+
${Fi}
|
|
320
342
|
}
|
|
321
|
-
}`,variables:{passphrase:e,holochain:t}}));return new
|
|
343
|
+
}`,variables:{passphrase:e,holochain:t}}));return new qt(n)}async byDID(e){let{agentByDID:t}=T(await ie(this,pe,"f").query({query:x`query agentByDID($did: String!) {
|
|
322
344
|
agentByDID(did: $did) {
|
|
323
345
|
${Pa}
|
|
324
346
|
}
|
|
325
|
-
}`,variables:{did:e}}));return t}async updatePublicPerspective(e){let t=JSON.parse(JSON.stringify(e));delete t.__typename,t.links.forEach(o=>{delete o.__typename,delete o.data.__typename,delete o.proof.__typename,delete o.status});let{agentUpdatePublicPerspective:
|
|
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 ie(this,pe,"f").mutate({mutation:x`mutation agentUpdatePublicPerspective($perspective: PerspectiveInput!) {
|
|
326
348
|
agentUpdatePublicPerspective(perspective: $perspective) {
|
|
327
349
|
${Pa}
|
|
328
350
|
}
|
|
329
|
-
}`,variables:{perspective:t}})),n
|
|
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 dc(ie(this,pe,"f")),n=new po(ie(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 ie(this,pe,"f").mutate({mutation:x`mutation agentUpdateDirectMessageLanguage($directMessageLanguage: String!) {
|
|
330
352
|
agentUpdateDirectMessageLanguage(directMessageLanguage: $directMessageLanguage) {
|
|
331
353
|
${Pa}
|
|
332
354
|
}
|
|
333
|
-
}`,variables:{directMessageLanguage:e}})),
|
|
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 ie(this,pe,"f").mutate({mutation:x`mutation agentAddEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
334
356
|
agentAddEntanglementProofs(proofs: $proofs) {
|
|
335
|
-
${
|
|
357
|
+
${Ts}
|
|
336
358
|
}
|
|
337
|
-
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=
|
|
359
|
+
}`,variables:{proofs:e}}));return t}async deleteEntanglementProofs(e){let{agentDeleteEntanglementProofs:t}=T(await ie(this,pe,"f").mutate({mutation:x`mutation agentDeleteEntanglementProofs($proofs: [EntanglementProofInput!]!) {
|
|
338
360
|
agentDeleteEntanglementProofs(proofs: $proofs) {
|
|
339
|
-
${
|
|
361
|
+
${Ts}
|
|
340
362
|
}
|
|
341
|
-
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=
|
|
363
|
+
}`,variables:{proofs:e}}));return t}async getEntanglementProofs(){let{agentGetEntanglementProofs:e}=T(await ie(this,pe,"f").query({query:x`query agentGetEntanglementProofs {
|
|
342
364
|
agentGetEntanglementProofs {
|
|
343
|
-
${
|
|
365
|
+
${Ts}
|
|
344
366
|
}
|
|
345
|
-
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:
|
|
367
|
+
}`}));return e}async entanglementProofPreFlight(e,t){let{agentEntanglementProofPreFlight:n}=T(await ie(this,pe,"f").mutate({mutation:x`mutation agentEntanglementProofPreFlight($deviceKey: String!, $deviceKeyType: String!) {
|
|
346
368
|
agentEntanglementProofPreFlight(deviceKey: $deviceKey, deviceKeyType: $deviceKeyType) {
|
|
347
|
-
${
|
|
369
|
+
${Ts}
|
|
348
370
|
}
|
|
349
|
-
}`,variables:{deviceKey:e,deviceKeyType:t}}));return
|
|
371
|
+
}`,variables:{deviceKey:e,deviceKeyType:t}}));return n}addUpdatedListener(e){ie(this,Ha,"f").push(e)}addAppChangedListener(e){ie(this,Wa,"f").push(e)}subscribeAgentUpdated(){ie(this,pe,"f").subscribe({query:x` subscription {
|
|
350
372
|
agentUpdated { ${Pa} }
|
|
351
373
|
}
|
|
352
|
-
`}).subscribe({next:e=>{let t=e.data.agentUpdated;
|
|
374
|
+
`}).subscribe({next:e=>{let t=e.data.agentUpdated;ie(this,Ha,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}subscribeAppsChanged(){ie(this,pe,"f").subscribe({query:x` subscription {
|
|
353
375
|
agentAppsChanged {
|
|
354
376
|
${Is}
|
|
355
377
|
}
|
|
356
378
|
}
|
|
357
|
-
`}).subscribe({next:e=>{
|
|
358
|
-
agentStatusChanged { ${
|
|
379
|
+
`}).subscribe({next:e=>{ie(this,Wa,"f").forEach(t=>{t()})},error:e=>console.error(e)})}addAgentStatusChangedListener(e){ie(this,Ga,"f").push(e)}subscribeAgentStatusChanged(){ie(this,pe,"f").subscribe({query:x` subscription {
|
|
380
|
+
agentStatusChanged { ${Fi} }
|
|
359
381
|
}
|
|
360
|
-
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;
|
|
382
|
+
`}).subscribe({next:e=>{let t=e.data.agentStatusChanged;ie(this,Ga,"f").forEach(n=>{n(t)})},error:e=>console.error(e)})}async requestCapability(e){let{agentRequestCapability:t}=T(await ie(this,pe,"f").mutate({mutation:x`
|
|
361
383
|
mutation agentRequestCapability($authInfo: AuthInfoInput!) {
|
|
362
384
|
agentRequestCapability(authInfo: $authInfo)
|
|
363
385
|
}
|
|
364
|
-
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=
|
|
386
|
+
`,variables:{authInfo:e}}));return t}async permitCapability(e){let{agentPermitCapability:t}=T(await ie(this,pe,"f").mutate({mutation:x`
|
|
365
387
|
mutation agentPermitCapability($auth: String!) {
|
|
366
388
|
agentPermitCapability(auth: $auth)
|
|
367
389
|
}
|
|
368
|
-
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:
|
|
390
|
+
`,variables:{auth:e}}));return t}async generateJwt(e,t){let{agentGenerateJwt:n}=T(await ie(this,pe,"f").mutate({mutation:x`
|
|
369
391
|
mutation agentGenerateJwt($requestId: String!, $rand: String!) {
|
|
370
392
|
agentGenerateJwt(requestId: $requestId, rand: $rand)
|
|
371
393
|
}
|
|
372
|
-
`,variables:{requestId:e,rand:t}}));return
|
|
394
|
+
`,variables:{requestId:e,rand:t}}));return n}async getApps(){let{agentGetApps:e}=T(await ie(this,pe,"f").mutate({mutation:x`query agentGetApps {
|
|
373
395
|
agentGetApps {
|
|
374
396
|
${Is}
|
|
375
397
|
}
|
|
376
|
-
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=
|
|
398
|
+
}`}));return e}async removeApp(e){let{agentRemoveApp:t}=T(await ie(this,pe,"f").mutate({mutation:x`mutation agentRemoveApp($requestId: String!) {
|
|
377
399
|
agentRemoveApp(requestId: $requestId) {
|
|
378
400
|
${Is}
|
|
379
401
|
}
|
|
380
|
-
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=
|
|
402
|
+
}`,variables:{requestId:e}}));return t}async revokeToken(e){let{agentRevokeToken:t}=T(await ie(this,pe,"f").mutate({mutation:x`mutation agentRevokeToken($requestId: String!) {
|
|
381
403
|
agentRevokeToken(requestId: $requestId) {
|
|
382
404
|
${Is}
|
|
383
405
|
}
|
|
384
|
-
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=
|
|
406
|
+
}`,variables:{requestId:e}}));return t}async isLocked(){let{agentIsLocked:e}=T(await ie(this,pe,"f").mutate({mutation:x`
|
|
385
407
|
query agentIsLocked {
|
|
386
408
|
agentIsLocked
|
|
387
409
|
}
|
|
388
|
-
`}));return e}async signMessage(e){let{agentSignMessage:t}=
|
|
410
|
+
`}));return e}async signMessage(e){let{agentSignMessage:t}=T(await ie(this,pe,"f").mutate({mutation:x`mutation agentSignMessage($message: String!) {
|
|
389
411
|
agentSignMessage(message: $message) {
|
|
390
|
-
${
|
|
412
|
+
${pb}
|
|
391
413
|
}
|
|
392
|
-
}`,variables:{message:e}}));return t}async createUser(e,t,
|
|
414
|
+
}`,variables:{message:e}}));return t}async createUser(e,t,n){let{runtimeCreateUser:i}=T(await ie(this,pe,"f").mutate({mutation:x`mutation runtimeCreateUser($email: String!, $password: String!, $appInfo: AuthInfoInput) {
|
|
393
415
|
runtimeCreateUser(email: $email, password: $password, appInfo: $appInfo) {
|
|
394
416
|
did
|
|
395
417
|
success
|
|
396
418
|
error
|
|
397
419
|
}
|
|
398
|
-
}`,variables:{email:e,password:t,appInfo:
|
|
420
|
+
}`,variables:{email:e,password:t,appInfo:n}}));return i}async loginUser(e,t){let{runtimeLoginUser:n}=T(await ie(this,pe,"f").mutate({mutation:x`mutation runtimeLoginUser($email: String!, $password: String!) {
|
|
399
421
|
runtimeLoginUser(email: $email, password: $password)
|
|
400
|
-
}`,variables:{email:e,password:t}}));return
|
|
422
|
+
}`,variables:{email:e,password:t}}));return n}async requestLoginVerification(e,t){let{runtimeRequestLoginVerification:n}=T(await ie(this,pe,"f").mutate({mutation:x`mutation runtimeRequestLoginVerification($email: String!, $appInfo: AuthInfoInput) {
|
|
401
423
|
runtimeRequestLoginVerification(email: $email, appInfo: $appInfo) {
|
|
402
424
|
success
|
|
403
425
|
message
|
|
404
426
|
requiresPassword
|
|
405
427
|
isExistingUser
|
|
406
428
|
}
|
|
407
|
-
}`,variables:{email:e,appInfo:t}}));return
|
|
429
|
+
}`,variables:{email:e,appInfo:t}}));return n}async verifyEmailCode(e,t,n){let{runtimeVerifyEmailCode:i}=T(await ie(this,pe,"f").mutate({mutation:x`mutation runtimeVerifyEmailCode($email: String!, $code: String!, $verificationType: String!) {
|
|
408
430
|
runtimeVerifyEmailCode(email: $email, code: $code, verificationType: $verificationType)
|
|
409
|
-
}`,variables:{email:e,code:t,verificationType:
|
|
431
|
+
}`,variables:{email:e,code:t,verificationType:n}}));return i}};pe=new WeakMap,Wa=new WeakMap,Ha=new WeakMap,Ga=new WeakMap;var db=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,Pf=`
|
|
410
432
|
name
|
|
411
433
|
address
|
|
412
434
|
settings
|
|
413
435
|
icon { code }
|
|
414
436
|
constructorIcon { code }
|
|
415
437
|
settingsIcon { code }
|
|
416
|
-
`,
|
|
438
|
+
`,Ff=`
|
|
417
439
|
name
|
|
418
440
|
address
|
|
419
441
|
description
|
|
@@ -423,45 +445,45 @@ neighbourhood {
|
|
|
423
445
|
templateAppliedParams
|
|
424
446
|
possibleTemplateParams
|
|
425
447
|
sourceCodeLink
|
|
426
|
-
`,Il=class{constructor(e){
|
|
448
|
+
`,Il=class{constructor(e){Jt.set(this,void 0),db(this,Jt,e,"f")}async byAddress(e){let{language:t}=T(await Kr(this,Jt,"f").query({query:x`query byAddress($address: String!) {
|
|
427
449
|
language(address: $address) {
|
|
428
|
-
${
|
|
450
|
+
${Pf}
|
|
429
451
|
}
|
|
430
|
-
}`,variables:{address:e}}));return t}async byFilter(e){let{languages:t}=
|
|
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!) {
|
|
431
453
|
languages(filter: $filter) {
|
|
432
|
-
${
|
|
454
|
+
${Pf}
|
|
433
455
|
}
|
|
434
|
-
}`,variables:{filter:e}}));return t}async all(){return this.byFilter("")}async writeSettings(e,t){let{languageWriteSettings:
|
|
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!) {
|
|
435
457
|
languageWriteSettings(languageAddress: $languageAddress, settings: $settings)
|
|
436
|
-
}`,variables:{languageAddress:e,settings:t}}));return
|
|
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(
|
|
437
459
|
$sourceLanguageHash: String!,
|
|
438
460
|
$templateData: String!,
|
|
439
461
|
) {
|
|
440
462
|
languageApplyTemplateAndPublish(sourceLanguageHash: $sourceLanguageHash, templateData: $templateData) {
|
|
441
463
|
name, address
|
|
442
464
|
}
|
|
443
|
-
}`,variables:{sourceLanguageHash:e,templateData:t}}));return
|
|
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(
|
|
444
466
|
$languagePath: String!,
|
|
445
467
|
$languageMeta: LanguageMetaInput!,
|
|
446
468
|
) {
|
|
447
469
|
languagePublish(languagePath: $languagePath, languageMeta: $languageMeta) {
|
|
448
|
-
${
|
|
470
|
+
${Ff}
|
|
449
471
|
}
|
|
450
|
-
}`,variables:{languagePath:e,languageMeta:t}}));return
|
|
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(
|
|
451
473
|
$address: String!,
|
|
452
474
|
) {
|
|
453
475
|
languageMeta(address: $address) {
|
|
454
|
-
${
|
|
476
|
+
${Ff}
|
|
455
477
|
}
|
|
456
|
-
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=
|
|
478
|
+
}`,variables:{address:e}}));return t}async source(e){let{languageSource:t}=T(await Kr(this,Jt,"f").query({query:x`query languageSource(
|
|
457
479
|
$address: String!,
|
|
458
480
|
) {
|
|
459
481
|
languageSource(address: $address)
|
|
460
|
-
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=
|
|
482
|
+
}`,variables:{address:e}}));return t}async remove(e){let{languageRemove:t}=T(await Kr(this,Jt,"f").mutate({mutation:x`mutation languageRemove(
|
|
461
483
|
$address: String!,
|
|
462
484
|
) {
|
|
463
485
|
languageRemove(address: $address)
|
|
464
|
-
}`,variables:{address:e}}));return t}};
|
|
486
|
+
}`,variables:{address:e}}));return t}};Jt=new WeakMap;var fb=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,Tl=class{constructor(e){dt.set(this,void 0),Vi.set(this,new Map),fb(this,dt,e,"f")}async publishFromPerspective(e,t,n){let{neighbourhoodPublishFromPerspective:i}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodPublishFromPerspective(
|
|
465
487
|
$linkLanguage: String!,
|
|
466
488
|
$meta: PerspectiveInput!,
|
|
467
489
|
$perspectiveUUID: String!
|
|
@@ -471,39 +493,39 @@ neighbourhood {
|
|
|
471
493
|
meta: $meta,
|
|
472
494
|
perspectiveUUID: $perspectiveUUID
|
|
473
495
|
)
|
|
474
|
-
}`,variables:{perspectiveUUID:e,linkLanguage:t,meta:
|
|
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!) {
|
|
475
497
|
neighbourhoodJoinFromUrl(url: $url) {
|
|
476
498
|
uuid
|
|
477
499
|
name
|
|
478
500
|
sharedUrl
|
|
479
501
|
state
|
|
480
|
-
neighbourhood {
|
|
502
|
+
neighbourhood {
|
|
481
503
|
data {
|
|
482
|
-
linkLanguage
|
|
483
|
-
meta {
|
|
504
|
+
linkLanguage
|
|
505
|
+
meta {
|
|
484
506
|
links
|
|
485
507
|
{
|
|
486
508
|
author
|
|
487
509
|
timestamp
|
|
488
510
|
data { source, predicate, target }
|
|
489
511
|
proof { valid, invalid, signature, key }
|
|
490
|
-
}
|
|
491
|
-
}
|
|
512
|
+
}
|
|
513
|
+
}
|
|
492
514
|
}
|
|
493
515
|
author
|
|
494
516
|
}
|
|
495
517
|
}
|
|
496
|
-
}`,variables:{url:e}}));return t}async otherAgents(e){let{neighbourhoodOtherAgents:t}=
|
|
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!) {
|
|
497
519
|
neighbourhoodOtherAgents(perspectiveUUID: $perspectiveUUID)
|
|
498
|
-
}`,variables:{perspectiveUUID:e}}));return t}async hasTelepresenceAdapter(e){let{neighbourhoodHasTelepresenceAdapter:t}=
|
|
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!) {
|
|
499
521
|
neighbourhoodHasTelepresenceAdapter(perspectiveUUID: $perspectiveUUID)
|
|
500
|
-
}`,variables:{perspectiveUUID:e}}));return t}async onlineAgents(e){let{neighbourhoodOnlineAgents:t}=
|
|
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!) {
|
|
501
523
|
neighbourhoodOnlineAgents(perspectiveUUID: $perspectiveUUID) {
|
|
502
524
|
did
|
|
503
525
|
status {
|
|
504
526
|
author
|
|
505
527
|
timestamp
|
|
506
|
-
data {
|
|
528
|
+
data {
|
|
507
529
|
links {
|
|
508
530
|
author
|
|
509
531
|
timestamp
|
|
@@ -514,7 +536,7 @@ neighbourhood {
|
|
|
514
536
|
proof { valid, invalid, signature, key }
|
|
515
537
|
}
|
|
516
538
|
}
|
|
517
|
-
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:
|
|
539
|
+
}`,variables:{perspectiveUUID:e}}));return t}async setOnlineStatus(e,t){let{neighbourhoodSetOnlineStatus:n}=T(await it(this,dt,"f").mutate({mutation:x`mutation neighbourhoodSetOnlineStatus(
|
|
518
540
|
$perspectiveUUID: String!,
|
|
519
541
|
$status: PerspectiveInput!
|
|
520
542
|
) {
|
|
@@ -522,7 +544,7 @@ neighbourhood {
|
|
|
522
544
|
perspectiveUUID: $perspectiveUUID,
|
|
523
545
|
status: $status
|
|
524
546
|
)
|
|
525
|
-
}`,variables:{perspectiveUUID:e,status:t}}));return
|
|
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(
|
|
526
548
|
$perspectiveUUID: String!,
|
|
527
549
|
$status: PerspectiveUnsignedInput!
|
|
528
550
|
) {
|
|
@@ -530,7 +552,7 @@ neighbourhood {
|
|
|
530
552
|
perspectiveUUID: $perspectiveUUID,
|
|
531
553
|
status: $status
|
|
532
554
|
)
|
|
533
|
-
}`,variables:{perspectiveUUID:e,status:t}}));return
|
|
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(
|
|
534
556
|
$perspectiveUUID: String!,
|
|
535
557
|
$remoteAgentDid: String!,
|
|
536
558
|
$payload: PerspectiveInput!
|
|
@@ -540,7 +562,7 @@ neighbourhood {
|
|
|
540
562
|
remoteAgentDid: $remoteAgentDid,
|
|
541
563
|
payload: $payload
|
|
542
564
|
)
|
|
543
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:
|
|
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(
|
|
544
566
|
$perspectiveUUID: String!,
|
|
545
567
|
$remoteAgentDid: String!,
|
|
546
568
|
$payload: PerspectiveUnsignedInput!
|
|
@@ -550,7 +572,7 @@ neighbourhood {
|
|
|
550
572
|
remoteAgentDid: $remoteAgentDid,
|
|
551
573
|
payload: $payload
|
|
552
574
|
)
|
|
553
|
-
}`,variables:{perspectiveUUID:e,remoteAgentDid:t,payload:
|
|
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(
|
|
554
576
|
$perspectiveUUID: String!,
|
|
555
577
|
$payload: PerspectiveInput!,
|
|
556
578
|
$loopback: Boolean
|
|
@@ -560,7 +582,7 @@ neighbourhood {
|
|
|
560
582
|
payload: $payload,
|
|
561
583
|
loopback: $loopback
|
|
562
584
|
)
|
|
563
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:
|
|
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(
|
|
564
586
|
$perspectiveUUID: String!,
|
|
565
587
|
$payload: PerspectiveUnsignedInput!,
|
|
566
588
|
$loopback: Boolean
|
|
@@ -570,7 +592,7 @@ neighbourhood {
|
|
|
570
592
|
payload: $payload,
|
|
571
593
|
loopback: $loopback
|
|
572
594
|
)
|
|
573
|
-
}`,variables:{perspectiveUUID:e,payload:t,loopback:
|
|
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!) {
|
|
574
596
|
neighbourhoodSignal(perspectiveUUID: $perspectiveUUID) {
|
|
575
597
|
author
|
|
576
598
|
timestamp
|
|
@@ -581,11 +603,11 @@ neighbourhood {
|
|
|
581
603
|
timestamp
|
|
582
604
|
data { source, predicate, target }
|
|
583
605
|
proof { valid, invalid, signature, key }
|
|
584
|
-
}
|
|
606
|
+
}
|
|
585
607
|
}
|
|
586
608
|
proof { valid, invalid, signature, key }
|
|
587
609
|
}
|
|
588
|
-
}`,variables:{perspectiveUUID:e}}).subscribe({next:
|
|
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 Os=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)},G,Ka,Ja,Za,nm,Cs=`
|
|
589
611
|
author
|
|
590
612
|
timestamp
|
|
591
613
|
data {
|
|
@@ -597,7 +619,7 @@ data {
|
|
|
597
619
|
}
|
|
598
620
|
}
|
|
599
621
|
proof { valid, invalid, signature, key }
|
|
600
|
-
`,
|
|
622
|
+
`,hb=`
|
|
601
623
|
description
|
|
602
624
|
appName
|
|
603
625
|
appUrl
|
|
@@ -606,72 +628,72 @@ trigger
|
|
|
606
628
|
perspectiveIds
|
|
607
629
|
webhookUrl
|
|
608
630
|
webhookAuth
|
|
609
|
-
`,
|
|
631
|
+
`,im=`
|
|
610
632
|
id
|
|
611
633
|
granted
|
|
612
|
-
${
|
|
613
|
-
`,
|
|
614
|
-
notification { ${
|
|
634
|
+
${hb}
|
|
635
|
+
`,mb=`
|
|
636
|
+
notification { ${im} }
|
|
615
637
|
perspectiveId
|
|
616
638
|
triggerMatch
|
|
617
|
-
`,
|
|
639
|
+
`,Ol=class{constructor(e,t=!0){G.set(this,void 0),Ka.set(this,void 0),Ja.set(this,void 0),Za.set(this,void 0),nm.set(this,void 0),Os(this,G,e,"f"),Os(this,Ka,[],"f"),Os(this,Ja,[],"f"),Os(this,Za,[],"f"),t&&(this.subscribeMessageReceived(),this.subscribeExceptionOccurred(),this.subscribeNotificationTriggered())}async info(){let{runtimeInfo:e}=T(await V(this,G,"f").query({query:x`query runtimeInfo {
|
|
618
640
|
runtimeInfo {
|
|
619
641
|
ad4mExecutorVersion,
|
|
620
642
|
isInitialized,
|
|
621
643
|
isUnlocked
|
|
622
644
|
}
|
|
623
|
-
}`}));return e}async quit(){return
|
|
645
|
+
}`}));return e}async quit(){return T(await V(this,G,"f").mutate({mutation:x`mutation runtimeQuit { runtimeQuit }`})).runtimeQuit}async openLink(e){let{runtimeOpenLink:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeOpenLink($url: String!) {
|
|
624
646
|
runtimeOpenLink(url: $url)
|
|
625
|
-
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=
|
|
647
|
+
}`,variables:{url:e}}));return t}async addTrustedAgents(e){let{addTrustedAgents:t}=T(await V(this,G,"f").mutate({mutation:x`mutation addTrustedAgents($agents: [String!]!) {
|
|
626
648
|
addTrustedAgents(agents: $agents)
|
|
627
|
-
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=
|
|
649
|
+
}`,variables:{agents:e}}));return t}async deleteTrustedAgents(e){let{deleteTrustedAgents:t}=T(await V(this,G,"f").mutate({mutation:x`mutation deleteTrustedAgents($agents: [String!]!) {
|
|
628
650
|
deleteTrustedAgents(agents: $agents)
|
|
629
|
-
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=
|
|
651
|
+
}`,variables:{agents:e}}));return t}async getTrustedAgents(){let{getTrustedAgents:e}=T(await V(this,G,"f").query({query:x`query getTrustedAgents {
|
|
630
652
|
getTrustedAgents
|
|
631
|
-
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=
|
|
653
|
+
}`}));return e}async addKnownLinkLanguageTemplates(e){let{runtimeAddKnownLinkLanguageTemplates:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeAddKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
632
654
|
runtimeAddKnownLinkLanguageTemplates(addresses: $addresses)
|
|
633
|
-
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=
|
|
655
|
+
}`,variables:{addresses:e}}));return t}async removeKnownLinkLanguageTemplates(e){let{runtimeRemoveKnownLinkLanguageTemplates:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeRemoveKnownLinkLanguageTemplates($addresses: [String!]!) {
|
|
634
656
|
runtimeRemoveKnownLinkLanguageTemplates(addresses: $addresses)
|
|
635
|
-
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=
|
|
657
|
+
}`,variables:{addresses:e}}));return t}async knownLinkLanguageTemplates(){let{runtimeKnownLinkLanguageTemplates:e}=T(await V(this,G,"f").query({query:x`query runtimeKnownLinkLanguageTemplates {
|
|
636
658
|
runtimeKnownLinkLanguageTemplates
|
|
637
|
-
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=
|
|
659
|
+
}`}));return e}async addFriends(e){let{runtimeAddFriends:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeAddFriends($dids: [String!]!) {
|
|
638
660
|
runtimeAddFriends(dids: $dids)
|
|
639
|
-
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=
|
|
661
|
+
}`,variables:{dids:e}}));return t}async removeFriends(e){let{runtimeRemoveFriends:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeRemoveFriends($dids: [String!]!) {
|
|
640
662
|
runtimeRemoveFriends(dids: $dids)
|
|
641
|
-
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=
|
|
663
|
+
}`,variables:{dids:e}}));return t}async friends(){let{runtimeFriends:e}=T(await V(this,G,"f").query({query:x`query runtimeFriends {
|
|
642
664
|
runtimeFriends
|
|
643
|
-
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=
|
|
665
|
+
}`}));return e}async hcAgentInfos(){let{runtimeHcAgentInfos:e}=T(await V(this,G,"f").query({query:x`query runtimeHcAgentInfos {
|
|
644
666
|
runtimeHcAgentInfos
|
|
645
|
-
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=
|
|
667
|
+
}`}));return e}async getNetworkMetrics(){let{runtimeGetNetworkMetrics:e}=T(await V(this,G,"f").query({query:x`query runtimeGetNetworkMetrics {
|
|
646
668
|
runtimeGetNetworkMetrics
|
|
647
|
-
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=
|
|
669
|
+
}`}));return e}async restartHolochain(){let{runtimeRestartHolochain:e}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeRestartHolochain {
|
|
648
670
|
runtimeRestartHolochain
|
|
649
|
-
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=
|
|
671
|
+
}`}));return e}async hcAddAgentInfos(e){let{runtimeHcAddAgentInfos:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeHcAddAgentInfos($agentInfos: String!) {
|
|
650
672
|
runtimeHcAddAgentInfos(agentInfos: $agentInfos)
|
|
651
|
-
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,i
|
|
673
|
+
}`,variables:{agentInfos:e}}));return t}async verifyStringSignedByDid(e,t,n,i){let{runtimeVerifyStringSignedByDid:a}=T(await V(this,G,"f").mutate({mutation:x`query runtimeVerifyStringSignedByDid($did: String!, $didSigningKeyId: String!, $data: String!, $signedData: String!) {
|
|
652
674
|
runtimeVerifyStringSignedByDid(did: $did, didSigningKeyId: $didSigningKeyId, data: $data, signedData: $signedData)
|
|
653
|
-
}`,variables:{did:e,didSigningKeyId:t,data:
|
|
675
|
+
}`,variables:{did:e,didSigningKeyId:t,data:n,signedData:i}}));return a}async setStatus(e){let{runtimeSetStatus:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeSetStatus($status: PerspectiveInput!) {
|
|
654
676
|
runtimeSetStatus(status: $status)
|
|
655
|
-
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=
|
|
656
|
-
runtimeFriendStatus(did: $did) { ${
|
|
657
|
-
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:
|
|
677
|
+
}`,variables:{status:e}}));return t}async friendStatus(e){let{runtimeFriendStatus:t}=T(await V(this,G,"f").query({query:x`query runtimeFriendStatus($did: String!) {
|
|
678
|
+
runtimeFriendStatus(did: $did) { ${Cs} }
|
|
679
|
+
}`,variables:{did:e}}));return t}async friendSendMessage(e,t){let{runtimeFriendSendMessage:n}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeFriendSendMessage($did: String!, $message: PerspectiveInput!) {
|
|
658
680
|
runtimeFriendSendMessage(did: $did, message: $message)
|
|
659
|
-
}`,variables:{did:e,message:t}}));return
|
|
660
|
-
runtimeMessageInbox(filter: $filter) { ${
|
|
661
|
-
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=
|
|
681
|
+
}`,variables:{did:e,message:t}}));return n}async messageInbox(e){let{runtimeMessageInbox:t}=T(await V(this,G,"f").query({query:x`query runtimeMessageInbox($filter: String) {
|
|
682
|
+
runtimeMessageInbox(filter: $filter) { ${Cs} }
|
|
683
|
+
}`,variables:{filter:e}}));return t}async messageOutbox(e){let{runtimeMessageOutbox:t}=T(await V(this,G,"f").query({query:x`query runtimeMessageOutbox($filter: String) {
|
|
662
684
|
runtimeMessageOutbox(filter: $filter) {
|
|
663
685
|
recipient,
|
|
664
686
|
message {
|
|
665
|
-
${
|
|
687
|
+
${Cs}
|
|
666
688
|
}
|
|
667
689
|
}
|
|
668
|
-
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=
|
|
690
|
+
}`,variables:{filter:e}}));return t}async requestInstallNotification(e){let{runtimeRequestInstallNotification:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeRequestInstallNotification($notification: NotificationInput!) {
|
|
669
691
|
runtimeRequestInstallNotification(notification: $notification)
|
|
670
|
-
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=
|
|
692
|
+
}`,variables:{notification:e}}));return t}async grantNotification(e){let{runtimeGrantNotification:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeGrantNotification($id: String!) {
|
|
671
693
|
runtimeGrantNotification(id: $id)
|
|
672
|
-
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=
|
|
694
|
+
}`,variables:{id:e}}));return t}async exportDb(e){let{runtimeExportDb:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeExportDb($filePath: String!) {
|
|
673
695
|
runtimeExportDb(filePath: $filePath)
|
|
674
|
-
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=
|
|
696
|
+
}`,variables:{filePath:e}}));return t}async importDb(e){let{runtimeImportDb:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeImportDb($filePath: String!) {
|
|
675
697
|
runtimeImportDb(filePath: $filePath) {
|
|
676
698
|
perspectives { total imported failed omitted errors }
|
|
677
699
|
links { total imported failed omitted errors }
|
|
@@ -685,51 +707,51 @@ triggerMatch
|
|
|
685
707
|
trustedAgents { total imported failed omitted errors }
|
|
686
708
|
knownLinkLanguages { total imported failed omitted errors }
|
|
687
709
|
}
|
|
688
|
-
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=
|
|
689
|
-
runtimeNotifications { ${
|
|
690
|
-
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:
|
|
710
|
+
}`,variables:{filePath:e}}));return t}async notifications(){let{runtimeNotifications:e}=T(await V(this,G,"f").query({query:x`query runtimeNotifications {
|
|
711
|
+
runtimeNotifications { ${im} }
|
|
712
|
+
}`}));return e}async updateNotification(e,t){let{runtimeUpdateNotification:n}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeUpdateNotification($id: String!, $notification: NotificationInput!) {
|
|
691
713
|
runtimeUpdateNotification(id: $id, notification: $notification)
|
|
692
|
-
}`,variables:{id:e,notification:t}}));return
|
|
714
|
+
}`,variables:{id:e,notification:t}}));return n}async removeNotification(e){let{runtimeRemoveNotification:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeRemoveNotification($id: String!) {
|
|
693
715
|
runtimeRemoveNotification(id: $id)
|
|
694
|
-
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:
|
|
716
|
+
}`,variables:{id:e}}));return t}async exportPerspective(e,t){let{runtimeExportPerspective:n}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeExportPerspective($perspectiveUuid: String!, $filePath: String!) {
|
|
695
717
|
runtimeExportPerspective(perspectiveUuid: $perspectiveUuid, filePath: $filePath)
|
|
696
|
-
}`,variables:{perspectiveUuid:e,filePath:t}}));return
|
|
718
|
+
}`,variables:{perspectiveUuid:e,filePath:t}}));return n}async importPerspective(e){let{runtimeImportPerspective:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeImportPerspective($filePath: String!) {
|
|
697
719
|
runtimeImportPerspective(filePath: $filePath)
|
|
698
|
-
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=
|
|
720
|
+
}`,variables:{filePath:e}}));return t}async multiUserEnabled(){let{runtimeMultiUserEnabled:e}=T(await V(this,G,"f").query({query:x`query runtimeMultiUserEnabled {
|
|
699
721
|
runtimeMultiUserEnabled
|
|
700
|
-
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=
|
|
722
|
+
}`}));return e}async setMultiUserEnabled(e){let{runtimeSetMultiUserEnabled:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeSetMultiUserEnabled($enabled: Boolean!) {
|
|
701
723
|
runtimeSetMultiUserEnabled(enabled: $enabled)
|
|
702
|
-
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=
|
|
724
|
+
}`,variables:{enabled:e}}));return t}async listUsers(){let{runtimeListUsers:e}=T(await V(this,G,"f").query({query:x`query runtimeListUsers {
|
|
703
725
|
runtimeListUsers {
|
|
704
726
|
email
|
|
705
727
|
did
|
|
706
728
|
lastSeen
|
|
707
729
|
perspectiveCount
|
|
708
730
|
}
|
|
709
|
-
}`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=
|
|
731
|
+
}`}));return e}async emailTestModeEnable(){let{runtimeEmailTestModeEnable:e}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestModeEnable {
|
|
710
732
|
runtimeEmailTestModeEnable
|
|
711
|
-
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=
|
|
733
|
+
}`}));return e}async emailTestModeDisable(){let{runtimeEmailTestModeDisable:e}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestModeDisable {
|
|
712
734
|
runtimeEmailTestModeDisable
|
|
713
|
-
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=
|
|
735
|
+
}`}));return e}async emailTestGetCode(e){let{runtimeEmailTestGetCode:t}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestGetCode($email: String!) {
|
|
714
736
|
runtimeEmailTestGetCode(email: $email)
|
|
715
|
-
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=
|
|
737
|
+
}`,variables:{email:e}}));return t}async emailTestClearCodes(){let{runtimeEmailTestClearCodes:e}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestClearCodes {
|
|
716
738
|
runtimeEmailTestClearCodes
|
|
717
|
-
}`}));return e}async emailTestSetExpiry(e,t,
|
|
739
|
+
}`}));return e}async emailTestSetExpiry(e,t,n){let{runtimeEmailTestSetExpiry:i}=T(await V(this,G,"f").mutate({mutation:x`mutation runtimeEmailTestSetExpiry($email: String!, $verificationType: String!, $expiresAt: Int!) {
|
|
718
740
|
runtimeEmailTestSetExpiry(email: $email, verificationType: $verificationType, expiresAt: $expiresAt)
|
|
719
|
-
}`,variables:{email:e,verificationType:t,expiresAt:
|
|
720
|
-
runtimeNotificationTriggered { ${
|
|
741
|
+
}`,variables:{email:e,verificationType:t,expiresAt:n}}));return i}addNotificationTriggeredCallback(e){V(this,Za,"f").push(e)}subscribeNotificationTriggered(){V(this,G,"f").subscribe({query:x` subscription {
|
|
742
|
+
runtimeNotificationTriggered { ${mb} }
|
|
721
743
|
}
|
|
722
|
-
`}).subscribe({next:e=>{
|
|
723
|
-
runtimeMessageReceived { ${
|
|
744
|
+
`}).subscribe({next:e=>{V(this,Za,"f").forEach(t=>{t(e.data.runtimeNotificationTriggered)})},error:e=>console.error(e)})}addMessageCallback(e){V(this,Ka,"f").push(e)}subscribeMessageReceived(){V(this,G,"f").subscribe({query:x` subscription {
|
|
745
|
+
runtimeMessageReceived { ${Cs} }
|
|
724
746
|
}
|
|
725
|
-
`}).subscribe({next:e=>{
|
|
747
|
+
`}).subscribe({next:e=>{V(this,Ka,"f").forEach(t=>{t(e.data.runtimeMessageReceived)})},error:e=>console.error(e)})}addExceptionCallback(e){V(this,Ja,"f").push(e)}subscribeExceptionOccurred(){V(this,G,"f").subscribe({query:x` subscription {
|
|
726
748
|
exceptionOccurred {
|
|
727
749
|
title
|
|
728
750
|
message
|
|
729
751
|
type
|
|
730
752
|
addon
|
|
731
753
|
}
|
|
732
|
-
}`}).subscribe({next:e=>{
|
|
754
|
+
}`}).subscribe({next:e=>{V(this,Ja,"f").forEach(t=>{t(e.data.exceptionOccurred)})},error:e=>console.error(e)})}};G=new WeakMap,Ka=new WeakMap,Ja=new WeakMap,Za=new WeakMap,nm=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},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,Cl=class{constructor(e){Nr.set(this,void 0),gb(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!) {
|
|
733
755
|
expression(url: $url) {
|
|
734
756
|
author
|
|
735
757
|
timestamp
|
|
@@ -742,7 +764,7 @@ triggerMatch
|
|
|
742
764
|
invalid
|
|
743
765
|
}
|
|
744
766
|
}
|
|
745
|
-
}`,variables:{url:e}}));return
|
|
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!]!) {
|
|
746
768
|
expressionMany(urls: $urls) {
|
|
747
769
|
author
|
|
748
770
|
timestamp
|
|
@@ -755,19 +777,19 @@ triggerMatch
|
|
|
755
777
|
invalid
|
|
756
778
|
}
|
|
757
779
|
}
|
|
758
|
-
}`,variables:{urls:e}}));return t}async getRaw(e){let{expressionRaw:t}=
|
|
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!) {
|
|
759
781
|
expressionRaw(url: $url)
|
|
760
|
-
}`,variables:{url:e}}));return t}async create(e,t){e=JSON.stringify(e);let{expressionCreate:
|
|
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!){
|
|
761
783
|
expressionCreate(content: $content, languageAddress: $languageAddress)
|
|
762
|
-
}`,variables:{content:e,languageAddress:t}}));return
|
|
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!) {
|
|
763
785
|
expressionInteractions(url: $url) {
|
|
764
786
|
label
|
|
765
787
|
name
|
|
766
788
|
parameters { name, type }
|
|
767
789
|
}
|
|
768
|
-
}`,variables:{url:e}}));return t}async interact(e,t){let{expressionInteract:
|
|
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!){
|
|
769
791
|
expressionInteract(url: $url, interactionCall: $interactionCall)
|
|
770
|
-
}`,variables:{url:e,interactionCall:t}}));return i}};Or=new WeakMap;var Ic={};Ic.byteLength=fb;Ic.toByteArray=mb;Ic.fromByteArray=vb;var dr=[],Bt=[],db=typeof Uint8Array<"u"?Uint8Array:Array,rl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Ti=0,Pf=rl.length;Ti<Pf;++Ti)dr[Ti]=rl[Ti],Bt[rl.charCodeAt(Ti)]=Ti;var Ti,Pf;Bt["-".charCodeAt(0)]=62;Bt["_".charCodeAt(0)]=63;function rm(r){var e=r.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var t=r.indexOf("=");t===-1&&(t=e);var i=t===e?0:4-t%4;return[t,i]}function fb(r){var e=rm(r),t=e[0],i=e[1];return(t+i)*3/4-i}function hb(r,e,t){return(e+t)*3/4-t}function mb(r){var e,t=rm(r),i=t[0],n=t[1],a=new db(hb(r,i,n)),o=0,s=n>0?i-4:i,c;for(c=0;c<s;c+=4)e=Bt[r.charCodeAt(c)]<<18|Bt[r.charCodeAt(c+1)]<<12|Bt[r.charCodeAt(c+2)]<<6|Bt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return n===2&&(e=Bt[r.charCodeAt(c)]<<2|Bt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),n===1&&(e=Bt[r.charCodeAt(c)]<<10|Bt[r.charCodeAt(c+1)]<<4|Bt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function gb(r){return dr[r>>18&63]+dr[r>>12&63]+dr[r>>6&63]+dr[r&63]}function yb(r,e,t){for(var i,n=[],a=e;a<t;a+=3)i=(r[a]<<16&16711680)+(r[a+1]<<8&65280)+(r[a+2]&255),n.push(gb(i));return n.join("")}function vb(r){for(var e,t=r.length,i=t%3,n=[],a=16383,o=0,s=t-i;o<s;o+=a)n.push(yb(r,o,o+a>s?s:o+a));return i===1?(e=r[t-1],n.push(dr[e>>2]+dr[e<<4&63]+"==")):i===2&&(e=(r[t-2]<<8)+r[t-1],n.push(dr[e>>10]+dr[e>>4&63]+dr[e<<2&63]+"=")),n.join("")}var bb=4,Ff=0,Mf=1,wb=2;function na(r){let e=r.length;for(;--e>=0;)r[e]=0}var Sb=0,im=1,_b=2,Eb=3,xb=258,Gl=29,xo=256,po=xo+1+Gl,zn=30,Kl=19,nm=2*po+1,Ui=15,il=16,Ab=7,Jl=256,am=16,om=17,sm=18,Cl=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Hs=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Ib=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),cm=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),kb=512,Cr=new Array((po+2)*2);na(Cr);var no=new Array(zn*2);na(no);var fo=new Array(kb);na(fo);var ho=new Array(xb-Eb+1);na(ho);var Zl=new Array(Gl);na(Zl);var hc=new Array(zn);na(hc);function nl(r,e,t,i,n){this.static_tree=r,this.extra_bits=e,this.extra_base=t,this.elems=i,this.max_length=n,this.has_stree=r&&r.length}var um,lm,pm;function al(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var dm=r=>r<256?fo[r]:fo[256+(r>>>7)],mo=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},Et=(r,e,t)=>{r.bi_valid>il-t?(r.bi_buf|=e<<r.bi_valid&65535,mo(r,r.bi_buf),r.bi_buf=e>>il-r.bi_valid,r.bi_valid+=t-il):(r.bi_buf|=e<<r.bi_valid&65535,r.bi_valid+=t)},fr=(r,e,t)=>{Et(r,t[e*2],t[e*2+1])},fm=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},Tb=r=>{r.bi_valid===16?(mo(r,r.bi_buf),r.bi_buf=0,r.bi_valid=0):r.bi_valid>=8&&(r.pending_buf[r.pending++]=r.bi_buf&255,r.bi_buf>>=8,r.bi_valid-=8)},Ob=(r,e)=>{let t=e.dyn_tree,i=e.max_code,n=e.stat_desc.static_tree,a=e.stat_desc.has_stree,o=e.stat_desc.extra_bits,s=e.stat_desc.extra_base,c=e.stat_desc.max_length,u,l,f,d,p,h,m=0;for(d=0;d<=Ui;d++)r.bl_count[d]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<nm;u++)l=r.heap[u],d=t[t[l*2+1]*2+1]+1,d>c&&(d=c,m++),t[l*2+1]=d,!(l>i)&&(r.bl_count[d]++,p=0,l>=s&&(p=o[l-s]),h=t[l*2],r.opt_len+=h*(d+p),a&&(r.static_len+=h*(n[l*2+1]+p)));if(m!==0){do{for(d=c-1;r.bl_count[d]===0;)d--;r.bl_count[d]--,r.bl_count[d+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(d=c;d!==0;d--)for(l=r.bl_count[d];l!==0;)f=r.heap[--u],!(f>i)&&(t[f*2+1]!==d&&(r.opt_len+=(d-t[f*2+1])*t[f*2],t[f*2+1]=d),l--)}},hm=(r,e,t)=>{let i=new Array(Ui+1),n=0,a,o;for(a=1;a<=Ui;a++)n=n+t[a-1]<<1,i[a]=n;for(o=0;o<=e;o++){let s=r[o*2+1];s!==0&&(r[o*2]=fm(i[s]++,s))}},Cb=()=>{let r,e,t,i,n,a=new Array(Ui+1);for(t=0,i=0;i<Gl-1;i++)for(Zl[i]=t,r=0;r<1<<Cl[i];r++)ho[t++]=i;for(ho[t-1]=i,n=0,i=0;i<16;i++)for(hc[i]=n,r=0;r<1<<Hs[i];r++)fo[n++]=i;for(n>>=7;i<zn;i++)for(hc[i]=n<<7,r=0;r<1<<Hs[i]-7;r++)fo[256+n++]=i;for(e=0;e<=Ui;e++)a[e]=0;for(r=0;r<=143;)Cr[r*2+1]=8,r++,a[8]++;for(;r<=255;)Cr[r*2+1]=9,r++,a[9]++;for(;r<=279;)Cr[r*2+1]=7,r++,a[7]++;for(;r<=287;)Cr[r*2+1]=8,r++,a[8]++;for(hm(Cr,po+1,a),r=0;r<zn;r++)no[r*2+1]=5,no[r*2]=fm(r,5);um=new nl(Cr,Cl,xo+1,po,Ui),lm=new nl(no,Hs,0,zn,Ui),pm=new nl(new Array(0),Ib,0,Kl,Ab)},mm=r=>{let e;for(e=0;e<po;e++)r.dyn_ltree[e*2]=0;for(e=0;e<zn;e++)r.dyn_dtree[e*2]=0;for(e=0;e<Kl;e++)r.bl_tree[e*2]=0;r.dyn_ltree[Jl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},gm=r=>{r.bi_valid>8?mo(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},Uf=(r,e,t,i)=>{let n=e*2,a=t*2;return r[n]<r[a]||r[n]===r[a]&&i[e]<=i[t]},ol=(r,e,t)=>{let i=r.heap[t],n=t<<1;for(;n<=r.heap_len&&(n<r.heap_len&&Uf(e,r.heap[n+1],r.heap[n],r.depth)&&n++,!Uf(e,i,r.heap[n],r.depth));)r.heap[t]=r.heap[n],t=n,n<<=1;r.heap[t]=i},jf=(r,e,t)=>{let i,n,a=0,o,s;if(r.sym_next!==0)do i=r.pending_buf[r.sym_buf+a++]&255,i+=(r.pending_buf[r.sym_buf+a++]&255)<<8,n=r.pending_buf[r.sym_buf+a++],i===0?fr(r,n,e):(o=ho[n],fr(r,o+xo+1,e),s=Cl[o],s!==0&&(n-=Zl[o],Et(r,n,s)),i--,o=dm(i),fr(r,o,t),s=Hs[o],s!==0&&(i-=hc[o],Et(r,i,s)));while(a<r.sym_next);fr(r,Jl,e)},Nl=(r,e)=>{let t=e.dyn_tree,i=e.stat_desc.static_tree,n=e.stat_desc.has_stree,a=e.stat_desc.elems,o,s,c=-1,u;for(r.heap_len=0,r.heap_max=nm,o=0;o<a;o++)t[o*2]!==0?(r.heap[++r.heap_len]=c=o,r.depth[o]=0):t[o*2+1]=0;for(;r.heap_len<2;)u=r.heap[++r.heap_len]=c<2?++c:0,t[u*2]=1,r.depth[u]=0,r.opt_len--,n&&(r.static_len-=i[u*2+1]);for(e.max_code=c,o=r.heap_len>>1;o>=1;o--)ol(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],ol(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++,ol(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],Ob(r,e),hm(t,c,r.bl_count)},qf=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),e[(t+1)*2+1]=65535,i=0;i<=t;i++)a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)&&(s<u?r.bl_tree[a*2]+=s:a!==0?(a!==n&&r.bl_tree[a*2]++,r.bl_tree[am*2]++):s<=10?r.bl_tree[om*2]++:r.bl_tree[sm*2]++,s=0,n=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},Bf=(r,e,t)=>{let i,n=-1,a,o=e[0*2+1],s=0,c=7,u=4;for(o===0&&(c=138,u=3),i=0;i<=t;i++)if(a=o,o=e[(i+1)*2+1],!(++s<c&&a===o)){if(s<u)do fr(r,a,r.bl_tree);while(--s!==0);else a!==0?(a!==n&&(fr(r,a,r.bl_tree),s--),fr(r,am,r.bl_tree),Et(r,s-3,2)):s<=10?(fr(r,om,r.bl_tree),Et(r,s-3,3)):(fr(r,sm,r.bl_tree),Et(r,s-11,7));s=0,n=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4)}},Nb=r=>{let e;for(qf(r,r.dyn_ltree,r.l_desc.max_code),qf(r,r.dyn_dtree,r.d_desc.max_code),Nl(r,r.bl_desc),e=Kl-1;e>=3&&r.bl_tree[cm[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},Db=(r,e,t,i)=>{let n;for(Et(r,e-257,5),Et(r,t-1,5),Et(r,i-4,4),n=0;n<i;n++)Et(r,r.bl_tree[cm[n]*2+1],3);Bf(r,r.dyn_ltree,e-1),Bf(r,r.dyn_dtree,t-1)},$b=r=>{let e=4093624447,t;for(t=0;t<=31;t++,e>>>=1)if(e&1&&r.dyn_ltree[t*2]!==0)return Ff;if(r.dyn_ltree[9*2]!==0||r.dyn_ltree[10*2]!==0||r.dyn_ltree[13*2]!==0)return Mf;for(t=32;t<xo;t++)if(r.dyn_ltree[t*2]!==0)return Mf;return Ff},Vf=!1,Rb=r=>{Vf||(Cb(),Vf=!0),r.l_desc=new al(r.dyn_ltree,um),r.d_desc=new al(r.dyn_dtree,lm),r.bl_desc=new al(r.bl_tree,pm),r.bi_buf=0,r.bi_valid=0,mm(r)},ym=(r,e,t,i)=>{Et(r,(Sb<<1)+(i?1:0),3),gm(r),mo(r,t),mo(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},Lb=r=>{Et(r,im<<1,3),fr(r,Jl,Cr),Tb(r)},Pb=(r,e,t,i)=>{let n,a,o=0;r.level>0?(r.strm.data_type===wb&&(r.strm.data_type=$b(r)),Nl(r,r.l_desc),Nl(r,r.d_desc),o=Nb(r),n=r.opt_len+3+7>>>3,a=r.static_len+3+7>>>3,a<=n&&(n=a)):n=a=t+5,t+4<=n&&e!==-1?ym(r,e,t,i):r.strategy===bb||a===n?(Et(r,(im<<1)+(i?1:0),3),jf(r,Cr,no)):(Et(r,(_b<<1)+(i?1:0),3),Db(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),jf(r,r.dyn_ltree,r.dyn_dtree)),mm(r),i&&gm(r)},Fb=(r,e,t)=>(r.pending_buf[r.sym_buf+r.sym_next++]=e,r.pending_buf[r.sym_buf+r.sym_next++]=e>>8,r.pending_buf[r.sym_buf+r.sym_next++]=t,e===0?r.dyn_ltree[t*2]++:(r.matches++,e--,r.dyn_ltree[(ho[t]+xo+1)*2]++,r.dyn_dtree[dm(e)*2]++),r.sym_next===r.sym_end),Mb=Rb,Ub=ym,jb=Pb,qb=Fb,Bb=Lb,Vb={_tr_init:Mb,_tr_stored_block:Ub,_tr_flush_block:jb,_tr_tally:qb,_tr_align:Bb},Qb=(r,e,t,i)=>{let n=r&65535|0,a=r>>>16&65535|0,o=0;for(;t!==0;){o=t>2e3?2e3:t,t-=o;do n=n+e[i++]|0,a=a+n|0;while(--o);n%=65521,a%=65521}return n|a<<16|0},go=Qb,zb=()=>{let r,e=[];for(var t=0;t<256;t++){r=t;for(var i=0;i<8;i++)r=r&1?3988292384^r>>>1:r>>>1;e[t]=r}return e},Wb=new Uint32Array(zb()),Hb=(r,e,t,i)=>{let n=Wb,a=i+t;r^=-1;for(let o=i;o<a;o++)r=r>>>8^n[(r^e[o])&255];return r^-1},Ge=Hb,Ki={2:"need dictionary",1:"stream end",0:"","-1":"file error","-2":"stream error","-3":"data error","-4":"insufficient memory","-5":"buffer error","-6":"incompatible version"},an={Z_NO_FLUSH:0,Z_PARTIAL_FLUSH:1,Z_SYNC_FLUSH:2,Z_FULL_FLUSH:3,Z_FINISH:4,Z_BLOCK:5,Z_TREES:6,Z_OK:0,Z_STREAM_END:1,Z_NEED_DICT:2,Z_ERRNO:-1,Z_STREAM_ERROR:-2,Z_DATA_ERROR:-3,Z_MEM_ERROR:-4,Z_BUF_ERROR:-5,Z_NO_COMPRESSION:0,Z_BEST_SPEED:1,Z_BEST_COMPRESSION:9,Z_DEFAULT_COMPRESSION:-1,Z_FILTERED:1,Z_HUFFMAN_ONLY:2,Z_RLE:3,Z_FIXED:4,Z_DEFAULT_STRATEGY:0,Z_BINARY:0,Z_TEXT:1,Z_UNKNOWN:2,Z_DEFLATED:8},{_tr_init:Gb,_tr_stored_block:Dl,_tr_flush_block:Kb,_tr_tally:ii,_tr_align:Jb}=Vb,{Z_NO_FLUSH:ni,Z_PARTIAL_FLUSH:Zb,Z_FULL_FLUSH:Yb,Z_FINISH:Qt,Z_BLOCK:Qf,Z_OK:rt,Z_STREAM_END:zf,Z_STREAM_ERROR:mr,Z_DATA_ERROR:Xb,Z_BUF_ERROR:sl,Z_DEFAULT_COMPRESSION:e0,Z_FILTERED:t0,Z_HUFFMAN_ONLY:Cs,Z_RLE:r0,Z_FIXED:i0,Z_DEFAULT_STRATEGY:n0,Z_UNKNOWN:a0,Z_DEFLATED:kc}=an,o0=9,s0=15,c0=8,u0=29,l0=256,$l=l0+1+u0,p0=30,d0=19,f0=2*$l+1,h0=15,se=3,Yr=258,gr=Yr+se+1,m0=32,Jn=42,Yl=57,Rl=69,Ll=73,Pl=91,Fl=103,ji=113,Ya=666,mt=1,aa=2,Ji=3,oa=4,g0=3,qi=(r,e)=>(r.msg=Ki[e],e),Wf=r=>r*2-(r>4?9:0),Zr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},y0=r=>{let e,t,i,n=r.w_size;e=r.hash_size,i=e;do t=r.head[--i],r.head[i]=t>=n?t-n:0;while(--e);e=n,i=e;do t=r.prev[--i],r.prev[i]=t>=n?t-n:0;while(--e)},v0=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,ai=v0,Tt=r=>{let e=r.state,t=e.pending;t>r.avail_out&&(t=r.avail_out),t!==0&&(r.output.set(e.pending_buf.subarray(e.pending_out,e.pending_out+t),r.next_out),r.next_out+=t,e.pending_out+=t,r.total_out+=t,r.avail_out-=t,e.pending-=t,e.pending===0&&(e.pending_out=0))},Nt=(r,e)=>{Kb(r,r.block_start>=0?r.block_start:-1,r.strstart-r.block_start,e),r.block_start=r.strstart,Tt(r.strm)},me=(r,e)=>{r.pending_buf[r.pending++]=e},Fa=(r,e)=>{r.pending_buf[r.pending++]=e>>>8&255,r.pending_buf[r.pending++]=e&255},Ml=(r,e,t,i)=>{let n=r.avail_in;return n>i&&(n=i),n===0?0:(r.avail_in-=n,e.set(r.input.subarray(r.next_in,r.next_in+n),t),r.state.wrap===1?r.adler=go(r.adler,e,n,t):r.state.wrap===2&&(r.adler=Ge(r.adler,e,n,t)),r.next_in+=n,r.total_in+=n,n)},vm=(r,e)=>{let t=r.max_chain_length,i=r.strstart,n,a,o=r.prev_length,s=r.nice_match,c=r.strstart>r.w_size-gr?r.strstart-(r.w_size-gr):0,u=r.window,l=r.w_mask,f=r.prev,d=r.strstart+Yr,p=u[i+o-1],h=u[i+o];r.prev_length>=r.good_match&&(t>>=2),s>r.lookahead&&(s=r.lookahead);do if(n=e,!(u[n+o]!==h||u[n+o-1]!==p||u[n]!==u[i]||u[++n]!==u[i+1])){i+=2,n++;do;while(u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&u[++i]===u[++n]&&i<d);if(a=Yr-(d-i),i=d-Yr,a>o){if(r.match_start=e,o=a,a>=s)break;p=u[i+o-1],h=u[i+o]}}while((e=f[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Zn=r=>{let e=r.w_size,t,i,n;do{if(i=r.window_size-r.lookahead-r.strstart,r.strstart>=e+(e-gr)&&(r.window.set(r.window.subarray(e,e+e-i),0),r.match_start-=e,r.strstart-=e,r.block_start-=e,r.insert>r.strstart&&(r.insert=r.strstart),y0(r),i+=e),r.strm.avail_in===0)break;if(t=Ml(r.strm,r.window,r.strstart+r.lookahead,i),r.lookahead+=t,r.lookahead+r.insert>=se)for(n=r.strstart-r.insert,r.ins_h=r.window[n],r.ins_h=ai(r,r.ins_h,r.window[n+1]);r.insert&&(r.ins_h=ai(r,r.ins_h,r.window[n+se-1]),r.prev[n&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=n,n++,r.insert--,!(r.lookahead+r.insert<se)););}while(r.lookahead<gr&&r.strm.avail_in!==0)},bm=(r,e)=>{let t=r.pending_buf_size-5>r.w_size?r.w_size:r.pending_buf_size-5,i,n,a,o=0,s=r.strm.avail_in;do{if(i=65535,a=r.bi_valid+42>>3,r.strm.avail_out<a||(a=r.strm.avail_out-a,n=r.strstart-r.block_start,i>n+r.strm.avail_in&&(i=n+r.strm.avail_in),i>a&&(i=a),i<t&&(i===0&&e!==Qt||e===ni||i!==n+r.strm.avail_in)))break;o=e===Qt&&i===n+r.strm.avail_in?1:0,Dl(r,0,0,o),r.pending_buf[r.pending-4]=i,r.pending_buf[r.pending-3]=i>>8,r.pending_buf[r.pending-2]=~i,r.pending_buf[r.pending-1]=~i>>8,Tt(r.strm),n&&(n>i&&(n=i),r.strm.output.set(r.window.subarray(r.block_start,r.block_start+n),r.strm.next_out),r.strm.next_out+=n,r.strm.avail_out-=n,r.strm.total_out+=n,r.block_start+=n,i-=n),i&&(Ml(r.strm,r.strm.output,r.strm.next_out,i),r.strm.next_out+=i,r.strm.avail_out-=i,r.strm.total_out+=i)}while(o===0);return s-=r.strm.avail_in,s&&(s>=r.w_size?(r.matches=2,r.window.set(r.strm.input.subarray(r.strm.next_in-r.w_size,r.strm.next_in),0),r.strstart=r.w_size,r.insert=r.strstart):(r.window_size-r.strstart<=s&&(r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,r.insert>r.strstart&&(r.insert=r.strstart)),r.window.set(r.strm.input.subarray(r.strm.next_in-s,r.strm.next_in),r.strstart),r.strstart+=s,r.insert+=s>r.w_size-r.insert?r.w_size-r.insert:s),r.block_start=r.strstart),r.high_water<r.strstart&&(r.high_water=r.strstart),o?oa:e!==ni&&e!==Qt&&r.strm.avail_in===0&&r.strstart===r.block_start?aa:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(Ml(r.strm,r.window,r.strstart,a),r.strstart+=a,r.insert+=a>r.w_size-r.insert?r.w_size-r.insert:a),r.high_water<r.strstart&&(r.high_water=r.strstart),a=r.bi_valid+42>>3,a=r.pending_buf_size-a>65535?65535:r.pending_buf_size-a,t=a>r.w_size?r.w_size:a,n=r.strstart-r.block_start,(n>=t||(n||e===Qt)&&e!==ni&&r.strm.avail_in===0&&n<=a)&&(i=n>a?a:n,o=e===Qt&&r.strm.avail_in===0&&i===n?1:0,Dl(r,r.block_start,i,o),r.block_start+=i,Tt(r.strm)),o?Ji:mt)},cl=(r,e)=>{let t,i;for(;;){if(r.lookahead<gr){if(Zn(r),r.lookahead<gr&&e===ni)return mt;if(r.lookahead===0)break}if(t=0,r.lookahead>=se&&(r.ins_h=ai(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-gr&&(r.match_length=vm(r,t)),r.match_length>=se)if(i=ii(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=ai(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=ai(r,r.ins_h,r.window[r.strstart+1]);else i=ii(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++;if(i&&(Nt(r,!1),r.strm.avail_out===0))return mt}return r.insert=r.strstart<se-1?r.strstart:se-1,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?mt:aa},Mn=(r,e)=>{let t,i,n;for(;;){if(r.lookahead<gr){if(Zn(r),r.lookahead<gr&&e===ni)return mt;if(r.lookahead===0)break}if(t=0,r.lookahead>=se&&(r.ins_h=ai(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=se-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-gr&&(r.match_length=vm(r,t),r.match_length<=5&&(r.strategy===t0||r.match_length===se&&r.strstart-r.match_start>4096)&&(r.match_length=se-1)),r.prev_length>=se&&r.match_length<=r.prev_length){n=r.strstart+r.lookahead-se,i=ii(r,r.strstart-1-r.prev_match,r.prev_length-se),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=n&&(r.ins_h=ai(r,r.ins_h,r.window[r.strstart+se-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=se-1,r.strstart++,i&&(Nt(r,!1),r.strm.avail_out===0))return mt}else if(r.match_available){if(i=ii(r,0,r.window[r.strstart-1]),i&&Nt(r,!1),r.strstart++,r.lookahead--,r.strm.avail_out===0)return mt}else r.match_available=1,r.strstart++,r.lookahead--}return r.match_available&&(i=ii(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<se-1?r.strstart:se-1,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?mt:aa},b0=(r,e)=>{let t,i,n,a,o=r.window;for(;;){if(r.lookahead<=Yr){if(Zn(r),r.lookahead<=Yr&&e===ni)return mt;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=se&&r.strstart>0&&(n=r.strstart-1,i=o[n],i===o[++n]&&i===o[++n]&&i===o[++n])){a=r.strstart+Yr;do;while(i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&i===o[++n]&&n<a);r.match_length=Yr-(a-n),r.match_length>r.lookahead&&(r.match_length=r.lookahead)}if(r.match_length>=se?(t=ii(r,1,r.match_length-se),r.lookahead-=r.match_length,r.strstart+=r.match_length,r.match_length=0):(t=ii(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++),t&&(Nt(r,!1),r.strm.avail_out===0))return mt}return r.insert=0,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?mt:aa},w0=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Zn(r),r.lookahead===0)){if(e===ni)return mt;break}if(r.match_length=0,t=ii(r,0,r.window[r.strstart]),r.lookahead--,r.strstart++,t&&(Nt(r,!1),r.strm.avail_out===0))return mt}return r.insert=0,e===Qt?(Nt(r,!0),r.strm.avail_out===0?Ji:oa):r.sym_next&&(Nt(r,!1),r.strm.avail_out===0)?mt:aa};function cr(r,e,t,i,n){this.good_length=r,this.max_lazy=e,this.nice_length=t,this.max_chain=i,this.func=n}var Xa=[new cr(0,0,0,0,bm),new cr(4,4,8,4,cl),new cr(4,5,16,8,cl),new cr(4,6,32,32,cl),new cr(4,4,16,16,Mn),new cr(8,16,32,32,Mn),new cr(8,16,128,128,Mn),new cr(8,32,128,256,Mn),new cr(32,128,258,1024,Mn),new cr(32,258,258,4096,Mn)],S0=r=>{r.window_size=2*r.w_size,Zr(r.head),r.max_lazy_match=Xa[r.level].max_lazy,r.good_match=Xa[r.level].good_length,r.nice_match=Xa[r.level].nice_length,r.max_chain_length=Xa[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=se-1,r.match_available=0,r.ins_h=0};function _0(){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=kc,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(f0*2),this.dyn_dtree=new Uint16Array((2*p0+1)*2),this.bl_tree=new Uint16Array((2*d0+1)*2),Zr(this.dyn_ltree),Zr(this.dyn_dtree),Zr(this.bl_tree),this.l_desc=null,this.d_desc=null,this.bl_desc=null,this.bl_count=new Uint16Array(h0+1),this.heap=new Uint16Array(2*$l+1),Zr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*$l+1),Zr(this.depth),this.sym_buf=0,this.lit_bufsize=0,this.sym_next=0,this.sym_end=0,this.opt_len=0,this.static_len=0,this.matches=0,this.insert=0,this.bi_buf=0,this.bi_valid=0}var Ao=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Jn&&e.status!==Yl&&e.status!==Rl&&e.status!==Ll&&e.status!==Pl&&e.status!==Fl&&e.status!==ji&&e.status!==Ya?1:0},wm=r=>{if(Ao(r))return qi(r,mr);r.total_in=r.total_out=0,r.data_type=a0;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Yl:e.wrap?Jn:ji,r.adler=e.wrap===2?0:1,e.last_flush=-2,Gb(e),rt},Sm=r=>{let e=wm(r);return e===rt&&S0(r.state),e},E0=(r,e)=>Ao(r)||r.state.wrap!==2?mr:(r.state.gzhead=e,rt),_m=(r,e,t,i,n,a)=>{if(!r)return mr;let o=1;if(e===e0&&(e=6),i<0?(o=0,i=-i):i>15&&(o=2,i-=16),n<1||n>o0||t!==kc||i<8||i>15||e<0||e>9||a<0||a>i0||i===8&&o!==1)return qi(r,mr);i===8&&(i=9);let s=new _0;return r.state=s,s.strm=r,s.status=Jn,s.wrap=o,s.gzhead=null,s.w_bits=i,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=n+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+se-1)/se),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<n+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,Sm(r)},x0=(r,e)=>_m(r,e,kc,s0,c0,n0),A0=(r,e)=>{if(Ao(r)||e>Qf||e<0)return r?qi(r,mr):mr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Ya&&e!==Qt)return qi(r,r.avail_out===0?sl:mr);let i=t.last_flush;if(t.last_flush=e,t.pending!==0){if(Tt(r),r.avail_out===0)return t.last_flush=-1,rt}else if(r.avail_in===0&&Wf(e)<=Wf(i)&&e!==Qt)return qi(r,sl);if(t.status===Ya&&r.avail_in!==0)return qi(r,sl);if(t.status===Jn&&t.wrap===0&&(t.status=ji),t.status===Jn){let n=kc+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Cs||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,n|=a<<6,t.strstart!==0&&(n|=m0),n+=31-n%31,Fa(t,n),t.strstart!==0&&(Fa(t,r.adler>>>16),Fa(t,r.adler&65535)),r.adler=1,t.status=ji,Tt(r),t.pending!==0)return t.last_flush=-1,rt}if(t.status===Yl){if(r.adler=0,me(t,31),me(t,139),me(t,8),t.gzhead)me(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),me(t,t.gzhead.time&255),me(t,t.gzhead.time>>8&255),me(t,t.gzhead.time>>16&255),me(t,t.gzhead.time>>24&255),me(t,t.level===9?2:t.strategy>=Cs||t.level<2?4:0),me(t,t.gzhead.os&255),t.gzhead.extra&&t.gzhead.extra.length&&(me(t,t.gzhead.extra.length&255),me(t,t.gzhead.extra.length>>8&255)),t.gzhead.hcrc&&(r.adler=Ge(r.adler,t.pending_buf,t.pending,0)),t.gzindex=0,t.status=Rl;else if(me(t,0),me(t,0),me(t,0),me(t,0),me(t,0),me(t,t.level===9?2:t.strategy>=Cs||t.level<2?4:0),me(t,g0),t.status=ji,Tt(r),t.pending!==0)return t.last_flush=-1,rt}if(t.status===Rl){if(t.gzhead.extra){let n=t.pending,a=(t.gzhead.extra.length&65535)-t.gzindex;for(;t.pending+a>t.pending_buf_size;){let s=t.pending_buf_size-t.pending;if(t.pending_buf.set(t.gzhead.extra.subarray(t.gzindex,t.gzindex+s),t.pending),t.pending=t.pending_buf_size,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex+=s,Tt(r),t.pending!==0)return t.last_flush=-1,rt;n=0,a-=s}let o=new Uint8Array(t.gzhead.extra);t.pending_buf.set(o.subarray(t.gzindex,t.gzindex+a),t.pending),t.pending+=a,t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Ll}if(t.status===Ll){if(t.gzhead.name){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),Tt(r),t.pending!==0)return t.last_flush=-1,rt;n=0}t.gzindex<t.gzhead.name.length?a=t.gzhead.name.charCodeAt(t.gzindex++)&255:a=0,me(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),t.gzindex=0}t.status=Pl}if(t.status===Pl){if(t.gzhead.comment){let n=t.pending,a;do{if(t.pending===t.pending_buf_size){if(t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n)),Tt(r),t.pending!==0)return t.last_flush=-1,rt;n=0}t.gzindex<t.gzhead.comment.length?a=t.gzhead.comment.charCodeAt(t.gzindex++)&255:a=0,me(t,a)}while(a!==0);t.gzhead.hcrc&&t.pending>n&&(r.adler=Ge(r.adler,t.pending_buf,t.pending-n,n))}t.status=Fl}if(t.status===Fl){if(t.gzhead.hcrc){if(t.pending+2>t.pending_buf_size&&(Tt(r),t.pending!==0))return t.last_flush=-1,rt;me(t,r.adler&255),me(t,r.adler>>8&255),r.adler=0}if(t.status=ji,Tt(r),t.pending!==0)return t.last_flush=-1,rt}if(r.avail_in!==0||t.lookahead!==0||e!==ni&&t.status!==Ya){let n=t.level===0?bm(t,e):t.strategy===Cs?w0(t,e):t.strategy===r0?b0(t,e):Xa[t.level].func(t,e);if((n===Ji||n===oa)&&(t.status=Ya),n===mt||n===Ji)return r.avail_out===0&&(t.last_flush=-1),rt;if(n===aa&&(e===Zb?Jb(t):e!==Qf&&(Dl(t,0,0,!1),e===Yb&&(Zr(t.head),t.lookahead===0&&(t.strstart=0,t.block_start=0,t.insert=0))),Tt(r),r.avail_out===0))return t.last_flush=-1,rt}return e!==Qt?rt:t.wrap<=0?zf:(t.wrap===2?(me(t,r.adler&255),me(t,r.adler>>8&255),me(t,r.adler>>16&255),me(t,r.adler>>24&255),me(t,r.total_in&255),me(t,r.total_in>>8&255),me(t,r.total_in>>16&255),me(t,r.total_in>>24&255)):(Fa(t,r.adler>>>16),Fa(t,r.adler&65535)),Tt(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?rt:zf)},I0=r=>{if(Ao(r))return mr;let e=r.state.status;return r.state=null,e===ji?qi(r,Xb):rt},k0=(r,e)=>{let t=e.length;if(Ao(r))return mr;let i=r.state,n=i.wrap;if(n===2||n===1&&i.status!==Jn||i.lookahead)return mr;if(n===1&&(r.adler=go(r.adler,e,t,0)),i.wrap=0,t>=i.w_size){n===0&&(Zr(i.head),i.strstart=0,i.block_start=0,i.insert=0);let c=new Uint8Array(i.w_size);c.set(e.subarray(t-i.w_size,t),0),e=c,t=i.w_size}let a=r.avail_in,o=r.next_in,s=r.input;for(r.avail_in=t,r.next_in=0,r.input=e,Zn(i);i.lookahead>=se;){let c=i.strstart,u=i.lookahead-(se-1);do i.ins_h=ai(i,i.ins_h,i.window[c+se-1]),i.prev[c&i.w_mask]=i.head[i.ins_h],i.head[i.ins_h]=c,c++;while(--u);i.strstart=c,i.lookahead=se-1,Zn(i)}return i.strstart+=i.lookahead,i.block_start=i.strstart,i.insert=i.lookahead,i.lookahead=0,i.match_length=i.prev_length=se-1,i.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,i.wrap=n,rt},T0=x0,O0=_m,C0=Sm,N0=wm,D0=E0,$0=A0,R0=I0,L0=k0,P0="pako deflate (from Nodeca project)",ao={deflateInit:T0,deflateInit2:O0,deflateReset:C0,deflateResetKeep:N0,deflateSetHeader:D0,deflate:$0,deflateEnd:R0,deflateSetDictionary:L0,deflateInfo:P0},F0=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),M0=function(r){let e=Array.prototype.slice.call(arguments,1);for(;e.length;){let t=e.shift();if(!!t){if(typeof t!="object")throw new TypeError(t+"must be non-object");for(let i in t)F0(t,i)&&(r[i]=t[i])}}return r},U0=r=>{let e=0;for(let i=0,n=r.length;i<n;i++)e+=r[i].length;let t=new Uint8Array(e);for(let i=0,n=0,a=r.length;i<a;i++){let o=r[i];t.set(o,n),n+=o.length}return t},Tc={assign:M0,flattenChunks:U0},Em=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){Em=!1}var yo=new Uint8Array(256);for(let r=0;r<256;r++)yo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;yo[254]=yo[254]=1;var j0=r=>{if(typeof TextEncoder=="function"&&TextEncoder.prototype.encode)return new TextEncoder().encode(r);let e,t,i,n,a,o=r.length,s=0;for(n=0;n<o;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),s+=t<128?1:t<2048?2:t<65536?3:4;for(e=new Uint8Array(s),a=0,n=0;a<s;n++)t=r.charCodeAt(n),(t&64512)===55296&&n+1<o&&(i=r.charCodeAt(n+1),(i&64512)===56320&&(t=65536+(t-55296<<10)+(i-56320),n++)),t<128?e[a++]=t:t<2048?(e[a++]=192|t>>>6,e[a++]=128|t&63):t<65536?(e[a++]=224|t>>>12,e[a++]=128|t>>>6&63,e[a++]=128|t&63):(e[a++]=240|t>>>18,e[a++]=128|t>>>12&63,e[a++]=128|t>>>6&63,e[a++]=128|t&63);return e},q0=(r,e)=>{if(e<65534&&r.subarray&&Em)return String.fromCharCode.apply(null,r.length===e?r:r.subarray(0,e));let t="";for(let i=0;i<e;i++)t+=String.fromCharCode(r[i]);return t},B0=(r,e)=>{let t=e||r.length;if(typeof TextDecoder=="function"&&TextDecoder.prototype.decode)return new TextDecoder().decode(r.subarray(0,e));let i,n,a=new Array(t*2);for(n=0,i=0;i<t;){let o=r[i++];if(o<128){a[n++]=o;continue}let s=yo[o];if(s>4){a[n++]=65533,i+=s-1;continue}for(o&=s===2?31:s===3?15:7;s>1&&i<t;)o=o<<6|r[i++]&63,s--;if(s>1){a[n++]=65533;continue}o<65536?a[n++]=o:(o-=65536,a[n++]=55296|o>>10&1023,a[n++]=56320|o&1023)}return q0(a,n)},V0=(r,e)=>{e=e||r.length,e>r.length&&(e=r.length);let t=e-1;for(;t>=0&&(r[t]&192)===128;)t--;return t<0||t===0?e:t+yo[r[t]]>e?t:e},vo={string2buf:j0,buf2string:B0,utf8border:V0};function Q0(){this.input=null,this.next_in=0,this.avail_in=0,this.total_in=0,this.output=null,this.next_out=0,this.avail_out=0,this.total_out=0,this.msg="",this.state=null,this.data_type=2,this.adler=0}var xm=Q0,Am=Object.prototype.toString,{Z_NO_FLUSH:z0,Z_SYNC_FLUSH:W0,Z_FULL_FLUSH:H0,Z_FINISH:G0,Z_OK:mc,Z_STREAM_END:K0,Z_DEFAULT_COMPRESSION:J0,Z_DEFAULT_STRATEGY:Z0,Z_DEFLATED:Y0}=an;function Io(r){this.options=Tc.assign({level:J0,method:Y0,chunkSize:16384,windowBits:15,memLevel:8,strategy:Z0},r||{});let e=this.options;e.raw&&e.windowBits>0?e.windowBits=-e.windowBits:e.gzip&&e.windowBits>0&&e.windowBits<16&&(e.windowBits+=16),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xm,this.strm.avail_out=0;let t=ao.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==mc)throw new Error(Ki[t]);if(e.header&&ao.deflateSetHeader(this.strm,e.header),e.dictionary){let i;if(typeof e.dictionary=="string"?i=vo.string2buf(e.dictionary):Am.call(e.dictionary)==="[object ArrayBuffer]"?i=new Uint8Array(e.dictionary):i=e.dictionary,t=ao.deflateSetDictionary(this.strm,i),t!==mc)throw new Error(Ki[t]);this._dict_set=!0}}Io.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n,a;if(this.ended)return!1;for(e===~~e?a=e:a=e===!0?G0:z0,typeof r=="string"?t.input=vo.string2buf(r):Am.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){if(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),(a===W0||a===H0)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(n=ao.deflate(t,a),n===K0)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),n=ao.deflateEnd(this.strm),this.onEnd(n),this.ended=!0,n===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};Io.prototype.onData=function(r){this.chunks.push(r)};Io.prototype.onEnd=function(r){r===mc&&(this.result=Tc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Xl(r,e){let t=new Io(e);if(t.push(r,!0),t.err)throw t.msg||Ki[t.err];return t.result}function X0(r,e){return e=e||{},e.raw=!0,Xl(r,e)}function ew(r,e){return e=e||{},e.gzip=!0,Xl(r,e)}var tw=Io,rw=Xl,iw=X0,nw=ew,aw=an,ow={Deflate:tw,deflate:rw,deflateRaw:iw,gzip:nw,constants:aw},Ns=16209,sw=16191,cw=function r(e,t){let i,n,a,o,s,c,u,l,f,d,p,h,m,y,S,w,_,v,T,$,E,R,L,D,I=e.state;i=e.next_in,L=e.input,n=i+(e.avail_in-5),a=e.next_out,D=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=I.dmax,u=I.wsize,l=I.whave,f=I.wnext,d=I.window,p=I.hold,h=I.bits,m=I.lencode,y=I.distcode,S=(1<<I.lenbits)-1,w=(1<<I.distbits)-1;e:do{h<15&&(p+=L[i++]<<h,h+=8,p+=L[i++]<<h,h+=8),_=m[p&S];t:for(;;){if(v=_>>>24,p>>>=v,h-=v,v=_>>>16&255,v===0)D[a++]=_&65535;else if(v&16){T=_&65535,v&=15,v&&(h<v&&(p+=L[i++]<<h,h+=8),T+=p&(1<<v)-1,p>>>=v,h-=v),h<15&&(p+=L[i++]<<h,h+=8,p+=L[i++]<<h,h+=8),_=y[p&w];r:for(;;){if(v=_>>>24,p>>>=v,h-=v,v=_>>>16&255,v&16){if($=_&65535,v&=15,h<v&&(p+=L[i++]<<h,h+=8,h<v&&(p+=L[i++]<<h,h+=8)),$+=p&(1<<v)-1,$>c){e.msg="invalid distance too far back",I.mode=Ns;break e}if(p>>>=v,h-=v,v=a-o,$>v){if(v=$-v,v>l&&I.sane){e.msg="invalid distance too far back",I.mode=Ns;break e}if(E=0,R=d,f===0){if(E+=u-v,v<T){T-=v;do D[a++]=d[E++];while(--v);E=a-$,R=D}}else if(f<v){if(E+=u+f-v,v-=f,v<T){T-=v;do D[a++]=d[E++];while(--v);if(E=0,f<T){v=f,T-=v;do D[a++]=d[E++];while(--v);E=a-$,R=D}}}else if(E+=f-v,v<T){T-=v;do D[a++]=d[E++];while(--v);E=a-$,R=D}for(;T>2;)D[a++]=R[E++],D[a++]=R[E++],D[a++]=R[E++],T-=3;T&&(D[a++]=R[E++],T>1&&(D[a++]=R[E++]))}else{E=a-$;do D[a++]=D[E++],D[a++]=D[E++],D[a++]=D[E++],T-=3;while(T>2);T&&(D[a++]=D[E++],T>1&&(D[a++]=D[E++]))}}else if((v&64)===0){_=y[(_&65535)+(p&(1<<v)-1)];continue r}else{e.msg="invalid distance code",I.mode=Ns;break e}break}}else if((v&64)===0){_=m[(_&65535)+(p&(1<<v)-1)];continue t}else if(v&32){I.mode=sw;break e}else{e.msg="invalid literal/length code",I.mode=Ns;break e}break}}while(i<n&&a<s);T=h>>3,i-=T,h-=T<<3,p&=(1<<h)-1,e.next_in=i,e.next_out=a,e.avail_in=i<n?5+(n-i):5-(i-n),e.avail_out=a<s?257+(s-a):257-(a-s),I.hold=p,I.bits=h},Un=15,Hf=852,Gf=592,Kf=0,ul=1,Jf=2,uw=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0]),lw=new Uint8Array([16,16,16,16,16,16,16,16,17,17,17,17,18,18,18,18,19,19,19,19,20,20,20,20,21,21,21,21,16,72,78]),pw=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577,0,0]),dw=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]),fw=(r,e,t,i,n,a,o,s)=>{let c=s.bits,u=0,l=0,f=0,d=0,p=0,h=0,m=0,y=0,S=0,w=0,_,v,T,$,E,R=null,L,D=new Uint16Array(Un+1),I=new Uint16Array(Un+1),Ie=null,oe,M,Se;for(u=0;u<=Un;u++)D[u]=0;for(l=0;l<i;l++)D[e[t+l]]++;for(p=c,d=Un;d>=1&&D[d]===0;d--);if(p>d&&(p=d),d===0)return n[a++]=1<<24|64<<16|0,n[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<d&&D[f]===0;f++);for(p<f&&(p=f),y=1,u=1;u<=Un;u++)if(y<<=1,y-=D[u],y<0)return-1;if(y>0&&(r===Kf||d!==1))return-1;for(I[1]=0,u=1;u<Un;u++)I[u+1]=I[u]+D[u];for(l=0;l<i;l++)e[t+l]!==0&&(o[I[e[t+l]]++]=l);if(r===Kf?(R=Ie=o,L=20):r===ul?(R=uw,Ie=lw,L=257):(R=pw,Ie=dw,L=0),w=0,l=0,u=f,E=a,h=p,m=0,T=-1,S=1<<p,$=S-1,r===ul&&S>Hf||r===Jf&&S>Gf)return 1;for(;;){oe=u-m,o[l]+1<L?(M=0,Se=o[l]):o[l]>=L?(M=Ie[o[l]-L],Se=R[o[l]-L]):(M=32+64,Se=0),_=1<<u-m,v=1<<h,f=v;do v-=_,n[E+(w>>m)+v]=oe<<24|M<<16|Se|0;while(v!==0);for(_=1<<u-1;w&_;)_>>=1;if(_!==0?(w&=_-1,w+=_):w=0,l++,--D[u]===0){if(u===d)break;u=e[t+o[l]]}if(u>p&&(w&$)!==T){for(m===0&&(m=p),E+=f,h=u-m,y=1<<h;h+m<d&&(y-=D[h+m],!(y<=0));)h++,y<<=1;if(S+=1<<h,r===ul&&S>Hf||r===Jf&&S>Gf)return 1;T=w&$,n[T]=p<<24|h<<16|E-a|0}}return w!==0&&(n[E+w]=u-m<<24|64<<16|0),s.bits=p,0},oo=fw,hw=0,Im=1,km=2,{Z_FINISH:Zf,Z_BLOCK:mw,Z_TREES:Ds,Z_OK:Zi,Z_STREAM_END:gw,Z_NEED_DICT:yw,Z_STREAM_ERROR:zt,Z_DATA_ERROR:Tm,Z_MEM_ERROR:Om,Z_BUF_ERROR:vw,Z_DEFLATED:Yf}=an,Oc=16180,Xf=16181,eh=16182,th=16183,rh=16184,ih=16185,nh=16186,ah=16187,oh=16188,sh=16189,gc=16190,Ir=16191,ll=16192,ch=16193,pl=16194,uh=16195,lh=16196,ph=16197,dh=16198,$s=16199,Rs=16200,fh=16201,hh=16202,mh=16203,gh=16204,yh=16205,dl=16206,vh=16207,bh=16208,Oe=16209,Cm=16210,Nm=16211,bw=852,ww=592,Sw=15,_w=Sw,wh=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Ew(){this.strm=null,this.mode=0,this.last=!1,this.wrap=0,this.havedict=!1,this.flags=0,this.dmax=0,this.check=0,this.total=0,this.head=null,this.wbits=0,this.wsize=0,this.whave=0,this.wnext=0,this.window=null,this.hold=0,this.bits=0,this.length=0,this.offset=0,this.extra=0,this.lencode=null,this.distcode=null,this.lenbits=0,this.distbits=0,this.ncode=0,this.nlen=0,this.ndist=0,this.have=0,this.next=null,this.lens=new Uint16Array(320),this.work=new Uint16Array(288),this.lendyn=null,this.distdyn=null,this.sane=0,this.back=0,this.was=0}var on=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.mode<Oc||e.mode>Nm?1:0},Dm=r=>{if(on(r))return zt;let e=r.state;return r.total_in=r.total_out=e.total=0,r.msg="",e.wrap&&(r.adler=e.wrap&1),e.mode=Oc,e.last=0,e.havedict=0,e.flags=-1,e.dmax=32768,e.head=null,e.hold=0,e.bits=0,e.lencode=e.lendyn=new Int32Array(bw),e.distcode=e.distdyn=new Int32Array(ww),e.sane=1,e.back=-1,Zi},$m=r=>{if(on(r))return zt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Dm(r)},Rm=(r,e)=>{let t;if(on(r))return zt;let i=r.state;return e<0?(t=0,e=-e):(t=(e>>4)+5,e<48&&(e&=15)),e&&(e<8||e>15)?zt:(i.window!==null&&i.wbits!==e&&(i.window=null),i.wrap=t,i.wbits=e,$m(r))},Lm=(r,e)=>{if(!r)return zt;let t=new Ew;r.state=t,t.strm=r,t.window=null,t.mode=Oc;let i=Rm(r,e);return i!==Zi&&(r.state=null),i},xw=r=>Lm(r,_w),Sh=!0,fl,hl,Aw=r=>{if(Sh){fl=new Int32Array(512),hl=new Int32Array(32);let e=0;for(;e<144;)r.lens[e++]=8;for(;e<256;)r.lens[e++]=9;for(;e<280;)r.lens[e++]=7;for(;e<288;)r.lens[e++]=8;for(oo(Im,r.lens,0,288,fl,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;oo(km,r.lens,0,32,hl,0,r.work,{bits:5}),Sh=!1}r.lencode=fl,r.lenbits=9,r.distcode=hl,r.distbits=5},Pm=(r,e,t,i)=>{let n,a=r.state;return a.window===null&&(a.wsize=1<<a.wbits,a.wnext=0,a.whave=0,a.window=new Uint8Array(a.wsize)),i>=a.wsize?(a.window.set(e.subarray(t-a.wsize,t),0),a.wnext=0,a.whave=a.wsize):(n=a.wsize-a.wnext,n>i&&(n=i),a.window.set(e.subarray(t-i,t-i+n),a.wnext),i-=n,i?(a.window.set(e.subarray(t-i,t),0),a.wnext=i,a.whave=a.wsize):(a.wnext+=n,a.wnext===a.wsize&&(a.wnext=0),a.whave<a.wsize&&(a.whave+=n))),0},Iw=(r,e)=>{let t,i,n,a,o,s,c,u,l,f,d,p,h,m,y=0,S,w,_,v,T,$,E,R,L=new Uint8Array(4),D,I,Ie=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]);if(on(r)||!r.output||!r.input&&r.avail_in!==0)return zt;t=r.state,t.mode===Ir&&(t.mode=ll),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,u=t.hold,l=t.bits,f=s,d=c,R=Zi;e:for(;;)switch(t.mode){case Oc:if(t.wrap===0){t.mode=ll;break}for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&2&&u===35615){t.wbits===0&&(t.wbits=15),t.check=0,L[0]=u&255,L[1]=u>>>8&255,t.check=Ge(t.check,L,2,0),u=0,l=0,t.mode=Xf;break}if(t.head&&(t.head.done=!1),!(t.wrap&1)||(((u&255)<<8)+(u>>8))%31){r.msg="incorrect header check",t.mode=Oe;break}if((u&15)!==Yf){r.msg="unknown compression method",t.mode=Oe;break}if(u>>>=4,l-=4,E=(u&15)+8,t.wbits===0&&(t.wbits=E),E>15||E>t.wbits){r.msg="invalid window size",t.mode=Oe;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=u&512?sh:Ir,u=0,l=0;break;case Xf:for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==Yf){r.msg="unknown compression method",t.mode=Oe;break}if(t.flags&57344){r.msg="unknown header flags set",t.mode=Oe;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=Ge(t.check,L,2,0)),u=0,l=0,t.mode=eh;case eh:for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.head&&(t.head.time=u),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,L[2]=u>>>16&255,L[3]=u>>>24&255,t.check=Ge(t.check,L,4,0)),u=0,l=0,t.mode=th;case th:for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.head&&(t.head.xflags=u&255,t.head.os=u>>8),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=Ge(t.check,L,2,0)),u=0,l=0,t.mode=rh;case rh:if(t.flags&1024){for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.length=u,t.head&&(t.head.extra_len=u),t.flags&512&&t.wrap&4&&(L[0]=u&255,L[1]=u>>>8&255,t.check=Ge(t.check,L,2,0)),u=0,l=0}else t.head&&(t.head.extra=null);t.mode=ih;case ih:if(t.flags&1024&&(p=t.length,p>s&&(p=s),p&&(t.head&&(E=t.head.extra_len-t.length,t.head.extra||(t.head.extra=new Uint8Array(t.head.extra_len)),t.head.extra.set(i.subarray(a,a+p),E)),t.flags&512&&t.wrap&4&&(t.check=Ge(t.check,i,p,a)),s-=p,a+=p,t.length-=p),t.length))break e;t.length=0,t.mode=nh;case nh:if(t.flags&2048){if(s===0)break e;p=0;do E=i[a+p++],t.head&&E&&t.length<65536&&(t.head.name+=String.fromCharCode(E));while(E&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ge(t.check,i,p,a)),s-=p,a+=p,E)break e}else t.head&&(t.head.name=null);t.length=0,t.mode=ah;case ah:if(t.flags&4096){if(s===0)break e;p=0;do E=i[a+p++],t.head&&E&&t.length<65536&&(t.head.comment+=String.fromCharCode(E));while(E&&p<s);if(t.flags&512&&t.wrap&4&&(t.check=Ge(t.check,i,p,a)),s-=p,a+=p,E)break e}else t.head&&(t.head.comment=null);t.mode=oh;case oh:if(t.flags&512){for(;l<16;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.check&65535)){r.msg="header crc mismatch",t.mode=Oe;break}u=0,l=0}t.head&&(t.head.hcrc=t.flags>>9&1,t.head.done=!0),r.adler=t.check=0,t.mode=Ir;break;case sh:for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}r.adler=t.check=wh(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,yw;r.adler=t.check=1,t.mode=Ir;case Ir:if(e===mw||e===Ds)break e;case ll:if(t.last){u>>>=l&7,l-=l&7,t.mode=dl;break}for(;l<3;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}switch(t.last=u&1,u>>>=1,l-=1,u&3){case 0:t.mode=ch;break;case 1:if(Aw(t),t.mode=$s,e===Ds){u>>>=2,l-=2;break e}break;case 2:t.mode=lh;break;case 3:r.msg="invalid block type",t.mode=Oe}u>>>=2,l-=2;break;case ch:for(u>>>=l&7,l-=l&7;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if((u&65535)!==(u>>>16^65535)){r.msg="invalid stored block lengths",t.mode=Oe;break}if(t.length=u&65535,u=0,l=0,t.mode=pl,e===Ds)break e;case pl:t.mode=uh;case uh:if(p=t.length,p){if(p>s&&(p=s),p>c&&(p=c),p===0)break e;n.set(i.subarray(a,a+p),o),s-=p,a+=p,c-=p,o+=p,t.length-=p;break}t.mode=Ir;break;case lh:for(;l<14;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.nlen=(u&31)+257,u>>>=5,l-=5,t.ndist=(u&31)+1,u>>>=5,l-=5,t.ncode=(u&15)+4,u>>>=4,l-=4,t.nlen>286||t.ndist>30){r.msg="too many length or distance symbols",t.mode=Oe;break}t.have=0,t.mode=ph;case ph:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.lens[Ie[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[Ie[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,D={bits:t.lenbits},R=oo(hw,t.lens,0,19,t.lencode,0,t.work,D),t.lenbits=D.bits,R){r.msg="invalid code lengths set",t.mode=Oe;break}t.have=0,t.mode=dh;case dh:for(;t.have<t.nlen+t.ndist;){for(;y=t.lencode[u&(1<<t.lenbits)-1],S=y>>>24,w=y>>>16&255,_=y&65535,!(S<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(_<16)u>>>=S,l-=S,t.lens[t.have++]=_;else{if(_===16){for(I=S+2;l<I;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(u>>>=S,l-=S,t.have===0){r.msg="invalid bit length repeat",t.mode=Oe;break}E=t.lens[t.have-1],p=3+(u&3),u>>>=2,l-=2}else if(_===17){for(I=S+3;l<I;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=S,l-=S,E=0,p=3+(u&7),u>>>=3,l-=3}else{for(I=S+7;l<I;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=S,l-=S,E=0,p=11+(u&127),u>>>=7,l-=7}if(t.have+p>t.nlen+t.ndist){r.msg="invalid bit length repeat",t.mode=Oe;break}for(;p--;)t.lens[t.have++]=E}}if(t.mode===Oe)break;if(t.lens[256]===0){r.msg="invalid code -- missing end-of-block",t.mode=Oe;break}if(t.lenbits=9,D={bits:t.lenbits},R=oo(Im,t.lens,0,t.nlen,t.lencode,0,t.work,D),t.lenbits=D.bits,R){r.msg="invalid literal/lengths set",t.mode=Oe;break}if(t.distbits=6,t.distcode=t.distdyn,D={bits:t.distbits},R=oo(km,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,D),t.distbits=D.bits,R){r.msg="invalid distances set",t.mode=Oe;break}if(t.mode=$s,e===Ds)break e;case $s:t.mode=Rs;case Rs:if(s>=6&&c>=258){r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,cw(r,d),o=r.next_out,n=r.output,c=r.avail_out,a=r.next_in,i=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===Ir&&(t.back=-1);break}for(t.back=0;y=t.lencode[u&(1<<t.lenbits)-1],S=y>>>24,w=y>>>16&255,_=y&65535,!(S<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(w&&(w&240)===0){for(v=S,T=w,$=_;y=t.lencode[$+((u&(1<<v+T)-1)>>v)],S=y>>>24,w=y>>>16&255,_=y&65535,!(v+S<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=v,l-=v,t.back+=v}if(u>>>=S,l-=S,t.back+=S,t.length=_,w===0){t.mode=yh;break}if(w&32){t.back=-1,t.mode=Ir;break}if(w&64){r.msg="invalid literal/length code",t.mode=Oe;break}t.extra=w&15,t.mode=fh;case fh:if(t.extra){for(I=t.extra;l<I;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.length+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}t.was=t.length,t.mode=hh;case hh:for(;y=t.distcode[u&(1<<t.distbits)-1],S=y>>>24,w=y>>>16&255,_=y&65535,!(S<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if((w&240)===0){for(v=S,T=w,$=_;y=t.distcode[$+((u&(1<<v+T)-1)>>v)],S=y>>>24,w=y>>>16&255,_=y&65535,!(v+S<=l);){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}u>>>=v,l-=v,t.back+=v}if(u>>>=S,l-=S,t.back+=S,w&64){r.msg="invalid distance code",t.mode=Oe;break}t.offset=_,t.extra=w&15,t.mode=mh;case mh:if(t.extra){for(I=t.extra;l<I;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}t.offset+=u&(1<<t.extra)-1,u>>>=t.extra,l-=t.extra,t.back+=t.extra}if(t.offset>t.dmax){r.msg="invalid distance too far back",t.mode=Oe;break}t.mode=gh;case gh:if(c===0)break e;if(p=d-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=Oe;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=n,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do n[o++]=m[h++];while(--p);t.length===0&&(t.mode=Rs);break;case yh:if(c===0)break e;n[o++]=t.length,c--,t.mode=Rs;break;case dl:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=i[a++]<<l,l+=8}if(d-=c,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Ge(t.check,n,d,o-d):go(t.check,n,d,o-d)),d=c,t.wrap&4&&(t.flags?u:wh(u))!==t.check){r.msg="incorrect data check",t.mode=Oe;break}u=0,l=0}t.mode=vh;case vh:if(t.wrap&&t.flags){for(;l<32;){if(s===0)break e;s--,u+=i[a++]<<l,l+=8}if(t.wrap&4&&u!==(t.total&4294967295)){r.msg="incorrect length check",t.mode=Oe;break}u=0,l=0}t.mode=bh;case bh:R=gw;break e;case Oe:R=Tm;break e;case Cm:return Om;case Nm: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||d!==r.avail_out&&t.mode<Oe&&(t.mode<dl||e!==Zf))&&Pm(r,r.output,r.next_out,d-r.avail_out),f-=r.avail_in,d-=r.avail_out,r.total_in+=f,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?Ge(t.check,n,d,r.next_out-d):go(t.check,n,d,r.next_out-d)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Ir?128:0)+(t.mode===$s||t.mode===pl?256:0),(f===0&&d===0||e===Zf)&&R===Zi&&(R=vw),R},kw=r=>{if(on(r))return zt;let e=r.state;return e.window&&(e.window=null),r.state=null,Zi},Tw=(r,e)=>{if(on(r))return zt;let t=r.state;return(t.wrap&2)===0?zt:(t.head=e,e.done=!1,Zi)},Ow=(r,e)=>{let t=e.length,i,n,a;return on(r)||(i=r.state,i.wrap!==0&&i.mode!==gc)?zt:i.mode===gc&&(n=1,n=go(n,e,t,0),n!==i.check)?Tm:(a=Pm(r,e,t,t),a?(i.mode=Cm,Om):(i.havedict=1,Zi))},Cw=$m,Nw=Rm,Dw=Dm,$w=xw,Rw=Lm,Lw=Iw,Pw=kw,Fw=Tw,Mw=Ow,Uw="pako inflate (from Nodeca project)",Nr={inflateReset:Cw,inflateReset2:Nw,inflateResetKeep:Dw,inflateInit:$w,inflateInit2:Rw,inflate:Lw,inflateEnd:Pw,inflateGetHeader:Fw,inflateSetDictionary:Mw,inflateInfo:Uw};function jw(){this.text=0,this.time=0,this.xflags=0,this.os=0,this.extra=null,this.extra_len=0,this.name="",this.comment="",this.hcrc=0,this.done=!1}var qw=jw,Fm=Object.prototype.toString,{Z_NO_FLUSH:Bw,Z_FINISH:Vw,Z_OK:bo,Z_STREAM_END:ml,Z_NEED_DICT:gl,Z_STREAM_ERROR:Qw,Z_DATA_ERROR:_h,Z_MEM_ERROR:zw}=an;function ko(r){this.options=Tc.assign({chunkSize:1024*64,windowBits:15,to:""},r||{});let e=this.options;e.raw&&e.windowBits>=0&&e.windowBits<16&&(e.windowBits=-e.windowBits,e.windowBits===0&&(e.windowBits=-15)),e.windowBits>=0&&e.windowBits<16&&!(r&&r.windowBits)&&(e.windowBits+=32),e.windowBits>15&&e.windowBits<48&&(e.windowBits&15)===0&&(e.windowBits|=15),this.err=0,this.msg="",this.ended=!1,this.chunks=[],this.strm=new xm,this.strm.avail_out=0;let t=Nr.inflateInit2(this.strm,e.windowBits);if(t!==bo)throw new Error(Ki[t]);if(this.header=new qw,Nr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=vo.string2buf(e.dictionary):Fm.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Nr.inflateSetDictionary(this.strm,e.dictionary),t!==bo)))throw new Error(Ki[t])}ko.prototype.push=function(r,e){let t=this.strm,i=this.options.chunkSize,n=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?Vw:Bw,Fm.call(r)==="[object ArrayBuffer]"?t.input=new Uint8Array(r):t.input=r,t.next_in=0,t.avail_in=t.input.length;;){for(t.avail_out===0&&(t.output=new Uint8Array(i),t.next_out=0,t.avail_out=i),a=Nr.inflate(t,o),a===gl&&n&&(a=Nr.inflateSetDictionary(t,n),a===bo?a=Nr.inflate(t,o):a===_h&&(a=gl));t.avail_in>0&&a===ml&&t.state.wrap>0&&r[t.next_in]!==0;)Nr.inflateReset(t),a=Nr.inflate(t,o);switch(a){case Qw:case _h:case gl:case zw:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===ml))if(this.options.to==="string"){let c=vo.utf8border(t.output,t.next_out),u=t.next_out-c,l=vo.buf2string(t.output,c);t.next_out=u,t.avail_out=i-u,u&&t.output.set(t.output.subarray(c,c+u),0),this.onData(l)}else this.onData(t.output.length===t.next_out?t.output:t.output.subarray(0,t.next_out));if(!(a===bo&&s===0)){if(a===ml)return a=Nr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};ko.prototype.onData=function(r){this.chunks.push(r)};ko.prototype.onEnd=function(r){r===bo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Tc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ep(r,e){let t=new ko(e);if(t.push(r),t.err)throw t.msg||Ki[t.err];return t.result}function Ww(r,e){return e=e||{},e.raw=!0,ep(r,e)}var Hw=ko,Gw=ep,Kw=Ww,Jw=ep,Zw=an,Yw={Inflate:Hw,inflate:Gw,inflateRaw:Kw,ungzip:Jw,constants:Zw},{Deflate:Xw,deflate:eS,deflateRaw:tS,gzip:rS}=ow,{Inflate:iS,inflate:nS,inflateRaw:aS,ungzip:oS}=Yw,sS=Xw,cS=eS,uS=tS,lS=rS,pS=iS,dS=nS,fS=aS,hS=oS,mS=an,gS={Deflate:sS,deflate:cS,deflateRaw:uS,gzip:lS,Inflate:pS,inflate:dS,inflateRaw:fS,ungzip:hS,constants:mS},xe=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Ae=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}};xe([g(),Ae("design:type",String)],yc.prototype,"input",void 0);xe([g(),Ae("design:type",String)],yc.prototype,"output",void 0);yc=xe([Je(),Ae("design:paramtypes",[String,String])],yc);var vc=class{constructor(e,t){this.input=e,this.output=t}};xe([g(),Ae("design:type",String)],vc.prototype,"input",void 0);xe([g(),Ae("design:type",String)],vc.prototype,"output",void 0);vc=xe([H(),Ae("design:paramtypes",[String,String])],vc);var ui=class{constructor(e,t,i,n,a){this.name=e,this.modelId=t,this.systemPrompt=i,this.promptExamples=n,this.metaData=a}};xe([g(),Ae("design:type",String)],ui.prototype,"name",void 0);xe([g(),Ae("design:type",String)],ui.prototype,"modelId",void 0);xe([g(),Ae("design:type",String)],ui.prototype,"systemPrompt",void 0);xe([g(),Ae("design:type",Array)],ui.prototype,"promptExamples",void 0);xe([g(),Ae("design:type",String)],ui.prototype,"metaData",void 0);ui=xe([Je(),Ae("design:paramtypes",[String,String,String,Array,String])],ui);var br=class{constructor(e,t,i,n,a,o,s,c){this.name=e,this.modelId=t,this.taskId=i,this.systemPrompt=n,this.promptExamples=a,this.metaData=o,this.createdAt=s,this.updatedAt=c}};xe([g(),Ae("design:type",String)],br.prototype,"name",void 0);xe([g(),Ae("design:type",String)],br.prototype,"modelId",void 0);xe([g(),Ae("design:type",String)],br.prototype,"taskId",void 0);xe([g(),Ae("design:type",String)],br.prototype,"systemPrompt",void 0);xe([g(),Ae("design:type",Array)],br.prototype,"promptExamples",void 0);xe([g(),Ae("design:type",String)],br.prototype,"metaData",void 0);xe([g(),Ae("design:type",String)],br.prototype,"createdAt",void 0);xe([g(),Ae("design:type",String)],br.prototype,"updatedAt",void 0);br=xe([H(),Ae("design:paramtypes",[String,String,String,String,Array,String,String,String])],br);var Yi=class{constructor(e,t,i,n,a){this.model=e,this.status=t,this.progress=i,this.downloaded=n,this.loaded=a}};xe([g(),Ae("design:type",String)],Yi.prototype,"model",void 0);xe([g(),Ae("design:type",String)],Yi.prototype,"status",void 0);xe([g(),Ae("design:type",Number)],Yi.prototype,"progress",void 0);xe([g(),Ae("design:type",Boolean)],Yi.prototype,"downloaded",void 0);xe([g(),Ae("design:type",Boolean)],Yi.prototype,"loaded",void 0);Yi=xe([H(),Ae("design:paramtypes",[String,String,Number,Boolean,Boolean])],Yi);var yS=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},We=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},Qe,Gs,Ul=class{constructor(e,t=!0){Qe.set(this,void 0),Gs.set(this,new Map),yS(this,Qe,e,"f")}async getModels(){let e=await We(this,Qe,"f").query({query:A`
|
|
792
|
+
}`,variables:{url:e,interactionCall:t}}));return n}};Nr=new WeakMap;var Ic={};Ic.byteLength=vb;Ic.toByteArray=wb;Ic.fromByteArray=Eb;var fr=[],jt=[],yb=typeof Uint8Array<"u"?Uint8Array:Array,nl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(Cn=0,Mf=nl.length;Cn<Mf;++Cn)fr[Cn]=nl[Cn],jt[nl.charCodeAt(Cn)]=Cn;var Cn,Mf;jt["-".charCodeAt(0)]=62;jt["_".charCodeAt(0)]=63;function am(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 vb(r){var e=am(r),t=e[0],n=e[1];return(t+n)*3/4-n}function bb(r,e,t){return(e+t)*3/4-t}function wb(r){var e,t=am(r),n=t[0],i=t[1],a=new yb(bb(r,n,i)),o=0,s=i>0?n-4:n,c;for(c=0;c<s;c+=4)e=jt[r.charCodeAt(c)]<<18|jt[r.charCodeAt(c+1)]<<12|jt[r.charCodeAt(c+2)]<<6|jt[r.charCodeAt(c+3)],a[o++]=e>>16&255,a[o++]=e>>8&255,a[o++]=e&255;return i===2&&(e=jt[r.charCodeAt(c)]<<2|jt[r.charCodeAt(c+1)]>>4,a[o++]=e&255),i===1&&(e=jt[r.charCodeAt(c)]<<10|jt[r.charCodeAt(c+1)]<<4|jt[r.charCodeAt(c+2)]>>2,a[o++]=e>>8&255,a[o++]=e&255),a}function Sb(r){return fr[r>>18&63]+fr[r>>12&63]+fr[r>>6&63]+fr[r&63]}function _b(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(Sb(n));return i.join("")}function Eb(r){for(var e,t=r.length,n=t%3,i=[],a=16383,o=0,s=t-n;o<s;o+=a)i.push(_b(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 xb=4,Uf=0,jf=1,kb=2;function ia(r){let e=r.length;for(;--e>=0;)r[e]=0}var Ab=0,om=1,Ib=2,Tb=3,Ob=258,Gl=29,ko=256,fo=ko+1+Gl,zi=30,Kl=19,sm=2*fo+1,qn=15,il=16,Cb=7,Jl=256,cm=16,um=17,lm=18,Nl=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0]),Gs=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Nb=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,3,7]),pm=new Uint8Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),$b=512,$r=new Array((fo+2)*2);ia($r);var ao=new Array(zi*2);ia(ao);var ho=new Array($b);ia(ho);var mo=new Array(Ob-Tb+1);ia(mo);var Zl=new Array(Gl);ia(Zl);var fc=new Array(zi);ia(fc);function al(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 dm,fm,hm;function ol(r,e){this.dyn_tree=r,this.max_code=0,this.stat_desc=e}var mm=r=>r<256?ho[r]:ho[256+(r>>>7)],go=(r,e)=>{r.pending_buf[r.pending++]=e&255,r.pending_buf[r.pending++]=e>>>8&255},_t=(r,e,t)=>{r.bi_valid>il-t?(r.bi_buf|=e<<r.bi_valid&65535,go(r,r.bi_buf),r.bi_buf=e>>il-r.bi_valid,r.bi_valid+=t-il):(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])},gm=(r,e)=>{let t=0;do t|=r&1,r>>>=1,t<<=1;while(--e>0);return t>>>1},Db=r=>{r.bi_valid===16?(go(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)},Rb=(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,f,d,p,h,m=0;for(d=0;d<=qn;d++)r.bl_count[d]=0;for(t[r.heap[r.heap_max]*2+1]=0,u=r.heap_max+1;u<sm;u++)l=r.heap[u],d=t[t[l*2+1]*2+1]+1,d>c&&(d=c,m++),t[l*2+1]=d,!(l>n)&&(r.bl_count[d]++,p=0,l>=s&&(p=o[l-s]),h=t[l*2],r.opt_len+=h*(d+p),a&&(r.static_len+=h*(i[l*2+1]+p)));if(m!==0){do{for(d=c-1;r.bl_count[d]===0;)d--;r.bl_count[d]--,r.bl_count[d+1]+=2,r.bl_count[c]--,m-=2}while(m>0);for(d=c;d!==0;d--)for(l=r.bl_count[d];l!==0;)f=r.heap[--u],!(f>n)&&(t[f*2+1]!==d&&(r.opt_len+=(d-t[f*2+1])*t[f*2],t[f*2+1]=d),l--)}},ym=(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]=gm(n[s]++,s))}},Lb=()=>{let r,e,t,n,i,a=new Array(qn+1);for(t=0,n=0;n<Gl-1;n++)for(Zl[n]=t,r=0;r<1<<Nl[n];r++)mo[t++]=n;for(mo[t-1]=n,i=0,n=0;n<16;n++)for(fc[n]=i,r=0;r<1<<Gs[n];r++)ho[i++]=n;for(i>>=7;n<zi;n++)for(fc[n]=i<<7,r=0;r<1<<Gs[n]-7;r++)ho[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(ym($r,fo+1,a),r=0;r<zi;r++)ao[r*2+1]=5,ao[r*2]=gm(r,5);dm=new al($r,Nl,ko+1,fo,qn),fm=new al(ao,Gs,0,zi,qn),hm=new al(new Array(0),Nb,0,Kl,Cb)},vm=r=>{let e;for(e=0;e<fo;e++)r.dyn_ltree[e*2]=0;for(e=0;e<zi;e++)r.dyn_dtree[e*2]=0;for(e=0;e<Kl;e++)r.bl_tree[e*2]=0;r.dyn_ltree[Jl*2]=1,r.opt_len=r.static_len=0,r.sym_next=r.matches=0},bm=r=>{r.bi_valid>8?go(r,r.bi_buf):r.bi_valid>0&&(r.pending_buf[r.pending++]=r.bi_buf),r.bi_buf=0,r.bi_valid=0},qf=(r,e,t,n)=>{let i=e*2,a=t*2;return r[i]<r[a]||r[i]===r[a]&&n[e]<=n[t]},sl=(r,e,t)=>{let n=r.heap[t],i=t<<1;for(;i<=r.heap_len&&(i<r.heap_len&&qf(e,r.heap[i+1],r.heap[i],r.depth)&&i++,!qf(e,n,r.heap[i],r.depth));)r.heap[t]=r.heap[i],t=i,i<<=1;r.heap[t]=n},Bf=(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=mo[i],hr(r,o+ko+1,e),s=Nl[o],s!==0&&(i-=Zl[o],_t(r,i,s)),n--,o=mm(n),hr(r,o,t),s=Gs[o],s!==0&&(n-=fc[o],_t(r,n,s)));while(a<r.sym_next);hr(r,Jl,e)},$l=(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=sm,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--)sl(r,t,o);u=a;do o=r.heap[1],r.heap[1]=r.heap[r.heap_len--],sl(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++,sl(r,t,1);while(r.heap_len>=2);r.heap[--r.heap_max]=r.heap[1],Rb(r,e),ym(t,c,r.bl_count)},Vf=(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[cm*2]++):s<=10?r.bl_tree[um*2]++:r.bl_tree[lm*2]++,s=0,i=a,o===0?(c=138,u=3):a===o?(c=6,u=3):(c=7,u=4))},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),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,cm,r.bl_tree),_t(r,s-3,2)):s<=10?(hr(r,um,r.bl_tree),_t(r,s-3,3)):(hr(r,lm,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)}},Pb=r=>{let e;for(Vf(r,r.dyn_ltree,r.l_desc.max_code),Vf(r,r.dyn_dtree,r.d_desc.max_code),$l(r,r.bl_desc),e=Kl-1;e>=3&&r.bl_tree[pm[e]*2+1]===0;e--);return r.opt_len+=3*(e+1)+5+5+4,e},Fb=(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[pm[i]*2+1],3);Qf(r,r.dyn_ltree,e-1),Qf(r,r.dyn_dtree,t-1)},Mb=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 jf;for(t=32;t<ko;t++)if(r.dyn_ltree[t*2]!==0)return jf;return Uf},zf=!1,Ub=r=>{zf||(Lb(),zf=!0),r.l_desc=new ol(r.dyn_ltree,dm),r.d_desc=new ol(r.dyn_dtree,fm),r.bl_desc=new ol(r.bl_tree,hm),r.bi_buf=0,r.bi_valid=0,vm(r)},wm=(r,e,t,n)=>{_t(r,(Ab<<1)+(n?1:0),3),bm(r),go(r,t),go(r,~t),t&&r.pending_buf.set(r.window.subarray(e,e+t),r.pending),r.pending+=t},jb=r=>{_t(r,om<<1,3),hr(r,Jl,$r),Db(r)},qb=(r,e,t,n)=>{let i,a,o=0;r.level>0?(r.strm.data_type===kb&&(r.strm.data_type=Mb(r)),$l(r,r.l_desc),$l(r,r.d_desc),o=Pb(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?wm(r,e,t,n):r.strategy===xb||a===i?(_t(r,(om<<1)+(n?1:0),3),Bf(r,$r,ao)):(_t(r,(Ib<<1)+(n?1:0),3),Fb(r,r.l_desc.max_code+1,r.d_desc.max_code+1,o+1),Bf(r,r.dyn_ltree,r.dyn_dtree)),vm(r),n&&bm(r)},Bb=(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[(mo[t]+ko+1)*2]++,r.dyn_dtree[mm(e)*2]++),r.sym_next===r.sym_end),Vb=Ub,Qb=wm,zb=qb,Wb=Bb,Hb=jb,Gb={_tr_init:Vb,_tr_stored_block:Qb,_tr_flush_block:zb,_tr_tally:Wb,_tr_align:Hb},Kb=(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},yo=Kb,Jb=()=>{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},Zb=new Uint32Array(Jb()),Yb=(r,e,t,n)=>{let i=Zb,a=n+t;r^=-1;for(let o=n;o<a;o++)r=r>>>8^i[(r^e[o])&255];return r^-1},We=Yb,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:Xb,_tr_stored_block:Dl,_tr_flush_block:e0,_tr_tally:an,_tr_align:t0}=Gb,{Z_NO_FLUSH:on,Z_PARTIAL_FLUSH:r0,Z_FULL_FLUSH:n0,Z_FINISH:Bt,Z_BLOCK:Wf,Z_OK:et,Z_STREAM_END:Hf,Z_STREAM_ERROR:yr,Z_DATA_ERROR:i0,Z_BUF_ERROR:cl,Z_DEFAULT_COMPRESSION:a0,Z_FILTERED:o0,Z_HUFFMAN_ONLY:Ns,Z_RLE:s0,Z_FIXED:c0,Z_DEFAULT_STRATEGY:u0,Z_UNKNOWN:l0,Z_DEFLATED:Tc}=oi,p0=9,d0=15,f0=8,h0=29,m0=256,Rl=m0+1+h0,g0=30,y0=19,v0=2*Rl+1,b0=15,ae=3,en=258,vr=en+ae+1,w0=32,Ji=42,Yl=57,Ll=69,Pl=73,Fl=91,Ml=103,Bn=113,Ya=666,ft=1,aa=2,Yn=3,oa=4,S0=3,Vn=(r,e)=>(r.msg=Zn[e],e),Gf=r=>r*2-(r>4?9:0),Xr=r=>{let e=r.length;for(;--e>=0;)r[e]=0},_0=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)},E0=(r,e,t)=>(e<<r.hash_shift^t)&r.hash_mask,sn=E0,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)=>{e0(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},Fa=(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=yo(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)},Sm=(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,f=r.prev,d=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<d);if(a=en-(d-n),n=d-en,a>o){if(r.match_start=e,o=a,a>=s)break;p=u[n+o-1],h=u[n+o]}}while((e=f[e&l])>c&&--t!==0);return o<=r.lookahead?o:r.lookahead},Zi=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),_0(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>=ae)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+ae-1]),r.prev[i&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=i,i++,r.insert--,!(r.lookahead+r.insert<ae)););}while(r.lookahead<vr&&r.strm.avail_in!==0)},_m=(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===on||n!==i+r.strm.avail_in)))break;o=e===Bt&&n===i+r.strm.avail_in?1:0,Dl(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?oa:e!==on&&e!==Bt&&r.strm.avail_in===0&&r.strstart===r.block_start?aa:(a=r.window_size-r.strstart,r.strm.avail_in>a&&r.block_start>=r.w_size&&(r.block_start-=r.w_size,r.strstart-=r.w_size,r.window.set(r.window.subarray(r.w_size,r.w_size+r.strstart),0),r.matches<2&&r.matches++,a+=r.w_size,r.insert>r.strstart&&(r.insert=r.strstart)),a>r.strm.avail_in&&(a=r.strm.avail_in),a&&(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!==on&&r.strm.avail_in===0&&i<=a)&&(n=i>a?a:i,o=e===Bt&&r.strm.avail_in===0&&n===i?1:0,Dl(r,r.block_start,n,o),r.block_start+=n,It(r.strm)),o?Yn:ft)},ul=(r,e)=>{let t,n;for(;;){if(r.lookahead<vr){if(Zi(r),r.lookahead<vr&&e===on)return ft;if(r.lookahead===0)break}if(t=0,r.lookahead>=ae&&(r.ins_h=sn(r,r.ins_h,r.window[r.strstart+ae-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),t!==0&&r.strstart-t<=r.w_size-vr&&(r.match_length=Sm(r,t)),r.match_length>=ae)if(n=an(r,r.strstart-r.match_start,r.match_length-ae),r.lookahead-=r.match_length,r.match_length<=r.max_lazy_match&&r.lookahead>=ae){r.match_length--;do r.strstart++,r.ins_h=sn(r,r.ins_h,r.window[r.strstart+ae-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart;while(--r.match_length!==0);r.strstart++}else r.strstart+=r.match_length,r.match_length=0,r.ins_h=r.window[r.strstart],r.ins_h=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&&(Ot(r,!1),r.strm.avail_out===0))return ft}return r.insert=r.strstart<ae-1?r.strstart:ae-1,e===Bt?(Ot(r,!0),r.strm.avail_out===0?Yn:oa):r.sym_next&&(Ot(r,!1),r.strm.avail_out===0)?ft:aa},Ui=(r,e)=>{let t,n,i;for(;;){if(r.lookahead<vr){if(Zi(r),r.lookahead<vr&&e===on)return ft;if(r.lookahead===0)break}if(t=0,r.lookahead>=ae&&(r.ins_h=sn(r,r.ins_h,r.window[r.strstart+ae-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart),r.prev_length=r.match_length,r.prev_match=r.match_start,r.match_length=ae-1,t!==0&&r.prev_length<r.max_lazy_match&&r.strstart-t<=r.w_size-vr&&(r.match_length=Sm(r,t),r.match_length<=5&&(r.strategy===o0||r.match_length===ae&&r.strstart-r.match_start>4096)&&(r.match_length=ae-1)),r.prev_length>=ae&&r.match_length<=r.prev_length){i=r.strstart+r.lookahead-ae,n=an(r,r.strstart-1-r.prev_match,r.prev_length-ae),r.lookahead-=r.prev_length-1,r.prev_length-=2;do++r.strstart<=i&&(r.ins_h=sn(r,r.ins_h,r.window[r.strstart+ae-1]),t=r.prev[r.strstart&r.w_mask]=r.head[r.ins_h],r.head[r.ins_h]=r.strstart);while(--r.prev_length!==0);if(r.match_available=0,r.match_length=ae-1,r.strstart++,n&&(Ot(r,!1),r.strm.avail_out===0))return ft}else if(r.match_available){if(n=an(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=an(r,0,r.window[r.strstart-1]),r.match_available=0),r.insert=r.strstart<ae-1?r.strstart:ae-1,e===Bt?(Ot(r,!0),r.strm.avail_out===0?Yn:oa):r.sym_next&&(Ot(r,!1),r.strm.avail_out===0)?ft:aa},x0=(r,e)=>{let t,n,i,a,o=r.window;for(;;){if(r.lookahead<=en){if(Zi(r),r.lookahead<=en&&e===on)return ft;if(r.lookahead===0)break}if(r.match_length=0,r.lookahead>=ae&&r.strstart>0&&(i=r.strstart-1,n=o[i],n===o[++i]&&n===o[++i]&&n===o[++i])){a=r.strstart+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>=ae?(t=an(r,1,r.match_length-ae),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&&(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:oa):r.sym_next&&(Ot(r,!1),r.strm.avail_out===0)?ft:aa},k0=(r,e)=>{let t;for(;;){if(r.lookahead===0&&(Zi(r),r.lookahead===0)){if(e===on)return ft;break}if(r.match_length=0,t=an(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:oa):r.sym_next&&(Ot(r,!1),r.strm.avail_out===0)?ft:aa};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 Xa=[new cr(0,0,0,0,_m),new cr(4,4,8,4,ul),new cr(4,5,16,8,ul),new cr(4,6,32,32,ul),new cr(4,4,16,16,Ui),new cr(8,16,32,32,Ui),new cr(8,16,128,128,Ui),new cr(8,32,128,256,Ui),new cr(32,128,258,1024,Ui),new cr(32,258,258,4096,Ui)],A0=r=>{r.window_size=2*r.w_size,Xr(r.head),r.max_lazy_match=Xa[r.level].max_lazy,r.good_match=Xa[r.level].good_length,r.nice_match=Xa[r.level].nice_length,r.max_chain_length=Xa[r.level].max_chain,r.strstart=0,r.block_start=0,r.lookahead=0,r.insert=0,r.match_length=r.prev_length=ae-1,r.match_available=0,r.ins_h=0};function I0(){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=Tc,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(v0*2),this.dyn_dtree=new Uint16Array((2*g0+1)*2),this.bl_tree=new Uint16Array((2*y0+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(b0+1),this.heap=new Uint16Array(2*Rl+1),Xr(this.heap),this.heap_len=0,this.heap_max=0,this.depth=new Uint16Array(2*Rl+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 Ao=r=>{if(!r)return 1;let e=r.state;return!e||e.strm!==r||e.status!==Ji&&e.status!==Yl&&e.status!==Ll&&e.status!==Pl&&e.status!==Fl&&e.status!==Ml&&e.status!==Bn&&e.status!==Ya?1:0},Em=r=>{if(Ao(r))return Vn(r,yr);r.total_in=r.total_out=0,r.data_type=l0;let e=r.state;return e.pending=0,e.pending_out=0,e.wrap<0&&(e.wrap=-e.wrap),e.status=e.wrap===2?Yl:e.wrap?Ji:Bn,r.adler=e.wrap===2?0:1,e.last_flush=-2,Xb(e),et},xm=r=>{let e=Em(r);return e===et&&A0(r.state),e},T0=(r,e)=>Ao(r)||r.state.wrap!==2?yr:(r.state.gzhead=e,et),km=(r,e,t,n,i,a)=>{if(!r)return yr;let o=1;if(e===a0&&(e=6),n<0?(o=0,n=-n):n>15&&(o=2,n-=16),i<1||i>p0||t!==Tc||n<8||n>15||e<0||e>9||a<0||a>c0||n===8&&o!==1)return Vn(r,yr);n===8&&(n=9);let s=new I0;return r.state=s,s.strm=r,s.status=Ji,s.wrap=o,s.gzhead=null,s.w_bits=n,s.w_size=1<<s.w_bits,s.w_mask=s.w_size-1,s.hash_bits=i+7,s.hash_size=1<<s.hash_bits,s.hash_mask=s.hash_size-1,s.hash_shift=~~((s.hash_bits+ae-1)/ae),s.window=new Uint8Array(s.w_size*2),s.head=new Uint16Array(s.hash_size),s.prev=new Uint16Array(s.w_size),s.lit_bufsize=1<<i+6,s.pending_buf_size=s.lit_bufsize*4,s.pending_buf=new Uint8Array(s.pending_buf_size),s.sym_buf=s.lit_bufsize,s.sym_end=(s.lit_bufsize-1)*3,s.level=e,s.strategy=a,s.method=t,xm(r)},O0=(r,e)=>km(r,e,Tc,d0,f0,u0),C0=(r,e)=>{if(Ao(r)||e>Wf||e<0)return r?Vn(r,yr):yr;let t=r.state;if(!r.output||r.avail_in!==0&&!r.input||t.status===Ya&&e!==Bt)return Vn(r,r.avail_out===0?cl: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&&Gf(e)<=Gf(n)&&e!==Bt)return Vn(r,cl);if(t.status===Ya&&r.avail_in!==0)return Vn(r,cl);if(t.status===Ji&&t.wrap===0&&(t.status=Bn),t.status===Ji){let i=Tc+(t.w_bits-8<<4)<<8,a=-1;if(t.strategy>=Ns||t.level<2?a=0:t.level<6?a=1:t.level===6?a=2:a=3,i|=a<<6,t.strstart!==0&&(i|=w0),i+=31-i%31,Fa(t,i),t.strstart!==0&&(Fa(t,r.adler>>>16),Fa(t,r.adler&65535)),r.adler=1,t.status=Bn,It(r),t.pending!==0)return t.last_flush=-1,et}if(t.status===Yl){if(r.adler=0,me(t,31),me(t,139),me(t,8),t.gzhead)me(t,(t.gzhead.text?1:0)+(t.gzhead.hcrc?2:0)+(t.gzhead.extra?4:0)+(t.gzhead.name?8:0)+(t.gzhead.comment?16:0)),me(t,t.gzhead.time&255),me(t,t.gzhead.time>>8&255),me(t,t.gzhead.time>>16&255),me(t,t.gzhead.time>>24&255),me(t,t.level===9?2:t.strategy>=Ns||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=Ll;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>=Ns||t.level<2?4:0),me(t,S0),t.status=Bn,It(r),t.pending!==0)return t.last_flush=-1,et}if(t.status===Ll){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=Pl}if(t.status===Pl){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=Fl}if(t.status===Fl){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=Ml}if(t.status===Ml){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=Bn,It(r),t.pending!==0)return t.last_flush=-1,et}if(r.avail_in!==0||t.lookahead!==0||e!==on&&t.status!==Ya){let i=t.level===0?_m(t,e):t.strategy===Ns?k0(t,e):t.strategy===s0?x0(t,e):Xa[t.level].func(t,e);if((i===Yn||i===oa)&&(t.status=Ya),i===ft||i===Yn)return r.avail_out===0&&(t.last_flush=-1),et;if(i===aa&&(e===r0?t0(t):e!==Wf&&(Dl(t,0,0,!1),e===n0&&(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?Hf:(t.wrap===2?(me(t,r.adler&255),me(t,r.adler>>8&255),me(t,r.adler>>16&255),me(t,r.adler>>24&255),me(t,r.total_in&255),me(t,r.total_in>>8&255),me(t,r.total_in>>16&255),me(t,r.total_in>>24&255)):(Fa(t,r.adler>>>16),Fa(t,r.adler&65535)),It(r),t.wrap>0&&(t.wrap=-t.wrap),t.pending!==0?et:Hf)},N0=r=>{if(Ao(r))return yr;let e=r.state.status;return r.state=null,e===Bn?Vn(r,i0):et},$0=(r,e)=>{let t=e.length;if(Ao(r))return yr;let n=r.state,i=n.wrap;if(i===2||i===1&&n.status!==Ji||n.lookahead)return yr;if(i===1&&(r.adler=yo(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,Zi(n);n.lookahead>=ae;){let c=n.strstart,u=n.lookahead-(ae-1);do n.ins_h=sn(n,n.ins_h,n.window[c+ae-1]),n.prev[c&n.w_mask]=n.head[n.ins_h],n.head[n.ins_h]=c,c++;while(--u);n.strstart=c,n.lookahead=ae-1,Zi(n)}return n.strstart+=n.lookahead,n.block_start=n.strstart,n.insert=n.lookahead,n.lookahead=0,n.match_length=n.prev_length=ae-1,n.match_available=0,r.next_in=o,r.input=s,r.avail_in=a,n.wrap=i,et},D0=O0,R0=km,L0=xm,P0=Em,F0=T0,M0=C0,U0=N0,j0=$0,q0="pako deflate (from Nodeca project)",oo={deflateInit:D0,deflateInit2:R0,deflateReset:L0,deflateResetKeep:P0,deflateSetHeader:F0,deflate:M0,deflateEnd:U0,deflateSetDictionary:j0,deflateInfo:q0},B0=(r,e)=>Object.prototype.hasOwnProperty.call(r,e),V0=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)B0(t,n)&&(r[n]=t[n])}}return r},Q0=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},Oc={assign:V0,flattenChunks:Q0},Am=!0;try{String.fromCharCode.apply(null,new Uint8Array(1))}catch(r){Am=!1}var vo=new Uint8Array(256);for(let r=0;r<256;r++)vo[r]=r>=252?6:r>=248?5:r>=240?4:r>=224?3:r>=192?2:1;vo[254]=vo[254]=1;var z0=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},W0=(r,e)=>{if(e<65534&&r.subarray&&Am)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},H0=(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=vo[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 W0(a,i)},G0=(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+vo[r[t]]>e?t:e},bo={string2buf:z0,buf2string:H0,utf8border:G0};function K0(){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 Im=K0,Tm=Object.prototype.toString,{Z_NO_FLUSH:J0,Z_SYNC_FLUSH:Z0,Z_FULL_FLUSH:Y0,Z_FINISH:X0,Z_OK:hc,Z_STREAM_END:ew,Z_DEFAULT_COMPRESSION:tw,Z_DEFAULT_STRATEGY:rw,Z_DEFLATED:nw}=oi;function Io(r){this.options=Oc.assign({level:tw,method:nw,chunkSize:16384,windowBits:15,memLevel:8,strategy:rw},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 Im,this.strm.avail_out=0;let t=oo.deflateInit2(this.strm,e.level,e.method,e.windowBits,e.memLevel,e.strategy);if(t!==hc)throw new Error(Zn[t]);if(e.header&&oo.deflateSetHeader(this.strm,e.header),e.dictionary){let n;if(typeof e.dictionary=="string"?n=bo.string2buf(e.dictionary):Tm.call(e.dictionary)==="[object ArrayBuffer]"?n=new Uint8Array(e.dictionary):n=e.dictionary,t=oo.deflateSetDictionary(this.strm,n),t!==hc)throw new Error(Zn[t]);this._dict_set=!0}}Io.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?X0:J0,typeof r=="string"?t.input=bo.string2buf(r):Tm.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===Z0||a===Y0)&&t.avail_out<=6){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(i=oo.deflate(t,a),i===ew)return t.next_out>0&&this.onData(t.output.subarray(0,t.next_out)),i=oo.deflateEnd(this.strm),this.onEnd(i),this.ended=!0,i===hc;if(t.avail_out===0){this.onData(t.output);continue}if(a>0&&t.next_out>0){this.onData(t.output.subarray(0,t.next_out)),t.avail_out=0;continue}if(t.avail_in===0)break}return!0};Io.prototype.onData=function(r){this.chunks.push(r)};Io.prototype.onEnd=function(r){r===hc&&(this.result=Oc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function Xl(r,e){let t=new Io(e);if(t.push(r,!0),t.err)throw t.msg||Zn[t.err];return t.result}function iw(r,e){return e=e||{},e.raw=!0,Xl(r,e)}function aw(r,e){return e=e||{},e.gzip=!0,Xl(r,e)}var ow=Io,sw=Xl,cw=iw,uw=aw,lw=oi,pw={Deflate:ow,deflate:sw,deflateRaw:cw,gzip:uw,constants:lw},$s=16209,dw=16191,fw=function r(e,t){let n,i,a,o,s,c,u,l,f,d,p,h,m,g,w,b,v,y,I,$,A,R,P,D,k=e.state;n=e.next_in,P=e.input,i=n+(e.avail_in-5),a=e.next_out,D=e.output,o=a-(t-e.avail_out),s=a+(e.avail_out-257),c=k.dmax,u=k.wsize,l=k.whave,f=k.wnext,d=k.window,p=k.hold,h=k.bits,m=k.lencode,g=k.distcode,w=(1<<k.lenbits)-1,b=(1<<k.distbits)-1;e:do{h<15&&(p+=P[n++]<<h,h+=8,p+=P[n++]<<h,h+=8),v=m[p&w];t:for(;;){if(y=v>>>24,p>>>=y,h-=y,y=v>>>16&255,y===0)D[a++]=v&65535;else if(y&16){I=v&65535,y&=15,y&&(h<y&&(p+=P[n++]<<h,h+=8),I+=p&(1<<y)-1,p>>>=y,h-=y),h<15&&(p+=P[n++]<<h,h+=8,p+=P[n++]<<h,h+=8),v=g[p&b];r:for(;;){if(y=v>>>24,p>>>=y,h-=y,y=v>>>16&255,y&16){if($=v&65535,y&=15,h<y&&(p+=P[n++]<<h,h+=8,h<y&&(p+=P[n++]<<h,h+=8)),$+=p&(1<<y)-1,$>c){e.msg="invalid distance too far back",k.mode=$s;break e}if(p>>>=y,h-=y,y=a-o,$>y){if(y=$-y,y>l&&k.sane){e.msg="invalid distance too far back",k.mode=$s;break e}if(A=0,R=d,f===0){if(A+=u-y,y<I){I-=y;do D[a++]=d[A++];while(--y);A=a-$,R=D}}else if(f<y){if(A+=u+f-y,y-=f,y<I){I-=y;do D[a++]=d[A++];while(--y);if(A=0,f<I){y=f,I-=y;do D[a++]=d[A++];while(--y);A=a-$,R=D}}}else if(A+=f-y,y<I){I-=y;do D[a++]=d[A++];while(--y);A=a-$,R=D}for(;I>2;)D[a++]=R[A++],D[a++]=R[A++],D[a++]=R[A++],I-=3;I&&(D[a++]=R[A++],I>1&&(D[a++]=R[A++]))}else{A=a-$;do D[a++]=D[A++],D[a++]=D[A++],D[a++]=D[A++],I-=3;while(I>2);I&&(D[a++]=D[A++],I>1&&(D[a++]=D[A++]))}}else if((y&64)===0){v=g[(v&65535)+(p&(1<<y)-1)];continue r}else{e.msg="invalid distance code",k.mode=$s;break e}break}}else if((y&64)===0){v=m[(v&65535)+(p&(1<<y)-1)];continue t}else if(y&32){k.mode=dw;break e}else{e.msg="invalid literal/length code",k.mode=$s;break e}break}}while(n<i&&a<s);I=h>>3,n-=I,h-=I<<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),k.hold=p,k.bits=h},ji=15,Kf=852,Jf=592,Zf=0,ll=1,Yf=2,hw=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]),mw=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]),gw=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]),yw=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]),vw=(r,e,t,n,i,a,o,s)=>{let c=s.bits,u=0,l=0,f=0,d=0,p=0,h=0,m=0,g=0,w=0,b=0,v,y,I,$,A,R=null,P,D=new Uint16Array(ji+1),k=new Uint16Array(ji+1),Te=null,Ue,W,be;for(u=0;u<=ji;u++)D[u]=0;for(l=0;l<n;l++)D[e[t+l]]++;for(p=c,d=ji;d>=1&&D[d]===0;d--);if(p>d&&(p=d),d===0)return i[a++]=1<<24|64<<16|0,i[a++]=1<<24|64<<16|0,s.bits=1,0;for(f=1;f<d&&D[f]===0;f++);for(p<f&&(p=f),g=1,u=1;u<=ji;u++)if(g<<=1,g-=D[u],g<0)return-1;if(g>0&&(r===Zf||d!==1))return-1;for(k[1]=0,u=1;u<ji;u++)k[u+1]=k[u]+D[u];for(l=0;l<n;l++)e[t+l]!==0&&(o[k[e[t+l]]++]=l);if(r===Zf?(R=Te=o,P=20):r===ll?(R=hw,Te=mw,P=257):(R=gw,Te=yw,P=0),b=0,l=0,u=f,A=a,h=p,m=0,I=-1,w=1<<p,$=w-1,r===ll&&w>Kf||r===Yf&&w>Jf)return 1;for(;;){Ue=u-m,o[l]+1<P?(W=0,be=o[l]):o[l]>=P?(W=Te[o[l]-P],be=R[o[l]-P]):(W=32+64,be=0),v=1<<u-m,y=1<<h,f=y;do y-=v,i[A+(b>>m)+y]=Ue<<24|W<<16|be|0;while(y!==0);for(v=1<<u-1;b&v;)v>>=1;if(v!==0?(b&=v-1,b+=v):b=0,l++,--D[u]===0){if(u===d)break;u=e[t+o[l]]}if(u>p&&(b&$)!==I){for(m===0&&(m=p),A+=f,h=u-m,g=1<<h;h+m<d&&(g-=D[h+m],!(g<=0));)h++,g<<=1;if(w+=1<<h,r===ll&&w>Kf||r===Yf&&w>Jf)return 1;I=b&$,i[I]=p<<24|h<<16|A-a|0}}return b!==0&&(i[A+b]=u-m<<24|64<<16|0),s.bits=p,0},so=vw,bw=0,Om=1,Cm=2,{Z_FINISH:Xf,Z_BLOCK:ww,Z_TREES:Ds,Z_OK:Xn,Z_STREAM_END:Sw,Z_NEED_DICT:_w,Z_STREAM_ERROR:Vt,Z_DATA_ERROR:Nm,Z_MEM_ERROR:$m,Z_BUF_ERROR:Ew,Z_DEFLATED:eh}=oi,Cc=16180,th=16181,rh=16182,nh=16183,ih=16184,ah=16185,oh=16186,sh=16187,ch=16188,uh=16189,mc=16190,Tr=16191,pl=16192,lh=16193,dl=16194,ph=16195,dh=16196,fh=16197,hh=16198,Rs=16199,Ls=16200,mh=16201,gh=16202,yh=16203,vh=16204,bh=16205,fl=16206,wh=16207,Sh=16208,ke=16209,Dm=16210,Rm=16211,xw=852,kw=592,Aw=15,Iw=Aw,_h=r=>(r>>>24&255)+(r>>>8&65280)+((r&65280)<<8)+((r&255)<<24);function Tw(){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<Cc||e.mode>Rm?1:0},Lm=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=Cc,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(xw),e.distcode=e.distdyn=new Int32Array(kw),e.sane=1,e.back=-1,Xn},Pm=r=>{if(si(r))return Vt;let e=r.state;return e.wsize=0,e.whave=0,e.wnext=0,Lm(r)},Fm=(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,Pm(r))},Mm=(r,e)=>{if(!r)return Vt;let t=new Tw;r.state=t,t.strm=r,t.window=null,t.mode=Cc;let n=Fm(r,e);return n!==Xn&&(r.state=null),n},Ow=r=>Mm(r,Iw),Eh=!0,hl,ml,Cw=r=>{if(Eh){hl=new Int32Array(512),ml=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(so(Om,r.lens,0,288,hl,0,r.work,{bits:9}),e=0;e<32;)r.lens[e++]=5;so(Cm,r.lens,0,32,ml,0,r.work,{bits:5}),Eh=!1}r.lencode=hl,r.lenbits=9,r.distcode=ml,r.distbits=5},Um=(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},Nw=(r,e)=>{let t,n,i,a,o,s,c,u,l,f,d,p,h,m,g=0,w,b,v,y,I,$,A,R,P=new Uint8Array(4),D,k,Te=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=pl),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,f=s,d=c,R=Xn;e:for(;;)switch(t.mode){case Cc:if(t.wrap===0){t.mode=pl;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=th;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)!==eh){r.msg="unknown compression method",t.mode=ke;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=ke;break}t.dmax=1<<t.wbits,t.flags=0,r.adler=t.check=1,t.mode=u&512?uh:Tr,u=0,l=0;break;case th:for(;l<16;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(t.flags=u,(t.flags&255)!==eh){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=rh;case rh: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=nh;case nh: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=ih;case ih: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=ah;case ah: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=oh;case oh: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=sh;case sh: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=ch;case ch: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 uh:for(;l<32;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}r.adler=t.check=_h(u),u=0,l=0,t.mode=mc;case mc:if(t.havedict===0)return r.next_out=o,r.avail_out=c,r.next_in=a,r.avail_in=s,t.hold=u,t.bits=l,_w;r.adler=t.check=1,t.mode=Tr;case Tr:if(e===ww||e===Ds)break e;case pl:if(t.last){u>>>=l&7,l-=l&7,t.mode=fl;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=lh;break;case 1:if(Cw(t),t.mode=Rs,e===Ds){u>>>=2,l-=2;break e}break;case 2:t.mode=dh;break;case 3:r.msg="invalid block type",t.mode=ke}u>>>=2,l-=2;break;case lh: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=dl,e===Ds)break e;case dl:t.mode=ph;case ph: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 dh: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=fh;case fh:for(;t.have<t.ncode;){for(;l<3;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}t.lens[Te[t.have++]]=u&7,u>>>=3,l-=3}for(;t.have<19;)t.lens[Te[t.have++]]=0;if(t.lencode=t.lendyn,t.lenbits=7,D={bits:t.lenbits},R=so(bw,t.lens,0,19,t.lencode,0,t.work,D),t.lenbits=D.bits,R){r.msg="invalid code lengths set",t.mode=ke;break}t.have=0,t.mode=hh;case hh:for(;t.have<t.nlen+t.ndist;){for(;g=t.lencode[u&(1<<t.lenbits)-1],w=g>>>24,b=g>>>16&255,v=g&65535,!(w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(v<16)u>>>=w,l-=w,t.lens[t.have++]=v;else{if(v===16){for(k=w+2;l<k;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(u>>>=w,l-=w,t.have===0){r.msg="invalid bit length repeat",t.mode=ke;break}A=t.lens[t.have-1],p=3+(u&3),u>>>=2,l-=2}else if(v===17){for(k=w+3;l<k;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=w,l-=w,A=0,p=3+(u&7),u>>>=3,l-=3}else{for(k=w+7;l<k;){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=w,l-=w,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=ke;break}for(;p--;)t.lens[t.have++]=A}}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,D={bits:t.lenbits},R=so(Om,t.lens,0,t.nlen,t.lencode,0,t.work,D),t.lenbits=D.bits,R){r.msg="invalid literal/lengths set",t.mode=ke;break}if(t.distbits=6,t.distcode=t.distdyn,D={bits:t.distbits},R=so(Cm,t.lens,t.nlen,t.ndist,t.distcode,0,t.work,D),t.distbits=D.bits,R){r.msg="invalid distances set",t.mode=ke;break}if(t.mode=Rs,e===Ds)break e;case Rs:t.mode=Ls;case Ls: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,fw(r,d),o=r.next_out,i=r.output,c=r.avail_out,a=r.next_in,n=r.input,s=r.avail_in,u=t.hold,l=t.bits,t.mode===Tr&&(t.back=-1);break}for(t.back=0;g=t.lencode[u&(1<<t.lenbits)-1],w=g>>>24,b=g>>>16&255,v=g&65535,!(w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if(b&&(b&240)===0){for(y=w,I=b,$=v;g=t.lencode[$+((u&(1<<y+I)-1)>>y)],w=g>>>24,b=g>>>16&255,v=g&65535,!(y+w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=w,l-=w,t.back+=w,t.length=v,b===0){t.mode=bh;break}if(b&32){t.back=-1,t.mode=Tr;break}if(b&64){r.msg="invalid literal/length code",t.mode=ke;break}t.extra=b&15,t.mode=mh;case mh:if(t.extra){for(k=t.extra;l<k;){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=gh;case gh:for(;g=t.distcode[u&(1<<t.distbits)-1],w=g>>>24,b=g>>>16&255,v=g&65535,!(w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}if((b&240)===0){for(y=w,I=b,$=v;g=t.distcode[$+((u&(1<<y+I)-1)>>y)],w=g>>>24,b=g>>>16&255,v=g&65535,!(y+w<=l);){if(s===0)break e;s--,u+=n[a++]<<l,l+=8}u>>>=y,l-=y,t.back+=y}if(u>>>=w,l-=w,t.back+=w,b&64){r.msg="invalid distance code",t.mode=ke;break}t.offset=v,t.extra=b&15,t.mode=yh;case yh:if(t.extra){for(k=t.extra;l<k;){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=vh;case vh:if(c===0)break e;if(p=d-c,t.offset>p){if(p=t.offset-p,p>t.whave&&t.sane){r.msg="invalid distance too far back",t.mode=ke;break}p>t.wnext?(p-=t.wnext,h=t.wsize-p):h=t.wnext-p,p>t.length&&(p=t.length),m=t.window}else m=i,h=o-t.offset,p=t.length;p>c&&(p=c),c-=p,t.length-=p;do i[o++]=m[h++];while(--p);t.length===0&&(t.mode=Ls);break;case bh:if(c===0)break e;i[o++]=t.length,c--,t.mode=Ls;break;case fl:if(t.wrap){for(;l<32;){if(s===0)break e;s--,u|=n[a++]<<l,l+=8}if(d-=c,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?We(t.check,i,d,o-d):yo(t.check,i,d,o-d)),d=c,t.wrap&4&&(t.flags?u:_h(u))!==t.check){r.msg="incorrect data check",t.mode=ke;break}u=0,l=0}t.mode=wh;case wh: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=Sh;case Sh:R=Sw;break e;case ke:R=Nm;break e;case Dm:return $m;case Rm: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||d!==r.avail_out&&t.mode<ke&&(t.mode<fl||e!==Xf))&&Um(r,r.output,r.next_out,d-r.avail_out),f-=r.avail_in,d-=r.avail_out,r.total_in+=f,r.total_out+=d,t.total+=d,t.wrap&4&&d&&(r.adler=t.check=t.flags?We(t.check,i,d,r.next_out-d):yo(t.check,i,d,r.next_out-d)),r.data_type=t.bits+(t.last?64:0)+(t.mode===Tr?128:0)+(t.mode===Rs||t.mode===dl?256:0),(f===0&&d===0||e===Xf)&&R===Xn&&(R=Ew),R},$w=r=>{if(si(r))return Vt;let e=r.state;return e.window&&(e.window=null),r.state=null,Xn},Dw=(r,e)=>{if(si(r))return Vt;let t=r.state;return(t.wrap&2)===0?Vt:(t.head=e,e.done=!1,Xn)},Rw=(r,e)=>{let t=e.length,n,i,a;return si(r)||(n=r.state,n.wrap!==0&&n.mode!==mc)?Vt:n.mode===mc&&(i=1,i=yo(i,e,t,0),i!==n.check)?Nm:(a=Um(r,e,t,t),a?(n.mode=Dm,$m):(n.havedict=1,Xn))},Lw=Pm,Pw=Fm,Fw=Lm,Mw=Ow,Uw=Mm,jw=Nw,qw=$w,Bw=Dw,Vw=Rw,Qw="pako inflate (from Nodeca project)",Dr={inflateReset:Lw,inflateReset2:Pw,inflateResetKeep:Fw,inflateInit:Mw,inflateInit2:Uw,inflate:jw,inflateEnd:qw,inflateGetHeader:Bw,inflateSetDictionary:Vw,inflateInfo:Qw};function zw(){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 Ww=zw,jm=Object.prototype.toString,{Z_NO_FLUSH:Hw,Z_FINISH:Gw,Z_OK:wo,Z_STREAM_END:gl,Z_NEED_DICT:yl,Z_STREAM_ERROR:Kw,Z_DATA_ERROR:xh,Z_MEM_ERROR:Jw}=oi;function To(r){this.options=Oc.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 Im,this.strm.avail_out=0;let t=Dr.inflateInit2(this.strm,e.windowBits);if(t!==wo)throw new Error(Zn[t]);if(this.header=new Ww,Dr.inflateGetHeader(this.strm,this.header),e.dictionary&&(typeof e.dictionary=="string"?e.dictionary=bo.string2buf(e.dictionary):jm.call(e.dictionary)==="[object ArrayBuffer]"&&(e.dictionary=new Uint8Array(e.dictionary)),e.raw&&(t=Dr.inflateSetDictionary(this.strm,e.dictionary),t!==wo)))throw new Error(Zn[t])}To.prototype.push=function(r,e){let t=this.strm,n=this.options.chunkSize,i=this.options.dictionary,a,o,s;if(this.ended)return!1;for(e===~~e?o=e:o=e===!0?Gw:Hw,jm.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===yl&&i&&(a=Dr.inflateSetDictionary(t,i),a===wo?a=Dr.inflate(t,o):a===xh&&(a=yl));t.avail_in>0&&a===gl&&t.state.wrap>0&&r[t.next_in]!==0;)Dr.inflateReset(t),a=Dr.inflate(t,o);switch(a){case Kw:case xh:case yl:case Jw:return this.onEnd(a),this.ended=!0,!1}if(s=t.avail_out,t.next_out&&(t.avail_out===0||a===gl))if(this.options.to==="string"){let c=bo.utf8border(t.output,t.next_out),u=t.next_out-c,l=bo.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===wo&&s===0)){if(a===gl)return a=Dr.inflateEnd(this.strm),this.onEnd(a),this.ended=!0,!0;if(t.avail_in===0)break}}return!0};To.prototype.onData=function(r){this.chunks.push(r)};To.prototype.onEnd=function(r){r===wo&&(this.options.to==="string"?this.result=this.chunks.join(""):this.result=Oc.flattenChunks(this.chunks)),this.chunks=[],this.err=r,this.msg=this.strm.msg};function ep(r,e){let t=new To(e);if(t.push(r),t.err)throw t.msg||Zn[t.err];return t.result}function Zw(r,e){return e=e||{},e.raw=!0,ep(r,e)}var Yw=To,Xw=ep,eS=Zw,tS=ep,rS=oi,nS={Inflate:Yw,inflate:Xw,inflateRaw:eS,ungzip:tS,constants:rS},{Deflate:iS,deflate:aS,deflateRaw:oS,gzip:sS}=pw,{Inflate:cS,inflate:uS,inflateRaw:lS,ungzip:pS}=nS,dS=iS,fS=aS,hS=oS,mS=sS,gS=cS,yS=uS,vS=lS,bS=pS,wS=oi,SS={Deflate:dS,deflate:fS,deflateRaw:hS,gzip:mS,Inflate:gS,inflate:yS,inflateRaw:vS,ungzip:bS,constants:wS},_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)},gc=class{constructor(e,t){this.input=e,this.output=t}};_e([S(),Ee("design:type",String)],gc.prototype,"input",void 0);_e([S(),Ee("design:type",String)],gc.prototype,"output",void 0);gc=_e([Ge(),Ee("design:paramtypes",[String,String])],gc);var 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([H(),Ee("design:paramtypes",[String,String])],yc);var pn=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)],pn.prototype,"name",void 0);_e([S(),Ee("design:type",String)],pn.prototype,"modelId",void 0);_e([S(),Ee("design:type",String)],pn.prototype,"systemPrompt",void 0);_e([S(),Ee("design:type",Array)],pn.prototype,"promptExamples",void 0);_e([S(),Ee("design:type",String)],pn.prototype,"metaData",void 0);pn=_e([Ge(),Ee("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}};_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 _S=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,Ks,jl=class{constructor(e,t=!0){Be.set(this,void 0),Ks.set(this,new Map),_S(this,Be,e,"f")}async getModels(){let e=await Qe(this,Be,"f").query({query:x`
|
|
771
793
|
query {
|
|
772
794
|
aiGetModels {
|
|
773
795
|
id
|
|
@@ -791,23 +813,23 @@ triggerMatch
|
|
|
791
813
|
modelType
|
|
792
814
|
}
|
|
793
815
|
}
|
|
794
|
-
`});return
|
|
816
|
+
`});return T(e).aiGetModels}async addModel(e){let t=await Qe(this,Be,"f").mutate({mutation:x`
|
|
795
817
|
mutation($model: ModelInput!) {
|
|
796
818
|
aiAddModel(model: $model)
|
|
797
819
|
}
|
|
798
|
-
`,variables:{model:e}});return
|
|
820
|
+
`,variables:{model:e}});return T(t).aiAddModel}async updateModel(e,t){let n=await Qe(this,Be,"f").mutate({mutation:x`
|
|
799
821
|
mutation($modelId: String!, $model: ModelInput!) {
|
|
800
822
|
aiUpdateModel(modelId: $modelId, model: $model)
|
|
801
823
|
}
|
|
802
|
-
`,variables:{modelId:e,model:t}});return
|
|
824
|
+
`,variables:{modelId:e,model:t}});return T(n).aiUpdateModel}async removeModel(e){let t=await Qe(this,Be,"f").mutate({mutation:x`
|
|
803
825
|
mutation($modelId: String!) {
|
|
804
826
|
aiRemoveModel(modelId: $modelId)
|
|
805
827
|
}
|
|
806
|
-
`,variables:{modelId:e}});return
|
|
828
|
+
`,variables:{modelId:e}});return T(t).aiRemoveModel}async setDefaultModel(e,t){let n=await Qe(this,Be,"f").mutate({mutation:x`
|
|
807
829
|
mutation($modelType: ModelType!, $modelId: String!) {
|
|
808
830
|
aiSetDefaultModel(modelType: $modelType modelId: $modelId)
|
|
809
831
|
}
|
|
810
|
-
`,variables:{modelId:t,modelType:e}});return
|
|
832
|
+
`,variables:{modelId:t,modelType:e}});return T(n).aiSetDefaultModel}async getDefaultModel(e){let t=await Qe(this,Be,"f").query({query:x`
|
|
811
833
|
query($modelType: ModelType!) {
|
|
812
834
|
aiGetDefaultModel(modelType: $modelType) {
|
|
813
835
|
id
|
|
@@ -831,7 +853,7 @@ triggerMatch
|
|
|
831
853
|
modelType
|
|
832
854
|
}
|
|
833
855
|
}
|
|
834
|
-
`,variables:{modelType:e}});return
|
|
856
|
+
`,variables:{modelType:e}});return T(t).aiGetDefaultModel}async tasks(){let{aiTasks:e}=T(await Qe(this,Be,"f").query({query:x`
|
|
835
857
|
query {
|
|
836
858
|
aiTasks {
|
|
837
859
|
name
|
|
@@ -847,7 +869,7 @@ triggerMatch
|
|
|
847
869
|
updatedAt
|
|
848
870
|
}
|
|
849
871
|
}
|
|
850
|
-
`}));return e}async addTask(e,t,i,
|
|
872
|
+
`}));return e}async addTask(e,t,n,i,a){let o=new pn(e,t,n,i,a),{aiAddTask:s}=T(await Qe(this,Be,"f").mutate({mutation:x`
|
|
851
873
|
mutation AiAddTask($task: AITaskInput!) {
|
|
852
874
|
aiAddTask(task: $task) {
|
|
853
875
|
name
|
|
@@ -863,7 +885,7 @@ triggerMatch
|
|
|
863
885
|
updatedAt
|
|
864
886
|
}
|
|
865
887
|
}
|
|
866
|
-
`,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=
|
|
888
|
+
`,variables:{task:o}}));return s}async removeTask(e){let{aiRemoveTask:t}=T(await Qe(this,Be,"f").mutate({mutation:x`
|
|
867
889
|
mutation AiRemoveTask($taskId: String!) {
|
|
868
890
|
aiRemoveTask(taskId: $taskId) {
|
|
869
891
|
name
|
|
@@ -879,7 +901,7 @@ triggerMatch
|
|
|
879
901
|
updatedAt
|
|
880
902
|
}
|
|
881
903
|
}
|
|
882
|
-
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:
|
|
904
|
+
`,variables:{taskId:e}}));return t}async updateTask(e,t){let{aiUpdateTask:n}=T(await Qe(this,Be,"f").mutate({mutation:x`
|
|
883
905
|
mutation AiUpdateTask($taskId: String!, $task: AITaskInput!) {
|
|
884
906
|
aiUpdateTask(taskId: $taskId, task: $task) {
|
|
885
907
|
name
|
|
@@ -895,7 +917,7 @@ triggerMatch
|
|
|
895
917
|
updatedAt
|
|
896
918
|
}
|
|
897
919
|
}
|
|
898
|
-
`,variables:{taskId:e,task:{name:t.name,modelId:t.modelId,systemPrompt:t.systemPrompt,promptExamples:t.promptExamples}}}));return
|
|
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`
|
|
899
921
|
query AiModelLoadingStatus($model: String!) {
|
|
900
922
|
aiModelLoadingStatus(model: $model) {
|
|
901
923
|
model
|
|
@@ -905,52 +927,29 @@ triggerMatch
|
|
|
905
927
|
downloaded
|
|
906
928
|
}
|
|
907
929
|
}
|
|
908
|
-
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:
|
|
930
|
+
`,variables:{model:e}}));return t}async prompt(e,t){let{aiPrompt:n}=T(await Qe(this,Be,"f").mutate({mutation:x`
|
|
909
931
|
mutation AiPrompt($taskId: String!, $prompt: String!) {
|
|
910
932
|
aiPrompt(taskId: $taskId, prompt: $prompt)
|
|
911
933
|
}
|
|
912
|
-
`,variables:{taskId:e,prompt:t}}));return
|
|
934
|
+
`,variables:{taskId:e,prompt:t}}));return n}async embed(e,t){let{aiEmbed:n}=T(await Qe(this,Be,"f").mutate({mutation:x`
|
|
913
935
|
mutation aiEmbed($modelId: String!, $text: String!) {
|
|
914
936
|
aiEmbed(modelId: $modelId, text: $text)
|
|
915
937
|
}
|
|
916
|
-
`,variables:{modelId:e,text:t}})),
|
|
938
|
+
`,variables:{modelId:e,text:t}})),i=Ic.toByteArray(n);return JSON.parse(SS.inflate(i,{to:"string"}))}async openTranscriptionStream(e,t,n){let{aiOpenTranscriptionStream:i}=T(await Qe(this,Be,"f").mutate({mutation:x`
|
|
917
939
|
mutation AiOpenTranscriptionStream($modelId: String!, $params: VoiceActivityParamsInput) {
|
|
918
940
|
aiOpenTranscriptionStream(modelId: $modelId, params: $params)
|
|
919
941
|
}
|
|
920
|
-
`,variables:{modelId:e,params:
|
|
921
|
-
aiTranscriptionText(streamId: "${
|
|
922
|
-
}`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return
|
|
942
|
+
`,variables:{modelId:e,params:n}})),a=Qe(this,Be,"f").subscribe({query:x` subscription {
|
|
943
|
+
aiTranscriptionText(streamId: "${i}")
|
|
944
|
+
}`}).subscribe({next(o){return t(o.data.aiTranscriptionText),o.data.aiTranscriptionText},error(o){console.error(o)}});return Qe(this,Ks,"f").set(i,a),i}async closeTranscriptionStream(e){let{aiCloseTranscriptionStream:t}=T(await Qe(this,Be,"f").mutate({mutation:x`
|
|
923
945
|
mutation aiCloseTranscriptionStream($streamId: String!) {
|
|
924
946
|
aiCloseTranscriptionStream(streamId: $streamId)
|
|
925
947
|
}
|
|
926
|
-
`,variables:{streamId:e}})),
|
|
948
|
+
`,variables:{streamId:e}})),n=Qe(this,Ks,"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`
|
|
927
949
|
mutation AiFeedTranscriptionStream($streamIds: [String!]!, $audio: [Float!]!) {
|
|
928
950
|
aiFeedTranscriptionStream(streamIds: $streamIds, audio: $audio)
|
|
929
951
|
}
|
|
930
|
-
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return i}};Qe=new WeakMap,Gs=new WeakMap;var Gr=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},Ve=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},pr,Ks,eo,Js,to,Pi,Zs,ro,wo=class{constructor(e,t=!0){pr.set(this,void 0),Ks.set(this,void 0),eo.set(this,void 0),Js.set(this,void 0),to.set(this,void 0),Pi.set(this,void 0),Zs.set(this,void 0),ro.set(this,void 0),Gr(this,pr,e,"f"),Gr(this,Ks,new lo(Ve(this,pr,"f"),t),"f"),Gr(this,eo,new Ol(Ve(this,pr,"f")),"f"),Gr(this,Js,new Il(Ve(this,pr,"f")),"f"),Gr(this,to,new kl(Ve(this,pr,"f")),"f"),Gr(this,ro,new Ul(Ve(this,pr,"f"),t),"f"),Gr(this,Pi,new fc(Ve(this,pr,"f"),t),"f"),Ve(this,Pi,"f").setExpressionClient(Ve(this,eo,"f")),Ve(this,Pi,"f").setNeighbourhoodClient(Ve(this,to,"f")),Ve(this,Pi,"f").setAIClient(Ve(this,ro,"f")),Gr(this,Zs,new Tl(Ve(this,pr,"f"),t),"f")}get agent(){return Ve(this,Ks,"f")}get expression(){return Ve(this,eo,"f")}get languages(){return Ve(this,Js,"f")}get neighbourhood(){return Ve(this,to,"f")}get perspective(){return Ve(this,Pi,"f")}get runtime(){return Ve(this,Zs,"f")}get ai(){return Ve(this,ro,"f")}};pr=new WeakMap,Ks=new WeakMap,eo=new WeakMap,Js=new WeakMap,to=new WeakMap,Pi=new WeakMap,Zs=new WeakMap,ro=new WeakMap;var jl;(function(r){r.LanguageIsNotLoaded="LANGUAGE_IS_NOT_LOADED",r.ExpressionIsNotVerified="EXPRESSION_IS_NOT_VERIFIED",r.AgentIsUntrusted="AGENT_IS_UNTRUSTED",r.CapabilityRequested="CAPABILITY_REQUESTED",r.InstallNotificationRequest="INSTALL_NOTIFICATION_REQUEST"})(jl||(jl={}));var tp=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},rp=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Bi=class{constructor(e,t){this.language=e,this.expression=t}};tp([g(),rp("design:type",hr)],Bi.prototype,"language",void 0);tp([g(),rp("design:type",String)],Bi.prototype,"expression",void 0);Bi=tp([H(),rp("design:paramtypes",[hr,String])],Bi);function XT(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function eO(r){if(r.startsWith("literal://")){let a=new hr;a.address="literal",a.name="literal";let o=r.substring(10);return new Bi(a,o)}let t=/^([^:^\s]+):\/\/([\s\S]+)$/.exec(r);if(t&&t.length==3){let a=t[1],o=t[2],s=new hr;return s.address=a,new Bi(s,o)}let n=/^did:([^\s]+)$/.exec(r);if(n&&n.length==2){let a=new hr;return a.address="did",new Bi(a,r)}throw new Error("Couldn't parse string as expression URL or DID: "+r)}var Lt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},wr=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},bc=class{};Lt([g(),wr("design:type",String)],bc.prototype,"name",void 0);Lt([g(),wr("design:type",String)],bc.prototype,"type",void 0);bc=Lt([H()],bc);var So=class{};Lt([g(),wr("design:type",String)],So.prototype,"label",void 0);Lt([g(),wr("design:type",String)],So.prototype,"name",void 0);Lt([g(),wr("design:type",Array)],So.prototype,"parameters",void 0);So=Lt([H()],So);var wc=class{get parameters(){return JSON.parse(this.parametersStringified)}constructor(e,t){this.name=e,this.parametersStringified=JSON.stringify(t)}};Lt([g(),wr("design:type",String)],wc.prototype,"name",void 0);Lt([g(),wr("design:type",String)],wc.prototype,"parametersStringified",void 0);wc=Lt([Je(),wr("design:paramtypes",[String,Object])],wc);var Sc=class{};Lt([g(),wr("design:type",String)],Sc.prototype,"did",void 0);Lt([g(),wr("design:type",Hi)],Sc.prototype,"status",void 0);Sc=Lt([H()],Sc);var Eh=class{},sn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},sa=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},li=class{};sn([g(),sa("design:type",String)],li.prototype,"name",void 0);sn([g(),sa("design:type",String)],li.prototype,"address",void 0);sn([g(),sa("design:type",String)],li.prototype,"settings",void 0);sn([g(),sa("design:type",zi)],li.prototype,"icon",void 0);sn([g(),sa("design:type",zi)],li.prototype,"constructorIcon",void 0);sn([g(),sa("design:type",zi)],li.prototype,"settingsIcon",void 0);li=sn([H()],li);var gt=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},xt=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Xt=class{};gt([g(),xt("design:type",String)],Xt.prototype,"name",void 0);gt([g(),xt("design:type",String)],Xt.prototype,"address",void 0);gt([g(),xt("design:type",String)],Xt.prototype,"description",void 0);gt([g(),xt("design:type",String)],Xt.prototype,"author",void 0);gt([g(),xt("design:type",Boolean)],Xt.prototype,"templated",void 0);gt([g(),xt("design:type",String)],Xt.prototype,"templateSourceLanguageAddress",void 0);gt([g(),xt("design:type",String)],Xt.prototype,"templateAppliedParams",void 0);gt([g(),xt("design:type",Array)],Xt.prototype,"possibleTemplateParams",void 0);gt([g(),xt("design:type",String)],Xt.prototype,"sourceCodeLink",void 0);Xt=gt([H()],Xt);var Yn=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};gt([g(),xt("design:type",String)],Yn.prototype,"name",void 0);gt([g(),xt("design:type",String)],Yn.prototype,"description",void 0);gt([g(),xt("design:type",Array)],Yn.prototype,"possibleTemplateParams",void 0);gt([g(),xt("design:type",String)],Yn.prototype,"sourceCodeLink",void 0);Yn=gt([Je(),xt("design:paramtypes",[String,String])],Yn);var xh=class{},Ah=class extends fi(){},Ih=class{},Cc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},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}};Cc([g(),ip("design:type",String)],_c.prototype,"linkLanguage",void 0);Cc([g(),ip("design:type",yr)],_c.prototype,"meta",void 0);_c=Cc([H(),ip("design:paramtypes",[String,yr])],_c);var ql=class extends fi(){};ql=Cc([H()],ql);var cn=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},un=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Bl;(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"})(Bl||(Bl={}));var pi=class{constructor(e,t,i){this.uuid=e,this.name=t,i?this.state=i:this.state=Bl.Private}};cn([g(),un("design:type",String)],pi.prototype,"uuid",void 0);cn([g(),un("design:type",String)],pi.prototype,"name",void 0);cn([g(),un("design:type",String)],pi.prototype,"state",void 0);cn([g(),un("design:type",String)],pi.prototype,"sharedUrl",void 0);cn([g(),un("design:type",ql)],pi.prototype,"neighbourhood",void 0);cn([g(),un("design:type",Array)],pi.prototype,"owners",void 0);pi=cn([H(),un("design:paramtypes",[String,String,String])],pi);var Nc=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},Mm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Ec=class{};Nc([g(),Mm("design:type",Array)],Ec.prototype,"additions",void 0);Nc([g(),Mm("design:type",Array)],Ec.prototype,"removals",void 0);Ec=Nc([H()],Ec);var kh=class extends fi(){};kh=Nc([H()],kh);var Th=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},jn=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},io,Fi,Ls="smart_literal://content";function vS(r){let e="",t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}var _o=class{constructor(e,t){io.set(this,void 0),Fi.set(this,void 0),Th(this,io,e,"f"),Th(this,Fi,t,"f")}get base(){return jn(this,Fi,"f")}static async create(e,t){let i=we.from(vS(10)).toUrl(),n=new _o(e,i);return await n.set(t),n}static async isSmartLiteralBase(e,t){return(await e.get(new Ee({source:t,predicate:Ls}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new Ee({predicate:Ls}))).map(i=>new _o(e,i.data.source))}async get(){let e=await jn(this,io,"f").getSingleTarget(new Ee({source:jn(this,Fi,"f"),predicate:Ls}));if(!e)throw`No content for smart literal ${jn(this,Fi,"f")}`;return we.fromUrl(e).get()}async set(e){let t=we.from(e);await jn(this,io,"f").setSingleTarget(new Ot({source:jn(this,Fi,"f"),predicate:Ls,target:t.toUrl()}))}};io=new WeakMap,Fi=new WeakMap;var Oh=class{};function fO(r,e,t){return{action:"addLink",source:r,predicate:e,target:t}}function hO(r){return`triple(this, "${r}", _)`}function mO(r){return function(e,t,i){if(typeof i.value!="function")throw new Error("InstanceQuery decorator can only be applied to methods");i.value=async function(a){let o=[],s=e.name,c=`subject_class("${s}", C), instance(C, Instance)`;if(r&&r.where)for(let l in r.where){let f=r.where[l];c+=`, property_getter(C, Instance, "${l}", "${f}")`}r&&r.prologCondition&&(c+=", "+r.prologCondition);try{let l=await a.infer(c);if(l&&l!==!1&&typeof l!="string"&&l.length>0){for(let f of l){let d=f.Instance,p=new Qn(a,d,s);await p.init(),o.push(p)}return o}}catch{}let u=await a.getAllSubjectInstances(e);if(r&&r.where){let l=[];for(let f of u){let d=!0;for(let p in r.where){let h=r.where[p];if(await f[p]!==h){d=!1;break}}d&&l.push(f)}return l}return u}}}function Um(r){return function(e,t){if(typeof r.writable>"u"&&r.through&&(r.writable=!0),r.required&&!r.initial)throw new Error("SubjectProperty requires an 'initial' option if 'required' is true");if(!r.through&&!r.prologGetter)throw new Error("SubjectProperty requires either 'through' or 'prologGetter' option");if(e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],...r},r.writable){let i=t;e[`set${ti(i)}`]=()=>{}}Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function gO(r){return function(e,t){if(!r.through&&!r.value)throw new Error("SubjectFlag requires a 'through' and 'value' option");if(!r.through)throw new Error("SubjectFlag requires a 'through' option");if(!r.value)throw new Error("SubjectFlag requires a 'value' option");e.__properties=e.__properties||{},e.__properties[t]=e.__properties[t]||{},e.__properties[t]={...e.__properties[t],through:r.through,required:!0,initial:r.value,flag:!0},e[t]=r.value,Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function yO(r){return function(e,t){e.__collections=e.__collections||{},e.__collections[t]=r;let i=t;e[`add${ti(i)}`]=()=>{},e[`remove${ti(i)}`]=()=>{},e[`setCollection${ti(i)}`]=()=>{},Object.defineProperty(e,t,{configurable:!0,writable:!0})}}function jm(r){let e="",t="abcdefghijklmnopqrstuvwxyz",i=t.length;for(let n=0;n<r;n++)e+=t.charAt(Math.floor(Math.random()*i));return e}function bS(r){return function(e){e.prototype.className=r.name,e.className=r.name,e.generateSDNA=function(){let t="",i=r.name,n=e.prototype,a=jm(8);t+=`subject_class("${i}", ${a}).
|
|
931
|
-
`;let o=[],s=[];n.subjectConstructor&&n.subjectConstructor.length&&(s=s.concat(n.subjectConstructor));let c=[];n.isSubjectInstance&&n.isSubjectInstance.length&&(c=c.concat(n.isSubjectInstance));let u=[],l=n.__properties||{};for(let h in l){let m=`property(${a}, "${h}").
|
|
932
|
-
`,{through:y,initial:S,required:w,resolveLanguage:_,writable:v,flag:T,prologGetter:$,prologSetter:E,local:R}=l[h];if(_&&(m+=`property_resolve(${a}, "${h}").
|
|
933
|
-
`,m+=`property_resolve_language(${a}, "${h}", "${_}").
|
|
934
|
-
`),$?m+=`property_getter(${a}, Base, "${h}", Value) :- ${$}.
|
|
935
|
-
`:y&&(m+=`property_getter(${a}, Base, "${h}", Value) :- triple(Base, "${y}", Value).
|
|
936
|
-
`,w&&(T?c.push(`triple(Base, "${y}", "${S}")`):c.push(`triple(Base, "${y}", _)`))),E)m+=`property_setter(${a}, "${h}", Actions) :- ${E}.
|
|
937
|
-
`;else if(v&&y&&typeof n[pc(h)]=="function"){let D=[{action:"setSingleTarget",source:"this",predicate:y,target:"value",...R&&{local:!0}}];m+=`property_setter(${a}, "${h}", '${Oi(D)}').
|
|
938
|
-
`}u.push(m),S&&(s.push({action:"addLink",source:"this",predicate:y,target:S}),o.push({action:"removeLink",source:"this",predicate:y,target:"*"}))}let f=[],d=n.__collections||{};for(let h in d){let m=`collection(${a}, "${h}").
|
|
939
|
-
`,{through:y,where:S,local:w}=d[h];if(y){if(S){if(!S.isInstance&&!S.prologCondition&&!S.condition)throw"'where' needs one of 'isInstance', 'prologCondition', or 'condition'";let $=[];if(S.isInstance){let E;S.isInstance.name?E=S.isInstance.name:E=S.isInstance,$.push(`instance(OtherClass, Target), subject_class("${E}", OtherClass)`)}if(S.prologCondition&&$.push(S.prologCondition),$.length>0){let E=$.join(", ");m+=`collection_getter(${a}, Base, "${h}", List) :- setof(Target, (triple(Base, "${y}", Target), ${E}), List).
|
|
940
|
-
`}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${y}", C), List).
|
|
941
|
-
`}else m+=`collection_getter(${a}, Base, "${h}", List) :- findall(C, triple(Base, "${y}", C), List).
|
|
942
|
-
`;let _=[{action:"addLink",source:"this",predicate:y,target:"value",...w&&{local:!0}}],v=[{action:"removeLink",source:"this",predicate:y,target:"value"}],T=[{action:"collectionSetter",source:"this",predicate:y,target:"value",...w&&{local:!0}}];m+=`collection_adder(${a}, "${h}", '${Oi(_)}').
|
|
943
|
-
`,m+=`collection_remover(${a}, "${h}", '${Oi(v)}').
|
|
944
|
-
`,m+=`collection_setter(${a}, "${h}", '${Oi(T)}').
|
|
945
|
-
`}f.push(m)}let p=Oi(s);if(t+=`constructor(${a}, '${p}').
|
|
946
|
-
`,c.length>0){let h=c.join(", ");t+=`instance(${a}, Base) :- ${h}.
|
|
947
|
-
`,t+=`
|
|
948
|
-
`}return t+=`destructor(${a}, '${Oi(o)}').
|
|
949
|
-
`,t+=`
|
|
950
|
-
`,t+=u.join(`
|
|
951
|
-
`),t+=`
|
|
952
|
-
`,t+=f.join(`
|
|
953
|
-
`),{sdna:t,name:i}},e.generateSHACL=function(){let t=r.name,i=e.prototype,n="ad4m://",a=i.__properties||{},o=i.__collections||{};if(Object.keys(a).length>0){let d=a[Object.keys(a)[0]];if(d.through){let p=d.through.match(/^([^:]+:\/\/)/);p&&(n=p[1])}}else if(Object.keys(o).length>0){let d=o[Object.keys(o)[0]];if(d.through){let p=d.through.match(/^([^:]+:\/\/)/);p&&(n=p[1])}}let s=`${n}${t}Shape`,c=`${n}${t}`,u=new ri(s,c),l=[];i.subjectConstructor&&i.subjectConstructor.length&&(l=l.concat(i.subjectConstructor));let f=[];for(let d in a){let p=a[d];if(!p.through)continue;let h={name:d,path:p.through};if(p.resolveLanguage==="literal")h.datatype="xsd://string";else if(p.initial){let m=typeof i[d];m==="number"?h.datatype="xsd://integer":m==="boolean"?h.datatype="xsd://boolean":m==="string"&&(h.datatype="xsd://string")}p.required&&(h.minCount=1),p.collection||(h.maxCount=1),p.flag&&p.initial&&(h.hasValue=p.initial),p.local!==void 0&&(h.local=p.local),p.writable!==void 0&&(h.writable=p.writable),p.resolveLanguage&&(h.resolveLanguage=p.resolveLanguage),p.setter?console.warn(`[SHACL Generation] Custom Prolog setter for property '${d}' in class '${t}' is not yet supported. The property will be created without setter actions. Consider using standard writable properties or provide explicit SHACL JSON.`):p.writable&&p.through&&typeof i[pc(d)]=="function"&&(h.setter=[{action:"setSingleTarget",source:"this",predicate:p.through,target:"value",...p.local&&{local:!0}}]),p.initial&&(l.push({action:"addLink",source:"this",predicate:p.through,target:p.initial}),f.push({action:"removeLink",source:"this",predicate:p.through,target:"*"})),u.addProperty(h)}for(let d in o){let p=o[d];if(!p.through)continue;let h={name:d,path:p.through};p.where?.isInstance,h.nodeKind="IRI",p.local!==void 0&&(h.local=p.local),p.writable!==void 0&&(h.writable=p.writable),h.adder=[{action:"addLink",source:"this",predicate:p.through,target:"value",...p.local&&{local:!0}}],h.remover=[{action:"removeLink",source:"this",predicate:p.through,target:"value",...p.local&&{local:!0}}],u.addProperty(h)}return l.length>0&&u.setConstructorActions(l),f.length>0&&u.setDestructorActions(f),{shape:u,name:t}},Object.defineProperty(e,"type",{configurable:!0})}}function vO(r){return Um({...r,required:!0,writable:!0,initial:r.initial||"literal://string:uninitialized"})}function bO(r){return Um({...r,writable:!1})}var wO=`
|
|
952
|
+
`,variables:{streamIds:Array.isArray(e)?e:[e],audio:t}}));return n}};Be=new WeakMap,Ks=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,Js,eo,Zs,to,Mn,Ys,ro,So=class{constructor(e,t=!0){pr.set(this,void 0),Js.set(this,void 0),eo.set(this,void 0),Zs.set(this,void 0),to.set(this,void 0),Mn.set(this,void 0),Ys.set(this,void 0),ro.set(this,void 0),Jr(this,pr,e,"f"),Jr(this,Js,new po(qe(this,pr,"f"),t),"f"),Jr(this,eo,new Cl(qe(this,pr,"f")),"f"),Jr(this,Zs,new Il(qe(this,pr,"f")),"f"),Jr(this,to,new Tl(qe(this,pr,"f")),"f"),Jr(this,ro,new jl(qe(this,pr,"f"),t),"f"),Jr(this,Mn,new dc(qe(this,pr,"f"),t),"f"),qe(this,Mn,"f").setExpressionClient(qe(this,eo,"f")),qe(this,Mn,"f").setNeighbourhoodClient(qe(this,to,"f")),qe(this,Mn,"f").setAIClient(qe(this,ro,"f")),Jr(this,Ys,new Ol(qe(this,pr,"f"),t),"f")}get agent(){return qe(this,Js,"f")}get expression(){return qe(this,eo,"f")}get languages(){return qe(this,Zs,"f")}get neighbourhood(){return qe(this,to,"f")}get perspective(){return qe(this,Mn,"f")}get runtime(){return qe(this,Ys,"f")}get ai(){return qe(this,ro,"f")}};pr=new WeakMap,Js=new WeakMap,eo=new WeakMap,Zs=new WeakMap,to=new WeakMap,Mn=new WeakMap,Ys=new WeakMap,ro=new WeakMap;var ql;(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"})(ql||(ql={}));var tp=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},rp=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}};tp([S(),rp("design:type",mr)],zn.prototype,"language",void 0);tp([S(),rp("design:type",String)],zn.prototype,"expression",void 0);zn=tp([H(),rp("design:paramtypes",[mr,String])],zn);function mO(r){return r.language.address==="did"?r.expression.toString():`${r.language.address}://${r.expression}`}function gO(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)},vc=class{};Dt([S(),_r("design:type",String)],vc.prototype,"name",void 0);Dt([S(),_r("design:type",String)],vc.prototype,"type",void 0);vc=Dt([H()],vc);var _o=class{};Dt([S(),_r("design:type",String)],_o.prototype,"label",void 0);Dt([S(),_r("design:type",String)],_o.prototype,"name",void 0);Dt([S(),_r("design:type",Array)],_o.prototype,"parameters",void 0);_o=Dt([H()],_o);var bc=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)],bc.prototype,"name",void 0);Dt([S(),_r("design:type",String)],bc.prototype,"parametersStringified",void 0);bc=Dt([Ge(),_r("design:paramtypes",[String,Object])],bc);var wc=class{};Dt([S(),_r("design:type",String)],wc.prototype,"did",void 0);Dt([S(),_r("design:type",Kn)],wc.prototype,"status",void 0);wc=Dt([H()],wc);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},sa=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},dn=class{};ci([S(),sa("design:type",String)],dn.prototype,"name",void 0);ci([S(),sa("design:type",String)],dn.prototype,"address",void 0);ci([S(),sa("design:type",String)],dn.prototype,"settings",void 0);ci([S(),sa("design:type",Hn)],dn.prototype,"icon",void 0);ci([S(),sa("design:type",Hn)],dn.prototype,"constructorIcon",void 0);ci([S(),sa("design:type",Hn)],dn.prototype,"settingsIcon",void 0);dn=ci([H()],dn);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 Yi=class{constructor(e,t){this.name=e,this.description=t,this.description||(this.description="")}};ht([S(),Et("design:type",String)],Yi.prototype,"name",void 0);ht([S(),Et("design:type",String)],Yi.prototype,"description",void 0);ht([S(),Et("design:type",Array)],Yi.prototype,"possibleTemplateParams",void 0);ht([S(),Et("design:type",String)],Yi.prototype,"sourceCodeLink",void 0);Yi=ht([Ge(),Et("design:paramtypes",[String,String])],Yi);var Ah=class{},Ih=class extends mn(){},Th=class{},Nc=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)},Sc=class{constructor(e,t){this.linkLanguage=e,this.meta=t}};Nc([S(),np("design:type",String)],Sc.prototype,"linkLanguage",void 0);Nc([S(),np("design:type",br)],Sc.prototype,"meta",void 0);Sc=Nc([H(),np("design:paramtypes",[String,br])],Sc);var Bl=class extends mn(){};Bl=Nc([H()],Bl);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)},Vl;(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"})(Vl||(Vl={}));var fn=class{constructor(e,t,n){this.uuid=e,this.name=t,n?this.state=n:this.state=Vl.Private}};ui([S(),li("design:type",String)],fn.prototype,"uuid",void 0);ui([S(),li("design:type",String)],fn.prototype,"name",void 0);ui([S(),li("design:type",String)],fn.prototype,"state",void 0);ui([S(),li("design:type",String)],fn.prototype,"sharedUrl",void 0);ui([S(),li("design:type",Bl)],fn.prototype,"neighbourhood",void 0);ui([S(),li("design:type",Array)],fn.prototype,"owners",void 0);fn=ui([H(),li("design:paramtypes",[String,String,String])],fn);var $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},qm=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},_c=class{};$c([S(),qm("design:type",Array)],_c.prototype,"additions",void 0);$c([S(),qm("design:type",Array)],_c.prototype,"removals",void 0);_c=$c([H()],_c);var Oh=class extends mn(){};Oh=$c([H()],Oh);var Ch=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)},no,Un,Ps="smart_literal://content";function ES(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 Eo=class{constructor(e,t){no.set(this,void 0),Un.set(this,void 0),Ch(this,no,e,"f"),Ch(this,Un,t,"f")}get base(){return qi(this,Un,"f")}static async create(e,t){let n=Se.from(ES(10)).toUrl(),i=new Eo(e,n);return await i.set(t),i}static async isSmartLiteralBase(e,t){return(await e.get(new fe({source:t,predicate:Ps}))).length>0}static async getAllSmartLiterals(e){return(await e.get(new fe({predicate:Ps}))).map(n=>new Eo(e,n.data.source))}async get(){let e=await qi(this,no,"f").getSingleTarget(new fe({source:qi(this,Un,"f"),predicate:Ps}));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,no,"f").setSingleTarget(new St({source:qi(this,Un,"f"),predicate:Ps,target:t.toUrl()}))}};no=new WeakMap,Un=new WeakMap;var OO=`
|
|
954
953
|
type AIModelLoadingStatus {
|
|
955
954
|
downloaded: Boolean!
|
|
956
955
|
loaded: Boolean!
|
|
@@ -1536,7 +1535,7 @@ input VoiceActivityParamsInput {
|
|
|
1536
1535
|
startWindow: Float
|
|
1537
1536
|
timeBeforeSpeech: Float
|
|
1538
1537
|
}
|
|
1539
|
-
`,N=function(r,e,t,i){var n=arguments.length,a=n<3?e:i===null?i=Object.getOwnPropertyDescriptor(e,t):i,o;if(typeof Reflect=="object"&&typeof Reflect.decorate=="function")a=Reflect.decorate(r,e,t,i);else for(var s=r.length-1;s>=0;s--)(o=r[s])&&(a=(n<3?o(a):n>3?o(e,t,a):o(e,t))||a);return n>3&&a&&Object.defineProperty(e,t,a),a},b=function(r,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(r,e)},Y=function(r,e){return function(t,i){e(t,i,r)}},To=new oi;To.author="did:ad4m:test";To.timestamp=Date.now();To.data={source:"root",target:"neighbourhood://Qm12345"};To.proof={signature:"",key:"",valid:!0};var Xr=new Hi;Xr.author="did:ad4m:test";Xr.timestamp=Date.now().toString();Xr.proof=new Dr("","");Xr.data=new yr([To]);var xc=class{};N([g(),b("design:type",String)],xc.prototype,"recipient",void 0);N([g(),b("design:type",Hi)],xc.prototype,"message",void 0);xc=N([H()],xc);var Xn=class{};N([g(),b("design:type",String)],Xn.prototype,"ad4mExecutorVersion",void 0);N([g(),b("design:type",Boolean)],Xn.prototype,"isInitialized",void 0);N([g(),b("design:type",Boolean)],Xn.prototype,"isUnlocked",void 0);Xn=N([H()],Xn);var Xi=class{};N([g(),b("design:type",String)],Xi.prototype,"title",void 0);N([g(),b("design:type",String)],Xi.prototype,"message",void 0);N([g(),b("design:type",String)],Xi.prototype,"type",void 0);N([g(),b("design:type",String)],Xi.prototype,"addon",void 0);Xi=N([H()],Xi);var Wt=class{};N([g(),b("design:type",String)],Wt.prototype,"description",void 0);N([g(),b("design:type",String)],Wt.prototype,"appName",void 0);N([g(),b("design:type",String)],Wt.prototype,"appUrl",void 0);N([g(),b("design:type",String)],Wt.prototype,"appIconPath",void 0);N([g(),b("design:type",String)],Wt.prototype,"trigger",void 0);N([g(),b("design:type",Array)],Wt.prototype,"perspectiveIds",void 0);N([g(),b("design:type",String)],Wt.prototype,"webhookUrl",void 0);N([g(),b("design:type",String)],Wt.prototype,"webhookAuth",void 0);Wt=N([Je()],Wt);var Dt=class{};N([g(),b("design:type",String)],Dt.prototype,"id",void 0);N([g(),b("design:type",Boolean)],Dt.prototype,"granted",void 0);N([g(),b("design:type",String)],Dt.prototype,"description",void 0);N([g(),b("design:type",String)],Dt.prototype,"appName",void 0);N([g(),b("design:type",String)],Dt.prototype,"appUrl",void 0);N([g(),b("design:type",String)],Dt.prototype,"appIconPath",void 0);N([g(),b("design:type",String)],Dt.prototype,"trigger",void 0);N([g(),b("design:type",Array)],Dt.prototype,"perspectiveIds",void 0);N([g(),b("design:type",String)],Dt.prototype,"webhookUrl",void 0);N([g(),b("design:type",String)],Dt.prototype,"webhookAuth",void 0);Dt=N([H()],Dt);var ea=class{};N([g(),b("design:type",Dt)],ea.prototype,"notification",void 0);N([g(),b("design:type",String)],ea.prototype,"perspectiveId",void 0);N([g(),b("design:type",String)],ea.prototype,"triggerMatch",void 0);ea=N([H()],ea);var Ke=class{};N([g(),b("design:type",Number)],Ke.prototype,"total",void 0);N([g(),b("design:type",Number)],Ke.prototype,"imported",void 0);N([g(),b("design:type",Number)],Ke.prototype,"failed",void 0);N([g(),b("design:type",Number)],Ke.prototype,"omitted",void 0);N([g(),b("design:type",Array)],Ke.prototype,"errors",void 0);Ke=N([H()],Ke);var $t=class{};N([g(),b("design:type",Ke)],$t.prototype,"perspectives",void 0);N([g(),b("design:type",Ke)],$t.prototype,"links",void 0);N([g(),b("design:type",Ke)],$t.prototype,"expressions",void 0);N([g(),b("design:type",Ke)],$t.prototype,"perspectiveDiffs",void 0);N([g(),b("design:type",Ke)],$t.prototype,"notifications",void 0);N([g(),b("design:type",Ke)],$t.prototype,"models",void 0);N([g(),b("design:type",Ke)],$t.prototype,"defaultModels",void 0);N([g(),b("design:type",Ke)],$t.prototype,"tasks",void 0);N([g(),b("design:type",Ke)],$t.prototype,"friends",void 0);N([g(),b("design:type",Ke)],$t.prototype,"trustedAgents",void 0);N([g(),b("design:type",Ke)],$t.prototype,"knownLinkLanguages",void 0);$t=N([H()],$t);var ta=class{};N([g(),b("design:type",String)],ta.prototype,"email",void 0);N([g(),b("design:type",String)],ta.prototype,"did",void 0);N([g(),b("design:type",String)],ta.prototype,"lastSeen",void 0);N([g(),b("design:type",Number)],ta.prototype,"perspectiveCount",void 0);ta=N([H()],ta);var en=class{};N([g(),b("design:type",Boolean)],en.prototype,"success",void 0);N([g(),b("design:type",String)],en.prototype,"message",void 0);N([g(),b("design:type",Boolean)],en.prototype,"requiresPassword",void 0);N([g(),b("design:type",Boolean)],en.prototype,"isExistingUser",void 0);en=N([H()],en);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,i,n){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return Xr}runtimeFriendSendMessage(e,t){return!0}runtimeMessageInbox(e){return[Xr]}runtimeMessageOutbox(e){return[{recipient:"did:test:recipient",message:Xr}]}runtimeMessageReceived(){return Xr}exceptionOccurred(){return{title:"Test title",message:"Test message",type:jl.LanguageIsNotLoaded}}runtimeRequestInstallNotification(e){return"new-notification-id"}runtimeNotifications(){return[{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}]}runtimeUpdateNotification(e,t){return!0}runtimeRemoveNotification(e){return!0}runtimeGrantNotification(e){return!0}runtimeNotificationTriggered(){return{perspectiveId:"test-perspective-id",triggerMatch:"test-trigger-match",notification:{id:"test-id",granted:!1,description:"Test description",appName:"Test app name",appUrl:"https://example.com",appIconPath:"https://fluxsocial.io/favicon",trigger:"triple(X, ad4m://has_type, flux://message)",perspectiveIds:["u983ud-jdhh38d"],webhookUrl:"https://example.com/webhook",webhookAuth:"test-auth"}}}runtimeExportDb(e){return!0}runtimeImportDb(e){return!0}runtimeExportPerspective(e,t){return!0}runtimeImportPerspective(e){return!0}runtimeMultiUserEnabled(){return!1}runtimeSetMultiUserEnabled(e){return e}runtimeListUsers(){return[{email:"test@example.com",did:"did:key:test123",lastSeen:new Date().toISOString(),perspectiveCount:5}]}runtimeRequestLoginVerification(e,t){return{success:!0,message:"Verification email sent",requiresPassword:!1,isExistingUser:!0}}runtimeVerifyEmailCode(e,t,i){return"test-jwt-token-from-email-verification"}runtimeTestEmail(e){return!0}runtimeCreateUser(e,t,i){return new Gi("did:key:test123",!0)}runtimeLoginUser(e,t){return"test-jwt-token-from-password-login"}runtimeEmailTestModeEnable(){return!0}runtimeEmailTestModeDisable(){return!0}runtimeEmailTestGetCode(e){return"123456"}runtimeEmailTestClearCodes(){return!0}runtimeEmailTestSetExpiry(e,t,i){return!0}};N([ye(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],B.prototype,"runtimeQuit",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],B.prototype,"runtimeOpenLink",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Xn)],B.prototype,"runtimeInfo",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],B.prototype,"addTrustedAgents",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],B.prototype,"deleteTrustedAgents",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],B.prototype,"getTrustedAgents",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],B.prototype,"runtimeKnownLinkLanguageTemplates",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],B.prototype,"runtimeAddKnownLinkLanguageTemplates",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],B.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],B.prototype,"runtimeFriends",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],B.prototype,"runtimeAddFriends",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Array]),b("design:returntype",Array)],B.prototype,"runtimeRemoveFriends",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",String)],B.prototype,"runtimeHcAgentInfos",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",String)],B.prototype,"runtimeGetNetworkMetrics",null);N([ye(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],B.prototype,"runtimeRestartHolochain",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Object]),b("design:returntype",Boolean)],B.prototype,"runtimeHcAddAgentInfos",null);N([Rt(),Y(0,Z()),Y(1,Z()),Y(2,Z()),Y(3,Z()),b("design:type",Function),b("design:paramtypes",[String,String,String,String]),b("design:returntype",void 0)],B.prototype,"runtimeVerifyStringSignedByDid",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[yr]),b("design:returntype",Boolean)],B.prototype,"runtimeSetStatus",null);N([Rt(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Hi)],B.prototype,"runtimeFriendStatus",null);N([ye(),Y(0,Z()),Y(1,Z()),b("design:type",Function),b("design:paramtypes",[String,sc]),b("design:returntype",Boolean)],B.prototype,"runtimeFriendSendMessage",null);N([Rt(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Array)],B.prototype,"runtimeMessageInbox",null);N([Rt(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Array)],B.prototype,"runtimeMessageOutbox",null);N([Ql(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Hi)],B.prototype,"runtimeMessageReceived",null);N([Ql(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Xi)],B.prototype,"exceptionOccurred",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Wt]),b("design:returntype",String)],B.prototype,"runtimeRequestInstallNotification",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],B.prototype,"runtimeNotifications",null);N([ye(),Y(0,Z()),Y(1,Z()),b("design:type",Function),b("design:paramtypes",[String,Wt]),b("design:returntype",Boolean)],B.prototype,"runtimeUpdateNotification",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],B.prototype,"runtimeRemoveNotification",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],B.prototype,"runtimeGrantNotification",null);N([Ql(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",ea)],B.prototype,"runtimeNotificationTriggered",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],B.prototype,"runtimeExportDb",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],B.prototype,"runtimeImportDb",null);N([ye(),Y(0,Z()),Y(1,Z()),b("design:type",Function),b("design:paramtypes",[String,String]),b("design:returntype",Boolean)],B.prototype,"runtimeExportPerspective",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],B.prototype,"runtimeImportPerspective",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],B.prototype,"runtimeMultiUserEnabled",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[Boolean]),b("design:returntype",Boolean)],B.prototype,"runtimeSetMultiUserEnabled",null);N([Rt(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Array)],B.prototype,"runtimeListUsers",null);N([ye(),Y(0,Z()),Y(1,Z()),b("design:type",Function),b("design:paramtypes",[String,vr]),b("design:returntype",en)],B.prototype,"runtimeRequestLoginVerification",null);N([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),b("design:type",Function),b("design:paramtypes",[String,String,String]),b("design:returntype",String)],B.prototype,"runtimeVerifyEmailCode",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",Boolean)],B.prototype,"runtimeTestEmail",null);N([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),b("design:type",Function),b("design:paramtypes",[String,String,vr]),b("design:returntype",Gi)],B.prototype,"runtimeCreateUser",null);N([ye(),Y(0,Z()),Y(1,Z()),b("design:type",Function),b("design:paramtypes",[String,String]),b("design:returntype",String)],B.prototype,"runtimeLoginUser",null);N([ye(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeEnable",null);N([ye(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],B.prototype,"runtimeEmailTestModeDisable",null);N([ye(),Y(0,Z()),b("design:type",Function),b("design:paramtypes",[String]),b("design:returntype",String)],B.prototype,"runtimeEmailTestGetCode",null);N([ye(),b("design:type",Function),b("design:paramtypes",[]),b("design:returntype",Boolean)],B.prototype,"runtimeEmailTestClearCodes",null);N([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),b("design:type",Function),b("design:paramtypes",[String,String,Number]),b("design:returntype",Boolean)],B.prototype,"runtimeEmailTestSetExpiry",null);B=N([tb()],B);var Ma=function(r,e,t,i,n){if(i==="m")throw new TypeError("Private method is not writable");if(i==="a"&&!n)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?r!==e||!n:!e.has(r))throw new TypeError("Cannot write private member to an object whose class did not declare it");return i==="a"?n.call(r,t):n?n.value=t:e.set(r,t),t},ae=function(r,e,t,i){if(t==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?r!==e||!i:!e.has(r))throw new TypeError("Cannot read private member from an object whose class did not declare it");return t==="m"?i:t==="a"?i.call(r):i?i.value:e.get(r)},st,Ys,Xs,Te;function ec(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Ch(r){return r?`triple("${r}", "ad4m://has_child", Base)`:""}function Nh(){return`
|
|
1538
|
+
`,N=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)}},Oo=new cn;Oo.author="did:ad4m:test";Oo.timestamp=Date.now();Oo.data={source:"root",target:"neighbourhood://Qm12345"};Oo.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([Oo]);var Ec=class{};N([S(),_("design:type",String)],Ec.prototype,"recipient",void 0);N([S(),_("design:type",Kn)],Ec.prototype,"message",void 0);Ec=N([H()],Ec);var Xi=class{};N([S(),_("design:type",String)],Xi.prototype,"ad4mExecutorVersion",void 0);N([S(),_("design:type",Boolean)],Xi.prototype,"isInitialized",void 0);N([S(),_("design:type",Boolean)],Xi.prototype,"isUnlocked",void 0);Xi=N([H()],Xi);var ti=class{};N([S(),_("design:type",String)],ti.prototype,"title",void 0);N([S(),_("design:type",String)],ti.prototype,"message",void 0);N([S(),_("design:type",String)],ti.prototype,"type",void 0);N([S(),_("design:type",String)],ti.prototype,"addon",void 0);ti=N([H()],ti);var Qt=class{};N([S(),_("design:type",String)],Qt.prototype,"description",void 0);N([S(),_("design:type",String)],Qt.prototype,"appName",void 0);N([S(),_("design:type",String)],Qt.prototype,"appUrl",void 0);N([S(),_("design:type",String)],Qt.prototype,"appIconPath",void 0);N([S(),_("design:type",String)],Qt.prototype,"trigger",void 0);N([S(),_("design:type",Array)],Qt.prototype,"perspectiveIds",void 0);N([S(),_("design:type",String)],Qt.prototype,"webhookUrl",void 0);N([S(),_("design:type",String)],Qt.prototype,"webhookAuth",void 0);Qt=N([Ge()],Qt);var Ct=class{};N([S(),_("design:type",String)],Ct.prototype,"id",void 0);N([S(),_("design:type",Boolean)],Ct.prototype,"granted",void 0);N([S(),_("design:type",String)],Ct.prototype,"description",void 0);N([S(),_("design:type",String)],Ct.prototype,"appName",void 0);N([S(),_("design:type",String)],Ct.prototype,"appUrl",void 0);N([S(),_("design:type",String)],Ct.prototype,"appIconPath",void 0);N([S(),_("design:type",String)],Ct.prototype,"trigger",void 0);N([S(),_("design:type",Array)],Ct.prototype,"perspectiveIds",void 0);N([S(),_("design:type",String)],Ct.prototype,"webhookUrl",void 0);N([S(),_("design:type",String)],Ct.prototype,"webhookAuth",void 0);Ct=N([H()],Ct);var ea=class{};N([S(),_("design:type",Ct)],ea.prototype,"notification",void 0);N([S(),_("design:type",String)],ea.prototype,"perspectiveId",void 0);N([S(),_("design:type",String)],ea.prototype,"triggerMatch",void 0);ea=N([H()],ea);var He=class{};N([S(),_("design:type",Number)],He.prototype,"total",void 0);N([S(),_("design:type",Number)],He.prototype,"imported",void 0);N([S(),_("design:type",Number)],He.prototype,"failed",void 0);N([S(),_("design:type",Number)],He.prototype,"omitted",void 0);N([S(),_("design:type",Array)],He.prototype,"errors",void 0);He=N([H()],He);var Nt=class{};N([S(),_("design:type",He)],Nt.prototype,"perspectives",void 0);N([S(),_("design:type",He)],Nt.prototype,"links",void 0);N([S(),_("design:type",He)],Nt.prototype,"expressions",void 0);N([S(),_("design:type",He)],Nt.prototype,"perspectiveDiffs",void 0);N([S(),_("design:type",He)],Nt.prototype,"notifications",void 0);N([S(),_("design:type",He)],Nt.prototype,"models",void 0);N([S(),_("design:type",He)],Nt.prototype,"defaultModels",void 0);N([S(),_("design:type",He)],Nt.prototype,"tasks",void 0);N([S(),_("design:type",He)],Nt.prototype,"friends",void 0);N([S(),_("design:type",He)],Nt.prototype,"trustedAgents",void 0);N([S(),_("design:type",He)],Nt.prototype,"knownLinkLanguages",void 0);Nt=N([H()],Nt);var ta=class{};N([S(),_("design:type",String)],ta.prototype,"email",void 0);N([S(),_("design:type",String)],ta.prototype,"did",void 0);N([S(),_("design:type",String)],ta.prototype,"lastSeen",void 0);N([S(),_("design:type",Number)],ta.prototype,"perspectiveCount",void 0);ta=N([H()],ta);var ri=class{};N([S(),_("design:type",Boolean)],ri.prototype,"success",void 0);N([S(),_("design:type",String)],ri.prototype,"message",void 0);N([S(),_("design:type",Boolean)],ri.prototype,"requiresPassword",void 0);N([S(),_("design:type",Boolean)],ri.prototype,"isExistingUser",void 0);ri=N([H()],ri);var q=class{runtimeQuit(){return!0}runtimeOpenLink(e){return!0}runtimeInfo(){return{ad4mExecutorVersion:"x.x.x",isInitialized:!0,isUnlocked:!0}}addTrustedAgents(e){return e}deleteTrustedAgents(e){return[]}getTrustedAgents(){return["agentPubKey"]}runtimeKnownLinkLanguageTemplates(){return["Qm12345abcdef"]}runtimeAddKnownLinkLanguageTemplates(e){return e}runtimeRemoveKnownLinkLanguageTemplates(e){return[]}runtimeFriends(){return["did:test:friend"]}runtimeAddFriends(e){return e}runtimeRemoveFriends(e){return[]}runtimeHcAgentInfos(){return JSON.stringify([{agent:{type:"Buffer",data:[9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186]},signature:{type:"Buffer",data:[195,143,170,36,234,123,255,85,188,138,124,2,91,18,53,231,44,41,240,8,80,131,100,150,165,125,146,90,17,200,190,129,114,211,11,146,150,128,198,199,79,118,157,101,194,68,58,245,98,182,79,139,140,41,143,129,8,136,87,77,180,231,218,11]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,9,191,231,58,255,107,202,55,206,57,9,103,17,34,206,195,207,114,5,73,77,198,56,136,17,227,242,231,194,135,128,48,170,189,119,186,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,101,83,52,86,112,54,109,118,80,48,122,116,85,101,104,114,117,113,89,52,102,66,53,101,69,98,121,48,69,66,100,89,84,50,95,67,48,69,112,77,111,76,111,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,104,189,50,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38]},signature:{type:"Buffer",data:[233,192,38,3,59,248,124,231,57,255,40,154,50,60,119,252,68,198,154,109,175,155,106,217,211,155,109,223,249,91,221,210,17,132,72,230,11,230,247,119,72,244,145,91,75,7,67,5,130,151,44,231,52,220,28,154,212,82,58,90,203,211,236,4]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,98,187,145,48,115,209,94,143,31,153,102,69,138,29,133,213,34,52,39,164,157,139,178,111,23,33,118,250,28,155,78,246,128,49,179,38,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,55,101,77,106,48,73,83,72,56,56,81,56,45,89,51,74,89,70,53,76,72,57,83,54,68,119,71,73,49,88,45,115,87,53,68,104,66,87,121,71,119,78,115,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,103,45,197,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109]},signature:{type:"Buffer",data:[88,189,229,122,44,171,194,156,90,79,148,49,207,224,34,199,219,88,24,243,103,127,123,41,87,171,127,92,6,216,198,171,26,226,237,217,122,78,98,146,55,255,68,240,202,83,58,140,147,185,3,66,15,216,210,22,99,197,73,234,120,17,74,1]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,181,101,115,45,214,127,198,153,159,184,30,87,67,224,208,184,203,176,130,158,236,127,153,125,243,183,188,167,154,25,118,254,101,145,210,109,164,117,114,108,115,145,217,99,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,114,70,71,83,100,113,104,101,68,107,70,70,56,69,102,109,45,69,116,55,119,81,101,120,83,88,55,65,112,69,51,89,86,99,45,120,102,52,104,106,77,115,77,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,57,50,46,49,54,56,46,49,55,56,46,54,48,47,112,47,55,55,52,52,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,23,220,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}},{agent:{type:"Buffer",data:[3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56]},signature:{type:"Buffer",data:[129,12,55,104,239,121,138,2,86,106,136,51,219,79,170,8,195,69,81,188,225,192,247,196,54,39,164,110,75,39,240,56,245,189,154,77,72,11,97,250,202,149,242,97,128,28,47,164,236,104,136,82,212,246,44,143,132,119,255,135,112,11,20,13]},agent_info:{type:"Buffer",data:[134,165,115,112,97,99,101,196,36,203,165,212,173,24,215,165,196,25,145,248,113,246,139,205,182,241,138,57,0,26,8,217,179,23,126,59,136,128,213,110,225,173,72,197,95,165,97,103,101,110,116,196,36,3,171,237,107,186,245,165,47,237,235,211,49,245,62,113,53,255,252,223,226,75,118,148,187,23,53,70,174,160,184,64,63,94,210,227,56,164,117,114,108,115,145,217,97,107,105,116,115,117,110,101,45,112,114,111,120,121,58,47,47,104,121,112,115,86,121,103,117,80,84,115,53,118,73,80,65,102,97,112,90,88,113,117,84,115,79,80,100,67,81,79,79,117,103,57,51,82,103,106,95,114,85,73,47,107,105,116,115,117,110,101,45,113,117,105,99,47,104,47,49,54,53,46,50,50,46,51,50,46,49,49,47,112,47,53,55,55,57,47,45,45,172,115,105,103,110,101,100,95,97,116,95,109,115,207,0,0,1,123,233,113,188,123,176,101,120,112,105,114,101,115,95,97,102,116,101,114,95,109,115,206,0,18,79,128,169,109,101,116,97,95,105,110,102,111,196,34,129,187,100,104,116,95,115,116,111,114,97,103,101,95,97,114,99,95,104,97,108,102,95,108,101,110,103,116,104,206,128,0,0,1]}}])}runtimeGetNetworkMetrics(){return JSON.stringify({metrics:{},stats:{}})}runtimeRestartHolochain(){return!0}runtimeHcAddAgentInfos(e){return!0}runtimeVerifyStringSignedByDid(e,t,n,i){return!0}runtimeSetStatus(e){return!0}runtimeFriendStatus(e){return 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:ql.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}};N([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeQuit",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeOpenLink",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Xi)],q.prototype,"runtimeInfo",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"addTrustedAgents",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"deleteTrustedAgents",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"getTrustedAgents",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"runtimeKnownLinkLanguageTemplates",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"runtimeAddKnownLinkLanguageTemplates",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"runtimeRemoveKnownLinkLanguageTemplates",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"runtimeFriends",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"runtimeAddFriends",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Array]),_("design:returntype",Array)],q.prototype,"runtimeRemoveFriends",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",String)],q.prototype,"runtimeHcAgentInfos",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",String)],q.prototype,"runtimeGetNetworkMetrics",null);N([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeRestartHolochain",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Object]),_("design:returntype",Boolean)],q.prototype,"runtimeHcAddAgentInfos",null);N([$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)],q.prototype,"runtimeVerifyStringSignedByDid",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[br]),_("design:returntype",Boolean)],q.prototype,"runtimeSetStatus",null);N([$t(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Kn)],q.prototype,"runtimeFriendStatus",null);N([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,oc]),_("design:returntype",Boolean)],q.prototype,"runtimeFriendSendMessage",null);N([$t(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Array)],q.prototype,"runtimeMessageInbox",null);N([$t(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Array)],q.prototype,"runtimeMessageOutbox",null);N([zl(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Kn)],q.prototype,"runtimeMessageReceived",null);N([zl(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",ti)],q.prototype,"exceptionOccurred",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Qt]),_("design:returntype",String)],q.prototype,"runtimeRequestInstallNotification",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"runtimeNotifications",null);N([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,Qt]),_("design:returntype",Boolean)],q.prototype,"runtimeUpdateNotification",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeRemoveNotification",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeGrantNotification",null);N([zl(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",ea)],q.prototype,"runtimeNotificationTriggered",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeExportDb",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeImportDb",null);N([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",Boolean)],q.prototype,"runtimeExportPerspective",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeImportPerspective",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeMultiUserEnabled",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[Boolean]),_("design:returntype",Boolean)],q.prototype,"runtimeSetMultiUserEnabled",null);N([$t(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Array)],q.prototype,"runtimeListUsers",null);N([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,wr]),_("design:returntype",ri)],q.prototype,"runtimeRequestLoginVerification",null);N([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),_("design:type",Function),_("design:paramtypes",[String,String,String]),_("design:returntype",String)],q.prototype,"runtimeVerifyEmailCode",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",Boolean)],q.prototype,"runtimeTestEmail",null);N([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),_("design:type",Function),_("design:paramtypes",[String,String,wr]),_("design:returntype",Jn)],q.prototype,"runtimeCreateUser",null);N([ye(),Y(0,Z()),Y(1,Z()),_("design:type",Function),_("design:paramtypes",[String,String]),_("design:returntype",String)],q.prototype,"runtimeLoginUser",null);N([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeEnable",null);N([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeEmailTestModeDisable",null);N([ye(),Y(0,Z()),_("design:type",Function),_("design:paramtypes",[String]),_("design:returntype",String)],q.prototype,"runtimeEmailTestGetCode",null);N([ye(),_("design:type",Function),_("design:paramtypes",[]),_("design:returntype",Boolean)],q.prototype,"runtimeEmailTestClearCodes",null);N([ye(),Y(0,Z()),Y(1,Z()),Y(2,Z()),_("design:type",Function),_("design:paramtypes",[String,String,Number]),_("design:returntype",Boolean)],q.prototype,"runtimeEmailTestSetExpiry",null);q=N([rb()],q);function Xs(r){return r.charAt(0).toUpperCase()+r.slice(1)}function Ma(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 Nh(r,e){return!r||!e?"":`triple("${r.id}", "${e}", Base)`}function $h(){return`
|
|
1540
1539
|
findall(
|
|
1541
1540
|
[T, A],
|
|
1542
1541
|
link(Base, _, _, T, A),
|
|
@@ -1544,98 +1543,99 @@ input VoiceActivityParamsInput {
|
|
|
1544
1543
|
),
|
|
1545
1544
|
sort(AllLinks, SortedLinks),
|
|
1546
1545
|
SortedLinks = [[Timestamp, Author]|_]
|
|
1547
|
-
`}function
|
|
1546
|
+
`}function xS(r){return`
|
|
1548
1547
|
findall([PropertyName, PropertyValue, Resolve], (
|
|
1549
1548
|
% Constrain to specified properties if provided
|
|
1550
1549
|
${r?`member(PropertyName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1551
1550
|
resolve_property(SubjectClass, Base, PropertyName, PropertyValue, Resolve)
|
|
1552
1551
|
), Properties)
|
|
1553
|
-
`}function
|
|
1554
|
-
|
|
1555
|
-
% Constrain to specified collections if provided
|
|
1556
|
-
${r?`member(CollectionName, [${r.map(e=>`"${e}"`).join(", ")}]),`:""}
|
|
1557
|
-
|
|
1558
|
-
collection(SubjectClass, CollectionName),
|
|
1559
|
-
collection_getter(SubjectClass, Base, CollectionName, CollectionValues)
|
|
1560
|
-
), Collections)
|
|
1561
|
-
`}function Dh(r={}){function e(t){return typeof t=="string"?`"${t}"`:t}return Object.entries(r).map(([t,i])=>{let n=["base","author","timestamp"].includes(t),a=`resolve_property(SubjectClass, Base, "${t}", Value${t}, _)`,o=ec(t);if(Array.isArray(i)){let s=i.map(c=>e(c)).join(", ");return n?`member(${o}, [${s}])`:`${a}, member(Value${t}, [${s}])`}if(typeof i=="object"&&i!==null){let{not:s,between:c,lt:u,lte:l,gt:f,gte:d}=i;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return n?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return n?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return n?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:f,symbol:">"},{value:d,symbol:">="}];for(let{value:h,symbol:m}of p)if(h!==void 0)return n?`${o} ${m} ${h}`:`${a}, Value${t} ${m} ${h}`}return n?`${o} = ${e(i)}`:`${a}, Value${t} = ${e(i)}`}).join(", ")}function $h(r){return r?"length(UnsortedInstances, TotalCount)":""}function Rh(r){if(!r)return"SortedInstances = UnsortedInstances";let[e,t]=Object.entries(r)[0];return`sort_instances(UnsortedInstances, "${e}", "${t}", SortedInstances)`}function Lh(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function Ph(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Fh(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),i=(t||"").replace(/\/+$/,"");return`${e}://${i}`}else return r.replace(/\/+$/,"")}function np(r){if(!!r){if(typeof r=="string")return r;if(Array.isArray(r)&&r.length>0)return r.find(t=>t!=="null")||r[0]}}function qm(r,e){return np(r.type)===e}function Mh(r){return qm(r,"array")}function Uh(r){return qm(r,"object")}function _S(r){let e=np(r.type);return e==="number"||e==="integer"}var Vi=class{static async getClassName(e){if(this===Vi)return await e.stringOrTemplateObjectToSubjectClassName(this);let i=this.classNamesByClass.get(this);i||(i={},this.classNamesByClass.set(this,i));let n=e.uuid;return i[n]||(i[n]=await e.stringOrTemplateObjectToSubjectClassName(this)),i[n]}get timestamp(){return this.createdAt}static getModelMetadata(){let e=this.prototype;if(!e.className||e.className==="Ad4mModel")throw new Error("Model class must be decorated with @ModelOptions");let t=e.className,i={},n=e.__properties||{};for(let[l,f]of Object.entries(n)){let d=f;i[l]={name:l,predicate:d.through||"",required:d.required||!1,writable:d.writable||!1,...d.initial!==void 0&&{initial:d.initial},...d.resolveLanguage!==void 0&&{resolveLanguage:d.resolveLanguage},...d.prologGetter!==void 0&&{prologGetter:d.prologGetter},...d.getter!==void 0&&{getter:d.getter},...d.prologSetter!==void 0&&{prologSetter:d.prologSetter},...d.local!==void 0&&{local:d.local},...d.transform!==void 0&&{transform:d.transform},...d.flag!==void 0&&{flag:d.flag}}}let a={},o=e.__collections||{};for(let[l,f]of Object.entries(o)){let d=f;a[l]={name:l,predicate:d.through||"",...d.where!==void 0&&{where:d.where},...d.local!==void 0&&{local:d.local},...d.getter!==void 0&&{getter:d.getter}}}let s=Object.keys(i).length>0,c=Object.keys(a).length>0;if(!(s||c)&&e.__jsonSchema){let l=e.__jsonSchema,f=e.__jsonSchemaOptions||{};if(l.properties)for(let[d,p]of Object.entries(l.properties)){let h=Mh(p),m=this.determinePredicate(l,d,p,this.determineNamespace(l,f),f);if(h)a[d]={name:d,predicate:m,...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}};else{let y=l.required?.includes(d)||!1;i[d]={name:d,predicate:m,required:y,writable:p["x-ad4m"]?.writable!==!1,...p["x-ad4m"]?.resolveLanguage&&{resolveLanguage:p["x-ad4m"].resolveLanguage},...p["x-ad4m"]?.initial&&{initial:p["x-ad4m"].initial},...p["x-ad4m"]?.local!==void 0&&{local:p["x-ad4m"].local}}}}}return{className:t,properties:i,collections:a}}constructor(e,t,i){st.set(this,void 0),Ys.set(this,void 0),Xs.set(this,void 0),Te.set(this,void 0),Ma(this,st,t||we.from(jm(24)).toUrl(),"f"),Ma(this,Te,e,"f"),Ma(this,Xs,i||"ad4m://self","f")}get baseExpression(){return ae(this,st,"f")}get perspective(){return ae(this,Te,"f")}getPropertyMetadata(e){return Object.getPrototypeOf(this).__properties?.[e]}getCollectionMetadata(e){return Object.getPrototypeOf(this).__collections?.[e]}generatePropertySetterAction(e,t){if(t.writable===!1)throw new Error(`Property "${e}" is read-only and cannot be written`);if(t.prologSetter)throw new Error(`Custom Prolog setter for property "${e}" not yet supported without Prolog. Use standard @Property decorator or enable Prolog for custom setters.`);if(!t.through)throw new Error(`Property "${e}" has no 'through' predicate defined`);return[{action:"setSingleTarget",source:"this",predicate:t.through,target:"value",...t.local&&{local:!0}}]}generateCollectionAction(e,t){let i=this.getCollectionMetadata(e);if(!i)throw new Error(`Collection "${e}" has no metadata defined`);if(!i.through)throw new Error(`Collection "${e}" has no 'through' predicate defined`);return[{action:{adder:"addLink",remover:"removeLink",setter:"collectionSetter"}[t],source:"this",predicate:i.through,target:"value",...i.local&&{local:!0}}]}static async assignValuesToInstance(e,t,i){let n=Object.fromEntries(await Promise.all(i.map(async([o,s,c])=>{let u=s;if(!c&&typeof s=="string"){let f=Array.from(s,h=>h.codePointAt(0)),d=f.every(h=>h<=255),p=f.some(h=>h>=128);if(d&&p)try{let h=Uint8Array.from(f),m=new TextDecoder("utf-8",{fatal:!0}).decode(h);m!==s&&(u=m)}catch(h){console.warn(`UTF-8 byte reconstruction failed for property "${o}"`,{value:s,error:h})}}if(c){let f=await e.getExpression(s);if(f)try{u=JSON.parse(f.data)}catch{u=f.data}}let l=t.__properties?.[o]?.transform;return l&&typeof l=="function"&&(u=l(u)),[o,u]}))),a=Object.fromEntries(Object.entries(n).filter(([o])=>{let s=Object.getOwnPropertyDescriptor(Object.getPrototypeOf(t),o);return s?s.get!==void 0||s.set!==void 0?s.set!==void 0:s.writable!==!1:!0}));Object.assign(t,a)}async getData(){try{let e=this.constructor,t=e.getModelMetadata(),n=`
|
|
1552
|
+
`}function Dh(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":Xs(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:f,gte:d}=n;if(s!==void 0)if(Array.isArray(s)){let h=s.map(m=>e(m)).join(", ");return i?`\\+ member(${o}, [${h}])`:`${a}, \\+ member(Value${t}, [${h}])`}else return i?`${o} \\= ${e(s)}`:`${a}, Value${t} \\= ${e(s)}`;if(c!==void 0&&Array.isArray(c)&&c.length===2)return i?`${o} >= ${c[0]}, ${o} =< ${c[1]}`:`${a}, Value${t} >= ${c[0]}, Value${t} =< ${c[1]}`;let p=[{value:u,symbol:"<"},{value:l,symbol:"=<"},{value:f,symbol:">"},{value:d,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 Rh(r){return r?"length(UnsortedInstances, TotalCount)":""}function Lh(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 Ph(r){return!r||r<0?"InstancesWithOffset = SortedInstances":`skipN(SortedInstances, ${r}, InstancesWithOffset)`}function Fh(r){return!r||r<0?"AllInstances = InstancesWithOffset":`takeN(InstancesWithOffset, ${r}, AllInstances)`}function Mh(r){if(!r)return"";if(r.includes("://")){let[e,t]=r.split("://"),n=(t||"").replace(/\/+$/,"");return`${e}://${n}`}else return r.replace(/\/+$/,"")}function ip(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 Bm(r,e){return ip(r.type)===e}function Uh(r){return Bm(r,"array")}function jh(r){return Bm(r,"object")}function kS(r){let e=ip(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=Qn(this);for(let[f,d]of Object.entries(i)){let p=d;n[f]={name:f,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(([,f])=>f.kind==="hasMany"||f.kind==="belongsToMany"));for(let[f,d]of Object.entries(s)){let p=d;a[f]={name:f,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"}}let c=Object.keys(n).length>0,u=Object.keys(a).length>0;if(!(c||u)&&e.__jsonSchema){let f=e.__jsonSchema,d=e.__jsonSchemaOptions||{};if(f.properties)for(let[p,h]of Object.entries(f.properties)){let m=Uh(h),g=this.determinePredicate(f,p,h,this.determineNamespace(f,d),d);if(m)a[p]={name:p,predicate:g,...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}};else{let w=f.required?.includes(p)||!1;n[p]={name:p,predicate:g,required:w,readOnly:h["x-ad4m"]?.writable===!1,...h["x-ad4m"]?.resolveLanguage&&{resolveLanguage:h["x-ad4m"].resolveLanguage},...h["x-ad4m"]?.initial&&{initial:h["x-ad4m"].initial},...h["x-ad4m"]?.local!==void 0&&{local:h["x-ad4m"].local}}}}}return{className:t,properties:n,relations:a}}constructor(e,t){this._snapshot=null,this._baseExpression=t||Se.from(tm(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 Qn(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,m]of Object.entries(n.properties))m.getter||u&&!u.has(h)||l.set(m.predicate,[h,m]);let f=new Map;for(let[h,m]of Object.entries(n.relations))m.getter||f.set(m.predicate,[h,m]);let d=new Map,p=new Map;for(let h=0;h<t.length;h++){let m=t[h],{predicate:g,target:w,author:b,timestamp:v}=m;if(w==="None"||w===void 0||w===null)continue;v!=null&&((o==null||v<o)&&(o=v,c=b??null),(s==null||v>s)&&(s=v));let y=l.get(g);if(y){d.get(y[0]),d.set(y[0],{target:w,timestamp:v});continue}let I=f.get(g);if(I){let[$]=I,A=p.get($);A||(A=[],p.set($,A)),A.push({target:w,timestamp:v??"",index:h})}}for(let[h,{target:m}]of d){let[,g]=l.get(n.properties[h].predicate),w=typeof e[h];e[h]=await this.hydratePropertyValue(m,g,i,w!=="undefined"?w:void 0)}for(let[h,m]of p)m.sort((g,w)=>{let b=String(g.timestamp).localeCompare(String(w.timestamp));return b!==0?b:g.index-w.index}),e[h]=m.map(g=>g.target).filter(g=>g!=null&&g!==""&&g!=="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 d=Array.from(s,m=>m.codePointAt(0)),p=d.every(m=>m<=255),h=d.some(m=>m>=128);if(p&&h)try{let m=Uint8Array.from(d),g=new TextDecoder("utf-8",{fatal:!0}).decode(m);g!==s&&(u=g)}catch(m){console.warn(`UTF-8 byte reconstruction failed for property "${o}"`,{value:s,error:m})}}if(c){let d=await e.getExpression(s);if(d)try{u=JSON.parse(d.data)}catch{u=d.data}}let f=Qn(t.constructor)[o]?.transform;return f&&typeof f=="function"&&(u=f(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,f)=>l!==u[f]))&&n.push(a)}else o!==s&&n.push(a)}return n}async getData(e){try{let t=this.constructor,n=t.getModelMetadata(),a=`
|
|
1562
1554
|
SELECT id, predicate, out.uri AS target, author, timestamp
|
|
1563
1555
|
FROM link
|
|
1564
|
-
WHERE in.uri = ${
|
|
1556
|
+
WHERE in.uri = ${t.formatSurrealValue(this._baseExpression)}
|
|
1565
1557
|
ORDER BY timestamp ASC
|
|
1566
|
-
`,
|
|
1558
|
+
`,o=await this._perspective.querySurrealDB(a);if(o&&o.length>0){let u=e?.properties&&e.properties.length>0?e.properties:void 0;await t.hydrateFromLinks(this,o,n,this._perspective,u)}let s=dr(t),c=e?.properties&&e.properties.length>0?new Set(e.properties):null;for(let[u,l]of Object.entries(s)){if(l.kind!=="belongsToOne"&&l.kind!=="belongsToMany"||c&&!c.has(u))continue;let d=(await this._perspective.get(new fe({predicate:l.predicate,target:this._baseExpression}))).filter(p=>p.data.target===this._baseExpression).map(p=>p.data.source);l.kind==="belongsToOne"?this[u]=d.length>0?d[d.length-1]:null:this[u]=d}await t.evaluateCustomGettersForInstance(this,this._perspective,n),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),f=t.parent?Ma(t.parent,this):void 0,d=[$h(),Nh(t.parent,f),xS(i),Dh(a)],p=[Rh(u),Lh(o),Ph(s),Fh(c)];return`
|
|
1567
1559
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1568
|
-
subject_class("${
|
|
1560
|
+
subject_class("${l}", SubjectClass),
|
|
1569
1561
|
instance(SubjectClass, Base),
|
|
1570
|
-
${
|
|
1562
|
+
${d.filter(m=>m).join(", ")}
|
|
1571
1563
|
), UnsortedInstances),
|
|
1572
|
-
${
|
|
1573
|
-
`}static async evaluateCustomGettersForInstance(e,t,
|
|
1564
|
+
${p.filter(m=>m).join(", ")}
|
|
1565
|
+
`}static async evaluateCustomGettersForInstance(e,t,n){let i=this.formatSurrealValue(e.id);for(let[a,o]of Object.entries(n.properties))if(o.getter)try{let s=o.getter.replace(/Base/g,i),c=await t.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${i}`);c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null&&c[0].value!=="None"&&c[0].value!==""&&(e[a]=c[0].value)}catch(s){console.warn(`Failed to evaluate getter for ${a}:`,s)}for(let[a,o]of Object.entries(n.relations))if(o.getter)try{let s=o.getter.replace(/Base/g,i),c=await t.querySurrealDB(`SELECT (${s}) AS value FROM node WHERE uri = ${i}`);if(c&&c.length>0&&c[0].value!==void 0&&c[0].value!==null){let u=c[0].value;e[a]=Array.isArray(u)?u.filter(l=>l!=null&&l!==""&&l!=="None"):u}}catch(s){console.warn(`Failed to evaluate getter for ${a}:`,s)}}static async 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 w of e){let v=(await t.get(new fe({predicate:s.predicate,target:w.id}))).filter(y=>y.data.target===w.id).map(y=>y.data.source);if(s.kind==="belongsToOne"){if(v.length===0){w[a]=null;continue}let y=v[v.length-1];try{let I=new c(t,y);await I.get(),w[a]=I}catch{w[a]=null}}else{let y=[];if(u&&(u.where||u.order||u.properties)){let I={id:v,...u.where??{}};y=await c.findAll(t,{where:I,...u.order&&{order:u.order},...u.properties&&{properties:u.properties}})}else await Promise.all(v.map(async I=>{try{let $=new c(t,I);await $.get(u?.properties?{properties:u.properties}:void 0),y.push($)}catch{}}));if(u?.order&&!(u.where||u.properties)){let I=Object.entries(u.order);y=y.sort(($,A)=>{for(let[R,P]of I){let D=String($[R]??""),k=String(A[R]??""),Te=D.localeCompare(k);if(Te!==0)return P==="DESC"?-Te:Te}return 0})}if(u?.offset!=null||u?.limit!=null){let I=u.offset??0,$=u.limit!=null?I+u.limit:void 0;y=y.slice(I,$)}w[a]=y,l&&y.length>0&&await c.hydrateRelations(y,t,l)}}continue}let f=new Set,d=new Map;for(let w of e){let b=w[a];if(d.set(w,Array.isArray(b)?[...b]:b),b!=null)if(Array.isArray(b))for(let v of b)typeof v=="string"?f.add(v):v&&typeof v=="object"&&typeof v.id=="string"&&f.add(v.id);else typeof b=="string"?f.add(b):b&&typeof b=="object"&&typeof b.id=="string"&&f.add(b.id)}if(f.size===0)continue;let p=new Map,m={where:{id:Array.from(f),...u?.where??{}},...u?.order&&{order:u.order},...u?.properties&&{properties:u.properties}},g=await c.findAll(t,m);for(let w of g)p.set(w.id,w);for(let w of e){let b=d.get(w);if(b!=null)if(Array.isArray(b)){let v=b.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);v=v.sort((I,$)=>{for(let[A,R]of y){let P=String(I[A]??""),D=String($[A]??""),k=P.localeCompare(D);if(k!==0)return R==="DESC"?-k:k}return 0})}if(u?.offset!=null||u?.limit!=null){let y=u.offset??0,I=u.limit!=null?y+u.limit:void 0;v=v.slice(y,I)}s.maxCount===1?(v.length>1&&console.warn(`include: relation "${a}" has maxCount 1 but ${v.length} values found; keeping the last`),w[a]=v.length>0?v[v.length-1]:null):w[a]=v}else typeof b=="string"&&p.has(b)?w[a]=p.get(b):b&&typeof b=="object"&&typeof b.id=="string"&&(w[a]=p.has(b.id)?p.get(b.id):b)}if(l){let w=Array.from(p.values());await c.hydrateRelations(w,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 d=Ma(t.parent,this);c.push(`count(<-link[WHERE in.uri = ${this.formatSurrealValue(t.parent.id)} AND predicate = '${ue(d)}']) > 0`)}for(let[d,p]of Object.entries(n.properties))if(p.required){if(p.getter)continue;p.flag&&p.initial?c.push(`count(->link[WHERE predicate = '${ue(p.predicate)}' AND out.uri = '${ue(p.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${ue(p.predicate)}']) > 0`)}if(c.length===0){for(let[d,p]of Object.entries(n.properties))if(p.initial){p.flag?c.push(`count(->link[WHERE predicate = '${ue(p.predicate)}' AND out.uri = '${ue(p.initial)}']) > 0`):c.push(`count(->link[WHERE predicate = '${ue(p.predicate)}']) > 0`);break}}if(c.length===0){let d=[];for(let[,p]of Object.entries(n.properties))p.predicate&&d.push(`predicate = '${ue(p.predicate)}'`);if(n.relations)for(let[,p]of Object.entries(n.relations))p.predicate&&d.push(`predicate = '${ue(p.predicate)}'`);d.length>0&&c.push(`count(->link[WHERE (${d.join(" OR ")})]) > 0`)}let u=this.buildGraphTraversalWhereClause(n,i),l=[];return l.push(...c),u&&l.push(u),l.push("count(->link) > 0"),`
|
|
1574
1566
|
SELECT
|
|
1575
1567
|
id AS source,
|
|
1576
1568
|
uri AS source_uri,
|
|
1577
|
-
->link
|
|
1569
|
+
->link AS links
|
|
1578
1570
|
FROM node
|
|
1579
|
-
WHERE ${
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
`)}static
|
|
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=ue(c.predicate);if(Array.isArray(a)){let h=a.map(m=>this.formatSurrealValue(m)).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 if(typeof a=="object"&&a!==null){let h=a;if(h.not!==void 0)if(Array.isArray(h.not)){let m=h.not.map(g=>this.formatSurrealValue(g)).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 u?n.push(`count(<-link[WHERE predicate = '${p}' AND in.uri = ${this.formatSurrealValue(h.not)}]) = 0`):n.push(`count(->link[WHERE predicate = '${p}' AND out.uri = ${this.formatSurrealValue(h.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 f=ue(l.predicate),d=l.resolveLanguage==="literal"?"fn::parse_literal(out.uri)":"out.uri";if(Array.isArray(a)){let p=a.map(h=>this.formatSurrealValue(h)).join(", ");n.push(`count(->link[WHERE predicate = '${f}' AND ${d} IN [${p}]]) > 0`)}else if(typeof a=="object"&&a!==null){let p=a;if(p.not!==void 0)if(Array.isArray(p.not)){let m=p.not.map(g=>this.formatSurrealValue(g)).join(", ");n.push(`count(->link[WHERE predicate = '${f}' AND ${d} IN [${m}]]) = 0`)}else n.push(`count(->link[WHERE predicate = '${f}' AND ${d} = ${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 = '${f}']) > 0`)}else n.push(`count(->link[WHERE predicate = '${f}' AND ${d} = ${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=ue(s.predicate),u=s.resolveLanguage==="literal"?"fn::parse_literal(target)":"target";if(Array.isArray(a)){let l=a.map(f=>this.formatSurrealValue(f)).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 d=l.not.map(p=>this.formatSurrealValue(p)).join(", ");n.push(`source NOT IN (SELECT VALUE source FROM link WHERE predicate = '${c}' AND ${u} IN [${d}])`)}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=ue(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=ue(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=ue(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=ue(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 typeof e=="string"?`'${e.replace(/\\/g,"\\\\").replace(/'/g,"\\'").replace(/"/g,'\\"').replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}'`:typeof e=="number"||typeof e=="boolean"?String(e):Array.isArray(e)?`[${e.map(t=>this.formatSurrealValue(t)).join(", ")}]`:String(e)}static async instancesFromPrologResult(e,t,n){if(!n?.[0]?.AllInstances)return{results:[],totalCount:0};let i=t?.properties||[],o=(await Promise.all(n[0].AllInstances.map(async([c,u,l,f,d])=>{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",f],["author",d]];return await Zt.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 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 m;try{if(m=h.source_uri,!m)continue;let g=h.links||[],w=new this(e,m);if(await this.hydrateFromLinks(w,g,i,e,a.length>0?a:void 0),a.length>0){let b=new Set(a);for(let v of Object.keys(i.properties))b.has(v)||delete w[v];for(let v of Object.keys(i.relations))!b.has(v)&&!(t.include&&v in t.include)&&delete w[v];for(let v of["author","createdAt","updatedAt"])b.has(v)||delete w[v]}o.push(w)}catch(g){console.error(`Failed to process SurrealDB instance ${m}:`,g)}}let s=dr(this),c=Object.entries(s).filter(([h,m])=>(m.kind==="belongsToOne"||m.kind==="belongsToMany")&&(a.length===0||a.includes(h)));c.length>0&&o.length>0&&await Promise.all(o.map(async h=>{for(let[m,g]of c){let b=(await e.get(new fe({predicate:g.predicate,target:h.id}))).filter(v=>v.data.target===h.id).map(v=>v.data.source);g.kind==="belongsToOne"?h[m]=b.length>0?b[b.length-1]:null:h[m]=b}}));for(let h of o)await this.evaluateCustomGettersForInstance(h,e,i);let u=o;t.where&&(u=o.filter(h=>{for(let[m,g]of Object.entries(t.where))if(m!=="base"){if(m==="author"||m==="timestamp"){if(!this.matchesCondition(h[m],g))return!1;continue}if(typeof g=="object"&&g!==null&&!Array.isArray(g)){let w=g;if((w.gt!==void 0||w.gte!==void 0||w.lt!==void 0||w.lte!==void 0||w.between!==void 0||w.contains!==void 0)&&!this.matchesCondition(h[m],g))return!1}}return!0}));let l=t.order||(t.limit!==void 0||t.offset!==void 0?{timestamp:"ASC"}:null);if(l){let h=Object.entries(l);u.sort((m,g)=>{for(let[w,b]of h){let v=m[w],y=g[w];if(v===void 0&&y===void 0)continue;if(v===void 0)return b==="ASC"?1:-1;if(y===void 0)return b==="ASC"?-1:1;let I=0;if(typeof v=="number"&&typeof y=="number"?I=v-y:typeof v=="string"&&typeof y=="string"?I=v.localeCompare(y):I=String(v).localeCompare(String(y)),I!==0)return b==="DESC"?-I:I}return 0})}let f=u.length,d=u;if(t.offset!==void 0||t.limit!==void 0){let h=t.offset||0,m=t.limit?h+t.limit:void 0;d=u.slice(h,m)}t.include&&d.length>0&&await this.hydrateRelations(d,e,t.include);let p=t.include;for(let h of d)h.takeSnapshot(p);return{results:d,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?Ma(t.parent,this):void 0,s=[$h(),Nh(t.parent,o),Dh(i)],c=[Rh(!0),Lh(),Ph(),Fh()];return`
|
|
1583
1576
|
findall([Base, Properties, Collections, Timestamp, Author], (
|
|
1584
|
-
subject_class("${
|
|
1577
|
+
subject_class("${a}", SubjectClass),
|
|
1585
1578
|
instance(SubjectClass, Base),
|
|
1586
1579
|
${s.filter(l=>l).join(", ")}
|
|
1587
1580
|
), UnsortedInstances),
|
|
1588
1581
|
${c.filter(l=>l).join(", ")}
|
|
1589
|
-
`}static async countQueryToSurrealQL(e,t){let
|
|
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(a=>a.required||a.flag||a.initial!==void 0);if(i){let a={};for(let[s,c]of Object.entries(this))c!=null&&!(Array.isArray(c)&&c.length>0)&&!c?.action&&(a[s]=c);let o=await this.perspective.stringOrTemplateObjectToSubjectClassName(this);await this.perspective.createSubject(o,this._baseExpression,a,e)}await this.innerUpdate(!i,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))&&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=await this._perspective.get(new fe({source:this._baseExpression}));i.length>0&&await this._perspective.removeLinks(i,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=Ma(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=Ma(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 Ql(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),f=e.required?.includes(c)||!1,d=ip(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 h=`add${Xs(c)}`,m=`remove${Xs(c)}`,g=`set${Xs(c)}`;i.prototype[h]=function(){},i.prototype[m]=function(){},i.prototype[g]=function(){}}else{let h=this.getPropertyOption(c,u,t,"resolveLanguage");!h&&t.resolveLanguage&&(h=t.resolveLanguage);let m=this.getPropertyOption(c,u,t,"local"),g=this.getPropertyOption(c,u,t,"readOnly");if(g===void 0){let v=u["x-ad4m"]?.writable;g=v!==void 0?!v:!1}let w=!g,b=this.getPropertyOption(c,u,t,"initial");if(jh(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&&kS(u)&&(h="literal"),h==null&&(h="literal"),f&&!b&&(jh(u)?b="literal://json:{}":b="ad4m://undefined"),a[c]={through:l,required:f,writable:w,...h&&{resolveLanguage:h},...m!==void 0&&{local:m},...b&&{initial:b}},Object.defineProperty(i.prototype,c,{configurable:!0,writable:!0,value:this.getDefaultValueForType(d)}),w){let v=lc(c);i.prototype[v]=function(){}}}}for(let[c,u]of Object.entries(a))sb(i,c,u);for(let[c,u]of Object.entries(o))cb(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,ub({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:
|
|
1590
1583
|
- options.namespace
|
|
1591
1584
|
- schema["x-ad4m"].namespace
|
|
1592
1585
|
- schema.title
|
|
1593
|
-
- valid schema.$id`)}static determinePredicate(e,t,i,n,a){if(a.propertyMapping?.[t])return a.propertyMapping[t];if(i["x-ad4m"]?.through)return i["x-ad4m"].through;if(a.predicateTemplate){let s=Fh(n),[c,u]=s.includes("://")?s.split("://"):["",s],l=u||"";return a.predicateTemplate.replace("${namespace}",l).replace("${scheme}",c).replace("${ns}",l).replace("${title}",e.title||"").replace("${property}",t)}if(a.predicateGenerator)return a.predicateGenerator(e.title||"",t);let o=Fh(n);return o.includes("://")?`${o}${t}`:`${o}://${t}`}static getPropertyOption(e,t,i,n,a){return i.propertyOptions?.[e]?.[n]!==void 0?i.propertyOptions[e][n]:t["x-ad4m"]?.[n]!==void 0?t["x-ad4m"][n]:i[n]!==void 0?i[n]:a}static getDefaultValueForType(e){switch(e){case"string":return"";case"number":return 0;case"integer":return 0;case"boolean":return!1;case"array":return[];case"object":return{};default:return""}}};st=new WeakMap,Ys=new WeakMap,Xs=new WeakMap,Te=new WeakMap;Vi.classNamesByClass=new WeakMap;var Vl=class{constructor(e,t,i){this.queryParams={},this.modelClassName=null,this.useSurrealDBFlag=!0,this.perspective=e,this.ctor=t,i&&(this.queryParams=i)}dispose(){this.currentSubscription&&(this.currentSubscription.dispose(),this.currentSubscription=void 0)}where(e){return this.queryParams.where=e,this}order(e){return this.queryParams.order=e,this}limit(e){return this.queryParams.limit=e,this}offset(e){return this.queryParams.offset=e,this}source(e){return this.queryParams.source=e,this}properties(e){return this.queryParams.properties=e,this}collections(e){return this.queryParams.collections=e,this}overrideModelClassName(e){return this.modelClassName=e,this}useSurrealDB(e=!0){return this.useSurrealDBFlag=e,this}async get(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{results:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName),t=await this.perspective.infer(e),{results:i}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,t);return i}}async subscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.queryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async a=>{let{results:o}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{results:n}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}}async count(){if(this.useSurrealDBFlag){let e=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams),t=await this.perspective.querySurrealDB(e),{totalCount:i}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,t);return i}else{let e=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);return(await this.perspective.infer(e))?.[0]?.TotalCount||0}}async countSubscribe(e){if(this.dispose(),this.useSurrealDBFlag){let t=await this.ctor.queryToSurrealQL(this.perspective,this.queryParams);this.currentSubscription=await this.perspective.subscribeSurrealDB(t);let i=async a=>{let{totalCount:o}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,a);e(o)};this.currentSubscription.onResult(i);let{totalCount:n}=await this.ctor.instancesFromSurrealResult(this.perspective,this.queryParams,this.currentSubscription.result);return n}else{let t=await this.ctor.countQueryToProlog(this.perspective,this.queryParams,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(t);let i=async n=>{let a=n?.[0]?.TotalCount||0;e(a)};return this.currentSubscription.onResult(i),this.currentSubscription.result?.[0]?.TotalCount||0}}async paginate(e,t){let i={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let n=await this.ctor.queryToSurrealQL(this.perspective,i),a=await this.perspective.querySurrealDB(n),{results:o,totalCount:s}=await this.ctor.instancesFromSurrealResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}else{let n=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName),a=await this.perspective.infer(n),{results:o,totalCount:s}=await this.ctor.instancesFromPrologResult(this.perspective,i,a);return{results:o,totalCount:s,pageSize:e,pageNumber:t}}}async paginateSubscribe(e,t,i){this.dispose();let n={...this.queryParams||{},limit:e,offset:e*(t-1),count:!0};if(this.useSurrealDBFlag){let a=await this.ctor.queryToSurrealQL(this.perspective,n);this.currentSubscription=await this.perspective.subscribeSurrealDB(a);let o=async u=>{let{results:l,totalCount:f}=await this.ctor.instancesFromSurrealResult(this.perspective,n,u);i({results:l,totalCount:f,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}else{let a=await this.ctor.queryToProlog(this.perspective,n,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async u=>{let{results:l,totalCount:f}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,u);i({results:l,totalCount:f,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,n,this.currentSubscription.result);return{results:s,totalCount:c,pageSize:e,pageNumber:t}}}};var ES=r=>{let e=new Set;do for(let t of Reflect.ownKeys(r))e.add([r,t]);while((r=Reflect.getPrototypeOf(r))&&r!==Object.prototype);return e};function Oo(r,{include:e,exclude:t}={}){let i=n=>{let a=o=>typeof o=="string"?n===o:o.test(n);return e?e.some(a):t?!t.some(a):!0};for(let[n,a]of ES(r.constructor.prototype)){if(a==="constructor"||!i(a))continue;let o=Reflect.getOwnPropertyDescriptor(n,a);o&&typeof o.value=="function"&&(r[a]=r[a].bind(r))}return r}var xS=12e3,Co=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;Oo(this),this.options=t,this.port=t.port||parseInt(_s("ad4m-port"))||xS,this.url=t.url||_s("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=_s("ad4m-token")||"",this.embedded=Ss(),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,i)=>{let n=setTimeout(()=>{i(new Error("Timeout waiting for AD4M config from parent window"))},3e4);this.embeddedResolve=a=>{clearTimeout(n),console.log("[Ad4m Connect] Successfully connected in embedded mode"),t(a)},this.embeddedReject=a=>{clearTimeout(n),i(a)},this.ad4mClient&&(this.authState==="authenticated"?(clearTimeout(n),console.log("[Ad4m Connect] Client already initialized in embedded mode"),t(this.ad4mClient)):(clearTimeout(n),i(new Error(`Embedded auth state: ${this.authState}`))))});try{return yield Rn(this.url),kt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth(),this.ad4mClient}catch(t){throw console.error("[Ad4m Connect] Connection failed:",t),this.notifyConnectionChange("error"),t}})}buildClient(){return 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=Ju({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(i){console.error("[Ad4m Connect] Reconnection failed:",i),this.notifyConnectionChange("error")}})}}),this.apolloClient=this.createApolloClient(this.wsClient),this.ad4mClient=new wo(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new Gu({link:new bf(t),cache:new hs({resultCaching:!1,addTypename:!1}),defaultOptions:{watchQuery:{fetchPolicy:"no-cache"},query:{fetchPolicy:"no-cache"},mutate:{fetchPolicy:"no-cache"}}})}withTempClient(t,i){return K(this,null,function*(){let n=Ju({url:t,connectionParams:()=>K(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(n),o=new wo(a);try{return yield i(o)}finally{n.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 i="Cannot extractByTags from a ciphered wallet. You must unlock first.";return t.message===i?(this.notifyAuthChange("locked"),!0):(t.message==="InvalidSignature"&&(console.log("[Ad4m Connect] Clearing invalid token due to InvalidSignature"),this.token="",Ra("ad4m-token")),this.notifyAuthChange("unauthenticated"),!1)}})}disconnect(){return 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="",Ra("ad4m-token"),this.notifyAuthChange("unauthenticated"),this.notifyConnectionChange("not-connected"),console.log("[Ad4m Connect] Disconnected successfully")})}initializeEmbeddedMode(){console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent"),window.addEventListener("message",t=>K(this,null,function*(){var i;if(((i=t.data)==null?void 0:i.type)==="AD4M_CONFIG"){if(t.source!==window.parent){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from invalid source (not parent window)");return}if(this.options.allowedOrigins&&this.options.allowedOrigins.length>0&&(!t.origin||!this.options.allowedOrigins.includes(t.origin))){console.warn("[Ad4m Connect] Rejected AD4M_CONFIG from unauthorized origin:",t.origin),this.rejectEmbedded(new Error(`Unauthorized origin: ${t.origin}`));return}console.log("[Ad4m Connect] Received AD4M_CONFIG from parent:",{port:t.data.port,hasToken:!!t.data.token});let{port:n,token:a}=t.data;if(n==null){let c=new Error("AD4M_CONFIG missing required field: port");console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let o=parseInt(n,10);if(!Number.isFinite(o)||o<=0){let c=new Error(`AD4M_CONFIG invalid port: ${n} (must be a positive integer)`);console.error("[Ad4m Connect]",c.message),this.rejectEmbedded(c);return}let s=a!=null&&typeof a=="string"?a:"";try{this.port=o,this.token=s,this.url=`ws://localhost:${o}/graphql`,kt("ad4m-port",o.toString()),s?kt("ad4m-token",s):Ra("ad4m-token"),kt("ad4m-url",this.url),this.ad4mClient=yield this.buildClient(),yield this.checkAuth()}catch(c){console.error("[Ad4m Connect] Failed to initialize from AD4M_CONFIG:",c),this.rejectEmbedded(c)}}})),console.log("[Ad4m Connect] Requesting AD4M config from parent window"),window.parent.postMessage({type:"REQUEST_AD4M_CONFIG"},"*")}buildAppInfo(){return{appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appDomain:this.options.appInfo.url,appUrl:window.location.origin,appIconPath:this.options.appInfo.iconPath}}requestCapability(t=!1){return K(this,null,function*(){return t&&(this.token="",Ra("ad4m-token"),this.notifyConfigChange("token",this.token)),this.requestId=yield this.ad4mClient.agent.requestCapability({appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appUrl:this.options.appInfo.url,appDomain:this.options.appInfo.url,appIconPath:this.options.appInfo.iconPath,capabilities:this.options.capabilities}),this.requestId})}verifyLocalAd4mCode(t){return 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 i=yield this.ad4mClient.agent.generateJwt(this.requestId,t);return this.token=i,kt("ad4m-token",this.token),yield this.connect(),!0}catch(i){return console.error("[Ad4m Connect] Code verification failed:",i),!1}})}isValidAd4mAPI(){return 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,i=>K(this,null,function*(){return yield i.agent.requestLoginVerification(t,this.buildAppInfo())}))}catch(i){return{success:!1,message:i.message||"Failed to process email. Please try again.",requiresPassword:!1,isExistingUser:!1}}})}verifyEmailCode(t,i){return K(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>K(this,null,function*(){return yield a.agent.verifyEmailCode(t,i,"login")}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Email code verification failed:",n),!1}})}loginWithPassword(t,i){return K(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>K(this,null,function*(){return yield a.agent.loginUser(t,i)}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Password login failed:",n),!1}})}createAccount(t,i){return K(this,null,function*(){try{let n=yield this.withTempClient(this.url,a=>K(this,null,function*(){let o=yield a.agent.createUser(t,i);if(o.success)return yield a.agent.loginUser(t,i);throw new Error(o.error||"Failed to create account")}));return this.token=n,kt("ad4m-token",this.token),yield this.connect(),!0}catch(n){return console.error("[Ad4m Connect] Account creation error:",n),!1}})}resolveEmbedded(t){this.embeddedResolve&&(this.embeddedResolve(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}rejectEmbedded(t){this.embeddedReject&&(this.embeddedReject(t),this.embeddedResolve=void 0,this.embeddedReject=void 0)}notifyConnectionChange(t){this.connectionState!==t&&(this.connectionState=t,this.dispatchEvent(new CustomEvent("connectionstatechange",{detail:t})))}notifyAuthChange(t){if(this.authState=t,this.dispatchEvent(new CustomEvent("authstatechange",{detail:t})),this.embedded&&(t==="authenticated"&&this.resolveEmbedded(this.ad4mClient),t==="unauthenticated"||t==="locked")){let i=t==="locked"?"Authentication failed: Agent is locked":"Authentication failed: Unauthenticated";this.rejectEmbedded(new Error(i))}}notifyConfigChange(t,i){this.dispatchEvent(new CustomEvent("configstatechange",{detail:{type:t,value:i}}))}};var Dc=window,$c=Dc.ShadowRoot&&(Dc.ShadyCSS===void 0||Dc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,ap=Symbol(),Bm=new WeakMap,No=class{constructor(e,t,i){if(this._$cssResult$=!0,i!==ap)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if($c&&e===void 0){let i=t!==void 0&&t.length===1;i&&(e=Bm.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),i&&Bm.set(t,e))}return e}toString(){return this.cssText}},Vm=r=>new No(typeof r=="string"?r:r+"",void 0,ap),Pt=(r,...e)=>{let t=r.length===1?r[0]:e.reduce((i,n,a)=>i+(o=>{if(o._$cssResult$===!0)return o.cssText;if(typeof o=="number")return o;throw Error("Value passed to 'css' function must be a 'css' function result: "+o+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(n)+r[a+1],r[0]);return new No(t,r,ap)},op=(r,e)=>{$c?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let i=document.createElement("style"),n=Dc.litNonce;n!==void 0&&i.setAttribute("nonce",n),i.textContent=t.cssText,r.appendChild(i)})},Rc=$c?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let i of e.cssRules)t+=i.cssText;return Vm(t)})(r):r;var sp,Lc=window,Qm=Lc.trustedTypes,AS=Qm?Qm.emptyScript:"",zm=Lc.reactiveElementPolyfillSupport,up={toAttribute(r,e){switch(e){case Boolean:r=r?AS: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}},Wm=(r,e)=>e!==r&&(e==e||r==r),cp={attribute:!0,type:String,converter:up,reflect:!1,hasChanged:Wm},lp="finalized",Rr=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(e){var t;this.finalize(),((t=this.h)!==null&&t!==void 0?t:this.h=[]).push(e)}static get observedAttributes(){this.finalize();let e=[];return this.elementProperties.forEach((t,i)=>{let n=this._$Ep(i,t);n!==void 0&&(this._$Ev.set(n,i),e.push(n))}),e}static createProperty(e,t=cp){if(t.state&&(t.attribute=!1),this.finalize(),this.elementProperties.set(e,t),!t.noAccessor&&!this.prototype.hasOwnProperty(e)){let i=typeof e=="symbol"?Symbol():"__"+e,n=this.getPropertyDescriptor(e,i,t);n!==void 0&&Object.defineProperty(this.prototype,e,n)}}static getPropertyDescriptor(e,t,i){return{get(){return this[t]},set(n){let a=this[e];this[t]=n,this.requestUpdate(e,a,i)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)||cp}static finalize(){if(this.hasOwnProperty(lp))return!1;this[lp]=!0;let e=Object.getPrototypeOf(this);if(e.finalize(),e.h!==void 0&&(this.h=[...e.h]),this.elementProperties=new Map(e.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){let t=this.properties,i=[...Object.getOwnPropertyNames(t),...Object.getOwnPropertySymbols(t)];for(let n of i)this.createProperty(n,t[n])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(e){let t=[];if(Array.isArray(e)){let i=new Set(e.flat(1/0).reverse());for(let n of i)t.unshift(Rc(n))}else e!==void 0&&t.push(Rc(e));return t}static _$Ep(e,t){let i=t.attribute;return i===!1?void 0:typeof i=="string"?i:typeof e=="string"?e.toLowerCase():void 0}_$Eu(){var e;this._$E_=new Promise(t=>this.enableUpdating=t),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(e=this.constructor.h)===null||e===void 0||e.forEach(t=>t(this))}addController(e){var t,i;((t=this._$ES)!==null&&t!==void 0?t:this._$ES=[]).push(e),this.renderRoot!==void 0&&this.isConnected&&((i=e.hostConnected)===null||i===void 0||i.call(e))}removeController(e){var t;(t=this._$ES)===null||t===void 0||t.splice(this._$ES.indexOf(e)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((e,t)=>{this.hasOwnProperty(t)&&(this._$Ei.set(t,this[t]),delete this[t])})}createRenderRoot(){var e;let t=(e=this.shadowRoot)!==null&&e!==void 0?e:this.attachShadow(this.constructor.shadowRootOptions);return op(t,this.constructor.elementStyles),t}connectedCallback(){var e;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostConnected)===null||i===void 0?void 0:i.call(t)})}enableUpdating(e){}disconnectedCallback(){var e;(e=this._$ES)===null||e===void 0||e.forEach(t=>{var i;return(i=t.hostDisconnected)===null||i===void 0?void 0:i.call(t)})}attributeChangedCallback(e,t,i){this._$AK(e,i)}_$EO(e,t,i=cp){var n;let a=this.constructor._$Ep(e,i);if(a!==void 0&&i.reflect===!0){let o=(((n=i.converter)===null||n===void 0?void 0:n.toAttribute)!==void 0?i.converter:up).toAttribute(t,i.type);this._$El=e,o==null?this.removeAttribute(a):this.setAttribute(a,o),this._$El=null}}_$AK(e,t){var i;let n=this.constructor,a=n._$Ev.get(e);if(a!==void 0&&this._$El!==a){let o=n.getPropertyOptions(a),s=typeof o.converter=="function"?{fromAttribute:o.converter}:((i=o.converter)===null||i===void 0?void 0:i.fromAttribute)!==void 0?o.converter:up;this._$El=a,this[a]=s.fromAttribute(t,o.type),this._$El=null}}requestUpdate(e,t,i){let n=!0;e!==void 0&&(((i=i||this.constructor.getPropertyOptions(e)).hasChanged||Wm)(this[e],t)?(this._$AL.has(e)||this._$AL.set(e,t),i.reflect===!0&&this._$El!==e&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(e,i))):n=!1),!this.isUpdatePending&&n&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(t){Promise.reject(t)}let e=this.scheduleUpdate();return e!=null&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var e;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((n,a)=>this[a]=n),this._$Ei=void 0);let t=!1,i=this._$AL;try{t=this.shouldUpdate(i),t?(this.willUpdate(i),(e=this._$ES)===null||e===void 0||e.forEach(n=>{var a;return(a=n.hostUpdate)===null||a===void 0?void 0:a.call(n)}),this.update(i)):this._$Ek()}catch(n){throw t=!1,this._$Ek(),n}t&&this._$AE(i)}willUpdate(e){}_$AE(e){var t;(t=this._$ES)===null||t===void 0||t.forEach(i=>{var n;return(n=i.hostUpdated)===null||n===void 0?void 0:n.call(i)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(e){return!0}update(e){this._$EC!==void 0&&(this._$EC.forEach((t,i)=>this._$EO(i,this[i],t)),this._$EC=void 0),this._$Ek()}updated(e){}firstUpdated(e){}};Rr[lp]=!0,Rr.elementProperties=new Map,Rr.elementStyles=[],Rr.shadowRootOptions={mode:"open"},zm?.({ReactiveElement:Rr}),((sp=Lc.reactiveElementVersions)!==null&&sp!==void 0?sp:Lc.reactiveElementVersions=[]).push("1.6.3");var pp,Pc=window,ca=Pc.trustedTypes,Hm=ca?ca.createPolicy("lit-html",{createHTML:r=>r}):void 0,fp="$lit$",hi=`lit$${(Math.random()+"").slice(9)}$`,eg="?"+hi,IS=`<${eg}>`,dn=document,$o=()=>dn.createComment(""),Ro=r=>r===null||typeof r!="object"&&typeof r!="function",tg=Array.isArray,kS=r=>tg(r)||typeof r?.[Symbol.iterator]=="function",dp=`[
|
|
1594
|
-
|
|
1595
|
-
|
|
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=Mh(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=Mh(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 Ql=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:f,totalCount:d}=await this.ctor.instancesFromSurrealResult(this.perspective,i,l);n({results:f,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromSurrealResult(this.perspective,i,this.currentSubscription.result),u={results:s,totalCount:c,pageSize:e,pageNumber:t};return n(u),u}else{let a=await this.ctor.queryToProlog(this.perspective,i,this.modelClassName);this.currentSubscription=await this.perspective.subscribeInfer(a);let o=async l=>{let{results:f,totalCount:d}=await this.ctor.instancesFromPrologResult(this.perspective,this.queryParams,l);n({results:f,totalCount:d,pageSize:e,pageNumber:t})};this.currentSubscription.onResult(o);let{results:s,totalCount:c}=await this.ctor.instancesFromPrologResult(this.perspective,i,this.currentSubscription.result),u={results:s,totalCount:c,pageSize:e,pageNumber:t};return n(u),u}}};function ap(r){return r.replace(/([A-Z])/g,"_$1").toLowerCase().replace(/^_/,"")}function AS(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 IS(r,e){return e.flag||!e.predicate?null:`${`${r}_${ap(e.name)}`}(X, Value) :- triple(X, '${e.predicate}', Value).`}function TS(r,e){if(!e.predicate)return null;let t=`${r}_${ap(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 qO(r){let e=r.getModelMetadata(),t=ap(e.className),n=[];n.push(`% ${e.className} \u2014 generated Prolog facts`);let i=AS(t,e);i&&(n.push(""),n.push("% Instance recognizer"),n.push(i));let a=Object.values(e.properties).map(s=>IS(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=>TS(t,s)).filter(s=>s!==null);return o.length>0&&(n.push(""),n.push("% Relation getters"),n.push(...o)),n.join(`
|
|
1593
|
+
`)}var OS=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 Co(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 OS(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 CS=12e3,No=class extends EventTarget{constructor(t){super();this.connectionState="not-connected";this.authState="unauthenticated";this.activeSocket=null;this.requestedRestart=!1;Co(this),this.options=t,this.port=t.port||parseInt(Es("ad4m-port"))||CS,this.url=t.url||Es("ad4m-url")||`ws://localhost:${this.port}/graphql`,this.token=Es("ad4m-token")||"",this.embedded=_s(),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),At("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=Zu({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 So(this.apolloClient),this.requestedRestart=!1,this.ad4mClient})}createApolloClient(t){return new Ku({link:new wf(t),cache:new ms({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=Zu({url:t,connectionParams:()=>K(this,null,function*(){return{headers:{authorization:""}}})}),a=this.createApolloClient(i),o=new So(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="",Ra("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="",Ra("ad4m-token"),this.notifyAuthChange("unauthenticated"),this.notifyConnectionChange("not-connected"),console.log("[Ad4m Connect] Disconnected successfully")})}initializeEmbeddedMode(){console.log("[Ad4m Connect] Running in embedded mode - waiting for AD4M config from parent"),window.addEventListener("message",t=>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`,At("ad4m-port",o.toString()),s?At("ad4m-token",s):Ra("ad4m-token"),At("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="",Ra("ad4m-token"),this.notifyConfigChange("token",this.token)),this.requestId=yield this.ad4mClient.agent.requestCapability({appName:this.options.appInfo.name,appDesc:this.options.appInfo.description,appUrl:this.options.appInfo.url,appDomain:this.options.appInfo.url,appIconPath:this.options.appInfo.iconPath,capabilities:this.options.capabilities}),this.requestId})}verifyLocalAd4mCode(t){return 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,At("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,At("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,At("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,At("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 Dc=window,Rc=Dc.ShadowRoot&&(Dc.ShadyCSS===void 0||Dc.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,op=Symbol(),Vm=new WeakMap,$o=class{constructor(e,t,n){if(this._$cssResult$=!0,n!==op)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(Rc&&e===void 0){let n=t!==void 0&&t.length===1;n&&(e=Vm.get(t)),e===void 0&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),n&&Vm.set(t,e))}return e}toString(){return this.cssText}},Qm=r=>new $o(typeof r=="string"?r:r+"",void 0,op),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 $o(t,r,op)},sp=(r,e)=>{Rc?r.adoptedStyleSheets=e.map(t=>t instanceof CSSStyleSheet?t:t.styleSheet):e.forEach(t=>{let n=document.createElement("style"),i=Dc.litNonce;i!==void 0&&n.setAttribute("nonce",i),n.textContent=t.cssText,r.appendChild(n)})},Lc=Rc?r=>r:r=>r instanceof CSSStyleSheet?(e=>{let t="";for(let n of e.cssRules)t+=n.cssText;return Qm(t)})(r):r;var cp,Pc=window,zm=Pc.trustedTypes,NS=zm?zm.emptyScript:"",Wm=Pc.reactiveElementPolyfillSupport,lp={toAttribute(r,e){switch(e){case Boolean:r=r?NS: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}},Hm=(r,e)=>e!==r&&(e==e||r==r),up={attribute:!0,type:String,converter:lp,reflect:!1,hasChanged:Hm},pp="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=up){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)||up}static finalize(){if(this.hasOwnProperty(pp))return!1;this[pp]=!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(Lc(i))}else e!==void 0&&t.push(Lc(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 sp(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=up){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:lp).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:lp;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||Hm)(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[pp]=!0,Pr.elementProperties=new Map,Pr.elementStyles=[],Pr.shadowRootOptions={mode:"open"},Wm?.({ReactiveElement:Pr}),((cp=Pc.reactiveElementVersions)!==null&&cp!==void 0?cp:Pc.reactiveElementVersions=[]).push("1.6.3");var dp,Fc=window,ca=Fc.trustedTypes,Gm=ca?ca.createPolicy("lit-html",{createHTML:r=>r}):void 0,hp="$lit$",gn=`lit$${(Math.random()+"").slice(9)}$`,tg="?"+gn,$S=`<${tg}>`,fi=document,Ro=()=>fi.createComment(""),Lo=r=>r===null||typeof r!="object"&&typeof r!="function",rg=Array.isArray,DS=r=>rg(r)||typeof r?.[Symbol.iterator]=="function",fp=`[
|
|
1594
|
+
\f\r]`,Do=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,Km=/-->/g,Jm=/>/g,pi=RegExp(`>|${fp}(?:([^\\s"'>=/]+)(${fp}*=${fp}*(?:[^
|
|
1595
|
+
\f\r"'\`<>=]|("|')|))|$)`,"g"),Zm=/'/g,Ym=/"/g,ng=/^(?:script|style|textarea|title)$/i,ig=r=>(e,...t)=>({_$litType$:r,strings:e,values:t}),M=ig(1),oC=ig(2),hi=Symbol.for("lit-noChange"),Ke=Symbol.for("lit-nothing"),Xm=new WeakMap,di=fi.createTreeWalker(fi,129,null,!1);function ag(r,e){if(!Array.isArray(r)||!r.hasOwnProperty("raw"))throw Error("invalid template strings array");return Gm!==void 0?Gm.createHTML(e):e}var RS=(r,e)=>{let t=r.length-1,n=[],i,a=e===2?"<svg>":"",o=Do;for(let s=0;s<t;s++){let c=r[s],u,l,f=-1,d=0;for(;d<c.length&&(o.lastIndex=d,l=o.exec(c),l!==null);)d=o.lastIndex,o===Do?l[1]==="!--"?o=Km:l[1]!==void 0?o=Jm:l[2]!==void 0?(ng.test(l[2])&&(i=RegExp("</"+l[2],"g")),o=pi):l[3]!==void 0&&(o=pi):o===pi?l[0]===">"?(o=i??Do,f=-1):l[1]===void 0?f=-2:(f=o.lastIndex-l[2].length,u=l[1],o=l[3]===void 0?pi:l[3]==='"'?Ym:Zm):o===Ym||o===Zm?o=pi:o===Km||o===Jm?o=Do:(o=pi,i=void 0);let p=o===pi&&r[s+1].startsWith("/>")?" ":"";a+=o===Do?c+$S:f>=0?(n.push(u),c.slice(0,f)+hp+c.slice(f)+gn+p):c+gn+(f===-2?(n.push(void 0),s):p)}return[ag(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]=RS(e,t);if(this.el=mi.createElement(u,n),di.currentNode=this.el.content,t===2){let f=this.el.content,d=f.firstChild;d.remove(),f.append(...d.childNodes)}for(;(i=di.nextNode())!==null&&c.length<s;){if(i.nodeType===1){if(i.hasAttributes()){let f=[];for(let d of i.getAttributeNames())if(d.endsWith(hp)||d.startsWith(gn)){let p=l[o++];if(f.push(d),p!==void 0){let h=i.getAttribute(p.toLowerCase()+hp).split(gn),m=/([.?@])?(.*)/.exec(p);c.push({type:1,index:a,name:m[2],strings:h,ctor:m[1]==="."?gp:m[1]==="?"?yp:m[1]==="@"?vp:la})}else c.push({type:6,index:a})}for(let d of f)i.removeAttribute(d)}if(ng.test(i.tagName)){let f=i.textContent.split(gn),d=f.length-1;if(d>0){i.textContent=ca?ca.emptyScript:"";for(let p=0;p<d;p++)i.append(f[p],Ro()),di.nextNode(),c.push({type:2,index:++a});i.append(f[d],Ro())}}}else if(i.nodeType===8)if(i.data===tg)c.push({type:2,index:a});else{let f=-1;for(;(f=i.data.indexOf(gn,f+1))!==-1;)c.push({type:7,index:a}),f+=gn.length-1}a++}}static createElement(e,t){let n=fi.createElement("template");return n.innerHTML=e,n}};function ua(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=Lo(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=ua(r,c._$AS(r,e.values),c,n)),e}var mp=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 bp(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=ua(this,e,t),Lo(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):DS(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&&Lo(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(ag(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 mp(a,this),s=o.u(this.options);o.v(n),this.$(s),this._$AH=o}}_$AC(e){let t=Xm.get(e.strings);return t===void 0&&Xm.set(e.strings,t=new mi(e)),t}T(e){rg(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(Ro()),this.k(Ro()),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))}},la=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=ua(this,e,t,0),o=!Lo(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=ua(this,s[n+c],t,c),u===hi&&(u=this._$AH[c]),o||(o=!Lo(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??"")}},gp=class extends la{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===Ke?void 0:e}},LS=ca?ca.emptyScript:"",yp=class extends la{constructor(){super(...arguments),this.type=4}j(e){e&&e!==Ke?this.element.setAttribute(this.name,LS):this.element.removeAttribute(this.name)}},vp=class extends la{constructor(e,t,n,i,a){super(e,t,n,i,a),this.type=5}_$AI(e,t=this){var n;if((e=(n=ua(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)}},bp=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){ua(this,e)}};var eg=Fc.litHtmlPolyfillSupport;eg?.(mi,gi),((dp=Fc.litHtmlVersions)!==null&&dp!==void 0?dp:Fc.litHtmlVersions=[]).push("2.8.0");var og=(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(Ro(),s),s,void 0,t??{})}return o._$AI(r),o};var wp,Sp;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=og(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,(wp=globalThis.litElementHydrateSupport)===null||wp===void 0||wp.call(globalThis,{LitElement:ot});var sg=globalThis.litElementPolyfillSupport;sg?.({LitElement:ot});((Sp=globalThis.litElementVersions)!==null&&Sp!==void 0?Sp: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 PS=(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)}},FS=(r,e,t)=>{e.constructor.createProperty(t,r)};function Ce(r){return(e,t)=>t!==void 0?FS(r,e,t):PS(r,e)}function Ie(r){return Ce({...r,state:!0})}var _p,DC=((_p=window.HTMLSlotElement)===null||_p===void 0?void 0:_p.prototype.assignedElements)!=null?(r,e)=>r.assignedElements(e):(r,e)=>r.assignedNodes(e).filter(t=>t.nodeType===Node.ELEMENT_NODE);function yi(){return M`
|
|
1596
1596
|
<svg viewBox="0 0 63.6 60" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
1597
1597
|
<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
1598
|
</svg>
|
|
1599
|
-
`}function pa(){return
|
|
1599
|
+
`}function pa(){return M`
|
|
1600
1600
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
|
1601
1601
|
<circle cx="12" cy="12" r="10"></circle>
|
|
1602
1602
|
<circle cx="12" cy="12" r="3" fill="currentColor"></circle>
|
|
1603
1603
|
</svg>
|
|
1604
|
-
`}function da(){return
|
|
1604
|
+
`}function da(){return M`
|
|
1605
1605
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor">
|
|
1606
1606
|
<circle cx="12" cy="12" r="10"></circle>
|
|
1607
1607
|
<path d="M2 12h20"></path>
|
|
1608
1608
|
<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
1609
|
</svg>
|
|
1610
|
-
`}function
|
|
1610
|
+
`}function Mc(){return M`
|
|
1611
1611
|
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
|
|
1612
1612
|
<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path>
|
|
1613
1613
|
<polyline points="7 10 12 15 17 10"></polyline>
|
|
1614
1614
|
<line x1="12" y1="15" x2="12" y2="3"></line>
|
|
1615
1615
|
</svg>
|
|
1616
|
-
`}function er(){return
|
|
1616
|
+
`}function er(){return M`
|
|
1617
1617
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256">
|
|
1618
1618
|
<rect width="256" height="256" fill="none"/>
|
|
1619
1619
|
<polyline points="40 144 96 200 224 72" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
1620
1620
|
</svg>
|
|
1621
|
-
`}function
|
|
1621
|
+
`}function mt(){return M`
|
|
1622
1622
|
<svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" fill="currentColor" viewBox="0 0 256 256">
|
|
1623
1623
|
<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
1624
|
</svg>
|
|
1625
|
-
`}function
|
|
1625
|
+
`}function Uc(){return M`
|
|
1626
1626
|
<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
1627
|
<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
1628
|
<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
1629
|
</svg>
|
|
1630
|
-
`}function
|
|
1630
|
+
`}function jc(){return M`
|
|
1631
1631
|
<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
1632
|
<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
1633
|
</svg>
|
|
1634
|
-
`}function fa(){return
|
|
1634
|
+
`}function fa(){return M`
|
|
1635
1635
|
<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
1636
|
<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
1637
|
</svg>
|
|
1638
|
-
`}var
|
|
1638
|
+
`}var yn=Rt`
|
|
1639
1639
|
* {
|
|
1640
1640
|
box-sizing: border-box;
|
|
1641
1641
|
}
|
|
@@ -1897,7 +1897,7 @@ WHERE ${f.join(" AND ")}
|
|
|
1897
1897
|
.state.danger svg {
|
|
1898
1898
|
color: var(--ac-danger-color);
|
|
1899
1899
|
}
|
|
1900
|
-
`;var
|
|
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*(){xp(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`
|
|
1901
1901
|
<div class="container">
|
|
1902
1902
|
<div class="header">
|
|
1903
1903
|
<h1>Connect AD4M</h1>
|
|
@@ -1905,14 +1905,14 @@ WHERE ${f.join(" AND ")}
|
|
|
1905
1905
|
</div>
|
|
1906
1906
|
|
|
1907
1907
|
<div class="options">
|
|
1908
|
-
${this.isMobile?"":
|
|
1908
|
+
${this.isMobile?"":M`
|
|
1909
1909
|
<div class="box">
|
|
1910
1910
|
<div class="box-header">
|
|
1911
1911
|
${pa()}
|
|
1912
1912
|
<h3>Local Node</h3>
|
|
1913
1913
|
</div>
|
|
1914
1914
|
|
|
1915
|
-
${this.localNodeDetected?
|
|
1915
|
+
${this.localNodeDetected?M`
|
|
1916
1916
|
<div class="state success">
|
|
1917
1917
|
${er()}
|
|
1918
1918
|
<p>Local node detected on port ${this.port}</p>
|
|
@@ -1921,15 +1921,15 @@ WHERE ${f.join(" AND ")}
|
|
|
1921
1921
|
<button class="primary" @click=${this.connectLocalNode}>
|
|
1922
1922
|
Connect to Local Node
|
|
1923
1923
|
</button>
|
|
1924
|
-
`:
|
|
1924
|
+
`:M`
|
|
1925
1925
|
<div class="state danger">
|
|
1926
|
-
${
|
|
1926
|
+
${mt()}
|
|
1927
1927
|
<p>No local node detected on port ${this.port}</p>
|
|
1928
1928
|
</div>
|
|
1929
1929
|
|
|
1930
1930
|
<p style="margin-bottom: -12px">Download and install AD4M</p>
|
|
1931
1931
|
<button class="secondary" @click=${()=>window.open("https://github.com/coasys/ad4m/releases")}>
|
|
1932
|
-
${
|
|
1932
|
+
${Mc()} Download AD4M
|
|
1933
1933
|
</button>
|
|
1934
1934
|
`}
|
|
1935
1935
|
|
|
@@ -1939,42 +1939,42 @@ WHERE ${f.join(" AND ")}
|
|
|
1939
1939
|
type="number"
|
|
1940
1940
|
placeholder="Port number..."
|
|
1941
1941
|
.value=${this.newPort!=null?this.newPort.toString():""}
|
|
1942
|
-
@input=${t=>{let
|
|
1942
|
+
@input=${t=>{let n=t.target,i=Number.parseInt(n.value,10);Number.isFinite(i)&&(this.newPort=i)}}
|
|
1943
1943
|
@keydown=${t=>{t.key==="Enter"&&this.refreshPort()}}
|
|
1944
1944
|
/>
|
|
1945
1945
|
<button class="primary" @click=${this.refreshPort}>
|
|
1946
|
-
${
|
|
1946
|
+
${Uc()}
|
|
1947
1947
|
</button>
|
|
1948
1948
|
</div>
|
|
1949
1949
|
</div>
|
|
1950
1950
|
`}
|
|
1951
1951
|
|
|
1952
|
-
${this.showMultiUserOption?
|
|
1952
|
+
${this.showMultiUserOption?M`
|
|
1953
1953
|
<div class="box">
|
|
1954
1954
|
<div class="box-header">
|
|
1955
1955
|
${da()}
|
|
1956
1956
|
<h3>Remote Node</h3>
|
|
1957
1957
|
</div>
|
|
1958
1958
|
|
|
1959
|
-
${this.remoteUrl?
|
|
1959
|
+
${this.remoteUrl?M`
|
|
1960
1960
|
<div class="state success">
|
|
1961
1961
|
${er()}
|
|
1962
1962
|
<p>Remote configuration detected</p>
|
|
1963
1963
|
</div>
|
|
1964
|
-
`:
|
|
1964
|
+
`:M`<p style="margin-bottom: -12px">Enter the URL of a remote AD4M node</p>`}
|
|
1965
1965
|
|
|
1966
1966
|
<input
|
|
1967
1967
|
type="text"
|
|
1968
1968
|
placeholder="https://ad4m-node:12000/graphql"
|
|
1969
1969
|
.value=${this.newRemoteUrl}
|
|
1970
|
-
@input=${t=>{let
|
|
1970
|
+
@input=${t=>{let n=t.target;this.newRemoteUrl=n.value,this.remoteNodeError&&this.clearRemoteNodeError()}}
|
|
1971
1971
|
@keydown=${t=>{t.key==="Enter"&&!this.connectingToRemoteNode&&this.newRemoteUrl.trim().length&&this.connectRemoteNode()}}
|
|
1972
1972
|
style= "font-size: 16px;"
|
|
1973
1973
|
/>
|
|
1974
1974
|
|
|
1975
|
-
${this.remoteNodeError?
|
|
1975
|
+
${this.remoteNodeError?M`
|
|
1976
1976
|
<div class="state danger">
|
|
1977
|
-
${
|
|
1977
|
+
${mt()}
|
|
1978
1978
|
<p>Unable to connect to remote node</p>
|
|
1979
1979
|
</div>
|
|
1980
1980
|
`:""}
|
|
@@ -1990,7 +1990,7 @@ WHERE ${f.join(" AND ")}
|
|
|
1990
1990
|
`:""}
|
|
1991
1991
|
</div>
|
|
1992
1992
|
</div>
|
|
1993
|
-
`}};
|
|
1993
|
+
`}};rt.styles=[yn,Rt`
|
|
1994
1994
|
.options {
|
|
1995
1995
|
display: flex;
|
|
1996
1996
|
flex-direction: column;
|
|
@@ -2019,7 +2019,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2019
2019
|
button {
|
|
2020
2020
|
width: 100%;
|
|
2021
2021
|
}
|
|
2022
|
-
`],
|
|
2022
|
+
`],Q([Ce({type:Number})],rt.prototype,"port",2),Q([Ce({type:String})],rt.prototype,"remoteUrl",2),Q([Ce({type:Boolean})],rt.prototype,"connectingToRemoteNode",2),Q([Ce({type:Boolean})],rt.prototype,"remoteNodeError",2),Q([Ce({type:Boolean})],rt.prototype,"showMultiUserOption",2),Q([Ie()],rt.prototype,"loading",2),Q([Ie()],rt.prototype,"localNodeDetected",2),Q([Ie()],rt.prototype,"newPort",2),Q([Ie()],rt.prototype,"newRemoteUrl",2),Q([Ie()],rt.prototype,"isMobile",2),rt=Q([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`
|
|
2023
2023
|
<div class="container">
|
|
2024
2024
|
<div class="back-button" @click=${this.back}>
|
|
2025
2025
|
${fa()}
|
|
@@ -2031,12 +2031,12 @@ WHERE ${f.join(" AND ")}
|
|
|
2031
2031
|
</div>
|
|
2032
2032
|
|
|
2033
2033
|
<div class="connection-icons">
|
|
2034
|
-
${this.appiconpath?
|
|
2035
|
-
<div class="arrow-icon">${
|
|
2036
|
-
<div class="ad4m-logo">${
|
|
2034
|
+
${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">${jc()}</div>
|
|
2036
|
+
<div class="ad4m-logo">${yi()}</div>
|
|
2037
2037
|
</div>
|
|
2038
2038
|
|
|
2039
|
-
${this.requestSent?
|
|
2039
|
+
${this.requestSent?M`
|
|
2040
2040
|
<div class="state success" style="margin-bottom: -12px">
|
|
2041
2041
|
${er()}
|
|
2042
2042
|
<p>Auth request sent to local AD4M node</p>
|
|
@@ -2056,17 +2056,17 @@ WHERE ${f.join(" AND ")}
|
|
|
2056
2056
|
/>
|
|
2057
2057
|
</div>
|
|
2058
2058
|
|
|
2059
|
-
${this.verificationError?
|
|
2059
|
+
${this.verificationError?M`
|
|
2060
2060
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2061
|
-
${
|
|
2061
|
+
${mt()}
|
|
2062
2062
|
<p>Verification failed. Please try again.</p>
|
|
2063
2063
|
</div>
|
|
2064
2064
|
`:""}
|
|
2065
|
-
`:
|
|
2065
|
+
`:M`
|
|
2066
2066
|
<p>This will allow ${this.appname} to</p>
|
|
2067
2067
|
|
|
2068
2068
|
<ul class="box">
|
|
2069
|
-
${this.capabilities.map(t=>
|
|
2069
|
+
${this.capabilities.map(t=>M`<li>${er()}<p>${rm(t)}</p></li>`)}
|
|
2070
2070
|
</ul>
|
|
2071
2071
|
|
|
2072
2072
|
<div class="row center">
|
|
@@ -2076,7 +2076,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2076
2076
|
</div>
|
|
2077
2077
|
`}
|
|
2078
2078
|
</div>
|
|
2079
|
-
`}};tr.styles=[
|
|
2079
|
+
`}};tr.styles=[yn,Rt`
|
|
2080
2080
|
h1 {
|
|
2081
2081
|
font-size: 34px;
|
|
2082
2082
|
}
|
|
@@ -2158,7 +2158,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2158
2158
|
.state {
|
|
2159
2159
|
justify-content: center;
|
|
2160
2160
|
}
|
|
2161
|
-
`],
|
|
2161
|
+
`],Q([Ce({type:Array})],tr.prototype,"capabilities",2),Q([Ce({type:String})],tr.prototype,"appname",2),Q([Ce({type:String})],tr.prototype,"appiconpath",2),Q([Ce({type:Boolean})],tr.prototype,"verificationError",2),Q([Ie()],tr.prototype,"requestSent",2),Q([Ie()],tr.prototype,"securityCode",2),tr=Q([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`
|
|
2162
2162
|
<div class="container">
|
|
2163
2163
|
<div class="back-button" @click=${this.back}>
|
|
2164
2164
|
${fa()}
|
|
@@ -2168,7 +2168,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2168
2168
|
<h1>Login</h1>
|
|
2169
2169
|
</div>
|
|
2170
2170
|
|
|
2171
|
-
${t?
|
|
2171
|
+
${t?M`
|
|
2172
2172
|
<h3>Enter your email to login to the remote node</h3>
|
|
2173
2173
|
|
|
2174
2174
|
<div class="input-row">
|
|
@@ -2188,9 +2188,9 @@ WHERE ${f.join(" AND ")}
|
|
|
2188
2188
|
</div>
|
|
2189
2189
|
`:""}
|
|
2190
2190
|
|
|
2191
|
-
${o?
|
|
2191
|
+
${o?M`
|
|
2192
2192
|
<div class="state danger">
|
|
2193
|
-
${
|
|
2193
|
+
${mt()}
|
|
2194
2194
|
<p>${this.remoteAuthState.message||"Failed to process email. Please try again."}</p>
|
|
2195
2195
|
</div>
|
|
2196
2196
|
|
|
@@ -2201,7 +2201,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2201
2201
|
</div>
|
|
2202
2202
|
`:""}
|
|
2203
2203
|
|
|
2204
|
-
${
|
|
2204
|
+
${n?M`
|
|
2205
2205
|
<div class="state success" style="margin-bottom: -12px">
|
|
2206
2206
|
${er()}
|
|
2207
2207
|
<p>Email verification code sent</p>
|
|
@@ -2221,15 +2221,15 @@ WHERE ${f.join(" AND ")}
|
|
|
2221
2221
|
/>
|
|
2222
2222
|
</div>
|
|
2223
2223
|
|
|
2224
|
-
${this.emailCodeError?
|
|
2224
|
+
${this.emailCodeError?M`
|
|
2225
2225
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2226
|
-
${
|
|
2226
|
+
${mt()}
|
|
2227
2227
|
<p>Verification failed. Please try again.</p>
|
|
2228
2228
|
</div>
|
|
2229
2229
|
`:""}
|
|
2230
2230
|
`:""}
|
|
2231
2231
|
|
|
2232
|
-
${
|
|
2232
|
+
${i?M`
|
|
2233
2233
|
<div class="state success" style="margin-bottom: -12px">
|
|
2234
2234
|
${er()}
|
|
2235
2235
|
<p>Account found</p>
|
|
@@ -2253,17 +2253,17 @@ WHERE ${f.join(" AND ")}
|
|
|
2253
2253
|
</button>
|
|
2254
2254
|
</div>
|
|
2255
2255
|
|
|
2256
|
-
${this.passwordError?
|
|
2256
|
+
${this.passwordError?M`
|
|
2257
2257
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2258
|
-
${
|
|
2258
|
+
${mt()}
|
|
2259
2259
|
<p>Incorrect password. Please try again.</p>
|
|
2260
2260
|
</div>
|
|
2261
2261
|
`:""}
|
|
2262
2262
|
`:""}
|
|
2263
2263
|
|
|
2264
|
-
${a?
|
|
2264
|
+
${a?M`
|
|
2265
2265
|
<div class="state danger">
|
|
2266
|
-
${
|
|
2266
|
+
${mt()}
|
|
2267
2267
|
<p>Email not found</p>
|
|
2268
2268
|
</div>
|
|
2269
2269
|
|
|
@@ -2285,16 +2285,16 @@ WHERE ${f.join(" AND ")}
|
|
|
2285
2285
|
</button>
|
|
2286
2286
|
</div>
|
|
2287
2287
|
|
|
2288
|
-
${this.accountCreationError?
|
|
2288
|
+
${this.accountCreationError?M`
|
|
2289
2289
|
<div class="state danger" style="margin-top: -32px; margin-bottom: 20px;">
|
|
2290
|
-
${
|
|
2290
|
+
${mt()}
|
|
2291
2291
|
<p>Failed to create account. Please try again.</p>
|
|
2292
2292
|
</div>
|
|
2293
2293
|
`:""}
|
|
2294
2294
|
`:""}
|
|
2295
2295
|
|
|
2296
2296
|
</div>
|
|
2297
|
-
`}};
|
|
2297
|
+
`}};Lt.styles=[yn,Rt`
|
|
2298
2298
|
.header h1 {
|
|
2299
2299
|
font-size: 32px;
|
|
2300
2300
|
margin-bottom: 0;
|
|
@@ -2340,10 +2340,10 @@ WHERE ${f.join(" AND ")}
|
|
|
2340
2340
|
.state {
|
|
2341
2341
|
justify-content: center;
|
|
2342
2342
|
}
|
|
2343
|
-
`],
|
|
2343
|
+
`],Q([Ce({type:Object})],Lt.prototype,"remoteAuthState",2),Q([Ce({type:Boolean})],Lt.prototype,"remoteAuthLoading",2),Q([Ce({type:Boolean})],Lt.prototype,"emailCodeError",2),Q([Ce({type:Boolean})],Lt.prototype,"passwordError",2),Q([Ce({type:Boolean})],Lt.prototype,"accountCreationError",2),Q([Ie()],Lt.prototype,"email",2),Q([Ie()],Lt.prototype,"password",2),Q([Ie()],Lt.prototype,"emailSecurityCode",2),Lt=Q([Er("remote-authentication")],Lt);var vn=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`
|
|
2344
2344
|
<div class="container">
|
|
2345
2345
|
<div class="close-button" @click=${this.close}>
|
|
2346
|
-
${
|
|
2346
|
+
${mt()}
|
|
2347
2347
|
</div>
|
|
2348
2348
|
|
|
2349
2349
|
<div class="header">
|
|
@@ -2357,7 +2357,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2357
2357
|
<h3>${t?"Local Node":"Remote Node"}</h3>
|
|
2358
2358
|
</div>
|
|
2359
2359
|
|
|
2360
|
-
${t?
|
|
2360
|
+
${t?M`
|
|
2361
2361
|
<div class="row">
|
|
2362
2362
|
<span>Port:</span>
|
|
2363
2363
|
<span class="detail-value">${this.port}</span>
|
|
@@ -2366,7 +2366,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2366
2366
|
<span>URL:</span>
|
|
2367
2367
|
<span class="detail-value">${this.url}</span>
|
|
2368
2368
|
</div>
|
|
2369
|
-
`:
|
|
2369
|
+
`:M`
|
|
2370
2370
|
<div class="row">
|
|
2371
2371
|
<span>URL:</span>
|
|
2372
2372
|
<span class="detail-value">${this.url}</span>
|
|
@@ -2385,7 +2385,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2385
2385
|
</button>
|
|
2386
2386
|
</div>
|
|
2387
2387
|
</div>
|
|
2388
|
-
`}};
|
|
2388
|
+
`}};vn.styles=[yn,Rt`
|
|
2389
2389
|
.box {
|
|
2390
2390
|
gap: 15px;
|
|
2391
2391
|
}
|
|
@@ -2420,7 +2420,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2420
2420
|
background: rgba(244, 54, 127, 0.2);
|
|
2421
2421
|
color: var(--ac-danger-color);
|
|
2422
2422
|
}
|
|
2423
|
-
`],
|
|
2423
|
+
`],Q([Ce({type:String})],vn.prototype,"url",2),Q([Ce({type:Number})],vn.prototype,"port",2),Q([Ce({type:String})],vn.prototype,"authState",2),vn=Q([Er("current-state")],vn);var MS=Rt`
|
|
2424
2424
|
@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;700&display=swap');
|
|
2425
2425
|
|
|
2426
2426
|
:host {
|
|
@@ -2505,7 +2505,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2505
2505
|
height: 34px;
|
|
2506
2506
|
z-index: 99999;
|
|
2507
2507
|
}
|
|
2508
|
-
`,
|
|
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(),Co(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,At("ad4m-port",this.core.port.toString()),this.requestUpdate()})}connectLocalNode(){return K(this,null,function*(){this.core.url=`ws://localhost:${this.core.port}/graphql`,At("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,At("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`
|
|
2509
2509
|
<connection-options
|
|
2510
2510
|
.port=${this.core.port}
|
|
2511
2511
|
.remoteUrl=${this.core.options.remoteUrl}
|
|
@@ -2517,7 +2517,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2517
2517
|
@connect-remote-node=${this.connectRemoteNode}
|
|
2518
2518
|
@clear-remote-node-error=${()=>{this.remoteNodeError=!1}}
|
|
2519
2519
|
></connection-options>
|
|
2520
|
-
`;if(this.currentView==="local-authentication")return
|
|
2520
|
+
`;if(this.currentView==="local-authentication")return M`
|
|
2521
2521
|
<local-authentication
|
|
2522
2522
|
.capabilities=${this.core.options.capabilities}
|
|
2523
2523
|
.appname=${this.core.options.appInfo.name}
|
|
@@ -2528,7 +2528,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2528
2528
|
@verify-code=${this.verifyLocalAd4mCode}
|
|
2529
2529
|
@clear-verification-error=${()=>{this.verificationError=!1}}
|
|
2530
2530
|
></local-authentication>
|
|
2531
|
-
`;if(this.currentView==="remote-authentication")return
|
|
2531
|
+
`;if(this.currentView==="remote-authentication")return M`
|
|
2532
2532
|
<remote-authentication
|
|
2533
2533
|
.remoteAuthLoading=${this.remoteAuthLoading}
|
|
2534
2534
|
.remoteAuthState=${this.remoteAuthState}
|
|
@@ -2542,7 +2542,7 @@ WHERE ${f.join(" AND ")}
|
|
|
2542
2542
|
@create-account=${this.createAccount}
|
|
2543
2543
|
@clear-email-code-error=${()=>{this.emailCodeError=!1}}
|
|
2544
2544
|
></remote-authentication>
|
|
2545
|
-
`;if(this.currentView==="current-state")return
|
|
2545
|
+
`;if(this.currentView==="current-state")return M`
|
|
2546
2546
|
<current-state
|
|
2547
2547
|
.url=${this.core.url}
|
|
2548
2548
|
.port=${this.core.port}
|
|
@@ -2550,11 +2550,11 @@ WHERE ${f.join(" AND ")}
|
|
|
2550
2550
|
@close=${()=>{this.modalOpen=!1}}
|
|
2551
2551
|
@disconnect=${this.disconnect}
|
|
2552
2552
|
></current-state>
|
|
2553
|
-
`}render(){return this.modalOpen?
|
|
2553
|
+
`}render(){return this.modalOpen?M`
|
|
2554
2554
|
<div class="wrapper">
|
|
2555
2555
|
<div class="modal">
|
|
2556
2556
|
<header class="modal-header">
|
|
2557
|
-
${
|
|
2557
|
+
${yi()}
|
|
2558
2558
|
</header>
|
|
2559
2559
|
<main class="modal-content">
|
|
2560
2560
|
${this.renderViews()}
|
|
@@ -2562,16 +2562,16 @@ WHERE ${f.join(" AND ")}
|
|
|
2562
2562
|
</div>
|
|
2563
2563
|
<div class="backdrop" />
|
|
2564
2564
|
</div>
|
|
2565
|
-
`:this.core.authState==="authenticated"?
|
|
2565
|
+
`:this.core.authState==="authenticated"?M`
|
|
2566
2566
|
<button
|
|
2567
2567
|
type="button"
|
|
2568
2568
|
class="settings-button"
|
|
2569
2569
|
aria-label="Open settings"
|
|
2570
2570
|
@click=${()=>{this.currentView="current-state",this.modalOpen=!0}}
|
|
2571
2571
|
>
|
|
2572
|
-
${
|
|
2572
|
+
${yi()}
|
|
2573
2573
|
</button>
|
|
2574
|
-
`:null}};
|
|
2574
|
+
`:null}};st.styles=[MS],Q([Ie()],st.prototype,"modalOpen",2),Q([Ie()],st.prototype,"currentView",2),Q([Ie()],st.prototype,"connectingToRemoteNode",2),Q([Ie()],st.prototype,"remoteNodeError",2),Q([Ie()],st.prototype,"verificationError",2),Q([Ie()],st.prototype,"remoteAuthLoading",2),Q([Ie()],st.prototype,"remoteAuthState",2),Q([Ie()],st.prototype,"emailCodeError",2),Q([Ie()],st.prototype,"passwordError",2),Q([Ie()],st.prototype,"accountCreationError",2),st=Q([Er("ad4m-connect")],st);function Ep(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 US(r){let e=new No(r);if(_s()){let t=e.connect();return{core:e,client:t}}else{Ep(e);let t=new Promise(n=>{e.addEventListener("authstatechange",i=>{i.detail==="authenticated"&&e.ad4mClient&&n(e.ad4mClient)})});return{core:e,client:t}}}function y$(r){return K(this,null,function*(){let{client:e}=US(r);return e})}export{y$ as getAd4mClient,US as getAd4mConnect,_s as isEmbedded};
|
|
2575
2575
|
/*! pako 2.1.0 https://github.com/nodeca/pako @license (MIT AND Zlib) */
|
|
2576
2576
|
/**
|
|
2577
2577
|
* @license
|