/*************************************************************************
* ADOBE CONFIDENTIAL
* ___________________
*
*  Copyright 2015 Adobe Systems Incorporated
*  All Rights Reserved.
*
* NOTICE:  All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any.  The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by all applicable intellectual property laws,
* including trade secret and or copyright laws.
* Dissemination of this information or reproduction of this material
* is strictly forbidden unless prior written permission is obtained
* from Adobe Systems Incorporated.
**************************************************************************/
import{floodgate as t}from"./floodgate.js";import{dcLocalStorage as n}from"../common/local-storage.js";import{setExperimentCodeForAnalytics as e,removeExperimentCodeForAnalytics as o}from"../common/experimentUtils.js";import{util as i}from"./util.js";import{viewerModuleUtils as a}from"./viewer-module-utils.js";import{loggingApi as c}from"../common/loggingApi.js";const l=(t,e)=>{const o="en-US"===n.getItem("locale")||"en-GB"===n.getItem("locale");return o&&t||!o&&e},r=n=>{try{return JSON.parse(t.getFeatureMeta(n))}catch(t){return c.error({context:"LinkedInTouchPoint",message:`Failure in parsing FeatureFlag ${n}`,error:t.message||t.toString()}),{}}};async function d(d,s){await n.init();const[h,p,u,g,m]=await Promise.all([t.hasFlag("dc-cv-linkedin-pdf-touch-point"),t.hasFlag("dc-cv-linkedin-pdf-touch-point-control"),t.hasFlag("dc-cv-linkedin-chat-pdf-touch-point"),t.hasFlag("dc-cv-linkedin-chat-pdf-touch-point-control"),t.hasFlag("dc-cv-linkedin-chat-pdf")]);try{await a.initializeViewerVariables(d)}catch(t){c.error({context:"LinkedInTouchPoint",message:"Error initializing viewer variables for LinkedIn",error:t.message||t.toString()})}let T;const f=!i.isAcrobatTouchPointEnabled("acrobat-touch-point-in-linkedin");let F;h?F=r("dc-cv-linkedin-pdf-touch-point"):p&&(F=r("dc-cv-linkedin-pdf-touch-point-control")),T=F?F.selectors:{};const k=!!F&&F.fteEnabled,L=!!F&&F.enLocaleEnabled,C=!!F&&F.nonEnLocaleEnabled,b=l(L,C),I=F?F.tooltip:{};if(m){const t=r("dc-cv-linkedin-chat-pdf");T={...T,linkedInChat:t}}let P;u?P=r("dc-cv-linkedin-chat-pdf-touch-point"):g&&(P=r("dc-cv-linkedin-chat-pdf-touch-point-control")),P&&(T={...T,linkedInChatTouchPoint:P});const E=!!P&&P.enLocaleEnabled,v=!!P&&P.nonEnLocaleEnabled,S=l(E,v),D=!!P&&P.fteEnabled,j=P?P.tooltip:{};return h&&b?(o("LIC"),e("LI")):p&&b?(o("LI"),e("LIC")):(o("LI"),o("LIC")),u&&S?(o("LCC"),e("LC")):g&&S?(o("LC"),e("LCC")):(o("LC"),o("LCC")),{enableLinkedinPDFTouchPoint:h&&!f&&b,enableLinkedinChatPDFTouchPoint:u&&!f&&S,enableLinkedinChatPDFAnalytics:m,selectors:T,openInAcrobatString:i.getTranslation("gsuiteOpenWithAcrobat"),summariseTouchPointString:i.getTranslation("linkedInSummarizePDF"),fteToolTipStrings:{title:i.getTranslation("outlookPDFTouchPointFTEHeader"),description:i.getTranslation("linkedInFeedPDFTouchPointFTEBody"),button:i.getTranslation("closeButton")},chatFteToolTipStrings:{title:i.getTranslation("linkedInChatPDFTouchPointFTEHeader"),description:i.getTranslation("linkedInChatPDFTouchPointFTEBody"),button:i.getTranslation("closeButton")},enableLinkedinFeedFteTooltip:k,enableLinkedinChatFteTooltip:D,frameId:s?.frameId,feedFteConfig:I,chatFteConfig:j}}export{d as linkedinInit};