"use strict";var e=require("@babel/runtime/helpers/typeof"),t=require("@babel/runtime/helpers/defineProperty"),r=require("prop-types"),a=require("immutable"),i=require("moment"),s=require("@material-ui/core"),n=require("./helpers.js"),p=require("./styles.css.js"),o=require("../../../../utils/mobileDetect.js"),u=require("../../../EmbeddedApp/DevCenterEmbeddedApp.js"),c=require("../../../EmbeddedApp/EmbeddedApp.js"),d=require("../../../Attachment/index.js"),l=require("../../../UserMention/utils/index.js"),m=require("react/jsx-runtime");function b(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var f=b(e),g=b(t),y=b(i);function h(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var a=Object.getOwnPropertySymbols(e);t&&(a=a.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,a)}return r}function j(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?h(Object(r),!0).forEach((function(t){g.default(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):h(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}var A=s.makeStyles((function(e){return{attachmentLable:{fontSize:"12px",color:e.palette.primary.text6}}})),q=function(e){var t=e.feedItem,r=t.id,i=t.well,b=t.rig,f=t.app,g=t.package,h=t.company_id,q=t.context.app_annotation,w=q.body,v=q.app_category,x=q.app_key,O=q.created_at,R=q.settings,D=void 0===R?{}:R,_=q.attachment,E=q.data_timestamp,P=t.mentioned_users,S=e.appContext,F=e.appRegistry,C=e.subscribeAppForAsset,I=e.unsubscribeAppFromAsset,N=e.currentUser,T=e.appData,L=e.isSubDataLoading,k=e.getSubErrors,U=e.isSubDataEmpty,M=A(),z=!!f,B=z&&"dev_center"===f.platform;if(!z||B&&!g)return m.jsx(s.Typography,{variant:"body2",children:"App not found"});var K=n.normalizeAssetForApp(i||b,h),G=y.default(E||O).unix();return[K,v,x,O].every(Boolean)&&K.id?m.jsxs("div",{className:p.appAnnotationFeedItem,children:[m.jsx(s.Typography,{variant:"body2","data-testid":"".concat("FeedActivityPo_appAnnotation","_message"),children:l.formatMentionText(w,P,o.isNativeDetected)}),e.showAppPreview&&m.jsxs(m.Fragment,{children:[m.jsx("br",{}),g&&g.url?m.jsx(u,{appContainerClassName:p.appAnnotationFeedItemApp,appId:r,assetId:K.id,asset:K,app:{app:j(j({},f),{},{settings:D}),package:g},coordinates:{},timestamp:G,time:E,currentUser:N}):m.jsx(c,{appContainerClassName:p.appAnnotationFeedItemApp,appId:r,assetId:K.id,asset:a.Map(K),appComponentKey:x,appComponentCategory:v,requiresSubscription:!0,appContext:a.Map(S),assetDashboards:a.List(),timestamp:G,time:E,onSettingChange:function(){},settings:D,internalSelectors:{isSubDataLoading:L,getSubErrors:k,isSubDataEmpty:U},appRegistry:F,appData:T,subscribeAppForAsset:C,unsubscribeAppFromAsset:I})]}),_&&_.signed_url&&m.jsxs("div",{className:p.appAnnotationFeedItemAttachment,children:[m.jsx(s.Typography,{variant:"subtitle1",className:M.attachmentLable,children:"Attachments"}),m.jsx(d,{small:!0,attachmentUrl:_.signed_url,fileName:_.file_name,displayName:_.file_name})]})]}):m.jsx(s.Typography,{variant:"body2",children:"No Data"})};q.propTypes={feedItem:r.shape({id:r.oneOfType([r.number,r.string]).isRequired,well:function(e,t,r){return e.well||e.rig?e.well&&"object"!==f.default(e.well)?new Error("Prop '".concat(t,"' should be an object")):null:new Error("One of props 'well' or 'rig' was not specified in '".concat(r,"'."))},rig:function(e,t,r){return e.well||e.rig?e.rig&&"object"!==f.default(e.rig)?new Error("Prop '".concat(t,"' should be an object")):null:new Error("One of props 'well' or 'rig' was not specified in '".concat(r,"'."))},context:r.shape({app_annotation:r.shape({body:r.string,app_category:r.string.isRequired,app_name:r.string.isRequired,created_at:r.string.isRequired,settings:r.shape()}).isRequired}).isRequired}).isRequired,appContext:r.shape().isRequired,currentUser:r.shape().isRequired,appData:r.shape().isRequired,appRegistry:r.shape().isRequired,subscribeAppForAsset:r.func.isRequired,unsubscribeAppFromAsset:r.func.isRequired,isSubDataLoading:r.func.isRequired,getSubErrors:r.func.isRequired,isSubDataEmpty:r.func.isRequired,showAppPreview:r.bool},q.defaultProps={showAppPreview:!0},module.exports=q;
//# sourceMappingURL=index.js.map
