/************************************************************************
*
* ADOBE CONFIDENTIAL
* ___________________
*
* Copyright 2015-2019 Adobe Systems Incorporated
* All Rights Reserved.
*
* NOTICE: All information contained herein is, and remains
* the property of Adobe Systems Incorporated and its suppliers,
* if any. The intellectual and technical concepts contained
* herein are proprietary to Adobe Systems Incorporated and its
* suppliers and are protected by 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 Systems Incorporated.
* @PreserveInCompilation
**************************************************************************/

!function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s=59)}([function(e,t,n){"use strict";var o,r=n(5),s=n(1),i=n(8),a={},c=s.getValue("LOG_DIR")+"CCX Process.log",u=s.getValue("LOG_DIR")+"CCX Process (prev).log",l=!1,p=new i(["logWrite"]);function _(){r.ensureDir(s.getValue("LOG_DIR"),function(e){if(e)return o=void 0,void console.log(e);var t;t=function(e){if(e)return o=void 0,void console.log(e);var t=o;o=void 0,l=!0,r.appendFile(c,t,function(e){e&&console.log(e),l=!1,o&&_(),p.notify("logWrite")})},r.stat(c,function(e,n){!e&&n.size>s.getValue("MAX_LOG_SIZE")?r.rename(c,u,t):t(null)})})}var d=[];a.log=function(){var e=Array.prototype.slice.call(arguments).join(": ");s.getValue("CONSOLE_LOGGING")&&console.log(e),function(e){d.length>=s.getValue("MAX_ANALYTICS_LOGS")&&d.shift(),d.push(e)}(e);var t=(new Date).toString()+" "+e+"\n";o?o+=t:(o=t,l||_())},a.getRecentLogs=function(){return d},a.clearRecentLogs=function(){d=[]},a._listenerManager=p,a.addLogWriteListener=function(e){p.add("logWrite",e)},a.removeLogWriteListener=function(e){p.remove("logWrite",e)},e.exports=a},function(e,t,n){var o,r=n(4),s=n(24),i=n(16),a={ENVIRONMENT:"production",ACTIVE_VERSIONS:["V1","V2","V2_5"],SETTINGS_FILE:"settings.json",SETTINGS_FILE_VERSION:3,LOOKUP_MAP_FILE:"map.json",PSDK_LOOKUP_MAP_FILE_VERSION:4,STOCK_LOOKUP_MAP_FILE_VERSION:1,ASSETS_DIRNAME:"assets",CC_SETTINGS_FILE:"C3Config.xml",CONSOLE_LOGGING:!1,SCOPES:"openid,AdobeID,creative_cloud,creative_sdk",SYNC_INITIAL_RETRY:24e4,MAX_LOG_SIZE:5242880,PROXY_REQUEST_TIMEOUT:2e3,GET_NOTIFICATION_DATA_TIMEOUT:2e3,NETWORK_STATUS_INTERVAL:1e3,STOP_SYNCING_BEYOND:6048e5,PSDK_API_VERSION:2,SOPHIA_API_VERSION:2,PSDK_SERVER_TIMEOUT:3e4,SOPHIA_SERVER_TIMEOUT:3e4,STOCK_API_VERSION:1,STOCK_SERVER_TIMEOUT:3e4,STOCK_TEST_API_KEY:"XDStockAPITest",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,NUM_CONCURRENT_REQUESTS:10,MIN_RANDOMIZED_TIME:1e3,MAX_RANDOMIZED_TIME:9e5,MAX_TIMEOUT:Math.pow(2,31)-1,MIN_TIMEOUT:36e6,TRIAL_DAYS:7,PRODUCT_LIST:["PHSP","PHXS","IDSN","PPRO","ILST","AEFT","MUSE","DRWV"],STOCK_PRODUCT_LIST:["PHXS","ILST","IDSN"],IGNORED_FILES_REGEXP:"^map.json|\\bassets\\b",SOPHIA_CLIENT_CODE:"ccx",PSDK_PARAMETERS_SCHEMA:{id:"psdk_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"},productPlatform:{type:"string"},productDevice:{type:"string"},productOS:{type:"string"},productArch:{type:"string"},countryCode:{type:"string"},subscriptionStatus:{type:"string"},trialEndDTS:{type:["string","null"]},radarSessionGuid:{type:"string"},contextGuid:{type:"string"}},required:["productCode","productVersion","productLanguage","countryCode","subscriptionStatus"]},SOPHIA_PARAMETERS_SCHEMA:{id:"sophia_parameters",type:"object",properties:{clientCode:{type:"string"},surfaceID:{type:"array",items:"string"},contextualParams:{type:"object",$ref:"psdk_parameters"},analyticsParams:{type:"object"}},required:["clientCode","surfaceID","contextualParams","analyticsParams"]},STOCK_TEMPLATE_PARAMETERS_SCHEMA:{id:"stock_parameters",type:"object",properties:{productCode:{type:"string"},productVersion:{type:"string"},productLanguage:{type:"string"},productPlatform:{type:"string"},productDevice:{type:"string"},productOS:{type:"string"},productArch:{type:"string"},countryCode:{type:"string"},radarSessionGuid:{type:"string"},contextGuid:{type:"string"}},required:["productCode","productVersion","productLanguage","countryCode","subscriptionStatus"]},PSDK_MAP_DATA_SCHEMA:{id:"MAP_DATA",type:"object",properties:{userCards:{type:"object"},userCardsCache:{type:"object"},assetsCache:{type:"object"},version:{type:"number"}},required:["userCards","userCardsCache","assetsCache","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:{analyticsParams:{type:"object"},cardControl:{type:"array",items:{type:"object",properties:{surfaceId:{type:"string"},containers:{type:"array",items:{type:"object",properties:{containerAnalyticsParams:{type:"object"},index:{type:"integer"}}}}}}},cards:{type:"array",items:{type:"object",properties:{backgroundImage:{type:"string"}}}},expirationDTS:{type:"string"}},required:["expirationDTS","cards","cardControl"]},CARDS_DATA_SCHEMA:{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"]},STOCK_MAP_DATA_SCHEMA:{id:"STOCK_MAP_DATA",type:"object",properties:{stockTemplates:{type:"object"},stockTemplatesCache:{type:"object"},assetsCache:{type:"object"},version:{type:"number"}},required:["stockTemplates","stockTemplatesCache","assetsCache","version"]},STOCK_TEMPLATES_DATA_SCHEMA:{id:"STOCK_TEMPLATES_DATA",type:"object",properties:{templates:{type:"array"},expirationDTS:{type:"string"},nb_results:{type:"number"}},required:["expirationDTS"]},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_GET_USER_REQUEST:"ccxprocess.GetUserRequest",VULCAN_GET_USER_RESPONSE:"ccxprocess.GetUserResponse",VULCAN_START_SETTINGS_REQUEST:"ccxprocess.StartSettingsRequest",VULCAN_START_SETTINGS_PATCH_UPDATE:"ccxprocess.StartSettingsPatchUpdate",VULCAN_STOCK_TEMPLATE_REQUEST:"ccxprocess.StockTemplateRequest",VULCAN_STOCK_TEMPLATE_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_SPECIFIER_MAP:{photoshop:"PHXS",illustrator:"ILST",indesign:"IDSN",aftereffects:"AEFT",dreamweaver:"DRWV",premierepro:"PPRO"},SKIP_LOGGING_MESSAGE_LIST:["ccxprocess.in.request.app.ping","ccxprocess.out.response.app.ping"],NOTIFICATION_REQUEST:"accc.notifications",NOTIFICATION_PSDK_RESPONSE:"ccxprocess.notification.psdk",NOTIFICATION_STOCK_RESPONSE:"ccxprocess.notification.stock",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",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",ANALYTICS_ENABLED:!1,ANALYTICS_INGEST_PATH:"/ingest",ANALYTICS_X_PRODUCT:"CCXStart/2.5",ANALYTICS_PROJECT:"ccx-process-service",ANALYTICS_INGEST_TYPE:"dunamis",ANALYTICS_MAX_QUEUED_EVENTS:150,ANALYTICS_DEBOUNCE:1e4,ANALYTICS_API_KEY:"ccx-process-service",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"]},"CCX_TUTORIAL_2.5":{id:"/TUTORIAL_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"}}}}}}}}}}},PRODUCT_PRIORITY:{PHXS:9,ILST:8,IDSN:7,PPRO:6,AEFT:5,DRVW:4,MUSE:3},URGENT_PRIORITY:1e3,PSDK_PRIORITY:200,STOCK_PRIORITY:100,V1:{VERSION_LESS_THAN:"2.0",START_VERSION:"1.0",SOPHIA_PREFETCH_CLIENTS:{AEFT:"15.0",DRWV:"18.0",IDSN:"13.0",ILST:"22.0",MUSE:"2018.0",PHXS:"19.0",PPRO:"12.0"},SOPHIA_SURFACEID:["welcome","openDoc"],SOPHIA_SURFACE_MODE_MAP:{openDoc:"openDoc",welcome:"welcome"},priority:-101},V2:{VERSION_LESS_THAN:"2.4",START_VERSION:"2.2.1.120",START_RELEASE:"CCXStart-2-1",SOPHIA_PREFETCH_CLIENTS:{AEFT:"16.0",DRWV:"19.0",IDSN:"14.0",ILST:"23.0",MUSE:"2019.0",PHXS:"20.0",PPRO:"13.0"},SOPHIA_SURFACEID:["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"],SOPHIA_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"},priority:0},V2_4:{VERSION_LESS_THAN:"2.5",START_VERSION:"2.4.0.11",START_RELEASE:"CCXStart-2-4",SOPHIA_SURFACEID:["CCX_TUTORIAL_2.5","CCX_Start_2.5_Learn","CCX_Start_2.5_Toast","CCX_Start_2.5_Home"],SOPHIA_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"},SOPHIA_PREFETCH_CLIENTS:{AEFT:"16.0",DRWV:"19.0",IDSN:"14.0",ILST:"23.0",MUSE:"2019.0",PHXS:"20.0",PPRO:"13.0"},priority:5},V2_5:{VERSION_LESS_THAN:"3.0",START_VERSION:"2.5.3.3",START_RELEASE:"CCXStart-2-5",SOPHIA_PREFETCH_CLIENTS:{AEFT:"99.0",DRWV:"99.0",IDSN:"99.0",ILST:"99.0",MUSE:"2099.0",PHXS:"99.0",PPRO:"99.0"},SOPHIA_SURFACEID:["CCX_TUTORIAL_2.5","CCX_Start_2.5_Learn","CCX_Start_2.5_Toast","CCX_Start_2.5_Home"],SOPHIA_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"},priority:10}},c={staging:{LABEL:"Staging",CLIENT_ID:"CCXInAppWelcomeProcess2",CLIENT_SECRET:"220debb8-26c5-4ce3-9c92-cc38bf589c7d",IMS:"ims-na1-stg1.adobelogin.com",PSDK_HOST:"psdk-stage.adobe.io",SOPHIA_HOST:"p13n-stage.adobe.io",ANALYTICS_HOST:"cc-api-data-stage.adobe.io",STORAGE_HOST:"cc-api-storage-stage.adobe.io",IMAGE_SERVICE_HOST:"cc-api-image-stage.adobe.io",STOCK_HOST:"stock-stage.adobe.io"},production:{LABEL:"Production",CLIENT_ID:"CCXInAppWelcomeProcess2",CLIENT_SECRET:"07a10ad7-27d4-4aec-8c8d-e4b47dffd414",IMS:"ims-na1.adobelogin.com",PSDK_HOST:"psdk.adobe.io",SOPHIA_HOST:"p13n.adobe.io",ANALYTICS_HOST:"cc-api-data.adobe.io",STORAGE_HOST:"cc-api-storage.adobe.io",IMAGE_SERVICE_HOST:"cc-api-image.adobe.io",STOCK_HOST:"stock.adobe.io"}};var u={SETTINGS_FILE_VERSION:a.SETTINGS_FILE_VERSION};var l={};l._init=function(){if(l.isPlatformWindows()){var e=process.env.USERPROFILE.replace(/\\/g,"/");a.ROOT_DIR=e+"/AppData/Roaming/",a.LOG_DIR=process.env.TEMP.replace(/\\/g,"/")+"/CreativeCloud/CCX Welcome/";var t=(process.env["ProgramFiles(x86)"]||process.env.PROGRAMFILES).replace(/\\/g,"/");a.CC_DIR=t+"/Adobe/Adobe Creative Cloud/"}else a.ROOT_DIR=process.env.HOME+"/Library/Caches/",a.LOG_DIR=process.env.HOME+"/Library/Logs/CreativeCloud/CCX Welcome/",a.CC_DIR="/Applications/Utilities/Adobe Creative Cloud/";a.ROOT_DIR+="Adobe/CCX Welcome/",a.DATA_DIR=a.ROOT_DIR+"data/",a.STOCK_DIR=a.ROOT_DIR+"stock/",a.PSDK_API_ROOT="/PSDK/v"+a.PSDK_API_VERSION,a.PSDK_ENGAGEMENT_PATH=a.PSDK_API_ROOT+"/engagement-stream-desktop",a.SOPHIA_ENGAGEMENT_PATH="/v1/fetchcontent",a.STOCK_API_ROOT="/Rest/Media/"+a.STOCK_API_VERSION,a.STOCK_TEMPLATE_API_PATH=a.STOCK_API_ROOT+"/Search/Templates",a.TMP_PHOTOS_DOWNLOAD_DIRECTORY="com.adobe.ccx.start.lrphotos/",a.PROGRESS_THROTTLE_INTERVAL=250,a.DOWNLOAD_TMP_EXTENSION=".tmp",["openDoc","firstrun","footer","learn","discover","trial","welcome"].forEach(e=>{a.CARD_DATA_SCHEMA[e]=a.CARD_DATA_SCHEMA.v2}),function(){try{o=s.readFileSync(a.ROOT_DIR+a.SETTINGS_FILE,"utf8");var e=JSON.parse(o);u.SETTINGS_FILE_VERSION===e.SETTINGS_FILE_VERSION&&(u=e)}catch(e){}}(),function(){var e=!1;try{var t=s.readFileSync(a.CC_DIR+a.CC_SETTINGS_FILE,"utf8");new i.Parser({async:!1}).parseString(t,function(t,n){t||n.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}()&&(a.ENVIRONMENT="staging"),process.argv.forEach(function(e){"--debug"===e&&(a.CONSOLE_LOGGING=!0)}),a.CONSOLE_LOGGING||(console.log("Outputting logs to: "+a.LOG_DIR),console.log("To view log messages on the console, use the --debug argument"))},l.isPlatformWindows=function(){return 0===process.platform.indexOf("win")},l.getValue=function(e,t){return t?u[t]&&void 0!==u[t][e]?u[t][e]:a[t]&&a[t][e]:void 0!==u[e]?u[e]:a[e]},l.setValue=function(e,t,n){return n?(u[n]=u[n]||{},u[n][e]=t):u[e]=t,function(){var e=JSON.stringify(u,void 0,2);if(e===o)return!1;try{var t=a.SETTINGS_FILE+".TEMP_"+r.v4();s.writeFileSync(a.ROOT_DIR+t,e),s.renameSync(a.ROOT_DIR+t,a.ROOT_DIR+a.SETTINGS_FILE),o=e}catch(e){}return!0}()},l.getEnvironment=function(){var e=l.getValue("ENVIRONMENT");return c[e]||c[a.ENVIRONMENT]},l._init(),e.exports=l},function(e,t,n){"use strict";var o=n(23),r=n(22),s=n(15),i=n(5),a=n(9),c=n(1),u=n(21).Validator,l=n(0),p={extend:function(e,t){Object.getOwnPropertyNames(t).forEach(function(n){try{"object"===t[n].constructor?("object"!==e[n].constructor&&(e[n]={}),p.extend(e[n],t[n])):e[n]=t[n]}catch(o){e[n]=t[n]}})},getTimeToExpiry:function(e){if(!e)return 0;var t=(new Date).valueOf(),n=new Date(e).valueOf()-t;return isNaN(n)?0:Math.max(0,n)},isDateExpired:function(e){return 0===p.getTimeToExpiry(e)},wrapCallback:function(e){return function(){e&&e.apply(this,arguments)}},getMIMEExtension:function(e){var t;return e&&(t=r.extension(e)),t},getRandomizedTime:function(){var e=c.getValue("MIN_RANDOMIZED_TIME"),t=c.getValue("MAX_RANDOMIZED_TIME");return Math.floor(Math.random()*(t-e))+e},validateDataFields:function(e,t,n){var o=new u;n&&n.forEach(function(e){o.addSchema(e,e.id)});var r=o.validate(e,t);return 0===r.errors.length?null:r.errors},getCurrentTime:function(){return(new Date).getTime()},getProcessVersion:function(){return o.version+"-13"},isWindows:function(){return"win32"===process.platform},formatDateString:function(e,t){return s(e).format(t)},truncateEventQueue:function(e,t){var n=e;if(e&&e.length>t&&t>0){var o=e.length-t;n=e.slice(o,e.length)}return n},getDefaultTrialEndDTS:function(){var e=new Date;return e.setTime(e.getTime()+24*c.getValue("TRIAL_DAYS")*60*60*1e3),e.toISOString()},validateTrialEndDate:function(e){if(null===e)return!0;if(!e)return!1;var t=new Date(e);return s(t).isValid()&&s(t).diff(s(),"days")<=365},getReleaseKey:function(e){return e.productCode+"-"+(e.productVersion&&e.productVersion.split(".")[0])},ccxVersionToString:(e={})=>e.ccxVersion?c.getValue("ACTIVE_VERSIONS").find(t=>{const n=c.getValue("VERSION_LESS_THAN",t);return-1===p.compareMajorMinorVersions(n,e.ccxVersion)}):"V1",sanitizeLocale:(e="")=>{const t=c.getValue("SUPPORTED_LOCALES");if(t.includes(e))return e;const n=e.slice(0,2);return t.find(e=>e.slice(0,2)===n)||"en_US"},compareMajorMinorVersions:function(e,t){let n,o,r,s;try{n=parseInt(e.split(".")[0],10),r=parseInt(e.split(".")[1]||"0",10)}catch(e){return 1}try{o=parseInt(t.split(".")[0],10),s=parseInt(t.split(".")[1]||"0",10)}catch(e){return-1}return n===o&&r===s?0:n<o||n===o&&r<s?1:-1},getClientsThatNeedRefresh:function(e){const t={};c.getValue("ACTIVE_VERSIONS").forEach(e=>{t[e]={}});const n=e.getCachedRequestData();Object.keys(n).forEach(e=>{Object.keys(n[e]).forEach(o=>{n[e][o].forEach(n=>{const r=p.ccxVersionToString(n),s=c.getValue("SOPHIA_PREFETCH_CLIENTS",r)[e];if(!s)return;if(-1!==p.compareMajorMinorVersions(s,o))return;const i=[e,o,n.subscriptionStatus,n.productLanguage,n.countryCode].join("-");t[r][i]||(t[r][i]=n)})})});const o={};return Object.keys(t).map(e=>{o[e]=Object.values(t[e])}),o},throttle:function(e,t,n){var o,r;return t=t||250,function(){var s=n||this,i=(new Date).getTime(),a=arguments;o&&i<o+t?(clearTimeout(r),r=setTimeout(function(){o=i,e.apply(s,a)},t)):(o=i,e.apply(s,a))}},hasBeenUsedRecently:function(e){if(!e)return!1;const t=new Date(e);return!isNaN(t)&&(t.setMilliseconds(c.getValue("STOP_SYNCING_BEYOND")),t>new Date)},deleteTempFiles:function(e,t,n=(()=>{})){var o="CCXWelcome > GeneralUtils > deleteTempFiles > ",r=new Date;void 0===t&&(t=864e5),i.readdir(e,function(s,c){s?l.log(o+s+": Error while deleting temp files"):Promise.all(c.map(function(n){return new Promise((s,c)=>{var u=a.join(e,n);i.stat(u,function(e,n){return e?(l.log(o+e+": Unable to read tmp file - "+u),s()):Number(r)-Number(n.mtime)<t?s():(l.log(o+": deleting tmp file - "+u),void i.unlink(u,function(e){e&&l.log(o+e+": Error deleting tmp file - "+u),s()}))})})})).then(n)})}};e.exports=p},function(e,t,n){"use strict";n(28);var o=n(4),r=n(12),s=(n(29),n(1)),i=n(0),a=n(14),c=n(2),u=n(6),l=n(19),p=n(11),_=n(51),d={},g={ENVIRONMENT:"Staging"===s.getEnvironment().LABEL?"stage":"prod",ANALYTICS_API_KEY:s.getValue("ANALYTICS_API_KEY"),ANALYTICS_X_PRODUCT:s.getValue("ANALYTICS_X_PRODUCT"),ANALYTICS_PROJECT:s.getValue("ANALYTICS_PROJECT"),ANALYTICS_INGEST_TYPE:s.getValue("ANALYTICS_INGEST_TYPE"),ANALYTICS_MAX_QUEUED_EVENTS:s.getValue("ANALYTICS_MAX_QUEUED_EVENTS"),ANALYTICS_DEBOUNCE:s.getValue("ANALYTICS_DEBOUNCE")};d.getAccessToken=function(e){l.getAccessToken(e)},d.clearAccessToken=function(){l.clearAccessToken()},d.log=function(e){i.log(e)},d.getAgent=function(e,t){var n=a.stripPathFromURL(e);p.getNodeTunnelOptionsForURL(n,function(e,n){delete n.agent,t(null,n)})};var f=_.createInstance(d,g);f.enable(s.getValue("ANALYTICS_ENABLED"));var S={_scrubStack:function(e){return e?(e=e.toString()).replace(/(\\|\/).*\1/g," "):e},_checkIMS:function(e,t){var n=u.getUserProfile(e),o=!(!n||!n.IMSProfile)&&JSON.parse(n.IMSProfile);return o&&(t["user.service_code"]=o.serviceAccounts?o.serviceAccounts[0].serviceCode:"creative_cloud",t["user.service_level"]=o.serviceAccounts?o.serviceAccounts[0].serviceLevel:""),t},_cleanPSDKParameters:function(e,t){return t&&(e["event.sessionGuid"]=t.radarSessionGUID,e["event.language"]=t.productLanguage,e["event.contextGuid"]=t.contextGuid,e["source.name"]=t.productCode,e["source.version"]=t.productVersion,e["source.platform"]=t.productPlatform+":"+t.productArch,e["source.device"]=t.productDevice,e["source.os_version"]=t.productOS,e["consumer.version"]=t.ccxVersion,t.numSophiaCards&&(e["content.type"]=S.SOPHIA_CARDS,e["content.size"]=t.numSophiaCards)),e},_createPayload:function(e,t){var n=u.getUserId();return e["event.guid"]=o.v4(),e["event.dts_start"]=(new Date).toISOString(),e["event.workflow"]=S.w_CCX_PROCESS,e["event.category"]=S.c_DESKTOP,e["event.user_guid"]=n,e["event.language"]=e["event.language"]||p.osLocale,e["event.device_guid"]=u.getDeviceID(),e["env.com.name"]=S.w_CCX_PROCESS,e["env.com.version"]=c.getProcessVersion(),e["consumer.name"]=S.w_CCX_PROCESS,e["consumer.version"]=e["consumer.version"],e["consumer.platform"]=r.platform(),e["consumer.os_version"]=r.release(),e["consumer.arch"]=r.arch(),e=S._cleanPSDKParameters(e,t),e=S._checkIMS(n,e)},_reset:function(e){return e&&(f=_.createInstance(d,e)).enable(s.getValue("ANALYTICS_ENABLED")),f},logProcessEvent:function(e,t,n,o){e=S._createPayload(e,t);n&&(e["event.error_type"]=n.type||"Unknown",e["event.error_code"]=n.code||"Unknown",e["event.error_desc"]=S._scrubStack(n.desc)||S._scrubStack(n)),S.postEvent(e,o)},flush:function(e){f.flush(e)},postEvent:function(e,t){var n=c.wrapCallback(t);f.postEvent(e,n)},enable:function(e){f.enable(e)},NO_PARAMS:null,w_CCX_PROCESS:"CCX Process",c_DESKTOP:"DESKTOP",sc_CUSTOM_HOOK:"CustomHook.js",sc_PROCESS:"Process",sc_SOPHIA:"Sophia",sc_STOCK:"Stock",sc_CCX_START:"CCX Start",sc_LR_CONTENT:"Lightroom Content",sc_OZ:"Oz",sc_UTUTS:"Ututs",sc_AUTH:"Auth",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",st_PROCESS:"process",st_API:"api",st_ANS:"ans",st_CC_PHOTOS:"cc photos",st_NETWORK:"network",st_SERVER:"server",st_ACCESS_TOKEN:"access token",st_CLIENT:"client",ERROR:"error",NO_ERROR:null,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",SOPHIA_CARDS:"Sophia Cards"};e.exports=S},function(e,t){e.exports=require("uuid")},function(e,t){e.exports=require("fs-extra")},function(e,t,n){"use strict";var o=n(1),r=n(0),s="CCXWelcome > IMS > ";r.log(s+"Loading IMS Library...");var i,a,c,u,l=n(29),p=o.getEnvironment();i=l.createRefEx(p.IMS),l.registerClientToGroup(i,p.CLIENT_ID,"AAM"),l.releaseRef(i),r.log(s+"IMS Library Successfully Loaded.");var _,d,g,f=[];function S(e,t){e.forEach(function(e){try{e.apply(void 0,t)}catch(e){r.log(s+"Error in callback: "+e)}})}var E={getUserInfo:function(){if(!c||null===c){var e,t,n=l.createRefEx(p.IMS);try{t=(e=l.fetchDefaultUserInfoForClientId(n,p.CLIENT_ID))?"Default User: "+e.Email+" ("+e.UserID+")":"No default user"}catch(e){t="Error fetching default user: "+e}l.releaseRef(n),t!==g&&r.log(s+t),g=t,c=e}return c},getUserProfile:function(e){if(!u||null===u){var t,n,o=l.createRefEx(p.IMS);try{n=(t=l.fetchUserProfileData(o,e))?"Default User: "+t.Email+" ("+t.UserID+")":"No user profile"}catch(e){n="Error fetching user profile: "+e}l.releaseRef(o),n!==g&&r.log(s+n),g=n,u=t}return u},getUserId:function(){return a&&null!==a||this.getUserInfo()&&(a=c.UserID),a},clearUserId:function(){a=void 0,c=void 0,u=void 0,g=void 0;var e=f;f=[],S(e,[null])},getDeviceID:function(){var e=l.createRefEx(p.IMS),t=l.getDeviceID(e);return l.releaseRef(e),t},getAccessToken:function(e){if(a){if(f.push(e),!(f.length>1)){var t=l.createRefEx(p.IMS);r.log(s+"Started IMSLib.fetchAccessToken."),t&&_&&d&&l.setProxyCredentialsInIMSLibSession(t,_,d),l.fetchAccessToken(t,p.CLIENT_ID,p.CLIENT_SECRET,a,"",o.getValue("SCOPES"),function(e,n){r.log(s+"Finished IMSLib.fetchAccessToken."),setTimeout(function(){l.releaseRef(t)});var o=function(e,t,n){var o=f;f=[],S(o,[e,t,n])};return e?(r.log(e),void o(null)):"ride_AdobeID_subs_actreq"===n.error?(r.log(s+"Services not provisioned"),void o(new Error("Services not provisioned"),void 0,n)):(n.error?r.log(s+"Unknown Error: "+n.error):r.log(s+"Successfully obtained access token"),void o(null,n.access_token,n))})}}else e&&e(null,void 0)},setProxyCredentials:function(e,t){_=e,d=t},isEnterpriseUserLoggedIn:function(){var e=this.getUserInfo();return!(!e||"type2"!==e.AccountType&&"type3"!==e.AccountType)}};e.exports=E},function(e,t,n){"use strict";var o=n(5),r=n(56),s=n(4),i=n(1),a=n(0),c=(n(2),"CCXWelcome > FileUtils > "),u={writeJSONFile:function(e,t,n,r){var i=e+t,a=i+"_"+s.v4();o.ensureDir(e,function(e){e?r(e):o.writeFile(a,JSON.stringify(n,void 0,2),function(e){e?r(e):o.rename(a,i,r)})})},readJSONFile:function(e,t,n){var r=e+t;o.readFile(r,"utf8",function(e,t){if(e)n(e);else{var o;try{o=JSON.parse(t)}catch(t){e=new Error("Invalid JSON")}n(e,o)}})},readDir:function(e,t){o.exists(e,function(n){n?o.readdir(e,t):t(null)})},deleteFile:function(e,t,n){var r=e+t;o.exists(r,function(e){e?o.unlink(r,n):n(null)})},getFileName:function(e){return e.replace(/^.*[\\\/]/,"")},getFileExtension:function(e){var t=e&&e.replace(/^.*[\\\/]/,""),n=t?t.lastIndexOf("."):-1;if(-1!==n)return t.substr(n+1).toLowerCase()},obtainProcessLock:function(e,t){var n=i.getValue("ROOT_DIR");i.isPlatformWindows()?t(!0):o.ensureDir(n,function(s){if(s)return a.log(c+"Error: Could not create root directory: "+n),void t(!1);var i=o.openSync(n+"."+e,"w");a.log(c+"lockfile:"+n+"."+e),r.flock(i,"exnb",function(e){if(e)return a.log(c+"Error: Radar Welcome process is already running."),void t(!1);t(!0)})})},copyFile:function(e,t,n){var r=!1,i=t+"_"+s.v4();function a(t){r||(n(e,t),r=!0)}var c=o.createReadStream(e);c.on("error",a);var u=o.createWriteStream(i);u.on("error",a),u.on("close",function(e){o.rename(i,t,a)}),c.pipe(u)},writeFile:function(e,t,n){var r=e+"_"+s.v4();o.writeFile(r,t,function(t){t?n(t):o.rename(r,e,n)})},getFileSizeInKB:function(e){var t=o.statSync(e).size;return Math.round(t/1024)},exists:function(e){return o.existsSync(e)}};e.exports=u},function(e,t,n){"use strict";function o(e){this._restrictedTypes=e,this._listeners={}}o.prototype._checkType=function(e){if(this._restrictedTypes&&-1===this._restrictedTypes.indexOf(e)){var t="["+this._restrictedTypes.join(", ")+"]";throw new Error(e+" is not allowed. Should be one of: "+t)}},o.prototype.add=function(e,t){this._checkType(e),this._listeners[e]=this._listeners[e]||[],this._listeners[e].push(t)},o.prototype.remove=function(e,t){this._checkType(e);var n=this._listeners[e];if(n){var o=n.indexOf(t);-1!==o&&n.splice(o,1)}},o.prototype.removeAll=function(e){e?(this._checkType(e),delete this._listeners[e]):this._listeners={}},o.prototype.notify=function(e,t){this._checkType(e);var o=this._listeners[e];o&&o.slice(0).forEach(function(e){try{e.apply(void 0,t||[])}catch(e){n(0).log("Listener Manager > Error in listener callback: "+(e?e.toString()+" "+e.stack:""))}})},o.prototype.hasListeners=function(e){this._checkType(e);var t=this._listeners[e];return!!(t&&t.length>0)},o.prototype.forEach=function(e){var t=this._listeners;Object.keys(t).forEach(function(n){t[n].forEach(function(t){e(n,t)})})},e.exports=o},function(e,t){e.exports=require("path")},function(e,t,n){"use strict";function o(){this._operations=[],this._isRunning=!1}o.prototype.addOperation=function(e,t,n){if(this._isRunning)throw new Error("Cannot add operations after calling run()");this._operations.push({operation:e,argsArray:t||[],thisObject:n})},o.prototype._runSeriesRecursive=function(e,t){var n=this,o=e[0];o.argsArray.push(function(o,r){o?t(o):1!==e.length?n._runSeriesRecursive(e.slice(1),t):t()}),o.operation.apply(o.thisObject,o.argsArray)},o.prototype.runSeries=function(e){this._runSeriesRecursive(this._operations,e)},o.prototype.run=function(e,t){function n(t,n,o){e&&e(t,n,o)}if(this._isRunning)throw new Error("Cannot call run() more than once");this._isRunning=!0;var o=this._operations.length;0===o&&n(null,!1,[]);var r,s=0,i=!1,a=[],c=[];this._operations.forEach(function(e,u){e.argsArray.push(function(e,l){!function(e,u,l){if(e&&t&&t(e),!i){if(r=r||e,a[l])return i=!0,void n(new Error("Operation not valid: calls callback multiple times"));if(s++,c[l]=u,a[l]=!0,s===o){i=!0;var p=!!c.reduce(function(e,t){return e||t},!1);n(r||null,p,c)}}}(e,l,u)}),e.operation.apply(e.thisObject,e.argsArray)})},e.exports=o},function(e,t,n){"use strict";var o,r,s=void 0,i=n(0),a=n(8),c="CCXWelcome > Proxy > ",u=n(53)(function(e,t){i.log(c+t)}),l={},p=new a(["change"]),_={};function d(e,t){u.resolve(e,function(e,n){e?t(e):t(null,n&&n[0])})}function g(e,t,n){d(e,function(r,a){delete t.agent,t.agent=a&&a.agent,t.agentClass=a.agentClass,t.agentOptions=a.agentOptions||{},s&&(t.agentOptions.ca=s),t.agent?i.log(c+"Setting proxy for "+e+": "+a.hostname+":"+a.port+(o?" with":" without")+" authentication"):i.log(c+"No proxy (direct connection) for "+e),n&&n(null,t)})}function f(){Object.keys(l).forEach(function(e){g(e,l[e])})}u.setAuthenticationCallback(function(e,t){var n=_[e.proxy.host+e.proxy.port]||{};n.username===o&&n.password===r?t("No new credentials"):o?(n.username=o,n.password=r,t(null,n),_[e.proxy.host+e.proxy.port]=n):t("No credentials present")}),u.on("change",function(){i.log(c+"System proxy settings changed"),f(),p.notify("change",[!0])});var S={init:function(e){u.getRootCA((t,n)=>{s=n,e()})},addListener:function(e,t){p.add(e,t)},removeListener:function(e,t){p.remove(e,t)},removeAllListeners:function(e){p.removeAll(e)},getProxyForURL:function(e,t){d(e,t)},getNodeTunnelOptionsForURL:function(e,t){l[e]?t(null,l[e]):g(e,{},function(n,o){l[e]=o,t(null,o)})},setProxyCredentials:function(e,t){o===e&&r===t||(i.log(c+"Setting proxy username and password"),o=e,r=t,f(),p.notify("change",[!1]))}};S.osLocale=u.getOSLocale(),S.getProxyCredentials=function(){return{user:o,password:r}},S.clearCache=function(){l={},o=void 0,r=void 0},e.exports=S},function(e,t){e.exports=require("os")},function(e,t,n){"use strict";function o(e){this._maxLocks=Math.max(1,e||0),this._hasWriteLock=!1,this._numLocks=0,this._pendingContinuations=[],this._pendingWrites=[]}o.prototype.obtain=function(e,t,n={}){n.priority=n.priority||0,this._numLocks===this._maxLocks||this._hasWriteLock?this._pendingContinuations.push({continuation:e,thisObject:t,prioritization:n}):(this._numLocks++,e.apply(t,[null]))},o.prototype.obtainWrite=function(e){this._numLocks>0||this._hasWriteLock?this._pendingWrites.push(e):(this._hasWriteLock=!0,e())},o.prototype.prioritize=function({key:e,priority:t}){this._pendingContinuations.forEach(n=>{n.prioritization.key===e&&(n.prioritization.priority=Math.max(n.prioritization.priority,t))})},o.prototype.release=function(){this._hasWriteLock?this._hasWriteLock=!1:this._numLocks--;for(var e,t=function(e,t){setTimeout(function(){e.continuation.apply(e.thisObject,[null])})};this._pendingContinuations.length>0&&this._numLocks<this._maxLocks;)e=this._pendingContinuations.reduce((e,t)=>t.prioritization.priority>e.prioritization.priority?t:e),this._pendingContinuations.splice(this._pendingContinuations.indexOf(e),1),this._numLocks++,t(e);0===this._numLocks&&this._pendingWrites.length>0&&(this._hasWriteLock=!0,this._pendingWrites.shift()())},o.prototype.abortPendingOperations=function(e){var t=this._pendingContinuations.concat(this._pendingWrites.map(e=>({continuation:e})));this._pendingContinuations=[],this._pendingWrites=[],t.forEach(function(t){t.continuation.apply(t.thisObject,[e])})},o.prototype.isLocked=function(){return this._numLocks===this._maxLocks||this._hasWriteLock},o.prototype.hasPendingRequest=function(){return this._pendingContinuations.length>0},e.exports=o},function(e,t,n){"use strict";var o=n(31),r=(n(0),n(1),n(2)),s=(n(30),{stripPathFromURL:function(e){if("string"==typeof e){var t=o.parse(e);if(t.protocol&&t.host)return t.protocol+"//"+t.host}},getRetryAfterHeader:function(e){if(e){var t=e["retry-after"]||e["Retry-After"];if(t)try{var n=parseInt(t,10);if(n)return Math.max(0,n);var o=new Date(t);if(!isNaN(o)){var s=(new Date).valueOf(),i=Math.max(0,o-s),a=r.getRandomizedTime();return Math.round((i+a)/1e3)}}catch(e){}}return 0},getLocationHeader:function(e){if(e){var t=e.location||e.Location;if(t)return t}},getContentTypeHeader:function(e){if(e){var t=e["content-type"]||e["Content-Type"];if(t){var n=t.indexOf(";");return n>0&&(t=t.substring(0,n)),t}}}});e.exports=s},function(e,t){e.exports=require("moment")},function(e,t){e.exports=require("xml2js")},function(e,t,n){"use strict";var o=n(28),r=n(4),s=n(5),i=n(1),a=n(0),c=n(7),u=n(14),l=n(2),p=n(13),_=n(30),d=n(11),g=(n(3),n(19)),f=n(18),S="CCXWelcome > DownloadManager > ";function E(){E._requestLock=E._requestLock||new p(i.getValue("NUM_CONCURRENT_REQUESTS")),this._requestLock=E._requestLock,this.prioritize=this._requestLock.prioritize.bind(this._requestLock)}E.prototype._downloadCollectionData=function(e,t,n,o,r,s){var i=this;i._commonRequest(o,!0,e,function(c,u,l,p){if(c)r(c);else{if("string"==typeof l)try{l=JSON.parse(l)}catch(e){l=null}l&&l.radarSessionGUID&&(n.radarSessionGUID=l.radarSessionGUID);var d=u&&u.statusCode;401!==d||(g.clearAccessToken(),a.log("401 error: access token is expired."),s)?200===d?r(null,o,l):r(new _("Unexpected Response",d,u&&u.headers,o)):setTimeout(function(){i._downloadCollectionData(e,t,n,o,r,!0)})}})},E.prototype._commonRequest=function(e,t,n,o){var r=this;this._commonRequestWithoutBody(e,t,n,function(e,t,n){e?o(e,t,null):r._getFullBody(t,function(e,r){e?o(e,null,null):o(null,t,r,n)})})},E.prototype._commonRequestWithoutBody=function(e,t,n,s){var i=this;!function(e,t,n){var o=u.stripPathFromURL(e.url);if(!o)return n(new _("Invalid URL - "+e.url));var s=function(t){d.getNodeTunnelOptionsForURL(o,function(n,o){l.extend(e,o),delete e.agent,e.headers=e.headers||{},e.headers["X-Request-Id"]=r.v4(),t()})};t?g.getAccessToken(function(t,o){if(t||!o)return a.log(S+"Failed to get access token:"+t),void n(t);e.headers.Authorization="Bearer "+o,s(n)}):s(n)}(e,t,function(t){if(t)s(t);else{var n,r=S+"["+e.headers["X-Request-Id"]+"] ",c=function(t,o){i._requestLock.release();var c=(new Date).valueOf()-n,u=r;t?("getaddrinfo"===t.syscall&&"ENOTFOUND"===t.code&&(t=new Error("Offline"),f.check()),u+="Failed: "+t):u+="Finished",a.log(u+" ("+c+"ms)"),s(t,o,e.headers["X-Request-Id"])};i._requestLock.obtain(function(t){t?s(t):(n=(new Date).valueOf(),a.log(r+"Sending request to "+JSON.stringify(e.url)+" with params: "+JSON.stringify(e.json)+" and priority "+(e.priority&&e.priority.priority)),o(e).on("response",function(e){c(null,e)}).on("error",function(e){c(e,null)}))},i,e.priority)}})},E.prototype._getFullBody=function(e,t){var n="";let o=e.headers["content-type"];o&&"application/json"===o&&e.setEncoding("utf8"),e.on("data",function(e){n+=e}).on("end",function(){t(null,n)}).on("error",function(e){t(e,null)})},E.prototype.getOptions=function(e,t){return{headers:{},priority:e.priority}},E.prototype.downloadCollectionData=function(e,t,n){n(new Error("Not implemented"))},E.prototype.downloadAsset=function({href:e,lastModified:t,assetsDir:n,clientId:o,shouldAuthenticate:p,assetFilename:d,analyticsSubcategory:g,progressCallback:f,priority:E},T){var C=this;s.ensureDir(n,function(h){if(h)T(h);else{var O={url:e,method:"GET",timeout:i.getValue("DOWNLOAD_ASSET_TIMEOUT"),headers:{},priority:E};t&&(O.headers["If-Modified-Since"]=t),o&&(O.headers["x-api-key"]=o),C._commonRequestWithoutBody(O,p,g,function(o,p,g){var E=S+"["+g+"] ",C=function(e,t,n,o){if(e)return a.log(E+"ERROR - Request failed: "+e.message+e.stack),void T(e,t,n);E+=t?"Downloaded to "+t:"Not changed on server",a.log(E),T(e,t,n,o)};if(o)C(o);else{var h=p&&p.statusCode,A=p&&p.headers,I=A&&A["last-modified"],y=A&&new Date(A.expiry);if(A&&A["cache-control"]&&A["cache-control"].includes("max-age=")){var v=A["cache-control"];const e=parseInt(v.split("max-age=")[1].trim(),10);e&&(y=new Date).setSeconds(e)}if(t&&304===h)C(null);else if(200===h){var R=d;if(!R){var N=l.getMIMEExtension(u.getContentTypeHeader(A));N=N||c.getFileExtension(e),R=r.v4()+"."+N}var m=i.getValue("ASSETS_DIRNAME")+"/"+R,P=n+R,D=P+i.getValue("DOWNLOAD_TMP_EXTENSION"),L=s.createWriteStream(D);if(p.pipe(L).on("error",function(e){s.unlink(D),C(e,null,null)}).on("close",function(){s.rename(D,P,function(e){C(e,m,I,y)})}),f){var b=parseInt(p.headers["content-length"],10),V=0,M=function(){var e=parseInt(V/b*100,10);f(e)};M=l.throttle(M,i.getValue("PROGRESS_THROTTLE_INTERVAL")),p.on("data",function(e){V+=e.length,M()})}}else C(new _("Unexpected Response for: "+O.url,h,p&&p.headers,O))}})}})},E.prototype.get=function(e){return new Promise((t,n)=>{this._commonRequest(e,e.shouldAuthenticate,e.analyticsSubcategory,(e,o,r,s)=>{if(e)return a.log(S+"["+s+"] ERROR: Failed with error"+e+e.message+e.stack),n(e);t({response:o,body:r,requestId:s})})})},e.exports=E},function(e,t,n){const o=n(26).EventEmitter,r=n(11),s=n(1),i=n(48);const a=new class extends o{constructor(){super(),this.ONLINE=Symbol("online"),this.OFFLINE=Symbol("offline");const e=s.getEnvironment();this._protocol=s.getValue("SOPHIA_PROTOCOL")||"https",this._host=s.getValue("SOPHIA_HOST")||e.SOPHIA_HOST,this._port=s.getValue("SOPHIA_PORT")||("http"===this._protocol?80:443),this._testUrl=s.getValue("SOPHIA_PORT")?`${this._protocol}://${this._host}:${this._port}`:`${this._protocol}://${this._host}`,this.on(this.OFFLINE,()=>setTimeout(()=>{this.check()},s.getValue("NETWORK_STATUS_INTERVAL")))}needsProxy(){return new Promise(e=>{r.getNodeTunnelOptionsForURL(this._testUrl,(t,n)=>{e(!(!n||!n.agent))})})}check(){return this.promise?this.promise:this.promise=new Promise(e=>{s.getEnvironment();const t=t=>{const n=n=>{this.promise=null,this.status=n,this.emit(this.status),t&&(t.removeAllListeners(),t.end()),e()};t?t.connecting?(t.on("connect",()=>n(this.ONLINE)),t.on("error",()=>n(this.OFFLINE))):n(this.ONLINE):n(this.OFFLINE)};r.getNodeTunnelOptionsForURL(this._testUrl,(e,n)=>{const o=n.agent;if(o)o.createConnection({host:this._host,port:this._port},(e,n)=>{t(n)});else{const e=i.createConnection({port:this._port,host:this._host});t(e)}})})}};e.exports=a},function(e,t,n){"use strict";var o=n(6),r=n(0),s={getAccessTokenExpiry:function(e){try{var t=JSON.parse(Buffer.from(e.split(".")[1],"base64").toString("utf-8"));return new Date(parseInt(t.created_at)+parseInt(t.expires_in)-1e4)}catch(t){r.log("Failed parsing access token: ",e);var o=n(3);return o.logProcessEvent({"event.type":o.ERROR,"event.subtype":o.st_ACCESS_TOKEN,"event.subcategory":o.sc_AUTH},o.NO_PARAMS,"Failed to parse access token "+(e||"No Access token")),new Date}},getAccessToken:function(e){var t=this,r=o.getUserId();r||e(new Error("Not Logged in")),this._accessToken&&this._userId===r&&this._accessTokenExpiry>new Date?e(null,this._accessToken):o.getAccessToken(function(o,s){var i=n(3);if(o)return i.logProcessEvent({"event.subcategory":i.sc_AUTH,"event.type":i.ERROR,"event.subtype":i.st_ACCESS_TOKEN},i.NO_PARAMS,o),void e(o);t._userId=r,t._accessToken=s,t._accessTokenExpiry=t.getAccessTokenExpiry(s),i.logProcessEvent({"event.subcategory":i.sc_AUTH,"event.type":i.t_FETCH,"event.subtype":i.st_ACCESS_TOKEN},i.NO_PARAMS),e(null,s)})},clearAccessToken:function(){var e=n(3);e.logProcessEvent({"event.subcategory":e.sc_AUTH,"event.type":e.t_CLEAR,"event.subtype":e.st_ACCESS_TOKEN},e.NO_PARAMS),delete this._userId,delete this._accessToken,delete this._accessTokenExpiry}};e.exports=s},function(e,t,n){"use strict";var o=n(1),r=n(0),s=n(8),i="CCXWelcome > VulcanWrapper > ";r.log(i+"Loading Vulcan Library...");var a=n(54),c=new a.VulcanAdapter("CCXP","1.0.0"),u=new a.VulcanControlAdapter;r.log(i+"Vulcan Library Successfully Loaded.");var l=new s,p=function(e){var t=o.getValue("SKIP_LOGGING_MESSAGE_LIST");return!t||-1===t.indexOf(e)||o.getValue("CONSOLE_LOGGING")};c.addMessageListener(function(e,t,n,s){e=e.replace(o.getValue("VULCAN_PREFIX"),""),l.hasListeners(e)&&(p(e)&&r.log(i+"<- "+n+" "+s+": "+e),l.notify(e,[t,n,s]))});var _={sendMessage:function(e,t,n,o){var s=n?n+" "+(o||"*"):"BROADCAST";p(e)&&r.log(i+"-> "+s+": "+e),c.sendMessage(e,t||"",n||"",o||"")},addListener:function(e,t){l.add(e,t)},removeListener:function(e,t){l.remove(e,t)}};_.getSpecifiers=u.getSpecifiers.bind(u),_.getAppVersion=u.getAppVersion.bind(u),e.exports=_},function(e,t){e.exports=require("jsonschema")},function(e,t){e.exports=require("mime")},function(e){e.exports={name:"ccx-welcome-process",version:"2.5.3",private:!0,description:"CCX Welcome Process",dependencies:{"fs-ext":"git+ssh://git@git.corp.adobe.com:michsmit/node-fs-ext.git#v0.5.1","fs-extra":"6.0.1",glob:"7.1.1","idle-gc":"1.0.1",ingest:"git+ssh://git@git.corp.adobe.com:CCX/Ingest.git#v1.0.1",jsonschema:"1.2.4",mime:"1.3.4",moment:"2.14.1","node-ProxyResolver":"git+ssh://git@git.corp.adobe.com:ProjectCentral/node-ProxyResolver.git#v1.2.3","node-imslib":"git+ssh://git@git.corp.adobe.com:ProjectCentral/node-imslib.git#v1.2.7","node-vulcanjs":"git+ssh://git@git.corp.adobe.com:slade/VulcanJS.git#v1.2.4","os-locale":"^2.1.0","ps-node":"^0.1.6",request:"2.61.0",uuid:"2.0.1",xml2js:"0.4.7"},devDependencies:{"7zip":"0.0.6","@babel/core":"^7.0.0-beta.49","@babel/preset-env":"^7.0.0-beta.49","@ccx/hyperdrive-builder":"git+ssh://git@git.corp.adobe.com:CCX/hyperdrive-builder.git#v3.0.14","@types/fs-extra":"^5.0.2","@types/jest":"^22.2.3","@types/node":"^10.1.4","@types/xml2js":"^0.4.2","@zolesio/npm-tessa-plugin":"^0.2.3",fetch:"^1.1.0",grunt:"1.0.1","grunt-contrib-clean":"1.0.0","grunt-contrib-compress":"1.3.0","grunt-contrib-copy":"1.0.0","grunt-contrib-requirejs":"1.0.0","grunt-node-gyp":"3.1.0",husky:"^0.14.3",inquirer:"0.9.0",jest:"^23.1.0","jest-date-mock":"^1.0.2","jest-extended":"^0.7.2",jsftp:"2.0.0","map-stream":"0.0.7",matchdep:"1.0.1",minimist:"^1.2.0",mkdirp:"0.5.1",mockery:"2.0.0",mustache:"2.3.0",nock:"9.0.14","node-uglifier":"0.5.4",prettier:"^1.13.3","pretty-quick":"^1.6.0","source-map-support":"^0.5.6","terser-webpack-plugin":"^1.1.0","ts-jest":"^22.4.6","ts-loader":"^4.3.0","ts-node":"^6.0.5",typescript:"^2.8.4","vinyl-ftp":"^0.6.0",webpack:"^4.10.2","webpack-node-externals":"^1.7.2"},prettier:{tabWidth:4,useTabs:!1,singleQuote:!0,trailingComma:"es5"},resolutions:{ffi:"2.2.0",ref:"1.3.5"},engines:{node:">=8.11.0"},scripts:{test:"jest --coverage=false --silent",coverage:"jest --silent",updateBuildCoverageComment:"grunt updateBuildCoverageComment",start:"ts-node main --debug",precommit:"pretty-quick --staged",tessa:"tessa-npm-plugin","tessa-plugin-pr":"tessa-npm-plugin --testOnly .",setup:"node packaging/credentials"},cepPanels:[{product:"CCX Start",subproduct:"Extension",version:"2.5.3",certification:"Not Tested",destination:"com.adobe.ccx.start-2019",name:"com.adobe.ccx.start"},{product:"CCX Start",subproduct:"CmdN",version:"2.5.1",certification:"Integration Ready",destination:"com.adobe.ccx.fnft-2.5.1",name:"com.adobe.ccx.fnft"}],thor:[{product:"ACCC",subproduct:"Application",version:"4.6",certification:"Integration Ready",name:"ACCCx4_6_0_{{build}}",volume:"Creative Cloud",build:"^\\d+$"},{product:"ACCC",subproduct:"HDSetup",version:"4.6",certification:"Integration Ready",name:"HDSetup",volume:"Release"}]}},function(e,t){e.exports=require("fs")},function(e,t,n){"use strict";n(1);var o=n(7),r=n(0),s=n(2),i=(n(10),n(13)),a=n(3);function c(e,t){this._id=e,this._lookupMap=t,this._writeLock=new i,this._fileName=this._id+".json"}c.prototype.setData=function(e){var t=this._validateData(e);return t?(r.log("CCXWelcome > CollectionData > Invalid data: "+JSON.stringify(e)),a.logProcessEvent({"event.subcategory":this.ANALYTICS_SUBCATEGORY,"event.type":a.ERROR,"event.subtype":a.st_API},a.NO_PARAMS,{type:a.DATA_VALIDATION_ERR,desc:"Invalid data: "+JSON.stringify(e)})):this._data=e,t},c.prototype.getFileName=function(){return this._fileName},c.prototype.hasValidCards=function(){return!0},c.prototype.getId=function(){return this._id},c.prototype.getExpiryTime=function(){return this._data.expirationDTS},c.prototype.load=function(e){var t=this;o.readJSONFile(this._lookupMap.getPath(),this._fileName,function(n,o){n?e(n):(n=t.setData(o),e(n))})},c.prototype.save=function(e){var t=this,n=s.wrapCallback(e);this._data?this._writeLock.obtain(function(){o.writeJSONFile(t._lookupMap.getPath(),t._fileName,t._data,function(e){t._writeLock.release(),n(e)})}):n(new Error("No data to save"))},c.prototype.sync=function(e,t){this._data?this._data[this._schema.collection]?this._syncData(e,e=>{e?t(e):this.save(t)}):this.save(t):t(new Error("Invalid data"))},e.exports=c},function(e,t){e.exports=require("events")},function(e,t,n){"use strict";var o=n(4),r=n(1),s=n(6),i=n(7),a=n(0),c=n(2),u=n(14),l=n(10),p=n(13),_=n(3),d=n(49),g=n(9),f=n(8),S=n(18);function E(e,t,n){this._path=e,this._fileName=r.getValue("LOOKUP_MAP_FILE"),this._downloadManager=null,this._writeLock=new p,this._syncLock=new p(999),this._pendingFetchAssetCallbacks={},this._isGCRunning=!1,this._schema=t,this._collectionType=n,this._pendingCollections={},this.listenerManager=new f(["newCollection"])}E.prototype._expireAll=function(e){var t=this;Object.keys(this._data[this._schema.collectionCache]).forEach(function(n){e&&e===t._data[t._schema.collectionCache][n].userId&&delete t._data[t._schema.collectionCache][n].expiryTime}),this.save()},E.prototype._expire=function(e){var t=this._getCollectionInfo(e),n=this._data[this._schema.collectionCache][t&&t.latestId];n&&delete n.expiryTime,this.save()},E.prototype._getLookupKeys=function(e,t){var n=e.productVersion&&e.productVersion.split(".")[0],o=[t||s.getUserId()];return o.push(e.productCode,n,e.productLanguage,e.subscriptionStatus),o},E.prototype._getCollectionInfo=function(e,t){if(e){var n=this._getLookupKeys(e,t),o=this._data[this._schema.collection];return n.forEach(function(e){o&&(o=o[e])}),o}},E.prototype._setCollectionInfo=function(e,t){var n=this._getLookupKeys(e),o=this._data[this._schema.collection];return n.forEach(function(e,r){r===n.length-1?o[e]=t:(o[e]=o[e]||{},o=o[e])}),o},E.prototype._isDataReferenced=function(e){var t=this._data[this._schema.collectionCache][e],n=t&&this._getCollectionInfo(t[this._schema.params],t.userId);return!!n&&Object.keys(n).some(function(t){return e===n[t]})},E.prototype._isDataPrimaryReference=function(e,t){var n=this._data[this._schema.collectionCache][e],o=n&&this._getCollectionInfo(n[this._schema.params],n.userId);if(o){if(o.pendingId)return e===o.pendingId;if(o.latestId)return e===o.latestId}return!1},E.prototype._isDataInvalid=function(){return!1},E.prototype._calculateExpiry=function(e,t){let n=e&&e.getExpiryTime();if(n){n=new Date(n);const e=new Date;e.setMilliseconds(r.getValue("MAX_TIMEOUT")),n>e&&(n=e);const t=new Date;t.setMilliseconds(r.getValue("MIN_TIMEOUT")),n<t&&(n=t)}return n},E.prototype._calculateBackOffMetadata=function(e,t=null,n=!0){let o=0;const s=this._data[this._schema.collectionCache][e];if(t&&t.responseHeaders){const e=u.getRetryAfterHeader(t.responseHeaders);e&&(o=1e3*e)}else s&&s.retry&&(o=s.retry*(n?2:1));o=Math.max(r.getValue("SYNC_INITIAL_RETRY"),Math.min(o,r.getValue("MAX_TIMEOUT")));const i=new Date;return i.setMilliseconds(o),{expiry:i,retry:o}},E.prototype._addNewCollectionInfo=function(e,t,n,o,r,i,a){var c=this._getCollectionInfo(e)||{},u=null;let l=new Date("2010-01-01");Object.values(c).forEach(e=>{const t=this._data[this._schema.collectionCache][e];if(t&&t.lastUseTime){const e=new Date(t.lastUseTime);!isNaN(e)&&e>l&&(l=e)}}),t?c.pendingId=n:(c.latestId=n,u=c.pendingId,delete c.pendingId),this._setCollectionInfo(e,c),this._data[this._schema.collectionCache][n]={expiryTime:i&&i.toISOString(),retry:a,userId:s.getUserId(),lastUseTime:r?(new Date).toISOString():l.toISOString()},this._data[this._schema.collectionCache][n][this._schema.params]=e,[u,c.latestId].forEach(e=>{!t&&Array.isArray(this._pendingCollections[e])&&(this._pendingCollections[e].forEach(e=>e(null,o)),delete this._pendingCollections[e])})},E.prototype.sanitizeParams=function(e){return e},E.prototype.isRequestPoisoned=function(e){return!1},E.prototype.getAdditionalIngestParams=function(e){return{}},E.prototype._fetchCollectionData=function(e,t,n=null){e=this.sanitizeParams(e);var r=this;n=n||o.v4(),e.priority=e.priority||this.priority(e,n);var s=Date.now();const i=this._downloadManager.getOptions(e);var a=(o,s)=>{let i=o?o.err||{}:null;if(o&&"IGNORE"!==o.stage&&("string"==typeof i?i=o.stage+" "+i:i.code=i.code+o.stage,_.logProcessEvent({"event.subcategory":this.ANALYTICS_SUBCATEGORY,"event.type":_.ERROR,"event.subtype":_.st_SERVER,...r.getAdditionalIngestParams(s)},e,i)),i){const t=r._calculateBackOffMetadata(n,i,!1);r._addNewCollectionInfo(e,!0,n,null,!1,t.expiry,t.retry)}if(i&&e.priority&&e.priority.key){const t=e.priority.key;Array.isArray(this._pendingCollections[t])&&(this._pendingCollections[t].forEach(e=>e(i)),delete this._pendingCollections[t])}t(i,s)};if(this.isRequestPoisoned(e))return a({stage:"IGNORE",err:new Error("Poisoned request not supported.")});let u=this._data[this._schema.collectionCache][n];if(u&&!c.isDateExpired(u.expiryTime))return a({stage:"IGNORE",err:new Error("Waiting for Backoff")});_.logProcessEvent({"event.subcategory":this.ANALYTICS_SUBCATEGORY,"event.type":_.t_REQUEST,"event.subtype":_.st_SERVER,"content.action":this._downloadManager.getURL(),"exp.request_id":i.json?i.json.analyticsParams.requestId:"","exp.surface_id":i.json&&Array.isArray(i.json.surfaceID)?i.json.surfaceID.join(" "):""},e);const l=r._calculateBackOffMetadata(n);r._addNewCollectionInfo(e,!0,n,null,!1,l.expiry,l.retry),this._downloadManager.downloadCollectionData(e,i,function(t,o){if(t)a({stage:"COLLECTION_DATA",err:t});else{var i=r._createCollectionData(n,r);if(!(t=i.setData(o)))return r._isDataInvalid(i)?a({stage:"DATA_CONTENT_VALIDATION",data:o,err:new Error("Home card not found")}):void i.sync({priority:e.priority},function(t){t?a({stage:"YUKON_DATA",data:o,err:t}):(delete e.priority,r._addNewCollectionInfo(e,!1,i.getId(),i,!1,r._calculateExpiry(i)),r.save(function(t){t?a({stage:"SAVING_COLLECTION_TO_DISK",data:o,err:t}):(r.listenerManager.notify("newCollection",[e]),a(null,i),_.logProcessEvent({"event.subcategory":r.ANALYTICS_SUBCATEGORY,"event.type":_.t_RESPONSE,"event.subtype":_.st_SERVER,"event.value":Date.now()-s,...r.getAdditionalIngestParams(o)},e))}))});a({stage:"DATA_FORMAT_VALIDATION",data:o,err:t})}})},E.prototype._clearScheduledSyncJob=function(){this._syncTimeout&&(clearTimeout(this._syncTimeout),delete this._syncTimeout)},E.prototype._scheduleNextSyncJob=function(){var e=this;this._clearScheduledSyncJob();var t=r.getValue("MAX_TIMEOUT");Object.keys(this._data[this._schema.collectionCache]).forEach(function(n){var o=e._data[e._schema.collectionCache][n],i=o[e._schema.params];if(o.userId===s.getUserId()&&e._isDataPrimaryReference(n)&&!e.isRequestPoisoned(i)&&!Array.isArray(e._pendingCollections[n])){var a=c.getTimeToExpiry(o.expiryTime);if(t=Math.min(t,a),0===a){t=r.getValue("SYNC_INITIAL_RETRY"),_.logProcessEvent({"event.subcategory":e.ANALYTICS_SUBCATEGORY,"event.type":_.ERROR,"event.subtype":_.st_API},i,{type:_.MISSING_DATA,desc:"Some collection has no data. Force retry with a back off"});const o=e._calculateBackOffMetadata(n);e._addNewCollectionInfo(i,Array.isArray(e._pendingCollections[n]),n,null,!1,o.expiry,o.retry)}}}),t+=c.getRandomizedTime(),t=Math.min(t,r.getValue("MAX_TIMEOUT")),a.log(this.LOG_PREFIX+"Scheduling next sync in "+t+"ms"),this._syncTimeout=setTimeout(function(){e.sync()},t)},E.prototype._getReferencedIdList=function(){var e=this,t={};return Object.keys(this._data[this._schema.collectionCache]).forEach(function(n){e._isDataReferenced(n)&&(t[n]=!0)}),t},E.prototype._isPendingCollection=function(e){var t=this._data[this._schema.collectionCache][e],n=t&&this._getCollectionInfo(t[this._schema.params],t.userId);return!(!n||!n.pendingId)&&e===n.pendingId},E.prototype._refetchCollection=function(e,t=(()=>{})){var n=this._data[this._schema.collectionCache],o=n[e]&&n[e][this._schema.params];o?(this.clearCollectionInfo(o),this.addNewCollectionData(o,t),a.log(this.LOG_PREFIX+"Refetch collection ["+e+"]")):t(null)},E.prototype._getReferencedAssetList=function(e,t){var n,o=this,r={},i=new l,u=function(e,t){e.load(function(n){if(n||c.extend(r,e.getReferencedAssets()),n&&"ENOENT"===n.code){a.log(o.LOG_PREFIX+"File is missing for collection ["+e.getId()+"]");var i=o._data[o._schema.collectionCache][e.getId()];i&&i.userId===s.getUserId()&&!o._isPendingCollection(e.getId())&&o._refetchCollection(e.getId()),n=null}t(n)})};Object.keys(e).forEach(function(e){n=o._createCollectionData(e,o),i.addOperation(u,[n],o)}),i.run(function(e){e?t(e):t(e,r)})},E.prototype._cleanupCache=function(e,t){var n=this,o=this._data[this._schema.collectionCache];Object.keys(o).forEach(function(r){n._isDataPrimaryReference(r)||e[r]&&-1!==t.indexOf(r+".json")||delete o[r]}),this.save()},E.prototype._cleanupAssetsCache=function(e,t){var n=this._data[this._schema.assetsCache];Object.keys(n).forEach(function(o){var r=n[o];e[r.path]&&-1!==t.indexOf(i.getFileName(r.path))||delete n[o]}),this.save()},E.prototype.setData=function(e){var t=c.validateDataFields(e,r.getValue(this._collectionType+"_MAP_DATA_SCHEMA"));return t?_.logProcessEvent({"event.subcategory":this.ANALYTICS_SUBCATEGORY,"event.type":_.ERROR,"event.subtype":_.st_API},_.NO_PARAMS,{type:_.DATA_VALIDATION_ERR,desc:t}):this._data=e,t},E.prototype.upgradeData=function(e){return null},E.prototype.load=function(e){var t=this;i.readJSONFile(this._path,this._fileName,function(n,o){n?(a.log(t.LOG_PREFIX+"Failed to load lookup file from disk: "+n),o=void 0,n=null):o?o.version!==r.getValue(t._collectionType+"_LOOKUP_MAP_FILE_VERSION")&&(a.log(t.LOG_PREFIX+"Lookup file version mismatch: "+t._path),o=t.upgradeData(o)):a.log(t.LOG_PREFIX+"Empty lookup file: "+t._path),o||((o={}).version=r.getValue(t._collectionType+"_LOOKUP_MAP_FILE_VERSION"),o[t._schema.collection]={},o[t._schema.collectionCache]={},o[t._schema.assetsCache]={},o.usersInfo={}),n=t.setData(o),e(n)})},E.prototype.getPath=function(){return this._path},E.prototype.updateDisplayedId=function(e){if(e.displayed){const n=g.basename(e.displayed,".json");var t=this._getCollectionInfo(e);t&&t.lastDisplayedId!==n&&(t.lastDisplayedId=n,this._setCollectionInfo(e,t),this.save())}},E.prototype.getLatestPath=function(e,t){var n=this,o=this._getCollectionInfo(e);if(o&&o.latestId){if(t){o.latestId!==o.lastUsedId&&(o.lastUsedId=o.latestId,this._setCollectionInfo(e,o));const t=this._data[this._schema.collectionCache][o.lastUsedId]||{},n=t.lastUseTime;if(t.lastUseTime=(new Date).toISOString(),this.save(),n){const e=new Date(n);e.setMilliseconds(r.getValue("STOP_SYNCING_BEYOND")),e<new Date&&this.sync()}}var i=n._data[n._schema.collectionCache][o.latestId];if(i&&i.userId===s.getUserId()&&!n._isPendingCollection(o.latestId)){var c=this._createCollectionData(o.latestId,this);c.load(function(e){e&&"ENOENT"===e.code&&(a.log(n.LOG_PREFIX+"File is missing for collection ["+c.getId()+"]"),n._refetchCollection(c.getId()))})}return this._path+o.latestId+".json"}},E.prototype.save=function(e=(()=>{})){var t=this;if(!this._data)return e(new Error("No data to save")),void _.logProcessEvent({"event.subcategory":this.ANALYTICS_SUBCATEGORY,"event.type":_.ERROR,"event.subtype":_.st_API},_.NO_PARAMS,{type:_.DATA_VALIDATION_ERR,desc:_.NO_DATA});this._writeLock.obtain(function(){i.writeJSONFile(t._path,t._fileName,t._data,function(n){t._writeLock.release(),e(n)})})},E.prototype.fetchAsset=function({href:e,assetsDir:t,priority:n},o){var r=this,s=this._data.assetsCache[e],c=s&&s.lastModified,u=s&&s.expiry;if(c&&!i.exists(t+"../"+s.path)&&(c=null,u=null),this._pendingFetchAssetCallbacks[e]=this._pendingFetchAssetCallbacks[e]||[],this._pendingFetchAssetCallbacks[e].push(o),!(this._pendingFetchAssetCallbacks[e].length>1)){var l=function(t,n){var o=r._pendingFetchAssetCallbacks[e];delete r._pendingFetchAssetCallbacks[e],o&&o.forEach(function(e){e(t,n)})};return new Date(u)>new Date?l(null,s.path):S.status===S.OFFLINE?(a.log("Not downloading asset - Offline"),l(new Error("offline"))):void this._downloadManager.downloadAsset({href:e,lastModified:c,assetsDir:t,priority:n},function(t,n,o,i){t?l(t):n||!s.path?(r._data.assetsCache[e]={path:n,lastModified:o,expiry:i instanceof Date&&!isNaN(i)&&i.toISOString()},r.save(function(e){e?l(e):l(null,n)})):l(null,s.path)})}},E.prototype.fetchAssetAsync=d.promisify(E.prototype.fetchAsset),E.prototype.priority=function(e,t=""){return{key:t,priority:this._schema.priority+(r.getValue("PRODUCT_PRIORITY")[e.productCode]||0)+(e.urgent?r.getValue("URGENT_PRIORITY"):0)}},E.prototype.addNewCollectionData=function(e,t=(()=>{})){var n=this;if(!e)return t(new Error("No Params")),void _.logProcessEvent({"event.subcategory":this.ANALYTICS_SUBCATEGORY,"event.type":_.ERROR,"event.subtype":_.st_API},_.NO_PARAMS,{type:_.DATA_VALIDATION_ERR,desc:_.NO_STOCK_PARAMS});e=JSON.parse(JSON.stringify(e));var r=this._getCollectionInfo(e);if(r&&r.pendingId&&Array.isArray(this._pendingCollections[r.pendingId])){const n=this.priority(e,r.pendingId);return this._syncLock.prioritize(n),this._downloadManager.prioritize(n),void this._pendingCollections[r.pendingId].push(t)}if(r&&r.latestId){var s=this._createCollectionData(r.latestId,this);return void s.load(n=>{n?(this.clearCollectionInfo(e),this.addNewCollectionData(e,t)):t(null,s)})}if(r&&r.pendingId){let n=this._data[this._schema.collectionCache][r.pendingId];if(n&&!c.isDateExpired(n.expiryTime))return a.log(`Awaiting backoff for ${e.productCode}(${e.productVersion})`),t(new Error("Waiting for back-off"))}this._clearScheduledSyncJob();const i=r&&r.pendingId||o.v4();if(this._pendingCollections[i]=[],e.priority=this.priority(e,i),delete e.urgent,this._addNewCollectionInfo(e,!0,i,void 0,!0),this.save(),S.status===S.OFFLINE)return delete this._pendingCollections[i],a.log("Not downloading collection - offline"),t(new Error("offline"));a.log("Downloading new Collection Data with params "+JSON.stringify(e)+" with lock count "+this._syncLock._numLocks),this._syncLock.obtain(function(){n._fetchCollectionData(e,function(e,o){n._syncLock.release(),e?(a.log(n.LOG_PREFIX+"Error fetching collection data: "+e),_.logProcessEvent({"event.subcategory":_.sc_PROCESS,"event.type":_.ERROR,"event.subtype":_.st_PROCESS},_.NO_PARAMS,"Error adding new collection: "+e.toString()+","+e.stack)):n.gc(),n._scheduleNextSyncJob(),t(e,o)},i)},this,e.priority)},E.prototype.sync=function(e,t=(()=>{})){if(S.status===S.OFFLINE)return a.log("Not syncing lookupmap - Offline"),t(new Error("offline"));var n=this;this._clearScheduledSyncJob(),e&&this._expireAll(s.getUserId()),this._syncLock.obtain(function(){var o=new l;n._data&&n._data[n._schema.collectionCache]&&Object.keys(n._data[n._schema.collectionCache]).forEach(function(t){var r=n._data[n._schema.collectionCache][t];r.userId===s.getUserId()&&n._isDataPrimaryReference(t)&&c.isDateExpired(r.expiryTime)&&(e||c.hasBeenUsedRecently(r.lastUseTime))&&!Array.isArray(n._pendingCollections[t])&&(n._pendingCollections[t]=[],o.addOperation(n._fetchCollectionData,[r[n._schema.params]],n))}),o.run(function(e){n._syncLock.release(),e?(a.log(n.LOG_PREFIX+"Error syncing: "+e),_.logProcessEvent({"event.subcategory":_.sc_PROCESS,"event.type":_.ERROR,"event.subtype":_.st_PROCESS},_.NO_PARAMS,"Error Syncing: "+e.toString()+","+e.stack)):n.gc(),n._scheduleNextSyncJob(),t(e)})})},E.prototype.gc=function(e=(()=>{})){var t=this;if(this._isGCRunning)e(null);else{var n=function(e,n,o,r){i.readDir(e,function(s,c){if(s)r(s);else{var u=[],p=new l;c&&c.forEach(function(r){n[r]||o&&o.test(r)?u.push(r):(p.addOperation(i.deleteFile,[e,r]),a.log(t.LOG_PREFIX+"GC: Delete file ["+e+r+"]."))}),p.run(function(e){r(e,u)})}})},o=function(n){t._syncLock.release(),t._isGCRunning=!1,n?(a.log(t.LOG_PREFIX+"GC ended with error: "+n),_.logProcessEvent({"event.subcategory":t.ANALYTICS_SUBCATEGORY,"event.type":_.ERROR,"event.subtype":_.st_API},_.NO_PARAMS,{type:_.GC_ERROR,desc:n})):a.log(t.LOG_PREFIX+"GC ended successfully."),e(n)};this._isGCRunning=!0,this._syncLock.obtainWrite(function(){a.log(t.LOG_PREFIX+"GC starts.");var e=t._getReferencedIdList(),s={},c={};Object.keys(e).forEach(function(e){s[e+".json"]=!0}),n(t._path,s,new RegExp(r.getValue("IGNORED_FILES_REGEXP")),function(s,a){s?o(s):t._getReferencedAssetList(e,function(s,u){s?o(s):(Object.keys(u).forEach(function(e){c[i.getFileName(e)]=!0}),n(t._path+r.getValue("ASSETS_DIRNAME")+"/",c,null,function(n,r){n||(t._cleanupCache(e,a),t._cleanupAssetsCache(u,r)),o(n)}))})})})}},E.prototype.setValueForUser=function(e,t){var n=this._data.usersInfo;(n=n||{})[s.getUserId()]=n[s.getUserId()]||{},n[s.getUserId()][e]=t,this.save()},E.prototype.getValueForUser=function(e){var t=this._data.usersInfo&&this._data.usersInfo[s.getUserId()];return t&&t[e]},E.prototype.getLastTimeOfNotification=function(){var e=this.getValueForUser("lastTimeOfNotification");return e||(e=c.getCurrentTime(),this.setValueForUser("lastTimeOfNotification",e)),e},E.prototype.setLastTimeOfNotification=function(e){this.setValueForUser("lastTimeOfNotification",e)},E.prototype.clearCollectionInfo=function(e,t){var n=this._getCollectionInfo(e);if(n){t&&Object.values(n).forEach(e=>{delete this._data[this._schema.collectionCache][e]});var o=this._getLookupKeys(e),r=this._data[this._schema.collection],s=!1;o.forEach(function(e,t){var n,i,a;r&&!s&&(n=r[e],i=o.slice(t+1,o.length),a=!0,i.forEach(function(e,t){n&&t!==i.length-1&&(a=a&&Object.keys(n).length<=1,n=n[e])}),a?(delete r[e],s=!0):r=r[e])}),this.save()}},E.prototype.updateLicenseInformation=function(e){if(e){var t=this._getLookupKeys(e),n=this._data[this._schema.collection];t.forEach((e,o)=>{if(o===t.length-1&&n&&Object.keys(n).length>1){const t="trial"===e?"paid":"trial";n[t]&&(Object.values(n[t]).forEach(e=>{delete this._data[this._schema.collectionCache][e]}),delete n[t])}n&&(n=n[e])}),this.save()}},E.prototype.setDownloadManager=function(e){this._downloadManager=e},E.prototype.getDownloadManager=function(){return this._downloadManager},E.prototype.getCollectionType=function(){return this._collectionType},e.exports=E},function(e,t){e.exports=require("request")},function(e,t){e.exports=require("node-imslib")},function(e,t,n){"use strict";function o(e,t,n,o){this.name="NetworkError",this.message=e||"Network Error",this.statusCode=t,this.responseHeaders=n,this.request=o,this.stack=(new Error).stack}o.prototype=Object.create(Error.prototype),o.prototype.constructor=o,o.prototype.toString=function(){var e=this.name+": "+this.message;return this.statusCode&&(e+=": "+this.statusCode),e},e.exports=o},function(e,t){e.exports=require("url")},,,,,,function(e,t){e.exports=require("idle-gc")},function(e,t){function n(e){var t=new Error("Cannot find module '"+e+"'");throw t.code="MODULE_NOT_FOUND",t}n.keys=function(){return[]},n.resolve=n,e.exports=n,n.id=38},function(e,t,n){"use strict";var o=n(12),r=n(9),s=n(5),i=n(6),a=n(20),c=(n(26),n(1)),u=n(0),l=n(2),p=n(3),_=n(17),d=(n(7),n(15)),g="CCXWelcome > ServiceInterface > ";function f(e,t){this._cardLookupMap=e,this._stockTemplateLookupMap=t,this._downloadManager=new _}f.prototype._getResponseData=function(e,t,n,o,r,s,a){var l={requestId:n};if(r)return u.log(g+r+": "+o),l.err=r,a(l);l.settings=c.getValue(`${t.productCode}_${e.getCollectionType()}`,`SETTINGS_${i.getUserId()}`)||{},u.log(g+"request: "+o),this._cardLookupMap.updateLicenseInformation(t),e.updateDisplayedId(t),t.urgent?e.addNewCollectionData(t,n=>{n?(u.log(g+n+": "+o),l.err=n.message):l.path=e.getLatestPath(t,!0),a(l)}):(l.path=e.getLatestPath(t,!0),l.path||s||e.addNewCollectionData(t),a(l))},f.prototype.init=function(){var e=this;a.addListener(c.getValue("VULCAN_PING_REQUEST"),function(e,t,n){a.sendMessage(c.getValue("VULCAN_PING_RESPONSE"),"",t,n)}),a.addListener(c.getValue("VULCAN_PSDK_FEED_REQUEST"),function(t,n,o){var r,s,_=Date.now();try{(s=JSON.parse(t)).psdkParams.requestId=s.requestId,(r=l.validateDataFields(s.psdkParams,c.getValue("PSDK_PARAMETERS_SCHEMA")))&&s&&s.psdkParams&&p.logProcessEvent({"event.subcategory":p.sc_SOPHIA,"event.type":p.ERROR,"event.subtype":p.st_CLIENT},s.psdkParams,{type:p.PARAM_VALIDATION_ERR,desc:r})}catch(e){r=new Error("Unable to parse PSDK feed data:"+t),p.logProcessEvent({"event.subcategory":p.sc_SOPHIA,"event.type":p.ERROR,"event.subtype":p.st_CLIENT},p.NO_PARAMS,{type:p.PARAM_VALIDATION_ERR,desc:r.message+e.stack})}if(p.logProcessEvent({"event.subcategory":p.sc_SOPHIA,"event.type":p.t_REQUEST,"event.subtype":p.st_CLIENT},s&&s.psdkParams),i.getUserId()||(r=new Error("Not logged in")),s&&(!0===s.userTrackingEnabled||!1===s.userTrackingEnabled)){var f="ANALYTICS_ENABLED_"+i.getUserId();c.setValue(f,s.userTrackingEnabled),p.enable(s.userTrackingEnabled),p.flush()}s&&s.psdkParams&&"trial"===s.psdkParams.subscriptionStatus&&!l.validateTrialEndDate(s.psdkParams.trialEndDTS)&&(r=new Error("Invalid trial end date."),p.logProcessEvent({"event.subcategory":p.sc_SOPHIA,"event.type":p.ERROR,"event.subtype":p.st_CLIENT},s.psdkParams,{type:p.PARAM_VALIDATION_ERR,desc:r.message}));e._getResponseData(e._cardLookupMap,s&&s.psdkParams,s&&s.requestId,t,r,function(e){var t=!1;if(e&&"trial"===e.subscriptionStatus){var n=e.trialEndDTS,o=n&&new Date(n);t=null===n||o&&d(o).isValid()&&d(o).diff(d(),"days")<=-365}return t}(s&&s.psdkParams),function(e){a.sendMessage(c.getValue("VULCAN_PSDK_FEED_RESPONSE"),JSON.stringify(e),n,o);var t=Date.now()-_;u.log(g+"responseData: "+JSON.stringify(e)+t+"(ms)"),p.logProcessEvent({"event.subcategory":p.sc_SOPHIA,"event.type":p.t_RESPONSE,"event.subtype":p.st_CLIENT,"event.value":t},s&&s.psdkParams)})}),a.addListener(c.getValue("VULCAN_GET_USER_REQUEST"),(e,t,n)=>{a.sendMessage(c.getValue("VULCAN_GET_USER_RESPONSE"),JSON.stringify({userId:i.getUserId()}),t,n),p.logProcessEvent({"event.subcategory":p.sc_CCX_START,"event.type":p.t_RESPONSE,"event.subtype":p.st_CLIENT})}),a.addListener(c.getValue("VULCAN_START_SETTINGS_REQUEST"),(e,t,n)=>{var o=Date.now();if(!i.getUserId())return u.log("Discarding start settings storage - not logged in");let r;try{r=JSON.parse(e)}catch(o){return u.log(`Unable to parse settings storage request from ${t}(${n}): ${e}`)}if(p.logProcessEvent({"event.subcategory":p.sc_CCX_START,"event.type":p.t_REQUEST,"event.subtype":p.st_CLIENT},r),i.getUserId()!==r.userId)return u.log(`Different user in request(${r.userId}) than the one logged in(${i.getUserId()})`);const s=`${r.productCode}_${this._cardLookupMap.getCollectionType()}`,l=`SETTINGS_${i.getUserId()}`,_=c.getValue(s,l)||{};Object.keys(r.settings).forEach(e=>{_[e]?Object.assign(_[e],r.settings[e]):_[e]=r.settings[e]}),_.lastModified=(new Date).toISOString(),c.setValue(s,_,l),a.sendMessage(c.getValue("VULCAN_START_SETTINGS_PATCH_UPDATE"),JSON.stringify({settings:r.settings,userId:r.userId}),r.productCode),u.log(g+"Successfully set settings"),p.logProcessEvent({"event.subcategory":p.sc_CCX_START,"event.type":p.t_RESPONSE,"event.subtype":p.st_CLIENT,"event.value":Date.now()-o},r)}),a.addListener(c.getValue("VULCAN_STOCK_TEMPLATE_REQUEST"),function(t,n,o){var r,s,_=Date.now();try{s=JSON.parse(t),(r=l.validateDataFields(s.stockParams,c.getValue("STOCK_TEMPLATE_PARAMETERS_SCHEMA")))&&s&&s.stockParams&&p.logProcessEvent({"event.subcategory":p.sc_STOCK,"event.type":p.ERROR,"event.subtype":p.st_CLIENT},s.stockParams,{type:p.PARAM_VALIDATION_ERR,desc:r})}catch(e){r=new Error("Unable to parse Stock template request:"+t),p.logProcessEvent({"event.subcategory":p.sc_STOCK,"event.type":p.ERROR,"event.subtype":p.st_CLIENT},p.NO_PARAMS,{type:p.PARAM_VALIDATION_ERR,desc:r.message})}p.logProcessEvent({"event.subcategory":p.sc_STOCK,"event.type":p.t_REQUEST,"event.subtype":p.st_CLIENT},s&&s.stockParams),i.getUserId()||(r=new Error("Not logged in")),e._getResponseData(e._stockTemplateLookupMap,s&&s.stockParams,s&&s.requestId,t,r,!1,function(e){a.sendMessage(c.getValue("VULCAN_STOCK_TEMPLATE_RESPONSE"),JSON.stringify(e),n,o),u.log(g+"responseData: "+JSON.stringify(e)),p.logProcessEvent({"event.subcategory":p.sc_STOCK,"event.type":p.t_RESPONSE,"event.subtype":p.st_CLIENT,"event.value":Date.now()-_},s&&s.stockParams)})}),a.addListener(c.getValue("VULCAN_CC_PHOTO_DOWNLOAD_REQUEST"),function(t,n,i){var u,_=Date.now();p.logProcessEvent({"event.subcategory":p.sc_LR_CONTENT,"event.type":p.t_REQUEST,"event.subtype":p.st_CLIENT});try{u=JSON.parse(t)}catch(e){return a.sendMessage(c.getValue("VULCAN_CC_PHOTO_DOWNLOAD_ERROR"),e,n,i),void p.logProcessEvent({"event.subcategory":p.sc_LR_CONTENT,"event.type":p.ERROR,"event.subtype":p.st_CLIENT},p.NO_PARAMS,{type:p.LR_PHOTO_DOWNLOAD_ERR,desc:err})}var d=r.join(o.tmpdir(),c.getValue("TMP_PHOTOS_DOWNLOAD_DIRECTORY")),g=u.id+"-"+u.filename,f=d+g,S=JSON.stringify({id:u.id,path:f.replace(/\\/g,"/")});s.access(f,s.constants.R_OK,function(t){if(t){e._downloadManager.downloadAsset({href:u.url,assetsDir:d,clientId:u.clientId,shouldAuthenticate:!0,assetFilename:g,analyticsSubcategory:e.analyticsSubcategory,progressCallback:function(e){var t=JSON.stringify({id:u.id,percentage:e});a.sendMessage(c.getValue("VULCAN_CC_PHOTO_DOWNLOAD_PROGRESS"),t,n,i)}},function(e,t){if(e){var o=JSON.stringify({id:u.id,error:e});a.sendMessage(c.getValue("VULCAN_CC_PHOTO_DOWNLOAD_ERROR"),o,n,i),p.logProcessEvent({"event.subcategory":p.sc_LR_CONTENT,"event.type":p.ERROR,"event.subtype":p.st_CLIENT},p.NO_PARAMS,{type:p.LR_PHOTO_DOWNLOAD_ERR,desc:e})}else a.sendMessage(c.getValue("VULCAN_CC_PHOTO_DOWNLOAD_RESPONSE"),S,n,i),p.logProcessEvent({"event.subcategory":p.sc_LR_CONTENT,"event.type":p.t_RESPONSE,"event.subtype":p.st_CLIENT,"event.value":Date.now()-_},u);l.deleteTempFiles(d)})}else a.sendMessage(c.getValue("VULCAN_CC_PHOTO_DOWNLOAD_RESPONSE"),S,n,i),p.logProcessEvent({"event.subcategory":p.sc_LR_CONTENT,"event.type":p.t_RESPONSE,"event.subtype":p.st_CLIENT,"event.value":Date.now()-_},u)})}),a.sendMessage(c.getValue("VULCAN_STARTUP_MESSAGE"),"","",""),p.logProcessEvent({"event.subcategory":p.sc_PROCESS,"event.type":p.t_START,"event.subtype":p.st_PROCESS})},f.prototype.broadcast=function(e){a.sendMessage(c.getValue("VULCAN_PSDK_FEED_BROADCAST"),JSON.stringify(e),e.productCode,e.productVersion)},e.exports=f},function(e){e.exports={expirationDTS:"2015-09-05T08:15:30-05:00",nb_results:8,templates:[{id:11,title:"App 3 Template",description:"<h1>App 3 Template</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt turpis tincidunt, pellentesque ligula in, varius lectus. Integer vel ligula.</p>",thumbnail_url:"http://test-video-us.ftcdn.net/templates/Test+File+-+Apps3_thumb.jpg",mime_type:"application/illustrator",size:41721289,price_prompt:"free",template_category:"app",previews:[{url:"http://test-video-us.ftcdn.net/templates/Test+File+-+Apps3_preview.jpg"}]},{id:12,title:"Mobile 3 Template",description:"<h1>Mobile 3 Template</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt turpis tincidunt, pellentesque ligula in, varius lectus. Integer vel ligula.</p>",thumbnail_url:"http://test-video-us.ftcdn.net/templates/Test+File+-+mobile3_thumb.jpg",mime_type:"application/illustrator",size:44876477,price_prompt:"$19.99",template_category:"mobile",previews:[{url:"http://test-video-us.ftcdn.net/templates/Test+File+-+mobile3_preview.jpg"}]},{id:13,title:"Print 3 Template",description:"<h1>Print 3 Template</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt turpis tincidunt, pellentesque ligula in, varius lectus. Integer vel ligula.</p>",thumbnail_url:"http://test-video-us.ftcdn.net/templates/Test+File+-+Print3_thumb.jpg",mime_type:"application/illustrator",size:770623,price_prompt:"$19.99",template_category:"print",previews:[{url:"http://test-video-us.ftcdn.net/templates/Test+File+-+Print3_preview.jpg"}]},{id:14,title:"Web Template 3",description:"<h1>Web Template 3</h1><p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse tincidunt turpis tincidunt, pellentesque ligula in, varius lectus. Integer vel ligula.</p>",thumbnail_url:"http://test-video-us.ftcdn.net/templates/Test+File+-+Web3_thumb.jpg",mime_type:"application/illustrator",size:374652,price_prompt:"free",template_category:"web",previews:[{url:"http://test-video-us.ftcdn.net/templates/Test+File+-+Web3_preview.jpg"}]}]}},function(e,t,n){"use strict";n(4);var o=n(17),r=n(1),s=n(2),i=(n(6),n(0)),a=n(3),c=r.getValue("STOCK_DUMMY_RESPONSE")||n(40);function u(){o.call(this,"STOCK"),this.ANALYTICS_SUBCATEGORY=a.sc_STOCK}u.prototype=Object.create(o.prototype),u.prototype.constructor=u,u.prototype.getURL=function(){var e=r.getEnvironment(),t=(r.getValue("STOCK_PROTOCOL")||"https")+"://"+(r.getValue("STOCK_HOST")||e.STOCK_HOST);return r.getValue("STOCK_PORT")&&(t+=":"+r.getValue("STOCK_PORT")),t},u.prototype.getOptions=function(e){return{url:this.getURL()+r.getValue("STOCK_TEMPLATE_API_PATH")+"?product="+e.productCode+"&locale="+e.productLanguage+"&country_code="+e.countryCode,method:"GET",timeout:r.getValue("STOCK_SERVER_TIMEOUT"),headers:{"X-API-Key":r.getEnvironment().CLIENT_ID,"X-Product":e.productCode+"/"+e.productVersion,"Content-Type":"application/json",priority:e.priority}}},u.prototype.downloadCollectionData=function(e,t,n){var o=this;if("Dummy"===r.getValue("STOCK_HOST"))return i.log("CCXWelcome > StockDownloadManager > Returning dummy STOCK data"),void n(null,c);this._downloadCollectionData(this.ANALYTICS_SUBCATEGORY,"STOCK",e,t,function(t,i,c){if(!t&&c)if(c.version=r.getValue("STOCK_API_VERSION"),c.ccxVersion&&(e.ccxVersion=c.ccxVersion),a.logProcessEvent({"event.subcategory":o.ANALYTICS_SUBCATEGORY,"event.type":a.t_RESPONSE,"event.subtype":a.st_API},e),"number"==typeof c.expirationDTS)c.expirationDTS=s.formatDateString((new Date).setTime(1e3*c.expirationDTS),"YYYY-MM-DDTHH:mm:ss.SSSZZ");else if(!c.expirationDTS){var u=new Date;u.setTime(u.getTime()+216e5);var l=s.formatDateString(u,"YYYY-MM-DDTHH:mm:ss.SSSZZ");c.expirationDTS=l}n(t,c)})},e.exports=u},function(e,t,n){"use strict";var o=n(1),r=(n(7),n(0),n(2)),s=n(10),i=(n(13),n(3)),a=n(25);function c(e,t){a.call(this,e,t),this.ANALYTICS_SUBCATEGORY=i.sc_STOCK,this._schema={collection:"templates"}}c.prototype=Object.create(a.prototype),c.prototype.constructor=c,c.prototype._downloadAsset=function({asset:e,link:t,priority:n},r){e&&e[t]&&0!==e[t].length?this._lookupMap.fetchAsset({href:e[t],assetsDir:o.getValue("STOCK_DIR")+o.getValue("ASSETS_DIRNAME")+"/",priority:n},function(n,o){n?r(n):(e[t]=o,r(null))}):r(new Error("Invalid data"))},c.prototype._validateData=function(e){return r.validateDataFields(e,o.getValue("STOCK_TEMPLATES_DATA_SCHEMA"))},c.prototype._syncData=function({priority:e},t){var n=this,o=new s;this._data.templates.forEach(function(t){t.thumbnail_url&&0!==t.thumbnail_url.length&&o.addOperation(n._downloadAsset,[{asset:t,link:"thumbnail_url",priority:e}],n),t.previews&&0!==t.previews.length&&t.previews.forEach(function(t){t&&t.url&&o.addOperation(n._downloadAsset,[{asset:t,link:"url",priority:e}],n)})}),o.run(t)},c.prototype.getReferencedAssets=function(){var e={};return this._data&&this._data.templates&&this._data.templates.forEach(function(t){t&&t.thumbnail_url&&(e[t.thumbnail_url]=!0),t&&t.previews&&t.previews.forEach(function(t){t&&t.url&&(e[t.url]=!0)})}),e},e.exports=c},function(e,t,n){"use strict";var o=n(1),r=n(27),s=n(42),i=(n(7),n(0),n(2),n(3)),a=n(41),c="CCXWelcome > StockTemplateLookupMap > ";function u(e){var t={collection:"stockTemplates",collectionCache:"stockTemplatesCache",assetsCache:"assetsCache",params:"stockParams",priority:o.getValue("STOCK_PRIORITY")};r.call(this,e,t,"STOCK"),this._downloadManager=new a,this.LOG_PREFIX=c,this.ANALYTICS_SUBCATEGORY=i.sc_STOCK}u.prototype=Object.create(r.prototype),u.prototype.constructor=u,u.prototype._createCollectionData=function(e,t){return new s(e,t)},e.exports=u},function(e,t){e.exports=require("https")},function(e,t,n){"use strict";var o=n(4),r=(n(44),n(17)),s=n(1),i=n(2),a=n(6),c=n(0),u=n(3);function l(){r.call(this),this.ANALYTICS_SUBCATEGORY=u.sc_SOPHIA}l.prototype=Object.create(r.prototype),l.prototype.constructor=l,l.prototype.getURL=function(){var e=s.getEnvironment(),t=(s.getValue("SOPHIA_PROTOCOL")||"https")+"://"+(s.getValue("SOPHIA_HOST")||e.SOPHIA_HOST);return s.getValue("SOPHIA_PORT")&&(t+=":"+s.getValue("SOPHIA_PORT")),t},l.prototype.getOptions=function(e){var t={contextualParams:JSON.parse(JSON.stringify(e))};t.surfaceID=s.getValue("SOPHIA_SURFACEID",i.ccxVersionToString(e)),t.clientCode=s.getValue("SOPHIA_CLIENT_CODE");var n=e.requestId;return n||(n=o.v4()),t.analyticsParams={requestId:n},delete t.contextualParams.requestId,delete t.contextualParams.featureFlag,delete t.contextualParams.priority,{url:this.getURL()+s.getValue("SOPHIA_ENGAGEMENT_PATH"),method:"POST",json:t,timeout:s.getValue("SOPHIA_SERVER_TIMEOUT"),headers:{"x-gw-ims-user-id":a.getUserId(),"X-API-Key":s.getEnvironment().CLIENT_ID},priority:e.priority}},l.prototype.downloadCollectionData=function(e,t,n,o){this._downloadCollectionData(this.ANALYTICS_SUBCATEGORY,"PSDK",e,t,function(t,o,r){var a=function(){n(t,r)};if(!t&&r){if(r.version=s.getValue("SOPHIA_API_VERSION"),r.ccxVersion&&(e.ccxVersion=r.ccxVersion),r.expirationDTS){const e=new Date(r.expirationDTS),t=new Date;t.setTime(t.getTime()+s.getValue("MAX_TIMEOUT")),r.expirationDTS=(e>t?t:e).toISOString()}const t=s.getValue("SOPHIA_RESPONSE_SCHEMA");if(i.validateDataFields(r,t))return c.log("CCXWelcome > CardDownloadManager > Received unknown JSON from sophia: "+JSON.stringify(r)),a();o.json&&o.json.contextualParams&&o.json.contextualParams.ccxVersion&&(r.ccxVersion=o.json.contextualParams.ccxVersion),o.json&&o.json.analyticsParams&&o.json.analyticsParams.requestId&&(r.analyticsParams=r.analyticsParams||{},r.analyticsParams.requestId=o.json.analyticsParams.requestId);var u=r.cardControl,l=[];if(u&&u.forEach(function(t){var n=t.surfaceId,o=[],r=t.containers,a=[];Array.isArray(r)&&r.forEach(function(e={}){e.containerAnalyticsParams&&a.push(e.containerAnalyticsParams);var t=e.index;o.push(t)});var c,u,p,_={modeID:(c=n,u=i.ccxVersionToString(e),p=s.getValue("SOPHIA_SURFACE_MODE_MAP",u),p[c]?p[c]:c),cardOrder:o,containerAnalyticsParams:a};l.push(_)}),r.cardControl=l,e.numSophiaCards=r.cards?r.cards.length:0,"V2"===i.ccxVersionToString(e))r.cards.forEach(function(e){e.backgroundImage&&(e.backgroundImage=e.backgroundImage.replace("730x280","1000x560"))})}a()})},e.exports=l},function(e,t,n){const o=n(1),r=n(3),s=o.getValue("DATA_DIR")+o.getValue("ASSETS_DIRNAME")+"/",i=["thumbnail"],a="Path",c=n(0),u=n(31);const l=new class{validatedUrl(e){const t=u.parse(e);return t.protocol=t.protocol||"https",u.format(t)}async downloadTutorialData({card:e,lookupMap:t,priority:n}){Array.isArray(e.tutorials)&&await Promise.all(e.tutorials.map(o=>{if(!o||!o.metadata||!o.metadata.images)return null;const u=o.metadata.images;return Promise.all(i.map(async e=>{if(!u[e]||0===u[e].length)return null;const o=await t.fetchAssetAsync({href:u[e],assetsDir:s,priority:n});u[e+a]=o})).catch(function(t){c.log("Error downloading UTUTS data: "+t,t.stack),r.logProcessEvent({"event.subcategory":r.sc_UTUTS,"event.type":r.ERROR,"event.subtype":r.st_API,"content.id":o.tutorialUUID||o.aem_id,"content.name":o.metadata.descriptions&&o.metadata.descriptions.short,"content.category":o.metadata.level,"content.action":o.metadata.urls&&o.metadata.urls.helpx,"content.type":o.metadata.learning_approach},r.NO_PARAMS,t.stack),e.tutorials.splice(e.tutorials.indexOf(o),1)})}))}async downloadYukonData({card:e,lookupMap:t,priority:n}){if(!e.contentURL||0===e.contentURL.length)return;const o=await t.getDownloadManager().get({url:e.contentURL,headers:{"If-Modified-Since":e.lastModified},priority:n});if(304!==o.response.statusCode||!e.lastModified||!e.content){if(!o.body||200!==o.response.statusCode)throw`Yukon Request failed: ${e.contentURL} with response: ${o.response.statusCode}, ${o.body}`;e.content=JSON.parse(o.body),e.lastModified=o.response.headers&&o.response.headers["last-modified"],e.content.includes&&Array.isArray(e.content.includes.Asset)&&await Promise.all(e.content.includes.Asset.map(async e=>{if(e.fields&&e.fields.file&&e.fields.file.url){const o=await t.fetchAssetAsync({href:this.validatedUrl(e.fields.file.url),assetsDir:s,priority:n});e.fields.file.path=o}}))}}async downloadLegacyData({card:e,lookupMap:t,priority:n}){if(!e.backgroundImage||0===e.backgroundImage.length)return;let o=null;try{o=await t.fetchAssetAsync({href:e.backgroundImage,assetsDir:s,priority:n})}catch(r){if(404!==r.statusCode||0===e.backgroundImage.indexOf("1000x560"))throw r;e.backgroundImage=e.backgroundImage.replace("1000x560","730x280"),o=await t.fetchAssetAsync({href:e.backgroundImage,assetsDir:s,priority:n})}return e.backgroundImageLocalpath=o,null}async downloadData({modeID:e,card:t,lookupMap:n,priority:o}){try{switch(e){case"CCX_TUTORIAL_2.5":return await this.downloadTutorialData({card:t,lookupMap:n,priority:o});case"CCX_Start_2.5_Learn":case"CCX_Start_2.5_Toast":case"CCX_Start_2.5_Home":return await this.downloadYukonData({card:t,lookupMap:n,priority:o});default:return await this.downloadLegacyData({card:t,lookupMap:n,priority:o})}}catch(n){throw c.log(`Error downloading content for ${e} ${n}, ${n.stack}, card: ${JSON.stringify(t)},`),n}}getReferencedAssets(e,t){const n={};switch(e){case"CCX_Start_2.5_Learn":case"CCX_Start_2.5_Toast":case"CCX_Start_2.5_Home":return t.content&&t.content.includes&&Array.isArray(t.content.includes.Asset)&&t.content.includes.Asset.forEach(e=>{e.fields&&e.fields.file&&e.fields.file.path&&(n[e.fields.file.path]=!0)}),n;case"CCX_TUTORIAL_2.5":return Array.isArray(t.tutorials)&&t.tutorials.forEach(e=>{if(e&&e.metadata&&e.metadata.images){const t=e.metadata.images;i.forEach(e=>{t[e+a]&&(n[t[e+a]]=!0)})}}),n;default:if(t.backgroundImageLocalpath)return{[`${t.backgroundImageLocalpath}`]:!0}}return{}}};e.exports=l},function(e,t,n){"use strict";var o=n(1),r=(n(0),n(2)),s=n(3),i=n(25),a=n(46);function c(e,t){i.call(this,e,t),this.ANALYTICS_SUBCATEGORY=s.sc_SOPHIA,this._schema={collection:"cards"}}c.prototype=Object.create(i.prototype),c.prototype.constructor=c,c.prototype._validateData=function(e){var t;if(t=r.validateDataFields(e,o.getValue("CARDS_DATA_SCHEMA"),[o.getValue("CARDS_CONTROL_SCHEMA")]))return t;var n=[];return e.cardControl.forEach(function(s){var i=o.getValue("CARD_DATA_SCHEMA")[s.modeID];if(!i)return null;s.cardOrder.forEach(function(o){var s=e.cards[o];s&&(t=r.validateDataFields(s,i))&&(n=n.concat(t))})}),n.length>0?n:null},c.prototype._syncData=function({priority:e},t){const n=[];this._data.cardControl.forEach(t=>{t.cardOrder.forEach(o=>{const r=this._data.cards[o];r&&n.push(a.downloadData({modeID:t.modeID,card:r,lookupMap:this._lookupMap,priority:e}))})}),Promise.all(n).then(()=>{t()},t)},c.prototype.hasValidCards=function(){const e=o.getValue("ACTIVE_VERSIONS"),t=e[e.length-1];return r.ccxVersionToString(this._data)!==t||!!this._data.cardControl.find(e=>"CCX_Start_2.5_Home"===e.modeID)},c.prototype.getReferencedAssets=function(){const e={};return this._data.cardControl.forEach(t=>{t.cardOrder.forEach(n=>{const o=this._data.cards[n];if(o){const n=a.getReferencedAssets(t.modeID,o);Object.assign(e,n)}})}),e},e.exports=c},function(e,t){e.exports=require("net")},function(e,t){e.exports=require("util")},function(e,t,n){"use strict";n(4);var o=n(1),r=n(27),s=n(6),i=n(47),a=(n(7),n(0)),c=n(2),u=n(3),l=n(45),p="CCXWelcome > CardLookupMap > ";function _(e){var t={collection:"userCards",collectionCache:"userCardsCache",assetsCache:"assetsCache",params:"psdkParams",priority:o.getValue("PSDK_PRIORITY")};r.call(this,e,t,"PSDK"),this._downloadManager=new l,this.LOG_PREFIX=p,this.ANALYTICS_SUBCATEGORY=u.sc_SOPHIA}_.prototype=Object.create(r.prototype),_.prototype.constructor=_,_.prototype.priority=function(e,t=""){const n=r.prototype.priority.apply(this,arguments);return n.priority+=o.getValue("priority",c.ccxVersionToString(e)),n},_.prototype.upgradeData=function(e){try{if(3===e.version&&e.userCards&&e.userCardsCache&&e.assetsCache)return a.log(`${this.LOG_PREFIX} Upgrading Card Data from Version 3 to Version 4`),e.version=4,Object.keys(e.userCards).forEach(t=>{const n=e.userCards[t],o={V1:{},V2:{},V2_4:{},V2_5:{}};Object.keys(n).forEach(e=>{["PHXS","IDSN","ILST","MUSE","AEFT","PPRO"].includes(e)?o.V1[e]=n[e]:["2.0","2.1","2.2","2.3"].includes(e)?Object.assign(o.V2,n[e]):"2.4"===e?Object.assign(o.V2_4,n[e]):"2.5"===e&&Object.assign(o.V2_5,n[e])}),Object.keys(o).forEach(e=>{0===Object.keys(o[e]).length&&delete o[e]}),e.userCards[t]=o}),e.usersInfo=e.usersInfo||{},Object.keys(e.usersInfo).forEach(t=>{delete e.usersInfo[t].floodGateCache}),e.userCardsCache=e.userCardsCache||{},Object.keys(e.userCardsCache).forEach(t=>{e.userCardsCache[t].lastUseTime=(new Date).toISOString()}),e}catch(e){a.log(`${this.LOG_PREFIX} error upgrading data - ${e}. Re-downloading`)}},_.prototype._createCollectionData=function(e,t){return new i(e,t)},_.prototype._getLookupKeys=function(e,t){var n=r.prototype._getLookupKeys.call(this,e,t);const o=c.ccxVersionToString(e);return n.splice(1,0,o),n},_.prototype._isDataInvalid=function(e,t){return!(e&&e.hasValidCards&&e.hasValidCards())&&(u.logProcessEvent({"event.subcategory":u.sc_SOPHIA,"event.type":u.ERROR,"event.subtype":u.st_API},t,{type:u.MISSING_DATA,desc:"Empty Sophia Cards"}),!0)},_.prototype.isRequestPoisoned=function(e){const t=c.ccxVersionToString(e);return"V1"===t||"V2"===t&&!o.getValue("TIER_1_LOCALES").includes(e.productLanguage)},_.prototype.sanitizeParams=function(e){return e.productLanguage=c.sanitizeLocale(e.productLanguage),e},_.prototype.getAdditionalIngestParams=function(e){let t={campaignId:""};return e&&(e.analyticsParams&&Object.assign(t,{"exp.request_id":e.analyticsParams.requestId,"exp.response_guid":e.analyticsParams.responseId}),t.numSophiaCards=e.cards?e.cards.length:0,Array.isArray(e.cardControl)&&e.cardControl.forEach(e=>{Array.isArray(e.containerAnalyticsParams)&&e.containerAnalyticsParams.forEach(e=>{t.campaign_id+=" "+e.campaignId,t.variation_id+=" "+e.variationId,t.treatment_id+=" "+e.treatmentId,t.control_group_id+=" "+e.controlGroupId,t.action_block_id+=" "+e.actionBlockId})})),t},_.prototype.getCachedRequestData=function(e){var t=this,n={};return Object.keys(this._data[this._schema.collectionCache]).forEach(function(o){var r=t._data[t._schema.collectionCache][o];if(r.userId===s.getUserId()){var i=r.psdkParams;if(i){n[i.productCode]||(n[i.productCode]={});var a=function(e){n[i.productCode][i.productVersion]||(n[i.productCode][i.productVersion]=[]),n[i.productCode][i.productVersion].push(e)};if(e)(r.psdkParams&&r.psdkParams.ccxVersion&&r.psdkParams.ccxVersion.split(".").slice(0,2).join("."))===e.split(".").slice(0,2).join(".")&&a(r.psdkParams);else a(r.psdkParams)}}}),n},e.exports=_},function(e,t){e.exports=require("ingest")},function(e,t,n){"use strict";var o=n(4),r=n(16),s=n(20),i=n(1),a=n(0),c=n(8),u=n(2),l=n(3),p="CCXWelcome > ThorNotifications > ";function _(e,t){var n=null;if(e){var o=new RegExp("<"+t+"[^<>]*>([^<>]*)</"+t+">",""),r=e.match(o);n=r&&r[1]}return n}function d(e,t){var n=e;return Object.keys(t).forEach(function(e){n=n.replace(e,t[e])}),n}var g=new c(["signIn","signOut","proxySettingsChanged","profileUpdated","installApplication","uninstallApplication","updateApplication","subscriptionStatusChanged","updateStock","updateApplicationComponents"]);s.addListener("accc.localapps.panel.refresh.ssoevent",function(e){var t=_(e,"event_type");a.log(p+"ACCC Sign-on State: "+t),"signin_success"===t?g.notify("signIn"):"signout_success"===t&&g.notify("signOut")}),s.addListener("com.adobe.aam.AAMIMSStatus",function(e){var t=_(e,"Status");a.log(p+"AAM Sign-on State: "+t),"USER_AUTH_SUCCESS"===t&&g.notify("signIn")}),s.addListener("com.adobe.aam.AAMSIGNOUTStatus",function(e){g.notify("signOut"),a.log(p+"AAM Sign-on State: signOut")}),s.addListener("any.accc.app.ProxySettingsChanged",function(e){var t=_(e,"proxyuser"),n=_(e,"proxypassword");null!==t&&null!==n&&g.notify("proxySettingsChanged",[t,n])}),s.addListener("any.accc.app.ProductDeploymentEvent",function(e){var t,n,o={productCode:_(e,"productCode"),productVersion:_(e,"productVersion"),productLanguage:_(e,"productLanguage"),countryCode:_(e,"countryCode"),subscriptionStatus:_(e,"subscriptionStatus")};if(-1!==i.getValue("PRODUCT_LIST").indexOf(o.productCode)&&(o.productCode=(t=o.productCode,n=t,"PHSP"===t&&(n="PHXS"),n),o.productLanguage))switch(_(e,"eventType")){case"Install":g.notify("installApplication",[o]);break;case"Uninstall":g.notify("uninstallApplication",[o]);break;case"Update":g.notify("updateApplication",[o]);break;case"UpdateComponents":g.hasListeners("updateApplicationComponents")&&(o.productID=_(e,"productID"),g.notify("updateApplicationComponents",[o]))}});var f={};f._handlePayload=function(e,t){var n={};new r.Parser({async:!1}).parseString(e,function(o,r){if(o)return a.log(p+o),void l.logProcessEvent({"event.subcategory":l.sc_PROCESS,"event.type":l.ERROR,"event.subtype":l.st_ANS},l.NO_PARAMS,{type:l.PARSE_MSG_FAIL,desc:"Fail to parse message, message="+e});var s=r["notification-error"];if(s){var c=s.error&&s.error[0],_=c&&c.$&&c.$.desc||"Unknown notification error";a.log(p+_)}else{var d,f=r&&r.notifications&&r.notifications.notification||[];a.log(p+"Received "+f.length+" ANS notifications."),f.forEach(function(e){var o=e.type[0],r=e["sub-type"][0],s=parseInt(e.timestamp[0],10),c=e.payload;(!t||s>t)&&(d=!d||s>d?s:d,function(e,t,o){if(e===i.getValue("ANS_PSDK_NOTIFICATION_TYPE")&&t===i.getValue("ANS_PSDK_NOTIFICATION_SUB_TYPE")){var r;a.log(p+"Handle ANS message: type="+e+", subtype="+t+", payload="+o);try{r=o&&JSON.parse(o)}catch(e){return a.log(p+"Fail to parse payload: "+o),void l.logProcessEvent({"event.subcategory":l.sc_PROCESS,"event.type":l.ERROR,"event.subtype":l.st_ANS},l.NO_PARAMS,{type:l.PAYLOAD_PARSE_FAIL,desc:"Fail to parse payload: "+o})}switch(r&&r.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 e===i.getValue("ANS_STOCK_NOTIFICATION_TYPE")&&t===i.getValue("ANS_STOCK_NOTIFICATION_SUB_TYPE")?n.updateStock=!0:(a.log(p+"Received unexpected ANS message, type="+e+", subType="+t),l.logProcessEvent({"event.subcategory":l.sc_PROCESS,"event.type":l.ERROR,"event.subtype":l.st_ANS},l.NO_PARAMS,{type:l.UNEXPECTED_ANS_MSG,desc:"Received unexpected ANS message, type="+e+", subType="+t}))}(o,r,c))}),Object.keys(n).forEach(function(e){g.notify(e,[d||u.getCurrentTime()])})}})},f._queryANSNotificationsByTime=function(e,t,n){var r,a=o.v4(),c=function(e){clearTimeout(r),s.removeListener(t,c),n(null,e)};s.addListener(t,c);var l={"{{TIME_STAMP}}":u.getCurrentTime(),"{{NOTIFICATION_TYPE}}":e,"{{NOTIFICATION_COUNT}}":"10","{{uuid}}":a,"{{requestor-namespace}}":t};s.sendMessage(i.getValue("NOTIFICATION_REQUEST"),d('<?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>',l),"ADCS",""),r=setTimeout(function(){s.removeListener(t,c),n(new Error("GetNotificationDataByTime timeout"))},i.getValue("GET_NOTIFICATION_DATA_TIMEOUT"))},f.addListener=function(e,t){g.add(e,t)},f.removeListener=function(e,t){g.remove(e,t)},f.removeAllListeners=function(e){g.removeAll(e)},f.getProxyCredentials=function(e){var t,n=function(o){s.removeListener("accc.app.ProxySettingsResponse",n),clearTimeout(t);var r=_(o,"proxyuser"),i=_(o,"proxypassword");a.log(p+"GetProxySettings - Successfully obtained username/password from Thor"),e(r,i)};s.addListener("accc.app.ProxySettingsResponse",n),s.sendMessage("accc.app.ProxySettingsRequest",d('<?xml version="1.0" encoding="utf-8"?><request><type>accc.app.ProxySettingsRequest</type><request_id>{{uuid}}</request_id></request>',{"{{uuid}}":o.v4()}),"ADCS",""),t=setTimeout(function(){s.removeListener("accc.app.ProxySettingsResponse",n),a.log(p+"GetProxySettings - Error: timed out getting proxy settings from Thor"),e(null,null)},i.getValue("PROXY_REQUEST_TIMEOUT"))},f.registerANSNotifications=function(){[{"{{NOTIFICATION_TYPE}}":i.getValue("ANS_PSDK_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":i.getValue("ANS_PSDK_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":i.getValue("NOTIFICATION_PSDK_RESPONSE")},{"{{NOTIFICATION_TYPE}}":i.getValue("ANS_STOCK_NOTIFICATION_TYPE"),"{{NOTIFICATION_SUB_TYPE}}":i.getValue("ANS_STOCK_NOTIFICATION_SUB_TYPE"),"{{observer-namespace}}":i.getValue("NOTIFICATION_STOCK_RESPONSE")}].forEach(function(e){s.sendMessage(i.getValue("NOTIFICATION_REQUEST"),d('<?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>',e),"ADCS","")})},f.getNotificationDataByIDs=function(e,t,n,r){if(0!==Object.keys(e).length){var a,c=o.v4(),u=function(e){s.removeListener(n,u),clearTimeout(a),r(null,e)};s.addListener(n,u);var p="";Object.keys(e).forEach(function(e){p+="<notification-id>"+e+"</notification-id>"});var _={"{{NOTIFICATION_TYPE}}":t,"{{NOTIFICATION_IDS}}":p,"{{uuid}}":c,"{{requestor-namespace}}":n};s.sendMessage(i.getValue("NOTIFICATION_REQUEST"),d('<?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>',_),"ADCS",""),a=setTimeout(function(){s.removeListener(n,u),l.logProcessEvent({"event.subcategory":l.sc_PROCESS,"event.type":l.ERROR,"event.subtype":l.st_ANS},l.NO_PARAMS,{type:l.GET_NOTIFICATION_DATA,desc:"GetNotificationDataByID - Error: timed out getting notification data from Thor"}),r(new Error("GetNotificationDataByID timeout"))},i.getValue("GET_NOTIFICATION_DATA_TIMEOUT"))}else r(new Error("No notification id"))},f.handleNotificationResponse=function(e,t,n){var o={};new r.Parser({async:!1}).parseString(e,function(r,s){if(r)return a.log(p+r),void l.logProcessEvent({"event.subcategory":l.sc_PROCESS,"event.type":l.ERROR,"event.subtype":l.st_ANS},l.NO_PARAMS,{type:l.PARSE_MSG_FAIL,desc:"Fail to parse message, message="+e});var i=s&&s["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){o[e]=!0})}),f.getNotificationDataByIDs(o,t,n,function(e,t){e?a.log(p+e):f._handlePayload(t)})})},s.addListener(i.getValue("NOTIFICATION_PSDK_RESPONSE"),function(e){f.handleNotificationResponse(e,i.getValue("ANS_PSDK_NOTIFICATION_TYPE"),i.getValue("NOTIFICATION_PSDK_QUERY_DATA_BY_ID_RESPONSE"))}),s.addListener(i.getValue("NOTIFICATION_STOCK_RESPONSE"),function(e){f.handleNotificationResponse(e,i.getValue("ANS_STOCK_NOTIFICATION_TYPE"),i.getValue("NOTIFICATION_STOCK_QUERY_DATA_BY_ID_RESPONSE"))}),f.checkForMissedNotifications=function(e,t){[{type:i.getValue("ANS_PSDK_NOTIFICATION_TYPE"),requestNamespace:i.getValue("NOTIFICATION_PSDK_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:e},{type:i.getValue("ANS_STOCK_NOTIFICATION_TYPE"),requestNamespace:i.getValue("NOTIFICATION_STOCK_QUERY_DATA_BY_TIME_RESPONSE"),lastTimeOfNotification:t}].forEach(function(e){var t=e.lastTimeOfNotification;f.queryANSNotificationsByTime(e,function(e,n){e?a.log(p+e):f._handlePayload(n,t)})})},f.queryANSNotificationsByTime=function(e,t){f._queryANSNotificationsByTime(e.type,e.requestNamespace,t)},e.exports=f},function(e,t){e.exports=require("node-ProxyResolver")},function(e,t){e.exports=require("node-vulcanjs")},function(e,t,n){"use strict";var o=n(20),r=n(1),s=n(0),i=n(11),a={getMissingProductList:function(e,t){var n=[];o.getSpecifiers().forEach(function(t){var i=t.split("-")[0],a=r.getValue("VULCAN_SPECIFIER_MAP")[i],c=o.getAppVersion(t);a&&c&&(e[a]&&(e[a][c]||e[a][c+".0"])?s.log("updateLookupMapWithInstalledApps - App found, Skipping : ",a,c):(s.log("updateLookupMapWithInstalledApps - App NOT found, Adding : ",a,c),n.push({productCode:a,productVersion:c})))});var a=[];if(n.length>0){const e=i.osLocale;var c=e.split("_")[1];n.forEach(function(t){t.productLanguage=e,t.countryCode=c,t.subscriptionStatus="paid",a.push(t);var n=Object.assign({},t);n.subscriptionStatus="trial",a.push(n)}),t(a)}else t([])},getExcessProductList:function(e,t){const n=[];Object.values(e).forEach(e=>{Object.values(e).forEach(e=>n.push(...e))});const s=o.getSpecifiers().map(e=>{const t=e.split("-")[0],n=r.getValue("VULCAN_SPECIFIER_MAP")[t],s=o.getAppVersion(e);return n&&s?{productCode:n,productVersion:s}:{}});return t(n.filter(e=>!s.find(t=>t.productCode===e.productCode&&(t.productVersion===e.productVersion||e.productVersion===t.productVersion+".0"))))}};e.exports=a},function(e,t){e.exports=require("fs-ext")},function(e,t,n){"use strict";var o=n(5),r=(n(12),n(1)),s=n(2),i=n(0),a=(n(14),n(7)),c=n(55),u=n(6),l=n(11),p=n(52),_=n(50),d=n(43),g=n(39),f=n(3),S=n(10),E=n(19),T=n(18);global.nodeRequire=n(38),n(37).start(),Error.stackTraceLimit=1/0;var C=function(e){var t=0,n=function(){i.removeLogWriteListener(n),2==++t&&process.exit()};f.logProcessEvent({"event.subcategory":f.sc_PROCESS,"event.type":f.ERROR,"event.subtype":f.st_PROCESS},f.NO_PARAMS,e.toString()+","+e.stack),console.log(e.toString()+","+e.stack),i.addLogWriteListener(n)};process.on("uncaughtException",C),process.on("unhandledRejection",(e="")=>{f.logProcessEvent({subcategory:f.sc_PROCESS,type:f.ERROR,subtype:f.st_PROCESS},f.NO_PARAMS,e.toString()+","+e.stack),i.log("unhandledRejection",e.stack,e.toString()),console.log(e.toString()+","+e.stack)});var h=new _(r.getValue("DATA_DIR")),O=new d(r.getValue("STOCK_DIR")),A=new g(h,O);function I(e){u.getUserId()&&h.sync(e,function(e){e&&(i.log("Syncing failed: "+e),f.logProcessEvent({"event.subcategory":f.sc_PROCESS,"event.type":f.ERROR,"event.subtype":f.st_PROCESS},f.NO_PARAMS,e))})}function y(e){u.getUserId()&&O.sync(e,function(e){e&&(i.log("Syncing stock templates failed: "+e),f.logProcessEvent({"event.subcategory":f.sc_PROCESS,"event.type":f.ERROR,"event.subtype":f.st_PROCESS},f.NO_PARAMS,e))})}function v(e,t,n){u.setProxyCredentials(e,t),l.setProxyCredentials(e,t),n&&(u.clearUserId(),u.getUserId(),I(),y())}function R(){if(!u.getUserId())return;const e=s.getClientsThatNeedRefresh(h);Object.keys(e).forEach(t=>{e[t].forEach(e=>{const n=JSON.parse(JSON.stringify(e));n.ccxVersion=r.getValue("START_VERSION",t),n.release=r.getValue("START_RELEASE",t),delete n.radarSessionGUID,delete n.requestId,h.isRequestPoisoned(n)||h.addNewCollectionData(n)})})}function N(e){if(u.getUserId()){var t=s.validateDataFields(e,r.getValue("PSDK_PARAMETERS_SCHEMA"));if(!t){"trial"===e.subscriptionStatus&&(e.trialEndDTS=s.getDefaultTrialEndDTS());const t=r.getValue("ACTIVE_VERSIONS").find(t=>{const n=r.getValue("SOPHIA_PREFETCH_CLIENTS",t)[e.productCode];return 1===s.compareMajorMinorVersions(e.productVersion,n)});e.ccxVersion=r.getValue("START_VERSION",t),e.release=r.getValue("START_RELEASE",t),R(),h.isRequestPoisoned(e)||h.addNewCollectionData(e)}(t=s.validateDataFields(e,r.getValue("STOCK_TEMPLATE_PARAMETERS_SCHEMA")))||-1===r.getValue("STOCK_PRODUCT_LIST").indexOf(e.productCode)||process.nextTick(()=>{O.addNewCollectionData(e)})}}function m(){c.getMissingProductList(h.getCachedRequestData(),function(e){e.forEach(function(e){N(e)})}),c.getExcessProductList(h.getCachedRequestData(),function(e){e.forEach(e=>{h.clearCollectionInfo(e,!0)})})}function P(){i.log("-------------------------Startup------------------------------"),i.log("Build version is "+s.getProcessVersion()),f.logProcessEvent({"event.subcategory":f.sc_PROCESS,"event.type":f.t_INIT,"event.subtype":f.st_PROCESS});var e=new S;e.addOperation(h.load,[],h),e.addOperation(O.load,[],O),o.remove(r.getValue("ROOT_DIR")+"floodgate"),e.run(function(e){e&&(i.log("Failed to load lookup map, err="+e),f.logProcessEvent({"event.subcategory":f.sc_PROCESS,"event.type":f.ERROR,"event.subtype":f.st_PROCESS},f.NO_PARAMS,e));const t=()=>{T.check().then(()=>{A.init(),h.listenerManager.add("newCollection",function(e){A.broadcast(e)}),f.logProcessEvent({"event.subcategory":f.sc_PROCESS,"event.type":f.t_START,"event.subtype":f.st_PROCESS}),p.addListener("signOut",function(){i.log("User is signOut."),f.logProcessEvent({"event.subcategory":f.sc_AUTH,"event.type":f.t_SIGNOUT,"event.subtype":f.st_PROCESS},f.NO_PARAMS),u.clearUserId(),E.clearAccessToken()}),p.addListener("signIn",function(){var e=u.getUserId();if(e){var t="ANALYTICS_ENABLED_"+e;f.enable(r.getValue(t)||!1),f.logProcessEvent({"event.subcategory":f.sc_AUTH,"event.type":f.t_SIGNIN,"event.subtype":f.st_PROCESS},f.NO_PARAMS),I(),y(),m(),R()}}),p.addListener("proxySettingsChanged",function(e,t){v(e,t,!0)}),p.addListener("profileUpdated",function(e){e&&h.setLastTimeOfNotification(e),I(!0)}),p.addListener("subscriptionStatusChanged",function(e){e&&(h.setLastTimeOfNotification(e),O.setLastTimeOfNotification(e)),I()}),p.addListener("updateStock",function(e){e&&O.setLastTimeOfNotification(e),y(!0)}),p.addListener("installApplication",function(e){i.log("Handle installApplication event, productInfo="+JSON.stringify(e)),N(e)}),p.addListener("updateApplication",function(e){i.log("Handle updateApplication event, productInfo="+JSON.stringify(e)),N(e)}),p.addListener("uninstallApplication",function(e){i.log("Handle uninstallApplication event, productInfo="+JSON.stringify(e));var t=s.validateDataFields(e,r.getValue("PSDK_PARAMETERS_SCHEMA"));t||h.clearCollectionInfo(e,!0),(t=s.validateDataFields(e,r.getValue("STOCK_TEMPLATE_PARAMETERS_SCHEMA")))||O.clearCollectionInfo(e,!0)}),l.addListener("change",function(e){e&&p.getProxyCredentials(function(e,t){v(e,t)})}),p.registerANSNotifications(),u.getUserId()&&p.checkForMissedNotifications(h.getLastTimeOfNotification(),O.getLastTimeOfNotification()),T.on(T.ONLINE,()=>{i.log("Network status back to online."),I(),y()}),m(),R(),I(),y()})};T.needsProxy().then(e=>{e?p.getProxyCredentials(function(e,n){v(e,n),t()}):(t(),p.getProxyCredentials(function(e,t){v(e,t)}))})})}a.obtainProcessLock("lockfile",function(e){e?(i.log("Get lock file successfully."),l.init(P)):process.exit(1)}),e.exports={handleUncaughtException:C}},function(e,t,n){n(57)},function(e,t,n){e.exports=n(58)}]);