forked from tfcoop/www_duniayetu
78 lines
4.0 MiB
JavaScript
78 lines
4.0 MiB
JavaScript
|
/*! Copyright (c) 2022 WhatsApp Inc. All Rights Reserved. */
|
||
|
(self.webpackChunkwhatsapp_web_client=self.webpackChunkwhatsapp_web_client||[]).push([[2143],{363509:(e,t,n)=>{var r={"./f00.png":192256,"./f01.png":107151,"./f02.png":329449,"./f03.png":594719,"./f04.png":783004,"./f05.png":99381,"./f06.png":604893,"./f07.png":761353,"./f08.png":945598,"./f09.png":379575,"./f10.png":105211,"./f11.png":419751,"./f12.png":61294,"./f13.png":970938,"./f14.png":381790,"./f15.png":8669,"./f16.png":130047,"./f17.png":361022,"./f18.png":633295,"./f19.png":299635,"./f20.png":882645,"./f21.png":367083,"./f22.png":755359,"./f23.png":30003,"./f24.png":677659,"./f25.png":81024,"./f26.png":564195,"./f27.png":837704,"./f28.png":393374,"./f29.png":712282,"./f30.png":657894,"./f31.png":353320,"./f32.png":918234,"./f33.png":537426,"./f34.png":37382,"./f35.png":380904,"./f36.png":605193,"./f37.png":838324,"./f38.png":683149,"./f39.png":968480,"./f40.png":235741,"./f41.png":424081,"./f42.png":709062,"./f43.png":951839,"./f44.png":477271,"./f45.png":39622,"./f46.png":148373,"./f47.png":51400,"./f48.png":542720,"./f49.png":243805,"./f50.png":56995,"./f51.png":575688,"./f52.png":131796,"./f53.png":173785,"./f54.png":162521,"./f55.png":471449,"./f56.png":298224,"./f57.png":710601,"./f58.png":972870,"./f59.png":493224,"./f60.png":921564,"./f61.png":93169,"./f62.png":154423,"./f63.png":303491,"./f64.png":886262,"./f65.png":37806,"./f66.png":135049,"./f67.png":704971,"./f68.png":332845,"./f69.png":529664,"./f70.png":29469,"./f71.png":860540,"./f72.png":114364,"./f73.png":34476,"./f74.png":280952,"./f75.png":547236,"./f76.png":991385,"./f77.png":886342,"./f78.png":593828,"./f79.png":407026,"./f80.png":659076,"./f81.png":686555,"./f82.png":215330,"./f83.png":751331,"./f84.png":844780,"./f85.png":902506,"./f86.png":527300,"./f87.png":235074,"./f88.png":583020,"./f89.png":558516,"./f90.png":615707,"./f91.png":871247,"./f92.png":654647,"./f93.png":167517,"./f94.png":383439,"./f95.png":938404,"./f96.png":550273,"./f97.png":312123,"./f98.png":879144,"./f99.png":440594,"./favicon-error.png":172654,"./favicon-error2.png":819528,"./favicon.png":429242};function i(e){var t=a(e);return n(t)}function a(e){if(!n.o(r,e)){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}return r[e]}i.keys=function(){return Object.keys(r)},i.resolve=a,e.exports=i,i.id=363509},276554:(e,t,n)=>{var r={"./f00.png":211372,"./f01.png":648039,"./f02.png":149519,"./f03.png":298446,"./f04.png":868917,"./f05.png":146454,"./f06.png":580841,"./f07.png":941038,"./f08.png":457522,"./f09.png":604754,"./f10.png":644183,"./f11.png":899233,"./f12.png":800347,"./f13.png":452761,"./f14.png":219754,"./f15.png":318613,"./f16.png":117613,"./f17.png":670322,"./f18.png":55928,"./f19.png":98442,"./f20.png":732677,"./f21.png":664770,"./f22.png":643426,"./f23.png":31644,"./f24.png":106597,"./f25.png":407210,"./f26.png":561890,"./f27.png":258229,"./f28.png":181250,"./f29.png":341431,"./f30.png":60853,"./f31.png":875920,"./f32.png":621202,"./f33.png":523022,"./f34.png":746622,"./f35.png":13683,"./f36.png":945274,"./f37.png":374507,"./f38.png":536466,"./f39.png":855254,"./f40.png":695725,"./f41.png":297585,"./f42.png":175218,"./f43.png":81303,"./f44.png":249465,"./f45.png":55625,"./f46.png":448475,"./f47.png":767848,"./f48.png":658139,"./f49.png":697019,"./f50.png":263744,"./f51.png":814517,"./f52.png":302181,"./f53.png":665405,"./f54.png":661605,"./f55.png":990866,"./f56.png":671888,"./f57.png":435515,"./f58.png":18457,"./f59.png":820009,"./f60.png":63163,"./f61.png":820930,"./f62.png":969341,"./f63.png":108373,"./f64.png":399910,"./f65.png":510127,"./f66.png":134843,"./f67.png":168683,"./f68.png":279587,"./f69.png":481265,"./f70.png":929761,"./f71.png":67156,"./f72.png":14427,"./f73.png":118241,"./f74.png":555948,"./f75.png":305193,"./f76.png":585044,"./f77.png":56746,"./f78.png":973675,"./f79.png":263159,"./f80.png":437160,"./f81.png":331456,"./f82.png":958193,"./f83.png":68436,"./f84.png":15188,"./f85.png":335444,"./f86.png":961218,"./f87.png":712535,"./f88.png":756277,"./f89.png":111847,"./f90.png":83242,"./f91.png":697168,"./f92.png":9067
|
||
|
/*! modernizr 3.11.8 (Custom Build) | MIT *
|
||
|
* https://modernizr.com/download/?-adownload-cssanimations-csstransitions-exiforientation-serviceworker-webp-domprefixes-hasevent-prefixed-prefixes-setclasses-testallprops-testprop !*/
|
||
|
!function(e,t,n,r){function i(e,t){return typeof e===t}function a(e){var t=T.className,n=E._config.classPrefix||"";if(v&&(t=t.baseVal),E._config.enableJSClass){var r=new RegExp("(^|\\s)"+n+"no-js(\\s|$)");t=t.replace(r,"$1"+n+"js$2")}E._config.enableClasses&&(e.length>0&&(t+=" "+n+e.join(" "+n)),v?T.className.baseVal=t:T.className=t)}function o(){return"function"!=typeof n.createElement?n.createElement(arguments[0]):v?n.createElementNS.call(n,"http://www.w3.org/2000/svg",arguments[0]):n.createElement.apply(n,arguments)}function s(e,t){return!!~(""+e).indexOf(t)}function l(e,t,r,i){var a,s,l,u,c="modernizr",d=o("div"),p=function(){var e=n.body;return e||((e=o(v?"svg":"body")).fake=!0),e}();if(parseInt(r,10))for(;r--;)(l=o("div")).id=i?i[r]:c+(r+1),d.appendChild(l);return(a=o("style")).type="text/css",a.id="s"+c,(p.fake?p:d).appendChild(a),p.appendChild(d),a.styleSheet?a.styleSheet.cssText=e:a.appendChild(n.createTextNode(e)),d.id=c,p.fake&&(p.style.background="",p.style.overflow="hidden",u=T.style.overflow,T.style.overflow="hidden",T.appendChild(p)),s=t(d,e),p.fake&&p.parentNode?(p.parentNode.removeChild(p),T.style.overflow=u,T.offsetHeight):d.parentNode.removeChild(d),!!s}function u(e){return e.replace(/([A-Z])/g,(function(e,t){return"-"+t.toLowerCase()})).replace(/^ms-/,"-ms-")}function c(e,n){var i=e.length;if("CSS"in t&&"supports"in t.CSS){for(;i--;)if(t.CSS.supports(u(e[i]),n))return!0;return!1}if("CSSSupportsRule"in t){for(var a=[];i--;)a.push("("+u(e[i])+":"+n+")");return l("@supports ("+(a=a.join(" or "))+") { #modernizr { position: absolute; } }",(function(e){return"absolute"===function(e,n,r){var i;if("getComputedStyle"in t){i=getComputedStyle.call(t,e,n);var a=t.console;null!==i?r&&(i=i.getPropertyValue(r)):a&&a[a.error?"error":"log"].call(a,"getComputedStyle returning null, its possible modernizr test results are inaccurate")}else i=!n&&e.currentStyle&&e.currentStyle[r];return i}(e,null,"position")}))}return r}function d(e){return e.replace(/([a-z])-([a-z])/g,(function(e,t,n){return t+n.toUpperCase()})).replace(/^-/,"")}function p(e,t,n,a){function l(){p&&(delete b.style,delete b.modElem)}if(a=!i(a,"undefined")&&a,!i(n,"undefined")){var u=c(e,n);if(!i(u,"undefined"))return u}for(var p,_,f,h,g,m=["modernizr","tspan","samp"];!b.style&&m.length;)p=!0,b.modElem=o(m.shift()),b.style=b.modElem.style;for(f=e.length,_=0;_<f;_++)if(h=e[_],g=b.style[h],s(h,"-")&&(h=d(h)),b.style[h]!==r){if(a||i(n,"undefined"))return l(),"pfx"!==t||h;try{b.style[h]=n}catch(e){}if(b.style[h]!==g)return l(),"pfx"!==t||h}return l(),!1}function _(e,t){return function(){return e.apply(t,arguments)}}function f(e,t,n,r,a){var o=e.charAt(0).toUpperCase()+e.slice(1),s=(e+" "+I.join(o+" ")+o).split(" ");return i(t,"string")||i(t,"undefined")?p(s,t,r,a):function(e,t,n){var r;for(var a in e)if(e[a]in t)return!1===n?e[a]:i(r=t[e[a]],"function")?_(r,n||t):r;return!1}(s=(e+" "+C.join(o+" ")+o).split(" "),t,n)}function h(e,t,n){return f(e,r,r,t,n)}function g(e,t){if("object"==typeof e)for(var n in e)R(e,n)&&g(n,e[n]);else{var r=(e=e.toLowerCase()).split("."),i=E[r[0]];if(2===r.length&&(i=i[r[1]]),void 0!==i)return E;t="function"==typeof t?t():t,1===r.length?E[r[0]]=t:(!E[r[0]]||E[r[0]]instanceof Boolean||(E[r[0]]=new Boolean(E[r[0]])),E[r[0]][r[1]]=t),a([(t&&!1!==t?"":"no-")+r.join("-")]),E._trigger(e,t)}return E}var m=[],y={_version:"3.11.8",_config:{classPrefix:"",enableClasses:!0,enableJSClass:!0,usePrefixes:!0},_q:[],on:function(e,t){var n=this;setTimeout((function(){t(n[e])}),0)},addTest:function(e,t,n){m.push({name:e,fn:t,options:n})},addAsyncTest:function(e){m.push({name:null,fn:e})}},E=function(){};E.prototype=y,E=new E;var S=[],T=n.documentElement,v="svg"===T.nodeName.toLowerCase(),A="Moz O ms Webkit",C=y._config.usePrefixes?A.toLowerCase().split(" "):[];y._domPrefixes=C;var P=y._config.usePrefixes?" -webkit- -moz- -o- -ms- ".split(" "):["",""];y._prefixes=P;var O=function(){var e=!("onblur"in T);return function(t,n){var i;return!!t&&(n&&"string"!=typeof n||(n=o(n||"div")),!(i=(t="on"+t)in n)&&e&&(n.setAttribute||(n=o("div")),n.setAttribute(t,
|
||
|
\tmoving blocked collections to dirty: [${e}]
|
||
|
\tadding inflight collections to pending: [${Array.from(v)}]`,L()};var i=r(n(311504)),a=n(819416),o=n(759998),s=n(773244),l=n(171537),u=n(787252),c=(n(865254),r(n(157926))),d=n(155172),p=(n(284642),n(28900)),_=n(3923),f=n(43959),h=n(493635),g=n(61314),m=n(823240),y=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=E(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(573166));function E(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(E=function(e){return e?n:t})(e)}const S=36e5;let T,v=new Set,A=new Set,C=!1,P=0,O=0;function I(){return M.apply(this,arguments)}function M(){return(M=(0,i.default)((function*(e,t){const n=null!=t?yield b(e,t):e;return __LOG__(2)`syncd: marking for sync: ${n}`,n.forEach((e=>{const t=c.default.getCollectionState(e);__LOG__(2)`syncd: ${e} state before sync: ${t}`,t===d.CollectionSyncState.UpToDate?c.default.moveCollectionsToDirty([e]):t===d.CollectionSyncState.Dirty&&(A=new Set([...Array.from(A),e]))})),yield c.default.persistToDb(),L()}))).apply(this,arguments)}function b(){return R.apply(this,arguments)}function R(){return(R=(0,i.default)((function*(e,t){__LOG__(2)`syncd: start filter collections: ${e}`;const n=yield(0,o.bulkGetCollectionVersionsInTransaction)(e),r=new Map(e.map(((e,t)=>{var r;return[e,null===(r=n[t])||void 0===r?void 0:r.version]})));return e.filter((e=>{const n=r.get(e);if(null==n)return __LOG__(2)`syncd: local version for ${e} missing; will mark for sync.`,!0;const i=t.get(e);return null==i?(__LOG__(2)`syncd: server version for ${e} missing; will mark for sync.`,!0):n<i?(__LOG__(2)`syncd: local version (${n}) for ${e} less than server version (${i}); will mark for sync.`,!0):(__LOG__(2)`syncd: local version (${n})for ${e} >= server version (${i}); will not mark for sync.`,!1)}))}))).apply(this,arguments)}function N(){return(N=(0,i.default)((function*(){const e=yield(0,u.countSyncActionsInTransaction)();y.setStoredMutationCount(e);const t=yield(0,u.getSyncActionsByActionStatesInTransaction)([d.SyncActionState.Malformed]);y.setInvalidActionCount(t.length);const n=yield(0,u.getSyncActionsByActionStatesInTransaction)([d.SyncActionState.Unsupported]);y.setUnsupportedActionCount(n.length);const r=yield(0,s.getMissingKeyCountTransaction)();y.setMissingKeyCount(r)}))).apply(this,arguments)}function w(){return(w=(0,i.default)((function*(){}))).apply(this,arguments)}function L(){return D.apply(this,arguments)}function D(){return(D=(0,i.default)((function*(){if((0,p.isSyncdDisabled)())return Promise.resolve();const e=c.default.getCollectionsInStateDirty();__LOG__(2)`syncd: dirty collections: ${e}`;const t=new Set(e.filter((e=>!v.has(e))));if(0===t.size)return __LOG__(2)`syncd: no collections to sync`,Promise.resolve();let n=[];try{v=new Set([...Array.from(v),...Array.from(t)]),__LOG__(2)`syncd: initiate server sync`,n=yield(0,m.serverSync)(Array.from(t)),__LOG__(2)`syncd: server sync successful`;const e=n.filter((e=>e.state===d.CollectionState.ErrorRetry));e.length>0&&(O=e[0].serverBackoff||0,P=0),G(n)}catch(e){__LOG__(2)`syncd: exception during sync(): ${e}`,c.default.moveCollectionsToFiniteRetry(Array.from(t))}finally{__LOG__(2)`syncd: cleanup after sync()`,c.default.persistToDb(),v=new Set(Array.from(v).filter((e=>!t.has(e)))),U(),yield(0,a.getDbImpls)().handleSyncCompleted(n)}}))).apply(this,arguments)}function k(){if((0,p.isSyncdDisabled)())return;const e=new Set(c.default.getCollectionsInStateRetry());var t,n;0!==e.size&&(T=setTimeout((0,i.default)((function*(){try{C=!0,P+=1,__LOG__(2)`syncd: initiate server sync retry`;const t=yield(0,m.serverSync)(Array.from(e));__LOG__(2)`syncd: server sync retry successful`,G(t)}catch(t){__LOG__(2)`syncd: exception during handleRetry(): ${t}`,c.default.moveCollections
|
||
|
${e} snapshot macsToAdd:
|
||
|
${Array.from(l.entries()).map((e=>{let[t,n]=e;return S(t,n)})).join("\n\t")}`;const u=yield o.LT_HASH_ANTI_TAMPERING.add(o.EMPTY_LT_HASH,Array.from(l.values())),{snapshotMacKey:c}=yield(0,_.generateEncryptionKeys)(s),d=(0,f.to64BitNetworkOrder)(r.version),p=(0,f.toUtf8)(e).buffer;return __LOG__(2)`syncd: validating snapshot mac for ${e} snapshot v${r.version}:
|
||
|
ltHash: ${(0,f.arrayBufferToHexPadded)(u)}
|
||
|
encoded version: ${(0,f.arrayBufferToHexPadded)(d)}
|
||
|
encoded collection: ${(0,f.arrayBufferToHexPadded)(p)}
|
||
|
expected snapshotMAC: ${(0,f.arrayBufferToHexPadded)(n)}`,yield O(e,n,c,u,d,p,!0,a.length,t.version.version),u}))).apply(this,arguments)}function A(){return(A=(0,i.default)((function*(e,t,n){const{version:r,mutations:a,snapshotMac:o,patchMac:s,keyId:l}=t,u=l.id,c=yield(0,g.getKeyData)(u);if(!c)throw new h.SyncdMissingKeyError;const{snapshotMacKey:p,patchMacKey:y}=yield(0,_.generateEncryptionKeys)(c),E=a.map((e=>({operation:e.operation,indexMac:e.record.index.blob,valueMac:(0,_.valueMacFromIndexAndValueCipherText)(e.record.value.blob)}))),T=yield N(e,E,n),v=(0,f.to64BitNetworkOrder)(r.version),A=(0,f.toUtf8)(e).buffer;__LOG__(2)`syncd: validating snapshot and patch mac for ${e} v${r.version}:
|
||
|
expected snapshotMAC: ${(0,f.arrayBufferToHexPadded)(o)}
|
||
|
expected patchMAC: ${(0,f.arrayBufferToHexPadded)(s)}
|
||
|
encoded version: ${(0,f.arrayBufferToHexPadded)(v)}
|
||
|
encoded collection: ${(0,f.arrayBufferToHexPadded)(A)}
|
||
|
key ID: ${(0,f.arrayBufferToHexPadded)((0,m.fromSyncKeyId)(u))}`;try{yield M(e,s,y,o,E.map((e=>e.valueMac)),v,A,a.length,r.version),yield O(e,o,p,T,v,A,!1,a.length,r.version)}catch(e){throw yield function(){return C.apply(this,arguments)}(),e}return T;function C(){return(C=(0,i.default)((function*(){const t=yield G(e,!1),n=new Map(t.map((e=>{let{indexMac:t,valueMac:n}=e;return[(0,f.arrayBufferToHexPadded)(t),(0,f.arrayBufferToHexPadded)(n)]})));__LOG__(2)`syncd: error on incoming records:
|
||
|
\t${E.map((e=>{let{operation:t,indexMac:r,valueMac:i}=e;return`${t===d.SyncdMutation$SyncdOperation.SET?"set":"remove"} | ${S(r,i,!1)} | ${n.has((0,f.arrayBufferToHexPadded)(r))?"found":"did not find"} indexMAC in the above logged macs`})).join("\n\t")}`}))).apply(this,arguments)}}))).apply(this,arguments)}function C(){return P.apply(this,arguments)}function P(){return(P=(0,i.default)((function*(e,t){const n=yield(0,l.getCollectionVersionInTransaction)(e).then((e=>{var t;return null!==(t=null==e?void 0:e.version)&&void 0!==t?t:0}));if(n!==t-1){const r=n>t-1?"greater-than-expected":"less-than-expected";throw __LOG__(3,void 0,void 0,!0)`syncd: ${e} received patch v${t} !== latest local version (v${n}) + 1`,SEND_LOGS(`syncd-version-check-error-local-version-${r}`),new h.SyncdRetryableError(`syncd-version-check-error-local-version-${r}`)}const r=yield(0,l.getCollectionVersionLtHashInTransaction)(e);if((0,s.arrayBuffersEqual)(r,o.EMPTY_LT_HASH)&&1!==t)throw __LOG__(3,void 0,void 0,!0)`syncd: empty local lthash found when processing ${e} patch v${t}`,SEND_LOGS("syncd-empty-lthash-on-mac-mismatch"),new h.SyncdRetryableError("empty lthash")}))).apply(this,arguments)}function O(){return I.apply(this,arguments)}function I(){return(I=(0,i.default)((function*(e,t,n,r,i,o,u,c,d){var p;const f=(0,a.getConfig)().syncdShouldNotFatalOnSnapshotMacMismatchInPatches()&&!u,g=null!==(p=yield(0,l.getIsCollectionInMacMismatchFatalInTransaction)(e))&&void 0!==p&&p;if(f&&g)return void __LOG__(2)`syncd: collection ${e} is already in snapshot mac mismatch so not checking again`;const m=yield(0,_.generateSnapshotMac)(n,r,i,o);if(!(0,s.arrayBuffersEqual)(m,t)){__LOG__(3,void 0,void 0,!0)`syncd: unable to validate snapshot mac.`,SEND_LOGS("syncd: unable to validate snapshot mac."),u||(yield C(e,d));const t=u?y.SyncdFatalErrorType.SNAPSHOT_MAC_MISMATCH_IN_SNAPSHOT:y.SyncdFatalErrorType.SNAPSHOT_MAC_MISMATCH_IN_PATCH;if((0,y.reportSyncdFatalError)(t,e,c,d,!f),f)return yield(0,l.updateIsCollectionInMacMismatchFatalInTransaction)(e),void __LOG__(2)`syncd: skip fatal after snapshot mac mismatch for collection ${e}`;throw new h.SyncdFatalError("unable to validate snapshot mac")}}))).apply(this,arguments)}function M(){return b.apply(this,arguments)}function b(){return(b=(0,i.default)((function*(e,t,n,r,i,a,o,l,u){const c=yield(0,_.generatePatchMac)(n,r,i,a,o);if(!(0,s.arrayBuffersEqual)(c,t))throw yield C(e,u),(0,y.reportSyncdFatalError)(y.SyncdFatalErrorType.MAC_MISMATCH_PATCH,e,l,u),__LOG__(3,void 0,void 0,!0)`syncd: unable to validate patch mac.`,SEND_LOGS("syncd: unable to validate patch mac."),new h.SyncdFatalError("unable to validate patch mac")}))).apply(this,arguments)}function R(){return(R=(0,i.default)((function*(e,t,n,r){const i=(yield(0,l.getCollectionVersionInTransaction)(e).then((e=>{var t;return null!==(t=null==e?void 0:e.version)&&void 0!==t?t:p.DEFAULT_COLLECTION_VERSION})))+1,{patchMacKey:a,snapshotMacKey:o}=yield(0,_.generateEncryptionKeys)(r),s=(0,f.to64BitNetworkOrder)(i),u=(0,f.toUtf8)(e).buffer,c=yield(0,_.generateSnapshotMac)(o,t,s,u),d=yield(0,_.generatePatchMac)(a,c,n.map((e=>e.valueMac)),s,u);return __LOG__(2)`syncd: computing snapshot and patch macs for outgoing patch ${e} v${i}:
|
||
|
encoded version: ${(0,f.arrayBufferToHexPadded)(s)}
|
||
|
encoded collection: ${(0,f.arrayBufferToHexPadded)(u)}
|
||
|
snapshotMAC: ${(0,f.arrayBufferToHexPadded)(c)}
|
||
|
patchMAC: ${(0,f.arrayBufferToHexPadded)(d)}`,{snapshotMac:c,patchMac:d}}))).apply(this,arguments)}function N(){return w.apply(this,arguments)}function w(){return(w=(0,i.default)((function*(e,t,n){const r=yield(0,l.getCollectionVersionLtHashInTransaction)(e),s=yield k(t.map((e=>e.indexMac))),u=new Map,p=new Map,_=new Map;yield(0,c.promiseEach)(t,function(){var t=(0,i.default)((function*(t){const{indexMac:r,valueMac:i,operation:o}=t,l=T.decode(r),c=s.get(l);if(c)o===d.SyncdMutation$SyncdOperation.REMOVE?p.set((0,f.arrayBufferToHexPadded)(r),c):_.set((0,f.arrayBufferToHexPadded)(r),c);else if(o===d.SyncdMutation$SyncdOperation.REMOVE){const t=yield function(e){if(null==n)return Promise.resolve(null);return n(e)}(r);var h,g;if(null!=t)p.set((0,f.arrayBufferToHexPadded)(r),t),__LOG__(3,void 0,void 0,!0,["non-sad"])`syncd: had to use fallbackQueryForValueMac in collection ${e} for platform ${null!==(h=(0,a.getConfig)().primaryPlatform())&&void 0!==h?h:"[empty]"}: ${(0,f.arrayBufferToHexPadded)(r).slice(-16)}
|
||
|
}`,SEND_LOGS("syncd: fallback query");else(0,E.reportSyncdCriticalEvent)(E.SyncdCriticalEventType.MISSING_MUTATION_TO_REMOVE,e),__LOG__(3)`syncd: missing indexMAC in sync-actions table for REMOVE mutation in collection ${e} for platform ${null!==(g=(0,a.getConfig)().primaryPlatform())&&void 0!==g?g:"[empty]"}:
|
||
|
${(0,f.arrayBufferToHexPadded)(r).slice(-16)}`}o===d.SyncdMutation$SyncdOperation.SET&&u.set((0,f.arrayBufferToHexPadded)(r),i)}));return function(){return t.apply(this,arguments)}}());const h=yield o.LT_HASH_ANTI_TAMPERING.subtractThenAdd(r,Array.from(u.values()),Array.from(p.values()).concat(Array.from(_.values())));return __LOG__(2)`syncd: computing ltHash for ${e}:
|
||
|
currentLtHash: ${(0,f.arrayBufferToHexPadded)(r)}
|
||
|
macsToAdd:
|
||
|
${Array.from(u.entries()).map((e=>{let[t,n]=e;return S(t,n)})).join("\n\t")}
|
||
|
macsToRemove:
|
||
|
${Array.from(p.entries()).map((e=>{let[t,n]=e;return S(t,n)})).join("\n\t")}
|
||
|
macsToOverwrite (also remove):
|
||
|
${Array.from(_.entries()).map((e=>{let[t,n]=e;return S(t,n)})).join("\n\t")}
|
||
|
newLtHash: ${(0,f.arrayBufferToHexPadded)(h)}`,h}))).apply(this,arguments)}function L(){return(L=(0,i.default)((function*(){const e=yield(0,a.runInTransaction)(["SyncActionStore","CollectionVersionStore"],function(){var e=(0,i.default)((function*(e){let{SyncActionStore:t,CollectionVersionStore:n}=e;const r=yield n.getAll();return Promise.all(r.map(function(){var e=(0,i.default)((function*(e){let{collection:n,ltHash:r}=e;return{collection:n,ltHash:r,mutations:yield t.getByCollections([n])}}));return function(){return e.apply(this,arguments)}}()))}));return function(){return e.apply(this,arguments)}}());yield Promise.all(e.map(function(){var e=(0,i.default)((function*(e){let{collection:t,ltHash:n,mutations:r}=e;const i=yield D(r);(0,s.arrayBuffersEqual)(n,i)||(__LOG__(4,!0,new Error,!0)`syncd: failed LtHash check for ${t}`,SEND_LOGS("LtHash check failed"))}));return function(){return e.apply(this,arguments)}}()))}))).apply(this,arguments)}function D(e){const t=new Map(e.map((e=>[(0,f.arrayBufferToHexPadded)(e.indexMac),e.valueMac])));return o.LT_HASH_ANTI_TAMPERING.add(o.EMPTY_LT_HASH,Array.from(t.values()))}function k(){return U.apply(this,arguments)}function U(){return(U=(0,i.default)((function*(e){const t=yield(0,u.getSyncActionsByIndexMacsInTransaction)(e);return new Map(t.map((e=>[T.decode(e.indexMac),e.valueMac])))}))).apply(this,arguments)}function G(){return x.apply(this,arguments)}function x(){return(x=(0,i.default)((function*(e){let t=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];const n=t?20:1;__LOG__(2)`syncd: logMacs: ${e}: prepare`;const[r,i]=yield(0,a.runInTransaction)(["SyncActionStore","CollectionVersionStore"],(t=>{let{SyncActionStore:n,CollectionVersionStore:r}=t;return Promise.all([r.get(e).then((e=>null==e?void 0:e.version)),n.getByCollections([e])])}));if(__LOG__(2)`syncd: current snapshot ${e} v${r} with ${i.length} mutations:`,t&&i.length>100)return i;const o=i.reduce(((e,r,i)=>(i%n==0&&e.push(""),e[e.length-1]+=S(r.indexMac,r.valueMac,t)+" | ",e)),[]);return o.forEach((e=>__LOG__(2)`|${e}`)),i}))).apply(this,arguments)}},155172:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncModelType=t.SyncDataType=t.SyncActionState=t.MIN_PATCH_SIZE=t.MIN_INLINE_MUTATIONS=t.MAX_PATCH_SIZE=t.MAX_INLINE_MUTATIONS=t.LABEL_ASSOCIATION_SYNC_VERSION=t.FINITE_FAILURE_EXPIRY_DURATION=t.DEFAULT_COLLECTION_VERSION=t.ConflictResolutionState=t.CollectionSyncState=t.CollectionState=t.CollectionName=t.CHAT_ASSIGNMENT_SYNC_VERSION=t.BACKOFF_MIN_TIMEOUT=t.BACKOFF_MAX_TIMEOUT=t.BACKOFF_BASE=t.Actions=void 0;var r=n(990445);t.BACKOFF_MIN_TIMEOUT=1e3;t.BACKOFF_MAX_TIMEOUT=36e5;t.BACKOFF_BASE=2;const i=2*r.DAY_MILLISECONDS;t.FINITE_FAILURE_EXPIRY_DURATION=i;t.MIN_INLINE_MUTATIONS=100;t.MAX_INLINE_MUTATIONS=2e3;t.MIN_PATCH_SIZE=10;t.MAX_PATCH_SIZE=100;t.DEFAULT_COLLECTION_VERSION=0;t.LABEL_ASSOCIATION_SYNC_VERSION=3;t.CHAT_ASSIGNMENT_SYNC_VERSION=7;const a=n(654302)({Star:"star",Contact:"contact",Mute:"mute",PinDEPRECATED:"pin",Pin:"pin_v1",SettingPushName:"setting_pushName",LabelEdit:"label_edit",LabelMessage:"label_message",LabelJid:"label_jid",QuickReply:"quick_reply",LocaleSetting:"setting_locale",Archive:"archive",MarkChatAsRead:"markChatAsRead",ClearChat:"clearChat",DeleteMessageForMe:"deleteMessageForMe",Sentinel:"sentinel",UnarchiveChatsSetting:"setting_unarchiveChats",DeleteChat:"deleteChat",AndroidUnsupportedActions:"android_unsupported_actions",PrimaryFeature:"primary_feature",Subscription:"subscription",Nux:"nux",Agent:"deviceAgent",TimeFormat:"time_format",UserStatusMute:"userStatusMute",PrimaryVersion:"primary_version",RemoveRecentSticker:"removeRecentSticker",ChatAssignment:"agentChatAssignment",ChatAssignmentOpenedStatus:"agentChatAssignmentOpenedStatus",FavoriteSticker:"favoriteSticker"});t.Actions=a;const o=n(654302)({Regular:"regular",RegularLow:"regular_low",RegularHigh:"regular_high",CriticalBlock:"critical_block",CriticalUnblockLow:"critical_unblock_low"});t.CollectionName=o;const s=n(654302).Mirrored(["Success","SuccessHasMore","Conflict","ConflictHasMore","ErrorRetry"
|
||
|
minPatch: ${e}`,__LOG__(4,void 0,new Error,!0)`syncd: has missing patches`,SEND_LOGS("syncd: has missing patches"),(0,o.getConfig)().syncdShouldFatalOnMissingPatch())throw(0,C.reportSyncdFatalError)(C.SyncdFatalErrorType.SERVER_DID_NOT_SEND_ALL_PATCHES,r,void 0,null!=t?t:0),new S.SyncdFatalError("syncd: has missing patches")}yield $(r,g,n),__LOG__(2)`syncd: ${r} patches applied successfully`}else null!=i?(yield G(r,i,c,d),__LOG__(2)`syncd: ${r} v${i} uploaded successfully`):((0,m.isBootstrap)(t)&&(yield(0,l.updateCollectionVersionAndLtHashInTransaction)(r,0,D)),__LOG__(2)`syncd: sync ${r} but there are no updates`);const E=Math.floor(performance.now()-y);return __LOG__(2)`syncd: applyAppStateSyncResponse: finished applying ${r} in ${E}ms`,(g||f)&&(0,m.isBootstrap)(t)&&!(0,m.isCriticalCollection)(r)&&(0,P.reportSyncdBootstrapDataApplied)(r,null!=f?P.SyncdBootstrapDataAppliedSnapshotUsed.SNAPSHOT_USED:P.SyncdBootstrapDataAppliedSnapshotUsed.SNAPSHOT_NOT_USED,E),yield(0,h.logMacsInSnapshot)(e.name),e}catch(e){const t=e.message;return e instanceof S.SyncdMissingKeyError?(__LOG__(3)`syncd: key error: ${r} missing keys`,{name:r,state:y.CollectionState.Blocked}):e instanceof S.SyncdFatalError?(__LOG__(4,void 0,new Error,!0)`syncd: fatal error: ${r} throws ${t}`,SEND_LOGS(`syncd: fatal error: ${String(r)} throws ${t}`),{name:r,state:y.CollectionState.ErrorFatal}):(__LOG__(3,void 0,void 0,!0)`syncd: retryable error: ${r} throws ${t}`,SEND_LOGS(`syncd: retryable error: ${String(r)} throws ${t}`),{name:r,state:y.CollectionState.ErrorRetry})}}))).apply(this,arguments)}function G(){return x.apply(this,arguments)}function x(){return(x=(0,a.default)((function*(e,t,n,r){var i;yield(0,h.logMacsInSnapshot)(e);const s=r.map((e=>({indexMac:e.indexMac,valueMac:e.valueMac,operation:e.operation}))),u=yield(0,h.computeLtHash)(e,s),c=(0,g.encryptedUploadMutationsToSyncActions)(r.filter((e=>e.operation===_.SyncdMutation$SyncdOperation.SET)),y.SyncActionState.Success),d=null!==(i=yield(0,l.getCollectionVersionInTransaction)(e).then((e=>null==e?void 0:e.version)))&&void 0!==i?i:0;t!==d+1&&(__LOG__(4,void 0,new Error,!0)`syncd: _uploadSuccessful: unexpected server version (${t}) after patch upload, expected ${d+1}`,SEND_LOGS("syncd: unexpected server version after patch upload")),__LOG__(2)`syncd: _uploadSuccessful: write to db for ${e}`,yield(0,o.runInTransaction)(["SyncActionStore","PendingMutationStore","CollectionVersionStore"],function(){var r=(0,a.default)((function*(r){let{SyncActionStore:i,PendingMutationStore:a,CollectionVersionStore:o}=r;yield i.bulkSet(c),yield a.bulkRemove(n),yield o.update(e,{version:t,ltHash:u})}));return function(){return r.apply(this,arguments)}}()),__LOG__(2)`syncd: end _uploadSuccessful for ${e}`}))).apply(this,arguments)}function B(){return F.apply(this,arguments)}function F(){return(F=(0,a.default)((function*(e,t,n,r){let i=Promise.resolve(),o=0;const s=(0,N.unixTimeMs)();if(null!=n){var l;const t=b.default.validateExternalBlobReference(e,n);o+=(0,d.numberOrThrowIfTooLarge)(null!==(l=t.fileSizeBytes)&&void 0!==l?l:0),__LOG__(2)`syncd: download snapshot for ${e}`,i=(0,O.downloadSnapshot)(e,t)}let u,c,p=Promise.resolve();if(null!=t&&t.length>0){const n=t.map((t=>b.default.validatePatchProtobuf(e,t)));p=Promise.all(n.map(function(){var t=(0,a.default)((function*(t){let n=t.mutations||[];const r=t.externalMutations;var i;r&&(__LOG__(2)`syncd: download patch for ${e}`,n=yield(0,O.downloadExternalPatch)(e,r),__LOG__(2)`syncd: ${e}'s external patch downloaded`,o+=(0,d.numberOrThrowIfTooLarge)(null!==(i=r.fileSizeBytes)&&void 0!==i?i:0));return{mutations:n,version:t.version,snapshotMac:t.snapshotMac,patchMac:t.patchMac,keyId:t.keyId,exitCode:t.exitCode,deviceIndex:t.deviceIndex}}));return function(){return t.apply(this,arguments)}}()))}try{[u,c]=yield Promise.all([i,p]),(0,m.isBootstrap)(r)&&(0,P.reportSyncdBootstrapAppStateDownloadMetric)({collection:e,downloadStartTs:s,downloadSize:o,isSuccess:"success"})}catch(t){throw(0,m.isBootstrap)(r)&&(0,P.reportSyncdBootstrapAppStateDownloadMetric)({collection:e,downloadStartTs
|
||
|
SET count: ${i}
|
||
|
REMOVE count: ${l}`,0===i&&0===l&&(__LOG__(3,void 0,void 0,!0)`syncd: ${e}: empty patch found`,SEND_LOGS(`syncd: ${e}: empty patch found`));const{measuredComputeLtHashAndValidatePatch:u,measuredTryDecryptPatch:d}=Y(n),p=yield u(e,t,(function(){return O.apply(this,arguments)}));__LOG__(2)`syncd: completed computeLtHashAndValidatePatch for ${e} v${t.version.version}`;const f=yield d(e,t);(0,A.reportSyncdDecryptedMutations)(A.SyncdDecryptMutationsType.PATCH_MUTATIONS,f),R.addMutationCount(f.length),(0,M.validateNoSameIndexForMultipleMutations)(e,f,y.SyncDataType.Patch);const g=ne(f),m=g.filter((e=>e.operation===_.SyncdMutation$SyncdOperation.REMOVE));yield Z(e,m),__LOG__(2)`syncd: completed _applyRemoveMutations for ${e} v${t.version.version}`;const E=g.filter((e=>e.operation===_.SyncdMutation$SyncdOperation.SET)),{setMutationsToPersist:T,pendingMutationsToDrop:v}=yield Q(e,E,y.SyncDataType.Patch,n);__LOG__(2)`syncd: processed ${f.length} mutations in patch version ${t.version.version} of collection ${e}`,null==n||n.mark("update_DB_start",{source:y.SyncDataType.Patch,setMutationsToPersistCount:T.length,pendingMutationsToDropCount:v.length});const P=t.version.version;function O(){return(O=(0,a.default)((function*(t){var n;return null===(n=(yield(0,c.getSyncActionsByCollectionsInTransaction)([e])).filter((e=>(0,s.arrayBuffersEqual)(t,e.indexMac))).pop())||void 0===n?void 0:n.valueMac}))).apply(this,arguments)}yield(0,o.runInTransaction)(["SyncActionStore","PendingMutationStore","CollectionVersionStore"],function(){var t=(0,a.default)((function*(t){let{SyncActionStore:n,PendingMutationStore:r,CollectionVersionStore:i}=t;yield n.bulkRemove(m.map((e=>e.index))),yield n.bulkSet(T),yield r.bulkRemove(v),yield i.update(e,{version:P,ltHash:p})}));return function(){return t.apply(this,arguments)}}()),null==n||n.mark("update_DB_end",{source:y.SyncDataType.Patch}),__LOG__(2)`syncd: completed final transaction in _applyPatch for ${e} v${t.version.version}`}))).apply(this,arguments)}function Q(){return X.apply(this,arguments)}function X(){return(X=(0,a.default)((function*(e,t,n,r){(0,A.reportSyncdCriticalBootstrapStage)(A.SyncdCriticalBootstrapStageType.ABOUT_TO_APPLY_MUTATIONS);const a=n===y.SyncDataType.Local?" (individual mutations)":"",o=[],s=(0,M.validateAndTypeSetMutations)(e,t),{supportedMutations:l,unsupportedMutations:u}=re(e,s);u.forEach((e=>o.push((0,g.setMutationToSyncAction)(e,y.SyncActionState.Unsupported)))),null==r||r.mark("conflict_resolution_start",{source:n,collectionName:e,count:l.length});const{remoteMutationsToApply:c,pendingMutationsToDrop:d}=yield(0,I.resolveConflict)(e,l),_=l.filter((e=>!c.includes(e)));null==r||r.mark("conflict_resolution_end",{source:n,collectionName:e,apply:c.length,drop:_.length}),_.forEach((e=>o.push((0,g.setMutationToSyncAction)(e,y.SyncActionState.Skipped,e.actionName)))),null==r||r.mark("apply_set_mutations_start",{source:n,collectionName:e,count:c.length});const h=ie(c);for(let t=0;t<h.length;t++){const n=h[t][0].actionHandler,r=h[t].map((e=>{let t;return t=e.binarySyncData?(0,p.default)((0,w.decodeProtobuf)(f.SyncActionDataSpec,e.binarySyncData).value,"decodeProtobuf(SyncActionDataSpec, m.binarySyncData).value"):(0,w.decodeProtobuf)(f.SyncActionValueSpec,e.binarySyncAction),{operation:"set",indexParts:e.indexArr,value:t,timestamp:e.timestamp}}));let i=[],s=!1;try{__LOG__(2)`syncd: before apply mutation batch for ${e}. mutations count: ${r.length} ${a}`,i=yield n.applyMutations(r,{setMutationsPendingToPersist:o,allSupportedSetMutations:c})}catch(t){if(t instanceof S.SyncdFatalError||e===y.CollectionName.CriticalBlock)throw t;s=!0,__LOG__(3)`synd: catching error during _applySetMutations: ${t}`}__LOG__(2)`syncd: after apply mutation batch for ${e} ${a}`;for(let e=0;e<h[t].length;e++){var m,E;const n=s?y.SyncActionState.Failed:i[e].actionState;o.push((0,g.setMutationToSyncAction)(h[t][e],n,h[t][e].actionName,s||null===(m=i[e].orphanModel)||void 0===m?void 0:m.modelId,s||null===(E=i[e].orphanModel)||void 0===E?void 0:E.modelType))}}const T=o.reduce(((e,t)=>{const n=t.actionState;return n
|
||
|
\tkeys with keyData: ${n}
|
||
|
\tkeys without keyData: ${r}`,(0,o.runInTransaction)(["MissingKeyStore"],function(){var e=(0,i.default)((function*(e){let{MissingKeyStore:i}=e;if(n.length>0&&(yield i.bulkRemove(n),yield h({MissingKeyStore:i})),r.length>0){const e=(yield i.bulkGet(r)).filter(Boolean);e.forEach((e=>e.deviceResponses.set(t,!1))),__LOG__(2)`syncd: updateMissingKeys: begin updating missing keys from device ${t}
|
||
|
\tmissingKeys: [${r}]`,yield i.bulkUpdate(e),__LOG__(2)`syncd: updateMissingKeys: finish updating missing keys from device ${t}`,yield T({MissingKeyStore:i})}}));return function(){return e.apply(this,arguments)}}())};var i=r(n(311504)),a=n(583159),o=n(819416),s=n(773244),l=n(865254),u=n(284642),c=n(493635),d=n(990445);let p;function _(){return(_=(0,i.default)((function*(){const e=(yield(0,o.getDbImpls)().getDeviceFingerprint()).deviceIndexes;return(0,o.runInTransaction)(["MissingKeyStore"],function(){var t=(0,i.default)((function*(t){let{MissingKeyStore:n}=t;const r=yield n.getAll();if(0===r.length)return Promise.resolve();r.forEach((t=>{t.deviceResponses.forEach(((n,r)=>{e.includes(r)||t.deviceResponses.delete(r)}))})),yield n.bulkUpdate(r),yield T({MissingKeyStore:n})}));return function(){return t.apply(this,arguments)}}())}))).apply(this,arguments)}function f(){return(0,o.runInTransaction)(["MissingKeyStore"],(e=>{let{MissingKeyStore:t}=e;return h({MissingKeyStore:t})}))}function h(){return g.apply(this,arguments)}function g(){return(g=(0,i.default)((function*(e){let{MissingKeyStore:t}=e;clearTimeout(p),p=null;const n=yield t.getAll();if(0===n.length)return;__LOG__(2)`syncd: _setMissingKeyTimeout: missing keys: ${n.map((e=>(0,u.syncKeyIdToHex)(e.keyId)))}`;const r=n.reduce(((e,t)=>e.timestamp<t.timestamp?e:t)),i=(0,o.getConfig)().syncdWaitForKeyTimeoutDays()*d.DAY_MILLISECONDS-(-r.timestamp+(0,d.unixTimeMs)());__LOG__(2)`syncd: earliest missing key: ${(0,u.syncKeyIdToHex)(r.keyId)}, timestamp=${r.timestamp}, timeoutMs=${i}`,p=setTimeout(m,i)}))).apply(this,arguments)}function m(){return y.apply(this,arguments)}function y(){return(y=(0,i.default)((function*(){__LOG__(2)`syncd: _timeoutWhileWaitingForMissingKey`,(yield E())?((0,c.reportSyncdFatalError)(c.SyncdFatalErrorType.TIMEOUT_WHILE_WAITING_FOR_MISSING_KEY),__LOG__(4,void 0,new Error,!0)`syncd: fatal error: timeout while waiting for missing key`,SEND_LOGS("syncd fatal error: timeout while waiting for missing key"),(0,o.getDbImpls)().handleSyncdFatal()):__LOG__(2)`syncd: _timeoutWhileWaitingForMissingKey: no expired keys`}))).apply(this,arguments)}function E(){return S.apply(this,arguments)}function S(){return(S=(0,i.default)((function*(){__LOG__(2)`syncd: check if has expired keys`;const e=(yield(0,l.getAllSyncKeysInTransaction)()).map((e=>(0,u.syncKeyIdToHex)(e.keyId)));__LOG__(2)`syncd: all keys: ${e}`;const t=yield(0,s.getAllMissingKeysInTransaction)();__LOG__(2)`syncd: missing keys: ${t.map((e=>(0,u.syncKeyIdToHex)(e.keyId)))}`;const n=t.filter((t=>!e.includes(t.keyHex)));__LOG__(2)`syncd: actually missing keys: ${t.map((e=>(0,u.syncKeyIdToHex)(e.keyId)))}`;const r=n.filter((e=>(0,o.getConfig)().syncdWaitForKeyTimeoutDays()*d.DAY_MILLISECONDS<(0,d.unixTimeMs)()-e.timestamp));return __LOG__(2)`syncd: expired keys: ${r.map((e=>(0,u.syncKeyIdToHex)(e.keyId)))}`,r.length>0}))).apply(this,arguments)}function T(){return v.apply(this,arguments)}function v(){return(v=(0,i.default)((function*(e){let{MissingKeyStore:t}=e;const n=yield t.getAll();for(const e of n){let t=!0;for(const n of e.deviceResponses.values())if(null==n){t=!1;break}if(t)return __LOG__(4,void 0,new Error,!0)`syncd: fatal error: missing key on all clients`,SEND_LOGS("syncd: fatal error: missing key on all clients"),(0,c.reportSyncdFatalError)(c.SyncdFatalErrorType.MISSING_KEY_ON_ALL_CLIENTS),yield(0,a.asyncSleep)(5e3),void(0,o.getDbImpls)().handleSyncdFatal()}}))).apply(this,arguments)}function A(){return(A=(0,i.default)((function*(e,t){const n=()=>{const e=new Map;return t.forEach((t=>e.set(t,null))),e},r=e.map((e=>({keyHex:(0,u.syncKeyIdToHex)(e),keyId:e,timestamp:(0,d.unixTimeMs)(),deviceResponses:n()})));yield(0,s.bulkUpdateMissingKeysInTransaction)(r),yield f()}))).apply(this,arguments)}},43959:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.SyncdDecryptMutationsType=t.SyncdCriticalBootstrapStageType=void 0,t.convertSyncdCriticalBootstrapStageFromAnnotations=function(e){var t;const n=null==e||null===(t=e.string)||void 0===t?void 0:t.criticalBootstrapStage;if(null==n)retu
|
||
|
is incomplete`,t.push(e);else{const{patchNode:t,encryptedMutations:r}=yield R(e,n);i=t,a=r}return{collection:e,version:r,patchNode:i,encryptedMutations:a}}));return function(){return e.apply(this,arguments)}}(),r=new Map,a=new Map,o=[];e.forEach(((e,t)=>o.push(n(t,e))));const l=(yield Promise.all(o)).map((e=>{const{collection:t,version:n,patchNode:i,encryptedMutations:o}=e;return o&&a.set(t,o),r.set(t,n),(0,A.wap)("collection",{name:(0,A.CUSTOM_STRING)(t),version:(0,A.INT)(null!=n?n:_.DEFAULT_COLLECTION_VERSION),return_snapshot:void 0===n?"true":"false"},i)}));return __LOG__(2)`syncd: end _buildCollectionNodes`,{collectionNodes:l,collectionWithEncryptedMutations:a,localCollectionVersions:r,collectionsToSkip:t}}))).apply(this,arguments)}function R(){return N.apply(this,arguments)}function N(){return(N=(0,i.default)((function*(e,t){const n=yield(0,g.getActiveKey)(!w(t)),r=(yield B(e,t,n)).map((e=>(0,h.encryptMutation)(e,n))),a=yield Promise.all(r),s=a.map((e=>({indexMac:e.indexMac,valueMac:e.valueMac,operation:e.operation}))),l=yield(0,p.computeLtHash)(e,s),{snapshotMac:u,patchMac:c}=yield(0,p.computeOutgoingSnapshotAndPatchMacs)(e,l,a,n.keyData),d=a.map((e=>x(e.keyId,e.operation,e.indexMac,e.indexAndValueCipherText))),_=G(d),f=function(){var e=(0,i.default)((function*(){const e=yield(0,o.getDbImpls)().uploadSyncExternalPatch(_);return k(yield L(e,_),n.keyId,u,c)}));return function(){return e.apply(this,arguments)}}();let m;(0,E.exceedInlineMutationCount)(d)?m=yield f():(m=U(d,n.keyId,u,c),(0,E.exceedPatchProtobufSize)(m)&&(m=yield f()));return{patchNode:(0,A.wap)("patch",null,m),encryptedMutations:a}}))).apply(this,arguments)}function w(e){return(0,o.getConfig)().logoutInProgress()&&e.some((e=>JSON.parse(e.index)[0]===_.Actions.Sentinel))}function L(){return D.apply(this,arguments)}function D(){return(D=(0,i.default)((function*(e,t){const{mediaKey:n,directPath:r,encFilehash:i,handle:o}=e,s=yield(0,c.calculateFilehash)(t);return{mediaKey:n,directPath:r,handle:o,fileSizeBytes:t.byteLength,fileSha256:(0,a.decodeB64)(s),fileEncSha256:i}}))).apply(this,arguments)}function k(e,t,n,r){const i=(0,o.getConfig)().syncdPatchDeviceIndexIncluded()?(0,u.extractDeviceId)((0,o.getMyDeviceJid)()):void 0;return(0,T.encodeSyncdPatch)({keyId:{id:(0,y.fromSyncKeyId)(t)},externalMutations:e,snapshotMac:n,patchMac:r,deviceIndex:i})}function U(e,t,n,r){const i=(0,o.getConfig)().syncdPatchDeviceIndexIncluded()?(0,u.extractDeviceId)((0,o.getMyDeviceJid)()):void 0;return(0,T.encodeSyncdPatch)({keyId:{id:(0,y.fromSyncKeyId)(t)},mutations:e,snapshotMac:n,patchMac:r,deviceIndex:i})}function G(e){return(0,T.encodeSyncdMutations)({mutations:e})}function x(e,t,n,r){return{operation:t,record:{keyId:{id:(0,y.fromSyncKeyId)(e)},index:{blob:n},value:{blob:r}}}}function B(){return F.apply(this,arguments)}function F(){return(F=(0,i.default)((function*(e,t,n){const r=yield(0,l.getSyncActionsByCollectionsInTransaction)([e]);let i=t;const a=j(r,t,n.keyId);i=i.concat(a);const o=Y(r,i,n.keyId);return v.addKeyRotationRemoveCount(o.length),i=i.concat(o),i}))).apply(this,arguments)}function j(e,t,n){let r=e.filter((e=>!t.map((e=>e.index)).includes(e.index)&&!(0,f.syncKeyIdsEqual)(e.keyId,n)));r=(0,C.default)(r,(e=>(0,m.getKeyEpoch)(e.keyId)));const i=Math.min(5,(0,o.getConfig)().syncdAdditionalMutations());return r=r.slice(0,i),(0,S.syncActionsToPendingMutations)(r,d.SyncdMutation$SyncdOperation.SET)}function Y(e,t,n){const r=t.map((e=>e.index)),i=e.filter((e=>r.includes(e.index))).filter((e=>!(0,f.syncKeyIdsEqual)(e.keyId,n)));return(0,S.syncActionsToPendingMutations)(i,d.SyncdMutation$SyncdOperation.REMOVE)}},385798:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.syncActionsToPendingMutations=function(e,t){return e.map((e=>{const n=(0,i.decodeProtobuf)(r.SyncActionDataSpec,e.binarySyncData).value,o=(0,a.encodeProtobuf)(r.SyncActionValueSpec,n).readBuffer();return{collection:e.collection,index:e.index,binarySyncAction:o,operation:t,version:e.version,timestamp:e.timestamp,action:e.action}}))};var r=n(370625),i=n(309512),a=n(653313)},854213:(
|
||
|
for ${e.from.toString()}`,e.type){case c.SIDE_LIST_CHANGE:break;case c.CHANGE:const t=u.StatusCollection.get(e.from);t?t.status=e.content:__LOG__(3)`handleAboutNotification: get status update for unknown contact ${e.from}`;break;default:__LOG__(3)`handleAboutNotification: unhandled notification of
|
||
|
type ${e.type}`}return(0,a.wap)("ack",{id:(0,a.CUSTOM_STRING)(e.stanzaId),to:"change"===e.type?(0,s.JID)(e.from):(0,a.CUSTOM_STRING)(e.from),class:"notification",type:"status"})}(t.success)};var i=r(n(81109)),a=n(738102),o=n(769707),s=n(355813),l=n(854379),u=n(600445);const c=Object.freeze({CHANGE:"change",SIDE_LIST_CHANGE:"sideListChange",UNKNOWN:"unknown"});t.NOTIFICATION_TYPE=c;const d=new o.WapParser("incomingAboutNotification",(e=>{e.assertTag("notification");const t={stanzaId:e.attrString("id")},n=e.hasChild("set")&&e.child("set");if(n&&!n.hasAttr("hash"))return(0,i.default)({type:c.CHANGE,from:(0,l.userJidToUserWid)(e.attrUserJid("from")),pushname:e.attrString("notify"),content:n.contentString(),ts:e.attrTime("t")},t);let r=c.UNKNOWN;return n&&n.hasAttr("hash")&&(r=c.SIDE_LIST_CHANGE),(0,i.default)({type:r,from:e.attrString("from")},t)}))},996578:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.getAndUpdateStatus=M,t.getDeviceSyncInputs=R,t.handleAccountSyncNotification=function(){return w.apply(this,arguments)};var i=r(n(348926)),a=r(n(81109)),o=n(616310),s=n(738102),l=n(769707),u=n(493928),c=n(696155),d=n(798440),p=n(277330),_=n(780549),f=n(355813),h=n(824668),g=n(515309),m=n(256905),y=n(854379),E=n(280464),S=n(359484),T=n(999821),v=n(326314),A=n(600445),C=n(459857),P=n(669050);const O=e=>{const t=e.maybeChild("key-index-list"),n=null==t?null:{ts:t.attrTime("ts"),signedKeyIndexBytes:t.hasContent()?t.contentBytes():null,expectedTs:t.hasAttr("expected_ts")?t.attrTime("expected_ts"):void 0},r=e.mapChildrenWithTag("device",(e=>({id:(0,P.createWid)(e.attrDeviceJid("jid")).device||o.DEFAULT_DEVICE_ID,keyIndex:e.hasAttr("key-index")?e.attrInt("key-index"):null})));return 0===r.length?null:{deviceList:r,keyIndex:n}},I=new l.WapParser("incomingAccountSyncNotification",(e=>{e.assertTag("notification");const t={stanzaId:e.attrString("id"),ts:e.attrTime("t"),from:(0,y.deviceJidToDeviceWid)(e.attrDeviceJid("from"))};if(e.hasChild("status")){const n=e.child("status"),r=n.hasAttr("action")?n.attrString("action"):void 0;return(0,a.default)({type:c.ACCOUNT_SYNC_TYPE.STATUS,action:r},t)}if(e.hasChild("privacy"))return(0,a.default)({type:c.ACCOUNT_SYNC_TYPE.PRIVACY},t);if(e.hasChild("devices"))return(0,a.default)({type:c.ACCOUNT_SYNC_TYPE.DEVICES,devices:O(e.child("devices"))},t);if(e.hasChild("blocklist"))return(0,a.default)({type:c.ACCOUNT_SYNC_TYPE.BLOCKLIST},t);if(e.hasChild("picture"))return(0,a.default)({type:c.ACCOUNT_SYNC_TYPE.PICTURE},t);if(e.hasChild("tos")){const n=e.child("tos"),r=[];return n.forEachChildWithTag("notice",(e=>{const t="false"!==e.maybeAttrString("state"),n=e.attrString("id");r.push({id:n,state:t})})),(0,a.default)({type:c.ACCOUNT_SYNC_TYPE.TOS,notices:r},t)}if(e.hasChild("disappearing_mode")){const n=e.child("disappearing_mode");let r,i,o;return n.hasAttr("action")?r=n.attrString("action"):(i=n.attrInt("duration"),o=n.attrInt("t")),(0,a.default)((0,a.default)({},t),{},{type:c.ACCOUNT_SYNC_TYPE.DISAPPEARING_MODE,action:r,disappearingModeDuration:i,disappearingModeSettingTimestamp:o})}throw e.createParseError("notification type not supported")}));function M(){return b.apply(this,arguments)}function b(){return(b=(0,i.default)((function*(){const e=(0,C.assertGetMe)(),t=yield(0,g.getAbout)(e);if(t.error)return __LOG__(3)`getStatus failed for ${e}: failed ${t.error.errorCode} : ${t.error.errorText}`,Promise.reject(t.error.errorText);const n=t.status;n&&(A.StatusCollection.assertGet((0,C.getMaybeMeUser)()).status=n)}))).apply(this,arguments)}function R(){return N.apply(this,arguments)}function N(){return(N=(0,i.default)((function*(e){let{wid:t,devices:n}=e;const r=(0,C.getMaybeMeLidUser)(),i={wid:t,devices:n};if(null==r)return[i];const a=(0,C.getMeUser)();if(!t.isSameAccount(a))return __LOG__(4,void 0,new Error,!0)`wid-is-not-self`,SEND_LOGS("wid-is-not-self"),[i];const[o,s]=yield v.waSignalStore.bulkGetIdentity([(0,T.createSignalAddress)(a).toString(),(0,T.createSignalAddress)(r).toString()]);return null==s&&null!=o&&(yield v.waSignalStore.putIdentity((0,T.createSigna
|
||
|
for ${n.toString()}`,(0,l.isDisappearingModeEnabled)()&&(yield(0,c.updateDisappearingMode)(n,t,i)),(0,o.wap)("ack",{id:(0,o.CUSTOM_STRING)(r),to:(0,u.JID)(n),class:"notification",type:"disappearing_mode"})}))).apply(this,arguments)}},63099:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return f.apply(this,arguments)};var i=r(n(348926)),a=n(911794),o=n(769707),s=n(780549),l=n(6961),u=n(366320),c=n(343343),d=n(885765),p=n(350906);const _=new o.WapParser("failureParser",(e=>(e.assertTag("failure"),{reason:e.attrInt("reason",400,599),location:e.attrString("location"),code:e.hasAttr("code")?e.attrInt("code"):null,expire:e.hasAttr("expire")?e.attrInt("expire"):null,message:e.maybeAttrString("message"),url:e.maybeAttrString("url")})));function f(){return(f=(0,i.default)((function*(e){const t=_.parse(e);if(t.error)return __LOG__(4,void 0,new Error)`${t.error.toString()} parsing ${e.toString()}`,Promise.reject(t.error);switch(t.success.reason){case 401:case 403:case 406:__LOG__(2)`received failure stanza, reason: ${t.success.reason}, logging out`,yield l.Socket.clearCredentialsAndStoredData(),s.Cmd.logout();break;case 405:case 409:__LOG__(2)`Client too old or bad user agent, attempting to update the app`;"web"===c.PLATFORMS[p.WAM_PLATFORM]?u.Updater.update(d.SANITIZED_VERSION_STR,!1,0):u.Updater.update(void 0,!1,0,!1),(0,a.stopComms)();break;case 402:const{code:e,expire:n,message:r,url:i}=t.success;if(null==e||null==n)throw __LOG__(4,void 0,new Error)`Incorrect temporary ban data ${e} ${n}`,new Error("handleFailure: wrong temp ban data");s.Cmd.onTemporaryBan({banned:!0,code:e,message:r,url:i,expire:n});break;case 400:case 500:case 501:__LOG__(3)`handleFailure: got failure code ${t.success.reason}`;break;default:return __LOG__(3)`failure reason ${t.success.reason} not implemented yet`,Promise.reject(new Error(`failure reason ${t.success.reason} not implemented yet`))}}))).apply(this,arguments)}},200279:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.handleGroupNotification=function(e){const t=G.parse(e);if(t.error)return __LOG__(4,void 0,new Error)`Parsing Error: ${t.error.toString()}`,Promise.reject(t.error);const n=t.success,r=!!n.offline&&!P.OfflineMessageHandler.isResumeFromRestartComplete();if((0,S.isGroupNotificationOptimizationEligible)(n,r)&&r)return(0,S.handleGroupNotificationV2)(n,r);return(0,v.handleMessage)(n.chatId.toString(),r,(0,i.default)((function*(){return yield Promise.all(n.actions.map((e=>function(){return H.apply(this,arguments)}(n,e,r)))),(0,o.wap)("ack",{to:(0,d.GROUP_JID)(n.chatId),id:(0,o.CUSTOM_STRING)(n.externalId),class:"notification",participant:n.author?(0,d.USER_JID)(n.author):o.DROP_ATTR})})))};var i=r(n(348926)),a=r(n(81109)),o=n(738102),s=n(769707),l=n(287461),u=n(565583),c=n(359987),d=n(355813),p=n(389293),_=n(800321),f=n(529921),h=n(326398),g=n(429267),m=n(614198),y=n(862159),E=n(111070),S=n(225390),T=n(854379),v=n(412985),A=n(97858),C=n(240493),P=n(359484),O=n(130207),I=n(76085),M=n(126092),b=n(193970),R=n(459857),N=n(343609);function w(e){return e.mapChildrenWithTag("participant",(e=>{const t=e.attrEnumOrDefault("type",f.GROUP_PARTICIPANT_TYPES,"participant"),n=e.maybeAttrLidUserJid("lid");return{displayName:e.maybeAttrString("display_name"),id:(0,T.userJidToUserWid)(e.attrUserJid("jid")),isSuperAdmin:t===f.GROUP_PARTICIPANT_TYPES.superadmin,isAdmin:t===f.GROUP_PARTICIPANT_TYPES.admin||t===f.GROUP_PARTICIPANT_TYPES.superadmin,lid:null!=n?(0,T.userJidToUserWid)(n):null}}))}function L(e){return{prevVersion:e.hasAttr("prev_v_id")?e.attrInt("prev_v_id"):void 0,version:e.hasAttr("v_id")?e.attrInt("v_id"):void 0}}const D={invite:y.ADD_REASON.INVITE,linked_group_join:y.ADD_REASON.LINKED_GROUP_JOIN,auto_add:y.ADD_REASON.AUTO_ADD,default_sub_group_admin_add:y.ADD_REASON.DEFAULT_SUBGROUP_ADMIN_ADD,default_sub_group_promote:y.ADD_REASON.DEFAULT_SUBGROUP_PROMOTE,invite_auto_add:y.ADD_REASON.INVITE_AUTO_ADD},k={default_sub_group_demote:y.REMOVE_REASON.DEFAULT_SUBGROUP_DEMOTE},U={invite_link:O.RequestMe
|
||
|
exisiting length: ${n.length}, new length: ${t.length}`,SEND_LOGS("self-identity-change-from-history-sync"))}))).apply(this,arguments)}function Oe(e){let t=Promise.resolve(),n=Promise.resolve();return null!=e.threadIdUserSecret&&(t=(0,y.setThreadIdUserSecret)(e.threadIdUserSecret)),null!=e.threadDsTimeframeOffset&&(n=(0,y.setThreadDsTimeframeOffset)(e.threadDsTimeframeOffset)),Promise.all([t,n])}},246226:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.handleE2eIdentityChange=function(e){const t=T.parse(e);if(t.error)return __LOG__(4,void 0,new Error)`Parsing Error: ${t.error.toString()}`,Promise.reject(t.error);const{wid:n,stanzaId:r,displayName:s,delay:d,lid:v,offline:A}=t.success,C=(0,o.wap)("ack",{to:(0,u.DEVICE_JID)(n),id:(0,o.CUSTOM_STRING)(r),class:"notification"});if(null!=n.device&&n.device!==a.DEFAULT_DEVICE_ID)return __LOG__(2)`handleNewIdentity: ignore identity change from companion device`,Promise.resolve(C);if((0,E.isMePrimary)(n))return(0,l.frontendFireAndForget)("handleSelfPrimaryIdentityChange",{}),Promise.resolve(C);const P=!!A&&!f.OfflineMessageHandler.isResumeFromRestartComplete();return(0,_.handleMessage)(String(n),P,(0,i.default)((function*(){yield(0,c.clearDeviceRecordForIdentityChange)(n,P);return(yield(0,y.getSignalProtocolStore)().loadIdentityKey((0,m.createSignalAddress)(n).toString()))&&(__LOG__(2)`handleE2eIdentityChange: ${n.toString()} has old identity, establishing new session`,yield g.Session.deleteRemoteInfo(n),(0,h.addSecurityCodeChangedNotifications)(n,P),(0,l.frontendFireAndForget)("sendTcTokenWhenDeviceIdentityChange",{chatId:n}),P||(null!=d?(0,p.ensureE2ESessionsWithDelay)([n],d,!0):(0,p.ensureE2ESessions)([n],!0)),yield(0,S.createOrReplaceDisplayNamesAndLidPnMappings)([{id:n,lid:v,displayName:s}])),C})))};var i=r(n(348926)),a=n(616310),o=n(738102),s=n(769707),l=n(359987),u=n(355813),c=n(74869),d=n(854379),p=n(917504),_=n(412985),f=n(359484),h=n(944641),g=n(138706),m=n(999821),y=n(76256),E=n(459857),S=n(343609);const T=new s.WapParser("identityChange",(e=>{e.assertTag("notification"),e.assertAttr("type","encrypt"),e.child("identity");const t=parseInt(e.maybeAttrString("delay"),10);return{wid:(0,d.deviceJidToDeviceWid)(e.attrDeviceJid("from")),stanzaId:e.attrString("id"),delay:isFinite(t)&&t>0?t:null,displayName:e.maybeAttrString("display_name"),lid:e.hasAttr("lid")?(0,d.deviceJidToDeviceWid)(e.attrDeviceJid("lid")):null,offline:e.hasAttr("offline")?e.attrString("offline"):null}}))},154269:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return h.apply(this,arguments)};var i=r(n(348926)),a=n(417405),o=r(n(132375)),s=n(738102),l=n(769707),u=n(355813),c=n(912384),d=n(229479),p=n(994451),_=n(459857);const f=new l.WapParser("mediaRetryNotification",(e=>{e.assertTag("notification");const t=e.maybeChild("error");if(t)return{msgId:e.attrString("id"),ciphertext:null,iv:null,errorCode:d.MediaRetryNotification$ResultType.cast(t.attrInt("code"))};const n=e.child("encrypt");return{msgId:e.attrString("id"),ciphertext:n.child("enc_p").contentBytes(),iv:n.child("enc_iv").contentBytes(c.ENC_IV_SIZE),errorCode:null}}));function h(){return(h=(0,i.default)((function*(e){const t=f.parse(e);if(t.error)throw __LOG__(4,void 0,new Error)`Parsing Error: ${t.error.toString()}`,t.error;const{msgId:n,errorCode:r}=t.success,i=(0,s.wap)("ack",{id:(0,s.CUSTOM_STRING)(n),class:"notification",type:"mediaretry",to:(0,u.USER_JID)((0,_.getMeUser)())});if(null!=r)return p.RequestMediaReuploadManager.resolveMediaReupload({msgId:n,result:r}),i;const{ciphertext:l,iv:d}=t.success,h=p.RequestMediaReuploadManager.getMediaKey(n);if(!h)return __LOG__(3)`handleMediaRetryNotification: mediaKey is not found for msgId ${n}`,i;const{stanzaId:g,directPath:m,result:y}=yield(0,c.decryptMediaRetryNotification)((0,a.decodeB64)(h),n,(0,o.default)(d,"iv"),(0,o.default)(l,"ciphertext"));if(g!==n)throw new Error("handleMediaRetryNotification: msg id does not match");return p.RequestMediaReuploadManager.resolveMediaReupload({msgId:n,result:y,
|
||
|
blindly ack-ing it and doing nothing`,Promise.resolve(t)}}(t.success)};var r=n(738102),i=n(769707),a=n(266485),o=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=l(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(996588)),s=n(927540);function l(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(l=function(e){return e?n:t})(e)}const u=Object.freeze({LOG:"log",PROPS:"props",ABPROPS:"abprops"});t.NOTIFICATION_TYPE=u;const c=new i.WapParser("incomingServerNotificationParser",(e=>{e.assertTag("notification");const t=e.attrString("id"),n=e.attrWapJid("from");return e.hasChild(u.LOG)?{type:u.LOG,stanzaId:t,from:n}:e.hasChild(u.PROPS)?{type:u.PROPS,stanzaId:t,from:n}:e.hasChild(u.ABPROPS)?{type:u.ABPROPS,stanzaId:t,from:n}:{type:null,stanzaId:t,from:n}}))},828104:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.handleServerSyncNotification=function(e){const t=p.parse(e);if(t.error)return __LOG__(4,void 0,new Error)`Parsing Error: ${t.error.toString()}`,Promise.reject(t.error);return function(e){if(e.changedCollections){const t=new Map;for(const[n,r]of e.changedCollections){const e=o.CollectionName.cast(n);null!=e?t.set(e,r):__LOG__(3)`syncd: unknown collection name in notification: ${n}`}let n=Array.from(t.keys());e.offline&&n.forEach((e=>{const t=d.get(e);null!=t?d.set(e,t+1):d.set(e,1)})),__LOG__(2)`syncd: incoming sync notification for collections
|
||
|
${Array.from(t.entries()).map((e=>{let[t,n]=e;return`${t} v${n}`})).join("\n")}`,u.default.isSyncDCriticalDataSyncInProcess()&&(n=n.filter((e=>(0,a.isCriticalCollection)(e))),__LOG__(2)`syncd: filtered non critical collections during bootstrap. new collections: ${n}`),(0,i.markCollectionsForSync)(n,t)}return Promise.resolve((0,s.wap)("ack",{id:(0,s.CUSTOM_STRING)(e.stanzaId),class:"notification",type:"server_sync",to:s.S_WHATSAPP_NET}))}(t.success)},t.reportOfflineNotifications=function(){if(d.size<1)return;let e=0;Array.from(d.entries()).forEach((t=>{let[,n]=t;e+=n-1})),new c.default.MdAppStateOfflineNotifications({redundantCount:e}).commit(),d.clear()};var i=n(279385),a=n(729208),o=n(155172),s=n(738102),l=n(769707),u=r(n(775410)),c=r(n(571834));const d=new Map,p=new l.WapParser("serverSyncNotification",(e=>{if(e.assertTag("notification"),!e.hasChild("collection"))throw e.createParseError("Server sync notifcation does not contain any collections");const t=e.attrString("id"),n=new Map(e.mapChildrenWithTag("collection",(e=>[e.attrString("name"),e.attrInt("version")]))),r=e.hasAttr("offline");return e.attrString("from")!==s.S_WHATSAPP_NET.toString()&&__LOG__(4,void 0,new Error)`handleServerSyncNotification: "from" is not domain jid "s.whatsapp.net"`,{changedCollections:n,stanzaId:t,offline:r}}))},657874:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){return _.apply(this,arguments)};var i=r(n(348926)),a=n(911794),o=n(769707),s=n(780549),l=n(400116),u=n(6961),c=n(581263),d=n(784898);const p=new o.WapParser("streamErrorParser",(e=>{if(e.assertTag("stream:error"),!e.hasChild("conflict"))return e.hasAttr("code")?{type:"code",code:e.attrInt("code")}:e.hasChild("ack")?{type:"ack",id:e.child("ack").hasAttr("id")?e.child("ack").attrString("id"):null}:e.hasChild("xml-not-well-formed")?{type:"xml-not-well-formed"}:(__LOG__(3)`Unrecognized stream:error: ${e.toString()}`,{type:"other"});switch(e.child("conflict").attrString("type")){case"replaced":return{type:"replaced"};case"device_removed":default:return{type:"device_removed"}}}));function _(){return(_=(0,i.default)((function*(e){const t=p.parse(e);if(t.error)return __LOG__(4,void 0,new Error)`Parsing Error: ${t.error.toString()}`,Promise.reject(t.error);const n=t.success;if("code"===n.type&&n.code>=500&&n.code<600){if(515===n.code)return(0,a.stopComms)(),yield(0,l.startLogin)(),(0,c.startBackend)(),Promise.resolve("NO_ACK");if(516===n.code)return(0,a.stopComms)(),yield(0,d.commitDeviceLinkEvent)(516),yield(0,l.startLogout)(),(0,c.startBackend)(),Promise.resolve("NO_ACK");(0,a.onStreamErrorReceived)()}else{if("device_removed"===n.type)return s.Cmd.onStartingLogout(),(0,a.stopComms)(),yield u.Socket.clearCredentialsAndStoredData(),__LOG__(2)`stream error due to device removed, logging out`,s.Cmd.logout(),Promise.resolve("NO_ACK");if("replaced"===n.type)return(0,a.stopComms)(),Promise.resolve("NO_ACK");"xml-not-well-formed"===n.type&&__LOG__(3)`handleStreamError: sent xml not well formed, closing the socket`}return Promise.resolve("CLOSE_SOCKET")}))).apply(this,arguments)}},265927:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const t=m.parse(e);if(t.error)return __LOG__(4,void 0,new Error)`handleSuccess: failed to parse ${t.error}`,Promise.reject(t.error);const n=t.success;(function(e){const t=Date.now()/1e3,n=Math.round(t-e),r=Math.round(n/3600);0!==r&&(0,s.getABPropConfigValue)("log_clock_skew")&&new h.default.ClockSkewDifferenceT({clockSkewHourly:-1*r}).commit();(0,a.setClockSkew)(n),l.Clock.setSkew(n)})(n.ts),function(e){const t=(0,f.getMaybeMeLid)();if(null==t&&null==e)return;if(null==t&&null!=e)return void(0,f.setMeLid)(e);if(null!=t&&null==e)return;if((0,i.default)(t,"lid").equals(e))return;(0,f.setMeLid)((0,i.default)(e,"nextLid"))}(null!=n.lid?(0,g.createWid)(n.lid):null),null!=n.displayName&&(0,f.setMeDisplayName)(n.displayName);u.Cmd.onTemporaryBan({banned:!1});const r=n.companionEncStatic;if(d.DbEncKeyStore.generateFinalDbEncryptionAndFtsKey(r),(0,c.
|
||
|
${e}`})))):Promise.resolve();yield Promise.all([t,r,i,a])})),p.length>0,l)}))).apply(this,arguments)}function T(){return v.apply(this,arguments)}function v(){return(v=(0,i.default)((function*(e,t){const{notifications:n,chatIds:r}=yield(0,l.bulkGenerateDeviceNotifications)(e);if(!t){const e=yield(0,_.encryptMultipleDBMsgs)(n);return P(n),{chatIds:r,encryptedNotifications:e}}return(0,g.getMessageCache)().addMessages(n.map((e=>({msg:e}))),!1),{chatIds:[],encryptedNotifications:[]}}))).apply(this,arguments)}function A(){return C.apply(this,arguments)}function C(){return(C=(0,i.default)((function*(e){const{deleteDeviceSenderKey:t,deleteRemoteInfo:r}=n(743275);try{yield Promise.all([r(e),t(e)])}catch(t){__LOG__(2)`handleDevicesNotification: failed to clean the signal info for ${e.user}`}}))).apply(this,arguments)}function P(e){return Promise.all(e.map((e=>(e.recvFresh=!0,e.isNewMsg=!0,(0,p.frontendSendAndReceive)("processMultipleMessages",{chatId:e.from,msgObjs:[e],meta:{add:"after",isHistory:!1}})))))}},76833:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.processKeyBundles=function(){return c.apply(this,arguments)};var i=r(n(348926)),a=n(616310),o=n(316860),s=n(138706),l=n(999821),u=r(n(9705));function c(){return(c=(0,i.default)((function*(e){let t=null,n=0,r=0;const c=new o.PromiseQueue;if(c.enqueue((0,i.default)((function*(){const i=[],o=[];if(e.forEach((e=>{e instanceof Error?(__LOG__(3)`establishE2ESession: error: ${e}`,t=e):(null!=e.wid.device&&e.wid.device!==a.DEFAULT_DEVICE_ID?o.push(e):i.push(e),e.key||n++)})),0===i.length&&0===o.length)throw new Error("establishE2ESession: no keys in the response");try{const e=[...i,...o].map((e=>(0,l.createSignalAddress)(e.wid).toString()));yield u.default.bulkLoadIdentityKey(e),__LOG__(2)`establishE2ESession: warmed up identity cache: ${e.length} records`}catch(e){__LOG__(3)`establishE2ESession: failed to warm up identity cache: ${e}`}const c=e=>s.Session.createSignalSession(e).then((()=>{r++})).catch((t=>{__LOG__(4,void 0,new Error,!0)`createSignalSession: failed for device ${e.wid} with error ${t}`,SEND_LOGS("createSignalSession-fail")}));yield Promise.all(i.map((e=>c(e)))),yield Promise.all(o.map((e=>c(e))))}))).catch((e=>{__LOG__(3)`createSignalSession: error: ${e}`,t=e})),yield c.wait(),null!=t)throw t;return{depletedPrekeyCount:n,processedPrekeyCount:r}}))).apply(this,arguments)}},944641:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.addSecurityCodeChangedNotifications=function(){return _.apply(this,arguments)};var i=r(n(348926)),a=n(359987),o=n(389293),s=n(890490),l=n(6007),u=n(800321),c=n(76469),d=n(117429),p=n(669050);function _(){return(_=(0,i.default)((function*(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];const{notifications:n,chatIds:r}=yield f(e);if(0!==n.length){if(!t){Promise.all(n.map((e=>(e.recvFresh=!0,e.isNewMsg=!0,(0,a.frontendSendAndReceive)("processMultipleMessages",{chatId:e.from,msgObjs:[e],meta:{add:"after",isHistory:!1}})))));const e=yield(0,s.encryptMultipleDBMsgs)(n);return(0,l.storeEncryptedDBMessages)(e,r,!1)}(0,u.getMessageCache)().addMessages(n.map((e=>({msg:e}))),!1)}}))).apply(this,arguments)}function f(){return h.apply(this,arguments)}function h(){return(h=(0,i.default)((function*(e){const t={notifications:[],chatIds:[]};if(!(0,d.getGlobalSecurityNotifications)())return t;let n=[];try{const t=yield(0,c.getChatTable)().get(String(e));n=(yield(0,c.getParticipantTable)().equals(["participants"],String(e))).map((e=>(0,p.createWid)(e.groupId))),t&&n.push((0,p.createWid)(t.id))}catch(e){throw __LOG__(4,!0,new Error,!0)`get chats failed`,SEND_LOGS("get chats failed when creating device notification"),new Error("get chats failed")}const r=n.map((t=>(0,o.genSecurityCodeNotificationMsg)(t,e)));return t.notifications=r,t.chatIds=n.map(String),t}))).apply(this,arguments)}},267420:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.deprecatedGenerateBaseInfoParamsFutureproofReparsing=function(e){let t;const n=e.id.re
|
||
|
\t for keyIds: [${e.map(a.syncKeyIdToHex)}]`,e){const{keys:n,orphanKeys:r}=yield(0,o.getKeysForKeyRequest)(e);return __LOG__(2)`syncd: handleAppStateSyncKeyRequest from device ${t.getDeviceId()}: about to send key share
|
||
|
\t keys with keydata: [${n.map((e=>(0,a.syncKeyIdToHex)(e.keyId)))}]
|
||
|
\t keys without keydata: [${r.map((e=>(0,a.syncKeyIdToHex)(e)))}]`,(0,u.getJobManager)().waitUntilPersisted(l.jobSerializers.sendRequestedKeyShare(n,r,t))}}}))).apply(this,arguments)}},104144:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.handleAppStateSyncKeyShare=function(e,t){return h(e,t)},t.setAppStateSyncKeyShareHandler=function(e){};var i=r(n(348926)),a=n(616310),o=n(478337),s=n(284642),l=n(371303),u=n(577392),c=n(682661),d=n(22383),p=r(n(571834)),_=n(398384),f=n(387159);let h=function(){var e=(0,i.default)((function*(e,t){(0,_.logCriticalBootstrapStageIfNecessary)(p.default.BOOTSTRAP_APP_STATE_DATA_STAGE_CODE.MISSING_KEYS_RECEIVED);const n=t.getDeviceId();__LOG__(2)`syncd: handling key share from device ${n} with ${e.keys.length} keys`;const r=[],i=e.keys;return i?(yield Promise.all(i.map((e=>{var t;const i=null===(t=e.keyId)||void 0===t?void 0:t.keyId,a=e.keyData,l=null==a?void 0:a.keyData,_=null==l?null:(0,c.toSyncKeyData)(l);if(!i)return void __LOG__(2)`syncd: received key with missing keyID from device ${n}`;const h=(0,c.toSyncKeyId)(i),g=(0,s.syncKeyIdToHex)(h);if(__LOG__(2)`syncd: received key share key id ${g} from device ${n} ${null!=l?"with":"without"} keyData`,6!==i.byteLength)return(0,d.uploadFatalErrorMetric)(p.default.MD_SYNCD_FATAL_ERROR_CODE.INVALID_KEY_SHARE_KEY_ID,null),__LOG__(4,void 0,new Error,!0)`syncd: fatal error: key share key id has invalid bytelength of ${i.byteLength}`,SEND_LOGS(`syncd: fatal error: key share key id has invalid bytelength of ${i.byteLength}`),(0,f.handleFatalError)();if(a){var m,y,E;const e=a.timestamp,t=null===(m=a.fingerprint)||void 0===m?void 0:m.currentIndex,n=null===(y=a.fingerprint)||void 0===y?void 0:y.rawId,i=null===(E=a.fingerprint)||void 0===E?void 0:E.deviceIndexes;if(!_||null==e||null==t||null==n||!i)return(0,d.uploadFatalErrorMetric)(p.default.MD_SYNCD_FATAL_ERROR_CODE.INVALID_KEY_SHARE_KEY_DATA,null),__LOG__(4,void 0,new Error,!0)`syncd: fatal error: invalid key share key data`,SEND_LOGS("syncd: fatal error: invalid key share key data"),(0,f.handleFatalError)();const s={keyId:h,keyEpoch:(0,u.getKeyEpoch)(h),keyData:_,timestamp:(0,o.numberOrThrowIfTooLarge)(e),fingerprint:{rawId:n,currentIndex:t,deviceIndexes:i}};r.push({keyId:h,fullKey:s})}else r.push({keyId:h,fullKey:null})}))),(0,l.handleKeyShare)((0,a.interpretAsDeviceId)(n),r)):Promise.resolve()}));return function(){return e.apply(this,arguments)}}()},456794:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.getPeerDevices=function(){return l.apply(this,arguments)};var i=r(n(348926)),a=n(866729),o=n(459857),s=n(669050);function l(){return(l=(0,i.default)((function*(){const e=[],t=(0,o.assertGetMe)();try{(yield(0,a.getMyDeviceList)()).devices.forEach((n=>{n.id!==t.getDeviceId()&&e.push((0,s.createDeviceWidFromUserAndDevice)(t.user,t.server,n.id))}))}catch(e){return __LOG__(3,void 0,void 0,!0)`syncd: getPeerDevices: error ${e}. Future key requests will only be sent to primary device.`,SEND_LOGS(e.toString()),[(0,s.createDeviceWidFromUserAndDevice)(t.user,t.server,0)]}return e}))).apply(this,arguments)}},491192:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.sendAppStateSyncKeyRequest=function(){return f.apply(this,arguments)};var i=r(n(348926)),a=n(284642),o=n(682661),s=n(118487),l=r(n(565754)),u=n(635881),c=n(459857),d=r(n(571834)),p=n(456794),_=n(398384);function f(){return(f=(0,i.default)((function*(e){const t=yield(0,p.getPeerDevices)(),n={keyIds:e.map((e=>({keyId:(0,o.fromSyncKeyId)(e)})))},r=t.map((e=>({id:new l.default({fromMe:!0,remote:(0,c.assertGetMeUser)(),id:l.default.newId()}),to:e,type:"protocol",subtype:"app_state_sync_key_request",appStateSyncKeyRequest:n}))),i=t.map((e=>e.getDeviceId())),f=e.map((e=>(0,a.syncKeyIdToHex)(e)));return __LOG__(2)`syncd: send key request key id ${f} to peer deviceIds ${i}`,yield(0,s.storePeerMessages)(r),yield Promise.all(r.map(u.encryptAndSendKeyMsg)),(0,_.logCriticalBootstrapStageIfNecessary)(d.default.BOOTSTRAP_APP_STATE_DATA_STAGE_C
|
||
|
This likely indicates a permissions error. Falling back to dummy \
|
||
|
(no-op) storage.`;else{if(e instanceof p.DbOnLogoutAbort)throw e;__LOG__(4,!0,new Error,!0)`Failed to initialize media store! Falling back to dummy (no-op) storage. Error:
|
||
|
${(0,_.default)(e)}`,SEND_LOGS("Failed to initialize media store")}}return new c.default})))}get(e){var t=this;return(0,i.default)((function*(){return(yield t._getBackingStore()).get(e)}))()}queryByIndex(e,t){var n=this;return(0,i.default)((function*(){return(yield n._getBackingStore()).queryByIndex(e,t)}))()}getAll(){var e=this;return(0,i.default)((function*(){return(yield e._getBackingStore()).getAll()}))()}put(e,t){var n=this;return(0,i.default)((function*(){return(yield n._getBackingStore()).put(e,t)}))()}del(e){var t=this;return(0,i.default)((function*(){const n=yield t._getBackingStore();yield n.del(e)}))()}count(){var e=this;return(0,i.default)((function*(){return(yield e._getBackingStore()).count()}))()}clear(){var e=this;return(0,i.default)((function*(){const t=yield e._getBackingStore();yield t.clear()}))()}open(){var e=this;return(0,i.default)((function*(){const t=yield e._getBackingStore();yield t.open()}))()}close(){var e=this;return(0,i.default)((function*(){const t=yield e._getBackingStore();yield t.close()}))()}}t.MediaStore=f;const h=new f;t.LruMediaStore=h},740573:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(173207));class a extends i.default{get(){return Promise.resolve()}queryByIndex(){return Promise.resolve([])}getAll(){return Promise.resolve([])}put(e,t){return Promise.resolve(t)}del(){return Promise.resolve()}count(){return Promise.resolve(0)}clear(){return Promise.resolve()}}t.default=a},198765:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(348926)),a=r(n(132375)),o=n(316860),s=n(287461),l=r(n(173207)),u=r(n(495976)),c=r(n(909520)),d=r(n(986128));class p extends l.default{constructor(e){var t;super(),t=this,this._queueMap=new o.PromiseQueueMap,this._isInitialized=!1,this.updateMaxSizeInterval=null,this._dispose=e=>this._bufferStore.del(e),this.doPut=(e,n)=>this._queueMap.enqueue(e,(0,i.default)((function*(){if(n.byteLength>t.getMaxSize())return n;if(n.byteLength>3e7)return n;const r={id:e,timestamp:(new Date).getTime(),size:n.byteLength};try{return(0,s.getABPropConfigValue)("web_lru_cache_purge_logic_refactor")&&(yield t._updateMaxSize()),yield t._metaInfoStore.putObject(r),t._bufferStore.put(e,n)}catch(e){if(e instanceof d.default.AbortError&&e.message.includes("QuotaExceededError"))return __LOG__(2)`LruMediaStore: encounter QuotaExceededError, thus shrink the size of LruMediaStore`,void t.setMaxSize((0,a.default)(t.getCurrentSize(),"_this.getCurrentSize()")/2);throw e}}))),this.doDel=e=>this._isInitialized?this._queueMap.enqueue(e,(()=>this._metaInfoStore.del(e))):Promise.resolve(),this._updateMaxSize=function(){var e=(0,i.default)((function*(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];const n=yield(0,u.default)();if(null==n)return void t._clearStoreForThisSession();const r=t.getCurrentSize();if(null==r)return;const i=n.available,a=t._calculateTargetedBufferSize(n.quota);if(i>a)return void(e&&t.setMaxSize(i));const o=(0,s.getABPropConfigValue)("web_lru_cache_purge_logic_refactor")?2:1,l=a*o-i;r<l?t._clearStoreForThisSession():t.setMaxSize(r-l)}));return function(){return e.apply(this,arguments)}}();const{maxSize:n,arrayBufferStore:r}=e;this._bufferStore=r,this._isInitialized=null!=n,this._metaInfoStore=new c.default(null!=n?n:0,this._dispose),this.updateMaxSizeInterval=setInterval(this._updateMaxSize,6e4)}doGet(e){var t=this;return(0,i.default)((function*(){const n=yield t._bufferStore.get(e);return null!=n&&t.put(e,n),n}))()}doClear(){var e=this;return(0,i.default)((function*(){return yield e._bufferStore.clear(),e._metaInfoStore.clear()}))()}doCount(){return this._metaInfoStore.count()}doOpen(){var e=this;return(0,i.default)((function*(){yield Promise.all([e._metaInfoStore.open(),e._bufferStore.open()]),!e._isInitialized&&(0,s.getABPropConfigValue)("web_lru_cache_purge_logic_refactor")&&(yield e._updateMaxSize(!0),e._isInitialized=!0)}))()}doClose(){var e=this;return(0,i.default)((function*(){yield Promise.all([e._metaInfoStore.close(),e
|
||
|
Header as expected? ${String("BEGIN:VCARD"===i)}
|
||
|
Version as expected? ${String(s)}
|
||
|
Footer as expected? ${String("END:VCARD"===o)}
|
||
|
Lines: ${t.length}`,void SEND_LOGS("vcard-fault");for(let e=2;e<t.length-1;e++){var d;const i=t[e],a=i.match(/item(\d+)\.(.*)/),o=a?a[2]:i,s=null===(d=o.match(/([^:;]*)[:;].*/))||void 0===d?void 0:d[1];if(null==s)continue;const l=a?E:S;let u,p,_=s,f=s;if(l[_]){const[e,t]=l[_],n=o.match(e);n&&(u=C(n[1]),p=1===t?p=n[2]:n.slice(2,2+t))}else{const e=o.match(y);e&&(f="SERVICE",_=e[1],p=e[2],u={})}if((Array.isArray(p)?p:[p]).some((e=>e&&(0,c.isString)(e)&&e.trim())))if(a){const t=a[1];r[t]?r[t].fields.push(new v(_,null,u,p)):r[t]={type:_,index:e,key:f,properties:u,value:p,fields:[]}}else A(n,f,new v(_,e,u,p))}return Object.keys(r).forEach((e=>{const{key:t,index:i,type:a,value:o,properties:s,fields:l}=r[e];l.forEach((e=>{s[e.type]=e.value})),A(n,t,new v(a,i,s,o))})),function(e){const t={};return(0,u.default)(e,((e,n)=>{t[n]=(0,l.default)(e,(e=>e.index))})),t}(n)}function I(e){const t=(0,i.default)(e.formattedName.split(e.formattedShortName)),n=t.length?t[0].trim():void 0,r=n?e.formattedShortName:e.formattedName;return`${P(n)};${P(r)};;;`}function M(e){return b(e.map((e=>e.displayName)))}function b(e){const t=e.find((e=>!!e));return e.length?t?1===e.length?t:d.default.t(481,{contactName:t,count:e.length-1,_plural:e.length-1}):d.default.t(482,{count:e.length,_plural:e.length}):g.fbt._("No contacts",null,{hk:"1p56oN"})}t.Field=v},809572:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"GET",n=arguments.length>2?arguments[2]:void 0,r=arguments.length>3?arguments[3]:void 0,a=arguments.length>4?arguments[4]:void 0;return i.default.request(e,t,n,a,r).then((e=>e.status&&e.status<12e3?e:null)).catch((()=>null))};var i=r(n(794938))},99398:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(348926)),a=r(n(947077)),o=n(54918),s=r(n(524173)),l=r(n(809572));class u extends o.BaseModel{constructor(){super(...arguments),this.online=(0,o.session)(!0),this.waitIfOffline=(0,a.default)((()=>"all"),(0,i.default)((function*(){this.online||("Firefox"!==s.default.info().name&&navigator.onLine?__LOG__(2)`waitIfOffline: XHR online is false, but navigator.onLine is true, resolving promise`:(__LOG__(2)`waitIfOffline: Waiting...`,yield new Promise((e=>{this.listenToOnce(this,"change:online",(()=>{__LOG__(2)`waitIfOffline: Continuing...`,e()}))}))))}))),this.checkOnline=(0,a.default)((()=>"all"),(0,i.default)((function*(){__LOG__(2)`NetworkStatus:checkOnline checking`;try{const e=yield(0,l.default)("https://web.whatsapp.com/status.json");this.online=!!e,__LOG__(2)`NetworkStatus:checkOnline response ${String(this.online)}`}catch(e){__LOG__(3)`NetworkStatus:checkOnline errored! ${String(e)}`}})))}initialize(){this.listenTo(this,"change:online",this._logOnlineOffline),this._logOnlineOffline()}_logOnlineOffline(){const e=this.online;__LOG__(2)`NetworkStatus ${e?"online":"offline"}`}}var c=new((0,o.defineModel)(u));t.default=c},192737:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.getEffectiveNetworkType=function(){if(navigator.connection&&"string"==typeof navigator.connection.effectiveType)return navigator.connection.effectiveType;return null}},794938:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=n(88237),a=r(n(589970)),o=r(n(79291));const s={GET:"GET",POST:"POST",HEAD:"HEAD",PUT:"PUT"};function l(e,t){for(const n in t)e.setRequestHeader(n,t[n])}function u(e,t,n,r,u,c,d){const p=new XMLHttpRequest,_=new Promise(((r,i)=>{if(p.onload=function(e){4===p.readyState?r(p):(__LOG__(4,void 0,new Error)`xhr.request:onload`,i(e))},p.onerror=e=>{__LOG__(4,void 0,new Error)`xhr.request:onerror`,i(e)},p.ontimeout=e=>{__LOG__(4,void 0,new Error)`xhr.request:ontimeout`,i(e)},c&&(p.onprogress=c),p.onabort=e=>{__LOG__(4,void 0,new Error)`xhr.request:onabort`,i(e)},n instanceof FormData)p.open(t||s.POST,e,!0),u&&(p.responseType=u),d&&l(p,d),p.send(n);else if(n instanceof Object){const r=o.default.build(e,n);p
|
||
|
message: ${t.offlineMessageCount}
|
||
|
receipt: ${t.offlineReceiptCount}
|
||
|
notification: ${t.offlineNotificationCount}
|
||
|
chatThreadCount: ${t.chatThreadCount}
|
||
|
offlineSizeBytes: ${t.offlineSizeBytes}
|
||
|
decryptError: ${t.offlineDecryptErrorCount}
|
||
|
lastStanzaT: ${t.lastStanzaT}
|
||
|
pageLoadT: ${t.pageLoadT}
|
||
|
connectionT: ${t.socketConnectT}
|
||
|
offlinePreviewT: ${t.offlinePreviewT}
|
||
|
screenLoadT: ${t.mainScreenLoadT}
|
||
|
isResumeInForeground: ${t.isResumeInForeground}
|
||
|
mailboxAge: ${t.mailboxAge}
|
||
|
======================================`,e.isInitialSync?e.qpl.drop():(t.commit(),e.qpl.setAnnotations({messageCount:t.offlineMessageCount,receiptCount:t.offlineReceiptCount,notificationCount:t.offlineNotificationCount,chatThreadCount:t.chatThreadCount,decryptErrorCount:t.offlineDecryptErrorCount,sizeBytes:t.offlineSizeBytes}),e.qpl.end()),e.offlineResume=null,window.document&&document.removeEventListener("visibilitychange",e.logResumeInBackground))}))()}};t.OfflineResumeReporter=g},115383:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.mainScriptTimer=t.initialScreenTimer=t.exeTimer=t.PageLoad=void 0,t.onInitialRenderComplete=function(){_()},t.saveInitialPanelMountTime=function(e){c=e},t.setInitialScreen=function(e){if(null==d)return;d.set({webcInitialPanel:e})},t.streamInfoChange=function(e,t,n){const r=Math.floor(window.performance.now());p[e]=r,n&&(p.socketSequence=t,f())};var i=r(n(132375)),a=n(154378),o=r(n(571834)),s=function(e,t){if(!t&&e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var n=u(t);if(n&&n.has(e))return n.get(e);var r={},i=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var a in e)if("default"!==a&&Object.prototype.hasOwnProperty.call(e,a)){var o=i?Object.getOwnPropertyDescriptor(e,a):null;o&&(o.get||o.set)?Object.defineProperty(r,a,o):r[a]=e[a]}r.default=e,n&&n.set(e,r);return r}(n(824194)),l=r(n(24650));function u(e){if("function"!=typeof WeakMap)return null;var t=new WeakMap,n=new WeakMap;return(u=function(e){return e?n:t})(e)}let c,d=new o.default.WebcPageLoad;const p={};let _,f;const h=new Promise((e=>_=e)),g=new Promise((e=>f=e));let m,y=!1;function E(e){return window.performance&&window.performance.timing&&window.performance.timing.navigationStart?e-window.performance.timing.navigationStart:null}function S(){d&&document.hidden&&(m=!1)}function T(){var e;if(!(null===(e=window.performance)||void 0===e?void 0:e.timing)||!window.performance.navigation)return void __LOG__(2)`MetricReporter:logPageLoad metrics not provided by browser!`;if(!d)return;const t=d,n=window.performance.timing,r=window.performance.navigation,i=n.navigationStart,a=n.loadEventEnd-i;if(a<=0)return __LOG__(2)`MetricReporter:logPageLoad delayed`,void setTimeout(T,1e4);function o(e){const t=n[e];return t&&E(t)}t.set({webcPageLoadT:a,webcUnloadEventStart:o("unloadEventStart"),webcUnloadEventEnd:o("unloadEventEnd"),webcRedirectStart:o("redirectStart"),webcRedirectEnd:o("redirectEnd"),webcFetchStart:o("fetchStart"),webcDomainLookupStart:o("domainLookupStart"),webcDomainLookupEnd:o("domainLookupEnd"),webcConnectStart:o("connectStart"),webcConnectEnd:o("connectEnd"),webcSecureConnectionStart:o("secureConnectionStart"),webcRequestStart:o("requestStart"),webcResponseStart:o("responseStart"),webcResponseEnd:o("responseEnd"),webcDomLoading:o("domLoading"),webcDomInteractive:o("domInteractive"),webcDomContentLoadedEventStart:o("domContentLoadedEventStart"),webcDomContentLoadedEventEnd:o("domContentLoadedEventEnd"),webcDomComplete:o("domComplete"),webcLoadEventStart:o("loadEventStart"),webcLoadEventEnd:o("loadEventEnd"),webcCached:n.fetchStart===n.domainLookupEnd,webcNavigation:r.type,webcRedirectCount:r.redirectCount,webcWsOpening:p.OPENING,webcWsPairing:p.PAIRING,webcWsSyncing:p.SYNCING,webcWsNormal:p.NORMAL,webcWsAttempts:p.socketSequence,webcQrCode:!p.SYNCING,webcInitialPanelMountT:c-i,webcLoadInForeground:m}),t.commit(),window.document&&document.removeEventListener("visibilitychange",S),d=null}window.document&&(m=!document.hidden,document.addEventListener("visibilitychange",S)),Promise.all([h,g]).then((()=>{T(),(0,l.default)(),y||(y=!0,a.Wam.resumeJobs())}));class v{constructor(e){this._hasStarted=!1,this._label=e.label,this._startProperty=e.startProperty,this._endProperty=e.endProperty}start(){this._hasStarted=!0,null!=d&&(d.set({[this._startProperty]:E(Date.now())}),this._measure=s.startMeasure(this._label))}end(){null!=d&&(d.set({[this._endProperty]:E(Date.now())}),(0,i.default)(this._measure,"this._measure").end())}hasStarted(){ret
|
||
|
formattedName:${k.formattedName},
|
||
|
name:${k.name},
|
||
|
formattedShortName:${k.formattedShortName},
|
||
|
formattedUser:${k.formattedUser}`,SEND_LOGS("display name is null or undefined"),"";const x=(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(c.EmojiText,{text:(0,s.default)(G.toString()),element:t,className:(0,m.default)(null,e.className),formatters:U,titlify:r,ellipsify:i,breakWord:a,direction:"auto",selectable:u,inlineblock:!0,onClick:T,xstyle:[b,L&&P.disableGrow],testid:D}),L&&(0,S.jsx)(c.EmojiText,{testid:"you-label",text:g.fbt._("(You)",null,{hk:"1CQza2"}),xstyle:P.spaceBefore})]}),B=e.labels||k.labels;B&&M&&(0,o.default)(B,M);const F=v&&B?(0,S.jsx)(p.Labels,{labels:B,showName:!1}):null;if(!w&&(k.isPSA||k.isIAS||A))return(0,S.jsxs)("span",{className:h.default.verified,children:[x,(0,S.jsx)("div",{className:h.default.icon,children:(0,S.jsx)(_.PsaVerifiedIcon,{})}),(0,S.jsx)("div",{className:h.default.labels,children:F})]});const j=R?O(N):null;return j||F?(0,S.jsxs)("span",{className:h.default.hasLabels,children:[x,(0,S.jsxs)("div",{className:h.default.labels,children:[j,F]})]}):x}function M(e){const{element:t,highlightText:n,titlify:r,ellipsify:i,breakWord:a,onClick:l,showLabel:f,firstLabel:g,className:T,xstyle:v,showChatAssignmentIcon:A=!1,assignedAgents:C=[],testid:P}=e;let I;const M=(0,E.useModelValues)(e.chat,["formattedTitle","labels"]),b=(0,E.useModelValues)(e.groupMetadata,["support"]);n&&(I=d.SearchName({terms:[n]}));const R=e.labels||M.labels;R&&g&&(0,o.default)(R,g);const N=f&&R?(0,S.jsx)(p.Labels,{labels:R,showName:!1}):null,w=(0,S.jsx)(c.EmojiText,{text:(0,s.default)(M.title()),element:t,className:(0,m.default)(T,(0,y.default)(v)),formatters:I,titlify:r,ellipsify:i,breakWord:a,direction:"auto",inlineblock:!0,onClick:l,testid:P});if(b.support)return(0,S.jsxs)("div",{className:(0,m.default)((0,u.cx)({[h.default.verified]:!0,[h.default.hasLabels]:!!N})),children:[w,(0,S.jsx)("div",{className:h.default.icon,children:(0,S.jsx)(_.PsaVerifiedIcon,{})}),(0,S.jsx)("div",{className:h.default.labels,children:N})]});const L=A?O(C):null;return L||N?(0,S.jsxs)("span",{className:h.default.hasLabels,children:[w,(0,S.jsxs)("div",{className:h.default.labels,children:[L,N]})]}):w}function b(e){if(e.chat&&!e.chat.isUser){const{chat:t}=e,n=(0,a.default)(e,T);return(0,S.jsx)(M,(0,i.default)({chat:t,groupMetadata:t.groupMetadata},n))}let t,n;if(e.chat){const{chat:r}=e,i=(0,a.default)(e,v);t=r.contact,n=i}else{const{contact:r}=e;t=r,n=(0,a.default)(e,A)}return(0,S.jsx)(I,(0,i.default)({contact:t},n))}},783301:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(e){const[t,n]=(0,p.default)(!1),[r,h]=(0,u.useState)(!1),g=(0,c.useFocus)({onFocusChange:h});return(0,_.jsxs)("div",{className:(0,d.default)([f.container,r&&f.focusedContainer]),children:[(0,_.jsx)("input",{ref:g,className:(0,d.default)(f.inputField),type:t?"text":"password",value:e.value,onChange:e.onChange,onKeyDown:e.onKeyDown,required:e.required,pattern:e.pattern,title:e.title,placeholder:e.placeholder,"data-testid":e.testid}),(0,_.jsx)(i.default,{xstyle:f.toggleButton,onClick:n,type:"simplified",children:t?(0,_.jsx)(s.VisibilityOnIcon,{"aria-label":l.fbt._("",null,{hk:"3QhoQq"}),color:a.SvgColorProp.TEAL}):(0,_.jsx)(o.VisibilityOffIcon,{"aria-label":l.fbt._("",null,{hk:"SOUsm"}),color:a.SvgColorProp.TEAL})})]})};var i=r(n(692629)),a=n(615647),o=n(700848),s=n(479846),l=n(548360),u=n(667294),c=n(162488),d=r(n(156720)),p=r(n(346787)),_=n(785893);const f={container:{position:"g0rxnol2",display:"p357zi0d",backgroundColor:"f6cvynhn",minWidth:"lu4oe39f",borderBottom:"d311eqfx",paddingBottom:"a15vwmim"},focusedContainer:{borderBottom:"ggdspdaz",paddingBottom:"przvwfww"},inputField:{fontSize:"enbbiyaj",color:"tviruh8d",flexGrow:"ggj6brxn",borderTop:"d27kr2rt",borderEnd:"q2i1o5qz",borderBottom:"r40aedaz",borderStart:"g9ebf9yp",outline:"gk6igrwd",backgroundColor:"f6cvynhn",overflowX:"gfz4du6o",overflowY:"r7fjleex"},toggleButton:{minWidth:"h3jhcnxg",color:"kzxpayn5",":hover":{color:"glk0grvq"}}}},525481:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var i=r(n(722074)),a=n(7
|
||
|
played: ${r.played.length}, read: ${r.read.length}, delivery: ${r.delivery.length}`,r.playedRemaining=a-r.played.length,r.readRemaining=r.playedRemaining-r.read.length,r.deliveryRemaining=r.readRemaining-r.delivery.length,r}))}))},t.updateReceiptRecords=function(e,t,n,r,i){const a=_[e],o=(0,p.toUserWid)(n).toString(),u=n.device||0;if(!a)return Promise.reject(new Error(`updateReceiptRecords: not supported ack type ${e}`));return function(e,t,n,r,i,a){if(0===i.length)return Promise.resolve();return(0,l.getStorage)().lock(["message-info"],(o=>{let[l]=o;const u=i.map((e=>[e,n]));return l.bulkGet(u).then((o=>{const u=[];return i.forEach(((i,l)=>{const c=o[l];if(!c){__LOG__(2)`updateReceiptRecords: got receipt for peer msg ${i},${n}`;const r={msgKey:i,receiverUserJid:n,[e]:t,deviceDelivered:[],deviceNotDelivered:[]};return e===s.ACK_STRING.DELIVERY&&null!=a&&(r.deliveryPrivacyMode=a),void u.push(r)}if(e!==_[s.ACK.INACTIVE]){const n=c[e];(null==c[e]||n>t)&&(c[e]=t),e===s.ACK_STRING.DELIVERY&&null!=a&&(c.deliveryPrivacyMode=a)}c.deviceNotDelivered.length>0&&(c.deviceDelivered.push(r),c.deviceDelivered=c.deviceDelivered.filter(((e,t,n)=>n.indexOf(e)===t)),c.deviceNotDelivered=c.deviceNotDelivered.filter((e=>e!==r))),u.push(c)})),l.bulkCreateOrReplace(u)}))}))}(a,t,o,u,r,i)};var i=r(n(81109)),a=r(n(348926)),o=n(616310),s=n(402994),l=n(605316),u=n(121260),c=n(719438),d=n(459857),p=(r(n(124928)),n(669050));const _={[s.ACK.RECEIVED]:s.ACK_STRING.DELIVERY,[s.ACK.READ]:s.ACK_STRING.READ,[s.ACK.PLAYED]:s.ACK_STRING.PLAYED,[s.ACK.INACTIVE]:s.ACK_STRING.INACTIVE},f=[s.ACK_STRING.PLAYED,s.ACK_STRING.READ,s.ACK_STRING.DELIVERY],h=Object.freeze({ELIGIBLE:"ELGIBLE",INELIGIBLE_RECORD_MISSING:"INELIGIBLE_RECORD_MISSING",INELIGIBLE_ALREADY_DELIVERED:"INELIGIBLE_ALREADY_DELIVERED",INELIGIBLE_NOT_MD:"INELIGIBLE_NOT_MD",INELIGIBLE_CHANGED_IDENTITY:"INELIGIBLE_CHANGED_IDENTITY"});t.RetryEligibilityResult=h},944161:(e,t,n)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.createOrUpdateOrphanReceipt=function(e,t,n){return(0,r.getStorage)().lock(["orphan-receipt"],(r=>{let[i]=r;return i.bulkGet(n).then((r=>{const a=n.reduce(((n,i,a)=>{let o=r[a];o||(o={msgKey:i});const s=o[e];return(null==s||s>t)&&(o[e]=t,n.push(o)),n}),[]);return i.bulkCreateOrReplace(a)}))}))},t.getOrphanReceipt=function(e){return(0,i.getTable)().get(e)},t.removeOrphanReceipt=function(e){return(0,i.getTable)().remove(e)};var r=n(605316),i=n(302213)},260071:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.addOrphanRevokes=function(e){return p.bulkCreateOrReplaceOrphanRevokes(e)},t.applyOrphanRevokes=function(){return _.apply(this,arguments)};var i=r(n(348926)),a=r(n(132375)),o=n(76469),s=n(373070),l=r(n(124928)),u=n(669050);let c=new Map,d=!1;const p={reset:()=>{c=new Map,d=!1},bulkRemoveOrphans:e=>(e.forEach((e=>{c.delete(e.msgKey)})),(0,o.getOrphanRevokeTable)().bulkRemove(e.map((e=>e.msgKey)))),bulkCreateOrReplaceOrphanRevokes:e=>(e.forEach((e=>{c.has(e.msgKey)&&c.delete(e.msgKey),c.set(e.msgKey,e)})),(0,o.getOrphanRevokeTable)().bulkCreateOrReplace(e)),getAllOrphanRevokes:()=>(0,i.default)((function*(){if(!d){const e=yield(0,o.getOrphanRevokeTable)().all();c=new Map(e.map((e=>[e.msgKey,e]))),d=!0}return c}))()};function _(){return(_=(0,i.default)((function*(e){const t=yield p.getAllOrphanRevokes(),n=[],r=[];return e.forEach((e=>{const i=e.id.toString();if(t.has(i)){const c=(0,a.default)(t.get(i),"orphanRevokesCache.get(messageId)");var o;if(__LOG__(2)`applyOrphanRevokes: found orphan revoke for message ${e.id.toString()}`,!l.default.isStatusV3(e.id.remote))r.push({id:e.id,to:e.to,author:e.author,revokeSender:(0,u.createWidFromWidLike)(null!==(o=c.sender)&&void 0!==o?o:e.sender),type:s.MSG_TYPE.REVOKED,subtype:"admin_revoke"===c.subtype?"admin":"sender",protocolMessageKey:e.id,from:e.from,t:e.t,broadcast:e.broadcast});n.push(c)}else r.push(e)})),p.bulkRemoveOrphans(n),r}))).apply(this,arguments)}},559432:(e,t,n)=>{"use strict";var r=n(595318);Object.defineProperty(t,"__esModule",{value:!0}),t.createOrUpdateOrphanTcToken=fun
|
||
|
//# sourceMappingURL=https://web.whatsapp.com/app.cbe2fde94befbde07514.js.map
|