;/*FB_PKG_DELIM*/

__d("LSBumpThread",[],(function(a,b,c,d,e,f){function a(){var a=arguments,b=a[a.length-1],c=[];return b.sequence([function(c){return b.i64.eq(a[1],b.i64.cast([0,1]))?b.forEach(b.db.table(9).fetch([[[a[2]]]]),function(b){var c=b.update;b.item;return c({lastReadWatermarkTimestampMs:a[0],lastActivityTimestampMs:a[0]})}):b.i64.eq(a[1],b.i64.cast([0,2]))?b.forEach(b.db.table(9).fetch([[[a[2]]]]),function(b){var c=b.update;b.item;return c({lastActivityTimestampMs:a[0]})}):b.i64.eq(a[1],b.i64.cast([0,3]))?b.db.table(9).fetch([[[a[2]]]]).next().then(function(c,d){var e=c.done;c=c.value;return e?0:(d=c.item,b.i64.le(d.lastActivityTimestampMs,d.lastReadWatermarkTimestampMs)?b.forEach(b.db.table(9).fetch([[[a[2]]]]),function(b){var c=b.update;b.item;return c({lastReadWatermarkTimestampMs:a[0],lastActivityTimestampMs:a[0]})}):b.forEach(b.db.table(9).fetch([[[a[2]]]]),function(b){var c=b.update;b.item;return c({lastActivityTimestampMs:a[0]})}))}):b.resolve(0)},function(a){return b.resolve(c)}])}a.__sproc_name__="LSMailboxBumpThreadStoredProcedure";e.exports=a}),null);
__d("LSCheckAuthoritativeMessageExists",[],(function(a,b,c,d,e,f){function a(){var a=arguments,b=a[a.length-1],c=[],d=[];return b.sequence([function(e){return b.sequence([function(d){return b.filter(b.db.table(12).fetch([[[a[1]]],"optimistic"]),function(c){return b.i64.eq(c.threadKey,a[0])&&c.offlineThreadingId===a[1]&&b.i64.eq(c.authorityLevel,b.i64.cast([0,80]))}).next().then(function(a,b){b=a.done;a=a.value;return b?c[0]=!1:(a.item,c[0]=!0)})},function(a){return d[0]=c[0]}])},function(a){return b.resolve(d)}])}a.__sproc_name__="LSMailboxCheckAuthoritativeMessageExistsStoredProcedure";e.exports=a}),null);
__d("LSInsertMessage",[],(function(a,b,c,d,e,f){function a(){var a=arguments,b=a[a.length-1],c=[],d=[];return b.sequence([function(d){return b.i64.eq(a[2],b.i64.cast([0,20]))?b.db.table(12).add({threadKey:a[3],timestampMs:a[5],messageId:a[8],offlineThreadingId:a[9],authorityLevel:a[2],primarySortKey:a[6],senderId:a[10],isAdminMessage:a[12],sendStatus:a[15],sendStatusV2:a[16],text:a[0],subscriptErrorMessage:a[1],secondarySortKey:a[7],stickerId:a[11],messageRenderingType:a[13],isUnsent:a[17],unsentTimestampMs:a[18],mentionOffsets:a[19],mentionLengths:a[20],mentionIds:a[21],mentionTypes:a[22],replySourceId:a[23],replySourceType:a[24],replySourceTypeV2:a[25],replyStatus:a[26],replySnippet:a[27],replyMessageText:a[28],replyToUserId:a[29],replyMediaExpirationTimestampMs:a[30],replyMediaUrl:a[31],replyMediaPreviewWidth:a[33],replyMediaPreviewHeight:a[34],replyMediaUrlMimeType:a[35],replyMediaUrlFallback:a[36],replyCtaId:a[37],replyCtaTitle:a[38],replyAttachmentType:a[39],replyAttachmentId:a[40],replyAttachmentExtra:a[41],isForwarded:a[42],forwardScore:a[43],hasQuickReplies:a[44],adminMsgCtaId:a[45],adminMsgCtaTitle:a[46],adminMsgCtaType:a[47],cannotUnsendReason:a[48],textHasLinks:a[49],viewFlags:a[50],displayedContentTypes:a[51],viewedPluginKey:a[52],viewedPluginContext:a[53],quickReplyType:a[54],hotEmojiSize:a[55],platformXmdEncoded:a[56],replySourceTimestampMs:a[57],ephemeralDurationInSec:a[58],msUntilExpirationTs:a[59],ephemeralExpirationTs:a[60],takedownState:a[61],isCollapsed:a[62],subthreadKey:a[63],botResponseId:a[64],metadataDataclass:a[65],editCount:a[66],isPaidPartnership:a[67],adminSignatureName:a[68],adminSignatureProfileUrl:a[69],adminSignatureCreatorType:a[70]}):b.sequence([function(d){return b.db.table(12).fetch([[[a[9]]],"optimistic"]).next().then(function(b,d){var e=b.done;b=b.value;return e?(e=[a[6],a[7],void 0],c[0]=e[0],c[1]=e[1],c[2]=e[2],e):(d=b.item,e=[d.primarySortKey,d.secondarySortKey,d.localDataId],c[0]=e[0],c[1]=e[1],c[2]=e[2],e)})},function(c){return b.forEach(b.filter(b.db.table(12).fetch([[[a[9]]],"optimistic"]),function(c){return c.offlineThreadingId===a[9]&&b.i64.lt(c.authorityLevel,a[2])}),function(a){return a["delete"]()})},function(d){return b.db.table(12).add({threadKey:a[3],timestampMs:a[5],messageId:a[8],offlineThreadingId:a[9],authorityLevel:a[2],primarySortKey:c[0],senderId:a[10],isAdminMessage:a[12],sendStatus:a[15],sendStatusV2:a[16],text:a[0],subscriptErrorMessage:a[1],secondarySortKey:c[1],stickerId:a[11],messageRenderingType:a[13],isUnsent:a[17],unsentTimestampMs:a[18],mentionOffsets:a[19],mentionLengths:a[20],mentionIds:a[21],mentionTypes:a[22],replySourceId:a[23],replySourceType:a[24],replySourceTypeV2:a[25],replyStatus:a[26],replySnippet:a[27],replyMessageText:a[28],replyToUserId:a[29],replyMediaExpirationTimestampMs:a[30],replyMediaUrl:a[31],replyMediaPreviewWidth:a[33],replyMediaPreviewHeight:a[34],replyMediaUrlMimeType:a[35],replyMediaUrlFallback:a[36],replyCtaId:a[37],replyCtaTitle:a[38],replyAttachmentType:a[39],replyAttachmentId:a[40],replyAttachmentExtra:a[41],isForwarded:a[42],forwardScore:a[43],hasQuickReplies:a[44],adminMsgCtaId:a[45],adminMsgCtaTitle:a[46],adminMsgCtaType:a[47],cannotUnsendReason:a[48],textHasLinks:a[49],viewFlags:a[50],displayedContentTypes:a[51],viewedPluginKey:a[52],viewedPluginContext:a[53],quickReplyType:a[54],hotEmojiSize:a[55],platformXmdEncoded:a[56],replySourceTimestampMs:a[57],ephemeralDurationInSec:a[58],msUntilExpirationTs:a[59],ephemeralExpirationTs:a[60],takedownState:a[61],isCollapsed:a[62],subthreadKey:a[63],botResponseId:a[64],metadataDataclass:a[65],editCount:a[66],isPaidPartnership:a[67],adminSignatureName:a[68],adminSignatureProfileUrl:a[69],adminSignatureCreatorType:a[70],localDataId:c[2]})}])},function(a){return b.resolve(d)}])}a.__sproc_name__="LSMailboxInsertMessageStoredProcedure";e.exports=a}),null);
__d("LSUpdateParticipantLastMessageSendTimestamp",[],(function(a,b,c,d,e,f){function a(){var a=arguments,b=a[a.length-1],c=[];return b.resolve(c)}a.__sproc_name__="LSMailboxUpdateParticipantLastMessageSendTimestampStoredProcedure";e.exports=a}),null);
__d("LSUpdateThreadSnippet",["LSGetThreadParticipantDisplayName"],(function(a,b,c,d,e,f){function a(){var a=arguments,c=a[a.length-1],d=[],e=[];return c.sequence([function(e){return c.sequence([function(a){return c.resolve((d[1]="",d[0]=d[1]===""?void 0:d[1]))},function(e){return d[0]!==void 0?c.forEach(c.db.table(9).fetch([[[a[0]]]]),function(b){var c=b.update;b.item;return c({snippet:d[0],snippetStringHash:void 0,snippetStringArgument1:void 0,snippetAttribution:void 0,snippetAttributionStringHash:void 0,isAdminSnippet:a[2],snippetSenderContactId:a[3],snippetHasEmoji:a[4],viewedPluginKey:a[5],viewedPluginContext:a[6]})}):a[7]?c.sequence([function(e){return c.i64.neq(a[3],void 0)?c.sequence([function(e){return c.storedProcedure(b("LSGetThreadParticipantDisplayName"),a[0],a[3]).then(function(a){return a=a,d[2]=a[0],a})},function(b){return a[1]!==void 0?(d[2]!==void 0?d[4]=[d[2],": ",a[1]].join(""):d[4]=a[1],d[3]=d[4]):d[3]=void 0,d[1]=d[3]}]):c.resolve(d[1]=a[1])},function(b){return c.forEach(c.db.table(9).fetch([[[a[0]]]]),function(b){var c=b.update;b.item;return c({snippet:d[1],snippetStringHash:void 0,snippetStringArgument1:void 0,snippetAttribution:void 0,snippetAttributionStringHash:void 0,isAdminSnippet:a[2],snippetSenderContactId:a[3],snippetHasEmoji:a[4],viewedPluginKey:a[5],viewedPluginContext:a[6]})})}]):c.forEach(c.db.table(9).fetch([[[a[0]]]]),function(b){var c=b.update;b.item;return c({snippet:a[1],snippetStringHash:void 0,snippetStringArgument1:void 0,snippetAttribution:void 0,snippetAttributionStringHash:void 0,isAdminSnippet:a[2],snippetSenderContactId:a[3],snippetHasEmoji:a[4],viewedPluginKey:a[5],viewedPluginContext:a[6]})})}])},function(a){return c.resolve(e)}])}a.__sproc_name__="LSMailboxUpdateThreadSnippetStoredProcedure";e.exports=a}),null);