@lifeready/core 7.2.3 → 8.0.1
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/bundles/lifeready-core.umd.js +7 -9
- package/bundles/lifeready-core.umd.js.map +1 -1
- package/bundles/lifeready-core.umd.min.js +1 -1
- package/bundles/lifeready-core.umd.min.js.map +1 -1
- package/esm2015/lib/api/query-processor/tp-password-reset-processor.service.js +2 -2
- package/esm2015/lib/api/types/lr-graphql.types.js +1 -6
- package/esm2015/lib/auth/auth.gql.private.js +1 -1
- package/esm2015/lib/auth/auth.service.js +5 -3
- package/esm2015/lib/auth/auth.types.js +1 -3
- package/esm2015/lib/plan/plan.types.js +1 -1
- package/fesm2015/lifeready-core.js +6 -11
- package/fesm2015/lifeready-core.js.map +1 -1
- package/lib/api/query-processor/tp-password-reset-processor.service.d.ts +2 -2
- package/lib/api/types/lr-graphql.types.d.ts +2 -9
- package/lib/auth/auth.gql.private.d.ts +3 -3
- package/lib/auth/auth.types.d.ts +3 -2
- package/lib/plan/plan.types.d.ts +0 -1
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("apollo-angular"),require("@dagrejs/graphlib"),require("lodash"),require("node-jose"),require("@aws-amplify/auth/lib-esm/Auth"),require("graphql-tag"),require("moment"),require("@apollo/client/core"),require("@apollo/client/link/context"),require("@apollo/client/link/retry"),require("ngx-cookie-service"),require("graphql/language/printer"),require("@angular/common/http"),require("@aws-amplify/core"),require("@ng-idle/core"),require("@ng-idle/keepalive"),require("slip39"),require("@aws-amplify/auth")):"function"==typeof define&&define.amd?define("@lifeready/core",["exports","@angular/core","apollo-angular","@dagrejs/graphlib","lodash","node-jose","@aws-amplify/auth/lib-esm/Auth","graphql-tag","moment","@apollo/client/core","@apollo/client/link/context","@apollo/client/link/retry","ngx-cookie-service","graphql/language/printer","@angular/common/http","@aws-amplify/core","@ng-idle/core","@ng-idle/keepalive","slip39","@aws-amplify/auth"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).lifeready=e.lifeready||{},e.lifeready.core={}),e.ng.core,e["apollo-angular"],e["@dagrejs/graphlib"],e.lodash,e["node-jose"],e["@aws-amplify/auth/lib-esm/Auth"],e["graphql-tag"],e.moment,e["@apollo/client/core"],e["@apollo/client/link/context"],e["@apollo/client/link/retry"],e["ngx-cookie-service"],e["graphql/language/printer"],e.ng.common.http,e["@aws-amplify/core"],e["@ng-idle/core"],e["@ng-idle/keepalive"],e.slip39,e["@aws-amplify/auth"])}(this,(function(e,t,n,r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,g,S){"use strict";function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function I(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var b=C(r),w=C(i),K=C(s),P=I(u),k=C(S),D=function(e,t){return(D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function R(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}D(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function E(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function M(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}function A(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))}function T(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}Object.create;function O(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function j(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function N(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(j(arguments[t]));return e}function F(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var $,_,L;Object.create;function U(e){if(e&&e.length){var t=e.map((function(e){return new q({code:e.extensions&&e.extensions.code,source:e.extensions&&e.extensions.source,message:e.message,debug:{locations:e.locations,path:e.path}})}));throw new(J.bind.apply(J,N([void 0],t)))}}!function(e){e.Key="key",e.PassKey="passKey"}($||($={})),function(e){e.KeyLink="keyLink",e.PassKeyLink="passKeyLink"}(_||(_={})),function(e){e.JSON="JSON",e.UINT_8_ARRAY="UINT_8_ARRAY"}(L||(L={}));var x,q=function(e){this._type="KcError",this.code=e.code,this.source=e.source,this.message=e.message,this.debug=e.debug},J=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._type="KcException",this.errors=e}return e.prototype.toString=function(){return this.errors.map((function(e){return JSON.stringify(e,null,2)}))},e}();(x=e.KcErrorCode||(e.KcErrorCode={})).ARCHIVED_RESOURCE="ARCHIVED_RESOURCE",x.BAD_ARGUMENT="BAD_ARGUMENT",x.BAD_SIGNATURE="BAD_SIGNATURE",x.BAD_STATE="BAD_STATE",x.CHANGED_PERMISSIONS="CHANGED_PERMISSIONS",x.CONCURRENT_ACCESS="CONCURRENT_ACCESS",x.CONFIG_ERROR="CONFIG_ERROR",x.CYCLE_DETECTED="CYCLE_DETECTED",x.EXPIRED="EXPIRED",x.INVALID_TOKEN="INVALID_TOKEN",x.INTERNAL_ERROR="INTERNAL_ERROR",x.JSON_DECODE_ERROR="JSON_DECODE_ERROR",x.KEY_MISMATCH="KEY_MISMATCH",x.LIMIT_REACHED="LIMIT_REACHED",x.LOCKED="LOCKED",x.LOGIC_ERROR="LOGIC_ERROR",x.LR_DEBUG_ONLY="LR_DEBUG_ONLY",x.MIN_DELAY="MIN_DELAY",x.MISSING_FIELD="MISSING_FIELD",x.MISSING_FIELD_VALUE="MISSING_FIELD_VALUE",x.MISSING_QUERY_PARAM="MISSING_QUERY_PARAM",x.NOT_IMPLEMENTED="NOT_IMPLEMENTED",x.OBJECT_DOES_NOT_EXIST="OBJECT_DOES_NOT_EXIST",x.OBJECT_EXISTS="OBJECT_EXISTS",x.RANGE_ERROR="RANGE_ERROR",x.TRUSTED_PARTY_NOT_FOUND="TRUSTED_PARTY_NOT_FOUND",x.UNAUTHENTICATED_USER="UNAUTHENTICATED_USER",x.USER_NOT_FOUND="USER_NOT_FOUND",x.VERSION_MISMATCH="VERSION_MISMATCH",x.WRONG_PERMISSIONS="WRONG_PERMISSIONS",x.AUTH="AUTH",x.BAD_LOGIC="BAD_LOGIC",x.BAD_REQUEST="BAD_REQUEST",x.BAD_TIME_SYNC="BAD_TIME_SYNC",x.CODE_MISMATCH="CODE_MISMATCH",x.ENCRYPTION="ENCRYPTION",x.NOT_FOUND="NOT_FOUND",x.SUSPICIOUS_OPERATION="SUSPICIOUS_OPERATION",x.UNSUPPORTED="UNSUPPORTED";var G=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.AUTH,message:n}))||this}return R(n,t),n}(J),Q=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_ARGUMENT,message:n}))||this}return R(n,t),n}(J),V=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_LOGIC,message:n}))||this}return R(n,t),n}(J),B=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_REQUEST,message:n}))||this}return R(n,t),n}(J),W=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_SIGNATURE,message:n}))||this}return R(n,t),n}(J),Z=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_STATE,message:n}))||this}return R(n,t),n}(J),H=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_TIME_SYNC,message:n}))||this}return R(n,t),n}(J),Y=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.CODE_MISMATCH,message:n}))||this}return R(n,t),n}(J),X=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.CONCURRENT_ACCESS,message:n}))||this}return R(n,t),n}(J),z=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.ENCRYPTION,message:n}))||this}return R(n,t),n}(J),ee=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.INTERNAL_ERROR,message:n}))||this}return R(n,t),n}(J),te=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.LOCKED,message:n}))||this}return R(n,t),n}(J),ne=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.NOT_FOUND,message:n}))||this}return R(n,t),n}(J),re=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.SUSPICIOUS_OPERATION,message:n}))||this}return R(n,t),n}(J),ie=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.UNSUPPORTED,message:n}))||this}return R(n,t),n}(J);function ae(e){if(!Array.isArray(e))throw new Error("not array");return e.some((function(e){return null==e?void 0:e.then}))?Promise.all(e):e}function oe(e,t){var n,r,i={};try{for(var a=O(Object.keys(e).entries()),o=a.next();!o.done;o=a.next()){var s=j(o.value,2),u=s[0];i[s[1]]=t[u]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function se(e,t){var n=ae(Object.entries(e).map((function(n){var r=j(n,2),i=r[0],a=r[1];return t(a,i,e)})));return n.then?n.then((function(t){return oe(e,t)})):oe(e,n)}function ue(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e.currentSession()];case 1:return[2,t.sent().getAccessToken().getJwtToken()];case 2:return t.sent(),[2,""];case 3:return[2]}}))}))}var ce,pe,de=P,le=K.default(ce||(ce=F(["\n query {\n serverTime {\n timestamp\n }\n }\n"],["\n query {\n serverTime {\n timestamp\n }\n }\n"]))),he=function(){function e(e,t){this.auth=e,this.apollo=t,this.VERIFY_ENABLED=!0,this.MAX_DIFF_MSEC=de.duration({seconds:30}).asMilliseconds(),this.offsetMs=null,this.verified=!1}return e.prototype.verifyCognito=function(){return A(this,void 0,void 0,(function(){var e,t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,ue(this.auth)];case 1:return(e=a.sent())?[4,fetch("https://cognito-idp.ap-southeast-2.amazonaws.com/",{method:"POST",mode:"cors",cache:"no-cache",headers:{"x-amz-target":"AWSCognitoIdentityProviderService.GetUser","x-amz-user-agent":"aws-amplify/0.1.x js","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({AccessToken:e})})]:[2];case 2:if(t=a.sent(),n=Date.now(),r=de(t.headers.get("Date")).valueOf(),i=n+this.offsetMs,Math.abs(i-r)>this.MAX_DIFF_MSEC)throw new H("Server time does not match independent source. ServerTime: "+i+", Cognito time: "+r);return this.verified=!0,[2]}}))}))},e.prototype.refresh=function(){return A(this,void 0,void 0,(function(){var e,t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return e=Date.now(),[4,this.apollo.query({query:le}).toPromise()];case 1:return t=a.sent(),n=Date.now(),U(t.errors),r=parseInt(t.data.serverTime.timestamp,10),i=n-e,this.offsetMs=Math.round(r-(e+i/2)),this.VERIFY_ENABLED?[4,this.verifyCognito()]:[3,3];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},e.prototype.serverNow=function(){return A(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return e=!1,null===this.offsetMs&&(e=!0),this.VERIFY_ENABLED?(t=!this.verified)?[4,ue(this.auth)]:[3,2]:[3,3];case 1:t=n.sent(),n.label=2;case 2:t&&(e=!0),n.label=3;case 3:return e?[4,this.refresh()]:[3,5];case 4:n.sent(),n.label=5;case 5:return[2,Date.now()+this.offsetMs]}}))}))},e.prototype.now=function(){return null===this.offsetMs?(console.error("Server time offset not known. You must await serverNow() first. Returning local clock instead."),Date.now()):Date.now()+this.offsetMs},e.prototype.date=function(){return new Date(this.now())},e}();he.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new he(t.ɵɵinject(o.AuthClass),t.ɵɵinject(n.Apollo))},token:he,providedIn:"root"}),he.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],he.ctorParameters=function(){return[{type:o.AuthClass},{type:n.Apollo}]},function(e){e.JSON="JSON",e.COMPACT="COMPACT"}(pe||(pe={}));var ye={payloadType:L.JSON,returnOnlyPayload:!0},fe={payloadType:L.JSON,returnOnlyPayload:!0,serializations:[pe.JSON]};var ve=function(){function e(e){this.timeService=e}return e.prototype.decrypt=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i;return T(this,(function(o){switch(o.label){case 0:if(r={algorithms:["dir","A*GCM","RSA-OAEP-*"]},n=Object.assign(Object.assign({},fe),n),e.jwk&&(e=e.jwk),"string"==typeof t&&n.serializations.includes(pe.JSON))try{t=JSON.parse(t)}catch(e){if(!n.serializations.includes(pe.COMPACT))throw e;console.log("Not a JSON-formatted JWE, it maybe compact serialisation format.")}return[4,a.JWE.createDecrypt(e,r).decrypt(t)];case 1:return(i=o.sent()).payload=this.decodePayload(n.payloadType,i.payload),n.returnOnlyPayload?[2,i.payload]:[2,i]}}))}))},e.prototype.encryptToString=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return r=(n=JSON).stringify,[4,this.encrypt(e,t)];case 1:return[2,r.apply(n,[i.sent()])]}}))}))},e.prototype.encrypt=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,o;return T(this,(function(s){switch(s.label){case 0:if(null==t)throw new Error("Encrypting null/undefined content.");return t instanceof ArrayBuffer||(t=(new TextEncoder).encode(JSON.stringify(t))),r=(n=a.JWE).createEncrypt,i={contentAlg:"A256GCM"},o={},[4,this.timeService.serverNow()];case 1:return[2,r.apply(n,[(i.fields=(o.timestamp=s.sent(),o),i),e]).update(t).final()]}}))}))},e.prototype.sign=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,o,s;return T(this,(function(u){switch(u.label){case 0:return i=(r=a.JWS).createSign,o={},s={},[4,this.timeService.serverNow()];case 1:return n=i.apply(r,[(o.fields=(s.timestamp=u.sent(),s),o),e]),t instanceof Buffer?n.update(t):n.update(JSON.stringify(t),"utf8"),[2,n.final()]}}))}))},e.prototype.signToString=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return r=(n=JSON).stringify,[4,this.sign(e,t)];case 1:return[2,r.apply(n,[i.sent()])]}}))}))},e.prototype.verify=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,o;return T(this,(function(s){switch(s.label){case 0:r={algorithms:["RS*"]},n=Object.assign(Object.assign({},ye),n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,a.JWS.createVerify(e,r).verify(t)];case 2:return(i=s.sent()).payload=this.decodePayload(n.payloadType,i.payload),n.returnOnlyPayload?[2,i.payload]:[2,i];case 3:throw o=s.sent(),new W("Bad signature: "+o);case 4:return[2]}}))}))},e.prototype.encryptThenSign=function(e,t){var n=e.key,r=e.sigPrk;return A(this,void 0,void 0,(function(){var e,i,a,o;return T(this,(function(s){switch(s.label){case 0:return a=(i=JSON).stringify,[4,this.encrypt(n,t)];case 1:return e=a.apply(i,[s.sent()]),[4,this.sign(r,e)];case 2:return delete(o=s.sent()).payload,[2,{cipher:e,sig:JSON.stringify(o)}]}}))}))},e.prototype.decodePayload=function(e,t){switch(e){case L.JSON:return JSON.parse((new TextDecoder).decode(t));case L.UINT_8_ARRAY:return t;default:throw new Q("Unknown payloadType: "+e)}},e}();ve.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new ve(t.ɵɵinject(he))},token:ve,providedIn:"root"}),ve.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ve.ctorParameters=function(){return[{type:he}]};var me=function(){function e(){this.kcCrypto=window.crypto}return e.prototype.toHex=function(e){return Array.from(new Uint8Array(e)).map((function(e){return e.toString(16).padStart(2,"0")})).join("")},e.prototype.stringDigest=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return n=new TextEncoder,r=n.encode(t),[4,this.kcCrypto.subtle.digest(e,r)];case 1:return i=a.sent(),[2,this.toHex(i)]}}))}))},e}();me.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new me},token:me,providedIn:"root"}),me.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var ge=function(){function e(e){this.webCryptoService=e,this.MIN_PASS_IDP_PBKDF_ITER=1e5,this.MIN_PASS_KEY_PBKDF_ITER=1e5,this.MIN_LBOP_KEY_PBKDF_ITER=1e5,this.DEFAULT_PASS_IDP_PBKDF_ITER=this.MIN_PASS_IDP_PBKDF_ITER,this.DEFAULT_PASS_KEY_PBKDF_ITER=this.MIN_PASS_KEY_PBKDF_ITER,this.DEFAULT_LBOP_KEY_PBKDF_ITER=this.MIN_LBOP_KEY_PBKDF_ITER,this.kcCrypto=this.webCryptoService.kcCrypto}return e.asKey=function(e,t,n){return a.JWK.asKey(e,t,n)},e.prototype.randomString=function(e){if(e<=0)throw new Q("digits <= 0");var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint32Array(e);return this.kcCrypto.getRandomValues(n),n=n.map((function(e){return t.charCodeAt(e%t.length)})),String.fromCharCode.apply(null,n)},e.prototype.randomDigitsNoZeros=function(e){return this.randomChoices([1,2,3,4,5,6,7,8,9],e).join("")},e.prototype.randomChoices=function(e,t){if(e.length<=1)throw new Q("array.length <= 0");if(t<=0)throw new Q("chooseN <= 0");var n=new Uint32Array(t);this.kcCrypto.getRandomValues(n);var r=[];return n.forEach((function(t){return r.push(e[t%e.length])})),r},e.prototype.createSalt=function(){return this.randomString(16)},e.prototype.createKey=function(){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.kcCrypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"])];case 1:return t=r.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t)];case 2:return delete(n=r.sent()).ext,delete n.key_ops,[2,e.asKey(n)]}}))}))},e.prototype.createSignKey=function(){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.kcCrypto.subtle.generateKey({name:"HMAC",hash:{name:"SHA-512"}},!0,["sign","verify"])];case 1:return t=r.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t)];case 2:return delete(n=r.sent()).key_ops,delete n.ext,[2,e.asKey(n)]}}))}))},e.prototype.createPkcKey=function(){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.kcCrypto.subtle.generateKey({name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["encrypt","decrypt"])];case 1:return t=r.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t.privateKey)];case 2:return delete(n=r.sent()).key_ops,delete n.ext,[2,e.asKey(n)]}}))}))},e.prototype.createPkcSignKey=function(){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.kcCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"])];case 1:return t=r.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t.privateKey)];case 2:return delete(n=r.sent()).key_ops,delete n.ext,[2,e.asKey(n)]}}))}))},e.prototype.importPassword=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){return t=new TextEncoder,[2,this.kcCrypto.subtle.importKey("raw",t.encode(e),"PBKDF2",!1,["deriveKey"])]}))}))},e.prototype.deriveKey=function(t){var n=t.password,r=t.salt,i=t.iterations,a=t.kid;return A(this,void 0,void 0,(function(){var t,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.kcCrypto.subtle.deriveKey({name:"PBKDF2",salt:(new TextEncoder).encode(r),iterations:i,hash:"SHA-256"},n,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])];case 1:return t=s.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t)];case 2:return o=s.sent(),a&&(o.kid=a),[4,e.asKey(o)];case 3:return[2,{jwk:s.sent()}]}}))}))},e.prototype.derivePassIdp=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){if(e.iterations<this.MIN_PASS_IDP_PBKDF_ITER)throw new re("The number of PassIdp key derivation iterations sent from the server ("+e.iterations+") is lower than the minimum ("+this.MIN_PASS_IDP_PBKDF_ITER+")");return[2,this.deriveKey(e)]}))}))},e.prototype.derivePassKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){if(e.iterations<this.MIN_PASS_KEY_PBKDF_ITER)throw new re("The number of PassKey key derivation iterations sent from the server("+e.iterations+") is lower than the minimum("+this.MIN_PASS_KEY_PBKDF_ITER+")");return[2,this.deriveKey(e)]}))}))},e.prototype.deriveLbopKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){if(e.iterations<this.MIN_LBOP_KEY_PBKDF_ITER)throw new re("The number of LbopKey key derivation iterations sent from the server("+e.iterations+") is lower than the minimum("+this.MIN_LBOP_KEY_PBKDF_ITER+")");return[2,this.deriveKey(e)]}))}))},e.prototype.createKid=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.createKey()];case 1:return[2,e.sent().kid]}}))}))},e.prototype.createPassIdpParams=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){return[2,{salt:this.createSalt(),iterations:this.DEFAULT_PASS_IDP_PBKDF_ITER}]}))}))},e.prototype.createPassKeyParams=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return e={salt:this.createSalt()},[4,this.createKid()];case 1:return[2,(e.kid=t.sent(),e.iterations=this.DEFAULT_PASS_KEY_PBKDF_ITER,e)]}}))}))},e.prototype.createLbopKeyParams=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return e={salt:this.createSalt()},[4,this.createKid()];case 1:return[2,(e.kid=t.sent(),e.iterations=this.DEFAULT_PASS_KEY_PBKDF_ITER,e)]}}))}))},e}();ge.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new ge(t.ɵɵinject(me))},token:ge,providedIn:"root"}),ge.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ge.ctorParameters=function(){return[{type:me}]};var Se=new t.InjectionToken("KC_CONFIG"),Ce=[e.KcErrorCode.CONCURRENT_ACCESS];function Ie(e,t){var n;return A(this,void 0,void 0,(function(){var r,i;return T(this,(function(a){switch(a.label){case 0:return[4,ue(e)];case 1:return r=a.sent(),i=null===(n=t.debug)||void 0===n?void 0:n.username,[2,{withCredentials:!0,headers:Object.assign(Object.assign({},r&&{authorization:"Bearer "+r}),i&&{"x-kc-dev-user":i})}]}}))}))}var be=function(e,t){var n=p.setContext((function(n,r){var i=r.headers;return A(void 0,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,Ie(t,e)];case 1:return n=r.sent(),[2,Object.assign(Object.assign({},n),{headers:Object.assign(Object.assign({},i),n.headers)})]}}))}))})),r=new d.RetryLink({delay:{initial:300,max:1/0,jitter:!0},attempts:{max:3,retryIf:function(e,t){return!!(e instanceof i&&e.errors.some((function(e){var t;return Ce.includes(null===(t=e.extensions)||void 0===t?void 0:t.code)})))}}}),i=function(e){function t(t){var n=e.call(this,t.map((function(e){return e.message})).join(", "))||this;return n.errors=t,n}return R(t,e),t}(Error),a=new c.ApolloLink((function(e,t){return t(e).map((function(e){if(e&&e.errors&&e.errors.filter((function(e){var t;return Ce.includes(null===(t=e.extensions)||void 0===t?void 0:t.code)})).length>0)throw new i(e.errors);return e}))})),o=c.createHttpLink({uri:e.apolloUrl,credentials:"include"});return Object.assign({link:c.from([r,a,n,o]),cache:new c.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"no-cache",errorPolicy:"all"},query:{fetchPolicy:"no-cache",errorPolicy:"all"},mutate:{fetchPolicy:"no-cache",errorPolicy:"all"}}},e.apolloConfig)},we=function(){function e(e,n,r,i){this.keyFactory=e,this.cookieService=n,this.encryptionService=r,this.injector=i,this.KEY_PREFIX="lrSession-",this.cookieSecure=!0,this.serverSessionEncryptionKey=null,t.isDevMode()&&this.setCookieSecure(!1)}return e.prototype.setServerSessionEncryptionKey=function(e){this.serverSessionEncryptionKey=e},e.prototype.clearServerSessionEncryptionKey=function(){this.serverSessionEncryptionKey=null},e.prototype.getCookieParams=function(){return{path:"/",domain:null,secure:this.cookieSecure,sameSite:"Lax"}},e.prototype.clear=function(){var e=this;Object.keys(this.cookieService.getAll()).forEach((function(t){t.startsWith(e.KEY_PREFIX)&&e.deletePrefixedName(t)})),Object.keys(localStorage).forEach((function(t){t.startsWith(e.KEY_PREFIX)&&e.deletePrefixedName(t)}))},e.prototype.setCookieSecure=function(e){if(this.cookieSecure=e,!e){if(!t.isDevMode())throw new Q("Can not set PersistService cookie secure flag to false in production mode.");console.warn("The cookie secure flag in persistService has been set to false, set it to true in production mode")}},e.prototype.prefixName=function(e){return this.KEY_PREFIX+e},e.prototype.delete=function(e){this.deletePrefixedName(this.prefixName(e))},e.prototype.deletePrefixedName=function(e){var t=this.getCookieParams();this.cookieService.delete(e,t.path,t.domain,t.secure,t.sameSite),localStorage.removeItem(e)},e.prototype.set=function(e){var t=e.name,n=e.value,r=e.serverSession,i=e.expiry;return A(this,void 0,void 0,(function(){var e,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:return e=this.prefixName(t),r?(o={serverSession:!0},[4,this.encryptionService.encryptToString(this.serverSessionEncryptionKey,n)]):[3,2];case 1:return o.data=d.sent(),a=o,[3,3];case 2:a={data:n},d.label=3;case 3:return i?[4,this.keyFactory.createKey()]:[3,6];case 4:return s=d.sent(),a.expiry=i.toISOString(),u=a,[4,this.encryptionService.encryptToString(s,a.data)];case 5:u.data=d.sent(),c={key:s.toJSON(!0)},p=this.getCookieParams(),this.cookieService.set(e,JSON.stringify(c),i,p.path,p.domain,p.secure,p.sameSite),d.label=6;case 6:return localStorage.setItem(e,JSON.stringify(a)),[2]}}))}))},e.prototype.get=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:t=this.prefixName(e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getImpl(t)];case 2:return null==(n=i.sent())&&this.deletePrefixedName(t),[2,n];case 3:throw r=i.sent(),this.deletePrefixedName(t),r;case 4:return[2]}}))}))},e.prototype.getImpl=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return(t=localStorage.getItem(e))?(n=JSON.parse(t)).expiry?(i=this.cookieService.get(e))?(a=JSON.parse(i),[4,ge.asKey(a.key)]):(console.log("No cookie."),[2,null]):[3,3]:[2,null];case 1:return o=s.sent(),[4,this.encryptionService.decrypt(o,n.data)];case 2:return r=s.sent(),[3,4];case 3:r=n.data,s.label=4;case 4:return n.serverSession?[4,this.encryptionService.decrypt(this.serverSessionEncryptionKey,r)]:[3,6];case 5:r=s.sent(),s.label=6;case 6:return[2,r]}}))}))},e}();we.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new we(t.ɵɵinject(ge),t.ɵɵinject(l.CookieService),t.ɵɵinject(ve),t.ɵɵinject(t.INJECTOR))},token:we,providedIn:"root"}),we.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],we.ctorParameters=function(){return[{type:ge},{type:l.CookieService},{type:ve},{type:t.Injector}]};var Ke=function(){function e(e,t){this.config=e,this.persistService=t,this.STORE_MASTER_KEY="masterKey",this.MIN_PASS_IDP_PBKDF_ITER=1e5,this.MIN_PASS_KEY_PBKDF_ITER=1e5,this.MIN_LBOP_KEY_PBKDF_ITER=1e5,this.DEFAULT_PASS_IDP_PBKDF_ITER=this.MIN_PASS_IDP_PBKDF_ITER,this.DEFAULT_PASS_KEY_PBKDF_ITER=this.MIN_PASS_KEY_PBKDF_ITER,this.DEFAULT_LBOP_KEY_PBKDF_ITER=this.MIN_LBOP_KEY_PBKDF_ITER,this.resetKeys()}return e.prototype.resetKeys=function(){this.keys=null,this.masterKey=null},e.prototype.purgeKeys=function(){this.resetKeys(),this.persistService.clear()},e.prototype.setKeys=function(e){this.keys=e},Object.defineProperty(e.prototype,"currentPassKey",{get:function(){return this.keys.passKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentMasterKey",{get:function(){return this.keys.masterKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRootKey",{get:function(){return this.keys.rootKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentPxk",{get:function(){return this.keys.pxk},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSigPxk",{get:function(){return this.keys.sigPxk},enumerable:!1,configurable:!0}),e.prototype.expiresAfter=function(e){return new Date(Date.now()+1e3*e)},e.prototype.persistMasterKey=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return n={id:e.id,jwk:e.jwk.toJSON(!0)},this.masterKey=e,[4,this.persistService.set({name:this.STORE_MASTER_KEY,value:n,expiry:this.expiresAfter(t),serverSession:!this.config.disableSessionEncryptionKey})];case 1:return r.sent(),[2]}}))}))},e.prototype.setMasterKeyExpiresAfterSeconds=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.persistService.get(this.STORE_MASTER_KEY)];case 1:if(null==(t=n.sent()))throw new ne("Can not find masterKey in persisted storage using name: "+this.STORE_MASTER_KEY);return[4,this.persistService.set({name:this.STORE_MASTER_KEY,value:t,expiry:this.expiresAfter(e),serverSession:!this.config.disableSessionEncryptionKey})];case 2:return n.sent(),[2]}}))}))},e.prototype.loadMasterKey=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return this.masterKey?[3,3]:[4,this.persistService.get(this.STORE_MASTER_KEY)];case 1:if(!(t=r.sent()))throw new ne("Could not find masterKey in persisted storage");if(t.id!==e)throw new ne("masterKeyId "+t.id+" in persisted storage does not match the one requested "+e);return n=t,[4,ge.asKey(t.jwk)];case 2:n.jwk=r.sent(),this.masterKey=t,r.label=3;case 3:return[2,this.masterKey]}}))}))},e}();Ke.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Ke(t.ɵɵinject(Se),t.ɵɵinject(we))},token:Ke,providedIn:"root"}),Ke.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Ke.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:we}]};var Pe=function(){function e(e,t,n){this.encryptionService=e,this.keyService=t,this.keyFactory=n,this.purgeKeys()}return e.prototype.purgeKeys=function(){this.graph=new r.Graph},e.prototype.populateKeys=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return n=(t=this.keyService).setKeys,r={passKey:e.passKey},[4,this.keyService.loadMasterKey(e.masterKey.id)];case 1:return r.masterKey=i.sent(),[4,this.unwrapKey(e.masterKey.id,e.rootKey.id)];case 2:return r.rootKey=i.sent(),[4,this.unwrapKey(e.masterKey.id,e.pxk.id)];case 3:return r.pxk=i.sent(),[4,this.unwrapKey(e.masterKey.id,e.sigPxk.id)];case 4:return n.apply(t,[(r.sigPxk=i.sent(),r)]),[2]}}))}))},e.prototype.hasKey=function(e){return!!this.graph.node(e)},e.prototype.getNode=function(e,t){var n=this.graph.node(e);if(!n)throw new ne("Key graphs does not contain key id: "+e);if(n.type!==t)throw new Z("Key with id "+e+" is not of type "+t);return n.data},e.prototype.key=function(e){return this.getNode(e,$.Key)},e.prototype.passKey=function(e){return this.getNode(e,$.PassKey)},e.prototype.addKeys=function(e){var t,n,r,i,a,o;if(e.keys)try{for(var s=O(e.keys),u=s.next();!u.done;u=s.next()){var c=u.value;if(!this.graph.hasNode(c.id)){var p={type:$.Key,data:w.default.cloneDeep(c)};this.graph.setNode(c.id,p)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}if(e.keyLinks)try{for(var d=O(e.keyLinks),l=d.next();!l.done;l=d.next()){var h=l.value;if(!this.graph.hasEdge(h.wrappingKeyId,h.keyId)){var y={type:_.KeyLink,data:w.default.cloneDeep(h)};this.graph.setEdge(h.wrappingKeyId,h.keyId,y)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}if(e.passKeyLinks)try{for(var f=O(e.passKeyLinks),v=f.next();!v.done;v=f.next()){var m=v.value;if(!this.graph.hasEdge(m.passKeyId,m.keyId)){y={type:_.PassKeyLink,data:w.default.cloneDeep(m)};this.graph.setEdge(m.passKeyId,m.keyId,y)}}}catch(e){a={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(a)throw a.error}}},e.prototype.tracePath=function(e,t){var n=[],r=t;if(!e[r].predecessor)return null;for(;e[r].predecessor;){var i=e[r].predecessor;n.push(this.graph.edge(i,r)),r=i}return n.reverse(),n},e.prototype.getPath=function(e,t){if(!e||"string"!=typeof e)throw new z("Param knownKeyId wrong format: "+e);if(!t||"string"!=typeof t)throw new z("Param keyId wrong format: "+t);var n=b.default.alg.dijkstra(this.graph,e);return this.tracePath(n,t)},e.prototype.getJwkKey=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.getKey(e,t)];case 1:return[2,n.sent().jwk]}}))}))},e.prototype.getKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return n="string"==typeof e?e:null==e?void 0:e.id,this.hasKey(n)||!t?[3,2]:[4,t()];case 1:if(r=a.sent(),null!=n&&n!=r)throw new V("Requested keyId is not in the key cache, so an API request was made to populate the key cache.But the key returned by the API does NOT match the requested keyId.This is a programming logic error.");n=r,a.label=2;case 2:return(i=this.key(n)).jwk?[2,i]:[2,this.unwrapKey(this.keyService.currentMasterKey.id,n)]}}))}))},e.prototype._unwrapLink=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a;return T(this,(function(o){switch(o.label){case 0:return(r=JSON.parse(t.data.wrappedKey)).signatures?[4,this.encryptionService.verify(e,r)]:[3,2];case 1:return i=o.sent(),[3,4];case 2:return[4,this.encryptionService.decrypt(e,r)];case 3:i=o.sent(),o.label=4;case 4:return a=n,[4,ge.asKey(i)];case 5:return a.jwk=o.sent(),n.task=null,[2]}}))}))},e.prototype._unwrap=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u;return T(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,7]),n=O(t),r=n.next(),c.label=1;case 1:return r.done?[3,4]:(i=r.value,(a=this.key(i.data.keyId)).jwk?(e=a.jwk,[3,3]):(a.task||(a.task=this._unwrapLink(e,i,a)),[4,a.task]));case 2:c.sent(),e=a.jwk,c.label=3;case 3:return r=n.next(),[3,1];case 4:return[3,7];case 5:return o=c.sent(),s={error:o},[3,7];case 6:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}return[7];case 7:return[2,e]}}))}))},e.prototype.unwrapWithPassKey=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i;return T(this,(function(a){switch(a.label){case 0:return r=this.getPath(e,n),i={id:n},[4,this._unwrap(t,r)];case 1:return[2,(i.jwk=a.sent(),i)]}}))}))},e.prototype.unwrapKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.keyService.loadMasterKey(e)];case 1:return n=a.sent(),e===t?[2,n]:(r=this.getPath(n.id,t),i={id:t},[4,this._unwrap(n.jwk,r)]);case 2:return[2,(i.jwk=a.sent(),i)]}}))}))},e.prototype.decryptFromString=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return t?[4,this.getJwkKey(e)]:[3,3];case 1:return r=i.sent(),[4,this.encryptionService.decrypt(r,JSON.parse(t),n)];case 2:return[2,i.sent()];case 3:return[2,null]}}))}))},e.prototype.decryptFile=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getJwkKey(e)];case 1:return n=r.sent(),[4,this.encryptionService.decrypt(n,t,{payloadType:L.UINT_8_ARRAY})];case 2:return[2,r.sent()]}}))}))},e.prototype.encryptToString=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return null==t?[2,null]:(r=function(e){return e.id&&e.jwk?e.jwk:e.keystore&&e.length&&e.kty&&e.kid&&e.alg?e:null}(e))?[3,2]:[4,this.getJwkKey(e)];case 1:r=i.sent(),i.label=2;case 2:return n=r,[2,this.encryptionService.encryptToString(n,t)]}}))}))},e.prototype.wrapKey=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){if(!function(e){return"oct"===e.kty}(t))throw new Q("Only allowing wrapping of symmetric keys.");return[2,this.encryptToString(e,t.toJSON(!0))]}))}))},e.prototype.encryptWithNewKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.keyFactory.createKey()];case 1:return n=a.sent(),[4,this.encryptToString(e,n.toJSON(!0))];case 2:return r=a.sent(),[4,this.encryptToString(n,t)];case 3:return i=a.sent(),[2,{key:n,wrappingKeyId:e,wrappedKey:r,cipher:i}]}}))}))},e}();Pe.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Pe(t.ɵɵinject(ve),t.ɵɵinject(Ke),t.ɵɵinject(ge))},token:Pe,providedIn:"root"}),Pe.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Pe.ctorParameters=function(){return[{type:ve},{type:Ke},{type:ge}]};var ke=function(){function e(e,t){this.apollo=e,this.keyGraph=t}return e.prototype.addKeys=function(e){e.data.keyGraph&&this.keyGraph.addKeys(e.data.keyGraph)},e.prototype.query=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.apollo.query(e).toPromise()];case 1:return U((t=n.sent()).errors),this.addKeys(t),[2,t.data]}}))}))},e.prototype.mutate=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.apollo.mutate(e).toPromise()];case 1:return U((t=n.sent()).errors),this.addKeys(t),[2,t.data]}}))}))},e}();function De(e,t){var n=e.definitions.filter((function(e){return"OperationDefinition"===e.kind}));if(n.length>1)throw new V("There can be only one '"+t+"' operation, instead there are "+n.length);return n[0]}function Re(e){return De(e,"query")}function Ee(e){return De(e,"mutation")}function Me(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Ae(e){return{kind:"Name",value:e}}function Te(e){var t;return(null===(t=e.alias)||void 0===t?void 0:t.value)||e.name.value}function Oe(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return K.default.apply(void 0,N([e],t))}ke.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new ke(t.ɵɵinject(n.Apollo),t.ɵɵinject(Pe))},token:ke,providedIn:"root"}),ke.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ke.ctorParameters=function(){return[{type:n.Apollo},{type:Pe}]};var je,Ne,Fe,$e,_e,Le,Ue,xe,qe="\n{\n keys {\n id\n }\n keyLinks {\n keyId\n wrappingKeyId\n wrappedKey\n }\n passKeys {\n id\n }\n passKeyLinks {\n keyId\n passKeyId\n wrappedKey\n }\n __typename\n}\n",Je=K.default(je||(je=F(["\nfragment KeyGraphFragment on KeyGraphType ","\n"],["\nfragment KeyGraphFragment on KeyGraphType ","\n"])),qe),Ge="keyGraph "+qe,Qe="keyGraph: fetchKeyGraph "+qe,Ve=K.default(Ne||(Ne=F(["\n query File($id: LrRelayIdInput!, $cachedKeyIds: [LrRelayIdInput!]) {\n file(id: $id) {\n id\n keyId\n currentVersion {\n id\n operation\n state {\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n versions {\n edges {\n node {\n id\n state {\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n }\n }\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n id\n plainMeta\n }\n }\n }\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n }\n ","\n"],["\n query File($id: LrRelayIdInput!, $cachedKeyIds: [LrRelayIdInput!]) {\n file(id: $id) {\n id\n keyId\n currentVersion {\n id\n operation\n state {\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n versions {\n edges {\n node {\n id\n state {\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n }\n }\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n id\n plainMeta\n }\n }\n }\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n }\n ","\n"])),Je),Be=K.default(Fe||(Fe=F(["\n query Directory($id: LrRelayIdInput!, $cachedKeyIds: [LrRelayIdInput!]) {\n directory(id: $id) {\n id\n keyId\n plainMeta\n cipherMeta\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n }\n ","\n"],["\n query Directory($id: LrRelayIdInput!, $cachedKeyIds: [LrRelayIdInput!]) {\n directory(id: $id) {\n id\n keyId\n plainMeta\n cipherMeta\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n }\n ","\n"])),Je),We=K.default($e||($e=F(["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"],["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"]))),Ze=K.default(_e||(_e=F(["\n mutation UpdateFile($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n currentVersion {\n id\n state {\n id\n }\n }\n }\n }\n }\n"],["\n mutation UpdateFile($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n currentVersion {\n id\n state {\n id\n }\n }\n }\n }\n }\n"]))),He=K.default(Le||(Le=F(["\n mutation RevertFile($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n currentVersion {\n id\n state {\n id\n }\n }\n }\n }\n }\n"],["\n mutation RevertFile($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n currentVersion {\n id\n state {\n id\n }\n }\n }\n }\n }\n"]))),Ye=K.default(Ue||(Ue=F(["\n mutation MoveFile(\n $fileId: LrRelayIdInput!\n $fromParentDirectoryId: LrRelayIdInput!\n $toParentDirectoryId: LrRelayIdInput!\n $wrappingKeyId: LrRelayIdInput!\n $wrappedKey: String!\n ) {\n moveFile(\n input: {\n fileId: $fileId\n fromParentDirectoryId: $fromParentDirectoryId\n toParentDirectoryId: $toParentDirectoryId\n wrappingKeyId: $wrappingKeyId\n wrappedKey: $wrappedKey\n }\n ) {\n file {\n id\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n plainMeta\n }\n }\n }\n }\n }\n }\n }\n"],["\n mutation MoveFile(\n $fileId: LrRelayIdInput!\n $fromParentDirectoryId: LrRelayIdInput!\n $toParentDirectoryId: LrRelayIdInput!\n $wrappingKeyId: LrRelayIdInput!\n $wrappedKey: String!\n ) {\n moveFile(\n input: {\n fileId: $fileId\n fromParentDirectoryId: $fromParentDirectoryId\n toParentDirectoryId: $toParentDirectoryId\n wrappingKeyId: $wrappingKeyId\n wrappedKey: $wrappedKey\n }\n ) {\n file {\n id\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n plainMeta\n }\n }\n }\n }\n }\n }\n }\n"]))),Xe=K.default(xe||(xe=F(["\n mutation MoveDirectory(\n $directoryId: LrRelayIdInput!\n $fromParentDirectoryId: LrRelayIdInput\n $toParentDirectoryId: LrRelayIdInput!\n $wrappedKey: String!\n $wrappingKeyId: LrRelayIdInput!\n ) {\n moveDirectory(\n input: {\n directoryId: $directoryId\n fromParentDirectoryId: $fromParentDirectoryId\n toParentDirectoryId: $toParentDirectoryId\n wrappedKey: $wrappedKey\n wrappingKeyId: $wrappingKeyId\n }\n ) {\n directory {\n id\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n plainMeta\n }\n }\n }\n }\n }\n }\n }\n"],["\n mutation MoveDirectory(\n $directoryId: LrRelayIdInput!\n $fromParentDirectoryId: LrRelayIdInput\n $toParentDirectoryId: LrRelayIdInput!\n $wrappedKey: String!\n $wrappingKeyId: LrRelayIdInput!\n ) {\n moveDirectory(\n input: {\n directoryId: $directoryId\n fromParentDirectoryId: $fromParentDirectoryId\n toParentDirectoryId: $toParentDirectoryId\n wrappedKey: $wrappedKey\n wrappingKeyId: $wrappingKeyId\n }\n ) {\n directory {\n id\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n plainMeta\n }\n }\n }\n }\n }\n }\n }\n"]))),ze=["constructor","ngOnChanges","ngOnInit","ngDoCheck","ngAfterContentInit","ngAfterContentChecked","ngAfterViewInit","ngAfterViewChecked","ngOnDestroy"];function et(e){var t=e.ngZoneName,n=e.exceptLastPromise,r=void 0===n||n,i=e.excludeMethods,a=void 0===i?[]:i,o=e.patchSetters,s=void 0===o||o;return function(e){function n(n,i){var a=this;if(!this[t])throw new V("RunOutsideAngular decorator requires that "+e.name+" inject NgZone as "+t);var o=this[t].runOutsideAngular((function(){return n.apply(a,i)}));return r&&(null==o?void 0:o.then)?Promise.resolve(o):o}return a=N(a,ze),Object.getOwnPropertyNames(e.prototype).filter((function(e){return!a.includes(e)})).forEach((function(t){if(s&&Object.getOwnPropertyDescriptor(e.prototype,t).set){var r=Object.getOwnPropertyDescriptor(e.prototype,t).set;Object.defineProperty(e.prototype,t,{set:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.apply(this,[r,e])}})}if("function"==typeof e.prototype[t]){var i=e.prototype[t];e.prototype[t]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.apply(this,[i,e])}}})),e}}var tt={hasKeys:!0};function nt(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o=this;return T(this,(function(s){switch(s.label){case 0:return r=(n=Object).assign,i=[Object.assign({},e)],a={},[4,Promise.all(e.edges.map((function(e){return A(o,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return r=(n=Object).assign,i=[Object.assign({},e)],a={},[4,t(e.node)];case 1:return[2,r.apply(n,i.concat([(a.node=o.sent(),a)]))]}}))}))})))];case 1:return[2,r.apply(n,i.concat([(a.edges=s.sent(),a)]))]}}))}))}e.CommonProcessorsService=function(){function e(e,t){this.ngZone=e,this.keyGraph=t}return e.prototype.series=function(e){var t=this;return function(n){var r=n.field,i=n.context,a=n.options;return A(t,void 0,void 0,(function(){var t,n,o,s,u;return T(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,7]),t=O(e),n=t.next(),c.label=1;case 1:return n.done?[3,4]:[4,(0,n.value)({field:r,context:i,options:a})];case 2:r=c.sent(),c.label=3;case 3:return n=t.next(),[3,1];case 4:return[3,7];case 5:return o=c.sent(),s={error:o},[3,7];case 6:try{n&&!n.done&&(u=t.return)&&u.call(t)}finally{if(s)throw s.error}return[7];case 7:return[2,r]}}))}))}},e.prototype.makeJsonParseProcessor=function(e){var t=void 0===e?{}:e,n=t.plainFieldName,r=t.jsonFieldSuffix,i=n+(void 0===r?"Json":r);return function(e){var t,r=e.field;if(null==r[n]||i in r)return r;try{return Object.assign(Object.assign({},r),((t={})[i]=JSON.parse(r[n]),t))}catch(e){return r}}},e.prototype.makeDecryptionProcessor=function(e){var t=this,n=void 0===e?{}:e,r=n.cipherFieldName,i=n.clearFieldSuffix,a=void 0===i?"ClearJson":i,o=n.getKeyId,s=void 0===o?null:o,u=r+a;return function(e){return A(t,void 0,void 0,(function(){var t,n,i,a,o,c;return T(this,(function(p){switch(p.label){case 0:return n=e.field,i=e.context,e.options.hasKeys?!(a=n[r])||u in n?[2,n]:s?[4,s(e)]:[3,2]:[2,n];case 1:return c=p.sent(),[3,3];case 2:c=n.keyId||(null===(t=n.key)||void 0===t?void 0:t.id),p.label=3;case 3:if(!(o=c))throw new V("Query response does not contain "+(s?"key-id":"keyId or key.id")+" field: "+i.path.join("."));return[2,this.keyGraph.decryptFromString(o,a).then((function(e){var t;return Object.assign(Object.assign({},n),((t={})[u]=e,t))}))]}}))}))}},e}(),e.CommonProcessorsService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.CommonProcessorsService(t.ɵɵinject(t.NgZone),t.ɵɵinject(Pe))},token:e.CommonProcessorsService,providedIn:"root"}),e.CommonProcessorsService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.CommonProcessorsService.ctorParameters=function(){return[{type:t.NgZone},{type:Pe}]},e.CommonProcessorsService=M([et({ngZoneName:"ngZone"})],e.CommonProcessorsService);var rt=function(){function e(e,t){this.ngZone=e,this.keyGraph=t}return e.prototype.processTpPasswordResetUserNode=function(e){var t;return A(this,void 0,void 0,(function(){var n,r,i,a,o=this;return T(this,(function(s){switch(s.label){case 0:return(r=null===(t=e.pxk)||void 0===t?void 0:t.id)?[4,this.keyGraph.getKey(e.pxk.id)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return n=r,i=Object.assign({},e),n&&e.approvals?(a=i,[4,Promise.all(e.approvals.map((function(e){return o.processTpPasswordResetUserApprovalNode(e,n)})))]):[3,4];case 3:a.approvals=s.sent(),s.label=4;case 4:return[2,i]}}))}))},e.prototype.processTpPasswordResetUserApprovalNode=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return n=Object.assign({},e),e.receiverCipher&&(n.receiverCipherClearJson=this.keyGraph.decryptFromString(t,e.receiverCipher)),e.receiverCipherPartialAssemblyKey?(r=n,[4,this.keyGraph.decryptFromString(t,e.receiverCipherPartialAssemblyKey)]):[3,2];case 1:r.receiverCipherPartialAssemblyKeyClearJson=i.sent(),i.label=2;case 2:return[2,n]}}))}))},e.prototype.makeTpPasswordResetNodeProcessor=function(){var e=this;return function(t){var n=t.field;return A(e,void 0,void 0,(function(){var e,t;return T(this,(function(r){switch(r.label){case 0:if(e=Object.assign({},n),!n.assembly)return[3,2];if(null==n.applied)throw new B('If you request for field "assembly" in the TpPasswordResetNode, then you must also request the "applied" field');return t=e,[4,this.processTpAssemblyNode(n.assembly,n.applied)];case 1:t.assembly=r.sent(),r.label=2;case 2:return[2,e]}}))}))}},e.prototype.processTpAssemblyNode=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l=this;return T(this,(function(h){switch(h.label){case 0:return n=e.subjectKey,r=e.assemblyKey,i=e.assemblyCipherData,a=e.subAssemblies,u=(s=Object).assign,c=[Object.assign({},e)],p={},[4,nt(a,(function(e){return l.processTpSubAssemblyNode(e,n.id,t)}))];case 1:return o=u.apply(s,c.concat([(p.subAssemblies=h.sent(),p)])),t?[3,3]:i?(d=o,[4,this.keyGraph.decryptFromString(r.id,i)]):[3,3];case 2:d.assemblyCipherDataClearJson=h.sent(),h.label=3;case 3:return[2,o]}}))}))},e.prototype.processTpSubAssemblyNode=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d=this;return T(this,(function(l){switch(l.label){case 0:return r=e.subjectCipherData,i=e.approvers,s=(o=Object).assign,u=[Object.assign({},e)],c={},[4,nt(i,(function(e){return d.processTpAssemblyApproverNode(e,n)}))];case 1:return a=s.apply(o,u.concat([(c.approvers=l.sent(),c)])),n?[3,3]:r?(p=a,[4,this.keyGraph.decryptFromString(t,r)]):[3,3];case 2:p.subjectCipherDataClearJson=l.sent(),l.label=3;case 3:return[2,a]}}))}))},e.prototype.processTpAssemblyApproverNode=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,e]}))}))},e}();function it(e,t){return Object.assign(Object.assign({},e),{path:N(e.path,[t])})}rt.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new rt(t.ɵɵinject(t.NgZone),t.ɵɵinject(Pe))},token:rt,providedIn:"root"}),rt.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],rt.ctorParameters=function(){return[{type:t.NgZone},{type:Pe}]},rt=M([et({ngZoneName:"ngZone"})],rt),e.QueryProcessorService=function(){function e(e,t,n,r){this.ngZone=e,this.keyService=t,this.common=n,this.tpprProcessor=r,this.TYPENAME="__typename",this.processors={},this.registerProcessor("DirectoryNode",n.series([n.makeJsonParseProcessor({plainFieldName:"plainMeta"}),n.makeDecryptionProcessor({cipherFieldName:"cipherMeta"})])),this.registerProcessor("FileStateNode",n.series([n.makeJsonParseProcessor({plainFieldName:"plainMeta"}),n.makeDecryptionProcessor({cipherFieldName:"cipherMeta"})])),this.registerProcessor("ContactCardNode",n.makeDecryptionProcessor({cipherFieldName:"cipherData"})),this.registerProcessor("SharedContactCardNode",n.series([n.makeJsonParseProcessor({plainFieldName:"ownerPlainData"}),n.makeDecryptionProcessor({cipherFieldName:"ownerCipherData",getKeyId:function(e){return e.field.ownerKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"receiverCipherData",getKeyId:function(e){return e.field.receiverKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("TpPasswordResetNode",this.tpprProcessor.makeTpPasswordResetNodeProcessor()),this.registerProcessor("SharedTpClaimApproverNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherApprovalData",getKeyId:function(e){return e.field.sharedKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"sharedCipherPartialAssemblyKey",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("TpAssemblyAsApproverNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("ScenarioNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"subjectCipherData",getKeyId:function(e){return e.field.subjectKey.id}})])),this.registerProcessor("ScenarioReceiverNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("ScenarioReceiverDirectoryNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("ScenarioApproverAssemblyNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"assemblyCipherData",getKeyId:function(e){return e.field.assemblyKey.id}})])),this.registerProcessor("ScenarioApproverSubAssemblyNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"subjectCipherData",getKeyId:function(e){return e.field.subjectKey.id}})])),this.registerProcessor("ScenarioApproverNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"sharedCipherApprovalData",getKeyId:function(e){return e.field.sharedKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"sharedCipherPartialAssemblyKey",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("ScenarioClaimantNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("TpAssemblyNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"subjectCipherData",getKeyId:function(e){return e.field.subjectKey.id}})])),this.registerProcessor("TpSubAssemblyNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"subjectCipherData",getKeyId:function(e){return e.field.subjectKey.id}})])),this.registerProcessor("NotificationNode",n.series([n.makeJsonParseProcessor({plainFieldName:"plainMeta"}),n.makeJsonParseProcessor({plainFieldName:"plainData"})])),this.registerProcessor("UserNode",n.series([n.makeJsonParseProcessor({plainFieldName:"config"})])),this.registerProcessor("ReminderNode",n.series([n.makeJsonParseProcessor({plainFieldName:"plain"})]))}return e.prototype.processQuery=function(e,t){return A(this,void 0,void 0,(function(){var n=this;return T(this,(function(r){return t=Object.assign(Object.assign({},tt),t),[2,se(e,(function(e,r){return n.processField({field:e,context:{path:[r],processChildren:!0},options:t})}))]}))}))},e.prototype.processField=function(e){var t=e.field,n=e.context,r=e.options;return A(this,void 0,void 0,(function(){var e,i,a,o=this;return T(this,(function(s){if(null==t?void 0:t.then)throw new V("processField() should not receive thenable.");return null==t?[2,null]:(e={field:t,context:Object.assign(Object.assign({},n),{processChildren:!0}),options:r},t[this.TYPENAME]?((i=this.processors[t[this.TYPENAME]])&&(t=i(e)),a=function(e){return n.processChildren&&null!==e&&"object"==typeof e?se(e,(function(e,t){return o.processField({field:e,context:it(n,t),options:r})})):e},t=t.then?t.then((function(e){return a(e)})):a(t)):n.processChildren&&Array.isArray(t)&&(t=ae(t.map((function(e,t){return o.processField({field:e,context:it(n,t.toString()),options:r})})))),[2,t])}))}))},e.prototype.registerProcessor=function(e,t){if(this.processors[e])throw new V("Processor for field "+e+" already exists.");this.processors[e]=t},e}(),e.QueryProcessorService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.QueryProcessorService(t.ɵɵinject(t.NgZone),t.ɵɵinject(Ke),t.ɵɵinject(e.CommonProcessorsService),t.ɵɵinject(rt))},token:e.QueryProcessorService,providedIn:"root"}),e.QueryProcessorService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.QueryProcessorService.ctorParameters=function(){return[{type:t.NgZone},{type:Ke},{type:e.CommonProcessorsService},{type:rt}]},e.QueryProcessorService=M([et({ngZoneName:"ngZone"})],e.QueryProcessorService);var at,ot,st,ut=function(){function e(){var e=this;this._fulfilled=!1,this.promise=new Promise((function(t,n){e._resolve=t,e._reject=n})).finally((function(){e._fulfilled=!0}))}return Object.defineProperty(e.prototype,"resolve",{get:function(){return this._resolve},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reject",{get:function(){return this._reject},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fulfilled",{get:function(){return this._fulfilled},enumerable:!1,configurable:!0}),e}(),ct=Re(K.default(at||(at=F(["\n query {\n ...FragmentName\n }\n"],["\n query {\n ...FragmentName\n }\n"])))).selectionSet.selections[0],pt=function(){function e(){this._executed=!1,this.deferredPromise=new ut}return Object.defineProperty(e.prototype,"promise",{get:function(){return this.deferredPromise.promise},enumerable:!1,configurable:!0}),e.prototype.resolve=function(e){this.deferredPromise.resolve(e)},e.prototype.reject=function(e){this.deferredPromise.reject(e)},Object.defineProperty(e.prototype,"lrMutationData",{get:function(){return{mutation:this.mutation,variables:this.variables}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"executed",{get:function(){return this._executed},enumerable:!1,configurable:!0}),e.prototype.setExecuted=function(){if(this._executed)throw new Z("Already executed");this._executed=!0},e}(),dt=function(e){function t(t){var n=e.call(this)||this;return n.mutation=t.mutation,n.variables=t.variables,n}return R(t,e),t.prototype.select=function(e){var n=i.cloneDeep(this.mutation),r=Ee(n),a={};Me(e).forEach((function(e){a[e.name.value]=e}));return r.selectionSet.selections.forEach((function(e){"Field"===e.kind&&function(e){var t=e,n=Te(t);a[n]&&(t.selectionSet.selections=[Object.assign(Object.assign({},ct),{name:Ae(n)})])}(e)})),new t({mutation:Object.assign(Object.assign({},n),{definitions:N(n.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})),e.definitions)}),variables:this.variables})},t}(pt),lt={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"lrMergedMutation"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[]}}]},ht=function(e){function t(t){var n=e.call(this)||this;n.lrMutations=t;var r=n.merge(),i=r.mutation,a=r.variables,o=r.prefixes;return n.mutation=i,n.variables=a,n.prefixes=o,n.descendants=n.getDescendants(),n}return R(t,e),t.create=function(e){return new t(e)},t.prototype.getDescendants=function(){var e=new Set,n=function(t){if(e.has(t))throw new V("Classes that are derived from LrMutationBase can not be used more than once in a merged mutation.");e.add(t)};return this.lrMutations.forEach((function(e){if(e instanceof dt)n(e);else{if(!(e instanceof t))throw new ie("LrMergeMutation can not handle class: "+e.constructor.name);e.descendants.forEach((function(e){return n(e)}))}})),e},t.prototype.resolve=function(t){for(var n=this,r=0;r<this.lrMutations.length;++r){var i=this.prefixes[r],a={};for(var o in t){if(o.startsWith(i))a[o.slice(i.length)]=t[o]}this.lrMutations[r].resolve(a)}Promise.all(this.lrMutations.map((function(e){return e.promise}))).then((function(t){e.prototype.resolve.call(n,t)}))},t.prototype.reject=function(t){e.prototype.reject.call(this,t),this.lrMutations.forEach((function(e){return e.reject(t)}))},t.prototype.setExecuted=function(){e.prototype.setExecuted.call(this),this.lrMutations.forEach((function(e){return e.setExecuted()}))},t.prototype.renameVariableDefinition=function(e,t){return Object.assign(Object.assign({},e),{variable:Object.assign(Object.assign({},e.variable),{name:Ae(t+e.variable.name.value)})})},t.prototype.renameVariableDefinitions=function(e,t){var n=this;return e.map((function(e){return n.renameVariableDefinition(e,t)}))},t.prototype.renameArgument=function(e,t){return"Variable"!==e.value.kind?e:Object.assign(Object.assign({},e),{value:Object.assign(Object.assign({},e.value),{name:Ae(t+e.value.name.value)})})},t.prototype.renameField=function(e,t){var n=this;if("Field"!==e.kind)return e;var r=t+Te(e),i=e.arguments.map((function(e){return n.renameArgument(e,t)}));return Object.assign(Object.assign({},e),{alias:{kind:"Name",value:r},arguments:i})},t.prototype.renameFragmentSpread=function(e,t){return Object.assign(Object.assign({},e),{name:Ae(t+e.name.value)})},t.prototype.processSelection=function(e,t){switch(e.kind){case"FragmentSpread":return this.renameFragmentSpread(e,t);case"Field":return e.selectionSet?Object.assign(Object.assign({},e),{selectionSet:this.processSelectionSet(e.selectionSet,t)}):e;default:return e}},t.prototype.processSelectionSet=function(e,t){var n=this;return Object.assign(Object.assign({},e),{selections:e.selections.map((function(e){return n.processSelection(e,t)}))})},t.prototype.renameSelections=function(e,t){var n=this;return e.map((function(e){switch(e.kind){case"Field":return n.processSelection(n.renameField(e,t),t);default:return e}}))},t.prototype.renameFragmentDefinition=function(e,t){var n=Object.assign(Object.assign({},e),{name:Ae(t+e.name.value)});return e.selectionSet&&(n.selectionSet=this.processSelectionSet(e.selectionSet,t)),n},t.prototype.renameFragmentDefinitions=function(e,t){var n=this;return e.map((function(e){return n.renameFragmentDefinition(e,t)}))},t.prototype.merge=function(){var e=this,t=[],n=[],r={},a=[],o=[];this.lrMutations.forEach((function(i,s){var u,c;if(!(i instanceof pt))throw new V("An mutation in the array is not of type LrMutationBase.");var p=i.lrMutationData,d=p.mutation,l=p.variables,h=Ee(d),y="item"+s+"_";h.name&&(y+=h.name.value+"_"),o.push(y),t=N(t,e.renameVariableDefinitions(h.variableDefinitions,y)),n=N(n,e.renameSelections(h.selectionSet.selections,y));try{for(var f=O(Object.keys(l)),v=f.next();!v.done;v=f.next()){var m=v.value;r[y+m]=l[m]}}catch(e){u={error:e}}finally{try{v&&!v.done&&(c=f.return)&&c.call(f)}finally{if(u)throw u.error}}var g=Me(d);a=N(a,e.renameFragmentDefinitions(g,y))}));var s=i.cloneDeep(lt),u=Ee(s);return u.selectionSet.selections=n,u.variableDefinitions=t,s.definitions=N(s.definitions,a),{mutation:s,variables:r,prefixes:o}},t}(pt),yt=Re(K.default(ot||(ot=F(["\nquery {\n ","\n}\n"],["\nquery {\n ","\n}\n"])),Ge)).selectionSet.selections[0],ft=Re(K.default(st||(st=F(["\nquery {\n ","\n}\n"],["\nquery {\n ","\n}\n"])),Qe)).selectionSet.selections[0];e.ɵg=function(){function e(e,t,n,r){this.ngZone=e,this.apollo=t,this.keyGraph=n,this.queryProcessor=r,this.stats={queryCount:0,mutationCount:0}}return e.prototype.query=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return e=i.cloneDeep(e),this.isIncludeKeyGraph(e.includeKeyGraph)&&((t=Re(e.query)).selectionSet.selections=N(t.selectionSet.selections,[yt])),e.name&&((t=Re(e.query)).name={kind:"Name",value:e.name}),[4,this.apollo.query(e).toPromise()];case 1:return n=r.sent(),this.stats.queryCount++,U(n.errors),this.addKeys(n),[4,this.queryProcessor.processQuery(n.data,e.processorOptions)];case 2:return[2,r.sent()]}}))}))},e.prototype.lrMutateImpl=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){if(null==t?void 0:t.variables)throw new ie('Unsupported field: "options.variables"');if(e.executed)throw new Z("LrMutation has already executed. LrMutation can only be used once in a lrMutate() call. Create new instances of LrMutation.");return e.setExecuted(),[2,this.apolloMutate(Object.assign(Object.assign({},t),e.lrMutationData)).then((function(t){return e.resolve(t),t})).catch((function(t){throw e.reject(t),t}))]}))}))},e.prototype.apolloMutate=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return e=Object.assign(Object.assign({},e),{mutation:i.cloneDeep(e.mutation)}),this.isIncludeKeyGraph(e.includeKeyGraph)&&((t=Ee(e.mutation)).selectionSet.selections=N(t.selectionSet.selections,[ft])),e.name&&((t=Ee(e.mutation)).name={kind:"Name",value:e.name}),e.mutation=K.default(h.print(e.mutation)),[4,this.apollo.mutate(e).toPromise()];case 1:return n=r.sent(),this.stats.mutationCount++,U(n.errors),this.addKeys(n),[4,this.queryProcessor.processQuery(n.data,e.processorOptions)];case 2:return[2,r.sent()]}}))}))},e.prototype.statsSnapshot=function(){return i.cloneDeep(this.stats)},e.prototype.addKeys=function(e){e.data.keyGraph&&(this.keyGraph.addKeys(e.data.keyGraph),delete e.data.keyGraph)},e.prototype.isIncludeKeyGraph=function(e){return null==e},e.prototype.lrMutate=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return e instanceof Array?(i=(r=ht).create,[4,Promise.all(e)]):[3,3];case 1:return n=i.apply(r,[o.sent()]),[4,this.lrMutateImpl(n,t)];case 2:return o.sent(),[2,n.promise];case 3:return[4,e];case 4:return a=o.sent(),[4,this.lrMutateImpl(a,t)];case 5:return o.sent(),[2,a.promise]}}))}))},e}(),e.ɵg.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ɵg(t.ɵɵinject(t.NgZone),t.ɵɵinject(n.Apollo),t.ɵɵinject(Pe),t.ɵɵinject(e.QueryProcessorService))},token:e.ɵg,providedIn:"root"}),e.ɵg.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵg.ctorParameters=function(){return[{type:t.NgZone},{type:n.Apollo},{type:Pe},{type:e.QueryProcessorService}]},e.ɵg=M([et({ngZoneName:"ngZone"})],e.ɵg);var vt,mt,gt,St,Ct,It,bt,wt,Kt,Pt,kt,Dt,Rt,Et,Mt,At,Tt,Ot,jt,Nt,Ft,$t=function(){function t(t){this.lrGraphQL=t.get(e.ɵg)}return t.prototype.mutate=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.lrGraphQL.lrMutate(e,t)]}))}))},t.prototype.query=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.lrGraphQL.query(e)]}))}))},t}();function _t(e){return e.edges.map((function(e){return e.node}))}(e.UserDeleteState||(e.UserDeleteState={})).REQUESTED="REQUESTED",(vt=e.PlanState||(e.PlanState={})).ENABLED="ENABLED",vt.DISABLED="DISABLED",(mt=e.TpShareTypeChoice||(e.TpShareTypeChoice={})).TP="TP",mt.DETACHED="DETACHED",(gt=e.TpDetachedShareStateChoice||(e.TpDetachedShareStateChoice={})).IN_PROGRESS="IN_PROGRESS",gt.COMPLETED="COMPLETED",(St=e.AccessRoleChoice||(e.AccessRoleChoice={})).READER="READER",St.WRITER="WRITER",St.ADMIN="ADMIN",St.CUSTODIAN="CUSTODIAN",St.DENY="DENY",St.OWNER="OWNER",(Ct=e.AccessRoleChoiceOrder||(e.AccessRoleChoiceOrder={}))[Ct.READER=0]="READER",Ct[Ct.WRITER=1]="WRITER",Ct[Ct.ADMIN=2]="ADMIN",Ct[Ct.CUSTODIAN=3]="CUSTODIAN",Ct[Ct.DENY=4]="DENY",Ct[Ct.CONFIDENTIAL=5]="CONFIDENTIAL",Ct[Ct.OWNER=6]="OWNER",(It=e.AccessRoleMethodChoice||(e.AccessRoleMethodChoice={})).INHERITED="INHERITED",It.DIRECT="DIRECT",(bt=e.PermissionChoice||(e.PermissionChoice={})).CREATE="CREATE",bt.READ="READ",bt.UPDATE="UPDATE",bt.DELETE="DELETE",bt.SHARE="SHARE",bt.ARCHIVE="ARCHIVE",bt.ACCESS_ARCHIVED="ACCESS_ARCHIVED",bt.UNARCHIVE="UNARCHIVE",bt.SET_CONFIDENTIAL="SET_CONFIDENTIAL",(wt=e.FileOperationField||(e.FileOperationField={})).CREATE="CREATE",wt.READ="READ",wt.UPDATE="UPDATE",wt.REVERT="REVERT",wt.DELETE="DELETE",(Kt=e.KeyExchangeOtkState||(e.KeyExchangeOtkState={})).OTK_INITIATED="OTK_INITIATED",Kt.OTK_ACCEPTED="OTK_ACCEPTED",Kt.OTK_COMPLETED="OTK_COMPLETED",(Pt=e.KeyExchangeState||(e.KeyExchangeState={})).IN_PROGRESS="IN_PROGRESS",Pt.COMPLETED="COMPLETED",Pt.DECLINED="DECLINED",Pt.CANCELLED="CANCELLED",Pt.DELETED="DELETED",(e.KeyExchangeMode||(e.KeyExchangeMode={})).OTK="OTK",(kt=e.TpAssemblyState||(e.TpAssemblyState={})).DISABLED="DISABLED",kt.ENABLED="ENABLED",kt.CLAIMED="CLAIMED",kt.APPROVED="APPROVED",kt.REJECTED="REJECTED",kt.EXPIRED="EXPIRED",kt.CANCELLED="CANCELLED",kt.RESET="RESET",(Dt=e.TpClaimState||(e.TpClaimState={})).CLAIMED="CLAIMED",Dt.APPROVED="APPROVED",Dt.REJECTED="REJECTED",Dt.EXPIRED="EXPIRED",Dt.CANCELLED="CANCELLED",Dt.RESET="RESET",(Rt=e.TpClaimApproverState||(e.TpClaimApproverState={})).CLAIMED="CLAIMED",Rt.APPROVED="APPROVED",Rt.REJECTED="REJECTED",(Et=e.LockState||(e.LockState={})).UNLOCKED="UNLOCKED",Et.MUTEX_LOCKED="MUTEX_LOCKED",(Mt=e.ScenarioState||(e.ScenarioState={})).DISABLED="DISABLED",Mt.ENABLED="ENABLED",Mt.CLAIMED="CLAIMED",Mt.APPROVED="APPROVED",(At=e.ClaimState||(e.ClaimState={})).CLAIMED="CLAIMED",At.EXPIRED="EXPIRED",At.APPROVED="APPROVED",At.REJECTED="REJECTED",At.CANCELLED="CANCELLED",At.RESET="RESET",(Tt=e.ClaimApproverState||(e.ClaimApproverState={})).CLAIMED="CLAIMED",Tt.APPROVED="APPROVED",Tt.REJECTED="REJECTED",(Ot=e.ScenarioLastClaimState||(e.ScenarioLastClaimState={})).CLAIMED="CLAIMED",Ot.APPROVED="APPROVED",Ot.REJECTED="REJECTED",Ot.EXPIRED="EXPIRED",Ot.CANCELLED="CANCELLED",Ot.RESET="RESET",(jt=e.LinkTypeField||(e.LinkTypeField={})).HARD="HARD",jt.SOFT="SOFT",(Nt=e.BillingPeriodField||(e.BillingPeriodField={})).MONTHLY="MONTHLY",Nt.ANNUAL="ANNUAL",(Ft=e.PlanStateField||(e.PlanStateField={})).TRIALLING="TRIALLING",Ft.ACTIVE="ACTIVE",Ft.CANCELLED="CANCELLED",Ft.EXPIRED="EXPIRED";var Lt,Ut=function(e){var t=window.fetch;return function(n,r){var i=function(){return t(n,r)};if(!r||!r.headers||!r.headers["X-Amz-Target"])return i();var a=r.headers["X-Amz-Target"].split(".");if(a.length<2||"AWSCognitoIdentityProviderService"!==a[0])return i();var o=JSON.parse(r.body);if(o&&o.ClientMetadata&&"true"===o.ClientMetadata.noProxy)return i();var s=!1;if("RespondToAuthChallenge"===a[1]){if(o&&"NEW_PASSWORD_REQUIRED"===o.ChallengeName)return i();s=!0}else"InitiateAuth"===a[1]&&"REFRESH_TOKEN_AUTH"===o.AuthFlow&&(s=!0);return s?t(e+"auth/proxy/",Object.assign(Object.assign({},r),{credentials:"include"})):i()}},xt=function(e,t){var n=e.authUrl,r=e.userPoolId,i=e.userPoolWebClientId;return function(){var e=r.split("_");if(e.length<2)throw new Error("userPoolId should have this format: {aws-region}_xxxxx");window.fetch=Ut(n),t.configure({region:e[0],userPoolId:r,userPoolWebClientId:i,mandatorySignIn:!1})}};(Lt=e.Config||(e.Config={}))[Lt.TIMEOUT=.01]="TIMEOUT",Lt[Lt.IDLE=1200]="IDLE",Lt[Lt.KEEP_ALIVE_INTERVAL=60]="KEEP_ALIVE_INTERVAL";var qt=function(){function t(e,t,n,r,i,a){this.config=e,this.http=t,this.idle=n,this.keepalive=r,this.keyService=i,this.auth=a,this.IDLE_EXPIRY_KEY="ng2Idle.main.expiry",this.IDLING_KEY="ng2Idle.main.idling",this.initCalled=!1}return t.prototype.assertInit=function(){if(!this.initCalled)throw new Z("Call IdleService.init() first.")},t.prototype.init=function(t){return A(this,void 0,void 0,(function(){var n,r=this;return T(this,(function(i){switch(i.label){case 0:if(this.initCalled)throw new Z("IdleService.init() can only be called once. IdleService.start() calls init() with default values if init() has not been called yet.");if(this.initCalled=!0,(t=Object.assign({onTimeout:null,onKeepalive:null,idleSec:e.Config.IDLE,timeoutSec:e.Config.TIMEOUT,keepAliveIntervalSec:e.Config.KEEP_ALIVE_INTERVAL},t)).timeoutSec<.01)throw new Q("Minimum value for IdleService.init({ timeoutSec }) is 0.01");return this.onTimeout=t.onTimeout,this.onKeepalive=t.onKeepalive,this.idle.setIdle(t.idleSec),this.idle.setTimeout(t.timeoutSec),this.idle.setInterrupts(v.DEFAULT_INTERRUPTSOURCES),this.idle.onIdleEnd.subscribe((function(){return console.log("Idle stopped")})),this.idle.onIdleStart.subscribe((function(){return console.log("Idle started")})),this.idle.onTimeout.subscribe((function(){return A(r,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return console.log("Idle timed out"),this.reset(),[4,Promise.resolve(this.onTimeout&&this.onTimeout({onInit:!1}))];case 1:return e.sent(),[2]}}))}))})),this.idle.onTimeoutWarning.subscribe((function(e){return console.log("Will timeout in "+e+" seconds!")})),this.keepalive.interval(t.keepAliveIntervalSec),console.log("Keep alive interval set at: "+e.Config.KEEP_ALIVE_INTERVAL+" seconds"),this.keepalive.onPing.subscribe((function(){return r.onPing()})),(n=localStorage.getItem(this.IDLE_EXPIRY_KEY))&&parseInt(n,10)+1e3*this.idle.getTimeout()<Date.now()?(this.reset(),[4,Promise.resolve(this.onTimeout&&this.onTimeout({onInit:!0}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.keepalivePost=function(){return A(this,void 0,void 0,(function(){var e,t,n;return T(this,(function(r){switch(r.label){case 0:return t=(e=this.http).post,n=[this.config.authUrl+"auth/keepalive/",null],[4,Ie(this.auth,this.config)];case 1:return[4,t.apply(e,n.concat([r.sent()])).toPromise()];case 2:return[2,{keepaliveResult:r.sent(),expiresAfterSeconds:this.idle.getIdle()+this.idle.getTimeout()+this.keepalive.interval()}]}}))}))},t.prototype.persistMasterKey=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.keepalivePost()];case 1:return t=n.sent().expiresAfterSeconds,[4,this.keyService.persistMasterKey(e,t)];case 2:return n.sent(),[2]}}))}))},t.prototype.onPing=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return console.log("Keep alive triggered at time: "+Date.now()+". Interval set at: "+this.keepalive.interval()+" seconds"),[4,this.keepalivePost()];case 1:return e=t.sent().expiresAfterSeconds,[4,this.keyService.setMasterKeyExpiresAfterSeconds(e)];case 2:return t.sent(),[4,Promise.resolve(this.onKeepalive&&this.onKeepalive())];case 3:return t.sent(),[2]}}))}))},t.prototype.start=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.initCalled?[3,2]:[4,this.init()];case 1:e.sent(),e.label=2;case 2:return this.idle.isRunning()?[2]:[4,this.onPing()];case 3:return e.sent(),this.idle.watch(),[2]}}))}))},t.prototype.stop=function(){this.idle.stop(),this.reset()},t.prototype.reset=function(){localStorage.removeItem(this.IDLE_EXPIRY_KEY),localStorage.removeItem(this.IDLING_KEY)},t}();qt.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new qt(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(v.Idle),t.ɵɵinject(m.Keepalive),t.ɵɵinject(Ke),t.ɵɵinject(o.AuthClass))},token:qt,providedIn:"root"}),qt.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],qt.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:v.Idle},{type:m.Keepalive},{type:Ke},{type:o.AuthClass}]};var Jt,Gt,Qt,Vt,Bt,Wt,Zt,Ht="\nid\npublicData\npublicSearchable\ncipherData\nkey {\n id\n}\n",Yt=(K.default(Jt||(Jt=F(["\nquery ContactCardQuery(\n$id: LrRelayIdInput!\n) {\ncontactCard (\n id: $id\n) {\n ","\n}\n","\n}"],["\nquery ContactCardQuery(\n$id: LrRelayIdInput!\n) {\ncontactCard (\n id: $id\n) {\n ","\n}\n","\n}"])),Ht,Ge),K.default(Gt||(Gt=F(['\nquery SearchContactCardQuery(\n $publicSearchable: LrJSONFilter!\n) {\n searchContactCards(\n publicSearchable: $publicSearchable\n orderBy: "created"\n ) {\n edges {\n node {\n ',"\n }\n }\n }\n ","\n}"],['\nquery SearchContactCardQuery(\n $publicSearchable: LrJSONFilter!\n) {\n searchContactCards(\n publicSearchable: $publicSearchable\n orderBy: "created"\n ) {\n edges {\n node {\n ',"\n }\n }\n }\n ","\n}"])),Ht,Ge),K.default(Qt||(Qt=F(['\nquery ContactCardListQuery {\n contactCards(\n orderBy: "created"\n ) {\n edges {\n node {\n ',"\n }\n }\n }\n ","\n}"],['\nquery ContactCardListQuery {\n contactCards(\n orderBy: "created"\n ) {\n edges {\n node {\n ',"\n }\n }\n }\n ","\n}"])),Ht,Ge)),Xt=(K.default(Vt||(Vt=F(["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n ","\n }\n }\n}"],["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n ","\n }\n }\n}"])),Ht),K.default(Bt||(Bt=F(["\nmutation UpdateContactCardMutation(\n $input: UpdateContactCardInput!\n) {\n updateContactCard(input: $input) {\n contactCard {\n ","\n }\n }\n}"],["\nmutation UpdateContactCardMutation(\n $input: UpdateContactCardInput!\n) {\n updateContactCard(input: $input) {\n contactCard {\n ","\n }\n }\n}"])),Ht),K.default(Wt||(Wt=F(["\n mutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n }\n"],["\n mutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n }\n"])))),zt=Oe(Zt||(Zt=F(["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"],["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"]))),en=function(){function e(e,t,n,r,i){this.encryptionService=e,this.keyGraph=t,this.lrApollo=n,this.keyService=r,this.keyFactory=i}return e.prototype.decryptMeta=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return e.cipherMeta?[4,this.keyGraph.getJwkKey(e.keyId)]:[3,3];case 1:return t=n.sent(),[4,this.encryptionService.decrypt(t,JSON.parse(e.cipherMeta))];case 2:return[2,n.sent()];case 3:return[2,null]}}))}))},e.prototype.doubleWrapContent=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d;return T(this,(function(l){switch(l.label){case 0:return[4,this.keyFactory.createKey()];case 1:return r=l.sent(),[4,this.wrapContent(r.toJSON(!0),t)];case 2:return i=l.sent(),a={rootKey:i.rootKey,wrappedKeys:i.wrappedKeys,doubleWrappedKey:i.cipherMeta},e?(u=(s=JSON).stringify,[4,this.encryptionService.encrypt(r,e)]):[3,4];case 3:return o=u.apply(s,[l.sent()]),[3,5];case 4:o=null,l.label=5;case 5:return a.cipherMeta=o,n?(d=(p=JSON).stringify,[4,this.encryptionService.encrypt(r,n)]):[3,7];case 6:return c=d.apply(p,[l.sent()]),[3,8];case 7:c=null,l.label=8;case 8:return[2,(a.cipherFileContent=c,a)]}}))}))},e.prototype.reWrapContent=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return[4,this.keyGraph.getJwkKey(e)];case 1:return n=p.sent(),[4,this.keyFactory.createKey()];case 2:return r=p.sent(),i={},o=(a=JSON).stringify,[4,this.encryptionService.encrypt(n,r.toJSON(!0))];case 3:return i.doubleWrappedKey=o.apply(a,[p.sent()]),t?(c=(u=JSON).stringify,[4,this.encryptionService.encrypt(r,t)]):[3,5];case 4:return s=c.apply(u,[p.sent()]),[3,6];case 5:s=null,p.label=6;case 6:return[2,(i.cipherMeta=s,i)]}}))}))},e.prototype.wrapContent=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l,h=this;return T(this,(function(y){switch(y.label){case 0:return[4,this.keyFactory.createKey()];case 1:return n=y.sent(),t&&t.length?[4,Promise.all(t.map((function(e){return A(h,void 0,void 0,(function(){var t,r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.getDirectoryKeyId(e)];case 1:return t=o.sent(),a=(i=JSON).stringify,[4,this.encryptionService.encrypt(t.key,n.toJSON(!0))];case 2:return r=a.apply(i,[o.sent()]),[2,{directoryId:e,wrappingKeyId:t.keyId,wrappedKey:r}]}}))}))})))]:[3,3];case 2:return r=y.sent(),[3,5];case 3:return a=this.keyService.currentRootKey,u=(s=JSON).stringify,[4,this.encryptionService.encrypt(a.jwk,n.toJSON(!0))];case 4:o=u.apply(s,[y.sent()]),i={wrappingKeyId:a.id,wrappedKey:o},y.label=5;case 5:return c={key:n,rootKey:i,wrappedKeys:r},e?(l=(d=JSON).stringify,[4,this.encryptionService.encrypt(n,e)]):[3,7];case 6:return p=l.apply(d,[y.sent()]),[3,8];case 7:p=null,y.label=8;case 8:return[2,(c.cipherMeta=p,c)]}}))}))},e.prototype.wrapContentWithKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s;return T(this,(function(u){switch(u.label){case 0:return[4,this.keyFactory.createKey()];case 1:return n=u.sent(),[4,this.keyGraph.encryptToString(t,n.toJSON(!0))];case 2:return r=u.sent(),i={key:n,rootKey:{wrappingKeyId:t,wrappedKey:r}},e?(s=(o=JSON).stringify,[4,this.encryptionService.encrypt(n,e)]):[3,4];case 3:return a=s.apply(o,[u.sent()]),[3,5];case 4:a=null,u.label=5;case 5:return[2,(i.cipherMeta=a,i)]}}))}))},e.prototype.getDirectoryKeyId=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.lrApollo.query({query:zt,variables:{id:e}})];case 1:return t=r.sent().directory,n={keyId:t.keyId},[4,this.keyGraph.getJwkKey(t.keyId)];case 2:return[2,(n.key=r.sent(),n)]}}))}))},e}();en.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new en(t.ɵɵinject(ve),t.ɵɵinject(Pe),t.ɵɵinject(ke),t.ɵɵinject(Ke),t.ɵɵinject(ge))},token:en,providedIn:"root"}),en.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],en.ctorParameters=function(){return[{type:ve},{type:Pe},{type:ke},{type:Ke},{type:ge}]};var tn,nn,rn,an,on,sn,un,cn,pn,dn="\n id\n token\n state\n mode\n isInitiator\n initiator {\n id\n username\n config\n }\n responder {\n id\n username\n }\n created\n modified\n tokenExpiryTime\n isExpired\n initiatorRootKeyCipher\n initiatorActionRequired\n responderActionRequired\n responderEmailAddress\n otk {\n state\n otKeyParams\n otKeyCipher\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n initiatorSigPxk {\n id\n }\n responderSigPxk {\n id\n }\n initiatorOneTimePbkCipher\n responderPbkCipher\n }\n",ln="\n userSigPrk {\n id\n }\n otherSigPbk {\n id\n }\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n pbk\n }\n mkReshareRequestCipher\n mkReshareResponseCipher\n mkReshareRequestSent\n mkReshareResponseSent\n",hn=Oe(tn||(tn=F(["\nquery KeyExchangesQuery2($state: String) {\n keyExchanges(state: $state) {\n edges {\n node {\n ","\n }\n }\n }\n}\n"],["\nquery KeyExchangesQuery2($state: String) {\n keyExchanges(state: $state) {\n edges {\n node {\n ","\n }\n }\n }\n}\n"])),dn),yn=Oe(nn||(nn=F(["\nquery KeyExchangeQuery2($id: LrRelayIdInput!) {\n keyExchange(id: $id) {\n ","\n }\n}\n"],["\nquery KeyExchangeQuery2($id: LrRelayIdInput!) {\n keyExchange(id: $id) {\n ","\n }\n}\n"])),dn),fn=Oe(rn||(rn=F(["\nquery KeyExchangeTokenQuery2($id: LrRelayIdInput!, $token: String) {\n keyExchange(id: $id, token: $token) {\n ","\n }\n}\n"],["\nquery KeyExchangeTokenQuery2($id: LrRelayIdInput!, $token: String) {\n keyExchange(id: $id, token: $token) {\n ","\n }\n}\n"])),dn),vn=Oe(an||(an=F(["\nmutation CancelKeyExchangeMutation($input: CancelKeyExchangeInput!) {\n cancelKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"],["\nmutation CancelKeyExchangeMutation($input: CancelKeyExchangeInput!) {\n cancelKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"]))),mn=Oe(on||(on=F(["\nmutation DeclineKeyExchangeMutation($input: DeclineKeyExchangeInput!) {\n declineKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"],["\nmutation DeclineKeyExchangeMutation($input: DeclineKeyExchangeInput!) {\n declineKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"]))),gn=Oe(sn||(sn=F(["\nmutation InitiateKeyExchangeOtkMutation(\n $input: InitiateKeyExchangeOtkInput!\n) {\n initiateKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n }\n}\n"],["\nmutation InitiateKeyExchangeOtkMutation(\n $input: InitiateKeyExchangeOtkInput!\n) {\n initiateKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n }\n}\n"])),dn),Sn=Oe(un||(un=F(["\nmutation RespondKeyExchangeOtkMutation($input: RespondKeyExchangeOtkInput!) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n userSharedKey {\n ","\n }\n tp {\n id\n user {\n config\n }\n }\n }\n}\n"],["\nmutation RespondKeyExchangeOtkMutation($input: RespondKeyExchangeOtkInput!) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n userSharedKey {\n ","\n }\n tp {\n id\n user {\n config\n }\n }\n }\n}\n"])),dn,ln),Cn=Oe(cn||(cn=F(["\nmutation CompleteKeyExchangeOtkMutation(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n userSharedKey {\n ","\n }\n tp {\n id\n user {\n config\n }\n }\n }\n}\n"],["\nmutation CompleteKeyExchangeOtkMutation(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n userSharedKey {\n ","\n }\n tp {\n id\n user {\n config\n }\n }\n }\n}\n"])),dn,ln),In=Oe(pn||(pn=F(["\nquery CurrentUserSharedKeyQuery2(\n $username: String\n $userId: LrRelayIdInput\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ","\n }\n }\n}\n"],["\nquery CurrentUserSharedKeyQuery2(\n $username: String\n $userId: LrRelayIdInput\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ","\n }\n }\n}\n"])),ln);(e.FeatureAction||(e.FeatureAction={})).ACCESS="access";var bn,wn=function(){},Kn=function(){},Pn=function(){},kn=function(){},Dn=function(e){this.name=e.name,this.title=e.title,this.firstName=e.firstName,this.lastName=e.lastName},Rn=function(){},En=function(){},Mn=function(){},An=function(){},Tn=function(){},On=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return R(t,e),t}(Tn),jn=function(){},Nn=function(){};(bn=e.TrustedPartyType||(e.TrustedPartyType={})).User="user",bn.Organisation="organisation";var Fn,$n=function(){},_n="\n id\n owner {\n id\n username\n }\n ownerKey {\n id\n }\n ownerCipherData\n receiver {\n id\n username\n }\n receiverKey {\n id\n }\n receiverCipherData\n sharedKey {\n id\n }\n sharedCipherData\n sharedCipherDataSig\n sharedCipherDataSigPxk {\n id\n }\n",Ln=K.default(Fn||(Fn=F(["\nmutation UpdateOwnedContactCard(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(\n input: $input\n ) {\n ownedContactCard {\n ","\n }\n }\n}"],["\nmutation UpdateOwnedContactCard(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(\n input: $input\n ) {\n ownedContactCard {\n ","\n }\n }\n}"])),_n),Un=function(){function e(e,t,n,r){this.keyService=e,this.lrApollo=t,this.keyGraph=n,this.encryptionService=r}return e.prototype.decryptSharedTrustedPartyDetails=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.decryptTrustedPartyDetails(e)];case 1:return t=n.sent(),[2,Object.assign({id:e.id,ownedKeyId:e.ownerKey.id,sharedKeyId:e.sharedKey.id},t)]}}))}))},e.prototype.decryptTrustedPartyDetails=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:if(!(e&&e.sharedKey&&e.sharedCipherData))return[3,5];i.label=1;case 1:return i.trys.push([1,4,,5]),n=(t=this.encryptionService).decrypt,[4,this.keyGraph.getJwkKey(e.sharedKey.id)];case 2:return[4,n.apply(t,[i.sent(),e.sharedCipherData])];case 3:return[2,i.sent()];case 4:return r=i.sent(),console.error("Cannot decrypt trusted party details",r),[3,5];case 5:return[2,null]}}))}))},e.prototype.updateMySharedContactCard=function(e,t,n,r){return A(this,void 0,void 0,(function(){var i,a,o,s,u,c,p,d,l,h,y;return T(this,(function(f){switch(f.label){case 0:return[4,this.keyGraph.getKey(t)];case 1:return i=f.sent(),[4,this.keyGraph.getKey(n)];case 2:return a=f.sent(),o=this.keyService.currentSigPxk,[4,this.encryptionService.encrypt(a.jwk,r)];case 3:return s=f.sent(),p=(c=JSON).stringify,[4,this.encryptionService.sign(o.jwk,s)];case 4:return u=p.apply(c,[f.sent()]),d={name:new Dn(r.name)},y=(h=JSON).stringify,[4,this.encryptionService.sign(o.jwk,d)];case 5:return l=y.apply(h,[f.sent()]),[4,this.lrApollo.mutate({mutation:Ln,variables:{input:{id:e,ownerCipherData:"",ownerKeyId:i.id,sharedCipherDataSig:u,sharedKeyId:a.id,sigPxkId:o.id,ownerPlainDataSig:l}}})];case 6:return f.sent(),[2]}}))}))},e}();Un.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Un(t.ɵɵinject(Ke),t.ɵɵinject(ke),t.ɵɵinject(Pe),t.ɵɵinject(ve))},token:Un,providedIn:"root"}),Un.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Un.ctorParameters=function(){return[{type:Ke},{type:ke},{type:Pe},{type:ve}]};var xn,qn,Jn,Gn,Qn,Vn="\n id\n user {\n id\n username\n }\n other{\n id\n username,\n features {\n shareVault\n }\n }\n sharedContactCard {\n "+_n+"\n }\n myContactCard {\n "+_n+"\n }\n sharedScenarios {\n edges {\n node {\n id\n }\n }\n }\n theirItems {\n directories {\n edges {\n node {\n id\n }\n }\n }\n }\n currentUserSharedKey {\n userSharedKey {\n keyExchange {\n "+dn+"\n }\n "+ln+"\n }\n }",Bn=K.default(xn||(xn=F(['\n query {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n userDelete {\n id\n created\n state\n }\n features {\n myVault\n tpVault\n shareVault\n }\n sessionEncryptionKey\n dateJoined\n }\n userPlans {\n id\n stripe {\n subscriptionId\n }\n plan {\n name\n data\n state\n }\n periodEnd\n }\n contactCards(orderBy: "created") {\n edges {\n node {\n id\n key {\n id\n }\n cipherData\n plainData\n }\n }\n }\n keyGraph {\n ...KeyGraphFragment\n }\n }\n ',"\n"],['\n query {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n userDelete {\n id\n created\n state\n }\n features {\n myVault\n tpVault\n shareVault\n }\n sessionEncryptionKey\n dateJoined\n }\n userPlans {\n id\n stripe {\n subscriptionId\n }\n plan {\n name\n data\n state\n }\n periodEnd\n }\n contactCards(orderBy: "created") {\n edges {\n node {\n id\n key {\n id\n }\n cipherData\n plainData\n }\n }\n }\n keyGraph {\n ...KeyGraphFragment\n }\n }\n ',"\n"])),Je),Wn=K.default(qn||(qn=F(["\n mutation CreateContactCardMutation($input: CreateContactCardInput!) {\n createContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"],["\n mutation CreateContactCardMutation($input: CreateContactCardInput!) {\n createContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"]))),Zn=K.default(Jn||(Jn=F(["\n mutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"],["\n mutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"]))),Hn=Oe(Gn||(Gn=F(["\nquery TrustedPartiesQuery {\n tps {\n edges {\n node {\n ","\n }\n }\n }\n}"],["\nquery TrustedPartiesQuery {\n tps {\n edges {\n node {\n ","\n }\n }\n }\n}"])),Vn),Yn=Oe(Qn||(Qn=F(['\nquery ContactCardsQuery {\n contactCards(orderBy: "created") {\n edges {\n node {\n id\n cipherData\n key {\n id\n }\n }\n }\n }\n}\n'],['\nquery ContactCardsQuery {\n contactCards(orderBy: "created") {\n edges {\n node {\n id\n cipherData\n key {\n id\n }\n }\n }\n }\n}\n']))),Xn=function(){function e(e,t,n,r,i,a,o){this.config=e,this.http=t,this.lrApollo=n,this.keyService=r,this.keyMetaService=i,this.keyGraph=a,this.encryptionService=o}return e.prototype.getCurrentUser=function(){return A(this,void 0,void 0,(function(){var e,t,n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.lrApollo.query({query:Bn})];case 1:return e=i.sent(),t=e.currentUser,n=e.contactCards,r=n.edges.map((function(e){return e.node}))[0],[2,{currentUser:t,contactCard:r}]}}))}))},e.prototype.decryptContactCard=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return e?[4,this.keyGraph.decryptFromString(e.key.id,e.cipherData)]:[2,null];case 1:return t=n.sent(),[2,Object.assign({id:e.id,keyId:e.key.id},t)]}}))}))},e.prototype.updateDetails=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,e?this.updateContactCard(e,t,n):this.createContactCard(n)];case 1:return r=i.sent(),[2,{fields:n,id:r.id,keyId:r.key.id}]}}))}))},e.prototype.prepareContactCardInput=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d;return T(this,(function(l){switch(l.label){case 0:return t=this.keyService.currentSigPxk,i=(r=JSON).stringify,[4,this.encryptionService.sign(t.jwk,"")];case 1:return n=i.apply(r,[l.sent()]),s=(o=JSON).stringify,[4,this.encryptionService.sign(t.jwk,"")];case 2:return a=s.apply(o,[l.sent()]),u={name:new Dn(e.name.value)},d=(p=JSON).stringify,[4,this.encryptionService.sign(t.jwk,u)];case 3:return c=d.apply(p,[l.sent()]),[2,{sigPxkId:t.id,publicDataSig:n,publicSearchableSig:a,plainDataSig:c}]}}))}))},e.prototype.createContactCard=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.prepareContactCardInput(e)];case 1:return t=a.sent(),[4,this.keyMetaService.wrapContent(e)];case 2:return n=a.sent(),r=n.rootKey,i=n.cipherMeta,[4,this.lrApollo.mutate({mutation:Wn,variables:{input:Object.assign(Object.assign({},t),{cipherData:i,wrappingKeyId:r.wrappingKeyId,wrappedKey:r.wrappedKey,default:!0})}})];case 3:return[2,a.sent().createContactCard.contactCard]}}))}))},e.prototype.updateContactCard=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.prepareContactCardInput(n)];case 1:return r=a.sent(),[4,this.keyGraph.encryptToString(t,n)];case 2:return i=a.sent(),[4,this.lrApollo.mutate({mutation:Zn,variables:{input:Object.assign(Object.assign({},r),{id:e,cipherData:i})}})];case 3:return[2,a.sent().updateContactCard.contactCard]}}))}))},e.prototype.decryptContactCardEdges=function(e){return A(this,void 0,void 0,(function(){var t=this;return T(this,(function(n){return[2,Promise.all(e.map((function(e){return A(t,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return t=e.node,[4,this.decryptContactCard(t)];case 1:return[2,n.sent()]}}))}))})))]}))}))},e.prototype.getContactCards=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return[4,this.lrApollo.query({query:Yt})];case 1:return e=t.sent(),[4,this.decryptContactCardEdges(e.contactCards.edges)];case 2:return[2,t.sent()]}}))}))},e.prototype.deleteContactCard=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.lrApollo.mutate({mutation:Xt,variables:{input:{id:e}}})];case 1:return[2,t.sent().deleteContactCard.id]}}))}))},e.prototype.signOut=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.http.post(this.config.authUrl+"auth/sign-out/",null,{withCredentials:!0,responseType:"text"}).toPromise()];case 1:return e.sent(),[2]}}))}))},e}();Xn.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Xn(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(ke),t.ɵɵinject(Ke),t.ɵɵinject(en),t.ɵɵinject(Pe),t.ɵɵinject(ve))},token:Xn,providedIn:"root"}),Xn.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Xn.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:ke},{type:Ke},{type:en},{type:Pe},{type:ve}]};var zn,er,tr,nr=K.default(zn||(zn=F(["\n mutation {\n passwordChangeRequest(input: {}) {\n challenge\n }\n }\n"],["\n mutation {\n passwordChangeRequest(input: {}) {\n challenge\n }\n }\n"]))),rr=K.default(er||(er=F(["\n mutation PasswordChange($input: PasswordChangeInput!) {\n passwordChange(input: $input) {\n token\n newPassKey {\n id\n }\n }\n }\n"],["\n mutation PasswordChange($input: PasswordChangeInput!) {\n passwordChange(input: $input) {\n token\n newPassKey {\n id\n }\n }\n }\n"]))),ir=K.default(tr||(tr=F(["\n query PasswordChangeConfigQuery {\n passwordChangeConfig {\n maxAuthAgeSeconds\n authTime\n serverTime\n }\n }\n"],["\n query PasswordChangeConfigQuery {\n passwordChangeConfig {\n maxAuthAgeSeconds\n authTime\n serverTime\n }\n }\n"]))),ar=P,or=function(){},sr=function(){function e(e,t,n,r,i,a,o,s,u){this.config=e,this.http=t,this.apollo=n,this.auth=r,this.profileService=i,this.keyFactory=a,this.encryptionService=o,this.keyGraph=s,this.webCryptoService=u,this.CLIENT_NONCE_LENGTH=32}return e.prototype.checkPassword=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=this.passwordStrength(e).years,n={length:e.length,timeToCrack:ar.duration({years:t})},[4,this.getExposureCount(e)];case 1:return[2,(n.passwordExposed=r.sent(),n)]}}))}))},e.prototype.getExposureCount=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.webCryptoService.stringDigest("SHA-1",e)];case 1:return t=a.sent(),n=t.substring(0,5),[4,this.http.get("https://api.pwnedpasswords.com/range/"+n,{responseType:"text"}).toPromise()];case 2:return r=a.sent(),(i=new RegExp("^(?:"+t.substring(5)+":)(?<count>\\d+)$","im").exec(r))?[2,+i.groups.count]:[2,0]}}))}))},e.prototype.getPassIdpString=function(e){return e.toJSON(!0).k},e.prototype.createPassKeyBundle=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.keyFactory.createPassIdpParams()];case 1:return t=s.sent(),[4,this.keyFactory.derivePassIdp(Object.assign({password:e},t))];case 2:return n=s.sent().jwk,[4,this.keyFactory.createPassKeyParams()];case 3:return r=s.sent(),[4,this.keyFactory.derivePassKey(Object.assign({password:e},r))];case 4:return i=s.sent().jwk,[4,this.keyFactory.createPkcSignKey()];case 5:return a=s.sent(),[4,this.encryptionService.encrypt(i,a.toJSON(!0))];case 6:return o=s.sent(),[2,{passKeyParams:r,passKey:i,passIdpParams:t,passIdp:n,passIdpVerifier:a,wrappedPassIdpVerifierPrk:o}]}}))}))},e.prototype.isLoginRequired=function(){return A(this,void 0,void 0,(function(){var e,t,n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.getChangePasswordConfig()];case 1:return e=i.sent(),t=ar(e.authTime),n=ar(e.serverTime),r=ar.duration(n.diff(t)),r.asSeconds()>e.maxAuthAgeSeconds?[2,!0]:[2,!1]}}))}))},e.prototype.changePassword=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return n=d.sent(),[4,this.profileService.getCurrentUser()];case 2:return r=d.sent().currentUser,[4,this.verifyPassword(e,r)];case 3:return i=d.sent(),a=i.passIdp,o=i.signedChallenge,[4,this.createPassKeyBundle(t)];case 4:return s=d.sent(),[4,this.keyGraph.getKey(r.currentUserKey.masterKey.id)];case 5:return u=d.sent(),[4,this.encryptionService.encrypt(s.passKey,u.jwk.toJSON(!0))];case 6:return c=d.sent(),[4,this.changePasswordMutation(o,r.currentUserKey.masterKey.id,c,s)];case 7:return p=d.sent().token,[4,this.auth.changePassword(n,this.getPassIdpString(a),this.getPassIdpString(s.passIdp))];case 8:return d.sent(),[4,this.changePasswordComplete({useNewPassword:!0,token:p})];case 9:return d.sent(),[2]}}))}))},e.prototype.changePasswordComplete=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return t=e.useNewPassword,n=e.token,i=(r=this.http).post,a=[this.config.authUrl+"users/password-change-complete/",Object.assign({use_new_password:t},n&&{token:n})],[4,Ie(this.auth,this.config)];case 1:return[2,i.apply(r,a.concat([o.sent()])).toPromise()]}}))}))},e.prototype.getVerifierPrK=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.encryptionService.decrypt(e,t)];case 1:return n=r.sent(),[2,ge.asKey(n)];case 2:throw r.sent(),new G("Wrong current password");case 3:return[2]}}))}))},e.prototype.verifyPassword=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.apollo.mutate({mutation:nr,variables:{}})];case 1:return n=s.sent(),[4,this.keyFactory.derivePassKey(Object.assign({password:e},t.currentUserKey.passKey.passKeyParams))];case 2:return r=s.sent(),[4,this.getVerifierPrK(r.jwk,t.currentUserKey.passKey.wrappedPassIdpVerifierPrk)];case 3:return i=s.sent(),a=this.keyFactory.randomString(this.CLIENT_NONCE_LENGTH),[4,this.encryptionService.sign(i,{serverNonce:n.passwordChangeRequest.challenge.serverNonce,clientNonce:a})];case 4:return o=s.sent(),[4,this.keyFactory.derivePassIdp(Object.assign({password:e},t.currentUserKey.passKey.passIdpParams))];case 5:return[2,{passIdp:s.sent().jwk,signedChallenge:o}]}}))}))},e.prototype.changePasswordMutation=function(e,t,n,r){return A(this,void 0,void 0,(function(){var i;return T(this,(function(a){switch(a.label){case 0:return[4,this.apollo.mutate({mutation:rr,variables:{input:{signedChallenge:JSON.stringify(e),masterKeyId:t,newWrappedMasterKey:JSON.stringify(n),newPassKey:{passIdpParams:JSON.stringify(r.passIdpParams),passIdpVerifierPbk:JSON.stringify(r.passIdpVerifier.toJSON()),wrappedPassIdpVerifierPrk:JSON.stringify(r.wrappedPassIdpVerifierPrk),passKeyParams:JSON.stringify(r.passKeyParams)}}}})];case 1:return[2,{token:(i=a.sent()).passwordChange.token,newPassKeyId:i.passwordChange.newPassKey.id}]}}))}))},e.prototype.getChangePasswordConfig=function(){return A(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return[4,this.apollo.query({query:ir})];case 1:return e=n.sent(),(t=e.passwordChangeConfig).authTime=new Date(t.authTime),t.serverTime=new Date(t.serverTime),[2,t]}}))}))},e.prototype.passwordStrength=function(e){function t(e,t){return((e||"").match(t)||[]).length}var n=t(e,/[A-Z]/g),r=t(e,/[a-z]/g),i=t(e,/[0-9]/g),a=0;if(n&&(a+=26),r&&(a+=26),i&&(a+=10),e.length-n-r-i&&(a+=30),0===e.length)return{years:0,bits:0};var o=Math.pow(a,e.length);return{years:54e3*o/Math.pow(62,12),bits:Math.round(Math.log2(o))}},e}();sr.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new sr(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(ke),t.ɵɵinject(o.AuthClass),t.ɵɵinject(Xn),t.ɵɵinject(ge),t.ɵɵinject(ve),t.ɵɵinject(Pe),t.ɵɵinject(me))},token:sr,providedIn:"root"}),sr.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],sr.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:ke},{type:o.AuthClass},{type:Xn},{type:ge},{type:ve},{type:Pe},{type:me}]};var ur="lifeready",cr=function(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=""),this.assembly=e,this.subAssembly=t,this.mnemonics=n},pr=function(){function e(e,t,n){void 0===t&&(t=0),void 0===n&&(n=0),this.index=e,this.threshold=t,this.size=n,this.clearShares()}return e.prototype.clearShares=function(){this.shares=[]},e.prototype.addShare=function(e){this.shares.push(e)},e}(),dr=function(){function e(e){void 0===e&&(e=0),this.threshold=e,this.clearSubAssemblies()}return e.prototype.size=function(){return this.subAssemblies.length},e.prototype.clearSubAssemblies=function(){this.subAssemblies=[]},e.prototype.addSubAssembly=function(e){this.subAssemblies.push(e)},e}(),lr=(function(){function e(e){this.subAssemblyIndex=e,this.clearShares()}e.prototype.clearShares=function(){this.shares=[]},e.prototype.addShare=function(e){this.shares.push(e)}}(),function(){function e(){this.clearSubQuora()}e.prototype.clearSubQuora=function(){this.subQuora=[]},e.prototype.addSubQuorum=function(e){this.subQuora.push(e)},e.prototype.serialiseShares=function(){var e=[];return this.subQuora.forEach((function(t){e=e.concat(t.shares)})),e}}(),function(){function e(){}return e.prototype.generateShares=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:r=btoa(e),r=g.Slip39Helper.slip39EncodeHex(r),i=[];try{for(a=O(n.subAssemblies),o=a.next();!o.done;o=a.next())s=o.value,i.push([s.threshold,s.size])}catch(e){c={error:e}}finally{try{o&&!o.done&&(p=a.return)&&p.call(a)}finally{if(c)throw c.error}}return[4,g.Slip39.fromArray(r,{passphrase:t,threshold:n.threshold,groups:i,title:""})];case 1:return u=d.sent(),n.subAssemblies.forEach((function(e,t){e.clearShares();for(var n=0;n<e.size;n++){var r="r/"+t.toString().padStart(2,"0")+"/"+n.toString().padStart(2,"0"),i=u.fromPath(r).mnemonics[0],a=new cr(t,n,i);e.addShare(a)}})),[2]}}))}))},e.prototype.minimalSet=function(e){var t,n,r,i,a=null,o=new Map;try{for(var s=O(e),u=s.next();!u.done;u=s.next()){var c=u.value,p=g.Slip39Helper.decodeMnemonic(c);if(a&&a!==p.groupThreshold)throw new Error("groupThreshold is different in mnemonics");a=p.groupThreshold,null==(f=o.get(p.groupIndex))&&(f={memberThreshold:p.memberThreshold,members:[]},o.set(p.groupIndex,f)),f.members.push({mnemonic:c,decoded:p})}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}var d=[],l=0;try{for(var h=O(o.values()),y=h.next();!y.done;y=h.next()){var f;if(!((f=y.value).members.length<f.memberThreshold)&&(f.members.slice(0,f.memberThreshold).forEach((function(e){d.push(e.mnemonic)})),++l>=a))break}}catch(e){r={error:e}}finally{try{y&&!y.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return d},e.prototype.recoverSecret=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return e=this.minimalSet(e),[4,g.Slip39.recoverSecret(e,t)];case 1:return n=i.sent(),r=g.Slip39Helper.slip39DecodeHex(n),[2,atob(r)]}}))}))},e}());lr.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new lr},token:lr,providedIn:"root"}),lr.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var hr,yr=Oe(hr||(hr=F(["\nquery TpsKeysQuery($ids: [ID]) {\n tps(id_In: $ids) {\n edges {\n node {\n id\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n }\n }\n }\n }\n }\n}"],["\nquery TpsKeysQuery($ids: [ID]) {\n tps(id_In: $ids) {\n edges {\n node {\n id\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n }\n }\n }\n }\n }\n}"]))),fr=function(){function t(t){this.keyFactory=t.get(ge),this.keyService=t.get(Ke),this.encryptionService=t.get(ve),this.keyGraph=t.get(Pe),this.slip39Service=t.get(lr),this.lrGraphQl=t.get(e.ɵg)}return t.prototype.recoverAssemblyKey=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return n=e.map((function(e){if(t){if(JSON.stringify(t)!==JSON.stringify(e.assemblyKeyParams))throw new Z("The assembly key parameters are different between the approvals.")}else t=e.assemblyKeyParams;return e.slip39.share.mnemonics})),[4,this.slip39Service.recoverSecret(n,this.slip39Passphrase)];case 1:return r=i.sent(),[4,ge.asKey(Object.assign(Object.assign({},t),{k:r}))];case 2:return[2,i.sent()]}}))}))},t.prototype.prepareTpWrappingKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.keyGraph.getKey(e.wrappingKeyId)]}))}))},t.prototype.prepareAssembly=function(e){var t=e.subjectKey,n=e.rootKey;return A(this,void 0,void 0,(function(){var e,r,i,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:return[4,this.keyFactory.createKey()];case 1:return e=d.sent(),r=e.toJSON(!0),i=r.k,a=E(r,["k"]),[4,this.keyFactory.createPkcSignKey()];case 2:return o=d.sent(),[4,this.encryptionService.encryptToString(e,o.toJSON(!0))];case 3:return s=d.sent(),u=JSON.stringify(o.toJSON()),[4,this.encryptionService.encryptToString(t,e.toJSON(!0))];case 4:return c=d.sent(),[4,this.encryptionService.encryptToString(e,{rootKey:n.toJSON(!0)})];case 5:return p=d.sent(),[2,{assemblyKey:e,rawAssemblyKey:i,assemblyKeyParams:a,subjectKeyWrappedAssemblyKey:c,assemblyCipherData:p,assemblyKeyVerifierPbk:u,wrappedAssemblyKeyVerifierPrk:s}]}}))}))},t.prototype.prepareCreateSubAssemblies=function(e){var t=e.input,n=e.subjectKey,r=e.slipSubAssemblies,i=e.assemblyKeyParams;return A(this,void 0,void 0,(function(){var e=this;return T(this,(function(a){return[2,Promise.all(t.map((function(t,a){return A(e,void 0,void 0,(function(){var e,o,s=this;return T(this,(function(u){switch(u.label){case 0:return[4,this.encryptionService.encryptToString(n,t.subjectCipherDataClearJson||"")];case 1:return e=u.sent(),[4,Promise.all(t.approverTps.map((function(e,t){return A(s,void 0,void 0,(function(){return T(this,(function(o){return[2,this.prepareApprover({tp:e,approverIndex:t,slipSubAssembly:r[a],assemblyKeyParams:i,subjectKey:n})]}))}))})))];case 2:return o=u.sent(),[2,{singleReject:t.singleReject,quorum:t.quorum,subjectCipherData:e,createApprovers:o}]}}))}))})))]}))}))},t.prototype.prepareUpdateSubAssemblies=function(e){var t=e.input,n=e.subjectKey,r=e.slipSubAssemblies,i=e.assemblyKeyParams,a=e.subAssemblies;return A(this,void 0,void 0,(function(){var e=this;return T(this,(function(o){if(r.length!==t.length)throw new Q("The slipSubAssemblies must be the same length as the input");return[2,Promise.all(t.map((function(t,o){return A(e,void 0,void 0,(function(){var e,s,u,c,p,d,l=this;return T(this,(function(h){switch(h.label){case 0:return[4,this.encryptionService.encryptToString(n,t.subjectCipherDataClearJson||"")];case 1:return e=h.sent(),s=a.edges.find((function(e){return e.node.id===t.id})).node,u=[],c=[],t.approverTps.forEach((function(e){var t,n=null===(t=s.approvers.edges.find((function(t){return t.node.tp.id===e.tpId})))||void 0===t?void 0:t.node;n?c.push({tp:e,approverId:n.id}):u.push({tp:e})})),p=r[o],d={subAssemblyId:t.id,singleReject:t.singleReject,quorum:t.quorum,subjectCipherData:e},[4,Promise.all(u.map((function(e,t){var r=e.tp;return A(l,void 0,void 0,(function(){return T(this,(function(e){return[2,this.prepareApprover({tp:r,approverIndex:t,slipSubAssembly:p,assemblyKeyParams:i,subjectKey:n})]}))}))})))];case 2:return d.createApprovers=h.sent(),[4,Promise.all(c.map((function(e,t){var r=e.tp,a=e.approverId;return A(l,void 0,void 0,(function(){return T(this,(function(e){return[2,this.prepareApprover({approverId:a,tp:r,approverIndex:t+u.length,slipSubAssembly:p,assemblyKeyParams:i,subjectKey:n})]}))}))})))];case 3:return[2,(d.updateApprovers=h.sent(),d)]}}))}))})))]}))}))},t.prototype.fillWrappingKeyId=function(e,t){var n=this;e.forEach((function(e){e.approverTps.forEach((function(e){if(!e.wrappingKeyId){var r=t.find((function(t){return t.id===e.tpId}));e.wrappingKeyId=n.getTpWrappingKeyId(r)}}))}))},t.prototype.getInputApprovers=function(e){var t=[];return e.forEach((function(e){e.approverTps.forEach((function(e){t.push(e.tpId)}))})),t},t.prototype.prepareCreate=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d,l,h,y;return T(this,(function(f){switch(f.label){case 0:return t=this.keyService.currentRootKey,[4,this.keyFactory.createKey()];case 1:return n=f.sent(),[4,this.keyGraph.wrapKey(t,n)];case 2:return r=f.sent(),[4,this.prepareAssembly({rootKey:t.jwk,subjectKey:n})];case 3:return i=f.sent(),a=i.assemblyKey,o=i.rawAssemblyKey,s=i.assemblyKeyParams,u=E(i,["assemblyKey","rawAssemblyKey","assemblyKeyParams"]),[4,this.prepareSlip39(e.createSubAssemblies,e.quorum,o)];case 4:return c=f.sent(),p=this.getInputApprovers(e.createSubAssemblies),l=_t,[4,this.lrGraphQl.query({query:yr,variables:{ids:p}})];case 5:return d=l.apply(void 0,[f.sent().tps]),this.fillWrappingKeyId(e.createSubAssemblies,d),[4,this.prepareCreateSubAssemblies({input:e.createSubAssemblies,assemblyKeyParams:s,slipSubAssemblies:c.subAssemblies,subjectKey:n})];case 6:return h=f.sent(),[4,this.encryptionService.encryptToString(n,e.subjectCipherDataClearJson||"")];case 7:return y=f.sent(),[2,{assemblyKey:a,mutationInput:Object.assign(Object.assign({},u),{singleReject:e.singleReject,quorum:e.quorum,subjectCipherData:y,createSubAssemblies:h,rootKeyId:t.id,rootKeyWrappedSubjectKey:r})}]}}))}))},t.prototype.getAssemblyApprovers=function(e){var t=[];return _t(e.subAssemblies).map((function(e){_t(e.approvers).forEach((function(e){return t.push(e.tp.id)}))})),t},t.prototype.prepareUpdate=function(e,t){var n;return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,g,S,C,I;return T(this,(function(b){switch(b.label){case 0:if(e=Object.assign({createSubAssemblies:[]},e),r=e.createSubAssemblies||[],i=e.updateSubAssemblies||[],a=e.deleteSubAssemblies||[],0===r.length&&0===i.length&&0===a.length)throw new Q("Must specify at least one of: [createSubAssemblies, updateSubAssemblies, deleteSubAssemblies]");return o=this.keyService.currentRootKey,[4,this.keyGraph.getKey(t.subjectKey.id)];case 1:return s=b.sent(),[4,this.prepareAssembly({rootKey:o.jwk,subjectKey:s.jwk})];case 2:return u=b.sent(),c=u.assemblyKey,p=u.rawAssemblyKey,d=u.assemblyKeyParams,l=E(u,["assemblyKey","rawAssemblyKey","assemblyKeyParams"]),h=this.getAssemblyApprovers(t).concat(this.getInputApprovers(r),this.getInputApprovers(i)),f=_t,[4,this.lrGraphQl.query({query:yr,variables:{ids:h}})];case 3:y=f.apply(void 0,[b.sent().tps]),_t(t.subAssemblies).forEach((function(e){if(!a.includes(e.id)&&!i.some((function(t){return t.id===e.id}))){var t=_t(e.approvers).map((function(e){return{tpId:e.tp.id,sharedCipherDataClearJson:e.sharedCipherDataClearJson,sharedCipherApprovalDataClearJson:e.sharedCipherApprovalDataClearJson}}));i.push({id:e.id,quorum:e.quorum,singleReject:e.singleReject,approverTps:t,subjectCipherDataClearJson:e.subjectCipherDataClearJson})}})),this.fillWrappingKeyId(r,y),this.fillWrappingKeyId(i,y),b.label=4;case 4:return b.trys.push([4,6,,7]),[4,this.prepareSlip39((r||[]).concat(i||[]),e.quorum,p)];case 5:return v=b.sent(),[3,7];case 6:return m=b.sent(),console.log("Error while creating slip assembly",m),[3,7];case 7:return g={assemblyKeyParams:d,subjectKey:s.jwk},[4,this.prepareCreateSubAssemblies(Object.assign(Object.assign({},g),{input:r,slipSubAssemblies:v.subAssemblies.slice(0,r.length)}))];case 8:return S=b.sent(),[4,this.prepareUpdateSubAssemblies(Object.assign(Object.assign({},g),{input:i,slipSubAssemblies:v.subAssemblies.slice(r.length),subAssemblies:t.subAssemblies}))];case 9:return C=b.sent(),[4,this.encryptionService.encryptToString(s.jwk,null!==(n=e.subjectCipherDataClearJson)&&void 0!==n?n:t.subjectCipherDataClearJson)];case 10:return I=b.sent(),[2,{assemblyKey:c,mutationInput:Object.assign(Object.assign({},l),{singleReject:e.singleReject,quorum:e.quorum,subjectCipherData:I,subjectKeyId:s.id,createSubAssemblies:S,updateSubAssemblies:C})}]}}))}))},t.prototype.prepareApprover=function(e){var t=e.approverId,n=e.tp,r=e.approverIndex,i=e.slipSubAssembly,a=e.assemblyKeyParams,o=e.subjectKey;return A(this,void 0,void 0,(function(){var e,s,u,c,p,d,l,h,y;return T(this,(function(f){switch(f.label){case 0:return[4,this.prepareTpWrappingKey(n)];case 1:return e=f.sent(),[4,this.keyFactory.createKey()];case 2:return s=f.sent(),[4,this.encryptionService.encryptToString(e.jwk,s.toJSON(!0))];case 3:return u=f.sent(),[4,this.encryptionService.encryptToString(o,s.toJSON(!0))];case 4:return c=f.sent(),p=1===i.threshold?i.shares[0]:i.shares[r],d={slip39:{share:p,subAssembly:{quorum:i.threshold,size:i.size}},assemblyKeyParams:a},[4,this.encryptionService.encryptToString(s,n.sharedCipherDataClearJson||"")];case 5:return l=f.sent(),[4,this.encryptionService.encryptToString(s,n.sharedCipherApprovalDataClearJson||"")];case 6:return h=f.sent(),[4,this.encryptionService.encryptToString(s,d)];case 7:return y=f.sent(),[2,{tpWrappingKeyId:e.id,tpWrappedSharedKey:u,subjectKeyWrappedSharedKey:c,sharedCipherData:l,sharedCipherApprovalData:h,sharedCipherPartialAssemblyKey:y,approverId:t||void 0,tpId:t?void 0:n.tpId}]}}))}))},t.prototype.validateApprovers=function(e){var t,n;try{for(var r=O(e),i=r.next();!i.done;i=r.next()){var a=i.value;if(!a.currentUserSharedKey.userSharedKey.mkSharedKey){var o="tp "+a.other.username+" does not have mkSharedKey";throw console.log(o),new Q(o)}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},t.prototype.prepareSlip39=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:if(e.length<t)throw new Q("Not enough sub assemblies to meet quorum");return r=new dr(t),e.forEach((function(e,t){var n=e.approverTps.length;1===e.quorum&&(n=1),r.addSubAssembly(new pr(t,e.quorum,n))})),[4,this.slip39Service.generateShares(n,this.slip39Passphrase,r)];case 1:return i.sent(),[2,r]}}))}))},t}();e.ɵi=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r.slip39Passphrase=ur,r}return R(t,e),t.prototype.getTpWrappingKeyId=function(e){return e.currentUserSharedKey.userSharedKey.mkSharedKey.id},t}(fr),e.ɵi.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ɵi(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ɵi,providedIn:"root"}),e.ɵi.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵi.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ɵi=M([et({ngZoneName:"ngZone"})],e.ɵi);var vr,mr,gr,Sr,Cr,Ir,br,wr,Kr,Pr,kr,Dr,Rr,Er,Mr,Ar,Tr=Oe(vr||(vr=F(["\nmutation CancelTpPasswordResetRequestMutation {\n cancelTpPasswordResetRequest(input: {}) {\n id\n }\n}"],["\nmutation CancelTpPasswordResetRequestMutation {\n cancelTpPasswordResetRequest(input: {}) {\n id\n }\n}"]))),Or=Oe(mr||(mr=F(["\nmutation CreateTpAssemblyKeyChallengeMutation(\n $input: CreateTpAssemblyKeyChallengeInput!\n) {\n createTpAssemblyKeyChallenge(input: $input) {\n challenge\n }\n}"],["\nmutation CreateTpAssemblyKeyChallengeMutation(\n $input: CreateTpAssemblyKeyChallengeInput!\n) {\n createTpAssemblyKeyChallenge(input: $input) {\n challenge\n }\n}"]))),jr=Oe(gr||(gr=F(["\nmutation PreCompleteTpPasswordResetRequestMutation(\n $input: PreCompleteTpPasswordResetRequestInput!\n) {\n preCompleteTpPasswordResetRequest(input: $input) {\n idpPassword\n }\n}"],["\nmutation PreCompleteTpPasswordResetRequestMutation(\n $input: PreCompleteTpPasswordResetRequestInput!\n) {\n preCompleteTpPasswordResetRequest(input: $input) {\n idpPassword\n }\n}"]))),Nr=Oe(Sr||(Sr=F(["\nmutation CompleteTpPasswordResetRequestMutation(\n $input: CompleteTpPasswordResetRequestInput!\n) {\n completeTpPasswordResetRequest(input: $input) {\n id\n }\n}"],["\nmutation CompleteTpPasswordResetRequestMutation(\n $input: CompleteTpPasswordResetRequestInput!\n) {\n completeTpPasswordResetRequest(input: $input) {\n id\n }\n}"]))),Fr=Oe(Cr||(Cr=F(["\nmutation ApproveTpPasswordResetRequestMutation(\n $input: ApproveTpPasswordResetRequestInput!\n) {\n approveTpPasswordResetRequest(input: $input) {\n claimApprover {\n id\n }\n }\n}"],["\nmutation ApproveTpPasswordResetRequestMutation(\n $input: ApproveTpPasswordResetRequestInput!\n) {\n approveTpPasswordResetRequest(input: $input) {\n claimApprover {\n id\n }\n }\n}"]))),$r=Oe(Ir||(Ir=F(["\nmutation RejectTpPasswordResetRequestMutation(\n $input: RejectTpPasswordResetRequestInput!\n) {\n rejectTpPasswordResetRequest(input: $input) {\n claimApprover {\n id\n }\n }\n}"],["\nmutation RejectTpPasswordResetRequestMutation(\n $input: RejectTpPasswordResetRequestInput!\n) {\n rejectTpPasswordResetRequest(input: $input) {\n claimApprover {\n id\n }\n }\n}"]))),_r=Oe(br||(br=F(["\nmutation CreateTpPasswordResetMutation($input: CreateTpPasswordResetInput!) {\n createTpPasswordReset(input: $input) {\n tpPasswordReset {\n id\n }\n }\n}"],["\nmutation CreateTpPasswordResetMutation($input: CreateTpPasswordResetInput!) {\n createTpPasswordReset(input: $input) {\n tpPasswordReset {\n id\n }\n }\n}"]))),Lr=Oe(wr||(wr=F(["\nmutation DeleteTpPasswordResetMutation {\n deleteTpPasswordReset(input: {}) {\n id\n }\n}"],["\nmutation DeleteTpPasswordResetMutation {\n deleteTpPasswordReset(input: {}) {\n id\n }\n}"]))),Ur=Oe(Kr||(Kr=F(["\nmutation UpdateTpPasswordResetMutation($input: UpdateTpPasswordResetInput!) {\n updateTpPasswordReset(input: $input) {\n tpPasswordReset {\n id\n }\n }\n}"],["\nmutation UpdateTpPasswordResetMutation($input: UpdateTpPasswordResetInput!) {\n updateTpPasswordReset(input: $input) {\n tpPasswordReset {\n id\n }\n }\n}"]))),xr=function(){function e(e,t){var n=this;this._key=e,this.timer=setTimeout((function(){n._key=null}),t)}return Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),e.prototype.pop=function(){var e=this._key;return this._key=null,this.timer&&(clearTimeout(this.timer),this.timer=null),e},e}(),qr=Oe(Pr||(Pr=F(["\nquery {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n sessionEncryptionKey\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n","\n"],["\nquery {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n sessionEncryptionKey\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n","\n"])),Je),Jr=Oe(kr||(kr=F(["\nquery ResetUserQuery {\n tpPasswordResetUser {\n username\n sessionEncryptionKey\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n }\n}"],["\nquery ResetUserQuery {\n tpPasswordResetUser {\n username\n sessionEncryptionKey\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n }\n}"]))),Gr=Oe(Dr||(Dr=F(["\nmutation SetSessionEncryptionKeyMutation($input: SetSessionEncryptionKeyInput!) {\n setSessionEncryptionKey(input: $input) {\n sessionEncryptionKey\n }\n}\n"],["\nmutation SetSessionEncryptionKeyMutation($input: SetSessionEncryptionKeyInput!) {\n setSessionEncryptionKey(input: $input) {\n sessionEncryptionKey\n }\n}\n"])));(Rr=e.RecoveryStatus||(e.RecoveryStatus={})).NONE="NONE",Rr.NEW_PASSWORD="NEW_PASSWORD",Rr.OLD_PASSWORD="OLD_PASSWORD",(Er=e.PasswordChangeStatus||(e.PasswordChangeStatus={})).IN_PROGRESS="IN_PROGRESS",Er.RECOVERY="RECOVERY",(Mr=e.CognitoChallengeName||(e.CognitoChallengeName={})).NEW_PASSWORD_REQUIRED="NEW_PASSWORD_REQUIRED",Mr.SMS_MFA="SMS_MFA",Mr.SOFTWARE_TOKEN_MFA="SOFTWARE_TOKEN_MFA",Mr.MFA_SETUP="MFA_SETUP",e.AuthService=Ar=function(n){function r(e,r,i,a,o,s,u,c,p,d,l,h,y,f){var v=n.call(this,r)||this;if(v.ngZone=e,v.injector=r,v.http=i,v.cognito=a,v.api=o,v.keyService=s,v.keyGraphService=u,v.keyFactoryService=c,v.passwordService=p,v.idleService=d,v.persistService=l,v.encryptionService=h,v.assemblyController=y,v.kcConfig=f,v.logoutListeners=new Set,v.password=null,!t.isDevMode()&&null!=v.kcConfig.debug)throw new B('In production mode, "KcConfig.debug" must be set to null');return v}return R(r,n),r.prototype.importPassword=function(e){return this.keyFactoryService.importPassword(e)},r.prototype.logout=function(){var e;return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,Promise.all(N(this.logoutListeners).map((function(e){return e()})))];case 1:return t.sent(),this.user=null,this.keyService.purgeKeys(),this.keyGraphService.purgeKeys(),[4,Promise.all([this.cognito.signOut(),this.kcLogout()])];case 2:return t.sent(),(null===(e=this.kcConfig.debug)||void 0===e?void 0:e.username)&&(this.kcConfig.debug.username=null),[2]}}))}))},r.prototype.addLogoutListener=function(e){this.logoutListeners.add(e)},r.prototype.removeLogoutListener=function(e){this.logoutListeners.delete(e)},r.prototype.login=function(t,n,r){var i,a=(void 0===r?{}:r).tpPasswordResetAutoComplete,o=void 0===a||a;return A(this,void 0,void 0,(function(){var r;return T(this,(function(a){switch(a.label){case 0:return[4,this.loginImpl(t,n)];case 1:return(r=a.sent()).challenge?(this.password=new xr(n,Ar.CHALLENGE_TIMEOUT),[2,r]):o&&(null===(i=r.user.resetUser)||void 0===i?void 0:i.state)===e.TpClaimState.APPROVED?[4,this.completeResetRequest(n)]:[3,4];case 2:return a.sent(),[4,this.loginImpl(t,n)];case 3:r=a.sent(),a.label=4;case 4:return[2,r]}}))}))},r.prototype.verifyLogin=function(t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s;return T(this,(function(u){switch(u.label){case 0:if(n=t.challenge,r=t.code,i=t.rememberMe,!(a=[e.CognitoChallengeName.SMS_MFA,e.CognitoChallengeName.SOFTWARE_TOKEN_MFA]).includes(n.cognitoUser.challengeName))throw new B("challengeName must be one of "+a);return[4,this.cognito.confirmSignIn(n.cognitoUser,r,n.cognitoUser.challengeName)];case 1:return o=u.sent(),[4,this.handlePostAuth(n.recoveryStatus)];case 2:return u.sent(),[4,this.loadUser(o,this.password.pop())];case 3:return s=u.sent(),this.password=null,i&&o.setDeviceStatusRemembered({onSuccess:function(){},onFailure:function(e){return console.error(e)}}),[2,{user:s}]}}))}))},r.prototype.getUser=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return this.user?[2,this.user]:[4,this.cognito.currentAuthenticatedUser()];case 1:return e=t.sent(),[2,this.loadUser(e)]}}))}))},r.prototype.refreshAccessToken=function(){return A(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return[4,this.cognito.currentAuthenticatedUser()];case 1:return e=n.sent(),t=e.getSignInUserSession().getRefreshToken(),console.log("Token refresh..."),[2,new Promise((function(n,r){e.refreshSession(t,(function(e){e?(console.error("Error refreshing token: ",e),r(e)):(console.log("Token refresh complete"),n(0))}))}))]}}))}))},r.prototype.fetchCurrentUser=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.api.query({query:qr,processorOptions:{hasKeys:!1}})];case 1:return[2,e.sent().currentUser]}}))}))},r.prototype.fetchResetUser=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.api.query({query:Jr,processorOptions:{hasKeys:!1}})];case 1:return[2,e.sent().tpPasswordResetUser]}}))}))},r.prototype.kcLogout=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.http.post(this.kcConfig.authUrl+"auth/sign-out/",null,{withCredentials:!0,responseType:"text"}).toPromise()];case 1:return e.sent(),[2]}}))}))},r.prototype.fetchPassIdpParams=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.http.get(this.kcConfig.authUrl+"users/pass-idp-params/?login_name="+encodeURIComponent(e)).toPromise()];case 1:return[2,t.sent()]}}))}))},r.prototype.loginImpl=function(t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,this.logout()];case 1:return i.sent(),[4,this.loginIdp(t,n)];case 2:return r=i.sent(),[e.CognitoChallengeName.SMS_MFA,e.CognitoChallengeName.SOFTWARE_TOKEN_MFA].includes(r.cognitoUser.challengeName)?[2,{challenge:{cognitoUser:r.cognitoUser,recoveryStatus:r.recoveryStatus}}]:[4,this.handlePostAuth(r.recoveryStatus)];case 3:return i.sent(),[4,this.loadUser(r.cognitoUser,n)];case 4:return[2,{user:i.sent()}]}}))}))},r.prototype.loginIdp=function(t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d,l;return T(this,(function(h){switch(h.label){case 0:return[4,this.fetchPassIdpParams(t)];case 1:if((r=h.sent()).passwordChangeStatus===e.PasswordChangeStatus.IN_PROGRESS)throw new X("A password change is in progress");if(r.passwordChangeStatus!==e.PasswordChangeStatus.RECOVERY)return[3,8];console.log("In recovery mode."),h.label=2;case 2:return h.trys.push([2,4,,5]),a={},[4,this.loginIdpImpl(t,n,r.newPassIdpParams)];case 3:return a.cognitoUser=h.sent(),a.recoveryStatus=e.RecoveryStatus.NEW_PASSWORD,i=a,console.log("New password works!"),[2,i];case 4:if("NotAuthorizedException"!==(o=h.sent()).code)throw o;return[3,5];case 5:return h.trys.push([5,7,,8]),u={},[4,this.loginIdpImpl(t,n,r.currentPassIdpParams)];case 6:return u.cognitoUser=h.sent(),u.recoveryStatus=e.RecoveryStatus.OLD_PASSWORD,s=u,console.log("Old password works!"),[2,s];case 7:throw"NotAuthorizedException"===(c=h.sent()).code?new B("The password change request was interrupted, please try to login with both your new and old password"):c;case 8:if(!r.tpPasswordReset)return[3,12];h.label=9;case 9:return h.trys.push([9,11,,12]),p=r.tpPasswordReset,d={},[4,this.loginIdpImpl(p.resetUsername,n,p.passIdpParams)];case 10:return d.cognitoUser=h.sent(),d.recoveryStatus=e.RecoveryStatus.NONE,[2,d];case 11:return h.sent(),[3,12];case 12:return l={},[4,this.loginIdpImpl(t,n,r.currentPassIdpParams)];case 13:return l.cognitoUser=h.sent(),l.recoveryStatus=e.RecoveryStatus.NONE,[2,l]}}))}))},r.prototype.loginIdpImpl=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,this.keyFactoryService.derivePassIdp(Object.assign({password:t},n))];case 1:return r=i.sent(),[2,this.cognito.signIn(e,this.passwordService.getPassIdpString(r.jwk))]}}))}))},r.prototype.handlePostAuth=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.handlePasswordRecovery(e)];case 1:return t.sent(),[4,this.handleSessionEncryptionKey()];case 2:return t.sent(),[2]}}))}))},r.prototype.handlePasswordRecovery=function(t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return t===e.RecoveryStatus.NONE?[3,2]:[4,this.passwordService.changePasswordComplete({useNewPassword:t===e.RecoveryStatus.NEW_PASSWORD})];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},r.prototype.handleSessionEncryptionKey=function(){return A(this,void 0,void 0,(function(){var e,n;return T(this,(function(r){switch(r.label){case 0:if(!this.kcConfig.disableSessionEncryptionKey)return[3,1];if(!t.isDevMode())throw e="You should not set disableSessionEncryptionKey=True in mode prod. It defaults to false.",console.error(e),new ee(e);return console.warn("You have set disableSessionEncryptionKey=True. Make sure not to do this in prod mode."),[3,4];case 1:return[4,this.keyFactoryService.createKey()];case 2:return n=r.sent(),[4,this.lrGraphQL.lrMutate(new dt({mutation:Gr,variables:{input:{sessionEncryptionKey:JSON.stringify(n.toJSON(!0))}}}),{includeKeyGraph:!1})];case 3:r.sent(),this.persistService.setServerSessionEncryptionKey(n),r.label=4;case 4:return[2]}}))}))},r.prototype.getCognitoUserAttribute=function(e,t){var n=t.find((function(t){return t.getName()===e}));return n?n.getValue():null},r.prototype.loadUserKeys=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return t=e.userKeys,n=e.password,(r=e.sessionEncryptionKey)?(o=(i=this.persistService).setServerSessionEncryptionKey,[4,a.JWK.asKey(r)]):[3,2];case 1:o.apply(i,[p.sent()]),p.label=2;case 2:return n?[4,this.keyFactoryService.derivePassKey(Object.assign({password:n},t.passKey.passKeyParams))]:[3,6];case 3:return s=p.sent().jwk,c=(u=this.idleService).persistMasterKey,[4,this.keyGraphService.unwrapWithPassKey(t.passKey.id,s,t.masterKey.id)];case 4:return[4,c.apply(u,[p.sent()])];case 5:p.sent(),p.label=6;case 6:return[2]}}))}))},r.prototype.loadUser=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return e.getUsername().endsWith(".tp_password_reset")?(n=this,[4,this.loadResetUser(e,t)]):[3,2];case 1:return n.user=i.sent(),[3,4];case 2:return r=this,[4,this.loadRegularUser(e,t)];case 3:r.user=i.sent(),i.label=4;case 4:return[4,this.idleService.start()];case 5:return i.sent(),[2,this.user]}}))}))},r.prototype.loadRegularUser=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.fetchCurrentUser()];case 1:return n=a.sent(),[4,this.loadUserKeys({userKeys:n.currentUserKey,password:t,sessionEncryptionKey:n.sessionEncryptionKey})];case 2:return a.sent(),[4,this.keyGraphService.populateKeys(n.currentUserKey)];case 3:return a.sent(),r=n.username,[4,this.cognito.userAttributes(e)];case 4:return i=a.sent(),[2,{username:r,sub:this.getCognitoUserAttribute("sub",i),loginEmail:this.getCognitoUserAttribute("email",i),resetUser:null}]}}))}))},r.prototype.loadResetUser=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.fetchResetUser()];case 1:return n=o.sent(),r={passKey:{id:n.passKey.id,passKeyParams:n.passKey.passKeyParams},masterKey:{id:n.masterKey.id}},[4,this.loadUserKeys({userKeys:r,password:t,sessionEncryptionKey:n.sessionEncryptionKey})];case 2:return o.sent(),[4,this.keyService.setKeys(r)];case 3:return o.sent(),i=n.username,[4,this.cognito.userAttributes(e)];case 4:return a=o.sent(),[2,{username:i,sub:this.getCognitoUserAttribute("sub",a),loginEmail:this.getCognitoUserAttribute("email",a),resetUser:{state:n.state}}]}}))}))},r.prototype.recoverAssemblyKey=function(e){return A(this,void 0,void 0,(function(){var t,n,r=this;return T(this,(function(i){switch(i.label){case 0:return[4,this.keyGraphService.getKey(e.pxk.id)];case 1:return t=i.sent(),[4,Promise.all(e.approvals.filter((function(e){return!!e.receiverCipherPartialAssemblyKey})).map((function(e){return r.encryptionService.decrypt(t,e.receiverCipherPartialAssemblyKey)})))];case 2:return n=i.sent(),[2,this.assemblyController.recoverAssemblyKey(n)]}}))}))},r.prototype.completeResetRequest=function(t){return A(this,void 0,void 0,(function(){var n,r,i,o,s,u,c,p,d,l,h,y,v,m,g=this;return T(this,(function(S){switch(S.label){case 0:return[4,this.fetchResetUser()];case 1:if((n=S.sent()).state!==e.TpClaimState.APPROVED)throw new Z("Password reset request has not been approved.");return[4,this.recoverAssemblyKey(n)];case 2:return r=S.sent(),[4,this.encryptionService.decrypt(r,n.assemblyCipherData)];case 3:return i=S.sent().rootKey,[4,a.JWK.asKey(i)];case 4:return o=S.sent(),[4,this.keyGraphService.getKey(n.masterKey.id)];case 5:return s=S.sent(),[4,this.encryptionService.encryptToString(s.jwk,o.toJSON(!0))];case 6:return u=S.sent(),[4,this.keyFactoryService.derivePassIdp(Object.assign({password:t},n.passKey.passIdpParams))];case 7:return c=S.sent(),p=this.passwordService.getPassIdpString(c.jwk),[4,this.lrGraphQL.lrMutate(new dt({mutation:Or,variables:{input:{}}}),{includeKeyGraph:!1})];case 8:return(d=S.sent().createTpAssemblyKeyChallenge.challenge).clientNonce=this.keyFactoryService.randomString(32),[4,this.encryptionService.decrypt(r,n.wrappedAssemblyKeyVerifierPrk)];case 9:return l=S.sent(),[4,this.encryptionService.sign(l,d)];case 10:return h=S.sent(),[4,this.lrGraphQL.lrMutate(new dt({mutation:jr,variables:{input:{signedChallenge:JSON.stringify(h)}}}),{includeKeyGraph:!1})];case 11:return y=S.sent().preCompleteTpPasswordResetRequest.idpPassword,v=new Promise((function(e){var t=function(r){return A(g,void 0,void 0,(function(){return T(this,(function(i){switch(i.label){case 0:return"signIn"!==r.payload.event?[2]:(f.Hub.remove("auth",t),[4,this.cognito.signIn(n.username,p)]);case 1:return i.sent(),[4,this.lrGraphQL.lrMutate(new dt({mutation:Nr,variables:{input:{masterKeyWrappedRootKey:u,masterKeyId:s.id}}}))];case 2:return i.sent(),e(),[2]}}))}))};f.Hub.listen("auth",t)})),[4,this.cognito.signIn(n.username,y,{noProxy:"true"})];case 12:if("NEW_PASSWORD_REQUIRED"!==(m=S.sent()).challengeName)throw new ee("Expecting Cognito to have done a password reset after call to PreCompleteTpPasswordResetRequestMutation.");return[4,this.cognito.completeNewPassword(m,p,{})];case 13:return m=S.sent(),[2,v]}}))}))},r.prototype.debugLogin=function(e,t){return this.kcConfig.debug.username=e,this.debugLoadUser(t)},r.prototype.debugLoadUser=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.fetchCurrentUser()];case 1:return t=o.sent(),n=t.username,r=t.currentUserKey,[4,this.keyFactoryService.derivePassKey(Object.assign({password:e},r.passKey.passKeyParams))];case 2:return i=o.sent().jwk,[4,this.keyGraphService.unwrapWithPassKey(r.passKey.id,i,r.masterKey.id)];case 3:return a=o.sent(),[4,this.idleService.persistMasterKey(a)];case 4:return o.sent(),[4,this.keyGraphService.populateKeys(r)];case 5:return o.sent(),this.user={username:n,resetUser:null,sub:"DEBUG_MODE",loginEmail:"DEBUG_MODE"},[2,this.user]}}))}))},r.prototype.debugClearUser=function(){this.user=null},r.prototype.getCurrentUserAttributes=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return[4,this.cognito.currentAuthenticatedUser()];case 1:return e=t.sent(),[4,this.cognito.userAttributes(e)];case 2:return[2,t.sent()]}}))}))},r}($t),e.AuthService.CHALLENGE_TIMEOUT=3e5,e.AuthService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.AuthService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(y.HttpClient),t.ɵɵinject(o.AuthClass),t.ɵɵinject(e.ɵg),t.ɵɵinject(Ke),t.ɵɵinject(Pe),t.ɵɵinject(ge),t.ɵɵinject(sr),t.ɵɵinject(qt),t.ɵɵinject(we),t.ɵɵinject(ve),t.ɵɵinject(e.ɵi),t.ɵɵinject(Se))},token:e.AuthService,providedIn:"root"}),e.AuthService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.AuthService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:y.HttpClient},{type:o.AuthClass},{type:e.ɵg},{type:Ke},{type:Pe},{type:ge},{type:sr},{type:qt},{type:we},{type:ve},{type:e.ɵi},{type:void 0,decorators:[{type:t.Inject,args:[Se]}]}]},e.AuthService=Ar=M([et({ngZoneName:"ngZone"})],e.AuthService);var Qr,Vr,Br,Wr=Oe(Qr||(Qr=F(["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"],["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"]))),Zr=Oe(Vr||(Vr=F(["\nmutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"],["\nmutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"]))),Hr=Oe(Br||(Br=F(["\nmutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n}\n"]))),Yr=function(){};e.ContactCard2Service=function(){function e(e,t,n,r,i,a){this.keyFactory=e,this.keyService=t,this.encryptionService=n,this.keyGraph=r,this.keyMetaService=i,this.ngZone=a}return e.prototype.createContactCard=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return t=this.keyService.currentRootKey,[4,this.keyFactory.createKey()];case 1:return n=o.sent(),[4,this.keyGraph.encryptToString(t.jwk,n.toJSON(!0))];case 2:return r=o.sent(),[4,this.keyGraph.encryptToString(n,e.plainCipherDataJson)];case 3:return i=o.sent(),[4,this.prepareContactCardInput(e)];case 4:return a=o.sent(),[2,new dt({mutation:Wr,variables:{input:Object.assign(Object.assign({},a),{wrappingKeyId:t.id,wrappedKey:r,cipherData:i})}})]}}))}))},e.prototype.updateContactCard=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.keyGraph.encryptToString(e.keyId,e.plainCipherDataJson)];case 1:return t=r.sent(),[4,this.prepareContactCardInput(e)];case 2:return n=r.sent(),[2,new dt({mutation:Zr,variables:{input:Object.assign(Object.assign({},n),{id:e.id,cipherData:t})}})]}}))}))},e.prototype.deleteContactCard=function(e){return new dt({mutation:Hr,variables:{input:{id:e}}})},e.prototype.prepareContactCardInput=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:return t=this.keyService.currentSigPxk,i=(r=JSON).stringify,[4,this.encryptionService.sign(t.jwk,e.publicDataJson)];case 1:return n=i.apply(r,[d.sent()]),s=(o=JSON).stringify,[4,this.encryptionService.sign(t.jwk,e.publicSearchableJson)];case 2:return a=s.apply(o,[d.sent()]),p=(c=JSON).stringify,[4,this.encryptionService.sign(t.jwk,e.plainDataJson)];case 3:return u=p.apply(c,[d.sent()]),[2,{sigPxkId:t.id,publicDataSig:n,publicSearchableSig:a,plainDataSig:u}]}}))}))},e}(),e.ContactCard2Service.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ContactCard2Service(t.ɵɵinject(ge),t.ɵɵinject(Ke),t.ɵɵinject(ve),t.ɵɵinject(Pe),t.ɵɵinject(en),t.ɵɵinject(t.NgZone))},token:e.ContactCard2Service,providedIn:"root"}),e.ContactCard2Service.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ContactCard2Service.ctorParameters=function(){return[{type:ge},{type:Ke},{type:ve},{type:Pe},{type:en},{type:t.NgZone}]},e.ContactCard2Service=M([et({ngZoneName:"ngZone"})],e.ContactCard2Service);var Xr=function(){function e(e,t,n){this.config=e,this.http=t,this.auth=n}return e.prototype.downloadEncryptedFileJson=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return n=(t=JSON).parse,[4,this.downloadEncryptedFile(e)];case 1:return[2,n.apply(t,[r.sent()])]}}))}))},e.prototype.downloadEncryptedFile=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return t=this.config.apiUrl+"files/download/?file_state_node_id="+e,r=(n=this.http).get,i=[t],o=(a=Object).assign,u=(s=Object).assign,c=[{}],[4,Ie(this.auth,this.config)];case 1:return[4,r.apply(n,i.concat([o.apply(a,[u.apply(s,c.concat([p.sent()])),{responseType:"text"}])])).toPromise()];case 2:return[2,p.sent()]}}))}))},e.prototype.loadFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return e instanceof ArrayBuffer?[2,e]:[2,new Promise((function(t){var n=new FileReader;n.onload=function(){t(n.result)},n.readAsArrayBuffer(e)}))]}))}))},e.prototype.uploadEncryptedFile=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return t=e.encryptedContent,n=e.fileName,(r=new FormData).append("content",new Blob([t]),n),a=(i=this.http).post,o=[this.config.apiUrl+"files/upload/",r],[4,Ie(this.auth,this.config)];case 1:return[4,a.apply(i,o.concat([s.sent()])).toPromise()];case 2:return[2,s.sent().content_resource]}}))}))},e}();Xr.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Xr(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(o.AuthClass))},token:Xr,providedIn:"root"}),Xr.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Xr.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:o.AuthClass}]};var zr,ei,ti,ni,ri,ii,ai,oi,si,ui,ci,pi,di,li,hi,yi,fi,vi,mi,gi,Si,Ci=Oe(zr||(zr=F(["\nmutation CreateDirectoryMutation($input: CreateDirectoryInput!) {\n createDirectory(input: $input) {\n directory {\n id\n keyId\n }\n }\n}\n"],["\nmutation CreateDirectoryMutation($input: CreateDirectoryInput!) {\n createDirectory(input: $input) {\n directory {\n id\n keyId\n }\n }\n}\n"]))),Ii=Oe(ei||(ei=F(["\nmutation UpdateDirectoryMutation($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n modified\n }\n }\n}\n"],["\nmutation UpdateDirectoryMutation($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n modified\n }\n }\n}\n"]))),bi=Oe(ti||(ti=F(["\nmutation DeleteDirectoryMutation($input: DeleteDirectoryInput!) {\n deleteDirectory(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteDirectoryMutation($input: DeleteDirectoryInput!) {\n deleteDirectory(input: $input) {\n id\n }\n}\n"]))),wi=Oe(ni||(ni=F(["\nmutation CreateFileMutation($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n keyId\n }\n }\n}\n"],["\nmutation CreateFileMutation($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n keyId\n }\n }\n}\n"]))),Ki=Oe(ri||(ri=F(["\nmutation UpdateFileMutation($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation UpdateFileMutation($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Pi=Oe(ii||(ii=F(["\nmutation RevertFileMutation($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation RevertFileMutation($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n }\n }\n}\n"]))),ki=Oe(ai||(ai=F(["\nmutation DeleteFileMutation($input: DeleteFileInput!) {\n deleteFile(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteFileMutation($input: DeleteFileInput!) {\n deleteFile(input: $input) {\n id\n }\n}\n"]))),Di=Oe(oi||(oi=F(["\nmutation ArchiveDirectoryMutation($input: ArchiveDirectoryInput!) {\n archiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"],["\nmutation ArchiveDirectoryMutation($input: ArchiveDirectoryInput!) {\n archiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"]))),Ri=Oe(si||(si=F(["\nmutation ArchiveFileMutation($input: ArchiveFileInput!) {\n archiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation ArchiveFileMutation($input: ArchiveFileInput!) {\n archiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Ei=Oe(ui||(ui=F(["\nmutation UnarchiveDirectoryMutation($input: UnarchiveDirectoryInput!) {\n unarchiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"],["\nmutation UnarchiveDirectoryMutation($input: UnarchiveDirectoryInput!) {\n unarchiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"]))),Mi=Oe(ci||(ci=F(["\nmutation UnarchiveFileMutation($input: UnarchiveFileInput!) {\n unarchiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation UnarchiveFileMutation($input: UnarchiveFileInput!) {\n unarchiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Ai=Oe(pi||(pi=F(["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n }\n }\n}\n"],["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n }\n }\n}\n"]))),Ti=Oe(di||(di=F(["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Oi=Oe(li||(li=F(["\nmutation BeginDeleteChildItemLinksWindowMutation($input: BeginDeleteChildItemLinksWindowInput!) {\n beginDeleteChildItemLinksWindow(input: $input) {\n begin\n end\n scheduled\n windowMs\n directory {\n id\n }\n }\n}\n"],["\nmutation BeginDeleteChildItemLinksWindowMutation($input: BeginDeleteChildItemLinksWindowInput!) {\n beginDeleteChildItemLinksWindow(input: $input) {\n begin\n end\n scheduled\n windowMs\n directory {\n id\n }\n }\n}\n"]))),ji=Oe(hi||(hi=F(['\nquery TempDirectoryQuery($plainMeta: LrJSONFilter!) {\n rootDirectories(plainMeta: $plainMeta, first: 2, orderBy: "created") {\n edges {\n node {\n id\n keyId\n }\n }\n }\n lock {\n version\n }\n}\n'],['\nquery TempDirectoryQuery($plainMeta: LrJSONFilter!) {\n rootDirectories(plainMeta: $plainMeta, first: 2, orderBy: "created") {\n edges {\n node {\n id\n keyId\n }\n }\n }\n lock {\n version\n }\n}\n']))),Ni=Oe(yi||(yi=F(["\nmutation SetFileConfidentialMutation($input: SetFileConfidentialInput!) {\n setFileConfidential(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation SetFileConfidentialMutation($input: SetFileConfidentialInput!) {\n setFileConfidential(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Fi=Oe(fi||(fi=F(["\nmutation SetDirectoryConfidentialMutation($input: SetDirectoryConfidentialInput!) {\n setDirectoryConfidential(input: $input) {\n directory {\n id\n }\n }\n}\n"],["\nmutation SetDirectoryConfidentialMutation($input: SetDirectoryConfidentialInput!) {\n setDirectoryConfidential(input: $input) {\n directory {\n id\n }\n }\n}\n"]))),$i=Oe(vi||(vi=F(["\nfragment LockFragment on LockField {\n created\n modified\n version\n expiryTime\n state\n}"],["\nfragment LockFragment on LockField {\n created\n modified\n version\n expiryTime\n state\n}"]))),_i=Oe(mi||(mi=F(["\nmutation UpdateLockMutation($input: UpdateLockInput!) {\n updateLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"],["\nmutation UpdateLockMutation($input: UpdateLockInput!) {\n updateLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"])),$i),Li=Oe(gi||(gi=F(["\nmutation AcquireLockMutation($input: AcquireLockInput!) {\n acquireLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"],["\nmutation AcquireLockMutation($input: AcquireLockInput!) {\n acquireLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"])),$i),Ui=Oe(Si||(Si=F(["\nmutation ReleaseLockMutation($input: ReleaseLockInput!) {\n releaseLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"],["\nmutation ReleaseLockMutation($input: ReleaseLockInput!) {\n releaseLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"])),$i);e.LockService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.updateLockMutation=function(e){return new dt({mutation:_i,variables:{input:{resourceId:e.resourceId,version:e.version}}})},t.prototype.acquireLockMutation=function(e){return new dt({mutation:Li,variables:{input:{resourceId:e.resourceId,timeoutMs:e.timeoutMs}}})},t.prototype.releaseLockMutation=function(e){return new dt({mutation:Ui,variables:{input:{resourceId:e.resourceId,version:e.version}}})},t}($t),e.LockService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.LockService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.LockService,providedIn:"root"}),e.LockService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.LockService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.LockService=M([et({ngZoneName:"ngZone"})],e.LockService);var xi,qi,Ji,Gi,Qi,Vi,Bi=Oe(xi||(xi=F(["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"],["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"]))),Wi=Oe(qi||(qi=F(["\nquery FileKeyQuery($id: LrRelayIdInput!) {\n file(id: $id) {\n keyId\n }\n}\n"],["\nquery FileKeyQuery($id: LrRelayIdInput!) {\n file(id: $id) {\n keyId\n }\n}\n"]))),Zi=Oe(Ji||(Ji=F(["\nquery DirectoryKeyFromSharedDirectoryQuery($id: LrRelayIdInput!) {\n tpSharedDirectory(id: $id) {\n item {\n keyId\n }\n }\n}\n"],["\nquery DirectoryKeyFromSharedDirectoryQuery($id: LrRelayIdInput!) {\n tpSharedDirectory(id: $id) {\n item {\n keyId\n }\n }\n}\n"]))),Hi=Oe(Gi||(Gi=F(["\nquery FileKeyFromSharedFileQuery($id: LrRelayIdInput!) {\n tpSharedFile(id: $id) {\n item {\n keyId\n }\n }\n}\n"],["\nquery FileKeyFromSharedFileQuery($id: LrRelayIdInput!) {\n tpSharedFile(id: $id) {\n item {\n keyId\n }\n }\n}\n"]))),Yi=Oe(Qi||(Qi=F(["\nquery FileStateKeyQuery($id: LrRelayIdInput!) {\n fileState(id: $id) {\n keyId\n }\n}\n"],["\nquery FileStateKeyQuery($id: LrRelayIdInput!) {\n fileState(id: $id) {\n keyId\n }\n}\n"])));e.ItemService=Vi=function(e){function t(t,n,r,i,a,o,s,u){var c=e.call(this,n)||this;return c.ngZone=t,c.injector=n,c.fileUploadService=r,c.keyService=i,c.keyFactory=a,c.keyGraph=o,c.lockService=s,c.authService=u,c.tempDirectory=null,c.authService.addLogoutListener((function(){return c.onLogout()})),c}return R(t,e),t.prototype.downloadFileContent=function(e){return A(this,void 0,void 0,(function(){var t,n,r=this;return T(this,(function(i){switch(i.label){case 0:return[4,this.fileUploadService.downloadEncryptedFile(e.fileStateNodeId)];case 1:return t=i.sent(),[4,this.keyGraph.getKey(e.fileStateKeyId,(function(){return r.getFileStateKeyId(e.fileStateNodeId)}))];case 2:return n=i.sent(),[2,this.keyGraph.decryptFromString(n,t,{payloadType:L.UINT_8_ARRAY})]}}))}))},t.prototype.getDirectoryKeyId=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Bi,variables:{id:e}})];case 1:return[2,t.sent().directory.keyId]}}))}))},t.prototype.getFileKeyId=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Wi,variables:{id:e}})];case 1:return[2,t.sent().file.keyId]}}))}))},t.prototype.getDirectoryKeyIdFromSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Zi,variables:{id:e}})];case 1:return[2,t.sent().tpSharedDirectory.item.keyId]}}))}))},t.prototype.getFileKeyIdFromSharedFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Hi,variables:{id:e}})];case 1:return[2,t.sent().tpSharedFile.item.keyId]}}))}))},t.prototype.getDirectoryKey=function(e,t){return A(this,void 0,void 0,(function(){var n=this;return T(this,(function(r){return[2,this.keyGraph.getKey(t,(function(){return n.getDirectoryKeyId(e)}))]}))}))},t.prototype.getFileKey=function(e,t){return A(this,void 0,void 0,(function(){var n=this;return T(this,(function(r){return[2,this.keyGraph.getKey(t,(function(){return n.getFileKeyId(e)}))]}))}))},t.prototype.createDirectory=function(e){return this.mutate(this.createDirectoryMutation(e))},t.prototype.createDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Ci},r={},[4,this.prepareCreateDirectory(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.updateDirectory=function(e){return this.mutate(this.updateDirectoryMutation(e))},t.prototype.updateDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Ii},r={},[4,this.prepareUpdateDirectory(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.deleteDirectory=function(e){return this.mutate(this.deleteDirectoryMutation(e))},t.prototype.deleteDirectoryMutation=function(e){return new dt({mutation:bi,variables:{input:{directoryId:e}}})},t.prototype.createFile=function(e){return this.mutate(this.createFileMutation(e))},t.prototype.createFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:wi},r={},[4,this.prepareCreateFile(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.updateFile=function(e){return this.mutate(this.updateFileMutation(e))},t.prototype.updateFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Ki},r={},[4,this.prepareUpdateFile(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.revertFile=function(e){return this.mutate(this.revertFileMutation(e))},t.prototype.revertFileMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Pi,variables:{input:e}})]}))}))},t.prototype.deleteFile=function(e){return this.mutate(this.deleteFileMutation(e))},t.prototype.deleteFileMutation=function(e){return new dt({mutation:ki,variables:{input:{fileId:e}}})},t.prototype.archiveDirectory=function(e,t){return this.mutate(this.archiveDirectoryMutation(e,t))},t.prototype.archiveDirectoryMutation=function(e,t){return new dt({mutation:Di,variables:{input:{directoryId:e,recursive:t.recursive}}})},t.prototype.archiveFile=function(e){return this.mutate(this.archiveFileMutation(e))},t.prototype.archiveFileMutation=function(e){return new dt({mutation:Ri,variables:{input:{fileId:e}}})},t.prototype.unarchiveDirectory=function(e,t){return this.mutate(this.unarchiveDirectoryMutation(e,t))},t.prototype.unarchiveDirectoryMutation=function(e,t){return new dt({mutation:Ei,variables:{input:{directoryId:e,recursive:t.recursive}}})},t.prototype.unarchiveFile=function(e){return this.mutate(this.unarchiveFileMutation(e))},t.prototype.unarchiveFileMutation=function(e){return new dt({mutation:Mi,variables:{input:{fileId:e}}})},t.prototype.changeDirectoryParents=function(e){return this.mutate(this.changeDirectoryParentsMutation(e))},t.prototype.changeDirectoryParentsMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Ai},r={},[4,this.prepareChangeDirectoryParents(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.changeFileParents=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.changeFileParentsMutation(e))]}))}))},t.prototype.changeFileParentsMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Ti},r={},[4,this.prepareChangeFileParents(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.beginDeleteChildItemLinksWindow=function(e){return this.mutate(this.beginDeleteChildItemLinksWindowMutation(e))},t.prototype.beginDeleteChildItemLinksWindowMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Oi,variables:{input:e}})]}))}))},t.prototype.ensureTempDirectory=function(){var e;return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return this.tempDirectory?[2,this.tempDirectory]:[4,this.query({query:ji,variables:{plainMeta:Vi.TEMP_DIRECTORY_PLAIN_META_FILTER}})];case 1:return(t=p.sent()).rootDirectories.edges.length>1&&console.error("There is more than 1 temp directory (plainMeta filter: "+Vi.TEMP_DIRECTORY_PLAIN_META_FILTER+")"),0!==t.rootDirectories.edges.length?[3,4]:[4,this.createDirectoryMutation({asRootDirectory:!0,plainMetaJson:Vi.TEMP_DIRECTORY_PLAIN_META})];case 2:return n=p.sent(),r=this.lockService.updateLockMutation({version:null===(e=t.lock)||void 0===e?void 0:e.version}),[4,this.lrGraphQL.lrMutate([n,r])];case 3:return i=j.apply(void 0,[p.sent(),1]),a=i[0],o=a.createDirectory.directory,u=o.id,c=o.keyId,this.tempDirectory={id:u,keyId:c},[3,5];case 4:s=t.rootDirectories.edges[0].node,u=s.id,c=s.keyId,this.tempDirectory={id:u,keyId:c},p.label=5;case 5:return[2,this.tempDirectory]}}))}))},t.prototype.createDirectoryTree=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createDirectoryTreeMutation(e))]}))}))},t.prototype.createDirectoryTreeMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.ensureTempDirectory()];case 1:return t=r.sent(),[4,this.beginDeleteChildItemLinksWindow({directoryId:t.id,requestWindowMs:e.requestWindowMs})];case 2:return r.sent(),[4,this.createDirectory({cipherMetaClearJson:e.cipherMetaClearJson,parentDirectories:[{directoryId:t.id,wrappingKeyId:t.keyId}],plainMetaJson:e.plainMetaJson})];case 3:return n=r.sent().createDirectory.directory,[4,e.createContent({id:n.id,keyId:n.keyId})];case 4:return r.sent(),[2,this.changeDirectoryParentsMutation({directoryId:n.id,directoryKeyId:n.keyId,parentsToRemove:[t.id],parentsToAdd:e.parentDirectories})]}}))}))},t.prototype.setFileConfidential=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.setFileConfidentialMutation(e))]}))}))},t.prototype.setFileConfidentialMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Ni,variables:{input:{fileId:e.fileId,confidential:e.confidential}}})]}))}))},t.prototype.setDirectoryConfidential=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.setDirectoryConfidentialMutation(e))]}))}))},t.prototype.setDirectoryConfidentialMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Fi,variables:{input:{directoryId:e.directoryId,confidential:e.confidential}}})]}))}))},t.prototype.prepareParentDirectory=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.getDirectoryKey(e.directoryId,e.wrappingKeyId)];case 1:return n=i.sent(),r={directoryId:e.directoryId,wrappingKeyId:n.id},[4,this.keyGraph.wrapKey(n,t)];case 2:return[2,(r.wrappedKey=i.sent(),r.linkType=e.linkType,r)]}}))}))},t.prototype.getFileStateKeyId=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Yi,variables:{id:e}})];case 1:return[2,t.sent().fileState.keyId]}}))}))},t.prototype.prepareCreateFileState=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l,h;return T(this,(function(y){switch(y.label){case 0:return[4,this.keyFactory.createKey()];case 1:return n=y.sent(),(i=t.file)?[4,this.fileUploadService.loadFile(t.file)]:[3,3];case 2:i=y.sent(),y.label=3;case 3:return(r=i)?[4,this.keyGraph.encryptToString(n,r)]:[3,8];case 4:return o=y.sent(),t.upload?[4,t.upload(o)]:[3,6];case 5:return a=y.sent(),[3,8];case 6:return[4,this.fileUploadService.uploadEncryptedFile({encryptedContent:o})];case 7:a=y.sent(),y.label=8;case 8:return u=(s=Object).assign,p=(c=Object).assign,d=[{}],[4,this.prepareItem(n,t)];case 9:return l=[p.apply(c,d.concat([y.sent()]))],h={},[4,this.keyGraph.wrapKey(e,n)];case 10:return[2,u.apply(s,l.concat([(h.wrappedStateKey=y.sent(),h.contentResource=a,h)]))]}}))}))},t.prototype.prepareChangeItemParents=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i=this;return T(this,(function(a){switch(a.label){case 0:return e.parentsToAdd?[4,Promise.all(e.parentsToAdd.map((function(e){return i.prepareParentDirectory(e,t)})))]:[3,2];case 1:return r=a.sent(),[3,3];case 2:r=[],a.label=3;case 3:return n=r,[2,{directoriesToRemove:e.parentsToRemove||[],directoriesToAdd:n}]}}))}))},t.prototype.prepareItem=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return n=t.plainMetaJson,r=t.cipherMetaClearJson,i={plainMeta:n&&JSON.stringify(n)},(a=r)?[4,this.keyGraph.encryptToString(e,r)]:[3,2];case 1:a=o.sent(),o.label=2;case 2:return[2,(i.cipherMeta=a,i)]}}))}))},t.prototype.prepareCreateDirectory=function(e){var t,n,r;return A(this,void 0,void 0,(function(){var i,a,o,s,u,c,p=this;return T(this,(function(d){switch(d.label){case 0:return[4,this.keyFactory.createKey()];case 1:if(i=d.sent(),e.parentDirectories=e.parentDirectories||[],!e.asRootDirectory&&!(null===(t=e.parentDirectories)||void 0===t?void 0:t.length))throw new Q("A new directory must be either a root directory or a sub-directory. So you must provide either parentDirectories or asRootDirectory parameter.");if(e.asRootDirectory&&(null===(n=e.parentDirectories)||void 0===n?void 0:n.length))throw new Q("A new directory must be either a root directory or a sub-directory. So you can only provide either parentDirectories or asRootDirectory parameter.");return[4,Promise.all(null===(r=e.parentDirectories)||void 0===r?void 0:r.map((function(e){return p.prepareParentDirectory(e,i)})))];case 2:return a=d.sent(),e.asRootDirectory?(s=this.keyService.currentRootKey,u={wrappingKeyId:s.id},[4,this.keyGraph.wrapKey(s,i)]):[3,4];case 3:u.wrappedKey=d.sent(),o=u,d.label=4;case 4:return[4,this.prepareItem(i,e)];case 5:return c=d.sent(),[2,Object.assign(Object.assign({},c),{parentDirectories:a,parentRootDirectory:o})]}}))}))},t.prototype.prepareUpdateDirectory=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getDirectoryKey(e.directoryId,e.directoryKeyId)];case 1:return t=r.sent(),[4,this.prepareItem(t.jwk,e)];case 2:return n=r.sent(),[2,Object.assign(Object.assign({},n),{directoryId:e.directoryId})]}}))}))},t.prototype.prepareCreateFile=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i=this;return T(this,(function(a){switch(a.label){case 0:return[4,this.keyFactory.createKey()];case 1:return t=a.sent(),[4,Promise.all(e.parentDirectories.map((function(e){return A(i,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.prepareParentDirectory(e,t)];case 1:return n=o.sent(),r=n.directoryId,i=n.wrappingKeyId,a=n.wrappedKey,[2,{directoryId:r,wrappingKeyId:i,wrappedFileKey:a}]}}))}))})))];case 2:return n=a.sent(),[4,this.prepareCreateFileState(t,e)];case 3:return r=a.sent(),[2,Object.assign(Object.assign({},r),{parentDirectories:n})]}}))}))},t.prototype.prepareUpdateFile=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getFileKey(e.fileId,e.fileKeyId)];case 1:return t=r.sent(),[4,this.prepareCreateFileState(t.jwk,e)];case 2:return n=r.sent(),[2,Object.assign(Object.assign({},n),{fileId:e.fileId})]}}))}))},t.prototype.prepareChangeDirectoryParents=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getDirectoryKey(e.directoryId,e.directoryKeyId)];case 1:return t=r.sent(),[4,this.prepareChangeItemParents(e,t.jwk)];case 2:return n=r.sent(),[2,Object.assign(Object.assign({},n),{directoryId:e.directoryId})]}}))}))},t.prototype.prepareChangeFileParents=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getFileKey(e.fileId,e.fileKeyId)];case 1:return t=r.sent(),[4,this.prepareChangeItemParents(e,t.jwk)];case 2:return n=r.sent(),[2,Object.assign(Object.assign({},n),{fileId:e.fileId})]}}))}))},t.prototype.onLogout=function(){this.tempDirectory=null},t}($t),e.ItemService.TEMP_DIRECTORY_PLAIN_META={kcType:"temp"},e.ItemService.TEMP_DIRECTORY_PLAIN_META_FILTER=JSON.stringify({filter:[{contains:Vi.TEMP_DIRECTORY_PLAIN_META}]}),e.ItemService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ItemService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(Xr),t.ɵɵinject(Ke),t.ɵɵinject(ge),t.ɵɵinject(Pe),t.ɵɵinject(e.LockService),t.ɵɵinject(e.AuthService))},token:e.ItemService,providedIn:"root"}),e.ItemService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ItemService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:Xr},{type:Ke},{type:ge},{type:Pe},{type:e.LockService},{type:e.AuthService}]},e.ItemService=Vi=M([et({ngZoneName:"ngZone"})],e.ItemService),e.KeyExchangeService=function(e){function t(t,n,r,i,a,o){var s=e.call(this,n)||this;return s.ngZone=t,s.injector=n,s.keyFactory=r,s.keyService=i,s.encryptionService=a,s.keyGraph=o,s.CLIENT_NONCE_LENGTH=32,s}return R(t,e),t.prototype.getOtKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return t?[4,ge.asKey(Object.assign(Object.assign({},JSON.parse(e.otk.otKeyParams)),{k:t}))]:[3,2];case 1:return[2,i.sent()];case 2:return"OTK_INITIATED"!==e.otk.state||e.isInitiator||!e.otk.responderPbkCipher?[3,5]:(n=this.keyService.currentPxk,[4,this.encryptionService.decrypt(n.jwk,JSON.parse(e.otk.responderPbkCipher),{serializations:[pe.COMPACT]})]);case 3:return(r=i.sent()).otKey?[4,ge.asKey(r.otKey)]:[3,5];case 4:return[2,i.sent()];case 5:return[2,null]}}))}))},t.prototype.decryptOtk=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s;return T(this,(function(u){switch(u.label){case 0:return[4,this.getOtKey(e,t)];case 1:return n=u.sent(),r=e.otk,n&&r.otKeyCipher?(a=(i=Object).assign,o=[Object.assign({},r)],s={otKey:n},[4,this.encryptionService.decrypt(n,e.otk.otKeyCipher)]):[3,3];case 2:r=a.apply(i,o.concat([(s.otKeyCipherClearJson=u.sent(),s)])),u.label=3;case 3:return[2,Object.assign(Object.assign({},e),{otk:r})]}}))}))},t.prototype.decryptResponseCipher=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.encryptionService.decrypt(e,n)];case 1:return n=i.sent(),[3,3];case 2:if("no key found"!==(r=i.sent()).message)throw r;return[3,3];case 3:return[4,this.encryptionService.decrypt(t,n)];case 4:return[2,i.sent()]}}))}))},t.prototype.decryptKeyExchangeAsInitiator=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d;return T(this,(function(l){switch(l.label){case 0:return t=this.keyService.currentRootKey,[4,this.encryptionService.decrypt(t.jwk,e.initiatorRootKeyCipher)];case 1:return n=l.sent(),[4,ge.asKey(n.otKey)];case 2:return r=l.sent(),e=Object.assign(Object.assign({},e),{initiatorRootKeyCipherClearJson:n}),(i=e.otk).initiatorOneTimePbkCipher?(o=(a=Object).assign,s=[Object.assign({},i)],u={},c=this.decryptResponseCipher,p=[r],[4,ge.asKey(n.oneTimePrk)]):[3,5];case 3:return[4,c.apply(this,p.concat([l.sent(),i.initiatorOneTimePbkCipher]))];case 4:i=o.apply(a,s.concat([(u.initiatorOneTimePbkCipherClearJson=l.sent(),u)])),l.label=5;case 5:return i.otKeyCipher?(d=i,[4,this.encryptionService.decrypt(r,i.otKeyCipher)]):[3,7];case 6:d.otKeyCipherClearJson=l.sent(),l.label=7;case 7:return[2,Object.assign(Object.assign({},e),{otk:i})]}}))}))},t.prototype.decryptKeyExchangeAsResponder=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.decryptOtk(e,t)]}))}))},t.prototype.decryptKeyExchange=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return e.isInitiator?[2,this.decryptKeyExchangeAsInitiator(e)]:[2,this.decryptKeyExchangeAsResponder(e,t)]}))}))},t.prototype.getKeyExchanges=function(e){var t=(void 0===e?{}:e).state;return A(this,void 0,void 0,(function(){var e,n=this;return T(this,(function(r){switch(r.label){case 0:return[4,this.query({query:hn,variables:{state:t}})];case 1:return e=r.sent().keyExchanges,[2,Promise.all(e.edges.map((function(e){return n.decryptKeyExchange(e.node)})))]}}))}))},t.prototype.getKeyExchange=function(e,t){var n=void 0===t?{}:t,r=n.otKeyK,i=n.token;return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.query({query:i?fn:yn,variables:{id:e,token:i},includeKeyGraph:!i})];case 1:return t=n.sent(),[2,this.decryptKeyExchange(t.keyExchange,r)]}}))}))},t.prototype.getCurrentUserSharedKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.query({query:In,variables:{username:e.username,userId:e.userId}})]}))}))},t.prototype.cancelKeyExchange=function(e){return this.mutate(this.cancelKeyExchangeMutation(e))},t.prototype.cancelKeyExchangeMutation=function(e){return new dt({mutation:vn,variables:{input:{id:e}}})},t.prototype.declineKeyExchange=function(e,t){return this.mutate(this.declineKeyExchangeMutation(e,t))},t.prototype.declineKeyExchangeMutation=function(e,t){return new dt({mutation:mn,variables:{input:{id:e,token:t}}})},t.prototype.initiateOtk=function(e){return void 0===e&&(e={}),A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return t=this.mutate,[4,this.initiateOtkMutation(e)];case 1:return[2,t.apply(this,[n.sent().lrMutation])]}}))}))},t.prototype.initiateOtkMutation=function(e){var t=void 0===e?{}:e,n=t.message,r=t.email,i=t.contactCard,a=t.upgrade;return A(this,void 0,void 0,(function(){var e,t,o,s,u,c,p,d,l,h,y,f,v;return T(this,(function(m){switch(m.label){case 0:return[4,this.keyFactory.createKey()];case 1:return e=m.sent(),t=this.keyFactory.randomString(this.CLIENT_NONCE_LENGTH),[4,this.keyFactory.createPkcKey()];case 2:return o=m.sent(),s=this.keyService.currentPxk,u=this.keyService.currentSigPxk,c=null,i&&i.ownerPlainDataJson?[4,this.encryptionService.signToString(u.jwk,i.ownerPlainDataJson)]:[3,4];case 3:c=m.sent(),m.label=4;case 4:return p={message:n,contactCard:i&&{sharedCipherDataClearJson:i.sharedCipherDataClearJson}},d={nonce:t,initiator:Object.assign(Object.assign({},p),{oneTimePbk:o.toJSON(),pbk:s.jwk.toJSON(),sigPbk:u.jwk.toJSON()})},[4,this.keyGraph.encryptToString(e,d)];case 5:return l=m.sent(),h={nonce:t,oneTimePrk:o.toJSON(!0),otKey:e.toJSON(!0),initiatorContactCard:i,initiator:p},y=this.keyService.currentRootKey,[4,this.keyGraph.encryptToString(y.jwk,h)];case 6:return f=m.sent(),v=e.toJSON(!0).k,[2,{lrMutation:new dt({mutation:gn,variables:{input:{initiatorRootKeyCipher:f,initiatorPxkId:s.id,initiatorSigPxkId:u.id,otKeyParams:JSON.stringify(e.toJSON()),otKeyCipher:l,sendEmail:r&&{email:r,rawOtKey:v},createTp:!0,initiatorPlainDataSig:c,upgrade:a}}}),otKeyK:v}]}}))}))},t.prototype.respondOtk=function(e){return this.mutate(this.respondOtkMutation(e))},t.prototype.respondOtkMutation=function(e){var t=e.keyExchangeId,n=e.token,r=e.decryptedOtk,i=e.message,a=e.initiatorContactCard,o=e.responderContactCard;return A(this,void 0,void 0,(function(){var e,s,u,c,p,d,l,h,y,f,v,m,g,S,C,I,b,w,K,P,k,D,R,E,M,A,O,j,N,F,$,_,L,U,x,q,J,G,Q,V,B,W,Z,H,Y,X,z,ee;return T(this,(function(T){switch(T.label){case 0:return e=this.keyService.currentRootKey,s=this.keyService.currentMasterKey,[4,this.keyFactory.createKey()];case 1:return u=T.sent(),[4,this.keyFactory.createKey()];case 2:return c=T.sent(),[4,this.encryptionService.encrypt(e.jwk,u.toJSON(!0))];case 3:return p=T.sent(),[4,this.encryptionService.encrypt(s.jwk,c.toJSON(!0))];case 4:return d=T.sent(),[4,ge.asKey(r.otKeyCipherClearJson.initiator.oneTimePbk)];case 5:return l=T.sent(),[4,ge.asKey(r.otKeyCipherClearJson.initiator.pbk)];case 6:return h=T.sent(),[4,ge.asKey(r.otKeyCipherClearJson.initiator.sigPbk)];case 7:return y=T.sent(),f=this.keyService.currentPxk,v=this.keyService.currentSigPxk,[4,this.encryptionService.sign(v.jwk,h.toJSON())];case 8:return m=T.sent(),[4,this.encryptionService.sign(v.jwk,y.toJSON())];case 9:return g=T.sent(),S={nonce:r.otKeyCipherClearJson.nonce,sharedKey:u.toJSON(!0),mkSharedKey:c.toJSON(!0),responder:{pbk:f.jwk.toJSON(),sigPbk:v.jwk.toJSON(),message:i}},r.otKeyCipherClearJson.initiator.contactCard?(I=r.otKeyCipherClearJson.initiator.contactCard.sharedCipherDataClearJson,[4,this.keyFactory.createKey()]):[3,19];case 10:return b=T.sent(),[4,this.keyFactory.createKey()];case 11:return $=T.sent(),_=this.keyService.currentSigPxk,w={},P=(K=JSON).stringify,[4,this.encryptionService.encrypt(e.jwk,b.toJSON(!0))];case 12:return w.receiverWrappedKey=P.apply(K,[T.sent()]),w.receiverWrappingKeyId=e.id,a?(R=(D=JSON).stringify,[4,this.encryptionService.encrypt(b,a.receiverCipherDataClearJson)]):[3,14];case 13:return k=R.apply(D,[T.sent()]),[3,15];case 14:k="",T.label=15;case 15:return w.receiverCipherData=k,M=(E=JSON).stringify,[4,this.encryptionService.encrypt(u,$.toJSON(!0))];case 16:return w.sharedWrappedKey=M.apply(E,[T.sent()]),C=w,[4,this.encryptionService.encrypt($,I)];case 17:return B=T.sent(),A=C,j=(O=JSON).stringify,[4,this.encryptionService.sign(_.jwk,B)];case 18:A.sharedCipherDataSig=j.apply(O,[T.sent()]),C.sigPxkId=_.id,S.responder.contactCard=Object.assign(Object.assign({},S.responder.contactCard),{sharedCipherKey:$.toJSON(!0)}),T.label=19;case 19:return o?[4,this.keyFactory.createKey()]:[3,31];case 20:return F=T.sent(),[4,this.keyFactory.createKey()];case 21:return $=T.sent(),_=this.keyService.currentSigPxk,L={},x=(U=JSON).stringify,[4,this.encryptionService.encrypt(e.jwk,F.toJSON(!0))];case 22:return L.ownerWrappedKey=x.apply(U,[T.sent()]),L.ownerWrappingKeyId=e.id,o.ownerCipherDataClearJson?(G=(J=JSON).stringify,[4,this.encryptionService.encrypt(F,o.ownerCipherDataClearJson)]):[3,24];case 23:return q=G.apply(J,[T.sent()]),[3,25];case 24:q="",T.label=25;case 25:return L.ownerCipherData=q,V=(Q=JSON).stringify,[4,this.encryptionService.encrypt(u,$.toJSON(!0))];case 26:return L.sharedWrappedKey=V.apply(Q,[T.sent()]),N=L,[4,this.encryptionService.encrypt($,o.sharedCipherDataClearJson)];case 27:return B=T.sent(),W=N,H=(Z=JSON).stringify,[4,this.encryptionService.sign(_.jwk,B)];case 28:return W.sharedCipherDataSig=H.apply(Z,[T.sent()]),N.sigPxkId=_.id,o.ownerPlainDataJson?(Y=N,z=(X=JSON).stringify,[4,this.encryptionService.sign(v.jwk,o.ownerPlainDataJson)]):[3,30];case 29:Y.ownerPlainDataSig=z.apply(X,[T.sent()]),T.label=30;case 30:S.responder.contactCard=Object.assign(Object.assign({},S.responder.contactCard),{sharedCipherDataClearJson:o.sharedCipherDataClearJson}),T.label=31;case 31:return[4,this.encryptionService.encrypt(l,S)];case 32:return ee=T.sent(),[4,this.encryptionService.encrypt(r.otKey,ee)];case 33:return ee=T.sent(),[2,new dt({mutation:Sn,variables:{input:{keyExchangeId:t,keyExchangeToken:n,rootKeyId:e.id,masterKeyId:s.id,responderPxkId:f.id,responderSigPxkId:v.id,signedInitiatorPbk:JSON.stringify(m),signedInitiatorSigPbk:JSON.stringify(g),rkWrappedSharedKey:JSON.stringify(p),mkWrappedMkSharedKey:JSON.stringify(d),initiatorOneTimePbkCipher:JSON.stringify(ee),initiatorContactCard:C,responderContactCard:N}}})]}}))}))},t.prototype.completeOtk=function(e){return this.mutate(this.completeOtkMutation(e))},t.prototype.completeOtkMutation=function(e){var t=e.keyExchangeId,n=e.initiatorRootKeyCipher,r=e.initiatorOneTimePbkCipher,i=e.responderContactCard,a=e.initiatorContactCard;return A(this,void 0,void 0,(function(){var e,o,s,u,c,p,d,l,h,y,f,v,m,g,S,C,I,b,w,K,P,k,D,R,E,M,A,O,j,N,F,$,_,L,U,x,q;return T(this,(function(T){switch(T.label){case 0:return e=this.keyService.currentRootKey,o=this.keyService.currentMasterKey,[4,this.encryptionService.decrypt(e.jwk,n)];case 1:return s=T.sent(),c=this.decryptResponseCipher,[4,ge.asKey(s.otKey)];case 2:return p=[T.sent()],[4,ge.asKey(s.oneTimePrk)];case 3:return[4,c.apply(this,p.concat([T.sent(),r]))];case 4:if(u=T.sent(),s.nonce!==u.nonce)throw new Y("The nonce returned by responder does not match with the one created by the initiator.");return d=this.keyService.currentSigPxk,[4,ge.asKey(u.responder.sigPbk)];case 5:return l=T.sent(),[4,ge.asKey(u.responder.pbk)];case 6:return h=T.sent(),[4,this.encryptionService.sign(d.jwk,h.toJSON())];case 7:return y=T.sent(),[4,this.encryptionService.sign(d.jwk,l.toJSON())];case 8:return f=T.sent(),[4,ge.asKey(u.sharedKey)];case 9:return v=T.sent(),[4,this.encryptionService.encrypt(e.jwk,v.toJSON(!0))];case 10:return m=T.sent(),[4,ge.asKey(u.mkSharedKey)];case 11:return g=T.sent(),[4,this.encryptionService.encrypt(o.jwk,g.toJSON(!0))];case 12:return S=T.sent(),i?[4,this.keyFactory.createKey()]:[3,16];case 13:return I=T.sent(),b={},K=(w=JSON).stringify,[4,this.encryptionService.encrypt(e.jwk,I.toJSON(!0))];case 14:return b.receiverWrappedKey=K.apply(w,[T.sent()]),b.receiverWrappingKeyId=e.id,k=(P=JSON).stringify,[4,this.encryptionService.encrypt(I,i.receiverCipherDataClearJson)];case 15:b.receiverCipherData=k.apply(P,[T.sent()]),C=b,T.label=16;case 16:return s.initiatorContactCard?(E=s.initiatorContactCard,[4,this.keyFactory.createKey()]):[3,25];case 17:return M=T.sent(),[4,ge.asKey(u.responder.contactCard.sharedCipherKey)];case 18:return A=T.sent(),N=(j=JSON).stringify,[4,this.encryptionService.encrypt(e.jwk,M.toJSON(!0))];case 19:return O=N.apply(j,[T.sent()]),(F=(null==a?void 0:a.ownerCipherDataClearJson)||E.ownerCipherDataClearJson)?[4,this.keyGraph.encryptToString(M,F)]:[3,21];case 20:return _=T.sent(),[3,22];case 21:_="",T.label=22;case 22:return $=_,D={ownerWrappedKey:O,ownerWrappingKeyId:e.id,ownerCipherData:$},R={sigPxkId:d.id},[4,this.encryptionService.encrypt(A,E.sharedCipherDataClearJson)];case 23:return L=T.sent(),U=R,q=(x=JSON).stringify,[4,this.encryptionService.sign(d.jwk,L)];case 24:U.sharedCipherDataSig=q.apply(x,[T.sent()]),T.label=25;case 25:return[2,new dt({mutation:Cn,variables:{input:{keyExchangeId:t,rootKeyId:e.id,masterKeyId:o.id,initiatorSigPxkId:d.id,signedResponderPbk:JSON.stringify(y),signedResponderSigPbk:JSON.stringify(f),rkWrappedSharedKey:JSON.stringify(m),mkWrappedMkSharedKey:JSON.stringify(S),responderContactCardCipher:C,initiatorContactCardCipher:D,initiatorContactCardSharedCipher:R}}})]}}))}))},t}($t),e.KeyExchangeService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.KeyExchangeService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(ge),t.ɵɵinject(Ke),t.ɵɵinject(ve),t.ɵɵinject(Pe))},token:e.KeyExchangeService,providedIn:"root"}),e.KeyExchangeService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.KeyExchangeService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:ge},{type:Ke},{type:ve},{type:Pe}]},e.KeyExchangeService=M([et({ngZoneName:"ngZone"})],e.KeyExchangeService);var Xi="LBOP";(e.KcLbopErrorCode||(e.KcLbopErrorCode={})).INVALID_PASSPHRASE="INVALID_PASSPHRASE";var zi,ea,ta,na,ra,ia=K.default(zi||(zi=F(["\n mutation CreateLbop($input: CreateLbopInput!) {\n createLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"],["\n mutation CreateLbop($input: CreateLbopInput!) {\n createLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"]))),aa=K.default(ea||(ea=F(["\n mutation DeleteLbop($input: DeleteLbopInput!) {\n deleteLbop(input: $input) {\n id\n }\n }\n"],["\n mutation DeleteLbop($input: DeleteLbopInput!) {\n deleteLbop(input: $input) {\n id\n }\n }\n"]))),oa=K.default(ta||(ta=F(["\n mutation UpdateLbop($input: UpdateLbopInput!) {\n updateLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"],["\n mutation UpdateLbop($input: UpdateLbopInput!) {\n updateLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"]))),sa=K.default(na||(na=F(["\n query Lbop($id: LrRelayIdInput!) {\n lbop(id: $id) {\n id\n cipherMeta\n }\n }\n"],["\n query Lbop($id: LrRelayIdInput!) {\n lbop(id: $id) {\n id\n cipherMeta\n }\n }\n"]))),ua=K.default(ra||(ra=F(["\n query Lbops {\n lbops {\n edges {\n node {\n id\n cipherMeta\n }\n }\n }\n }\n"],["\n query Lbops {\n lbops {\n edges {\n node {\n id\n cipherMeta\n }\n }\n }\n }\n"]))),ca=function(){function t(e,t,n,r,i,a,o,s){this.config=e,this.http=t,this.lrApollo=n,this.auth=r,this.keyFactory=i,this.keyService=a,this.encryptionService=o,this.passwordService=s,this.CLIENT_NONCE_LENGTH=32,this.LBOP_WORDS=25}return t.prototype.getPartial=function(e){return e.split(" ")[0]},t.prototype.remove=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.lrApollo.mutate({mutation:aa,variables:{input:{id:e}}})];case 1:return[2,t.sent().deleteLbop.id]}}))}))},t.prototype.update=function(e){var t=e.id,n=e.name;return A(this,void 0,void 0,(function(){var e,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.get(t)];case 1:return(e=a.sent()).name=n,r=this.keyService.currentMasterKey,[4,this.encryptionService.encrypt(r.jwk,e)];case 2:return i=a.sent(),[4,this.lrApollo.mutate({mutation:oa,variables:{input:{id:t,cipherMeta:JSON.stringify(i)}}})];case 3:return[2,a.sent().updateLbop]}}))}))},t.prototype.get=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.lrApollo.query({query:sa,variables:{id:e}})];case 1:return t=i.sent(),n=this.keyService.currentMasterKey,[4,this.encryptionService.decrypt(n.jwk,JSON.parse(t.lbop.cipherMeta))];case 2:return r=i.sent(),[2,Object.assign({id:t.id},r)]}}))}))},t.prototype.list=function(){return A(this,void 0,void 0,(function(){var e,t,n=this;return T(this,(function(r){switch(r.label){case 0:return[4,this.lrApollo.query({query:ua})];case 1:return e=r.sent(),[4,this.keyService.currentMasterKey];case 2:return t=r.sent(),[2,Promise.all(e.lbops.edges.map((function(e){return A(n,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,this.encryptionService.decrypt(t.jwk,JSON.parse(e.node.cipherMeta))];case 1:return n=r.sent(),[2,Object.assign({id:e.node.id},n)]}}))}))})))]}}))}))},t.prototype.create=function(e){var t=e.name;return A(this,void 0,void 0,(function(){var e,n,r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,S;return T(this,(function(C){switch(C.label){case 0:if(1024!==g.Slip39Helper.WORD_LIST.length)throw new V("Slip39Helper.WORD_LIST.length != 1024");return[4,this.list()];case 1:for(e=C.sent(),r=function(){n=i.keyFactory.randomChoices(g.Slip39Helper.WORD_LIST,i.LBOP_WORDS).join(" ");var t=i.getPartial(n);if(!e.some((function(e){return e.partial===t})))return"break"},i=this;"break"!==r(););return[4,this.keyFactory.createLbopKeyParams()];case 2:return a=C.sent(),u=(s=this.keyFactory).deriveLbopKey,p=(c=Object).assign,d={},[4,this.keyFactory.importPassword(n)];case 3:return[4,u.apply(s,[p.apply(c,[(d.password=C.sent(),d),a])])];case 4:return o=C.sent().jwk,[4,this.keyFactory.createSignKey()];case 5:return l=C.sent(),[4,this.encryptionService.encrypt(o,l.toJSON(!0))];case 6:return h=C.sent(),y=this.keyService.currentMasterKey,[4,this.encryptionService.encrypt(o,y.jwk.toJSON(!0))];case 7:return f=C.sent(),v=Object.assign(Object.assign({},t&&{name:t}),{partial:this.getPartial(n)}),[4,this.encryptionService.encrypt(y.jwk,v)];case 8:return m=C.sent(),[4,this.lrApollo.mutate({mutation:ia,variables:{input:{cipherMeta:JSON.stringify(m),lbopKeyParams:JSON.stringify(a),lbopKeyVerifier:JSON.stringify(l.toJSON(!0)),wrappedLbopKeyVerifier:JSON.stringify(h),masterKeyId:y.id,wrappedMasterKey:JSON.stringify(f)}}})];case 9:return S=C.sent(),[2,Object.assign(Object.assign({},S.createLbop.lbop),{lbopString:n})]}}))}))},t.prototype.verifyLbops=function(t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,g;return T(this,(function(S){switch(S.label){case 0:r=this.keyFactory.randomString(this.CLIENT_NONCE_LENGTH),S.label=1;case 1:S.trys.push([1,11,12,13]),i=O(t.lbops),a=i.next(),S.label=2;case 2:return a.done?[3,10]:(o=a.value,c=(u=this.keyFactory).deriveLbopKey,d=(p=Object).assign,l={},[4,this.keyFactory.importPassword(n)]);case 3:return[4,c.apply(u,[d.apply(p,[(l.password=S.sent(),l),o.lbopKeyParams])])];case 4:s=S.sent().jwk,S.label=5;case 5:return S.trys.push([5,8,,9]),[4,this.encryptionService.decrypt(s,o.wrappedLbopKeyVerifier)];case 6:return h=S.sent(),y=t.challenge.serverNonce,[4,this.encryptionService.sign(h,{serverNonce:y,clientNonce:r})];case 7:return f=S.sent(),[2,{lbop:o,signedChallenge:f,lbopKey:s}];case 8:return S.sent(),[3,9];case 9:return a=i.next(),[3,2];case 10:return[3,13];case 11:return v=S.sent(),m={error:v},[3,13];case 12:try{a&&!a.done&&(g=i.return)&&g.call(i)}finally{if(m)throw m.error}return[7];case 13:throw new J(new q({source:Xi,code:e.KcLbopErrorCode.INVALID_PASSPHRASE,message:"Invalid passphrase."}))}}))}))},t.prototype.verifyContact=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.http.post(this.config.authUrl+"users/lbop-reset/verify-contact/",e).toPromise()]}))}))},t.prototype.confirmContact=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.http.post(this.config.authUrl+"cove/respond/",{claim_id:e.claimId,v_code:e.vCode}).toPromise()]}))}))},t.prototype.verify=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return[4,this.http.post(this.config.authUrl+"users/lbop-reset/get-challenge/",{claimId:e.claimId,claimToken:e.claimToken}).toPromise()];case 1:return t=p.sent(),[4,this.verifyLbops(t,e.lbop)];case 2:return n=p.sent(),r=n.signedChallenge,i=n.lbop,a=n.lbopKey,[4,this.http.post(this.config.authUrl+"users/lbop-reset/verify-challenge/",{lbopId:i.lbopId,signedChallenge:r}).toPromise()];case 3:return o=p.sent(),s={lbopId:i.lbopId,verifiedToken:o.verifiedToken,masterKeyId:o.masterKeyId},c=(u=ge).asKey,[4,this.encryptionService.decrypt(a,o.wrappedMasterKey)];case 4:return[4,c.apply(u,[p.sent()])];case 5:return[2,(s.masterKey=p.sent(),s)]}}))}))},t.prototype.setPassword=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.passwordService.createPassKeyBundle(e.newPassword)];case 1:return t=a.sent(),[4,this.encryptionService.encrypt(t.passKey,e.masterKey.toJSON(!0))];case 2:return n=a.sent(),[4,this.http.post(this.config.authUrl+"users/lbop-reset/set-password/",{lbopId:e.lbopId,verifiedToken:e.verifiedToken,masterKeyId:e.masterKeyId,newWrappedMasterKey:n,newPassKey:{passKeyParams:t.passKeyParams,passIdpParams:t.passIdpParams,passIdpVerifierPbk:t.passIdpVerifier.toJSON(),wrappedPassIdpVerifierPrk:t.wrappedPassIdpVerifierPrk}}).toPromise()];case 3:return r=a.sent(),[4,this.auth.signIn(r.username,r.idpPassword,{noProxy:"true"})];case 4:if("NEW_PASSWORD_REQUIRED"!==(i=a.sent()).challengeName)throw new ee("Expecting Cognito to have done a password reset.");return[4,this.auth.completeNewPassword(i,this.passwordService.getPassIdpString(t.passIdp),{})];case 5:return i=a.sent(),[4,this.auth.signOut()];case 6:return a.sent(),[4,this.http.post(this.config.authUrl+"users/lbop-reset/complete/",{lbopId:e.lbopId,setPasswordToken:r.setPasswordToken}).toPromise()];case 7:return[2,a.sent()]}}))}))},t}();ca.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new ca(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(ke),t.ɵɵinject(o.AuthClass),t.ɵɵinject(ge),t.ɵɵinject(Ke),t.ɵɵinject(ve),t.ɵɵinject(sr))},token:ca,providedIn:"root"}),ca.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ca.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:ke},{type:o.AuthClass},{type:ge},{type:Ke},{type:ve},{type:sr}]};var pa=function(){function e(){}return e.forRoot=function(r){return{ngModule:e,providers:[{provide:Se,useValue:r},{provide:o.AuthClass,useValue:k.default},{provide:t.APP_INITIALIZER,useFactory:xt,deps:[Se,o.AuthClass],multi:!0},{provide:n.APOLLO_OPTIONS,useFactory:be,deps:[Se,o.AuthClass]}]}},e}();pa.decorators=[{type:t.NgModule,args:[{imports:[y.HttpClientModule,m.NgIdleKeepaliveModule.forRoot()]}]}];var da,la,ha,ya,fa,va=Oe(da||(da=F(["\nmutation UpdateNotificationMutation($input: UpdateNotificationInput!) {\n updateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"],["\nmutation UpdateNotificationMutation($input: UpdateNotificationInput!) {\n updateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"]))),ma=Oe(la||(la=F(["\nmutation UpdateAllNotificationsReadStateMutation($input: UpdateAllNotificationsReadStateInput!) {\n updateAllNotificationsReadState(input: $input) {\n count\n }\n}\n"],["\nmutation UpdateAllNotificationsReadStateMutation($input: UpdateAllNotificationsReadStateInput!) {\n updateAllNotificationsReadState(input: $input) {\n count\n }\n}\n"]))),ga=Oe(ha||(ha=F(["\nmutation DebugCreateNotificationMutation($input: DebugCreateNotificationInput!) {\n debugCreateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"],["\nmutation DebugCreateNotificationMutation($input: DebugCreateNotificationInput!) {\n debugCreateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"]))),Sa=Oe(ya||(ya=F(["\nmutation DebugDeleteAllNotificationsMutation($input: DebugDeleteAllNotificationsInput!) {\n debugDeleteAllNotifications(input: $input) {\n count\n }\n}\n"],["\nmutation DebugDeleteAllNotificationsMutation($input: DebugDeleteAllNotificationsInput!) {\n debugDeleteAllNotifications(input: $input) {\n count\n }\n}\n"]))),Ca=Oe(fa||(fa=F(["\nmutation UpdateNotificationFeatureStateMutation($input: UpdateNotificationFeatureStateInput!) {\n updateNotificationFeatureState(input: $input) {\n featureState {\n notificationsLastViewed\n\t\t}\n }\n}\n"],["\nmutation UpdateNotificationFeatureStateMutation($input: UpdateNotificationFeatureStateInput!) {\n updateNotificationFeatureState(input: $input) {\n featureState {\n notificationsLastViewed\n\t\t}\n }\n}\n"])));e.NotificationService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.updateNotification=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateNotificationMutation(e))]}))}))},t.prototype.updateNotificationMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:va,variables:{input:Object.assign({},e)}})]}))}))},t.prototype.updateAllNotificationsReadState=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateAllNotificationsReadStateMutation(e))]}))}))},t.prototype.updateAllNotificationsReadStateMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:ma,variables:{input:Object.assign({},e)}})]}))}))},t.prototype.debugCreateNotification=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.debugCreateNotificationMutation(e))]}))}))},t.prototype.debugCreateNotificationMutation=function(e){var t;return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,new dt({mutation:ga,variables:{input:{receiverId:e.receiverId,hasBeenRead:e.hasBeenRead,timeRead:null===(t=e.timeRead)||void 0===t?void 0:t.toISOString(),plainData:JSON.stringify(e.plainData),plainMeta:JSON.stringify(e.plainMeta)}}})]}))}))},t.prototype.debugDeleteAllNotifications=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.debugDeleteAllNotificationsMutation(e))]}))}))},t.prototype.debugDeleteAllNotificationsMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Sa,variables:{input:{receiverId:e.receiverId}}})]}))}))},t.prototype.updateNotificationFeatureState=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateNotificationFeatureStateMutation(e))]}))}))},t.prototype.updateNotificationFeatureStateMutation=function(e){var t;return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,new dt({mutation:Ca,variables:{input:{lastViewed:null===(t=e.lastViewed)||void 0===t?void 0:t.toISOString(),clearLastViewed:null==e.lastViewed||void 0}}})]}))}))},t}($t),e.NotificationService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.NotificationService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.NotificationService,providedIn:"root"}),e.NotificationService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.NotificationService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.NotificationService=M([et({ngZoneName:"ngZone"})],e.NotificationService);var Ia,ba,wa,Ka,Pa,ka,Da,Ra,Ea,Ma,Aa=Oe(Ia||(Ia=F(["\nmutation InitiateStripePaymentMethodCaptureMutation {\n initiateStripePaymentMethodCapture(input: {}) {\n paymentCapture {\n stripeIntentId\n stripeClientSecret\n }\n }\n}\n"],["\nmutation InitiateStripePaymentMethodCaptureMutation {\n initiateStripePaymentMethodCapture(input: {}) {\n paymentCapture {\n stripeIntentId\n stripeClientSecret\n }\n }\n}\n"]))),Ta=Oe(ba||(ba=F(["\nmutation CompleteStripePaymentMethodCaptureMutation($input: CompleteStripePaymentMethodCaptureInput!) {\n completeStripePaymentMethodCapture(input: $input) {\n paymentMethod {\n id\n created\n modified\n card {\n brand\n lastFourDigits\n expiryYear\n expiryMonth\n }\n isDefault \n }\n }\n}\n"],["\nmutation CompleteStripePaymentMethodCaptureMutation($input: CompleteStripePaymentMethodCaptureInput!) {\n completeStripePaymentMethodCapture(input: $input) {\n paymentMethod {\n id\n created\n modified\n card {\n brand\n lastFourDigits\n expiryYear\n expiryMonth\n }\n isDefault \n }\n }\n}\n"]))),Oa=Oe(wa||(wa=F(["\nmutation RemovePaymentMethodMutation($input: RemovePaymentMethodInput!) {\n removePaymentMethod(input: $input) {\n id\n }\n}\n"],["\nmutation RemovePaymentMethodMutation($input: RemovePaymentMethodInput!) {\n removePaymentMethod(input: $input) {\n id\n }\n}\n"]))),ja=Oe(Ka||(Ka=F(["\nmutation SetDefaultPaymentMethodMutation($input: SetDefaultPaymentMethodInput!) {\n setDefaultPaymentMethod(input: $input) {\n paymentMethod {\n id\n } \n }\n}\n"],["\nmutation SetDefaultPaymentMethodMutation($input: SetDefaultPaymentMethodInput!) {\n setDefaultPaymentMethod(input: $input) {\n paymentMethod {\n id\n } \n }\n}\n"]))),Na=Oe(Pa||(Pa=F(["\nmutation RemoveDefaultPaymentMethodMutation {\n removeDefaultPaymentMethod(input: {}) {\n paymentMethod {\n id\n } \n }\n}\n"],["\nmutation RemoveDefaultPaymentMethodMutation {\n removeDefaultPaymentMethod(input: {}) {\n paymentMethod {\n id\n } \n }\n}\n"]))),Fa=Oe(ka||(ka=F(["\nmutation IssuePlanMutation($input: IssuePlanInput!) {\n issuePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"],["\nmutation IssuePlanMutation($input: IssuePlanInput!) {\n issuePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"]))),$a=Oe(Da||(Da=F(["\nmutation CancelPlanMutation($input: CancelPlanInput!) {\n cancelPlan(input: $input) {\n plan {\n id\n } \n }\n}\n"],["\nmutation CancelPlanMutation($input: CancelPlanInput!) {\n cancelPlan(input: $input) {\n plan {\n id\n } \n }\n}\n"]))),_a=Oe(Ra||(Ra=F(["\nmutation ChangePriceOptionMutation($input: ChangePriceOptionInput!) {\n changePriceOption(input: $input) {\n plan {\n id\n }\n }\n}\n"],["\nmutation ChangePriceOptionMutation($input: ChangePriceOptionInput!) {\n changePriceOption(input: $input) {\n plan {\n id\n }\n }\n}\n"]))),La=Oe(Ea||(Ea=F(["\nmutation ReactivatePlanMutation($input: ReactivatePlanInput!) {\n reactivatePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"],["\nmutation ReactivatePlanMutation($input: ReactivatePlanInput!) {\n reactivatePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"])));e.PlanService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.initiateStripePaymentMethodCapture=function(){return this.mutate(this.initiateStripePaymentMethodCaptureMutation())},t.prototype.initiateStripePaymentMethodCaptureMutation=function(){return new dt({mutation:Aa,variables:{input:{}}})},t.prototype.completeStripePaymentMethodCapture=function(e){return this.mutate(this.completeStripePaymentMethodCaptureMutation(e))},t.prototype.completeStripePaymentMethodCaptureMutation=function(e){return new dt({mutation:Ta,variables:{input:{stripeIntentId:e}}})},t.prototype.setDefaultPaymentMethod=function(e){return this.mutate(this.setDefaultPaymentMethodMutation(e))},t.prototype.setDefaultPaymentMethodMutation=function(e){return new dt({mutation:ja,variables:{input:{paymentMethodId:e}}})},t.prototype.removeDefaultPaymentMethod=function(){return this.mutate(this.removeDefaultPaymentMethodMutation())},t.prototype.removeDefaultPaymentMethodMutation=function(){return new dt({mutation:Na,variables:{input:{}}})},t.prototype.issuePlan=function(e){return this.mutate(this.issuePlanMutation(e))},t.prototype.issuePlanMutation=function(e){return new dt({mutation:Fa,variables:{input:e}})},t.prototype.removePaymentMethod=function(e){return this.mutate(this.removePaymentMethodMutation(e))},t.prototype.removePaymentMethodMutation=function(e){return new dt({mutation:Oa,variables:{input:{paymentMethodId:e}}})},t.prototype.cancelPlan=function(e){return this.mutate(this.cancelPlanMutation(e))},t.prototype.cancelPlanMutation=function(e){return new dt({mutation:$a,variables:{input:e}})},t.prototype.changePriceOption=function(e){return this.mutate(this.changePriceOptionMutation(e))},t.prototype.changePriceOptionMutation=function(e){return new dt({mutation:_a,variables:{input:e}})},t.prototype.reactivatePlan=function(e){return this.mutate(this.reactivatePlanMutation(e))},t.prototype.reactivatePlanMutation=function(e){return new dt({mutation:La,variables:{input:{planId:e}}})},t}($t),e.PlanService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.PlanService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.PlanService,providedIn:"root"}),e.PlanService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.PlanService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.PlanService=M([et({ngZoneName:"ngZone"})],e.PlanService),function(e){e.Name="name",e.Email="email",e.Image="image",e.Phone="phone",e.Address="address"}(Ma||(Ma={}));var Ua=[Ma.Name,Ma.Email,Ma.Image,Ma.Phone,Ma.Address],xa=function(){function t(e,t,n){this.sharedContactCardService=e,this.profileService=t,this.api=n}return t.prototype.updateDetails=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return console.log("updateDetails()"),[4,this.fetchMainContactCard()];case 1:return t=r.sent(),[4,this.profileService.updateDetails(null==t?void 0:t.id,null==t?void 0:t.keyId,e)];case 2:return n=r.sent(),[4,this.synchronizeContactCards(e,null==t?void 0:t.fields)];case 3:return r.sent(),[2,n]}}))}))},t.prototype.updateTrustedPartyDetails=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return t=e.id,n=e.ownedKeyId,r=e.sharedKeyId,i=E(e,["id","ownedKeyId","sharedKeyId"]),[4,this.sharedContactCardService.updateMySharedContactCard(t,n,r,i)];case 1:return a.sent(),[4,this.synchronizeSharedDetails(e)];case 2:return a.sent(),[2]}}))}))},t.prototype.synchronizeSharedDetails=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d,l,h;return T(this,(function(y){switch(y.label){case 0:return t=!1,[4,this.fetchMainContactCard()];case 1:if(n=y.sent(),e.name&&(c=this.checkField(e.name,n.fields.name))&&(n.fields.name=c,t=!0),e.email&&(c=this.checkField(e.email,n.fields.email))&&(n.fields.email=c,t=!0),e.image&&(c=this.checkField(e.image,n.fields.image))&&(n.fields.image=c,t=!0),e.phones&&e.phones.length)try{for(r=O(e.phones),i=r.next();!i.done;i=r.next())a=i.value,(c=this.checkField(a.value,n.fields.phone,a.label))&&(n.fields.phone=c,t=!0)}catch(e){p={error:e}}finally{try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(p)throw p.error}}if(e.addresses&&e.addresses.length)try{for(o=O(e.addresses),s=o.next();!s.done;s=o.next())u=s.value,(c=this.checkField(u.value,n.fields.address,u.label))&&(n.fields.address=c,t=!0)}catch(e){l={error:e}}finally{try{s&&!s.done&&(h=o.return)&&h.call(o)}finally{if(l)throw l.error}}return t?[4,this.profileService.updateDetails(n.id,n.keyId,n.fields)]:[3,3];case 2:y.sent(),y.label=3;case 3:return[2]}}))}))},t.prototype.fetchMainContactCard=function(){var e;return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.api.query({query:Yn})];case 1:return[2,(t=null===(e=n.sent().contactCards.edges[0])||void 0===e?void 0:e.node)?{id:t.id,keyId:t.key.id,fields:t.cipherDataClearJson}:null]}}))}))},t.prototype.getTrustedParties=function(){return A(this,void 0,void 0,(function(){var e=this;return T(this,(function(t){switch(t.label){case 0:return[4,this.api.query({query:Hn})];case 1:return[2,_t(t.sent().tps).map((function(t){return e.mapTrustedParty(t)}))]}}))}))},t.prototype.mapTrustedParty=function(t){var n,r,i=t.sharedContactCard.sharedCipherDataClearJson,a=Object.assign(Object.assign({},t.myContactCard.sharedCipherDataClearJson),{id:t.myContactCard.id,ownedKeyId:t.myContactCard.ownerKey.id,sharedKeyId:t.myContactCard.sharedKey.id});return{id:t.id,type:e.TrustedPartyType.User,hasScenarios:!!t.sharedScenarios.edges.length,hasSharedVault:!!t.theirItems.directories.edges.length,name:null===(n=null==i?void 0:i.name)||void 0===n?void 0:n.name,details:i,mySharedDetails:a,userSharedKey:t.currentUserSharedKey.userSharedKey,username:t.other.username,features:{sharedVault:{hasAccess:"access"===((null===(r=t.other.features)||void 0===r?void 0:r.shareVault)||["noaccess"])[0]}}}},t.prototype.synchronizeContactCards=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return t?0===(n=this.getChanges(e,t)).length?[2]:[4,this.getTrustedParties()]:[2];case 1:if(0===(r=p.sent()).length)return[2];p.label=2;case 2:p.trys.push([2,7,8,9]),i=O(r.map((function(e){return e.mySharedDetails}))),a=i.next(),p.label=3;case 3:return a.done?[3,6]:(o=a.value,[4,this.synchronizeSharedContactCard(o,n)]);case 4:p.sent(),p.label=5;case 5:return a=i.next(),[3,3];case 6:return[3,9];case 7:return s=p.sent(),u={error:s},[3,9];case 8:try{a&&!a.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}return[7];case 9:return[2]}}))}))},t.prototype.getChanges=function(e,t){var n,r,i,a,o,s=[];try{for(var u=O(Ua),c=u.next();!c.done;c=u.next()){var p=c.value,d=t[p];if(d&&d.values){var l=function(t){var n=null===(o=e[p].values)||void 0===o?void 0:o.find((function(e){return e.id===t.id}));n?w.default.isEqual(n.value,t.value)||s.push({field:p,id:t.id,label:t.label,oldValue:t.value,newValue:n.value}):s.push({field:p,id:t.id,label:t.label,oldValue:t.value})};try{for(var h=(i=void 0,O(d.values)),y=h.next();!y.done;y=h.next()){l(y.value)}}catch(e){i={error:e}}finally{try{y&&!y.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return s},t.prototype.synchronizeSharedContactCard=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l;return T(this,(function(h){switch(h.label){case 0:n=!1,r=function(t){switch(t.field){case Ma.Phone:(r=e.phones&&e.phones.find((function(e){return e.label===t.label})))&&(n=!0,r.value=t.newValue);break;case Ma.Address:(r=e.addresses&&e.addresses.find((function(e){return e.label===t.label})))&&(n=!0,r.value=t.newValue);break;default:var r=e[t.field];w.default.isEqual(r,t.oldValue)&&(n=!0,e[t.field]=t.newValue)}};try{for(i=O(t),a=i.next();!a.done;a=i.next())o=a.value,r(o)}catch(e){d={error:e}}finally{try{a&&!a.done&&(l=i.return)&&l.call(i)}finally{if(d)throw d.error}}return n?(s=e.id,u=e.ownedKeyId,c=e.sharedKeyId,p=E(e,["id","ownedKeyId","sharedKeyId"]),[4,this.sharedContactCardService.updateMySharedContactCard(s,u,c,p)]):[3,2];case 1:h.sent(),h.label=2;case 2:return[2]}}))}))},t.prototype.checkField=function(e,t,n){return void 0===n&&(n=null),(t=t||{value:e,hasMultiple:!1}).values=t.values||[],0===t.values.length||t.values.every((function(t){return!w.default.isEqual(e,t.value)}))?(t.values.push({id:n+"-"+(new Date).getTime(),label:n,value:e}),t.hasMultiple=t.values.length>1,t.value=t.value||e,t):null},t}();xa.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new xa(t.ɵɵinject(Un),t.ɵɵinject(Xn),t.ɵɵinject(e.ɵg))},token:xa,providedIn:"root"}),xa.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],xa.ctorParameters=function(){return[{type:Un},{type:Xn},{type:e.ɵg}]};var qa=function(){function e(e,t,n,r,i,a){this.config=e,this.auth=t,this.http=n,this.keyFactory=r,this.encryptionService=i,this.passwordService=a}return e.prototype.verifyEmail=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.http.post(this.config.authUrl+"cove/claim/email/",{address:e,context:"signup"}).toPromise()];case 1:return[2,t.sent().claim_id]}}))}))},e.prototype.verifyPhone=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.http.post(this.config.authUrl+"cove/claim/sms/",{address:e,context:"signup"}).toPromise()];case 1:return[2,t.sent().claim_id]}}))}))},e.prototype.confirmVerificationCode=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.http.post(this.config.authUrl+"cove/respond/",{claim_id:e,v_code:t}).toPromise()];case 1:return[2,n.sent().token]}}))}))},e.prototype.register=function(e,t,n,r,i){return void 0===i&&(i="email"),A(this,void 0,void 0,(function(){var a,o,s,u,c,p,d,l,h,y,f,v,m;return T(this,(function(g){switch(g.label){case 0:return[4,this.passwordService.createPassKeyBundle(t)];case 1:return a=g.sent(),[4,this.keyFactory.createKey()];case 2:return o=g.sent(),[4,this.encryptionService.encrypt(a.passKey,o.toJSON(!0))];case 3:return s=g.sent(),[4,this.keyFactory.createKey()];case 4:return u=g.sent(),[4,this.encryptionService.encrypt(o,u.toJSON(!0))];case 5:return c=g.sent(),[4,this.keyFactory.createPkcKey()];case 6:return p=g.sent(),[4,this.encryptionService.encrypt(u,p.toJSON(!0))];case 7:return d=g.sent(),[4,this.keyFactory.createPkcSignKey()];case 8:return l=g.sent(),[4,this.encryptionService.encrypt(u,l.toJSON(!0))];case 9:return h=g.sent(),[4,this.http.post(this.config.authUrl+"users/",{claims:[{type:i,token:r,claim_id:n}],pass_idp_params:a.passIdpParams,pass_idp_verifier_pbk:a.passIdpVerifier.toJSON(),wrapped_pass_idp_verifier_prk:a.wrappedPassIdpVerifierPrk,pass_key_params:a.passKeyParams,wrapped_master_key:s,wrapped_root_key:c,pbk:p.toJSON(),wrapped_prk:d,sig_pbk:l.toJSON(),wrapped_sig_prk:h}).toPromise()];case 10:return y=g.sent(),f={},y.claims.forEach((function(e){f[e.type]=e.value})),v=this.keyFactory.randomDigitsNoZeros(4),[4,this.auth.signUp({username:e.split("@")[0]+"."+v,password:this.passwordService.getPassIdpString(a.passIdp),attributes:f,clientMetadata:{user_id:String(y.id),user_pre_sign_up_token:String(y.pre_sign_up_token)}})];case 11:return[2,{username:(m=g.sent()).user.getUsername(),userId:y.id,preSignUpToken:y.pre_sign_up_token,userSub:m.userSub}]}}))}))},e.prototype.hibpBreachedAccounts=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.http.get(this.config.authUrl+"users/hibp/breachedaccount/"+e+"/?truncateResponse=false").toPromise()];case 1:return[2,n.sent()];case 2:if(404===(t=n.sent()).status)return[2,null];throw t;case 3:return[2]}}))}))},e}();qa.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new qa(t.ɵɵinject(Se),t.ɵɵinject(o.AuthClass),t.ɵɵinject(y.HttpClient),t.ɵɵinject(ge),t.ɵɵinject(ve),t.ɵɵinject(sr))},token:qa,providedIn:"root"}),qa.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],qa.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:o.AuthClass},{type:y.HttpClient},{type:ge},{type:ve},{type:sr}]};var Ja,Ga,Qa,Va=function(){},Ba=Oe(Ja||(Ja=F(["\nmutation CreateReminderMutation($input: CreateReminderInput!) {\n createReminder(input: $input) {\n reminder {\n id\n }\n }\n}\n"],["\nmutation CreateReminderMutation($input: CreateReminderInput!) {\n createReminder(input: $input) {\n reminder {\n id\n }\n }\n}\n"]))),Wa=Oe(Ga||(Ga=F(["\nmutation UpdateReminderMutation($input: UpdateReminderInput!) {\n updateReminder(input: $input) {\n reminder {\n id\n }\n }\n}\n"],["\nmutation UpdateReminderMutation($input: UpdateReminderInput!) {\n updateReminder(input: $input) {\n reminder {\n id\n }\n }\n}\n"]))),Za=Oe(Qa||(Qa=F(["\nmutation DeleteReminderMutation($input: DeleteReminderInput!) {\n deleteReminder(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteReminderMutation($input: DeleteReminderInput!) {\n deleteReminder(input: $input) {\n id\n }\n}\n"])));e.ReminderService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.createReminder=function(e){return this.mutate(this.createReminderMutation(e))},t.prototype.createReminderMutation=function(e){var t;return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,new dt({mutation:Ba,variables:{input:{directoryId:e.directoryId,firstEvent:e.firstEvent.toISOString(),plain:JSON.stringify(e.plainJson),notifyAheadSeconds:null!==(t=e.notifyAheadSeconds)&&void 0!==t?t:0}}})]}))}))},t.prototype.updateReminder=function(e){return this.mutate(this.updateReminderMutation(e))},t.prototype.updateReminderMutation=function(e){var t,n;return A(this,void 0,void 0,(function(){return T(this,(function(r){return[2,new dt({mutation:Wa,variables:{input:{id:e.id,firstEvent:null===(t=e.firstEvent)||void 0===t?void 0:t.toISOString(),plain:JSON.stringify(null!==(n=e.plainJson)&&void 0!==n?n:void 0),notifyAheadSeconds:e.notifyAheadSeconds}}})]}))}))},t.prototype.deleteReminder=function(e){return this.mutate(this.deleteReminderMutation(e))},t.prototype.deleteReminderMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Za,variables:{input:{id:e}}})]}))}))},t}($t),e.ReminderService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ReminderService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ReminderService,providedIn:"root"}),e.ReminderService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ReminderService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ReminderService=M([et({ngZoneName:"ngZone"})],e.ReminderService);var Ha,Ya,Xa,za,eo,to,no,ro,io,ao,oo=Oe(Ha||(Ha=F(["\nmutation CreateScenarioMutation($input: CreateScenarioInput!) {\n createScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"],["\nmutation CreateScenarioMutation($input: CreateScenarioInput!) {\n createScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"]))),so=Oe(Ya||(Ya=F(["\nmutation UpdateScenarioMutation($input: UpdateScenarioInput!) {\n updateScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"],["\nmutation UpdateScenarioMutation($input: UpdateScenarioInput!) {\n updateScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"]))),uo=Oe(Xa||(Xa=F(["\nmutation DeleteScenarioMutation($input: DeleteScenarioInput!) {\n deleteScenario(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteScenarioMutation($input: DeleteScenarioInput!) {\n deleteScenario(input: $input) {\n id\n }\n}\n"]))),co=Oe(za||(za=F(["\nmutation CreateScenarioClaimMutation($input: CreateScenarioClaimInput!) {\n createScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"],["\nmutation CreateScenarioClaimMutation($input: CreateScenarioClaimInput!) {\n createScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"]))),po=Oe(eo||(eo=F(["\nmutation CancelScenarioClaimMutation($input: CancelScenarioClaimInput!) {\n cancelScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"],["\nmutation CancelScenarioClaimMutation($input: CancelScenarioClaimInput!) {\n cancelScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"]))),lo=Oe(to||(to=F(["\nmutation RejectScenarioClaimMutation($input: RejectScenarioClaimInput!) {\n rejectScenarioClaim(input: $input) {\n claimApprover {\n id\n }\n }\n}\n"],["\nmutation RejectScenarioClaimMutation($input: RejectScenarioClaimInput!) {\n rejectScenarioClaim(input: $input) {\n claimApprover {\n id\n }\n }\n}\n"]))),ho=Oe(no||(no=F(["\nmutation ApproveScenarioClaimMutation($input: ApproveScenarioClaimInput!) {\n approveScenarioClaim(input: $input) {\n claimApprover {\n id\n }\n }\n}\n"],["\nmutation ApproveScenarioClaimMutation($input: ApproveScenarioClaimInput!) {\n approveScenarioClaim(input: $input) {\n claimApprover {\n id\n }\n }\n}\n"]))),yo=Oe(ro||(ro=F(["\nmutation ReceiveScenarioClaimMutation($input: ReceiveScenarioClaimInput!) {\n receiveScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"],["\nmutation ReceiveScenarioClaimMutation($input: ReceiveScenarioClaimInput!) {\n receiveScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"]))),fo=Oe(io||(io=F(["\nmutation DebugExpireScenarioClaimMutation($input: DebugExpireScenarioClaimInput!) {\n debugExpireScenarioClaim(input: $input) {\n scenarioClaim {\n id\n }\n }\n}\n"],["\nmutation DebugExpireScenarioClaimMutation($input: DebugExpireScenarioClaimInput!) {\n debugExpireScenarioClaim(input: $input) {\n scenarioClaim {\n id\n }\n }\n}\n"]))),vo=Oe(ao||(ao=F(["\nmutation DebugExpireTpPasswordResetRequestMutation($input: DebugExpireTpPasswordResetRequestInput!) {\n debugExpireTpPasswordResetRequest(input: $input) {\n passwordResetRequest {\n id\n }\n }\n}\n"],["\nmutation DebugExpireTpPasswordResetRequestMutation($input: DebugExpireTpPasswordResetRequestInput!) {\n debugExpireTpPasswordResetRequest(input: $input) {\n passwordResetRequest {\n id\n }\n }\n}\n"])));e.ɵm=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r.slip39Passphrase="lifeready",r}return R(t,e),t.prototype.getTpWrappingKeyId=function(e){return e.currentUserSharedKey.userSharedKey.sharedKey.id},t}(fr),e.ɵm.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ɵm(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ɵm,providedIn:"root"}),e.ɵm.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵm.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ɵm=M([et({ngZoneName:"ngZone"})],e.ɵm);var mo,go,So=Oe(mo||(mo=F(["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"],["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"]))),Co=Oe(go||(go=F(["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverDirectories {\n edges {\n node {\n id\n wrappedItemKey\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"],["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverDirectories {\n edges {\n node {\n id\n wrappedItemKey\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"])));function Io(){throw new Q("claimId does not match with the current claimId of the scenario")}function bo(){throw new Z("Scenario claim has not been approved")}e.ScenarioService=function(t){function n(e,n,r,i,a,o){var s=t.call(this,n)||this;return s.ngZone=e,s.injector=n,s.keyGraph=r,s.itemService=i,s.assemblyController=a,s.encryptionService=o,s.prepareAddReceiverDirectory=s.prepareReceiverDirectory,s.prepareUpdateReceiverDirectory=s.prepareReceiverDirectory,s}return R(n,t),n.prototype.createScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createScenarioMutation(e))]}))}))},n.prototype.createScenarioMutation=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.prepareCreateScenarioMutation(e)];case 1:return t=n.sent(),[2,new dt({mutation:oo,variables:{input:t}})]}}))}))},n.prototype.updateScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateScenarioMutation(e))]}))}))},n.prototype.updateScenarioMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getScenario(e.scenarioId)];case 1:return t=r.sent().scenario,[4,this.prepareUpdateScenario(e,t)];case 2:return n=r.sent(),[2,new dt({mutation:so,variables:{input:n}})]}}))}))},n.prototype.resetScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.resetScenarioMutation(e))]}))}))},n.prototype.resetScenarioMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.getScenario(e.scenarioId)];case 1:return t=a.sent().scenario,n=t.assembly,r=_t(n.subAssemblies).map((function(e){var t=_t(e.approvers).map((function(e){return{tpId:e.tp.id}}));return{id:e.id,quorum:e.quorum,singleReject:e.singleReject,subjectCipherDataClearJson:e.subjectCipherDataClearJson,approverTps:t}})),[4,this.prepareUpdateScenario({scenarioId:e.scenarioId,enabled:e.enabled,updateAssembly:{quorum:n.quorum,singleReject:n.singleReject,updateSubAssemblies:r}},t)];case 2:return i=a.sent(),[2,new dt({mutation:so,variables:{input:i}})]}}))}))},n.prototype.deleteScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.lrGraphQL.lrMutate(this.deleteScenarioMutation(e))]}))}))},n.prototype.deleteScenarioMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:uo,variables:{input:{scenarioId:e}}})]}))}))},n.prototype.createClaim=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createClaimMutation(e))]}))}))},n.prototype.createClaimMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:co,variables:{input:{scenarioId:e}}})]}))}))},n.prototype.cancelClaim=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.cancelClaimMutation(e))]}))}))},n.prototype.cancelClaimMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:po,variables:{input:{claimId:e}}})]}))}))},n.prototype.rejectClaim=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.mutate(this.rejectClaimMutation(e,t))]}))}))},n.prototype.rejectClaimMutation=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.prepareRejectClaimMutations(e,t)];case 1:return n=a.sent(),i=(r=ht).create,[4,Promise.all(n)];case 2:return[2,i.apply(r,[a.sent()])]}}))}))},n.prototype.approveClaim=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.mutate(this.approveClaimMutation(e,t))]}))}))},n.prototype.approveClaimMutation=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.prepareApproveClaimMutations(e,t)];case 1:return n=a.sent(),i=(r=ht).create,[4,Promise.all(n)];case 2:return[2,i.apply(r,[a.sent()])]}}))}))},n.prototype.receiveClaim=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.mutate(this.receiveClaimMutation(e,t))]}))}))},n.prototype.receiveClaimMutation=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return n=dt.bind,r={mutation:yo},i={},[4,this.prepareClaim(e,t)];case 1:return[2,new(n.apply(dt,[void 0,(r.variables=(i.input=a.sent(),i),r)]))]}}))}))},n.prototype.debugExpireClaim=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.debugExpireClaimMutation(e))]}))}))},n.prototype.debugExpireClaimMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:fo,variables:{input:{scenarioId:e}}})]}))}))},n.prototype.getScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.query({query:So,variables:{scenarioId:e}})]}))}))},n.prototype.getSharedScenario=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,this.query({query:Co,variables:{scenarioId:e}})];case 1:return n=r.sent(),t&&n.sharedScenario.sharedClaim.id!==t&&Io(),[2,n]}}))}))},n.prototype.getParticipantTpsKeys=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=e.map((function(e){return e.tpId})),n=_t,[4,this.lrGraphQL.query({query:yr,variables:{ids:t}})];case 1:return[2,n.apply(void 0,[r.sent().tps])]}}))}))},n.prototype.fillTpSharedKeyId=function(e,t){e.forEach((function(e){if(!e.tpSharedKeyId){var n=t.find((function(t){return t.id===e.tpId}));e.tpSharedKeyId=n.currentUserSharedKey.userSharedKey.sharedKey.id}}))},n.prototype.prepareCreateScenarioMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p=this;return T(this,(function(d){switch(d.label){case 0:return[4,this.assemblyController.prepareCreate(e.createAssembly)];case 1:return t=d.sent(),n=t.assemblyKey,r=t.mutationInput,i=e.createReceivers||[],a=e.createClaimants||[],o=i.concat(a),[4,this.getParticipantTpsKeys(o)];case 2:return s=d.sent(),this.fillTpSharedKeyId(o,s),[4,Promise.all(i.map((function(e){return p.prepareCreateReceiver(e,n)})))];case 3:return u=d.sent(),[4,Promise.all(a.map((function(e){return p.prepareCreateClaimant(e)})))];case 4:return c=d.sent(),[2,{enabled:e.enabled,createAssembly:r,createReceivers:u,createClaimants:c}]}}))}))},n.prototype.prepareUpdateScenario=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,g,S,C,I,b=this;return T(this,(function(w){switch(w.label){case 0:return[4,this.keyGraph.getJwkKey(t.assembly.assemblyKey.id)];case 1:return n=w.sent(),e.updateAssembly?[4,A(b,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,this.assemblyController.prepareUpdate(e.updateAssembly,t.assembly)];case 1:return r=i.sent(),n=r.assemblyKey,[2,r.mutationInput]}}))}))]:[3,3];case 2:return i=w.sent(),[3,4];case 3:i=void 0,w.label=4;case 4:return r=i,a=e.createReceivers||[],o=e.createClaimants||[],s=a.concat(o),[4,this.getParticipantTpsKeys(s)];case 5:return u=w.sent(),this.fillTpSharedKeyId(s,u),(p=e.createReceivers)?[4,Promise.all(e.createReceivers.map((function(e){return b.prepareCreateReceiver(e,n)})))]:[3,7];case 6:p=w.sent(),w.label=7;case 7:return c=p,d=_t(t.receivers),e.updateReceivers?[4,Promise.all(e.updateReceivers.map((function(e){var t=d.find((function(t){return t.tp.id===e.tpId}));return b.prepareUpdateReceiver(e,n,t)})))]:[3,9];case 8:return h=w.sent(),[3,10];case 9:h=[],w.label=10;case 10:return l=h,e.updateAssembly?(y=d.filter((function(t){return!(e.deleteReceivers||[]).includes(t.tp.id)&&!l.some((function(e){return e.tpId===t.tp.id}))})),v=(f=l).concat,[4,this.prepareExistingReceivers(y,n)]):[3,12];case 11:l=v.apply(f,[w.sent()]),w.label=12;case 12:return(g=e.createClaimants)?[4,Promise.all(e.createClaimants.map((function(e){return b.prepareCreateClaimant(e)})))]:[3,14];case 13:g=w.sent(),w.label=14;case 14:return m=g,S=_t(t.claimants),(I=e.updateClaimants)?[4,Promise.all(e.updateClaimants.map((function(e){var t=S.find((function(t){return t.tp.id===e.tpId}));return b.prepareUpdateClaimant(e,t.sharedKey.id)})))]:[3,16];case 15:I=w.sent(),w.label=16;case 16:return C=I,[2,{scenarioId:e.scenarioId,enabled:e.enabled,updateAssembly:r,createReceivers:c,updateReceivers:l,deleteReceivers:e.deleteReceivers,createClaimants:m,updateClaimants:C,deleteClaimants:e.deleteClaimants}]}}))}))},n.prototype.prepareReceiverDirectory=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.itemService.getDirectoryKey(e.directoryId,e.directoryKeyId)];case 1:return r=o.sent(),[4,this.keyGraph.encryptToString(t,e.sharedCipherDataClearJson||"")];case 2:return i=o.sent(),[4,this.keyGraph.encryptToString(t,r.jwk.toJSON(!0))];case 3:return a=o.sent(),[4,this.keyGraph.encryptToString(n,a)];case 4:return a=o.sent(),[2,{directoryId:e.directoryId,wrappedItemKey:a,accessRole:e.accessRole,sharedCipherData:i}]}}))}))},n.prototype.prepareCreateReceiver=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s=this;return T(this,(function(u){switch(u.label){case 0:return[4,this.prepareCreateParticipant(e)];case 1:return n=u.sent(),r=n.sharedKey,i=n.mutationInput,(o=e.addDirectories)?[4,Promise.all(e.addDirectories.map((function(e){return s.prepareAddReceiverDirectory(e,r.key,t)})))]:[3,3];case 2:o=u.sent(),u.label=3;case 3:return a=o,[2,Object.assign(Object.assign({},i),{addDirectories:a})]}}))}))},n.prototype.prepareUpdateReceiver=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d,l=this;return T(this,(function(h){switch(h.label){case 0:return r=n.sharedKey.id,i=e.deleteDirectories||[],a=e.updateDirectories||[],_t(n.receiverDirectories).forEach((function(e){i.includes(e.directory.id)||a.find((function(t){return t.directoryId===e.directory.id}))||a.push({accessRole:e.accessRole,directoryId:e.directory.id,sharedCipherDataClearJson:e.sharedCipherDataClearJson})})),[4,this.prepareUpdateParticipant(e,r)];case 1:return o=h.sent(),s=o.sharedKey,u=o.mutationInput,(p=e.addDirectories)?[4,Promise.all(e.addDirectories.map((function(e){return l.prepareAddReceiverDirectory(e,s,t)})))]:[3,3];case 2:p=h.sent(),h.label=3;case 3:return c=p,[4,Promise.all(a.map((function(e){return l.prepareUpdateReceiverDirectory(e,s,t)})))];case 4:return d=h.sent(),[2,Object.assign(Object.assign({},u),{addDirectories:c,updateDirectories:d,deleteDirectories:e.deleteDirectories})]}}))}))},n.prototype.prepareExistingReceiver=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){return n=_t(e.receiverDirectories).map((function(e){return{directoryId:e.directory.id,directoryKeyId:e.directory.keyId,accessRole:e.accessRole,sharedCipherDataClearJson:e.sharedCipherDataClearJson}})),[2,this.prepareUpdateReceiver({tpId:e.tp.id,sharedCipherDataClearJson:e.sharedCipherDataClearJson,updateDirectories:n},t,e)]}))}))},n.prototype.prepareExistingReceivers=function(e,t){return A(this,void 0,void 0,(function(){var n=this;return T(this,(function(r){return[2,Promise.all(e.map((function(e){return n.prepareExistingReceiver(e,t)})))]}))}))},n.prototype.prepareCreateParticipant=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.keyGraph.encryptWithNewKey(e.tpSharedKeyId,e.sharedCipherDataClearJson||"")];case 1:return[2,{sharedKey:t=n.sent(),mutationInput:{tpId:e.tpId,tpSharedKeyId:e.tpSharedKeyId,tpSharedKeyWrappedSharedKey:t.wrappedKey,sharedCipherData:t.cipher}}]}}))}))},n.prototype.prepareUpdateParticipant=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.keyGraph.getJwkKey(t)];case 1:return n=i.sent(),[4,this.keyGraph.encryptToString(n,e.sharedCipherDataClearJson||"")];case 2:return r=i.sent(),[2,{sharedKey:n,mutationInput:{tpId:e.tpId,sharedKeyId:t,sharedCipherData:r}}]}}))}))},n.prototype.prepareCreateClaimant=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.prepareCreateParticipant(e)];case 1:return[2,t.sent().mutationInput]}}))}))},n.prototype.prepareUpdateClaimant=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.prepareUpdateParticipant(e,t)];case 1:return[2,n.sent().mutationInput]}}))}))},n.prototype.prepareClaim=function(t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s=this;return T(this,(function(u){switch(u.label){case 0:return[4,this.getSharedScenario(t,n)];case 1:return(r=u.sent().sharedScenario).state!==e.ScenarioState.APPROVED&&bo(),i=_t(r.sharedClaim.asClaimReceiver.approvals),[4,this.recoverAssemblyKey(i)];case 2:return a=u.sent(),[4,Promise.all(r.asReceiver.receiverDirectories.edges.map((function(e){return e.node})).map((function(e){return A(s,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.encryptionService.decrypt(a,e.wrappedItemKey)];case 1:return t=n.sent(),[2,{receiverDirectoryId:e.id,receiverSharedKeyWrappedItemKey:t}]}}))}))})))];case 3:return o=u.sent(),[2,{scenarioClaimId:n,receiverDirectories:o}]}}))}))},n.prototype.recoverAssemblyKey=function(e){return A(this,void 0,void 0,(function(){var t,n=this;return T(this,(function(r){switch(r.label){case 0:return[4,Promise.all(e.map((function(e){return n.keyGraph.decryptFromString(e.pxk.id,e.receiverCipherPartialAssemblyKey)})))];case 1:return t=r.sent(),[2,this.assemblyController.recoverAssemblyKey(t)]}}))}))},n.prototype.asClaimApprovers=function(e,t,n){return A(this,void 0,void 0,(function(){return T(this,(function(r){switch(r.label){case 0:return[4,this.getSharedScenario(e,t)];case 1:return[2,_t(r.sent().sharedScenario.sharedClaim.claim.asClaimApprovers).filter((function(e){return e.state===n}))]}}))}))},n.prototype.prepareApproveClaimMutations=function(t,n){return A(this,void 0,void 0,(function(){var r=this;return T(this,(function(i){switch(i.label){case 0:return[4,this.asClaimApprovers(t,n,e.TpClaimApproverState.CLAIMED)];case 1:return[2,i.sent().map((function(e){return A(r,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:ho},r={},[4,this.prepareApproveClaim(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))}))]}}))}))},n.prototype.prepareApproveClaim=function(e){return A(this,void 0,void 0,(function(){var t,n=this;return T(this,(function(r){switch(r.label){case 0:return[4,Promise.all(_t(e.receiverApprovals).map((function(t){return n.prepareReceiverApproval({receiverApprovalId:t.id,receiverApprovalPxkId:t.pxk.id,sharedCipherPartialAssemblyKeyClearJson:e.sharedCipherPartialAssemblyKeyClearJson})})))];case 1:return t=r.sent(),[2,{claimApproverId:e.id,receiverApprovals:t}]}}))}))},n.prototype.prepareReceiverApproval=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return t={receiverApprovalId:e.receiverApprovalId,receiverCipher:""},[4,this.keyGraph.encryptToString(e.receiverApprovalPxkId,e.sharedCipherPartialAssemblyKeyClearJson)];case 1:return[2,(t.receiverCipherPartialAssemblyKey=n.sent(),t)]}}))}))},n.prototype.prepareRejectClaimMutations=function(t,n){return A(this,void 0,void 0,(function(){var r=this;return T(this,(function(i){switch(i.label){case 0:return[4,this.asClaimApprovers(t,n,e.TpClaimApproverState.CLAIMED)];case 1:return[2,i.sent().map((function(e){return A(r,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:lo,variables:{input:{claimApproverId:e.id}}})]}))}))}))]}}))}))},n}($t),e.ScenarioService.SLIP39_PASSPHRASE="lifeready",e.ScenarioService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ScenarioService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(Pe),t.ɵɵinject(e.ItemService),t.ɵɵinject(e.ɵm),t.ɵɵinject(ve))},token:e.ScenarioService,providedIn:"root"}),e.ScenarioService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ScenarioService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:Pe},{type:e.ItemService},{type:e.ɵm},{type:ve}]},e.ScenarioService=M([et({ngZoneName:"ngZone"})],e.ScenarioService);var wo,Ko=Oe(wo||(wo=F(["\nquery ServerConfigQuery {\n serverConfig {\n relayConnectionMaxLimit\n }\n}\n"],["\nquery ServerConfigQuery {\n serverConfig {\n relayConnectionMaxLimit\n }\n}\n"])));e.ServerConfigService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.getConfig=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return null!=this.serverConfig?[3,2]:(e=this,[4,this.query({query:Ko,includeKeyGraph:!1})]);case 1:e.serverConfig=t.sent().serverConfig,t.label=2;case 2:return[2,this.serverConfig]}}))}))},t}($t),e.ServerConfigService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ServerConfigService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ServerConfigService,providedIn:"root"}),e.ServerConfigService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ServerConfigService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ServerConfigService=M([et({ngZoneName:"ngZone"})],e.ServerConfigService);var Po,ko,Do,Ro,Eo=Oe(Po||(Po=F(["\nmutation UpdateOwnedContactCardMutation(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(input: $input) {\n ownedContactCard {\n id\n }\n }\n}"],["\nmutation UpdateOwnedContactCardMutation(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(input: $input) {\n ownedContactCard {\n id\n }\n }\n}"]))),Mo=Oe(ko||(ko=F(["\nmutation UpdateReceivedContactCardMutation(\n $input: UpdateReceivedContactCardInput!\n) {\n updateReceivedContactCard(input: $input) {\n receivedContactCard {\n id\n }\n }\n}"],["\nmutation UpdateReceivedContactCardMutation(\n $input: UpdateReceivedContactCardInput!\n) {\n updateReceivedContactCard(input: $input) {\n receivedContactCard {\n id\n }\n }\n}"]))),Ao=Oe(Do||(Do=F(["\nquery GetOwnedContactCardKeyIdsQuery($id: LrRelayIdInput!) {\n ownedContactCard(id: $id) {\n sharedKey {\n id\n }\n ownerKey {\n id\n }\n }\n}"],["\nquery GetOwnedContactCardKeyIdsQuery($id: LrRelayIdInput!) {\n ownedContactCard(id: $id) {\n sharedKey {\n id\n }\n ownerKey {\n id\n }\n }\n}"]))),To=Oe(Ro||(Ro=F(["\nquery GetReceivedContactCardKeyIdQuery($id: LrRelayIdInput!) {\n receivedContactCard(id: $id) {\n receiverKey {\n id\n }\n }\n}"],["\nquery GetReceivedContactCardKeyIdQuery($id: LrRelayIdInput!) {\n receivedContactCard(id: $id) {\n receiverKey {\n id\n }\n }\n}"])));e.SharedContactCard2Service=function(){function e(e,t,n,r,i){this.ngZone=e,this.keyService=t,this.keyGraph=n,this.encryptionService=r,this.lrGraphQL=i}return e.prototype.getOwnedContactCardKeyIds=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.lrGraphQL.query({query:Ao,variables:{id:e}})];case 1:return[2,{sharedKeyId:(t=n.sent().ownedContactCard).sharedKey.id,ownerKeyId:t.ownerKey.id}]}}))}))},e.prototype.getReceivedContactCardKeyId=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.lrGraphQL.query({query:To,variables:{id:e}})];case 1:return[2,t.sent().receivedContactCard.receiverKey.id]}}))}))},e.prototype.updateOwnedContactCard=function(e){var t=e.id,n=e.ownerKeyId,r=e.sharedKeyId,i=e.ownerPlainDataJson,a=e.ownerCipherDataClearJson,o=e.sharedCipherDataClearJson;return A(this,void 0,void 0,(function(){var e,s,u,c,p,d,l,h,y,f,v,m;return T(this,(function(g){switch(g.label){case 0:return g.trys.push([0,3,,7]),[4,this.keyGraph.getKey(n)];case 1:return e=g.sent(),[4,this.keyGraph.getKey(r)];case 2:return s=g.sent(),[3,7];case 3:return g.sent(),[4,this.getOwnedContactCardKeyIds(t)];case 4:return u=g.sent(),[4,this.keyGraph.getKey(u.ownerKeyId)];case 5:return e=g.sent(),[4,this.keyGraph.getKey(u.sharedKeyId)];case 6:return s=g.sent(),[3,7];case 7:return c=this.keyService.currentSigPxk,[4,this.encryptionService.encrypt(s.jwk,o)];case 8:return p=g.sent(),h=(l=JSON).stringify,[4,this.encryptionService.sign(c.jwk,p)];case 9:return d=h.apply(l,[g.sent()]),v=(f=JSON).stringify,[4,this.encryptionService.sign(c.jwk,i)];case 10:return y=v.apply(f,[g.sent()]),[4,this.encryptionService.encryptToString(e.jwk,a)];case 11:return m=g.sent(),[2,new dt({mutation:Eo,variables:{input:{id:t,ownerCipherData:m,ownerKeyId:e.id,sharedCipherDataSig:d,sharedKeyId:s.id,sigPxkId:c.id,ownerPlainDataSig:y}}})]}}))}))},e.prototype.updateReceivedContactCard=function(e){var t=e.id,n=e.receiverKeyId,r=e.receiverCipherDataClearJson;return A(this,void 0,void 0,(function(){var e,i,a=this;return T(this,(function(o){switch(o.label){case 0:return[4,this.keyGraph.getKey(n,(function(){return a.getReceivedContactCardKeyId(t)}))];case 1:return e=o.sent(),[4,this.encryptionService.encryptToString(e.jwk,r)];case 2:return i=o.sent(),[2,new dt({mutation:Mo,variables:{input:{id:t,receiverCipherData:i,receiverKeyId:e.id}}})]}}))}))},e}(),e.SharedContactCard2Service.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.SharedContactCard2Service(t.ɵɵinject(t.NgZone),t.ɵɵinject(Ke),t.ɵɵinject(Pe),t.ɵɵinject(ve),t.ɵɵinject(e.ɵg))},token:e.SharedContactCard2Service,providedIn:"root"}),e.SharedContactCard2Service.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.SharedContactCard2Service.ctorParameters=function(){return[{type:t.NgZone},{type:Ke},{type:Pe},{type:ve},{type:e.ɵg}]},e.SharedContactCard2Service=M([et({ngZoneName:"ngZone"})],e.SharedContactCard2Service);var Oo,jo,No,Fo,$o,_o=Oe(Oo||(Oo=F(["\nfragment SharedTpPasswordResetFragment on SharedTpPasswordResetNode {\n id\n tp {\n id\n other {\n username\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedRequest {\n id\n pxk {\n id\n pbk\n }\n claim {\n id\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"],["\nfragment SharedTpPasswordResetFragment on SharedTpPasswordResetNode {\n id\n tp {\n id\n other {\n username\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedRequest {\n id\n pxk {\n id\n pbk\n }\n claim {\n id\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"]))),Lo=Oe(jo||(jo=F(["\nquery SharedTpPasswordResetsQuery {\n sharedTpPasswordResets {\n edges {\n node {\n ...SharedTpPasswordResetFragment\n }\n }\n }\n}\n","\n"],["\nquery SharedTpPasswordResetsQuery {\n sharedTpPasswordResets {\n edges {\n node {\n ...SharedTpPasswordResetFragment\n }\n }\n }\n}\n","\n"])),_o),Uo=Oe(No||(No=F(["\nquery SharedTpPasswordResetQuery($id: LrRelayIdInput!) {\n sharedTpPasswordReset(id: $id) {\n ...SharedTpPasswordResetFragment\n }\n}\n","\n"],["\nquery SharedTpPasswordResetQuery($id: LrRelayIdInput!) {\n sharedTpPasswordReset(id: $id) {\n ...SharedTpPasswordResetFragment\n }\n}\n","\n"])),_o),xo=(Oe(Fo||(Fo=F(["\nquery TpPasswordResetUserQuery {\n tpPasswordResetUser {\n username\n resetUsername\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n sessionEncryptionKey\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n requestAgainAfter\n }\n}"],["\nquery TpPasswordResetUserQuery {\n tpPasswordResetUser {\n username\n resetUsername\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n sessionEncryptionKey\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n requestAgainAfter\n }\n}"]))),Oe($o||($o=F(["\nquery TpPasswordResetQuery {\n tpPasswordReset {\n id\n applied\n assembly {\n singleReject\n quorum\n canMeetQuorum\n subjectCipherData\n subjectKey {\n id\n }\n assemblyKey {\n id\n }\n assemblyCipherData\n subAssemblies {\n edges {\n node {\n id\n singleReject\n quorum\n subjectCipherData\n subjectKey {\n id\n }\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n }\n }\n }\n }\n}"],["\nquery TpPasswordResetQuery {\n tpPasswordReset {\n id\n applied\n assembly {\n singleReject\n quorum\n canMeetQuorum\n subjectCipherData\n subjectKey {\n id\n }\n assemblyKey {\n id\n }\n assemblyCipherData\n subAssemblies {\n edges {\n node {\n id\n singleReject\n quorum\n subjectCipherData\n subjectKey {\n id\n }\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n }\n }\n }\n }\n}"]))));e.ɵn=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.getReset=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.query({query:xo})];case 1:return[2,e.sent().tpPasswordReset]}}))}))},t.prototype.getSharedResets=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.query({query:Lo})];case 1:return[2,e.sent().sharedTpPasswordResets]}}))}))},t.prototype.getSharedReset=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Uo,variables:{id:e}})];case 1:return[2,t.sent().sharedTpPasswordReset]}}))}))},t}($t),e.ɵn.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ɵn(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ɵn,providedIn:"root"}),e.ɵn.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵn.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ɵn=M([et({ngZoneName:"ngZone"})],e.ɵn),e.TpPasswordResetRequestService=function(t){function n(e,n,r,i){var a=t.call(this,n)||this;return a.ngZone=e,a.injector=n,a.encryptionService=r,a.privateService=i,a}return R(n,t),n.prototype.activeRequestOrRaise=function(t){var n=t.sharedRequest.claim.state;if(n!==e.TpAssemblyState.CLAIMED)throw new Z("Claim is already in "+n+" state.")},n.prototype.rejectRequest=function(e){return this.mutate(this.rejectRequestMutation(e))},n.prototype.rejectRequestMutation=function(t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,this.privateService.getSharedReset(t)];case 1:return n=r.sent(),this.activeRequestOrRaise(n),[2,ht.create(n.sharedRequest.claim.asClaimApprovers.edges.filter((function(t){return t.node.state===e.TpClaimApproverState.CLAIMED})).map((function(e){return new dt({mutation:$r,variables:{input:{claimApproverId:e.node.id}}})})))]}}))}))},n.prototype.approveRequest=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return r=(n=this.lrGraphQL).lrMutate,[4,this.approveRequestMutation(e,t)];case 1:return[2,r.apply(n,[i.sent()])]}}))}))},n.prototype.approveRequestMutation=function(t,n){return A(this,void 0,void 0,(function(){var n,r,i,o,s,u=this;return T(this,(function(c){switch(c.label){case 0:return[4,this.privateService.getSharedReset(t)];case 1:return n=c.sent(),this.activeRequestOrRaise(n),[4,a.JWK.asKey(JSON.parse(n.sharedRequest.pxk.pbk))];case 2:return r=c.sent(),i=n.sharedRequest.claim.asClaimApprovers.edges.filter((function(t){return t.node.state===e.TpClaimApproverState.CLAIMED})),s=(o=ht).create,[4,Promise.all(i.map((function(e){return A(u,void 0,void 0,(function(){var t,n,i=this;return T(this,(function(a){switch(a.label){case 0:return t=e.node,n={claimApproverId:t.id},[4,Promise.all(t.receiverApprovals.edges.map((function(e){return A(i,void 0,void 0,(function(){var n,i;return T(this,(function(a){switch(a.label){case 0:return n=e.node,i={receiverApprovalId:n.id,receiverCipher:""},[4,this.encryptionService.encryptToString(r,t.sharedCipherPartialAssemblyKeyClearJson)];case 1:return[2,(i.receiverCipherPartialAssemblyKey=a.sent(),i)]}}))}))})))];case 1:return n.receiverApprovals=a.sent(),[2,new dt({mutation:Fr,variables:{input:n}})]}}))}))})))];case 3:return[2,s.apply(o,[c.sent()])]}}))}))},n}($t),e.TpPasswordResetRequestService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.TpPasswordResetRequestService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(ve),t.ɵɵinject(e.ɵn))},token:e.TpPasswordResetRequestService,providedIn:"root"}),e.TpPasswordResetRequestService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.TpPasswordResetRequestService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:ve},{type:e.ɵn}]},e.TpPasswordResetRequestService=M([et({ngZoneName:"ngZone"})],e.TpPasswordResetRequestService);function qo(){!function(e){if(!e)throw new Q("You must specify a non empty prefix.");Object.keys(localStorage).forEach((function(t){t.startsWith(e)&&localStorage.removeItem(t)}))}("CognitoIdentityServiceProvider")}e.TpPasswordResetUserService=function(e){function t(t,n,r,i,a,o,s,u){var c=e.call(this,n)||this;return c.ngZone=t,c.injector=n,c.config=r,c.keyFactory=i,c.encryptionService=a,c.passwordService=o,c.http=s,c.auth=u,c}return R(t,e),t.prototype.verifyEmailContact=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){return t={email:e},[2,this.http.post(this.config.authUrl+"tp/password-reset/verify-contact/",t).toPromise()]}))}))},t.prototype.verifyContactRespond=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.http.post(this.config.authUrl+"cove/respond/",{claim_id:e,v_code:t}).toPromise()];case 1:return[2,n.sent().token]}}))}))},t.prototype.requestReset=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return qo(),[4,this.passwordService.createPassKeyBundle(e)];case 1:return r=p.sent(),[4,this.keyFactory.createKey()];case 2:return i=p.sent(),[4,this.encryptionService.encrypt(r.passKey,i.toJSON(!0))];case 3:return a=p.sent(),[4,this.keyFactory.createPkcKey()];case 4:return o=p.sent(),[4,this.encryptionService.encrypt(i,o.toJSON(!0))];case 5:return s=p.sent(),[4,this.http.post(this.config.authUrl+"tp/password-reset/request/",{claimId:t,claimToken:n,pass_key_params:r.passKeyParams,pass_idp_params:r.passIdpParams,pass_idp_verifier_pbk:r.passIdpVerifier.toJSON(),wrapped_pass_idp_verifier_prk:r.wrappedPassIdpVerifierPrk,wrapped_master_key:a,pbk:o.toJSON(),master_key_wrapped_prk:s}).toPromise()];case 6:return u=p.sent(),console.log("Using new password"),[4,this.auth.signUp({username:u.reset_username,password:this.passwordService.getPassIdpString(r.passIdp),clientMetadata:{tp_password_reset_request:JSON.stringify({id:u.id,associate_reset_user_token:u.associate_reset_user_token})}})];case 7:return c=p.sent(),console.log("requestRest done"),[2,{requestResetResult:u,signUpResult:c}]}}))}))},t}($t),e.TpPasswordResetUserService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.TpPasswordResetUserService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(Se),t.ɵɵinject(ge),t.ɵɵinject(ve),t.ɵɵinject(sr),t.ɵɵinject(y.HttpClient),t.ɵɵinject(o.AuthClass))},token:e.TpPasswordResetUserService,providedIn:"root"}),e.TpPasswordResetUserService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.TpPasswordResetUserService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:ge},{type:ve},{type:sr},{type:y.HttpClient},{type:o.AuthClass}]},e.TpPasswordResetUserService=M([et({ngZoneName:"ngZone"})],e.TpPasswordResetUserService),e.TpPasswordResetService=function(e){function t(t,n,r,i){var a=e.call(this,n)||this;return a.ngZone=t,a.injector=n,a.privateService=r,a.assemblyController=i,a.slip39Passphrase=ur,a}return R(t,e),t.prototype.cancelResetRequest=function(){return this.mutate(this.cancelResetRequestMutation())},t.prototype.cancelResetRequestMutation=function(){return new dt({mutation:Tr})},t.prototype.deleteReset=function(){return this.mutate(this.deleteResetMutation())},t.prototype.deleteResetMutation=function(){return new dt({mutation:Lr})},t.prototype.validateApprovers=function(e){return this.assemblyController.validateApprovers(e)},t.prototype.createReset=function(e){return this.mutate(this.createResetMutation(e))},t.prototype.createResetMutation=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.assemblyController.prepareCreate(e)];case 1:return t=n.sent().mutationInput,[2,new dt({mutation:_r,variables:{input:{assembly:Object.assign({},t)}}})]}}))}))},t.prototype.updateReset=function(e){return this.mutate(this.updateResetMutation(e))},t.prototype.updateResetMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.privateService.getReset()];case 1:return t=r.sent(),[4,this.assemblyController.prepareUpdate(e,t.assembly)];case 2:return n=r.sent().mutationInput,[2,new dt({mutation:Ur,variables:{input:{assembly:Object.assign({},n)}}})]}}))}))},t.prototype.debugExpireResetRequest=function(e){return this.mutate(this.debugExpireResetRequestMutation(e),{includeKeyGraph:!1})},t.prototype.debugExpireResetRequestMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:vo,variables:{input:{username:e}}})]}))}))},t}($t),e.TpPasswordResetService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.TpPasswordResetService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(e.ɵn),t.ɵɵinject(e.ɵi))},token:e.TpPasswordResetService,providedIn:"root"}),e.TpPasswordResetService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.TpPasswordResetService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:e.ɵn},{type:e.ɵi}]},e.TpPasswordResetService=M([et({ngZoneName:"ngZone"})],e.TpPasswordResetService);var Jo,Go,Qo,Vo,Bo,Wo,Zo,Ho,Yo,Xo,zo,es,ts,ns,rs,is,as,os=Oe(Jo||(Jo=F(["\nmutation DeleteTpMutation($input: DeleteTpInput!) {\n deleteTp(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteTpMutation($input: DeleteTpInput!) {\n deleteTp(input: $input) {\n id\n }\n}\n"]))),ss=Oe(Go||(Go=F(["\n mutation ShareDirectoryMutation($input: ShareDirectoryInput!) {\n shareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"],["\n mutation ShareDirectoryMutation($input: ShareDirectoryInput!) {\n shareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"]))),us=Oe(Qo||(Qo=F(["\n mutation UnshareDirectoryMutation($input: UnshareDirectoryInput!) {\n unshareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"],["\n mutation UnshareDirectoryMutation($input: UnshareDirectoryInput!) {\n unshareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"]))),cs=Oe(Vo||(Vo=F(["\n mutation ShareFileMutation($input: ShareFileInput!) {\n shareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"],["\n mutation ShareFileMutation($input: ShareFileInput!) {\n shareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"]))),ps=Oe(Bo||(Bo=F(["\n mutation UnshareFileMutation($input: UnshareFileInput!) {\n unshareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"],["\n mutation UnshareFileMutation($input: UnshareFileInput!) {\n unshareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"]))),ds=Oe(Wo||(Wo=F(["\nmutation CreateSharedDirectoryMutation($input: CreateSharedDirectoryInput!) {\n createSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"],["\nmutation CreateSharedDirectoryMutation($input: CreateSharedDirectoryInput!) {\n createSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"]))),ls=Oe(Zo||(Zo=F(["\nmutation CreateSharedFileMutation($input: CreateSharedFileInput!) {\n createSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"],["\nmutation CreateSharedFileMutation($input: CreateSharedFileInput!) {\n createSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"]))),hs=Oe(Ho||(Ho=F(["\nmutation UpdateSharedDirectoryMutation($input: UpdateSharedDirectoryInput!) {\n updateSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"],["\nmutation UpdateSharedDirectoryMutation($input: UpdateSharedDirectoryInput!) {\n updateSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"]))),ys=Oe(Yo||(Yo=F(["\nmutation UpdateSharedFileMutation($input: UpdateSharedFileInput!) {\n updateSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"],["\nmutation UpdateSharedFileMutation($input: UpdateSharedFileInput!) {\n updateSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"]))),fs=Oe(Xo||(Xo=F(["\nmutation DeleteSharedDirectoryMutation($input: DeleteSharedDirectoryInput!) {\n deleteSharedDirectory(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteSharedDirectoryMutation($input: DeleteSharedDirectoryInput!) {\n deleteSharedDirectory(input: $input) {\n id\n }\n}\n"]))),vs=(Oe(zo||(zo=F(["\nmutation DeleteSharedFileMutation($input: DeleteSharedFileInput!) {\n deleteSharedFile(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteSharedFileMutation($input: DeleteSharedFileInput!) {\n deleteSharedFile(input: $input) {\n id\n }\n}\n"]))),Oe(es||(es=F(["\nmutation CompleteDetachedSharedDirectoryMutation($input: CompleteDetachedSharedDirectoryInput!) {\n completeDetachedSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"],["\nmutation CompleteDetachedSharedDirectoryMutation($input: CompleteDetachedSharedDirectoryInput!) {\n completeDetachedSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"])))),ms=Oe(ts||(ts=F(["\nmutation CompleteDetachedSharedFileMutation($input: CompleteDetachedSharedFileInput!) {\n completeDetachedSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"],["\nmutation CompleteDetachedSharedFileMutation($input: CompleteDetachedSharedFileInput!) {\n completeDetachedSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"]))),gs=Oe(ns||(ns=F(["\nmutation RequestTpMkReshareMutation($input: RequestTpMkReshareInput!) {\n requestTpMkReshare(input: $input) {\n id\n }\n}"],["\nmutation RequestTpMkReshareMutation($input: RequestTpMkReshareInput!) {\n requestTpMkReshare(input: $input) {\n id\n }\n}"]))),Ss=Oe(rs||(rs=F(["\n mutation RespondTpMkReshareMutation($input: RespondTpMkReshareInput!) {\n respondTpMkReshare(input: $input) {\n id\n }\n }\n"],["\n mutation RespondTpMkReshareMutation($input: RespondTpMkReshareInput!) {\n respondTpMkReshare(input: $input) {\n id\n }\n }\n"]))),Cs=Oe(is||(is=F(["\nmutation CompleteTpMkReshareMutation($input: CompleteTpMkReshareInput!) {\n completeTpMkReshare(input: $input) {\n id\n }\n}"],["\nmutation CompleteTpMkReshareMutation($input: CompleteTpMkReshareInput!) {\n completeTpMkReshare(input: $input) {\n id\n }\n}"]))),Is=Oe(as||(as=F(["\nquery TpCurrentUserSharedKeyQuery($id: LrRelayIdInput!) {\n tp(id: $id){\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n }\n mkReshareRequestCipher\n mkReshareRequestSent\n mkReshareResponseCipher\n mkReshareResponseSent\n }\n }\n }\n}\n"],["\nquery TpCurrentUserSharedKeyQuery($id: LrRelayIdInput!) {\n tp(id: $id){\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n }\n mkReshareRequestCipher\n mkReshareRequestSent\n mkReshareResponseCipher\n mkReshareResponseSent\n }\n }\n }\n}\n"])));e.TrustedPartyService=function(e){function t(t,n,r,i,a,o,s){var u=e.call(this,n)||this;return u.ngZone=t,u.injector=n,u.keyGraph=r,u.itemService=i,u.keyService=a,u.keyFactory=o,u.encryptionService=s,u}return R(t,e),t.prototype.deleteTp=function(e){return this.mutate(this.deleteTpMutation(e))},t.prototype.deleteTpMutation=function(e){return new dt({mutation:os,variables:{input:{id:e}}})},t.prototype.shareDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.shareDirectoryMutation(e))]}))}))},t.prototype.shareDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:ss},[4,this.prepareShareItemMutation(Object.assign(Object.assign({},e),{isDirectory:!0}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.shareFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.shareFileMutation(e))]}))}))},t.prototype.shareFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:cs},[4,this.prepareShareItemMutation(Object.assign(Object.assign({},e),{isDirectory:!1}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.prepareShareItemMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p=this;return T(this,(function(d){switch(d.label){case 0:return t=e.itemId,n=e.itemKeyId,r=e.tpId,i=e.tpSharedKeyId,a=e.accessRole,o=e.isDirectory,[4,this.keyGraph.getKey(n,(function(){return o?p.itemService.getDirectoryKeyId(t):p.itemService.getFileKeyId(t)}))];case 1:return s=d.sent(),[4,this.keyGraph.getKey(i,(function(){return p.getTpCurrentUserSharedKey(r).then((function(e){return e.sharedKey.id}))}))];case 2:return u=d.sent(),[4,this.keyGraph.wrapKey(u,s.jwk)];case 3:return c=d.sent(),[2,{input:{id:t,tpId:r,accessRole:a,keyId:s.id,wrappingKeyId:u.id,wrappedKey:c}}]}}))}))},t.prototype.unshareDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.unshareDirectoryMutation(e))]}))}))},t.prototype.unshareDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.unshareItemMutation(Object.assign(Object.assign({},e),{isDirectory:!0}))]}))}))},t.prototype.unshareFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.unshareFileMutation(e))]}))}))},t.prototype.unshareFileMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.unshareItemMutation(Object.assign(Object.assign({},e),{isDirectory:!1}))]}))}))},t.prototype.unshareItemMutation=function(e){var t=e.itemId,n=e.tpId,r=e.isDirectory;return A(this,void 0,void 0,(function(){return T(this,(function(e){return[2,new dt({mutation:r?us:ps,variables:{input:{id:t,tpId:n}}})]}))}))},t.prototype.createSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createSharedDirectoryMutation(e))]}))}))},t.prototype.createSharedDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:ds},[4,this.prepareCreateSharedItemMutation(Object.assign(Object.assign({},e),{isDirectory:!0}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.createSharedFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createSharedFileMutation(e))]}))}))},t.prototype.createSharedFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:ls},[4,this.prepareCreateSharedItemMutation(Object.assign(Object.assign({},e),{isDirectory:!1}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.prepareCreateSharedItemMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d=this;return T(this,(function(l){switch(l.label){case 0:return t=e.itemId,n=e.itemKeyId,r=e.tpId,i=e.tpSharedKeyId,a=e.accessRole,o=e.isDirectory,s=e.shareType,console.log("createSharedItemMutation()",n),[4,this.keyGraph.getKey(n,(function(){return o?d.itemService.getDirectoryKeyId(t):d.itemService.getFileKeyId(t)}))];case 1:return u=l.sent(),console.log("createSharedItemMutation()",u.id),[4,this.keyGraph.getKey(i,(function(){return d.getTpCurrentUserSharedKey(r).then((function(e){return e.sharedKey.id}))}))];case 2:return c=l.sent(),[4,this.keyGraph.wrapKey(c,u.jwk)];case 3:return p=l.sent(),[2,{input:{id:t,tpId:r,accessRole:a,keyId:u.id,wrappingKeyId:c.id,wrappedKey:p,shareType:s}}]}}))}))},t.prototype.updateSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateSharedDirectoryMutation(e))]}))}))},t.prototype.updateSharedDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:hs,variables:this.prepareUpdateSharedItemMutation(e)})]}))}))},t.prototype.updateSharedFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateSharedFileMutation(e))]}))}))},t.prototype.updateSharedFileMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:ys,variables:this.prepareUpdateSharedItemMutation(e)})]}))}))},t.prototype.prepareUpdateSharedItemMutation=function(e){return{input:{id:e.sharedItemId,accessRole:e.accessRole}}},t.prototype.deleteSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.deleteSharedDirectoryMutation(e))]}))}))},t.prototype.deleteSharedDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:fs,variables:{input:{id:e}}})]}))}))},t.prototype.completeDetachedSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.completeDetachedSharedDirectoryMutation(e))]}))}))},t.prototype.completeDetachedSharedDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:vs},[4,this.prepareCompleteDetachedSharedItemMutation(Object.assign(Object.assign({},e),{isDirectory:!0}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.completeDetachedSharedFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.completeDetachedSharedFileMutation(e))]}))}))},t.prototype.completeDetachedSharedFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:ms},[4,this.prepareCompleteDetachedSharedItemMutation(Object.assign(Object.assign({},e),{isDirectory:!1}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.prepareCompleteDetachedSharedItemMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s=this;return T(this,(function(u){switch(u.label){case 0:return t=e.sharedItemId,n=e.itemKeyId,r=e.isDirectory,[4,this.keyGraph.getKey(n,(function(){return r?s.itemService.getDirectoryKeyIdFromSharedDirectory(t):s.itemService.getFileKeyIdFromSharedFile(t)}))];case 1:return i=u.sent(),a=this.keyService.currentRootKey,[4,this.keyGraph.wrapKey(a,i.jwk)];case 2:return o=u.sent(),[2,{input:{id:t,keyId:i.id,wrappingKeyId:a.id,wrappedKey:o}}]}}))}))},t.prototype.requestMkReshareMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.getTpCurrentUserSharedKey(e)];case 1:if((t=s.sent()).mkSharedKey)throw new Z("TP already has mkSharedKey");return n=this.keyService.currentMasterKey,[4,this.keyFactory.createPkcKey()];case 2:return r=s.sent(),[4,this.encryptionService.encryptToString(n.jwk,r.toJSON(!0))];case 3:return i=s.sent(),[4,this.keyGraph.getKey(t.sharedKey.id)];case 4:return a=s.sent(),[4,this.encryptionService.encryptToString(a.jwk,{pbk:r.toJSON()})];case 5:return o=s.sent(),[4,new dt({mutation:gs,variables:{input:{tpId:e,masterKeyId:n.id,mkPbk:JSON.stringify(r.toJSON()),mkWrappedMkPrk:i,sharedKeyId:a.id,mkReshareRequestCipher:o}}})];case 6:return[2,s.sent()]}}))}))},t.prototype.respondMkReshare=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,c,p,d;return T(this,(function(l){switch(l.label){case 0:return[4,this.getTpCurrentUserSharedKey(e)];case 1:if(!(t=l.sent()).mkSharedKey)throw new Z("No access to the mkSharedKey so cannot reshare it with TP");return[4,this.keyGraph.getKey(t.sharedKey.id)];case 2:return n=l.sent(),[4,this.encryptionService.decrypt(n,t.mkReshareRequestCipher)];case 3:return r=l.sent(),[4,a.JWK.asKey(r.pbk)];case 4:return i=l.sent(),[4,this.keyGraph.getKey(t.mkSharedKey.id)];case 5:return o=l.sent(),s={mkSharedKey:{id:o.id,jwk:o.jwk.toJSON(!0)}},p=(c=this.encryptionService).encryptToString,d=[i],[4,this.encryptionService.encryptToString(n.jwk,s)];case 6:return[4,p.apply(c,d.concat([l.sent()]))];case 7:return u=l.sent(),[2,new dt({mutation:Ss,variables:{input:{tpId:e,mkSharedKeyId:o.id,mkReshareResponseCipher:u}}})]}}))}))},t.prototype.completeMkReshare=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,c,p,d,l;return T(this,(function(h){switch(h.label){case 0:return[4,this.getTpCurrentUserSharedKey(e)];case 1:return t=h.sent(),[4,this.keyGraph.getKey(t.sharedKey.id)];case 2:return n=h.sent(),[4,this.keyGraph.getKey(t.mkPxk.id)];case 3:return r=h.sent(),s=(o=this.encryptionService).decrypt,u=[n],[4,this.encryptionService.decrypt(r,t.mkReshareResponseCipher)];case 4:return[4,s.apply(o,u.concat([h.sent()]))];case 5:return i=h.sent(),p={id:i.mkSharedKey.id},[4,a.JWK.asKey(i.mkSharedKey.jwk)];case 6:return p.jwk=h.sent(),c=p,d=this.keyService.currentMasterKey,[4,this.encryptionService.encryptToString(d.jwk,c.jwk.toJSON(!0))];case 7:return l=h.sent(),[2,new dt({mutation:Cs,variables:{input:{tpId:e,masterKeyId:d.id,mkSharedKeyId:c.id,mkWrappedMkSharedKey:l}}})]}}))}))},t.prototype.getTpCurrentUserSharedKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.lrGraphQL.query({query:Is,variables:{id:e}})];case 1:return[2,t.sent().tp.currentUserSharedKey.userSharedKey]}}))}))},t}($t),e.TrustedPartyService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.TrustedPartyService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(Pe),t.ɵɵinject(e.ItemService),t.ɵɵinject(Ke),t.ɵɵinject(ge),t.ɵɵinject(ve))},token:e.TrustedPartyService,providedIn:"root"}),e.TrustedPartyService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.TrustedPartyService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:Pe},{type:e.ItemService},{type:Ke},{type:ge},{type:ve}]},e.TrustedPartyService=M([et({ngZoneName:"ngZone"})],e.TrustedPartyService);var bs=function(){function e(e){this.auth=e}return e.prototype.getPreferredMFA=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return e=t.sent(),[4,this.auth.getPreferredMFA(e)];case 2:return[2,t.sent()]}}))}))},e.prototype.setPreferredMFA=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return t=n.sent(),[4,this.auth.setPreferredMFA(t,e)];case 2:return n.sent(),[2]}}))}))},e.prototype.setPhoneNumber=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return t=n.sent(),[4,this.auth.updateUserAttributes(t,{phone_number:e})];case 2:return n.sent(),[2]}}))}))},e.prototype.getSMSCode=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.auth.verifyCurrentUserAttribute("phone_number")];case 1:return e.sent(),[2]}}))}))},e.prototype.verifySMSCode=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.auth.verifyCurrentUserAttributeSubmit("phone_number",e)];case 1:return t.sent(),[2]}}))}))},e.prototype.getSoftwareToken=function(){return A(this,void 0,void 0,(function(){var e,t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,Promise.all([this.auth.currentAuthenticatedUser(),this.auth.currentUserInfo()])];case 1:return e=j.apply(void 0,[a.sent(),2]),t=e[0],n=e[1],[4,this.auth.setupTOTP(t)];case 2:if(r=a.sent(),!(i=n.attributes.email))throw new Q("No email associated with user.");return[2,{code:r,codeUri:"otpauth://totp/"+i+"?secret="+r+"&issuer=LifeReady"}]}}))}))},e.prototype.verifySoftwareToken=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return t=n.sent(),[4,this.auth.verifyTotpToken(t,e)];case 2:return n.sent(),[2]}}))}))},e}();bs.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new bs(t.ɵɵinject(o.AuthClass))},token:bs,providedIn:"root"}),bs.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],bs.ctorParameters=function(){return[{type:o.AuthClass}]};var ws,Ks,Ps,ks=K.default(ws||(ws=F(["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"],["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"]))),Ds=K.default(Ks||(Ks=F(["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"],["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"]))),Rs=K.default(Ps||(Ps=F(["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"],["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"]))),Es=function(){function e(e){this.lrApollo=e}return e.prototype.requestUserDelete=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.lrApollo.mutate({mutation:ks,variables:{input:{}}})];case 1:return[2,e.sent().requestUserDelete.userDelete]}}))}))},e.prototype.cancelUserDelete=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.lrApollo.mutate({mutation:Ds,variables:{input:{}}})];case 1:return[2,e.sent().cancelUserDelete.id]}}))}))},e.prototype.loginHistory=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=null),A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.lrApollo.query({query:Rs,variables:{first:e,after:t}})];case 1:return[2,n.sent().loginHistory]}}))}))},e}();Es.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Es(t.ɵɵinject(ke))},token:Es,providedIn:"root"}),Es.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Es.ctorParameters=function(){return[{type:ke}]},e.ApiContactCard=kn,e.ApiCurrentUser=Pn,e.ApproveScenarioClaimMutation=ho,e.ApproveTpPasswordResetRequestMutation=Fr,e.ArchiveDirectoryMutation=Di,e.ArchiveFileMutation=Ri,e.BeginDeleteChildItemLinksWindowMutation=Oi,e.CancelKeyExchangeMutation=vn,e.CancelScenarioClaimMutation=po,e.CancelTpPasswordResetRequestMutation=Tr,e.CancelUserDeleteMutation=Ds,e.ChangeDirectoryParentsMutation=Ai,e.ChangeFileParentsMutation=Ti,e.CompleteKeyExchangeOtkMutation=Cn,e.CompleteTpPasswordResetRequestMutation=Nr,e.ContactCardAddress=Rn,e.ContactCardName=Dn,e.ContactCardsQuery=Yn,e.CreateContactCardMutation=Wn,e.CreateDirectoryMutation=Ci,e.CreateFileMutation=wi,e.CreateFileQuery=We,e.CreateLbopQuery=ia,e.CreateScenarioClaimMutation=co,e.CreateScenarioMutation=oo,e.CreateTpAssemblyKeyChallengeMutation=Or,e.CreateTpPasswordResetMutation=_r,e.CurrentUserKey=Kn,e.CurrentUserQuery=Bn,e.CurrentUserSharedKeyQuery2=In,e.DebugExpireScenarioClaimMutation=fo,e.DebugExpireTpPasswordResetRequestMutation=vo,e.DeclineKeyExchangeMutation=mn,e.DefaultProcessorOptions=tt,e.DeleteDirectoryMutation=bi,e.DeleteFileMutation=ki,e.DeleteLbopQuery=aa,e.DeleteScenarioMutation=uo,e.DeleteTpPasswordResetMutation=Lr,e.DirectoryQuery=Be,e.ERROR_SOURCE=Xi,e.Features=wn,e.FetchKeyGraphField=Qe,e.FileQuery=Ve,e.FileUploadService=Xr,e.GetOwnedContactCardKeyIdsQuery=Ao,e.GetReceivedContactCardKeyIdQuery=To,e.IdleService=qt,e.InitiateKeyExchangeOtkMutation=gn,e.KC_CONFIG=Se,e.KcAuthException=G,e.KcBadArgumentException=Q,e.KcBadLogicException=V,e.KcBadRequestException=B,e.KcBadSignatureException=W,e.KcBadStateException=Z,e.KcBadTimeSyncException=H,e.KcCodeMismatchException=Y,e.KcConcurrentAccessException=X,e.KcEncryptionException=z,e.KcError=q,e.KcException=J,e.KcInternalErrorException=ee,e.KcLockedException=te,e.KcNotFoundException=ne,e.KcSuspiciousOperationException=re,e.KcUnsupportedException=ie,e.KeyExchangeFields=dn,e.KeyExchangeQuery2=yn,e.KeyExchangeTokenQuery2=fn,e.KeyExchangesQuery2=hn,e.KeyGraphField=Ge,e.KeyGraphFragment=Je,e.LbopQuery=sa,e.LbopService=ca,e.LbopsQuery=ua,e.LifeReadyModule=pa,e.LoginHistoryQuery=Rs,e.LrApolloService=ke,e.LrGraphQLService=e.ɵg,e.LrMergedMutation=ht,e.LrMutation=dt,e.LrMutationBase=pt,e.LrService=$t,e.MainContactCardFields=Mn,e.MainContactCardPlainFields=An,e.MainContactCardProperty=En,e.MoveDirectoryQuery=Xe,e.MoveFileQuery=Ye,e.OwnerPlainDataJson=Yr,e.PasswordCheck=or,e.PasswordService=sr,e.PersistService=we,e.PreCompleteTpPasswordResetRequestMutation=jr,e.ProfileDetailsService=xa,e.ProfileService=Xn,e.ReceiveScenarioClaimMutation=yo,e.RegisterResult=Va,e.RegisterService=qa,e.RejectScenarioClaimMutation=lo,e.RejectTpPasswordResetRequestMutation=$r,e.RequestUserDeleteMutation=ks,e.RespondKeyExchangeOtkMutation=Sn,e.RevertFileMutation=Pi,e.RevertFileQuery=He,e.ServerTimeQuery=le,e.SetDirectoryConfidentialMutation=Fi,e.SetFileConfidentialMutation=Ni,e.SharedTrustedPartyDetails=On,e.SharedVaultFeature=Nn,e.TPFeatures=jn,e.TempDirectoryQuery=ji,e.TimeService=he,e.TrustedPartiesQuery=Hn,e.TrustedParty=$n,e.TrustedPartyDetails=Tn,e.TrustedPartyProperties=Vn,e.TwoFactorService=bs,e.UnarchiveDirectoryMutation=Ei,e.UnarchiveFileMutation=Mi,e.UpdateContactCardMutation=Zn,e.UpdateDirectoryMutation=Ii,e.UpdateFileMutation=Ki,e.UpdateFileQuery=Ze,e.UpdateLbopQuery=oa,e.UpdateOwnedContactCardMutation=Eo,e.UpdateReceivedContactCardMutation=Mo,e.UpdateScenarioMutation=so,e.UpdateTpPasswordResetMutation=Ur,e.UserService=Es,e.UserSharedKeyFields=ln,e.WebCryptoService=me,e.awsFetch=Ut,e.configureAmplifyAuth=xt,e.configureApollo=be,e.fragmentSpreadAstSelection=ct,e.gqlTyped=Oe,e.handleApolloError=U,e.handleCognitoCallback=function(e){return new Promise((function(t,n){return e((function(e,r){return e?n(e):t(r)}))}))},e.httpOptions=Ie,e.mapEdges=_t,e.processConnection=nt,e.throwClaimIdMismatch=Io,e.throwClaimNotApproved=bo,e.ɵa=Pe,e.ɵb=ve,e.ɵc=Ke,e.ɵd=ge,e.ɵe=$t,e.ɵf=et,e.ɵh=en,e.ɵj=fr,e.ɵk=_n,e.ɵl=Un,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
1
|
+
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(exports,require("@angular/core"),require("apollo-angular"),require("@dagrejs/graphlib"),require("lodash"),require("node-jose"),require("@aws-amplify/auth/lib-esm/Auth"),require("graphql-tag"),require("moment"),require("@apollo/client/core"),require("@apollo/client/link/context"),require("@apollo/client/link/retry"),require("ngx-cookie-service"),require("graphql/language/printer"),require("@angular/common/http"),require("@aws-amplify/core"),require("@ng-idle/core"),require("@ng-idle/keepalive"),require("slip39"),require("@aws-amplify/auth")):"function"==typeof define&&define.amd?define("@lifeready/core",["exports","@angular/core","apollo-angular","@dagrejs/graphlib","lodash","node-jose","@aws-amplify/auth/lib-esm/Auth","graphql-tag","moment","@apollo/client/core","@apollo/client/link/context","@apollo/client/link/retry","ngx-cookie-service","graphql/language/printer","@angular/common/http","@aws-amplify/core","@ng-idle/core","@ng-idle/keepalive","slip39","@aws-amplify/auth"],t):t(((e="undefined"!=typeof globalThis?globalThis:e||self).lifeready=e.lifeready||{},e.lifeready.core={}),e.ng.core,e["apollo-angular"],e["@dagrejs/graphlib"],e.lodash,e["node-jose"],e["@aws-amplify/auth/lib-esm/Auth"],e["graphql-tag"],e.moment,e["@apollo/client/core"],e["@apollo/client/link/context"],e["@apollo/client/link/retry"],e["ngx-cookie-service"],e["graphql/language/printer"],e.ng.common.http,e["@aws-amplify/core"],e["@ng-idle/core"],e["@ng-idle/keepalive"],e.slip39,e["@aws-amplify/auth"])}(this,(function(e,t,n,r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,g,S){"use strict";function C(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}function I(e){if(e&&e.__esModule)return e;var t=Object.create(null);return e&&Object.keys(e).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(t,n,r.get?r:{enumerable:!0,get:function(){return e[n]}})}})),t.default=e,Object.freeze(t)}var b=C(r),w=C(i),K=C(s),P=I(u),k=C(S),D=function(e,t){return(D=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n])})(e,t)};function R(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function n(){this.constructor=e}D(e,t),e.prototype=null===t?Object.create(t):(n.prototype=t.prototype,new n)}function E(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}function M(e,t,n,r){var i,a=arguments.length,o=a<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,n):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,n,o):i(t,n))||o);return a>3&&o&&Object.defineProperty(t,n,o),o}function A(e,t,n,r){return new(n||(n=Promise))((function(i,a){function o(e){try{u(r.next(e))}catch(e){a(e)}}function s(e){try{u(r.throw(e))}catch(e){a(e)}}function u(e){var t;e.done?i(e.value):(t=e.value,t instanceof n?t:new n((function(e){e(t)}))).then(o,s)}u((r=r.apply(e,t||[])).next())}))}function T(e,t){var n,r,i,a,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return a={next:s(0),throw:s(1),return:s(2)},"function"==typeof Symbol&&(a[Symbol.iterator]=function(){return this}),a;function s(a){return function(s){return function(a){if(n)throw new TypeError("Generator is already executing.");for(;o;)try{if(n=1,r&&(i=2&a[0]?r.return:a[0]?r.throw||((i=r.return)&&i.call(r),0):r.next)&&!(i=i.call(r,a[1])).done)return i;switch(r=0,i&&(a=[2&a[0],i.value]),a[0]){case 0:case 1:i=a;break;case 4:return o.label++,{value:a[1],done:!1};case 5:o.label++,r=a[1],a=[0];continue;case 7:a=o.ops.pop(),o.trys.pop();continue;default:if(!(i=o.trys,(i=i.length>0&&i[i.length-1])||6!==a[0]&&2!==a[0])){o=0;continue}if(3===a[0]&&(!i||a[1]>i[0]&&a[1]<i[3])){o.label=a[1];break}if(6===a[0]&&o.label<i[1]){o.label=i[1],i=a;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(a);break}i[2]&&o.ops.pop(),o.trys.pop();continue}a=t.call(e,o)}catch(e){a=[6,e],r=0}finally{n=i=0}if(5&a[0])throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}([a,s])}}}Object.create;function O(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function j(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,a=n.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(r=a.next()).done;)o.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=a.return)&&n.call(a)}finally{if(i)throw i.error}}return o}function N(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(j(arguments[t]));return e}function F(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}var $,_,L;Object.create;function U(e){if(e&&e.length){var t=e.map((function(e){return new q({code:e.extensions&&e.extensions.code,source:e.extensions&&e.extensions.source,message:e.message,debug:{locations:e.locations,path:e.path}})}));throw new(J.bind.apply(J,N([void 0],t)))}}!function(e){e.Key="key",e.PassKey="passKey"}($||($={})),function(e){e.KeyLink="keyLink",e.PassKeyLink="passKeyLink"}(_||(_={})),function(e){e.JSON="JSON",e.UINT_8_ARRAY="UINT_8_ARRAY"}(L||(L={}));var x,q=function(e){this._type="KcError",this.code=e.code,this.source=e.source,this.message=e.message,this.debug=e.debug},J=function(){function e(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._type="KcException",this.errors=e}return e.prototype.toString=function(){return this.errors.map((function(e){return JSON.stringify(e,null,2)}))},e}();(x=e.KcErrorCode||(e.KcErrorCode={})).ARCHIVED_RESOURCE="ARCHIVED_RESOURCE",x.BAD_ARGUMENT="BAD_ARGUMENT",x.BAD_SIGNATURE="BAD_SIGNATURE",x.BAD_STATE="BAD_STATE",x.CHANGED_PERMISSIONS="CHANGED_PERMISSIONS",x.CONCURRENT_ACCESS="CONCURRENT_ACCESS",x.CONFIG_ERROR="CONFIG_ERROR",x.CYCLE_DETECTED="CYCLE_DETECTED",x.EXPIRED="EXPIRED",x.INVALID_TOKEN="INVALID_TOKEN",x.INTERNAL_ERROR="INTERNAL_ERROR",x.JSON_DECODE_ERROR="JSON_DECODE_ERROR",x.KEY_MISMATCH="KEY_MISMATCH",x.LIMIT_REACHED="LIMIT_REACHED",x.LOCKED="LOCKED",x.LOGIC_ERROR="LOGIC_ERROR",x.LR_DEBUG_ONLY="LR_DEBUG_ONLY",x.MIN_DELAY="MIN_DELAY",x.MISSING_FIELD="MISSING_FIELD",x.MISSING_FIELD_VALUE="MISSING_FIELD_VALUE",x.MISSING_QUERY_PARAM="MISSING_QUERY_PARAM",x.NOT_IMPLEMENTED="NOT_IMPLEMENTED",x.OBJECT_DOES_NOT_EXIST="OBJECT_DOES_NOT_EXIST",x.OBJECT_EXISTS="OBJECT_EXISTS",x.RANGE_ERROR="RANGE_ERROR",x.TRUSTED_PARTY_NOT_FOUND="TRUSTED_PARTY_NOT_FOUND",x.UNAUTHENTICATED_USER="UNAUTHENTICATED_USER",x.USER_NOT_FOUND="USER_NOT_FOUND",x.VERSION_MISMATCH="VERSION_MISMATCH",x.WRONG_PERMISSIONS="WRONG_PERMISSIONS",x.AUTH="AUTH",x.BAD_LOGIC="BAD_LOGIC",x.BAD_REQUEST="BAD_REQUEST",x.BAD_TIME_SYNC="BAD_TIME_SYNC",x.CODE_MISMATCH="CODE_MISMATCH",x.ENCRYPTION="ENCRYPTION",x.NOT_FOUND="NOT_FOUND",x.SUSPICIOUS_OPERATION="SUSPICIOUS_OPERATION",x.UNSUPPORTED="UNSUPPORTED";var G=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.AUTH,message:n}))||this}return R(n,t),n}(J),Q=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_ARGUMENT,message:n}))||this}return R(n,t),n}(J),V=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_LOGIC,message:n}))||this}return R(n,t),n}(J),W=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_REQUEST,message:n}))||this}return R(n,t),n}(J),B=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_SIGNATURE,message:n}))||this}return R(n,t),n}(J),Z=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_STATE,message:n}))||this}return R(n,t),n}(J),H=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.BAD_TIME_SYNC,message:n}))||this}return R(n,t),n}(J),Y=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.CODE_MISMATCH,message:n}))||this}return R(n,t),n}(J),X=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.CONCURRENT_ACCESS,message:n}))||this}return R(n,t),n}(J),z=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.ENCRYPTION,message:n}))||this}return R(n,t),n}(J),ee=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.INTERNAL_ERROR,message:n}))||this}return R(n,t),n}(J),te=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.LOCKED,message:n}))||this}return R(n,t),n}(J),ne=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.NOT_FOUND,message:n}))||this}return R(n,t),n}(J),re=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.SUSPICIOUS_OPERATION,message:n}))||this}return R(n,t),n}(J),ie=function(t){function n(n){return t.call(this,new q({code:e.KcErrorCode.UNSUPPORTED,message:n}))||this}return R(n,t),n}(J);function ae(e){if(!Array.isArray(e))throw new Error("not array");return e.some((function(e){return null==e?void 0:e.then}))?Promise.all(e):e}function oe(e,t){var n,r,i={};try{for(var a=O(Object.keys(e).entries()),o=a.next();!o.done;o=a.next()){var s=j(o.value,2),u=s[0];i[s[1]]=t[u]}}catch(e){n={error:e}}finally{try{o&&!o.done&&(r=a.return)&&r.call(a)}finally{if(n)throw n.error}}return i}function se(e,t){var n=ae(Object.entries(e).map((function(n){var r=j(n,2),i=r[0],a=r[1];return t(a,i,e)})));return n.then?n.then((function(t){return oe(e,t)})):oe(e,n)}function ue(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return t.trys.push([0,2,,3]),[4,e.currentSession()];case 1:return[2,t.sent().getAccessToken().getJwtToken()];case 2:return t.sent(),[2,""];case 3:return[2]}}))}))}var ce,pe,de=P,le=K.default(ce||(ce=F(["\n query {\n serverTime {\n timestamp\n }\n }\n"],["\n query {\n serverTime {\n timestamp\n }\n }\n"]))),he=function(){function e(e,t){this.auth=e,this.apollo=t,this.VERIFY_ENABLED=!0,this.MAX_DIFF_MSEC=de.duration({seconds:30}).asMilliseconds(),this.offsetMs=null,this.verified=!1}return e.prototype.verifyCognito=function(){return A(this,void 0,void 0,(function(){var e,t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,ue(this.auth)];case 1:return(e=a.sent())?[4,fetch("https://cognito-idp.ap-southeast-2.amazonaws.com/",{method:"POST",mode:"cors",cache:"no-cache",headers:{"x-amz-target":"AWSCognitoIdentityProviderService.GetUser","x-amz-user-agent":"aws-amplify/0.1.x js","Content-Type":"application/x-amz-json-1.1"},body:JSON.stringify({AccessToken:e})})]:[2];case 2:if(t=a.sent(),n=Date.now(),r=de(t.headers.get("Date")).valueOf(),i=n+this.offsetMs,Math.abs(i-r)>this.MAX_DIFF_MSEC)throw new H("Server time does not match independent source. ServerTime: "+i+", Cognito time: "+r);return this.verified=!0,[2]}}))}))},e.prototype.refresh=function(){return A(this,void 0,void 0,(function(){var e,t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return e=Date.now(),[4,this.apollo.query({query:le}).toPromise()];case 1:return t=a.sent(),n=Date.now(),U(t.errors),r=parseInt(t.data.serverTime.timestamp,10),i=n-e,this.offsetMs=Math.round(r-(e+i/2)),this.VERIFY_ENABLED?[4,this.verifyCognito()]:[3,3];case 2:a.sent(),a.label=3;case 3:return[2]}}))}))},e.prototype.serverNow=function(){return A(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return e=!1,null===this.offsetMs&&(e=!0),this.VERIFY_ENABLED?(t=!this.verified)?[4,ue(this.auth)]:[3,2]:[3,3];case 1:t=n.sent(),n.label=2;case 2:t&&(e=!0),n.label=3;case 3:return e?[4,this.refresh()]:[3,5];case 4:n.sent(),n.label=5;case 5:return[2,Date.now()+this.offsetMs]}}))}))},e.prototype.now=function(){return null===this.offsetMs?(console.error("Server time offset not known. You must await serverNow() first. Returning local clock instead."),Date.now()):Date.now()+this.offsetMs},e.prototype.date=function(){return new Date(this.now())},e}();he.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new he(t.ɵɵinject(o.AuthClass),t.ɵɵinject(n.Apollo))},token:he,providedIn:"root"}),he.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],he.ctorParameters=function(){return[{type:o.AuthClass},{type:n.Apollo}]},function(e){e.JSON="JSON",e.COMPACT="COMPACT"}(pe||(pe={}));var ye={payloadType:L.JSON,returnOnlyPayload:!0},fe={payloadType:L.JSON,returnOnlyPayload:!0,serializations:[pe.JSON]};var ve=function(){function e(e){this.timeService=e}return e.prototype.decrypt=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i;return T(this,(function(o){switch(o.label){case 0:if(r={algorithms:["dir","A*GCM","RSA-OAEP-*"]},n=Object.assign(Object.assign({},fe),n),e.jwk&&(e=e.jwk),"string"==typeof t&&n.serializations.includes(pe.JSON))try{t=JSON.parse(t)}catch(e){if(!n.serializations.includes(pe.COMPACT))throw e;console.log("Not a JSON-formatted JWE, it maybe compact serialisation format.")}return[4,a.JWE.createDecrypt(e,r).decrypt(t)];case 1:return(i=o.sent()).payload=this.decodePayload(n.payloadType,i.payload),n.returnOnlyPayload?[2,i.payload]:[2,i]}}))}))},e.prototype.encryptToString=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return r=(n=JSON).stringify,[4,this.encrypt(e,t)];case 1:return[2,r.apply(n,[i.sent()])]}}))}))},e.prototype.encrypt=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,o;return T(this,(function(s){switch(s.label){case 0:if(null==t)throw new Error("Encrypting null/undefined content.");return t instanceof ArrayBuffer||(t=(new TextEncoder).encode(JSON.stringify(t))),r=(n=a.JWE).createEncrypt,i={contentAlg:"A256GCM"},o={},[4,this.timeService.serverNow()];case 1:return[2,r.apply(n,[(i.fields=(o.timestamp=s.sent(),o),i),e]).update(t).final()]}}))}))},e.prototype.sign=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,o,s;return T(this,(function(u){switch(u.label){case 0:return i=(r=a.JWS).createSign,o={},s={},[4,this.timeService.serverNow()];case 1:return n=i.apply(r,[(o.fields=(s.timestamp=u.sent(),s),o),e]),t instanceof Buffer?n.update(t):n.update(JSON.stringify(t),"utf8"),[2,n.final()]}}))}))},e.prototype.signToString=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return r=(n=JSON).stringify,[4,this.sign(e,t)];case 1:return[2,r.apply(n,[i.sent()])]}}))}))},e.prototype.verify=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,o;return T(this,(function(s){switch(s.label){case 0:r={algorithms:["RS*"]},n=Object.assign(Object.assign({},ye),n),s.label=1;case 1:return s.trys.push([1,3,,4]),[4,a.JWS.createVerify(e,r).verify(t)];case 2:return(i=s.sent()).payload=this.decodePayload(n.payloadType,i.payload),n.returnOnlyPayload?[2,i.payload]:[2,i];case 3:throw o=s.sent(),new B("Bad signature: "+o);case 4:return[2]}}))}))},e.prototype.encryptThenSign=function(e,t){var n=e.key,r=e.sigPrk;return A(this,void 0,void 0,(function(){var e,i,a,o;return T(this,(function(s){switch(s.label){case 0:return a=(i=JSON).stringify,[4,this.encrypt(n,t)];case 1:return e=a.apply(i,[s.sent()]),[4,this.sign(r,e)];case 2:return delete(o=s.sent()).payload,[2,{cipher:e,sig:JSON.stringify(o)}]}}))}))},e.prototype.decodePayload=function(e,t){switch(e){case L.JSON:return JSON.parse((new TextDecoder).decode(t));case L.UINT_8_ARRAY:return t;default:throw new Q("Unknown payloadType: "+e)}},e}();ve.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new ve(t.ɵɵinject(he))},token:ve,providedIn:"root"}),ve.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ve.ctorParameters=function(){return[{type:he}]};var me=function(){function e(){this.kcCrypto=window.crypto}return e.prototype.toHex=function(e){return Array.from(new Uint8Array(e)).map((function(e){return e.toString(16).padStart(2,"0")})).join("")},e.prototype.stringDigest=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return n=new TextEncoder,r=n.encode(t),[4,this.kcCrypto.subtle.digest(e,r)];case 1:return i=a.sent(),[2,this.toHex(i)]}}))}))},e}();me.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new me},token:me,providedIn:"root"}),me.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var ge=function(){function e(e){this.webCryptoService=e,this.MIN_PASS_IDP_PBKDF_ITER=1e5,this.MIN_PASS_KEY_PBKDF_ITER=1e5,this.MIN_LBOP_KEY_PBKDF_ITER=1e5,this.DEFAULT_PASS_IDP_PBKDF_ITER=this.MIN_PASS_IDP_PBKDF_ITER,this.DEFAULT_PASS_KEY_PBKDF_ITER=this.MIN_PASS_KEY_PBKDF_ITER,this.DEFAULT_LBOP_KEY_PBKDF_ITER=this.MIN_LBOP_KEY_PBKDF_ITER,this.kcCrypto=this.webCryptoService.kcCrypto}return e.asKey=function(e,t,n){return a.JWK.asKey(e,t,n)},e.prototype.randomString=function(e){if(e<=0)throw new Q("digits <= 0");var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",n=new Uint32Array(e);return this.kcCrypto.getRandomValues(n),n=n.map((function(e){return t.charCodeAt(e%t.length)})),String.fromCharCode.apply(null,n)},e.prototype.randomDigitsNoZeros=function(e){return this.randomChoices([1,2,3,4,5,6,7,8,9],e).join("")},e.prototype.randomChoices=function(e,t){if(e.length<=1)throw new Q("array.length <= 0");if(t<=0)throw new Q("chooseN <= 0");var n=new Uint32Array(t);this.kcCrypto.getRandomValues(n);var r=[];return n.forEach((function(t){return r.push(e[t%e.length])})),r},e.prototype.createSalt=function(){return this.randomString(16)},e.prototype.createKey=function(){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.kcCrypto.subtle.generateKey({name:"AES-GCM",length:256},!0,["encrypt","decrypt"])];case 1:return t=r.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t)];case 2:return delete(n=r.sent()).ext,delete n.key_ops,[2,e.asKey(n)]}}))}))},e.prototype.createSignKey=function(){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.kcCrypto.subtle.generateKey({name:"HMAC",hash:{name:"SHA-512"}},!0,["sign","verify"])];case 1:return t=r.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t)];case 2:return delete(n=r.sent()).key_ops,delete n.ext,[2,e.asKey(n)]}}))}))},e.prototype.createPkcKey=function(){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.kcCrypto.subtle.generateKey({name:"RSA-OAEP",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["encrypt","decrypt"])];case 1:return t=r.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t.privateKey)];case 2:return delete(n=r.sent()).key_ops,delete n.ext,[2,e.asKey(n)]}}))}))},e.prototype.createPkcSignKey=function(){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.kcCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:2048,publicExponent:new Uint8Array([1,0,1]),hash:{name:"SHA-256"}},!0,["sign","verify"])];case 1:return t=r.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t.privateKey)];case 2:return delete(n=r.sent()).key_ops,delete n.ext,[2,e.asKey(n)]}}))}))},e.prototype.importPassword=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){return t=new TextEncoder,[2,this.kcCrypto.subtle.importKey("raw",t.encode(e),"PBKDF2",!1,["deriveKey"])]}))}))},e.prototype.deriveKey=function(t){var n=t.password,r=t.salt,i=t.iterations,a=t.kid;return A(this,void 0,void 0,(function(){var t,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.kcCrypto.subtle.deriveKey({name:"PBKDF2",salt:(new TextEncoder).encode(r),iterations:i,hash:"SHA-256"},n,{name:"AES-GCM",length:256},!0,["encrypt","decrypt"])];case 1:return t=s.sent(),[4,this.kcCrypto.subtle.exportKey("jwk",t)];case 2:return o=s.sent(),a&&(o.kid=a),[4,e.asKey(o)];case 3:return[2,{jwk:s.sent()}]}}))}))},e.prototype.derivePassIdp=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){if(e.iterations<this.MIN_PASS_IDP_PBKDF_ITER)throw new re("The number of PassIdp key derivation iterations sent from the server ("+e.iterations+") is lower than the minimum ("+this.MIN_PASS_IDP_PBKDF_ITER+")");return[2,this.deriveKey(e)]}))}))},e.prototype.derivePassKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){if(e.iterations<this.MIN_PASS_KEY_PBKDF_ITER)throw new re("The number of PassKey key derivation iterations sent from the server("+e.iterations+") is lower than the minimum("+this.MIN_PASS_KEY_PBKDF_ITER+")");return[2,this.deriveKey(e)]}))}))},e.prototype.deriveLbopKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){if(e.iterations<this.MIN_LBOP_KEY_PBKDF_ITER)throw new re("The number of LbopKey key derivation iterations sent from the server("+e.iterations+") is lower than the minimum("+this.MIN_LBOP_KEY_PBKDF_ITER+")");return[2,this.deriveKey(e)]}))}))},e.prototype.createKid=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.createKey()];case 1:return[2,e.sent().kid]}}))}))},e.prototype.createPassIdpParams=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){return[2,{salt:this.createSalt(),iterations:this.DEFAULT_PASS_IDP_PBKDF_ITER}]}))}))},e.prototype.createPassKeyParams=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return e={salt:this.createSalt()},[4,this.createKid()];case 1:return[2,(e.kid=t.sent(),e.iterations=this.DEFAULT_PASS_KEY_PBKDF_ITER,e)]}}))}))},e.prototype.createLbopKeyParams=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return e={salt:this.createSalt()},[4,this.createKid()];case 1:return[2,(e.kid=t.sent(),e.iterations=this.DEFAULT_PASS_KEY_PBKDF_ITER,e)]}}))}))},e}();ge.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new ge(t.ɵɵinject(me))},token:ge,providedIn:"root"}),ge.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ge.ctorParameters=function(){return[{type:me}]};var Se=new t.InjectionToken("KC_CONFIG"),Ce=[e.KcErrorCode.CONCURRENT_ACCESS];function Ie(e,t){var n;return A(this,void 0,void 0,(function(){var r,i;return T(this,(function(a){switch(a.label){case 0:return[4,ue(e)];case 1:return r=a.sent(),i=null===(n=t.debug)||void 0===n?void 0:n.username,[2,{withCredentials:!0,headers:Object.assign(Object.assign({},r&&{authorization:"Bearer "+r}),i&&{"x-kc-dev-user":i})}]}}))}))}var be=function(e,t){var n=p.setContext((function(n,r){var i=r.headers;return A(void 0,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,Ie(t,e)];case 1:return n=r.sent(),[2,Object.assign(Object.assign({},n),{headers:Object.assign(Object.assign({},i),n.headers)})]}}))}))})),r=new d.RetryLink({delay:{initial:300,max:1/0,jitter:!0},attempts:{max:3,retryIf:function(e,t){return!!(e instanceof i&&e.errors.some((function(e){var t;return Ce.includes(null===(t=e.extensions)||void 0===t?void 0:t.code)})))}}}),i=function(e){function t(t){var n=e.call(this,t.map((function(e){return e.message})).join(", "))||this;return n.errors=t,n}return R(t,e),t}(Error),a=new c.ApolloLink((function(e,t){return t(e).map((function(e){if(e&&e.errors&&e.errors.filter((function(e){var t;return Ce.includes(null===(t=e.extensions)||void 0===t?void 0:t.code)})).length>0)throw new i(e.errors);return e}))})),o=c.createHttpLink({uri:e.apolloUrl,credentials:"include"});return Object.assign({link:c.from([r,a,n,o]),cache:new c.InMemoryCache,defaultOptions:{watchQuery:{fetchPolicy:"no-cache",errorPolicy:"all"},query:{fetchPolicy:"no-cache",errorPolicy:"all"},mutate:{fetchPolicy:"no-cache",errorPolicy:"all"}}},e.apolloConfig)},we=function(){function e(e,n,r,i){this.keyFactory=e,this.cookieService=n,this.encryptionService=r,this.injector=i,this.KEY_PREFIX="lrSession-",this.cookieSecure=!0,this.serverSessionEncryptionKey=null,t.isDevMode()&&this.setCookieSecure(!1)}return e.prototype.setServerSessionEncryptionKey=function(e){this.serverSessionEncryptionKey=e},e.prototype.clearServerSessionEncryptionKey=function(){this.serverSessionEncryptionKey=null},e.prototype.getCookieParams=function(){return{path:"/",domain:null,secure:this.cookieSecure,sameSite:"Lax"}},e.prototype.clear=function(){var e=this;Object.keys(this.cookieService.getAll()).forEach((function(t){t.startsWith(e.KEY_PREFIX)&&e.deletePrefixedName(t)})),Object.keys(localStorage).forEach((function(t){t.startsWith(e.KEY_PREFIX)&&e.deletePrefixedName(t)}))},e.prototype.setCookieSecure=function(e){if(this.cookieSecure=e,!e){if(!t.isDevMode())throw new Q("Can not set PersistService cookie secure flag to false in production mode.");console.warn("The cookie secure flag in persistService has been set to false, set it to true in production mode")}},e.prototype.prefixName=function(e){return this.KEY_PREFIX+e},e.prototype.delete=function(e){this.deletePrefixedName(this.prefixName(e))},e.prototype.deletePrefixedName=function(e){var t=this.getCookieParams();this.cookieService.delete(e,t.path,t.domain,t.secure,t.sameSite),localStorage.removeItem(e)},e.prototype.set=function(e){var t=e.name,n=e.value,r=e.serverSession,i=e.expiry;return A(this,void 0,void 0,(function(){var e,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:return e=this.prefixName(t),r?(o={serverSession:!0},[4,this.encryptionService.encryptToString(this.serverSessionEncryptionKey,n)]):[3,2];case 1:return o.data=d.sent(),a=o,[3,3];case 2:a={data:n},d.label=3;case 3:return i?[4,this.keyFactory.createKey()]:[3,6];case 4:return s=d.sent(),a.expiry=i.toISOString(),u=a,[4,this.encryptionService.encryptToString(s,a.data)];case 5:u.data=d.sent(),c={key:s.toJSON(!0)},p=this.getCookieParams(),this.cookieService.set(e,JSON.stringify(c),i,p.path,p.domain,p.secure,p.sameSite),d.label=6;case 6:return localStorage.setItem(e,JSON.stringify(a)),[2]}}))}))},e.prototype.get=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:t=this.prefixName(e),i.label=1;case 1:return i.trys.push([1,3,,4]),[4,this.getImpl(t)];case 2:return null==(n=i.sent())&&this.deletePrefixedName(t),[2,n];case 3:throw r=i.sent(),this.deletePrefixedName(t),r;case 4:return[2]}}))}))},e.prototype.getImpl=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return(t=localStorage.getItem(e))?(n=JSON.parse(t)).expiry?(i=this.cookieService.get(e))?(a=JSON.parse(i),[4,ge.asKey(a.key)]):(console.log("No cookie."),[2,null]):[3,3]:[2,null];case 1:return o=s.sent(),[4,this.encryptionService.decrypt(o,n.data)];case 2:return r=s.sent(),[3,4];case 3:r=n.data,s.label=4;case 4:return n.serverSession?[4,this.encryptionService.decrypt(this.serverSessionEncryptionKey,r)]:[3,6];case 5:r=s.sent(),s.label=6;case 6:return[2,r]}}))}))},e}();we.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new we(t.ɵɵinject(ge),t.ɵɵinject(l.CookieService),t.ɵɵinject(ve),t.ɵɵinject(t.INJECTOR))},token:we,providedIn:"root"}),we.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],we.ctorParameters=function(){return[{type:ge},{type:l.CookieService},{type:ve},{type:t.Injector}]};var Ke=function(){function e(e,t){this.config=e,this.persistService=t,this.STORE_MASTER_KEY="masterKey",this.MIN_PASS_IDP_PBKDF_ITER=1e5,this.MIN_PASS_KEY_PBKDF_ITER=1e5,this.MIN_LBOP_KEY_PBKDF_ITER=1e5,this.DEFAULT_PASS_IDP_PBKDF_ITER=this.MIN_PASS_IDP_PBKDF_ITER,this.DEFAULT_PASS_KEY_PBKDF_ITER=this.MIN_PASS_KEY_PBKDF_ITER,this.DEFAULT_LBOP_KEY_PBKDF_ITER=this.MIN_LBOP_KEY_PBKDF_ITER,this.resetKeys()}return e.prototype.resetKeys=function(){this.keys=null,this.masterKey=null},e.prototype.purgeKeys=function(){this.resetKeys(),this.persistService.clear()},e.prototype.setKeys=function(e){this.keys=e},Object.defineProperty(e.prototype,"currentPassKey",{get:function(){return this.keys.passKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentMasterKey",{get:function(){return this.keys.masterKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentRootKey",{get:function(){return this.keys.rootKey},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentPxk",{get:function(){return this.keys.pxk},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"currentSigPxk",{get:function(){return this.keys.sigPxk},enumerable:!1,configurable:!0}),e.prototype.expiresAfter=function(e){return new Date(Date.now()+1e3*e)},e.prototype.persistMasterKey=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return n={id:e.id,jwk:e.jwk.toJSON(!0)},this.masterKey=e,[4,this.persistService.set({name:this.STORE_MASTER_KEY,value:n,expiry:this.expiresAfter(t),serverSession:!this.config.disableSessionEncryptionKey})];case 1:return r.sent(),[2]}}))}))},e.prototype.setMasterKeyExpiresAfterSeconds=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.persistService.get(this.STORE_MASTER_KEY)];case 1:if(null==(t=n.sent()))throw new ne("Can not find masterKey in persisted storage using name: "+this.STORE_MASTER_KEY);return[4,this.persistService.set({name:this.STORE_MASTER_KEY,value:t,expiry:this.expiresAfter(e),serverSession:!this.config.disableSessionEncryptionKey})];case 2:return n.sent(),[2]}}))}))},e.prototype.loadMasterKey=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return this.masterKey?[3,3]:[4,this.persistService.get(this.STORE_MASTER_KEY)];case 1:if(!(t=r.sent()))throw new ne("Could not find masterKey in persisted storage");if(t.id!==e)throw new ne("masterKeyId "+t.id+" in persisted storage does not match the one requested "+e);return n=t,[4,ge.asKey(t.jwk)];case 2:n.jwk=r.sent(),this.masterKey=t,r.label=3;case 3:return[2,this.masterKey]}}))}))},e}();Ke.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Ke(t.ɵɵinject(Se),t.ɵɵinject(we))},token:Ke,providedIn:"root"}),Ke.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Ke.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:we}]};var Pe=function(){function e(e,t,n){this.encryptionService=e,this.keyService=t,this.keyFactory=n,this.purgeKeys()}return e.prototype.purgeKeys=function(){this.graph=new r.Graph},e.prototype.populateKeys=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return n=(t=this.keyService).setKeys,r={passKey:e.passKey},[4,this.keyService.loadMasterKey(e.masterKey.id)];case 1:return r.masterKey=i.sent(),[4,this.unwrapKey(e.masterKey.id,e.rootKey.id)];case 2:return r.rootKey=i.sent(),[4,this.unwrapKey(e.masterKey.id,e.pxk.id)];case 3:return r.pxk=i.sent(),[4,this.unwrapKey(e.masterKey.id,e.sigPxk.id)];case 4:return n.apply(t,[(r.sigPxk=i.sent(),r)]),[2]}}))}))},e.prototype.hasKey=function(e){return!!this.graph.node(e)},e.prototype.getNode=function(e,t){var n=this.graph.node(e);if(!n)throw new ne("Key graphs does not contain key id: "+e);if(n.type!==t)throw new Z("Key with id "+e+" is not of type "+t);return n.data},e.prototype.key=function(e){return this.getNode(e,$.Key)},e.prototype.passKey=function(e){return this.getNode(e,$.PassKey)},e.prototype.addKeys=function(e){var t,n,r,i,a,o;if(e.keys)try{for(var s=O(e.keys),u=s.next();!u.done;u=s.next()){var c=u.value;if(!this.graph.hasNode(c.id)){var p={type:$.Key,data:w.default.cloneDeep(c)};this.graph.setNode(c.id,p)}}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}if(e.keyLinks)try{for(var d=O(e.keyLinks),l=d.next();!l.done;l=d.next()){var h=l.value;if(!this.graph.hasEdge(h.wrappingKeyId,h.keyId)){var y={type:_.KeyLink,data:w.default.cloneDeep(h)};this.graph.setEdge(h.wrappingKeyId,h.keyId,y)}}}catch(e){r={error:e}}finally{try{l&&!l.done&&(i=d.return)&&i.call(d)}finally{if(r)throw r.error}}if(e.passKeyLinks)try{for(var f=O(e.passKeyLinks),v=f.next();!v.done;v=f.next()){var m=v.value;if(!this.graph.hasEdge(m.passKeyId,m.keyId)){y={type:_.PassKeyLink,data:w.default.cloneDeep(m)};this.graph.setEdge(m.passKeyId,m.keyId,y)}}}catch(e){a={error:e}}finally{try{v&&!v.done&&(o=f.return)&&o.call(f)}finally{if(a)throw a.error}}},e.prototype.tracePath=function(e,t){var n=[],r=t;if(!e[r].predecessor)return null;for(;e[r].predecessor;){var i=e[r].predecessor;n.push(this.graph.edge(i,r)),r=i}return n.reverse(),n},e.prototype.getPath=function(e,t){if(!e||"string"!=typeof e)throw new z("Param knownKeyId wrong format: "+e);if(!t||"string"!=typeof t)throw new z("Param keyId wrong format: "+t);var n=b.default.alg.dijkstra(this.graph,e);return this.tracePath(n,t)},e.prototype.getJwkKey=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.getKey(e,t)];case 1:return[2,n.sent().jwk]}}))}))},e.prototype.getKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return n="string"==typeof e?e:null==e?void 0:e.id,this.hasKey(n)||!t?[3,2]:[4,t()];case 1:if(r=a.sent(),null!=n&&n!=r)throw new V("Requested keyId is not in the key cache, so an API request was made to populate the key cache.But the key returned by the API does NOT match the requested keyId.This is a programming logic error.");n=r,a.label=2;case 2:return(i=this.key(n)).jwk?[2,i]:[2,this.unwrapKey(this.keyService.currentMasterKey.id,n)]}}))}))},e.prototype._unwrapLink=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a;return T(this,(function(o){switch(o.label){case 0:return(r=JSON.parse(t.data.wrappedKey)).signatures?[4,this.encryptionService.verify(e,r)]:[3,2];case 1:return i=o.sent(),[3,4];case 2:return[4,this.encryptionService.decrypt(e,r)];case 3:i=o.sent(),o.label=4;case 4:return a=n,[4,ge.asKey(i)];case 5:return a.jwk=o.sent(),n.task=null,[2]}}))}))},e.prototype._unwrap=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u;return T(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,7]),n=O(t),r=n.next(),c.label=1;case 1:return r.done?[3,4]:(i=r.value,(a=this.key(i.data.keyId)).jwk?(e=a.jwk,[3,3]):(a.task||(a.task=this._unwrapLink(e,i,a)),[4,a.task]));case 2:c.sent(),e=a.jwk,c.label=3;case 3:return r=n.next(),[3,1];case 4:return[3,7];case 5:return o=c.sent(),s={error:o},[3,7];case 6:try{r&&!r.done&&(u=n.return)&&u.call(n)}finally{if(s)throw s.error}return[7];case 7:return[2,e]}}))}))},e.prototype.unwrapWithPassKey=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i;return T(this,(function(a){switch(a.label){case 0:return r=this.getPath(e,n),i={id:n},[4,this._unwrap(t,r)];case 1:return[2,(i.jwk=a.sent(),i)]}}))}))},e.prototype.unwrapKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.keyService.loadMasterKey(e)];case 1:return n=a.sent(),e===t?[2,n]:(r=this.getPath(n.id,t),i={id:t},[4,this._unwrap(n.jwk,r)]);case 2:return[2,(i.jwk=a.sent(),i)]}}))}))},e.prototype.decryptFromString=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return t?[4,this.getJwkKey(e)]:[3,3];case 1:return r=i.sent(),[4,this.encryptionService.decrypt(r,JSON.parse(t),n)];case 2:return[2,i.sent()];case 3:return[2,null]}}))}))},e.prototype.decryptFile=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getJwkKey(e)];case 1:return n=r.sent(),[4,this.encryptionService.decrypt(n,t,{payloadType:L.UINT_8_ARRAY})];case 2:return[2,r.sent()]}}))}))},e.prototype.encryptToString=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return null==t?[2,null]:(r=function(e){return e.id&&e.jwk?e.jwk:e.keystore&&e.length&&e.kty&&e.kid&&e.alg?e:null}(e))?[3,2]:[4,this.getJwkKey(e)];case 1:r=i.sent(),i.label=2;case 2:return n=r,[2,this.encryptionService.encryptToString(n,t)]}}))}))},e.prototype.wrapKey=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){if(!function(e){return"oct"===e.kty}(t))throw new Q("Only allowing wrapping of symmetric keys.");return[2,this.encryptToString(e,t.toJSON(!0))]}))}))},e.prototype.encryptWithNewKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.keyFactory.createKey()];case 1:return n=a.sent(),[4,this.encryptToString(e,n.toJSON(!0))];case 2:return r=a.sent(),[4,this.encryptToString(n,t)];case 3:return i=a.sent(),[2,{key:n,wrappingKeyId:e,wrappedKey:r,cipher:i}]}}))}))},e}();Pe.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Pe(t.ɵɵinject(ve),t.ɵɵinject(Ke),t.ɵɵinject(ge))},token:Pe,providedIn:"root"}),Pe.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Pe.ctorParameters=function(){return[{type:ve},{type:Ke},{type:ge}]};var ke=function(){function e(e,t){this.apollo=e,this.keyGraph=t}return e.prototype.addKeys=function(e){e.data.keyGraph&&this.keyGraph.addKeys(e.data.keyGraph)},e.prototype.query=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.apollo.query(e).toPromise()];case 1:return U((t=n.sent()).errors),this.addKeys(t),[2,t.data]}}))}))},e.prototype.mutate=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.apollo.mutate(e).toPromise()];case 1:return U((t=n.sent()).errors),this.addKeys(t),[2,t.data]}}))}))},e}();function De(e,t){var n=e.definitions.filter((function(e){return"OperationDefinition"===e.kind}));if(n.length>1)throw new V("There can be only one '"+t+"' operation, instead there are "+n.length);return n[0]}function Re(e){return De(e,"query")}function Ee(e){return De(e,"mutation")}function Me(e){return e.definitions.filter((function(e){return"FragmentDefinition"===e.kind}))}function Ae(e){return{kind:"Name",value:e}}function Te(e){var t;return(null===(t=e.alias)||void 0===t?void 0:t.value)||e.name.value}function Oe(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];return K.default.apply(void 0,N([e],t))}ke.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new ke(t.ɵɵinject(n.Apollo),t.ɵɵinject(Pe))},token:ke,providedIn:"root"}),ke.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ke.ctorParameters=function(){return[{type:n.Apollo},{type:Pe}]};var je,Ne,Fe,$e,_e,Le,Ue,xe,qe="\n{\n keys {\n id\n }\n keyLinks {\n keyId\n wrappingKeyId\n wrappedKey\n }\n passKeys {\n id\n }\n passKeyLinks {\n keyId\n passKeyId\n wrappedKey\n }\n __typename\n}\n",Je=K.default(je||(je=F(["\nfragment KeyGraphFragment on KeyGraphType ","\n"],["\nfragment KeyGraphFragment on KeyGraphType ","\n"])),qe),Ge="keyGraph "+qe,Qe="keyGraph: fetchKeyGraph "+qe,Ve=K.default(Ne||(Ne=F(["\n query File($id: LrRelayIdInput!, $cachedKeyIds: [LrRelayIdInput!]) {\n file(id: $id) {\n id\n keyId\n currentVersion {\n id\n operation\n state {\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n versions {\n edges {\n node {\n id\n state {\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n }\n }\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n id\n plainMeta\n }\n }\n }\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n }\n ","\n"],["\n query File($id: LrRelayIdInput!, $cachedKeyIds: [LrRelayIdInput!]) {\n file(id: $id) {\n id\n keyId\n currentVersion {\n id\n operation\n state {\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n versions {\n edges {\n node {\n id\n state {\n keyId\n plainMeta\n cipherMeta\n contentResource\n }\n }\n }\n }\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n id\n plainMeta\n }\n }\n }\n }\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n }\n ","\n"])),Je),We=K.default(Fe||(Fe=F(["\n query Directory($id: LrRelayIdInput!, $cachedKeyIds: [LrRelayIdInput!]) {\n directory(id: $id) {\n id\n keyId\n plainMeta\n cipherMeta\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n }\n ","\n"],["\n query Directory($id: LrRelayIdInput!, $cachedKeyIds: [LrRelayIdInput!]) {\n directory(id: $id) {\n id\n keyId\n plainMeta\n cipherMeta\n }\n keyGraph(cachedKeyIds: $cachedKeyIds) {\n ...KeyGraphFragment\n }\n }\n ","\n"])),Je),Be=K.default($e||($e=F(["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"],["\n mutation CreateFile($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n }\n }\n }\n"]))),Ze=K.default(_e||(_e=F(["\n mutation UpdateFile($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n currentVersion {\n id\n state {\n id\n }\n }\n }\n }\n }\n"],["\n mutation UpdateFile($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n currentVersion {\n id\n state {\n id\n }\n }\n }\n }\n }\n"]))),He=K.default(Le||(Le=F(["\n mutation RevertFile($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n currentVersion {\n id\n state {\n id\n }\n }\n }\n }\n }\n"],["\n mutation RevertFile($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n currentVersion {\n id\n state {\n id\n }\n }\n }\n }\n }\n"]))),Ye=K.default(Ue||(Ue=F(["\n mutation MoveFile(\n $fileId: LrRelayIdInput!\n $fromParentDirectoryId: LrRelayIdInput!\n $toParentDirectoryId: LrRelayIdInput!\n $wrappingKeyId: LrRelayIdInput!\n $wrappedKey: String!\n ) {\n moveFile(\n input: {\n fileId: $fileId\n fromParentDirectoryId: $fromParentDirectoryId\n toParentDirectoryId: $toParentDirectoryId\n wrappingKeyId: $wrappingKeyId\n wrappedKey: $wrappedKey\n }\n ) {\n file {\n id\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n plainMeta\n }\n }\n }\n }\n }\n }\n }\n"],["\n mutation MoveFile(\n $fileId: LrRelayIdInput!\n $fromParentDirectoryId: LrRelayIdInput!\n $toParentDirectoryId: LrRelayIdInput!\n $wrappingKeyId: LrRelayIdInput!\n $wrappedKey: String!\n ) {\n moveFile(\n input: {\n fileId: $fileId\n fromParentDirectoryId: $fromParentDirectoryId\n toParentDirectoryId: $toParentDirectoryId\n wrappingKeyId: $wrappingKeyId\n wrappedKey: $wrappedKey\n }\n ) {\n file {\n id\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n plainMeta\n }\n }\n }\n }\n }\n }\n }\n"]))),Xe=K.default(xe||(xe=F(["\n mutation MoveDirectory(\n $directoryId: LrRelayIdInput!\n $fromParentDirectoryId: LrRelayIdInput\n $toParentDirectoryId: LrRelayIdInput!\n $wrappedKey: String!\n $wrappingKeyId: LrRelayIdInput!\n ) {\n moveDirectory(\n input: {\n directoryId: $directoryId\n fromParentDirectoryId: $fromParentDirectoryId\n toParentDirectoryId: $toParentDirectoryId\n wrappedKey: $wrappedKey\n wrappingKeyId: $wrappingKeyId\n }\n ) {\n directory {\n id\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n plainMeta\n }\n }\n }\n }\n }\n }\n }\n"],["\n mutation MoveDirectory(\n $directoryId: LrRelayIdInput!\n $fromParentDirectoryId: LrRelayIdInput\n $toParentDirectoryId: LrRelayIdInput!\n $wrappedKey: String!\n $wrappingKeyId: LrRelayIdInput!\n ) {\n moveDirectory(\n input: {\n directoryId: $directoryId\n fromParentDirectoryId: $fromParentDirectoryId\n toParentDirectoryId: $toParentDirectoryId\n wrappedKey: $wrappedKey\n wrappingKeyId: $wrappingKeyId\n }\n ) {\n directory {\n id\n parentDirectoryLinks {\n edges {\n node {\n parentDirectory {\n plainMeta\n }\n }\n }\n }\n }\n }\n }\n"]))),ze=["constructor","ngOnChanges","ngOnInit","ngDoCheck","ngAfterContentInit","ngAfterContentChecked","ngAfterViewInit","ngAfterViewChecked","ngOnDestroy"];function et(e){var t=e.ngZoneName,n=e.exceptLastPromise,r=void 0===n||n,i=e.excludeMethods,a=void 0===i?[]:i,o=e.patchSetters,s=void 0===o||o;return function(e){function n(n,i){var a=this;if(!this[t])throw new V("RunOutsideAngular decorator requires that "+e.name+" inject NgZone as "+t);var o=this[t].runOutsideAngular((function(){return n.apply(a,i)}));return r&&(null==o?void 0:o.then)?Promise.resolve(o):o}return a=N(a,ze),Object.getOwnPropertyNames(e.prototype).filter((function(e){return!a.includes(e)})).forEach((function(t){if(s&&Object.getOwnPropertyDescriptor(e.prototype,t).set){var r=Object.getOwnPropertyDescriptor(e.prototype,t).set;Object.defineProperty(e.prototype,t,{set:function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.apply(this,[r,e])}})}if("function"==typeof e.prototype[t]){var i=e.prototype[t];e.prototype[t]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return n.apply(this,[i,e])}}})),e}}var tt={hasKeys:!0};function nt(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o=this;return T(this,(function(s){switch(s.label){case 0:return r=(n=Object).assign,i=[Object.assign({},e)],a={},[4,Promise.all(e.edges.map((function(e){return A(o,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return r=(n=Object).assign,i=[Object.assign({},e)],a={},[4,t(e.node)];case 1:return[2,r.apply(n,i.concat([(a.node=o.sent(),a)]))]}}))}))})))];case 1:return[2,r.apply(n,i.concat([(a.edges=s.sent(),a)]))]}}))}))}e.CommonProcessorsService=function(){function e(e,t){this.ngZone=e,this.keyGraph=t}return e.prototype.series=function(e){var t=this;return function(n){var r=n.field,i=n.context,a=n.options;return A(t,void 0,void 0,(function(){var t,n,o,s,u;return T(this,(function(c){switch(c.label){case 0:c.trys.push([0,5,6,7]),t=O(e),n=t.next(),c.label=1;case 1:return n.done?[3,4]:[4,(0,n.value)({field:r,context:i,options:a})];case 2:r=c.sent(),c.label=3;case 3:return n=t.next(),[3,1];case 4:return[3,7];case 5:return o=c.sent(),s={error:o},[3,7];case 6:try{n&&!n.done&&(u=t.return)&&u.call(t)}finally{if(s)throw s.error}return[7];case 7:return[2,r]}}))}))}},e.prototype.makeJsonParseProcessor=function(e){var t=void 0===e?{}:e,n=t.plainFieldName,r=t.jsonFieldSuffix,i=n+(void 0===r?"Json":r);return function(e){var t,r=e.field;if(null==r[n]||i in r)return r;try{return Object.assign(Object.assign({},r),((t={})[i]=JSON.parse(r[n]),t))}catch(e){return r}}},e.prototype.makeDecryptionProcessor=function(e){var t=this,n=void 0===e?{}:e,r=n.cipherFieldName,i=n.clearFieldSuffix,a=void 0===i?"ClearJson":i,o=n.getKeyId,s=void 0===o?null:o,u=r+a;return function(e){return A(t,void 0,void 0,(function(){var t,n,i,a,o,c;return T(this,(function(p){switch(p.label){case 0:return n=e.field,i=e.context,e.options.hasKeys?!(a=n[r])||u in n?[2,n]:s?[4,s(e)]:[3,2]:[2,n];case 1:return c=p.sent(),[3,3];case 2:c=n.keyId||(null===(t=n.key)||void 0===t?void 0:t.id),p.label=3;case 3:if(!(o=c))throw new V("Query response does not contain "+(s?"key-id":"keyId or key.id")+" field: "+i.path.join("."));return[2,this.keyGraph.decryptFromString(o,a).then((function(e){var t;return Object.assign(Object.assign({},n),((t={})[u]=e,t))}))]}}))}))}},e}(),e.CommonProcessorsService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.CommonProcessorsService(t.ɵɵinject(t.NgZone),t.ɵɵinject(Pe))},token:e.CommonProcessorsService,providedIn:"root"}),e.CommonProcessorsService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.CommonProcessorsService.ctorParameters=function(){return[{type:t.NgZone},{type:Pe}]},e.CommonProcessorsService=M([et({ngZoneName:"ngZone"})],e.CommonProcessorsService);var rt=function(){function e(e,t){this.ngZone=e,this.keyGraph=t}return e.prototype.processTpPasswordResetUser=function(e){var t;return A(this,void 0,void 0,(function(){var n,r,i,a,o=this;return T(this,(function(s){switch(s.label){case 0:return(r=null===(t=e.pxk)||void 0===t?void 0:t.id)?[4,this.keyGraph.getKey(e.pxk.id)]:[3,2];case 1:r=s.sent(),s.label=2;case 2:return n=r,i=Object.assign({},e),n&&e.approvals?(a=i,[4,Promise.all(e.approvals.map((function(e){return o.processTpPasswordResetUserApprovalNode(e,n)})))]):[3,4];case 3:a.approvals=s.sent(),s.label=4;case 4:return[2,i]}}))}))},e.prototype.processTpPasswordResetUserApprovalNode=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return n=Object.assign({},e),e.receiverCipher&&(n.receiverCipherClearJson=this.keyGraph.decryptFromString(t,e.receiverCipher)),e.receiverCipherPartialAssemblyKey?(r=n,[4,this.keyGraph.decryptFromString(t,e.receiverCipherPartialAssemblyKey)]):[3,2];case 1:r.receiverCipherPartialAssemblyKeyClearJson=i.sent(),i.label=2;case 2:return[2,n]}}))}))},e.prototype.makeTpPasswordResetNodeProcessor=function(){var e=this;return function(t){var n=t.field;return A(e,void 0,void 0,(function(){var e,t;return T(this,(function(r){switch(r.label){case 0:if(e=Object.assign({},n),!n.assembly)return[3,2];if(null==n.applied)throw new W('If you request for field "assembly" in the TpPasswordResetNode, then you must also request the "applied" field');return t=e,[4,this.processTpAssemblyNode(n.assembly,n.applied)];case 1:t.assembly=r.sent(),r.label=2;case 2:return[2,e]}}))}))}},e.prototype.processTpAssemblyNode=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l=this;return T(this,(function(h){switch(h.label){case 0:return n=e.subjectKey,r=e.assemblyKey,i=e.assemblyCipherData,a=e.subAssemblies,u=(s=Object).assign,c=[Object.assign({},e)],p={},[4,nt(a,(function(e){return l.processTpSubAssemblyNode(e,n.id,t)}))];case 1:return o=u.apply(s,c.concat([(p.subAssemblies=h.sent(),p)])),t?[3,3]:i?(d=o,[4,this.keyGraph.decryptFromString(r.id,i)]):[3,3];case 2:d.assemblyCipherDataClearJson=h.sent(),h.label=3;case 3:return[2,o]}}))}))},e.prototype.processTpSubAssemblyNode=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d=this;return T(this,(function(l){switch(l.label){case 0:return r=e.subjectCipherData,i=e.approvers,s=(o=Object).assign,u=[Object.assign({},e)],c={},[4,nt(i,(function(e){return d.processTpAssemblyApproverNode(e,n)}))];case 1:return a=s.apply(o,u.concat([(c.approvers=l.sent(),c)])),n?[3,3]:r?(p=a,[4,this.keyGraph.decryptFromString(t,r)]):[3,3];case 2:p.subjectCipherDataClearJson=l.sent(),l.label=3;case 3:return[2,a]}}))}))},e.prototype.processTpAssemblyApproverNode=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,e]}))}))},e}();function it(e,t){return Object.assign(Object.assign({},e),{path:N(e.path,[t])})}rt.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new rt(t.ɵɵinject(t.NgZone),t.ɵɵinject(Pe))},token:rt,providedIn:"root"}),rt.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],rt.ctorParameters=function(){return[{type:t.NgZone},{type:Pe}]},rt=M([et({ngZoneName:"ngZone"})],rt),e.QueryProcessorService=function(){function e(e,t,n,r){this.ngZone=e,this.keyService=t,this.common=n,this.tpprProcessor=r,this.TYPENAME="__typename",this.processors={},this.registerProcessor("DirectoryNode",n.series([n.makeJsonParseProcessor({plainFieldName:"plainMeta"}),n.makeDecryptionProcessor({cipherFieldName:"cipherMeta"})])),this.registerProcessor("FileStateNode",n.series([n.makeJsonParseProcessor({plainFieldName:"plainMeta"}),n.makeDecryptionProcessor({cipherFieldName:"cipherMeta"})])),this.registerProcessor("ContactCardNode",n.makeDecryptionProcessor({cipherFieldName:"cipherData"})),this.registerProcessor("SharedContactCardNode",n.series([n.makeJsonParseProcessor({plainFieldName:"ownerPlainData"}),n.makeDecryptionProcessor({cipherFieldName:"ownerCipherData",getKeyId:function(e){return e.field.ownerKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"receiverCipherData",getKeyId:function(e){return e.field.receiverKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("TpPasswordResetNode",this.tpprProcessor.makeTpPasswordResetNodeProcessor()),this.registerProcessor("SharedTpClaimApproverNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherApprovalData",getKeyId:function(e){return e.field.sharedKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"sharedCipherPartialAssemblyKey",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("TpAssemblyAsApproverNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("ScenarioNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"subjectCipherData",getKeyId:function(e){return e.field.subjectKey.id}})])),this.registerProcessor("ScenarioReceiverNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("ScenarioReceiverDirectoryNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("ScenarioApproverAssemblyNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"assemblyCipherData",getKeyId:function(e){return e.field.assemblyKey.id}})])),this.registerProcessor("ScenarioApproverSubAssemblyNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"subjectCipherData",getKeyId:function(e){return e.field.subjectKey.id}})])),this.registerProcessor("ScenarioApproverNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"sharedCipherApprovalData",getKeyId:function(e){return e.field.sharedKey.id}}),n.makeDecryptionProcessor({cipherFieldName:"sharedCipherPartialAssemblyKey",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("ScenarioClaimantNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"sharedCipherData",getKeyId:function(e){return e.field.sharedKey.id}})])),this.registerProcessor("TpAssemblyNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"subjectCipherData",getKeyId:function(e){return e.field.subjectKey.id}})])),this.registerProcessor("TpSubAssemblyNode",n.series([n.makeDecryptionProcessor({cipherFieldName:"subjectCipherData",getKeyId:function(e){return e.field.subjectKey.id}})])),this.registerProcessor("NotificationNode",n.series([n.makeJsonParseProcessor({plainFieldName:"plainMeta"}),n.makeJsonParseProcessor({plainFieldName:"plainData"})])),this.registerProcessor("UserNode",n.series([n.makeJsonParseProcessor({plainFieldName:"config"})])),this.registerProcessor("ReminderNode",n.series([n.makeJsonParseProcessor({plainFieldName:"plain"})]))}return e.prototype.processQuery=function(e,t){return A(this,void 0,void 0,(function(){var n=this;return T(this,(function(r){return t=Object.assign(Object.assign({},tt),t),[2,se(e,(function(e,r){return n.processField({field:e,context:{path:[r],processChildren:!0},options:t})}))]}))}))},e.prototype.processField=function(e){var t=e.field,n=e.context,r=e.options;return A(this,void 0,void 0,(function(){var e,i,a,o=this;return T(this,(function(s){if(null==t?void 0:t.then)throw new V("processField() should not receive thenable.");return null==t?[2,null]:(e={field:t,context:Object.assign(Object.assign({},n),{processChildren:!0}),options:r},t[this.TYPENAME]?((i=this.processors[t[this.TYPENAME]])&&(t=i(e)),a=function(e){return n.processChildren&&null!==e&&"object"==typeof e?se(e,(function(e,t){return o.processField({field:e,context:it(n,t),options:r})})):e},t=t.then?t.then((function(e){return a(e)})):a(t)):n.processChildren&&Array.isArray(t)&&(t=ae(t.map((function(e,t){return o.processField({field:e,context:it(n,t.toString()),options:r})})))),[2,t])}))}))},e.prototype.registerProcessor=function(e,t){if(this.processors[e])throw new V("Processor for field "+e+" already exists.");this.processors[e]=t},e}(),e.QueryProcessorService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.QueryProcessorService(t.ɵɵinject(t.NgZone),t.ɵɵinject(Ke),t.ɵɵinject(e.CommonProcessorsService),t.ɵɵinject(rt))},token:e.QueryProcessorService,providedIn:"root"}),e.QueryProcessorService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.QueryProcessorService.ctorParameters=function(){return[{type:t.NgZone},{type:Ke},{type:e.CommonProcessorsService},{type:rt}]},e.QueryProcessorService=M([et({ngZoneName:"ngZone"})],e.QueryProcessorService);var at,ot,st,ut=function(){function e(){var e=this;this._fulfilled=!1,this.promise=new Promise((function(t,n){e._resolve=t,e._reject=n})).finally((function(){e._fulfilled=!0}))}return Object.defineProperty(e.prototype,"resolve",{get:function(){return this._resolve},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"reject",{get:function(){return this._reject},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"fulfilled",{get:function(){return this._fulfilled},enumerable:!1,configurable:!0}),e}(),ct=Re(K.default(at||(at=F(["\n query {\n ...FragmentName\n }\n"],["\n query {\n ...FragmentName\n }\n"])))).selectionSet.selections[0],pt=function(){function e(){this._executed=!1,this.deferredPromise=new ut}return Object.defineProperty(e.prototype,"promise",{get:function(){return this.deferredPromise.promise},enumerable:!1,configurable:!0}),e.prototype.resolve=function(e){this.deferredPromise.resolve(e)},e.prototype.reject=function(e){this.deferredPromise.reject(e)},Object.defineProperty(e.prototype,"lrMutationData",{get:function(){return{mutation:this.mutation,variables:this.variables}},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"executed",{get:function(){return this._executed},enumerable:!1,configurable:!0}),e.prototype.setExecuted=function(){if(this._executed)throw new Z("Already executed");this._executed=!0},e}(),dt=function(e){function t(t){var n=e.call(this)||this;return n.mutation=t.mutation,n.variables=t.variables,n}return R(t,e),t.prototype.select=function(e){var n=i.cloneDeep(this.mutation),r=Ee(n),a={};Me(e).forEach((function(e){a[e.name.value]=e}));return r.selectionSet.selections.forEach((function(e){"Field"===e.kind&&function(e){var t=e,n=Te(t);a[n]&&(t.selectionSet.selections=[Object.assign(Object.assign({},ct),{name:Ae(n)})])}(e)})),new t({mutation:Object.assign(Object.assign({},n),{definitions:N(n.definitions.filter((function(e){return"FragmentDefinition"!==e.kind})),e.definitions)}),variables:this.variables})},t}(pt),lt={kind:"Document",definitions:[{kind:"OperationDefinition",operation:"mutation",name:{kind:"Name",value:"lrMergedMutation"},variableDefinitions:[],directives:[],selectionSet:{kind:"SelectionSet",selections:[]}}]},ht=function(e){function t(t){var n=e.call(this)||this;n.lrMutations=t;var r=n.merge(),i=r.mutation,a=r.variables,o=r.prefixes;return n.mutation=i,n.variables=a,n.prefixes=o,n.descendants=n.getDescendants(),n}return R(t,e),t.create=function(e){return new t(e)},t.prototype.getDescendants=function(){var e=new Set,n=function(t){if(e.has(t))throw new V("Classes that are derived from LrMutationBase can not be used more than once in a merged mutation.");e.add(t)};return this.lrMutations.forEach((function(e){if(e instanceof dt)n(e);else{if(!(e instanceof t))throw new ie("LrMergeMutation can not handle class: "+e.constructor.name);e.descendants.forEach((function(e){return n(e)}))}})),e},t.prototype.resolve=function(t){for(var n=this,r=0;r<this.lrMutations.length;++r){var i=this.prefixes[r],a={};for(var o in t){if(o.startsWith(i))a[o.slice(i.length)]=t[o]}this.lrMutations[r].resolve(a)}Promise.all(this.lrMutations.map((function(e){return e.promise}))).then((function(t){e.prototype.resolve.call(n,t)}))},t.prototype.reject=function(t){e.prototype.reject.call(this,t),this.lrMutations.forEach((function(e){return e.reject(t)}))},t.prototype.setExecuted=function(){e.prototype.setExecuted.call(this),this.lrMutations.forEach((function(e){return e.setExecuted()}))},t.prototype.renameVariableDefinition=function(e,t){return Object.assign(Object.assign({},e),{variable:Object.assign(Object.assign({},e.variable),{name:Ae(t+e.variable.name.value)})})},t.prototype.renameVariableDefinitions=function(e,t){var n=this;return e.map((function(e){return n.renameVariableDefinition(e,t)}))},t.prototype.renameArgument=function(e,t){return"Variable"!==e.value.kind?e:Object.assign(Object.assign({},e),{value:Object.assign(Object.assign({},e.value),{name:Ae(t+e.value.name.value)})})},t.prototype.renameField=function(e,t){var n=this;if("Field"!==e.kind)return e;var r=t+Te(e),i=e.arguments.map((function(e){return n.renameArgument(e,t)}));return Object.assign(Object.assign({},e),{alias:{kind:"Name",value:r},arguments:i})},t.prototype.renameFragmentSpread=function(e,t){return Object.assign(Object.assign({},e),{name:Ae(t+e.name.value)})},t.prototype.processSelection=function(e,t){switch(e.kind){case"FragmentSpread":return this.renameFragmentSpread(e,t);case"Field":return e.selectionSet?Object.assign(Object.assign({},e),{selectionSet:this.processSelectionSet(e.selectionSet,t)}):e;default:return e}},t.prototype.processSelectionSet=function(e,t){var n=this;return Object.assign(Object.assign({},e),{selections:e.selections.map((function(e){return n.processSelection(e,t)}))})},t.prototype.renameSelections=function(e,t){var n=this;return e.map((function(e){switch(e.kind){case"Field":return n.processSelection(n.renameField(e,t),t);default:return e}}))},t.prototype.renameFragmentDefinition=function(e,t){var n=Object.assign(Object.assign({},e),{name:Ae(t+e.name.value)});return e.selectionSet&&(n.selectionSet=this.processSelectionSet(e.selectionSet,t)),n},t.prototype.renameFragmentDefinitions=function(e,t){var n=this;return e.map((function(e){return n.renameFragmentDefinition(e,t)}))},t.prototype.merge=function(){var e=this,t=[],n=[],r={},a=[],o=[];this.lrMutations.forEach((function(i,s){var u,c;if(!(i instanceof pt))throw new V("An mutation in the array is not of type LrMutationBase.");var p=i.lrMutationData,d=p.mutation,l=p.variables,h=Ee(d),y="item"+s+"_";h.name&&(y+=h.name.value+"_"),o.push(y),t=N(t,e.renameVariableDefinitions(h.variableDefinitions,y)),n=N(n,e.renameSelections(h.selectionSet.selections,y));try{for(var f=O(Object.keys(l)),v=f.next();!v.done;v=f.next()){var m=v.value;r[y+m]=l[m]}}catch(e){u={error:e}}finally{try{v&&!v.done&&(c=f.return)&&c.call(f)}finally{if(u)throw u.error}}var g=Me(d);a=N(a,e.renameFragmentDefinitions(g,y))}));var s=i.cloneDeep(lt),u=Ee(s);return u.selectionSet.selections=n,u.variableDefinitions=t,s.definitions=N(s.definitions,a),{mutation:s,variables:r,prefixes:o}},t}(pt),yt=Re(K.default(ot||(ot=F(["\nquery {\n ","\n}\n"],["\nquery {\n ","\n}\n"])),Ge)).selectionSet.selections[0],ft=Re(K.default(st||(st=F(["\nquery {\n ","\n}\n"],["\nquery {\n ","\n}\n"])),Qe)).selectionSet.selections[0];e.ɵg=function(){function e(e,t,n,r){this.ngZone=e,this.apollo=t,this.keyGraph=n,this.queryProcessor=r,this.stats={queryCount:0,mutationCount:0}}return e.prototype.query=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return e=i.cloneDeep(e),this.isIncludeKeyGraph(e.includeKeyGraph)&&((t=Re(e.query)).selectionSet.selections=N(t.selectionSet.selections,[yt])),e.name&&((t=Re(e.query)).name={kind:"Name",value:e.name}),[4,this.apollo.query(e).toPromise()];case 1:return n=r.sent(),this.stats.queryCount++,U(n.errors),this.addKeys(n),[4,this.queryProcessor.processQuery(n.data,e.processorOptions)];case 2:return[2,r.sent()]}}))}))},e.prototype.lrMutateImpl=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){if(null==t?void 0:t.variables)throw new ie('Unsupported field: "options.variables"');if(e.executed)throw new Z("LrMutation has already executed. LrMutation can only be used once in a lrMutate() call. Create new instances of LrMutation.");return e.setExecuted(),[2,this.apolloMutate(Object.assign(Object.assign({},t),e.lrMutationData)).then((function(t){return e.resolve(t),t})).catch((function(t){throw e.reject(t),t}))]}))}))},e.prototype.apolloMutate=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return e=Object.assign(Object.assign({},e),{mutation:i.cloneDeep(e.mutation)}),this.isIncludeKeyGraph(e.includeKeyGraph)&&((t=Ee(e.mutation)).selectionSet.selections=N(t.selectionSet.selections,[ft])),e.name&&((t=Ee(e.mutation)).name={kind:"Name",value:e.name}),e.mutation=K.default(h.print(e.mutation)),[4,this.apollo.mutate(e).toPromise()];case 1:return n=r.sent(),this.stats.mutationCount++,U(n.errors),this.addKeys(n),[4,this.queryProcessor.processQuery(n.data,e.processorOptions)];case 2:return[2,r.sent()]}}))}))},e.prototype.statsSnapshot=function(){return i.cloneDeep(this.stats)},e.prototype.addKeys=function(e){e.data.keyGraph&&(this.keyGraph.addKeys(e.data.keyGraph),delete e.data.keyGraph)},e.prototype.isIncludeKeyGraph=function(e){return null==e},e.prototype.lrMutate=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return e instanceof Array?(i=(r=ht).create,[4,Promise.all(e)]):[3,3];case 1:return n=i.apply(r,[o.sent()]),[4,this.lrMutateImpl(n,t)];case 2:return o.sent(),[2,n.promise];case 3:return[4,e];case 4:return a=o.sent(),[4,this.lrMutateImpl(a,t)];case 5:return o.sent(),[2,a.promise]}}))}))},e}(),e.ɵg.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ɵg(t.ɵɵinject(t.NgZone),t.ɵɵinject(n.Apollo),t.ɵɵinject(Pe),t.ɵɵinject(e.QueryProcessorService))},token:e.ɵg,providedIn:"root"}),e.ɵg.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵg.ctorParameters=function(){return[{type:t.NgZone},{type:n.Apollo},{type:Pe},{type:e.QueryProcessorService}]},e.ɵg=M([et({ngZoneName:"ngZone"})],e.ɵg);var vt,mt,gt,St,Ct,It,bt,wt,Kt,Pt,kt,Dt,Rt,Et,Mt,At,Tt,Ot,jt,Nt,Ft=function(){function t(t){this.lrGraphQL=t.get(e.ɵg)}return t.prototype.mutate=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.lrGraphQL.lrMutate(e,t)]}))}))},t.prototype.query=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.lrGraphQL.query(e)]}))}))},t}();function $t(e){return e.edges.map((function(e){return e.node}))}(e.UserDeleteState||(e.UserDeleteState={})).REQUESTED="REQUESTED",(vt=e.PlanState||(e.PlanState={})).ENABLED="ENABLED",vt.DISABLED="DISABLED",(mt=e.TpShareTypeChoice||(e.TpShareTypeChoice={})).TP="TP",mt.DETACHED="DETACHED",(gt=e.TpDetachedShareStateChoice||(e.TpDetachedShareStateChoice={})).IN_PROGRESS="IN_PROGRESS",gt.COMPLETED="COMPLETED",(St=e.AccessRoleChoice||(e.AccessRoleChoice={})).READER="READER",St.WRITER="WRITER",St.ADMIN="ADMIN",St.CUSTODIAN="CUSTODIAN",St.DENY="DENY",St.OWNER="OWNER",(Ct=e.AccessRoleChoiceOrder||(e.AccessRoleChoiceOrder={}))[Ct.READER=0]="READER",Ct[Ct.WRITER=1]="WRITER",Ct[Ct.ADMIN=2]="ADMIN",Ct[Ct.CUSTODIAN=3]="CUSTODIAN",Ct[Ct.DENY=4]="DENY",Ct[Ct.CONFIDENTIAL=5]="CONFIDENTIAL",Ct[Ct.OWNER=6]="OWNER",(It=e.AccessRoleMethodChoice||(e.AccessRoleMethodChoice={})).INHERITED="INHERITED",It.DIRECT="DIRECT",(bt=e.PermissionChoice||(e.PermissionChoice={})).CREATE="CREATE",bt.READ="READ",bt.UPDATE="UPDATE",bt.DELETE="DELETE",bt.SHARE="SHARE",bt.ARCHIVE="ARCHIVE",bt.ACCESS_ARCHIVED="ACCESS_ARCHIVED",bt.UNARCHIVE="UNARCHIVE",bt.SET_CONFIDENTIAL="SET_CONFIDENTIAL",(wt=e.FileOperationField||(e.FileOperationField={})).CREATE="CREATE",wt.READ="READ",wt.UPDATE="UPDATE",wt.REVERT="REVERT",wt.DELETE="DELETE",(Kt=e.KeyExchangeOtkState||(e.KeyExchangeOtkState={})).OTK_INITIATED="OTK_INITIATED",Kt.OTK_ACCEPTED="OTK_ACCEPTED",Kt.OTK_COMPLETED="OTK_COMPLETED",(Pt=e.KeyExchangeState||(e.KeyExchangeState={})).IN_PROGRESS="IN_PROGRESS",Pt.COMPLETED="COMPLETED",Pt.DECLINED="DECLINED",Pt.CANCELLED="CANCELLED",Pt.DELETED="DELETED",(e.KeyExchangeMode||(e.KeyExchangeMode={})).OTK="OTK",(kt=e.TpAssemblyState||(e.TpAssemblyState={})).DISABLED="DISABLED",kt.ENABLED="ENABLED",kt.CLAIMED="CLAIMED",kt.APPROVED="APPROVED",kt.REJECTED="REJECTED",kt.EXPIRED="EXPIRED",kt.CANCELLED="CANCELLED",kt.RESET="RESET",(Dt=e.TpClaimState||(e.TpClaimState={})).CLAIMED="CLAIMED",Dt.APPROVED="APPROVED",Dt.REJECTED="REJECTED",Dt.EXPIRED="EXPIRED",Dt.CANCELLED="CANCELLED",Dt.RESET="RESET",(Rt=e.TpClaimApproverState||(e.TpClaimApproverState={})).CLAIMED="CLAIMED",Rt.APPROVED="APPROVED",Rt.REJECTED="REJECTED",(Et=e.LockState||(e.LockState={})).UNLOCKED="UNLOCKED",Et.MUTEX_LOCKED="MUTEX_LOCKED",(Mt=e.ScenarioState||(e.ScenarioState={})).DISABLED="DISABLED",Mt.ENABLED="ENABLED",Mt.CLAIMED="CLAIMED",Mt.APPROVED="APPROVED",(At=e.ClaimState||(e.ClaimState={})).CLAIMED="CLAIMED",At.EXPIRED="EXPIRED",At.APPROVED="APPROVED",At.REJECTED="REJECTED",At.CANCELLED="CANCELLED",At.RESET="RESET",(Tt=e.ClaimApproverState||(e.ClaimApproverState={})).CLAIMED="CLAIMED",Tt.APPROVED="APPROVED",Tt.REJECTED="REJECTED",(Ot=e.ScenarioLastClaimState||(e.ScenarioLastClaimState={})).CLAIMED="CLAIMED",Ot.APPROVED="APPROVED",Ot.REJECTED="REJECTED",Ot.EXPIRED="EXPIRED",Ot.CANCELLED="CANCELLED",Ot.RESET="RESET",(jt=e.LinkTypeField||(e.LinkTypeField={})).HARD="HARD",jt.SOFT="SOFT",(Nt=e.PlanStateField||(e.PlanStateField={})).TRIALLING="TRIALLING",Nt.ACTIVE="ACTIVE",Nt.CANCELLED="CANCELLED",Nt.EXPIRED="EXPIRED";var _t,Lt=function(e){var t=window.fetch;return function(n,r){var i=function(){return t(n,r)};if(!r||!r.headers||!r.headers["X-Amz-Target"])return i();var a=r.headers["X-Amz-Target"].split(".");if(a.length<2||"AWSCognitoIdentityProviderService"!==a[0])return i();var o=JSON.parse(r.body);if(o&&o.ClientMetadata&&"true"===o.ClientMetadata.noProxy)return i();var s=!1;if("RespondToAuthChallenge"===a[1]){if(o&&"NEW_PASSWORD_REQUIRED"===o.ChallengeName)return i();s=!0}else"InitiateAuth"===a[1]&&"REFRESH_TOKEN_AUTH"===o.AuthFlow&&(s=!0);return s?t(e+"auth/proxy/",Object.assign(Object.assign({},r),{credentials:"include"})):i()}},Ut=function(e,t){var n=e.authUrl,r=e.userPoolId,i=e.userPoolWebClientId;return function(){var e=r.split("_");if(e.length<2)throw new Error("userPoolId should have this format: {aws-region}_xxxxx");window.fetch=Lt(n),t.configure({region:e[0],userPoolId:r,userPoolWebClientId:i,mandatorySignIn:!1})}};(_t=e.Config||(e.Config={}))[_t.TIMEOUT=.01]="TIMEOUT",_t[_t.IDLE=1200]="IDLE",_t[_t.KEEP_ALIVE_INTERVAL=60]="KEEP_ALIVE_INTERVAL";var xt=function(){function t(e,t,n,r,i,a){this.config=e,this.http=t,this.idle=n,this.keepalive=r,this.keyService=i,this.auth=a,this.IDLE_EXPIRY_KEY="ng2Idle.main.expiry",this.IDLING_KEY="ng2Idle.main.idling",this.initCalled=!1}return t.prototype.assertInit=function(){if(!this.initCalled)throw new Z("Call IdleService.init() first.")},t.prototype.init=function(t){return A(this,void 0,void 0,(function(){var n,r=this;return T(this,(function(i){switch(i.label){case 0:if(this.initCalled)throw new Z("IdleService.init() can only be called once. IdleService.start() calls init() with default values if init() has not been called yet.");if(this.initCalled=!0,(t=Object.assign({onTimeout:null,onKeepalive:null,idleSec:e.Config.IDLE,timeoutSec:e.Config.TIMEOUT,keepAliveIntervalSec:e.Config.KEEP_ALIVE_INTERVAL},t)).timeoutSec<.01)throw new Q("Minimum value for IdleService.init({ timeoutSec }) is 0.01");return this.onTimeout=t.onTimeout,this.onKeepalive=t.onKeepalive,this.idle.setIdle(t.idleSec),this.idle.setTimeout(t.timeoutSec),this.idle.setInterrupts(v.DEFAULT_INTERRUPTSOURCES),this.idle.onIdleEnd.subscribe((function(){return console.log("Idle stopped")})),this.idle.onIdleStart.subscribe((function(){return console.log("Idle started")})),this.idle.onTimeout.subscribe((function(){return A(r,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return console.log("Idle timed out"),this.reset(),[4,Promise.resolve(this.onTimeout&&this.onTimeout({onInit:!1}))];case 1:return e.sent(),[2]}}))}))})),this.idle.onTimeoutWarning.subscribe((function(e){return console.log("Will timeout in "+e+" seconds!")})),this.keepalive.interval(t.keepAliveIntervalSec),console.log("Keep alive interval set at: "+e.Config.KEEP_ALIVE_INTERVAL+" seconds"),this.keepalive.onPing.subscribe((function(){return r.onPing()})),(n=localStorage.getItem(this.IDLE_EXPIRY_KEY))&&parseInt(n,10)+1e3*this.idle.getTimeout()<Date.now()?(this.reset(),[4,Promise.resolve(this.onTimeout&&this.onTimeout({onInit:!0}))]):[3,2];case 1:i.sent(),i.label=2;case 2:return[2]}}))}))},t.prototype.keepalivePost=function(){return A(this,void 0,void 0,(function(){var e,t,n;return T(this,(function(r){switch(r.label){case 0:return t=(e=this.http).post,n=[this.config.authUrl+"auth/keepalive/",null],[4,Ie(this.auth,this.config)];case 1:return[4,t.apply(e,n.concat([r.sent()])).toPromise()];case 2:return[2,{keepaliveResult:r.sent(),expiresAfterSeconds:this.idle.getIdle()+this.idle.getTimeout()+this.keepalive.interval()}]}}))}))},t.prototype.persistMasterKey=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.keepalivePost()];case 1:return t=n.sent().expiresAfterSeconds,[4,this.keyService.persistMasterKey(e,t)];case 2:return n.sent(),[2]}}))}))},t.prototype.onPing=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return console.log("Keep alive triggered at time: "+Date.now()+". Interval set at: "+this.keepalive.interval()+" seconds"),[4,this.keepalivePost()];case 1:return e=t.sent().expiresAfterSeconds,[4,this.keyService.setMasterKeyExpiresAfterSeconds(e)];case 2:return t.sent(),[4,Promise.resolve(this.onKeepalive&&this.onKeepalive())];case 3:return t.sent(),[2]}}))}))},t.prototype.start=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return this.initCalled?[3,2]:[4,this.init()];case 1:e.sent(),e.label=2;case 2:return this.idle.isRunning()?[2]:[4,this.onPing()];case 3:return e.sent(),this.idle.watch(),[2]}}))}))},t.prototype.stop=function(){this.idle.stop(),this.reset()},t.prototype.reset=function(){localStorage.removeItem(this.IDLE_EXPIRY_KEY),localStorage.removeItem(this.IDLING_KEY)},t}();xt.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new xt(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(v.Idle),t.ɵɵinject(m.Keepalive),t.ɵɵinject(Ke),t.ɵɵinject(o.AuthClass))},token:xt,providedIn:"root"}),xt.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],xt.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:v.Idle},{type:m.Keepalive},{type:Ke},{type:o.AuthClass}]};var qt,Jt,Gt,Qt,Vt,Wt,Bt,Zt="\nid\npublicData\npublicSearchable\ncipherData\nkey {\n id\n}\n",Ht=(K.default(qt||(qt=F(["\nquery ContactCardQuery(\n$id: LrRelayIdInput!\n) {\ncontactCard (\n id: $id\n) {\n ","\n}\n","\n}"],["\nquery ContactCardQuery(\n$id: LrRelayIdInput!\n) {\ncontactCard (\n id: $id\n) {\n ","\n}\n","\n}"])),Zt,Ge),K.default(Jt||(Jt=F(['\nquery SearchContactCardQuery(\n $publicSearchable: LrJSONFilter!\n) {\n searchContactCards(\n publicSearchable: $publicSearchable\n orderBy: "created"\n ) {\n edges {\n node {\n ',"\n }\n }\n }\n ","\n}"],['\nquery SearchContactCardQuery(\n $publicSearchable: LrJSONFilter!\n) {\n searchContactCards(\n publicSearchable: $publicSearchable\n orderBy: "created"\n ) {\n edges {\n node {\n ',"\n }\n }\n }\n ","\n}"])),Zt,Ge),K.default(Gt||(Gt=F(['\nquery ContactCardListQuery {\n contactCards(\n orderBy: "created"\n ) {\n edges {\n node {\n ',"\n }\n }\n }\n ","\n}"],['\nquery ContactCardListQuery {\n contactCards(\n orderBy: "created"\n ) {\n edges {\n node {\n ',"\n }\n }\n }\n ","\n}"])),Zt,Ge)),Yt=(K.default(Qt||(Qt=F(["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n ","\n }\n }\n}"],["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n ","\n }\n }\n}"])),Zt),K.default(Vt||(Vt=F(["\nmutation UpdateContactCardMutation(\n $input: UpdateContactCardInput!\n) {\n updateContactCard(input: $input) {\n contactCard {\n ","\n }\n }\n}"],["\nmutation UpdateContactCardMutation(\n $input: UpdateContactCardInput!\n) {\n updateContactCard(input: $input) {\n contactCard {\n ","\n }\n }\n}"])),Zt),K.default(Wt||(Wt=F(["\n mutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n }\n"],["\n mutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n }\n"])))),Xt=Oe(Bt||(Bt=F(["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"],["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"]))),zt=function(){function e(e,t,n,r,i){this.encryptionService=e,this.keyGraph=t,this.lrApollo=n,this.keyService=r,this.keyFactory=i}return e.prototype.decryptMeta=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return e.cipherMeta?[4,this.keyGraph.getJwkKey(e.keyId)]:[3,3];case 1:return t=n.sent(),[4,this.encryptionService.decrypt(t,JSON.parse(e.cipherMeta))];case 2:return[2,n.sent()];case 3:return[2,null]}}))}))},e.prototype.doubleWrapContent=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d;return T(this,(function(l){switch(l.label){case 0:return[4,this.keyFactory.createKey()];case 1:return r=l.sent(),[4,this.wrapContent(r.toJSON(!0),t)];case 2:return i=l.sent(),a={rootKey:i.rootKey,wrappedKeys:i.wrappedKeys,doubleWrappedKey:i.cipherMeta},e?(u=(s=JSON).stringify,[4,this.encryptionService.encrypt(r,e)]):[3,4];case 3:return o=u.apply(s,[l.sent()]),[3,5];case 4:o=null,l.label=5;case 5:return a.cipherMeta=o,n?(d=(p=JSON).stringify,[4,this.encryptionService.encrypt(r,n)]):[3,7];case 6:return c=d.apply(p,[l.sent()]),[3,8];case 7:c=null,l.label=8;case 8:return[2,(a.cipherFileContent=c,a)]}}))}))},e.prototype.reWrapContent=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return[4,this.keyGraph.getJwkKey(e)];case 1:return n=p.sent(),[4,this.keyFactory.createKey()];case 2:return r=p.sent(),i={},o=(a=JSON).stringify,[4,this.encryptionService.encrypt(n,r.toJSON(!0))];case 3:return i.doubleWrappedKey=o.apply(a,[p.sent()]),t?(c=(u=JSON).stringify,[4,this.encryptionService.encrypt(r,t)]):[3,5];case 4:return s=c.apply(u,[p.sent()]),[3,6];case 5:s=null,p.label=6;case 6:return[2,(i.cipherMeta=s,i)]}}))}))},e.prototype.wrapContent=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l,h=this;return T(this,(function(y){switch(y.label){case 0:return[4,this.keyFactory.createKey()];case 1:return n=y.sent(),t&&t.length?[4,Promise.all(t.map((function(e){return A(h,void 0,void 0,(function(){var t,r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.getDirectoryKeyId(e)];case 1:return t=o.sent(),a=(i=JSON).stringify,[4,this.encryptionService.encrypt(t.key,n.toJSON(!0))];case 2:return r=a.apply(i,[o.sent()]),[2,{directoryId:e,wrappingKeyId:t.keyId,wrappedKey:r}]}}))}))})))]:[3,3];case 2:return r=y.sent(),[3,5];case 3:return a=this.keyService.currentRootKey,u=(s=JSON).stringify,[4,this.encryptionService.encrypt(a.jwk,n.toJSON(!0))];case 4:o=u.apply(s,[y.sent()]),i={wrappingKeyId:a.id,wrappedKey:o},y.label=5;case 5:return c={key:n,rootKey:i,wrappedKeys:r},e?(l=(d=JSON).stringify,[4,this.encryptionService.encrypt(n,e)]):[3,7];case 6:return p=l.apply(d,[y.sent()]),[3,8];case 7:p=null,y.label=8;case 8:return[2,(c.cipherMeta=p,c)]}}))}))},e.prototype.wrapContentWithKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s;return T(this,(function(u){switch(u.label){case 0:return[4,this.keyFactory.createKey()];case 1:return n=u.sent(),[4,this.keyGraph.encryptToString(t,n.toJSON(!0))];case 2:return r=u.sent(),i={key:n,rootKey:{wrappingKeyId:t,wrappedKey:r}},e?(s=(o=JSON).stringify,[4,this.encryptionService.encrypt(n,e)]):[3,4];case 3:return a=s.apply(o,[u.sent()]),[3,5];case 4:a=null,u.label=5;case 5:return[2,(i.cipherMeta=a,i)]}}))}))},e.prototype.getDirectoryKeyId=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.lrApollo.query({query:Xt,variables:{id:e}})];case 1:return t=r.sent().directory,n={keyId:t.keyId},[4,this.keyGraph.getJwkKey(t.keyId)];case 2:return[2,(n.key=r.sent(),n)]}}))}))},e}();zt.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new zt(t.ɵɵinject(ve),t.ɵɵinject(Pe),t.ɵɵinject(ke),t.ɵɵinject(Ke),t.ɵɵinject(ge))},token:zt,providedIn:"root"}),zt.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],zt.ctorParameters=function(){return[{type:ve},{type:Pe},{type:ke},{type:Ke},{type:ge}]};var en,tn,nn,rn,an,on,sn,un,cn,pn="\n id\n token\n state\n mode\n isInitiator\n initiator {\n id\n username\n config\n }\n responder {\n id\n username\n }\n created\n modified\n tokenExpiryTime\n isExpired\n initiatorRootKeyCipher\n initiatorActionRequired\n responderActionRequired\n responderEmailAddress\n otk {\n state\n otKeyParams\n otKeyCipher\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n initiatorSigPxk {\n id\n }\n responderSigPxk {\n id\n }\n initiatorOneTimePbkCipher\n responderPbkCipher\n }\n",dn="\n userSigPrk {\n id\n }\n otherSigPbk {\n id\n }\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n pbk\n }\n mkReshareRequestCipher\n mkReshareResponseCipher\n mkReshareRequestSent\n mkReshareResponseSent\n",ln=Oe(en||(en=F(["\nquery KeyExchangesQuery2($state: String) {\n keyExchanges(state: $state) {\n edges {\n node {\n ","\n }\n }\n }\n}\n"],["\nquery KeyExchangesQuery2($state: String) {\n keyExchanges(state: $state) {\n edges {\n node {\n ","\n }\n }\n }\n}\n"])),pn),hn=Oe(tn||(tn=F(["\nquery KeyExchangeQuery2($id: LrRelayIdInput!) {\n keyExchange(id: $id) {\n ","\n }\n}\n"],["\nquery KeyExchangeQuery2($id: LrRelayIdInput!) {\n keyExchange(id: $id) {\n ","\n }\n}\n"])),pn),yn=Oe(nn||(nn=F(["\nquery KeyExchangeTokenQuery2($id: LrRelayIdInput!, $token: String) {\n keyExchange(id: $id, token: $token) {\n ","\n }\n}\n"],["\nquery KeyExchangeTokenQuery2($id: LrRelayIdInput!, $token: String) {\n keyExchange(id: $id, token: $token) {\n ","\n }\n}\n"])),pn),fn=Oe(rn||(rn=F(["\nmutation CancelKeyExchangeMutation($input: CancelKeyExchangeInput!) {\n cancelKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"],["\nmutation CancelKeyExchangeMutation($input: CancelKeyExchangeInput!) {\n cancelKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"]))),vn=Oe(an||(an=F(["\nmutation DeclineKeyExchangeMutation($input: DeclineKeyExchangeInput!) {\n declineKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"],["\nmutation DeclineKeyExchangeMutation($input: DeclineKeyExchangeInput!) {\n declineKeyExchange(input: $input) {\n keyExchange {\n id\n }\n }\n}\n"]))),mn=Oe(on||(on=F(["\nmutation InitiateKeyExchangeOtkMutation(\n $input: InitiateKeyExchangeOtkInput!\n) {\n initiateKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n }\n}\n"],["\nmutation InitiateKeyExchangeOtkMutation(\n $input: InitiateKeyExchangeOtkInput!\n) {\n initiateKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n }\n}\n"])),pn),gn=Oe(sn||(sn=F(["\nmutation RespondKeyExchangeOtkMutation($input: RespondKeyExchangeOtkInput!) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n userSharedKey {\n ","\n }\n tp {\n id\n user {\n config\n }\n }\n }\n}\n"],["\nmutation RespondKeyExchangeOtkMutation($input: RespondKeyExchangeOtkInput!) {\n respondKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n userSharedKey {\n ","\n }\n tp {\n id\n user {\n config\n }\n }\n }\n}\n"])),pn,dn),Sn=Oe(un||(un=F(["\nmutation CompleteKeyExchangeOtkMutation(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n userSharedKey {\n ","\n }\n tp {\n id\n user {\n config\n }\n }\n }\n}\n"],["\nmutation CompleteKeyExchangeOtkMutation(\n $input: CompleteKeyExchangeOtkInput!\n) {\n completeKeyExchangeOtk(input: $input) {\n keyExchange {\n ","\n }\n userSharedKey {\n ","\n }\n tp {\n id\n user {\n config\n }\n }\n }\n}\n"])),pn,dn),Cn=Oe(cn||(cn=F(["\nquery CurrentUserSharedKeyQuery2(\n $username: String\n $userId: LrRelayIdInput\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ","\n }\n }\n}\n"],["\nquery CurrentUserSharedKeyQuery2(\n $username: String\n $userId: LrRelayIdInput\n) {\n currentUserSharedKey(\n username: $username\n userId: $userId\n ) {\n userSharedKey {\n ","\n }\n }\n}\n"])),dn);(e.FeatureAction||(e.FeatureAction={})).ACCESS="access";var In,bn=function(){},wn=function(){},Kn=function(){},Pn=function(){},kn=function(e){this.name=e.name,this.title=e.title,this.firstName=e.firstName,this.lastName=e.lastName},Dn=function(){},Rn=function(){},En=function(){},Mn=function(){},An=function(){},Tn=function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return R(t,e),t}(An),On=function(){},jn=function(){};(In=e.TrustedPartyType||(e.TrustedPartyType={})).User="user",In.Organisation="organisation";var Nn,Fn=function(){},$n="\n id\n owner {\n id\n username\n }\n ownerKey {\n id\n }\n ownerCipherData\n receiver {\n id\n username\n }\n receiverKey {\n id\n }\n receiverCipherData\n sharedKey {\n id\n }\n sharedCipherData\n sharedCipherDataSig\n sharedCipherDataSigPxk {\n id\n }\n",_n=K.default(Nn||(Nn=F(["\nmutation UpdateOwnedContactCard(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(\n input: $input\n ) {\n ownedContactCard {\n ","\n }\n }\n}"],["\nmutation UpdateOwnedContactCard(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(\n input: $input\n ) {\n ownedContactCard {\n ","\n }\n }\n}"])),$n),Ln=function(){function e(e,t,n,r){this.keyService=e,this.lrApollo=t,this.keyGraph=n,this.encryptionService=r}return e.prototype.decryptSharedTrustedPartyDetails=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.decryptTrustedPartyDetails(e)];case 1:return t=n.sent(),[2,Object.assign({id:e.id,ownedKeyId:e.ownerKey.id,sharedKeyId:e.sharedKey.id},t)]}}))}))},e.prototype.decryptTrustedPartyDetails=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:if(!(e&&e.sharedKey&&e.sharedCipherData))return[3,5];i.label=1;case 1:return i.trys.push([1,4,,5]),n=(t=this.encryptionService).decrypt,[4,this.keyGraph.getJwkKey(e.sharedKey.id)];case 2:return[4,n.apply(t,[i.sent(),e.sharedCipherData])];case 3:return[2,i.sent()];case 4:return r=i.sent(),console.error("Cannot decrypt trusted party details",r),[3,5];case 5:return[2,null]}}))}))},e.prototype.updateMySharedContactCard=function(e,t,n,r){return A(this,void 0,void 0,(function(){var i,a,o,s,u,c,p,d,l,h,y;return T(this,(function(f){switch(f.label){case 0:return[4,this.keyGraph.getKey(t)];case 1:return i=f.sent(),[4,this.keyGraph.getKey(n)];case 2:return a=f.sent(),o=this.keyService.currentSigPxk,[4,this.encryptionService.encrypt(a.jwk,r)];case 3:return s=f.sent(),p=(c=JSON).stringify,[4,this.encryptionService.sign(o.jwk,s)];case 4:return u=p.apply(c,[f.sent()]),d={name:new kn(r.name)},y=(h=JSON).stringify,[4,this.encryptionService.sign(o.jwk,d)];case 5:return l=y.apply(h,[f.sent()]),[4,this.lrApollo.mutate({mutation:_n,variables:{input:{id:e,ownerCipherData:"",ownerKeyId:i.id,sharedCipherDataSig:u,sharedKeyId:a.id,sigPxkId:o.id,ownerPlainDataSig:l}}})];case 6:return f.sent(),[2]}}))}))},e}();Ln.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Ln(t.ɵɵinject(Ke),t.ɵɵinject(ke),t.ɵɵinject(Pe),t.ɵɵinject(ve))},token:Ln,providedIn:"root"}),Ln.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Ln.ctorParameters=function(){return[{type:Ke},{type:ke},{type:Pe},{type:ve}]};var Un,xn,qn,Jn,Gn,Qn="\n id\n user {\n id\n username\n }\n other{\n id\n username,\n features {\n shareVault\n }\n }\n sharedContactCard {\n "+$n+"\n }\n myContactCard {\n "+$n+"\n }\n sharedScenarios {\n edges {\n node {\n id\n }\n }\n }\n theirItems {\n directories {\n edges {\n node {\n id\n }\n }\n }\n }\n currentUserSharedKey {\n userSharedKey {\n keyExchange {\n "+pn+"\n }\n "+dn+"\n }\n }",Vn=K.default(Un||(Un=F(['\n query {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n userDelete {\n id\n created\n state\n }\n features {\n myVault\n tpVault\n shareVault\n }\n sessionEncryptionKey\n dateJoined\n }\n userPlans {\n id\n stripe {\n subscriptionId\n }\n plan {\n name\n data\n state\n }\n periodEnd\n }\n contactCards(orderBy: "created") {\n edges {\n node {\n id\n key {\n id\n }\n cipherData\n plainData\n }\n }\n }\n keyGraph {\n ...KeyGraphFragment\n }\n }\n ',"\n"],['\n query {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n userDelete {\n id\n created\n state\n }\n features {\n myVault\n tpVault\n shareVault\n }\n sessionEncryptionKey\n dateJoined\n }\n userPlans {\n id\n stripe {\n subscriptionId\n }\n plan {\n name\n data\n state\n }\n periodEnd\n }\n contactCards(orderBy: "created") {\n edges {\n node {\n id\n key {\n id\n }\n cipherData\n plainData\n }\n }\n }\n keyGraph {\n ...KeyGraphFragment\n }\n }\n ',"\n"])),Je),Wn=K.default(xn||(xn=F(["\n mutation CreateContactCardMutation($input: CreateContactCardInput!) {\n createContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"],["\n mutation CreateContactCardMutation($input: CreateContactCardInput!) {\n createContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"]))),Bn=K.default(qn||(qn=F(["\n mutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"],["\n mutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n key {\n id\n }\n cipherData\n }\n }\n }\n"]))),Zn=Oe(Jn||(Jn=F(["\nquery TrustedPartiesQuery {\n tps {\n edges {\n node {\n ","\n }\n }\n }\n}"],["\nquery TrustedPartiesQuery {\n tps {\n edges {\n node {\n ","\n }\n }\n }\n}"])),Qn),Hn=Oe(Gn||(Gn=F(['\nquery ContactCardsQuery {\n contactCards(orderBy: "created") {\n edges {\n node {\n id\n cipherData\n key {\n id\n }\n }\n }\n }\n}\n'],['\nquery ContactCardsQuery {\n contactCards(orderBy: "created") {\n edges {\n node {\n id\n cipherData\n key {\n id\n }\n }\n }\n }\n}\n']))),Yn=function(){function e(e,t,n,r,i,a,o){this.config=e,this.http=t,this.lrApollo=n,this.keyService=r,this.keyMetaService=i,this.keyGraph=a,this.encryptionService=o}return e.prototype.getCurrentUser=function(){return A(this,void 0,void 0,(function(){var e,t,n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.lrApollo.query({query:Vn})];case 1:return e=i.sent(),t=e.currentUser,n=e.contactCards,r=n.edges.map((function(e){return e.node}))[0],[2,{currentUser:t,contactCard:r}]}}))}))},e.prototype.decryptContactCard=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return e?[4,this.keyGraph.decryptFromString(e.key.id,e.cipherData)]:[2,null];case 1:return t=n.sent(),[2,Object.assign({id:e.id,keyId:e.key.id},t)]}}))}))},e.prototype.updateDetails=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,e?this.updateContactCard(e,t,n):this.createContactCard(n)];case 1:return r=i.sent(),[2,{fields:n,id:r.id,keyId:r.key.id}]}}))}))},e.prototype.prepareContactCardInput=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d;return T(this,(function(l){switch(l.label){case 0:return t=this.keyService.currentSigPxk,i=(r=JSON).stringify,[4,this.encryptionService.sign(t.jwk,"")];case 1:return n=i.apply(r,[l.sent()]),s=(o=JSON).stringify,[4,this.encryptionService.sign(t.jwk,"")];case 2:return a=s.apply(o,[l.sent()]),u={name:new kn(e.name.value)},d=(p=JSON).stringify,[4,this.encryptionService.sign(t.jwk,u)];case 3:return c=d.apply(p,[l.sent()]),[2,{sigPxkId:t.id,publicDataSig:n,publicSearchableSig:a,plainDataSig:c}]}}))}))},e.prototype.createContactCard=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.prepareContactCardInput(e)];case 1:return t=a.sent(),[4,this.keyMetaService.wrapContent(e)];case 2:return n=a.sent(),r=n.rootKey,i=n.cipherMeta,[4,this.lrApollo.mutate({mutation:Wn,variables:{input:Object.assign(Object.assign({},t),{cipherData:i,wrappingKeyId:r.wrappingKeyId,wrappedKey:r.wrappedKey,default:!0})}})];case 3:return[2,a.sent().createContactCard.contactCard]}}))}))},e.prototype.updateContactCard=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.prepareContactCardInput(n)];case 1:return r=a.sent(),[4,this.keyGraph.encryptToString(t,n)];case 2:return i=a.sent(),[4,this.lrApollo.mutate({mutation:Bn,variables:{input:Object.assign(Object.assign({},r),{id:e,cipherData:i})}})];case 3:return[2,a.sent().updateContactCard.contactCard]}}))}))},e.prototype.decryptContactCardEdges=function(e){return A(this,void 0,void 0,(function(){var t=this;return T(this,(function(n){return[2,Promise.all(e.map((function(e){return A(t,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return t=e.node,[4,this.decryptContactCard(t)];case 1:return[2,n.sent()]}}))}))})))]}))}))},e.prototype.getContactCards=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return[4,this.lrApollo.query({query:Ht})];case 1:return e=t.sent(),[4,this.decryptContactCardEdges(e.contactCards.edges)];case 2:return[2,t.sent()]}}))}))},e.prototype.deleteContactCard=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.lrApollo.mutate({mutation:Yt,variables:{input:{id:e}}})];case 1:return[2,t.sent().deleteContactCard.id]}}))}))},e.prototype.signOut=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.http.post(this.config.authUrl+"auth/sign-out/",null,{withCredentials:!0,responseType:"text"}).toPromise()];case 1:return e.sent(),[2]}}))}))},e}();Yn.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Yn(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(ke),t.ɵɵinject(Ke),t.ɵɵinject(zt),t.ɵɵinject(Pe),t.ɵɵinject(ve))},token:Yn,providedIn:"root"}),Yn.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Yn.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:ke},{type:Ke},{type:zt},{type:Pe},{type:ve}]};var Xn,zn,er,tr=K.default(Xn||(Xn=F(["\n mutation {\n passwordChangeRequest(input: {}) {\n challenge\n }\n }\n"],["\n mutation {\n passwordChangeRequest(input: {}) {\n challenge\n }\n }\n"]))),nr=K.default(zn||(zn=F(["\n mutation PasswordChange($input: PasswordChangeInput!) {\n passwordChange(input: $input) {\n token\n newPassKey {\n id\n }\n }\n }\n"],["\n mutation PasswordChange($input: PasswordChangeInput!) {\n passwordChange(input: $input) {\n token\n newPassKey {\n id\n }\n }\n }\n"]))),rr=K.default(er||(er=F(["\n query PasswordChangeConfigQuery {\n passwordChangeConfig {\n maxAuthAgeSeconds\n authTime\n serverTime\n }\n }\n"],["\n query PasswordChangeConfigQuery {\n passwordChangeConfig {\n maxAuthAgeSeconds\n authTime\n serverTime\n }\n }\n"]))),ir=P,ar=function(){},or=function(){function e(e,t,n,r,i,a,o,s,u){this.config=e,this.http=t,this.apollo=n,this.auth=r,this.profileService=i,this.keyFactory=a,this.encryptionService=o,this.keyGraph=s,this.webCryptoService=u,this.CLIENT_NONCE_LENGTH=32}return e.prototype.checkPassword=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=this.passwordStrength(e).years,n={length:e.length,timeToCrack:ir.duration({years:t})},[4,this.getExposureCount(e)];case 1:return[2,(n.passwordExposed=r.sent(),n)]}}))}))},e.prototype.getExposureCount=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.webCryptoService.stringDigest("SHA-1",e)];case 1:return t=a.sent(),n=t.substring(0,5),[4,this.http.get("https://api.pwnedpasswords.com/range/"+n,{responseType:"text"}).toPromise()];case 2:return r=a.sent(),(i=new RegExp("^(?:"+t.substring(5)+":)(?<count>\\d+)$","im").exec(r))?[2,+i.groups.count]:[2,0]}}))}))},e.prototype.getPassIdpString=function(e){return e.toJSON(!0).k},e.prototype.createPassKeyBundle=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.keyFactory.createPassIdpParams()];case 1:return t=s.sent(),[4,this.keyFactory.derivePassIdp(Object.assign({password:e},t))];case 2:return n=s.sent().jwk,[4,this.keyFactory.createPassKeyParams()];case 3:return r=s.sent(),[4,this.keyFactory.derivePassKey(Object.assign({password:e},r))];case 4:return i=s.sent().jwk,[4,this.keyFactory.createPkcSignKey()];case 5:return a=s.sent(),[4,this.encryptionService.encrypt(i,a.toJSON(!0))];case 6:return o=s.sent(),[2,{passKeyParams:r,passKey:i,passIdpParams:t,passIdp:n,passIdpVerifier:a,wrappedPassIdpVerifierPrk:o}]}}))}))},e.prototype.isLoginRequired=function(){return A(this,void 0,void 0,(function(){var e,t,n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.getChangePasswordConfig()];case 1:return e=i.sent(),t=ir(e.authTime),n=ir(e.serverTime),r=ir.duration(n.diff(t)),r.asSeconds()>e.maxAuthAgeSeconds?[2,!0]:[2,!1]}}))}))},e.prototype.changePassword=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return n=d.sent(),[4,this.profileService.getCurrentUser()];case 2:return r=d.sent().currentUser,[4,this.verifyPassword(e,r)];case 3:return i=d.sent(),a=i.passIdp,o=i.signedChallenge,[4,this.createPassKeyBundle(t)];case 4:return s=d.sent(),[4,this.keyGraph.getKey(r.currentUserKey.masterKey.id)];case 5:return u=d.sent(),[4,this.encryptionService.encrypt(s.passKey,u.jwk.toJSON(!0))];case 6:return c=d.sent(),[4,this.changePasswordMutation(o,r.currentUserKey.masterKey.id,c,s)];case 7:return p=d.sent().token,[4,this.auth.changePassword(n,this.getPassIdpString(a),this.getPassIdpString(s.passIdp))];case 8:return d.sent(),[4,this.changePasswordComplete({useNewPassword:!0,token:p})];case 9:return d.sent(),[2]}}))}))},e.prototype.changePasswordComplete=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return t=e.useNewPassword,n=e.token,i=(r=this.http).post,a=[this.config.authUrl+"users/password-change-complete/",Object.assign({use_new_password:t},n&&{token:n})],[4,Ie(this.auth,this.config)];case 1:return[2,i.apply(r,a.concat([o.sent()])).toPromise()]}}))}))},e.prototype.getVerifierPrK=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return r.trys.push([0,2,,3]),[4,this.encryptionService.decrypt(e,t)];case 1:return n=r.sent(),[2,ge.asKey(n)];case 2:throw r.sent(),new G("Wrong current password");case 3:return[2]}}))}))},e.prototype.verifyPassword=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.apollo.mutate({mutation:tr,variables:{}})];case 1:return n=s.sent(),[4,this.keyFactory.derivePassKey(Object.assign({password:e},t.currentUserKey.passKey.passKeyParams))];case 2:return r=s.sent(),[4,this.getVerifierPrK(r.jwk,t.currentUserKey.passKey.wrappedPassIdpVerifierPrk)];case 3:return i=s.sent(),a=this.keyFactory.randomString(this.CLIENT_NONCE_LENGTH),[4,this.encryptionService.sign(i,{serverNonce:n.passwordChangeRequest.challenge.serverNonce,clientNonce:a})];case 4:return o=s.sent(),[4,this.keyFactory.derivePassIdp(Object.assign({password:e},t.currentUserKey.passKey.passIdpParams))];case 5:return[2,{passIdp:s.sent().jwk,signedChallenge:o}]}}))}))},e.prototype.changePasswordMutation=function(e,t,n,r){return A(this,void 0,void 0,(function(){var i;return T(this,(function(a){switch(a.label){case 0:return[4,this.apollo.mutate({mutation:nr,variables:{input:{signedChallenge:JSON.stringify(e),masterKeyId:t,newWrappedMasterKey:JSON.stringify(n),newPassKey:{passIdpParams:JSON.stringify(r.passIdpParams),passIdpVerifierPbk:JSON.stringify(r.passIdpVerifier.toJSON()),wrappedPassIdpVerifierPrk:JSON.stringify(r.wrappedPassIdpVerifierPrk),passKeyParams:JSON.stringify(r.passKeyParams)}}}})];case 1:return[2,{token:(i=a.sent()).passwordChange.token,newPassKeyId:i.passwordChange.newPassKey.id}]}}))}))},e.prototype.getChangePasswordConfig=function(){return A(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return[4,this.apollo.query({query:rr})];case 1:return e=n.sent(),(t=e.passwordChangeConfig).authTime=new Date(t.authTime),t.serverTime=new Date(t.serverTime),[2,t]}}))}))},e.prototype.passwordStrength=function(e){function t(e,t){return((e||"").match(t)||[]).length}var n=t(e,/[A-Z]/g),r=t(e,/[a-z]/g),i=t(e,/[0-9]/g),a=0;if(n&&(a+=26),r&&(a+=26),i&&(a+=10),e.length-n-r-i&&(a+=30),0===e.length)return{years:0,bits:0};var o=Math.pow(a,e.length);return{years:54e3*o/Math.pow(62,12),bits:Math.round(Math.log2(o))}},e}();or.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new or(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(ke),t.ɵɵinject(o.AuthClass),t.ɵɵinject(Yn),t.ɵɵinject(ge),t.ɵɵinject(ve),t.ɵɵinject(Pe),t.ɵɵinject(me))},token:or,providedIn:"root"}),or.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],or.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:ke},{type:o.AuthClass},{type:Yn},{type:ge},{type:ve},{type:Pe},{type:me}]};var sr="lifeready",ur=function(e,t,n){void 0===e&&(e=0),void 0===t&&(t=0),void 0===n&&(n=""),this.assembly=e,this.subAssembly=t,this.mnemonics=n},cr=function(){function e(e,t,n){void 0===t&&(t=0),void 0===n&&(n=0),this.index=e,this.threshold=t,this.size=n,this.clearShares()}return e.prototype.clearShares=function(){this.shares=[]},e.prototype.addShare=function(e){this.shares.push(e)},e}(),pr=function(){function e(e){void 0===e&&(e=0),this.threshold=e,this.clearSubAssemblies()}return e.prototype.size=function(){return this.subAssemblies.length},e.prototype.clearSubAssemblies=function(){this.subAssemblies=[]},e.prototype.addSubAssembly=function(e){this.subAssemblies.push(e)},e}(),dr=(function(){function e(e){this.subAssemblyIndex=e,this.clearShares()}e.prototype.clearShares=function(){this.shares=[]},e.prototype.addShare=function(e){this.shares.push(e)}}(),function(){function e(){this.clearSubQuora()}e.prototype.clearSubQuora=function(){this.subQuora=[]},e.prototype.addSubQuorum=function(e){this.subQuora.push(e)},e.prototype.serialiseShares=function(){var e=[];return this.subQuora.forEach((function(t){e=e.concat(t.shares)})),e}}(),function(){function e(){}return e.prototype.generateShares=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:r=btoa(e),r=g.Slip39Helper.slip39EncodeHex(r),i=[];try{for(a=O(n.subAssemblies),o=a.next();!o.done;o=a.next())s=o.value,i.push([s.threshold,s.size])}catch(e){c={error:e}}finally{try{o&&!o.done&&(p=a.return)&&p.call(a)}finally{if(c)throw c.error}}return[4,g.Slip39.fromArray(r,{passphrase:t,threshold:n.threshold,groups:i,title:""})];case 1:return u=d.sent(),n.subAssemblies.forEach((function(e,t){e.clearShares();for(var n=0;n<e.size;n++){var r="r/"+t.toString().padStart(2,"0")+"/"+n.toString().padStart(2,"0"),i=u.fromPath(r).mnemonics[0],a=new ur(t,n,i);e.addShare(a)}})),[2]}}))}))},e.prototype.minimalSet=function(e){var t,n,r,i,a=null,o=new Map;try{for(var s=O(e),u=s.next();!u.done;u=s.next()){var c=u.value,p=g.Slip39Helper.decodeMnemonic(c);if(a&&a!==p.groupThreshold)throw new Error("groupThreshold is different in mnemonics");a=p.groupThreshold,null==(f=o.get(p.groupIndex))&&(f={memberThreshold:p.memberThreshold,members:[]},o.set(p.groupIndex,f)),f.members.push({mnemonic:c,decoded:p})}}catch(e){t={error:e}}finally{try{u&&!u.done&&(n=s.return)&&n.call(s)}finally{if(t)throw t.error}}var d=[],l=0;try{for(var h=O(o.values()),y=h.next();!y.done;y=h.next()){var f;if(!((f=y.value).members.length<f.memberThreshold)&&(f.members.slice(0,f.memberThreshold).forEach((function(e){d.push(e.mnemonic)})),++l>=a))break}}catch(e){r={error:e}}finally{try{y&&!y.done&&(i=h.return)&&i.call(h)}finally{if(r)throw r.error}}return d},e.prototype.recoverSecret=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return e=this.minimalSet(e),[4,g.Slip39.recoverSecret(e,t)];case 1:return n=i.sent(),r=g.Slip39Helper.slip39DecodeHex(n),[2,atob(r)]}}))}))},e}());dr.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new dr},token:dr,providedIn:"root"}),dr.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}];var lr,hr=Oe(lr||(lr=F(["\nquery TpsKeysQuery($ids: [ID]) {\n tps(id_In: $ids) {\n edges {\n node {\n id\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n }\n }\n }\n }\n }\n}"],["\nquery TpsKeysQuery($ids: [ID]) {\n tps(id_In: $ids) {\n edges {\n node {\n id\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n }\n }\n }\n }\n }\n}"]))),yr=function(){function t(t){this.keyFactory=t.get(ge),this.keyService=t.get(Ke),this.encryptionService=t.get(ve),this.keyGraph=t.get(Pe),this.slip39Service=t.get(dr),this.lrGraphQl=t.get(e.ɵg)}return t.prototype.recoverAssemblyKey=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return n=e.map((function(e){if(t){if(JSON.stringify(t)!==JSON.stringify(e.assemblyKeyParams))throw new Z("The assembly key parameters are different between the approvals.")}else t=e.assemblyKeyParams;return e.slip39.share.mnemonics})),[4,this.slip39Service.recoverSecret(n,this.slip39Passphrase)];case 1:return r=i.sent(),[4,ge.asKey(Object.assign(Object.assign({},t),{k:r}))];case 2:return[2,i.sent()]}}))}))},t.prototype.prepareTpWrappingKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.keyGraph.getKey(e.wrappingKeyId)]}))}))},t.prototype.prepareAssembly=function(e){var t=e.subjectKey,n=e.rootKey;return A(this,void 0,void 0,(function(){var e,r,i,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:return[4,this.keyFactory.createKey()];case 1:return e=d.sent(),r=e.toJSON(!0),i=r.k,a=E(r,["k"]),[4,this.keyFactory.createPkcSignKey()];case 2:return o=d.sent(),[4,this.encryptionService.encryptToString(e,o.toJSON(!0))];case 3:return s=d.sent(),u=JSON.stringify(o.toJSON()),[4,this.encryptionService.encryptToString(t,e.toJSON(!0))];case 4:return c=d.sent(),[4,this.encryptionService.encryptToString(e,{rootKey:n.toJSON(!0)})];case 5:return p=d.sent(),[2,{assemblyKey:e,rawAssemblyKey:i,assemblyKeyParams:a,subjectKeyWrappedAssemblyKey:c,assemblyCipherData:p,assemblyKeyVerifierPbk:u,wrappedAssemblyKeyVerifierPrk:s}]}}))}))},t.prototype.prepareCreateSubAssemblies=function(e){var t=e.input,n=e.subjectKey,r=e.slipSubAssemblies,i=e.assemblyKeyParams;return A(this,void 0,void 0,(function(){var e=this;return T(this,(function(a){return[2,Promise.all(t.map((function(t,a){return A(e,void 0,void 0,(function(){var e,o,s=this;return T(this,(function(u){switch(u.label){case 0:return[4,this.encryptionService.encryptToString(n,t.subjectCipherDataClearJson||"")];case 1:return e=u.sent(),[4,Promise.all(t.approverTps.map((function(e,t){return A(s,void 0,void 0,(function(){return T(this,(function(o){return[2,this.prepareApprover({tp:e,approverIndex:t,slipSubAssembly:r[a],assemblyKeyParams:i,subjectKey:n})]}))}))})))];case 2:return o=u.sent(),[2,{singleReject:t.singleReject,quorum:t.quorum,subjectCipherData:e,createApprovers:o}]}}))}))})))]}))}))},t.prototype.prepareUpdateSubAssemblies=function(e){var t=e.input,n=e.subjectKey,r=e.slipSubAssemblies,i=e.assemblyKeyParams,a=e.subAssemblies;return A(this,void 0,void 0,(function(){var e=this;return T(this,(function(o){if(r.length!==t.length)throw new Q("The slipSubAssemblies must be the same length as the input");return[2,Promise.all(t.map((function(t,o){return A(e,void 0,void 0,(function(){var e,s,u,c,p,d,l=this;return T(this,(function(h){switch(h.label){case 0:return[4,this.encryptionService.encryptToString(n,t.subjectCipherDataClearJson||"")];case 1:return e=h.sent(),s=a.edges.find((function(e){return e.node.id===t.id})).node,u=[],c=[],t.approverTps.forEach((function(e){var t,n=null===(t=s.approvers.edges.find((function(t){return t.node.tp.id===e.tpId})))||void 0===t?void 0:t.node;n?c.push({tp:e,approverId:n.id}):u.push({tp:e})})),p=r[o],d={subAssemblyId:t.id,singleReject:t.singleReject,quorum:t.quorum,subjectCipherData:e},[4,Promise.all(u.map((function(e,t){var r=e.tp;return A(l,void 0,void 0,(function(){return T(this,(function(e){return[2,this.prepareApprover({tp:r,approverIndex:t,slipSubAssembly:p,assemblyKeyParams:i,subjectKey:n})]}))}))})))];case 2:return d.createApprovers=h.sent(),[4,Promise.all(c.map((function(e,t){var r=e.tp,a=e.approverId;return A(l,void 0,void 0,(function(){return T(this,(function(e){return[2,this.prepareApprover({approverId:a,tp:r,approverIndex:t+u.length,slipSubAssembly:p,assemblyKeyParams:i,subjectKey:n})]}))}))})))];case 3:return[2,(d.updateApprovers=h.sent(),d)]}}))}))})))]}))}))},t.prototype.fillWrappingKeyId=function(e,t){var n=this;e.forEach((function(e){e.approverTps.forEach((function(e){if(!e.wrappingKeyId){var r=t.find((function(t){return t.id===e.tpId}));e.wrappingKeyId=n.getTpWrappingKeyId(r)}}))}))},t.prototype.getInputApprovers=function(e){var t=[];return e.forEach((function(e){e.approverTps.forEach((function(e){t.push(e.tpId)}))})),t},t.prototype.prepareCreate=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d,l,h,y;return T(this,(function(f){switch(f.label){case 0:return t=this.keyService.currentRootKey,[4,this.keyFactory.createKey()];case 1:return n=f.sent(),[4,this.keyGraph.wrapKey(t,n)];case 2:return r=f.sent(),[4,this.prepareAssembly({rootKey:t.jwk,subjectKey:n})];case 3:return i=f.sent(),a=i.assemblyKey,o=i.rawAssemblyKey,s=i.assemblyKeyParams,u=E(i,["assemblyKey","rawAssemblyKey","assemblyKeyParams"]),[4,this.prepareSlip39(e.createSubAssemblies,e.quorum,o)];case 4:return c=f.sent(),p=this.getInputApprovers(e.createSubAssemblies),l=$t,[4,this.lrGraphQl.query({query:hr,variables:{ids:p}})];case 5:return d=l.apply(void 0,[f.sent().tps]),this.fillWrappingKeyId(e.createSubAssemblies,d),[4,this.prepareCreateSubAssemblies({input:e.createSubAssemblies,assemblyKeyParams:s,slipSubAssemblies:c.subAssemblies,subjectKey:n})];case 6:return h=f.sent(),[4,this.encryptionService.encryptToString(n,e.subjectCipherDataClearJson||"")];case 7:return y=f.sent(),[2,{assemblyKey:a,mutationInput:Object.assign(Object.assign({},u),{singleReject:e.singleReject,quorum:e.quorum,subjectCipherData:y,createSubAssemblies:h,rootKeyId:t.id,rootKeyWrappedSubjectKey:r})}]}}))}))},t.prototype.getAssemblyApprovers=function(e){var t=[];return $t(e.subAssemblies).map((function(e){$t(e.approvers).forEach((function(e){return t.push(e.tp.id)}))})),t},t.prototype.prepareUpdate=function(e,t){var n;return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,g,S,C,I;return T(this,(function(b){switch(b.label){case 0:if(e=Object.assign({createSubAssemblies:[]},e),r=e.createSubAssemblies||[],i=e.updateSubAssemblies||[],a=e.deleteSubAssemblies||[],0===r.length&&0===i.length&&0===a.length)throw new Q("Must specify at least one of: [createSubAssemblies, updateSubAssemblies, deleteSubAssemblies]");return o=this.keyService.currentRootKey,[4,this.keyGraph.getKey(t.subjectKey.id)];case 1:return s=b.sent(),[4,this.prepareAssembly({rootKey:o.jwk,subjectKey:s.jwk})];case 2:return u=b.sent(),c=u.assemblyKey,p=u.rawAssemblyKey,d=u.assemblyKeyParams,l=E(u,["assemblyKey","rawAssemblyKey","assemblyKeyParams"]),h=this.getAssemblyApprovers(t).concat(this.getInputApprovers(r),this.getInputApprovers(i)),f=$t,[4,this.lrGraphQl.query({query:hr,variables:{ids:h}})];case 3:y=f.apply(void 0,[b.sent().tps]),$t(t.subAssemblies).forEach((function(e){if(!a.includes(e.id)&&!i.some((function(t){return t.id===e.id}))){var t=$t(e.approvers).map((function(e){return{tpId:e.tp.id,sharedCipherDataClearJson:e.sharedCipherDataClearJson,sharedCipherApprovalDataClearJson:e.sharedCipherApprovalDataClearJson}}));i.push({id:e.id,quorum:e.quorum,singleReject:e.singleReject,approverTps:t,subjectCipherDataClearJson:e.subjectCipherDataClearJson})}})),this.fillWrappingKeyId(r,y),this.fillWrappingKeyId(i,y),b.label=4;case 4:return b.trys.push([4,6,,7]),[4,this.prepareSlip39((r||[]).concat(i||[]),e.quorum,p)];case 5:return v=b.sent(),[3,7];case 6:return m=b.sent(),console.log("Error while creating slip assembly",m),[3,7];case 7:return g={assemblyKeyParams:d,subjectKey:s.jwk},[4,this.prepareCreateSubAssemblies(Object.assign(Object.assign({},g),{input:r,slipSubAssemblies:v.subAssemblies.slice(0,r.length)}))];case 8:return S=b.sent(),[4,this.prepareUpdateSubAssemblies(Object.assign(Object.assign({},g),{input:i,slipSubAssemblies:v.subAssemblies.slice(r.length),subAssemblies:t.subAssemblies}))];case 9:return C=b.sent(),[4,this.encryptionService.encryptToString(s.jwk,null!==(n=e.subjectCipherDataClearJson)&&void 0!==n?n:t.subjectCipherDataClearJson)];case 10:return I=b.sent(),[2,{assemblyKey:c,mutationInput:Object.assign(Object.assign({},l),{singleReject:e.singleReject,quorum:e.quorum,subjectCipherData:I,subjectKeyId:s.id,createSubAssemblies:S,updateSubAssemblies:C})}]}}))}))},t.prototype.prepareApprover=function(e){var t=e.approverId,n=e.tp,r=e.approverIndex,i=e.slipSubAssembly,a=e.assemblyKeyParams,o=e.subjectKey;return A(this,void 0,void 0,(function(){var e,s,u,c,p,d,l,h,y;return T(this,(function(f){switch(f.label){case 0:return[4,this.prepareTpWrappingKey(n)];case 1:return e=f.sent(),[4,this.keyFactory.createKey()];case 2:return s=f.sent(),[4,this.encryptionService.encryptToString(e.jwk,s.toJSON(!0))];case 3:return u=f.sent(),[4,this.encryptionService.encryptToString(o,s.toJSON(!0))];case 4:return c=f.sent(),p=1===i.threshold?i.shares[0]:i.shares[r],d={slip39:{share:p,subAssembly:{quorum:i.threshold,size:i.size}},assemblyKeyParams:a},[4,this.encryptionService.encryptToString(s,n.sharedCipherDataClearJson||"")];case 5:return l=f.sent(),[4,this.encryptionService.encryptToString(s,n.sharedCipherApprovalDataClearJson||"")];case 6:return h=f.sent(),[4,this.encryptionService.encryptToString(s,d)];case 7:return y=f.sent(),[2,{tpWrappingKeyId:e.id,tpWrappedSharedKey:u,subjectKeyWrappedSharedKey:c,sharedCipherData:l,sharedCipherApprovalData:h,sharedCipherPartialAssemblyKey:y,approverId:t||void 0,tpId:t?void 0:n.tpId}]}}))}))},t.prototype.validateApprovers=function(e){var t,n;try{for(var r=O(e),i=r.next();!i.done;i=r.next()){var a=i.value;if(!a.currentUserSharedKey.userSharedKey.mkSharedKey){var o="tp "+a.other.username+" does not have mkSharedKey";throw console.log(o),new Q(o)}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},t.prototype.prepareSlip39=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:if(e.length<t)throw new Q("Not enough sub assemblies to meet quorum");return r=new pr(t),e.forEach((function(e,t){var n=e.approverTps.length;1===e.quorum&&(n=1),r.addSubAssembly(new cr(t,e.quorum,n))})),[4,this.slip39Service.generateShares(n,this.slip39Passphrase,r)];case 1:return i.sent(),[2,r]}}))}))},t}();e.ɵi=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r.slip39Passphrase=sr,r}return R(t,e),t.prototype.getTpWrappingKeyId=function(e){return e.currentUserSharedKey.userSharedKey.mkSharedKey.id},t}(yr),e.ɵi.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ɵi(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ɵi,providedIn:"root"}),e.ɵi.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵi.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ɵi=M([et({ngZoneName:"ngZone"})],e.ɵi);var fr,vr,mr,gr,Sr,Cr,Ir,br,wr,Kr,Pr,kr,Dr,Rr,Er,Mr,Ar=Oe(fr||(fr=F(["\nmutation CancelTpPasswordResetRequestMutation {\n cancelTpPasswordResetRequest(input: {}) {\n id\n }\n}"],["\nmutation CancelTpPasswordResetRequestMutation {\n cancelTpPasswordResetRequest(input: {}) {\n id\n }\n}"]))),Tr=Oe(vr||(vr=F(["\nmutation CreateTpAssemblyKeyChallengeMutation(\n $input: CreateTpAssemblyKeyChallengeInput!\n) {\n createTpAssemblyKeyChallenge(input: $input) {\n challenge\n }\n}"],["\nmutation CreateTpAssemblyKeyChallengeMutation(\n $input: CreateTpAssemblyKeyChallengeInput!\n) {\n createTpAssemblyKeyChallenge(input: $input) {\n challenge\n }\n}"]))),Or=Oe(mr||(mr=F(["\nmutation PreCompleteTpPasswordResetRequestMutation(\n $input: PreCompleteTpPasswordResetRequestInput!\n) {\n preCompleteTpPasswordResetRequest(input: $input) {\n idpPassword\n }\n}"],["\nmutation PreCompleteTpPasswordResetRequestMutation(\n $input: PreCompleteTpPasswordResetRequestInput!\n) {\n preCompleteTpPasswordResetRequest(input: $input) {\n idpPassword\n }\n}"]))),jr=Oe(gr||(gr=F(["\nmutation CompleteTpPasswordResetRequestMutation(\n $input: CompleteTpPasswordResetRequestInput!\n) {\n completeTpPasswordResetRequest(input: $input) {\n id\n }\n}"],["\nmutation CompleteTpPasswordResetRequestMutation(\n $input: CompleteTpPasswordResetRequestInput!\n) {\n completeTpPasswordResetRequest(input: $input) {\n id\n }\n}"]))),Nr=Oe(Sr||(Sr=F(["\nmutation ApproveTpPasswordResetRequestMutation(\n $input: ApproveTpPasswordResetRequestInput!\n) {\n approveTpPasswordResetRequest(input: $input) {\n claimApprover {\n id\n }\n }\n}"],["\nmutation ApproveTpPasswordResetRequestMutation(\n $input: ApproveTpPasswordResetRequestInput!\n) {\n approveTpPasswordResetRequest(input: $input) {\n claimApprover {\n id\n }\n }\n}"]))),Fr=Oe(Cr||(Cr=F(["\nmutation RejectTpPasswordResetRequestMutation(\n $input: RejectTpPasswordResetRequestInput!\n) {\n rejectTpPasswordResetRequest(input: $input) {\n claimApprover {\n id\n }\n }\n}"],["\nmutation RejectTpPasswordResetRequestMutation(\n $input: RejectTpPasswordResetRequestInput!\n) {\n rejectTpPasswordResetRequest(input: $input) {\n claimApprover {\n id\n }\n }\n}"]))),$r=Oe(Ir||(Ir=F(["\nmutation CreateTpPasswordResetMutation($input: CreateTpPasswordResetInput!) {\n createTpPasswordReset(input: $input) {\n tpPasswordReset {\n id\n }\n }\n}"],["\nmutation CreateTpPasswordResetMutation($input: CreateTpPasswordResetInput!) {\n createTpPasswordReset(input: $input) {\n tpPasswordReset {\n id\n }\n }\n}"]))),_r=Oe(br||(br=F(["\nmutation DeleteTpPasswordResetMutation {\n deleteTpPasswordReset(input: {}) {\n id\n }\n}"],["\nmutation DeleteTpPasswordResetMutation {\n deleteTpPasswordReset(input: {}) {\n id\n }\n}"]))),Lr=Oe(wr||(wr=F(["\nmutation UpdateTpPasswordResetMutation($input: UpdateTpPasswordResetInput!) {\n updateTpPasswordReset(input: $input) {\n tpPasswordReset {\n id\n }\n }\n}"],["\nmutation UpdateTpPasswordResetMutation($input: UpdateTpPasswordResetInput!) {\n updateTpPasswordReset(input: $input) {\n tpPasswordReset {\n id\n }\n }\n}"]))),Ur=function(){function e(e,t){var n=this;this._key=e,this.timer=setTimeout((function(){n._key=null}),t)}return Object.defineProperty(e.prototype,"key",{get:function(){return this._key},enumerable:!1,configurable:!0}),e.prototype.pop=function(){var e=this._key;return this._key=null,this.timer&&(clearTimeout(this.timer),this.timer=null),e},e}(),xr=Oe(Kr||(Kr=F(["\nquery {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n sessionEncryptionKey\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n","\n"],["\nquery {\n currentUser {\n id\n username\n currentUserKey {\n passKey {\n id\n passKeyParams\n passIdpParams\n wrappedPassIdpVerifierPrk\n created\n }\n masterKey {\n id\n }\n rootKey {\n id\n }\n pxk {\n id\n }\n sigPxk {\n id\n }\n }\n sessionEncryptionKey\n }\n keyGraph {\n ...KeyGraphFragment\n }\n}\n","\n"])),Je),qr=Oe(Pr||(Pr=F(["\nquery ResetUserQuery {\n tpPasswordResetUser {\n username\n sessionEncryptionKey\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n }\n}"],["\nquery ResetUserQuery {\n tpPasswordResetUser {\n username\n sessionEncryptionKey\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n }\n}"]))),Jr=Oe(kr||(kr=F(["\nmutation SetSessionEncryptionKeyMutation($input: SetSessionEncryptionKeyInput!) {\n setSessionEncryptionKey(input: $input) {\n sessionEncryptionKey\n }\n}\n"],["\nmutation SetSessionEncryptionKeyMutation($input: SetSessionEncryptionKeyInput!) {\n setSessionEncryptionKey(input: $input) {\n sessionEncryptionKey\n }\n}\n"])));(Dr=e.RecoveryStatus||(e.RecoveryStatus={})).NONE="NONE",Dr.NEW_PASSWORD="NEW_PASSWORD",Dr.OLD_PASSWORD="OLD_PASSWORD",(Rr=e.PasswordChangeStatus||(e.PasswordChangeStatus={})).IN_PROGRESS="IN_PROGRESS",Rr.RECOVERY="RECOVERY",(Er=e.CognitoChallengeName||(e.CognitoChallengeName={})).NEW_PASSWORD_REQUIRED="NEW_PASSWORD_REQUIRED",Er.SMS_MFA="SMS_MFA",Er.SOFTWARE_TOKEN_MFA="SOFTWARE_TOKEN_MFA",Er.MFA_SETUP="MFA_SETUP",e.AuthService=Mr=function(n){function r(e,r,i,a,o,s,u,c,p,d,l,h,y,f){var v=n.call(this,r)||this;if(v.ngZone=e,v.injector=r,v.http=i,v.cognito=a,v.api=o,v.keyService=s,v.keyGraphService=u,v.keyFactoryService=c,v.passwordService=p,v.idleService=d,v.persistService=l,v.encryptionService=h,v.assemblyController=y,v.kcConfig=f,v.logoutListeners=new Set,v.password=null,!t.isDevMode()&&null!=v.kcConfig.debug)throw new W('In production mode, "KcConfig.debug" must be set to null');return v}return R(r,n),r.prototype.importPassword=function(e){return this.keyFactoryService.importPassword(e)},r.prototype.logout=function(){var e;return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,Promise.all(N(this.logoutListeners).map((function(e){return e()})))];case 1:return t.sent(),this.user=null,this.keyService.purgeKeys(),this.keyGraphService.purgeKeys(),[4,Promise.all([this.cognito.signOut(),this.kcLogout()])];case 2:return t.sent(),(null===(e=this.kcConfig.debug)||void 0===e?void 0:e.username)&&(this.kcConfig.debug.username=null),[2]}}))}))},r.prototype.addLogoutListener=function(e){this.logoutListeners.add(e)},r.prototype.removeLogoutListener=function(e){this.logoutListeners.delete(e)},r.prototype.login=function(t,n,r){var i,a=(void 0===r?{}:r).tpPasswordResetAutoComplete,o=void 0===a||a;return A(this,void 0,void 0,(function(){var r;return T(this,(function(a){switch(a.label){case 0:return[4,this.loginImpl(t,n)];case 1:return(r=a.sent()).challenge?(this.password=new Ur(n,Mr.CHALLENGE_TIMEOUT),[2,r]):o&&(null===(i=r.user.resetUser)||void 0===i?void 0:i.state)===e.TpClaimState.APPROVED?[4,this.completeResetRequest(n)]:[3,4];case 2:return a.sent(),[4,this.loginImpl(t,n)];case 3:r=a.sent(),a.label=4;case 4:return[2,r]}}))}))},r.prototype.verifyLogin=function(t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s;return T(this,(function(u){switch(u.label){case 0:if(n=t.challenge,r=t.code,i=t.rememberMe,!(a=[e.CognitoChallengeName.SMS_MFA,e.CognitoChallengeName.SOFTWARE_TOKEN_MFA]).includes(n.cognitoUser.challengeName))throw new W("challengeName must be one of "+a);return[4,this.cognito.confirmSignIn(n.cognitoUser,r,n.cognitoUser.challengeName)];case 1:return o=u.sent(),[4,this.handlePostAuth(n.recoveryStatus)];case 2:return u.sent(),[4,this.loadUser(o,this.password.pop())];case 3:return s=u.sent(),this.password=null,i&&o.setDeviceStatusRemembered({onSuccess:function(){},onFailure:function(e){return console.error(e)}}),[2,{user:s}]}}))}))},r.prototype.getUser=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return this.user?[2,this.user]:[4,this.cognito.currentAuthenticatedUser()];case 1:return e=t.sent(),[2,this.loadUser(e)]}}))}))},r.prototype.refreshAccessToken=function(){return A(this,void 0,void 0,(function(){var e,t;return T(this,(function(n){switch(n.label){case 0:return[4,this.cognito.currentAuthenticatedUser()];case 1:return e=n.sent(),t=e.getSignInUserSession().getRefreshToken(),console.log("Token refresh..."),[2,new Promise((function(n,r){e.refreshSession(t,(function(e){e?(console.error("Error refreshing token: ",e),r(e)):(console.log("Token refresh complete"),n(0))}))}))]}}))}))},r.prototype.fetchCurrentUser=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.api.query({query:xr,processorOptions:{hasKeys:!1}})];case 1:return[2,e.sent().currentUser]}}))}))},r.prototype.fetchResetUser=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.api.query({query:qr,processorOptions:{hasKeys:!1}})];case 1:return[2,e.sent().tpPasswordResetUser]}}))}))},r.prototype.kcLogout=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.http.post(this.kcConfig.authUrl+"auth/sign-out/",null,{withCredentials:!0,responseType:"text"}).toPromise()];case 1:return e.sent(),[2]}}))}))},r.prototype.fetchPassIdpParams=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.http.get(this.kcConfig.authUrl+"users/pass-idp-params/?login_name="+encodeURIComponent(e)).toPromise()];case 1:return[2,t.sent()]}}))}))},r.prototype.loginImpl=function(t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,this.logout()];case 1:return i.sent(),[4,this.loginIdp(t,n)];case 2:return r=i.sent(),[e.CognitoChallengeName.SMS_MFA,e.CognitoChallengeName.SOFTWARE_TOKEN_MFA].includes(r.cognitoUser.challengeName)?[2,{challenge:{cognitoUser:r.cognitoUser,recoveryStatus:r.recoveryStatus}}]:[4,this.handlePostAuth(r.recoveryStatus)];case 3:return i.sent(),[4,this.loadUser(r.cognitoUser,n)];case 4:return[2,{user:i.sent()}]}}))}))},r.prototype.loginIdp=function(t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d,l;return T(this,(function(h){switch(h.label){case 0:return[4,this.fetchPassIdpParams(t)];case 1:if((r=h.sent()).passwordChangeStatus===e.PasswordChangeStatus.IN_PROGRESS)throw new X("A password change is in progress");if(r.passwordChangeStatus!==e.PasswordChangeStatus.RECOVERY)return[3,8];console.log("In recovery mode."),h.label=2;case 2:return h.trys.push([2,4,,5]),a={},[4,this.loginIdpImpl(t,n,r.newPassIdpParams)];case 3:return a.cognitoUser=h.sent(),a.recoveryStatus=e.RecoveryStatus.NEW_PASSWORD,i=a,console.log("New password works!"),[2,i];case 4:if("NotAuthorizedException"!==(o=h.sent()).code)throw o;return[3,5];case 5:return h.trys.push([5,7,,8]),u={},[4,this.loginIdpImpl(t,n,r.currentPassIdpParams)];case 6:return u.cognitoUser=h.sent(),u.recoveryStatus=e.RecoveryStatus.OLD_PASSWORD,s=u,console.log("Old password works!"),[2,s];case 7:throw"NotAuthorizedException"===(c=h.sent()).code?new W("The password change request was interrupted, please try to login with both your new and old password"):c;case 8:if(!r.tpPasswordReset)return[3,12];h.label=9;case 9:return h.trys.push([9,11,,12]),p=r.tpPasswordReset,d={},[4,this.loginIdpImpl(p.resetUsername,n,p.passIdpParams)];case 10:return d.cognitoUser=h.sent(),d.recoveryStatus=e.RecoveryStatus.NONE,[2,d];case 11:return h.sent(),[3,12];case 12:return l={},[4,this.loginIdpImpl(t,n,r.currentPassIdpParams)];case 13:return l.cognitoUser=h.sent(),l.recoveryStatus=e.RecoveryStatus.NONE,[2,l]}}))}))},r.prototype.loginIdpImpl=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,this.keyFactoryService.derivePassIdp(Object.assign({password:t},n))];case 1:return r=i.sent(),[2,this.cognito.signIn(e,this.passwordService.getPassIdpString(r.jwk))]}}))}))},r.prototype.handlePostAuth=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.handlePasswordRecovery(e)];case 1:return t.sent(),[4,this.handleSessionEncryptionKey()];case 2:return t.sent(),[2]}}))}))},r.prototype.handlePasswordRecovery=function(t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return t===e.RecoveryStatus.NONE?[3,2]:[4,this.passwordService.changePasswordComplete({useNewPassword:t===e.RecoveryStatus.NEW_PASSWORD})];case 1:n.sent(),n.label=2;case 2:return[2]}}))}))},r.prototype.handleSessionEncryptionKey=function(){return A(this,void 0,void 0,(function(){var e,n;return T(this,(function(r){switch(r.label){case 0:if(!this.kcConfig.disableSessionEncryptionKey)return[3,1];if(!t.isDevMode())throw e="You should not set disableSessionEncryptionKey=True in mode prod. It defaults to false.",console.error(e),new ee(e);return console.warn("You have set disableSessionEncryptionKey=True. Make sure not to do this in prod mode."),[3,4];case 1:return[4,this.keyFactoryService.createKey()];case 2:return n=r.sent(),[4,this.lrGraphQL.lrMutate(new dt({mutation:Jr,variables:{input:{sessionEncryptionKey:JSON.stringify(n.toJSON(!0))}}}),{includeKeyGraph:!1})];case 3:r.sent(),this.persistService.setServerSessionEncryptionKey(n),r.label=4;case 4:return[2]}}))}))},r.prototype.getCognitoUserAttribute=function(e,t){var n=t.find((function(t){return t.getName()===e}));return n?n.getValue():null},r.prototype.loadUserKeys=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return t=e.userKeys,n=e.password,(r=e.sessionEncryptionKey)?(o=(i=this.persistService).setServerSessionEncryptionKey,[4,a.JWK.asKey(r)]):[3,2];case 1:o.apply(i,[p.sent()]),p.label=2;case 2:return n?[4,this.keyFactoryService.derivePassKey(Object.assign({password:n},t.passKey.passKeyParams))]:[3,6];case 3:return s=p.sent().jwk,c=(u=this.idleService).persistMasterKey,[4,this.keyGraphService.unwrapWithPassKey(t.passKey.id,s,t.masterKey.id)];case 4:return[4,c.apply(u,[p.sent()])];case 5:p.sent(),p.label=6;case 6:return[2]}}))}))},r.prototype.loadUser=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return e.getUsername().endsWith(".tp_password_reset")?(n=this,[4,this.loadResetUser(e,t)]):[3,2];case 1:return n.user=i.sent(),[3,4];case 2:return r=this,[4,this.loadRegularUser(e,t)];case 3:r.user=i.sent(),i.label=4;case 4:return[4,this.idleService.start()];case 5:return i.sent(),[2,this.user]}}))}))},r.prototype.loadRegularUser=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.fetchCurrentUser()];case 1:return n=o.sent(),[4,this.loadUserKeys({userKeys:n.currentUserKey,password:t,sessionEncryptionKey:n.sessionEncryptionKey})];case 2:return o.sent(),[4,this.keyGraphService.populateKeys(n.currentUserKey)];case 3:return o.sent(),r=n.id,i=n.username,[4,this.cognito.userAttributes(e)];case 4:return a=o.sent(),[2,{id:r,username:i,sub:this.getCognitoUserAttribute("sub",a),loginEmail:this.getCognitoUserAttribute("email",a),resetUser:null}]}}))}))},r.prototype.loadResetUser=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.fetchResetUser()];case 1:return n=o.sent(),r={passKey:{id:n.passKey.id,passKeyParams:n.passKey.passKeyParams},masterKey:{id:n.masterKey.id}},[4,this.loadUserKeys({userKeys:r,password:t,sessionEncryptionKey:n.sessionEncryptionKey})];case 2:return o.sent(),[4,this.keyService.setKeys(r)];case 3:return o.sent(),i=n.username,[4,this.cognito.userAttributes(e)];case 4:return a=o.sent(),[2,{username:i,sub:this.getCognitoUserAttribute("sub",a),loginEmail:this.getCognitoUserAttribute("email",a),resetUser:{state:n.state}}]}}))}))},r.prototype.recoverAssemblyKey=function(e){return A(this,void 0,void 0,(function(){var t,n,r=this;return T(this,(function(i){switch(i.label){case 0:return[4,this.keyGraphService.getKey(e.pxk.id)];case 1:return t=i.sent(),[4,Promise.all(e.approvals.filter((function(e){return!!e.receiverCipherPartialAssemblyKey})).map((function(e){return r.encryptionService.decrypt(t,e.receiverCipherPartialAssemblyKey)})))];case 2:return n=i.sent(),[2,this.assemblyController.recoverAssemblyKey(n)]}}))}))},r.prototype.completeResetRequest=function(t){return A(this,void 0,void 0,(function(){var n,r,i,o,s,u,c,p,d,l,h,y,v,m,g=this;return T(this,(function(S){switch(S.label){case 0:return[4,this.fetchResetUser()];case 1:if((n=S.sent()).state!==e.TpClaimState.APPROVED)throw new Z("Password reset request has not been approved.");return[4,this.recoverAssemblyKey(n)];case 2:return r=S.sent(),[4,this.encryptionService.decrypt(r,n.assemblyCipherData)];case 3:return i=S.sent().rootKey,[4,a.JWK.asKey(i)];case 4:return o=S.sent(),[4,this.keyGraphService.getKey(n.masterKey.id)];case 5:return s=S.sent(),[4,this.encryptionService.encryptToString(s.jwk,o.toJSON(!0))];case 6:return u=S.sent(),[4,this.keyFactoryService.derivePassIdp(Object.assign({password:t},n.passKey.passIdpParams))];case 7:return c=S.sent(),p=this.passwordService.getPassIdpString(c.jwk),[4,this.lrGraphQL.lrMutate(new dt({mutation:Tr,variables:{input:{}}}),{includeKeyGraph:!1})];case 8:return(d=S.sent().createTpAssemblyKeyChallenge.challenge).clientNonce=this.keyFactoryService.randomString(32),[4,this.encryptionService.decrypt(r,n.wrappedAssemblyKeyVerifierPrk)];case 9:return l=S.sent(),[4,this.encryptionService.sign(l,d)];case 10:return h=S.sent(),[4,this.lrGraphQL.lrMutate(new dt({mutation:Or,variables:{input:{signedChallenge:JSON.stringify(h)}}}),{includeKeyGraph:!1})];case 11:return y=S.sent().preCompleteTpPasswordResetRequest.idpPassword,v=new Promise((function(e){var t=function(r){return A(g,void 0,void 0,(function(){return T(this,(function(i){switch(i.label){case 0:return"signIn"!==r.payload.event?[2]:(f.Hub.remove("auth",t),[4,this.cognito.signIn(n.username,p)]);case 1:return i.sent(),[4,this.lrGraphQL.lrMutate(new dt({mutation:jr,variables:{input:{masterKeyWrappedRootKey:u,masterKeyId:s.id}}}))];case 2:return i.sent(),e(),[2]}}))}))};f.Hub.listen("auth",t)})),[4,this.cognito.signIn(n.username,y,{noProxy:"true"})];case 12:if("NEW_PASSWORD_REQUIRED"!==(m=S.sent()).challengeName)throw new ee("Expecting Cognito to have done a password reset after call to PreCompleteTpPasswordResetRequestMutation.");return[4,this.cognito.completeNewPassword(m,p,{})];case 13:return m=S.sent(),[2,v]}}))}))},r.prototype.debugLogin=function(e,t){return this.kcConfig.debug.username=e,this.debugLoadUser(t)},r.prototype.debugLoadUser=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.fetchCurrentUser()];case 1:return t=s.sent(),n=t.id,r=t.username,i=t.currentUserKey,[4,this.keyFactoryService.derivePassKey(Object.assign({password:e},i.passKey.passKeyParams))];case 2:return a=s.sent().jwk,[4,this.keyGraphService.unwrapWithPassKey(i.passKey.id,a,i.masterKey.id)];case 3:return o=s.sent(),[4,this.idleService.persistMasterKey(o)];case 4:return s.sent(),[4,this.keyGraphService.populateKeys(i)];case 5:return s.sent(),this.user={id:n,username:r,resetUser:null,sub:"DEBUG_MODE",loginEmail:"DEBUG_MODE"},[2,this.user]}}))}))},r.prototype.debugClearUser=function(){this.user=null},r.prototype.getCurrentUserAttributes=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return[4,this.cognito.currentAuthenticatedUser()];case 1:return e=t.sent(),[4,this.cognito.userAttributes(e)];case 2:return[2,t.sent()]}}))}))},r}(Ft),e.AuthService.CHALLENGE_TIMEOUT=3e5,e.AuthService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.AuthService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(y.HttpClient),t.ɵɵinject(o.AuthClass),t.ɵɵinject(e.ɵg),t.ɵɵinject(Ke),t.ɵɵinject(Pe),t.ɵɵinject(ge),t.ɵɵinject(or),t.ɵɵinject(xt),t.ɵɵinject(we),t.ɵɵinject(ve),t.ɵɵinject(e.ɵi),t.ɵɵinject(Se))},token:e.AuthService,providedIn:"root"}),e.AuthService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.AuthService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:y.HttpClient},{type:o.AuthClass},{type:e.ɵg},{type:Ke},{type:Pe},{type:ge},{type:or},{type:xt},{type:we},{type:ve},{type:e.ɵi},{type:void 0,decorators:[{type:t.Inject,args:[Se]}]}]},e.AuthService=Mr=M([et({ngZoneName:"ngZone"})],e.AuthService);var Gr,Qr,Vr,Wr=Oe(Gr||(Gr=F(["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"],["\nmutation CreateContactCardMutation(\n $input: CreateContactCardInput!\n) {\n createContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"]))),Br=Oe(Qr||(Qr=F(["\nmutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"],["\nmutation UpdateContactCardMutation($input: UpdateContactCardInput!) {\n updateContactCard(input: $input) {\n contactCard {\n id\n }\n }\n}\n"]))),Zr=Oe(Vr||(Vr=F(["\nmutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteContactCardMutation($input: DeleteContactCardInput!) {\n deleteContactCard(input: $input) {\n id\n }\n}\n"]))),Hr=function(){};e.ContactCard2Service=function(){function e(e,t,n,r,i,a){this.keyFactory=e,this.keyService=t,this.encryptionService=n,this.keyGraph=r,this.keyMetaService=i,this.ngZone=a}return e.prototype.createContactCard=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return t=this.keyService.currentRootKey,[4,this.keyFactory.createKey()];case 1:return n=o.sent(),[4,this.keyGraph.encryptToString(t.jwk,n.toJSON(!0))];case 2:return r=o.sent(),[4,this.keyGraph.encryptToString(n,e.plainCipherDataJson)];case 3:return i=o.sent(),[4,this.prepareContactCardInput(e)];case 4:return a=o.sent(),[2,new dt({mutation:Wr,variables:{input:Object.assign(Object.assign({},a),{wrappingKeyId:t.id,wrappedKey:r,cipherData:i})}})]}}))}))},e.prototype.updateContactCard=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.keyGraph.encryptToString(e.keyId,e.plainCipherDataJson)];case 1:return t=r.sent(),[4,this.prepareContactCardInput(e)];case 2:return n=r.sent(),[2,new dt({mutation:Br,variables:{input:Object.assign(Object.assign({},n),{id:e.id,cipherData:t})}})]}}))}))},e.prototype.deleteContactCard=function(e){return new dt({mutation:Zr,variables:{input:{id:e}}})},e.prototype.prepareContactCardInput=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p;return T(this,(function(d){switch(d.label){case 0:return t=this.keyService.currentSigPxk,i=(r=JSON).stringify,[4,this.encryptionService.sign(t.jwk,e.publicDataJson)];case 1:return n=i.apply(r,[d.sent()]),s=(o=JSON).stringify,[4,this.encryptionService.sign(t.jwk,e.publicSearchableJson)];case 2:return a=s.apply(o,[d.sent()]),p=(c=JSON).stringify,[4,this.encryptionService.sign(t.jwk,e.plainDataJson)];case 3:return u=p.apply(c,[d.sent()]),[2,{sigPxkId:t.id,publicDataSig:n,publicSearchableSig:a,plainDataSig:u}]}}))}))},e}(),e.ContactCard2Service.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ContactCard2Service(t.ɵɵinject(ge),t.ɵɵinject(Ke),t.ɵɵinject(ve),t.ɵɵinject(Pe),t.ɵɵinject(zt),t.ɵɵinject(t.NgZone))},token:e.ContactCard2Service,providedIn:"root"}),e.ContactCard2Service.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ContactCard2Service.ctorParameters=function(){return[{type:ge},{type:Ke},{type:ve},{type:Pe},{type:zt},{type:t.NgZone}]},e.ContactCard2Service=M([et({ngZoneName:"ngZone"})],e.ContactCard2Service);var Yr=function(){function e(e,t,n){this.config=e,this.http=t,this.auth=n}return e.prototype.downloadEncryptedFileJson=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return n=(t=JSON).parse,[4,this.downloadEncryptedFile(e)];case 1:return[2,n.apply(t,[r.sent()])]}}))}))},e.prototype.downloadEncryptedFile=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return t=this.config.apiUrl+"files/download/?file_state_node_id="+e,r=(n=this.http).get,i=[t],o=(a=Object).assign,u=(s=Object).assign,c=[{}],[4,Ie(this.auth,this.config)];case 1:return[4,r.apply(n,i.concat([o.apply(a,[u.apply(s,c.concat([p.sent()])),{responseType:"text"}])])).toPromise()];case 2:return[2,p.sent()]}}))}))},e.prototype.loadFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return e instanceof ArrayBuffer?[2,e]:[2,new Promise((function(t){var n=new FileReader;n.onload=function(){t(n.result)},n.readAsArrayBuffer(e)}))]}))}))},e.prototype.uploadEncryptedFile=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return t=e.encryptedContent,n=e.fileName,(r=new FormData).append("content",new Blob([t]),n),a=(i=this.http).post,o=[this.config.apiUrl+"files/upload/",r],[4,Ie(this.auth,this.config)];case 1:return[4,a.apply(i,o.concat([s.sent()])).toPromise()];case 2:return[2,s.sent().content_resource]}}))}))},e}();Yr.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Yr(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(o.AuthClass))},token:Yr,providedIn:"root"}),Yr.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Yr.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:o.AuthClass}]};var Xr,zr,ei,ti,ni,ri,ii,ai,oi,si,ui,ci,pi,di,li,hi,yi,fi,vi,mi,gi,Si=Oe(Xr||(Xr=F(["\nmutation CreateDirectoryMutation($input: CreateDirectoryInput!) {\n createDirectory(input: $input) {\n directory {\n id\n keyId\n }\n }\n}\n"],["\nmutation CreateDirectoryMutation($input: CreateDirectoryInput!) {\n createDirectory(input: $input) {\n directory {\n id\n keyId\n }\n }\n}\n"]))),Ci=Oe(zr||(zr=F(["\nmutation UpdateDirectoryMutation($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n modified\n }\n }\n}\n"],["\nmutation UpdateDirectoryMutation($input: UpdateDirectoryInput!) {\n updateDirectory(input: $input) {\n directory {\n id\n modified\n }\n }\n}\n"]))),Ii=Oe(ei||(ei=F(["\nmutation DeleteDirectoryMutation($input: DeleteDirectoryInput!) {\n deleteDirectory(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteDirectoryMutation($input: DeleteDirectoryInput!) {\n deleteDirectory(input: $input) {\n id\n }\n}\n"]))),bi=Oe(ti||(ti=F(["\nmutation CreateFileMutation($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n keyId\n }\n }\n}\n"],["\nmutation CreateFileMutation($input: CreateFileInput!) {\n createFile(input: $input) {\n file {\n id\n keyId\n }\n }\n}\n"]))),wi=Oe(ni||(ni=F(["\nmutation UpdateFileMutation($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation UpdateFileMutation($input: UpdateFileInput!) {\n updateFile(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Ki=Oe(ri||(ri=F(["\nmutation RevertFileMutation($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation RevertFileMutation($input: RevertFileInput!) {\n revertFile(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Pi=Oe(ii||(ii=F(["\nmutation DeleteFileMutation($input: DeleteFileInput!) {\n deleteFile(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteFileMutation($input: DeleteFileInput!) {\n deleteFile(input: $input) {\n id\n }\n}\n"]))),ki=Oe(ai||(ai=F(["\nmutation ArchiveDirectoryMutation($input: ArchiveDirectoryInput!) {\n archiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"],["\nmutation ArchiveDirectoryMutation($input: ArchiveDirectoryInput!) {\n archiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"]))),Di=Oe(oi||(oi=F(["\nmutation ArchiveFileMutation($input: ArchiveFileInput!) {\n archiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation ArchiveFileMutation($input: ArchiveFileInput!) {\n archiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Ri=Oe(si||(si=F(["\nmutation UnarchiveDirectoryMutation($input: UnarchiveDirectoryInput!) {\n unarchiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"],["\nmutation UnarchiveDirectoryMutation($input: UnarchiveDirectoryInput!) {\n unarchiveDirectory(input: $input) {\n directory {\n id\n }\n }\n}\n"]))),Ei=Oe(ui||(ui=F(["\nmutation UnarchiveFileMutation($input: UnarchiveFileInput!) {\n unarchiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation UnarchiveFileMutation($input: UnarchiveFileInput!) {\n unarchiveFile(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Mi=Oe(ci||(ci=F(["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n }\n }\n}\n"],["\nmutation ChangeDirectoryParentsMutation($input: ChangeDirectoryParentsInput!) {\n changeDirectoryParents(input: $input) {\n directory {\n id\n }\n }\n}\n"]))),Ai=Oe(pi||(pi=F(["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation ChangeFileParentsMutation($input: ChangeFileParentsInput!) {\n changeFileParents(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Ti=Oe(di||(di=F(["\nmutation BeginDeleteChildItemLinksWindowMutation($input: BeginDeleteChildItemLinksWindowInput!) {\n beginDeleteChildItemLinksWindow(input: $input) {\n begin\n end\n scheduled\n windowMs\n directory {\n id\n }\n }\n}\n"],["\nmutation BeginDeleteChildItemLinksWindowMutation($input: BeginDeleteChildItemLinksWindowInput!) {\n beginDeleteChildItemLinksWindow(input: $input) {\n begin\n end\n scheduled\n windowMs\n directory {\n id\n }\n }\n}\n"]))),Oi=Oe(li||(li=F(['\nquery TempDirectoryQuery($plainMeta: LrJSONFilter!) {\n rootDirectories(plainMeta: $plainMeta, first: 2, orderBy: "created") {\n edges {\n node {\n id\n keyId\n }\n }\n }\n lock {\n version\n }\n}\n'],['\nquery TempDirectoryQuery($plainMeta: LrJSONFilter!) {\n rootDirectories(plainMeta: $plainMeta, first: 2, orderBy: "created") {\n edges {\n node {\n id\n keyId\n }\n }\n }\n lock {\n version\n }\n}\n']))),ji=Oe(hi||(hi=F(["\nmutation SetFileConfidentialMutation($input: SetFileConfidentialInput!) {\n setFileConfidential(input: $input) {\n file {\n id\n }\n }\n}\n"],["\nmutation SetFileConfidentialMutation($input: SetFileConfidentialInput!) {\n setFileConfidential(input: $input) {\n file {\n id\n }\n }\n}\n"]))),Ni=Oe(yi||(yi=F(["\nmutation SetDirectoryConfidentialMutation($input: SetDirectoryConfidentialInput!) {\n setDirectoryConfidential(input: $input) {\n directory {\n id\n }\n }\n}\n"],["\nmutation SetDirectoryConfidentialMutation($input: SetDirectoryConfidentialInput!) {\n setDirectoryConfidential(input: $input) {\n directory {\n id\n }\n }\n}\n"]))),Fi=Oe(fi||(fi=F(["\nfragment LockFragment on LockField {\n created\n modified\n version\n expiryTime\n state\n}"],["\nfragment LockFragment on LockField {\n created\n modified\n version\n expiryTime\n state\n}"]))),$i=Oe(vi||(vi=F(["\nmutation UpdateLockMutation($input: UpdateLockInput!) {\n updateLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"],["\nmutation UpdateLockMutation($input: UpdateLockInput!) {\n updateLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"])),Fi),_i=Oe(mi||(mi=F(["\nmutation AcquireLockMutation($input: AcquireLockInput!) {\n acquireLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"],["\nmutation AcquireLockMutation($input: AcquireLockInput!) {\n acquireLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"])),Fi),Li=Oe(gi||(gi=F(["\nmutation ReleaseLockMutation($input: ReleaseLockInput!) {\n releaseLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"],["\nmutation ReleaseLockMutation($input: ReleaseLockInput!) {\n releaseLock(input: $input) {\n lock {\n ...LockFragment\n }\n }\n}\n","\n"])),Fi);e.LockService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.updateLockMutation=function(e){return new dt({mutation:$i,variables:{input:{resourceId:e.resourceId,version:e.version}}})},t.prototype.acquireLockMutation=function(e){return new dt({mutation:_i,variables:{input:{resourceId:e.resourceId,timeoutMs:e.timeoutMs}}})},t.prototype.releaseLockMutation=function(e){return new dt({mutation:Li,variables:{input:{resourceId:e.resourceId,version:e.version}}})},t}(Ft),e.LockService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.LockService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.LockService,providedIn:"root"}),e.LockService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.LockService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.LockService=M([et({ngZoneName:"ngZone"})],e.LockService);var Ui,xi,qi,Ji,Gi,Qi,Vi=Oe(Ui||(Ui=F(["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"],["\nquery DirectoryKeyQuery($id: LrRelayIdInput!) {\n directory(id: $id) {\n keyId\n }\n}\n"]))),Wi=Oe(xi||(xi=F(["\nquery FileKeyQuery($id: LrRelayIdInput!) {\n file(id: $id) {\n keyId\n }\n}\n"],["\nquery FileKeyQuery($id: LrRelayIdInput!) {\n file(id: $id) {\n keyId\n }\n}\n"]))),Bi=Oe(qi||(qi=F(["\nquery DirectoryKeyFromSharedDirectoryQuery($id: LrRelayIdInput!) {\n tpSharedDirectory(id: $id) {\n item {\n keyId\n }\n }\n}\n"],["\nquery DirectoryKeyFromSharedDirectoryQuery($id: LrRelayIdInput!) {\n tpSharedDirectory(id: $id) {\n item {\n keyId\n }\n }\n}\n"]))),Zi=Oe(Ji||(Ji=F(["\nquery FileKeyFromSharedFileQuery($id: LrRelayIdInput!) {\n tpSharedFile(id: $id) {\n item {\n keyId\n }\n }\n}\n"],["\nquery FileKeyFromSharedFileQuery($id: LrRelayIdInput!) {\n tpSharedFile(id: $id) {\n item {\n keyId\n }\n }\n}\n"]))),Hi=Oe(Gi||(Gi=F(["\nquery FileStateKeyQuery($id: LrRelayIdInput!) {\n fileState(id: $id) {\n keyId\n }\n}\n"],["\nquery FileStateKeyQuery($id: LrRelayIdInput!) {\n fileState(id: $id) {\n keyId\n }\n}\n"])));e.ItemService=Qi=function(e){function t(t,n,r,i,a,o,s,u){var c=e.call(this,n)||this;return c.ngZone=t,c.injector=n,c.fileUploadService=r,c.keyService=i,c.keyFactory=a,c.keyGraph=o,c.lockService=s,c.authService=u,c.tempDirectory=null,c.authService.addLogoutListener((function(){return c.onLogout()})),c}return R(t,e),t.prototype.downloadFileContent=function(e){return A(this,void 0,void 0,(function(){var t,n,r=this;return T(this,(function(i){switch(i.label){case 0:return[4,this.fileUploadService.downloadEncryptedFile(e.fileStateNodeId)];case 1:return t=i.sent(),[4,this.keyGraph.getKey(e.fileStateKeyId,(function(){return r.getFileStateKeyId(e.fileStateNodeId)}))];case 2:return n=i.sent(),[2,this.keyGraph.decryptFromString(n,t,{payloadType:L.UINT_8_ARRAY})]}}))}))},t.prototype.getDirectoryKeyId=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Vi,variables:{id:e}})];case 1:return[2,t.sent().directory.keyId]}}))}))},t.prototype.getFileKeyId=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Wi,variables:{id:e}})];case 1:return[2,t.sent().file.keyId]}}))}))},t.prototype.getDirectoryKeyIdFromSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Bi,variables:{id:e}})];case 1:return[2,t.sent().tpSharedDirectory.item.keyId]}}))}))},t.prototype.getFileKeyIdFromSharedFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Zi,variables:{id:e}})];case 1:return[2,t.sent().tpSharedFile.item.keyId]}}))}))},t.prototype.getDirectoryKey=function(e,t){return A(this,void 0,void 0,(function(){var n=this;return T(this,(function(r){return[2,this.keyGraph.getKey(t,(function(){return n.getDirectoryKeyId(e)}))]}))}))},t.prototype.getFileKey=function(e,t){return A(this,void 0,void 0,(function(){var n=this;return T(this,(function(r){return[2,this.keyGraph.getKey(t,(function(){return n.getFileKeyId(e)}))]}))}))},t.prototype.createDirectory=function(e){return this.mutate(this.createDirectoryMutation(e))},t.prototype.createDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Si},r={},[4,this.prepareCreateDirectory(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.updateDirectory=function(e){return this.mutate(this.updateDirectoryMutation(e))},t.prototype.updateDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Ci},r={},[4,this.prepareUpdateDirectory(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.deleteDirectory=function(e){return this.mutate(this.deleteDirectoryMutation(e))},t.prototype.deleteDirectoryMutation=function(e){return new dt({mutation:Ii,variables:{input:{directoryId:e}}})},t.prototype.createFile=function(e){return this.mutate(this.createFileMutation(e))},t.prototype.createFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:bi},r={},[4,this.prepareCreateFile(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.updateFile=function(e){return this.mutate(this.updateFileMutation(e))},t.prototype.updateFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:wi},r={},[4,this.prepareUpdateFile(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.revertFile=function(e){return this.mutate(this.revertFileMutation(e))},t.prototype.revertFileMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Ki,variables:{input:e}})]}))}))},t.prototype.deleteFile=function(e){return this.mutate(this.deleteFileMutation(e))},t.prototype.deleteFileMutation=function(e){return new dt({mutation:Pi,variables:{input:{fileId:e}}})},t.prototype.archiveDirectory=function(e,t){return this.mutate(this.archiveDirectoryMutation(e,t))},t.prototype.archiveDirectoryMutation=function(e,t){return new dt({mutation:ki,variables:{input:{directoryId:e,recursive:t.recursive}}})},t.prototype.archiveFile=function(e){return this.mutate(this.archiveFileMutation(e))},t.prototype.archiveFileMutation=function(e){return new dt({mutation:Di,variables:{input:{fileId:e}}})},t.prototype.unarchiveDirectory=function(e,t){return this.mutate(this.unarchiveDirectoryMutation(e,t))},t.prototype.unarchiveDirectoryMutation=function(e,t){return new dt({mutation:Ri,variables:{input:{directoryId:e,recursive:t.recursive}}})},t.prototype.unarchiveFile=function(e){return this.mutate(this.unarchiveFileMutation(e))},t.prototype.unarchiveFileMutation=function(e){return new dt({mutation:Ei,variables:{input:{fileId:e}}})},t.prototype.changeDirectoryParents=function(e){return this.mutate(this.changeDirectoryParentsMutation(e))},t.prototype.changeDirectoryParentsMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Mi},r={},[4,this.prepareChangeDirectoryParents(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.changeFileParents=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.changeFileParentsMutation(e))]}))}))},t.prototype.changeFileParentsMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:Ai},r={},[4,this.prepareChangeFileParents(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))},t.prototype.beginDeleteChildItemLinksWindow=function(e){return this.mutate(this.beginDeleteChildItemLinksWindowMutation(e))},t.prototype.beginDeleteChildItemLinksWindowMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Ti,variables:{input:e}})]}))}))},t.prototype.ensureTempDirectory=function(){var e;return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return this.tempDirectory?[2,this.tempDirectory]:[4,this.query({query:Oi,variables:{plainMeta:Qi.TEMP_DIRECTORY_PLAIN_META_FILTER}})];case 1:return(t=p.sent()).rootDirectories.edges.length>1&&console.error("There is more than 1 temp directory (plainMeta filter: "+Qi.TEMP_DIRECTORY_PLAIN_META_FILTER+")"),0!==t.rootDirectories.edges.length?[3,4]:[4,this.createDirectoryMutation({asRootDirectory:!0,plainMetaJson:Qi.TEMP_DIRECTORY_PLAIN_META})];case 2:return n=p.sent(),r=this.lockService.updateLockMutation({version:null===(e=t.lock)||void 0===e?void 0:e.version}),[4,this.lrGraphQL.lrMutate([n,r])];case 3:return i=j.apply(void 0,[p.sent(),1]),a=i[0],o=a.createDirectory.directory,u=o.id,c=o.keyId,this.tempDirectory={id:u,keyId:c},[3,5];case 4:s=t.rootDirectories.edges[0].node,u=s.id,c=s.keyId,this.tempDirectory={id:u,keyId:c},p.label=5;case 5:return[2,this.tempDirectory]}}))}))},t.prototype.createDirectoryTree=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createDirectoryTreeMutation(e))]}))}))},t.prototype.createDirectoryTreeMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.ensureTempDirectory()];case 1:return t=r.sent(),[4,this.beginDeleteChildItemLinksWindow({directoryId:t.id,requestWindowMs:e.requestWindowMs})];case 2:return r.sent(),[4,this.createDirectory({cipherMetaClearJson:e.cipherMetaClearJson,parentDirectories:[{directoryId:t.id,wrappingKeyId:t.keyId}],plainMetaJson:e.plainMetaJson})];case 3:return n=r.sent().createDirectory.directory,[4,e.createContent({id:n.id,keyId:n.keyId})];case 4:return r.sent(),[2,this.changeDirectoryParentsMutation({directoryId:n.id,directoryKeyId:n.keyId,parentsToRemove:[t.id],parentsToAdd:e.parentDirectories})]}}))}))},t.prototype.setFileConfidential=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.setFileConfidentialMutation(e))]}))}))},t.prototype.setFileConfidentialMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:ji,variables:{input:{fileId:e.fileId,confidential:e.confidential}}})]}))}))},t.prototype.setDirectoryConfidential=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.setDirectoryConfidentialMutation(e))]}))}))},t.prototype.setDirectoryConfidentialMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Ni,variables:{input:{directoryId:e.directoryId,confidential:e.confidential}}})]}))}))},t.prototype.prepareParentDirectory=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.getDirectoryKey(e.directoryId,e.wrappingKeyId)];case 1:return n=i.sent(),r={directoryId:e.directoryId,wrappingKeyId:n.id},[4,this.keyGraph.wrapKey(n,t)];case 2:return[2,(r.wrappedKey=i.sent(),r.linkType=e.linkType,r)]}}))}))},t.prototype.getFileStateKeyId=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Hi,variables:{id:e}})];case 1:return[2,t.sent().fileState.keyId]}}))}))},t.prototype.prepareCreateFileState=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l,h;return T(this,(function(y){switch(y.label){case 0:return[4,this.keyFactory.createKey()];case 1:return n=y.sent(),(i=t.file)?[4,this.fileUploadService.loadFile(t.file)]:[3,3];case 2:i=y.sent(),y.label=3;case 3:return(r=i)?[4,this.keyGraph.encryptToString(n,r)]:[3,8];case 4:return o=y.sent(),t.upload?[4,t.upload(o)]:[3,6];case 5:return a=y.sent(),[3,8];case 6:return[4,this.fileUploadService.uploadEncryptedFile({encryptedContent:o})];case 7:a=y.sent(),y.label=8;case 8:return u=(s=Object).assign,p=(c=Object).assign,d=[{}],[4,this.prepareItem(n,t)];case 9:return l=[p.apply(c,d.concat([y.sent()]))],h={},[4,this.keyGraph.wrapKey(e,n)];case 10:return[2,u.apply(s,l.concat([(h.wrappedStateKey=y.sent(),h.contentResource=a,h)]))]}}))}))},t.prototype.prepareChangeItemParents=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i=this;return T(this,(function(a){switch(a.label){case 0:return e.parentsToAdd?[4,Promise.all(e.parentsToAdd.map((function(e){return i.prepareParentDirectory(e,t)})))]:[3,2];case 1:return r=a.sent(),[3,3];case 2:r=[],a.label=3;case 3:return n=r,[2,{directoriesToRemove:e.parentsToRemove||[],directoriesToAdd:n}]}}))}))},t.prototype.prepareItem=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return n=t.plainMetaJson,r=t.cipherMetaClearJson,i={plainMeta:n&&JSON.stringify(n)},(a=r)?[4,this.keyGraph.encryptToString(e,r)]:[3,2];case 1:a=o.sent(),o.label=2;case 2:return[2,(i.cipherMeta=a,i)]}}))}))},t.prototype.prepareCreateDirectory=function(e){var t,n,r;return A(this,void 0,void 0,(function(){var i,a,o,s,u,c,p=this;return T(this,(function(d){switch(d.label){case 0:return[4,this.keyFactory.createKey()];case 1:if(i=d.sent(),e.parentDirectories=e.parentDirectories||[],!e.asRootDirectory&&!(null===(t=e.parentDirectories)||void 0===t?void 0:t.length))throw new Q("A new directory must be either a root directory or a sub-directory. So you must provide either parentDirectories or asRootDirectory parameter.");if(e.asRootDirectory&&(null===(n=e.parentDirectories)||void 0===n?void 0:n.length))throw new Q("A new directory must be either a root directory or a sub-directory. So you can only provide either parentDirectories or asRootDirectory parameter.");return[4,Promise.all(null===(r=e.parentDirectories)||void 0===r?void 0:r.map((function(e){return p.prepareParentDirectory(e,i)})))];case 2:return a=d.sent(),e.asRootDirectory?(s=this.keyService.currentRootKey,u={wrappingKeyId:s.id},[4,this.keyGraph.wrapKey(s,i)]):[3,4];case 3:u.wrappedKey=d.sent(),o=u,d.label=4;case 4:return[4,this.prepareItem(i,e)];case 5:return c=d.sent(),[2,Object.assign(Object.assign({},c),{parentDirectories:a,parentRootDirectory:o})]}}))}))},t.prototype.prepareUpdateDirectory=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getDirectoryKey(e.directoryId,e.directoryKeyId)];case 1:return t=r.sent(),[4,this.prepareItem(t.jwk,e)];case 2:return n=r.sent(),[2,Object.assign(Object.assign({},n),{directoryId:e.directoryId})]}}))}))},t.prototype.prepareCreateFile=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i=this;return T(this,(function(a){switch(a.label){case 0:return[4,this.keyFactory.createKey()];case 1:return t=a.sent(),[4,Promise.all(e.parentDirectories.map((function(e){return A(i,void 0,void 0,(function(){var n,r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.prepareParentDirectory(e,t)];case 1:return n=o.sent(),r=n.directoryId,i=n.wrappingKeyId,a=n.wrappedKey,[2,{directoryId:r,wrappingKeyId:i,wrappedFileKey:a}]}}))}))})))];case 2:return n=a.sent(),[4,this.prepareCreateFileState(t,e)];case 3:return r=a.sent(),[2,Object.assign(Object.assign({},r),{parentDirectories:n})]}}))}))},t.prototype.prepareUpdateFile=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getFileKey(e.fileId,e.fileKeyId)];case 1:return t=r.sent(),[4,this.prepareCreateFileState(t.jwk,e)];case 2:return n=r.sent(),[2,Object.assign(Object.assign({},n),{fileId:e.fileId})]}}))}))},t.prototype.prepareChangeDirectoryParents=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getDirectoryKey(e.directoryId,e.directoryKeyId)];case 1:return t=r.sent(),[4,this.prepareChangeItemParents(e,t.jwk)];case 2:return n=r.sent(),[2,Object.assign(Object.assign({},n),{directoryId:e.directoryId})]}}))}))},t.prototype.prepareChangeFileParents=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getFileKey(e.fileId,e.fileKeyId)];case 1:return t=r.sent(),[4,this.prepareChangeItemParents(e,t.jwk)];case 2:return n=r.sent(),[2,Object.assign(Object.assign({},n),{fileId:e.fileId})]}}))}))},t.prototype.onLogout=function(){this.tempDirectory=null},t}(Ft),e.ItemService.TEMP_DIRECTORY_PLAIN_META={kcType:"temp"},e.ItemService.TEMP_DIRECTORY_PLAIN_META_FILTER=JSON.stringify({filter:[{contains:Qi.TEMP_DIRECTORY_PLAIN_META}]}),e.ItemService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ItemService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(Yr),t.ɵɵinject(Ke),t.ɵɵinject(ge),t.ɵɵinject(Pe),t.ɵɵinject(e.LockService),t.ɵɵinject(e.AuthService))},token:e.ItemService,providedIn:"root"}),e.ItemService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ItemService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:Yr},{type:Ke},{type:ge},{type:Pe},{type:e.LockService},{type:e.AuthService}]},e.ItemService=Qi=M([et({ngZoneName:"ngZone"})],e.ItemService),e.KeyExchangeService=function(e){function t(t,n,r,i,a,o){var s=e.call(this,n)||this;return s.ngZone=t,s.injector=n,s.keyFactory=r,s.keyService=i,s.encryptionService=a,s.keyGraph=o,s.CLIENT_NONCE_LENGTH=32,s}return R(t,e),t.prototype.getOtKey=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return t?[4,ge.asKey(Object.assign(Object.assign({},JSON.parse(e.otk.otKeyParams)),{k:t}))]:[3,2];case 1:return[2,i.sent()];case 2:return"OTK_INITIATED"!==e.otk.state||e.isInitiator||!e.otk.responderPbkCipher?[3,5]:(n=this.keyService.currentPxk,[4,this.encryptionService.decrypt(n.jwk,JSON.parse(e.otk.responderPbkCipher),{serializations:[pe.COMPACT]})]);case 3:return(r=i.sent()).otKey?[4,ge.asKey(r.otKey)]:[3,5];case 4:return[2,i.sent()];case 5:return[2,null]}}))}))},t.prototype.decryptOtk=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s;return T(this,(function(u){switch(u.label){case 0:return[4,this.getOtKey(e,t)];case 1:return n=u.sent(),r=e.otk,n&&r.otKeyCipher?(a=(i=Object).assign,o=[Object.assign({},r)],s={otKey:n},[4,this.encryptionService.decrypt(n,e.otk.otKeyCipher)]):[3,3];case 2:r=a.apply(i,o.concat([(s.otKeyCipherClearJson=u.sent(),s)])),u.label=3;case 3:return[2,Object.assign(Object.assign({},e),{otk:r})]}}))}))},t.prototype.decryptResponseCipher=function(e,t,n){return A(this,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.encryptionService.decrypt(e,n)];case 1:return n=i.sent(),[3,3];case 2:if("no key found"!==(r=i.sent()).message)throw r;return[3,3];case 3:return[4,this.encryptionService.decrypt(t,n)];case 4:return[2,i.sent()]}}))}))},t.prototype.decryptKeyExchangeAsInitiator=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d;return T(this,(function(l){switch(l.label){case 0:return t=this.keyService.currentRootKey,[4,this.encryptionService.decrypt(t.jwk,e.initiatorRootKeyCipher)];case 1:return n=l.sent(),[4,ge.asKey(n.otKey)];case 2:return r=l.sent(),e=Object.assign(Object.assign({},e),{initiatorRootKeyCipherClearJson:n}),(i=e.otk).initiatorOneTimePbkCipher?(o=(a=Object).assign,s=[Object.assign({},i)],u={},c=this.decryptResponseCipher,p=[r],[4,ge.asKey(n.oneTimePrk)]):[3,5];case 3:return[4,c.apply(this,p.concat([l.sent(),i.initiatorOneTimePbkCipher]))];case 4:i=o.apply(a,s.concat([(u.initiatorOneTimePbkCipherClearJson=l.sent(),u)])),l.label=5;case 5:return i.otKeyCipher?(d=i,[4,this.encryptionService.decrypt(r,i.otKeyCipher)]):[3,7];case 6:d.otKeyCipherClearJson=l.sent(),l.label=7;case 7:return[2,Object.assign(Object.assign({},e),{otk:i})]}}))}))},t.prototype.decryptKeyExchangeAsResponder=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.decryptOtk(e,t)]}))}))},t.prototype.decryptKeyExchange=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return e.isInitiator?[2,this.decryptKeyExchangeAsInitiator(e)]:[2,this.decryptKeyExchangeAsResponder(e,t)]}))}))},t.prototype.getKeyExchanges=function(e){var t=(void 0===e?{}:e).state;return A(this,void 0,void 0,(function(){var e,n=this;return T(this,(function(r){switch(r.label){case 0:return[4,this.query({query:ln,variables:{state:t}})];case 1:return e=r.sent().keyExchanges,[2,Promise.all(e.edges.map((function(e){return n.decryptKeyExchange(e.node)})))]}}))}))},t.prototype.getKeyExchange=function(e,t){var n=void 0===t?{}:t,r=n.otKeyK,i=n.token;return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.query({query:i?yn:hn,variables:{id:e,token:i},includeKeyGraph:!i})];case 1:return t=n.sent(),[2,this.decryptKeyExchange(t.keyExchange,r)]}}))}))},t.prototype.getCurrentUserSharedKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.query({query:Cn,variables:{username:e.username,userId:e.userId}})]}))}))},t.prototype.cancelKeyExchange=function(e){return this.mutate(this.cancelKeyExchangeMutation(e))},t.prototype.cancelKeyExchangeMutation=function(e){return new dt({mutation:fn,variables:{input:{id:e}}})},t.prototype.declineKeyExchange=function(e,t){return this.mutate(this.declineKeyExchangeMutation(e,t))},t.prototype.declineKeyExchangeMutation=function(e,t){return new dt({mutation:vn,variables:{input:{id:e,token:t}}})},t.prototype.initiateOtk=function(e){return void 0===e&&(e={}),A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return t=this.mutate,[4,this.initiateOtkMutation(e)];case 1:return[2,t.apply(this,[n.sent().lrMutation])]}}))}))},t.prototype.initiateOtkMutation=function(e){var t=void 0===e?{}:e,n=t.message,r=t.email,i=t.contactCard,a=t.upgrade;return A(this,void 0,void 0,(function(){var e,t,o,s,u,c,p,d,l,h,y,f,v;return T(this,(function(m){switch(m.label){case 0:return[4,this.keyFactory.createKey()];case 1:return e=m.sent(),t=this.keyFactory.randomString(this.CLIENT_NONCE_LENGTH),[4,this.keyFactory.createPkcKey()];case 2:return o=m.sent(),s=this.keyService.currentPxk,u=this.keyService.currentSigPxk,c=null,i&&i.ownerPlainDataJson?[4,this.encryptionService.signToString(u.jwk,i.ownerPlainDataJson)]:[3,4];case 3:c=m.sent(),m.label=4;case 4:return p={message:n,contactCard:i&&{sharedCipherDataClearJson:i.sharedCipherDataClearJson}},d={nonce:t,initiator:Object.assign(Object.assign({},p),{oneTimePbk:o.toJSON(),pbk:s.jwk.toJSON(),sigPbk:u.jwk.toJSON()})},[4,this.keyGraph.encryptToString(e,d)];case 5:return l=m.sent(),h={nonce:t,oneTimePrk:o.toJSON(!0),otKey:e.toJSON(!0),initiatorContactCard:i,initiator:p},y=this.keyService.currentRootKey,[4,this.keyGraph.encryptToString(y.jwk,h)];case 6:return f=m.sent(),v=e.toJSON(!0).k,[2,{lrMutation:new dt({mutation:mn,variables:{input:{initiatorRootKeyCipher:f,initiatorPxkId:s.id,initiatorSigPxkId:u.id,otKeyParams:JSON.stringify(e.toJSON()),otKeyCipher:l,sendEmail:r&&{email:r,rawOtKey:v},createTp:!0,initiatorPlainDataSig:c,upgrade:a}}}),otKeyK:v}]}}))}))},t.prototype.respondOtk=function(e){return this.mutate(this.respondOtkMutation(e))},t.prototype.respondOtkMutation=function(e){var t=e.keyExchangeId,n=e.token,r=e.decryptedOtk,i=e.message,a=e.initiatorContactCard,o=e.responderContactCard;return A(this,void 0,void 0,(function(){var e,s,u,c,p,d,l,h,y,f,v,m,g,S,C,I,b,w,K,P,k,D,R,E,M,A,O,j,N,F,$,_,L,U,x,q,J,G,Q,V,W,B,Z,H,Y,X,z,ee;return T(this,(function(T){switch(T.label){case 0:return e=this.keyService.currentRootKey,s=this.keyService.currentMasterKey,[4,this.keyFactory.createKey()];case 1:return u=T.sent(),[4,this.keyFactory.createKey()];case 2:return c=T.sent(),[4,this.encryptionService.encrypt(e.jwk,u.toJSON(!0))];case 3:return p=T.sent(),[4,this.encryptionService.encrypt(s.jwk,c.toJSON(!0))];case 4:return d=T.sent(),[4,ge.asKey(r.otKeyCipherClearJson.initiator.oneTimePbk)];case 5:return l=T.sent(),[4,ge.asKey(r.otKeyCipherClearJson.initiator.pbk)];case 6:return h=T.sent(),[4,ge.asKey(r.otKeyCipherClearJson.initiator.sigPbk)];case 7:return y=T.sent(),f=this.keyService.currentPxk,v=this.keyService.currentSigPxk,[4,this.encryptionService.sign(v.jwk,h.toJSON())];case 8:return m=T.sent(),[4,this.encryptionService.sign(v.jwk,y.toJSON())];case 9:return g=T.sent(),S={nonce:r.otKeyCipherClearJson.nonce,sharedKey:u.toJSON(!0),mkSharedKey:c.toJSON(!0),responder:{pbk:f.jwk.toJSON(),sigPbk:v.jwk.toJSON(),message:i}},r.otKeyCipherClearJson.initiator.contactCard?(I=r.otKeyCipherClearJson.initiator.contactCard.sharedCipherDataClearJson,[4,this.keyFactory.createKey()]):[3,19];case 10:return b=T.sent(),[4,this.keyFactory.createKey()];case 11:return $=T.sent(),_=this.keyService.currentSigPxk,w={},P=(K=JSON).stringify,[4,this.encryptionService.encrypt(e.jwk,b.toJSON(!0))];case 12:return w.receiverWrappedKey=P.apply(K,[T.sent()]),w.receiverWrappingKeyId=e.id,a?(R=(D=JSON).stringify,[4,this.encryptionService.encrypt(b,a.receiverCipherDataClearJson)]):[3,14];case 13:return k=R.apply(D,[T.sent()]),[3,15];case 14:k="",T.label=15;case 15:return w.receiverCipherData=k,M=(E=JSON).stringify,[4,this.encryptionService.encrypt(u,$.toJSON(!0))];case 16:return w.sharedWrappedKey=M.apply(E,[T.sent()]),C=w,[4,this.encryptionService.encrypt($,I)];case 17:return W=T.sent(),A=C,j=(O=JSON).stringify,[4,this.encryptionService.sign(_.jwk,W)];case 18:A.sharedCipherDataSig=j.apply(O,[T.sent()]),C.sigPxkId=_.id,S.responder.contactCard=Object.assign(Object.assign({},S.responder.contactCard),{sharedCipherKey:$.toJSON(!0)}),T.label=19;case 19:return o?[4,this.keyFactory.createKey()]:[3,31];case 20:return F=T.sent(),[4,this.keyFactory.createKey()];case 21:return $=T.sent(),_=this.keyService.currentSigPxk,L={},x=(U=JSON).stringify,[4,this.encryptionService.encrypt(e.jwk,F.toJSON(!0))];case 22:return L.ownerWrappedKey=x.apply(U,[T.sent()]),L.ownerWrappingKeyId=e.id,o.ownerCipherDataClearJson?(G=(J=JSON).stringify,[4,this.encryptionService.encrypt(F,o.ownerCipherDataClearJson)]):[3,24];case 23:return q=G.apply(J,[T.sent()]),[3,25];case 24:q="",T.label=25;case 25:return L.ownerCipherData=q,V=(Q=JSON).stringify,[4,this.encryptionService.encrypt(u,$.toJSON(!0))];case 26:return L.sharedWrappedKey=V.apply(Q,[T.sent()]),N=L,[4,this.encryptionService.encrypt($,o.sharedCipherDataClearJson)];case 27:return W=T.sent(),B=N,H=(Z=JSON).stringify,[4,this.encryptionService.sign(_.jwk,W)];case 28:return B.sharedCipherDataSig=H.apply(Z,[T.sent()]),N.sigPxkId=_.id,o.ownerPlainDataJson?(Y=N,z=(X=JSON).stringify,[4,this.encryptionService.sign(v.jwk,o.ownerPlainDataJson)]):[3,30];case 29:Y.ownerPlainDataSig=z.apply(X,[T.sent()]),T.label=30;case 30:S.responder.contactCard=Object.assign(Object.assign({},S.responder.contactCard),{sharedCipherDataClearJson:o.sharedCipherDataClearJson}),T.label=31;case 31:return[4,this.encryptionService.encrypt(l,S)];case 32:return ee=T.sent(),[4,this.encryptionService.encrypt(r.otKey,ee)];case 33:return ee=T.sent(),[2,new dt({mutation:gn,variables:{input:{keyExchangeId:t,keyExchangeToken:n,rootKeyId:e.id,masterKeyId:s.id,responderPxkId:f.id,responderSigPxkId:v.id,signedInitiatorPbk:JSON.stringify(m),signedInitiatorSigPbk:JSON.stringify(g),rkWrappedSharedKey:JSON.stringify(p),mkWrappedMkSharedKey:JSON.stringify(d),initiatorOneTimePbkCipher:JSON.stringify(ee),initiatorContactCard:C,responderContactCard:N}}})]}}))}))},t.prototype.completeOtk=function(e){return this.mutate(this.completeOtkMutation(e))},t.prototype.completeOtkMutation=function(e){var t=e.keyExchangeId,n=e.initiatorRootKeyCipher,r=e.initiatorOneTimePbkCipher,i=e.responderContactCard,a=e.initiatorContactCard;return A(this,void 0,void 0,(function(){var e,o,s,u,c,p,d,l,h,y,f,v,m,g,S,C,I,b,w,K,P,k,D,R,E,M,A,O,j,N,F,$,_,L,U,x,q;return T(this,(function(T){switch(T.label){case 0:return e=this.keyService.currentRootKey,o=this.keyService.currentMasterKey,[4,this.encryptionService.decrypt(e.jwk,n)];case 1:return s=T.sent(),c=this.decryptResponseCipher,[4,ge.asKey(s.otKey)];case 2:return p=[T.sent()],[4,ge.asKey(s.oneTimePrk)];case 3:return[4,c.apply(this,p.concat([T.sent(),r]))];case 4:if(u=T.sent(),s.nonce!==u.nonce)throw new Y("The nonce returned by responder does not match with the one created by the initiator.");return d=this.keyService.currentSigPxk,[4,ge.asKey(u.responder.sigPbk)];case 5:return l=T.sent(),[4,ge.asKey(u.responder.pbk)];case 6:return h=T.sent(),[4,this.encryptionService.sign(d.jwk,h.toJSON())];case 7:return y=T.sent(),[4,this.encryptionService.sign(d.jwk,l.toJSON())];case 8:return f=T.sent(),[4,ge.asKey(u.sharedKey)];case 9:return v=T.sent(),[4,this.encryptionService.encrypt(e.jwk,v.toJSON(!0))];case 10:return m=T.sent(),[4,ge.asKey(u.mkSharedKey)];case 11:return g=T.sent(),[4,this.encryptionService.encrypt(o.jwk,g.toJSON(!0))];case 12:return S=T.sent(),i?[4,this.keyFactory.createKey()]:[3,16];case 13:return I=T.sent(),b={},K=(w=JSON).stringify,[4,this.encryptionService.encrypt(e.jwk,I.toJSON(!0))];case 14:return b.receiverWrappedKey=K.apply(w,[T.sent()]),b.receiverWrappingKeyId=e.id,k=(P=JSON).stringify,[4,this.encryptionService.encrypt(I,i.receiverCipherDataClearJson)];case 15:b.receiverCipherData=k.apply(P,[T.sent()]),C=b,T.label=16;case 16:return s.initiatorContactCard?(E=s.initiatorContactCard,[4,this.keyFactory.createKey()]):[3,25];case 17:return M=T.sent(),[4,ge.asKey(u.responder.contactCard.sharedCipherKey)];case 18:return A=T.sent(),N=(j=JSON).stringify,[4,this.encryptionService.encrypt(e.jwk,M.toJSON(!0))];case 19:return O=N.apply(j,[T.sent()]),(F=(null==a?void 0:a.ownerCipherDataClearJson)||E.ownerCipherDataClearJson)?[4,this.keyGraph.encryptToString(M,F)]:[3,21];case 20:return _=T.sent(),[3,22];case 21:_="",T.label=22;case 22:return $=_,D={ownerWrappedKey:O,ownerWrappingKeyId:e.id,ownerCipherData:$},R={sigPxkId:d.id},[4,this.encryptionService.encrypt(A,E.sharedCipherDataClearJson)];case 23:return L=T.sent(),U=R,q=(x=JSON).stringify,[4,this.encryptionService.sign(d.jwk,L)];case 24:U.sharedCipherDataSig=q.apply(x,[T.sent()]),T.label=25;case 25:return[2,new dt({mutation:Sn,variables:{input:{keyExchangeId:t,rootKeyId:e.id,masterKeyId:o.id,initiatorSigPxkId:d.id,signedResponderPbk:JSON.stringify(y),signedResponderSigPbk:JSON.stringify(f),rkWrappedSharedKey:JSON.stringify(m),mkWrappedMkSharedKey:JSON.stringify(S),responderContactCardCipher:C,initiatorContactCardCipher:D,initiatorContactCardSharedCipher:R}}})]}}))}))},t}(Ft),e.KeyExchangeService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.KeyExchangeService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(ge),t.ɵɵinject(Ke),t.ɵɵinject(ve),t.ɵɵinject(Pe))},token:e.KeyExchangeService,providedIn:"root"}),e.KeyExchangeService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.KeyExchangeService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:ge},{type:Ke},{type:ve},{type:Pe}]},e.KeyExchangeService=M([et({ngZoneName:"ngZone"})],e.KeyExchangeService);var Yi="LBOP";(e.KcLbopErrorCode||(e.KcLbopErrorCode={})).INVALID_PASSPHRASE="INVALID_PASSPHRASE";var Xi,zi,ea,ta,na,ra=K.default(Xi||(Xi=F(["\n mutation CreateLbop($input: CreateLbopInput!) {\n createLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"],["\n mutation CreateLbop($input: CreateLbopInput!) {\n createLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"]))),ia=K.default(zi||(zi=F(["\n mutation DeleteLbop($input: DeleteLbopInput!) {\n deleteLbop(input: $input) {\n id\n }\n }\n"],["\n mutation DeleteLbop($input: DeleteLbopInput!) {\n deleteLbop(input: $input) {\n id\n }\n }\n"]))),aa=K.default(ea||(ea=F(["\n mutation UpdateLbop($input: UpdateLbopInput!) {\n updateLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"],["\n mutation UpdateLbop($input: UpdateLbopInput!) {\n updateLbop(input: $input) {\n lbop {\n id\n }\n }\n }\n"]))),oa=K.default(ta||(ta=F(["\n query Lbop($id: LrRelayIdInput!) {\n lbop(id: $id) {\n id\n cipherMeta\n }\n }\n"],["\n query Lbop($id: LrRelayIdInput!) {\n lbop(id: $id) {\n id\n cipherMeta\n }\n }\n"]))),sa=K.default(na||(na=F(["\n query Lbops {\n lbops {\n edges {\n node {\n id\n cipherMeta\n }\n }\n }\n }\n"],["\n query Lbops {\n lbops {\n edges {\n node {\n id\n cipherMeta\n }\n }\n }\n }\n"]))),ua=function(){function t(e,t,n,r,i,a,o,s){this.config=e,this.http=t,this.lrApollo=n,this.auth=r,this.keyFactory=i,this.keyService=a,this.encryptionService=o,this.passwordService=s,this.CLIENT_NONCE_LENGTH=32,this.LBOP_WORDS=25}return t.prototype.getPartial=function(e){return e.split(" ")[0]},t.prototype.remove=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.lrApollo.mutate({mutation:ia,variables:{input:{id:e}}})];case 1:return[2,t.sent().deleteLbop.id]}}))}))},t.prototype.update=function(e){var t=e.id,n=e.name;return A(this,void 0,void 0,(function(){var e,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.get(t)];case 1:return(e=a.sent()).name=n,r=this.keyService.currentMasterKey,[4,this.encryptionService.encrypt(r.jwk,e)];case 2:return i=a.sent(),[4,this.lrApollo.mutate({mutation:aa,variables:{input:{id:t,cipherMeta:JSON.stringify(i)}}})];case 3:return[2,a.sent().updateLbop]}}))}))},t.prototype.get=function(e){return A(this,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.lrApollo.query({query:oa,variables:{id:e}})];case 1:return t=i.sent(),n=this.keyService.currentMasterKey,[4,this.encryptionService.decrypt(n.jwk,JSON.parse(t.lbop.cipherMeta))];case 2:return r=i.sent(),[2,Object.assign({id:t.id},r)]}}))}))},t.prototype.list=function(){return A(this,void 0,void 0,(function(){var e,t,n=this;return T(this,(function(r){switch(r.label){case 0:return[4,this.lrApollo.query({query:sa})];case 1:return e=r.sent(),[4,this.keyService.currentMasterKey];case 2:return t=r.sent(),[2,Promise.all(e.lbops.edges.map((function(e){return A(n,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,this.encryptionService.decrypt(t.jwk,JSON.parse(e.node.cipherMeta))];case 1:return n=r.sent(),[2,Object.assign({id:e.node.id},n)]}}))}))})))]}}))}))},t.prototype.create=function(e){var t=e.name;return A(this,void 0,void 0,(function(){var e,n,r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,S;return T(this,(function(C){switch(C.label){case 0:if(1024!==g.Slip39Helper.WORD_LIST.length)throw new V("Slip39Helper.WORD_LIST.length != 1024");return[4,this.list()];case 1:for(e=C.sent(),r=function(){n=i.keyFactory.randomChoices(g.Slip39Helper.WORD_LIST,i.LBOP_WORDS).join(" ");var t=i.getPartial(n);if(!e.some((function(e){return e.partial===t})))return"break"},i=this;"break"!==r(););return[4,this.keyFactory.createLbopKeyParams()];case 2:return a=C.sent(),u=(s=this.keyFactory).deriveLbopKey,p=(c=Object).assign,d={},[4,this.keyFactory.importPassword(n)];case 3:return[4,u.apply(s,[p.apply(c,[(d.password=C.sent(),d),a])])];case 4:return o=C.sent().jwk,[4,this.keyFactory.createSignKey()];case 5:return l=C.sent(),[4,this.encryptionService.encrypt(o,l.toJSON(!0))];case 6:return h=C.sent(),y=this.keyService.currentMasterKey,[4,this.encryptionService.encrypt(o,y.jwk.toJSON(!0))];case 7:return f=C.sent(),v=Object.assign(Object.assign({},t&&{name:t}),{partial:this.getPartial(n)}),[4,this.encryptionService.encrypt(y.jwk,v)];case 8:return m=C.sent(),[4,this.lrApollo.mutate({mutation:ra,variables:{input:{cipherMeta:JSON.stringify(m),lbopKeyParams:JSON.stringify(a),lbopKeyVerifier:JSON.stringify(l.toJSON(!0)),wrappedLbopKeyVerifier:JSON.stringify(h),masterKeyId:y.id,wrappedMasterKey:JSON.stringify(f)}}})];case 9:return S=C.sent(),[2,Object.assign(Object.assign({},S.createLbop.lbop),{lbopString:n})]}}))}))},t.prototype.verifyLbops=function(t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,g;return T(this,(function(S){switch(S.label){case 0:r=this.keyFactory.randomString(this.CLIENT_NONCE_LENGTH),S.label=1;case 1:S.trys.push([1,11,12,13]),i=O(t.lbops),a=i.next(),S.label=2;case 2:return a.done?[3,10]:(o=a.value,c=(u=this.keyFactory).deriveLbopKey,d=(p=Object).assign,l={},[4,this.keyFactory.importPassword(n)]);case 3:return[4,c.apply(u,[d.apply(p,[(l.password=S.sent(),l),o.lbopKeyParams])])];case 4:s=S.sent().jwk,S.label=5;case 5:return S.trys.push([5,8,,9]),[4,this.encryptionService.decrypt(s,o.wrappedLbopKeyVerifier)];case 6:return h=S.sent(),y=t.challenge.serverNonce,[4,this.encryptionService.sign(h,{serverNonce:y,clientNonce:r})];case 7:return f=S.sent(),[2,{lbop:o,signedChallenge:f,lbopKey:s}];case 8:return S.sent(),[3,9];case 9:return a=i.next(),[3,2];case 10:return[3,13];case 11:return v=S.sent(),m={error:v},[3,13];case 12:try{a&&!a.done&&(g=i.return)&&g.call(i)}finally{if(m)throw m.error}return[7];case 13:throw new J(new q({source:Yi,code:e.KcLbopErrorCode.INVALID_PASSPHRASE,message:"Invalid passphrase."}))}}))}))},t.prototype.verifyContact=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.http.post(this.config.authUrl+"users/lbop-reset/verify-contact/",e).toPromise()]}))}))},t.prototype.confirmContact=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.http.post(this.config.authUrl+"cove/respond/",{claim_id:e.claimId,v_code:e.vCode}).toPromise()]}))}))},t.prototype.verify=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return[4,this.http.post(this.config.authUrl+"users/lbop-reset/get-challenge/",{claimId:e.claimId,claimToken:e.claimToken}).toPromise()];case 1:return t=p.sent(),[4,this.verifyLbops(t,e.lbop)];case 2:return n=p.sent(),r=n.signedChallenge,i=n.lbop,a=n.lbopKey,[4,this.http.post(this.config.authUrl+"users/lbop-reset/verify-challenge/",{lbopId:i.lbopId,signedChallenge:r}).toPromise()];case 3:return o=p.sent(),s={lbopId:i.lbopId,verifiedToken:o.verifiedToken,masterKeyId:o.masterKeyId},c=(u=ge).asKey,[4,this.encryptionService.decrypt(a,o.wrappedMasterKey)];case 4:return[4,c.apply(u,[p.sent()])];case 5:return[2,(s.masterKey=p.sent(),s)]}}))}))},t.prototype.setPassword=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.passwordService.createPassKeyBundle(e.newPassword)];case 1:return t=a.sent(),[4,this.encryptionService.encrypt(t.passKey,e.masterKey.toJSON(!0))];case 2:return n=a.sent(),[4,this.http.post(this.config.authUrl+"users/lbop-reset/set-password/",{lbopId:e.lbopId,verifiedToken:e.verifiedToken,masterKeyId:e.masterKeyId,newWrappedMasterKey:n,newPassKey:{passKeyParams:t.passKeyParams,passIdpParams:t.passIdpParams,passIdpVerifierPbk:t.passIdpVerifier.toJSON(),wrappedPassIdpVerifierPrk:t.wrappedPassIdpVerifierPrk}}).toPromise()];case 3:return r=a.sent(),[4,this.auth.signIn(r.username,r.idpPassword,{noProxy:"true"})];case 4:if("NEW_PASSWORD_REQUIRED"!==(i=a.sent()).challengeName)throw new ee("Expecting Cognito to have done a password reset.");return[4,this.auth.completeNewPassword(i,this.passwordService.getPassIdpString(t.passIdp),{})];case 5:return i=a.sent(),[4,this.auth.signOut()];case 6:return a.sent(),[4,this.http.post(this.config.authUrl+"users/lbop-reset/complete/",{lbopId:e.lbopId,setPasswordToken:r.setPasswordToken}).toPromise()];case 7:return[2,a.sent()]}}))}))},t}();ua.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new ua(t.ɵɵinject(Se),t.ɵɵinject(y.HttpClient),t.ɵɵinject(ke),t.ɵɵinject(o.AuthClass),t.ɵɵinject(ge),t.ɵɵinject(Ke),t.ɵɵinject(ve),t.ɵɵinject(or))},token:ua,providedIn:"root"}),ua.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],ua.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:y.HttpClient},{type:ke},{type:o.AuthClass},{type:ge},{type:Ke},{type:ve},{type:or}]};var ca=function(){function e(){}return e.forRoot=function(r){return{ngModule:e,providers:[{provide:Se,useValue:r},{provide:o.AuthClass,useValue:k.default},{provide:t.APP_INITIALIZER,useFactory:Ut,deps:[Se,o.AuthClass],multi:!0},{provide:n.APOLLO_OPTIONS,useFactory:be,deps:[Se,o.AuthClass]}]}},e}();ca.decorators=[{type:t.NgModule,args:[{imports:[y.HttpClientModule,m.NgIdleKeepaliveModule.forRoot()]}]}];var pa,da,la,ha,ya,fa=Oe(pa||(pa=F(["\nmutation UpdateNotificationMutation($input: UpdateNotificationInput!) {\n updateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"],["\nmutation UpdateNotificationMutation($input: UpdateNotificationInput!) {\n updateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"]))),va=Oe(da||(da=F(["\nmutation UpdateAllNotificationsReadStateMutation($input: UpdateAllNotificationsReadStateInput!) {\n updateAllNotificationsReadState(input: $input) {\n count\n }\n}\n"],["\nmutation UpdateAllNotificationsReadStateMutation($input: UpdateAllNotificationsReadStateInput!) {\n updateAllNotificationsReadState(input: $input) {\n count\n }\n}\n"]))),ma=Oe(la||(la=F(["\nmutation DebugCreateNotificationMutation($input: DebugCreateNotificationInput!) {\n debugCreateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"],["\nmutation DebugCreateNotificationMutation($input: DebugCreateNotificationInput!) {\n debugCreateNotification(input: $input) {\n notification {\n id\n }\n }\n}\n"]))),ga=Oe(ha||(ha=F(["\nmutation DebugDeleteAllNotificationsMutation($input: DebugDeleteAllNotificationsInput!) {\n debugDeleteAllNotifications(input: $input) {\n count\n }\n}\n"],["\nmutation DebugDeleteAllNotificationsMutation($input: DebugDeleteAllNotificationsInput!) {\n debugDeleteAllNotifications(input: $input) {\n count\n }\n}\n"]))),Sa=Oe(ya||(ya=F(["\nmutation UpdateNotificationFeatureStateMutation($input: UpdateNotificationFeatureStateInput!) {\n updateNotificationFeatureState(input: $input) {\n featureState {\n notificationsLastViewed\n\t\t}\n }\n}\n"],["\nmutation UpdateNotificationFeatureStateMutation($input: UpdateNotificationFeatureStateInput!) {\n updateNotificationFeatureState(input: $input) {\n featureState {\n notificationsLastViewed\n\t\t}\n }\n}\n"])));e.NotificationService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.updateNotification=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateNotificationMutation(e))]}))}))},t.prototype.updateNotificationMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:fa,variables:{input:Object.assign({},e)}})]}))}))},t.prototype.updateAllNotificationsReadState=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateAllNotificationsReadStateMutation(e))]}))}))},t.prototype.updateAllNotificationsReadStateMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:va,variables:{input:Object.assign({},e)}})]}))}))},t.prototype.debugCreateNotification=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.debugCreateNotificationMutation(e))]}))}))},t.prototype.debugCreateNotificationMutation=function(e){var t;return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,new dt({mutation:ma,variables:{input:{receiverId:e.receiverId,hasBeenRead:e.hasBeenRead,timeRead:null===(t=e.timeRead)||void 0===t?void 0:t.toISOString(),plainData:JSON.stringify(e.plainData),plainMeta:JSON.stringify(e.plainMeta)}}})]}))}))},t.prototype.debugDeleteAllNotifications=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.debugDeleteAllNotificationsMutation(e))]}))}))},t.prototype.debugDeleteAllNotificationsMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:ga,variables:{input:{receiverId:e.receiverId}}})]}))}))},t.prototype.updateNotificationFeatureState=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateNotificationFeatureStateMutation(e))]}))}))},t.prototype.updateNotificationFeatureStateMutation=function(e){var t;return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,new dt({mutation:Sa,variables:{input:{lastViewed:null===(t=e.lastViewed)||void 0===t?void 0:t.toISOString(),clearLastViewed:null==e.lastViewed||void 0}}})]}))}))},t}(Ft),e.NotificationService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.NotificationService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.NotificationService,providedIn:"root"}),e.NotificationService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.NotificationService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.NotificationService=M([et({ngZoneName:"ngZone"})],e.NotificationService);var Ca,Ia,ba,wa,Ka,Pa,ka,Da,Ra,Ea,Ma=Oe(Ca||(Ca=F(["\nmutation InitiateStripePaymentMethodCaptureMutation {\n initiateStripePaymentMethodCapture(input: {}) {\n paymentCapture {\n stripeIntentId\n stripeClientSecret\n }\n }\n}\n"],["\nmutation InitiateStripePaymentMethodCaptureMutation {\n initiateStripePaymentMethodCapture(input: {}) {\n paymentCapture {\n stripeIntentId\n stripeClientSecret\n }\n }\n}\n"]))),Aa=Oe(Ia||(Ia=F(["\nmutation CompleteStripePaymentMethodCaptureMutation($input: CompleteStripePaymentMethodCaptureInput!) {\n completeStripePaymentMethodCapture(input: $input) {\n paymentMethod {\n id\n created\n modified\n card {\n brand\n lastFourDigits\n expiryYear\n expiryMonth\n }\n isDefault \n }\n }\n}\n"],["\nmutation CompleteStripePaymentMethodCaptureMutation($input: CompleteStripePaymentMethodCaptureInput!) {\n completeStripePaymentMethodCapture(input: $input) {\n paymentMethod {\n id\n created\n modified\n card {\n brand\n lastFourDigits\n expiryYear\n expiryMonth\n }\n isDefault \n }\n }\n}\n"]))),Ta=Oe(ba||(ba=F(["\nmutation RemovePaymentMethodMutation($input: RemovePaymentMethodInput!) {\n removePaymentMethod(input: $input) {\n id\n }\n}\n"],["\nmutation RemovePaymentMethodMutation($input: RemovePaymentMethodInput!) {\n removePaymentMethod(input: $input) {\n id\n }\n}\n"]))),Oa=Oe(wa||(wa=F(["\nmutation SetDefaultPaymentMethodMutation($input: SetDefaultPaymentMethodInput!) {\n setDefaultPaymentMethod(input: $input) {\n paymentMethod {\n id\n } \n }\n}\n"],["\nmutation SetDefaultPaymentMethodMutation($input: SetDefaultPaymentMethodInput!) {\n setDefaultPaymentMethod(input: $input) {\n paymentMethod {\n id\n } \n }\n}\n"]))),ja=Oe(Ka||(Ka=F(["\nmutation RemoveDefaultPaymentMethodMutation {\n removeDefaultPaymentMethod(input: {}) {\n paymentMethod {\n id\n } \n }\n}\n"],["\nmutation RemoveDefaultPaymentMethodMutation {\n removeDefaultPaymentMethod(input: {}) {\n paymentMethod {\n id\n } \n }\n}\n"]))),Na=Oe(Pa||(Pa=F(["\nmutation IssuePlanMutation($input: IssuePlanInput!) {\n issuePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"],["\nmutation IssuePlanMutation($input: IssuePlanInput!) {\n issuePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"]))),Fa=Oe(ka||(ka=F(["\nmutation CancelPlanMutation($input: CancelPlanInput!) {\n cancelPlan(input: $input) {\n plan {\n id\n } \n }\n}\n"],["\nmutation CancelPlanMutation($input: CancelPlanInput!) {\n cancelPlan(input: $input) {\n plan {\n id\n } \n }\n}\n"]))),$a=Oe(Da||(Da=F(["\nmutation ChangePriceOptionMutation($input: ChangePriceOptionInput!) {\n changePriceOption(input: $input) {\n plan {\n id\n }\n }\n}\n"],["\nmutation ChangePriceOptionMutation($input: ChangePriceOptionInput!) {\n changePriceOption(input: $input) {\n plan {\n id\n }\n }\n}\n"]))),_a=Oe(Ra||(Ra=F(["\nmutation ReactivatePlanMutation($input: ReactivatePlanInput!) {\n reactivatePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"],["\nmutation ReactivatePlanMutation($input: ReactivatePlanInput!) {\n reactivatePlan(input: $input) {\n plan {\n id\n }\n }\n}\n"])));e.PlanService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.initiateStripePaymentMethodCapture=function(){return this.mutate(this.initiateStripePaymentMethodCaptureMutation())},t.prototype.initiateStripePaymentMethodCaptureMutation=function(){return new dt({mutation:Ma,variables:{input:{}}})},t.prototype.completeStripePaymentMethodCapture=function(e){return this.mutate(this.completeStripePaymentMethodCaptureMutation(e))},t.prototype.completeStripePaymentMethodCaptureMutation=function(e){return new dt({mutation:Aa,variables:{input:{stripeIntentId:e}}})},t.prototype.setDefaultPaymentMethod=function(e){return this.mutate(this.setDefaultPaymentMethodMutation(e))},t.prototype.setDefaultPaymentMethodMutation=function(e){return new dt({mutation:Oa,variables:{input:{paymentMethodId:e}}})},t.prototype.removeDefaultPaymentMethod=function(){return this.mutate(this.removeDefaultPaymentMethodMutation())},t.prototype.removeDefaultPaymentMethodMutation=function(){return new dt({mutation:ja,variables:{input:{}}})},t.prototype.issuePlan=function(e){return this.mutate(this.issuePlanMutation(e))},t.prototype.issuePlanMutation=function(e){return new dt({mutation:Na,variables:{input:e}})},t.prototype.removePaymentMethod=function(e){return this.mutate(this.removePaymentMethodMutation(e))},t.prototype.removePaymentMethodMutation=function(e){return new dt({mutation:Ta,variables:{input:{paymentMethodId:e}}})},t.prototype.cancelPlan=function(e){return this.mutate(this.cancelPlanMutation(e))},t.prototype.cancelPlanMutation=function(e){return new dt({mutation:Fa,variables:{input:e}})},t.prototype.changePriceOption=function(e){return this.mutate(this.changePriceOptionMutation(e))},t.prototype.changePriceOptionMutation=function(e){return new dt({mutation:$a,variables:{input:e}})},t.prototype.reactivatePlan=function(e){return this.mutate(this.reactivatePlanMutation(e))},t.prototype.reactivatePlanMutation=function(e){return new dt({mutation:_a,variables:{input:{planId:e}}})},t}(Ft),e.PlanService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.PlanService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.PlanService,providedIn:"root"}),e.PlanService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.PlanService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.PlanService=M([et({ngZoneName:"ngZone"})],e.PlanService),function(e){e.Name="name",e.Email="email",e.Image="image",e.Phone="phone",e.Address="address"}(Ea||(Ea={}));var La=[Ea.Name,Ea.Email,Ea.Image,Ea.Phone,Ea.Address],Ua=function(){function t(e,t,n){this.sharedContactCardService=e,this.profileService=t,this.api=n}return t.prototype.updateDetails=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return console.log("updateDetails()"),[4,this.fetchMainContactCard()];case 1:return t=r.sent(),[4,this.profileService.updateDetails(null==t?void 0:t.id,null==t?void 0:t.keyId,e)];case 2:return n=r.sent(),[4,this.synchronizeContactCards(e,null==t?void 0:t.fields)];case 3:return r.sent(),[2,n]}}))}))},t.prototype.updateTrustedPartyDetails=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return t=e.id,n=e.ownedKeyId,r=e.sharedKeyId,i=E(e,["id","ownedKeyId","sharedKeyId"]),[4,this.sharedContactCardService.updateMySharedContactCard(t,n,r,i)];case 1:return a.sent(),[4,this.synchronizeSharedDetails(e)];case 2:return a.sent(),[2]}}))}))},t.prototype.synchronizeSharedDetails=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d,l,h;return T(this,(function(y){switch(y.label){case 0:return t=!1,[4,this.fetchMainContactCard()];case 1:if(n=y.sent(),e.name&&(c=this.checkField(e.name,n.fields.name))&&(n.fields.name=c,t=!0),e.email&&(c=this.checkField(e.email,n.fields.email))&&(n.fields.email=c,t=!0),e.image&&(c=this.checkField(e.image,n.fields.image))&&(n.fields.image=c,t=!0),e.phones&&e.phones.length)try{for(r=O(e.phones),i=r.next();!i.done;i=r.next())a=i.value,(c=this.checkField(a.value,n.fields.phone,a.label))&&(n.fields.phone=c,t=!0)}catch(e){p={error:e}}finally{try{i&&!i.done&&(d=r.return)&&d.call(r)}finally{if(p)throw p.error}}if(e.addresses&&e.addresses.length)try{for(o=O(e.addresses),s=o.next();!s.done;s=o.next())u=s.value,(c=this.checkField(u.value,n.fields.address,u.label))&&(n.fields.address=c,t=!0)}catch(e){l={error:e}}finally{try{s&&!s.done&&(h=o.return)&&h.call(o)}finally{if(l)throw l.error}}return t?[4,this.profileService.updateDetails(n.id,n.keyId,n.fields)]:[3,3];case 2:y.sent(),y.label=3;case 3:return[2]}}))}))},t.prototype.fetchMainContactCard=function(){var e;return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.api.query({query:Hn})];case 1:return[2,(t=null===(e=n.sent().contactCards.edges[0])||void 0===e?void 0:e.node)?{id:t.id,keyId:t.key.id,fields:t.cipherDataClearJson}:null]}}))}))},t.prototype.getTrustedParties=function(){return A(this,void 0,void 0,(function(){var e=this;return T(this,(function(t){switch(t.label){case 0:return[4,this.api.query({query:Zn})];case 1:return[2,$t(t.sent().tps).map((function(t){return e.mapTrustedParty(t)}))]}}))}))},t.prototype.mapTrustedParty=function(t){var n,r,i=t.sharedContactCard.sharedCipherDataClearJson,a=Object.assign(Object.assign({},t.myContactCard.sharedCipherDataClearJson),{id:t.myContactCard.id,ownedKeyId:t.myContactCard.ownerKey.id,sharedKeyId:t.myContactCard.sharedKey.id});return{id:t.id,type:e.TrustedPartyType.User,hasScenarios:!!t.sharedScenarios.edges.length,hasSharedVault:!!t.theirItems.directories.edges.length,name:null===(n=null==i?void 0:i.name)||void 0===n?void 0:n.name,details:i,mySharedDetails:a,userSharedKey:t.currentUserSharedKey.userSharedKey,username:t.other.username,features:{sharedVault:{hasAccess:"access"===((null===(r=t.other.features)||void 0===r?void 0:r.shareVault)||["noaccess"])[0]}}}},t.prototype.synchronizeContactCards=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return t?0===(n=this.getChanges(e,t)).length?[2]:[4,this.getTrustedParties()]:[2];case 1:if(0===(r=p.sent()).length)return[2];p.label=2;case 2:p.trys.push([2,7,8,9]),i=O(r.map((function(e){return e.mySharedDetails}))),a=i.next(),p.label=3;case 3:return a.done?[3,6]:(o=a.value,[4,this.synchronizeSharedContactCard(o,n)]);case 4:p.sent(),p.label=5;case 5:return a=i.next(),[3,3];case 6:return[3,9];case 7:return s=p.sent(),u={error:s},[3,9];case 8:try{a&&!a.done&&(c=i.return)&&c.call(i)}finally{if(u)throw u.error}return[7];case 9:return[2]}}))}))},t.prototype.getChanges=function(e,t){var n,r,i,a,o,s=[];try{for(var u=O(La),c=u.next();!c.done;c=u.next()){var p=c.value,d=t[p];if(d&&d.values){var l=function(t){var n=null===(o=e[p].values)||void 0===o?void 0:o.find((function(e){return e.id===t.id}));n?w.default.isEqual(n.value,t.value)||s.push({field:p,id:t.id,label:t.label,oldValue:t.value,newValue:n.value}):s.push({field:p,id:t.id,label:t.label,oldValue:t.value})};try{for(var h=(i=void 0,O(d.values)),y=h.next();!y.done;y=h.next()){l(y.value)}}catch(e){i={error:e}}finally{try{y&&!y.done&&(a=h.return)&&a.call(h)}finally{if(i)throw i.error}}}}}catch(e){n={error:e}}finally{try{c&&!c.done&&(r=u.return)&&r.call(u)}finally{if(n)throw n.error}}return s},t.prototype.synchronizeSharedContactCard=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l;return T(this,(function(h){switch(h.label){case 0:n=!1,r=function(t){switch(t.field){case Ea.Phone:(r=e.phones&&e.phones.find((function(e){return e.label===t.label})))&&(n=!0,r.value=t.newValue);break;case Ea.Address:(r=e.addresses&&e.addresses.find((function(e){return e.label===t.label})))&&(n=!0,r.value=t.newValue);break;default:var r=e[t.field];w.default.isEqual(r,t.oldValue)&&(n=!0,e[t.field]=t.newValue)}};try{for(i=O(t),a=i.next();!a.done;a=i.next())o=a.value,r(o)}catch(e){d={error:e}}finally{try{a&&!a.done&&(l=i.return)&&l.call(i)}finally{if(d)throw d.error}}return n?(s=e.id,u=e.ownedKeyId,c=e.sharedKeyId,p=E(e,["id","ownedKeyId","sharedKeyId"]),[4,this.sharedContactCardService.updateMySharedContactCard(s,u,c,p)]):[3,2];case 1:h.sent(),h.label=2;case 2:return[2]}}))}))},t.prototype.checkField=function(e,t,n){return void 0===n&&(n=null),(t=t||{value:e,hasMultiple:!1}).values=t.values||[],0===t.values.length||t.values.every((function(t){return!w.default.isEqual(e,t.value)}))?(t.values.push({id:n+"-"+(new Date).getTime(),label:n,value:e}),t.hasMultiple=t.values.length>1,t.value=t.value||e,t):null},t}();Ua.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Ua(t.ɵɵinject(Ln),t.ɵɵinject(Yn),t.ɵɵinject(e.ɵg))},token:Ua,providedIn:"root"}),Ua.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Ua.ctorParameters=function(){return[{type:Ln},{type:Yn},{type:e.ɵg}]};var xa=function(){function e(e,t,n,r,i,a){this.config=e,this.auth=t,this.http=n,this.keyFactory=r,this.encryptionService=i,this.passwordService=a}return e.prototype.verifyEmail=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.http.post(this.config.authUrl+"cove/claim/email/",{address:e,context:"signup"}).toPromise()];case 1:return[2,t.sent().claim_id]}}))}))},e.prototype.verifyPhone=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.http.post(this.config.authUrl+"cove/claim/sms/",{address:e,context:"signup"}).toPromise()];case 1:return[2,t.sent().claim_id]}}))}))},e.prototype.confirmVerificationCode=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.http.post(this.config.authUrl+"cove/respond/",{claim_id:e,v_code:t}).toPromise()];case 1:return[2,n.sent().token]}}))}))},e.prototype.register=function(e,t,n,r,i){return void 0===i&&(i="email"),A(this,void 0,void 0,(function(){var a,o,s,u,c,p,d,l,h,y,f,v,m;return T(this,(function(g){switch(g.label){case 0:return[4,this.passwordService.createPassKeyBundle(t)];case 1:return a=g.sent(),[4,this.keyFactory.createKey()];case 2:return o=g.sent(),[4,this.encryptionService.encrypt(a.passKey,o.toJSON(!0))];case 3:return s=g.sent(),[4,this.keyFactory.createKey()];case 4:return u=g.sent(),[4,this.encryptionService.encrypt(o,u.toJSON(!0))];case 5:return c=g.sent(),[4,this.keyFactory.createPkcKey()];case 6:return p=g.sent(),[4,this.encryptionService.encrypt(u,p.toJSON(!0))];case 7:return d=g.sent(),[4,this.keyFactory.createPkcSignKey()];case 8:return l=g.sent(),[4,this.encryptionService.encrypt(u,l.toJSON(!0))];case 9:return h=g.sent(),[4,this.http.post(this.config.authUrl+"users/",{claims:[{type:i,token:r,claim_id:n}],pass_idp_params:a.passIdpParams,pass_idp_verifier_pbk:a.passIdpVerifier.toJSON(),wrapped_pass_idp_verifier_prk:a.wrappedPassIdpVerifierPrk,pass_key_params:a.passKeyParams,wrapped_master_key:s,wrapped_root_key:c,pbk:p.toJSON(),wrapped_prk:d,sig_pbk:l.toJSON(),wrapped_sig_prk:h}).toPromise()];case 10:return y=g.sent(),f={},y.claims.forEach((function(e){f[e.type]=e.value})),v=this.keyFactory.randomDigitsNoZeros(4),[4,this.auth.signUp({username:e.split("@")[0]+"."+v,password:this.passwordService.getPassIdpString(a.passIdp),attributes:f,clientMetadata:{user_id:String(y.id),user_pre_sign_up_token:String(y.pre_sign_up_token)}})];case 11:return[2,{username:(m=g.sent()).user.getUsername(),userId:y.id,preSignUpToken:y.pre_sign_up_token,userSub:m.userSub}]}}))}))},e.prototype.hibpBreachedAccounts=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return n.trys.push([0,2,,3]),[4,this.http.get(this.config.authUrl+"users/hibp/breachedaccount/"+e+"/?truncateResponse=false").toPromise()];case 1:return[2,n.sent()];case 2:if(404===(t=n.sent()).status)return[2,null];throw t;case 3:return[2]}}))}))},e}();xa.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new xa(t.ɵɵinject(Se),t.ɵɵinject(o.AuthClass),t.ɵɵinject(y.HttpClient),t.ɵɵinject(ge),t.ɵɵinject(ve),t.ɵɵinject(or))},token:xa,providedIn:"root"}),xa.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],xa.ctorParameters=function(){return[{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:o.AuthClass},{type:y.HttpClient},{type:ge},{type:ve},{type:or}]};var qa,Ja,Ga,Qa=function(){},Va=Oe(qa||(qa=F(["\nmutation CreateReminderMutation($input: CreateReminderInput!) {\n createReminder(input: $input) {\n reminder {\n id\n }\n }\n}\n"],["\nmutation CreateReminderMutation($input: CreateReminderInput!) {\n createReminder(input: $input) {\n reminder {\n id\n }\n }\n}\n"]))),Wa=Oe(Ja||(Ja=F(["\nmutation UpdateReminderMutation($input: UpdateReminderInput!) {\n updateReminder(input: $input) {\n reminder {\n id\n }\n }\n}\n"],["\nmutation UpdateReminderMutation($input: UpdateReminderInput!) {\n updateReminder(input: $input) {\n reminder {\n id\n }\n }\n}\n"]))),Ba=Oe(Ga||(Ga=F(["\nmutation DeleteReminderMutation($input: DeleteReminderInput!) {\n deleteReminder(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteReminderMutation($input: DeleteReminderInput!) {\n deleteReminder(input: $input) {\n id\n }\n}\n"])));e.ReminderService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.createReminder=function(e){return this.mutate(this.createReminderMutation(e))},t.prototype.createReminderMutation=function(e){var t;return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,new dt({mutation:Va,variables:{input:{directoryId:e.directoryId,firstEvent:e.firstEvent.toISOString(),plain:JSON.stringify(e.plainJson),notifyAheadSeconds:null!==(t=e.notifyAheadSeconds)&&void 0!==t?t:0}}})]}))}))},t.prototype.updateReminder=function(e){return this.mutate(this.updateReminderMutation(e))},t.prototype.updateReminderMutation=function(e){var t,n;return A(this,void 0,void 0,(function(){return T(this,(function(r){return[2,new dt({mutation:Wa,variables:{input:{id:e.id,firstEvent:null===(t=e.firstEvent)||void 0===t?void 0:t.toISOString(),plain:JSON.stringify(null!==(n=e.plainJson)&&void 0!==n?n:void 0),notifyAheadSeconds:e.notifyAheadSeconds}}})]}))}))},t.prototype.deleteReminder=function(e){return this.mutate(this.deleteReminderMutation(e))},t.prototype.deleteReminderMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:Ba,variables:{input:{id:e}}})]}))}))},t}(Ft),e.ReminderService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ReminderService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ReminderService,providedIn:"root"}),e.ReminderService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ReminderService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ReminderService=M([et({ngZoneName:"ngZone"})],e.ReminderService);var Za,Ha,Ya,Xa,za,eo,to,no,ro,io,ao=Oe(Za||(Za=F(["\nmutation CreateScenarioMutation($input: CreateScenarioInput!) {\n createScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"],["\nmutation CreateScenarioMutation($input: CreateScenarioInput!) {\n createScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"]))),oo=Oe(Ha||(Ha=F(["\nmutation UpdateScenarioMutation($input: UpdateScenarioInput!) {\n updateScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"],["\nmutation UpdateScenarioMutation($input: UpdateScenarioInput!) {\n updateScenario(input: $input) {\n scenario {\n id\n }\n }\n}\n"]))),so=Oe(Ya||(Ya=F(["\nmutation DeleteScenarioMutation($input: DeleteScenarioInput!) {\n deleteScenario(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteScenarioMutation($input: DeleteScenarioInput!) {\n deleteScenario(input: $input) {\n id\n }\n}\n"]))),uo=Oe(Xa||(Xa=F(["\nmutation CreateScenarioClaimMutation($input: CreateScenarioClaimInput!) {\n createScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"],["\nmutation CreateScenarioClaimMutation($input: CreateScenarioClaimInput!) {\n createScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"]))),co=Oe(za||(za=F(["\nmutation CancelScenarioClaimMutation($input: CancelScenarioClaimInput!) {\n cancelScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"],["\nmutation CancelScenarioClaimMutation($input: CancelScenarioClaimInput!) {\n cancelScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"]))),po=Oe(eo||(eo=F(["\nmutation RejectScenarioClaimMutation($input: RejectScenarioClaimInput!) {\n rejectScenarioClaim(input: $input) {\n claimApprover {\n id\n }\n }\n}\n"],["\nmutation RejectScenarioClaimMutation($input: RejectScenarioClaimInput!) {\n rejectScenarioClaim(input: $input) {\n claimApprover {\n id\n }\n }\n}\n"]))),lo=Oe(to||(to=F(["\nmutation ApproveScenarioClaimMutation($input: ApproveScenarioClaimInput!) {\n approveScenarioClaim(input: $input) {\n claimApprover {\n id\n }\n }\n}\n"],["\nmutation ApproveScenarioClaimMutation($input: ApproveScenarioClaimInput!) {\n approveScenarioClaim(input: $input) {\n claimApprover {\n id\n }\n }\n}\n"]))),ho=Oe(no||(no=F(["\nmutation ReceiveScenarioClaimMutation($input: ReceiveScenarioClaimInput!) {\n receiveScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"],["\nmutation ReceiveScenarioClaimMutation($input: ReceiveScenarioClaimInput!) {\n receiveScenarioClaim(input: $input) {\n sharedClaim {\n id\n }\n }\n}\n"]))),yo=Oe(ro||(ro=F(["\nmutation DebugExpireScenarioClaimMutation($input: DebugExpireScenarioClaimInput!) {\n debugExpireScenarioClaim(input: $input) {\n scenarioClaim {\n id\n }\n }\n}\n"],["\nmutation DebugExpireScenarioClaimMutation($input: DebugExpireScenarioClaimInput!) {\n debugExpireScenarioClaim(input: $input) {\n scenarioClaim {\n id\n }\n }\n}\n"]))),fo=Oe(io||(io=F(["\nmutation DebugExpireTpPasswordResetRequestMutation($input: DebugExpireTpPasswordResetRequestInput!) {\n debugExpireTpPasswordResetRequest(input: $input) {\n passwordResetRequest {\n id\n }\n }\n}\n"],["\nmutation DebugExpireTpPasswordResetRequestMutation($input: DebugExpireTpPasswordResetRequestInput!) {\n debugExpireTpPasswordResetRequest(input: $input) {\n passwordResetRequest {\n id\n }\n }\n}\n"])));e.ɵm=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r.slip39Passphrase="lifeready",r}return R(t,e),t.prototype.getTpWrappingKeyId=function(e){return e.currentUserSharedKey.userSharedKey.sharedKey.id},t}(yr),e.ɵm.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ɵm(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ɵm,providedIn:"root"}),e.ɵm.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵm.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ɵm=M([et({ngZoneName:"ngZone"})],e.ɵm);var vo,mo,go=Oe(vo||(vo=F(["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"],["\nquery ScenarioQuery(\n $scenarioId: LrRelayIdInput!\n) {\n scenario(id: $scenarioId) {\n id\n state\n assembly {\n quorum\n singleReject\n assemblyKey {\n id\n }\n subjectKey {\n id\n }\n subjectCipherData\n subAssemblies {\n edges {\n node {\n id\n subjectKey {\n id\n }\n subjectCipherData\n quorum\n singleReject\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n claimants {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n }\n }\n }\n receivers {\n edges {\n node {\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n receiverDirectories {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n directory {\n id\n keyId\n }\n }\n }\n }\n receiverFiles {\n edges {\n node {\n id\n sharedCipherData\n sharedKey {\n id\n }\n accessRole\n itemKey {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"]))),So=Oe(mo||(mo=F(["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverDirectories {\n edges {\n node {\n id\n wrappedItemKey\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"],["\nquery SharedScenarioQuery($scenarioId: LrRelayIdInput!) {\n sharedScenario(id: $scenarioId) {\n id\n state\n tp {\n id\n }\n asClaimant {\n sharedKey {\n id\n }\n sharedCipherData\n }\n asReceiver {\n sharedKey {\n id\n }\n sharedCipherData\n pbk {\n id\n }\n receiverDirectories {\n edges {\n node {\n id\n wrappedItemKey\n }\n }\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedClaim {\n\t \t\tid\n isClaimant\n claim {\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n asClaimReceiver {\n received\n approvals {\n edges {\n node {\n receiverCipher\n receiverCipherPartialAssemblyKey\n pxk {\n id\n }\n }\n }\n }\n }\n }\n }\n}\n"])));function Co(){throw new Q("claimId does not match with the current claimId of the scenario")}function Io(){throw new Z("Scenario claim has not been approved")}e.ScenarioService=function(t){function n(e,n,r,i,a,o){var s=t.call(this,n)||this;return s.ngZone=e,s.injector=n,s.keyGraph=r,s.itemService=i,s.assemblyController=a,s.encryptionService=o,s.prepareAddReceiverDirectory=s.prepareReceiverDirectory,s.prepareUpdateReceiverDirectory=s.prepareReceiverDirectory,s}return R(n,t),n.prototype.createScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createScenarioMutation(e))]}))}))},n.prototype.createScenarioMutation=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.prepareCreateScenarioMutation(e)];case 1:return t=n.sent(),[2,new dt({mutation:ao,variables:{input:t}})]}}))}))},n.prototype.updateScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateScenarioMutation(e))]}))}))},n.prototype.updateScenarioMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.getScenario(e.scenarioId)];case 1:return t=r.sent().scenario,[4,this.prepareUpdateScenario(e,t)];case 2:return n=r.sent(),[2,new dt({mutation:oo,variables:{input:n}})]}}))}))},n.prototype.resetScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.resetScenarioMutation(e))]}))}))},n.prototype.resetScenarioMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.getScenario(e.scenarioId)];case 1:return t=a.sent().scenario,n=t.assembly,r=$t(n.subAssemblies).map((function(e){var t=$t(e.approvers).map((function(e){return{tpId:e.tp.id}}));return{id:e.id,quorum:e.quorum,singleReject:e.singleReject,subjectCipherDataClearJson:e.subjectCipherDataClearJson,approverTps:t}})),[4,this.prepareUpdateScenario({scenarioId:e.scenarioId,enabled:e.enabled,updateAssembly:{quorum:n.quorum,singleReject:n.singleReject,updateSubAssemblies:r}},t)];case 2:return i=a.sent(),[2,new dt({mutation:oo,variables:{input:i}})]}}))}))},n.prototype.deleteScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.lrGraphQL.lrMutate(this.deleteScenarioMutation(e))]}))}))},n.prototype.deleteScenarioMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:so,variables:{input:{scenarioId:e}}})]}))}))},n.prototype.createClaim=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createClaimMutation(e))]}))}))},n.prototype.createClaimMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:uo,variables:{input:{scenarioId:e}}})]}))}))},n.prototype.cancelClaim=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.cancelClaimMutation(e))]}))}))},n.prototype.cancelClaimMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:co,variables:{input:{claimId:e}}})]}))}))},n.prototype.rejectClaim=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.mutate(this.rejectClaimMutation(e,t))]}))}))},n.prototype.rejectClaimMutation=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.prepareRejectClaimMutations(e,t)];case 1:return n=a.sent(),i=(r=ht).create,[4,Promise.all(n)];case 2:return[2,i.apply(r,[a.sent()])]}}))}))},n.prototype.approveClaim=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.mutate(this.approveClaimMutation(e,t))]}))}))},n.prototype.approveClaimMutation=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,this.prepareApproveClaimMutations(e,t)];case 1:return n=a.sent(),i=(r=ht).create,[4,Promise.all(n)];case 2:return[2,i.apply(r,[a.sent()])]}}))}))},n.prototype.receiveClaim=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){return[2,this.mutate(this.receiveClaimMutation(e,t))]}))}))},n.prototype.receiveClaimMutation=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i;return T(this,(function(a){switch(a.label){case 0:return n=dt.bind,r={mutation:ho},i={},[4,this.prepareClaim(e,t)];case 1:return[2,new(n.apply(dt,[void 0,(r.variables=(i.input=a.sent(),i),r)]))]}}))}))},n.prototype.debugExpireClaim=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.debugExpireClaimMutation(e))]}))}))},n.prototype.debugExpireClaimMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:yo,variables:{input:{scenarioId:e}}})]}))}))},n.prototype.getScenario=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.query({query:go,variables:{scenarioId:e}})]}))}))},n.prototype.getSharedScenario=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,this.query({query:So,variables:{scenarioId:e}})];case 1:return n=r.sent(),t&&n.sharedScenario.sharedClaim.id!==t&&Co(),[2,n]}}))}))},n.prototype.getParticipantTpsKeys=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=e.map((function(e){return e.tpId})),n=$t,[4,this.lrGraphQL.query({query:hr,variables:{ids:t}})];case 1:return[2,n.apply(void 0,[r.sent().tps])]}}))}))},n.prototype.fillTpSharedKeyId=function(e,t){e.forEach((function(e){if(!e.tpSharedKeyId){var n=t.find((function(t){return t.id===e.tpId}));e.tpSharedKeyId=n.currentUserSharedKey.userSharedKey.sharedKey.id}}))},n.prototype.prepareCreateScenarioMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p=this;return T(this,(function(d){switch(d.label){case 0:return[4,this.assemblyController.prepareCreate(e.createAssembly)];case 1:return t=d.sent(),n=t.assemblyKey,r=t.mutationInput,i=e.createReceivers||[],a=e.createClaimants||[],o=i.concat(a),[4,this.getParticipantTpsKeys(o)];case 2:return s=d.sent(),this.fillTpSharedKeyId(o,s),[4,Promise.all(i.map((function(e){return p.prepareCreateReceiver(e,n)})))];case 3:return u=d.sent(),[4,Promise.all(a.map((function(e){return p.prepareCreateClaimant(e)})))];case 4:return c=d.sent(),[2,{enabled:e.enabled,createAssembly:r,createReceivers:u,createClaimants:c}]}}))}))},n.prototype.prepareUpdateScenario=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s,u,c,p,d,l,h,y,f,v,m,g,S,C,I,b=this;return T(this,(function(w){switch(w.label){case 0:return[4,this.keyGraph.getJwkKey(t.assembly.assemblyKey.id)];case 1:return n=w.sent(),e.updateAssembly?[4,A(b,void 0,void 0,(function(){var r;return T(this,(function(i){switch(i.label){case 0:return[4,this.assemblyController.prepareUpdate(e.updateAssembly,t.assembly)];case 1:return r=i.sent(),n=r.assemblyKey,[2,r.mutationInput]}}))}))]:[3,3];case 2:return i=w.sent(),[3,4];case 3:i=void 0,w.label=4;case 4:return r=i,a=e.createReceivers||[],o=e.createClaimants||[],s=a.concat(o),[4,this.getParticipantTpsKeys(s)];case 5:return u=w.sent(),this.fillTpSharedKeyId(s,u),(p=e.createReceivers)?[4,Promise.all(e.createReceivers.map((function(e){return b.prepareCreateReceiver(e,n)})))]:[3,7];case 6:p=w.sent(),w.label=7;case 7:return c=p,d=$t(t.receivers),e.updateReceivers?[4,Promise.all(e.updateReceivers.map((function(e){var t=d.find((function(t){return t.tp.id===e.tpId}));return b.prepareUpdateReceiver(e,n,t)})))]:[3,9];case 8:return h=w.sent(),[3,10];case 9:h=[],w.label=10;case 10:return l=h,e.updateAssembly?(y=d.filter((function(t){return!(e.deleteReceivers||[]).includes(t.tp.id)&&!l.some((function(e){return e.tpId===t.tp.id}))})),v=(f=l).concat,[4,this.prepareExistingReceivers(y,n)]):[3,12];case 11:l=v.apply(f,[w.sent()]),w.label=12;case 12:return(g=e.createClaimants)?[4,Promise.all(e.createClaimants.map((function(e){return b.prepareCreateClaimant(e)})))]:[3,14];case 13:g=w.sent(),w.label=14;case 14:return m=g,S=$t(t.claimants),(I=e.updateClaimants)?[4,Promise.all(e.updateClaimants.map((function(e){var t=S.find((function(t){return t.tp.id===e.tpId}));return b.prepareUpdateClaimant(e,t.sharedKey.id)})))]:[3,16];case 15:I=w.sent(),w.label=16;case 16:return C=I,[2,{scenarioId:e.scenarioId,enabled:e.enabled,updateAssembly:r,createReceivers:c,updateReceivers:l,deleteReceivers:e.deleteReceivers,createClaimants:m,updateClaimants:C,deleteClaimants:e.deleteClaimants}]}}))}))},n.prototype.prepareReceiverDirectory=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a;return T(this,(function(o){switch(o.label){case 0:return[4,this.itemService.getDirectoryKey(e.directoryId,e.directoryKeyId)];case 1:return r=o.sent(),[4,this.keyGraph.encryptToString(t,e.sharedCipherDataClearJson||"")];case 2:return i=o.sent(),[4,this.keyGraph.encryptToString(t,r.jwk.toJSON(!0))];case 3:return a=o.sent(),[4,this.keyGraph.encryptToString(n,a)];case 4:return a=o.sent(),[2,{directoryId:e.directoryId,wrappedItemKey:a,accessRole:e.accessRole,sharedCipherData:i}]}}))}))},n.prototype.prepareCreateReceiver=function(e,t){return A(this,void 0,void 0,(function(){var n,r,i,a,o,s=this;return T(this,(function(u){switch(u.label){case 0:return[4,this.prepareCreateParticipant(e)];case 1:return n=u.sent(),r=n.sharedKey,i=n.mutationInput,(o=e.addDirectories)?[4,Promise.all(e.addDirectories.map((function(e){return s.prepareAddReceiverDirectory(e,r.key,t)})))]:[3,3];case 2:o=u.sent(),u.label=3;case 3:return a=o,[2,Object.assign(Object.assign({},i),{addDirectories:a})]}}))}))},n.prototype.prepareUpdateReceiver=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c,p,d,l=this;return T(this,(function(h){switch(h.label){case 0:return r=n.sharedKey.id,i=e.deleteDirectories||[],a=e.updateDirectories||[],$t(n.receiverDirectories).forEach((function(e){i.includes(e.directory.id)||a.find((function(t){return t.directoryId===e.directory.id}))||a.push({accessRole:e.accessRole,directoryId:e.directory.id,sharedCipherDataClearJson:e.sharedCipherDataClearJson})})),[4,this.prepareUpdateParticipant(e,r)];case 1:return o=h.sent(),s=o.sharedKey,u=o.mutationInput,(p=e.addDirectories)?[4,Promise.all(e.addDirectories.map((function(e){return l.prepareAddReceiverDirectory(e,s,t)})))]:[3,3];case 2:p=h.sent(),h.label=3;case 3:return c=p,[4,Promise.all(a.map((function(e){return l.prepareUpdateReceiverDirectory(e,s,t)})))];case 4:return d=h.sent(),[2,Object.assign(Object.assign({},u),{addDirectories:c,updateDirectories:d,deleteDirectories:e.deleteDirectories})]}}))}))},n.prototype.prepareExistingReceiver=function(e,t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){return n=$t(e.receiverDirectories).map((function(e){return{directoryId:e.directory.id,directoryKeyId:e.directory.keyId,accessRole:e.accessRole,sharedCipherDataClearJson:e.sharedCipherDataClearJson}})),[2,this.prepareUpdateReceiver({tpId:e.tp.id,sharedCipherDataClearJson:e.sharedCipherDataClearJson,updateDirectories:n},t,e)]}))}))},n.prototype.prepareExistingReceivers=function(e,t){return A(this,void 0,void 0,(function(){var n=this;return T(this,(function(r){return[2,Promise.all(e.map((function(e){return n.prepareExistingReceiver(e,t)})))]}))}))},n.prototype.prepareCreateParticipant=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.keyGraph.encryptWithNewKey(e.tpSharedKeyId,e.sharedCipherDataClearJson||"")];case 1:return[2,{sharedKey:t=n.sent(),mutationInput:{tpId:e.tpId,tpSharedKeyId:e.tpSharedKeyId,tpSharedKeyWrappedSharedKey:t.wrappedKey,sharedCipherData:t.cipher}}]}}))}))},n.prototype.prepareUpdateParticipant=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return[4,this.keyGraph.getJwkKey(t)];case 1:return n=i.sent(),[4,this.keyGraph.encryptToString(n,e.sharedCipherDataClearJson||"")];case 2:return r=i.sent(),[2,{sharedKey:n,mutationInput:{tpId:e.tpId,sharedKeyId:t,sharedCipherData:r}}]}}))}))},n.prototype.prepareCreateClaimant=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.prepareCreateParticipant(e)];case 1:return[2,t.sent().mutationInput]}}))}))},n.prototype.prepareUpdateClaimant=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.prepareUpdateParticipant(e,t)];case 1:return[2,n.sent().mutationInput]}}))}))},n.prototype.prepareClaim=function(t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s=this;return T(this,(function(u){switch(u.label){case 0:return[4,this.getSharedScenario(t,n)];case 1:return(r=u.sent().sharedScenario).state!==e.ScenarioState.APPROVED&&Io(),i=$t(r.sharedClaim.asClaimReceiver.approvals),[4,this.recoverAssemblyKey(i)];case 2:return a=u.sent(),[4,Promise.all(r.asReceiver.receiverDirectories.edges.map((function(e){return e.node})).map((function(e){return A(s,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.encryptionService.decrypt(a,e.wrappedItemKey)];case 1:return t=n.sent(),[2,{receiverDirectoryId:e.id,receiverSharedKeyWrappedItemKey:t}]}}))}))})))];case 3:return o=u.sent(),[2,{scenarioClaimId:n,receiverDirectories:o}]}}))}))},n.prototype.recoverAssemblyKey=function(e){return A(this,void 0,void 0,(function(){var t,n=this;return T(this,(function(r){switch(r.label){case 0:return[4,Promise.all(e.map((function(e){return n.keyGraph.decryptFromString(e.pxk.id,e.receiverCipherPartialAssemblyKey)})))];case 1:return t=r.sent(),[2,this.assemblyController.recoverAssemblyKey(t)]}}))}))},n.prototype.asClaimApprovers=function(e,t,n){return A(this,void 0,void 0,(function(){return T(this,(function(r){switch(r.label){case 0:return[4,this.getSharedScenario(e,t)];case 1:return[2,$t(r.sent().sharedScenario.sharedClaim.claim.asClaimApprovers).filter((function(e){return e.state===n}))]}}))}))},n.prototype.prepareApproveClaimMutations=function(t,n){return A(this,void 0,void 0,(function(){var r=this;return T(this,(function(i){switch(i.label){case 0:return[4,this.asClaimApprovers(t,n,e.TpClaimApproverState.CLAIMED)];case 1:return[2,i.sent().map((function(e){return A(r,void 0,void 0,(function(){var t,n,r;return T(this,(function(i){switch(i.label){case 0:return t=dt.bind,n={mutation:lo},r={},[4,this.prepareApproveClaim(e)];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=(r.input=i.sent(),r),n)]))]}}))}))}))]}}))}))},n.prototype.prepareApproveClaim=function(e){return A(this,void 0,void 0,(function(){var t,n=this;return T(this,(function(r){switch(r.label){case 0:return[4,Promise.all($t(e.receiverApprovals).map((function(t){return n.prepareReceiverApproval({receiverApprovalId:t.id,receiverApprovalPxkId:t.pxk.id,sharedCipherPartialAssemblyKeyClearJson:e.sharedCipherPartialAssemblyKeyClearJson})})))];case 1:return t=r.sent(),[2,{claimApproverId:e.id,receiverApprovals:t}]}}))}))},n.prototype.prepareReceiverApproval=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return t={receiverApprovalId:e.receiverApprovalId,receiverCipher:""},[4,this.keyGraph.encryptToString(e.receiverApprovalPxkId,e.sharedCipherPartialAssemblyKeyClearJson)];case 1:return[2,(t.receiverCipherPartialAssemblyKey=n.sent(),t)]}}))}))},n.prototype.prepareRejectClaimMutations=function(t,n){return A(this,void 0,void 0,(function(){var r=this;return T(this,(function(i){switch(i.label){case 0:return[4,this.asClaimApprovers(t,n,e.TpClaimApproverState.CLAIMED)];case 1:return[2,i.sent().map((function(e){return A(r,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:po,variables:{input:{claimApproverId:e.id}}})]}))}))}))]}}))}))},n}(Ft),e.ScenarioService.SLIP39_PASSPHRASE="lifeready",e.ScenarioService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ScenarioService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(Pe),t.ɵɵinject(e.ItemService),t.ɵɵinject(e.ɵm),t.ɵɵinject(ve))},token:e.ScenarioService,providedIn:"root"}),e.ScenarioService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ScenarioService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:Pe},{type:e.ItemService},{type:e.ɵm},{type:ve}]},e.ScenarioService=M([et({ngZoneName:"ngZone"})],e.ScenarioService);var bo,wo=Oe(bo||(bo=F(["\nquery ServerConfigQuery {\n serverConfig {\n relayConnectionMaxLimit\n }\n}\n"],["\nquery ServerConfigQuery {\n serverConfig {\n relayConnectionMaxLimit\n }\n}\n"])));e.ServerConfigService=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.getConfig=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return null!=this.serverConfig?[3,2]:(e=this,[4,this.query({query:wo,includeKeyGraph:!1})]);case 1:e.serverConfig=t.sent().serverConfig,t.label=2;case 2:return[2,this.serverConfig]}}))}))},t}(Ft),e.ServerConfigService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ServerConfigService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ServerConfigService,providedIn:"root"}),e.ServerConfigService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ServerConfigService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ServerConfigService=M([et({ngZoneName:"ngZone"})],e.ServerConfigService);var Ko,Po,ko,Do,Ro=Oe(Ko||(Ko=F(["\nmutation UpdateOwnedContactCardMutation(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(input: $input) {\n ownedContactCard {\n id\n }\n }\n}"],["\nmutation UpdateOwnedContactCardMutation(\n $input: UpdateOwnedContactCardInput!\n) {\n updateOwnedContactCard(input: $input) {\n ownedContactCard {\n id\n }\n }\n}"]))),Eo=Oe(Po||(Po=F(["\nmutation UpdateReceivedContactCardMutation(\n $input: UpdateReceivedContactCardInput!\n) {\n updateReceivedContactCard(input: $input) {\n receivedContactCard {\n id\n }\n }\n}"],["\nmutation UpdateReceivedContactCardMutation(\n $input: UpdateReceivedContactCardInput!\n) {\n updateReceivedContactCard(input: $input) {\n receivedContactCard {\n id\n }\n }\n}"]))),Mo=Oe(ko||(ko=F(["\nquery GetOwnedContactCardKeyIdsQuery($id: LrRelayIdInput!) {\n ownedContactCard(id: $id) {\n sharedKey {\n id\n }\n ownerKey {\n id\n }\n }\n}"],["\nquery GetOwnedContactCardKeyIdsQuery($id: LrRelayIdInput!) {\n ownedContactCard(id: $id) {\n sharedKey {\n id\n }\n ownerKey {\n id\n }\n }\n}"]))),Ao=Oe(Do||(Do=F(["\nquery GetReceivedContactCardKeyIdQuery($id: LrRelayIdInput!) {\n receivedContactCard(id: $id) {\n receiverKey {\n id\n }\n }\n}"],["\nquery GetReceivedContactCardKeyIdQuery($id: LrRelayIdInput!) {\n receivedContactCard(id: $id) {\n receiverKey {\n id\n }\n }\n}"])));e.SharedContactCard2Service=function(){function e(e,t,n,r,i){this.ngZone=e,this.keyService=t,this.keyGraph=n,this.encryptionService=r,this.lrGraphQL=i}return e.prototype.getOwnedContactCardKeyIds=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.lrGraphQL.query({query:Mo,variables:{id:e}})];case 1:return[2,{sharedKeyId:(t=n.sent().ownedContactCard).sharedKey.id,ownerKeyId:t.ownerKey.id}]}}))}))},e.prototype.getReceivedContactCardKeyId=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.lrGraphQL.query({query:Ao,variables:{id:e}})];case 1:return[2,t.sent().receivedContactCard.receiverKey.id]}}))}))},e.prototype.updateOwnedContactCard=function(e){var t=e.id,n=e.ownerKeyId,r=e.sharedKeyId,i=e.ownerPlainDataJson,a=e.ownerCipherDataClearJson,o=e.sharedCipherDataClearJson;return A(this,void 0,void 0,(function(){var e,s,u,c,p,d,l,h,y,f,v,m;return T(this,(function(g){switch(g.label){case 0:return g.trys.push([0,3,,7]),[4,this.keyGraph.getKey(n)];case 1:return e=g.sent(),[4,this.keyGraph.getKey(r)];case 2:return s=g.sent(),[3,7];case 3:return g.sent(),[4,this.getOwnedContactCardKeyIds(t)];case 4:return u=g.sent(),[4,this.keyGraph.getKey(u.ownerKeyId)];case 5:return e=g.sent(),[4,this.keyGraph.getKey(u.sharedKeyId)];case 6:return s=g.sent(),[3,7];case 7:return c=this.keyService.currentSigPxk,[4,this.encryptionService.encrypt(s.jwk,o)];case 8:return p=g.sent(),h=(l=JSON).stringify,[4,this.encryptionService.sign(c.jwk,p)];case 9:return d=h.apply(l,[g.sent()]),v=(f=JSON).stringify,[4,this.encryptionService.sign(c.jwk,i)];case 10:return y=v.apply(f,[g.sent()]),[4,this.encryptionService.encryptToString(e.jwk,a)];case 11:return m=g.sent(),[2,new dt({mutation:Ro,variables:{input:{id:t,ownerCipherData:m,ownerKeyId:e.id,sharedCipherDataSig:d,sharedKeyId:s.id,sigPxkId:c.id,ownerPlainDataSig:y}}})]}}))}))},e.prototype.updateReceivedContactCard=function(e){var t=e.id,n=e.receiverKeyId,r=e.receiverCipherDataClearJson;return A(this,void 0,void 0,(function(){var e,i,a=this;return T(this,(function(o){switch(o.label){case 0:return[4,this.keyGraph.getKey(n,(function(){return a.getReceivedContactCardKeyId(t)}))];case 1:return e=o.sent(),[4,this.encryptionService.encryptToString(e.jwk,r)];case 2:return i=o.sent(),[2,new dt({mutation:Eo,variables:{input:{id:t,receiverCipherData:i,receiverKeyId:e.id}}})]}}))}))},e}(),e.SharedContactCard2Service.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.SharedContactCard2Service(t.ɵɵinject(t.NgZone),t.ɵɵinject(Ke),t.ɵɵinject(Pe),t.ɵɵinject(ve),t.ɵɵinject(e.ɵg))},token:e.SharedContactCard2Service,providedIn:"root"}),e.SharedContactCard2Service.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.SharedContactCard2Service.ctorParameters=function(){return[{type:t.NgZone},{type:Ke},{type:Pe},{type:ve},{type:e.ɵg}]},e.SharedContactCard2Service=M([et({ngZoneName:"ngZone"})],e.SharedContactCard2Service);var To,Oo,jo,No,Fo,$o=Oe(To||(To=F(["\nfragment SharedTpPasswordResetFragment on SharedTpPasswordResetNode {\n id\n tp {\n id\n other {\n username\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedRequest {\n id\n pxk {\n id\n pbk\n }\n claim {\n id\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"],["\nfragment SharedTpPasswordResetFragment on SharedTpPasswordResetNode {\n id\n tp {\n id\n other {\n username\n }\n }\n assembly {\n asApprovers {\n edges {\n node {\n id\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n sharedRequest {\n id\n pxk {\n id\n pbk\n }\n claim {\n id\n state\n asClaimApprovers {\n edges {\n node {\n id\n state\n sharedKey {\n id\n }\n sharedCipherApprovalData\n sharedCipherPartialAssemblyKey\n receiverApprovals {\n edges {\n node {\n id\n }\n }\n }\n }\n }\n }\n }\n }\n}"]))),_o=Oe(Oo||(Oo=F(["\nquery SharedTpPasswordResetsQuery {\n sharedTpPasswordResets {\n edges {\n node {\n ...SharedTpPasswordResetFragment\n }\n }\n }\n}\n","\n"],["\nquery SharedTpPasswordResetsQuery {\n sharedTpPasswordResets {\n edges {\n node {\n ...SharedTpPasswordResetFragment\n }\n }\n }\n}\n","\n"])),$o),Lo=Oe(jo||(jo=F(["\nquery SharedTpPasswordResetQuery($id: LrRelayIdInput!) {\n sharedTpPasswordReset(id: $id) {\n ...SharedTpPasswordResetFragment\n }\n}\n","\n"],["\nquery SharedTpPasswordResetQuery($id: LrRelayIdInput!) {\n sharedTpPasswordReset(id: $id) {\n ...SharedTpPasswordResetFragment\n }\n}\n","\n"])),$o),Uo=(Oe(No||(No=F(["\nquery TpPasswordResetUserQuery {\n tpPasswordResetUser {\n username\n resetUsername\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n sessionEncryptionKey\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n requestAgainAfter\n }\n}"],["\nquery TpPasswordResetUserQuery {\n tpPasswordResetUser {\n username\n resetUsername\n state\n passKey {\n id\n passKeyParams\n passIdpParams\n }\n masterKey {\n id\n }\n pxk {\n id\n }\n sessionEncryptionKey\n assembly {\n singleReject\n quorum\n subAssemblies {\n singleReject\n quorum\n approvers {\n name\n email\n state\n }\n }\n }\n approvals {\n id\n modified\n approverEmail\n receiverCipher\n receiverCipherPartialAssemblyKey\n }\n assemblyCipherData\n wrappedAssemblyKeyVerifierPrk\n requestAgainAfter\n }\n}"]))),Oe(Fo||(Fo=F(["\nquery TpPasswordResetQuery {\n tpPasswordReset {\n id\n applied\n assembly {\n singleReject\n quorum\n canMeetQuorum\n subjectCipherData\n subjectKey {\n id\n }\n assemblyKey {\n id\n }\n assemblyCipherData\n subAssemblies {\n edges {\n node {\n id\n singleReject\n quorum\n subjectCipherData\n subjectKey {\n id\n }\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n }\n }\n }\n }\n}"],["\nquery TpPasswordResetQuery {\n tpPasswordReset {\n id\n applied\n assembly {\n singleReject\n quorum\n canMeetQuorum\n subjectCipherData\n subjectKey {\n id\n }\n assemblyKey {\n id\n }\n assemblyCipherData\n subAssemblies {\n edges {\n node {\n id\n singleReject\n quorum\n subjectCipherData\n subjectKey {\n id\n }\n approvers {\n edges {\n node {\n id\n tp {\n id\n }\n sharedKey {\n id\n }\n sharedCipherData\n }\n }\n }\n }\n }\n }\n }\n }\n}"]))));e.ɵn=function(e){function t(t,n){var r=e.call(this,n)||this;return r.ngZone=t,r.injector=n,r}return R(t,e),t.prototype.getReset=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.query({query:Uo})];case 1:return[2,e.sent().tpPasswordReset]}}))}))},t.prototype.getSharedResets=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.query({query:_o})];case 1:return[2,e.sent().sharedTpPasswordResets]}}))}))},t.prototype.getSharedReset=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.query({query:Lo,variables:{id:e}})];case 1:return[2,t.sent().sharedTpPasswordReset]}}))}))},t}(Ft),e.ɵn.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.ɵn(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR))},token:e.ɵn,providedIn:"root"}),e.ɵn.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.ɵn.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector}]},e.ɵn=M([et({ngZoneName:"ngZone"})],e.ɵn),e.TpPasswordResetRequestService=function(t){function n(e,n,r,i){var a=t.call(this,n)||this;return a.ngZone=e,a.injector=n,a.encryptionService=r,a.privateService=i,a}return R(n,t),n.prototype.activeRequestOrRaise=function(t){var n=t.sharedRequest.claim.state;if(n!==e.TpAssemblyState.CLAIMED)throw new Z("Claim is already in "+n+" state.")},n.prototype.rejectRequest=function(e){return this.mutate(this.rejectRequestMutation(e))},n.prototype.rejectRequestMutation=function(t){return A(this,void 0,void 0,(function(){var n;return T(this,(function(r){switch(r.label){case 0:return[4,this.privateService.getSharedReset(t)];case 1:return n=r.sent(),this.activeRequestOrRaise(n),[2,ht.create(n.sharedRequest.claim.asClaimApprovers.edges.filter((function(t){return t.node.state===e.TpClaimApproverState.CLAIMED})).map((function(e){return new dt({mutation:Fr,variables:{input:{claimApproverId:e.node.id}}})})))]}}))}))},n.prototype.approveRequest=function(e,t){return A(this,void 0,void 0,(function(){var n,r;return T(this,(function(i){switch(i.label){case 0:return r=(n=this.lrGraphQL).lrMutate,[4,this.approveRequestMutation(e,t)];case 1:return[2,r.apply(n,[i.sent()])]}}))}))},n.prototype.approveRequestMutation=function(t,n){return A(this,void 0,void 0,(function(){var n,r,i,o,s,u=this;return T(this,(function(c){switch(c.label){case 0:return[4,this.privateService.getSharedReset(t)];case 1:return n=c.sent(),this.activeRequestOrRaise(n),[4,a.JWK.asKey(JSON.parse(n.sharedRequest.pxk.pbk))];case 2:return r=c.sent(),i=n.sharedRequest.claim.asClaimApprovers.edges.filter((function(t){return t.node.state===e.TpClaimApproverState.CLAIMED})),s=(o=ht).create,[4,Promise.all(i.map((function(e){return A(u,void 0,void 0,(function(){var t,n,i=this;return T(this,(function(a){switch(a.label){case 0:return t=e.node,n={claimApproverId:t.id},[4,Promise.all(t.receiverApprovals.edges.map((function(e){return A(i,void 0,void 0,(function(){var n,i;return T(this,(function(a){switch(a.label){case 0:return n=e.node,i={receiverApprovalId:n.id,receiverCipher:""},[4,this.encryptionService.encryptToString(r,t.sharedCipherPartialAssemblyKeyClearJson)];case 1:return[2,(i.receiverCipherPartialAssemblyKey=a.sent(),i)]}}))}))})))];case 1:return n.receiverApprovals=a.sent(),[2,new dt({mutation:Nr,variables:{input:n}})]}}))}))})))];case 3:return[2,s.apply(o,[c.sent()])]}}))}))},n}(Ft),e.TpPasswordResetRequestService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.TpPasswordResetRequestService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(ve),t.ɵɵinject(e.ɵn))},token:e.TpPasswordResetRequestService,providedIn:"root"}),e.TpPasswordResetRequestService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.TpPasswordResetRequestService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:ve},{type:e.ɵn}]},e.TpPasswordResetRequestService=M([et({ngZoneName:"ngZone"})],e.TpPasswordResetRequestService);function xo(){!function(e){if(!e)throw new Q("You must specify a non empty prefix.");Object.keys(localStorage).forEach((function(t){t.startsWith(e)&&localStorage.removeItem(t)}))}("CognitoIdentityServiceProvider")}e.TpPasswordResetUserService=function(e){function t(t,n,r,i,a,o,s,u){var c=e.call(this,n)||this;return c.ngZone=t,c.injector=n,c.config=r,c.keyFactory=i,c.encryptionService=a,c.passwordService=o,c.http=s,c.auth=u,c}return R(t,e),t.prototype.verifyEmailContact=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){return t={email:e},[2,this.http.post(this.config.authUrl+"tp/password-reset/verify-contact/",t).toPromise()]}))}))},t.prototype.verifyContactRespond=function(e,t){return A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.http.post(this.config.authUrl+"cove/respond/",{claim_id:e,v_code:t}).toPromise()];case 1:return[2,n.sent().token]}}))}))},t.prototype.requestReset=function(e,t,n){return A(this,void 0,void 0,(function(){var r,i,a,o,s,u,c;return T(this,(function(p){switch(p.label){case 0:return xo(),[4,this.passwordService.createPassKeyBundle(e)];case 1:return r=p.sent(),[4,this.keyFactory.createKey()];case 2:return i=p.sent(),[4,this.encryptionService.encrypt(r.passKey,i.toJSON(!0))];case 3:return a=p.sent(),[4,this.keyFactory.createPkcKey()];case 4:return o=p.sent(),[4,this.encryptionService.encrypt(i,o.toJSON(!0))];case 5:return s=p.sent(),[4,this.http.post(this.config.authUrl+"tp/password-reset/request/",{claimId:t,claimToken:n,pass_key_params:r.passKeyParams,pass_idp_params:r.passIdpParams,pass_idp_verifier_pbk:r.passIdpVerifier.toJSON(),wrapped_pass_idp_verifier_prk:r.wrappedPassIdpVerifierPrk,wrapped_master_key:a,pbk:o.toJSON(),master_key_wrapped_prk:s}).toPromise()];case 6:return u=p.sent(),console.log("Using new password"),[4,this.auth.signUp({username:u.reset_username,password:this.passwordService.getPassIdpString(r.passIdp),clientMetadata:{tp_password_reset_request:JSON.stringify({id:u.id,associate_reset_user_token:u.associate_reset_user_token})}})];case 7:return c=p.sent(),console.log("requestRest done"),[2,{requestResetResult:u,signUpResult:c}]}}))}))},t}(Ft),e.TpPasswordResetUserService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.TpPasswordResetUserService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(Se),t.ɵɵinject(ge),t.ɵɵinject(ve),t.ɵɵinject(or),t.ɵɵinject(y.HttpClient),t.ɵɵinject(o.AuthClass))},token:e.TpPasswordResetUserService,providedIn:"root"}),e.TpPasswordResetUserService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.TpPasswordResetUserService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:void 0,decorators:[{type:t.Inject,args:[Se]}]},{type:ge},{type:ve},{type:or},{type:y.HttpClient},{type:o.AuthClass}]},e.TpPasswordResetUserService=M([et({ngZoneName:"ngZone"})],e.TpPasswordResetUserService),e.TpPasswordResetService=function(e){function t(t,n,r,i){var a=e.call(this,n)||this;return a.ngZone=t,a.injector=n,a.privateService=r,a.assemblyController=i,a.slip39Passphrase=sr,a}return R(t,e),t.prototype.cancelResetRequest=function(){return this.mutate(this.cancelResetRequestMutation())},t.prototype.cancelResetRequestMutation=function(){return new dt({mutation:Ar})},t.prototype.deleteReset=function(){return this.mutate(this.deleteResetMutation())},t.prototype.deleteResetMutation=function(){return new dt({mutation:_r})},t.prototype.validateApprovers=function(e){return this.assemblyController.validateApprovers(e)},t.prototype.createReset=function(e){return this.mutate(this.createResetMutation(e))},t.prototype.createResetMutation=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.assemblyController.prepareCreate(e)];case 1:return t=n.sent().mutationInput,[2,new dt({mutation:$r,variables:{input:{assembly:Object.assign({},t)}}})]}}))}))},t.prototype.updateReset=function(e){return this.mutate(this.updateResetMutation(e))},t.prototype.updateResetMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return[4,this.privateService.getReset()];case 1:return t=r.sent(),[4,this.assemblyController.prepareUpdate(e,t.assembly)];case 2:return n=r.sent().mutationInput,[2,new dt({mutation:Lr,variables:{input:{assembly:Object.assign({},n)}}})]}}))}))},t.prototype.debugExpireResetRequest=function(e){return this.mutate(this.debugExpireResetRequestMutation(e),{includeKeyGraph:!1})},t.prototype.debugExpireResetRequestMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:fo,variables:{input:{username:e}}})]}))}))},t}(Ft),e.TpPasswordResetService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.TpPasswordResetService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(e.ɵn),t.ɵɵinject(e.ɵi))},token:e.TpPasswordResetService,providedIn:"root"}),e.TpPasswordResetService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.TpPasswordResetService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:e.ɵn},{type:e.ɵi}]},e.TpPasswordResetService=M([et({ngZoneName:"ngZone"})],e.TpPasswordResetService);var qo,Jo,Go,Qo,Vo,Wo,Bo,Zo,Ho,Yo,Xo,zo,es,ts,ns,rs,is,as=Oe(qo||(qo=F(["\nmutation DeleteTpMutation($input: DeleteTpInput!) {\n deleteTp(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteTpMutation($input: DeleteTpInput!) {\n deleteTp(input: $input) {\n id\n }\n}\n"]))),os=Oe(Jo||(Jo=F(["\n mutation ShareDirectoryMutation($input: ShareDirectoryInput!) {\n shareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"],["\n mutation ShareDirectoryMutation($input: ShareDirectoryInput!) {\n shareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"]))),ss=Oe(Go||(Go=F(["\n mutation UnshareDirectoryMutation($input: UnshareDirectoryInput!) {\n unshareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"],["\n mutation UnshareDirectoryMutation($input: UnshareDirectoryInput!) {\n unshareDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n }\n"]))),us=Oe(Qo||(Qo=F(["\n mutation ShareFileMutation($input: ShareFileInput!) {\n shareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"],["\n mutation ShareFileMutation($input: ShareFileInput!) {\n shareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"]))),cs=Oe(Vo||(Vo=F(["\n mutation UnshareFileMutation($input: UnshareFileInput!) {\n unshareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"],["\n mutation UnshareFileMutation($input: UnshareFileInput!) {\n unshareFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n }\n"]))),ps=Oe(Wo||(Wo=F(["\nmutation CreateSharedDirectoryMutation($input: CreateSharedDirectoryInput!) {\n createSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"],["\nmutation CreateSharedDirectoryMutation($input: CreateSharedDirectoryInput!) {\n createSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"]))),ds=Oe(Bo||(Bo=F(["\nmutation CreateSharedFileMutation($input: CreateSharedFileInput!) {\n createSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"],["\nmutation CreateSharedFileMutation($input: CreateSharedFileInput!) {\n createSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"]))),ls=Oe(Zo||(Zo=F(["\nmutation UpdateSharedDirectoryMutation($input: UpdateSharedDirectoryInput!) {\n updateSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"],["\nmutation UpdateSharedDirectoryMutation($input: UpdateSharedDirectoryInput!) {\n updateSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"]))),hs=Oe(Ho||(Ho=F(["\nmutation UpdateSharedFileMutation($input: UpdateSharedFileInput!) {\n updateSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"],["\nmutation UpdateSharedFileMutation($input: UpdateSharedFileInput!) {\n updateSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"]))),ys=Oe(Yo||(Yo=F(["\nmutation DeleteSharedDirectoryMutation($input: DeleteSharedDirectoryInput!) {\n deleteSharedDirectory(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteSharedDirectoryMutation($input: DeleteSharedDirectoryInput!) {\n deleteSharedDirectory(input: $input) {\n id\n }\n}\n"]))),fs=(Oe(Xo||(Xo=F(["\nmutation DeleteSharedFileMutation($input: DeleteSharedFileInput!) {\n deleteSharedFile(input: $input) {\n id\n }\n}\n"],["\nmutation DeleteSharedFileMutation($input: DeleteSharedFileInput!) {\n deleteSharedFile(input: $input) {\n id\n }\n}\n"]))),Oe(zo||(zo=F(["\nmutation CompleteDetachedSharedDirectoryMutation($input: CompleteDetachedSharedDirectoryInput!) {\n completeDetachedSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"],["\nmutation CompleteDetachedSharedDirectoryMutation($input: CompleteDetachedSharedDirectoryInput!) {\n completeDetachedSharedDirectory(input: $input) {\n tpSharedDirectory {\n id\n }\n }\n}\n"])))),vs=Oe(es||(es=F(["\nmutation CompleteDetachedSharedFileMutation($input: CompleteDetachedSharedFileInput!) {\n completeDetachedSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"],["\nmutation CompleteDetachedSharedFileMutation($input: CompleteDetachedSharedFileInput!) {\n completeDetachedSharedFile(input: $input) {\n tpSharedFile {\n id\n }\n }\n}\n"]))),ms=Oe(ts||(ts=F(["\nmutation RequestTpMkReshareMutation($input: RequestTpMkReshareInput!) {\n requestTpMkReshare(input: $input) {\n id\n }\n}"],["\nmutation RequestTpMkReshareMutation($input: RequestTpMkReshareInput!) {\n requestTpMkReshare(input: $input) {\n id\n }\n}"]))),gs=Oe(ns||(ns=F(["\n mutation RespondTpMkReshareMutation($input: RespondTpMkReshareInput!) {\n respondTpMkReshare(input: $input) {\n id\n }\n }\n"],["\n mutation RespondTpMkReshareMutation($input: RespondTpMkReshareInput!) {\n respondTpMkReshare(input: $input) {\n id\n }\n }\n"]))),Ss=Oe(rs||(rs=F(["\nmutation CompleteTpMkReshareMutation($input: CompleteTpMkReshareInput!) {\n completeTpMkReshare(input: $input) {\n id\n }\n}"],["\nmutation CompleteTpMkReshareMutation($input: CompleteTpMkReshareInput!) {\n completeTpMkReshare(input: $input) {\n id\n }\n}"]))),Cs=Oe(is||(is=F(["\nquery TpCurrentUserSharedKeyQuery($id: LrRelayIdInput!) {\n tp(id: $id){\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n }\n mkReshareRequestCipher\n mkReshareRequestSent\n mkReshareResponseCipher\n mkReshareResponseSent\n }\n }\n }\n}\n"],["\nquery TpCurrentUserSharedKeyQuery($id: LrRelayIdInput!) {\n tp(id: $id){\n currentUserSharedKey {\n userSharedKey {\n sharedKey {\n id\n }\n mkSharedKey {\n id\n }\n mkPxk {\n id\n }\n mkReshareRequestCipher\n mkReshareRequestSent\n mkReshareResponseCipher\n mkReshareResponseSent\n }\n }\n }\n}\n"])));e.TrustedPartyService=function(e){function t(t,n,r,i,a,o,s){var u=e.call(this,n)||this;return u.ngZone=t,u.injector=n,u.keyGraph=r,u.itemService=i,u.keyService=a,u.keyFactory=o,u.encryptionService=s,u}return R(t,e),t.prototype.deleteTp=function(e){return this.mutate(this.deleteTpMutation(e))},t.prototype.deleteTpMutation=function(e){return new dt({mutation:as,variables:{input:{id:e}}})},t.prototype.shareDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.shareDirectoryMutation(e))]}))}))},t.prototype.shareDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:os},[4,this.prepareShareItemMutation(Object.assign(Object.assign({},e),{isDirectory:!0}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.shareFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.shareFileMutation(e))]}))}))},t.prototype.shareFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:us},[4,this.prepareShareItemMutation(Object.assign(Object.assign({},e),{isDirectory:!1}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.prepareShareItemMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p=this;return T(this,(function(d){switch(d.label){case 0:return t=e.itemId,n=e.itemKeyId,r=e.tpId,i=e.tpSharedKeyId,a=e.accessRole,o=e.isDirectory,[4,this.keyGraph.getKey(n,(function(){return o?p.itemService.getDirectoryKeyId(t):p.itemService.getFileKeyId(t)}))];case 1:return s=d.sent(),[4,this.keyGraph.getKey(i,(function(){return p.getTpCurrentUserSharedKey(r).then((function(e){return e.sharedKey.id}))}))];case 2:return u=d.sent(),[4,this.keyGraph.wrapKey(u,s.jwk)];case 3:return c=d.sent(),[2,{input:{id:t,tpId:r,accessRole:a,keyId:s.id,wrappingKeyId:u.id,wrappedKey:c}}]}}))}))},t.prototype.unshareDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.unshareDirectoryMutation(e))]}))}))},t.prototype.unshareDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.unshareItemMutation(Object.assign(Object.assign({},e),{isDirectory:!0}))]}))}))},t.prototype.unshareFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.unshareFileMutation(e))]}))}))},t.prototype.unshareFileMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.unshareItemMutation(Object.assign(Object.assign({},e),{isDirectory:!1}))]}))}))},t.prototype.unshareItemMutation=function(e){var t=e.itemId,n=e.tpId,r=e.isDirectory;return A(this,void 0,void 0,(function(){return T(this,(function(e){return[2,new dt({mutation:r?ss:cs,variables:{input:{id:t,tpId:n}}})]}))}))},t.prototype.createSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createSharedDirectoryMutation(e))]}))}))},t.prototype.createSharedDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:ps},[4,this.prepareCreateSharedItemMutation(Object.assign(Object.assign({},e),{isDirectory:!0}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.createSharedFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.createSharedFileMutation(e))]}))}))},t.prototype.createSharedFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:ds},[4,this.prepareCreateSharedItemMutation(Object.assign(Object.assign({},e),{isDirectory:!1}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.prepareCreateSharedItemMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s,u,c,p,d=this;return T(this,(function(l){switch(l.label){case 0:return t=e.itemId,n=e.itemKeyId,r=e.tpId,i=e.tpSharedKeyId,a=e.accessRole,o=e.isDirectory,s=e.shareType,console.log("createSharedItemMutation()",n),[4,this.keyGraph.getKey(n,(function(){return o?d.itemService.getDirectoryKeyId(t):d.itemService.getFileKeyId(t)}))];case 1:return u=l.sent(),console.log("createSharedItemMutation()",u.id),[4,this.keyGraph.getKey(i,(function(){return d.getTpCurrentUserSharedKey(r).then((function(e){return e.sharedKey.id}))}))];case 2:return c=l.sent(),[4,this.keyGraph.wrapKey(c,u.jwk)];case 3:return p=l.sent(),[2,{input:{id:t,tpId:r,accessRole:a,keyId:u.id,wrappingKeyId:c.id,wrappedKey:p,shareType:s}}]}}))}))},t.prototype.updateSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateSharedDirectoryMutation(e))]}))}))},t.prototype.updateSharedDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:ls,variables:this.prepareUpdateSharedItemMutation(e)})]}))}))},t.prototype.updateSharedFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.updateSharedFileMutation(e))]}))}))},t.prototype.updateSharedFileMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:hs,variables:this.prepareUpdateSharedItemMutation(e)})]}))}))},t.prototype.prepareUpdateSharedItemMutation=function(e){return{input:{id:e.sharedItemId,accessRole:e.accessRole}}},t.prototype.deleteSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.deleteSharedDirectoryMutation(e))]}))}))},t.prototype.deleteSharedDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,new dt({mutation:ys,variables:{input:{id:e}}})]}))}))},t.prototype.completeDetachedSharedDirectory=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.completeDetachedSharedDirectoryMutation(e))]}))}))},t.prototype.completeDetachedSharedDirectoryMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:fs},[4,this.prepareCompleteDetachedSharedItemMutation(Object.assign(Object.assign({},e),{isDirectory:!0}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.completeDetachedSharedFile=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){return[2,this.mutate(this.completeDetachedSharedFileMutation(e))]}))}))},t.prototype.completeDetachedSharedFileMutation=function(e){return A(this,void 0,void 0,(function(){var t,n;return T(this,(function(r){switch(r.label){case 0:return t=dt.bind,n={mutation:vs},[4,this.prepareCompleteDetachedSharedItemMutation(Object.assign(Object.assign({},e),{isDirectory:!1}))];case 1:return[2,new(t.apply(dt,[void 0,(n.variables=r.sent(),n)]))]}}))}))},t.prototype.prepareCompleteDetachedSharedItemMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o,s=this;return T(this,(function(u){switch(u.label){case 0:return t=e.sharedItemId,n=e.itemKeyId,r=e.isDirectory,[4,this.keyGraph.getKey(n,(function(){return r?s.itemService.getDirectoryKeyIdFromSharedDirectory(t):s.itemService.getFileKeyIdFromSharedFile(t)}))];case 1:return i=u.sent(),a=this.keyService.currentRootKey,[4,this.keyGraph.wrapKey(a,i.jwk)];case 2:return o=u.sent(),[2,{input:{id:t,keyId:i.id,wrappingKeyId:a.id,wrappedKey:o}}]}}))}))},t.prototype.requestMkReshareMutation=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,a,o;return T(this,(function(s){switch(s.label){case 0:return[4,this.getTpCurrentUserSharedKey(e)];case 1:if((t=s.sent()).mkSharedKey)throw new Z("TP already has mkSharedKey");return n=this.keyService.currentMasterKey,[4,this.keyFactory.createPkcKey()];case 2:return r=s.sent(),[4,this.encryptionService.encryptToString(n.jwk,r.toJSON(!0))];case 3:return i=s.sent(),[4,this.keyGraph.getKey(t.sharedKey.id)];case 4:return a=s.sent(),[4,this.encryptionService.encryptToString(a.jwk,{pbk:r.toJSON()})];case 5:return o=s.sent(),[4,new dt({mutation:ms,variables:{input:{tpId:e,masterKeyId:n.id,mkPbk:JSON.stringify(r.toJSON()),mkWrappedMkPrk:i,sharedKeyId:a.id,mkReshareRequestCipher:o}}})];case 6:return[2,s.sent()]}}))}))},t.prototype.respondMkReshare=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,c,p,d;return T(this,(function(l){switch(l.label){case 0:return[4,this.getTpCurrentUserSharedKey(e)];case 1:if(!(t=l.sent()).mkSharedKey)throw new Z("No access to the mkSharedKey so cannot reshare it with TP");return[4,this.keyGraph.getKey(t.sharedKey.id)];case 2:return n=l.sent(),[4,this.encryptionService.decrypt(n,t.mkReshareRequestCipher)];case 3:return r=l.sent(),[4,a.JWK.asKey(r.pbk)];case 4:return i=l.sent(),[4,this.keyGraph.getKey(t.mkSharedKey.id)];case 5:return o=l.sent(),s={mkSharedKey:{id:o.id,jwk:o.jwk.toJSON(!0)}},p=(c=this.encryptionService).encryptToString,d=[i],[4,this.encryptionService.encryptToString(n.jwk,s)];case 6:return[4,p.apply(c,d.concat([l.sent()]))];case 7:return u=l.sent(),[2,new dt({mutation:gs,variables:{input:{tpId:e,mkSharedKeyId:o.id,mkReshareResponseCipher:u}}})]}}))}))},t.prototype.completeMkReshare=function(e){return A(this,void 0,void 0,(function(){var t,n,r,i,o,s,u,c,p,d,l;return T(this,(function(h){switch(h.label){case 0:return[4,this.getTpCurrentUserSharedKey(e)];case 1:return t=h.sent(),[4,this.keyGraph.getKey(t.sharedKey.id)];case 2:return n=h.sent(),[4,this.keyGraph.getKey(t.mkPxk.id)];case 3:return r=h.sent(),s=(o=this.encryptionService).decrypt,u=[n],[4,this.encryptionService.decrypt(r,t.mkReshareResponseCipher)];case 4:return[4,s.apply(o,u.concat([h.sent()]))];case 5:return i=h.sent(),p={id:i.mkSharedKey.id},[4,a.JWK.asKey(i.mkSharedKey.jwk)];case 6:return p.jwk=h.sent(),c=p,d=this.keyService.currentMasterKey,[4,this.encryptionService.encryptToString(d.jwk,c.jwk.toJSON(!0))];case 7:return l=h.sent(),[2,new dt({mutation:Ss,variables:{input:{tpId:e,masterKeyId:d.id,mkSharedKeyId:c.id,mkWrappedMkSharedKey:l}}})]}}))}))},t.prototype.getTpCurrentUserSharedKey=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.lrGraphQL.query({query:Cs,variables:{id:e}})];case 1:return[2,t.sent().tp.currentUserSharedKey.userSharedKey]}}))}))},t}(Ft),e.TrustedPartyService.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new e.TrustedPartyService(t.ɵɵinject(t.NgZone),t.ɵɵinject(t.INJECTOR),t.ɵɵinject(Pe),t.ɵɵinject(e.ItemService),t.ɵɵinject(Ke),t.ɵɵinject(ge),t.ɵɵinject(ve))},token:e.TrustedPartyService,providedIn:"root"}),e.TrustedPartyService.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],e.TrustedPartyService.ctorParameters=function(){return[{type:t.NgZone},{type:t.Injector},{type:Pe},{type:e.ItemService},{type:Ke},{type:ge},{type:ve}]},e.TrustedPartyService=M([et({ngZoneName:"ngZone"})],e.TrustedPartyService);var Is=function(){function e(e){this.auth=e}return e.prototype.getPreferredMFA=function(){return A(this,void 0,void 0,(function(){var e;return T(this,(function(t){switch(t.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return e=t.sent(),[4,this.auth.getPreferredMFA(e)];case 2:return[2,t.sent()]}}))}))},e.prototype.setPreferredMFA=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return t=n.sent(),[4,this.auth.setPreferredMFA(t,e)];case 2:return n.sent(),[2]}}))}))},e.prototype.setPhoneNumber=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return t=n.sent(),[4,this.auth.updateUserAttributes(t,{phone_number:e})];case 2:return n.sent(),[2]}}))}))},e.prototype.getSMSCode=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.auth.verifyCurrentUserAttribute("phone_number")];case 1:return e.sent(),[2]}}))}))},e.prototype.verifySMSCode=function(e){return A(this,void 0,void 0,(function(){return T(this,(function(t){switch(t.label){case 0:return[4,this.auth.verifyCurrentUserAttributeSubmit("phone_number",e)];case 1:return t.sent(),[2]}}))}))},e.prototype.getSoftwareToken=function(){return A(this,void 0,void 0,(function(){var e,t,n,r,i;return T(this,(function(a){switch(a.label){case 0:return[4,Promise.all([this.auth.currentAuthenticatedUser(),this.auth.currentUserInfo()])];case 1:return e=j.apply(void 0,[a.sent(),2]),t=e[0],n=e[1],[4,this.auth.setupTOTP(t)];case 2:if(r=a.sent(),!(i=n.attributes.email))throw new Q("No email associated with user.");return[2,{code:r,codeUri:"otpauth://totp/"+i+"?secret="+r+"&issuer=LifeReady"}]}}))}))},e.prototype.verifySoftwareToken=function(e){return A(this,void 0,void 0,(function(){var t;return T(this,(function(n){switch(n.label){case 0:return[4,this.auth.currentAuthenticatedUser()];case 1:return t=n.sent(),[4,this.auth.verifyTotpToken(t,e)];case 2:return n.sent(),[2]}}))}))},e}();Is.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Is(t.ɵɵinject(o.AuthClass))},token:Is,providedIn:"root"}),Is.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Is.ctorParameters=function(){return[{type:o.AuthClass}]};var bs,ws,Ks,Ps=K.default(bs||(bs=F(["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"],["\n mutation RequestUserDelete($input: RequestUserDeleteInput!) {\n requestUserDelete(input: $input) {\n userDelete {\n state\n created\n }\n }\n }\n"]))),ks=K.default(ws||(ws=F(["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"],["\n mutation CancelUserDelete($input: CancelUserDeleteInput!) {\n cancelUserDelete(input: $input) {\n id\n }\n }\n"]))),Ds=K.default(Ks||(Ks=F(["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"],["\n query LoginHistory($first: Int, $after: String) {\n loginHistory(first: $first, after: $after) {\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n events\n }\n }\n"]))),Rs=function(){function e(e){this.lrApollo=e}return e.prototype.requestUserDelete=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.lrApollo.mutate({mutation:Ps,variables:{input:{}}})];case 1:return[2,e.sent().requestUserDelete.userDelete]}}))}))},e.prototype.cancelUserDelete=function(){return A(this,void 0,void 0,(function(){return T(this,(function(e){switch(e.label){case 0:return[4,this.lrApollo.mutate({mutation:ks,variables:{input:{}}})];case 1:return[2,e.sent().cancelUserDelete.id]}}))}))},e.prototype.loginHistory=function(e,t){return void 0===e&&(e=null),void 0===t&&(t=null),A(this,void 0,void 0,(function(){return T(this,(function(n){switch(n.label){case 0:return[4,this.lrApollo.query({query:Ds,variables:{first:e,after:t}})];case 1:return[2,n.sent().loginHistory]}}))}))},e}();Rs.ɵprov=t.ɵɵdefineInjectable({factory:function(){return new Rs(t.ɵɵinject(ke))},token:Rs,providedIn:"root"}),Rs.decorators=[{type:t.Injectable,args:[{providedIn:"root"}]}],Rs.ctorParameters=function(){return[{type:ke}]},e.ApiContactCard=Pn,e.ApiCurrentUser=Kn,e.ApproveScenarioClaimMutation=lo,e.ApproveTpPasswordResetRequestMutation=Nr,e.ArchiveDirectoryMutation=ki,e.ArchiveFileMutation=Di,e.BeginDeleteChildItemLinksWindowMutation=Ti,e.CancelKeyExchangeMutation=fn,e.CancelScenarioClaimMutation=co,e.CancelTpPasswordResetRequestMutation=Ar,e.CancelUserDeleteMutation=ks,e.ChangeDirectoryParentsMutation=Mi,e.ChangeFileParentsMutation=Ai,e.CompleteKeyExchangeOtkMutation=Sn,e.CompleteTpPasswordResetRequestMutation=jr,e.ContactCardAddress=Dn,e.ContactCardName=kn,e.ContactCardsQuery=Hn,e.CreateContactCardMutation=Wn,e.CreateDirectoryMutation=Si,e.CreateFileMutation=bi,e.CreateFileQuery=Be,e.CreateLbopQuery=ra,e.CreateScenarioClaimMutation=uo,e.CreateScenarioMutation=ao,e.CreateTpAssemblyKeyChallengeMutation=Tr,e.CreateTpPasswordResetMutation=$r,e.CurrentUserKey=wn,e.CurrentUserQuery=Vn,e.CurrentUserSharedKeyQuery2=Cn,e.DebugExpireScenarioClaimMutation=yo,e.DebugExpireTpPasswordResetRequestMutation=fo,e.DeclineKeyExchangeMutation=vn,e.DefaultProcessorOptions=tt,e.DeleteDirectoryMutation=Ii,e.DeleteFileMutation=Pi,e.DeleteLbopQuery=ia,e.DeleteScenarioMutation=so,e.DeleteTpPasswordResetMutation=_r,e.DirectoryQuery=We,e.ERROR_SOURCE=Yi,e.Features=bn,e.FetchKeyGraphField=Qe,e.FileQuery=Ve,e.FileUploadService=Yr,e.GetOwnedContactCardKeyIdsQuery=Mo,e.GetReceivedContactCardKeyIdQuery=Ao,e.IdleService=xt,e.InitiateKeyExchangeOtkMutation=mn,e.KC_CONFIG=Se,e.KcAuthException=G,e.KcBadArgumentException=Q,e.KcBadLogicException=V,e.KcBadRequestException=W,e.KcBadSignatureException=B,e.KcBadStateException=Z,e.KcBadTimeSyncException=H,e.KcCodeMismatchException=Y,e.KcConcurrentAccessException=X,e.KcEncryptionException=z,e.KcError=q,e.KcException=J,e.KcInternalErrorException=ee,e.KcLockedException=te,e.KcNotFoundException=ne,e.KcSuspiciousOperationException=re,e.KcUnsupportedException=ie,e.KeyExchangeFields=pn,e.KeyExchangeQuery2=hn,e.KeyExchangeTokenQuery2=yn,e.KeyExchangesQuery2=ln,e.KeyGraphField=Ge,e.KeyGraphFragment=Je,e.LbopQuery=oa,e.LbopService=ua,e.LbopsQuery=sa,e.LifeReadyModule=ca,e.LoginHistoryQuery=Ds,e.LrApolloService=ke,e.LrGraphQLService=e.ɵg,e.LrMergedMutation=ht,e.LrMutation=dt,e.LrMutationBase=pt,e.LrService=Ft,e.MainContactCardFields=En,e.MainContactCardPlainFields=Mn,e.MainContactCardProperty=Rn,e.MoveDirectoryQuery=Xe,e.MoveFileQuery=Ye,e.OwnerPlainDataJson=Hr,e.PasswordCheck=ar,e.PasswordService=or,e.PersistService=we,e.PreCompleteTpPasswordResetRequestMutation=Or,e.ProfileDetailsService=Ua,e.ProfileService=Yn,e.ReceiveScenarioClaimMutation=ho,e.RegisterResult=Qa,e.RegisterService=xa,e.RejectScenarioClaimMutation=po,e.RejectTpPasswordResetRequestMutation=Fr,e.RequestUserDeleteMutation=Ps,e.RespondKeyExchangeOtkMutation=gn,e.RevertFileMutation=Ki,e.RevertFileQuery=He,e.ServerTimeQuery=le,e.SetDirectoryConfidentialMutation=Ni,e.SetFileConfidentialMutation=ji,e.SharedTrustedPartyDetails=Tn,e.SharedVaultFeature=jn,e.TPFeatures=On,e.TempDirectoryQuery=Oi,e.TimeService=he,e.TrustedPartiesQuery=Zn,e.TrustedParty=Fn,e.TrustedPartyDetails=An,e.TrustedPartyProperties=Qn,e.TwoFactorService=Is,e.UnarchiveDirectoryMutation=Ri,e.UnarchiveFileMutation=Ei,e.UpdateContactCardMutation=Bn,e.UpdateDirectoryMutation=Ci,e.UpdateFileMutation=wi,e.UpdateFileQuery=Ze,e.UpdateLbopQuery=aa,e.UpdateOwnedContactCardMutation=Ro,e.UpdateReceivedContactCardMutation=Eo,e.UpdateScenarioMutation=oo,e.UpdateTpPasswordResetMutation=Lr,e.UserService=Rs,e.UserSharedKeyFields=dn,e.WebCryptoService=me,e.awsFetch=Lt,e.configureAmplifyAuth=Ut,e.configureApollo=be,e.fragmentSpreadAstSelection=ct,e.gqlTyped=Oe,e.handleApolloError=U,e.handleCognitoCallback=function(e){return new Promise((function(t,n){return e((function(e,r){return e?n(e):t(r)}))}))},e.httpOptions=Ie,e.mapEdges=$t,e.processConnection=nt,e.throwClaimIdMismatch=Co,e.throwClaimNotApproved=Io,e.ɵa=Pe,e.ɵb=ve,e.ɵc=Ke,e.ɵd=ge,e.ɵe=Ft,e.ɵf=et,e.ɵh=zt,e.ɵj=yr,e.ɵk=$n,e.ɵl=Ln,Object.defineProperty(e,"__esModule",{value:!0})}));
|
|
2
2
|
//# sourceMappingURL=lifeready-core.umd.min.js.map
|