/**\*\***\*\*\*\***\*\***\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\***\*\***\*\*\*\***\*\*** \*

-   ADOBE CONFIDENTIAL
-   ***
-
-   Copyright 2015-2022 Adobe Inc.
-   All Rights Reserved.
-
-   NOTICE: All information contained herein is, and remains
-   the property of Adobe Inc. and its suppliers,
-   if any. The intellectual and technical concepts contained
-   herein are proprietary to Adobe Inc. and its
-   suppliers and are protected by trade secret or copyright law.
-   Dissemination of this information or reproduction of this material
-   is strictly forbidden unless prior written permission is obtained
-   from Adobe Inc..
    **\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***\*\*\*\***\*\***/

!function(e){var t={};function r(n){if(t[n])return t[n].exports;var a=t[n]={i:n,l:!1,exports:{}};return e[n].call(a.exports,a,a.exports,r),a.l=!0,a.exports}r.m=e,r.c=t,r.d=function(e,t,n){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:n})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var n=Object.create(null);if(r.r(n),Object.defineProperty(n,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var a in e)r.d(n,a,function(t){return e[t]}.bind(null,a));return n},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=50)}([function(e,t){e.exports=require("@babel/runtime/regenerator")},function(e,t,r){"use strict";r.r(t);var n=r(7),a=r.n(n),s=r(8),o=r.n(s),i=r(4),c=r.n(i),u=r(19),l=r(34),d=r(32),f=r(13),p=new(function(){function e(){a()(this,e),c()(this,"config",{ENVIRONMENT:"production",ACTIVE_VERSIONS:["V1","V2","V2_5","V2_8","V3_0","V3_1","V4_0"],SUPPORTED_ACTIVE_VERSIONS:5,SETTINGS_FILE:"settings.json",SETTINGS_FILE_VERSION:3,LOOKUP_MAP_FILE:"map.json",ASSETS_DIRNAME:"assets",CC_SETTINGS_FILE:"C3Config.xml",CONSOLE_LOGGING:!1,SCOPES:"openid,AdobeID",SYNC_INITIAL_RETRY:24e4,KILLED_BEFORE_RESPONSE_INITIAL_RETRY:1e3,MAX_LOG_SIZE:5242880,PROXY_REQUEST_TIMEOUT:2e3,CLIENT_REQUEST_TIMEOUT:9e5,USER_ANALYTICS__REQUEST_TIMEOUT:2e3,GET_NOTIFICATION_DATA_TIMEOUT:2e3,NETWORK_STATUS_INTERVAL:1e3,NETWORK_MAX_LATENCY:3e3,NETWORK_MAX_SOCKETS:1,NETWORK_MAX_LATENCY_RETRIES:20,NETWORK_MINIMUM_PARTIAL_SIZE:524288,STOP_SYNCING_BEYOND:2556e5,HEALTH_POLL_INTERVAL:864e5,INITIAL_HEALTH_MEASUREMENT_DELAY:18e4,CPU_POLL_DURATION:6e4,DEFAULT_MEMOIZE_TIMEOUT:6e4,MAX_BACK_OFF:864e5,RETRYABLE_ERRORS:["ECONNRESET","ETIMEDOUT","ECONNREFUSED","LOCAL_RETRY","ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC"],NGL_ERRORS_TO_INFO_LOG:[403,407,408],EMBARGO_BACK_OFF:20736e5,RETRYABLE_DEFAULT_ATTEMPTS:8,GLOBAL_BACKOFF_SYNC_THROTTLE:1e4,ONLINE_SYNC_THROTTLE:1e4,OFFLINE_SYNC_THROTTLE:1e4,LEARN_DEFAULT_EXPIRATION:2592e5,ASSET_DEFAULT_EXPIRATION:2592e5,KILLSWITCH_MEMOIZE_TIMEOUT:864e5,TEMP_KILL_SWITCH_REGISTRY_KEY:"\\SOFTWARE\\Policies\\Adobe\\CCXProcess",TEMP_KILL_SWITCH_PLIST_PATH:"/Library/Preferences/com.adobe.CCXProcess.plist",TEMP_DEFAULT_TEMPLATES_DOWNLOADED:100,TEMP_STOCK_TEMPLATE_DOWNLOAD_LIMIT_REGISTRY_SETTING:"TempStockDownloadLimit",TEMP_CCD_CONTENT_DOWNLOAD_REGISTRY_SETTING:"TempCCDContentDownloadDisabled",TEMP_CCD_CONTENT_DOWNLOAD_DISABLED:!1,TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_REGISTRY_SETTING:"TempSenseiModelContentDownloadDisabled",TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_DISABLED:!1,TEMP_NETWORK_STATUS_REGISTRY_SETTING:"TempNetworkStatusDisabled",TEMP_NETWORK_STATUS_DISABLED:!1,LAUNCH_AGENT:"".concat(process.env.HOME,"/Library/LaunchAgents/com.adobe.ccxprocess.plist"),LAUNCH_DIRECTORY:"".concat(process.env.HOME,"/Library/LaunchAgents/"),NGL_INITIALIZE_TIMEOUT:3e5,TIER_1_LOCALES:["en_US","fr_FR","de_DE","ja_JP","ko_KR"],SUPPORTED_LOCALES:["cs_CZ","da_DK","de_DE","en_US","en_AE","en_GB","en_IL","es_ES","es_MX","fi_FI","fr_FR","fr_CA","fr_MA","hu_HU","it_IT","ja_JP","ko_KR","nb_NO","nl_NL","pl_PL","pt_BR","ru_RU","sv_SE","tr_TR","uk_UA","zh_CN","zh_TW"],DOWNLOAD_ASSET_TIMEOUT:6e4,DNS_CACHE_DURATION:24e4,MAX_EPERM_RENAMES:10,NUM_CONCURRENT_REQUESTS:10,MIN_RANDOMIZED_TIME:1e3,MAX_RANDOMIZED_TIME:9e5,MAX_RANDOMIZED_TIME_SHORT:3e4,TIME_FOR_SHORT_RANDOMIZE:36e5,MAX_TIMEOUT:Math.pow(2,31)-1,MIN_TIMEOUT:36e6,NETWORK_POLL_INTERVAL:36e5,DNS_RESOLVE_TIMEOUT:2e3,MIN_REFRESH:6e4,TRIAL_DAYS:7,PRODUCT_ALIASES:{PHSP:"PHXS",PHSPPR:"PHXS",PHSPBETA:"PHXS",PPROBETA:"PPRO",AEFTBETA:"AEFT",IDSNBETA:"IDSN",IDSNPR:"IDSN",FLPRBETA:"FLPR",FLPRPR:"FLPR",SPRKDV:"SPRK",SPRKPR:"SPRK",KCCC:"ACCC",ILSTBETA:"ILST",ILSTPR:"ILST"},PRODUCT_LIST:["PHXS","IDSN","PPRO","ILST","AEFT","MUSE","DRWV","FLPR","SPRK"],IGNORED_FILES_REGEXP:"\\bassets\\b",NODE_AID_RESPONSE_SCHEMA:{id:"NODE_AID_RESPONSE",type:"object",properties:{ProductsInfo:{type:"object",properties:{ProductInfo:{type:"array",items:{type:"object",properties:{SAPCode:{type:"array",items:{type:"string"}},CodexVersion:{type:"array",items:{type:"string"}},Platform:{type:"array",items:{type:"string"}},InstallerType:{type:"array",items:{type:"string"}},IsUWPProduct:{type:"array",items:{type:"string"}},InstallLanguage:{type:"array",items:{type:"string"}},DisplayName:{type:"array",items:{type:"string"}},BuildVersion:{type:"array",items:{type:"string"}},LaunchString:{type:"array",items:{type:"string"}}}}}}}}},MAP_DATA_SCHEMA:{id:"MAP_DATA",type:"object",properties:{versionInfo:{type:"object"},metadata:{type:"object"},assetMetadata:{type:"object"},version:{type:"number"}},required:["versionInfo","metadata","assetMetadata","version"]},CARDS_CONTROL_SCHEMA:{id:"/CARDS_CONTROL",type:"object",properties:{modeID:{type:["string","null"]},cardOrder:{type:["array","null"],items:{type:"number"}}},required:["modeID","cardOrder"]},SOPHIA_RESPONSE_SCHEMA:{id:"/SOPHIA_RESPONSE",type:"object",properties:{analyticsData:{type:"object",properties:{responseGUID:{type:"string"}}},surfaces:{type:"object",additionalProperties:{type:"object",properties:{containers:{type:"array",items:{type:"object",properties:{data:{type:"string",dataType:"string"},containerAnalyticsData:{type:"object"}}}},surfaceAnalyticsData:{type:"object",properties:{surfaceId:{type:"string"}}}}}},expirationDTS:{type:"string"}},required:["expirationDTS"]},CARDS_DATA_SCHEMA:{V1:{id:"CARDS_DATA",type:"object",properties:{cards:{type:"array"},expirationDTS:{type:"string"},cardControl:{type:"array",items:{$ref:"/CARDS_CONTROL"}},version:{type:"number"}},required:["expirationDTS","cards","cardControl"]},V2:{id:"CARDS_DATA",type:"object",properties:{cards:{type:"array"},expirationDTS:{type:"string"},cardControl:{type:"array",items:{$ref:"/CARDS_CONTROL"}},version:{type:"number"}},required:["expirationDTS","cards","cardControl"]},V2_4:{id:"CARDS_DATA",type:"object",properties:{cards:{type:"array"},expirationDTS:{type:"string"},cardControl:{type:"array",items:{$ref:"/CARDS_CONTROL"}},version:{type:"number"}},required:["expirationDTS","cards","cardControl"]},V2_5:{id:"CARDS_DATA",type:"object",properties:{cards:{type:"array"},expirationDTS:{type:"string"},cardControl:{type:"array",items:{$ref:"/CARDS_CONTROL"}},version:{type:"number"}},required:["expirationDTS","cards","cardControl"]},V2_8:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]},V3_0:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]},V3_1:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]},V4_0:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]}},VULCAN_PREFIX:"vulcan.SuiteMessage.",VULCAN_STARTUP_MESSAGE:"ccxprocess.Initialized",VULCAN_PING_REQUEST:"ccxprocess.in.request.app.ping",VULCAN_PING_RESPONSE:"ccxprocess.out.response.app.ping",VULCAN_PSDK_FEED_REQUEST:"ccxprocess.PSDKFeedRequest",VULCAN_PSDK_FEED_RESPONSE:"ccxprocess.PSDKFeedResponse",VULCAN_PSDK_FEED_BROADCAST:"ccxprocess.PSDKFeedBroadcast",VULCAN_LEARN_REQUEST:"ccxprocess.LearnRequest",VULCAN_LEARN_RESPONSE:"ccxprocess.LearnResponse",VULCAN_LEARN_USAGE_MARKER:"ccxprocess.LearnUsageMarker",VULCAN_LEARN_BROADCAST:"ccxprocess.LearnBroadcast",VULCAN_GET_USER_REQUEST:"ccxprocess.GetUserRequest",VULCAN_GET_USER_RESPONSE:"ccxprocess.GetUserResponse",VULCAN_START_SETTINGS_REQUEST:"ccxprocess.StartSettingsRequest",VULCAN_START_SETTINGS_GET_REQUEST:"ccxprocess.StartSettingsGetRequest",VULCAN_START_SETTINGS_GET_RESPONSE:"ccxprocess.StartSettingsGetResponse",VULCAN_START_SETTINGS_PATCH_UPDATE:"ccxprocess.StartSettingsPatchUpdate",VULCAN_STOCK_REQUEST:"ccxprocess.StockTemplateRequest",VULCAN_STOCK_RESPONSE:"ccxprocess.StockTemplateResponse",VULCAN_CC_PHOTO_DOWNLOAD_REQUEST:"ccxprocess.CCPhotoDownloadRequest",VULCAN_CC_PHOTO_DOWNLOAD_RESPONSE:"ccxprocess.CCPhotoDownloadResponse",VULCAN_CC_PHOTO_DOWNLOAD_PROGRESS:"ccxprocess.CCPhotoDownloadProgress",VULCAN_CC_PHOTO_DOWNLOAD_ERROR:"ccxprocess.CCPhotoDownloadError",VULCAN_AVATAR_REQUEST:"ccxprocess.UserAvatarRequest",VULCAN_AVATAR_RESPONSE:"ccxprocess.UserAvatarResponse",VULCAN_AVATAR_REQUEST_V2:"ccxprocess.AvatarRequest",VULCAN_AVATAR_RESPONSE_V2:"ccxprocess.AvatarResponse",SKIP_LOGGING_MESSAGE_LIST:["ccxprocess.in.request.app.ping","ccxprocess.out.response.app.ping"],SKIP_LOGGING_MESSAGE_CONTENT:["ccxprocess.in.request.app.ping","ccxprocess.out.response.app.ping","adbproduct.app.UserContextDataResponse","accc.app.ProxySettingsResponse","any.accc.app.ProxySettingsChanged","any.accc.app.UserContextData"],NOTIFICATION_REQUEST:"accc.notifications",NOTIFICATION_PSDK_RESPONSE:"ccxprocess.notification.psdk",NOTIFICATION_STOCK_RESPONSE:"ccxprocess.notification.stock",NOTIFICATION_FORCE_REFRESH_RESPONSE:"ccxprocess.notification.force-refresh",NOTIFICATION_PSDK_QUERY_DATA_BY_ID_RESPONSE:"ccxprocess.notification.psdk.byID.data",NOTIFICATION_STOCK_QUERY_DATA_BY_ID_RESPONSE:"ccxprocess.notification.stock.byID.data",NOTIFICATION_PSDK_QUERY_DATA_BY_TIME_RESPONSE:"ccxprocess.notification.psdk.byTime.data",NOTIFICATION_STOCK_QUERY_DATA_BY_TIME_RESPONSE:"ccxprocess.notification.stock.byTime.data",NOTIFICATION_FORCE_REFRESH_QUERY_DATA_BY_TIME_RESPONSE:"ccxprocess.notification.force-refresh.byTime.data",ANS_PSDK_NOTIFICATION_TYPE:"com.adobe.psdk.v1",ANS_PSDK_NOTIFICATION_SUB_TYPE:"operational.profile.updated",ANS_STOCK_NOTIFICATION_TYPE:"com.adobe.stock",ANS_STOCK_NOTIFICATION_SUB_TYPE:"templates.update",ANS_FORCE_REFRESH_NOTIFICATION_TYPE:"com.adobe.accc.generic.v1",ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE:"esdk.force.refresh",ANS_NUJ_REFRESH_NOTIFICATION_TYPE:"com.adobe.dunamis",ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE:"profile.state.change",USER_ANALYTICS_ENABLED:!1,ANALYTICS_INGEST_PATH:"/ingest",ANALYTICS_X_PRODUCT:"CCXStart/2.5",ANALYTICS_PROJECT:"ccx-process-service",ANALYTICS_INGEST_TYPE:"dunamis",ANALYTICS_API_KEY:"ccx-process-service",ANALYTICS_MAX_QUEUED_EVENTS:600,ANALYTICS_DEBOUNCE:1e4,ALLOW_NO_TOKEN:!0,ANALYTICS_HEARTBEAT_INTERVAL:36e5,ANALYTICS_EVENT_VALIDATION_INTERVAL:144e5,UNSUPPORTED_WINDOWS_UXP_APPS:["PHXS","ILST","SPRK","IDSN","PPRO","AEFT"],EARLIEST_SUPPORTED_WINDOWS_VERSION_UXP:"6.2",SUPPORTED_LEARN_THIRD_PARTY_START_MIN_VERSION:"2.7",LEARN_DATA_SCHEMA:{id:"/LEARN_CARD_DATA",type:"object",properties:{tutorials:{type:"array",items:{type:"object",properties:{metadata:{type:"object",properties:{images:{type:"object",properties:{hero:{type:"string"},thumbnail:{type:"string"}}}}}}}}}},CARD_DATA_SCHEMA:{v2:{id:"/CARD_DATA",type:"object",properties:{cardType:{type:"string"},cardName:{type:"string"},displayTemplate:{type:"string"},backgroundImage:{type:["string","null"]},backgroundImageLocalPath:{type:["string","null"]},backgroundFillColor:{type:["string","null"]},startDTS:{type:["string","null"]},endDTS:{type:["string","null"]},overlayTintColor:{type:["string","null"]}},required:["cardType"]},openDoc:{},firstrun:{},footer:{},learn:{},discover:{},trial:{},welcome:{}},PRODUCT_PRIORITY:{PHXS:9,ILST:8,IDSN:7,PPRO:6,AEFT:5,SPRK:4,DRWV:3,FLPR:2,MUSE:1},DEFAULT:{LOOKUP_MAP_FILE_VERSION:2,URL_STAGING:"https://p13n-stage.adobe.io/psdk/v2/content",URL_PRODUCTION:"https://p13n.adobe.io/psdk/v2/content",SUPPORTED_PRODUCTS:{},LOOKUP_COLLECTION_FILE_VERSION:1,PRIORITY_CHANNEL:f.b.Unknown,HTTP_STATUS_HEAD_CHECK_URL:"https://odin.adobe.com/content/odin/home.html",DNS_RESOLVE_STATUS_CHECK_URL:"https://p13n.adobe.io"},OZ:{LOG_PREFIX:"Oz"},V1:{VERSION_LESS_THAN:"2.0",START_VERSION:"1.0",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"15.0",DRWV:"18.0",IDSN:"13.0",ILST:"22.0",MUSE:"2018.0",PHXS:"19.0",PPRO:"12.0"},FIRST_MILE_SURFACE_ID:["welcome","openDoc"],FIRST_MILE_SURFACE_MODE_MAP:{openDoc:"openDoc",welcome:"welcome"}},V2:{VERSION_LESS_THAN:"2.4",START_VERSION:"2.2.1.120",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"16.0",DRWV:"19.0",IDSN:"14.0",ILST:"23.0",MUSE:"2019.0",PHXS:"20.0",PPRO:"13.0"},FIRST_MILE_SURFACE_ID:["CCX_Start_2.0_FirstRun","CCX_Start_2.0_Footer","CCX_Start_2.0_Learn","CCX_Start_2.0_Discover","CCX_Start_2.0_Trial"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_2.0_FirstRun":"firstrun","CCX_Start_2.0_Footer":"footer","CCX_Start_2.0_Learn":"learn","CCX_Start_2.0_Discover":"discover","CCX_Start_2.0_Trial":"trial"}},V2_4:{VERSION_LESS_THAN:"2.5",START_VERSION:"2.4.0.11",FIRST_MILE_SURFACE_ID:["CCX_TUTORIAL_2.5","CCX_Start_2.5_Learn","CCX_Start_2.5_Toast","CCX_Start_2.5_Home"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_TUTORIAL_2.5":"CCX_TUTORIAL_2.5","CCX_Start_2.5_Learn":"CCX_Start_2.5_Learn","CCX_Start_2.5_Home":"CCX_Start_2.5_Home","CCX_Start_2.5_Toast":"CCX_Start_2.5_Toast"},FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"16.0",DRWV:"19.0",IDSN:"14.0",ILST:"23.0",MUSE:"2019.0",PHXS:"20.0",PPRO:"13.0"},HOME_SURFACE_ID:"CCX_Start_2.5_Home",LEARN_SURFACE_ID:"CCX_TUTORIAL_2.5"},V2_5:{VERSION_LESS_THAN:"2.8",START_VERSION:"2.7.2.14",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"16.99",DRWV:"99.99",IDSN:"14.99",ILST:"23.99",MUSE:"2019.99",PHXS:"20.99",PPRO:"13.99"},FIRST_MILE_SURFACE_ID:["CCX_Start_2.5_Learn","CCX_Start_2.5_Toast","CCX_Start_2.5_Home"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_TUTORIAL_2.5":"CCX_TUTORIAL_2.5","CCX_Start_2.5_Learn":"CCX_Start_2.5_Learn","CCX_Start_2.5_Home":"CCX_Start_2.5_Home","CCX_Start_2.5_Toast":"CCX_Start_2.5_Toast"},HOME_SURFACE_ID:"CCX_Start_2.5_Home",LEARN_SURFACE_ID:"CCX_TUTORIAL_2.5"},V2_8:{VERSION_LESS_THAN:"3.0",START_VERSION:"2.16.0.8",FIRST_MILE_PREFETCH_CLIENTS:{AEFT:"18.0",IDSN:"15.99",ILST:"24.0",MUSE:"2099.0",PHXS:"21.0",PPRO:"14.4"},FIRST_MILE_SURFACE_ID:["CCX_Start_3.1_Learn","CCX_Start_3.1_Toast","CCX_Start_3.1_Home","CCX_Start_3.1_Whats_New"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_3.1_Tutorials":"CCX_Start_3.1_Tutorials","CCX_Start_3.1_Learn":"CCX_Start_3.1_Learn","CCX_Start_3.1_Home":"CCX_Start_3.1_Home","CCX_Start_3.1_Toast":"CCX_Start_3.1_Toast","CCX_Start_3.1_Whats_New":"CCX_Start_3.1_Whats_New"},HOME_SURFACE_ID:"CCX_Start_3.1_Home",LEARN_SURFACE_ID:"CCX_Start_3.1_Tutorials"},V3_0:{VERSION_LESS_THAN:"3.1",START_VERSION:"3.0.4",FIRST_MILE_PREFETCH_CLIENTS:{FLPR:"20.0",ILST:"24.0",PHXS:"21.0"},FIRST_MILE_SURFACE_ID:["CCX_Start_3.0_Learn","CCX_Start_3.0_Toast","CCX_Start_3.0_Home"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_3.0_Tutorials":"CCX_Start_3.0_Tutorials","CCX_Start_3.0_Learn":"CCX_Start_3.0_Learn","CCX_Start_3.0_Home":"CCX_Start_3.0_Home","CCX_Start_3.0_Toast":"CCX_Start_3.0_Toast"},HOME_SURFACE_ID:"CCX_Start_3.0_Home",LEARN_SURFACE_ID:"CCX_Start_3.0_Tutorials"},V3_1:{VERSION_LESS_THAN:"4.0",START_VERSION:"3.8.0.28",FIRST_MILE_PREFETCH_CLIENTS:{FLPR:"21.0.3",PHXS:"22.2",ILST:"25.2",SPRK:"38.0",IDSN:"16.1",PPRO:"14.9"},FIRST_MILE_SURFACE_ID:["CCX_Start_3.1_Learn","CCX_Start_3.1_Toast","CCX_Start_3.1_Home","CCX_Start_3.1_Whats_New"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_3.1_Tutorials":"CCX_Start_3.1_Tutorials","CCX_Start_3.1_Learn":"CCX_Start_3.1_Learn","CCX_Start_3.1_Home":"CCX_Start_3.1_Home","CCX_Start_3.1_Toast":"CCX_Start_3.1_Toast","CCX_Start_3.1_Whats_New":"CCX_Start_3.1_Whats_New"},HOME_SURFACE_ID:"CCX_Start_3.1_Home",LEARN_SURFACE_ID:"CCX_Start_3.1_Tutorials"},V4_0:{VERSION_LESS_THAN:"99.9",START_VERSION:"6.0.0.31",FIRST_MILE_PREFETCH_CLIENTS:{FLPR:"99.0",ILST:"99.0",PHXS:"99.0",SPRK:"99.0",PPRO:"99.0",IDSN:"99.0",AEFT:"99.0"},FIRST_MILE_SURFACE_ID:["CCX_Start_4.0_Toast","CCX_Start_4.0_Home","CCX_Start_4.0_Whats_New"],FIRST_MILE_SURFACE_MODE_MAP:{"CCX_Start_3.1_Tutorials":"CCX_Start_3.1_Tutorials","CCX_Start_4.0_Home":"CCX_Start_4.0_Home","CCX_Start_4.0_Toast":"CCX_Start_4.0_Toast","CCX_Start_4.0_Whats_New":"CCX_Start_4.0_Whats_New"},HOME_SURFACE_ID:"CCX_Start_4.0_Home",LEARN_SURFACE_ID:"CCX_Start_3.1_Tutorials"},ANALYTICS:{w_CCX_PROCESS:"CCX Process",w_NOTIFICATION:"Notification",w_INTERNAL:"Internal",c_DESKTOP:"DESKTOP",SOPHIA_CARDS:"Sophia Cards",UTUTS:"Ututs",sc_CONFIG_SETTINGS:"Config Settings",sc_CUSTOM_HOOK:"CustomHook.ts",sc_PROCESS:"Process",sc_SOPHIA:"Sophia",sc_STOCK:"Stock",sc_LEARN:"Learn",sc_CCX_START:"CCX Start",sc_CC_PHOTO:"CC Photo",sc_LR_CONTENT:"Lightroom Content",sc_CC_SEARCH:"CC Search",sc_OZ:"Oz",sc_CC_SEARCH_STORAGE:"CC Storage",sc_UTUTS:"Ututs",sc_LCM:"LCM",sc_RECOMMMENDATIONS:"Recommendations",sc_AUTH:"Auth",sc_AVATAR:"Avatar",sc_FORCE_REFRESH:"Force Refresh",sc_CCX_FILE_DOWNLOAD:"CCX Start File Download",sc_PULSE:"Pulse",sc_Network:"Network",sc_Proxy:"Proxy",t_INSTALL:"install",t_UNINSTALL:"uninstall",t_UPDATE:"update",t_INIT:"init",t_START:"start",t_REQUEST:"request",t_RESPONSE:"response",t_SIGNOUT:"signout",t_SIGNIN:"signin",t_FETCH:"fetch",t_CLEAR:"clear",t_PERFORMANCE:"performance",t_APP:"app",t_INFO:"info",t_WARNING:"warning",st_PROCESS:"process",st_API:"api",st_ANS:"ans",st_CC_PHOTOS:"cc photos",st_NETWORK:"network",st_CLIENT:"client",st_TOKEN:"token",st_RECEIVED:"received",st_FINISHED:"finished",st_RUNNING:"running",st_STATUS:"status",st_SETTINGS:"settings",st_DEBUG:"debug",ERROR:"error",NO_ERROR:null,AGGREGATE_ERROR:"Aggregate Error",AGGREGATE_ERROR_DESCRIPTION:" aggregation error.",PARAM_VALIDATION_ERR:"Param Validation Error",PAYLOAD_PARSE_FAIL:"Fail to parse payload",UNEXPECTED_ANS_MSG:"Received unexpected ANS message",PARSE_MSG_FAIL:"Fail to parse message",GET_NOTIFICATION_DATA:"Get Notification Data By ID",DATA_VALIDATION_ERR:"Data Validation Error",GC_ERROR:"GC Error",NETWORK_ERR:"Network Error",IO_ERR:"I/O Error",LR_PHOTO_DOWNLOAD_ERR:"Lightroom Photo Download Error",NO_DATA:"No data to save",NO_STOCK_PARAMS:"No Stock Params",MISSING_DATA:"Missing Data",SIGNED_OUT:"User Signed Out",OFFLINE_ERROR:"Offline",INVALID_JSON:"Invalid JSON",EXPIRED_DATA:"Expired Data",NGL_PROFILE_ERROR:"NGL Profile",NGL_TOKEN_ERROR:"NGL Token",AID_GET_INSTALLED_APPS_ERROR:"AID Installed App Sync DB Error",ONLINE_SYNC_ERROR:"Online Sync Error",INVALID_COLLECTION:"Invalid Collection Data",DEBUG_INTERFACE:"DEBUG Interface"},ON_DEMAND_REQUEST_SCHEMA:{id:"/ON_DEMAND_REQUEST_SCHEMA",type:"object",properties:{params:{type:"object"},requestId:{type:"string"},version:{type:"integer",maximum:1,minimum:1},force:{type:"object",properties:{type:{type:"string",pattern:"stale|always|none"},depth:{type:"integer",minimum:0,maximum:2}}},analytics:{type:"object"},required:["version","params","requestId"]}},ON_DEMAND_LIST_REQUEST_SCHEMA:{id:"/ON_DEMAND_LIST_REQUEST_SCHEMA",type:"object",properties:{params:{type:"object"},requestId:{type:"string"},version:{type:"integer",maximum:1,minimum:1},required:["version","params","requestId"]}},SERVICE_REQUEST_SCHEMA:{id:"/SERVICE_REQUEST_SCHEMA",type:"object",properties:{params:{type:"object"},requestId:{type:"string"},version:{type:"integer",maximum:1,minimum:1},displayed:{type:"string"},urgent:{type:"boolean"},updateLastUseTime:{type:"boolean"},force:{type:"object",properties:{type:{type:"string",pattern:"stale|always|none"},depth:{type:"integer",minimum:0,maximum:2}}},analytics:{type:"object"},required:["version","params","requestId"]}},FORCE_REFRESH_SCHEMA:{id:"/FORCE_REFRESH_SCHEMA",type:"object",properties:{expire:{type:"object",properties:{AVATAR:{type:["boolean","array"]},CCD:{type:["boolean","array"]},DISCOVER_PANEL:{type:["boolean","array"]},FIRST_MILE:{type:["boolean","array"]},LEARN:{type:["boolean","array"]},SENSEI_MODELS:{type:["boolean","array"]},STOCK:{type:["boolean","array"]},XD:{type:["boolean","array"]}}},force:{type:"object",properties:{type:{enum:["stale","always","none"]},depth:{type:"integer",minimum:0,maximum:2}},required:["type"]}},required:["expire"]},CC_DIR:"",ROOT_DIR:"",LOG_DIR:"",DOWNLOAD_TMP_EXTENSION:"",PROGRESS_THROTTLE_INTERVAL:0,TMP_PHOTOS_DOWNLOAD_DIRECTORY:"",STOCK_API_PATH:"",STOCK_API_ROOT:"",CC_SEARCH_IDENTIFIER:"ccsearch-component-service",CC_TOUT_DOWNLOAD_IDENTIFIER:"ccxstart-download-file"}),c()(this,"environments",{staging:{LABEL:"Staging",CLIENT_NAME:"CCXProcess1",CLIENT_ID:"CCXProcess_v4_12",CLIENT_SECRET:"s8e-6NswK8KSNuafwLj0hfcchtOkra30s4yq",IMS:"ims-na1-stg1.adobelogin.com",UTUTS_SERVICE:"https://utut-service.stage.adobe.com/api/ututs"},production:{LABEL:"Production",CLIENT_NAME:"CCXProcess1",CLIENT_ID:"CCXProcess_v4_12",CLIENT_SECRET:"p8e-4-0RPoM61uhVKXI9bkKDIfVXelfRR-F-",IMS:"ims-na1.adobelogin.com",UTUTS_SERVICE:"https://utut-service.adobe.com/api/ututs"}}),c()(this,"settings",{SETTINGS_FILE_VERSION:this.config.SETTINGS_FILE_VERSION}),c()(this,"currentDiskState",void 0),c()(this,"analytics",this.get("ANALYTICS")),this.init()}return o()(e,[{key:"init",value:function(){var e=this;if(this.isPlatformWindows()){var t=process.env.USERPROFILE.replace(/\\/g,"/");this.config.ROOT_DIR="".concat(t,"/AppData/Roaming/"),this.config.LOG_DIR="".concat(process.env.TEMP.replace(/\\/g,"/"),"/CreativeCloud/CCX Welcome/");var r="".concat(this.isArm()?process.env.ProgramFiles:process.env["ProgramFiles(x86)"]).replace(/\\/g,"/");this.config.CC_DIR="".concat(r,"/Adobe/Adobe Creative Cloud/")}else this.config.ROOT_DIR="".concat(process.env.HOME,"/Library/Caches/"),this.config.LOG_DIR="".concat(process.env.HOME,"/Library/Logs/CreativeCloud/CCX Welcome/"),this.config.CC_DIR="/Applications/Utilities/Adobe Creative Cloud/";var n=!1;this.isStagingRedirectInEffect()&&(this.config.ENVIRONMENT="staging",n=!0),this.config.ROOT_DIR+="Adobe/CCX Welcome/"+(n?"stage/":""),this.config.LOG_DIR+=n?"stage/":"",this.config.STOCK_API_ROOT="/Rest/Media/".concat(this.config.STOCK_API_VERSION),this.config.STOCK_API_PATH="".concat(this.config.STOCK_API_ROOT,"/Search/Templates"),this.config.TMP_PHOTOS_DOWNLOAD_DIRECTORY="com.adobe.ccx.start.lrphotos/",this.config.PROGRESS_THROTTLE_INTERVAL=250,this.config.DOWNLOAD_TMP_EXTENSION=".tmp",["openDoc","firstrun","footer","learn","discover","trial","welcome"].forEach(function(t){e.config.CARD_DATA_SCHEMA[t]=e.config.CARD_DATA_SCHEMA.v2}),this.loadSettings(),process.argv.forEach(function(t){"--debug"===t&&(e.config.CONSOLE_LOGGING=!0)}),this.config.CONSOLE_LOGGING||global.test||(console.log("Outputting logs to: ".concat(this.config.LOG_DIR)),console.log("To view log messages on the console, use the --debug argument"))}},{key:"isPlatformWindows",value:function(){return 0===process.platform.indexOf("win")}},{key:"isArm",value:function(){return 0===process.arch.indexOf("arm")}},{key:"get",value:function(e,t){return t?this.settings[t]&&void 0!==this.settings[t][e]?this.settings[t][e]:this.config[t]&&this.config[t][e]:void 0!==this.settings[e]?this.settings[e]:this.config[e]}},{key:"set",value:function(e,t,r){return r?(this.settings[r]=this.settings[r]||{},this.settings[r][e]=t):this.settings[e]=t,this.saveSettings()}},{key:"default",value:function(e){var t=e.LABEL.toLowerCase().replace(/^\w/,function(e){return e.toUpperCase()});return e.ANALYTICS_SUBCATEGORY=e.ANALYTICS_SUBCATEGORY||t,e.LOG_PREFIX=e.LOG_PREFIX||t,e.DIR=e.DIR||t.toLowerCase()+"/",e.VULCAN_TYPE=e.VULCAN_TYPE||t,e.AGGREGATE_TYPE=e.AGGREGATE_TYPE||t,e}},{key:"patch",value:function(e,t){this.config[e]=this.config[e]||{};var r=Object.assign({},this.config[e]);Object.assign(this.config[e],this.config.DEFAULT,r,t),this.default(this.config[e])}},{key:"getEnvironment",value:function(){var e=this.get("ENVIRONMENT");return this.environments[e]||this.environments[this.config.ENVIRONMENT]}},{key:"isStagingRedirectInEffect",value:function(){var e=!1;try{var t=l.readFileSync(this.config.CC_DIR+this.config.CC_SETTINGS_FILE,"utf8");new d.Parser({async:!1}).parseString(t,function(t,r){t||r.C3Config.config[0].namespace.forEach(function(t){t&&t.$&&t.$.name&&"accc.container"===t.$.name&&t.property.forEach(function(t){t&&t.$&&t.$.name&&"IMS_ENV"===t.$.name&&"STG"===t._&&(e=!0)})})})}catch(e){}return e}},{key:"loadSettings",value:function(){try{this.currentDiskState=l.readFileSync(this.config.ROOT_DIR+this.config.SETTINGS_FILE,"utf8");var e=JSON.parse(this.currentDiskState);this.settings.SETTINGS_FILE_VERSION===e.SETTINGS_FILE_VERSION&&(this.settings=e)}catch(e){}}},{key:"saveSettings",value:function(){var e=JSON.stringify(this.settings,void 0,2);if(e===this.currentDiskState)return!1;try{var t="".concat(this.config.SETTINGS_FILE,".TEMP_").concat(u.v4());l.writeFileSync(this.config.ROOT_DIR+t,e),l.renameSync(this.config.ROOT_DIR+t,this.config.ROOT_DIR+this.config.SETTINGS_FILE),this.currentDiskState=e}catch(e){}return!0}}]),e}());t.default=p},function(e,t){e.exports=require("@babel/runtime/helpers/asyncToGenerator")},function(e,t,r){"use strict";r.r(t);var n=r(2),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(4),l=r.n(u),d=r(0),f=r.n(d),p=r(37),h=r(16),v=r(11),_=r(24),y=r(32),E=r(1),m=r(40),g=r(41),O=r.n(g),S=r(5),T=new(function(){function e(){var t=this;o()(this,e),l()(this,"memoize",function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},n=r.resolver,a=r.refresher,s=r.wrapper,o=r.timeout,i=void 0===o?E.default.get("DEFAULT_MEMOIZE_TIMEOUT"):o,c=r.destructor,u=void 0===c?function(){return!0}:c,l=t,d=function t(){var r=arguments,o=n?n.apply(this,r):r[0],c=t.cacheTimeout.get(o);if(c&&clearTimeout(c),i>0&&t.cacheTimeout.set(o,setTimeout(function e(){t.cache.get(o)&&(u(o,t.cache.get(o))?t.cache.delete(o):t.cacheTimeout.set(o,setTimeout(e,i)))},i)),t.cache.has(o)){var d=t.cache.get(o);if(!a||!a(d))return s?s(r,d,!0):d}var f=e.apply(this,r);return f instanceof Promise&&l.enablePromiseStateAccess(f),t.cache.set(o,f),s?s(r,f,!1):f};return d.cache=new Map,d.cacheTimeout=new Map,d}),l()(this,"throttle",function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:250;return function(){var a=this,s=(new Date).getTime(),o=arguments;t&&s<t+n?(clearTimeout(r),r=setTimeout(function(){t=s,e.apply(a,o)},n)):(t=s,e.apply(a,o))}}),l()(this,"setTimeoutAsync",function(e){return new Promise(function(t){return setTimeout(t,e)})})}return c()(e,[{key:"getTimeToExpiry",value:function(e){if(!e)return 0;var t=(new Date).valueOf(),r=new Date(e).valueOf()-t;return isNaN(r)?0:Math.max(0,r)}},{key:"enablePromiseStateAccess",value:function(e){e.state="pending",e.then(function(t){e.state="resolved",e.value=t},function(t){e.state="rejected",e.value=t})}},{key:"isDebugModeEnabled",value:function(){return E.default.get("DEBUG_MODE")}},{key:"isDateExpired",value:function(e){return 0===this.getTimeToExpiry(e)}},{key:"getHumanReadableTime",value:function(e){var t=e/36e5,r=e/6e4%60,n=e/1e3%60;return t>1?t.toFixed(2)+" hr":r>1?r.toFixed(2)+" min":n>1?n.toFixed(2)+" s":e+" ms"}},{key:"getRandomizedTime",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0],t=E.default.get("MIN_RANDOMIZED_TIME"),r=e?E.default.get("MAX_RANDOMIZED_TIME_SHORT"):E.default.get("MAX_RANDOMIZED_TIME");return Math.floor(Math.random()*(r-t))+t}},{key:"validateDataFields",value:function(e,t){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,n=new m.Validator;r&&r.forEach(function(e){n.addSchema(e,e.id)});var a=n.validate(e,t);return 0===a.errors.length?null:a.errors}},{key:"parseXml",value:function(){var e=a()(f.a.mark(function e(t){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,new Promise(function(){var e=a()(f.a.mark(function e(r,n){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:y.parseString(t,function(e,t){e?n(e):r(t)});case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}());case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getProductAlias",value:function(e){var t=E.default.get("PRODUCT_ALIASES");return t&&t[e]||e}},{key:"getProcessVersion",value:function(){return"".concat(p.version,"-").concat("21")}},{key:"isWindows",value:function(){return"win32"===process.platform}},{key:"getOsVersion",value:function(){return _.release()}},{key:"getOsPlatform",value:function(){var e=this.isWindows()?"win":"mac";return"arm64"===_.arch()?e+="arm64":e+="64",e}},{key:"getClientContentVersion",value:function(e,t){return E.default.get("ACTIVE_VERSIONS",t).find(function(r){var n=E.default.get(r,t).PREFETCH_CLIENTS[e.productCode];return 1!==T.compareMajorMinorVersions(n,e.productVersion)})||"V1"}},{key:"ccxVersionToString",value:function(){var e=this,t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{ccxVersion:""},r=t.ccxVersion;return t.ccxVersion?E.default.get("ACTIVE_VERSIONS").find(function(t){var n=E.default.get("VERSION_LESS_THAN",t);return-1===e.compareMajorMinorVersions(n,r)})||"V1":(r=E.default.get("ACTIVE_VERSIONS").filter(function(r){if(!t.productCode||!t.productVersion)return!1;var n=E.default.get("FIRST_MILE_PREFETCH_CLIENTS",r)[t.productCode];return!(!n||1===e.compareMajorMinorVersions(n,t.productVersion))})[0])||"V1"}},{key:"retryLocalErrors",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:E.default.get("RETRYABLE_DEFAULT_ATTEMPTS");return function(){var r=a()(f.a.mark(function r(n){var a,s,o,i=this;return f.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:a=0,s=null,o=null;case 1:return s=null,r.next=4,e(n).catch(function(e){if(!E.default.get("RETRYABLE_ERRORS").includes(null==e?void 0:e.code))throw e;s=e,i.log.disk("Retry-able error present. Retrying ".concat(a+1,". Underlying error ").concat(e))});case 4:o=r.sent;case 5:if(++a<t&&s){r.next=1;break}case 6:if(!s){r.next=8;break}throw new S.default("LOCAL_NETWORK_ERROR_RETRY_FAILED",s);case 8:return r.abrupt("return",o);case 9:case"end":return r.stop()}},r)}));return function(e){return r.apply(this,arguments)}}()}},{key:"sanitizeLocale",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:E.default.get("SUPPORTED_LOCALES");if(t.includes(e))return e;var r=e.slice(0,2);return t.find(function(e){return e.slice(0,2)===r})||"en_US"}},{key:"compareMajorMinorVersions",value:function(e,t){if(!e)return 1;if(!t)return-1;var r,n,a,s;try{r=parseInt(e.split(".")[0],10),a=parseInt(e.split(".")[1]||"0",10)}catch(e){return 1}try{n=parseInt(t.split(".")[0],10),s=parseInt(t.split(".")[1]||"0",10)}catch(e){return-1}return r===n&&a===s?0:r<n||r===n&&a<s?1:-1}},{key:"getClientsThatNeedRefresh",value:function(e){var t=this,r={};E.default.get("ACTIVE_VERSIONS").forEach(function(e){r[e]={}});var n=e.getCachedRequestData();Object.keys(n).forEach(function(e){Object.keys(n[e]).forEach(function(a){n[e][a].forEach(function(n){var s=t.ccxVersionToString(n),o=E.default.get("FIRST_MILE_PREFETCH_CLIENTS",s)[e];if(o&&-1===t.compareMajorMinorVersions(o,a)){var i=[e,a,n.productLanguage,n.countryCode].join("-");r[s][i]||(r[s][i]=n)}})})});var a={};return Object.keys(r).map(function(e){a[e]=Object.values(r[e])}),a}},{key:"hasBeenUsedRecently",value:function(e){if(!e)return!1;var t=new Date(e);return!isNaN(t)&&(t.setMilliseconds(E.default.get("STOP_SYNCING_BEYOND")),t>new Date)}},{key:"getDiskSize",value:function(){var e=a()(f.a.mark(function e(){var t,r,n,s=this,o=arguments;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=o.length>0&&void 0!==o[0]?o[0]:E.default.get("ROOT_DIR"),e.next=3,h.readdir(t);case 3:return r=e.sent,e.next=6,T.waitAll(r.map(function(){var e=a()(f.a.mark(function e(r){var n;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.join(t,r),e.next=3,h.stat(r).catch(function(e){return{isFile:function(){return!1},size:0,isDirectory:function(){return!1}}});case 3:if(!(n=e.sent).isFile()){e.next=8;break}return e.abrupt("return",n.size);case 8:if(!n.isDirectory()){e.next=12;break}return e.next=11,s.getDiskSize(r);case 11:return e.abrupt("return",e.sent);case 12:return e.abrupt("return",0);case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 6:return n=e.sent.reduce(function(e,t){return e+t},0),e.abrupt("return",n);case 8:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"deleteTempFiles",value:function(){var e=a()(f.a.mark(function e(t){var r,n,s,o=arguments;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:864e5,n=new Date,e.next=4,h.readdir(t);case 4:return s=e.sent,e.next=7,T.waitAll(s.map(function(){var e=a()(f.a.mark(function e(a){var s,o;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=v.join(t,a),e.next=3,h.stat(s);case 3:if(o=e.sent,!(Number(n)-Number(o.mtime)<r)){e.next=6;break}return e.abrupt("return");case 6:return e.next=8,h.unlink(s);case 8:return e.abrupt("return","Deleted ".concat(s));case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()).map(function(e){return e.catch(function(e){return"Error deleting temp file: ".concat(e)})}));case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"scrubStack",value:function(e){return e?(e=e.toString()).replace(/[A-Z]?\:?(\\|\/).*\1/g,function(e){return e.length>=5?"<r>":e}).trim():e}},{key:"getLocks",value:function(){var e=a()(f.a.mark(function e(t,r,n){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",new Promise(function(e,a){var s=void 0,o=void 0,i=function(){t(function(){return new Promise(function(e){s=e})})},c=function(){r(function(){return new Promise(function(e){o=e})})};setTimeout(function t(){s&&o?n().then(e).catch(a).finally(function(){s(),o()}):s?(s(),s=void 0,setTimeout(i,10),setTimeout(t,30)):o?(o(),o=void 0,setTimeout(c,10),setTimeout(t,30)):setTimeout(t,20)},20),i(),c()}));case 1:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"waitAll",value:function(){var e=a()(f.a.mark(function e(t){var r,n;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=null,e.next=3,Promise.all(t.map(function(e){return e.catch(function(e){return r=r||e})}));case 3:if(n=e.sent,!r){e.next=6;break}throw r;case 6:return e.abrupt("return",n);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"exec",value:function(e,t){return new Promise(function(r,n){return O.a.exec(e,t,function(e,t){return e?n(e):r(t)})})}}]),e}());t.default=T},function(e,t){e.exports=require("@babel/runtime/helpers/defineProperty")},function(e,t,r){"use strict";r.r(t),r.d(t,"default",function(){return I});var n=r(25),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(9),l=r.n(u),d=r(14),f=r.n(d),p=r(15),h=r.n(p),v=r(6),_=r.n(v),y=r(42),E=r.n(y),m=r(4),g=r.n(m),O=r(24);function S(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function T(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?S(Object(r),!0).forEach(function(t){g()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):S(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function A(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var a=_()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return h()(this,r)}}var I=function(e){f()(r,e);var t=A(r);function r(e){var n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:void 0,s=arguments.length>2&&void 0!==arguments[2]?arguments[2]:void 0;return o()(this,r),n=t.call(this,e||a instanceof Error&&a.message||"Unknown"),g()(l()(n),"underlyingError",void 0),g()(l()(n),"error_code",void 0),g()(l()(n),"silent",!1),g()(l()(n),"context",""),g()(l()(n),"headers",void 0),g()(l()(n),"payload",{}),g()(l()(n),"subErrorList",[]),g()(l()(n),"supportData",void 0),a&&(a instanceof r?(n.silent=a.isSilent,n.underlyingError=a,a.hasSubErrors&&n.addSubError({err:a}),Object.assign(n.payload,a.ingestPayload)):n.underlyingError=a),n.error_code=s||n.underlyingError&&"string"!=typeof n.underlyingError&&n.underlyingError.code||"Unknown",n}return c()(r,[{key:"addSubError",value:function(e){var t=this,n=e.err;return this.underlyingError||(n instanceof r?(this.silent=n.isSilent,this.underlyingError="",Object.assign(this.payload,n.ingestPayload)):this.underlyingError=""),"Unknown"===this.error_code&&n instanceof Error&&void 0!==n.code&&(this.underlyingError=n,this.error_code=n.code),n instanceof r&&null!=n&&n.hasSubErrors?n.subErrors.forEach(function(r){t.addSubError(T(T({},e),r))}):this.subErrorList.push(e),this}},{key:"assignSubErrors",value:function(e){return this.subErrorList.forEach(function(t){Object.assign(t,e,t)}),this}},{key:"addSubErrors",value:function(e){var t=this;Object.keys(e||{}).forEach(function(r){var n;null==e||null===(n=e[r].failed)||void 0===n||n.forEach(function(e){return t.addSubError(T(T({},e),{},{surface:r}))})})}},{key:"subErrorJSON",get:function(){var e={};return new Set(this.subErrorList.map(function(e){return e.surface})).forEach(function(t){return e[t||"unknown"]={failed:[]}}),this.subErrorList.forEach(function(t){e[t.surface||"unknown"].failed.push(T(T({},t),{},{surface:void 0}))}),this.subErrorList.length>0?e:void 0}},{key:"hasSubErrors",get:function(){return this.subErrorList.length>0}},{key:"subErrors",get:function(){return a()(this.subErrorList)}},{key:"code",get:function(){return this.error_code}},{key:"short",get:function(){return this.message+(this.context||"")}},{key:"description",get:function(){var e=this.context?this.context+O.EOL:"";return this.subErrorList&&(e+=this.subErrorList.map(function(e){var t,r;return(e.err instanceof String?e.err:"".concat(null===(t=e.err)||void 0===t?void 0:t.message," (").concat(null===(r=e.err)||void 0===r?void 0:r.code,")"))+"@ ".concat(e.url)}).join(O.EOL)),this.stack&&(e+=this.stack+O.EOL),this.underlyingError&&(e+=" VIA ",this.underlyingError instanceof r?e+=this.underlyingError.message+" "+this.underlyingError.code+O.EOL+this.underlyingError.description+O.EOL:this.underlyingError instanceof Error?e+=this.underlyingError.message+this.underlyingError.code+(this.underlyingError.stack?O.EOL+this.underlyingError.stack:"")+O.EOL:e+=this.underlyingError),e}},{key:"responseHeaders",get:function(){return this.headers}},{key:"ingestPayload",get:function(){return this.payload}},{key:"setPayload",value:function(e){return Object.assign(this.payload,e),this}},{key:"setResponseHeaders",value:function(e){return this.headers=e,this}},{key:"setContext",value:function(e){return this.context+=e,this}},{key:"toString",value:function(){return this.message+(this.description||this.message?O.EOL:"")+this.description}},{key:"toJSON",value:function(){return{desc:this.context,message:this.message,code:this.code}}},{key:"toSnapshot",value:function(){var e="".concat(this.message," (").concat(this.code,") ");return this.underlyingError instanceof r?e+this.underlyingError.toSnapshot():this.underlyingError instanceof Error?e+this.underlyingError.message+(this.underlyingError.code?" ".concat(this.underlyingError.code):""):e+this.underlyingError}},{key:"silence",value:function(){return this.silent=!0,this}},{key:"isSilent",get:function(){return this.silent}}]),r}(E()(Error))},function(e,t){e.exports=require("@babel/runtime/helpers/getPrototypeOf")},function(e,t){e.exports=require("@babel/runtime/helpers/classCallCheck")},function(e,t){e.exports=require("@babel/runtime/helpers/createClass")},function(e,t){e.exports=require("@babel/runtime/helpers/assertThisInitialized")},function(e,t,r){"use strict";r.r(t);var n=r(43),a=r.n(n),s=r(2),o=r.n(s),i=r(7),c=r.n(i),u=r(8),l=r.n(u),d=r(9),f=r.n(d),p=r(14),h=r.n(p),v=r(15),_=r.n(v),y=r(6),E=r.n(y),m=r(4),g=r.n(m),O=r(0),S=r.n(O),T=r(1),A=r(21),I=r(3),C=r(12),R=r(27),x=r(20),k=r(5),b=r(24);function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=E()(e);if(t){var a=E()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _()(this,r)}}var w=r(54),D=r(37),L=1e4,P=T.default.getEnvironment(),M=315,U=function(e){h()(r,e);var t=N(r);function r(){var e;return c()(this,r),e=t.call(this),g()(f()(e),"log",void 0),g()(f()(e),"init",I.default.memoize(function(){return new Promise(function(t,r){var n=setTimeout(function(){e.log.error(new k.default("NGL initialization timed out")),t()},T.default.get("NGL_INITIALIZE_TIMEOUT")),a=w.InitializeProfileUpdates(e.nglConfig,function(){var r=o()(S.a.mark(function r(a,s){var o,i;return S.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(a&&(T.default.get("NGL_ERRORS_TO_INFO_LOG").includes(a)?e.log.disk("".concat(T.default.analytics.NGL_PROFILE_ERROR,": Ignoring ").concat(a," from NGL Library")):e.log.error(new k.default("Error from NGL Library "+a,T.default.analytics.NGL_PROFILE_ERROR,a))),o=e.getUserId(),e.setUserProfile(s),i=e.getUserId(),e.isInitialized){r.next=10;break}e.isInitialized=!0,clearTimeout(n),t(),r.next=21;break;case 10:if(!o||i){r.next=16;break}e.log.disk("Received Sign out event with error: ".concat(a)),e.log.context({authenticationDisabled:!1}).info(T.default.analytics.t_SIGNOUT),x.default.flush(!0,function(){e.log.disk("Flushed logs due to user sign out event"),e.reset(),e.emit("SIGN_OUT")}),r.next=21;break;case 16:if(i==o){r.next=21;break}return r.next=19,C.b.updateBackOff({clear:!0,type:C.a.AUTH});case 19:e.log.context({authenticationDisabled:!1}).info(T.default.analytics.t_SIGNIN),e.emit("SIGN_IN");case 21:case"end":return r.stop()}},r)}));return function(e,t){return r.apply(this,arguments)}}()).userProfile;e.setUserProfile(a)})},{timeout:-1})),g()(f()(e),"isInitialized",!1),g()(f()(e),"userProfile",void 0),g()(f()(e),"getDeviceID",I.default.memoize(function(){return Object.values(b.networkInterfaces()).map(function(e){return e[0].mac}).find(function(e){return"00:00:00:00:00:00"!=e})})),g()(f()(e),"getAccessTokenExpiry",I.default.memoize(function(t){try{var r=JSON.parse(Buffer.from(t.split(".")[1],"base64").toString("utf-8"));return new Date(parseInt(r.created_at)+parseInt(r.expires_in)-L)}catch(r){return t&&e.log.error(new k.default("Failed parsing access token",r)),-1}})),g()(f()(e),"getAccessToken",I.default.memoize(function(){return new Promise(function(){var t=o()(S.a.mark(function t(r,n){var a,s;return S.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.init();case 2:if(a=e.getUserId()){t.next=5;break}return t.abrupt("return",n(new k.default("Not Logged in").silence()));case 5:if(!C.b.isWaitingForBackOff(C.a.AUTH)){t.next=9;break}return s="Access Token awaiting global Auth back-off ".concat(C.b.backOffCause(C.a.AUTH)),e.log.disk(s),t.abrupt("return",n(new k.default(s,T.default.analytics.NGL_TOKEN_ERROR).silence()));case 9:e.log.disk("Started NGL.GetImsAccessToken."),w.GetImsAccessToken(e.nglConfig,function(){var t=o()(S.a.mark(function t(s,o){var i,c,u,l,d,f,p,h,v;return S.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.log.disk("Finished NGL.GetImsAccessToken."),e.getUserId()==a){t.next=3;break}return t.abrupt("return",n(new k.default("User changed").silence()));case 3:if(s!==M){t.next=9;break}return i=new k.default("Services not provisioned",T.default.analytics.NGL_TOKEN_ERROR,s.toString()),e.log.error(i),t.next=8,C.b.updateBackOff({cause:i.message,type:C.a.AUTH});case 8:return t.abrupt("return",n(i));case 9:if(!s||o){t.next=17;break}return c=s.toString(),u="Error from NGL fetching access token: ".concat(s.toString()),l=new k.default(u,T.default.analytics.NGL_TOKEN_ERROR,c),e.log.error(l),t.next=16,C.b.updateBackOff({cause:u,type:C.a.AUTH});case 16:return t.abrupt("return",n(l));case 17:d=0,s&&(d=s instanceof Error?s.code:parseInt(s.toString(),10)||void 0),f=s instanceof Error?s:s instanceof String?new Error(s.toString()):void 0,p={},t.prev=21,p=JSON.parse(o),t.next=32;break;case 25:return t.prev=25,t.t0=t.catch(21),h=new k.default("Cannot parse NGL access token response",f,d),e.log.error(h),t.next=31,C.b.updateBackOff({cause:h.message,type:C.a.AUTH});case 31:return t.abrupt("return",n(h));case 32:if(p.access_token){t.next=38;break}return v="No access token",e.log.error(new k.default(v,f,d)),t.next=37,C.b.updateBackOff({cause:v,type:C.a.AUTH});case 37:return t.abrupt("return",n(new k.default(v,f,d)));case 38:return s&&e.log.disk("Ignoring ".concat(s," from NGL Library while fetching access token")),e.log.context({authenticationDisabled:!1}).info(T.default.analytics.t_FETCH,"Successfully obtained access token"),t.next=42,C.b.updateBackOff({clear:!0,type:C.a.AUTH});case 42:return t.abrupt("return",r(p.access_token));case 43:case"end":return t.stop()}},t,null,[[21,25]])}));return function(e,r){return t.apply(this,arguments)}}());case 11:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())},{refresher:e.checkAccessTokenNeedsRefresh.bind(f()(e)),timeout:864e5})),e.log=new A.default({prefix:"IMS > ",payload:{"event.subcategory":T.default.analytics.sc_AUTH,"event.subtype":T.default.analytics.st_TOKEN},authenticationDisabled:!0}),e.on("SIGN_IN",function(){x.default.resetEventInterval()}),e.on("SIGN_OUT",function(){x.default.resetEventInterval()}),e}return l()(r,[{key:"nglConfig",get:function(){var e=D.version.split("."),t=a()(e,2),r=t[0],n=t[1];return{clientName:P.CLIENT_NAME,clientId:P.CLIENT_ID,clientSecret:P.CLIENT_SECRET,clientScope:T.default.get("SCOPES"),clientVersion:"".concat(r,".").concat(n),clientLocale:"en_US",isStage:"Staging"===P.LABEL,forceRefresh:!0}}},{key:"setUserProfile",value:function(e){try{var t,r=this.getUserId();if(this.userProfile=JSON.parse(e),r!==this.getUserId())this.log.disk("Default User: ".concat(null===(t=this.getUserInfo())||void 0===t?void 0:t.userId))}catch(t){this.log.error(new k.default("Unable to parse user profile from NGL "+JSON.stringify(e,function(e,t){if("enigmaData"!=e)return"UserProfile"==e?{accountType:t.accountType,countryCode:t.countryCode,userId:t.userId}:t},2)))}}},{key:"checkAccessTokenNeedsRefresh",value:function(e){var t=e.state,r=e.value;return"pending"!==t&&("resolved"!==t||!r||this.getAccessTokenExpiry(r)<new Date)}},{key:"getUserInfo",value:function(){var e;return null===(e=this.userProfile)||void 0===e?void 0:e.UserProfile}},{key:"getUserId",value:function(){var e;return null===(e=this.getUserInfo())||void 0===e?void 0:e.userId}},{key:"reset",value:function(){this.log.info(T.default.analytics.t_CLEAR),this.getAccessToken.cache&&this.getAccessToken.cache.clear()}}]),r}(R.EventEmitter);t.default=new U},function(e,t){e.exports=require("path")},function(e,t,r){"use strict";r.d(t,"a",function(){return a});var n,a,s=r(2),o=r.n(s),i=r(7),c=r.n(i),u=r(8),l=r.n(u),d=r(9),f=r.n(d),p=r(14),h=r.n(p),v=r(15),_=r.n(v),y=r(6),E=r.n(y),m=r(4),g=r.n(m),O=r(0),S=r.n(O),T=r(27),A=r(1);function I(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=E()(e);if(t){var a=E()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return _()(this,r)}}!function(e){e.SYNC="SYNC"}(n||(n={})),function(e){e.AUTH="BackoffAuthentication",e.NETWORK="BackOffNetwork"}(a||(a={}));var C=new(function(e){h()(r,e);var t=I(r);function r(){var e;c()(this,r);for(var a=arguments.length,s=new Array(a),o=0;o<a;o++)s[o]=arguments[o];return e=t.call.apply(t,[this].concat(s)),g()(f()(e),"SYNC",n.SYNC),g()(f()(e),"_syncRetryTimeout",null),e}return l()(r,[{key:"isWaitingForBackOff",value:function(e){var t=A.default.get("BACK_OFF_EXPIRY",e);return!!(t&&new Date(t)>new Date)}},{key:"backOffCause",value:function(e){return A.default.get("BACK_OFF_CAUSE",e)}},{key:"backOffWaitTime",value:function(e){return A.default.get("BACK_OFF",e)}},{key:"backOffExpiry",value:function(e){return A.default.get("BACK_OFF_EXPIRY",e)}},{key:"updateBackOff",value:function(){var e=o()(S.a.mark(function e(){var t,r,n,s,o,i,c,u,l,d,f=this,p=arguments;return S.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.length>0&&void 0!==p[0]?p[0]:{clear:!1,sync:!0,cause:"Unknown",type:a.NETWORK},r=t.clear,n=void 0!==r&&r,s=t.cause,o=void 0===s?"Unknown":s,i=t.type,c=t.sync,u=void 0===c||c,l=this.backOffWaitTime(i),!n){e.next=7;break}return l&&(A.default.set("BACK_OFF_EXPIRY",void 0,i),A.default.set("BACK_OFF",void 0,i),A.default.set("BACK_OFF_CAUSE",void 0,i)),u&&l&&(clearTimeout(this._syncRetryTimeout),this.emit(this.SYNC)),e.abrupt("return");case 7:return this.isWaitingForBackOff(i)||(l?l*=2:l=A.default.get("SYNC_INITIAL_RETRY"),l=Math.min(l,A.default.get("MAX_BACK_OFF")),A.default.set("BACK_OFF",l,i),(d=new Date).setMilliseconds(d.getMilliseconds()+l),A.default.set("BACK_OFF_EXPIRY",d.toISOString(),i),A.default.set("BACK_OFF_CAUSE","".concat(o," for ").concat(l/1e3,"s expiring ").concat(d.toISOString()),i),clearTimeout(this._syncRetryTimeout),this._syncRetryTimeout=setTimeout(function(){f.emit(f.SYNC)},this.backOffWaitTime(i))),e.abrupt("return");case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(T.EventEmitter));t.b=C},function(e,t,r){"use strict";r.d(t,"b",function(){return n}),r.d(t,"c",function(){return a}),r.d(t,"a",function(){return v}),r.d(t,"d",function(){return y});var n,a,s=r(2),o=r.n(s),i=r(7),c=r.n(i),u=r(8),l=r.n(u),d=r(4),f=r.n(d),p=r(0),h=r.n(p);!function(e){e[e.Unknown=0]="Unknown",e[e.Deprecated=1]="Deprecated",e[e.XdPrimary=2]="XdPrimary",e[e.SenseiModels=3]="SenseiModels",e[e.Stock=4]="Stock",e[e.CollectionTemplates=5]="CollectionTemplates",e[e.DiscoverPanel=6]="DiscoverPanel",e[e.FirstMileOld=7]="FirstMileOld",e[e.Lcm=8]="Lcm",e[e.Avatar=9]="Avatar",e[e.Learn=10]="Learn",e[e.CcdQuarternary=11]="CcdQuarternary",e[e.CcdTertiary=12]="CcdTertiary",e[e.CcdSecondary=13]="CcdSecondary",e[e.CcdPrimary=14]="CcdPrimary",e[e.FirstMileLatest=15]="FirstMileLatest"}(n||(n={})),function(e){e[e.Regular=0]="Regular",e[e.BackgroundRequest=1]="BackgroundRequest",e[e.Installation=2]="Installation",e[e.UrgentRequest=3]="UrgentRequest"}(a||(a={}));var v=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=t.key,s=void 0===r?"":r,o=t.value,i=void 0===o?0:o,u=t.channel,l=void 0===u?n.Unknown:u,d=t.level,p=void 0===d?a.Regular:d;c()(this,e),f()(this,"key",void 0),f()(this,"value",void 0),f()(this,"channel",void 0),f()(this,"level",void 0),this.key=s,this.value=i,this.channel=l,this.level=p}return l()(e,[{key:"toString",value:function(){return"".concat(1e3*this.queue+this.value)}},{key:"queue",get:function(){return this.channel+100*this.level}}]),e}(),_=n.Unknown+100*a.Regular,y=function(){function e(){var t=this,r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:1,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:108e5;c()(this,e),this.maxLocks=r,this.defaultTimeout=n,f()(this,"hasWriteLock",!1),f()(this,"readsInProgress",[]),f()(this,"pendingReads",[]),f()(this,"pendingWrites",[]),f()(this,"priorityOverrides",{}),f()(this,"prioritize",function(r){var n=r.key;n&&(t.priorityOverrides[n]=r,e.noTimeout()||setTimeout(function(){n&&delete t.priorityOverrides[n]},1e4),t.pendingReads.forEach(function(e){e.priority.key===n&&t.applyOverride(r,e.priority)}),t.check())})}return l()(e,[{key:"call",value:function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=setTimeout(function(){t.reject(new Error("Lock Timed out"))},t.timeout),e.next=3,t.callback().then(function(e){t.resolve(e),clearTimeout(r)}).catch(function(e){t.reject(e),clearTimeout(r)});case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"checkReads",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=[],!this.hasWriteLock&&this.pendingReads.length>0)for(n=function(){var e=r,n=a.call(e).then(function(){a.readsInProgress.splice(a.readsInProgress.indexOf(e),1),a.check()});t.push(n)};r=this.nextReadLock();)n();return e.next=4,Promise.all(t);case 4:return e.abrupt("return",t.length);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"nextReadLock",value:function(){if(0!==this.pendingReads.length){var e=this.readsInProgress.length>0&&this.readsInProgress.reduce(function(e,t){return e.priority.queue>t.priority.queue?e:t}),t=e?e.priority.queue:_,r=this.pendingReads.reduce(function(e,t){return e.priority.queue>t.priority.queue?e:t}).priority.queue;if(!(r<t)){if(r===t)if(this.readsInProgress.filter(function(e){return e.priority.queue===t}).length>=this.maxLocks)return;var n=this.pendingReads.filter(function(e){return e.priority.queue===r});if(0!==n.length){var a=n.reduce(function(e,t){return t.priority.value>e.priority.value?t:e});return this.pendingReads.splice(this.pendingReads.indexOf(a),1),this.readsInProgress.push(a),a}}}}},{key:"check",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.checkReads();case 2:if(e.t0=e.sent,0===e.t0){e.next=7;break}e.next=0;break;case 7:if(0!==this.readsInProgress.length||this.hasWriteLock){e.next=15;break}if(!(t=this.pendingWrites.shift())){e.next=15;break}return this.hasWriteLock=!0,e.next=13,this.call(t);case 13:this.hasWriteLock=!1,this.check();case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"read",value:function(){var e=o()(h.a.mark(function e(t){var r,s,o=this,i=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=i.length>1&&void 0!==i[1]?i[1]:new v({}),s=i.length>2&&void 0!==i[2]?i[2]:this.defaultTimeout,r.channel=r.channel||n.Unknown,r.level=r.level||a.Regular,r.value=r.value||0,r.key&&this.priorityOverrides[r.key]&&this.applyOverride(this.priorityOverrides[r.key],r),e.abrupt("return",new Promise(function(e,n){o.pendingReads.push({callback:t,resolve:e,reject:n,priority:r,timeout:s}),o.check()}));case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"write",value:function(){var e=o()(h.a.mark(function e(t){var r,n=this,a=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a.length>1&&void 0!==a[1]?a[1]:this.defaultTimeout,e.abrupt("return",new Promise(function(e,a){n.pendingWrites.push({callback:t,resolve:e,reject:a,timeout:r}),n.check()}));case 2:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"applyOverride",value:function(e,t){t.level=Math.max(t.level,e.level)}}],[{key:"noTimeout",value:function(){return!1}}]),e}()},function(e,t){e.exports=require("@babel/runtime/helpers/inherits")},function(e,t){e.exports=require("@babel/runtime/helpers/possibleConstructorReturn")},function(e,t){e.exports=require("fs-extra")},function(e,t,r){"use strict";r.r(t);var n=r(2),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(9),l=r.n(u),d=r(14),f=r.n(d),p=r(15),h=r.n(p),v=r(6),_=r.n(v),y=r(4),E=r.n(y),m=r(0),g=r.n(m),O=r(1),S=r(27),T=r(21),A=r(3),I=r(20),C=r(5),R=r(28);function x(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var a=_()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return h()(this,r)}}function k(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function b(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?k(Object(r),!0).forEach(function(t){E()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):k(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var N=r(57),w=function(e){return Object.keys(e).reduce(function(t,r){return b(b({},t),{},E()({},r,e[r][0]))},{})},D=new(function(e){f()(n,e);var t=x(n);function n(){var e;o()(this,n),e=t.call(this),E()(l()(e),"log",new T.default({prefix:"VulcanWrapper > "})),E()(l()(e),"vulcan",void 0),E()(l()(e),"installedApps",{}),E()(l()(e),"aidFetched",!1),E()(l()(e),"getInstalledApps",A.default.memoize(a()(g.a.mark(function t(){var r,n,s,o,i;return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(t.prev=0,!e.aidFetched){t.next=3;break}return t.abrupt("return",e.installedApps);case 3:return t.next=5,new Promise(function(){var e=a()(g.a.mark(function e(t,r){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",N.getAllInstalledApps(!1,function(e,n){e?r(new C.default(O.default.analytics.AID_GET_INSTALLED_APPS_ERROR,e)):t(n)}));case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}());case 5:return r=t.sent,t.next=8,A.default.parseXml(r);case 8:if(n=t.sent,!(s=A.default.validateDataFields(n,O.default.get("NODE_AID_RESPONSE_SCHEMA")))){t.next=13;break}throw new C.default(I.default.DATA_VALIDATION_ERR,"Invalid data: ".concat(JSON.stringify(null===(o=s[0])||void 0===o?void 0:o.message)));case 13:return i=n.ProductsInfo.ProductInfo,e.installedApps=i.reduce(function(e,t){var r=w(t);return r.SAPCode=A.default.getProductAlias(r.SAPCode),b(b({},e),{},E()({},r.SAPCode,b(b({},e[r.SAPCode]),{},E()({},r.CodexVersion,r))))},{}),e.aidFetched=!0,t.abrupt("return",e.installedApps);case 19:return t.prev=19,t.t0=t.catch(0),e.log.error(t.t0),t.abrupt("return",{});case 23:case"end":return t.stop()}},t,null,[[0,19]])})))),E()(l()(e),"getAppLanguage",function(){var t=a()(g.a.mark(function t(r,n){var a,s,o;return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,R.a.getOSLocale();case 2:return a=t.sent,t.next=5,e.getKeyForApp("InstallLanguage",r,n);case 5:if((s=t.sent)&&"mul"!==s){t.next=8;break}return t.abrupt("return",void 0);case 8:if(!s.includes(",")){t.next=11;break}return o=s.split(","),t.abrupt("return",o.includes(a)?a:o.includes("en_US")?"en_US":void 0);case 11:return t.abrupt("return",s);case 12:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()),e.log.disk("Loading Vulcan Library...");var s=r(38);return e.log.disk("Vulcan Library Successfully Loaded."),e.vulcan=s.createMessageAdapter("CCXP","1.0.0"),e.vulcan.addMessageListener(function(t,r,n,a){t=t.replace(O.default.get("VULCAN_PREFIX"),""),0!==e.listenerCount(t)&&(e.shouldLogMessage(t)&&e.log.disk("<- ".concat(n," ").concat(a,": ").concat(t," \n ").concat(e.shouldLogContent(t)?r:"").trim()),e.emit(t,r,n,a))}),e}return c()(n,[{key:"clearInstalledAppsCache",value:function(){this.aidFetched=!1,this.getInstalledApps.cache.clear()}},{key:"shouldLogMessage",value:function(e){var t=O.default.get("SKIP_LOGGING_MESSAGE_LIST");return!t||!t.includes(e)||O.default.get("CONSOLE_LOGGING")}},{key:"shouldLogContent",value:function(e){var t=O.default.get("SKIP_LOGGING_MESSAGE_CONTENT");return!t||!t.includes(e)}},{key:"sendMessage",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"",n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",a=r?"".concat(r," ").concat(n||"*"):"BROADCAST";"string"!=typeof t&&(t=JSON.stringify(t)),this.shouldLogMessage(e)&&this.log.disk("-> ".concat(a,": ").concat(e," \n ").concat(this.shouldLogContent(e)?t:"").trim()),this.vulcan.sendMessage(e,t,r,n)}},{key:"getKeyForApp",value:function(){var e=a()(g.a.mark(function e(t,r,n){var a,s;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getInstalledApps();case 2:if(e.t2=r,e.t3=a=e.sent[e.t2],e.t1=null===e.t3,e.t1){e.next=7;break}e.t1=void 0===a;case 7:if(!e.t1){e.next=11;break}e.t4=void 0,e.next=12;break;case 11:e.t4=a[n];case 12:if(e.t0=e.t4,e.t0){e.next=15;break}e.t0={};case 15:return s=e.t0,e.abrupt("return",s[t]);case 17:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"getSpecifiers",value:function(){var e=a()(g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getInstalledApps();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),n}(S));D.setMaxListeners(20),t.default=D},function(e,t,r){"use strict";r.d(t,"a",function(){return D});var n=r(2),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(9),l=r.n(u),d=r(14),f=r.n(d),p=r(15),h=r.n(p),v=r(6),_=r.n(v),y=r(4),E=r.n(y),m=r(0),g=r.n(m),O=r(27),S=r(36),T=r(1),A=r(21),I=r(3),C=r(26),R=r(12),x=r(5),k=r(30),b=r(19);function N(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var a=_()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return h()(this,r)}}var w,D,L=k.ReachabilityChanged;!function(e){e.ONLINE="ONLINE",e.OFFLINE="OFFLINE",e.UNKNOWN="UNKNOWN"}(w||(w={})),function(e){e.OS_NETWORK_NOTIFICATION="OS_NETWORK_NOTIFICATION ",e.CLIENT_REQUEST="CLIENT_REQUEST",e.ONDEMAND_REQUEST="ONDEMAND_REQUEST",e.NETWORK_SLOW_POLL="NETWORK_SLOW_POLL",e.CCXPROCESS_INITIALIZED="CCXPROCESS_INITIALIZED",e.LOOKUP_MAP_SYNC="LOOKUP_MAP_SYNC",e.DOWNLOAD_FETCH_ERROR="DOWNLOAD_FETCH_ERROR",e.UNKNOWN="UNKNOWN"}(D||(D={}));var P=new(function(e){f()(r,e);var t=N(r);function r(){var e;return o()(this,r),e=t.call(this),E()(l()(e),"networkCheckTimeout",void 0),E()(l()(e),"resolver",void 0),E()(l()(e),"currentCheckId","unknown"),E()(l()(e),"UNKNOWN",w.UNKNOWN),E()(l()(e),"ONLINE",w.ONLINE),E()(l()(e),"OFFLINE",w.OFFLINE),E()(l()(e),"status",w.UNKNOWN),E()(l()(e),"dnsFailed",!1),E()(l()(e),"log",void 0),E()(l()(e),"check",void 0),E()(l()(e),"isOnline",void 0),e.log=new A.default({prefix:"NetworkStatus >",payload:{"event.subcategory":T.default.analytics.sc_Network,"event.subtype":T.default.analytics.st_STATUS}}),e.resolver=new S.Resolver,e.isOnline=function(){return k.isOnline},e.check=I.default.memoize(e.checkInternal.bind(l()(e)),{refresher:function(e){return"pending"!==e.state},destructor:function(e,t){return"pending"!==t.state}}),e.on(e.OFFLINE,I.default.throttle(function(){var t=a()(g.a.mark(function t(r,n){return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r===e.OFFLINE){t.next=6;break}return I.default.isDebugModeEnabled()&&e.log.disk("[".concat(n,"] Change in Network Status from ").concat(r," to ").concat(e.OFFLINE,". Entering Network Backoff")),t.next=4,R.b.updateBackOff({type:R.a.NETWORK,cause:"Offline[Network Check]"});case 4:t.next=7;break;case 6:I.default.isDebugModeEnabled()&&e.log.disk("[".concat(n,"] Detected OFFLINE Network Status (unchanged from before)"));case 7:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}(),T.default.get("OFFLINE_SYNC_THROTTLE"))),e.on(e.ONLINE,I.default.throttle(function(){var t=a()(g.a.mark(function t(r,n){return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(r===e.ONLINE){t.next=9;break}return I.default.isDebugModeEnabled()&&e.log.disk("[".concat(n,"] Change in Network Status from ").concat(r," to ").concat(e.ONLINE,".  Clearing Network Backoff")),t.next=4,R.b.updateBackOff({clear:!0,type:R.a.NETWORK,sync:!1});case 4:return t.next=6,R.b.updateBackOff({clear:!0,type:R.a.AUTH,sync:!0});case 6:e.clearScheduledNetworkCheck(),t.next=10;break;case 9:I.default.isDebugModeEnabled()&&e.log.disk("[".concat(n,"] Detected ONLINE Network Status (unchanged from before)"));case 10:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}(),T.default.get("ONLINE_SYNC_THROTTLE"))),k.on(L,a()(g.a.mark(function t(){return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(e.status===e.ONLINE){t.next=5;break}return t.next=3,e.runCheck();case 3:t.next=6;break;case 5:I.default.isDebugModeEnabled()&&e.log.disk("Reachability Notification Received - Skipping network check since networks status is online.");case 6:case"end":return t.stop()}},t)}))),e}return c()(r,[{key:"getDnsServers",value:function(){var e=a()(g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.getServers();case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"runCheck",value:function(){var e=a()(g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.check(D.OS_NETWORK_NOTIFICATION);case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"checkInternal",value:function(){var e=a()(g.a.mark(function e(t){var r,n,a;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=b.v4(),this.currentCheckId=r,n=this.status,!T.default.get("TEMP_NETWORK_STATUS_DISABLED")){e.next=7;break}return e.next=6,this.emitAndSetStatus(this.ONLINE,n,r);case 6:return e.abrupt("return");case 7:return e.next=9,this.isOnline();case 9:if(!e.sent){e.next=13;break}e.t0=this.ONLINE,e.next=14;break;case 13:e.t0=this.OFFLINE;case 14:if((a=e.t0)!==this.OFFLINE){e.next=22;break}return I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] isOnline() Check returned FALSE from ").concat(t)),e.next=19,this.dnsCheck(r,t);case 19:this.dnsFailed?I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] DNS.resolve()  Check FAILED - from ").concat(t)):(a=this.ONLINE,I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] DNS.resolve()  Check  SUCCESSFUL - from ").concat(t))),e.next=24;break;case 22:I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] isOnline() Check returned TRUE from ").concat(t));case 24:if(n===a){e.next=30;break}return t===D.NETWORK_SLOW_POLL&&this.log.warning("Network Slow Poll resulted in changed Network Status").appendPayload({"event.value":"".concat(n,":").concat(this.status),"event.context_guid":r}),e.next=28,this.emitAndSetStatus(a,n,r);case 28:e.next=31;break;case 30:I.default.isDebugModeEnabled()&&this.log.disk("[".concat(r,"] No Change in Network Status [").concat(this.status,"] Check due to ").concat(t));case 31:this.scheduleNextNetworkCheck(r);case 32:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"dnsCheck",value:function(){var e=a()(g.a.mark(function e(t){var r,n,s=this,o=arguments;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=o.length>1&&void 0!==o[1]?o[1]:D.UNKNOWN,n=new C.URL(T.default.get("DNS_RESOLVE_STATUS_CHECK_URL","DEFAULT")).host,I.default.isDebugModeEnabled()&&this.log.disk("[".concat(t,"] triggered DNS check (").concat(n,") due to  ").concat(r)),e.abrupt("return",new Promise(function(){var e=a()(g.a.mark(function e(r){var o,i;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:o=Date.now(),i=setTimeout(function(){s.resolver.cancel(),I.default.isDebugModeEnabled()&&s.log.disk("[".concat(t,"] DNS Timeout occured. Cancelling DNS Check")),s.dnsFailed=!0},T.default.get("DNS_RESOLVE_TIMEOUT")),s.resolver.resolve(n,function(){var e=a()(g.a.mark(function e(a){var c;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(c=Date.now()-o,!a){e.next=16;break}return s.dnsFailed=!0,e.t0=s.log,e.t1=new x.default("DNS FAILED TO RESOLVE",a,a.code),e.t2=n,e.t3=c,e.t4=t,e.next=10,s.getDnsServers();case 10:e.t5=e.sent,e.t6={"event.url":e.t2,"event.value":e.t3,"event.context_guid":e.t4,"ccxp.dns_ip":e.t5},e.t7=e.t1.setPayload.call(e.t1,e.t6).silence(),e.t0.error.call(e.t0,e.t7),e.next=17;break;case 16:s.dnsFailed=!1;case 17:clearTimeout(i),r();case 19:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"scheduleNextNetworkCheck",value:function(){var e=a()(g.a.mark(function e(){var t,r,n=arguments;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=n.length>0&&void 0!==n[0]?n[0]:"unknown",this.status!==this.ONLINE&&this.currentCheckId===t?((r=new Date).setMilliseconds(T.default.get("NETWORK_POLL_INTERVAL")),this.clearScheduledNetworkCheck(),this.log.disk("[".concat(t,"] Scheduling Next Network Check in: ").concat(I.default.getHumanReadableTime(r.valueOf()-(new Date).valueOf()))),this.networkCheckTimeout=setTimeout(this.check.bind(this,D.NETWORK_SLOW_POLL),T.default.get("NETWORK_POLL_INTERVAL"))):I.default.isDebugModeEnabled()&&this.log.disk("[".concat(t,"] Network Status is ").concat(this.status,".  Not Scheduling Slow Poll. Network ID Matches ? ").concat(this.currentCheckId===t));case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"emitAndSetStatus",value:function(){var e=a()(g.a.mark(function e(t,r,n){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.currentCheckId===n&&(this.status=t,this.emit(t,r,n));case 1:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()},{key:"clearScheduledNetworkCheck",value:function(){var e=a()(g.a.mark(function e(){return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:this.networkCheckTimeout&&(I.default.isDebugModeEnabled()&&this.log.disk("Clearing the slow poll"),clearTimeout(this.networkCheckTimeout),delete this.networkCheckTimeout);case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(O.EventEmitter));P.setMaxListeners(30),t.b=P},function(e,t){e.exports=require("uuid")},function(e,t,r){"use strict";r.r(t);var n=r(2),a=r.n(n),s=r(8),o=r.n(s),i=r(7),c=r.n(i),u=r(4),l=r.n(u),d=r(0),f=r.n(d),p=r(19),h=r(24),v=r(1),_=r(18),y=r(31),E=r(3),m=r(10),g=r(28),O=r(5),S=r(21);function T(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return A(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return A(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(i)throw s}}}}function A(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}global.fetch=r(58);var I=!1,C=r(59),R={ENVIRONMENT:"Staging"===v.default.getEnvironment().LABEL?"stage":"prod",ANALYTICS_API_KEY:v.default.get("ANALYTICS_API_KEY"),ANALYTICS_X_PRODUCT:v.default.get("ANALYTICS_X_PRODUCT"),ANALYTICS_PROJECT:v.default.get("ANALYTICS_PROJECT"),ANALYTICS_INGEST_TYPE:v.default.get("ANALYTICS_INGEST_TYPE"),ANALYTICS_MAX_QUEUED_EVENTS:v.default.get("ANALYTICS_MAX_QUEUED_EVENTS"),ANALYTICS_DEBOUNCE:v.default.get("ANALYTICS_DEBOUNCE"),ALLOW_NO_TOKEN:v.default.get("ALLOW_NO_TOKEN")},x=function e(){var t=this;c()(this,e),l()(this,"getAccessToken",function(e){if(I)return e();m.default.getAccessToken().then(function(t){e(null,t)}).catch(function(r){t.log("Error getting access token - ".concat(r)),e()})}),l()(this,"log",function(e){N.disk(e)}),l()(this,"getAgent",function(e,t){var r=y.a.stripPathFromURL(e);g.a.getNodeTunnelOptionsForURL(r).then(function(e){delete e.agent,t(null,e)},function(e){t(e)})})},k=new C(new x,R),b=new C(new x,R),N=new S.default({prefix:"Ingest >"}),w=function(){function e(){var t=this;c()(this,e),l()(this,"NO_PARAMS",null),l()(this,"session_guid",p.v4()),l()(this,"event_session_tracker",p.v4()),l()(this,"_status",!1),l()(this,"_eventCount",0),l()(this,"_eventInterval",void 0),l()(this,"setEventInterval",function(){E.default.isDebugModeEnabled()&&(t._eventInterval&&t.clearEventInterval(),t._eventInterval=setInterval(function(){t.sendEventValidation(),t.resetEventCount(),t.resetEventSessionGuid()},v.default.get("ANALYTICS_EVENT_VALIDATION_INTERVAL")))}),l()(this,"clearEventInterval",function(){clearInterval(t._eventInterval),t._eventInterval=void 0}),l()(this,"resetEventCount",function(){t._eventCount=-1}),l()(this,"incrementEventCount",function(){t._eventCount++}),l()(this,"checkIMS",function(e,t){return t["user.service_code"]="creative_cloud",t}),l()(this,"sendEventValidation",function(){E.default.isDebugModeEnabled()&&N.context({payload:{"event.subcategory":"Metrics","event.subtype":"Ingest","event.value":t._eventCount,"ccxp.event_session_tracker":t.event_session_tracker}}).info("validation")}),l()(this,"resetEventInterval",function(){t.clearEventInterval(),m.default.getUserId()&&(t.sendEventValidation(),t.resetEventCount(),t.resetEventSessionGuid(),t.setEventInterval())}),l()(this,"getIpAddress",E.default.memoize(function(){var e=h.networkInterfaces(),t=Object.keys(e).map(function(t){return e[t].filter(function(e){return"IPv4"===e.family&&!e.internal})[0]}).filter(function(e){return e});return t.length>0?t[0].address:""})),l()(this,"resetEventSessionGuid",function(){t.event_session_tracker=p.v4()}),l()(this,"cleanPSDKParameters",function(e,t){return t&&(e["event.language"]=t.productLanguage,e["source.name"]=t.productCode,e["source.version"]=t.productVersion,e["source.device"]="Desktop",e["consumer.name"]="CCX Start",e["consumer.platform"]=E.default.getOsPlatform(),e["consumer.os_version"]=E.default.getOsVersion(),e["consumer.version"]=t.ccxVersion),e}),l()(this,"createPayload",function(){var e=a()(f.a.mark(function e(r,n,a){var s,o=arguments;return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(o.length>3&&void 0!==o[3]&&o[3]||(s=m.default.getUserId(),r["event.user_guid"]=s,r=t.checkIMS(s||"",r)),r["event.guid"]=p.v4(),r["event.session_guid"]=t.session_guid,r["event.coll_dts"]=(new Date).toISOString(),r["event.dts_start"]=r["event.dts_start"]||(new Date).toISOString(),r["event.dts_end"]=r["event.dts_end"]||(new Date).toISOString(),r["event.workflow"]=r["event.workflow"]||v.default.analytics.w_CCX_PROCESS,r["event.category"]=v.default.analytics.c_DESKTOP,r["event.offline"]=_.b.status===_.b.OFFLINE,r["event.ip"]=t.getIpAddress(),e.t0=r["event.language"],e.t0){e.next=16;break}return e.next=15,g.a.getOSLocale();case 15:e.t0=e.sent;case 16:return r["event.language"]=e.t0,r["event.device_guid"]=m.default.getDeviceID(),r["env.com.name"]=v.default.analytics.w_CCX_PROCESS,r["env.com.version"]=E.default.getProcessVersion(),r["source.client_id"]=v.default.getEnvironment().CLIENT_ID,r["source.platform"]=E.default.getOsPlatform(),r["source.os_version"]=E.default.getOsVersion(),r["ccxp.event_session_tracker"]=r["ccxp.event_session_tracker"]||t.event_session_tracker,n&&(r=t.cleanPSDKParameters(r,n)),a&&t.addSurfaceAnalytics(r,a),e.abrupt("return",r);case 27:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),l()(this,"reset",function(e){return t.clearEventInterval(),e&&(k=new C(new x,e)),k}),l()(this,"resetOperational",function(e){return t.clearEventInterval(),e&&(b=new C(new x,e)),b}),l()(this,"logProcessEvent",function(){var e=a()(f.a.mark(function e(r,n,a,s,o,i){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.createPayload(r,n,a,o);case 2:r=e.sent,s&&(s instanceof O.default||(s=new O.default(s)),r["event.error_desc"]=t.limitMessageSize(E.default.scrubStack(s.description)),r["event.error_type"]=t.limitMessageSize(E.default.scrubStack(s.message)),r["event.error_code"]=s.code),o?(I=!0,t.postEvent(r,i),t.flush(!0,function(){I=!1})):t.postEvent(r,i);case 5:case"end":return e.stop()}},e)}));return function(t,r,n,a,s,o){return e.apply(this,arguments)}}()),l()(this,"logPollingEvent",function(){var e=a()(f.a.mark(function e(r,n,a){return f.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.createPayload(r);case 2:r=e.sent,n?(I=!0,t.operationalPostEvent(r,a),t.operationalFlush(!0,function(){I=!1})):t.operationalPostEvent(r,a);case 4:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),l()(this,"operationalPostEvent",function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};t.incrementEventCount(),b.postEvent(e,r)}),l()(this,"operationalFlush",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};b.flush(e,t)}),l()(this,"flush",function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};k.flush(e,t)}),l()(this,"postEvent",function(e){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(){};t.incrementEventCount(),k.postEvent(e,r)}),l()(this,"enable",function(e){t._status=e,k.enable(e),b.enable(!0)}),l()(this,"limitMessageSize",function(e){return e.substring(0,1024)}),_.b.on(_.b.ONLINE,function(){t.getIpAddress.cache.clear()}),this.setEventInterval()}return o()(e,[{key:"addSurfaceAnalytics",value:function(e,t){var r=function(t,r){r&&(e[t]=e[t]||"",e[t].toString().includes(r)||(e[t]+=(e[t].toString().length>0?", ":"")+r))};if(t){var n,a=T(t);try{for(a.s();!(n=a.n()).done;){var s=n.value;s.surface&&r("exp.surface_id",s.surface),s.campaignId&&r("exp.campaign_id",""+s.campaignId),s.variationId&&r("exp.variation_id",s.variationId),s.treatmentId&&r("exp.treatment_id",s.treatmentId),s.controlGroupId&&r("exp.control_group_id",s.controlGroupId),s.actionBlockId&&r("exp.action_block_id",s.actionBlockId)}}catch(e){a.e(e)}finally{a.f()}}return e}}]),e}();t.default=Object.assign(new w,v.default.analytics)},function(e,t,r){"use strict";r.r(t);var n=r(2),a=r.n(n),s=r(35),o=r.n(s),i=r(25),c=r.n(i),u=r(7),l=r.n(u),d=r(8),f=r.n(d),p=r(4),h=r.n(p),v=r(0),_=r.n(v),y=r(29),E=r(19),m=r(1),g=r(9),O=r.n(g),S=r(14),T=r.n(S),A=r(15),I=r.n(A),C=r(6),R=r.n(C),x=r(16);function k(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=R()(e);if(t){var a=R()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return I()(this,r)}}var b,N=new(function(e){T()(r,e);var t=k(r);function r(){var e;l()(this,r);for(var n=arguments.length,a=new Array(n),s=0;s<n;s++)a[s]=arguments[s];return e=t.call.apply(t,[this].concat(a)),h()(O()(e),"logFilePath","".concat(m.default.get("LOG_DIR"),"CCX Process.log")),h()(O()(e),"prevLogFilePath","".concat(m.default.get("LOG_DIR"),"CCX Process (prev).log")),h()(O()(e),"pendingLogWrite",void 0),h()(O()(e),"writingToLog",!1),e}return f()(r,[{key:"swapLogIfNeeded",value:function(e){var t=this;x.stat(this.logFilePath,function(r,n){!r&&n.size>m.default.get("MAX_LOG_SIZE")?x.rename(t.logFilePath,t.prevLogFilePath,e):e(null)})}},{key:"doLogWrite",value:function(){var e=this;x.ensureDir(m.default.get("LOG_DIR"),function(t){if(t)return e.pendingLogWrite=void 0,void console.log(t);e.swapLogIfNeeded(function(t){if(t)return e.pendingLogWrite=void 0,void console.log(t);var r=e.pendingLogWrite;e.pendingLogWrite=void 0,e.writingToLog=!0,x.appendFile(e.logFilePath,r,function(t){t&&console.log(t),e.writingToLog=!1,e.pendingLogWrite&&e.doLogWrite(),e.emit("logWrite")})})})}},{key:"log",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];var n=t.join(": ");m.default.get("CONSOLE_LOGGING")&&n.match(new RegExp(process.argv[3]||".*"))&&console.log(n);var a=new Date,s=m.default.get("JSON_LOGGING")?n:"".concat(a.toString().replace(/(\d+\:\d+\:\d+)/,"$1."+a.getMilliseconds())," ").concat(n,"\n");this.pendingLogWrite?this.pendingLogWrite+=s:(this.pendingLogWrite=s,this.writingToLog||this.doLogWrite())}}]),r}(r(27).EventEmitter)),w=r(5),D=r(24);function L(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function P(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?L(Object(r),!0).forEach(function(t){h()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):L(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}r.d(t,"LogBuilder",function(){return M}),r.d(t,"default",function(){return U});var M=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},r=arguments.length>1?arguments[1]:void 0;l()(this,e),h()(this,"options",void 0),h()(this,"level",void 0),h()(this,"args",void 0),h()(this,"logArgs",[]),h()(this,"error",void 0),h()(this,"params",void 0),h()(this,"payload",void 0),h()(this,"surfaceAnalytics",void 0),this.options=t,this.level=r;for(var n=arguments.length,a=new Array(n>2?n-2:0),s=2;s<n;s++)a[s-2]=arguments[s];this.args=a,this.logArgs=[],this.payload=Object.assign({},this.options.payload),this.options.params&&this.setParams(this.options.params),this.options.surfaceAnalytics&&this.addSurfaceAnalytics(this.options.surfaceAnalytics)}return f()(e,[{key:"stringifyWithCycles",value:function(e){return"string"==typeof e?e:(e instanceof Error&&e.stack&&(e.stack=e.stack.replace(/[A-Z]?:?(\\|\/).*\1/g," ")),y.inspect(e))}},{key:"convertArgsToString",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return t.map(this.stringifyWithCycles).join(" ")}},{key:"post",value:function(){var e,t=this;if(this.error&&this.error instanceof w.default&&this.error.isSilent)return this;this.options.skipDiskLog||(m.default.get("JSON_LOGGING")?N.log(JSON.stringify(P(P(P({level:this.level.toUpperCase(),prefix:null===(e=this.options.prefix)||void 0===e?void 0:e.trim(),message:this.convertArgsToString.apply(this,c()(this.args).concat(c()(this.logArgs))).trim(),timestamp:(new Date).toISOString()},this.params),this.surfaceAnalytics),this.options.diskParams))+D.EOL):N.log(this.options.prefix+"[".concat(this.level.toUpperCase(),"] ")+this.convertArgsToString.apply(this,c()(this.args).concat(c()(this.logArgs)))));return(this.options.forceSilentError||!1!==this.options.analytics)&&(this.error instanceof w.default&&this.error.hasSubErrors&&!this.options.combineSubErrors?this.error.subErrors.forEach(function(e){e.err&&b.logProcessEvent(P(P(P({},t.payload),e.err.ingestPayload||{}),e.url&&{"event.url":e.url}),t.params,[e],e.err,t.options.authenticationDisabled)}):b.logProcessEvent(this.payload,this.params,this.surfaceAnalytics,this.error,this.options.authenticationDisabled)),this}},{key:"addSurfaceAnalytics",value:function(e){var t;this.surfaceAnalytics=this.surfaceAnalytics||[],(t=this.surfaceAnalytics).push.apply(t,c()(e))}},{key:"addDiskLog",value:function(){var e;return this.args=(e=this.args).concat.apply(e,arguments),this}},{key:"appendPayload",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return Object.assign(this.payload,e),this}},{key:"setError",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:new w.default("No error object passed");return e instanceof Error||(e=new w.default(""+e)),this.appendPayload({"event.type":m.default.analytics.ERROR}),e instanceof w.default&&this.appendPayload(e.ingestPayload),this.args.push(e),this.error=e,this}},{key:"setParams",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return e.productCode&&this.logArgs.push(" for product ".concat(e.productCode,"[").concat(e.productVersion,"]")+(e.productLanguage?"[".concat(e.productLanguage,"]"):"")),this.params=e,this}}]),e}(),U=function(){function e(t){l()(this,e),h()(this,"options",{}),this.options=t}return f()(e,[{key:"context",value:function(t){return new e(P(P(P({},this.options),t),{},{diskParams:P(P({},this.options.diskParams),t.diskParams),combineSubErrors:this.options.combineSubErrors||t.combineSubErrors,payload:P(P({},this.options.payload),t.payload),surfaceAnalytics:[].concat(c()(this.options.surfaceAnalytics||[]),c()(t.surfaceAnalytics||[]))}))}},{key:"disk",value:function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];return o()(M,[P({analytics:!1},this.options),"DISK"].concat(t)).post()}},{key:"error",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o()(M,[this.options,"error"].concat(r)).setError(e).post()}},{key:"info",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o()(M,[this.options,"info",e].concat(r)).appendPayload({"event.type":m.default.analytics.t_INFO,"ccxp.message":e}).post()}},{key:"warning",value:function(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];return o()(M,[this.options,"warning",e].concat(r)).appendPayload({"event.type":m.default.analytics.t_WARNING,"ccxp.message":e}).post()}},{key:"time",value:function(){var e=a()(_.a.mark(function e(t){var r,n,a;return _.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=Date.now(),n=new M(P(P({},this.options),{},{skipDiskLog:!0}),"Perf"),e.next=4,t(n);case 4:return a=e.sent,n.appendPayload({"event.dts_start":new Date(r).toISOString(),"event.dts_end":(new Date).toISOString(),"event.type":m.default.analytics.t_PERFORMANCE,"event.value":n.payload&&n.payload["event.value"]||Date.now()-r}).post(),e.abrupt("return",a);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"request",value:function(){var e=a()(_.a.mark(function e(t){var r,n,a,s,o;return _.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=this.options.payload,n="usage-marker"===(null==r?void 0:r["ccxp.mode"]),a=r&&r["event.context_guid"]||E.v4(),s=Date.now(),n||new M(this.options,"INFO").appendPayload({"event.type":m.default.analytics.t_REQUEST,"event.context_guid":a}).addDiskLog("Request Received").post(),o=new M(P(P({},this.options),{},{forceSilentError:!0}),"INFO"),e.next=8,t(o).then(function(e){return n||o.appendPayload({"event.type":m.default.analytics.t_RESPONSE,"event.context_guid":a,"event.value":Date.now()-s,"ccxp.partial":!1}).addDiskLog("Response sent in ".concat(Date.now()-s,"ms")).post(),e}).catch(function(e){var t,s;e instanceof w.default&&r&&r["event.subtype"]&&"client"==r["event.subtype"]&&(t={"ccxp.partial":!(null===(s=e.supportData)||void 0===s||!s.path)});throw n||o.appendPayload(P({"event.context_guid":a},void 0!==t&&t)).setError(e).post(),e});case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"console",value:function(e){function t(){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(){var e;(e=console).log.apply(e,arguments)})}],[{key:"init",value:function(){b=r(20).default}}]),e}();h()(U,"Builder",void 0),U.Builder=M},function(e,t){e.exports=require("@babel/runtime/helpers/get")},function(e,t,r){"use strict";r.r(t);var n=r(7),a=r.n(n),s=r(8),o=r.n(s),i=r(14),c=r.n(i),u=r(15),l=r.n(u),d=r(6),f=r.n(d);function p(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=f()(e);if(t){var a=f()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return l()(this,r)}}var h=r(19),v=r(32),_=r(17).default,y=r(1).default,E=r(27),m=r(21).default,g=r(5).default,O=r(20).default,S=r(10).default,T=r(3).default,A=new v.Parser,I=new(function(e){c()(r,e);var t=p(r);function r(){var e;return a()(this,r),(e=t.call(this)).log=new m({prefix:"CCNotifications > ",payload:{"event.subcategory":y.analytics.sc_PROCESS,"event.subtype":y.analytics.st_ANS}}),e.events={SIGN_IN:"signIn",SIGN_OUT:"signOut",PROXY_SETTINGS_CHANGED:"proxySettingsChanged",PROFILE_UPDATED:"profileUpdated",INSTALL_APPLICATION:"installApplication",UNINSTALL_APPLICATION:"uninstallApplication",UPDATE_APPLICATION:"updateApplication",SUBSCRIPTION_STATUS_CHANGED:"subscriptionStatusChanged",UPDATE_STOCK:"updateStock",UPDATE_APPLICATION_COMPONENTS:"updateApplicationComponents",USER_ANALYTICS_CHANGED:"userAnalyticsChanged",FORCE_REFRESH:"forceRefresh"},e.getProxyCredentials=e._getProxyCredentials,e.getUserAnalyticsEnabledFlag=e._getUserAnalyticsEnabledFlag,e.handlePayload=e._handlePayload,e.registerANSNotifications=e._registerANSNotifications,e.addListeners(),e}return o()(r,[{key:"getMessageValue",value:function(e,t){var r=null;if(e){var n=new RegExp("<".concat(t,"[^<>]*>([^<>]*)</").concat(t,">"),""),a=e.match(n);r=a&&a[1]}return r}},{key:"constructMessage",value:function(e,t){var r=e;return Object.keys(t).forEach(function(e){r=r.replace(e,t[e])}),r}},{key:"normalizeProductCode",value:function(e){return T.getProductAlias(e)}},{key:"addListeners",value:function(){var e=this;_.addListener("accc.localapps.panel.refresh.ssoevent",function(t){var r=e.getMessageValue(t,"event_type");e.log.disk("ACCC Sign-on State: ".concat(r)),"signin_success"===r?e.emit(e.events.SIGN_IN):"signout_success"===r&&e.emit(e.events.SIGN_OUT)}),_.addListener("accc.any.NoListenerAvailable",function(t){e.log.error("No Listener Available: ".concat(t))}),_.addListener("com.adobe.aam.AAMIMSStatus",function(t){var r=e.getMessageValue(t,"Status");e.log.disk("AAM Sign-on State: ".concat(r)),"USER_AUTH_SUCCESS"===r&&e.emit(e.events.SIGN_IN)}),_.addListener("com.adobe.aam.AAMSIGNOUTStatus",function(t){e.emit(e.events.SIGN_OUT),e.log.disk("AAM Sign-on State: signOut")}),_.addListener("any.accc.app.UserContextData",function(t){var r=y.get(S.getUserId(),"USER_ANALYTICS_ENABLED")||!1;if(!t)return e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to receive user analytics message on sign in")),void O.enable(r);A.parseString(t,function(t,n){if(t||!n)return e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to parse user analytics flag on update, err=".concat(t))),void O.enable(r);if(n.response&&n.response.error)return e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Error in user analytics flag on update, err=".concat(JSON.stringify(n.response.error)))),void O.enable(r);var a=n["feature-response"]&&n["feature-response"]["feature-entry"]&&n["feature-response"]["feature-entry"].find(function(e,t){return"com.adobe.oobe.acc.v1.piip.user.status"===e.$.id});if(a&&a.$){e.log.disk("GetUserAnalyticsFlag - Successfully updated user analytics enabled flag: ".concat(a.$.state));var s="OptedIn"===a.$.state;return O.enable(s),void y.set(S.getUserId(),s,"USER_ANALYTICS_ENABLED")}return e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to parse userAnalyticsStatus, userAnalyticsStatus=".concat(a))),void O.enable(r)})}),_.addListener("any.accc.app.ProxySettingsChanged",function(t){var r=e.getMessageValue(t,"proxyuser"),n=e.getMessageValue(t,"proxypassword");null!==r&&null!==n&&e.emit(e.events.PROXY_SETTINGS_CHANGED,r,n)}),_.addListener("any.accc.app.ProductDeploymentEvent",function(t){var n={productCode:e.getMessageValue(t,"productCode"),productVersion:e.getMessageValue(t,"productVersion"),productLanguage:e.getMessageValue(t,"productLanguage"),countryCode:e.getMessageValue(t,"countryCode"),productID:e.getMessageValue(t,"productID")};if(n.productCode=n.productCode?e.normalizeProductCode(n.productCode):"",y.get("PRODUCT_LIST").includes(n.productCode))switch(e.getMessageValue(t,"eventType")){case"Install":case"Install-Start":case"Install-Progress":e.emit(e.events.INSTALL_APPLICATION,n);break;case"Uninstall":e.emit(e.events.UNINSTALL_APPLICATION,n);break;case"Update":case"Update-Start":case"Update-Progress":e.emit(e.events.UPDATE_APPLICATION,n);break;case"UpdateComponents":0!==r.listenerCount(e.events.UPDATE_APPLICATION_COMPONENTS)&&e.emit(e.events.UPDATE_APPLICATION_COMPONENTS,n)}}),_.addListener(y.get("NOTIFICATION_PSDK_RESPONSE"),function(t){e.handleNotificationResponse(t,y.get("ANS_PSDK_NOTIFICATION_TYPE"),y.get("NOTIFICATION_PSDK_QUERY_DATA_BY_ID_RESPONSE"))}),_.addListener(y.get("NOTIFICATION_STOCK_RESPONSE"),function(t){e.handleNotificationResponse(t,y.get("ANS_STOCK_NOTIFICATION_TYPE"),y.get("NOTIFICATION_STOCK_QUERY_DATA_BY_ID_RESPONSE"))}),_.addListener(y.get("NOTIFICATION_FORCE_REFRESH_RESPONSE"),function(t){e.handleNotificationResponse(t,y.get("ANS_FORCE_REFRESH_NOTIFICATION_TYPE"),y.get("ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE"))}),_.addListener(y.get("NOTIFICATION_FORCE_REFRESH_RESPONSE"),function(t){e.handleNotificationResponse(t,y.get("ANS_NUJ_REFRESH_NOTIFICATION_TYPE"),y.get("ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE"))})}},{key:"_handlePayload",value:function(e,t){var r=this,n={};A.parseString(e,function(e,a){if(e)r.log.error(new g(e,"Fail to parse message"));else{var s=a["notification-error"];if(s){var o=s.error&&s.error[0],i=o&&o.$&&o.$.desc||"Unknown notification error";r.log.disk(i)}else{var c,u=a&&a.notifications&&a.notifications.notification||[];r.log.disk("Received ".concat(u.length," ANS notifications.")),u.forEach(function(e){var a=e.type[0],s=e["sub-type"][0],o=parseInt(e.timestamp[0],10),i=e.payload;(!t||o>t)&&(c=!c||o>c?o:c,function(e,t,a){if(e===y.get("ANS_PSDK_NOTIFICATION_TYPE")&&t===y.get("ANS_PSDK_NOTIFICATION_SUB_TYPE")){var s;r.log.disk("Handle ANS message: type=".concat(e,", subtype=").concat(t,", payload=").concat(a));try{s=a&&JSON.parse(a)}catch(e){return r.log.error(new g(y.analytics.PAYLOAD_PARSE_FAIL,"Fail to parse payload: ".concat(a)))}switch(s&&s.eventType){case"HVA_COMMUNICATION":case"HVA_COMPLETED":case"SEGMENT_CHANGE":case"EXPERIENCE_CHANGE":case"APS_COMMUNICATION":case"APPLAUNCH_BUCKET_CHANGE":case"PERSONA_SEGMENT_CHANGE":case"ENTITLEMENT_CHANGE":case"ENGAGEMENT_CLICK_EVENT":n.profileUpdated=!0;break;case"MEMBERSHIP_CHANGE":n.subscriptionStatusChanged=!0}}else if(e===y.get("ANS_STOCK_NOTIFICATION_TYPE")&&t===y.get("ANS_STOCK_NOTIFICATION_SUB_TYPE"))n.updateStock=!0;else if(e===y.get("ANS_FORCE_REFRESH_NOTIFICATION_TYPE")&&t===y.get("ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE"))try{n[r.events.FORCE_REFRESH]=JSON.parse(a).payload}catch(n){r.log.error(new g(y.analytics.UNEXPECTED_ANS_MSG,"Unable to parse ANS message payload, type=".concat(e,", subType=").concat(t,", payload=").concat(a)))}else if(e===y.get("ANS_NUJ_REFRESH_NOTIFICATION_TYPE")&&t===y.get("ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE"))try{n[r.events.FORCE_REFRESH]=JSON.parse(a[0])}catch(n){r.log.error(new g(y.analytics.UNEXPECTED_ANS_MSG,"Unable to parse ANS message payload, type=".concat(e,", subType=").concat(t,", payload=").concat(a)))}}(a,s,i))}),Object.keys(n).forEach(function(e){r.emit(e,c||(new Date).getTime(),n[e]||null)})}}})}},{key:"_queryANSNotificationsByTime",value:function(e,t,r){var n,a=arguments.length>3&&void 0!==arguments[3]?arguments[3]:void 0,s=h.v4(),o=function e(a){clearTimeout(n),_.removeListener(t,e),r(null,a)};_.addListener(t,o);var i={"{{TIME_STAMP}}":(new Date).getTime(),"{{NOTIFICATION_TYPE}}":e,"{{NOTIFICATION_COUNT}}":"10","{{uuid}}":s,"{{requestor-namespace}}":t};a&&(i["{{NOTIFNOTIFICATION_SUB_TYPE}}"]=a),_.sendMessage(y.get("NOTIFICATION_REQUEST"),this.constructMessage('<?xml version="1.0" encoding="utf-8"?><NEMessage action="GetDataByTime"><timestamp>{{TIME_STAMP}}</timestamp><type>{{NOTIFICATION_TYPE}}</type><notifications-count-limit>{{NOTIFICATION_COUNT}}</notifications-count-limit><request-context>{{uuid}}</request-context><requestor-namespace>{{requestor-namespace}}</requestor-namespace></NEMessage>',i),"ADCS",""),n=setTimeout(function(){_.removeListener(t,o),r(new Error("GetNotificationDataByTime timeout"))},y.get("GET_NOTIFICATION_DATA_TIMEOUT"))}},{key:"_getUserAnalyticsEnabledFlag",value:function(){var e=this;return new Promise(function(t){var r,n,a=y.get(S.getUserId(),"USER_ANALYTICS_ENABLED")||!1,s=function s(o){if(_.removeListener("adbproduct.app.UserContextDataResponse",s),clearTimeout(r),!o)return e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to receive user analytics message on sign in.")),void t({enabled:a});A.parseString(o,function(r,s){if(r||!s)return e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to receive user analytics flag on sign in, err=".concat(r))),void t({enabled:a});if(s.response&&s.response.error){var o=s.response.error;return o[0]&&"SignInPending"===o[0].$.id?(e.log.disk("User sign in pending. Analytics flag not received yet."),void t({enabled:a})):(e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to parse user analytics flag on sign in, err=".concat(JSON.stringify(s.response.error)))),void t({enabled:a}))}var i=s.response&&s.response.UserfeatureXML&&s.response.UserfeatureXML[0];A.parseString(i,function(r,s){if(r||!s)return e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to parse UserfeatureXML, err=".concat(r))),void t({enabled:a});if((n=s["feature-response"]&&s["feature-response"]["feature-entry"]&&s["feature-response"]["feature-entry"].find(function(e,t){return e&&e.$&&"com.adobe.oobe.acc.v1.piip.user.status"===e.$.id}))&&n.$){e.log.disk("GetUserAnalyticsFlag - Successfully obtained user analytics enabled flag: ".concat(n.$.state));var o="OptedIn"===n.$.state;return t({enabled:o}),void y.set(S.getUserId(),o,"USER_ANALYTICS_ENABLED")}return e.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to parse userAnalyticsStatus, userAnalyticsStatus=".concat(n))),void t({enabled:a})})})};_.addListener("adbproduct.app.UserContextDataResponse",s),_.sendMessage("accc.app.UserContextDataRequest",e.constructMessage('<?xml version= "1.0" encoding= "utf-8"?><request><request-id>{{uuid}}</request-id></request>',{"{{uuid}}":h.v4()}),"ADCS",""),r=setTimeout(function(){_.removeListener("adbproduct.app.UserContextDataResponse",s),e.log.disk("GetUserAnalyticsFlag - Error: timed out getting user analytics enabled flag"),t({enabled:a})},y.get("USER_ANALYTICS__REQUEST_TIMEOUT"))})}},{key:"_getProxyCredentials",value:function(){var e=this;return new Promise(function(t){var r,n=function n(a){_.removeListener("accc.app.ProxySettingsResponse",n),clearTimeout(r);var s=e.getMessageValue(a,"proxyuser"),o=e.getMessageValue(a,"proxypassword");e.log.disk("GetProxySettings - Successfully obtained username/password"),t({user:s,password:o})};_.addListener("accc.app.ProxySettingsResponse",n),_.sendMessage("accc.app.ProxySettingsRequest",e.constructMessage('<?xml version="1.0" encoding="utf-8"?><request><type>accc.app.ProxySettingsRequest</type><request_id>{{uuid}}</request_id></request>',{"{{uuid}}":h.v4()}),"ADCS",""),r=setTimeout(function(){_.removeListener("accc.app.ProxySettingsResponse",n),e.log.disk("GetProxySettings - Error: timed out getting proxy settings"),t({})},y.get("PROXY_REQUEST_TIMEOUT"))})}},{key:"_registerANSNotifications",value:function(){var e=this;[{"{{NOTIFICATION_TYPE}}":y.get("ANS_PSDK_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":y.get("ANS_PSDK_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":y.get("NOTIFICATION_PSDK_RESPONSE")},{"{{NOTIFICATION_TYPE}}":y.get("ANS_STOCK_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":y.get("ANS_STOCK_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":y.get("NOTIFICATION_STOCK_RESPONSE")},{"{{NOTIFICATION_TYPE}}":y.get("ANS_FORCE_REFRESH_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":y.get("ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":y.get("NOTIFICATION_FORCE_REFRESH_RESPONSE")},{"{{NOTIFICATION_TYPE}}":y.get("ANS_NUJ_REFRESH_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":y.get("ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":y.get("NOTIFICATION_FORCE_REFRESH_RESPONSE")}].forEach(function(t){_.sendMessage(y.get("NOTIFICATION_REQUEST"),e.constructMessage('<?xml version="1.0" encoding="utf-8"?><NEMessage action="RegisterObserver"><type>{{NOTIFICATION_TYPE}}</type><sub-type>{{NOTIFICATION_SUB_TYPE}}</sub-type><observer-namespace>{{observer-namespace}}</observer-namespace></NEMessage>',t),"ADCS","")})}},{key:"getNotificationDataByIDs",value:function(e,t,r,n){var a=this;if(0!==Object.keys(e).length){var s,o=h.v4(),i=function e(t){_.removeListener(r,e),clearTimeout(s),n(null,t)};_.addListener(r,i);var c="";Object.keys(e).forEach(function(e){c+="<notification-id>".concat(e,"</notification-id>")});var u={"{{NOTIFICATION_TYPE}}":t,"{{NOTIFICATION_IDS}}":c,"{{uuid}}":o,"{{requestor-namespace}}":r};_.sendMessage(y.get("NOTIFICATION_REQUEST"),this.constructMessage('<?xml version="1.0" encoding="utf-8"?><NEMessage action="GetDataByID"><notification-ids>{{NOTIFICATION_IDS}}</notification-ids><request-context>{{uuid}}</request-context><requestor-namespace>{{requestor-namespace}}</requestor-namespace></NEMessage>',u),"ADCS",""),s=setTimeout(function(){_.removeListener(r,i);var e=new g(y.analytics.GET_NOTIFICATION_DATA,"GetNotificationDataByID - Error: timed out getting notification data");a.log.error(e),n(e)},y.get("GET_NOTIFICATION_DATA_TIMEOUT"))}else n(new Error("No notification id"))}},{key:"handleNotificationResponse",value:function(e,t,r){var n=this,a={};A.parseString(e,function(s,o){if(s)n.log.error(new g(y.analytics.PARSE_MSG_FAIL,"Fail to parse message, message=".concat(e)));else{var i=o&&o["notifications-signal"],c=i&&i["notification-signal"];(c&&c[0]&&c[0]["notification-info"]||[]).forEach(function(e){var t=e&&e["notification-ids"]&&e["notification-ids"][0];(t&&t["notification-id"]||[]).forEach(function(e){a[e]=!0})}),n.getNotificationDataByIDs(a,t,r,function(e,t){e?n.log.disk(e):n.handlePayload(t)})}})}},{key:"checkForMissedNotifications",value:function(e,t,r){var n=this;[{type:y.get("ANS_PSDK_NOTIFICATION_TYPE"),requestNamespace:y.get("NOTIFICATION_PSDK_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:e},{type:y.get("ANS_STOCK_NOTIFICATION_TYPE"),requestNamespace:y.get("NOTIFICATION_STOCK_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:t},{type:y.get("ANS_FORCE_REFRESH_NOTIFICATION_TYPE"),subtype:y.get("ANS_FORCE_REFRESH_NOTIFICATION_SUB_TYPE"),requestNamespace:y.get("NOTIFICATION_FORCE_REFRESH_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:r},{type:y.get("ANS_NUJ_REFRESH_NOTIFICATION_TYPE"),subtype:y.get("ANS_NUJ_REFRESH_NOTIFICATION_SUB_TYPE"),requestNamespace:y.get("NOTIFICATION_FORCE_REFRESH_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:r}].forEach(function(e){var t=e.lastTimeOfNotification;n.queryANSNotificationsByTime(e,function(e,r){e?n.log.disk(e):n.handlePayload(r,t)})})}},{key:"queryANSNotificationsByTime",value:function(e,t){this._queryANSNotificationsByTime(e.type,e.requestNamespace,t,e.subtype)}}]),r}(E));I.setMaxListeners(20),t.default=I},function(e,t){e.exports=require("os")},function(e,t){e.exports=require("@babel/runtime/helpers/toConsumableArray")},function(e,t){e.exports=require("url")},function(e,t){e.exports=require("events")},function(e,t,r){"use strict";var n=r(2),a=r.n(n),s=r(7),o=r.n(s),i=r(8),c=r.n(i),u=r(9),l=r.n(u),d=r(14),f=r.n(d),p=r(15),h=r.n(p),v=r(6),_=r.n(v),y=r(4),E=r.n(y),m=r(0),g=r.n(m),O=r(21),S=r(27),T=r(29),A=r(3),I=r(5),C=r(1);function R(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=_()(e);if(t){var a=_()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return h()(this,r)}}var x=new O.default({prefix:"Proxy > ",payload:{"event.subcategory":C.default.analytics.sc_Network}}),k=r(39),b=r(55),N=r(39).globalAgent,w={},D=r(56)(function(e,t){x.disk(t)}),L={getRootCA:T.promisify(D.getRootCA),resolve:T.promisify(D.resolve),getOSLocale:T.promisify(D.getOSLocale)},P=function(e){f()(n,e);var t=R(n);function n(){var e;return o()(this,n),e=t.call(this),E()(l()(e),"_lastCredentials",new Map),E()(l()(e),"_ca",void 0),E()(l()(e),"proxyUser",void 0),E()(l()(e),"proxyPassword",void 0),E()(l()(e),"proxyResolver",{getRootCA:T.promisify(D.getRootCA),resolve:T.promisify(D.resolve),getOSLocale:T.promisify(D.getOSLocale)}),E()(l()(e),"getOSLocale",A.default.memoize(L.getOSLocale,{timeout:-1})),E()(l()(e),"getNodeTunnelOptionsForURL",A.default.memoize(e._getNodeTunnelOptionsForURL,{destructor:function(e,t){var r=t.value.agent;return!(!r||!r.isAvailable||0!==Object.values(r.sockets).map(function(e){return e.length}).reduce(function(e,t){},0))&&(r.destroy(),r.isAvailable=!1,!0)}})),E()(l()(e),"init",A.default.memoize(a()(g.a.mark(function t(){var n,a,s,o;return g.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return D.setAuthenticationCallback(function(t,r){var n=e._lastCredentials.get(t.proxy.host+t.proxy.port)||{};if(n.username===e.proxyUser&&n.password===e.proxyPassword)r(new I.default("No new credentials for ".concat(t.proxy.host,":").concat(t.proxy.port),void 0,"PROXY"));else if(e.proxyUser){var a;n.username=e.proxyUser,n.password=e.proxyPassword,r(null,n),e._lastCredentials.set((null==t?void 0:null===(a=t.proxy)||void 0===a?void 0:a.host)+t.proxy.port,n)}else{r(new I.default("No credentials present for ".concat(t.proxy.host,":").concat(t.proxy.port),void 0,"PROXY"))}}),D.on("change",function(){x.disk("System proxy settings changed"),e.getNodeTunnelOptionsForURL.cache.clear(),e.emit("change",!0)}),t.next=4,e.proxyResolver.getRootCA().catch(function(e){x.error(e,"Error getting Root CA")});case 4:return e._ca=t.sent,N.options.ca=e._ca,n=r(23).default,t.next=9,n.getProxyCredentials();case 9:a=t.sent,s=a.user,o=a.password,e.setProxyCredentials(s,o);case 13:case"end":return t.stop()}},t)})),{timeout:-1})),e}return c()(n,[{key:"_getNodeTunnelOptionsForURL",value:function(){var e=a()(g.a.mark(function e(t){var r,n,a,s,o,i,c;return g.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,L.resolve(t).catch(function(e){x.error(e,"Error getting proxy settings")});case 2:if(n=(n=e.sent)&&n[0],a=n&&n.agentClass||(t.startsWith("https")?k.Agent:b.Agent),s=n&&n.agentOptions||{},o={},s.ca=this._ca,s.keepAlive=!0,s.keepAliveMsecs=1e3,s.maxFreeSockets=5,i=s.proxy?s.proxy.host+s.proxy.port:t.startsWith("https")?"https":"http",w[i]=null!==(r=w[i])&&void 0!==r&&r.isAvailable?w[i]:new a(s),w[i].isAvailable=!0,o.agent=w[i],!n.agent){e.next=23;break}return e.next=18,this.init();case 18:c="".concat(n.hostname,":").concat(n.port).concat(this.proxyUser?" with":" without"," authentication"),x.disk("Setting proxy for ".concat(t,": ").concat(c)),o.details=c,e.next=25;break;case 23:x.disk("No proxy (direct connection) for ".concat(t)),o.details="No Proxy";case 25:return e.abrupt("return",o);case 26:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"setProxyCredentials",value:function(e,t){this.proxyUser===e&&this.proxyPassword===t||(x.disk("Setting proxy username and password"),this.proxyUser=e,this.proxyPassword=t,this.getNodeTunnelOptionsForURL.cache.clear(),this.emit("change",!1))}},{key:"getProxyCredentials",value:function(){return{user:this.proxyUser,password:this.proxyPassword}}},{key:"clearCache",value:function(){this.getNodeTunnelOptionsForURL.cache&&this.getNodeTunnelOptionsForURL.cache.clear(),this.proxyUser=void 0,this.proxyPassword=void 0,this._lastCredentials.clear()}}]),n}(S.EventEmitter);t.a=new P},function(e,t){e.exports=require("util")},function(e,t){e.exports=require("@ccx/node-reachability")},function(e,t,r){"use strict";r.d(t,"a",function(){return u});var n=r(7),a=r.n(n),s=r(8),o=r.n(s),i=r(26),c=r(3).default,u=function(){function e(){a()(this,e)}return o()(e,null,[{key:"stripPathFromURL",value:function(e){if("string"==typeof e){var t=i.parse(e);if(t.protocol&&t.host)return"".concat(t.protocol,"//").concat(t.host)}}},{key:"getRetryAfterHeader",value:function(e){if(e){var t=e.get("retry-after");if(t)try{var r=parseInt(t,10);if(r)return Math.max(0,r);var n=new Date(t);if(!isNaN(n)){var a=(new Date).valueOf(),s=Math.max(0,n-a),o=c.getRandomizedTime();return Math.round((s+o)/1e3)}}catch(e){}}return 0}},{key:"getExpiry",value:function(e){var t=e.get("expiry")?new Date(e.get("expiry")||""):void 0,r=e.get("cache-control");if(r&&"string"==typeof r&&r.includes("max-age=")){var n=parseInt(r.split("max-age=")[1].trim(),10);isNaN(n)||(t=new Date).setSeconds(n)}if(t&&!isNaN(t))return t.toISOString()}},{key:"getContentTypeHeader",value:function(e){if(e){var t=e.get("content-type");if(t&&"string"==typeof t){var r=t.indexOf(";");return r>0&&(t=t.substring(0,r)),t}}}}]),e}()},function(e,t){e.exports=require("xml2js")},function(e,t){e.exports=require("@ccx/parallel-fetch")},function(e,t){e.exports=require("fs")},function(e,t){e.exports=require("@babel/runtime/helpers/construct")},function(e,t){e.exports=require("dns")},function(e){e.exports={name:"ccx-welcome-process",version:"4.12.0",private:!0,description:"CCXProcess",dependencies:{"@babel/runtime":"^7.14.6","@ccx/node-ProxyResolver":"git+ssh://git@git.corp.adobe.com:ProjectCentral/node-ProxyResolver.git#v2.2.19","@ccx/node-aid":"git+ssh://git@git.corp.adobe.com:CCX/node-aid.git#v0.0.11","@ccx/node-ngl":"git+ssh://git@git.corp.adobe.com:ProjectCentral/node-ngl.git#v1.30.0.3","@ccx/parallel-fetch":"0.0.31","@ccx/node-reachability":"git+ssh://git@git.corp.adobe.com:CCX/node-reachability.git#v1.3.5",decompress:"^4.2.1","fs-ext":"2.0.0","fs-extra":"10.0.0",ingest:"git+ssh://git@git.corp.adobe.com:CCX/Ingest.git#v4.3.0",jsonschema:"1.4.0",mime:"2.5.2",mkdirp:"^1.0.4","node-vulcanjs":"git+ssh://git@git.corp.adobe.com:slade/VulcanJS.git#v2.0.7","simple-plist":"^1.1.1",uuid:"8.3.2",winreg:"^1.2.4",xml2js:"0.4.23"},devDependencies:{"7zip":"0.0.6","@adobe/tessa-npm-plugin":"1.2.1","@babel/cli":"^7.14.5","@babel/core":"^7.14.6","@babel/plugin-proposal-class-properties":"^7.14.5","@babel/plugin-proposal-object-rest-spread":"^7.14.7","@babel/plugin-transform-runtime":"^7.14.5","@babel/preset-env":"^7.14.7","@babel/preset-typescript":"^ 7.14.5","@ccx/hyperdrive-builder":"git+ssh://git@git.corp.adobe.com:CCX/hyperdrive-builder.git#v5.0.5","@types/core-js":"^2.5.0","@types/decompress":"^4.2.3","@types/es6-promise":"^3.3.0","@types/fs-ext":"0.0.29","@types/fs-extra":"5.0.4","@types/glob":"^7.1.1","@types/jest":"23.3.7","@types/mime":"^2.0.0","@types/mustache":"^4.0.1","@types/nock":"^9.3.0","@types/node":"^10.12.0","@types/uuid":"^3.4.4","@types/webpack":"^4.4.17","@types/winreg":"^1.2.4","@types/xml2js":"0.4.3","babel-loader":"^8.2.2",glob:"7.1.3",husky:"1.1.2",jest:"23.6.0","jest-date-mock":"1.0.5","jest-extended":"0.11.0",jsftp:"2.1.3",matchdep:"2.0.0",mockery:"2.1.0",mustache:"^4.0.1",nock:"10.0.1","node-gyp":"^7.1.0","node-uglifier":"0.5.41",prettier:"2.0.5","pretty-quick":"1.8.0","terser-webpack-plugin":"1.1.0","ts-jest":"23.10.4","ts-loader":"5.2.2","ts-node":"7.0.1","ts-node-dev":"^1.0.0-pre.30",typescript:"3.8",webpack:"4.23.0","webpack-node-externals":"1.7.2"},prettier:{tabWidth:4,useTabs:!1,singleQuote:!0,trailingComma:"all",printWidth:120,arrowParens:"avoid",endOfLine:"auto"},engines:{node:">=16.13.2"},scripts:{test:"jest",coverage:"jest --coverage",updateBuildCoverageComment:"ts-node packaging/updateCoverage",main:"ts-node-dev --no-deps --files main --debug",tessa:"tessa-npm-plugin update --yarn","tessa-plugin-pr":"tessa-npm-plugin check --errorOnNewVulnerability --yarn",kill:'pkill -f ".*CCXProcess.app/Contents/MacOS/../js/main.js$"',killWin:'cmd /C taskkill /f /im "CCXProcess.exe" /t',build:"ts-node --files packaging/build.ts compile","build:arm":"ts-node --files packaging/build.ts compile arm","build:mac-arm":"ts-node --files packaging/build.ts compile mac-arm",package:"ts-node --files packaging/build.ts hyperdrive","package:arm":"ts-node --files packaging/build.ts hyperdrive arm","package:mac-arm":"ts-node --files packaging/build.ts hyperdrive mac-arm",jira:"node packaging/jiraRestApi",preinstall:"node packaging/credentials",start:"node -p \"if (process.platform == 'darwin') { try { require('child_process').execSync('yarn run kill')} catch(err) {}} else { try { require('child_process').exec('yarn run killWin')} catch (err) {}} require('child_process').execSync('yarn run main', {stdio: [0,1,2]})\"",postinstall:"node packaging/fixDepsMac",installNoDepCopy:"NO_DEP_COPY=true yarn install",addTessaLibrary:"node packaging/addTessaLib"},cepPanels:[{NOTE:"REMOVING START 2.7 from the CCXPROCESS WILL CAUSE LEARN TAB TO GO MISSING IN FRESH INSTALLS OF CC 2019 APPS. ALSO DISABLE YBR NON 2.5 COMPATIBLE CAMPAIGNS BEFORE THIS, Locking 2.7.2-15 version",product:"CCX Start",subproduct:"Extension",version:"2.7.2",build:"2.7.2-15",certification:"Not Tested",destination:"com.adobe.ccx.start-2.7.2",name:"com.adobe.ccx.start"},{product:"CCX Start",subproduct:"Extension",version:"2.16.0",certification:"Not Tested",destination:"com.adobe.ccx.start-2.16.0",name:"com.adobe.ccx.start"},{product:"CCX Start",subproduct:"CmdN",version:"3.5.0",certification:"Not Tested",destination:"com.adobe.ccx.fnft-3.5.0",name:"com.adobe.ccx.fnft"}],"UNINSTALLATION INSTRUCTIONS":{STEPS:"NAME THE KEY uninstall to uninstall extensions. The contents of the key add  an array objects each with a destination folder name and isCEP which is true if this is a CEP extension and false if this is a UXP extension.",SAMPLE:{uninstall:[{COMMENT:"The provided destination folder(com.adobe.ccx.start-2.6.1) in the CEP or UXP (CEP in this case) extension is deleted",destination:"com.adobe.ccx.start-2.6.1",isCEP:!0}]}},"uninstall-example":[{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.3.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.3.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.5.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.5.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.5.1) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.5.1",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.6.1) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.6.1",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.7.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.7.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.7.2) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.7.2",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.7.4) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.7.4",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.8.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.8.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.9.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.9.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.10.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.10.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.11.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.11.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.12.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.12.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.13.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.13.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2.14.0) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2.14.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-2019) in CEP extensions is deleted",destination:"com.adobe.ccx.start-2019",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.1.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.1.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.2.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.2.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.3.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.3.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.4.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.4.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.5.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.5.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.6.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.6.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start-3.7.0) in UXP extensions is deleted",destination:"com.adobe.ccx.start-3.7.0",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.start.uxp-2019) in UXP extensions is deleted",destination:"com.adobe.ccx.start.uxp-2019",isCEP:!1},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-2.5.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-2.5.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-2.5.1) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-2.5.1",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-2.6.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-2.6.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.0.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.0.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.1.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.1.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.2.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.2.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.3.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.3.0",isCEP:!0},{COMMENT:"The provided destination folder (com.adobe.ccx.fnft-3.4.0) in CMDN extensions is deleted",destination:"com.adobe.ccx.fnft-3.4.0",isCEP:!0}],uxpPanels:[{product:"CCX Start",subproduct:"HomeScreenUXP",version:"6.0.0",certification:"Golden Master",destination:"com.adobe.ccx.start-6.0.0",name:"com.adobe.ccx.start.{{build}}"}],thor:[{product:"ACCC",subproduct:"Application",version:"5.7.0",certification:"Release Candidate",name:"ACCCx5_7_0_{{build}}",volume:"Creative Cloud",build:"^\\d+$"},{product:"ACCC",subproduct:"HDSetup",version:"5.7.0",certification:"Release Candidate",name:"HDSetup",volume:"Release"}],AdobePIM:{product:"ACCC",subproduct:"AdobePIM",version:"5.7.0",certification:"Release Candidate",name:"AdobePIM",volume:"Release",platform:"winarm64",extension:"zip"},resolutions:{xml2js:"0.4.23","node-fetch":"3.0.0-beta.7"},husky:{hooks:{"pre-commit":"pretty-quick --staged"}}}},function(e,t){e.exports=require("node-vulcanjs")},function(e,t){e.exports=require("https")},function(e,t){e.exports=require("jsonschema")},function(e,t){e.exports=require("child_process")},function(e,t){e.exports=require("@babel/runtime/helpers/wrapNativeSuper")},function(e,t){e.exports=require("@babel/runtime/helpers/slicedToArray")},function(e,t){e.exports=require("fs-ext")},function(e,t){e.exports=require("decompress")},function(e,t){e.exports=require("@babel/runtime/helpers/typeof")},function(e,t){e.exports=require("mime")},function(e,t){e.exports=require("abort-controller")},function(e,t){e.exports=require("simple-plist")},function(e,t,r){e.exports=r(61)},function(e,t){e.exports=require("module")},function(e,t){e.exports=require("v8")},function(e,t){e.exports=require("vm")},function(e,t){e.exports=require("@ccx/node-ngl")},function(e,t){e.exports=require("http")},function(e,t){e.exports=require("@ccx/node-ProxyResolver")},function(e,t){e.exports=require("@ccx/node-aid")},function(e,t){e.exports=require("node-fetch")},function(e,t){e.exports=require("ingest/src/ingest")},function(e,t){e.exports=require("winreg")},function(e,t,r){"use strict";r.r(t);var n=r(25),a=r.n(n),s=r(2),o=r.n(s),i=r(7),c=r.n(i),u=r(8),l=r.n(u),d=r(4),f=r.n(d),p=r(0),h=r.n(p),v=r(1),_=r(3),y=r(21),E=r(38),m=r(20),g=E.createControlAdapter(),O=new(function(){function e(){c()(this,e),f()(this,"log",new y.default({prefix:"HeartbeatProductAnalytics > "}))}return l()(e,[{key:"createOperationalPayload",value:function(e){var t={};return t["event.workflow"]=v.default.analytics.w_INTERNAL,t["event.subcategory"]=v.default.analytics.sc_PULSE,t["event.type"]=v.default.analytics.t_APP,t["event.subtype"]=v.default.analytics.st_RUNNING,t["source.name"]=e.SAPCode,t["source.version"]=e.CodexVersion,t["source.platform"]=_.default.getOsPlatform(),t["source.device"]="Desktop",t["source.os_version"]=_.default.getOsVersion(),t}},{key:"sendPollingEvent",value:function(){var e=this;g.getInstalledApps().filter(function(e){return e.SAPCode&&g.isAppRunning(e.SAPCode)}).forEach(function(t){var r=e.createOperationalPayload(t);e.log.disk("App Running: ".concat(t.SAPCode,":").concat(t.CodexVersion)),m.default.logPollingEvent(r)})}},{key:"startPoll",value:function(){var e=this;setInterval(function(){return e.sendPollingEvent()},v.default.get("ANALYTICS_HEARTBEAT_INTERVAL"))}}]),e}()),S=r(10),T=r(16),A=r(11),I=r(44),C=r(19),R=r(29),x=r(24),k=r(45),b=R.promisify(I.flock),N=function(){function e(){c()(this,e)}return l()(e,null,[{key:"writeJsonAtomic",value:function(){var t=o()(h.a.mark(function t(r,n,a){var s,o,i,c=arguments;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return s=c.length>3&&void 0!==c[3]&&c[3],r.endsWith("/")||(r+="/"),i="".concat(o=r+n,"_").concat(C.v4(),".json"),t.next=6,T.ensureDir(r);case 6:return t.next=8,T.writeJson(i,a,{spaces:2,EOL:x.EOL});case 8:return t.next=10,e.rename(i,o,s);case 10:return t.abrupt("return",t.sent);case 11:case"end":return t.stop()}},t)}));return function(e,r,n){return t.apply(this,arguments)}}()},{key:"unzip",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",k(t,r));case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"rename",value:function(){var t=o()(h.a.mark(function t(r,n){var a,s,i,c=arguments;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return a=c.length>2&&void 0!==c[2]&&c[2],s=Date.now(),i=0,t.next=5,T.rename(r,n).catch(function(){var t=o()(h.a.mark(function t(o){return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(i<100&&(i+=10),!o||"EACCES"!==o.code&&"EPERM"!==o.code&&"ENOENT"!==o.code||!(Date.now()-s<6e4)){t.next=17;break}return t.next=4,_.default.setTimeoutAsync(i);case 4:if(!a){t.next=8;break}return t.next=7,e.removeOrRename(n);case 7:n=t.sent;case 8:return t.next=10,T.pathExists(n);case 10:if(!t.sent){t.next=12;break}throw o;case 12:return t.next=14,T.rename(r,n).catch(c);case 14:return t.abrupt("return",n);case 17:throw o;case 18:case"end":return t.stop()}},t)}));function c(e){return t.apply(this,arguments)}return c}());case 5:return t.abrupt("return",n);case 6:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}()},{key:"writeAtomic",value:function(){var t=o()(h.a.mark(function t(r){var n,a,s,o,i,c,u,l;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return n=r.response,a=r.target,s=r.progress,o=void 0===s?function(){}:s,i=r.renameOnError,c=void 0!==i&&i,u=a+v.default.get("DOWNLOAD_TMP_EXTENSION"),l=_.default.throttle(o,v.default.get("PROGRESS_THROTTLE_INTERVAL")),t.next=5,T.ensureDir(A.dirname(a));case 5:if(!c){t.next=9;break}return t.next=8,e.removeOrRename(u);case 8:u=t.sent;case 9:return n.emitter.on("progress",function(e){l(e.done,e.total,u)}),t.next=12,n.file(u);case 12:return n.emitter.removeAllListeners(),t.next=15,e.rename(u,a,c);case 15:return t.abrupt("return",a);case 16:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()},{key:"removeOrRename",value:function(){var t=o()(h.a.mark(function t(r){var n;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,T.remove(r).catch(function(){});case 2:return t.next=4,T.access(r).then(function(){return!0}).catch(function(e){return"ENOENT"!==e.code});case 4:if(!t.sent){t.next=13;break}if(n=r,(r=e.renameFile(r))!==n){t.next=9;break}return t.abrupt("return",r);case 9:return t.next=11,T.remove(r).catch(function(){});case 11:t.next=2;break;case 13:return t.abrupt("return",r);case 14:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}()},{key:"renameFile",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:v.default.get("MAX_EPERM_RENAMES"),r=A.extname(e),n=A.basename(e,r),a=n.substr(-3),s=/^\-(\d\d)$/.exec(a),o=s&&s[1]?parseInt(s[1],10):0,i=n.substr(0,n.length-3);return 0===o&&(i=n),++o>t?e:(o<10&&(o="0"+o),A.join(A.dirname(e),i+"-"+o+r))}},{key:"cleanupFolder",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=u.length>1&&void 0!==u[1]?u[1]:{},n=u.length>2&&void 0!==u[2]?u[2]:/^$/,e.next=4,T.ensureDir(t);case 4:return e.next=6,T.readdir(t);case 6:return a=e.sent,s=[],i=[],c=[],a.forEach(function(){var e=o()(h.a.mark(function e(a){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r[a]||n.test(a)?s.push(a):c.push(T.remove(t+a).then(function(){i.push(a)}).catch(function(){s.push(a)}));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=12,_.default.waitAll(c);case 12:return e.abrupt("return",{left:s.sort(),removed:i.sort()});case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"obtainProcessLock",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.default.get("ROOT_DIR"),e.next=3,T.ensureDir(r);case 3:return n="".concat(r,".").concat(t),e.next=6,T.open(n,"w");case 6:return a=e.sent,e.next=9,b(a,"exnb");case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),w=r(12),D=r(26),L=r(13),P=r(5);function M(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function U(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?M(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):M(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var F=r(17).default,V=function(){function e(){c()(this,e)}return l()(e,null,[{key:"getMissingProductList",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.getCachedRequestData(),n=new y.default({prefix:"LookupMapUtils > ".concat(t.type),payload:{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",t.type)}}),a=v.default.get("SUPPORTED_PRODUCTS",t.type),s=[],e.next=6,F.getSpecifiers();case 6:return i=e.sent,e.next=9,Promise.all(Object.keys(i).map(function(){var e=o()(h.a.mark(function e(t){var c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c=_.default.getProductAlias(t),e.abrupt("return",Promise.all(Object.keys(i[t]).map(function(){var e=o()(h.a.mark(function e(o){var i,u,l,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,F.getAppLanguage(t,o);case 2:(i=e.sent)&&c&&a[c]&&_.default.compareMajorMinorVersions(a[c],o)>-1&&(u=r[c],l=u&&(u[o]||u["".concat(o,".0")]),d=l&&l.find(function(e){return void 0===e.productLanguage||e.productLanguage===i}),u&&l&&d||(n.disk("App NOT found, Adding : ",c,o,i),s.push({productCode:c,productVersion:o,productLanguage:i})));case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 9:return e.abrupt("return",s);case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getExcessProductList",value:function(){var e=o()(h.a.mark(function e(t){var r,n,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=[],Object.values(t).forEach(function(e){Object.values(e).forEach(function(e){r.push.apply(r,a()(e))})}),e.next=4,F.getSpecifiers();case 4:return n=e.sent,s=[],e.next=8,Promise.all(Object.keys(n).map(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=_.default.getProductAlias(t),Object.keys(n[t]).map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r&&t&&s.push({productCode:r,productVersion:t});case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 8:return e.abrupt("return",r.filter(function(e){return!s.find(function(t){return t.productCode===e.productCode&&(t.productVersion===e.productVersion||e.productVersion===t.productVersion+".0")})}));case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getStockCollectionUrl",value:function(e){var t=e.id,r=e.params,n=e.options,a=e.map,s=v.default.getEnvironment(),o=new D.URL(v.default.get("COLLECTION_URL_".concat(s.LABEL.toUpperCase()),a.type));return r.productCode&&o.searchParams.set("product",r.productCode),r.productLanguage&&o.searchParams.set("locale",r.productLanguage),r.countryCode&&o.searchParams.set("country_code",r.countryCode),o.searchParams.set("search_parameters[offset]",n.offset||"0"),o.searchParams.set("search_parameters[gallery_id]",t),o.searchParams.set("search_parameters[limit]",n.limit||"100"),o.searchParams.set("ff_9909481692","1"),o.searchParams.set("search_parameters[enable_templates]",n.enable_templates||"1"),o.toString()}},{key:"downloadStockCollection",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,E,m,g,O,S,I,C;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.id,n=t.params,a=t.map,s=t.force,i=void 0===s?{type:"none"}:s,c=t.priority,u=t.options,l=void 0===u?{}:u,d=new P.default(v.default.analytics.AGGREGATE_ERROR,"CollectionTemplates"+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),f=0,p=0,E=new y.default({prefix:"LookupMapUtils > ".concat(a.type),payload:{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",a.type)}}),(m=new L.a(c)).channel=L.b.CollectionTemplates,g=this.getStockCollectionUrl({id:r,params:n,options:l,map:a}),e.next=10,a.fetchAsset({href:g,priority:m,force:i,params:n,assetsDir:a.assetsDir,headers:{"X-API-Key":v.default.getEnvironment().CLIENT_ID,"X-Product":"".concat(n.productCode),"Content-Type":"application/json"}}).catch(function(e){return d.addSubError({err:e,url:g}),{time:0,path:void 0}});case 10:if(O=e.sent,f+=O.time,p++,!(S=O.path)){e.next=22;break}return I="".concat(a.getPath(),"/").concat(S),e.next=18,T.readJSON(I).catch(function(e){E.error(new P.default("filesystem",e)),d.addSubError({err:e,id:r,url:S})});case 18:if(C=e.sent,!Array.isArray(null==C?void 0:C.files)){e.next=22;break}return e.next=22,_.default.waitAll(C.files.map(function(){var e=o()(h.a.mark(function e(t){var r,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==t||!t.thumbnail_url||null==t||null===(r=t.thumbnail_url)||void 0===r||!r.startsWith("http")){e.next=7;break}return e.next=3,a.fetchAsset({href:t.thumbnail_url,priority:m,force:U(U({},i),{},{depth:i.depth-1}),params:n,assetsDir:a.assetsDir}).catch(function(e){return d.addSubError({url:null==t?void 0:t.thumbnail_url,err:e}),{time:0,path:null==t?void 0:t.thumbnail_url}});case 3:s=e.sent,t.thumbnail_url=s.path,f+=s.time,p++;case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N.writeJsonAtomic(A.dirname(I)+"/",A.basename(I),C,!0);case 2:if(!(t=e.sent)||t===I){e.next=8;break}return S=A.basename(A.dirname(t))+"/"+A.basename(I),a.cachedAsset(g).path=S,e.next=8,a.save();case 8:case"end":return e.stop()}},e)})));case 22:if(!d.hasSubErrors&&S){e.next=24;break}throw d.assignSubErrors({id:r});case 24:return e.abrupt("return",{path:S,time:f,count:p});case 25:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getTutorialUrl",value:function(e){var t=e.id,r=e.productLanguage,n=void 0===r?"en_US":r,a=e.status,s=void 0===a?"live":a,o=e.productVersion,i=e.surface,c=void 0===i?"in_app_panel:v2":i,u=new D.URL(v.default.getEnvironment().UTUTS_SERVICE);return u.searchParams.set("aem_id",t),u.searchParams.set("locale",n),u.searchParams.set("inline_surface",c),u.searchParams.set("status",s),o&&u.searchParams.set("app_version",o),u.toString()}},{key:"downloadTutorial",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,E,m,g,O,S,I,C,R,x,k,b;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.id,a=t.url,s=t.priority,i=t.force,c=void 0===i?{type:"none"}:i,u=t.analyticsData,l=t.filePrefix,d=t.status,f=void 0===d?"live":d,p=t.map,E=new P.default(v.default.analytics.AGGREGATE_ERROR,"Ututs"+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),m=0,g=0,O=new y.default({prefix:"LookupMapUtils > ".concat(p.type),payload:{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",p.type)}}),S=U(U({},r),{},{filePrefix:l}),(I=new L.a(s)).channel=L.b.Lcm,C=null!=a?a:this.getTutorialUrl({id:n,productLanguage:null==r?void 0:r.productLanguage,status:f,productVersion:null==r?void 0:r.productVersion,surface:v.default.get("UTUTS_API_REQUEST_SURFACE",p.type)}),e.next=11,p.fetchAsset({href:C,analyticsData:u,priority:I,force:c,params:S,assetsDir:p.assetsDir,headers:{"X-API-Key":v.default.getEnvironment().CLIENT_ID}}).catch(function(e){return E.addSubError({err:e,url:C}),{time:0,path:void 0}});case 11:if(R=e.sent,m+=R.time,g++,!(x=R.path)){e.next=23;break}return k="".concat(p.getPath(),"/").concat(x),e.next=19,T.readJSON(k).catch(function(e){O.error(new P.default("filesystem",e)),E.addSubError({err:e,id:n,url:x})});case 19:if(b=e.sent,!Array.isArray(null==b?void 0:b.tutorials)){e.next=23;break}return e.next=23,_.default.waitAll(b.tutorials.map(function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==t||null===(r=t.metadata)||void 0===r||null===(n=r.images)||void 0===n||!n.hero){e.next=7;break}return e.next=3,p.fetchAsset({href:t.metadata.images.hero,analyticsData:u,priority:I,force:U(U({},c),{},{depth:c.depth-1}),params:S,assetsDir:p.assetsDir}).catch(function(e){var r,n;return E.addSubError({url:null==t?void 0:null===(r=t.metadata)||void 0===r?void 0:null===(n=r.images)||void 0===n?void 0:n.hero,err:e}),{time:0,path:void 0}});case 3:o=e.sent,t.metadata.images.heroPath=o.path,m+=o.time,g++;case 7:if(null==t||null===(a=t.metadata)||void 0===a||null===(s=a.images)||void 0===s||!s.thumbnail){e.next=14;break}return e.next=10,p.fetchAsset({href:t.metadata.images.thumbnail,analyticsData:u,priority:I,force:U(U({},c),{},{depth:c.depth-1}),params:S,assetsDir:p.assetsDir}).catch(function(e){var r,n;return E.addSubError({err:e,url:null==t?void 0:null===(r=t.metadata)||void 0===r?void 0:null===(n=r.images)||void 0===n?void 0:n.thumbnail}),{time:0,path:void 0}});case 10:i=e.sent,t.metadata.images.thumbnailPath=i.path,m+=i.time,g++;case 14:return e.next=16,N.writeJsonAtomic(A.dirname(k)+"/",A.basename(k),b,!0);case 16:if(!(l=e.sent)||l===k){e.next=22;break}return x=A.basename(A.dirname(l))+"/"+A.basename(k),p.cachedAsset(C).path=x,e.next=22,p.save();case 22:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 23:if(!E.hasSubErrors&&x){e.next=25;break}throw E.assignSubErrors({id:n});case 25:return e.abrupt("return",{path:x,time:m,count:g});case 26:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),e}(),j=r(28),G=r(23),H=r(22),B=r.n(H),X=r(14),K=r.n(X),Y=r(15),q=r.n(Y),W=r(6),J=r.n(W),Q=r(46),z=r.n(Q),Z=r(9),$=r.n(Z),ee=r(18),te=r(47),re=r(31),ne=r(27),ae=r(48),se=r.n(ae),oe=r(33),ie=r.n(oe),ce=r(17);function ue(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return le(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return le(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(i)throw s}}}}function le(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}function de(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function fe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?de(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):de(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function pe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var he=function(e){K()(r,e);var t=pe(r);function r(e){var n;return c()(this,r),n=t.call(this),f()($()(n),"_data",void 0),f()($()(n),"_type",void 0),f()($()(n),"_path",void 0),f()($()(n),"_fileName",void 0),f()($()(n),"_downloadManager",void 0),f()($()(n),"_diskLock",void 0),f()($()(n),"_syncLock",void 0),f()($()(n),"log",void 0),f()($()(n),"gc",void 0),f()($()(n),"_syncTimeout",void 0),f()($()(n),"fetchOnDemandContent",void 0),f()($()(n),"fetchAsset",void 0),f()($()(n),"_fetchCollectionData",void 0),f()($()(n),"fetchCollectionIndex",void 0),f()($()(n),"_saveInProgress",!1),f()($()(n),"_calledSave",!1),f()($()(n),"abortControllers",{}),v.default.patch(e.LABEL,e||{}),n._type=e.LABEL,n._path=A.join(v.default.get("ROOT_DIR"),v.default.get("DIR",n.type)),n._fileName=v.default.get("LOOKUP_MAP_FILE",n.type)||v.default.get("LOOKUP_MAP_FILE"),n._downloadManager=null,n._diskLock=new L.d,n._syncLock=new L.d(9999),n.log=new y.default({prefix:"".concat(v.default.get("LOG_PREFIX",n.type),"LookupMap > "),payload:{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",n.type)}}),n.fetchOnDemandContent=_.default.memoize(_.default.retryLocalErrors(n._fetchOnDemandContent.bind($()(n))),{refresher:function(e){return"pending"!==e.state},resolver:function(e){return n.paramsToOnDemandId(e)},destructor:function(e,t){return"pending"!==t.state}}),n.fetchAsset=_.default.memoize(_.default.retryLocalErrors(n._fetchAsset.bind($()(n))),{refresher:function(e){return"pending"!==e.state},resolver:function(e){return e.key||e.href},wrapper:function(e,t,r){var a=e[0]||{};return a.force&&a.force.type&&r&&["stale","always"].includes(a.force.type)?t.then(function(){return n._fetchAsset(a)}):t},destructor:function(e,t){return"pending"!==t.state}}),n._fetchCollectionData=_.default.memoize(n._fetchCollectionDataRaw,{refresher:function(e){return"pending"!==e.state},resolver:function(e){return n.paramsToId(e.params,!1)},wrapper:function(e,t,r){var a=e[0]||{};return a.force&&a.force.type&&r&&["stale","always"].includes(a.force.type)?t.then(function(){return n._fetchCollectionData(a)}):t},destructor:function(e,t){return"pending"!==t.state}}),n.fetchCollectionIndex=_.default.retryLocalErrors(n.fetchCollectionIndexRaw.bind($()(n))),n.gc=_.default.memoize(n._gc,{refresher:function(e){return"pending"!==e.state},destructor:function(e,t){return"pending"!==t.state}}),n}return l()(r,[{key:"isSyncInProgress",value:function(e){var t=this._fetchCollectionData.cache&&this._fetchCollectionData.cache.get(e);return t&&"pending"===t.state}},{key:"paramsToIdRaw",value:function(e){var t=this._getCollectionInfo(e);if(t&&t.pendingId)return t.pendingId;if(t&&t.latestId){var r=this._data.metadata[t.latestId];if(_.default.getTimeToExpiry(null==r?void 0:r.expiryTime)>0)return t.latestId}}},{key:"paramsToId",value:function(e){var t,r,n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],a=this.paramsToIdRaw(e);if(a)return a;var s=this.generateId(e);return this._addNewCollectionInfo({params:e,isPending:!0,collectionId:s,file:null===(t=this._data)||void 0===t?void 0:null===(r=t.metadata[s])||void 0===r?void 0:r.path}),n?this.save().then(function(){return s}):(this.save(),s)}},{key:"generateId",value:function(e){return[e.filePrefix,e.productCode,e.productVersion,e.productLanguage,C.v4()].filter(function(e){return!!e}).join("-").trim()}},{key:"expireAll",value:function(){var e=o()(h.a.mark(function e(t){var r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._data){e.next=2;break}return e.abrupt("return");case 2:return Object.keys(this._data.metadata).forEach(function(e){t&&t===r._data.metadata[e].userId&&delete r._data.metadata[e].expiryTime}),e.next=5,this.save();case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"forceRefresh",value:function(){var e=o()(h.a.mark(function e(t){var r,n,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=a()(Object.values(t)),n=this.getIdsByKeys(r),e.next=4,Promise.all(n.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,s.expireOne(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getIdsByKeys",value:function(e){var t=[],r=e.reduce(function(e,r){return e[r]?e[r]:(t.push(r),e)},this._data.versionInfo[S.default.getUserId()]),n=[];if(r.lastUsedId&&n.push(r.lastUsedId),r.pendingId&&n.push(r.pendingId),r.lastDisplayedId&&n.push(r.lastDisplayedId),r.latestId&&n.push(r.latestId),n.length>0)return n;var a=new Set;return function e(r){var s=!1;r.lastUsedId&&(n.push(r.lastUsedId),s=!0),r.pendingId&&(n.push(r.pendingId),s=!0),r.lastDisplayedId&&(n.push(r.lastDisplayedId),s=!0),r.latestId&&(n.push(r.latestId),s=!0);var o=Object.keys(r).some(function(e){return"object"===z()(r[e])});if(!s&&o){var i=Object.keys(r),c=t.find(function(e){return!!r[e]});c?(a.add(c),e(r[c])):i.forEach(function(t){return e(r[t])})}}(r),t.length>a.size?[]:n}},{key:"expireOne",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:e.prev=0,delete this._data.metadata[t].expiryTime,e.next=7;break;case 4:return e.prev=4,e.t0=e.catch(0),e.abrupt("return");case 7:return e.next=9,this.save();case 9:case"end":return e.stop()}},e,this,[[0,4]])}));return function(t){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.makeVersionLookupKey(e.productVersion),n=[t||S.default.getUserId()];return n.push(e.productCode,r,e.productLanguage),n}},{key:"makeVersionLookupKey",value:function(e){var t=e&&e.split(".");return t&&"".concat(t[0],".").concat(t[1])}},{key:"_getCollectionInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){var r=this._getLookupKeys(e,t),n=this._data.versionInfo;return r.forEach(function(e){n&&(n=n[e])}),n}}},{key:"_setCollectionInfo",value:function(e,t){var r=this._getLookupKeys(e),n=this._data.versionInfo;return r.forEach(function(e,a){a===r.length-1?n[e]=t:(n[e]=n[e]||{},n=n[e])}),n}},{key:"_isDataReferenced",value:function(e){var t=this._data.metadata[e],r=t&&this._getCollectionInfo(t.params,t.userId);return!!r&&!!Object.keys(r).find(function(t){return e===r[t]})}},{key:"_isDataPrimaryReference",value:function(e){var t=this._data.metadata[e],r=t&&this._getCollectionInfo(t.params,t.userId);if(r){if(r.pendingId)return e===r.pendingId;if(r.latestId)return e===r.latestId}return!1}},{key:"_checkValidity",value:function(e,t){}},{key:"_addNewCollectionInfo",value:function(e){var t=this,r=e.params,n=e.isPending,a=e.collectionId,s=e.expiry,o=e.retry,i=e.cause,c=void 0===i?"Unknown":i,u=e.refreshTime,l=e.file,d=e.subErrors,f=this._getCollectionInfo(r)||{},p=new Date,h=void 0;return Object.values(f).forEach(function(e){var r=t._data.metadata[e];if(r&&r.lastUseTime){var n=new Date(r.lastUseTime);!isNaN(n.getTime())&&n>p&&(p=n)}!o&&null!=r&&r.retry&&(o=r.retry),h=h||(null==r?void 0:r.delay),r&&delete r.delay}),!n&&h&&u&&new Date(u)>new Date(h.expiryTime)?h=void 0:n&&h&&new Date>new Date(h.expiryTime)&&(h=void 0),n?f.pendingId=a:(f.latestId=a,delete f.pendingId),this._setCollectionInfo(r,f),this._data.metadata[a]={expiryTime:s?s.toISOString():void 0,userId:S.default.getUserId(),lastUseTime:p.toISOString(),retry:o,cause:c,params:r,refreshTime:u,path:null!=l?l:n?void 0:"".concat(a,".json"),subErrors:d,delay:h},this._data.metadata[a]}},{key:"sanitizeParams",value:function(e){return e.productLanguage=_.default.sanitizeLocale(e.productLanguage),e}},{key:"isRequestPoisoned",value:function(e){var t=v.default.get("SUPPORTED_PRODUCTS",this.type);return!(e.productCode&&t[e.productCode]&&_.default.compareMajorMinorVersions(t[e.productCode],e.productVersion)>-1)}},{key:"_calculateExpiry",value:function(e,t){var r,n=e?e.expiryTime:void 0;if(n){r=new Date(n);var a=new Date;a.setMilliseconds(v.default.get("MAX_TIMEOUT")),r>a&&(r=a);var s=new Date;s.setMilliseconds(v.default.get("MIN_TIMEOUT")),r<s&&(r=s)}return r}},{key:"_calculateBackOffMetadata",value:function(e){var t=e.metadata,r=e.error,n=e.updateBackOff,a=void 0===n||n,s=e.initialRetry,o=void 0===s?v.default.get("SYNC_INITIAL_RETRY"):s,i="killed before response",c=r;if(c&&c.responseHeaders){var u=re.a.getRetryAfterHeader(c.responseHeaders);u&&(o=1e3*u)}else null!=t&&t.retry&&(o=t.retry*(a?2:1),o=Math.max(v.default.get("SYNC_INITIAL_RETRY"),o));o=Math.min(o,v.default.get("MAX_BACK_OFF")),c&&(i=c.short?c.short:c.message?null==c?void 0:c.message:c.toString(),c.code&&"403012"===c.code.toString()&&(o=v.default.get("EMBARGO_BACK_OFF")));var l=new Date;return l.setMilliseconds(o),{expiry:l,retry:o,cause:i,subErrors:null==r?void 0:r.subErrorJSON}}},{key:"fetchCollectionIndexRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,y,E,m,g=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=t.requestId,s=t.desiredId,o=t.params,i=t.oldMetadata,c=t.priority,u=t.force,l=t.skipAuth,d=void 0!==l&&l,f=this._createCollectionData(s),p=!0,e.next=5,f.load({version:this.getClientVersion(o,this.type),file:null===(r=this._data)||void 0===r?void 0:null===(n=r.metadata[s])||void 0===n?void 0:n.path}).then(function(){var e;null!==(e=g._data)&&void 0!==e&&e.metadata[s]&&(g._data.metadata[s].path=f.fileName)}).catch(function(e){p=!1});case 5:if(p&&_.default.isDateExpired(f.expiryTime)&&(p=!1),p&&f.isDefaultData&&(p=!1),y=i&&i.refreshTime,p&&("stale"===u.type&&_.default.isDateExpired(null==i?void 0:i.expiryTime)?p=!1:"always"===u.type&&(p=!1)),p&&!d){e.next=24;break}return e.next=12,this.downloadManager.downloadCollectionData({id:a,params:o,priority:c,skipAuth:d});case 12:if((E=e.sent)._ccx=E._ccx||{},E._ccx.version=v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type),!(m=f.setData(E,this.getClientVersion(o,this.type)))){e.next=18;break}throw m;case 18:return e.next=20,f.save();case 20:return y=(new Date).toISOString(),this._data.metadata[s]&&(this._data.metadata[s].path=f.fileName,this._data.metadata[s].refreshTime=y),e.next=24,this.save();case 24:return this._checkValidity(f,o),e.abrupt("return",f);case 26:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"defaultCollectionData",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.params,t.desiredId,e.abrupt("return",void 0);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"_fetchCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=void 0===r?{}:r,a=t.priority,s=void 0===a?void 0:a,i=t.payload,c=void 0===i?void 0:i,u=t.force,l=void 0===u?{type:"none"}:u,d=t.fetchType,f=void 0===d?"pre-fetch":d,S.default.getUserId()){e.next=3;break}throw new P.default("signed out").silence();case 3:return n=this.sanitizeParams(n),e.next=6,this._syncLock.read(o()(h.a.mark(function e(){var t,r,a,i,u,d,y,E,m,g,O,T,A;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ee.b.status!==ee.b.OFFLINE){e.next=3;break}throw p.log.disk("Not downloading collection - offline"),new P.default("offline").silence();case 3:if(!w.b.isWaitingForBackOff(w.a.NETWORK)){e.next=5;break}throw new P.default("Awaiting global back-off ".concat(w.b.backOffCause(w.a.NETWORK))).silence();case 5:return e.next=7,p.paramsToId(n);case 7:if(a=e.sent,i=p._getCollectionInfo(n),u=a,!i||a!==i.latestId){e.next=19;break}if("always"===l.type){e.next=15;break}return e.abrupt("return",p._createCollectionData(a));case 15:try{delete p._data.metadata[a].expiryTime}catch(e){p.log.disk("Failed to find desiredId ".concat(a," for deletion."))}return e.next=18,p.paramsToId(n);case 18:a=e.sent;case 19:if(d=function(e){p.emit(a,e),u!==a&&p.emit(u,e)},(s=s||p.priority({params:n,key:a})).key=a,!p.isRequestPoisoned(n)){e.next=24;break}throw new P.default("Poisoned request not supported.").silence();case 24:if(!(y=Object.assign({},p._data.metadata[a]))||_.default.isDateExpired(y.expiryTime)||"none"!==l.type){e.next=30;break}throw E="Waiting for back-off ".concat(y.cause," for ").concat(_.default.getHumanReadableTime(y.retry||0)," expiring at ").concat(y.expiryTime," in ").concat(_.default.getHumanReadableTime(new Date(y.expiryTime).getTime()-Date.now())),p.log.context({params:n}).disk(E),new P.default(E).silence();case 30:return p._addNewCollectionInfo(fe(fe({params:n,isPending:!0,collectionId:a,refreshTime:y.refreshTime},p._calculateBackOffMetadata({metadata:p._data.metadata[a],initialRetry:v.default.get("KILLED_BEFORE_RESPONSE_INITIAL_RETRY")})),{},{file:null===(t=p._data)||void 0===t?void 0:null===(r=t.metadata[a])||void 0===r?void 0:r.path})),e.next=33,p.save();case 33:return m=C.v4(),e.next=36,p.downloadManager.url(n);case 36:return g=e.sent,O=new D.URL(g).origin,e.next=40,j.a.getNodeTunnelOptionsForURL(O);case 40:return T=e.sent.details,A=p.log.context({params:n,payload:fe(fe({},c),{},{"exp.request_guid":m,"event.url":g,"content.action":g,"event.subtype":v.default.analytics.st_API,"ccxp.mode":f,"ccxp.request_type":"get","ccxp.proxy":T},p.downloadManager.additionalAnalytics(n))}),e.next=44,A.request(function(){var e=o()(h.a.mark(function e(t){var r,i,c,u,f,_,E;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,d(r={}),i={requestId:m,params:n,desiredId:a,oldMetadata:y,force:l,priority:s},e.next=6,p.fetchCollectionIndex(i).catch(function(){var e=o()(h.a.mark(function e(t){var r,s,c,u;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,"401013"!==(null==t?void 0:null===(r=t.code)||void 0===r?void 0:r.toString())){e.next=10;break}return p.log.context({params:n}).error(new P.default("Retrying with fresh token",t)),S.default.reset(),e.next=6,w.b.updateBackOff({clear:!0,type:w.a.AUTH,sync:!1});case 6:return e.next=8,p.fetchCollectionIndex(i).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:throw t;case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 8:return s=e.sent,e.abrupt("return",s);case 10:e.next=15;break;case 12:e.prev=12,e.t0=e.catch(0),p.log.context({params:n}).error(new P.default("Auth retry failed",e.t0));case 15:if(e.t1=!v.default.get("ANONYMOUS_RETRY_DISABLED",p.type),!e.t1){e.next=20;break}return e.next=19,S.default.getAccessToken().catch(function(e){return!1});case 19:e.t1=!!e.sent;case 20:if(!e.t1){e.next=33;break}return i.skipAuth=!0,p.log.context({params:n}).error(new P.default("Attempting Context only (bypass)",t)),e.next=25,p.fetchCollectionIndex(i).catch(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(v.default.get("DEFAULT_URLS_ENABLED",p.type)){e.next=2;break}throw t;case 2:return p.log.context({params:n}).error(new P.default("Attempting Default URL (bypass)",t,"X_ERR_DEFAULT_URL_BYPASS")),e.next=5,p.defaultCollectionData({params:n,desiredId:a});case 5:if(r=e.sent){e.next=8;break}throw t;case 8:return e.next=10,r.save();case 10:return e.abrupt("return",r);case 11:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 25:if(c=e.sent){e.next=28;break}throw t;case 28:return e.next=30,c.save();case 30:return e.abrupt("return",c);case 33:if(v.default.get("DEFAULT_URLS_ENABLED",p.type)){e.next=35;break}throw t;case 35:return p.log.context({params:n}).error(new P.default("Attempting Default URL (bypass)",t,"X_ERR_DEFAULT_URL_BYPASS")),e.next=38,p.defaultCollectionData({params:n,desiredId:a});case 38:if(u=e.sent){e.next=41;break}throw t;case 41:return e.next=43,u.save();case 43:return e.abrupt("return",u);case 44:case"end":return e.stop()}},e,null,[[0,12]])}));return function(t){return e.apply(this,arguments)}}());case 6:return c=e.sent,p.downloadManager.applyResponseAnalytics(t,c.data,n),r.path="".concat(p._path+c.fileName),r.contentId=c.id,r.total=c.totalItems,p._data.metadata[c.id]&&(p._data.metadata[c.id].path=c.fileName),d(r),e.next=15,c.sync({priority:s,payload:t.options.payload,params:n,progress:function(e){function t(t){return e.apply(this,arguments)}return t.toString=function(){return e.toString()},t}(function(e){r.path="".concat(p._path+c.fileName),d(Object.assign(e,r))}),force:l});case 15:return p._checkValidity(c,n),p._addNewCollectionInfo({params:n,isPending:!1,collectionId:c.id,expiry:p._calculateExpiry(c,n),refreshTime:p._data&&p._data.metadata[a]&&p._data.metadata[a].refreshTime,file:c.fileName}),e.next=19,p.save();case 19:return p.emit("newCollection",n,c),e.abrupt("return",c);case 23:return e.prev=23,e.t0=e.catch(0),p._addNewCollectionInfo(fe(fe({params:n,isPending:!0,collectionId:a,refreshTime:p._data.metadata[a].refreshTime},p._calculateBackOffMetadata({metadata:p._data.metadata[a],error:e.t0,updateBackOff:!1})),{},{file:null===(u=p._data)||void 0===u?void 0:null===(f=u.metadata[a])||void 0===f?void 0:f.path})),e.next=28,p.save();case 28:throw e.t0 instanceof P.default&&(e.t0.supportData={id:a,path:null===(_=p._data)||void 0===_?void 0:null===(E=_.metadata[a])||void 0===E?void 0:E.path}),e.t0;case 30:case"end":return e.stop()}},e,null,[[0,23]])}));return function(t){return e.apply(this,arguments)}}());case 44:return e.abrupt("return",e.sent);case 45:case"end":return e.stop()}},e)})),s).catch(function(){var e=o()(h.a.mark(function e(t){var r,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t instanceof P.default)||t.supportData||t.hasSubErrors){e.next=7;break}return e.next=3,p.paramsToId(n);case 3:r=e.sent,a=p._data.metadata[r],t.addSubErrors(null==a?void 0:a.subErrors),null!=a&&a.path&&(t.supportData={id:r,path:null==a?void 0:a.path});case 7:throw t;case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_clearScheduledSyncJob",value:function(){this._syncTimeout&&(clearTimeout(this._syncTimeout),delete this._syncTimeout)}},{key:"_scheduleNextSyncJob",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=1/0,this._clearScheduledSyncJob(),!w.b.isWaitingForBackOff(w.a.NETWORK)){e.next=8;break}return n=new Date(w.b.backOffExpiry(w.a.NETWORK)).getTime()-(new Date).getTime(),this.log.disk("Scheduling next sync in ".concat(_.default.getHumanReadableTime(n)," after global backoff")),n=Math.min(v.default.get("MAX_TIMEOUT"),n),this._syncTimeout=setTimeout(function(){a.sync.bind(a)().catch(function(e){a.log.disk("Error syncing after content backoff for ".concat(a.type),e)})},n),e.abrupt("return");case 8:return e.next=10,_.default.waitAll(Object.keys(this._data.metadata).map(function(){var e=o()(h.a.mark(function e(t){var r,s,o,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=a._data.metadata[t],s=r.params,!a.needsSync(t,{checkExpiry:!1})){e.next=14;break}if(o=_.default.getTimeToExpiry(r.expiryTime),r.delay&&(i=_.default.getTimeToExpiry(r.delay.expiryTime),0===o&&(o=i),n=Math.min(n,i)),0!==o){e.next=13;break}return o=v.default.get("SYNC_INITIAL_RETRY"),(c=new Date).setMilliseconds(o),r.expiryTime=c.toISOString(),e.next=12,a.save();case 12:a.log.context({params:s}).info(v.default.analytics.EXPIRED_DATA,"Scheduling with expired data. Add back-off for ".concat(s.productCode,"[").concat(s.productLanguage,"] - ").concat(r.expiryTime));case 13:n=Math.min(n,o);case 14:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 10:return e.next=12,_.default.waitAll(Object.values(null!==(t=null===(r=this._data)||void 0===r?void 0:r.onDemandMetadata)&&void 0!==t?t:{}).map(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:"notReady"!==a.getOnDemandCollectionInfo(t.params)||a.isOnDemandSyncInProgress(a.paramsToOnDemandId(t.params))||(r=_.default.getTimeToExpiry(t.expiryTime),n=Math.min(n,r));case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 12:if(n!==1/0){e.next=14;break}return e.abrupt("return");case 14:n+=_.default.getRandomizedTime(n<v.default.get("TIME_FOR_SHORT_RANDOMIZE")),n=Math.min(n,v.default.get("MAX_TIMEOUT")),this.log.disk("Scheduling next sync in ".concat(_.default.getHumanReadableTime(n)," at ").concat(new Date(Date.now()+n).toISOString())),this._syncTimeout=setTimeout(function(){a.sync.bind(a)().catch(function(e){a.log.disk("Error syncing content for ".concat(a.type),e)})},n);case 18:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_getReferencedIdList",value:function(){var e=this,t={};return Object.keys(this._data.metadata).forEach(function(r){e._isDataReferenced(r)&&(t[r]=!0)}),t}},{key:"_isPendingCollection",value:function(e){var t=this._data.metadata[e],r=t&&this._getCollectionInfo(t.params,t.userId);return!(!r||!r.pendingId)&&e===r.pendingId}},{key:"_refetchCollection",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=this._data.metadata,!(n=r[t]&&r[t].params)){e.next=8;break}return this.clearCollectionInfo(n,t,!1),this.log.disk("Refetch collection [".concat(t,"]")),e.next=7,this.addNewCollectionData({params:n}).catch(function(e){return a.log.context({params:n}).error(new P.default("Error Re-fetching collection",e))&&void 0});case 7:return e.abrupt("return",e.sent);case 8:return e.abrupt("return",Promise.resolve());case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getReferencedAssetList",value:function(){var e=o()(h.a.mark(function e(t){var r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={},e.next=3,_.default.waitAll(Object.keys(t).map(function(){var e=o()(h.a.mark(function e(t){var a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=n._createCollectionData(t),e.prev=1,o=n.getClientVersion(n._data.metadata[t].params,n.type),e.next=5,a.load({version:o,skipSaving:!0,file:null===(s=n._data.metadata[t])||void 0===s?void 0:s.path});case 5:return e.t0=Object,e.t1=r,e.next=9,a.getReferencedAssets();case 9:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2),e.next=22;break;case 13:if(e.prev=13,e.t3=e.catch(1),"ENOENT"!==e.t3.code&&e.t3.code!==m.default.INVALID_COLLECTION){e.next=21;break}n.log.disk("File is missing for collection [".concat(a.id,"]")),(i=n._data.metadata[a.id])&&i.userId===S.default.getUserId()&&n._isDataPrimaryReference(a.id)&&!n._isPendingCollection(a.id)&&n._refetchCollection(a.id),e.next=22;break;case 21:throw e.t3;case 22:case"end":return e.stop()}},e,null,[[1,13]])}));return function(t){return e.apply(this,arguments)}}()));case 3:return e.abrupt("return",r);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"_cleanupCache",value:function(e,t){var r,n=this,a=this._data.metadata;Object.keys(a).forEach(function(r){var s,o;n._isDataPrimaryReference(r)||e[r]&&t.includes(null!==(s=null===(o=n._data.metadata[r])||void 0===o?void 0:o.path)&&void 0!==s?s:"".concat(r,".json"))||delete a[r]});var s=null!==(r=this._data.onDemandMetadata)&&void 0!==r?r:{};Object.keys(s).forEach(function(e){n.getOnDemandCollectionInfo(s[e].params,s[e].userId)||delete s[e]})}},{key:"_cleanupAssetsCache",value:function(e,t){var r=this._data.assetMetadata;Object.keys(r).forEach(function(n){var a=r[n];a.path&&(e[a.path]&&t.includes(A.basename(a.path))||delete r[n])})}},{key:"setData",value:function(e){var t=_.default.validateDataFields(e,v.default.get("MAP_DATA_SCHEMA"));return t?this.log.error(new P.default(m.default.DATA_VALIDATION_ERR,t[0])):this._data=e,t}},{key:"getMinorVersion",value:function(e,t,r,n){var a=Object.keys(n.metadata).find(function(a){var s,o,i=null===(s=n.metadata[a])||void 0===s?void 0:s.params;return(null==i?void 0:i.productCode)===t&&(null==i?void 0:i.productVersion.split(".")[0])===r&&(null===(o=n.metadata[a])||void 0===o?void 0:o.userId)===e});if(!a)return null;var s=n.metadata[a].params.productVersion;return this.makeVersionLookupKey(s)}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null);case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getTutorialAssets",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{});case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getCollectionAsset",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",{});case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,T.readJson(this._path+this._fileName).catch(function(e){n.log.disk("Failed to load lookup file from disk: ".concat(n._fileName," - ").concat(e))});case 2:if(t=e.sent,r=!1,t){e.next=8;break}this.log.disk("Empty lookup file: ".concat(this._fileName)),e.next=14;break;case 8:if(t.version===v.default.get("LOOKUP_MAP_FILE_VERSION",this._type)){e.next=14;break}return this.log.disk("Lookup file version mismatch: ".concat(this._fileName)),e.next=12,this.upgrade(t).catch(function(e){return null});case 12:t=e.sent,r=!0;case 14:if(t&&!this.setData(t)||((t={}).version=v.default.get("LOOKUP_MAP_FILE_VERSION",this._type),t.versionInfo={},t.metadata={},t.assetMetadata={},t.usersInfo={},t.onDemand={},t.onDemandMetadata={},this.setData(t)),t.onDemand||(t.onDemand={},t.onDemandMetadata={},r=!0),!r){e.next=19;break}return e.next=19,this.save();case 19:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getPath",value:function(){return this._path}},{key:"updateDisplayedId",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,!(n=t.displayed)||!r){e.next=10;break}if(s=null!==(a=Object.keys(this._data.metadata).find(function(e){return i._data.metadata[e].path===n}))&&void 0!==a?a:A.basename(n,".json"),(o=this._getCollectionInfo(r))||(this._addNewCollectionInfo({params:r,isPending:!1,collectionId:s,file:n}),o=this._getCollectionInfo(r)),!o||o.lastDisplayedId===s){e.next=10;break}return o.lastDisplayedId=s,this._setCollectionInfo(r,o),e.next=10,this.save();case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"validateParams",value:function(e){var t=_.default.validateDataFields(e,v.default.get("PARAMETERS_SCHEMA",this.type));if(t)throw new P.default(v.default.analytics.PARAM_VALIDATION_ERR,t[0])}},{key:"getPending",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.updateLastUseTime,r){e.next=5;break}return a=new P.default(m.default.DATA_VALIDATION_ERR,"No data to get the path for in LookupMap"),this.log.error(a),e.abrupt("return");case 5:e.prev=5,this.validateParams(r),e.next=13;break;case 9:return e.prev=9,e.t0=e.catch(5),this.log.error(new P.default(e.t0,"No data to get the path for in LookupMap")),e.abrupt("return");case 13:if(s=!1,o=void 0,i=void 0,!(c=this._getCollectionInfo(r))){e.next=25;break}if(u=[c.partialId,c.latestId,c.pendingId].reduce(function(e,t){var r,n;return e?t?new Date((null===(r=l._data.metadata[e])||void 0===r?void 0:r.refreshTime)||0)>new Date((null===(n=l._data.metadata[t])||void 0===n?void 0:n.refreshTime)||0)?e:t:e:t}),o=u&&this._data.metadata[u].path,i=u&&this._data.metadata[u].subErrors,n&&((u&&this._data.metadata[c.pendingId?c.pendingId:u]||{}).lastUseTime=(new Date).toISOString(),s=!0),!s){e.next=25;break}return e.next=25,this.save();case 25:return e.abrupt("return",{partial:o,failures:i});case 26:case"end":return e.stop()}},e,this,[[5,9]])}));return function(t){return e.apply(this,arguments)}}()},{key:"updatePending",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.id,a=t.updateLastUseTime,s=t.err,r){e.next=5;break}return o=new P.default(m.default.DATA_VALIDATION_ERR,"No data to get the path for in LookupMap"),this.log.error(o),e.abrupt("return");case 5:if(this.validateParams(r),i=!1,!(c=this._getCollectionInfo(r))){e.next=14;break}if(c.partialId!==n&&(c.partialId=n,this._data.metadata[n]=this._data.metadata[n]||{},this._data.metadata[n].subErrors=s.subErrorJSON,i=!0),a&&((this._data.metadata[c.pendingId?c.pendingId:c.partialId]||{}).lastUseTime=(new Date).toISOString(),i=!0),!i){e.next=14;break}return e.next=14,this.save();case 14:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getLatestPath",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,_,y,E,g,O,T,A=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.updateLastUsedId,a=void 0!==n&&n,s=t.updateLastUseTime,o=void 0!==s&&s,r){e.next=5;break}return i=new P.default(m.default.DATA_VALIDATION_ERR,"No data to get the path for in LookupMap"),this.log.error(i),e.abrupt("return");case 5:if(this.validateParams(r),!(c=this._getCollectionInfo(r))||!c.latestId){e.next=17;break}if(d=!1,a&&c.latestId!==c.lastUsedId&&(c.lastUsedId=c.latestId,this._setCollectionInfo(r,c),d=!0),o&&(f=this._data.metadata[c.lastUsedId?c.lastUsedId:""]||{},p=f.lastUseTime,f.lastUseTime=(new Date).toISOString(),p&&((_=new Date(p)).setMilliseconds(v.default.get("STOP_SYNCING_BEYOND")),_<new Date&&this.sync().catch(function(e){A.log.disk("Error syncing outdated content ",e)})),d=!0),!d){e.next=14;break}return e.next=14,this.save();case 14:return(y=this._data.metadata[c.latestId])&&y.userId===S.default.getUserId()&&!this._isPendingCollection(c.latestId)&&((T=this._createCollectionData(c.latestId)).load({version:this.getClientVersion(r,this.type),file:null===(E=this._data)||void 0===E?void 0:null===(g=E.metadata[c.latestId])||void 0===g?void 0:g.path}).catch(function(e){"ENOENT"===e.code&&(A.log.disk("File is missing for collection [".concat(T.id,"]")),A._refetchCollection(T.id))}),null!==(O=this._data)&&void 0!==O&&O.metadata[c.latestId]&&(this._data.metadata[c.latestId].path=T.fileName)),e.abrupt("return",this._path+(null!==(u=null===(l=this._data.metadata[c.latestId])||void 0===l?void 0:l.path)&&void 0!==u?u:"".concat(c.latestId,".json")));case 17:return e.abrupt("return",void 0);case 18:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getExpiry",value:function(e){return this._data.metadata[e]&&this._data.metadata[e].expiryTime}},{key:"save",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._data){e.next=4;break}throw t=new P.default(m.default.DATA_VALIDATION_ERR,"No data to save to LookupMap."),this.log.error(t),t;case 4:if(!this._saveInProgress){e.next=7;break}return this._calledSave=!0,e.abrupt("return");case 7:return this._calledSave=!1,this._saveInProgress=!0,e.next=11,this._diskLock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N.writeJsonAtomic(r._path,v.default.get("LOOKUP_MAP_FILE"),r._data,!0);case 2:t=e.sent,A.basename(t)!==r._fileName&&(r._fileName=A.basename(t),v.default.set("LOOKUP_MAP_FILE",r._fileName,r.type));case 4:case"end":return e.stop()}},e)}))).catch(function(e){r.log.error(new P.default(e,"Error writing to ".concat(r._fileName)))});case 11:if(this._saveInProgress=!1,!this._calledSave){e.next=16;break}return e.next=15,this.save();case 15:this._calledSave=!1;case 16:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"cachedAsset",value:function(e){return this._data.assetMetadata[e]}},{key:"_fetchAsset",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,p,y,E,m,g,O,S,I,C,R,x,k,b,w,D,L,M,U,F,V,j,G,H,B,X,K,Y,q,W,J,Q,z,Z,$,ee,ne,ae=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i=t.href,c=t.assetsDir,u=t.priority,l=t.params,d=t.force,p=t.key,y=t.headers,E=t.auth,m=t.progressKey,p=p||i,g=this._data.assetMetadata[p]||{},O=g.lastModified,S=g.expiry,I=g.etag,C=g.date,e.t0=g.path,!e.t0){e.next=9;break}return e.next=8,T.pathExists("".concat(c,"../").concat(g.path));case 8:e.t0=e.sent;case 9:if((R=e.t0)||(O=I=C=S=void 0),d&&d.depth>=0&&"always"===d.type&&(!d.from||!g.refreshTime||new Date(d.from)>new Date(g.refreshTime))&&(O=I=C=S=void 0),!(new Date(S||"")>new Date)){e.next=14;break}return e.abrupt("return",{path:g.path});case 14:if("always"===(null==d?void 0:d.type)&&(null!==(r=null==d?void 0:d.depth)&&void 0!==r?r:0)>=0||!R||!g.path||".json"===A.extname(g.path)||v.default.get("NON_IDEMPOTENT_IMAGES",this.type)){e.next=16;break}return e.abrupt("return",{path:g.path});case 16:if(x=null!=u&&u.key?this.abortControllers[u.key]:void 0,k=g.temp&&A.normalize("".concat(c,"/../").concat(g.temp)),e.t1=k,!e.t1){e.next=23;break}return e.next=22,T.pathExists(k);case 22:e.t1=e.sent;case 23:if(b=e.t1,w=!0,D=0,L=void 0,M=g.path,U=function(e){var t,r;m=null!==(t=m)&&void 0!==t?t:"Asset-"+(null!==(r=null==u?void 0:u.key)&&void 0!==r?r:p),ae.emit(m,f()({},p||i,e))},F=_.default.throttle(U,v.default.get("PROGRESS_THROTTLE_INTERVAL")),R||!b||!k||!g.path){e.next=46;break}return e.next=33,this.downloadManager.load(k).catch(function(e){ae.log.error(new P.default("Could not load file for resume",e))});case 33:if(!(V=e.sent)){e.next=46;break}return V.emitter.on("progress",F),e.next=38,this.downloadManager.resume(V,{url:i,priority:u,options:{signal:null==x?void 0:x.signal}}).catch(function(){var e=o()(h.a.mark(function e(t){var r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(ae.log.error(new P.default("Resume Failed",t)),"ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC"!==t.code){e.next=5;break}throw n=null!==(r=v.default.get("ASSET_MAX_SOCKETS",ae._type))&&void 0!==r?r:v.default.get("NETWORK_MAX_SOCKETS"),v.default.set("ASSET_MAX_SOCKETS",Math.max(Math.floor(n/2),1),ae._type),new P.default("server",t,"LOCAL_RETRY");case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 38:if(j=e.sent,V.emitter.off("progress",F),w=void 0===j){e.next=45;break}return e.next=44,N.rename(k,"".concat(c,"../").concat(g.path)).catch(function(){return w=!0});case 44:D+=j||0;case 45:L=V.headers;case 46:if(G=g.id||this.generateId(l||{}),!w){e.next=80;break}return y=y||{},I?y["If-None-Match"]=I:O?y["If-Modified-Since"]=O:C&&(y["If-Modified-Since"]=C),e.next=52,this.downloadManager.get({url:i,options:{headers:y,parallel:{minimumPartialSize:null!==(H=v.default.get("ASSET_MINIMUM_PARTIAL_SIZE",this._type))&&void 0!==H?H:v.default.get("NETWORK_MINIMUM_PARTIAL_SIZE"),maxSockets:null!==(B=v.default.get("ASSET_MAX_SOCKETS",this._type))&&void 0!==B?B:v.default.get("NETWORK_MAX_SOCKETS"),maxLatency:null!==(X=v.default.get("ASSET_MAX_LATENCY",this._type))&&void 0!==X?X:v.default.get("NETWORK_MAX_LATENCY"),maxLatencyRetries:null!==(K=v.default.get("ASSET_MAX_LATENCY_RETRIES",this._type))&&void 0!==K?K:v.default.get("NETWORK_MAX_LATENCY_RETRIES")},signal:null==x?void 0:x.signal},auth:E,priority:u,id:G}).catch(function(){var e=o()(h.a.mark(function e(t){var r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("ERR_SSL_DECRYPTION_FAILED_OR_BAD_RECORD_MAC"!==t.code){e.next=4;break}throw n=null!==(r=v.default.get("ASSET_MAX_SOCKETS",ae._type))&&void 0!==r?r:v.default.get("NETWORK_MAX_SOCKETS"),v.default.set("ASSET_MAX_SOCKETS",Math.max(Math.floor(n/2),1),ae._type),new P.default("server",t,"LOCAL_RETRY");case 4:if(4!==Math.floor(t.code/100)&&5!==Math.floor(t.code/100)||!y||!y["If-None-Match"]&&!y["If-Modified-Since"]){e.next=11;break}return delete g.date,delete g.lastModified,delete g.etag,e.next=10,ae.save();case 10:throw new P.default("server",t,"LOCAL_RETRY");case 11:throw t;case 12:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 52:if(q=e.sent,W=q.response,L=W.headers,D+=q.time,304!==W.status){e.next=63;break}if(!g.path){e.next=62;break}return this._data.assetMetadata[p]=fe(fe({},g),{},{expiry:L&&re.a.getExpiry(L)||new Date(Date.now()+v.default.get("ASSET_DEFAULT_EXPIRATION")),refreshTime:(new Date).toISOString()}),e.next=61,this.save();case 61:return e.abrupt("return",{path:g.path});case 62:throw new Error("Got 304 for asset not on disk for url ".concat(i));case 63:return(J=te.getExtension(re.a.getContentTypeHeader(W.headers)||""))||(J=(J=(J=A.extname(W.url))&&J.substr(1))||"bin"),Q="".concat(c).concat(G,".").concat(J),this._data.assetMetadata[p]=(null===(Y=this._data)||void 0===Y?void 0:Y.assetMetadata[p])||{},this._data.assetMetadata[p].id=G,this._data.assetMetadata[p].path=A.basename(c)+"/".concat(G,".").concat(J),e.next=71,this.save();case 71:return z=Date.now(),Z=!1,e.next=75,N.writeAtomic({response:W,target:Q,progress:function(e,t,r){var n;!Z&&p&&ae._data.assetMetadata[p]&&(null===(n=ae._data.assetMetadata[p])||void 0===n?void 0:n.temp)!==r&&(ae._data.assetMetadata[p].temp=A.basename(c)+"/"+A.basename(r),ae.save()),F({done:e,total:t})},renameOnError:!0});case 75:Q=e.sent,Z=!0,M="".concat(A.basename(c),"/").concat(A.basename(Q)),L=W.headers,D+=Date.now()-z;case 80:return this._data.assetMetadata[p]={id:G,path:M,expiry:L&&re.a.getExpiry(L)||new Date(Date.now()+v.default.get("ASSET_DEFAULT_EXPIRATION")),refreshTime:(new Date).toISOString()},null!==(n=L)&&void 0!==n&&n.get("last-modified")&&(this._data.assetMetadata[p].lastModified=null===($=L)||void 0===$?void 0:$.get("last-modified")),null!==(a=L)&&void 0!==a&&a.get("etag")&&(this._data.assetMetadata[p].etag=null===(ee=L)||void 0===ee?void 0:ee.get("etag")),null!==(s=L)&&void 0!==s&&s.get("date")&&(this._data.assetMetadata[p].date=null===(ne=L)||void 0===ne?void 0:ne.get("date")),e.next=86,this.save();case 86:return e.abrupt("return",{path:M,time:D});case 87:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"priority",value:function(e){var t=e.params,r=e.key,n=void 0===r?"":r,a=e.level,s=void 0===a?L.c.Regular:a;return new L.a({key:n,value:v.default.get("PRODUCT_PRIORITY")[t.productCode]||0,channel:v.default.get("PRIORITY_CHANNEL",this._type),level:s})}},{key:"isValidDataForParams",value:function(e){e.id,e.params;return!0}},{key:"addDelay",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,!("always"===(n=t.force).type&&n.delay&&n.delay>0)){e.next=11;break}return e.next=4,this.paramsToId(r);case 4:if(s=this._getCollectionInfo(r),!(o=null!==(a=null==s?void 0:s.pendingId)&&void 0!==a?a:null==s?void 0:s.latestId)){e.next=11;break}return this._data.metadata[o].delay={depth:n.depth||0,expiryTime:new Date(Date.now()+n.delay).toISOString()},e.next=10,this._scheduleNextSyncJob();case 10:return e.abrupt("return",this._createCollectionData(o));case 11:return e.abrupt("return",void 0);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"delayExpiry",value:function(e){var t,r,n;return e?null===(t=this._data)||void 0===t?void 0:null===(r=t.metadata[e])||void 0===r?void 0:null===(n=r.delay)||void 0===n?void 0:n.expiryTime:void 0}},{key:"addNewCollectionData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p,y,E,g,O,S,T,A,I,C,R,x,k,b,N,w=this,D=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=D.length>0&&void 0!==D[0]?D[0]:{},a=n.params,s=n.payload,i=n.priorityLevel,c=n.progress,u=void 0===c?function(){}:c,l=n.force,d=n.fetchType,f=void 0===d?"pre-fetch":d,a){e.next=5;break}throw p=new P.default(m.default.DATA_VALIDATION_ERR,"No parameters to add the collection of."),this.log.error(p),p;case 5:return e.next=7,this.updateParams([a]);case 7:if(y=e.sent[0],a=null!=y?y:a,this.validateParams(a),null===(t=l)||void 0===t||!t.delay){e.next=16;break}return e.next=13,this.addDelay({params:a,force:l});case 13:return E=e.sent,f="delayed",e.abrupt("return",E);case 16:if(!(g=this._getCollectionInfo(a))||!a.ccxVersion){e.next=23;break}if(O=!1,Object.values(g).forEach(function(e){var t=w._data.metadata[e];t&&t.params&&t.params.ccxVersion&&(t.params.ccxVersion&&-1!==_.default.compareMajorMinorVersions(a.ccxVersion,t.params.ccxVersion)||(t.params.ccxVersion=a.ccxVersion,O=!0))}),!O){e.next=23;break}return e.next=23,this.save();case 23:if(!g||!a.vmStatus){e.next=30;break}if(S=!1,T=!(256&a.vmStatus),Object.values(g).forEach(function(e){var t=w._data.metadata[e];t&&t.params&&(T||!t.params.vmStatus)&&(t.params.vmStatus=a.vmStatus,S=!0)}),!S){e.next=30;break}return e.next=30,this.save();case 30:if(!g||!g.latestId){e.next=53;break}if(A=g.latestId,this._data.metadata[A]=this._data.metadata[A]||{},I=!0,v.default.get("MINOR_VERSION_SHOULD_UPDATE_CONTENT",this.type)&&(Object.values(g).some(function(e){var t=w._data.metadata[e];return!!(t&&t.params&&t.params.productVersion&&0==_.default.compareMajorMinorVersions(a.productVersion,t.params.productVersion))})||(l={type:"always"})),!l){e.next=46;break}e.t0=l.type,e.next="always"===e.t0?39:"stale"===e.t0?43:46;break;case 39:f="force-always",I=!1;try{delete this._data.metadata[A].expiryTime}catch(e){this.log.disk("Failed to find id: ".concat(A," for deletion."))}return e.abrupt("break",46);case 43:return f="force-stale",_.default.isDateExpired(null===(r=this._data.metadata[A])||void 0===r?void 0:r.expiryTime)&&(f="expired",I=!1),e.abrupt("break",46);case 46:if(this._data.metadata[A]){if(!this.isValidDataForParams({id:A,params:a})){I=!1;try{delete this._data.metadata[A].expiryTime}catch(e){this.log.disk("Failed to find id: ".concat(A," for deletion."))}}}else I=!1;if(!I){e.next=53;break}return x=this._createCollectionData(A),this._data.metadata[A].params=a,e.next=52,x.load({version:this.getClientVersion(a,this.type),file:null===(C=this._data)||void 0===C?void 0:null===(R=C.metadata[A])||void 0===R?void 0:R.path}).then(function(e){var t;return null!==(t=w._data)&&void 0!==t&&t.metadata[A]&&(w._data.metadata[A].path=x.fileName),e}).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return w.clearCollectionInfo(a,A,!1),e.next=3,w.addNewCollectionData({params:a,payload:s,progress:u,priorityLevel:i,force:l,fetchType:f});case 3:return e.abrupt("return",e.sent);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 52:return e.abrupt("return",e.sent);case 53:return e.next=55,this.paramsToId(a);case 55:return k=e.sent,b=this.priority({params:a,key:k,level:i||L.c.Regular}),this._syncLock.prioritize(b),this._downloadManager.prioritize(b),this.addListener(k,u),e.next=62,this._fetchCollectionData({params:a,priority:b,payload:s,force:l,fetchType:f}).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return w.log.context({params:a}).disk(t,"Error adding new collection"),e.next=3,w._scheduleNextSyncJob();case 3:throw w.removeListener(k,u),t;case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 62:return N=e.sent,this.removeListener(k,u),e.abrupt("return",N);case 65:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"needsSync",value:function(e){var t,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},a=n.checkExpiry,s=void 0===a||a,o=n.force,i=void 0!==o&&o,c=n.inFuture,u=void 0!==c&&c,l=this._data.metadata[e],d=l&&l.userId===S.default.getUserId()&&this._isDataPrimaryReference(e)&&!this.isRequestPoisoned(l.params);u&&l.delay?d=d&&!(this.isSyncInProgress(e)&&_.default.isDateExpired(null===(t=l.delay)||void 0===t?void 0:t.expiryTime)):d=d&&!this.isSyncInProgress(e);(i||(d=d&&_.default.hasBeenUsedRecently(l.lastUseTime)),s&&!i)&&(l.delay&&_.default.isDateExpired(null===(r=l.delay)||void 0===r?void 0:r.expiryTime)||(d=d&&_.default.isDateExpired(null==l?void 0:l.expiryTime)));return d}},{key:"sync",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a=this,s=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s.length>0&&void 0!==s[0]?s[0]:{type:"none"},n="pre-fetch",ee.b.status!==ee.b.OFFLINE){e.next=11;break}return e.next=5,w.b.updateBackOff({cause:"Offline[Network-Sync]",type:w.a.NETWORK});case 5:return e.next=7,ee.b.check(ee.a.LOOKUP_MAP_SYNC);case 7:return e.next=9,this._scheduleNextSyncJob();case 9:throw new P.default("Offline[Network-Sync]",new Error("Offline-Lookup-Sync"),v.default.analytics.OFFLINE_ERROR);case 11:if(this._clearScheduledSyncJob(),"always"!==r.type){e.next=16;break}return n="force-always",e.next=16,this.expireAll(S.default.getUserId());case 16:if(null===(t=this._data)||void 0===t||!t.metadata){e.next=19;break}return e.next=19,_.default.waitAll(Object.keys(this._data.metadata).map(function(e){var t=a._data.metadata[e],s=fe({},r),o=n;return a.needsSync(e,{force:"none"!==s.type,checkExpiry:!a._isPendingCollection(e)})?(t&&t.expiryTime&&_.default.isDateExpired(t.expiryTime)?o="expired":null!=t&&t.delay&&_.default.isDateExpired(t.delay.expiryTime)&&(o="delayed",s.type="always",s.depth=t.delay.depth),a._fetchCollectionData({params:t.params,force:s,fetchType:o})):Promise.resolve()})).then(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.syncOnDemandAssets();case 2:case"end":return e.stop()}},e)}))).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a._scheduleNextSyncJob();case 2:throw t;case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 19:return e.next=21,this.gc();case 21:return e.next=23,this._scheduleNextSyncJob();case 23:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_gc",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.prev=0,e.next=3,_.default.getLocks(this._syncLock.write.bind(this._syncLock),this._diskLock.write.bind(this._diskLock),o()(h.a.mark(function e(){var r,n,a,s,o,i,c,u,l,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.log.disk("GC starts."),r=t._getReferencedIdList(),n={},a={},Object.keys(r).forEach(function(e){var r,a,s,o=null!==(r=null===(a=t._data)||void 0===a?void 0:null===(s=a.metadata[e])||void 0===s?void 0:s.path)&&void 0!==r?r:"".concat(e,".json");n[o]=!0}),n[t._fileName]=!0,e.next=8,N.cleanupFolder(t._path,n,new RegExp(v.default.get("IGNORED_FILES_REGEXP")));case 8:return s=e.sent,o=s.left,(i=s.removed).length>0&&t.log.disk("Removed from ".concat(t._path," - ").concat(i.join(" "))),e.next=14,t._getReferencedAssetList(r);case 14:return c=e.sent,e.next=17,t._getOnDemandAssetList();case 17:return u=e.sent,Object.assign(c,u),Object.keys(c).forEach(function(e){a[A.basename(e)]=!0}),l=t._path+v.default.get("ASSETS_DIRNAME")+"/",e.next=23,N.cleanupFolder(l,a);case 23:d=e.sent,f=d.left,(p=d.removed).length>0&&t.log.disk("Removed from ".concat(l," - ").concat(p.join(", "))),t._cleanupCache(r,o),t._cleanupAssetsCache(c,f);case 29:case"end":return e.stop()}},e)})));case 3:return e.next=5,this.save();case 5:this.log.disk("GC ended successfully."),e.next=12;break;case 8:throw e.prev=8,e.t0=e.catch(0),this.log.error(new P.default(e.t0,v.default.analytics.GC_ERROR)),e.t0;case 12:case"end":return e.stop()}},e,this,[[0,8]])}));return function(){return e.apply(this,arguments)}}()},{key:"setForUser",value:function(){var e=o()(h.a.mark(function e(t,r){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(n=(n=this._data.usersInfo)||{})[S.default.getUserId()]=n[S.default.getUserId()]||{},n[S.default.getUserId()][t]=r,e.next=6,this.save();case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"getForUser",value:function(e){var t=this._data.usersInfo&&this._data.usersInfo[S.default.getUserId()];return t&&t[e]}},{key:"getLastTimeOfNotification",value:function(){var e=this.getForUser("lastTimeOfNotification");return e||(e=(new Date).getTime(),this.setForUser("lastTimeOfNotification",e)),Number(e)}},{key:"setLastTimeOfNotification",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.setForUser("lastTimeOfNotification",t);case 2:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.clearCollectionInfo(t);case 2:return e.next=4,this.clearOnDemandCollectionInfo(t);case 4:return e.next=6,this.gc();case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"update",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.updateOnDemandCollectionInfo(t,r);case 2:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"clearCollectionInfo",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,v,_,y,E,m,g=this,O=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=O.length>1&&void 0!==O[1]?O[1]:void 0,n=!(O.length>2&&void 0!==O[2])||O[2],this.validateParams(t),a=this._getLookupKeys(t),!n){e.next=39;break}return e.next=7,ce.default.getInstalledApps();case 7:if(e.t1=t.productCode,e.t2=s=e.sent[e.t1],e.t0=null!==e.t2,!e.t0){e.next=12;break}e.t0=void 0!==s;case 12:if(!e.t0){e.next=16;break}e.t3=s,e.next=17;break;case 16:e.t3={};case 17:return o=e.t3,e.next=20,this.updateParams(Object.values(o).map(function(e){var t=e;return t.InstallLanguage.split(",").map(function(e){return{productCode:t.SAPCode,productVersion:t.CodexVersion,productLanguage:e}})}).flat());case 20:i=e.sent,c=ue(i),e.prev=22,c.s();case 24:if((u=c.n()).done){e.next=31;break}if(l=u.value,JSON.stringify(this._getLookupKeys(l))!==JSON.stringify(a)){e.next=29;break}return this.log.context({params:t}).disk("Not uninstalling regular ".concat(t.productCode,"[").concat(t.productVersion,"] because a competing key software still exists.")),e.abrupt("return");case 29:e.next=24;break;case 31:e.next=36;break;case 33:e.prev=33,e.t4=e.catch(22),c.e(e.t4);case 36:return e.prev=36,c.f(),e.finish(36);case 39:if(d=this._data.versionInfo,f=!1,p=[["root",d]],a.forEach(function(e){d&&d[e]?(d=d[e],p.push([e,d])):f=!0}),!f&&0!==p.length){e.next=45;break}return e.abrupt("return");case 45:for(v=p.pop(),_=v[0],y=v[1],E=[],Object.keys(y).forEach(function(e){r?y[e]===r&&(delete y[e],E.push(r)):(E.push(y[e]),delete y[e])}),E.forEach(function(e){return delete g._data.metadata[e]});p.length>0&&0===Object.keys(y).length;)m=_,v=p.pop(),_=v[0],delete(y=v[1])[m];return e.next=53,this.save();case 53:case"end":return e.stop()}},e,this,[[22,33,36,39]])}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadManager",get:function(){return this._downloadManager}},{key:"type",get:function(){return this._type}},{key:"getCachedRequestData",value:function(){var e=this,t={};return Object.keys(this._data.metadata).forEach(function(r){var n=e._data.metadata[r];if(n.userId===S.default.getUserId()){var a=n.params;if(a&&a.productCode&&a.productVersion){t[a.productCode]||(t[a.productCode]={});!function(e){t[e.productCode][e.productVersion]||(t[e.productCode][e.productVersion]=[]),t[e.productCode][e.productVersion].push(e)}(n.params)}}}),t}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=JSON.parse(JSON.stringify(t)),e.next=3,j.a.getOSLocale();case 3:return a=e.sent,s=(null===(r=S.default.getUserInfo())||void 0===r?void 0:r.countryCode)||(null==a?void 0:a.split("_")[1]),n.forEach(function(e){e.productLanguage=e.productLanguage||a,e.countryCode=e.countryCode||s}),e.abrupt("return",n);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"getClientVersion",value:function(e,t){return _.default.ccxVersionToString(e)}},{key:"targetDetails",value:function(e){return e}},{key:"diskLock",get:function(){return this._diskLock}},{key:"assetsDir",get:function(){return A.join(v.default.get("ROOT_DIR"),v.default.get("DIR",this.type),v.default.get("ASSETS_DIRNAME"))+"/"}},{key:"_getOnDemandLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return this._getLookupKeys(e,t)}},{key:"getOnDemandCollection",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(e){var r=this._getOnDemandLookupKeys(e,t),n=this._data.onDemand;return r.forEach(function(e){n&&(n=n[e])}),n}var a=new P.default(m.default.DATA_VALIDATION_ERR,"No data to get collection for in LookupMap.");this.log.error(a)}},{key:"getOnDemandCollectionInfo",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,r=this.getOnDemandCollection(e,t);if(r)return r[this.paramsToOnDemandId(e)]}},{key:"paramsToOnDemandId",value:function(e){return(null==e?void 0:e.url)||(null==e?void 0:e.id)}},{key:"addOnDemandCollectionInfo",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,v,_,y,E,m;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.state,a=t.updateLastUseTime,s=void 0!==a&&a,o=t.expiry,i=t.retry,c=t.cause,!(u=this.paramsToOnDemandId(r))){e.next=11;break}p=this._getOnDemandLookupKeys(r),v=this._data.onDemand,_=ue(p);try{for(_.s();!(y=_.n()).done;)m=y.value,v[m]=null!==(E=v[m])&&void 0!==E?E:{},v=v[m]}catch(e){_.e(e)}finally{_.f()}return v[u]=n,this._data.onDemandMetadata[u]={userId:S.default.getUserId(),params:r,lastUseTime:s?(new Date).toISOString():null===(l=this._data)||void 0===l?void 0:null===(d=l.onDemandMetadata)||void 0===d?void 0:null===(f=d[u])||void 0===f?void 0:f.lastUseTime,expiryTime:null==o?void 0:o.toISOString(),retry:i,cause:c},e.next=11,this.save();case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getOnDemandAssetList",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r={},Object.values((null===(t=this._data)||void 0===t?void 0:t.onDemandMetadata)||{}).forEach(function(e){var t,a=n.paramsToOnDemandId(e.params),s=null===(t=n._data.assetMetadata[a])||void 0===t?void 0:t.path;s&&(r[s]=!0)}),e.abrupt("return",r);case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"_fetchOnDemandContent",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.force,a=t.priority,s=this.paramsToOnDemandId(r)){e.next=4;break}throw new Error(m.default.DATA_VALIDATION_ERR);case 4:return e.next=6,this.fetchAsset({href:s,assetsDir:this.assetsDir,force:n,priority:a,params:r});case 6:return e.abrupt("return",e.sent.path);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"updateOnDemandCollectionInfo",value:function(){var e=o()(h.a.mark(function e(t,r){var n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.validateParams(r),this.validateParams(t),Object.keys(this._data.onDemand).forEach(function(e){var a=n.getOnDemandCollection(t,e);if(a){var s,o=n._getOnDemandLookupKeys(r),i=n._data.onDemand,c=ue(o);try{for(c.s();!(s=c.n()).done;){var u,l=s.value;i[l]=null!==(u=i[l])&&void 0!==u?u:{},i=i[l]}}catch(e){c.e(e)}finally{c.f()}Object.keys(a).forEach(function(e){n._data.onDemandMetadata[e]&&(n._data.onDemandMetadata[e].params=Object.assign(n._data.onDemandMetadata[e].params,r)),i[e]=a[e]})}}),e.next=6,this.save();case 6:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"clearOnDemandCollectionInfo",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p,v,_,y,E,m,g=this,O=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=O.length>1&&void 0!==O[1]?O[1]:void 0,n=!(O.length>2&&void 0!==O[2])||O[2],this.validateParams(t),a=this._getOnDemandLookupKeys(t),!n){e.next=39;break}return e.next=7,ce.default.getInstalledApps();case 7:if(e.t1=t.productCode,e.t2=s=e.sent[e.t1],e.t0=null!==e.t2,!e.t0){e.next=12;break}e.t0=void 0!==s;case 12:if(!e.t0){e.next=16;break}e.t3=s,e.next=17;break;case 16:e.t3={};case 17:return o=e.t3,e.next=20,this.updateParams(Object.values(o).map(function(e){var t=e;return t.InstallLanguage.split(",").map(function(e){return{productCode:t.SAPCode,productVersion:t.CodexVersion,productLanguage:e}})}).flat());case 20:i=e.sent,c=ue(i),e.prev=22,c.s();case 24:if((u=c.n()).done){e.next=31;break}if(l=u.value,JSON.stringify(this._getOnDemandLookupKeys(l))!==JSON.stringify(a)){e.next=29;break}return this.log.context({params:t}).disk("Not uninstalling on demand ".concat(t.productCode,"[").concat(t.productVersion,"] because a competing key software still exists.")),e.abrupt("return");case 29:e.next=24;break;case 31:e.next=36;break;case 33:e.prev=33,e.t4=e.catch(22),c.e(e.t4);case 36:return e.prev=36,c.f(),e.finish(36);case 39:if(d=this._data.onDemand,f=!1,p=[["root",d]],a.forEach(function(e){d&&d[e]?(d=d[e],p.push([e,d])):f=!0}),!f&&0!==p.length){e.next=45;break}return e.abrupt("return");case 45:for(v=p.pop(),_=v[0],y=v[1],E=[],Object.keys(y).forEach(function(e){r?e===r&&(delete y[e],E.push(r)):(E.push(e),delete y[e])});p.length>0&&0===Object.keys(y).length;)m=_,v=p.pop(),_=v[0],delete(y=v[1])[m];return E.forEach(function(e){g.getOnDemandCollectionInfo(g._data.onDemandMetadata[e].params)||delete g._data.onDemandMetadata[e]}),e.next=53,this.save();case 53:case"end":return e.stop()}},e,this,[[22,33,36,39]])}));return function(t){return e.apply(this,arguments)}}()},{key:"syncOnDemandAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll(Object.values((null===(t=this._data)||void 0===t?void 0:t.onDemandMetadata)||{}).map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!_.default.hasBeenUsedRecently(t.lastUseTime)||"paused"===r.getOnDemandCollectionInfo(t.params)){e.next=3;break}return e.next=3,r.getOnDemandData({params:t.params,force:{type:"stale",depth:999}});case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"isOnDemandSyncInProgress",value:function(e){var t=this.fetchOnDemandContent.cache&&this.fetchOnDemandContent.cache.get(e);return t&&"pending"===t.state}},{key:"getOnDemandAssetPath",value:function(e){var t,r,n;return e.url?null===(t=this._data)||void 0===t?void 0:null===(r=t.assetMetadata)||void 0===r?void 0:null===(n=r[e.url])||void 0===n?void 0:n.path:void 0}},{key:"getOnDemandData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,v,y,E,g,O,S,T,A,I,C,R=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.params,a=void 0===n?{}:n,s=t.force,i=void 0===s?{type:"none"}:s,c=t.updateLastUseTime,u=void 0!==c&&c,l=t.priorityLevel,d=void 0===l?L.c.Regular:l,f=this.paramsToOnDemandId(a)){e.next=6;break}throw p=new P.default(m.default.DATA_VALIDATION_ERR,"Cannot generate key from parameters."),this.log.error(p),p;case 6:if(this.abortControllers[f]=this.abortControllers[f]||new se.a,v=this.priority({params:a,key:f,level:d}),this._downloadManager.prioritize(v),this.getOnDemandCollectionInfo(a)){e.next=14;break}return e.next=12,this.addOnDemandCollectionInfo(fe({params:a,state:"notReady",updateLastUseTime:u},this._calculateBackOffMetadata({updateBackOff:!1,metadata:null===(y=this._data)||void 0===y?void 0:y.onDemandMetadata[f]})));case 12:e.next=19;break;case 14:if(!(g=null===(E=this._data)||void 0===E?void 0:E.onDemandMetadata[f])||_.default.isDateExpired(g.expiryTime)||"none"!==i.type){e.next=19;break}throw O="Waiting for back-off ".concat(g.cause," for ").concat(_.default.getHumanReadableTime(g.retry||0)," expiring ").concat(g.expiryTime," in ").concat(_.default.getHumanReadableTime(new Date(g.expiryTime).getTime()-Date.now())),this.log.context({params:a}).disk(O),new P.default(O).silence();case 19:if(S=a&&a.url&&this._data.assetMetadata[null===(r=a)||void 0===r?void 0:r.url],T=i&&"always"===i.type||"ready"!=this.getOnDemandCollectionInfo(a)||S&&_.default.getTimeToExpiry(S.expiry)<=0,!(A=T?void 0:this.getOnDemandAssetPath(a))){e.next=25;break}e.next=38;break;case 25:if(this.isOnDemandSyncInProgress(f)){e.next=35;break}return I={assets:{}},C=function(e){Object.assign(I.assets,e),R.emit(f,I)},this.on("Asset-".concat(f),C),e.next=31,this._syncLock.read(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,R.log.context({payload:{"ccxp.mode":"on-demand","event.subtype":"api","ccxp.request_type":"get","event.url":a.url,"content.id":a.id}}).request(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,R.updateParams([a]);case 2:return a=e.sent[0],e.next=5,R._fetchOnDemandContent({params:a,force:i,priority:v}).catch(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t instanceof oe.AbortError){e.next=5;break}return e.next=3,R.addOnDemandCollectionInfo(fe({params:a,state:"notReady"},R._calculateBackOffMetadata({metadata:null===(r=R._data)||void 0===r?void 0:r.onDemandMetadata[f],error:t})));case 3:R.log.error(new P.default("Error getting on demand data",t)),R._scheduleNextSyncJob();case 5:throw t;case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 5:return e.abrupt("return",e.sent);case 6:case"end":return e.stop()}},e)})));case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})),v);case 31:A=e.sent,this.off("Asset-".concat(f),C),e.next=38;break;case 35:return e.next=37,this._fetchOnDemandContent({params:a,force:i,priority:v});case 37:A=e.sent;case 38:return e.next=40,this.addOnDemandCollectionInfo({params:a,state:"ready",updateLastUseTime:u});case 40:return delete this.abortControllers[f],e.abrupt("return",A);case 42:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"onDemandAbort",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=s.length>0&&void 0!==s[0]?s[0]:{},n=this.paramsToOnDemandId(r)){e.next=6;break}throw a=new Error(m.default.DATA_VALIDATION_ERR),this.log.error(new P.default("Cannot generate key from parameters.",a)),a;case 6:if(null===(t=this.abortControllers[n])||void 0===t||t.abort(),!this.isOnDemandSyncInProgress(n)){e.next=10;break}return e.next=10,this.getOnDemandData({params:r});case 10:"notReady"===this.getOnDemandCollectionInfo(r)&&this.addOnDemandCollectionInfo({params:r,state:"paused",updateLastUseTime:!1}),delete this.abortControllers[n];case 12:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ne);function ve(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function _e(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?ve(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):ve(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ye=function(){function e(t,r){c()(this,e),f()(this,"_id",void 0),f()(this,"_lookupMap",void 0),f()(this,"_diskLock",void 0),f()(this,"log",void 0),f()(this,"_fileName",void 0),f()(this,"_data",void 0),this._id=t,this._lookupMap=r,this._diskLock=r.diskLock,this.log=new y.default({prefix:"".concat(v.default.get("LOG_PREFIX",r.type),"Data > "),payload:{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",r.type)}}),this._fileName="".concat(this._id,".json")}return l()(e,[{key:"setData",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!e)return new P.default(m.default.MISSING_DATA,"No data to set for ".concat(this._lookupMap.type));var r,n=this.validateData(e,t);n?this.log.error(m.default.DATA_VALIDATION_ERR,new P.default("[Collection]: Invalid data: ".concat(JSON.stringify(null===(r=n[0])||void 0===r?void 0:r.message)))):this._data=e;return n}},{key:"fileName",get:function(){return this._fileName}},{key:"assetsDir",get:function(){return A.join(v.default.get("ROOT_DIR"),v.default.get("DIR",this._lookupMap.type),v.default.get("ASSETS_DIRNAME"))+"/"}},{key:"hasValidCards",value:function(e){return!0}},{key:"id",get:function(){return this._id}},{key:"expiryTime",get:function(){return this._data&&this._data.expirationDTS}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",null);case 1:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.version,n=t.skipSaving,a=t.file,this._fileName=null!=a?a:this._fileName,e.next=4,T.readJson(this._lookupMap.getPath()+this._fileName);case 4:if(s=e.sent,o=!1,s){e.next=8;break}throw new P.default(m.default.DATA_VALIDATION_ERR,"Failure to load collection JSON");case 8:if(i=s._ccx&&s._ccx.version||s.version,c=v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type),!s||i===c){e.next=18;break}return this.log.disk("Collection File mismatch. File ".concat(this._fileName," with version:").concat(i," vs version from lookup:").concat(c)),e.next=14,this.upgrade(s,r).catch(function(e){return null});case 14:if(s=e.sent){e.next=17;break}throw new P.default(m.default.INVALID_COLLECTION,"Required Collection Lookup file upgrade not available for ".concat(this._lookupMap.type," - ").concat(i,":").concat(c),m.default.INVALID_COLLECTION);case 17:o=!0;case 18:if(!(u=this.setData(s,r))){e.next=21;break}throw u;case 21:if(u||!o||n){e.next=24;break}return e.next=24,this.save();case 24:return e.abrupt("return",this);case 25:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"save",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._data){e.next=2;break}throw new Error("No data to save");case 2:return e.next=4,this._diskLock.write(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N.writeJsonAtomic(r._lookupMap.getPath(),r._fileName,r._data,!0);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})));case 4:t=e.sent,this._fileName=A.basename(t);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"logFailures",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:Object.keys(null!==(r=null==this?void 0:null===(n=this._data)||void 0===n?void 0:n.surfaces)&&void 0!==r?r:{}).forEach(function(e){var t;((null===(t=a._data.surfaces[e||""])||void 0===t?void 0:t.failedContainers)||[]).forEach(function(t){t&&e&&a.log.disk("Sophia Surface Error (".concat(t.errorCode,"): ").concat(t.errorMessage," - ").concat(e,"(").concat(t.containerId,")"))})});case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"sync",value:function(){var e=o()(h.a.mark(function e(t){var r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(this._data){e.next=2;break}throw new P.default(v.default.analytics.MISSING_DATA,"No data to sync");case 2:return this.logFailures((null==t?void 0:t.params)||{}),e.next=5,this.syncData(_e(_e({},t),{},{progress:function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.save();case 2:t.progress&&t.progress(n);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()})).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.save();case 2:case"end":return e.stop()}},e)})));case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"isDefaultData",get:function(){return!!(this._data&&this._data._ccx&&this._data._ccx.isDefault)}},{key:"totalItems",get:function(){var e;return null!==(e=this._data)&&void 0!==e&&e.surfaces?Object.keys(this._data.surfaces).length:0}},{key:"data",get:function(){return this._data}},{key:"validateData",value:function(e,t){return null}}]),e}();function Ee(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function me(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ee(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ee(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var ge=function(){function e(t,r){c()(this,e),f()(this,"lock",void 0),f()(this,"log",void 0),f()(this,"assetsDir",void 0),this.log=new y.default({prefix:"".concat(v.default.get("LOG_PREFIX",t),"DataManager"),payload:{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",t)}}),this.assetsDir=A.join(v.default.get("ROOT_DIR"),v.default.get("DIR",t),v.default.get("ASSETS_DIRNAME"))+"/",this.lock=r}return l()(e,[{key:"downloadAemCollectionTemplateData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,y,E=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.card,n=t.lookupMap,a=t.priority,t.bundle,s=t.params,i=t.started,c=t.force,u=0,l=0,d={},f="",p="",!("URL"===r.dataType&&r.data||r.contentURL)){e.next=22;break}return p="URL"===r.dataType&&r.data?"data":"contentURL",e.next=9,n.fetchAsset({href:r[p],assetsDir:this.assetsDir,priority:a,params:s,force:me(me({},c),{},{depth:(c.depth||0)-1})});case 9:if(e.t0=e.sent,e.t0){e.next=12;break}e.t0={};case 12:return y=e.t0,u++,l+=y.time,f=A.basename(y.path),e.next=18,T.readJson("".concat(this.assetsDir,"/").concat(f));case 18:d=e.sent,r.path=y.path,e.next=34;break;case 22:if("application/json"!==r.dataType||!r.data){e.next=33;break}return d=JSON.parse(r.data),f=n.generateId(s)+".json",e.t1=A,e.next=28,N.writeJsonAtomic(this.assetsDir,f,d,!0);case 28:e.t2=e.sent,f=e.t1.basename.call(e.t1,e.t2),r.path=v.default.get("ASSETS_DIRNAME")+"/"+f,e.next=34;break;case 33:return e.abrupt("return",{totalTime:l,count:u});case 34:if(i(),!d.data){e.next=37;break}return e.delegateYield(h.a.mark(function e(){var t,i,y,m,g,O;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=new P.default(v.default.analytics.AGGREGATE_ERROR,"AEM"+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),i=0,y=Object.values(d.data);case 2:if(!(i<y.length)){e.next=10;break}if(g=y[i],!Array.isArray(null===(m=g.item)||void 0===m?void 0:m.templateCollections)){e.next=7;break}return e.next=7,_.default.waitAll(null===(O=g.item)||void 0===O?void 0:O.templateCollections.map(function(){var e=o()(h.a.mark(function e(r){var o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!r.collectionId){e.next=6;break}return e.next=3,V.downloadStockCollection({id:r.collectionId,options:r.options,priority:a,params:s,force:me(me({},c),{},{depth:(c.depth||0)-2}),map:n}).catch(function(e){return t.addSubError({err:e,url:r._publishUrl,id:r._path}),{path:void 0,time:0}});case 3:o=e.sent,r.path=o.path,o.time&&(u++,l+=o.time);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(E.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(E.assetsDir,f,d,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),r.path=e.t0+e.t3,!(p.length>0)){e.next=13;break}if((null===(t=n.cachedAsset(r[p]))||void 0===t?void 0:t.path)===r.path||!n.cachedAsset(r[p])){e.next=13;break}return n.cachedAsset(r[p]).path=r.path,e.next=13,n.save();case 13:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 7:i++,e.next=2;break;case 10:if(!t.hasSubErrors){e.next=12;break}throw t;case 12:case"end":return e.stop()}},e)})(),"t3",37);case 37:return e.abrupt("return",{totalTime:l,count:u});case 38:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadAEMData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,y,E=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.card,n=t.lookupMap,a=t.priority,t.bundle,s=t.params,i=t.started,c=t.force,u=0,l=0,d={},f="",p="",!("URL"===r.dataType&&r.data||r.contentURL)){e.next=22;break}return p="URL"===r.dataType&&r.data?"data":"contentURL",e.next=9,n.fetchAsset({href:r[p],assetsDir:this.assetsDir,priority:a,params:s,force:me(me({},c),{},{depth:(c.depth||0)-1})});case 9:if(e.t0=e.sent,e.t0){e.next=12;break}e.t0={};case 12:return y=e.t0,u++,l+=y.time,f=A.basename(y.path),e.next=18,T.readJson("".concat(this.assetsDir,"/").concat(f));case 18:d=e.sent,r.path=y.path,e.next=34;break;case 22:if("application/json"!==r.dataType||!r.data){e.next=33;break}return d=JSON.parse(r.data),f=n.generateId(s)+".json",e.t1=A,e.next=28,N.writeJsonAtomic(this.assetsDir,f,d,!0);case 28:e.t2=e.sent,f=e.t1.basename.call(e.t1,e.t2),r.path=v.default.get("ASSETS_DIRNAME")+"/"+f,e.next=34;break;case 33:return e.abrupt("return",{totalTime:l,count:u});case 34:if(i(),!d.data){e.next=37;break}return e.delegateYield(h.a.mark(function e(){var t,i,y,m;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t=new P.default(v.default.analytics.AGGREGATE_ERROR,"AEM"+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),i=0,y=Object.values(d.data);case 2:if(!(i<y.length)){e.next=10;break}if(m=y[i],!Array.isArray(m._references)){e.next=7;break}return e.next=7,_.default.waitAll(m._references.map(function(){var e=o()(h.a.mark(function e(r){var o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!r._publishUrl){e.next=6;break}return e.next=3,n.fetchAsset({href:r._publishUrl,assetsDir:E.assetsDir,priority:a,params:s,force:me(me({},c),{},{depth:(c.depth||0)-2})}).catch(function(e){return t.addSubError({err:e,url:r._publishUrl,id:r._path}),{path:void 0,time:0}});case 3:o=e.sent,r.path=o.path,o.time&&(u++,l+=o.time);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(E.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(E.assetsDir,f,d,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),r.path=e.t0+e.t3,!(p.length>0)){e.next=13;break}if((null===(t=n.cachedAsset(r[p]))||void 0===t?void 0:t.path)===r.path||!n.cachedAsset(r[p])){e.next=13;break}return n.cachedAsset(r[p]).path=r.path,e.next=13,n.save();case 13:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 7:i++,e.next=2;break;case 10:if(!t.hasSubErrors){e.next=12;break}throw t;case 12:case"end":return e.stop()}},e)})(),"t3",37);case 37:return e.abrupt("return",{totalTime:l,count:u});case 38:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"passThroughContent",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.card,n=t.lookupMap,t.priority,t.bundle,a=t.params,s=t.started,t.force,o=0,i=0,u="",s(),l=new P.default(v.default.analytics.AGGREGATE_ERROR,"PASS"+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),e.prev=4,c={data:r.data},u=n.generateId(a)+".json",e.t0=A,e.next=10,N.writeJsonAtomic(this.assetsDir,u,c,!0);case 10:e.t1=e.sent,u=e.t0.basename.call(e.t0,e.t1),r.path=v.default.get("ASSETS_DIRNAME")+"/"+u,o++,e.next=19;break;case 16:e.prev=16,e.t2=e.catch(4),l.addSubError({err:e.t2,url:r.data});case 19:if(!l.hasSubErrors){e.next=21;break}throw l;case 21:return e.abrupt("return",{totalTime:i,count:o});case 22:case"end":return e.stop()}},e,this,[[4,16]])}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadIndexFileData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,y,E,m,g,O,S=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=t.card,s=t.lookupMap,i=t.priority,t.bundle,c=t.params,u=t.started,l=t.force,d=0,f=0,p={},y="",E="",!("URL"===a.dataType&&a.data||a.contentURL)){e.next=22;break}return E="URL"===a.dataType&&a.data?"data":"contentURL",e.next=9,s.fetchAsset({href:a[E],assetsDir:this.assetsDir,priority:i,params:c,force:me(me({},l),{},{depth:(l.depth||0)-1})});case 9:if(e.t0=e.sent,e.t0){e.next=12;break}e.t0={};case 12:return m=e.t0,d++,f+=m.time,y=A.basename(m.path),e.next=18,T.readJson("".concat(this.assetsDir,"/").concat(y));case 18:p=e.sent,a.path=m.path,e.next=34;break;case 22:if("application/json"!==a.dataType||!a.data){e.next=33;break}return p=JSON.parse(a.data),y=s.generateId(c)+".json",e.t1=A,e.next=28,N.writeJsonAtomic(this.assetsDir,y,p,!0);case 28:e.t2=e.sent,y=e.t1.basename.call(e.t1,e.t2),a.path=v.default.get("ASSETS_DIRNAME")+"/"+y,e.next=34;break;case 33:return e.abrupt("return",{totalTime:f,count:d});case 34:if(u(),g=new P.default(v.default.analytics.AGGREGATE_ERROR,"DP Index"+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),null===(r=p)||void 0===r||!r.paths){e.next=43;break}return p._assetPaths={},O=Object.keys(p.paths),e.next=41,_.default.waitAll(O.map(function(){var e=o()(h.a.mark(function e(t){var r,n,a,o,u;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null===(r=p)||void 0===r||null===(n=r.paths)||void 0===n||!n[t]){e.next=6;break}return e.next=3,s.fetchAsset({href:null===(a=p)||void 0===a?void 0:null===(o=a.paths)||void 0===o?void 0:o[t],assetsDir:S.assetsDir,priority:i,params:c,force:me(me({},l),{},{depth:(l.depth||0)-2})}).catch(function(e){var r,n;return g.addSubError({err:e,url:null===(r=p)||void 0===r?void 0:null===(n=r.paths)||void 0===n?void 0:n[t]}),{path:void 0,time:0,count:0}});case 3:(u=e.sent).path&&(p._assetPaths[t]=u.path),u.time&&(d++,f+=u.time);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(S.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(S.assetsDir,y,p,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),a.path=e.t0+e.t3,!(E.length>0)){e.next=13;break}if((null===(t=s.cachedAsset(a[E]))||void 0===t?void 0:t.path)===a.path||!s.cachedAsset(a[E])){e.next=13;break}return s.cachedAsset(a[E]).path=a.path,e.next=13,s.save();case 13:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 41:e.next=47;break;case 43:if(null===(n=p)||void 0===n||!n.toolTechniques){e.next=47;break}return p._toolTechniquesPaths={},e.next=47,_.default.waitAll(p.toolTechniques.map(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V.downloadTutorial({params:c,id:t,priority:i,force:l,analyticsData:{},filePrefix:"DP",status:c.status||"live",map:s}).catch(function(e){return g.addSubError({err:e,id:t}),{path:void 0,time:0,count:0}});case 2:(r=e.sent).path&&(p._toolTechniquesPaths[t]=r.path),f+=r.time,d+=r.count;case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,S.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(S.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(S.assetsDir,y,p,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),a.path=e.t0+e.t3,!(E.length>0)){e.next=13;break}if((null===(t=s.cachedAsset(a[E]))||void 0===t?void 0:t.path)===a.path||!s.cachedAsset(a[E])){e.next=13;break}return s.cachedAsset(a[E]).path=a.path,e.next=13,s.save();case 13:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 47:if(!g.hasSubErrors){e.next=49;break}throw g;case 49:return e.abrupt("return",{totalTime:f,count:d});case 50:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadContentfulData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,v,y,E=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.card,n=t.lookupMap,a=t.priority,s=t.urlKey,i=t.bundle,c=t.params,u=t.started,l=t.force,r[s]&&0!==r[s].length){e.next=3;break}return e.abrupt("return",{count:0,totalTime:0});case 3:return d=0,f=0,e.next=6,n.fetchAsset({href:r[s],assetsDir:this.assetsDir,priority:a,params:c,force:me(me({},l),{},{depth:(l.depth||0)-1})});case 6:if(e.t0=e.sent,e.t0){e.next=9;break}e.t0={};case 9:return p=e.t0,d++,f+=p.time,v=A.basename(p.path),e.next=15,T.readJson("".concat(this.assetsDir,"/").concat(v));case 15:if(y=e.sent,i&&(r.content=y),r.path=p.path,u(),!y.includes||!Array.isArray(y.includes.Asset)){e.next=22;break}return e.next=22,_.default.waitAll(y.includes.Asset.map(function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(t.fields&&t.fields.file&&t.fields.file.url)){e.next=6;break}return e.next=3,n.fetchAsset({href:t.fields.file.url,assetsDir:E.assetsDir,priority:a,params:c,force:me(me({},l),{},{depth:(l.depth||0)-2})});case 3:r=e.sent,t.fields.file.path=r.path,r.time&&(d++,f+=r.time);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}())).finally(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E.lock.write(o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=A.basename(E.assetsDir)+"/",e.t1=A,e.next=4,N.writeJsonAtomic(E.assetsDir,v,y,!0);case 4:if(e.t2=e.sent,e.t3=e.t1.basename.call(e.t1,e.t2),r.path=e.t0+e.t3,(null===(t=n.cachedAsset(r[s]))||void 0===t?void 0:t.path)===r.path||!n.cachedAsset(r[s])){e.next=12;break}return n.cachedAsset(r[s]).path=r.path,e.next=12,n.save();case 12:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)})));case 22:return e.abrupt("return",{count:d,totalTime:f});case 23:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadLegacyData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.card,n=t.lookupMap,a=t.priority,s=t.params,r.backgroundImage&&0!==r.backgroundImage.length){e.next=3;break}return e.abrupt("return",{count:0,totalTime:0});case 3:return o=null,e.prev=4,e.next=7,n.fetchAsset({href:r.backgroundImage,assetsDir:this.assetsDir,priority:a,params:s});case 7:i=e.sent,o=i.path,e.next=22;break;case 11:if(e.prev=11,e.t0=e.catch(4),404!==e.t0.statusCode||0===r.backgroundImage.indexOf("1000x560")){e.next=21;break}return r.backgroundImage=r.backgroundImage.replace("1000x560","730x280"),e.next=17,n.fetchAsset({href:r.backgroundImage,assetsDir:this.assetsDir,priority:a});case 17:i=e.sent,o=i.path,e.next=22;break;case 21:throw e.t0;case 22:return r.backgroundImageLocalpath=o,e.abrupt("return",{count:1,totalTime:i.time});case 24:case"end":return e.stop()}},e,this,[[4,11]])}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=t.modeID,n=t.card,a=t.lookupMap,s=t.priority,o=t.bundle,i=void 0!==o&&o,c=t.params,u=void 0===c?{}:c,l=t.started,d=void 0===l?function(){}:l,f=t.force,p=void 0===f?{type:"none"}:f,e.prev=1,e.t0=r,e.next="CCX_Start_2.5_Learn"===e.t0?5:"CCX_Start_2.5_Toast"===e.t0?5:"CCX_Start_2.5_Home"===e.t0?5:"firstrun"===e.t0?8:"footer"===e.t0?8:"learn"===e.t0?8:"discover"===e.t0?8:"trial"===e.t0?8:"openDoc"===e.t0?8:"welcome"===e.t0?8:"CCX_Start_3.0_Learn"===e.t0?11:"CCX_Start_3.0_Home"===e.t0?11:"CCX_Start_3.0_Toast"===e.t0?11:"ACCC_ALL_APPS_BANNERS"===e.t0?11:"ACCC_CATEGORIES_BANNERS"===e.t0?11:"ACCC_APPS_CATALOG"===e.t0?11:"ACCC_APP_SKELETON"===e.t0?11:"CCX_Start_3.1_Learn"===e.t0?11:"CCX_Start_3.1_Toast"===e.t0?11:"CCX_Start_3.1_Home"===e.t0?11:"CCX_Start_3.1_Whats_New"===e.t0?11:"Discover_Panel"===e.t0?14:"DP_Tool_Techniques_v1"===e.t0?14:"payment_notification_banner"===e.t0?17:"CCX_Start_5.11_Stock"===e.t0?20:"CCX_Start_4.0_Home"===e.t0?23:"CCX_Start_4.0_Whats_New"===e.t0?23:"CCX_Start_4.0_Toast"===e.t0?23:"CCD_ALL_APPS_BANNERS"===e.t0?23:"CCD_APP_SKELETON"===e.t0?23:(e.t0,23);break;case 5:return e.next=7,this.downloadContentfulData({card:n,lookupMap:a,priority:s,urlKey:"contentURL",bundle:i,params:u,started:d,force:p});case 7:return e.abrupt("return",e.sent);case 8:return e.next=10,this.downloadLegacyData({card:n,lookupMap:a,priority:s,params:u});case 10:return e.abrupt("return",e.sent);case 11:return e.next=13,this.downloadContentfulData({card:n,lookupMap:a,priority:s,urlKey:"data",bundle:i,params:u,started:d,force:p});case 13:return e.abrupt("return",e.sent);case 14:return e.next=16,this.downloadIndexFileData({card:n,lookupMap:a,priority:s,bundle:i,params:u,started:d,force:p});case 16:return e.abrupt("return",e.sent);case 17:return e.next=19,this.passThroughContent({card:n,lookupMap:a,priority:s,bundle:i,params:u,started:d,force:p});case 19:return e.abrupt("return",e.sent);case 20:return e.next=22,this.downloadAemCollectionTemplateData({card:n,lookupMap:a,priority:s,bundle:i,params:u,started:d,force:p});case 22:return e.abrupt("return",e.sent);case 23:return e.next=25,this.downloadAEMData({card:n,lookupMap:a,priority:s,bundle:i,params:u,started:d,force:p});case 25:return e.abrupt("return",e.sent);case 26:e.next=32;break;case 28:throw e.prev=28,e.t1=e.catch(1),this.log.disk("Error downloading content for ".concat(r," ").concat(e.t1,", ").concat(e.t1.stack,", card: ").concat(JSON.stringify(n),",")),e.t1;case 32:case"end":return e.stop()}},e,this,[[1,28]])}));return function(t){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(t,r,n){var a,s,i,c,u,l,d,p,v,y,E,m,g,O,S;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a={},!r.backgroundImageLocalpath){e.next=3;break}return e.abrupt("return",f()({},"".concat(r.backgroundImageLocalpath),!0));case 3:e.t0=t,e.next="CCX_Start_3.0_Learn"===e.t0?6:"CCX_Start_3.0_Home"===e.t0?6:"CCX_Start_3.0_Toast"===e.t0?6:"CCX_Start_2.5_Learn"===e.t0?6:"CCX_Start_2.5_Toast"===e.t0?6:"CCX_Start_2.5_Home"===e.t0?6:"ACCC_ALL_APPS_BANNERS"===e.t0?6:"ACCC_CATEGORIES_BANNERS"===e.t0?6:"ACCC_APPS_CATALOG"===e.t0?6:"ACCC_APP_SKELETON"===e.t0?6:"CCX_Start_3.1_Learn"===e.t0?6:"CCX_Start_3.1_Toast"===e.t0?6:"CCX_Start_3.1_Home"===e.t0?6:"CCX_Start_3.1_Whats_New"===e.t0?6:"Discover_Panel"===e.t0?15:"DP_Tool_Techniques_v1"===e.t0?15:"CCX_Start_5.11_Stock"===e.t0?26:"CCX_Start_4.0_Home"===e.t0?36:"CCX_Start_4.0_Whats_New"===e.t0?36:"CCX_Start_4.0_Toast"===e.t0?36:"CCD_ALL_APPS_BANNERS"===e.t0?36:"CCD_APP_SKELETON"===e.t0?36:"CCD_APPS_CATALOG"===e.t0?36:(e.t0,36);break;case 6:if(s=r.content,!r.path){e.next=13;break}return a[r.path]=!0,i=A.basename(r.path),e.next=12,T.readJson("".concat(this.assetsDir,"/").concat(i)).catch(function(){delete a[r.path]});case 12:s=e.sent;case 13:return s&&s.includes&&Array.isArray(s.includes.Asset)&&s.includes.Asset.forEach(function(e){e.fields&&e.fields.file&&e.fields.file.path&&(a[e.fields.file.path]=!0)}),e.abrupt("return",a);case 15:if(!r.path){e.next=25;break}return a[r.path]=!0,c=A.basename(r.path),e.next=20,T.readJson("".concat(this.assetsDir,"/").concat(c)).catch(function(){return delete a[r.path],{}});case 20:if(null!=(u=e.sent)&&u._assetPaths&&(Object.keys(u._assetPaths)||[]).forEach(function(e){a[u._assetPaths[e]]=!0}),null==u||!u._toolTechniquesPaths){e.next=25;break}return e.next=25,_.default.waitAll((Object.values(u._toolTechniquesPaths)||[]).map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=a,e.next=4,null==n?void 0:n.getTutorialAssets(t);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 25:return e.abrupt("return",a);case 26:if(!r.path){e.next=35;break}return a[r.path]=!0,p=A.basename(r.path),e.next=31,T.readJson("".concat(this.assetsDir,"/").concat(p)).catch(function(){return delete a[r.path],{}});case 31:if(null==(v=e.sent)||null===(l=v.data)||void 0===l||null===(d=l.modalCollectionsByPath)||void 0===d||!d.item.templateCollections){e.next=35;break}return e.next=35,_.default.waitAll(null==v?void 0:null===(y=v.data)||void 0===y?void 0:y.modalCollectionsByPath.item.templateCollections.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=a,e.next=4,null==n?void 0:n.getCollectionAsset(t.path);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 35:return e.abrupt("return",a);case 36:if(!r.path){e.next=43;break}return a[r.path]=!0,E=A.basename(r.path),e.next=41,T.readJson("".concat(this.assetsDir,"/").concat(E)).catch(function(){return delete a[r.path],{}});case 41:if((m=e.sent)&&m.data)for(g=0,O=Object.values(m.data);g<O.length;g++)S=O[g],Array.isArray(S._references)&&S._references.forEach(function(e){e.path&&(a[e.path]=!0)});case 43:return e.abrupt("return",a);case 44:case"end":return e.stop()}},e,this)}));return function(t,r,n){return e.apply(this,arguments)}}()}]),e}();function Oe(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Se(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Oe(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Oe(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Te(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Ae=function(e){K()(r,e);var t=Te(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"cardDataManager",void 0),a.cardDataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"validateData",value:function(e,t){var n;if(!e.cardControl)return B()(J()(r.prototype),"validateData",this).call(this,e,"");if(n=_.default.validateDataFields(e,v.default.get("CARDS_DATA_SCHEMA")[t],[v.default.get("CARDS_CONTROL_SCHEMA")]))return n;var a=[];return e.cardControl&&e.cardControl.forEach(function(t){var r=v.default.get("CARD_DATA_SCHEMA")[t.modeID];if(!r)return null;t.cardOrder.forEach(function(t){var s=e.cards[t];s&&(n=_.default.validateDataFields(s,r))&&(a=a.concat(n))})}),a.length>0?a:null}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("V3_0"!==r||!t||!t.cardControl){e.next=5;break}return this.log.disk("Invalidating Home Data: ".concat(this._fileName)),e.abrupt("return",null);case 5:if(t.version!==v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type)){e.next=9;break}return e.abrupt("return",t);case 9:if(!t||2!==t.version){e.next=14;break}return t.version=v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this._lookupMap.type),e.abrupt("return",t);case 14:return this.log.disk("Unsupported format, downloading new content: ".concat(this._fileName)),e.abrupt("return",null);case 16:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.started,l=t.force,e.next=3,this.log.context({payload:n,surfaceAnalytics:[Se({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.cardDataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,bundle:!0,params:c,started:u,force:l});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/(n||1),"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"totalItems",get:function(){var e,t;return null!==(e=this._data)&&void 0!==e&&e.surfaces?Object.keys(this._data.surfaces).length:null!==(t=this._data)&&void 0!==t&&t.cardControl?this._data.cardControl.map(function(e){return e.modeID}).length:0}},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.priority,n=t.payload,a=t.params,s=t.progress,i=t.force,this._data){e.next=3;break}return e.abrupt("return");case 3:if(c={started:[],complete:[],failed:[]},u=new P.default(v.default.analytics.AGGREGATE_ERROR,v.default.get("AGGREGATE_TYPE",this._lookupMap.type)+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),l=[],!this._data.surfaces){e.next=10;break}Object.keys(this._data.surfaces).forEach(function(e){var t,f=!1;l.push(_.default.waitAll(null===(t=(d._data.surfaces[e].containers||[]).filter(function(e){return"URL"===e.dataType}))||void 0===t?void 0:t.map(function(){var t=o()(h.a.mark(function t(o){return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,d.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:r,params:a,force:i,started:function(){c.started.includes(e)||(c.started.push(e),s(Object.assign({},c)))}}).catch(function(t){f=!0,u.addSubError(Se(Se({surface:e,url:o.data},o.containerAnalyticsData),{},{err:t}))});case 2:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}())).then(function(){c.started.includes(e)||c.started.push(e),f?c.failed.push(e):c.complete.push(e),s(Object.assign({},c))}))}),e.next=15;break;case 10:if(!this._data.cardControl){e.next=14;break}this._data.cardControl.forEach(function(e){l.push(_.default.waitAll(e.cardOrder.map(function(){var t=o()(h.a.mark(function t(o,u){var l;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!(l=d._data.cards[o])){t.next=4;break}return t.next=4,d.syncDataPromises({analyticsParams:e.containerAnalyticsParams&&e.containerAnalyticsParams[u],payload:n,surface:e.modeID,card:l,priority:r,params:a,force:i,started:function(){c.started.includes(e.modeID)||(c.started.push(e.modeID),s(Object.assign({},c)))}});case 4:case"end":return t.stop()}},t)}));return function(e,r){return t.apply(this,arguments)}}())).then(function(){c.started.includes(e.modeID)||c.started.push(e.modeID),c.complete.push(e.modeID),s(Object.assign({},c))}))}),e.next=15;break;case 14:return e.abrupt("return");case 15:return e.next=17,_.default.waitAll(l);case 17:if(!u.hasSubErrors){e.next=19;break}throw u;case 19:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"hasValidCards",value:function(){var e=v.default.get("ACTIVE_VERSIONS"),t=v.default.get("SUPPORTED_ACTIVE_VERSIONS"),r=e.slice(-1*t),n=_.default.ccxVersionToString(this._data);if(!r.includes(n))return!0;var a=v.default.get("HOME_SURFACE_ID",n);return["V1","V2","V2_5"].includes(n)?!!this._data.cardControl.find(function(e){return e.modeID===a}):!!Object.keys(this._data.surfaces).includes(a)}},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=6;break}return e.next=4,_.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.cardDataManager.getReferencedAssets(n,a);case 2:s=e.sent,Object.assign(t,s);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:e.next=9;break;case 6:if(!this._data||!this._data.cardControl){e.next=9;break}return e.next=9,_.default.waitAll(this._data.cardControl.map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll(n.cardOrder.map(function(){var e=o()(h.a.mark(function e(a){var s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(s=r._data.cards[a])){e.next=6;break}return e.next=4,r.cardDataManager.getReferencedAssets(n.modeID,s);case 4:o=e.sent,Object.assign(t,o);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 9:return e.abrupt("return",t);case 10:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ye),Ie={ANALYTICS_SUBCATEGORY:"Sophia",LOOKUP_MAP_FILE_VERSION:6,LOOKUP_COLLECTION_FILE_VERSION:3,ASSET_MAX_SOCKETS:4,ASSET_MINIMUM_PARTIAL_SIZE:65536,SUPPORTED_PRODUCTS:{AEFT:"15.0",DRWV:"18.0",FLPR:"20.0",IDSN:"13.0",ILST:"22.0",MUSE:"2018.0",PHXS:"19.0",PPRO:"12.0",SPRK:"31.0"},PARAMETERS_SCHEMA:{id:"psdk_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},LOG_PREFIX:"FirstMile",LABEL:"FIRST_MILE",DIR:"data/",VULCAN_TYPE:"FirstMile",PRIORITY_CHANNEL:L.b.FirstMileLatest,ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_DATA_EXPIRATION:864e5,DEFAULT_URLS_ENABLED:!0,DEFAULT_URLS:{V2_5:{PHXS:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/953/2drOpU2WQ0s4qG6KacAgmk/{locale}.json",PPRO:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/62/3JrN0dcjvNeCc1oEZPABh9/{locale}.json",AEFT:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/687/50WW9E93Dvfv7Otfe3B2UO/{locale}.json",ILST:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/832/7pCFzXfA6QAaKI6MsicKO2/{locale}.json",IDSN:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/619/1dyQrULwM8wCi4oiaY0gUy/{locale}.json",DRWV:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/709/4gK0NuqSF2G4YwYc6MoSO/{locale}.json"},V2_8:{PHXS:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/169/45a57xm7FMMg2CHHSsI5T/{locale}.json",PPRO:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/508/XFd1SlnnXACOaGHvHrkzR/{locale}.json",AEFT:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/53/66SsgxKgPwafhzfZhaH73y/{locale}.json",ILST:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/959/3QlaTwccpuG2gM4WwJu2O5/{locale}.json",IDSN:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/71/3fF2Ay5mQhhH3ruR2k7fU8/{locale}.json"},V3_0:{PHXS:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/953/2drOpU2WQ0s4qG6KacAgmk/{locale}.json",ILST:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/832/7pCFzXfA6QAaKI6MsicKO2/{locale}.json"},V3_1:{PHXS:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/169/45a57xm7FMMg2CHHSsI5T/{locale}.json",PPRO:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/508/XFd1SlnnXACOaGHvHrkzR/{locale}.json",AEFT:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/53/66SsgxKgPwafhzfZhaH73y/{locale}.json",ILST:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/959/3QlaTwccpuG2gM4WwJu2O5/{locale}.json",IDSN:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/71/3fF2Ay5mQhhH3ruR2k7fU8/{locale}.json",SPRK:"https://cvs.adobe.com/content/dam/cvs/firstmile/V2/634/hs2oiIlx8QNVYkYXaNJrs/{locale}.json"},V4_0:{PHXS:"https://odin.adobe.com/content/dam/ccfirstmile/PHSP/{locale}/experienceHomeMx19/Ps-Home-Max-2020-Photo-editing.cfm.gql.json",PPRO:"https://odin.adobe.com/content/dam/ccfirstmile/PPRO/{locale}/experienceHomeMx19/Pr-NUJ-M3-2020-Social-video.cfm.gql.json",AEFT:"https://odin.adobe.com/content/dam/ccfirstmile/AEFT/{locale}/experienceHomeMx19/Ae-NUJ-M3-Home-2020-Social.cfm.gql.json",ILST:"https://odin.adobe.com/content/dam/ccfirstmile/ILST/{locale}/experienceHomeMx19/Ai-MAX-2020-Home-Individual-Enterprise-AEM.cfm.gql.json",IDSN:"https://odin.adobe.com/content/dam/ccfirstmile/IDSN/{locale}/experienceHomeMx19/Id-MAX-2020-Home-Individual-Enterprise-AEM.cfm.gql.json"}},MINOR_VERSION_SHOULD_UPDATE_CONTENT:!0,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5,SUPPORTS_ON_DEMAND:!0},Ce=function(){function e(t){c()(this,e),f()(this,"type",void 0),f()(this,"_requestLock",void 0),f()(this,"prioritize",void 0),f()(this,"log",void 0),f()(this,"downloadCollectionData",void 0),this.type=t,e.requestLock=e.requestLock||new L.d(v.default.get("NUM_CONCURRENT_REQUESTS")),this._requestLock=e.requestLock,this.prioritize=this._requestLock.prioritize,this.log=new y.default({prefix:"".concat(v.default.get("LOG_PREFIX",t),"DownloadManager > "),payload:{"event.subtype":v.default.analytics.st_API,"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",this.type)}}),this.downloadCollectionData=_.default.retryLocalErrors(this.downloadCollectionDataRaw.bind(this))}return l()(e,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.default.getEnvironment(),n=new D.URL(v.default.get("URL_".concat(r.LABEL.toUpperCase()),this.type)),(t.verbose||v.default.get("SOPHIA_VERBOSE_FLAG_ENABLED",this.type))&&(t.verbose=v.default.get("SOPHIA_VERBOSE_FLAG_ENABLED",this.type)),this.appendUrlSearchParams(n.searchParams,t),e.abrupt("return",n.toString());case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"additionalAnalytics",value:function(e){return{}}},{key:"applyResponseAnalytics",value:function(e,t,r){if(e.appendPayload({"exp.response_guid":t.analyticsData&&t.analyticsData.responseGUID}),t.surfaces)for(var n in t.surfaces)e.addSurfaceAnalytics([{surface:n}]),Array.isArray(t.surfaces[n].containers)&&e.addSurfaceAnalytics(t.surfaces[n].containers.map(function(e){return e.containerAnalyticsData}))}},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.priority,a=t.id,s=void 0===a?C.v4():a,i=t.skipAuth,e.next=3,this.url(r);case 3:return c=e.sent,e.next=6,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,u,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=l,e.t1=c,e.t2={method:"GET",headers:{"content-type":"application/json","x-gw-ims-user-id":S.default.getUserId(),"X-API-Key":v.default.getEnvironment().CLIENT_ID}},e.t3=n,e.t4=!i,!e.t4){e.next=9;break}return e.next=8,S.default.getAccessToken().catch(function(e){return!1});case 8:e.t4=!!e.sent;case 9:return e.t5=e.t4,e.t6=s,e.t7={url:e.t1,options:e.t2,priority:e.t3,auth:e.t5,id:e.t6},e.next=14,e.t0.get.call(e.t0,e.t7);case 14:return r=e.sent,a=r.response,o=r.time,t.appendPayload({"event.value":o,"event.url":c,"env.svc.name":v.default.get("ANALYTICS_SUBCATEGORY",l.type)}),u=Date.now(),e.next=21,l.getResponseJson(a,c);case 21:return d=e.sent,o+=Date.now()-u,e.abrupt("return",d);case 24:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:return(u=e.sent).analyticsData&&(u.analyticsData.requestId=s),e.abrupt("return",u);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"load",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Object(oe.load)(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"resume",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c=this,u=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=u.length>1&&void 0!==u[1]?u[1]:{},n=r.url,a=r.priority,s=r.id,i=void 0===s?C.v4():s,!w.b.isWaitingForBackOff(w.a.NETWORK)){e.next=4;break}throw new Error("Waiting for global back-off ".concat(w.b.backOffCause(w.a.NETWORK)));case 4:if(ee.b.status!==ee.b.OFFLINE){e.next=6;break}throw new Error("Cannot get ".concat(n," - Offline"));case 6:return e.next=8,this._requestLock.read(o()(h.a.mark(function e(){var s,o,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return c.log.disk("[".concat(i,"] Resuming ").concat(n," - Priority(").concat(a&&a.toString()||0,")")),s=Date.now(),o=new D.URL(n||t.url).origin,u=r.options||{},e.next=6,j.a.getNodeTunnelOptionsForURL(o);case 6:return u.agent=e.sent.agent,e.next=9,t.resume(n,u);case 9:return l=Date.now()-s,c.log.disk("[".concat(i,"] Finished.")),e.abrupt("return",l);case 12:case"end":return e.stop()}},e)})),a);case 8:return e.abrupt("return",e.sent);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"get",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f=this,p=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=p.length>0&&void 0!==p[0]?p[0]:{url:""},r=t.url,n=t.options,a=void 0===n?{}:n,s=t.auth,i=void 0!==s&&s,c=t.id,u=void 0===c?C.v4():c,l=t.priority,!w.b.isWaitingForBackOff(w.a.NETWORK)){e.next=4;break}throw new Error("Waiting for global back-off ".concat(w.b.backOffCause(w.a.NETWORK)));case 4:if(ee.b.status!==ee.b.OFFLINE){e.next=6;break}throw new Error("Cannot get ".concat(r," - Offline"));case 6:return a.headers=a.headers||{},a.headers["X-Request-Id"]=u,a.headers["user-agent"]="Adobe CCXProcess-".concat(_.default.getProcessVersion(),"/").concat(process.platform,"-").concat(_.default.getOsVersion(),"-").concat(process.arch),a.parallel=Object.assign({minimumPartialSize:v.default.get("NETWORK_MINIMUM_PARTIAL_SIZE"),maxSockets:v.default.get("NETWORK_MAX_SOCKETS"),maxLatency:v.default.get("NETWORK_MAX_LATENCY"),maxLatencyRetries:v.default.get("NETWORK_MAX_LATENCY_RETRIES"),exitOnLatency:!1},a.parallel||{}),a.timeout=v.default.get("ASSET_DOWNLOAD_TIMEOUT",this.type),d=this.log.context({diskParams:{id:u,priority:null==l?void 0:l.toString(),auth:!!i,url:r}}),e.next=14,this._requestLock.read(o()(h.a.mark(function e(){var t,n,s,c,p,_,y,E,m,g,O;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=Date.now(),n=new D.URL(r).origin,e.t0=i,!e.t0){e.next=7;break}return e.next=6,S.default.getAccessToken().catch(function(e){return f.log.disk("Error getting access token - ".concat(e)),!1});case 6:e.t0=e.sent;case 7:if(s=e.t0,c=!1,!i||s){e.next=12;break}if(!w.b.isWaitingForBackOff(w.a.AUTH)||!v.default.get("ANONYMOUS_RETRY_DISABLED",f.type)){e.next=12;break}throw new Error("Waiting for global back-off ".concat(w.b.backOffCause(w.a.AUTH)));case 12:return i&&s&&(a.headers.Authorization="Bearer ".concat(s),c=!0),a.headers.Connection="keep-alive",e.next=16,j.a.getNodeTunnelOptionsForURL(n);case 16:return a.agent=e.sent.agent,d.disk("[".concat(u,"] Requesting ").concat(c?"with Auth Headers":"without Auth Headers"," ").concat(r," - Priority(").concat(l&&l.toString()||0,")")),e.next=20,ie()(r,a).catch(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("system"!==t.type||"ENOTFOUND"!==t.code&&"EADDRNOTAVAIL"!==t.code){e.next=6;break}return e.next=3,w.b.updateBackOff({cause:"Offline[Network-"+t.code+"]",type:w.a.NETWORK});case 3:return e.next=5,ee.b.check(ee.a.DOWNLOAD_FETCH_ERROR);case 5:throw new P.default("Offline[Network]",new Error("Offline-Download"),t.code||v.default.analytics.OFFLINE_ERROR).setPayload({"event.url":r});case 6:if("system"!==t.type||"PROXY"!==t.code){e.next=9;break}return e.next=9,w.b.updateBackOff({cause:t.message,type:w.a.NETWORK});case 9:throw t;case 10:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 20:if((p=e.sent).ok||304===p.status){e.next=36;break}return e.next=24,p.text();case 24:if(_=e.sent,y=0,429!==p.status){e.next=29;break}return e.next=29,w.b.updateBackOff({cause:"Server Error[".concat(p.status,"]"),type:w.a.NETWORK});case 29:if(401!==p.status){e.next=32;break}return e.next=32,w.b.updateBackOff({cause:"Server Error[".concat(p.status,"]"),type:w.a.AUTH});case 32:try{m=JSON.parse(_),y=null!==(E=null==m?void 0:m.error_code)&&void 0!==E?E:0}catch(e){}throw(g=new P.default(v.default.analytics.st_NETWORK,"Failed to get ".concat(r," with status code ").concat(p.status," - ").concat(_),0!=y?y:p.status).setPayload({"event.url":r})).setResponseHeaders(p.headers),g;case 36:return e.next=38,w.b.updateBackOff({clear:!0,type:w.a.NETWORK});case 38:return O=Date.now()-t,d.context({diskParams:{time:O}}).disk("[".concat(u,"] Finished ").concat(O,"ms with status ").concat(p.status)),e.abrupt("return",{response:p,time:O});case 41:case"end":return e.stop()}},e)})),l).catch(function(e){throw d.disk("[".concat(u,"] Failed - ").concat(e)),e});case 14:return e.abrupt("return",e.sent);case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getResponseJson",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.json().catch(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=new P.default(v.default.analytics.INVALID_JSON,n),e.t1=r,e.next=4,t.text();case 4:throw e.t2=e.sent.length,e.t3={"event.url":e.t1,"event.value":e.t2},e.t0.setPayload.call(e.t0,e.t3);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"appendUrlSearchParams",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=function(r){Array.isArray(t[r])?t[r].forEach(function(t){e.append(r,t||"")}):e.append(r,t[r]||"")};for(var n in t)r(n)}}]),e}();function Re(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function xe(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Re(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Re(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ke(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}f()(Ce,"requestLock",void 0);var be=function(e){K()(r,e);var t=ke(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"_convertSurfaceIdToModeId",value:function(e,t){var r=v.default.get("FIRST_MILE_SURFACE_MODE_MAP",t);return r&&r[e]?r[e]:e}},{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var n,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=v.default.get("FIRST_MILE_SURFACE_ID",_.default.ccxVersionToString(t)),a={productCode:t.productCode,productLanguage:t.productLanguage,productVersion:t.productVersion,productSemver:t.productVersion,surfaceId:n,ccxVersion:t.ccxVersion,osVersion:_.default.getOsVersion(),platform:_.default.getOsPlatform(),verbose:!0},t.vmStatus&&(a.vmStatus=t.vmStatus),e.abrupt("return",B()(J()(r.prototype),"url",this).call(this,a));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"additionalAnalytics",value:function(e){return{"exp.surface_id":v.default.get("FIRST_MILE_SURFACE_ID",_.default.ccxVersionToString(e)).join(", ")}}},{key:"applyResponseAnalytics",value:function(e,t,r){if(e.appendPayload({"exp.response_guid":t.analyticsParams&&t.analyticsParams.responseGUID,"content.type":v.default.analytics.SOPHIA_CARDS,"content.size":t.cards?t.cards.length:0}),r&&["V2_8","V3_0","V3_1","V4_0"].includes(_.default.ccxVersionToString(r))){if(null!=t&&t.surfaces)for(var n in e.appendPayload({"exp.response_guid":t.analyticsData&&t.analyticsData.responseGUID,"content.size":Object.keys(t.surfaces).length}),t.surfaces){var a,s,o;if(e.addSurfaceAnalytics([{surface:n}]),null!=t&&null!==(a=t.surfaces)&&void 0!==a&&null!==(s=a[n])&&void 0!==s&&s.containers&&Array.isArray(t.surfaces[n].containers))e.addSurfaceAnalytics(null===(o=t.surfaces[n])||void 0===o?void 0:o.containers.map(function(e){return e&&e.containerAnalyticsData}))}}else t.cardControl&&Array.isArray(t.cardControl)&&t.cardControl.forEach(function(t){Array.isArray(t.containerAnalyticsParams)&&(e.addSurfaceAnalytics(t.containerAnalyticsParams),e.addSurfaceAnalytics([{surface:t.modeID}]))})}},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,y=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.priority,a=t.id,s=void 0===a?C.v4():a,i=t.skipAuth,c=void 0!==i&&i,e.next=3,this.url(r);case 3:return u=e.sent,e.next=6,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,i,l,d,f;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r={"content-type":"application/json","X-API-Key":v.default.getEnvironment().CLIENT_ID},e.t0=!c,!e.t0){e.next=6;break}return e.next=5,S.default.getAccessToken().catch(function(e){return!1});case 5:e.t0=!!e.sent;case 6:return(a=e.t0)&&(r["x-gw-ims-user-id"]=S.default.getUserId()),e.next=10,y.get({url:u,options:{method:"GET",timeout:v.default.get("SERVER_TIMEOUT"),headers:r},priority:n,auth:a,id:s});case 10:return o=e.sent,i=o.response,l=o.time,t.appendPayload({"event.value":l,"event.url":u,"env.svc.name":"Sophia"}),d=Date.now(),e.next=17,y.getResponseJson(i,u);case 17:return f=e.sent,l+=Date.now()-d,e.abrupt("return",f);case 20:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:if(l=e.sent,d=v.default.get("SOPHIA_RESPONSE_SCHEMA"),!(f=_.default.validateDataFields(l,d))){e.next=11;break}throw new P.default(v.default.analytics.PARAM_VALIDATION_ERR,f);case 11:if(!["V2_8","V3_0","V3_1","V4_0"].includes(_.default.ccxVersionToString(r))){e.next=16;break}return l.analyticsData&&(l.analyticsData.requestId=s),l.ccxVersion=r.ccxVersion,l.surfaces&&Object.keys(l.surfaces).forEach(function(e){var t=l.surfaces[e];t.containers&&(t.containers=t.containers.map(function(e){return e.data&&"application/json"===e.dataType?xe(xe({},e),{},{content:JSON.parse(e.data)}):e}))}),e.abrupt("return",l);case 16:return p={cards:[],cardControl:[],expirationDTS:new Date(Math.min(new Date(l.expirationDTS||0).getTime(),new Date(Date.now()+v.default.get("MAX_TIMEOUT")).getTime())).toISOString(),analyticsParams:{responseGUID:l.analyticsData&&l.analyticsData.responseGUID,requestId:s},ccxVersion:r.ccxVersion},l.surfaces&&Object.keys(l.surfaces).forEach(function(e){if(Array.isArray(l.surfaces[e].containers)&&0!=l.surfaces[e].containers.length){var t={modeID:y._convertSurfaceIdToModeId(e,_.default.ccxVersionToString(r)),cardOrder:[],containerAnalyticsParams:[]};l.surfaces[e].containers.forEach(function(r){r.containerAnalyticsData=r.containerAnalyticsData||{},t.containerAnalyticsParams.push(r.containerAnalyticsData);var n={startDTS:r.startDTS,endDTS:r.endDTS};if(r.data&&"application/json"===r.dataType)try{Object.assign(n,JSON.parse(r.data))}catch(n){y.log.error(new P.default(v.default.analytics.PARAM_VALIDATION_ERR,n).setContext("Error parsing card data for ".concat(e," with analytics ").concat(JSON.stringify(t.containerAnalyticsParams)," which was ").concat(r.data)))}else"URL"===r.dataType?Object.assign(n,{contentURL:r.data}):Object.assign(n,r);p.cards.push(n),t.cardOrder.push(p.cards.length-1)}),p.cardControl.push(t)}}),"V2"===_.default.ccxVersionToString(r)&&p.cards.forEach(function(e){e.backgroundImage&&(e.backgroundImage=e.backgroundImage.replace("730x280","1000x560"))}),e.abrupt("return",p);case 20:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Ce);function Ne(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var we=function(e){K()(r,e);var t=Ne(r);function r(){var e;return c()(this,r),(e=t.call(this,Ie))._downloadManager=new be(e.type),e}return l()(r,[{key:"generateId",value:function(e){return"".concat(e.productCode,"-").concat(e.productVersion,"-").concat(e.productLanguage,"-").concat(C.v4()).trim()}},{key:"priority",value:function(e){var t=e.params,n=B()(J()(r.prototype),"priority",this).call(this,e),a=this.getClientVersion(t);return n.value+=v.default.get("priority",a),"V1"!==a&&"V2"!==a||(n.channel=L.b.Deprecated),"V2_5"!==a&&"V3_0"!==a||(n.channel=L.b.FirstMileOld),n}},{key:"_createCollectionData",value:function(e){return new Ae(e,this)}},{key:"_getLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=B()(J()(r.prototype),"_getLookupKeys",this).call(this,e,t),a=this.getClientVersion(e);return n.splice(1,0,a),n}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,5!==t.version){e.next=30;break}e.t0=h.a.keys(t.versionInfo);case 3:if((e.t1=e.t0()).done){e.next=28;break}r=e.t1.value,e.t2=h.a.keys(t.versionInfo[r]);case 6:if((e.t3=e.t2()).done){e.next=26;break}n=e.t3.value,e.t4=h.a.keys(t.versionInfo[r][n]);case 9:if((e.t5=e.t4()).done){e.next=24;break}a=e.t5.value,e.t6=h.a.keys(t.versionInfo[r][n][a]);case 12:if((e.t7=e.t6()).done){e.next=22;break}if(s=e.t7.value,o=t.versionInfo[r][n][a][s],i=this.getMinorVersion(r,a,s,t)){e.next=18;break}return e.abrupt("continue",12);case 18:delete t.versionInfo[r][n][a][s],t.versionInfo[r][n][a][i]=o,e.next=12;break;case 22:e.next=9;break;case 24:e.next=6;break;case 26:e.next=3;break;case 28:return t.version=v.default.get("LOOKUP_MAP_FILE_VERSION",this._type),e.abrupt("return",t);case 30:e.next=35;break;case 32:e.prev=32,e.t8=e.catch(0),console.error("Error performing lookupmap upgrade: ",e.t8);case 35:return e.abrupt("return",null);case 36:case"end":return e.stop()}},e,this,[[0,32]])}));return function(t){return e.apply(this,arguments)}}()},{key:"_checkValidity",value:function(e,t){if(!e||!e.hasValidCards||!e.hasValidCards())throw new P.default(m.default.MISSING_DATA,"Empty Sophia Cards")}},{key:"forceRefresh",value:function(){var e=o()(h.a.mark(function e(t){var r,n,s,i=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.default.get("ACTIVE_VERSIONS"),n=r.map(function(e){return[e].concat(a()(Object.values(t)))}),s=n.map(function(e){return i.getIdsByKeys(e)}).reduce(function(e,t){return[].concat(a()(e),a()(t))},[]).filter(function(e,t,r){return r.indexOf(e)===t}),e.next=5,Promise.all(s.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,i.expireOne(t);case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()},{key:"isRequestPoisoned",value:function(e){var t=this.getClientVersion(e),r=v.default.get("SUPPORTED_PRODUCTS",this.type)||{};return"V1"===t||("V2"===t&&!v.default.get("TIER_1_LOCALES").includes(e.productLanguage)||(!("V2_8"!==t&&"V3_1"!==t&&"V4_0"!==t||!e||"DRWV"!==e.productCode)||(!!(e.productCode&&r[e.productCode]&&_.default.compareMajorMinorVersions(r[e.productCode],e.productVersion)<0)||!!(_.default.isWindows()&&_.default.compareMajorMinorVersions(v.default.get("EARLIEST_SUPPORTED_WINDOWS_VERSION_UXP"),_.default.getOsVersion())<0&&v.default.get("UNSUPPORTED_WINDOWS_UXP_APPS").includes(e.productCode)))))}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return(n=e.sent).forEach(function(e){var t=v.default.get("ACTIVE_VERSIONS").find(function(t){var r=v.default.get("FIRST_MILE_PREFETCH_CLIENTS",t)[e.productCode];return 1===_.default.compareMajorMinorVersions(e.productVersion,r)});e.ccxVersion=e.ccxVersion||v.default.get("START_VERSION",t),e.surfaceId=v.default.get("FIRST_MILE_SURFACE_ID",t),e.platform=_.default.getOsPlatform(),e.osVersion=_.default.getOsVersion()}),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"defaultCollectionData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.desiredId,a=this.getClientVersion(r),!["V2_5","V2_8","V3_0","V3_1","V4_0"].includes(a)){e.next=15;break}if(s=this._createCollectionData(n),o=v.default.get("DEFAULT_URLS",this.type)[a][r.productCode],i=o&&o.replace("{locale}",r.productLanguage)){e.next=8;break}return e.abrupt("return",void 0);case 8:return c={ccxVersion:"2.7.4.99",cards:[{startDTS:(new Date).toISOString(),endDTS:(new Date).toISOString(),contentURL:i}],cardControl:[{modeID:"CCX_Start_2.5_Home",cardOrder:[0],containerAnalyticsParams:[{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}]}],analyticsParams:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+v.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString(),_ccx:{isDefault:!0,version:v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)}},"V2_8"===a&&(c={ccxVersion:"2.8.0.99",_ccx:{isDefault:!0,version:v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.1_Home":{containers:[{dataType:"URL",data:i,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+v.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),"V3_1"===a&&(c={ccxVersion:"3.1.0.99",_ccx:{isDefault:!0,version:v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.1_Home":{containers:[{dataType:"URL",data:i,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+v.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),"V4_0"===a&&(c={ccxVersion:"4.1.0.0",_ccx:{isDefault:!0,version:v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_4.0_Home":{containers:[{dataType:"URL",data:i,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+v.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),"V3_0"===a&&(c={ccxVersion:"3.0.1.99",_ccx:{isDefault:!0,version:v.default.get("LOOKUP_COLLECTION_FILE_VERSION",this.type)},surfaces:{"CCX_Start_3.0_Home":{containers:[{dataType:"URL",data:i,containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"}}]}},analyticsData:{responseGUID:"dummy",requestId:"dummy"},expirationDTS:new Date(Date.now()+v.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString()}),s.setData(c,a),e.abrupt("return",s);case 15:return e.abrupt("return",void 0);case 16:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he);function De(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Le(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?De(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):De(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Pe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Me=function(e){K()(r,e);var t=Pe(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"_lookupMap",void 0),a._lookupMap=n,a}return l()(r,[{key:"validateData",value:function(e){return _.default.validateDataFields(e,v.default.get("LEARN_DATA_SCHEMA"))}},{key:"ututAnalyticsData",value:function(e){return{"event.subcategory":v.default.analytics.sc_UTUTS,"event.subtype":v.default.analytics.st_API,"content.id":e.tutorialUUID||e.aem_id,"content.name":e.metadata&&e.metadata.descriptions&&e.metadata.descriptions.short,"content.category":e.metadata&&e.metadata.level,"content.action":e.metadata&&e.metadata.urls&&e.metadata.urls.helpx,"content.type":e.metadata&&e.metadata.learning_approach}}},{key:"ututPlaylistAnalyticsData",value:function(e,t){return{"event.subcategory":v.default.analytics.sc_LCM,"event.subtype":v.default.analytics.st_API,"content.id":t,"content.name":e.description,"content.category":e.level}}},{key:"recommendationAnalyticsData",value:function(e){var t,r;return{"event.subcategory":v.default.analytics.sc_RECOMMMENDATIONS,"event.subtype":v.default.analytics.st_API,"content.id":null==e?void 0:null===(t=e.content)||void 0===t?void 0:t.id,"content.type":null==e?void 0:null===(r=e.content)||void 0===r?void 0:r.type}}},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p,y=this,E=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=E.length>0&&void 0!==E[0]?E[0]:{},n=r.priority,a=r.payload,s=r.params,i=r.progress,c=void 0===i?function(){}:i,u=r.force,l=void 0===u?{type:"none"}:u,d=this._data,f={started:[],complete:[],failed:[]},p=new P.default(v.default.analytics.AGGREGATE_ERROR,v.default.get("AGGREGATE_TYPE",this._lookupMap.type)+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),l.depth=null!==(t=l.depth)&&void 0!==t?t:0,e.next=7,this.log.time(function(){var e=o()(h.a.mark(function e(t){var r,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=0,i=0,e.next=4,_.default.waitAll(Object.keys(d.surfaces||{}).map(function(){var e=o()(h.a.mark(function e(t){var a,u,v;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=d.surfaces[t],u=a.containers||[],f.started.push(t),c(f),v=!1,e.next=7,_.default.waitAll(u.map(function(){var e=o()(h.a.mark(function e(a){var c,u,d,f,E,m,g,O,S,T,A,I;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a&&a.content){e.next=2;break}return e.abrupt("return");case 2:if(!Array.isArray(null==a?void 0:null===(c=a.content)||void 0===c?void 0:c.tutorials)){e.next=9;break}return(f=new L.a(n)).channel=L.b.Learn,e.next=7,_.default.waitAll(a.content.tutorials.map(function(){var e=o()(h.a.mark(function e(n){var o,c,u,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==n||null===(o=n.metadata)||void 0===o||null===(c=o.images)||void 0===c||null===(u=c.hero)||void 0===u||!u.length){e.next=7;break}return e.next=3,y._lookupMap.fetchAsset({href:n.metadata.images.hero,analyticsData:y.ututAnalyticsData(n),priority:f,params:s,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),assetsDir:y.assetsDir}).catch(function(e){var r,s;return p.addSubError(Le(Le({err:e,url:null==n?void 0:null===(r=n.metadata)||void 0===r?void 0:null===(s=r.images)||void 0===s?void 0:s.hero,id:(null==n?void 0:n.tutorialUUID)||(null==n?void 0:n.aem_id)},null==a?void 0:a.containerAnalyticsData),{},{surface:t})),v=!0,{path:void 0,time:0}});case 3:d=e.sent,n.metadata.images.heroPath=d.path,i+=null==d?void 0:d.time,r++;case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 7:e.next=23;break;case 9:if(null==a||null===(u=a.content)||void 0===u||!u.playlists){e.next=16;break}return(E=new L.a(n)).channel=L.b.Lcm,e.next=14,_.default.waitAll(a.content.playlists.map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Array.isArray(null==n?void 0:n.tutorial_ids)){e.next=4;break}return n.tutorial_paths={},e.next=4,_.default.waitAll(n.tutorial_ids.map(function(){var e=o()(h.a.mark(function e(o){var c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V.downloadTutorial({params:s,id:o,priority:E,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),analyticsData:y.ututPlaylistAnalyticsData(n,o),filePrefix:"LCM",status:n.status||"live",map:y._lookupMap}).catch(function(e){return p.addSubError(Le(Le({err:e,id:o},null==a?void 0:a.containerAnalyticsData),{},{surface:t})),v=!0,{time:0,count:0}});case 2:c=e.sent,n.tutorial_paths[o]=c.path,i+=c.time,r+=c.count;case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 14:e.next=23;break;case 16:if(null==a||null===(d=a.content)||void 0===d||!d.data){e.next=23;break}if(!Array.isArray(null==a?void 0:null===(m=a.content)||void 0===m?void 0:null===(g=m.data)||void 0===g?void 0:g.recommendations)){e.next=22;break}return(I=new L.a(n)).channel=L.b.Learn,e.next=22,_.default.waitAll(null==a?void 0:null===(T=a.content)||void 0===T?void 0:null===(A=T.data)||void 0===A?void 0:A.recommendations.map(function(){var e=o()(h.a.mark(function e(c){var u,d,f,_,E,m,g;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if("quickAction"===(null==c?void 0:null===(u=c.content)||void 0===u?void 0:u.type)&&(E={},Object.keys((null==c?void 0:null===(_=c.content)||void 0===_?void 0:_.assetUrls)||{}).map(function(){var e=o()(h.a.mark(function e(t){var a,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=null==c?void 0:c.content.assetUrls[t],!y.shouldPrefetchAsset(t)){e.next=10;break}return e.next=4,y._lookupMap.fetchAsset({href:a,analyticsData:y.recommendationAnalyticsData(c),priority:n,params:s,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),assetsDir:y.assetsDir}).catch(function(e){var t;return p.addSubError({err:e,url:a,id:null==c?void 0:null===(t=c.content)||void 0===t?void 0:t.uuid}),v=!0,{path:void 0,time:0}});case 4:(o=e.sent).path&&(E[t]=o.path),i+=null==o?void 0:o.time,r++,e.next=11;break;case 10:y.log.disk("Asset ".concat(t," in QuickAction deny list. Skipping prefetch"));case 11:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),c.content.assetPaths=E),null==c||null===(d=c.content)||void 0===d||!d.downloadUrl||"ututService"!==(null==c?void 0:null===(f=c.content)||void 0===f?void 0:f.source)){e.next=8;break}return e.next=4,V.downloadTutorial({params:s,url:null==c?void 0:null===(m=c.content)||void 0===m?void 0:m.downloadUrl,id:c.content.id||"",priority:I,force:Le(Le({},l),{},{depth:(l.depth||0)-1}),analyticsData:y.recommendationAnalyticsData(c),filePrefix:"REC",map:y._lookupMap}).catch(function(e){var r;return p.addSubError(Le(Le({err:e,id:null==c?void 0:null===(r=c.content)||void 0===r?void 0:r.id},null==a?void 0:a.containerAnalyticsData),{},{surface:t})),v=!0,{time:0,count:0}});case 4:g=e.sent,c.content.path=g.path,i+=g.time,r+=g.count;case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 22:Array.isArray(null==a?void 0:null===(O=a.content)||void 0===O?void 0:null===(S=O.data)||void 0===S?void 0:S.errors)&&a.content.data.errors.forEach(function(e){p.addSubError(Le(Le({err:new P.default(e.type||"Dynamic Recommendations Error",e.title||"",e.status)},null==a?void 0:a.containerAnalyticsData),{},{surface:t})),v=!0});case 23:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 7:v?f.failed.push(t):f.complete.push(t),c(f);case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:if(t.appendPayload(Le(Le({},a),{},{"event.url":"","event.count":r,"event.value":i/r})),!p.hasSubErrors){e.next=7;break}throw p;case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"shouldPrefetchAsset",value:function(e){return!(v.default.get("QUICK_ACTIONS_PREFETCH_DENY_LIST",this._lookupMap.type)||[]).includes(e)}},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t={},r=this._data,e.t0=h.a.keys(null==r?void 0:r.surfaces);case 3:if((e.t1=e.t0()).done){e.next=10;break}if(n=e.t1.value,!Array.isArray(null==r?void 0:r.surfaces[n].containers)){e.next=8;break}return e.next=8,_.default.waitAll(r.surfaces[n].containers.map(function(){var e=o()(h.a.mark(function e(r){var n,s,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!Array.isArray(null==r?void 0:null===(n=r.content)||void 0===n?void 0:n.tutorials)){e.next=4;break}r.content.tutorials.forEach(function(e){if(e&&e.metadata&&e.metadata.images){var r=e.metadata.images;r.heroPath&&(t[r.heroPath]=!0)}}),e.next=12;break;case 4:if(!Array.isArray(null==r?void 0:null===(s=r.content)||void 0===s?void 0:s.playlists)){e.next=9;break}return e.next=7,_.default.waitAll(r.content.playlists.map(function(){var e=o()(h.a.mark(function e(r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll(Object.values(r.tutorial_paths||{}).map(function(){var e=o()(h.a.mark(function e(r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,a._lookupMap.getTutorialAssets(r);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 7:e.next=12;break;case 9:if(!Array.isArray(null==r?void 0:null===(i=r.content)||void 0===i?void 0:null===(c=i.data)||void 0===c?void 0:c.recommendations)){e.next=12;break}return e.next=12,_.default.waitAll(r.content.data.recommendations.map(function(){var e=o()(h.a.mark(function e(r){var n,s,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,a._lookupMap.getTutorialAssets(null==r?void 0:null===(n=r.content)||void 0===n?void 0:n.path);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2),"quickAction"===(null==r?void 0:null===(s=r.content)||void 0===s?void 0:s.type)&&null!=r&&null!==(i=r.content)&&void 0!==i&&i.assetPaths&&Object.keys(null==r?void 0:null===(c=r.content)||void 0===c?void 0:c.assetPaths).map(function(){var e=o()(h.a.mark(function e(n){var a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:(s=null==r?void 0:null===(a=r.content)||void 0===a?void 0:a.assetPaths[n])&&(t[s]=!0);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 12:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 8:e.next=3;break;case 10:return e.abrupt("return",t);case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ye);function Ue(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Fe=function(e){K()(r,e);var t=Ue(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=v.default.get("LEARN_SURFACE_ID",_.default.ccxVersionToString(t)),a=_.default.compareMajorMinorVersions(v.default.get("SUPPORTED_LEARN_THIRD_PARTY_START_MIN_VERSION"),t.ccxVersion||"")>-1,s={productCode:t.productCode,productLanguage:t.productLanguage,productVersion:t.productVersion,productSemver:t.productVersion,surfaceId:[n],ccxVersion:t.ccxVersion,allowThirdPartyContent:a.toString(),osVersion:_.default.getOsVersion(),platform:_.default.getOsPlatform(),verbose:t.verbose},(o=v.default.get("LCM_SUPPORTED_PRODUCTS",this.type)||{})[t.productCode]&&_.default.compareMajorMinorVersions(t.productVersion,o[t.productCode])<=0&&s.surfaceId.push(v.default.get("UTUTS_SURFACE",this.type)),e.abrupt("return",B()(J()(r.prototype),"url",this).call(this,s));case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"additionalAnalytics",value:function(e){return{"exp.surface_id":v.default.get("LEARN_SURFACE_ID",_.default.ccxVersionToString(e))}}},{key:"numberOfTutorials",value:function(e,t){var r,n,a,s,o,i=0,c=0,u=0,l=v.default.get("LEARN_SURFACE_ID",_.default.ccxVersionToString(t));e&&e.surfaces&&e.surfaces[l]&&Array.isArray(e.surfaces[l].containers)&&e.surfaces[l].containers.forEach(function(e){e.content&&Array.isArray(e.content.tutorials)&&e.content.tutorials.length>0&&(e.content.tutorials[0].metadata&&Array.isArray(e.content.tutorials[0].metadata.platforms)&&e.content.tutorials[0].metadata.platforms.includes("in-app")?c=e.content.tutorials.length:i=e.content.tutorials.length)});var d,f,p,h,y,E,m=v.default.get("UTUTS_SURFACE",this.type);Array.isArray(null==e?void 0:null===(r=e.surfaces)||void 0===r?void 0:null===(n=r[m])||void 0===n?void 0:null===(a=n.containers)||void 0===a?void 0:null===(s=a[0])||void 0===s?void 0:null===(o=s.content)||void 0===o?void 0:o.playlists)&&(u=(null==e?void 0:null===(d=e.surfaces)||void 0===d?void 0:null===(f=d[m])||void 0===f?void 0:null===(p=f.containers)||void 0===p?void 0:null===(h=p[0])||void 0===h?void 0:null===(y=h.content)||void 0===y?void 0:null===(E=y.playlists)||void 0===E?void 0:E.length)||0);return{web:i,app:c,ututs:u}}},{key:"applyResponseAnalytics",value:function(e,t,r){var n=this.numberOfTutorials(t,r);if(e.appendPayload({"exp.response_guid":t.analyticsData&&t.analyticsData.responseGUID,"content.type":v.default.analytics.UTUTS,"content.size":"".concat(n.web,":").concat(n.app,":").concat(null==n?void 0:n.ututs)}),t.surfaces)for(var a in t.surfaces)e.addSurfaceAnalytics([{surface:a}]),Array.isArray(t.surfaces[a].containers)&&e.addSurfaceAnalytics(t.surfaces[a].containers.map(function(e){return e.containerAnalyticsData}))}},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p,y=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.priority,a=t.id,s=void 0===a?C.v4():a,i=t.skipAuth,e.next=3,this.url(r);case 3:return c=e.sent,e.next=6,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,u,l,d,f;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r={"content-type":"application/json","X-API-Key":v.default.getEnvironment().CLIENT_ID},e.t0=!i,!e.t0){e.next=6;break}return e.next=5,S.default.getAccessToken().catch(function(e){return!1});case 5:e.t0=!!e.sent;case 6:return(a=e.t0)&&(r["x-gw-ims-user-id"]=S.default.getUserId()),e.next=10,y.get({url:c,options:{method:"GET",timeout:v.default.get("SERVER_TIMEOUT"),headers:r},priority:n,auth:a,id:s});case 10:return o=e.sent,u=o.response,l=o.time,t.appendPayload({"event.value":l,"event.url":c,"env.svc.name":"Learn"}),d=Date.now(),e.next=17,y.getResponseJson(u,c);case 17:return f=e.sent,l+=Date.now()-d,e.abrupt("return",f);case 20:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:if(u=e.sent,l=v.default.get("SOPHIA_RESPONSE_SCHEMA"),!(d=_.default.validateDataFields(u,l))){e.next=11;break}throw new P.default(v.default.analytics.PARAM_VALIDATION_ERR,d);case 11:for(p in f=function(e){Array.isArray(u.surfaces[e].containers)&&u.surfaces[e].containers.forEach(function(t,n){if(t.data)t.content=JSON.parse(t.data);else{var a=t.containerAnalyticsData;y.log.context({params:r,surfaceAnalytics:[{surface:e,campaignId:null==a?void 0:a.campaignId,variationId:null==a?void 0:a.variationId,treatmentId:null==a?void 0:a.treatmentId,controlGroupId:null==a?void 0:a.controlGroupId,actionBlockId:null==a?void 0:a.actionBlockId}]}).error(new P.default("Missing data field in container(".concat(n+1,")"),v.default.analytics.DATA_VALIDATION_ERR,"X_ERR_MISSING_DATA_FIELD"))}})},u.surfaces)f(p);return e.abrupt("return",u);case 14:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Ce),Ve={ANALYTICS_SUBCATEGORY:"Learn",LOOKUP_COLLECTION_FILE_VERSION:3,LOOKUP_MAP_FILE_VERSION:2,LOG_PREFIX:"Learn",SUPPORTED_PRODUCTS:{AEFT:"16.0",DRWV:"19.0",FLPR:"20.0",IDSN:"14.0",ILST:"23.0",PHXS:"20.0",PPRO:"13.0",SPRK:"31.0"},PARAMETERS_SCHEMA:{id:"learn_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},LABEL:"LEARN",VULCAN_TYPE:"Tutorial",DIR:"learn/",NON_IDEMPOTENT_IMAGES:!0,PRIORITY_CHANNEL:L.b.Learn,ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!0,LCM_SUPPORTED_PRODUCTS:{PHXS:"22.0",ILST:"26.0"},UTUTS_SURFACE:"LCM_LEARN_PANEL",UTUTS_API_REQUEST_SURFACE:"in_app_panel:v2",SUPPORTS_ON_DEMAND:!0,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5,QUICK_ACTIONS_PREFETCH_DENY_LIST:["sampleFile"]};function je(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Ge=function(e){K()(r,e);var t=je(r);function r(){var e;return c()(this,r),(e=t.call(this,Ve))._downloadManager=new Fe(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new Me(e,this)}},{key:"upgrade",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,1!==t.version){e.next=25;break}e.t0=h.a.keys(t.versionInfo);case 3:if((e.t1=e.t0()).done){e.next=23;break}r=e.t1.value,e.t2=h.a.keys(t.versionInfo[r]);case 6:if((e.t3=e.t2()).done){e.next=21;break}n=e.t3.value,e.t4=h.a.keys(t.versionInfo[r][n]);case 9:if((e.t5=e.t4()).done){e.next=19;break}if(a=e.t5.value,s=t.versionInfo[r][n][a],o=this.getMinorVersion(r,n,a,t)){e.next=15;break}return e.abrupt("continue",9);case 15:delete t.versionInfo[r][n][a],t.versionInfo[r][n][o]=s,e.next=9;break;case 19:e.next=6;break;case 21:e.next=3;break;case 23:return t.version=v.default.get("LOOKUP_MAP_FILE_VERSION",this._type),e.abrupt("return",t);case 25:e.next=30;break;case 27:e.prev=27,e.t6=e.catch(0),console.error("Error performing lookupmap upgrade: ",e.t6);case 30:return e.abrupt("return",null);case 31:case"end":return e.stop()}},e,this,[[0,27]])}));return function(t){return e.apply(this,arguments)}}()},{key:"isRequestPoisoned",value:function(e){var t=_.default.ccxVersionToString(e),r=v.default.get("SUPPORTED_PRODUCTS",this.type)||{};if("V1"===t){var n=v.default.get("LCM_SUPPORTED_PRODUCTS",this.type)||{};return!(e.productCode&&e.productVersion&&n[e.productCode]&&_.default.compareMajorMinorVersions(n[e.productCode],e.productVersion)<=0)}return"V2"===t&&!v.default.get("TIER_1_LOCALES").includes(e.productLanguage)||(!("V2_8"!==t&&"V3_1"!==t&&"V4_0"!==t||!e||"DRWV"!==e.productCode)||(!!(e.productCode&&r[e.productCode]&&_.default.compareMajorMinorVersions(r[e.productCode],e.productVersion)<0)||!!(_.default.isWindows()&&_.default.compareMajorMinorVersions(v.default.get("EARLIEST_SUPPORTED_WINDOWS_VERSION_UXP"),_.default.getOsVersion())<0&&v.default.get("UNSUPPORTED_WINDOWS_UXP_APPS").includes(e.productCode))))}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return e.abrupt("return",e.sent.map(function(e){var t=v.default.get("ACTIVE_VERSIONS").find(function(t){var r=(v.default.get("FIRST_MILE_PREFETCH_CLIENTS",t)||{})[e.productCode];return 1===_.default.compareMajorMinorVersions(e.productVersion,r)});return e.ccxVersion=e.ccxVersion||v.default.get("START_VERSION",t),e.platform=_.default.getOsPlatform(),e.osVersion=_.default.getOsVersion(),e}));case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_fetchOnDemandContent",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=t.params,a=t.force,s=t.priority,!n.url){e.next=5;break}return e.next=4,B()(J()(r.prototype),"_fetchOnDemandContent",this).call(this,t);case 4:return e.abrupt("return",e.sent);case 5:if(n.id){e.next=7;break}throw new P.default(v.default.analytics.DATA_VALIDATION_ERR,"Cannot add on demand model without id");case 7:return e.next=9,V.downloadTutorial({id:n.id,priority:s,params:n,force:a,analyticsData:{"content.id":n.id},filePrefix:"LCM",status:n.status||"live",map:this});case 9:if(o=e.sent,i=o.path){e.next=13;break}throw new P.default("FETCH","No path downloaded from AEM");case 13:return e.abrupt("return",i);case 14:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getOnDemandLookupKeys",value:function(e){var t,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=null===(t=e.productVersion)||void 0===t?void 0:t.split(".")[0],a=[r||S.default.getUserId()];return a.push(e.productCode,n,e.productLanguage),a}},{key:"getOnDemandAssetPath",value:function(e){var t,r,n,a,s,o,i=e.id,c=void 0===i?"":i,u=e.productLanguage,l=e.status,d=e.productVersion;return e.url?null===(t=this._data)||void 0===t?void 0:null===(r=t.assetMetadata)||void 0===r?void 0:null===(n=r[e.url])||void 0===n?void 0:n.path:null===(a=this._data)||void 0===a?void 0:null===(s=a.assetMetadata)||void 0===s?void 0:null===(o=s[V.getTutorialUrl({id:c,productLanguage:u,status:l,productVersion:d,surface:v.default.get("UTUTS_API_REQUEST_SURFACE",this.type)})])||void 0===o?void 0:o.path}},{key:"_getOnDemandAssetList",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r={},n=Object.values((null===(t=this._data)||void 0===t?void 0:t.onDemandMetadata)||{}),a=0,s=n;case 3:if(!(a<s.length)){e.next=18;break}if(!(o=s[a]).params.id){e.next=14;break}return e.t0=Object,e.t1=r,e.next=10,this.getTutorialAssets(null===(i=this._data)||void 0===i?void 0:null===(c=i.assetMetadata[V.getTutorialUrl({id:o.params.id||"",productLanguage:o.params.productLanguage,status:o.params.status,productVersion:o.params.productVersion,surface:v.default.get("UTUTS_API_REQUEST_SURFACE",this.type)})])||void 0===c?void 0:c.path);case 10:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2),e.next=15;break;case 14:r[(null===(u=this._data)||void 0===u?void 0:null===(l=u.assetMetadata[o.params.url||""])||void 0===l?void 0:l.path)||""]=!0;case 15:a++,e.next=3;break;case 18:return e.abrupt("return",r);case 19:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getTutorialAssets",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",{});case 2:return(n={})[t]=!0,e.next=6,T.readJSON("".concat(this.getPath(),"/").concat(t)).catch(function(e){s.log.error(new P.default("filesystem",e))});case 6:return null==(a=e.sent)||null===(r=a.tutorials)||void 0===r||r.forEach(function(e){var t,r,a,s;null!==(t=e.metadata)&&void 0!==t&&null!==(r=t.images)&&void 0!==r&&r.heroPath&&(n[e.metadata.images.heroPath]=!0),null!==(a=e.metadata)&&void 0!==a&&null!==(s=a.images)&&void 0!==s&&s.thumbnailPath&&(n[e.metadata.images.thumbnailPath]=!0)}),e.abrupt("return",n);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he),He={LABEL:"CCD",ANALYTICS_SUBCATEGORY:"CCD",VULCAN_TYPE:"CCD",LOG_PREFIX:"CCD",LOOKUP_MAP_FILE_VERSION:2,LOOKUP_COLLECTION_FILE_VERSION:1,SUPPORTED_PRODUCTS:{ACCC:"5.0"},DIR:"ccd/",SURFACE_V2_VERSION:"5.4.0",PRIORITY_CHANNEL:L.b.CcdPrimary,SURFACE_PRIORITY:{payment_notification_banner:0,CCD_PMP:0,CCD_QUICK_ACTIONS:100,CCD_USER_FEEDBACK:200,ACCC_APPS_CATALOG:300,CCD_APPS_CATALOG:300,ACCC_CATEGORIES_BANNERS:400,CCD_ALL_APPS_BANNERS:500,ACCC_ALL_APPS_BANNERS:500,CCD_APP_SKELETON:600,ACCC_APP_SKELETON:600,CCD_HOME_SKELETON:600,CCD_FRAMEWORK:600},AEM_SURFACES:["CCD_ALL_APPS_BANNERS","CCD_APPS_CATALOG","CCD_APP_SKELETON","CCD_PMP","CCD_USER_FEEDBACK","CCD_HOME_SKELETON","CCD_FRAMEWORK","CCD_QUICK_ACTIONS","payment_notification_banner"],SECONDARY_SURFACES:["ACCC_ALL_APPS_BANNERS","CCD_ALL_APPS_BANNERS","CCD_HOME_SKELETON","CCD_QUICK_ACTIONS"],TERTIARY_SURFACES:["ACCC_APPS_CATALOG","ACCC_CATEGORIES_BANNERS","CCD_APPS_CATALOG"],QUARTERNARY_SURFACES:["CCD_USER_FEEDBACK","CCD_PMP","payment_notification_banner"],SUPPORTED_LOCALES:["cs_CZ","da_DK","de_DE","en_US","es_ES","es_MX","fi_FI","fr_FR","fr_CA","it_IT","ja_JP","ko_KR","nb_NO","nl_NL","pl_PL","pt_BR","ru_RU","sv_SE","tr_TR","zh_CN","zh_TW"],IGNORE_PERF_EVENTS_FOR_SURFACES:["payment_notification_banner"],ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!0,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function Be(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Xe=function(e){K()(r,e);var t=Be(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",B()(J()(r.prototype),"url",this).call(this,Object.assign(t,{comLocale:t.comLocale||(t.productLanguage?t.productLanguage.substring(0,2):"en"),comCustomerUi:t.comCustomerUi||"cc_desktop"})));case 1:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f,p=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.priority,a=t.id,s=void 0===a?C.v4():a,i=t.skipAuth,!v.default.get("TEMP_CCD_CONTENT_DOWNLOAD_DISABLED")){e.next=5;break}return(c=new Date).setDate(c.getDate()+14),e.abrupt("return",{expirationDTS:c.toISOString(),surfaces:{}});case 5:return e.next=7,this.url(r);case 7:return u=e.sent,e.next=10,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,c,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.t0=p,e.t1=u,e.t2={method:"GET",timeout:v.default.get("SERVER_TIMEOUT"),headers:{"content-type":"application/json","x-gw-ims-user-id":S.default.getUserId(),"X-API-Key":v.default.getEnvironment().CLIENT_ID}},e.t3=n,e.t4=!i,!e.t4){e.next=9;break}return e.next=8,S.default.getAccessToken().catch(function(e){return!1});case 8:e.t4=!!e.sent;case 9:return e.t5=e.t4,e.t6=s,e.t7={url:e.t1,options:e.t2,priority:e.t3,auth:e.t5,id:e.t6},e.next=14,e.t0.get.call(e.t0,e.t7);case 14:return r=e.sent,a=r.response,o=r.time,t.appendPayload({"event.value":o,"event.url":u,"env.svc.name":v.default.get("ANALYTICS_SUBCATEGORY",p.type)}),c=Date.now(),e.next=21,p.getResponseJson(a,u);case 21:return l=e.sent,o+=Date.now()-c,e.abrupt("return",l);case 24:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 10:if(l=e.sent,d=v.default.get("SOPHIA_RESPONSE_SCHEMA"),!(f=_.default.validateDataFields(l,d))){e.next=15;break}throw new P.default(v.default.analytics.PARAM_VALIDATION_ERR,f);case 15:return l.analyticsData&&(l.analyticsData.requestId=s),e.abrupt("return",l);case 17:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Ce);function Ke(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Ye(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ke(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ke(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function qe(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var We=function(e){K()(r,e);var t=qe(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,d=v.default.get("IGNORE_PERF_EVENTS_FOR_SURFACES",this._lookupMap.type).includes(a),e.next=4,this.log.context({analytics:!d,payload:n,surfaceAnalytics:[Ye({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,f.dataManager.downloadData({modeID:a,card:s,lookupMap:f._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,y=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=y.length>0&&void 0!==y[0]?y[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=new P.default(v.default.analytics.AGGREGATE_ERROR,v.default.get("AGGREGATE_TYPE",this._lookupMap.type)+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),f=[],Object.keys(this._data.surfaces).forEach(function(e){var t=!1;f.push(_.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=v.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,v.default.get("SECONDARY_SURFACES",p._lookupMap.type).includes(e)&&(c.channel=L.b.CcdSecondary),v.default.get("TERTIARY_SURFACES",p._lookupMap.type).includes(e)&&(c.channel=L.b.CcdTertiary),v.default.get("QUARTERNARY_SURFACES",p._lookupMap.type).includes(e)&&(c.channel=L.b.CcdQuarternary),s.next=7,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,d.addSubError(Ye(Ye({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 7:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,_.default.waitAll(f);case 9:if(!d.hasSubErrors){e.next=11;break}throw d;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,_.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.dataManager.getReferencedAssets(n,a);case 2:s=e.sent,Object.assign(t,s);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ye);function Je(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Qe=function(e){K()(r,e);var t=Je(r);function r(){var e;return c()(this,r),(e=t.call(this,He))._downloadManager=new Xe(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new We(e,this)}},{key:"_getLookupKeys",value:function(e,t){var r=[t||S.default.getUserId()];return r.push(e.productLanguage),r}},{key:"validateParams",value:function(e){}},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"isRequestPoisoned",value:function(e){return!1}},{key:"generateId",value:function(e){return"".concat(e.productLanguage,"-").concat(C.v4()).trim()}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=null===(n=S.default.getUserInfo())||void 0===n?void 0:n.countryCode,e.next=3,B()(J()(r.prototype),"updateParams",this).call(this,t);case 3:return e.abrupt("return",e.sent.map(function(e){var t=1===_.default.compareMajorMinorVersions(e.productVersion,v.default.get("SURFACE_V2_VERSION",s.type))?["ACCC_ALL_APPS_BANNERS","ACCC_CATEGORIES_BANNERS","ACCC_APPS_CATALOG","ACCC_APP_SKELETON"]:v.default.get("AEM_SURFACES",s.type),r=e.comLocale||(e.productLanguage?e.productLanguage.substring(0,2):"en"),n=e.comCustomerUi||"cc_desktop",o=Object.assign({surfaceId:e.surfaceId,productLanguage:e.productLanguage,productCode:e.productCode||"ACCC",productVersion:e.productVersion,productSemver:e.productSemver||e.productVersion,osVersion:_.default.getOsVersion(),platform:""},a?{countryCode:a}:{},{comLocale:r,comCustomerUi:n},e);return o.surfaceId=t,o.platform=_.default.getOsPlatform(),o}));case 4:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"sanitizeParams",value:function(e){return e.productLanguage=_.default.sanitizeLocale(e.productLanguage,v.default.get("SUPPORTED_LOCALES",this.type)),e}},{key:"targetDetails",value:function(e){return{productCode:"ACCC"}}},{key:"isValidDataForParams",value:function(e){var t=e.id,r=e.params,n=this._data.metadata[t];return!(n&&n.params&&n.params.countryCode&&r.countryCode&&n.params.countryCode!==r.countryCode)}},{key:"addNewCollectionData",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o,i,c,u,l,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.params){e.next=4;break}throw o=new P.default(v.default.analytics.DATA_VALIDATION_ERR,"No parameters to add the collection of."),this.log.error(o),o;case 4:return e.next=6,this.updateParams([t.params]);case 6:return t.params=e.sent[0],e.next=9,this.paramsToId(t.params);case 9:if(i=e.sent,!(c=null===(n=this._data)||void 0===n?void 0:n.metadata[i])){e.next=21;break}if(d=Array.from((null==c?void 0:null===(u=c.params)||void 0===u?void 0:u.surfaceId)||[]).sort(),f=Array.from((null==t?void 0:null===(l=t.params)||void 0===l?void 0:l.surfaceId)||[]).sort(),JSON.stringify(d)===JSON.stringify(f)){e.next=21;break}if(!t||!t.params){e.next=21;break}if(!(p=this._getCollectionInfo(t.params))){e.next=21;break}return delete p.latestId,e.next=21,this.save();case 21:return null!==(a=t.params)&&void 0!==a&&null!==(s=a.surfaceId)&&void 0!==s&&s.includes("ACCC_ALL_APPS_BANNERS")&&(t.progress=function(){}),e.abrupt("return",B()(J()(r.prototype),"addNewCollectionData",this).call(this,t));case 23:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he),ze={LABEL:"DISCOVER_PANEL",ANALYTICS_SUBCATEGORY:"DiscoverPanel",VULCAN_TYPE:"DiscoverPanel",LOG_PREFIX:"DiscoverPanel",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,ACTIVE_VERSIONS:["V1","V2","V3"],DIR:"discover_panel/",SUPPORTED_PRODUCTS:{PHXS:"22.4",ILST:"26.0"},PARAMETERS_SCHEMA:{id:"discover_panel_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},V1:{SURFACES:["Discover_Panel"],PREFETCH_CLIENTS:{PHXS:"22.4"},REQUIRED_SURFACES:[]},V2:{SURFACES:["Discover_Panel","DP_Tool_Techniques_v1"],PREFETCH_CLIENTS:{ILST:"99.9",PHXS:"23.3"},REQUIRED_SURFACES:[]},V3:{SURFACES:["Discover_Panel","DP_Tool_Techniques_v1","in_app_contextual_notifications"],PREFETCH_CLIENTS:{PHXS:"99.9"},REQUIRED_SURFACES:[]},PRIORITY_CHANNEL:L.b.DiscoverPanel,NON_IDEMPOTENT_IMAGES:!0,SURFACE_PRIORITY:{Discover_Panel:100,DP_Tool_Techniques_v1:100,in_app_contextual_notifications:100},ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,SOPHIA_VERBOSE_FLAG_ENABLED:!0,UTUTS_API_REQUEST_SURFACE:"help_json",SUPPORTS_ON_DEMAND:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function Ze(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function $e(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ze(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ze(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var tt=function(e){K()(r,e);var t=et(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,e.next=3,this.log.context({payload:n,surfaceAnalytics:[$e({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.dataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,y=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=y.length>0&&void 0!==y[0]?y[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=[],f=new P.default(v.default.analytics.AGGREGATE_ERROR,v.default.get("AGGREGATE_TYPE",this._lookupMap.type)+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),Object.keys(this._data.surfaces).forEach(function(e){var t=!1;d.push(_.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=v.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,s.next=4,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,f.addSubError($e($e({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 4:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,_.default.waitAll(d);case 9:if(!f.hasSubErrors){e.next=11;break}throw f;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,_.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,r.dataManager.getReferencedAssets(n,a,r._lookupMap);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ye);function rt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var nt=function(e){K()(r,e);var t=rt(r);function r(){var e;return c()(this,r),(e=t.call(this,ze))._downloadManager=new Ce(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new tt(e,this)}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return(n=e.sent).forEach(function(e){var t=a.getClientVersion(e,a.type);e.surfaceId=v.default.get(t,a.type).SURFACES,e.productSemver=e.productSemver||e.productVersion,e.osVersion=_.default.getOsVersion(),e.platform=_.default.getOsPlatform()}),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_checkValidity",value:function(e,t){if(!e||!e.hasValidCards||!e.hasValidCards(t))throw new P.default(m.default.MISSING_DATA,"Failed Sophia Container")}},{key:"getClientVersion",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return _.default.getClientContentVersion(e,t)}},{key:"getTutorialAssets",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",{});case 2:return(n={})[t]=!0,e.next=6,T.readJSON("".concat(this.getPath()).concat(t)).catch(function(e){s.log.error(new P.default("filesystem",e))});case 6:return null==(a=e.sent)||null===(r=a.tutorials)||void 0===r||r.forEach(function(e){var t,r,a,s;null!==(t=e.metadata)&&void 0!==t&&null!==(r=t.images)&&void 0!==r&&r.heroPath&&(n[e.metadata.images.heroPath]=!0),null!==(a=e.metadata)&&void 0!==a&&null!==(s=a.images)&&void 0!==s&&s.thumbnailPath&&(n[e.metadata.images.thumbnailPath]=!0)}),e.abrupt("return",n);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he);function at(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function st(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?at(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):at(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function ot(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var it=function(e){K()(r,e);var t=ot(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"_lookupMap",void 0),a._lookupMap=n,a}return l()(r,[{key:"totalItems",get:function(){var e;return Object.values((null===(e=this._data)||void 0===e?void 0:e.surfaces)||{}).map(function(e){var t;return(null===(t=e.containers)||void 0===t?void 0:t.map(function(e){var t,r;try{e.content=e.content||JSON.parse((null==e?void 0:e.data)||"{}")}catch(e){}return(null===(t=e.content)||void 0===t?void 0:null===(r=t.models)||void 0===r?void 0:r.length)||0}).reduce(function(e,t){return e+t},0))||0}).reduce(function(e,t){return e+t},0)||0}},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,this._data){e.next=3;break}return e.abrupt("return");case 3:return c={count:0,time:0},u={started:[],complete:[],failed:[]},l=Promise.resolve(),d=new P.default(v.default.analytics.AGGREGATE_ERROR,v.default.get("AGGREGATE_TYPE",this._lookupMap.type)+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),e.next=9,this._lookupMap.modelLock.write(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return l=f.log.time(function(){var e=o()(h.a.mark(function e(t){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(null==(s=f._data)||!s.surfaces){e.next=4;break}return e.next=4,_.default.waitAll(Object.values(s.surfaces).map(function(){var e=o()(h.a.mark(function e(s){var l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll((null===(l=s.containers)||void 0===l?void 0:l.map(function(){var e=o()(h.a.mark(function e(t){var n,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.content=t.content||JSON.parse((null==t?void 0:t.data)||"{}"),e.next=3,_.default.waitAll((null===(n=t.content)||void 0===n?void 0:null===(s=n.models)||void 0===s?void 0:s.map(function(){var e=o()(h.a.mark(function e(n){var s,o,l,p,v;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!n.id||!n.prefetch){e.next=14;break}return u.started.push(n.id),i(u),(o=new L.a(r)).value=o.value+(null!==(s=n.priority)&&void 0!==s?s:0)/100,e.next=7,f._lookupMap.downloadModel(n,o,a).catch(function(e){var r,a=void 0;e instanceof P.default&&(a=null===(r=e.ingestPayload)||void 0===r?void 0:r["event.url"]);return d.addSubError(st(st({url:a,id:n.id},t.containerAnalyticsData),{},{err:e})),{path:void 0,time:0}});case 7:return l=e.sent,p=l.path,v=l.time,p?(n.path=p,c.count++,c.time+=v,u.complete.push(n.id)):u.failed.push(n.id),e.next=13,f.save();case 13:i(u);case 14:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 2:t.appendPayload(st(st({},n),{},{"event.count":c.count,"event.value":c.time/c.count}));case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=3,_.default.setTimeoutAsync(10);case 3:case"end":return e.stop()}},e)})));case 9:return e.next=11,l;case 11:if(!d.hasSubErrors){e.next=13;break}throw d;case 13:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},null==(r=this._data)||!r.surfaces){e.next=5;break}return e.next=5,_.default.waitAll(Object.values(r.surfaces).map(function(){var e=o()(h.a.mark(function e(r){var a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll((null==r?void 0:null===(a=r.containers)||void 0===a?void 0:a.map(function(){var e=o()(h.a.mark(function e(r){var a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll((null==r?void 0:null===(a=r.content)||void 0===a?void 0:null===(s=a.models)||void 0===s?void 0:s.map(function(){var e=o()(h.a.mark(function e(r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,n._lookupMap.getModelAssets(r.path);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()))||[]);case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 5:return e.abrupt("return",t);case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ye);function ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var ut=function(e){K()(r,e);var t=ct(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!v.default.get("TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_DISABLED")){e.next=4;break}return(n=new Date).setDate(n.getDate()+14),e.abrupt("return",{expirationDTS:n.toISOString(),surfaces:{}});case 4:return e.next=6,B()(J()(r.prototype),"downloadCollectionDataRaw",this).call(this,t);case 6:return e.abrupt("return",e.sent);case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"url",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return delete t.type,e.abrupt("return",B()(J()(r.prototype),"url",this).call(this,t));case 2:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Ce),lt={ANALYTICS_SUBCATEGORY:"SenseiModels",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,SUPPORTED_PRODUCTS:{PHXS:"22.0"},PARAMETERS_SCHEMA:{id:"sensei_models_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},surfaceId:{type:"array",items:{type:"string"}}},required:["productCode","productVersion"]},LOG_PREFIX:"SenseiModels",DIR:"senseiModels/",LABEL:"SENSEI_MODELS",PRIORITY_CHANNEL:L.b.SenseiModels,VULCAN_TYPE:"SenseiModels",ANONYMOUS_RETRY_DISABLED:!0,DEFAULT_URLS_ENABLED:!0,DEFAULT_DATA_EXPIRATION:864e5,DEFAULT_URL_WIN:"https://cc-cdn.adobe.com/content/neural-filters/sensei/win-models.json",DEFAULT_URL_MAC:"https://cc-cdn.adobe.com/content/neural-filters/sensei/mac-models.json",MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,MODEL_URL_PRODUCTION:"https://senseimds.adobe.io/compositemodels/",MODEL_URL_STAGING:"https://senseimds-stage.adobe.io/compositemodels/",ASSET_MINIMUM_PARTIAL_SIZE:1048576,ASSET_MAX_SOCKETS:16,NON_IDEMPOTENT_IMAGES:!0,SUPPORTS_ON_DEMAND:!0,MAXIMUM_PARALLEL_MODEL_DOWNLOADS:2,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function dt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ft(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?dt(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):dt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function pt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var ht=function(e){K()(r,e);var t=pt(r);function r(){var e;return c()(this,r),e=t.call(this,lt),f()($()(e),"modelLock",void 0),f()($()(e),"downloadModel",void 0),e.downloadModel=_.default.memoize(e._downloadModel,{refresher:function(e){return"pending"!==e.state},resolver:function(e){return e.id},destructor:function(e,t){return"pending"!==t.state}}),e._downloadManager=new ut("SENSEI_MODELS"),e.modelLock=new L.d(v.default.get("MAXIMUM_PARALLEL_MODEL_DOWNLOADS",e.type)),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new it(e,this)}},{key:"generateId",value:function(e){return"".concat(e.productCode,"-").concat(e.productVersion,"-").concat(e.filePrefix?e.filePrefix+"-":"","-").concat(C.v4()).trim()}},{key:"sanitizeParams",value:function(e){var t=!!e.productLanguage,n=B()(J()(r.prototype),"sanitizeParams",this).call(this,e);return t||delete n.productLanguage,n}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return e.abrupt("return",e.sent.map(function(e){delete e.productLanguage,delete e.countryCode;var t=Object.assign({surfaceId:e.surfaceId||["sensei_model"],productSemver:e.productSemver||e.productVersion,productVersion:e.productVersion,osVersion:_.default.getOsVersion(),platform:""},e);return t.platform=_.default.getOsPlatform(),t}));case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e,t){var r=[t||S.default.getUserId()||""];return r.push(e.productCode,(e.productVersion||"").match(/\d*(\.\d+)?/)[0]),r}},{key:"getModelUrl",value:function(e){var t=e.id,r=e.type,n=v.default.get("MODEL_URL_"+v.default.getEnvironment().LABEL.toUpperCase(),this.type);return n+=t,(n=new D.URL(n)).searchParams.set("runtime",r),n.toString()}},{key:"_downloadModel",value:function(){var e=o()(h.a.mark(function e(t,r,n,a){var s,i,c,u,l,d,f,p,y,E=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t.id&&t.type){e.next=2;break}throw new P.default(v.default.analytics.DATA_VALIDATION_ERR,"Cannot add download model without required fields: id: ".concat(t.id," type: model.type"));case 2:if((a=a||{type:"none"}).type=a.type||"none",a.depth=a.depth||0,s=0,i="Asset-"+t.id,c=this.getModelUrl(t),null==(u=this.cachedAsset(c))||!u.path||!("always"!==a.type||a.depth<1)){e.next=20;break}return e.next=12,T.readJson("".concat(this.getPath(),"/").concat(u.path)).catch(function(){});case 12:if(y=e.sent,e.t0=null!=y&&null!==(l=y.targets)&&void 0!==l&&null!==(d=l[t.type])&&void 0!==d&&d.folder,!e.t0){e.next=18;break}return e.next=17,T.pathExists("".concat(this.getPath(),"/").concat(null==y?void 0:null===(f=y.targets)||void 0===f?void 0:null===(p=f[t.type])||void 0===p?void 0:p.folder));case 17:e.t0=e.sent;case 18:if(!e.t0){e.next=20;break}return e.abrupt("return",{time:0,path:u.path});case 20:return e.next=22,this.modelLock.read(o()(h.a.mark(function e(){var a,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,E.fetchAsset({href:c,assetsDir:E.assetsDir,force:{type:"always",depth:3},priority:r,params:ft(ft({},n),{},{filePrefix:t.id}),auth:!0,headers:{"x-api-key":v.default.getEnvironment().CLIENT_ID,"x-forwarded-for":m.default.getIpAddress()},progressKey:i});case 2:return a=e.sent,s+=a.time,u="".concat(E.getPath(),"/").concat(a.path),e.next=7,T.readJson(u);case 7:return l=e.sent,e.next=10,_.default.waitAll(Object.keys((null==l?void 0:l.targets)||{}).map(function(){var e=o()(h.a.mark(function e(o){var c,d,f,p,_,y,g,O,S;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!(f=null==l?void 0:null===(c=l.targets)||void 0===c?void 0:null===(d=c[o])||void 0===d?void 0:d.cdnUri)){e.next=28;break}return p=t.id+"-"+o,e.next=5,E.fetchAsset({key:p,href:f,assetsDir:E.assetsDir,priority:r,force:{type:"always",depth:3},params:n,progressKey:i,headers:{"x-api-key":v.default.getEnvironment().CLIENT_ID,"x-forwarded-for":m.default.getIpAddress()}});case 5:return _=e.sent,s+=_.time,y=A.basename(_.path,".bin"),g="".concat(E.assetsDir,"/").concat(y),e.next=11,T.mkdirp(g);case 11:return e.next=13,T.emptyDir(g);case 13:return e.next=15,N.unzip(A.join(g,"../",A.basename(_.path)),g);case 15:return l.targets[o].folder=A.dirname(_.path)+"/"+y,E.cachedAsset(p).path=l.targets[o].folder,e.next=19,T.remove(E.assetsDir+A.basename(_.path));case 19:return e.next=21,N.writeJsonAtomic(A.dirname(u),A.basename(u),l,!0);case 21:if(O=e.sent,S=a.path,a.path=A.basename(A.dirname(O))+"/"+A.basename(O),S===a.path||!E.cachedAsset(f)){e.next=28;break}return E.cachedAsset(f).path=a.path,e.next=28,E.save();case 28:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 10:return e.abrupt("return",{time:s,path:a.path});case 11:case"end":return e.stop()}},e)})),r);case 22:return e.abrupt("return",e.sent);case 23:case"end":return e.stop()}},e,this)}));return function(t,r,n,a){return e.apply(this,arguments)}}()},{key:"defaultCollectionData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.params,r=t.desiredId,n=_.default.isWindows()?v.default.get("DEFAULT_URL_WIN",this.type):v.default.get("DEFAULT_URL_MAC",this.type),e.next=4,this.downloadManager.get({url:n});case 4:return a=e.sent,e.next=7,a.response.json();case 7:return s=e.sent,o=this._createCollectionData(r),i={surfaces:{sensei_model:{containers:[{containerId:1,containerLabel:"1",dataType:"application/json",data:JSON.stringify(s),containerAnalyticsData:{variationId:"dummy",actionBlockId:"dummy",campaignId:0,containerId:"1",controlGroupId:"",treatmentId:"dummy"},content:s}],surfaceAnalyticsData:{surfaceId:"sensei_model"}}},expirationDTS:new Date(Date.now()+v.default.get("DEFAULT_DATA_EXPIRATION",this.type)).toISOString(),analyticsData:{responseGUID:"dummy",requestId:"dummy"},_ccx:{version:1}},o.setData(i),e.abrupt("return",o);case 12:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_fetchOnDemandContent",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.force,a=t.priority,r.id&&r.type){e.next=3;break}throw new P.default(v.default.analytics.DATA_VALIDATION_ERR,"Cannot add on demand model without required fields: id: ".concat(r.id," type: params.type"));case 3:return s=r.id,o=r.type,i=r.runtime_version,this.modelLock.prioritize(a),e.next=7,this.downloadModel({id:s,type:o,runtime_version:i},a,r,n);case 7:return c=e.sent,u=c.path,e.abrupt("return",u);case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getOnDemandAssetPath",value:function(e){var t,r,n,a=e.id,s=e.type,o=e.runtime_version;return a&&s?null===(t=this._data)||void 0===t?void 0:null===(r=t.assetMetadata)||void 0===r?void 0:null===(n=r[this.getModelUrl({id:a,type:s,runtime_version:o})])||void 0===n?void 0:n.path:void 0}},{key:"_getOnDemandAssetList",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o,i,c,u,l,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r={},n=Object.values((null===(t=this._data)||void 0===t?void 0:t.onDemandMetadata)||{}),a=0,s=n;case 3:if(!(a<s.length)){e.next=16;break}return c=s[a],u=c.params,l=u.id,d=u.type,f=u.runtime_version,p=l&&d?null===(o=this._data)||void 0===o?void 0:null===(i=o.assetMetadata[this.getModelUrl({id:l,type:d,runtime_version:f})])||void 0===i?void 0:i.path:void 0,e.t0=Object,e.t1=r,e.next=11,this.getModelAssets(p);case 11:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 13:a++,e.next=3;break;case 16:return e.abrupt("return",r);case 17:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getModelAssets",value:function(){var e=o()(h.a.mark(function e(t){var r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r={},t){e.next=3;break}return e.abrupt("return",r);case 3:return r[t]=!0,e.next=6,T.readJson(this.assetsDir+"/../"+t).catch(function(){});case 6:return n=e.sent,Object.keys((null==n?void 0:n.targets)||{}).forEach(function(e){var t,a;null!=n&&null!==(t=n.targets)&&void 0!==t&&null!==(a=t[e])&&void 0!==a&&a.folder&&(r[n.targets[e].folder]=!0)}),e.abrupt("return",r);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he),vt={LABEL:"XD",ANALYTICS_SUBCATEGORY:"XD",VULCAN_TYPE:"XD",LOG_PREFIX:"XD",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,ACTIVE_VERSIONS:["V1"],SUPPORTED_PRODUCTS:{SPRK:"43.0"},DIR:"xd/",PARAMETERS_SCHEMA:{id:"xd_client_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"}},required:["productCode","productVersion","productLanguage"]},PRIORITY_CHANNEL:L.b.XdPrimary,SURFACE_PRIORITY:{XD_SURFACE_PRODUCTIVITY_TIP_V1:500},V1:{SURFACES:["XD_SURFACE_PRODUCTIVITY_TIP_V1"],PREFETCH_CLIENTS:{SPRK:"99.0"},SOPHIA_RESPONSE_SCHEMA:{id:"/SOPHIA_RESPONSE",type:"object",properties:{surfaces:{type:"object"},expirationDTS:{type:"string"},version:{type:"number"}},required:["expirationDTS","surfaces"]}},ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function _t(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function yt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?_t(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):_t(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function Et(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var mt=function(e){K()(r,e);var t=Et(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"validateData",value:function(e,t){return _.default.validateDataFields(e,v.default.get(t,this._lookupMap.type).SOPHIA_RESPONSE_SCHEMA)||null}},{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,e.next=3,this.log.context({payload:n,surfaceAnalytics:[yt({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.dataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,y=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=y.length>0&&void 0!==y[0]?y[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=new P.default(v.default.analytics.AGGREGATE_ERROR,v.default.get("AGGREGATE_TYPE",this._lookupMap.type)+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),f=[],Object.keys(this._data.surfaces).forEach(function(e){var t=!1;f.push(_.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=v.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,s.next=4,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,d.addSubError(yt(yt({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 4:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,_.default.waitAll(f);case 9:if(!d.hasSubErrors){e.next=11;break}throw d;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,_.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.dataManager.getReferencedAssets(n,a);case 2:s=e.sent,Object.assign(t,s);case 4:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ye);function gt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Ot=function(e){K()(r,e);var t=gt(r);function r(){var e;return c()(this,r),(e=t.call(this,vt))._downloadManager=new Ce(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new mt(e,this)}},{key:"_getLookupKeys",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null,n=B()(J()(r.prototype),"_getLookupKeys",this).call(this,e,t),a=this.getClientVersion(e,this.type);return n.splice(1,0,a),n}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a,s,o=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return a=null===(n=S.default.getUserInfo())||void 0===n?void 0:n.countryCode,e.next=3,B()(J()(r.prototype),"updateParams",this).call(this,t);case 3:return(s=e.sent).map(function(e){var t=o.getClientVersion(e,o.type);e.surfaceId=v.default.get(t,o.type).SURFACES,e.productSemver=e.productSemver||e.productVersion,e.osVersion=_.default.getOsVersion(),e.platform=_.default.getOsPlatform(),a&&(e.countryCode=a)}),e.abrupt("return",s);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getClientVersion",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return _.default.getClientContentVersion(e,t)}}]),r}(he);function St(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Tt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?St(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):St(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function At(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var It=function(e){K()(r,e);var t=At(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"downloadAsset",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.asset,n=t.link,a=t.priority,s=t.analytics,o=t.params,i=r&&r[n],r&&i&&0!==i.length){e.next=4;break}throw new P.default(v.default.analytics.DATA_VALIDATION_ERR,"Missing stock asset for ".concat(JSON.stringify(i)));case 4:return e.next=6,this._lookupMap.fetchAsset({href:i.toString(),assetsDir:this.assetsDir,priority:a,params:o});case 6:c=e.sent,u=c.path,l=c.time,s&&s.count&&s.time&&(s.time+=l,s.count++),r[n]=u;case 11:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"validateData",value:function(e){return _.default.validateDataFields(e,v.default.get("TEMPLATES_DATA_SCHEMA",this._lookupMap.type))}},{key:"totalItems",get:function(){return this._data&&this._data.templates&&this._data.templates.length||0}},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d,f=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,this._data&&this._data.templates){e.next=3;break}return e.abrupt("return");case 3:return c={count:0,time:0},u=[],l={started:0,complete:0,failed:0},d=new P.default(v.default.analytics.AGGREGATE_ERROR,v.default.get("AGGREGATE_TYPE",this._lookupMap.type)+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),this._data.templates.forEach(function(e){l.started++,i(l);var t=0;function n(){return s.apply(this,arguments)}function s(){return(s=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:2===++t&&(l.complete++,i(l));case 2:case"end":return e.stop()}},e)}))).apply(this,arguments)}e.thumbnail_url&&0!==e.thumbnail_url.length&&e.thumbnail_url.startsWith("http")&&u.push(f.downloadAsset({asset:e,link:"thumbnail_url",priority:r,analytics:c,params:a}).then(n).catch(function(r){var n;d.addSubError({id:null===(n=e.id)||void 0===n?void 0:n.toString(),url:e.thumbnail_url,err:r}),-1!==t&&(l.failed=l.failed+1,i(l),t=-1)})),e.previews&&0!==e.previews.length&&e.previews.forEach(function(s){s&&s.url&&s.url.startsWith("http")&&u.push(f.downloadAsset({asset:s,link:"url",priority:r,analytics:c,params:a}).then(n).catch(function(r){var n;d.addSubError({id:null===(n=e.id)||void 0===n?void 0:n.toString(),url:s.url,err:r}),-1!==t&&(l.failed=l.failed+1,i(l),t=-1)}))})}),e.next=10,this.log.time(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t.appendPayload(Tt(Tt({},n),{},{"event.count":c.count,"event.value":c.time/c.count})),e.next=3,_.default.waitAll(u);case 3:if(!d.hasSubErrors){e.next=5;break}throw d;case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 10:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t={},this._data&&this._data.templates&&this._data.templates.forEach(function(e){e&&e.thumbnail_url&&(t[e.thumbnail_url]=!0),e&&e.previews&&e.previews.forEach(function(e){e&&e.url&&(t[e.url]=!0)})}),e.abrupt("return",t);case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ye);function Ct(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Rt=function(e){K()(r,e);var t=Ct(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.default.getEnvironment(),n=Math.min(100,v.default.get("TEMP_DEFAULT_TEMPLATES_DOWNLOADED")),isNaN(n)&&(n=100),a=new D.URL(v.default.get("URL_".concat(r.LABEL.toUpperCase()),this.type)),s=f()({product:t.productCode,locale:t.productLanguage,country_code:t.countryCode},"search_parameters[limit]","".concat(n)),this.appendUrlSearchParams(a.searchParams,s),e.abrupt("return",a.toString());case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,o,i,c,u,l,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=t.params,n=t.priority,a=t.id,s=void 0===a?C.v4():a,v.default.get("TEMP_DEFAULT_TEMPLATES_DOWNLOADED")){e.next=5;break}return(o=new Date).setDate(o.getDate()+14),e.abrupt("return",{expirationDTS:o.toISOString(),templates:[]});case 5:return e.next=7,this.url(r);case 7:return i=e.sent,e.t0=this,e.t1=i,e.t2={timeout:v.default.get("SERVER_TIMEOUT"),headers:{"X-API-Key":v.default.getEnvironment().CLIENT_ID,"X-Product":"".concat(r.productCode,"/").concat(r.productVersion),"Content-Type":"application/json"}},e.t3=n,e.t4=s,e.next=15,S.default.getAccessToken().catch(function(e){return!1});case 15:return e.t5=!!e.sent,e.t6={url:e.t1,options:e.t2,priority:e.t3,id:e.t4,auth:e.t5},e.next=19,e.t0.get.call(e.t0,e.t6);case 19:return c=e.sent,u=c.response,e.next=23,this.getResponseJson(u,i);case 23:return"number"==typeof(l=e.sent).expirationDTS&&(d=new Date(1e3*l.expirationDTS),l.expirationDTS=d.toISOString()),e.abrupt("return",l);case 26:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Ce),xt={ANALYTICS_SUBCATEGORY:"Stock",LOOKUP_MAP_FILE_VERSION:3,LOOKUP_COLLECTION_FILE_VERSION:1,SUPPORTED_PRODUCTS:{IDSN:"12.0",ILST:"21.0",PHXS:"18.0"},PARAMETERS_SCHEMA:{id:"stock_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"},countryCode:{type:"string"}},required:["productCode","productVersion","productLanguage","countryCode"]},TEMPLATES_DATA_SCHEMA:{id:"STOCK_TEMPLATES_DATA",type:"object",properties:{templates:{type:"array"},expirationDTS:{type:"string"},nb_results:{type:"number"}},required:["expirationDTS"]},LOG_PREFIX:"Stock",URL_STAGING:"https://stock-stage.adobe.io/Rest/Media/1/Search/Templates",URL_PRODUCTION:"https://stock.adobe.io/Rest/Media/1/Search/Templates",DIR:"stock/",LABEL:"STOCK",PRIORITY_CHANNEL:L.b.Stock,ANONYMOUS_RETRY_DISABLED:!0,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,TEMP_DEFAULT_TEMPLATES_DOWNLOADED:100,ASSET_DOWNLOAD_TIMEOUT:36e5};function kt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var bt=function(e){K()(r,e);var t=kt(r);function r(){var e;return c()(this,r),(e=t.call(this,xt))._downloadManager=new Rt(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new It(e,this)}},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(t){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce.default.getInstalledApps();case 2:if(n=e.sent,!t.productCode||!n[t.productCode]){e.next=5;break}return e.abrupt("return");case 5:return e.abrupt("return",B()(J()(r.prototype),"uninstall",this).call(this,t));case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e,t){var r=[t||S.default.getUserId()||""];return r.push(e.productCode,e.productLanguage),r}}]),r}(he);function Nt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var wt=function(e){K()(r,e);var t=Nt(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"totalItems",get:function(){return 1}},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t={},this._data&&this._data.path&&(t[this._data.path]=!0),e.abrupt("return",t);case 3:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.priority,t.payload,n=t.params,e.next=3,this._lookupMap.fetchAsset({href:this._data.user.images[50],assetsDir:this.assetsDir,priority:r,params:n});case 3:return a=e.sent,s=a.path,this._data.path=s,e.abrupt("return");case 7:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(ye);function Dt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Lt=function(e){K()(r,e);var t=Dt(r);function r(){return c()(this,r),t.apply(this,arguments)}return l()(r,[{key:"url",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=v.default.getEnvironment(),n=S.default.getUserId(),a=v.default.get("URL_".concat(r.LABEL.toUpperCase()),this.type),s=new D.URL("".concat(a).concat(n)),this.appendUrlSearchParams(s.searchParams,{card:"0"}),e.abrupt("return",s.toString());case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"downloadCollectionDataRaw",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.params,n=t.priority,a=t.id,void 0===a?C.v4():a,e.next=3,this.url(r);case 3:return s=e.sent,e.next=6,this.log.context({params:r}).time(function(){var e=o()(h.a.mark(function e(t){var r,a,o,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.get({url:s,priority:n,options:{method:"GET",headers:{"X-API-Key":v.default.getEnvironment().CLIENT_ID}}});case 2:return r=e.sent,a=r.response,o=r.time,t.appendPayload({"event.value":o,"event.url":s,"env.svc.name":v.default.get("ANALYTICS_SUBCATEGORY",d.type)}),i=Date.now(),e.next=9,d.getResponseJson(a,s);case 9:return c=e.sent,o+=Date.now()-i,e.abrupt("return",c);case 12:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:if(i=e.sent,c=v.default.get("RESPONSE_SCHEMA",this.type),!(u=_.default.validateDataFields(i,c))){e.next=11;break}throw new P.default(v.default.analytics.PARAM_VALIDATION_ERR,u);case 11:return(l=new Date).setDate(l.getDate()+1),i.expirationDTS=l.toISOString(),e.abrupt("return",i);case 15:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(Ce),Pt={ANALYTICS_SUBCATEGORY:"Avatar",LOG_PREFIX:"Avatar",DIR:"avatar/",LABEL:"AVATAR",VULCAN_TYPE:"Avatar",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,PARAMETERS_SCHEMA:{id:"avatar_parameters",type:"object",properties:{}},RESPONSE_SCHEMA:{id:"avatar_endpoint_schema",type:"object",properties:{user:{type:"object",properties:{images:{type:"object",properties:{50:{type:"string"}},required:["50"]}},required:["images"]}},required:["user"]},SUPPORTED_PRODUCTS:{CCXP:"4.3"},URL_STAGING:"https://cc-api-behance-stage.adobe.io/v2/users/",URL_PRODUCTION:"https://cc-api-behance.adobe.io/v2/users/",PRIORITY_CHANNEL:L.b.Avatar,ANONYMOUS_RETRY_DISABLED:!0,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,ASSET_DOWNLOAD_TIMEOUT:36e5};function Mt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Ut=function(e){K()(r,e);var t=Mt(r);function r(){var e;return c()(this,r),(e=t.call(this,Pt))._downloadManager=new Lt(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new wt(e,this)}},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return");case 1:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e,t){return[t||S.default.getUserId()||""]}},{key:"isRequestPoisoned",value:function(e){return!1}},{key:"generateId",value:function(e){return"".concat(C.v4()).trim()}}]),r}(he);function Ft(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Vt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Ft(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Ft(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function jt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Gt=function(e){K()(r,e);var t=jt(r);function r(e,n){var a;return c()(this,r),a=t.call(this,e,n),f()($()(a),"dataManager",void 0),a.dataManager=new ge(n.type,a._lookupMap.diskLock),a}return l()(r,[{key:"syncDataPromises",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a,s,i,c,u,l,d=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r=t.analyticsParams,n=t.payload,a=t.surface,s=t.card,i=t.priority,c=t.params,u=t.force,l=t.started,e.next=3,this.log.context({payload:n,surfaceAnalytics:[Vt({surface:a},r)]}).time(function(){var e=o()(h.a.mark(function e(t){var r,n,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,d.dataManager.downloadData({modeID:a,card:s,lookupMap:d._lookupMap,priority:i,params:c,started:l,force:u});case 2:r=e.sent,n=r.count,o=r.totalTime,t.appendPayload({"event.url":"URL"===s.dataType&&s.data||"","event.count":n,"event.value":o/n,"exp.surface_id":"".concat(a,"(").concat(s.containerId,")")});case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 3:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"syncData",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,i,c,u,l,d,f,p=this,y=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=y.length>0&&void 0!==y[0]?y[0]:{},r=t.priority,n=t.payload,a=t.params,s=t.progress,i=void 0===s?function(){}:s,c=t.force,u=void 0===c?{type:"none"}:c,this._data){e.next=3;break}return e.abrupt("return");case 3:return l={started:[],complete:[],failed:[]},d=[],f=new P.default(v.default.analytics.AGGREGATE_ERROR,v.default.get("AGGREGATE_TYPE",this._lookupMap.type)+v.default.analytics.AGGREGATE_ERROR_DESCRIPTION),Object.keys(this._data.surfaces).forEach(function(e){var t=!1;d.push(_.default.waitAll((p._data.surfaces[e].containers||[]).map(function(){var s=o()(h.a.mark(function s(o){var c;return h.a.wrap(function(s){for(;;)switch(s.prev=s.next){case 0:return(c=new L.a(r)).value+=v.default.get("SURFACE_PRIORITY",p._lookupMap.type)[e]||0,s.next=4,p.syncDataPromises({analyticsParams:o.containerAnalyticsData,payload:n,surface:e,card:o,priority:c,params:a,force:u,started:function(){l.started.includes(e)||(l.started.push(e),i(Object.assign({},l)))}}).catch(function(r){t=!0,f.addSubError(Vt(Vt({surface:e,url:o.data},o.containerAnalyticsData),{},{err:r}))});case 4:case"end":return s.stop()}},s)}));return function(e){return s.apply(this,arguments)}}())).then(function(){l.started.includes(e)||l.started.push(e),t?l.failed.push(e):l.complete.push(e),i(Object.assign({},l))}))}),e.next=9,_.default.waitAll(d);case 9:if(!f.hasSubErrors){e.next=11;break}throw f;case 11:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"totalItems",get:function(){var e;return null!==(e=this._data)&&void 0!==e&&e.surfaces?Object.keys(this._data.surfaces).length:0}},{key:"getReferencedAssets",value:function(){var e=o()(h.a.mark(function e(){var t,r=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t={},!this._data||!this._data.surfaces){e.next=4;break}return e.next=4,_.default.waitAll(Object.keys(this._data.surfaces).map(function(){var e=o()(h.a.mark(function e(n){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll((r._data.surfaces[n].containers||[]).map(function(){var e=o()(h.a.mark(function e(a){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.t0=Object,e.t1=t,e.next=4,r.dataManager.getReferencedAssets(n,a,r._lookupMap);case 4:e.t2=e.sent,e.t0.assign.call(e.t0,e.t1,e.t2);case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:return e.abrupt("return",t);case 5:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),r}(ye),Ht={LABEL:"COLLECTION_TEMPLATES",ANALYTICS_SUBCATEGORY:"CollectionTemplates",VULCAN_TYPE:"CollectionTemplates",LOG_PREFIX:"CollectionTemplates",LOOKUP_MAP_FILE_VERSION:1,LOOKUP_COLLECTION_FILE_VERSION:1,ACTIVE_VERSIONS:["V1"],DIR:"collectionTemplates/",SUPPORTED_PRODUCTS:{ILST:"26.0"},PARAMETERS_SCHEMA:{id:"stock_collection_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"},countryCode:{type:"string"}},required:["productCode","productVersion","productLanguage","countryCode"]},TEMPLATES_DATA_SCHEMA:{id:"STOCK_COLLECTIONS_DATA",type:"object",properties:{templates:{type:"array"},expirationDTS:{type:"string"},nb_results:{type:"number"}},required:["expirationDTS"]},V1:{SURFACES:["CCX_Start_5.11_Stock"],PREFETCH_CLIENTS:{ILST:"26.0"}},COLLECTION_URL_STAGING:"https://stock-stage.adobe.io/Rest/Media/1/Search/Collections",COLLECTION_URL_PRODUCTION:"https://stock.adobe.io/Rest/Media/1/Search/Collections",PRIORITY_CHANNEL:L.b.CollectionTemplates,SURFACE_PRIORITY:{"CCX_Start_5.11_Stock":0},ANONYMOUS_RETRY_DISABLED:!1,DEFAULT_URLS_ENABLED:!1,MINOR_VERSION_SHOULD_UPDATE_CONTENT:!1,SOPHIA_VERBOSE_FLAG_ENABLED:!0,ASSET_DOWNLOAD_TIMEOUT:36e5};function Bt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var Xt=function(e){K()(r,e);var t=Bt(r);function r(){var e;return c()(this,r),(e=t.call(this,Ht))._downloadManager=new Ce(e.type),e}return l()(r,[{key:"_createCollectionData",value:function(e){return new Gt(e,this)}},{key:"updateParams",value:function(){var e=o()(h.a.mark(function e(t){var n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,B()(J()(r.prototype),"updateParams",this).call(this,t);case 2:return(n=e.sent).forEach(function(e){var t=a.getClientVersion(e,a.type);e.surfaceId=v.default.get(t,a.type).SURFACES,e.productSemver=e.productSemver||e.productVersion,e.osVersion=_.default.getOsVersion(),e.platform=_.default.getOsPlatform()}),e.abrupt("return",n);case 5:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"uninstall",value:function(){var e=o()(h.a.mark(function e(t){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce.default.getInstalledApps();case 2:if(n=e.sent,!t.productCode||!n[t.productCode]){e.next=5;break}return e.abrupt("return");case 5:return e.abrupt("return",B()(J()(r.prototype),"uninstall",this).call(this,t));case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_getLookupKeys",value:function(e,t){var r=[t||S.default.getUserId()||""];return r.push(e.productCode,e.productLanguage),r}},{key:"getClientVersion",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.type;return _.default.getClientContentVersion(e,t)}},{key:"getCollectionAsset",value:function(){var e=o()(h.a.mark(function e(t){var r,n,a=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t){e.next=2;break}return e.abrupt("return",{});case 2:return(r={})[t]=!0,e.next=6,T.readJSON("".concat(this.getPath()).concat(t)).catch(function(e){a.log.error(new P.default("filesystem",e))});case 6:return null==(n=e.sent)||n.files.forEach(function(e){e.thumbnail_url&&(r[e.thumbnail_url]=!0)}),e.abrupt("return",r);case 9:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()}]),r}(he);function Kt(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function Yt(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?Kt(Object(r),!0).forEach(function(t){f()(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):Kt(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}var qt=function(){function e(t){c()(this,e),f()(this,"log",void 0),f()(this,"maps",void 0),f()(this,"_firstMileLookupMap",void 0),f()(this,"_stockLookupMap",void 0),f()(this,"_learnLookupMap",void 0),f()(this,"_downloadManager",void 0),this.log=new y.default({prefix:"ServiceInterface > ",payload:{"event.subtype":m.default.st_CLIENT},combineSubErrors:!0}),this._firstMileLookupMap=t.find(function(e){return"FIRST_MILE"===e.type}),this._stockLookupMap=t.find(function(e){return"STOCK"===e.type}),this._learnLookupMap=t.find(function(e){return"LEARN"===e.type}),this.maps=t}return l()(e,[{key:"init",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:ce.default.addListener(v.default.get("VULCAN_PING_REQUEST"),function(e,t,r){ce.default.sendMessage(v.default.get("VULCAN_PING_RESPONSE"),"",t,r)}),ce.default.addListener(v.default.get("VULCAN_AVATAR_REQUEST"),function(e,t,r){var a=n.log.context({payload:{"event.subcategory":v.default.analytics.sc_CCX_START}}),s=t,i=r;e=JSON.stringify({params:{productCode:t,productVersion:r}}),ce.default.once(v.default.get("VULCAN_AVATAR_RESPONSE_V2"),function(){var e=o()(h.a.mark(function e(t,r,n){var c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(e.prev=0,!(t=JSON.parse(t)).path){e.next=8;break}return e.next=5,T.readFile(t.path,{encoding:"utf-8"});case 5:u=e.sent,l=JSON.parse(u),c={path:"".concat(v.default.get("ROOT_DIR")).concat(v.default.get("DIR","AVATAR")).concat(l.path)};case 8:e.next=14;break;case 10:e.prev=10,e.t0=e.catch(0),a.error(new P.default(v.default.analytics.INVALID_JSON,e.t0),"Unable to parse avatar message: ".concat(t)),c={path:"",err:"Unable to parse avatar message: ".concat(t)};case 14:a.request(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:ce.default.sendMessage(v.default.get("VULCAN_AVATAR_RESPONSE"),JSON.stringify(c),s,i);case 1:case"end":return e.stop()}},e)})));case 15:case"end":return e.stop()}},e,null,[[0,10]])}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.sendMessage(v.default.get("VULCAN_AVATAR_REQUEST_V2"),e,"CCXP","1.0.0")}),ce.default.addListener(v.default.get("VULCAN_PSDK_FEED_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i={};try{i=JSON.parse(t)}catch(e){s=new P.default(v.default.analytics.PARAM_VALIDATION_ERR,e).setContext("Unable to parse PSDK feed data:".concat(t))}return i.psdkParams=i.psdkParams||{},u={"event.context_guid":i.radarSessionGUID||C.v4()},c=n.log.context({params:i&&i.psdkParams,payload:Yt({"event.subcategory":v.default.analytics.sc_SOPHIA},u)}),e.next=7,c.request(o()(h.a.mark(function e(){var t,r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}throw s;case 2:if(S.default.getUserId()){e.next=4;break}throw new Error(v.default.analytics.SIGNED_OUT);case 4:return t=n._firstMileLookupMap,r={requestId:i.requestId,settings:v.default.get("".concat(i.psdkParams.productCode,"_PSDK"),"SETTINGS_".concat(S.default.getUserId()))||{}},e.next=8,t.updateDisplayedId({params:i.psdkParams,displayed:i.psdkParams.displayed});case 8:if(!i.psdkParams.urgent){e.next=17;break}return delete i.psdkParams.urgent,e.next=12,t.addNewCollectionData({params:i.psdkParams,payload:u,priorityLevel:L.c.UrgentRequest,fetchType:"client-request"});case 12:return e.next=14,t.getLatestPath({params:i.psdkParams,updateLastUsedId:!0,updateLastUseTime:!0});case 14:r.path=e.sent,e.next=21;break;case 17:return e.next=19,t.getLatestPath({params:i.psdkParams,updateLastUsedId:!0,updateLastUseTime:!0});case 19:r.path=e.sent,r.path||t.addNewCollectionData({params:i.psdkParams,payload:u,priorityLevel:L.c.BackgroundRequest,fetchType:"client-request"});case 21:return r.path&&(r.path=r.path.replace(/\\/gi,"/")),e.abrupt("return",r);case 23:case"end":return e.stop()}},e)}))).catch(function(e){return{requestId:i.requestId,err:e}});case 7:l=e.sent,ce.default.sendMessage(v.default.get("VULCAN_PSDK_FEED_RESPONSE"),l,r,a);case 9:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(v.default.get("VULCAN_LEARN_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i={};try{i=JSON.parse(t)}catch(e){s=new P.default(v.default.analytics.PARAM_VALIDATION_ERR,e).setContext("Unable to parse Learn feed data:".concat(t))}return i.params=i.params||{},u={"event.context_guid":i.radarSessionGUID||C.v4()},c=n.log.context({params:i&&i.params,payload:Yt({"event.subcategory":v.default.analytics.sc_LEARN},u)}),e.next=7,c.request(o()(h.a.mark(function e(){var t,r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}throw s;case 2:if(S.default.getUserId()){e.next=4;break}throw new P.default(v.default.analytics.SIGNED_OUT,"","X_ERR_USER_SIGNEDOUT");case 4:return t=n._learnLookupMap,r={requestId:i.requestId},e.next=8,t.addNewCollectionData({params:i.params,payload:u,priorityLevel:L.c.BackgroundRequest,fetchType:"client-request"});case 8:return e.next=10,t.getLatestPath({params:i.params,updateLastUsedId:!0,updateLastUseTime:!1});case 10:return r.path=e.sent,r.path&&(r.path=r.path.replace(/\\/gi,"/")),e.abrupt("return",r);case 13:case"end":return e.stop()}},e)}))).catch(function(e){return{requestId:i.requestId,err:e}});case 7:l=e.sent,ce.default.sendMessage(v.default.get("VULCAN_LEARN_RESPONSE"),l,r,a);case 9:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(v.default.get("VULCAN_LEARN_USAGE_MARKER"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.log.context({payload:{"event.subcategory":v.default.analytics.sc_LEARN}}),e.prev=1,o=JSON.parse(t),e.next=5,n._learnLookupMap.getLatestPath({params:o.params,updateLastUsedId:!1,updateLastUseTime:!0});case 5:s.context({params:o.params,payload:{"event.context_guid":o.radarSessionGUID||C.v4()}}).info(v.default.analytics.t_UPDATE,"Update last use time"),e.next=11;break;case 8:e.prev=8,e.t0=e.catch(1),s.error(new P.default(v.default.analytics.PARAM_VALIDATION_ERR,e.t0),"Error parsing learn usage marker");case 11:case"end":return e.stop()}},e,null,[[1,8]])}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(v.default.get("VULCAN_GET_USER_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=n.log.context({payload:{"event.subcategory":v.default.analytics.sc_CCX_START}}),e.next=3,s.request(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:ce.default.sendMessage(v.default.get("VULCAN_GET_USER_RESPONSE"),{userId:S.default.getUserId()},r,a);case 1:case"end":return e.stop()}},e)})));case 3:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(v.default.get("VULCAN_START_SETTINGS_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s=null,i=null;try{i=JSON.parse(t)}catch(e){s=new Error("Unable to parse settings storage request from ".concat(r,"(").concat(a,"): ").concat(t))}return c=n.log.context({params:i,payload:{"event.subcategory":m.default.sc_CCX_START}}),e.next=6,c.request(o()(h.a.mark(function e(){var t,r,n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}throw s;case 2:if(S.default.getUserId()){e.next=4;break}throw new Error("Discarding start settings storage - not logged in");case 4:if(S.default.getUserId()===i.userId){e.next=6;break}throw new Error("Different user in request(".concat(i.userId,") than the one logged in(").concat(S.default.getUserId(),")"));case 6:t="".concat(i.productCode,"_PSDK"),r="SETTINGS_".concat(S.default.getUserId()),n=v.default.get(t,r)||{},Object.keys(i.settings).forEach(function(e){n[e]?Object.assign(n[e],i.settings[e]):n[e]=i.settings[e]}),n.lastModified=(new Date).toISOString(),v.default.set(t,n,r);case 12:case"end":return e.stop()}},e)}))).catch(function(e){return i=null});case 6:i&&ce.default.sendMessage(v.default.get("VULCAN_START_SETTINGS_PATCH_UPDATE"),{settings:i.settings,userId:i.userId},i.productCode);case 7:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(v.default.get("VULCAN_START_SETTINGS_GET_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,o;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s={},o=n.log.context({params:{productCode:r,productVersion:a},payload:{"event.subcategory":m.default.sc_CCX_START,"event.subtype":m.default.st_SETTINGS}});try{s=JSON.parse(t)}catch(e){o.error(new Error("Unable to parse settings get request from ".concat(r,"(").concat(a,"): ").concat(t)))}ce.default.sendMessage(v.default.get("VULCAN_START_SETTINGS_GET_RESPONSE"),{requestId:s.requestId,userId:S.default.getUserId(),settings:v.default.get("".concat(r,"_PSDK"),"SETTINGS_".concat(S.default.getUserId()))||{}},r,a);case 4:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(v.default.get("VULCAN_STOCK_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i={};try{i=JSON.parse(t)}catch(e){(s=new Error(v.default.analytics.PARAM_VALIDATION_ERR)).desc="Unable to parse Stock template request:".concat(t)}return i.stockParams=i.stockParams||{},u={"event.context_guid":i.radarSessionGUID||C.v4()},c=n.log.context({params:i.stockParams,payload:Yt({"event.subcategory":v.default.analytics.sc_STOCK},u)}),e.next=7,c.request(o()(h.a.mark(function e(){var t,r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!s){e.next=2;break}throw s;case 2:if(S.default.getUserId()){e.next=4;break}throw new Error(v.default.analytics.SIGNED_OUT);case 4:return t=n._stockLookupMap,r={requestId:i.requestId},e.next=8,t.getLatestPath({params:i.stockParams,updateLastUsedId:!0,updateLastUseTime:!0});case 8:return r.path=e.sent,r.path||t.addNewCollectionData({params:i.stockParams,priorityLevel:L.c.BackgroundRequest,fetchType:"client-request"}),r.path&&(r.path=r.path.replace(/\\/gi,"/")),e.abrupt("return",r);case 12:case"end":return e.stop()}},e)}))).catch(function(e){return{requestId:i.requestId,err:e}});case 7:l=e.sent,ce.default.sendMessage(v.default.get("VULCAN_STOCK_RESPONSE"),l,r,a);case 9:case"end":return e.stop()}},e)}));return function(t,r,n){return e.apply(this,arguments)}}()),ce.default.addListener(v.default.get("VULCAN_CC_PHOTO_DOWNLOAD_REQUEST"),function(){var e=o()(h.a.mark(function e(t,r,a){var s,i,c,u,l;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i="OZ",c=v.default.analytics.sc_LR_CONTENT,u=v.default.analytics.sc_OZ,e.prev=3,(s=JSON.parse(t)).source&&s.source===v.default.get("CC_SEARCH_IDENTIFIER")&&(i="CCSearch",c=v.default.analytics.sc_CC_SEARCH,u=v.default.analytics.sc_CC_SEARCH_STORAGE),s.source&&s.source===v.default.get("CC_TOUT_DOWNLOAD_IDENTIFIER")&&(i="CCXFileDownload",c=v.default.analytics.sc_CCX_FILE_DOWNLOAD,u=s.downloadSubcategory),e.next=14;break;case 9:return e.prev=9,e.t0=e.catch(3),ce.default.sendMessage(v.default.get("VULCAN_CC_PHOTO_DOWNLOAD_ERROR"),e.t0.toString(),r,a),n.log.context({payload:{"event.subcategory":v.default.analytics.sc_CC_PHOTO,"source.name":r,"source.version":a,"ccxp.mode":"download"}}).error(new P.default(e.t0)),e.abrupt("return");case 14:return e.next=16,n.log.context({payload:{"event.subcategory":c,"source.name":r,"source.version":a,"ccxp.mode":"download"}}).request(o()(h.a.mark(function e(){var t,c,l,d;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=A.join(x.tmpdir(),v.default.get("TMP_PHOTOS_DOWNLOAD_DIRECTORY")),c="".concat(s.id,"-").concat(s.filename),l=t+c,d={id:s.id,path:l.replace(/\\/g,"/")},e.next=6,T.access(l,T.constants.R_OK).catch(function(){var e=o()(h.a.mark(function e(t){var c,d,f,p;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n._downloadManager=n._downloadManager||new Ce(i),c=C.v4(),e.next=4,n.log.context({payload:{"event.subcategory":u,"event.subtype":v.default.analytics.st_API,"source.name":r,"source.version":a,"ccxp.mode":"download"}}).request(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n._downloadManager.get({url:s.url,options:{headers:{"x-api-key":s.clientId}},auth:!0,id:c});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)})));case 4:return d=e.sent,f=d.response,p=f.headers.get("content-length"),e.next=9,N.writeAtomic({response:f,target:l,progress:function(e){ce.default.sendMessage(v.default.get("VULCAN_CC_PHOTO_DOWNLOAD_PROGRESS"),{id:s.id,percentage:100*e/p},r,a)}});case 9:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}());case 6:return e.next=8,_.default.deleteTempFiles(t,void 0).catch(function(e){return n.log.disk("Err deleting temp files - ".concat(e))});case 8:return e.abrupt("return",d);case 9:case"end":return e.stop()}},e)}))).catch(function(e){ce.default.sendMessage(v.default.get("VULCAN_CC_PHOTO_DOWNLOAD_ERROR"),e.toString(),r,a)});case 16:(l=e.sent)&&ce.default.sendMessage(v.default.get("VULCAN_CC_PHOTO_DOWNLOAD_RESPONSE"),l,r,a);case 18:case"end":return e.stop()}},e,null,[[3,9]])}));return function(t,r,n){return e.apply(this,arguments)}}()),null===(t=this._firstMileLookupMap)||void 0===t||t.addListener("newCollection",function(e){ce.default.sendMessage(v.default.get("VULCAN_PSDK_FEED_BROADCAST"),e,e.productCode,e.productVersion)}),null===(r=this._learnLookupMap)||void 0===r||r.addListener("newCollection",function(e){ce.default.sendMessage(v.default.get("VULCAN_LEARN_BROADCAST"),e,e.productCode,e.productVersion)}),this.maps.forEach(function(e){var t=v.default.get("VULCAN_TYPE",e.type),r=function(){var r=o()(h.a.mark(function r(a,s,i,c){var u,l,d,f,p,y,E,g,O,T,A,I,C,R=arguments;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:d=R.length>4&&void 0!==R[4]?R[4]:"client-request",p={};try{p=JSON.parse(a)}catch(e){f=new P.default(v.default.analytics.PARAM_VALIDATION_ERR,"Unable to parse ".concat(t," request:").concat(a))}if(y=void 0,E=null,(g=function(){null!=E&&clearTimeout(E),E=c?setTimeout(function(){n.log.error(new P.default("CCX Process Hung. Quitting",void 0,"X_ERR_PROCESS_HUNG")),m.default.flush(!0,process.exit)},v.default.get("CLIENT_REQUEST_TIMEOUT")):null})(),O=p.params||{},T=p.analytics||{},p.force&&((A=p.force).delay?(d="delayed",y=A.delay):"always"===A.type?d="force-always":"stale"===A.type&&(d="expired")),I=n.log.context({params:O,payload:Yt(Yt(Yt({},T),{},{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",e.type),"ccxp.mode":d},"client-request"!==d&&{"ccxp.force_depth":null===(u=p)||void 0===u?void 0:null===(l=u.force)||void 0===l?void 0:l.depth}),void 0!==y&&{"event.value":y})}),ee.b.status!==ee.b.OFFLINE&&!w.b.isWaitingForBackOff(w.a.NETWORK)){r.next=15;break}return n.log.disk("Incoming client Request while in Network Backoff or Offline - Doing network Check"),r.next=15,ee.b.check(ee.a.CLIENT_REQUEST);case 15:return r.next=17,I.request(o()(h.a.mark(function r(){var n,a,o;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!f){r.next=2;break}throw f;case 2:if(S.default.getUserId()){r.next=4;break}throw new P.default(v.default.analytics.SIGNED_OUT,v.default.analytics.SIGNED_OUT,"X_ERR_USER_SIGNEDOUT");case 4:if(n=_.default.validateDataFields(p,v.default.get("SERVICE_REQUEST_SCHEMA")),!Array.isArray(n)){r.next=7;break}throw n[0];case 7:if(!p.displayed){r.next=10;break}return r.next=10,e.updateDisplayedId(p);case 10:if(c){r.next=15;break}if(!p.updateLastUseTime){r.next=14;break}return r.next=14,e.getLatestPath(p);case 14:return r.abrupt("return");case 15:return a={requestId:p.requestId},r.next=18,e.addNewCollectionData({params:O,payload:T,priorityLevel:p.urgent?L.c.UrgentRequest:L.c.BackgroundRequest,force:Yt(Yt({type:"none"},p.force),{},{from:Date.now()}),fetchType:d,progress:function(e){e.requestId=p.requestId,ce.default.sendMessage("ccxprocess.".concat(t,"Progress"),e,s,i),g()}});case 18:if(o=r.sent,!y){r.next=23;break}a.scheduled=!0,r.next=28;break;case 23:return r.next=25,e.getLatestPath(Yt(Yt({},p),{},{updateLastUsedId:!0,updateLastUseTime:p.urgent?!1!==p.updateLastUseTime:p.updateLastUseTime}));case 25:a.path=r.sent,a.contentId=null==o?void 0:o.id,a.expiry=o&&e.getExpiry(o.id)||(null==o?void 0:o.expiryTime);case 28:return r.abrupt("return",a);case 29:case"end":return r.stop()}},r)}))).catch(function(){var t=o()(h.a.mark(function t(r){var n,a,s,o,i,c;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(a=void 0,s=void 0,!(r instanceof P.default&&null!==(n=r.supportData)&&void 0!==n&&n.id)){t.next=9;break}return t.next=5,e.updatePending({params:O,id:null===(o=r.supportData)||void 0===o?void 0:o.id,updateLastUseTime:p.urgent||p.updateLastUseTime||!1,err:r});case 5:a=null===(i=r.supportData)||void 0===i?void 0:i.path,s=r.subErrorJSON,t.next=14;break;case 9:return t.next=11,e.getPending({params:O,updateLastUseTime:p.urgent||p.updateLastUseTime||!1});case 11:c=t.sent,a=null==c?void 0:c.partial,s=null==c?void 0:c.failures;case 14:return a&&(a=e.getPath()+a),t.abrupt("return",Yt(Yt({requestId:p.requestId,err:r instanceof Error&&!(r instanceof P.default)?{message:r.message}:r},void 0!==a&&{partial:a}),{},{failures:s}));case 16:case"end":return t.stop()}},t)}));return function(e){return t.apply(this,arguments)}}());case 17:C=r.sent,c&&(null!=E&&clearTimeout(E),ce.default.sendMessage("ccxprocess.".concat(t,"Response"),C,s,i));case 19:case"end":return r.stop()}},r)}));return function(e,t,n,a){return r.apply(this,arguments)}}();ce.default.addListener("ccxprocess.".concat(t,"Request"),function(e,t,n){return r(e,t,n,!0)}),ce.default.addListener("ccxprocess.".concat(t,"UsageMarker"),function(e,t,n){return r(e,t,n,!1,"usage-marker")}),e.addListener("newCollection",function(){var r=o()(h.a.mark(function r(n,a){var s;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:return s=e.targetDetails(n),r.t0=ce.default,r.t1="ccxprocess.".concat(t,"Broadcast"),r.t2=n,r.next=6,e.getLatestPath({params:n});case 6:r.t3=r.sent,r.t4=a.id,r.t5={params:r.t2,path:r.t3,contentId:r.t4},r.t6=s.productCode,r.t7=s.productVersion,r.t0.sendMessage.call(r.t0,r.t1,r.t5,r.t6,r.t7);case 12:case"end":return r.stop()}},r)}));return function(e,t){return r.apply(this,arguments)}}()),v.default.get("SUPPORTS_ON_DEMAND",e.type)&&(ce.default.addListener("ccxprocess.".concat(t,"OnDemandRequest"),function(){var r=o()(h.a.mark(function r(a,s,i){var c,u,l,d,f,p,y,E,g,O,T;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:try{f=JSON.parse(a)}catch(e){p=new P.default(v.default.analytics.PARAM_VALIDATION_ERR,"Unable to parse ".concat(t," request:").concat(a))}if(y=null,function(){null!=y&&clearTimeout(y),y=setTimeout(function(){n.log.error(new P.default("CCX Process Hung. Quitting")),m.default.flush(!0,process.exit)},v.default.get("CLIENT_REQUEST_TIMEOUT"))}(),E=(null===(c=f)||void 0===c?void 0:c.params)||{},g=(null===(u=f)||void 0===u?void 0:u.analytics)||{},O=n.log.context({params:E,payload:Yt(Yt({},g),{},{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",e.type),"ccxp.mode":"on-demand","ccxp.request_type":null!==(l=null===(d=f)||void 0===d?void 0:d.action)&&void 0!==l?l:"get"})}),ee.b.status!==ee.b.OFFLINE&&!w.b.isWaitingForBackOff(w.a.NETWORK)){r.next=11;break}return n.log.disk("Incoming On Demand Request while in Network Backoff or Offline - Doing network Check"),r.next=11,ee.b.check(ee.a.ONDEMAND_REQUEST);case 11:return r.next=13,O.request(o()(h.a.mark(function r(){var n,a,o,c,u,l,d;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:if(!p&&f){r.next=2;break}throw p;case 2:if(S.default.getUserId()){r.next=4;break}throw new Error(v.default.analytics.SIGNED_OUT);case 4:if(o=_.default.validateDataFields(f,v.default.get("ON_DEMAND_REQUEST_SCHEMA")),!Array.isArray(o)){r.next=7;break}throw o[0];case 7:c=null!==(n=null===(a=f)||void 0===a?void 0:a.action)&&void 0!==n?n:"get",u={requestId:f.requestId},r.t0=c.toLowerCase(),r.next="get"===r.t0?12:"pause"===r.t0?24:"delete"===r.t0?27:33;break;case 12:return l=e.paramsToOnDemandId(f.params||{}),d=function(e){var r;ce.default.sendMessage("ccxprocess.".concat(t,"OnDemandProgress"),Yt(Yt({},e),{},{requestId:null===(r=f)||void 0===r?void 0:r.requestId}),s,i)},l&&e.on(l,d),r.t1=A,r.t2=e.getPath(),r.next=19,e.getOnDemandData({params:f.params,force:f.force,updateLastUseTime:!0,priorityLevel:L.c.UrgentRequest}).finally(function(){l&&e.off(l,d)});case 19:return r.t3=r.sent,r.t4=r.t2+r.t3,u.path=r.t1.normalize.call(r.t1,r.t4),l&&e.off(l,d),r.abrupt("break",33);case 24:return r.next=26,e.onDemandAbort(f.params);case 26:return r.abrupt("break",33);case 27:return r.next=29,e.onDemandAbort(f.params);case 29:return r.next=31,e.clearOnDemandCollectionInfo(E,e.paramsToOnDemandId(E),!1);case 31:return e.sync(),r.abrupt("break",33);case 33:return r.abrupt("return",u);case 34:case"end":return r.stop()}},r)}))).catch(function(e){var t;return{requestId:null===(t=f)||void 0===t?void 0:t.requestId,err:e instanceof Error&&!(e instanceof P.default)?{message:e.message}:e}});case 13:T=r.sent,null!=y&&clearTimeout(y),ce.default.sendMessage("ccxprocess.".concat(t,"OnDemandResponse"),T,s,i);case 16:case"end":return r.stop()}},r)}));return function(e,t,n){return r.apply(this,arguments)}}()),ce.default.addListener("ccxprocess.".concat(t,"OnDemandListRequest"),function(){var r=o()(h.a.mark(function r(a,s,i){var c,u,l,d,f,p,y,E;return h.a.wrap(function(r){for(;;)switch(r.prev=r.next){case 0:try{l=JSON.parse(a)}catch(e){d=new P.default(v.default.analytics.PARAM_VALIDATION_ERR,"Unable to parse ".concat(t," request:").concat(a))}return f=(null===(c=l)||void 0===c?void 0:c.params)||{},p=(null===(u=l)||void 0===u?void 0:u.analytics)||{},y=n.log.context({params:f,payload:Yt(Yt({},p),{},{"event.subcategory":v.default.get("ANALYTICS_SUBCATEGORY",e.type),"ccxp.mode":"on-demand","ccxp.request_type":"list"})}),r.next=6,y.request(o()(h.a.mark(function t(){var r,n,a,s;return h.a.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:if(!d&&l){t.next=2;break}throw d;case 2:if(n=_.default.validateDataFields(l,v.default.get("ON_DEMAND_LIST_REQUEST_SCHEMA")),!Array.isArray(n)){t.next=5;break}throw n[0];case 5:if(l.params){t.next=7;break}throw new P.default(v.default.analytics.PARAM_VALIDATION_ERR,"Need params to get the list for");case 7:return a=e.getOnDemandCollection(l.params),s=[],a&&(s=Object.keys(a).map(function(t){var r,n={key:t,state:a[t]},s=null===(r=e.cachedAsset(t))||void 0===r?void 0:r.path;return s&&(n.path=A.normalize(e.getPath()+s)),n})),t.abrupt("return",{requestId:null===(r=l)||void 0===r?void 0:r.requestId,list:s});case 11:case"end":return t.stop()}},t)}))).catch(function(e){var t;return{requestId:null===(t=l)||void 0===t?void 0:t.requestId,err:e instanceof Error&&!(e instanceof P.default)?{message:e.message}:e}});case 6:E=r.sent,ce.default.sendMessage("ccxprocess.".concat(t,"OnDemandListResponse"),E,s,i);case 8:case"end":return r.stop()}},r)}));return function(e,t,n){return r.apply(this,arguments)}}()))}),ce.default.sendMessage(v.default.get("VULCAN_STARTUP_MESSAGE"),"","","");case 14:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()}]),e}(),Wt=r(49),Jt=r(60),Qt=new(function(){function e(){var t=this;c()(this,e),f()(this,"isKillSwitchEnabled",_.default.memoize(function(){var e=o()(h.a.mark(function e(r){var n,a,s,o,i,c,u,l,d,f,p,y,E,m,g;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=v.default.get("TEMP_STOCK_TEMPLATE_DOWNLOAD_LIMIT_REGISTRY_SETTING"),a=v.default.get("TEMP_CCD_CONTENT_DOWNLOAD_REGISTRY_SETTING"),s=v.default.get("TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_REGISTRY_SETTING"),o=v.default.get("TEMP_NETWORK_STATUS_REGISTRY_SETTING"),i=function(e,t){t&&(null!==t[n]&&void 0!==t[n]&&v.default.set("TEMP_DEFAULT_TEMPLATES_DOWNLOADED",parseInt(t[n])),v.default.set("TEMP_CCD_CONTENT_DOWNLOAD_DISABLED",!!parseInt(t[a])),v.default.set("TEMP_SENSEI_MODELS_CONTENT_DOWNLOAD_DISABLED",!!parseInt(t[s])),v.default.set("TEMP_NETWORK_STATUS_DISABLED",!!parseInt(t[o]))),r(e,t)},!_.default.isWindows()){e.next=29;break}return c={},e.prev=7,l=null,d=null,f=null,p=null,e.next=14,t.getRegistryByKey(Jt.HKLM,v.default.get("TEMP_KILL_SWITCH_REGISTRY_KEY"));case 14:if(y=e.sent)for(E=0;E<y.length;E++)y[E].name===n?l=y[E].value:y[E].name===a?d=y[E].value:y[E].name===s?f=y[E].value:y[E].name===o&&(p=y[E].value);c[n]=l,c[a]=d,c[s]=f,c[o]=p,i(u,c),e.next=27;break;case 23:e.prev=23,e.t0=e.catch(7),u=e.t0,i(u,c);case 27:e.next=31;break;case 29:try{m=Wt.readFileSync(v.default.get("TEMP_KILL_SWITCH_PLIST_PATH"))}catch(e){g=e}i(g,m);case 31:case"end":return e.stop()}},e,null,[[7,23]])}));return function(t){return e.apply(this,arguments)}}(),{timeout:v.default.get("KILLSWITCH_MEMOIZE_TIMEOUT")}))}return l()(e,[{key:"getRegistryByKey",value:function(){var e=o()(h.a.mark(function e(t,r){var n,a;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n=new Jt({hive:t,key:r}),a=function(){return new Promise(function(e){n.values(function(t,r){t?e(null):r&&r.length?e(r):e(null)})})},e.abrupt("return",a());case 3:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()}]),e}()),zt=r(30);function Zt(e){var t=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){})),!0}catch(e){return!1}}();return function(){var r,n=J()(e);if(t){var a=J()(this).constructor;r=Reflect.construct(n,arguments,a)}else r=n.apply(this,arguments);return q()(this,r)}}var $t=function(e){K()(r,e);var t=Zt(r);function r(){var e;return c()(this,r),e=t.call(this),f()($()(e),"log",void 0),e.log=new y.default({prefix:"DebugInterface > ",payload:{"event.subcategory":v.default.analytics.sc_PROCESS,"event.subtype":v.default.analytics.st_ANS}}),e}return l()(r,[{key:"init",value:function(){this.log.disk("**********Initializing DEBUG Interface*****"),this.addNetworkDebugListeners()}},{key:"addNetworkDebugListeners",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce.default.addListener("TRIGGER_OS_NETWORK_NOTIFCATION",function(){t.log.disk("Triggering Reachability Notification: ",zt.ReachabilityChanged),ee.b.emit(zt.ReachabilityChanged)});case 2:return e.next=4,ce.default.addListener("TOGGLE_NETWORK_STATUS",o()(h.a.mark(function e(){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return r="[DEBUG_INTERFACE]"+C.v4(),e.next=3,ee.b.isOnline();case 3:if(e.sent){e.next=10;break}return t.log.disk("Current Network Status is OFFLINE. Moving to Online. ID ".concat(r)),e.next=8,ee.b.emitAndSetStatus(ee.b.ONLINE,ee.b.OFFLINE,r);case 8:e.next=13;break;case 10:return t.log.disk("Current Network Status is ONLINE. Moving to Offline. ID ".concat(r)),e.next=13,ee.b.emitAndSetStatus(ee.b.OFFLINE,ee.b.ONLINE,r);case 13:case"end":return e.stop()}},e)})));case 4:return e.next=6,ce.default.addListener("SET_ONLINE",o()(h.a.mark(function e(){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r="[DEBUG_INTERFACE]"+C.v4(),t.setOnline(r);case 2:case"end":return e.stop()}},e)})));case 6:return e.next=8,ce.default.addListener("SET_OFFLINE",o()(h.a.mark(function e(){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r="[DEBUG_INTERFACE]"+C.v4(),t.setOffline(r);case 2:case"end":return e.stop()}},e)})));case 8:return e.next=10,ce.default.addListener("NETWORK_STATUS",o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:t.log.disk("****** Current Network Status is: ",ee.b.status);case 1:case"end":return e.stop()}},e)})));case 10:ce.default.addListener("FORCE_REFRESH_TEST",function(e){t.log.disk("************ Force Refresh Test ************"),t.log.disk("payload: ",e),t.log.disk("********************************************"),G.default.emit(G.default.events.FORCE_REFRESH,void 0,JSON.parse(e))});case 11:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"setOnline",value:function(e){var t=ee.b.status;this.log.disk("".concat(e," -- Current Network Status ").concat(t," . Changing status to ONLINE.")),ee.b.status=ee.b.ONLINE,ee.b.emit(ee.b.ONLINE,t,e)}},{key:"setOffline",value:function(e){var t=ee.b.status;this.log.disk("".concat(e," -- Current Network Status ").concat(t," . Changing status to OFFLINE.")),ee.b.status=ee.b.OFFLINE,ee.b.emit(ee.b.OFFLINE,t,e)}}]),r}(ne.EventEmitter),er=function(){function e(){c()(this,e),f()(this,"log",void 0),f()(this,"initialHealthMetric",{MEMORY:void 0,TIME:void 0}),y.default.init(),this.log=new y.default({prefix:"Main > ",payload:{"event.subcategory":v.default.analytics.sc_PROCESS,"event.subtype":v.default.analytics.st_PROCESS}})}return l()(e,[{key:"init",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.monitorHealth();case 2:return setTimeout(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.getCurrentHealthMetric();case 2:t.initialHealthMetric=e.sent,t.log.disk("Initial Memory Metric:",JSON.stringify(t.initialHealthMetric)),t.log.context({payload:{"event.subcategory":"Metrics","ccxp.metric_ram":t.initialHealthMetric.MEMORY}}).info(v.default.analytics.t_PERFORMANCE);case 5:case"end":return e.stop()}},e)})),v.default.get("INITIAL_HEALTH_MEASUREMENT_DELAY")),e.abrupt("return",this);case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"monitorHealth",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o,i,c,u,l,d,f,p=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if((t=new Date(v.default.get("HEALTH_POLL")||"2010-01-01T00:00:00Z")).setMilliseconds(v.default.get("HEALTH_POLL_INTERVAL")),!(t<new Date)){e.next=27;break}return r=process.cpuUsage(),n=process.hrtime(),e.next=7,_.default.setTimeoutAsync(v.default.get("CPU_POLL_DURATION"));case 7:return a=process.cpuUsage(r),s=process.hrtime(n),o=(100*(a.system+a.user)/(1e6*s[0]+s[1]/1e3)).toFixed(2),e.next=12,_.default.getDiskSize().catch(function(e){return p.log.error(new P.default(e,"Error getting disk size")),-1});case 12:return e.t0=e.sent,e.t1=1048576,i=(e.t0/e.t1).toFixed(2),e.next=17,this.calcMemChange();case 17:c=e.sent,u=c.elapsedTimeMs,l=c.percMemChange,d=c.normalizedMemChange,f=(process.memoryUsage().rss/1048576).toFixed(2),isNaN(d)&&isNaN(l)&&isNaN(u)?this.log.disk("Mem metric not available due to -- Elapsed Time ".concat(u,", mem change per hour ").concat(d,", mem change per hour ").concat(l)):(this.log.context({payload:{"event.subcategory":"Metrics","ccxp.metric_cpu":o,"ccxp.metric_disk":i,"ccxp.metric_ram":f,"ccxp.metric_perc_memdiff":null==l?void 0:l.toFixed(2),"ccxp.metric_perc_memdiff_normalized":null==d?void 0:d.toFixed(2),"ccxp.metric_elapsedms":u}}).info(v.default.analytics.t_PERFORMANCE),this.log.disk("CPU: ".concat(o,"%, RAM: ").concat(f,"MB, Disk: ").concat(i,"MB")),this.log.disk("RAM Change: ".concat(null==l?void 0:l.toFixed(2),"%, RAM Change/Hr: ").concat(null==d?void 0:d.toFixed(4),"%, Elapsed Time: ").concat(u&&(u/36e5).toFixed(2)," Hours"))),v.default.set("HEALTH_POLL",(new Date).toISOString()),setTimeout(this.monitorHealth.bind(this),v.default.get("HEALTH_POLL_INTERVAL")),e.next=28;break;case 27:setTimeout(this.monitorHealth.bind(this),t.valueOf()-(new Date).valueOf());case 28:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"calcMemChange",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,this.getInitialMetric();case 2:return t=e.sent,e.next=5,this.getCurrentHealthMetric();case 5:r=e.sent,n=0,a=0,s=0;try{n=(r.MEMORY-t.MEMORY)/(t.MEMORY<=0?1:t.MEMORY)*100,a=r.TIME-t.TIME,s=n/(a/36e5)}catch(e){this.log.disk("Calculation Error: ".concat(e)),this.log.disk("Start: ".concat(JSON.stringify(t)," -- End: ").concat(JSON.stringify(r)))}return e.abrupt("return",{elapsedTimeMs:a,percMemChange:n,normalizedMemChange:s});case 9:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getInitialMetric",value:function(){var e=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.abrupt("return",this.initialHealthMetric);case 1:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"getCurrentHealthMetric",value:function(){var e=o()(h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return(t={}).MEMORY=(process.memoryUsage().rss/1048576).toFixed(2),t.TIME=new Date,e.abrupt("return",t);case 4:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()}]),e}();function tr(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(!e)return;if("string"==typeof e)return rr(e,t);var r=Object.prototype.toString.call(e).slice(8,-1);"Object"===r&&e.constructor&&(r=e.constructor.name);if("Map"===r||"Set"===r)return Array.from(e);if("Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return rr(e,t)}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,a=function(){};return{s:a,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:a}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,o=!0,i=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return o=e.done,e},e:function(e){i=!0,s=e},f:function(){try{o||null==r.return||r.return()}finally{if(i)throw s}}}}function rr(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=new Array(t);r<t;r++)n[r]=e[r];return n}var nr=function(){function e(){c()(this,e),f()(this,"log",void 0),f()(this,"maps",void 0),f()(this,"firstMileLookupMap",void 0),f()(this,"stockLookupMap",void 0),f()(this,"learnLookupMap",void 0),f()(this,"ccdLookupMap",void 0),f()(this,"senseiModelsLookupMap",void 0),f()(this,"xdLookupMap",void 0),f()(this,"discoverPanelLookupMap",void 0),f()(this,"avatarLookupMap",void 0),f()(this,"collectionTemplatesLookupMap",void 0),f()(this,"lastKnownCredentials",void 0),f()(this,"serviceInterface",void 0),f()(this,"debugInterface",void 0),f()(this,"healthMonitor",void 0),y.default.init(),this.log=new y.default({prefix:"Main > ",payload:{"event.subcategory":v.default.analytics.sc_PROCESS,"event.subtype":v.default.analytics.st_PROCESS}}),O.startPoll(),this.stockLookupMap=new bt,this.firstMileLookupMap=new we,this.learnLookupMap=new Ge,this.ccdLookupMap=new Qe,this.senseiModelsLookupMap=new ht,this.xdLookupMap=new Ot,this.discoverPanelLookupMap=new nt,this.avatarLookupMap=new Ut,this.collectionTemplatesLookupMap=new Xt,this.maps=[this.firstMileLookupMap,this.stockLookupMap,this.learnLookupMap,this.ccdLookupMap,this.senseiModelsLookupMap,this.xdLookupMap,this.discoverPanelLookupMap,this.avatarLookupMap,this.collectionTemplatesLookupMap],this.lastKnownCredentials={},this.serviceInterface=new qt(this.maps),this.debugInterface=v.default.get("DEBUG_MODE")?new $t:void 0,this.healthMonitor=new er}return l()(e,[{key:"sync",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this,a=arguments;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(t=a.length>0&&void 0!==a[0]?a[0]:this.maps,r=a.length>1&&void 0!==a[1]?a[1]:{type:"none"},S.default.getUserId()){e.next=4;break}return e.abrupt("return");case 4:return e.next=6,_.default.waitAll(t.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.sync(r).catch(function(e){n.log.disk("Failed to sync ".concat(t.type),e)});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 6:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"updateLookupMapWithInstalledApps",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(S.default.getUserId()){e.next=2;break}return e.abrupt("return");case 2:return e.next=4,_.default.waitAll(this.maps.map(function(){var e=o()(h.a.mark(function e(r){var n;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,V.getMissingProductList(r);case 2:return n=e.sent,e.t0=_.default,e.next=6,r.updateParams(n);case 6:return e.t1=e.sent.map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,r.addNewCollectionData({params:t});case 2:return e.abrupt("return",e.sent);case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=9,e.t0.waitAll.call(e.t0,e.t1);case 9:return e.next=11,V.getExcessProductList(r.getCachedRequestData());case 11:e.sent.forEach(function(e){r.uninstall(e).catch(function(r){t.log.context({params:e}).error(new P.default("Uninstall Error - LookupUpdate",r))})});case 13:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 4:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"setProxyCredentials",value:function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t||this.lastKnownCredentials.user===t||this.lastKnownCredentials.password===r){e.next=5;break}return this.lastKnownCredentials={user:t,password:r},j.a.setProxyCredentials(t,r),e.next=5,this.sync();case 5:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"setUserAnalyticsFlag",value:function(){var e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];m.default.enable(e)}},{key:"prefetchData",value:function(){var e=this;if(S.default.getUserId()){var t=_.default.getClientsThatNeedRefresh(this.firstMileLookupMap);Object.keys(t).forEach(function(r){t[r].forEach(function(t){var n=JSON.parse(JSON.stringify(t));n.ccxVersion=v.default.get("START_VERSION",r),delete n.radarSessionGUID,delete n.requestId,e.firstMileLookupMap.isRequestPoisoned(n)||e.firstMileLookupMap.addNewCollectionData({params:n}).catch(function(t){return e.log.context({params:n}).disk(t,"Error pre-fetching")})})})}}},{key:"addProductInfoToLookup",value:function(){var e=o()(h.a.mark(function e(t,r){var n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.waitAll(this.maps.map(function(){var e=o()(h.a.mark(function e(a){var s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(s=v.default.get("SUPPORTED_PRODUCTS",a.type),null==t||!t.productCode||!s[t.productCode]||1===_.default.compareMajorMinorVersions(t.productVersion,s[t.productCode])){e.next=8;break}return e.t0=_.default,e.next=5,a.updateParams([t]);case 5:return e.t1=e.sent.map(function(){var e=o()(h.a.mark(function e(s){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,a.addNewCollectionData({params:s,priorityLevel:r}).catch(function(e){n.log.context({params:t}).disk(e,"Error adding new ".concat(a.type," product"))});case 2:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),e.next=8,e.t0.waitAll.call(e.t0,e.t1);case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 2:case"end":return e.stop()}},e,this)}));return function(t,r){return e.apply(this,arguments)}}()},{key:"forceRefresh",value:function(){var e=o()(h.a.mark(function e(t,r){var n,a,s,i,c,u,l,d,f,p,E=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(n=S.default.getUserId()){e.next=3;break}return e.abrupt("return");case 3:if(a=new y.default({prefix:"Force Refresh > ",payload:{"event.workflow":v.default.analytics.w_NOTIFICATION,"event.subcategory":v.default.analytics.sc_FORCE_REFRESH}}),!(s=_.default.validateDataFields(r,v.default.get("FORCE_REFRESH_SCHEMA")))){e.next=7;break}throw new P.default(m.default.DATA_VALIDATION_ERR,"Invalid data: ".concat(JSON.stringify(null===(i=s[0])||void 0===i?void 0:i.message)));case 7:if(e.prev=7,c=r.expire,u=void 0===c?{}:c,l=r.force,d=void 0===l?{type:"stale"}:l,f=Object.keys(u).filter(function(e){return!!E.maps.find(function(t){return t.type===e})}),!((p=this.maps.filter(function(e){return f.includes(e.type)})).length<1)){e.next=13;break}return e.abrupt("return");case 13:return e.next=15,w.b.updateBackOff({clear:!0,type:w.a.NETWORK,sync:!1});case 15:return e.next=17,w.b.updateBackOff({clear:!0,type:w.a.AUTH,sync:!1});case 17:return a.context({payload:{"event.subtype":v.default.analytics.t_REQUEST,"event.value":f.join(", ")}}).info(v.default.analytics.st_RECEIVED),e.next=20,Promise.all(p.map(function(){var e=o()(h.a.mark(function e(r){var a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(a=[],t&&a.push(r.setLastTimeOfNotification(t)),!0!==u[r.type]){e.next=6;break}return e.next=5,r.expireAll(n);case 5:return e.abrupt("return",e.sent);case 6:if(s=u[r.type]||[],!Array.isArray(s)){e.next=12;break}return s.forEach(function(e){if(!e.productCode)throw new P.default(m.default.DATA_VALIDATION_ERR,"No product code provided: ".concat(JSON.stringify(s)));e.productCode&&(e.productCode=_.default.getProductAlias(e.productCode),a.push(r.forceRefresh(e)))}),e.next=11,Promise.all(a);case 11:return e.abrupt("return",e.sent);case 12:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 20:return e.next=22,this.sync(p,d);case 22:a.context({payload:{"event.subtype":v.default.analytics.t_REQUEST,"event.value":f.join(", ")}}).info(v.default.analytics.st_FINISHED),e.next=28;break;case 25:throw e.prev=25,e.t0=e.catch(7),e.t0;case 28:case"end":return e.stop()}},e,this,[[7,25]])}));return function(t,r){return e.apply(this,arguments)}}()},{key:"registerNotifications",value:function(){var e=o()(h.a.mark(function e(){var t,r,n=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:S.default.on("SIGN_OUT",function(){return n.setUserAnalyticsFlag(!1)}),w.b.on(w.b.SYNC,_.default.throttle(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return n.log.disk("Global backoff over, syncing data."),e.next=3,n.sync();case 3:case"end":return e.stop()}},e)})),v.default.get("GLOBAL_BACKOFF_SYNC_THROTTLE"))),S.default.on("SIGN_IN",o()(h.a.mark(function e(){var t,r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.updateLookupMapWithInstalledApps().catch(function(e){n.log.error(new P.default("Failed to update lookup map on sign in",e))});case 2:return e.next=4,G.default.getUserAnalyticsEnabledFlag().catch(function(e){n.log.error(new P.default("Could not enable analytics on sign in",e))});case 4:return t=e.sent,r=t.enabled,n.setUserAnalyticsFlag(r),n.prefetchData(),e.next=10,n.sync();case 10:case"end":return e.stop()}},e)}))),G.default.addListener(G.default.events.PROXY_SETTINGS_CHANGED,function(){var e=o()(h.a.mark(function e(t,r){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,n.setProxyCredentials(t,r);case 2:case"end":return e.stop()}},e)}));return function(t,r){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.FORCE_REFRESH,function(e,t){n.forceRefresh(e,t).catch(function(e){n.log.context({prefix:"Force Refresh > ",payload:{"event.workflow":v.default.analytics.w_NOTIFICATION,"event.subcategory":v.default.analytics.sc_FORCE_REFRESH,"event.value":t}}).error(e)})}),G.default.addListener(G.default.events.PROFILE_UPDATED,function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=3;break}return e.next=3,n.firstMileLookupMap.setLastTimeOfNotification(t);case 3:return e.next=5,n.sync([n.firstMileLookupMap],{type:"always"});case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.SUBSCRIPTION_STATUS_CHANGED,function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=5;break}return e.next=3,n.firstMileLookupMap.setLastTimeOfNotification(t);case 3:return e.next=5,n.stockLookupMap.setLastTimeOfNotification(t);case 5:return e.next=7,n.sync([n.firstMileLookupMap]);case 7:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.UPDATE_STOCK,function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=3;break}return e.next=3,n.stockLookupMap.setLastTimeOfNotification(t);case 3:return e.next=5,n.sync([n.stockLookupMap],{type:"always"});case 5:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.INSTALL_APPLICATION,function(e){n.log.context({params:e}).disk("Handle installApplication"),ce.default.clearInstalledAppsCache(),n.addProductInfoToLookup(e,L.c.Installation)}),t={},G.default.addListener(G.default.events.UPDATE_APPLICATION,function(){var e=o()(h.a.mark(function e(r){var a,s,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,ce.default.getInstalledApps();case 2:return e.t0=r.productCode,s=e.sent[e.t0],t[r.productCode]=Object.assign(null!=s?s:{},null!==(a=t[r.productCode])&&void 0!==a?a:{}),n.log.context({params:r}).disk("Handle updateApplication event"),n.addProductInfoToLookup(r,L.c.Installation),e.next=9,_.default.setTimeoutAsync(1e3);case 9:return ce.default.clearInstalledAppsCache(),e.next=12,ce.default.getInstalledApps();case 12:return e.t1=r.productCode,i=e.sent[e.t1],e.next=16,_.default.waitAll(Object.keys(t[r.productCode]).map(function(){var e=o()(h.a.mark(function e(a){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(i[a]){e.next=3;break}return e.next=3,_.default.waitAll(n.maps.map(function(){var e=o()(h.a.mark(function e(n){var s,i;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return s=t[r.productCode][a],i={productCode:s.SAPCode,productVersion:s.CodexVersion,productLanguage:r.productLanguage,countryCode:r.countryCode},e.next=4,n.update(i,r);case 4:return e.next=6,_.default.waitAll(s.InstallLanguage.split(",").map(function(){var e=o()(h.a.mark(function e(t){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:i.productLanguage=t;case 1:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 6:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 3:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()));case 16:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.addListener(G.default.events.UNINSTALL_APPLICATION,function(){var e=o()(h.a.mark(function e(t){var r;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,_.default.setTimeoutAsync(1e3);case 2:return n.log.context({params:t}).disk("Handle uninstallApplication event"),ce.default.clearInstalledAppsCache(),e.next=6,ce.default.getInstalledApps();case 6:(r=e.sent)[t.productCode]&&(r[t.productCode][t.productVersion]||r[t.productCode][t.productVersion+".0"])?n.log.disk("Ignoring uninstall as the version or alias is already installed."):(n.log.disk("Removing ".concat(t.productCode,"[").concat(t.productVersion,"]")),n.maps.forEach(function(e){return e.uninstall(t).catch(function(e){n.log.context({params:t}).error(new P.default("Uninstall Error - Notification",e))})}));case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),j.a.addListener("change",function(){var e=o()(h.a.mark(function e(t){var r,a,s;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(!t){e.next=8;break}return e.next=3,G.default.getProxyCredentials();case 3:return r=e.sent,a=r.user,s=r.password,e.next=8,n.setProxyCredentials(a,s);case 8:case"end":return e.stop()}},e)}));return function(t){return e.apply(this,arguments)}}()),G.default.registerANSNotifications(),S.default.getUserId()&&(r=this.maps.map(function(e){return e.getLastTimeOfNotification()}),G.default.checkForMissedNotifications(r[0],r[1],Math.max.apply(Math,a()(r))));case 15:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"onLoadHouseKeeping",value:function(){var e=o()(h.a.mark(function e(){var t=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,N.obtainProcessLock("lockfile").catch(function(e){"EAGAIN"===e.code||"EWOULDBLOCK"===e.code?t.log.disk("Unable to get lock. Process is already running"):t.log.error(new P.default(e,"Failed to get Lockfile.")),process.exit(1)});case 2:this.log.info(v.default.analytics.t_INIT),Error.stackTraceLimit=1/0,process.on("uncaughtException",function(e){return t.log.error(new P.default("Uncaught Exception",e,"X_ERR_UNCAUGHT_EXCEPTION"))}),process.on("unhandledRejection",function(e){return t.log.error(new P.default("Unhandled Promise Rejection",e))}),this.healthMonitor.init();case 7:case"end":return e.stop()}},e,this)}));return function(){return e.apply(this,arguments)}}()},{key:"preventQuitting",value:function(){setTimeout(this.preventQuitting.bind(this),999999)}},{key:"initNetwork",value:function(){var e=o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,Ce.requestLock.write(o()(h.a.mark(function e(){return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,j.a.init();case 2:case"end":return e.stop()}},e)})));case 2:case"end":return e.stop()}},e)}));return function(){return e.apply(this,arguments)}}()},{key:"init",value:function(){var e=o()(h.a.mark(function e(){var t,r,n,a,s,o,i=this;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return this.log.disk("-------------------------Startup------------------------------"),this.log.disk("Build version is ".concat(_.default.getProcessVersion(),", Environment: ").concat(v.default.getEnvironment().LABEL)),!0===v.default.get("DEBUG_MODE")&&(this.log.disk("***** CCXP Debug Mode Enabled"),void 0!==this.debugInterface&&this.debugInterface.init()),e.next=6,Qt.isKillSwitchEnabled(function(e,t){e&&"ENOENT"!==e.code&&i.log.error(new P.default("Failed to enable admin download blocking.",e)),t&&i.log.disk("Successfully updated admin settings: ".concat(JSON.stringify(t)))});case 6:return e.next=8,this.onLoadHouseKeeping();case 8:t=tr(this.maps),e.prev=9,n=h.a.mark(function e(){var t;return h.a.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return t=r.value,e.next=3,t.load().catch(function(e){return i.log.error(new P.default("Failed to load lookup map ".concat(t.type),e))});case 3:case"end":return e.stop()}},e)}),t.s();case 12:if((r=t.n()).done){e.next=16;break}return e.delegateYield(n(),"t0",14);case 14:e.next=12;break;case 16:e.next=21;break;case 18:e.prev=18,e.t1=e.catch(9),t.e(e.t1);case 21:return e.prev=21,t.f(),e.finish(21);case 24:return a=this.initNetwork(),e.next=27,S.default.init();case 27:return e.next=29,ee.b.check(ee.a.CCXPROCESS_INITIALIZED);case 29:return e.next=31,this.serviceInterface.init();case 31:return e.next=33,this.registerNotifications().catch(function(e){i.log.error(new P.default("Failed to register for notifications",e))});case 33:return e.next=35,this.updateLookupMapWithInstalledApps().catch(function(e){i.log.error(new P.default("Failed to update lookup map on launch",e))});case 35:return e.next=37,G.default.getUserAnalyticsEnabledFlag().catch(function(e){i.log.error(new P.default("Could not enable analytics on startup",e))});case 37:return s=e.sent,o=s.enabled,this.setUserAnalyticsFlag(o),this.prefetchData(),e.next=43,this.sync();case 43:return this.preventQuitting(),e.next=46,a.catch(function(e){i.log.error(new P.default("Failed to initialize network",e))});case 46:return e.abrupt("return",this);case 47:case"end":return e.stop()}},e,this,[[9,18,21,24]])}));return function(){return e.apply(this,arguments)}}()}]),e}(),ar=r(51).Module,sr=ar._nodeModulePaths.bind(ar);ar._nodeModulePaths=function(e){return sr(e).filter(function(e){return e.startsWith(__dirname)})};var or=r(52),ir=r(53);or.setFlagsFromString("--expose_gc"),or.setFlagsFromString("--max_heap_size=100"),or.setFlagsFromString("--optimize-for-size"),global.gc=ir.runInNewContext("gc"),setTimeout(function e(){global.gc(),setTimeout(e,3e4)},3e4);t.default=(new nr).init()}]);