{
  "version": 3,
  "sources": ["ssg:https://framerusercontent.com/modules/TXyEPWdgwKQyOo4OnUpW/LIiNl7eZulGhD07SY7cu/Initialize_Amplitude.js"],
  "sourcesContent": ["import{jsx as _jsx}from\"react/jsx-runtime\";import React from\"react\";export const initializeAmplitude=Component=>{return props=>{// Function to sanitize path\nfunction sanitizePath(pathname){pathname=pathname.replace(/^\\/|\\/$/g,\"\");return pathname.replace(/\\//g,\"_\");}// Get existing device id from cookie\nconst getDeviceId=React.useCallback(async data=>{if(!window){return;}// Get existing device id from cookie\nconst existingDeviceId=document.cookie.split(\"; \").find(row=>row.startsWith(\"__session=\"))?.split(\"=\")[1];if(existingDeviceId){return existingDeviceId;}// Create a new device id\nconst appEndpoint=data.gitbookEnv!==\"production\"?\"https://app.gitbook-staging.com\":\"https://app.gitbook.com\";const resp=await fetch(appEndpoint+\"/__session?proposed=\"+crypto.randomUUID(),{method:\"GET\",credentials:\"include\",cache:\"no-cache\",mode:\"cors\"});const json=await resp.json();return json.deviceId;},[]);// Function to initialize Amplitude\nconst initializeAmplitude=React.useCallback(async deviceId=>{window.amplitude.init(\"fef1e872c952688acd962d30aa545b9e\",{autocapture:{attribution:true,pageViews:false,sessions:false,formInteractions:false,fileDownloads:false,elementInteractions:false},deviceId:deviceId,serverUrl:\"https://app.gitbook.com/__amp/2/\"});return;},[]);// Main call\nReact.useEffect(()=>{if(window&&window.location.pathname){const isProduction=window.location.host===\"www.gitbook.com\"?true:false;// Homepage\nconst isHomePage=window.location.pathname===\"/\";// Blog Homepage\nconst isBlogHomePage=window.location.pathname===\"/blog\";// Any blog post\nconst isBlogPostPage=window.location.pathname.startsWith(\"/blog/\");let data={amplitudeKey:isProduction?\"fef1e872c952688acd962d30aa545b9e\":\"94e2e3490890004b116c012a939ffd2a\",gitbookEnv:isProduction?\"production\":\"development\"};// Call the initializeAmplitude function\ngetDeviceId(data).then(deviceId=>{return initializeAmplitude(deviceId);}).then(()=>{return window.amplitude.track(`view_marketing_site_${isHomePage?\"home\":isBlogPostPage?\"blog_post\":isBlogHomePage?\"blog_home\":sanitizePath(window.location.pathname)}`,{Site:\"Marketing Site\",screenURL:document.location.href,screenPath:document.location.pathname,screenPageTitle:document.title});});}},[]);return /*#__PURE__*/_jsx(Component,{...props});};};\nexport const __FramerMetadata__ = {\"exports\":{\"initializeAmplitude\":{\"type\":\"reactHoc\",\"name\":\"initializeAmplitude\",\"annotations\":{\"framerContractVersion\":\"1\"}},\"__FramerMetadata__\":{\"type\":\"variable\"}}}\n//# sourceMappingURL=./Initialize_Amplitude.map"],
  "mappings": "oFAA2E,IAAMA,EAAoBC,GAAmBC,GAAO,CAC/H,SAASC,EAAaC,EAAS,CAAC,OAAAA,EAASA,EAAS,QAAQ,WAAW,EAAE,EAASA,EAAS,QAAQ,MAAM,GAAG,CAAE,CAC5G,IAAMC,EAAYC,EAAM,YAAY,MAAMC,GAAM,CAAC,GAAG,CAACC,EAAQ,OAC7D,IAAMC,EAAiB,SAAS,OAAO,MAAM,IAAI,EAAE,KAAKC,GAAKA,EAAI,WAAW,YAAY,CAAC,GAAG,MAAM,GAAG,EAAE,CAAC,EAAE,GAAGD,EAAkB,OAAOA,EACtI,IAAME,EAAYJ,EAAK,aAAa,aAAa,kCAAkC,0BAAwM,OAAlB,MAAjJ,MAAM,MAAMI,EAAY,uBAAuB,OAAO,WAAW,EAAE,CAAC,OAAO,MAAM,YAAY,UAAU,MAAM,WAAW,KAAK,MAAM,CAAC,GAAwB,KAAK,GAAc,QAAS,EAAE,CAAC,CAAC,EAC9SX,EAAoBM,EAAM,YAAY,MAAMM,GAAU,CAACJ,EAAO,UAAU,KAAK,mCAAmC,CAAC,YAAY,CAAC,YAAY,GAAK,UAAU,GAAM,SAAS,GAAM,iBAAiB,GAAM,cAAc,GAAM,oBAAoB,EAAK,EAAE,SAASI,EAAS,UAAU,kCAAkC,CAAC,CAAS,EAAE,CAAC,CAAC,EACtU,OAAAN,EAAM,UAAU,IAAI,CAAC,GAAGE,GAAQA,EAAO,SAAS,SAAS,CAAC,IAAMK,EAAaL,EAAO,SAAS,OAAO,kBAC9FM,EAAWN,EAAO,SAAS,WAAW,IACtCO,EAAeP,EAAO,SAAS,WAAW,QAC1CQ,EAAeR,EAAO,SAAS,SAAS,WAAW,QAAQ,EACjEH,EAD4E,CAAC,aAAaQ,EAAa,mCAAmC,mCAAmC,WAAWA,EAAa,aAAa,aAAa,CAC/M,EAAE,KAAKD,GAAkBZ,EAAoBY,CAAQ,CAAG,EAAE,KAAK,IAAYJ,EAAO,UAAU,MAAM,uBAAuBM,EAAW,OAAOE,EAAe,YAAYD,EAAe,YAAYZ,EAAaK,EAAO,SAAS,QAAQ,CAAC,GAAG,CAAC,KAAK,iBAAiB,UAAU,SAAS,SAAS,KAAK,WAAW,SAAS,SAAS,SAAS,gBAAgB,SAAS,KAAK,CAAC,CAAG,CAAE,CAAC,EAAE,CAAC,CAAC,EAAsBS,EAAKhB,EAAU,CAAC,GAAGC,CAAK,CAAC,CAAE",
  "names": ["initializeAmplitude", "Component", "props", "sanitizePath", "pathname", "getDeviceId", "e", "data", "window", "existingDeviceId", "row", "appEndpoint", "deviceId", "isProduction", "isHomePage", "isBlogHomePage", "isBlogPostPage", "p"]
}
