builder.io 1.1.13-10 → 1.1.13-11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/server/index.cjs +3 -3
- package/server/index.mjs +2 -2
package/package.json
CHANGED
package/server/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ ${u}`)}else o(`Request to ${e.url.href} failed with status ${s.statusCode}: ${a}
|
|
|
6
6
|
}
|
|
7
7
|
}`};e.debug(`Get model id for model name "${t.model}"`);let i=(await p({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)})).data.models.find(u=>u.name===t.model);if(!i)return e.debug(`No model found for model name "${t.model}"`),!1;e.debug(`Data query, modelId: "${i.id}", urlPath: "${t.pageUrl}"`);let s=new URL("https://cdn.builder.io/api/v3/data");s.searchParams.set("limit","1"),s.searchParams.set("cachebust","true"),s.searchParams.set("collection","content"),s.searchParams.set("query.published.$ne","archived"),s.searchParams.set("query.query.$elemMatch.$and[0].property","urlPath"),s.searchParams.set("query.query.$elemMatch.$and[0].operator","is"),s.searchParams.set("query.query.$elemMatch.$and[0].value",t.pageUrl),s.searchParams.set("query.modelId",i.id),s.searchParams.set("apiKey",t.publicApiKey);let a=await p({url:s,method:"GET"});return e.debug(`Data results (${a.results.length}): ${s.href}`),a.results.length>0}async function h(e,t){let r=new URL(`https://cdn.builder.io/api/v3/content/${t.model}`);r.searchParams.set("apiKey",t.publicApiKey),r.searchParams.set("cachebust","true"),r.searchParams.set("cb",Date.now().toString()),t.pageUrl&&(r.searchParams.set("url",t.pageUrl),e.debug(`get model: "${t.model}", pageUrl: "${t.pageUrl}":`,r.href)),t.id&&(r.searchParams.set("query.id",t.id),e.debug(`get model: "${t.model}", id: "${t.id}":`,r.href));let o=await p({url:r,method:"GET"});return e.debug(`get content results: ${o.results.length}`),o}async function M(e,t){let r=new URL(`https://cdn.builder.io/api/v1/write/${t.model}`);e.debug(`writing "${t.model}" content:`,r.href),await p({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`},body:t.body})}var c="page",x="integration-welcome-screens",H="8d9ee72a33344b4b867918b442ebd0af";async function B(e,t){let r=await h(e,{model:x,publicApiKey:H,id:t.templateContentId});if(!Array.isArray(r?.results)||r.results.length===0||!r.results[0].data?.blocks)throw new Error(`No Builder content found for id ${t.templateContentId}`);let o=JSON.stringify(r.results[0].data.blocks),n=ue(t.publicApiKey,t.pathname,t.title,o);await M(e,{privateAuthKey:t.privateAuthKey,model:c,body:n})}function ue(e,t,r,o){return JSON.stringify({name:r,ownerId:e,published:"published",query:[{property:"urlPath",value:[t],operator:"is"}],data:{title:r,blocksString:o}})}async function V(e,t,r){e.debug(`connect builder with public key: ${t}`),e.publicApiKey=t;let o=e.closeAppServer(),n=await e.setPublicApiKey({publicApiKey:t});e.debug(`set public key: process.env.${n.envKey}=${t}`),process.env[n.envKey]=t;let i=await e.builderPageOptions();e.debug(`builder model: ${c}, path: ${i.pathname}, template: ${i.templateContentId}`);let s=await k(e,{model:c,pageUrl:i.pathname,publicApiKey:t,privateAuthKey:r});if(!s){await B(e,{templateContentId:i.templateContentId,pathname:i.pathname,title:i.title,publicApiKey:t,privateAuthKey:r});let l=5,g=0;for(;!s&&g<l;){await new Promise(te=>setTimeout(te,1e3));let E=await F({model:c,pageUrl:i.pathname,publicApiKey:t,privateAuthKey:r});g++,E&&E.length>0&&(s=!0)}}await o,e.debug("ensure builder setup");let a=await e.ensureBuilderSetup();n.modifiedType&&a.push({filePath:n.file,modifiedType:n.modifiedType}),a.forEach(l=>{l.displayFilePath=e.relative(e.getRootDir(),l.filePath)}),a.sort((l,g)=>l.filePath.localeCompare(g.filePath)),a.length>0?(e.debug(`modified files: ${a.map(l=>l.displayFilePath).join(", ")}`),await e.restartAppServer(),await new Promise(l=>setTimeout(l,500))):e.debug("no modified files");let u={success:!0,pathname:i.localePathname||i.pathname,modifiedFiles:a,platform:e.platform()};return e.debug(`connected builder: ${u.pathname}`),u}async function j(e){let t=await e.builderPageOptions();e.debug(`validateBuilder, pathname: ${t.pathname}, localePathname: ${t.localePathname}, isValid: ${e.isValid}`);let r={isValid:e.isValid,pathname:t.localePathname||t.pathname,platform:e.platform()};if(e.isValid)return r;let o=await e.getPublicApiKey();return o.envValue?(e.debug(`public api key: ${o.envValue}, ${o.file}`),e.publicApiKey=o.envValue,(await h(e,{model:c,publicApiKey:o.envValue})).results.length===0?(e.debug("missing homepage content"),r):(e.debug("builder connection is valid"),r.isValid=!0,e.isValid=!0,r)):(e.debug("missing public api key"),r)}async function K(e,t){let r={type:t.type};switch(t.type){case"getCache":{r.data=await e.getCache();break}case"setCache":{await e.setCache(t.data);break}case"connectBuilder":{r.data=await V(e,t.data.publicApiKey,t.data.privateAuthKey);break}case"enableDevTools":{r.data=ce(e,t.data.enabled);break}case"getRegistry":{r.data=await e.getRegistry(t.data);break}case"launchEditor":{r.data=await e.launchEditor(t.data);break}case"validateBuilder":{r.data=await j(e);break}case"loadComponent":{r.data=await e.loadComponent(t.data);break}case"registerComponent":{r.data=await e.registerComponent(t.data),e.serverShouldRestart=!0;break}case"setComponentInfo":{r.data=await e.setRegisteredComponentInfo(t.data),e.serverShouldRestart=!0;break}case"setComponentInput":{r.data=await e.setRegisteredComponentInput(t.data),e.serverShouldRestart=!0;break}case"unregisterComponent":{r.data=await e.unregisterComponent(t.data),e.serverShouldRestart=!0;break}case"getFrameworks":{r.data=e.getFrameworks();break}case"readdir":{_(t.path)?r.data=await e.readdir(t.path,!0):r.errors=[`Invalid file request: ${t.path}`];break}case"readFile":{_(t.path)?r.data=await e.readFile(t.path):r.errors=[`Invalid file request: ${t.path}`];break}case"writeFile":{_(t.path)?await e.writeFile(t.path,t.content):r.errors=[`Invalid file request: ${t.path}`];break}case"ensureFigmaImportPage":{r.data=await e.ensureFigmaImportPage();break}case"transileFile":{r.data=await I(e,t);break}case"transileModule":{r.data=w(e,t);break}case"getPastSyncInfo":{r.data=await e.getPastSyncInfo?.(t.data);break}case"resyncSnippet":{r.data=await e.resyncSnippet?.(t.data);break}default:{r.errors=[`Unknown request type: ${JSON.stringify(t)}`];let o=t}}return r}function _(e){if(!e||e.includes(".."))return!1;e=e.replace(/\\/g,"/");let t=e.split("/"),r=t[t.length-1];if(r.length>0){let o=r.split(".").pop();if(o&&(o=`.${o}`.toLocaleLowerCase(),o=o.split("?")[0],!de.includes(o)))return!1}return!0}var de=[".js",".jsx",".ts",".tsx",".json",".css",".scss",".sass",".less",".html",".htm",".xml",".svg",".png",".jpg",".jpeg",".gif",".ico",".webp",".woff",".woff2",".ttf",".eot",".mp4",".webm",".ogg",".md",".txt",".csv",".pdf"];function ce(e,t){return!t&&e.serverShouldRestart&&setTimeout(()=>{console.log(`
|
|
8
8
|
Restarting server after Builder Devtools update...
|
|
9
|
-
`),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function J(e){return q(e,`"use strict";(()=>{var Br=Object.defineProperty;var Fr=(t,e)=>{for(var n in e)Br(t,n,{get:e[n],enumerable:!0})};var G=(t,e)=>{Tt(t);let n=t.querySelector("aside");n.dataset.view=e,n.classList.remove("section-ready"),setTimeout(()=>{n.classList.add("section-ready")},200)},pn=t=>{Array.from(t.querySelectorAll(".back-button")).forEach(e=>{e.addEventListener("click",n=>{Tt(t),n.preventDefault(),n.stopPropagation();let r=n.target;G(t,r?.dataset.back||"nav-home")})})},Et=(t,e)=>{Tt(t);let n=t.querySelector("aside"),r=document.createElement("div");r.className="ui-toast",r.innerHTML=e,n.appendChild(r),setTimeout(()=>{r.classList.add("ui-toast-show"),setTimeout(()=>{r.classList.remove("ui-toast-show"),setTimeout(()=>{r.remove()},500)},4e3)},30)},Tt=t=>{let e=t.querySelector("aside");Array.from(e.querySelectorAll(".ui-toast")).forEach(r=>{r.classList.remove("ui-toast-show")})},ke=()=>{let t=fn();return localStorage.getItem(t)!=="true"},bt=t=>{let e=fn();t?localStorage.removeItem(e):localStorage.setItem(e,"true")},fn=()=>Vr("disableEdit"),Vr=t=>\`builder.__LOCAL_APP_ID__.\${t}\`,mn=()=>{let e=document.body.querySelector("[builder-content-id]")?.getAttribute("builder-content-id");return Ee(e)},Ee=(t,e)=>{let n="/content";t&&(n+="/"+t+"/edit");let r=new URL(n,"https://builder.io");t&&e&&r.searchParams.set("selectedBlock",e);let i=new URL(location.pathname,location.href);return r.searchParams.set("overridePreviewUrl",i.href),r.href},Oe="__DEV_TOOLS_URL__",O={components:[],registryPath:"",registryDisplayPath:"",frameworks:[],dependencies:[],publicApiKey:void 0,devToolsVersion:""},X=t=>{O.components=t.components,O.registryPath=t.registryPath,O.registryDisplayPath=t.registryDisplayPath,O.dependencies=t.dependencies,O.publicApiKey=t.publicApiKey};function vn(t){let e=null,n=document.querySelector("builder-dev-tools-menu"),r=()=>{t.hide()},i=u=>{let c=u.target;if(!c){r();return}if(c.closest("builder-dev-tools-edit"))return;let a=c.closest("[builder-content-id]"),l=c.closest("[builder-id]");if(!a||!l){t.hide();return}let d=t.show(a,l);!d||d===e||(n.highlightOpener(),e=d)};document.addEventListener("pointerover",i,{passive:!0}),document.addEventListener("pointerleave",r,{passive:!0}),document.addEventListener("pointercancel",r,{passive:!0}),document.addEventListener("visibilitychange",r,{passive:!0}),window.addEventListener("popstate",r,{passive:!0});let o=history.pushState;history.pushState=function(...u){t.hide(),o.apply(this,u)};let s=history.replaceState;history.replaceState=function(...u){t.hide(),s.apply(this,u)}}var Ue=class extends HTMLElement{constructor(){super();this.openInBuilder=null;this.block=null}connectedCallback(){this.setAttribute("aria-hidden","true");let n=this.attachShadow({mode:"open"});n.innerHTML='<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}:host{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}#content-highlight,#block{position:absolute}#content-highlight{border:3px solid var(--primary-color);background-color:var(--primary-color-alpha)}a{position:absolute;top:-33px;left:0;display:block;padding:5px 10px 8px;pointer-events:auto;z-index:100;text-decoration:none}a:hover{text-decoration:none}a span{display:block;padding:3px 6px;font-size:10px;font-weight:300;border-radius:3px;text-align:center;text-decoration:none;pointer-events:none;background-color:var(--edit-color);color:var(--text-color);white-space:nowrap}a:hover span{background-color:var(--edit-color-highlight)}a:hover~.outline{border-color:var(--edit-color-highlight)}#open-in-editor{display:none}.outline{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid var(--edit-color);background-color:var(--edit-color-alpha)}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>',this.openInBuilder=n.getElementById("open-in-builder"),this.block=n.getElementById("block"),vn(this)}show(n,r){if(!ke())return this.hide(),null;let i=n.getAttribute("builder-content-id"),o=r.getAttribute("builder-id");if(!i||!o)return this.hide(),null;let s=this.block,u=this.openInBuilder,c=r.getBoundingClientRect();s.style.top=c.top+window.scrollY-1+"px",s.style.left=c.left+window.scrollX+"px",s.style.width=c.width+"px",s.style.height=c.height+1+"px";let a=u.getBoundingClientRect();if(a.width>c.width){let l=a.width-c.width;u.style.left=l/2*-1+"px"}else u.style.left="";return u.href=Ee(i,o),this.style.display="block",o}hide(){this.style.display=""}};var gn="preview-url";var hn="_b-uid";var yn="/~builder-connect";var _n="/~builder-dev-tools";var En="https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";var Tn=()=>z({type:"validateBuilder"}),ve=t=>z({type:"launchEditor",data:t}),bn=t=>z({type:"getRegistry",data:t}),In=t=>z({type:"loadComponent",data:t}),Sn=t=>z({type:"registerComponent",data:t}),xn=t=>z({type:"setComponentInfo",data:t}),Ne=t=>z({type:"setComponentInput",data:t}),wn=t=>z({type:"unregisterComponent",data:t}),Ln=t=>z({type:"enableDevTools",data:{enabled:t}}),z=async t=>{let e=new URL(_n,Oe),n;try{n=await fetch(e,{method:"POST",body:JSON.stringify(t)})}catch(i){throw console.error(\`Devtools Fetch Error, \${e.href}\`,i),new Error("Builder Devtools Fetch Error")}if((n.headers.get("content-type")||"").includes("application/json")){let i=await n.json();if(n.ok)return i.data;if(Array.isArray(i.errors)&&i.errors.length>0)throw i.errors.forEach(o=>console.error(o)),new Error(\`Builder Devtools Fetch Error: \${i.errors[0]}\`)}throw new Error(\`Builder Devtools Fetch Error: \${n.status}, \${await n.text()}\`)};var Pn=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}],Me=["color","date","email","file","longText","richText","string"],Be=["number"],Fe=["boolean"],Ve=["list"],He=["object"];function qe(t){return Me.includes(t)?"string":Be.includes(t)?"number":Fe.includes(t)?"boolean":Ve.includes(t)?"array":He.includes(t)?"object":"string"}var ji=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(t=>t.toLowerCase()));var It=function(t,e){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},It(t,e)};function V(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");It(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v.apply(this,arguments)};function Te(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function p(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(d){s(d)}}function c(l){try{a(r.throw(l))}catch(d){s(d)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function f(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function W(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function q(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Cn="Event tracked successfully",Rn="Unexpected error occurred",Dn="Event rejected due to exceeded retry count",An="Event skipped due to optOut config",kn="Event rejected due to missing API key",On="Invalid API key",Un="Client not initialized";var Ge={};Fr(Ge,{IdentifyOperation:()=>L,LogLevel:()=>N,OfflineDisabled:()=>Ke,RevenueProperty:()=>$,ServerZone:()=>je,SpecialEventType:()=>Z,Status:()=>x});var L;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(L||(L={}));var $;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE="$revenue"})($||($={}));var Z;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(Z||(Z={}));var N;(function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose",t[t.Debug=4]="Debug"})(N||(N={}));var je;(function(t){t.US="US",t.EU="EU"})(je||(je={}));var x;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(x||(x={}));var Ke=null;var J=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=x.Unknown),{event:t,code:e,message:n}};var Y=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,Y)};var Nn=function(){function t(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return t.prototype.register=function(e,n){var r,i,o;return p(this,void 0,void 0,function(){return f(this,function(s){switch(s.label){case 0:return e.name=(r=e.name)!==null&&r!==void 0?r:Y(),e.type=(i=e.type)!==null&&i!==void 0?i:"enrichment",[4,(o=e.setup)===null||o===void 0?void 0:o.call(e,n,this.client)];case 1:return s.sent(),this.plugins.push(e),[2]}})})},t.prototype.deregister=function(e){var n;return p(this,void 0,void 0,function(){var r,i;return f(this,function(o){switch(o.label){case 0:return r=this.plugins.findIndex(function(s){return s.name===e}),i=this.plugins[r],this.plugins.splice(r,1),[4,(n=i.teardown)===null||n===void 0?void 0:n.call(i)];case 1:return o.sent(),[2]}})})},t.prototype.reset=function(e){this.applying=!1;var n=this.plugins;n.map(function(r){var i;return(i=r.teardown)===null||i===void 0?void 0:i.call(r)}),this.plugins=[],this.client=e},t.prototype.push=function(e){var n=this;return new Promise(function(r){n.queue.push([e,r]),n.scheduleApply(0)})},t.prototype.scheduleApply=function(e){var n=this;this.applying||(this.applying=!0,setTimeout(function(){n.apply(n.queue.shift()).then(function(){n.applying=!1,n.queue.length>0&&n.scheduleApply(0)})},e))},t.prototype.apply=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c,y,g,a,l,d,m,y,g,T,h,_,U,b,A,F;return f(this,function(I){switch(I.label){case 0:if(!e)return[2];n=w(e,1),r=n[0],i=w(e,2),o=i[1],s=this.plugins.filter(function(S){return S.type==="before"}),I.label=1;case 1:I.trys.push([1,6,7,8]),u=W(s),c=u.next(),I.label=2;case 2:return c.done?[3,5]:(y=c.value,y.execute?[4,y.execute(v({},r))]:[3,4]);case 3:if(g=I.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,I.label=4;case 4:return c=u.next(),[3,2];case 5:return[3,8];case 6:return a=I.sent(),U={error:a},[3,8];case 7:try{c&&!c.done&&(b=u.return)&&b.call(u)}finally{if(U)throw U.error}return[7];case 8:l=this.plugins.filter(function(S){return S.type==="enrichment"||S.type===void 0}),I.label=9;case 9:I.trys.push([9,14,15,16]),d=W(l),m=d.next(),I.label=10;case 10:return m.done?[3,13]:(y=m.value,y.execute?[4,y.execute(v({},r))]:[3,12]);case 11:if(g=I.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,I.label=12;case 12:return m=d.next(),[3,10];case 13:return[3,16];case 14:return T=I.sent(),A={error:T},[3,16];case 15:try{m&&!m.done&&(F=d.return)&&F.call(d)}finally{if(A)throw A.error}return[7];case 16:return h=this.plugins.filter(function(S){return S.type==="destination"}),_=h.map(function(S){var k=v({},r);return S.execute(k).catch(function(B){return J(k,0,String(B))})}),Promise.all(_).then(function(S){var k=w(S,1),B=k[0],Q=B||J(r,100,"Event not tracked, no destination plugins on the instance");o(Q)}),[2]}})})},t.prototype.flush=function(){return p(this,void 0,void 0,function(){var e,n,r,i=this;return f(this,function(o){switch(o.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(s){return i.apply(s)}))];case 1:return o.sent(),n=this.plugins.filter(function(s){return s.type==="destination"}),r=n.map(function(s){return s.flush&&s.flush()}),[4,Promise.all(r)];case 2:return o.sent(),[2]}})})},t}();var St="-",le="AMP",xt="".concat(le,"_unsent"),wt="https://api2.amplitude.com/2/httpapi",Mn="https://api.eu.amplitude.com/2/httpapi",Bn="https://api2.amplitude.com/batch",Fn="https://api.eu.amplitude.com/batch";var Hr=1e3,We=function(t){if(Object.keys(t).length>Hr)return!1;for(var e in t){var n=t[e];if(!Lt(e,n))return!1}return!0},Lt=function(t,e){var n,r;if(typeof t!="string")return!1;if(Array.isArray(e)){var i=!0;try{for(var o=W(e),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if(typeof u=="object")i=i&&We(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(e==null)return!1;if(typeof e=="object")return We(e);if(!["number","string","boolean"].includes(typeof e))return!1}return!0};var ne=function(){function t(){this._propertySet=new Set,this._properties={}}return t.prototype.getUserProperties=function(){return v({},this._properties)},t.prototype.set=function(e,n){return this._safeSet(L.SET,e,n),this},t.prototype.setOnce=function(e,n){return this._safeSet(L.SET_ONCE,e,n),this},t.prototype.append=function(e,n){return this._safeSet(L.APPEND,e,n),this},t.prototype.prepend=function(e,n){return this._safeSet(L.PREPEND,e,n),this},t.prototype.postInsert=function(e,n){return this._safeSet(L.POSTINSERT,e,n),this},t.prototype.preInsert=function(e,n){return this._safeSet(L.PREINSERT,e,n),this},t.prototype.remove=function(e,n){return this._safeSet(L.REMOVE,e,n),this},t.prototype.add=function(e,n){return this._safeSet(L.ADD,e,n),this},t.prototype.unset=function(e){return this._safeSet(L.UNSET,e,St),this},t.prototype.clearAll=function(){return this._properties={},this._properties[L.CLEAR_ALL]=St,this},t.prototype._safeSet=function(e,n,r){if(this._validate(e,n,r)){var i=this._properties[e];return i===void 0&&(i={},this._properties[e]=i),i[n]=r,this._propertySet.add(n),!0}return!1},t.prototype._validate=function(e,n,r){return this._properties[L.CLEAR_ALL]!==void 0||this._propertySet.has(n)?!1:e===L.ADD?typeof r=="number":e!==L.UNSET&&e!==L.REMOVE?Lt(n,r):!0},t}();var Vn=function(t,e,n){var r=typeof t=="string"?{event_type:t}:t;return v(v(v({},r),n),e&&{event_properties:e})},be=function(t,e){var n=v(v({},e),{event_type:Z.IDENTIFY,user_properties:t.getUserProperties()});return n},Hn=function(t,e,n,r){var i,o=v(v({},r),{event_type:Z.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[t]=e,i)});return o},qn=function(t,e,n){var r,i=new ne;i.set(t,e);var o=v(v({},n),{event_type:Z.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[t]=e,r)});return o},jn=function(t,e){return v(v({},e),{event_type:Z.REVENUE,event_properties:t.getEventProperties()})};var H=function(t){return{promise:t||Promise.resolve()}};var Pt=function(){function t(e){e===void 0&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Nn(this),this.name=e}return t.prototype._init=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return n.sent(),[2]}})})},t.prototype.runQueuedFunctions=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c;return f(this,function(a){switch(a.label){case 0:n=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,6,7,8]),r=W(n),i=r.next(),a.label=2;case 2:return i.done?[3,5]:(o=i.value,[4,o()]);case 3:a.sent(),a.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s=a.sent(),u={error:s},[3,8];case 7:try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}return[7];case 8:return[2]}})})},t.prototype.track=function(e,n,r){var i=Vn(e,n,r);return H(this.dispatch(i))},t.prototype.identify=function(e,n){var r=be(e,n);return H(this.dispatch(r))},t.prototype.groupIdentify=function(e,n,r,i){var o=Hn(e,n,r,i);return H(this.dispatch(o))},t.prototype.setGroup=function(e,n,r){var i=qn(e,n,r);return H(this.dispatch(i))},t.prototype.revenue=function(e,n){var r=jn(e,n);return H(this.dispatch(r))},t.prototype.add=function(e){return this.config?H(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),H())},t.prototype.remove=function(e){return this.config?H(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),H())},t.prototype.dispatchWithCallback=function(e,n){if(!this.config)return n(J(e,0,Un));this.process(e).then(n)},t.prototype.dispatch=function(e){return p(this,void 0,void 0,function(){var n=this;return f(this,function(r){return this.config?[2,this.process(e)]:[2,new Promise(function(i){n.dispatchQ.push(n.dispatchWithCallback.bind(n,e,i))})]})})},t.prototype.process=function(e){return p(this,void 0,void 0,function(){var i,n,r,i;return f(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.config.optOut?[2,J(e,0,An)]:[4,this.timeline.push(e)];case 1:return i=o.sent(),i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return n=o.sent(),r=String(n),this.config.loggerProvider.error(r),i=J(e,0,r),[2,i];case 3:return[2]}})})},t.prototype.setOptOut=function(e){if(!this.config){this.q.push(this.setOptOut.bind(this,!!e));return}this.config.optOut=!!e},t.prototype.flush=function(){return H(this.timeline.flush())},t}();var Ct=function(){function t(){this.productId="",this.quantity=1,this.price=0}return t.prototype.setProductId=function(e){return this.productId=e,this},t.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},t.prototype.setPrice=function(e){return this.price=e,this},t.prototype.setRevenueType=function(e){return this.revenueType=e,this},t.prototype.setRevenue=function(e){return this.revenue=e,this},t.prototype.setEventProperties=function(e){return We(e)&&(this.properties=e),this},t.prototype.getEventProperties=function(){var e=this.properties?v({},this.properties):{};return e[$.REVENUE_PRODUCT_ID]=this.productId,e[$.REVENUE_QUANTITY]=this.quantity,e[$.REVENUE_PRICE]=this.price,e[$.REVENUE_TYPE]=this.revenueType,e[$.REVENUE]=this.revenue,e},t}();var Kn=function(t,e){var n=Math.max(e,1);return t.reduce(function(r,i,o){var s=Math.floor(o/n);return r[s]||(r[s]=[]),r[s].push(i),r},[])};var $e="Amplitude Logger ",Ie=function(){function t(){this.logLevel=N.None}return t.prototype.disable=function(){this.logLevel=N.None},t.prototype.enable=function(e){e===void 0&&(e=N.Warn),this.logLevel=e},t.prototype.log=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Verbose||console.log("".concat($e,"[Log]: ").concat(e.join(" ")))},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Warn||console.warn("".concat($e,"[Warn]: ").concat(e.join(" ")))},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Error||console.error("".concat($e,"[Error]: ").concat(e.join(" ")))},t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Debug||console.log("".concat($e,"[Debug]: ").concat(e.join(" ")))},t}();var Ye=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:N.Warn,loggerProvider:new Ie,offline:!1,optOut:!1,serverUrl:wt,serverZone:"US",useBatch:!1}},Rt=function(){function t(e){var n,r,i,o;this._optOut=!1;var s=Ye();this.apiKey=e.apiKey,this.flushIntervalMillis=(n=e.flushIntervalMillis)!==null&&n!==void 0?n:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=(r=e.logLevel)!==null&&r!==void 0?r:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline!==void 0?e.offline:s.offline,this.optOut=(i=e.optOut)!==null&&i!==void 0?i:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var u=Dt(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=u.serverZone,this.serverUrl=u.serverUrl}return Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),t}();var qr=function(t,e){return t==="EU"?e?Fn:Mn:e?Bn:wt},Dt=function(t,e,n){if(t===void 0&&(t=""),e===void 0&&(e=Ye().serverZone),n===void 0&&(n=Ye().useBatch),t)return{serverUrl:t,serverZone:void 0};var r=["US","EU"].includes(e)?e:Ye().serverZone;return{serverZone:r,serverUrl:qr(r,n)}};function jr(t){return t instanceof Error?t.message:String(t)}function Qe(t){var e="";try{"body"in t&&(e=JSON.stringify(t.body,null,2))}catch{}return e}var At=function(){function t(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return t.prototype.setup=function(e){var n;return p(this,void 0,void 0,function(){var r,i=this;return f(this,function(o){switch(o.label){case 0:return this.config=e,this.storageKey="".concat(xt,"_").concat(this.config.apiKey.substring(0,10)),[4,(n=this.config.storageProvider)===null||n===void 0?void 0:n.get(this.storageKey)];case 1:return r=o.sent(),this.saveEvents(),r&&r.length>0&&Promise.all(r.map(function(s){return i.execute(s)})).catch(),[2,Promise.resolve(void 0)]}})})},t.prototype.execute=function(e){var n=this;return new Promise(function(r){var i={event:e,attempts:0,callback:function(o){return r(o)},timeout:0};n.addToQueue(i)})},t.prototype.addToQueue=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n.filter(function(o){return o.attempts<e.config.flushMaxRetries?(o.attempts+=1,!0):(e.fulfillRequest([o],500,Dn),!1)});i.forEach(function(o){if(e.queue=e.queue.concat(o),o.timeout===0){e.schedule(e.config.flushIntervalMillis);return}setTimeout(function(){o.timeout=0,e.schedule(0)},o.timeout)}),this.saveEvents()},t.prototype.schedule=function(e){var n=this;this.scheduled||this.config.offline||(this.scheduled=setTimeout(function(){n.flush(!0).then(function(){n.queue.length>0&&n.schedule(e)})},e))},t.prototype.flush=function(e){return e===void 0&&(e=!1),p(this,void 0,void 0,function(){var n,r,i,o=this;return f(this,function(s){switch(s.label){case 0:return this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(n=[],r=[],this.queue.forEach(function(u){return u.timeout===0?n.push(u):r.push(u)}),this.queue=r,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),i=Kn(n,this.config.flushQueueSize),[4,Promise.all(i.map(function(u){return o.send(u,e)}))]);case 1:return s.sent(),[2]}})})},t.prototype.send=function(e,n){return n===void 0&&(n=!0),p(this,void 0,void 0,function(){var r,i,o,s,u;return f(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,kn)];r={api_key:this.config.apiKey,events:e.map(function(a){var l=a.event,d=l.extra,m=Te(l,["extra"]);return m}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString()},c.label=1;case 1:return c.trys.push([1,3,,4]),i=Dt(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,r)];case 2:return o=c.sent(),o===null?(this.fulfillRequest(e,0,Rn),[2]):n?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(Qe(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return s=c.sent(),u=jr(s),this.config.loggerProvider.error(u),this.fulfillRequest(e,0,u),[3,4];case 4:return[2]}})})},t.prototype.handleResponse=function(e,n){var r=e.status;switch(r){case x.Success:{this.handleSuccessResponse(e,n);break}case x.Invalid:{this.handleInvalidResponse(e,n);break}case x.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,n);break}case x.RateLimit:{this.handleRateLimitResponse(e,n);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(r,"' provided for ").concat(n.length,' events"}')),this.handleOtherResponse(n);break}}},t.prototype.handleSuccessResponse=function(e,n){this.fulfillRequest(n,e.statusCode,Cn)},t.prototype.handleInvalidResponse=function(e,n){var r=this;if(e.body.missingField||e.body.error.startsWith(On)){this.fulfillRequest(n,e.statusCode,e.body.error);return}var i=q(q(q(q([],w(Object.values(e.body.eventsWithInvalidFields)),!1),w(Object.values(e.body.eventsWithMissingFields)),!1),w(Object.values(e.body.eventsWithInvalidIdLengths)),!1),w(e.body.silencedEvents),!1).flat(),o=new Set(i),s=n.filter(function(u,c){if(o.has(c)){r.fulfillRequest([u],e.statusCode,e.body.error);return}return!0});s.length>0&&this.config.loggerProvider.warn(Qe(e)),this.addToQueue.apply(this,q([],w(s),!1))},t.prototype.handlePayloadTooLargeResponse=function(e,n){if(n.length===1){this.fulfillRequest(n,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Qe(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,q([],w(n),!1))},t.prototype.handleRateLimitResponse=function(e,n){var r=this,i=Object.keys(e.body.exceededDailyQuotaUsers),o=Object.keys(e.body.exceededDailyQuotaDevices),s=e.body.throttledEvents,u=new Set(i),c=new Set(o),a=new Set(s),l=n.filter(function(d,m){if(d.event.user_id&&u.has(d.event.user_id)||d.event.device_id&&c.has(d.event.device_id)){r.fulfillRequest([d],e.statusCode,e.body.error);return}return a.has(m)&&(d.timeout=r.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(Qe(e)),this.addToQueue.apply(this,q([],w(l),!1))},t.prototype.handleOtherResponse=function(e){var n=this;this.addToQueue.apply(this,q([],w(e.map(function(r){return r.timeout=r.attempts*n.retryTimeout,r})),!1))},t.prototype.fulfillRequest=function(e,n,r){this.saveEvents(),e.forEach(function(i){return i.callback(J(i.event,n,r))})},t.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map(function(n){return n.event}));this.config.storageProvider.set(this.storageKey,e)}},t}();var Kr=function(t){t===void 0&&(t=0);var e=new Error().stack||"";return e.split(\`
|
|
9
|
+
`),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function J(e){return W(e,`"use strict";(()=>{var Br=Object.defineProperty;var Fr=(t,e)=>{for(var n in e)Br(t,n,{get:e[n],enumerable:!0})};var G=(t,e)=>{Tt(t);let n=t.querySelector("aside");n.dataset.view=e,n.classList.remove("section-ready"),setTimeout(()=>{n.classList.add("section-ready")},200)},pn=t=>{Array.from(t.querySelectorAll(".back-button")).forEach(e=>{e.addEventListener("click",n=>{Tt(t),n.preventDefault(),n.stopPropagation();let r=n.target;G(t,r?.dataset.back||"nav-home")})})},Et=(t,e)=>{Tt(t);let n=t.querySelector("aside"),r=document.createElement("div");r.className="ui-toast",r.innerHTML=e,n.appendChild(r),setTimeout(()=>{r.classList.add("ui-toast-show"),setTimeout(()=>{r.classList.remove("ui-toast-show"),setTimeout(()=>{r.remove()},500)},4e3)},30)},Tt=t=>{let e=t.querySelector("aside");Array.from(e.querySelectorAll(".ui-toast")).forEach(r=>{r.classList.remove("ui-toast-show")})},ke=()=>{let t=fn();return localStorage.getItem(t)!=="true"},bt=t=>{let e=fn();t?localStorage.removeItem(e):localStorage.setItem(e,"true")},fn=()=>Vr("disableEdit"),Vr=t=>\`builder.__LOCAL_APP_ID__.\${t}\`,mn=()=>{let e=document.body.querySelector("[builder-content-id]")?.getAttribute("builder-content-id");return Ee(e)},Ee=(t,e)=>{let n="/content";t&&(n+="/"+t+"/edit");let r=new URL(n,"https://builder.io");t&&e&&r.searchParams.set("selectedBlock",e);let i=new URL(location.pathname,location.href);return r.searchParams.set("overridePreviewUrl",i.href),r.href},Oe="__DEV_TOOLS_URL__",O={components:[],registryPath:"",registryDisplayPath:"",frameworks:[],dependencies:[],publicApiKey:void 0,devToolsVersion:""},X=t=>{O.components=t.components,O.registryPath=t.registryPath,O.registryDisplayPath=t.registryDisplayPath,O.dependencies=t.dependencies,O.publicApiKey=t.publicApiKey};function vn(t){let e=null,n=document.querySelector("builder-dev-tools-menu"),r=()=>{t.hide()},i=u=>{let c=u.target;if(!c){r();return}if(c.closest("builder-dev-tools-edit"))return;let a=c.closest("[builder-content-id]"),l=c.closest("[builder-id]");if(!a||!l){t.hide();return}let d=t.show(a,l);!d||d===e||(n.highlightOpener(),e=d)};document.addEventListener("pointerover",i,{passive:!0}),document.addEventListener("pointerleave",r,{passive:!0}),document.addEventListener("pointercancel",r,{passive:!0}),document.addEventListener("visibilitychange",r,{passive:!0}),window.addEventListener("popstate",r,{passive:!0});let o=history.pushState;history.pushState=function(...u){t.hide(),o.apply(this,u)};let s=history.replaceState;history.replaceState=function(...u){t.hide(),s.apply(this,u)}}var Ue=class extends HTMLElement{constructor(){super();this.openInBuilder=null;this.block=null}connectedCallback(){this.setAttribute("aria-hidden","true");let n=this.attachShadow({mode:"open"});n.innerHTML='<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}:host{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}#content-highlight,#block{position:absolute}#content-highlight{border:3px solid var(--primary-color);background-color:var(--primary-color-alpha)}a{position:absolute;top:-33px;left:0;display:block;padding:5px 10px 8px;pointer-events:auto;z-index:100;text-decoration:none}a:hover{text-decoration:none}a span{display:block;padding:3px 6px;font-size:10px;font-weight:300;border-radius:3px;text-align:center;text-decoration:none;pointer-events:none;background-color:var(--edit-color);color:var(--text-color);white-space:nowrap}a:hover span{background-color:var(--edit-color-highlight)}a:hover~.outline{border-color:var(--edit-color-highlight)}#open-in-editor{display:none}.outline{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid var(--edit-color);background-color:var(--edit-color-alpha)}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>',this.openInBuilder=n.getElementById("open-in-builder"),this.block=n.getElementById("block"),vn(this)}show(n,r){if(!ke())return this.hide(),null;let i=n.getAttribute("builder-content-id"),o=r.getAttribute("builder-id");if(!i||!o)return this.hide(),null;let s=this.block,u=this.openInBuilder,c=r.getBoundingClientRect();s.style.top=c.top+window.scrollY-1+"px",s.style.left=c.left+window.scrollX+"px",s.style.width=c.width+"px",s.style.height=c.height+1+"px";let a=u.getBoundingClientRect();if(a.width>c.width){let l=a.width-c.width;u.style.left=l/2*-1+"px"}else u.style.left="";return u.href=Ee(i,o),this.style.display="block",o}hide(){this.style.display=""}};var gn="preview-url";var hn="_b-uid";var yn="/~builder-connect";var _n="/~builder-dev-tools";var En="https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";var Tn=()=>z({type:"validateBuilder"}),ve=t=>z({type:"launchEditor",data:t}),bn=t=>z({type:"getRegistry",data:t}),In=t=>z({type:"loadComponent",data:t}),Sn=t=>z({type:"registerComponent",data:t}),xn=t=>z({type:"setComponentInfo",data:t}),Ne=t=>z({type:"setComponentInput",data:t}),wn=t=>z({type:"unregisterComponent",data:t}),Ln=t=>z({type:"enableDevTools",data:{enabled:t}}),z=async t=>{let e=new URL(_n,Oe),n;try{n=await fetch(e,{method:"POST",body:JSON.stringify(t)})}catch(i){throw console.error(\`Devtools Fetch Error, \${e.href}\`,i),new Error("Builder Devtools Fetch Error")}if((n.headers.get("content-type")||"").includes("application/json")){let i=await n.json();if(n.ok)return i.data;if(Array.isArray(i.errors)&&i.errors.length>0)throw i.errors.forEach(o=>console.error(o)),new Error(\`Builder Devtools Fetch Error: \${i.errors[0]}\`)}throw new Error(\`Builder Devtools Fetch Error: \${n.status}, \${await n.text()}\`)};var Pn=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}],Me=["color","date","email","file","longText","richText","string"],Be=["number"],Fe=["boolean"],Ve=["list"],He=["object"];function qe(t){return Me.includes(t)?"string":Be.includes(t)?"number":Fe.includes(t)?"boolean":Ve.includes(t)?"array":He.includes(t)?"object":"string"}var ji=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(t=>t.toLowerCase()));var It=function(t,e){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},It(t,e)};function V(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");It(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v.apply(this,arguments)};function Te(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function p(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(d){s(d)}}function c(l){try{a(r.throw(l))}catch(d){s(d)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function f(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function W(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function q(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Cn="Event tracked successfully",Rn="Unexpected error occurred",Dn="Event rejected due to exceeded retry count",An="Event skipped due to optOut config",kn="Event rejected due to missing API key",On="Invalid API key",Un="Client not initialized";var Ge={};Fr(Ge,{IdentifyOperation:()=>L,LogLevel:()=>N,OfflineDisabled:()=>Ke,RevenueProperty:()=>$,ServerZone:()=>je,SpecialEventType:()=>Z,Status:()=>x});var L;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(L||(L={}));var $;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE="$revenue"})($||($={}));var Z;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(Z||(Z={}));var N;(function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose",t[t.Debug=4]="Debug"})(N||(N={}));var je;(function(t){t.US="US",t.EU="EU"})(je||(je={}));var x;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(x||(x={}));var Ke=null;var J=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=x.Unknown),{event:t,code:e,message:n}};var Y=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,Y)};var Nn=function(){function t(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return t.prototype.register=function(e,n){var r,i,o;return p(this,void 0,void 0,function(){return f(this,function(s){switch(s.label){case 0:return e.name=(r=e.name)!==null&&r!==void 0?r:Y(),e.type=(i=e.type)!==null&&i!==void 0?i:"enrichment",[4,(o=e.setup)===null||o===void 0?void 0:o.call(e,n,this.client)];case 1:return s.sent(),this.plugins.push(e),[2]}})})},t.prototype.deregister=function(e){var n;return p(this,void 0,void 0,function(){var r,i;return f(this,function(o){switch(o.label){case 0:return r=this.plugins.findIndex(function(s){return s.name===e}),i=this.plugins[r],this.plugins.splice(r,1),[4,(n=i.teardown)===null||n===void 0?void 0:n.call(i)];case 1:return o.sent(),[2]}})})},t.prototype.reset=function(e){this.applying=!1;var n=this.plugins;n.map(function(r){var i;return(i=r.teardown)===null||i===void 0?void 0:i.call(r)}),this.plugins=[],this.client=e},t.prototype.push=function(e){var n=this;return new Promise(function(r){n.queue.push([e,r]),n.scheduleApply(0)})},t.prototype.scheduleApply=function(e){var n=this;this.applying||(this.applying=!0,setTimeout(function(){n.apply(n.queue.shift()).then(function(){n.applying=!1,n.queue.length>0&&n.scheduleApply(0)})},e))},t.prototype.apply=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c,y,g,a,l,d,m,y,g,T,h,_,U,b,A,F;return f(this,function(I){switch(I.label){case 0:if(!e)return[2];n=w(e,1),r=n[0],i=w(e,2),o=i[1],s=this.plugins.filter(function(S){return S.type==="before"}),I.label=1;case 1:I.trys.push([1,6,7,8]),u=W(s),c=u.next(),I.label=2;case 2:return c.done?[3,5]:(y=c.value,y.execute?[4,y.execute(v({},r))]:[3,4]);case 3:if(g=I.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,I.label=4;case 4:return c=u.next(),[3,2];case 5:return[3,8];case 6:return a=I.sent(),U={error:a},[3,8];case 7:try{c&&!c.done&&(b=u.return)&&b.call(u)}finally{if(U)throw U.error}return[7];case 8:l=this.plugins.filter(function(S){return S.type==="enrichment"||S.type===void 0}),I.label=9;case 9:I.trys.push([9,14,15,16]),d=W(l),m=d.next(),I.label=10;case 10:return m.done?[3,13]:(y=m.value,y.execute?[4,y.execute(v({},r))]:[3,12]);case 11:if(g=I.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,I.label=12;case 12:return m=d.next(),[3,10];case 13:return[3,16];case 14:return T=I.sent(),A={error:T},[3,16];case 15:try{m&&!m.done&&(F=d.return)&&F.call(d)}finally{if(A)throw A.error}return[7];case 16:return h=this.plugins.filter(function(S){return S.type==="destination"}),_=h.map(function(S){var k=v({},r);return S.execute(k).catch(function(B){return J(k,0,String(B))})}),Promise.all(_).then(function(S){var k=w(S,1),B=k[0],Q=B||J(r,100,"Event not tracked, no destination plugins on the instance");o(Q)}),[2]}})})},t.prototype.flush=function(){return p(this,void 0,void 0,function(){var e,n,r,i=this;return f(this,function(o){switch(o.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(s){return i.apply(s)}))];case 1:return o.sent(),n=this.plugins.filter(function(s){return s.type==="destination"}),r=n.map(function(s){return s.flush&&s.flush()}),[4,Promise.all(r)];case 2:return o.sent(),[2]}})})},t}();var St="-",le="AMP",xt="".concat(le,"_unsent"),wt="https://api2.amplitude.com/2/httpapi",Mn="https://api.eu.amplitude.com/2/httpapi",Bn="https://api2.amplitude.com/batch",Fn="https://api.eu.amplitude.com/batch";var Hr=1e3,We=function(t){if(Object.keys(t).length>Hr)return!1;for(var e in t){var n=t[e];if(!Lt(e,n))return!1}return!0},Lt=function(t,e){var n,r;if(typeof t!="string")return!1;if(Array.isArray(e)){var i=!0;try{for(var o=W(e),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if(typeof u=="object")i=i&&We(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(e==null)return!1;if(typeof e=="object")return We(e);if(!["number","string","boolean"].includes(typeof e))return!1}return!0};var ne=function(){function t(){this._propertySet=new Set,this._properties={}}return t.prototype.getUserProperties=function(){return v({},this._properties)},t.prototype.set=function(e,n){return this._safeSet(L.SET,e,n),this},t.prototype.setOnce=function(e,n){return this._safeSet(L.SET_ONCE,e,n),this},t.prototype.append=function(e,n){return this._safeSet(L.APPEND,e,n),this},t.prototype.prepend=function(e,n){return this._safeSet(L.PREPEND,e,n),this},t.prototype.postInsert=function(e,n){return this._safeSet(L.POSTINSERT,e,n),this},t.prototype.preInsert=function(e,n){return this._safeSet(L.PREINSERT,e,n),this},t.prototype.remove=function(e,n){return this._safeSet(L.REMOVE,e,n),this},t.prototype.add=function(e,n){return this._safeSet(L.ADD,e,n),this},t.prototype.unset=function(e){return this._safeSet(L.UNSET,e,St),this},t.prototype.clearAll=function(){return this._properties={},this._properties[L.CLEAR_ALL]=St,this},t.prototype._safeSet=function(e,n,r){if(this._validate(e,n,r)){var i=this._properties[e];return i===void 0&&(i={},this._properties[e]=i),i[n]=r,this._propertySet.add(n),!0}return!1},t.prototype._validate=function(e,n,r){return this._properties[L.CLEAR_ALL]!==void 0||this._propertySet.has(n)?!1:e===L.ADD?typeof r=="number":e!==L.UNSET&&e!==L.REMOVE?Lt(n,r):!0},t}();var Vn=function(t,e,n){var r=typeof t=="string"?{event_type:t}:t;return v(v(v({},r),n),e&&{event_properties:e})},be=function(t,e){var n=v(v({},e),{event_type:Z.IDENTIFY,user_properties:t.getUserProperties()});return n},Hn=function(t,e,n,r){var i,o=v(v({},r),{event_type:Z.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[t]=e,i)});return o},qn=function(t,e,n){var r,i=new ne;i.set(t,e);var o=v(v({},n),{event_type:Z.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[t]=e,r)});return o},jn=function(t,e){return v(v({},e),{event_type:Z.REVENUE,event_properties:t.getEventProperties()})};var H=function(t){return{promise:t||Promise.resolve()}};var Pt=function(){function t(e){e===void 0&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Nn(this),this.name=e}return t.prototype._init=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return n.sent(),[2]}})})},t.prototype.runQueuedFunctions=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c;return f(this,function(a){switch(a.label){case 0:n=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,6,7,8]),r=W(n),i=r.next(),a.label=2;case 2:return i.done?[3,5]:(o=i.value,[4,o()]);case 3:a.sent(),a.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s=a.sent(),u={error:s},[3,8];case 7:try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}return[7];case 8:return[2]}})})},t.prototype.track=function(e,n,r){var i=Vn(e,n,r);return H(this.dispatch(i))},t.prototype.identify=function(e,n){var r=be(e,n);return H(this.dispatch(r))},t.prototype.groupIdentify=function(e,n,r,i){var o=Hn(e,n,r,i);return H(this.dispatch(o))},t.prototype.setGroup=function(e,n,r){var i=qn(e,n,r);return H(this.dispatch(i))},t.prototype.revenue=function(e,n){var r=jn(e,n);return H(this.dispatch(r))},t.prototype.add=function(e){return this.config?H(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),H())},t.prototype.remove=function(e){return this.config?H(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),H())},t.prototype.dispatchWithCallback=function(e,n){if(!this.config)return n(J(e,0,Un));this.process(e).then(n)},t.prototype.dispatch=function(e){return p(this,void 0,void 0,function(){var n=this;return f(this,function(r){return this.config?[2,this.process(e)]:[2,new Promise(function(i){n.dispatchQ.push(n.dispatchWithCallback.bind(n,e,i))})]})})},t.prototype.process=function(e){return p(this,void 0,void 0,function(){var i,n,r,i;return f(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.config.optOut?[2,J(e,0,An)]:[4,this.timeline.push(e)];case 1:return i=o.sent(),i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return n=o.sent(),r=String(n),this.config.loggerProvider.error(r),i=J(e,0,r),[2,i];case 3:return[2]}})})},t.prototype.setOptOut=function(e){if(!this.config){this.q.push(this.setOptOut.bind(this,!!e));return}this.config.optOut=!!e},t.prototype.flush=function(){return H(this.timeline.flush())},t}();var Ct=function(){function t(){this.productId="",this.quantity=1,this.price=0}return t.prototype.setProductId=function(e){return this.productId=e,this},t.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},t.prototype.setPrice=function(e){return this.price=e,this},t.prototype.setRevenueType=function(e){return this.revenueType=e,this},t.prototype.setRevenue=function(e){return this.revenue=e,this},t.prototype.setEventProperties=function(e){return We(e)&&(this.properties=e),this},t.prototype.getEventProperties=function(){var e=this.properties?v({},this.properties):{};return e[$.REVENUE_PRODUCT_ID]=this.productId,e[$.REVENUE_QUANTITY]=this.quantity,e[$.REVENUE_PRICE]=this.price,e[$.REVENUE_TYPE]=this.revenueType,e[$.REVENUE]=this.revenue,e},t}();var Kn=function(t,e){var n=Math.max(e,1);return t.reduce(function(r,i,o){var s=Math.floor(o/n);return r[s]||(r[s]=[]),r[s].push(i),r},[])};var $e="Amplitude Logger ",Ie=function(){function t(){this.logLevel=N.None}return t.prototype.disable=function(){this.logLevel=N.None},t.prototype.enable=function(e){e===void 0&&(e=N.Warn),this.logLevel=e},t.prototype.log=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Verbose||console.log("".concat($e,"[Log]: ").concat(e.join(" ")))},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Warn||console.warn("".concat($e,"[Warn]: ").concat(e.join(" ")))},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Error||console.error("".concat($e,"[Error]: ").concat(e.join(" ")))},t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Debug||console.log("".concat($e,"[Debug]: ").concat(e.join(" ")))},t}();var Ye=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:N.Warn,loggerProvider:new Ie,offline:!1,optOut:!1,serverUrl:wt,serverZone:"US",useBatch:!1}},Rt=function(){function t(e){var n,r,i,o;this._optOut=!1;var s=Ye();this.apiKey=e.apiKey,this.flushIntervalMillis=(n=e.flushIntervalMillis)!==null&&n!==void 0?n:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=(r=e.logLevel)!==null&&r!==void 0?r:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline!==void 0?e.offline:s.offline,this.optOut=(i=e.optOut)!==null&&i!==void 0?i:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var u=Dt(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=u.serverZone,this.serverUrl=u.serverUrl}return Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),t}();var qr=function(t,e){return t==="EU"?e?Fn:Mn:e?Bn:wt},Dt=function(t,e,n){if(t===void 0&&(t=""),e===void 0&&(e=Ye().serverZone),n===void 0&&(n=Ye().useBatch),t)return{serverUrl:t,serverZone:void 0};var r=["US","EU"].includes(e)?e:Ye().serverZone;return{serverZone:r,serverUrl:qr(r,n)}};function jr(t){return t instanceof Error?t.message:String(t)}function Qe(t){var e="";try{"body"in t&&(e=JSON.stringify(t.body,null,2))}catch{}return e}var At=function(){function t(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return t.prototype.setup=function(e){var n;return p(this,void 0,void 0,function(){var r,i=this;return f(this,function(o){switch(o.label){case 0:return this.config=e,this.storageKey="".concat(xt,"_").concat(this.config.apiKey.substring(0,10)),[4,(n=this.config.storageProvider)===null||n===void 0?void 0:n.get(this.storageKey)];case 1:return r=o.sent(),this.saveEvents(),r&&r.length>0&&Promise.all(r.map(function(s){return i.execute(s)})).catch(),[2,Promise.resolve(void 0)]}})})},t.prototype.execute=function(e){var n=this;return new Promise(function(r){var i={event:e,attempts:0,callback:function(o){return r(o)},timeout:0};n.addToQueue(i)})},t.prototype.addToQueue=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n.filter(function(o){return o.attempts<e.config.flushMaxRetries?(o.attempts+=1,!0):(e.fulfillRequest([o],500,Dn),!1)});i.forEach(function(o){if(e.queue=e.queue.concat(o),o.timeout===0){e.schedule(e.config.flushIntervalMillis);return}setTimeout(function(){o.timeout=0,e.schedule(0)},o.timeout)}),this.saveEvents()},t.prototype.schedule=function(e){var n=this;this.scheduled||this.config.offline||(this.scheduled=setTimeout(function(){n.flush(!0).then(function(){n.queue.length>0&&n.schedule(e)})},e))},t.prototype.flush=function(e){return e===void 0&&(e=!1),p(this,void 0,void 0,function(){var n,r,i,o=this;return f(this,function(s){switch(s.label){case 0:return this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(n=[],r=[],this.queue.forEach(function(u){return u.timeout===0?n.push(u):r.push(u)}),this.queue=r,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),i=Kn(n,this.config.flushQueueSize),[4,Promise.all(i.map(function(u){return o.send(u,e)}))]);case 1:return s.sent(),[2]}})})},t.prototype.send=function(e,n){return n===void 0&&(n=!0),p(this,void 0,void 0,function(){var r,i,o,s,u;return f(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,kn)];r={api_key:this.config.apiKey,events:e.map(function(a){var l=a.event,d=l.extra,m=Te(l,["extra"]);return m}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString()},c.label=1;case 1:return c.trys.push([1,3,,4]),i=Dt(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,r)];case 2:return o=c.sent(),o===null?(this.fulfillRequest(e,0,Rn),[2]):n?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(Qe(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return s=c.sent(),u=jr(s),this.config.loggerProvider.error(u),this.fulfillRequest(e,0,u),[3,4];case 4:return[2]}})})},t.prototype.handleResponse=function(e,n){var r=e.status;switch(r){case x.Success:{this.handleSuccessResponse(e,n);break}case x.Invalid:{this.handleInvalidResponse(e,n);break}case x.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,n);break}case x.RateLimit:{this.handleRateLimitResponse(e,n);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(r,"' provided for ").concat(n.length,' events"}')),this.handleOtherResponse(n);break}}},t.prototype.handleSuccessResponse=function(e,n){this.fulfillRequest(n,e.statusCode,Cn)},t.prototype.handleInvalidResponse=function(e,n){var r=this;if(e.body.missingField||e.body.error.startsWith(On)){this.fulfillRequest(n,e.statusCode,e.body.error);return}var i=q(q(q(q([],w(Object.values(e.body.eventsWithInvalidFields)),!1),w(Object.values(e.body.eventsWithMissingFields)),!1),w(Object.values(e.body.eventsWithInvalidIdLengths)),!1),w(e.body.silencedEvents),!1).flat(),o=new Set(i),s=n.filter(function(u,c){if(o.has(c)){r.fulfillRequest([u],e.statusCode,e.body.error);return}return!0});s.length>0&&this.config.loggerProvider.warn(Qe(e)),this.addToQueue.apply(this,q([],w(s),!1))},t.prototype.handlePayloadTooLargeResponse=function(e,n){if(n.length===1){this.fulfillRequest(n,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Qe(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,q([],w(n),!1))},t.prototype.handleRateLimitResponse=function(e,n){var r=this,i=Object.keys(e.body.exceededDailyQuotaUsers),o=Object.keys(e.body.exceededDailyQuotaDevices),s=e.body.throttledEvents,u=new Set(i),c=new Set(o),a=new Set(s),l=n.filter(function(d,m){if(d.event.user_id&&u.has(d.event.user_id)||d.event.device_id&&c.has(d.event.device_id)){r.fulfillRequest([d],e.statusCode,e.body.error);return}return a.has(m)&&(d.timeout=r.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(Qe(e)),this.addToQueue.apply(this,q([],w(l),!1))},t.prototype.handleOtherResponse=function(e){var n=this;this.addToQueue.apply(this,q([],w(e.map(function(r){return r.timeout=r.attempts*n.retryTimeout,r})),!1))},t.prototype.fulfillRequest=function(e,n,r){this.saveEvents(),e.forEach(function(i){return i.callback(J(i.event,n,r))})},t.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map(function(n){return n.event}));this.config.storageProvider.set(this.storageKey,e)}},t}();var Kr=function(t){t===void 0&&(t=0);var e=new Error().stack||"";return e.split(\`
|
|
10
10
|
\`).slice(2+t).map(function(n){return n.trim()})},P=function(t){return function(){var e=v({},t.config),n=e.loggerProvider,r=e.logLevel;return{logger:n,logLevel:r}}},Gr=function(t,e){var n,r;e=e.replace(/\\[(\\w+)\\]/g,".$1"),e=e.replace(/^\\./,"");try{for(var i=W(e.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(s in t)t=t[s];else return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return t},C=function(t,e){return function(){var n,r,i={};try{for(var o=W(e),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=Gr(t,u)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},R=function(t,e,n,r,i){return i===void 0&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),c=u.logger,a=u.logLevel;if(a&&a<N.Debug||!a||!c)return t.apply(i,o);var l={type:"invoke public method",name:e,args:o,stacktrace:Kr(1),time:{start:new Date().toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=t.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),c.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),c.debug(JSON.stringify(l,null,2))),d}};var Xe=function(){function t(){this.memoryStorage=new Map}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2,!0]})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return[2,this.memoryStorage.get(e)]})})},t.prototype.getRaw=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return n=r.sent(),[2,n?JSON.stringify(n):void 0]}})})},t.prototype.set=function(e,n){return p(this,void 0,void 0,function(){return f(this,function(r){return this.memoryStorage.set(e,n),[2]})})},t.prototype.remove=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return this.memoryStorage.delete(e),[2]})})},t.prototype.reset=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return this.memoryStorage.clear(),[2]})})},t}();var de=function(){function t(){}return t.prototype.send=function(e,n){return Promise.resolve(null)},t.prototype.buildResponse=function(e){var n,r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,A,F,I,S;if(typeof e!="object")return null;var k=e.code||0,B=this.buildStatus(k);switch(B){case x.Success:return{status:B,statusCode:k,body:{eventsIngested:(n=e.events_ingested)!==null&&n!==void 0?n:0,payloadSizeBytes:(r=e.payload_size_bytes)!==null&&r!==void 0?r:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case x.Invalid:return{status:B,statusCode:k,body:{error:(o=e.error)!==null&&o!==void 0?o:"",missingField:(s=e.missing_field)!==null&&s!==void 0?s:"",eventsWithInvalidFields:(u=e.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(c=e.events_with_missing_fields)!==null&&c!==void 0?c:{},eventsWithInvalidIdLengths:(a=e.events_with_invalid_id_lengths)!==null&&a!==void 0?a:{},epsThreshold:(l=e.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(d=e.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(m=e.silenced_devices)!==null&&m!==void 0?m:[],silencedEvents:(y=e.silenced_events)!==null&&y!==void 0?y:[],throttledDevices:(g=e.throttled_devices)!==null&&g!==void 0?g:{},throttledEvents:(T=e.throttled_events)!==null&&T!==void 0?T:[]}};case x.PayloadTooLarge:return{status:B,statusCode:k,body:{error:(h=e.error)!==null&&h!==void 0?h:""}};case x.RateLimit:return{status:B,statusCode:k,body:{error:(_=e.error)!==null&&_!==void 0?_:"",epsThreshold:(U=e.eps_threshold)!==null&&U!==void 0?U:0,throttledDevices:(b=e.throttled_devices)!==null&&b!==void 0?b:{},throttledUsers:(A=e.throttled_users)!==null&&A!==void 0?A:{},exceededDailyQuotaDevices:(F=e.exceeded_daily_quota_devices)!==null&&F!==void 0?F:{},exceededDailyQuotaUsers:(I=e.exceeded_daily_quota_users)!==null&&I!==void 0?I:{},throttledEvents:(S=e.throttled_events)!==null&&S!==void 0?S:[]}};case x.Timeout:default:return{status:B,statusCode:k}}},t.prototype.buildStatus=function(e){return e>=200&&e<300?x.Success:e===429?x.RateLimit:e===413?x.PayloadTooLarge:e===408?x.Timeout:e>=400&&e<500?x.Invalid:e>=500?x.Failed:x.Unknown},t}();var M=function(){if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global};var ge=function(){var t,e=M();if(!(!((t=e?.location)===null||t===void 0)&&t.search))return{};var n=e.location.search.substring(1).split("&").filter(Boolean),r=n.reduce(function(i,o){var s=o.split("=",2),u=Gn(s[0]),c=Gn(s[1]);return c&&(i[u]=c),i},{});return r},Gn=function(t){t===void 0&&(t="");try{return decodeURIComponent(t)}catch{return""}};var Wn="utm_campaign",$n="utm_content",Yn="utm_id",Qn="utm_medium",Xn="utm_source",zn="utm_term",kt="dclid",Ot="fbclid",Ut="gbraid",Nt="gclid",Mt="ko_click_id",Bt="li_fat_id",Ft="msclkid",Vt="rtd_cid",Ht="ttclid",qt="twclid",jt="wbraid";var pe={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0};var Se=function(){function t(){}return t.prototype.parse=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2,v(v(v(v({},pe),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},t.prototype.getUtmParam=function(){var e=ge(),n=e[Wn],r=e[$n],i=e[Yn],o=e[Qn],s=e[Xn],u=e[zn];return{utm_campaign:n,utm_content:r,utm_id:i,utm_medium:o,utm_source:s,utm_term:u}},t.prototype.getReferrer=function(){var e,n,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=(n=(e=r.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&n!==void 0?n:void 0}catch{}return r},t.prototype.getClickIds=function(){var e,n=ge();return e={},e[kt]=n[kt],e[Ot]=n[Ot],e[Ut]=n[Ut],e[Nt]=n[Nt],e[Mt]=n[Mt],e[Bt]=n[Bt],e[Ft]=n[Ft],e[Vt]=n[Vt],e[Ht]=n[Ht],e[qt]=n[qt],e[jt]=n[jt],e},t}();var ze=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[le,e,t.substring(0,n)].filter(Boolean).join("_")},Kt=function(t){return"".concat(le.toLowerCase(),"_").concat(t.substring(0,6))};var xe=function(t,e){e===void 0&&(e=Date.now());var n=Date.now(),r=n-e;return r>t};var we=function(){function t(e){this.options=v({},e)}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){var e,n,r,i;return f(this,function(o){switch(o.label){case 0:if(!M())return[2,!1];t.testValue=String(Date.now()),e=new t(this.options),n="AMP_TEST",o.label=1;case 1:return o.trys.push([1,4,5,7]),[4,e.set(n,t.testValue)];case 2:return o.sent(),[4,e.get(n)];case 3:return r=o.sent(),[2,r===t.testValue];case 4:return i=o.sent(),[2,!1];case 5:return[4,e.remove(n)];case 6:return o.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:if(n=r.sent(),!n)return[2,void 0];try{try{n=decodeURIComponent(atob(n))}catch{}return[2,JSON.parse(n)]}catch{return[2,void 0]}return[2]}})})},t.prototype.getRaw=function(e){var n,r;return p(this,void 0,void 0,function(){var i,o,s;return f(this,function(u){return i=M(),o=(r=(n=i?.document)===null||n===void 0?void 0:n.cookie.split("; "))!==null&&r!==void 0?r:[],s=o.find(function(c){return c.indexOf(e+"=")===0}),s?[2,s.substring(e.length+1)]:[2,void 0]})})},t.prototype.set=function(e,n){var r;return p(this,void 0,void 0,function(){var i,o,s,u,c,a;return f(this,function(l){try{i=(r=this.options.expirationDays)!==null&&r!==void 0?r:0,o=n!==null?i:-1,s=void 0,o&&(u=new Date,u.setTime(u.getTime()+o*24*60*60*1e3),s=u),c="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(n)))),s&&(c+="; expires=".concat(s.toUTCString())),c+="; path=/",this.options.domain&&(c+="; domain=".concat(this.options.domain)),this.options.secure&&(c+="; Secure"),this.options.sameSite&&(c+="; SameSite=".concat(this.options.sameSite)),a=M(),a&&(a.document.cookie=c)}catch{}return[2]})})},t.prototype.remove=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return[4,this.set(e,null)];case 1:return n.sent(),[2]}})})},t.prototype.reset=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2]})})},t}();var Gt=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i,o,s;return f(this,function(u){switch(u.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(r),method:"POST"},[4,fetch(n,i)];case 1:return o=u.sent(),[4,o.json()];case 2:return s=u.sent(),[2,this.buildResponse(s)]}})})},e}(de);var Wr=function(){function t(){}return t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:$r(),platform:"Web",os:void 0,deviceModel:void 0}},t}(),$r=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Yr=function(){function t(){this.queue=[]}return t.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},t.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(n){e(n)}),this.queue=[])},t}(),re=function(){return re=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},re.apply(this,arguments)},Ze=function(t,e){var n=["string","number","boolean","undefined"],r=typeof t,i=typeof e;if(r!==i)return!1;for(var o=0,s=n;o<s.length;o++){var u=s[o];if(u===r)return t===e}if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;var c=Array.isArray(t),a=Array.isArray(e);if(c!==a)return!1;if(c&&a){for(var l=0;l<t.length;l++)if(!Ze(t[l],e[l]))return!1}else{var d=Object.keys(t).sort(),m=Object.keys(e).sort();if(!Ze(d,m))return!1;var y=!0;return Object.keys(t).forEach(function(g){Ze(t[g],e[g])||(y=!1)}),y}return!0},Qr="$set",Xr="$unset",zr="$clearAll";Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r});var Zr=function(){function t(){this.identity={userProperties:{}},this.listeners=new Set}return t.prototype.editIdentity=function(){var e=this,n=re({},this.identity.userProperties),r=re(re({},this.identity),{userProperties:n});return{setUserId:function(i){return r.userId=i,this},setDeviceId:function(i){return r.deviceId=i,this},setUserProperties:function(i){return r.userProperties=i,this},setOptOut:function(i){return r.optOut=i,this},updateUserProperties:function(i){for(var o=r.userProperties||{},s=0,u=Object.entries(i);s<u.length;s++){var c=u[s],a=c[0],l=c[1];switch(a){case Qr:for(var d=0,m=Object.entries(l);d<m.length;d++){var y=m[d],g=y[0],T=y[1];o[g]=T}break;case Xr:for(var h=0,_=Object.keys(l);h<_.length;h++){var g=_[h];delete o[g]}break;case zr:o={};break}}return r.userProperties=o,this},commit:function(){return e.setIdentity(r),this}}},t.prototype.getIdentity=function(){return re({},this.identity)},t.prototype.setIdentity=function(e){var n=re({},this.identity);this.identity=re({},e),Ze(n,this.identity)||this.listeners.forEach(function(r){r(e)})},t.prototype.addIdentityListener=function(e){this.listeners.add(e)},t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},t}(),Le=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,Zn=function(){function t(){this.identityStore=new Zr,this.eventBridge=new Yr,this.applicationContextProvider=new Wr}return t.getInstance=function(e){return Le.analyticsConnectorInstances||(Le.analyticsConnectorInstances={}),Le.analyticsConnectorInstances[e]||(Le.analyticsConnectorInstances[e]=new t),Le.analyticsConnectorInstances[e]},t}();var ie=function(t){return t===void 0&&(t="$default_instance"),Zn.getInstance(t)},Wt=function(t,e){ie(e).identityStore.editIdentity().setUserId(t).commit()},$t=function(t,e){ie(e).identityStore.editIdentity().setDeviceId(t).commit()};var Yt=function(){function t(){this.name="identity",this.type="before",this.identityStore=ie().identityStore}return t.prototype.execute=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){return n=e.user_properties,n&&this.identityStore.editIdentity().updateUserProperties(n).commit(),[2,e]})})},t.prototype.setup=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return e.instanceName&&(this.identityStore=ie(e.instanceName).identityStore),[2]})})},t}();var Qt=function(){var t,e,n,r;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(r=(n=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&n!==void 0?n:i)!==null&&r!==void 0?r:""};var Pe=function(t,e){return typeof t=="boolean"?t:t?.[e]!==!1},Je=function(t){return Pe(t,"attribution")},Xt=function(t){return Pe(t,"fileDownloads")},zt=function(t){return Pe(t,"formInteractions")},et=function(t){return Pe(t,"pageViews")},Zt=function(t){return Pe(t,"sessions")},Jt=function(t){var e=function(){return!1},n=void 0,r,i=t.pageCounter,o=et(t.defaultTracking);return o&&(e=void 0,r=void 0,t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews=="object"&&("trackOn"in t.defaultTracking.pageViews&&(e=t.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in t.defaultTracking.pageViews&&(n=t.defaultTracking.pageViews.trackHistoryChanges),"eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType&&(r=t.defaultTracking.pageViews.eventType))),{trackOn:e,trackHistoryChanges:n,eventType:r,pageCounter:i}},en=function(t){return Je(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution=="object"?v({},t.defaultTracking.attribution):{}};var tt=function(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.name,o=r.args,s=r.resolve,u=t&&t[i];if(typeof u=="function"){var c=u.apply(t,o);typeof s=="function"&&s(c?.promise)}}return t},nt=function(t){var e=t;return e&&e._q!==void 0};var Jn="2.5.2";var Jr="Web",ei="$remote",er=function(){function t(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat(Jn),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return t.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},t.prototype.execute=function(e){var n,r;return p(this,void 0,void 0,function(){var i,o,s,u;return f(this,function(c){return i=new Date().getTime(),o=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1,s=(r=e.event_id)!==null&&r!==void 0?r:o+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=i),u=v(v(v(v(v(v(v(v({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:Jr}),this.config.trackingOptions.language&&{language:Qt()}),this.config.trackingOptions.ipAddress&&{ip:ei}),{insert_id:Y(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:s,library:this.library,user_agent:this.userAgent}),[2,u]})})},t}();var rt=function(){function t(e){this.storage=e}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){var e,n,r,i,o;return f(this,function(s){switch(s.label){case 0:if(!this.storage)return[2,!1];e=String(Date.now()),n=new t(this.storage),r="AMP_TEST",s.label=1;case 1:return s.trys.push([1,4,5,7]),[4,n.set(r,e)];case 2:return s.sent(),[4,n.get(r)];case 3:return i=s.sent(),[2,i===e];case 4:return o=s.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return s.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){var n,r;return f(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return n=i.sent(),n?[2,JSON.parse(n)]:[2,void 0];case 2:return r=i.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},t.prototype.getRaw=function(e){var n;return p(this,void 0,void 0,function(){return f(this,function(r){return[2,((n=this.storage)===null||n===void 0?void 0:n.getItem(e))||void 0]})})},t.prototype.set=function(e,n){var r;return p(this,void 0,void 0,function(){return f(this,function(i){try{(r=this.storage)===null||r===void 0||r.setItem(e,JSON.stringify(n))}catch{}return[2]})})},t.prototype.remove=function(e){var n;return p(this,void 0,void 0,function(){return f(this,function(r){try{(n=this.storage)===null||n===void 0||n.removeItem(e)}catch{}return[2]})})},t.prototype.reset=function(){var e;return p(this,void 0,void 0,function(){return f(this,function(n){try{(e=this.storage)===null||e===void 0||e.clear()}catch{}return[2]})})},t}();var it=1e3,tn=function(t){V(e,t);function e(n){var r=this,i;return r=t.call(this,(i=M())===null||i===void 0?void 0:i.localStorage)||this,r.loggerProvider=n?.loggerProvider,r}return e.prototype.set=function(n,r){var i;return p(this,void 0,void 0,function(){var o;return f(this,function(s){switch(s.label){case 0:return Array.isArray(r)&&r.length>it?(o=r.length-it,[4,t.prototype.set.call(this,n,r.slice(0,it))]):[3,2];case 1:return s.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(it,".")),[3,4];case 2:return[4,t.prototype.set.call(this,n,r)];case 3:s.sent(),s.label=4;case 4:return[2]}})})},e}(rt);var tr=function(t){V(e,t);function e(){var n;return t.call(this,(n=M())===null||n===void 0?void 0:n.sessionStorage)||this}return e}(rt);var nr=function(t){V(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={done:4},n}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i=this;return f(this,function(o){return[2,new Promise(function(s,u){typeof XMLHttpRequest>"u"&&u(new Error("XHRTransport is not supported."));var c=new XMLHttpRequest;c.open("POST",n,!0),c.onreadystatechange=function(){if(c.readyState===i.state.done)try{var a=c.responseText,l=JSON.parse(a),d=i.buildResponse(l);s(d)}catch(m){u(m)}},c.setRequestHeader("Content-Type","application/json"),c.setRequestHeader("Accept","*/*"),c.send(JSON.stringify(r))})]})})},e}(de);var rr=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i=this;return f(this,function(o){return[2,new Promise(function(s,u){var c=M();if(!c?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(r),l=c.navigator.sendBeacon(n,JSON.stringify(r));return s(l?i.buildResponse({code:200,events_ingested:r.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):i.buildResponse({code:500}))}catch(d){u(d)}})]})})},e}(de);var ir=function(t,e,n){return n===void 0&&(n=!0),p(void 0,void 0,void 0,function(){var r,i,o,s,u,c,a,l,d;return f(this,function(m){switch(m.label){case 0:return r=Kt(t),[4,e.getRaw(r)];case 1:return i=m.sent(),i?n?[4,e.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:m.sent(),m.label=3;case 3:return o=w(i.split("."),6),s=o[0],u=o[1],c=o[2],a=o[3],l=o[4],d=o[5],[2,{deviceId:s,userId:ti(u),sessionId:nn(a),lastEventId:nn(d),lastEventTime:nn(l),optOut:!!c}]}})})},nn=function(t){var e=parseInt(t,32);if(!isNaN(e))return e},ti=function(t){if(!(!atob||!escape||!t))try{return decodeURIComponent(escape(atob(t)))}catch{return}};var j="[Amplitude]",Ca="".concat(j," Page Viewed"),rn="".concat(j," Form Started"),or="".concat(j," Form Submitted"),sr="".concat(j," File Downloaded"),on="session_start",sn="session_end",ar="".concat(j," File Extension"),ur="".concat(j," File Name"),cr="".concat(j," Link ID"),lr="".concat(j," Link Text"),dr="".concat(j," Link URL"),ot="".concat(j," Form ID"),st="".concat(j," Form Name"),at="".concat(j," Form Destination"),Ce="cookie",pr="US";var ni=function(t){V(e,t);function e(n,r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,A,F,I,S,k,B,Q,ee,ue,te,ce,ye,_e){i===void 0&&(i=new Xe),o===void 0&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),c===void 0&&(c=1e3),a===void 0&&(a=5),l===void 0&&(l=30),d===void 0&&(d=Ce),h===void 0&&(h=new Ie),_===void 0&&(_=N.Warn),b===void 0&&(b=!1),A===void 0&&(A=!1),S===void 0&&(S=""),k===void 0&&(k=pr),Q===void 0&&(Q=30*60*1e3),ee===void 0&&(ee=new tn({loggerProvider:h})),ue===void 0&&(ue={ipAddress:!0,language:!0,platform:!0}),te===void 0&&(te="fetch"),ce===void 0&&(ce=!1);var E=t.call(this,{apiKey:n,storageProvider:ee,transportProvider:an(te)})||this;return E.apiKey=n,E.appVersion=r,E.cookieOptions=o,E.defaultTracking=s,E.flushIntervalMillis=c,E.flushMaxRetries=a,E.flushQueueSize=l,E.identityStorage=d,E.ingestionMetadata=m,E.instanceName=y,E.loggerProvider=h,E.logLevel=_,E.minIdLength=U,E.offline=b,E.partnerId=F,E.plan=I,E.serverUrl=S,E.serverZone=k,E.sessionTimeout=Q,E.storageProvider=ee,E.trackingOptions=ue,E.transport=te,E.useBatch=ce,E._optOut=!1,E._cookieStorage=i,E.deviceId=u,E.lastEventId=g,E.lastEventTime=T,E.optOut=A,E.sessionId=B,E.pageCounter=_e,E.userId=ye,E.loggerProvider.enable(E.logLevel),E}return Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(n){this._cookieStorage!==n&&(this._cookieStorage=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(n){this._deviceId!==n&&(this._deviceId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(n){this._userId!==n&&(this._userId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(n){this._sessionId!==n&&(this._sessionId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(n){this._optOut!==n&&(this._optOut=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(n){this._lastEventTime!==n&&(this._lastEventTime=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(n){this._lastEventId!==n&&(this._lastEventId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(n){this._pageCounter!==n&&(this._pageCounter=n,this.updateStorage())},enumerable:!1,configurable:!0}),e.prototype.updateStorage=function(){var n={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter};this.cookieStorage.set(ze(this.apiKey),n)},e}(Rt);var fr=function(t,e,n){return e===void 0&&(e={}),p(void 0,void 0,void 0,function(){var r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,A,F,I,S,k,B,Q,ee,ue,te,ce,ye,_e,E,dt,pt,ft,mt,vt,gt,ht,yt,_t;return f(this,function(me){switch(me.label){case 0:return r=e.identityStorage||Ce,b={},r===Ce?[3,1]:(o="",[3,5]);case 1:return(F=(A=e.cookieOptions)===null||A===void 0?void 0:A.domain)!==null&&F!==void 0?(s=F,[3,4]):[3,2];case 2:return[4,ii()];case 3:s=me.sent(),me.label=4;case 4:o=s,me.label=5;case 5:return i=v.apply(void 0,[(b.domain=o,b.expiration=365,b.sameSite="Lax",b.secure=!1,b.upgrade=!0,b),e.cookieOptions]),u=ri(e.identityStorage,i),[4,ir(t,u,(S=(I=e.cookieOptions)===null||I===void 0?void 0:I.upgrade)!==null&&S!==void 0?S:!0)];case 6:return c=me.sent(),[4,u.get(ze(t))];case 7:return a=me.sent(),l=ge(),d=(ee=(Q=(B=(k=e.deviceId)!==null&&k!==void 0?k:l.deviceId)!==null&&B!==void 0?B:a?.deviceId)!==null&&Q!==void 0?Q:c.deviceId)!==null&&ee!==void 0?ee:Y(),m=(ue=a?.lastEventId)!==null&&ue!==void 0?ue:c.lastEventId,y=(te=a?.lastEventTime)!==null&&te!==void 0?te:c.lastEventTime,g=(ye=(ce=e.optOut)!==null&&ce!==void 0?ce:a?.optOut)!==null&&ye!==void 0?ye:c.optOut,T=(_e=a?.sessionId)!==null&&_e!==void 0?_e:c.sessionId,h=(dt=(E=e.userId)!==null&&E!==void 0?E:a?.userId)!==null&&dt!==void 0?dt:c.userId,n.previousSessionDeviceId=(pt=a?.deviceId)!==null&&pt!==void 0?pt:c.deviceId,n.previousSessionUserId=(ft=a?.userId)!==null&&ft!==void 0?ft:c.userId,_={ipAddress:(vt=(mt=e.trackingOptions)===null||mt===void 0?void 0:mt.ipAddress)!==null&&vt!==void 0?vt:!0,language:(ht=(gt=e.trackingOptions)===null||gt===void 0?void 0:gt.language)!==null&&ht!==void 0?ht:!0,platform:(_t=(yt=e.trackingOptions)===null||yt===void 0?void 0:yt.platform)!==null&&_t!==void 0?_t:!0},U=a?.pageCounter,[2,new ni(t,e.appVersion,u,i,e.defaultTracking,d,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,r,e.ingestionMetadata,e.instanceName,m,y,e.loggerProvider,e.logLevel,e.minIdLength,e.offline,g,e.partnerId,e.plan,e.serverUrl,e.serverZone,T,e.sessionTimeout,e.storageProvider,_,e.transport,e.useBatch,h,U)]}})})},ri=function(t,e){switch(t===void 0&&(t=Ce),e===void 0&&(e={}),t){case"localStorage":return new tn;case"sessionStorage":return new tr;case"none":return new Xe;case"cookie":default:return new we(v(v({},e),{expirationDays:e.expiration}))}},an=function(t){return t==="xhr"?new nr:t==="beacon"?new rr:new Gt},ii=function(t){return p(void 0,void 0,void 0,function(){var e,n,r,i,o,o,s,u,c,a;return f(this,function(l){switch(l.label){case 0:return[4,new we().isEnabled()];case 1:if(!l.sent()||!t&&typeof location>"u")return[2,""];for(e=t??location.hostname,n=e.split("."),r=[],i="AMP_TLDTEST",o=n.length-2;o>=0;--o)r.push(n.slice(o).join("."));o=0,l.label=2;case 2:return o<r.length?(s=r[o],u={domain:"."+s},c=new we(u),[4,c.set(i,1)]):[3,7];case 3:return l.sent(),[4,c.get(i)];case 4:return a=l.sent(),a?[4,c.remove(i)]:[3,6];case 5:return l.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}})})};var vr=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[le,e,t.substring(0,n)].filter(Boolean).join("_")},mr=function(t){var e=t.split(".");return e.length<=2?t:e.slice(e.length-2,e.length).join(".")},oi=function(t){return Object.values(t).every(function(e){return!e})},gr=function(t,e,n,r){r===void 0&&(r=!0);var i=t.referrer,o=t.referring_domain,s=Te(t,["referrer","referring_domain"]),u=e||{},c=u.referrer,a=u.referring_domain,l=Te(u,["referrer","referring_domain"]);if(si(n.excludeReferrers,t.referring_domain)||!r&&oi(t)&&e)return!1;var d=JSON.stringify(s)!==JSON.stringify(l),m=mr(o||"")!==mr(a||"");return!e||d||m},si=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=""),t.some(function(n){return n instanceof RegExp?n.test(e):n===e})},hr=function(t,e){var n=v(v({},pe),t),r=Object.entries(n).reduce(function(i,o){var s,u=w(o,2),c=u[0],a=u[1];return i.setOnce("initial_".concat(c),(s=a??e.initialEmptyValue)!==null&&s!==void 0?s:"EMPTY"),a?i.set(c,a):i.unset(c)},new ne);return be(r)},yr=function(t){var e=t;return e?(e.startsWith(".")&&(e=e.substring(1)),[new RegExp("".concat(e.replace(".","\\\\."),"$"))]):[]};var un=function(t){var e=this;t===void 0&&(t={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(r,i){var o;return p(this,void 0,void 0,function(){var s,u,c,a,l,d,m,y;return f(this,function(g){switch(g.label){case 0:return s=v({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:yr((o=r.cookieOptions)===null||o===void 0?void 0:o.domain)},t),r.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),u=r.cookieStorage,c=vr(r.apiKey,"MKTG"),[4,Promise.all([new Se().parse(),u.get(c)])];case 1:return a=w.apply(void 0,[g.sent(),2]),l=a[0],d=a[1],m=xe(r.sessionTimeout,r.lastEventTime),gr(l,d,s,m)&&(s.resetSessionOnNewCampaign&&(i.setSessionId(Date.now()),r.loggerProvider.log("Created a new session for new campaign.")),r.loggerProvider.log("Tracking attribution."),y=hr(l,s),i.track(y),u.set(c,l)),[2]}})})},execute:function(r){return p(e,void 0,void 0,function(){return f(this,function(i){return[2,r]})})}};return n};var _r=function(t){var e={};for(var n in t){var r=t[n];r&&(e[n]=r)}return e};var cn=function(t){t===void 0&&(t={});var e,n=M(),r=void 0,i,o,s=function(){return p(void 0,void 0,void 0,function(){var m,y,g;return f(this,function(T){switch(T.label){case 0:return o.pageCounter=o.pageCounter?o.pageCounter+1:1,y={event_type:(g=t.eventType)!==null&&g!==void 0?g:"[Amplitude] Page Viewed"},m=[{}],[4,ai()];case 1:return[2,(y.event_properties=v.apply(void 0,[v.apply(void 0,m.concat([T.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":typeof location<"u"&&location.href||"","[Amplitude] Page Path":typeof location<"u"&&location.pathname||"","[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":typeof location<"u"&&location.href.split("?")[0]||"","[Amplitude] Page Counter":o.pageCounter}]),y)]}})})},u=function(){return typeof t.trackOn>"u"||typeof t.trackOn=="function"&&t.trackOn()},c=typeof location<"u"?location.href:null,a=function(){return p(void 0,void 0,void 0,function(){var m,y,g,T,h;return f(this,function(_){switch(_.label){case 0:return m=location.href,y=ci(t.trackHistoryChanges,m,c||"")&&u(),c=m,y?(r?.log("Tracking page view event"),e!=null?[3,1]:(g=void 0,[3,3])):[3,4];case 1:return h=(T=e).track,[4,s()];case 2:g=h.apply(T,[_.sent()]),_.label=3;case 3:_.label=4;case 4:return[2]}})})},l=function(){a()},d={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(m,y){return p(void 0,void 0,void 0,function(){var g,T;return f(this,function(h){switch(h.label){case 0:return e=y,o=m,r=m.loggerProvider,r.log("Installing @amplitude/plugin-page-view-tracking-browser"),n&&(n.addEventListener("popstate",l),i=n.history.pushState,n.history.pushState=new Proxy(n.history.pushState,{apply:function(_,U,b){var A=w(b,3),F=A[0],I=A[1],S=A[2];_.apply(U,[F,I,S]),a()}})),u()?(r.log("Tracking page view event"),T=(g=e).track,[4,s()]):[3,2];case 1:T.apply(g,[h.sent()]),h.label=2;case 2:return[2]}})})},execute:function(m){return p(void 0,void 0,void 0,function(){var y;return f(this,function(g){switch(g.label){case 0:return t.trackOn==="attribution"&&ui(m)?(r?.log("Enriching campaign event to page view event with campaign parameters"),[4,s()]):[3,2];case 1:y=g.sent(),m.event_type=y.event_type,m.event_properties=v(v({},m.event_properties),y.event_properties),g.label=2;case 2:return[2,m]}})})},teardown:function(){return p(void 0,void 0,void 0,function(){return f(this,function(m){return n&&(n.removeEventListener("popstate",l),i&&(n.history.pushState=i)),[2]})})}};return d},ai=function(){return p(void 0,void 0,void 0,function(){var t;return f(this,function(e){switch(e.label){case 0:return t=_r,[4,new Se().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})},ui=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties,n=e[L.SET]||{},r=e[L.UNSET]||{},i=q(q([],w(Object.keys(n)),!1),w(Object.keys(r)),!1);return Object.keys(pe).every(function(o){return i.includes(o)})}return!1},ci=function(t,e,n){switch(t){case"pathOnly":return e.split("?")[0]!==n.split("?")[0];default:return e!==n}};var Er=function(){var t,e=[],n=function(a,l,d){a.addEventListener(l,d),e.push({element:a,type:l,handler:d})},r=function(){e.forEach(function(a){var l=a.element,d=a.type,m=a.handler;l?.removeEventListener(d,m)}),e=[]},i="@amplitude/plugin-form-interaction-tracking-browser",o="enrichment",s=function(a,l){return p(void 0,void 0,void 0,function(){var d,m;return f(this,function(y){return l?typeof document>"u"?[2]:(d=function(g){var T=!1;n(g,"change",function(){var h;T||l.track(rn,(h={},h[ot]=he(g.id),h[st]=he(g.name),h[at]=g.action,h)),T=!0}),n(g,"submit",function(){var h,_;T||l.track(rn,(h={},h[ot]=he(g.id),h[st]=he(g.name),h[at]=g.action,h)),l.track(or,(_={},_[ot]=he(g.id),_[st]=he(g.name),_[at]=g.action,_)),T=!1})},m=Array.from(document.getElementsByTagName("form")),m.forEach(d),typeof MutationObserver<"u"&&(t=new MutationObserver(function(g){g.forEach(function(T){T.addedNodes.forEach(function(h){h.nodeName==="FORM"&&d(h),"querySelectorAll"in h&&typeof h.querySelectorAll=="function"&&Array.from(h.querySelectorAll("form")).map(d)})})}),t.observe(document.body,{subtree:!0,childList:!0})),[2]):(a.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])})})},u=function(a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return[2,a]})})},c=function(){return p(void 0,void 0,void 0,function(){return f(this,function(a){return t?.disconnect(),r(),[2]})})};return{name:i,type:o,setup:s,execute:u,teardown:c}},he=function(t){if(typeof t=="string")return t};var Tr=function(){var t,e=[],n=function(a,l,d){a.addEventListener(l,d),e.push({element:a,type:l,handler:d})},r=function(){e.forEach(function(a){var l=a.element,d=a.type,m=a.handler;l?.removeEventListener(d,m)}),e=[]},i="@amplitude/plugin-file-download-tracking-browser",o="enrichment",s=function(a,l){return p(void 0,void 0,void 0,function(){var d,m,y;return f(this,function(g){return l?typeof document>"u"?[2]:(d=function(T){var h;try{h=new URL(T.href,window.location.href)}catch{return}var _=m.exec(h.href),U=_?.[1];U&&n(T,"click",function(){var b;U&&l.track(sr,(b={},b[ar]=U,b[ur]=h.pathname,b[cr]=T.id,b[lr]=T.text,b[dr]=T.href,b))})},m=/\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/,y=Array.from(document.getElementsByTagName("a")),y.forEach(d),typeof MutationObserver<"u"&&(t=new MutationObserver(function(T){T.forEach(function(h){h.addedNodes.forEach(function(_){_.nodeName==="A"&&d(_),"querySelectorAll"in _&&typeof _.querySelectorAll=="function"&&Array.from(_.querySelectorAll("a")).map(d)})})}),t.observe(document.body,{subtree:!0,childList:!0})),[2]):(a.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])})})},u=function(a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return[2,a]})})},c=function(){return p(void 0,void 0,void 0,function(){return f(this,function(a){return t?.disconnect(),r(),[2]})})};return{name:i,type:o,setup:s,execute:u,teardown:c}};var br=!1,Ir=function(t){if(!(br||t.defaultTracking!==void 0)){var e=\`\\\`options.defaultTracking\\\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \\\`options.defaultTracking\\\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:
|
|
11
11
|
|
|
12
12
|
amplitude.init(<YOUR_API_KEY>, {
|
|
@@ -72,7 +72,7 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
|
|
|
72
72
|
</nav>
|
|
73
73
|
</section>
|
|
74
74
|
</main>
|
|
75
|
-
\`,Ri();let n=new URL(yn,Oe);n.searchParams.set(gn,location.href);let r=e.querySelectorAll(".next-step");for(let i of r)i.setAttribute("href",n.href);oe("overview step viewed")}},Ri=()=>{let t=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");t?(t.href="https://cdn.builder.io/favicon.ico",t.removeAttribute("type")):(t=document.createElement("link"),t.rel="icon",t.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(t))};var Mr=async()=>{(await Tn()).isValid||Di()},Di=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",lt);let t=document.querySelector("builder-dev-tools-overview");t||(t=document.createElement("builder-dev-tools-overview"),t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),setTimeout(()=>{t.removeAttribute("aria-hidden")},32)};var Ai=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",Ue),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",ct);let t=document.querySelector("builder-dev-tools-menu");t||(t=document.createElement("builder-dev-tools-menu"),t.setAttribute("data-version","1.1.12"),document.body.appendChild(t));let e=document.querySelector("builder-dev-tools-edit");e||(e=document.createElement("builder-dev-tools-edit"),document.body.appendChild(e));let n=document.getElementById("builder-dev-tools-style");n||(n=document.createElement("style"),n.id="builder-dev-tools-style",n.innerHTML=".builder-no-scroll{overflow:hidden !important}",document.head.appendChild(n)),Mr(),Lr()}catch(t){console.error("Builder Devtools:",t)}};window.location===window.parent.location&&(console.debug("Builder.io Devtools v1.1.12"),Ai());})();`)}async function Q(e){return
|
|
75
|
+
\`,Ri();let n=new URL(yn,Oe);n.searchParams.set(gn,location.href);let r=e.querySelectorAll(".next-step");for(let i of r)i.setAttribute("href",n.href);oe("overview step viewed")}},Ri=()=>{let t=document.head.querySelector("link[rel='icon'], link[rel='icon shortcut']");t?(t.href="https://cdn.builder.io/favicon.ico",t.removeAttribute("type")):(t=document.createElement("link"),t.rel="icon",t.href="https://cdn.builder.io/favicon.ico",document.head.appendChild(t))};var Mr=async()=>{(await Tn()).isValid||Di()},Di=()=>{customElements.get("builder-dev-tools-overview")||customElements.define("builder-dev-tools-overview",lt);let t=document.querySelector("builder-dev-tools-overview");t||(t=document.createElement("builder-dev-tools-overview"),t.setAttribute("aria-hidden","true"),document.body.appendChild(t)),setTimeout(()=>{t.removeAttribute("aria-hidden")},32)};var Ai=()=>{try{customElements.get("builder-dev-tools-edit")||customElements.define("builder-dev-tools-edit",Ue),customElements.get("builder-dev-tools-menu")||customElements.define("builder-dev-tools-menu",ct);let t=document.querySelector("builder-dev-tools-menu");t||(t=document.createElement("builder-dev-tools-menu"),t.setAttribute("data-version","1.1.12"),document.body.appendChild(t));let e=document.querySelector("builder-dev-tools-edit");e||(e=document.createElement("builder-dev-tools-edit"),document.body.appendChild(e));let n=document.getElementById("builder-dev-tools-style");n||(n=document.createElement("style"),n.id="builder-dev-tools-style",n.innerHTML=".builder-no-scroll{overflow:hidden !important}",document.head.appendChild(n)),Mr(),Lr()}catch(t){console.error("Builder Devtools:",t)}};window.location===window.parent.location&&(console.debug("Builder.io Devtools v1.1.12"),Ai());})();`)}async function Q(e){return W(e,`<!DOCTYPE html>
|
|
76
76
|
<html lang="en" dir="ltr">
|
|
77
77
|
<head>
|
|
78
78
|
<meta charset="utf-8" />
|
|
@@ -246,4 +246,4 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
|
|
|
246
246
|
</script>
|
|
247
247
|
</body>
|
|
248
248
|
</html>
|
|
249
|
-
`)}async function
|
|
249
|
+
`)}async function W(e,t){let r=await L(e),o=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,r).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,o.length?o[0].name:"")}var q=require("os");async function G(e,t){let r=new URL("/cli-auth","https://builder.io");r.searchParams.set("client_id",e.getClientId()),r.searchParams.set("host",await e.getDeviceId()),r.searchParams.set("response_type","code"),r.searchParams.set("cli","true");let o=new URL(f,e.devToolsServerUrl);o.searchParams.set(A,(0,q.platform)()),o.searchParams.set(P,process.versions.node);let n=e.getFrameworks();return n.length>0&&(r.searchParams.set(y,n[0].name),o.searchParams.set(y,n[0].name)),r.searchParams.set("redirect_url",o.href),r.searchParams.set("preview_url",t),r.href}async function X(e,t,r,o){try{if(!e)return m(r,o,400,"Builder context closed");let n=he(r);if(n.pathname===C){if(r.method==="POST"){let i=await fe(r);if(i)try{let s=await K(e,JSON.parse(i));return z(r,o,200,s)}catch(s){e.debug("Dev API Error",s.stack||s.message||s);let a={errors:[String(s.message||s)]};return z(r,o,500,a)}}else if(r.method==="OPTIONS"){let i={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version"},s=r.headers.origin;s&&s!=="null"?Y(new URL(s))&&(i["Access-Control-Allow-Origin"]=s):i["Access-Control-Allow-Origin"]="*",o.writeHead(200,i),o.end();return}return m(r,o,405,`${C} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(n.pathname===O)return pe(r,o,200,await J(e));if(n.pathname===R){let i=n.searchParams.get(b);return i?ge(o,302,await G(e,i)):m(r,o,400,`Missing ${b} querystring`)}return n.pathname===f?me(r,o,200,await Q(e)):n.pathname===d?(e.debug(`Close Dev Tools Server Requested: ${n.href}`),setTimeout(()=>{try{t.close(i=>{e.debug(`Dev Tools Server Closed Error: ${i}`)})}catch(i){e.debug(`Error closing devtools server: ${i}`)}},20),m(r,o,200,"Closing Dev Tools Server")):m(r,o,404,"Not found")}catch(n){return console.error("Dev Server Error",n),m(r,o,500,`Dev Server Error: ${n}`)}}function z(e,t,r,o){v(e,t,r,"application/json",JSON.stringify(o))}function pe(e,t,r,o){v(e,t,r,"application/javascript",o)}function me(e,t,r,o){v(e,t,r,"text/html",o)}function m(e,t,r,o){v(e,t,r,"text/plain",o)}function v(e,t,r,o,n){let i={"Content-Type":`${o}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.1.12"},s=e.headers.origin;s&&s!=="null"?Y(new URL(s))&&(i["Access-Control-Allow-Origin"]=s):i["Access-Control-Allow-Origin"]="*",t.writeHead(r,i),t.end(n)}function Y(e){return e.hostname==="localhost"||e.origin.endsWith(".builder.io")?!0:e.port===""?!1:e.port!=="80"&&e.port!=="443"}function ge(e,t,r){e.writeHead(t,{Location:r}),e.end()}async function fe(e){let t="";for await(let r of e)t+=r;return t}function he(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function Z(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await ve(e),r=(0,S.createServer)((n,i)=>{X(e,r,n,i)}),o=()=>new Promise((n,i)=>{r.listening?(e.debug(`closing devtools server on port ${t}`),r.close(s=>{e=null,s?(e.debug(`error closing devtools server on port ${t}`),i(s)):(e&&e.debug(`closed devtools server on port ${t}`),n())})):(e.debug(`devtools server on port ${t} not listening`),n())});return process.once("SIGTERM",o),process.once("SIGINT",o),process.env.CI!=="true"&&process.stdin.on("end",o),globalThis.__builderDevToolsServer={url:new URL(`http://localhost:${t}`).href,port:t,setContext:n=>{e.debug(`set devtools context on server ${t}`),e=n},close:async()=>{globalThis.__builderDevToolsServer=null,await o()}},new Promise(n=>{r.listen(t,()=>{e.debug(`started devtools server on port ${t}`),n(globalThis.__builderDevToolsServer)})})}function ve(e){return new Promise(t=>{let r=e.port;try{(0,S.request)({hostname:"localhost",port:r,path:d,method:"GET"},n=>{n.on("end",()=>{e.debug(`${d} - Response ended`),t(r)})}).on("error",n=>{e.debug(`${d} - No response ${n}`),t(r)}).end()}catch(o){e.debug(`${d} - Error ${o}`),t(r)}})}async function ee(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},r=e.getFrameworks().map(i=>i.name).join(", ");t.debug(`create devtools ${D} [${r}]`);let o=await Z(t);return t.devToolsServerUrl=o.url,t.port=o.port,{getUrl:()=>t.devToolsServerUrl}}var D="1.1.12";0&&(module.exports={createDevToolsServer,version});
|
package/server/index.mjs
CHANGED
|
@@ -4,7 +4,7 @@ ${u}`)}else o(`Request to ${e.url.href} failed with status ${n.statusCode}: ${a}
|
|
|
4
4
|
id
|
|
5
5
|
name
|
|
6
6
|
}
|
|
7
|
-
}`};e.debug(`Get model id for model name "${t.model}"`);let i=(await p({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)})).data.models.find(u=>u.name===t.model);if(!i)return e.debug(`No model found for model name "${t.model}"`),!1;e.debug(`Data query, modelId: "${i.id}", urlPath: "${t.pageUrl}"`);let n=new URL("https://cdn.builder.io/api/v3/data");n.searchParams.set("limit","1"),n.searchParams.set("cachebust","true"),n.searchParams.set("collection","content"),n.searchParams.set("query.published.$ne","archived"),n.searchParams.set("query.query.$elemMatch.$and[0].property","urlPath"),n.searchParams.set("query.query.$elemMatch.$and[0].operator","is"),n.searchParams.set("query.query.$elemMatch.$and[0].value",t.pageUrl),n.searchParams.set("query.modelId",i.id),n.searchParams.set("apiKey",t.publicApiKey);let a=await p({url:n,method:"GET"});return e.debug(`Data results (${a.results.length}): ${n.href}`),a.results.length>0}async function h(e,t){let r=new URL(`https://cdn.builder.io/api/v3/content/${t.model}`);r.searchParams.set("apiKey",t.publicApiKey),r.searchParams.set("cachebust","true"),r.searchParams.set("cb",Date.now().toString()),t.pageUrl&&(r.searchParams.set("url",t.pageUrl),e.debug(`get model: "${t.model}", pageUrl: "${t.pageUrl}":`,r.href)),t.id&&(r.searchParams.set("query.id",t.id),e.debug(`get model: "${t.model}", id: "${t.id}":`,r.href));let o=await p({url:r,method:"GET"});return e.debug(`get content results: ${o.results.length}`),o}async function I(e,t){let r=new URL(`https://cdn.builder.io/api/v1/write/${t.model}`);e.debug(`writing "${t.model}" content:`,r.href),await p({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`},body:t.body})}var c="page",$="integration-welcome-screens",U="8d9ee72a33344b4b867918b442ebd0af";async function N(e,t){let r=await h(e,{model:$,publicApiKey:U,id:t.templateContentId});if(!Array.isArray(r?.results)||r.results.length===0||!r.results[0].data?.blocks)throw new Error(`No Builder content found for id ${t.templateContentId}`);let o=JSON.stringify(r.results[0].data.blocks),s=Z(t.publicApiKey,t.pathname,t.title,o);await I(e,{privateAuthKey:t.privateAuthKey,model:c,body:s})}function Z(e,t,r,o){return JSON.stringify({name:r,ownerId:e,published:"published",query:[{property:"urlPath",value:[t],operator:"is"}],data:{title:r,blocksString:o}})}async function F(e,t,r){e.debug(`connect builder with public key: ${t}`),e.publicApiKey=t;let o=e.closeAppServer(),s=await e.setPublicApiKey({publicApiKey:t});e.debug(`set public key: process.env.${s.envKey}=${t}`),process.env[s.envKey]=t;let i=await e.builderPageOptions();e.debug(`builder model: ${c}, path: ${i.pathname}, template: ${i.templateContentId}`);let n=await L(e,{model:c,pageUrl:i.pathname,publicApiKey:t,privateAuthKey:r});if(!n){await N(e,{templateContentId:i.templateContentId,pathname:i.pathname,title:i.title,publicApiKey:t,privateAuthKey:r});let l=5,g=0;for(;!n&&g<l;){await new Promise(
|
|
7
|
+
}`};e.debug(`Get model id for model name "${t.model}"`);let i=(await p({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`,"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify(o)})).data.models.find(u=>u.name===t.model);if(!i)return e.debug(`No model found for model name "${t.model}"`),!1;e.debug(`Data query, modelId: "${i.id}", urlPath: "${t.pageUrl}"`);let n=new URL("https://cdn.builder.io/api/v3/data");n.searchParams.set("limit","1"),n.searchParams.set("cachebust","true"),n.searchParams.set("collection","content"),n.searchParams.set("query.published.$ne","archived"),n.searchParams.set("query.query.$elemMatch.$and[0].property","urlPath"),n.searchParams.set("query.query.$elemMatch.$and[0].operator","is"),n.searchParams.set("query.query.$elemMatch.$and[0].value",t.pageUrl),n.searchParams.set("query.modelId",i.id),n.searchParams.set("apiKey",t.publicApiKey);let a=await p({url:n,method:"GET"});return e.debug(`Data results (${a.results.length}): ${n.href}`),a.results.length>0}async function h(e,t){let r=new URL(`https://cdn.builder.io/api/v3/content/${t.model}`);r.searchParams.set("apiKey",t.publicApiKey),r.searchParams.set("cachebust","true"),r.searchParams.set("cb",Date.now().toString()),t.pageUrl&&(r.searchParams.set("url",t.pageUrl),e.debug(`get model: "${t.model}", pageUrl: "${t.pageUrl}":`,r.href)),t.id&&(r.searchParams.set("query.id",t.id),e.debug(`get model: "${t.model}", id: "${t.id}":`,r.href));let o=await p({url:r,method:"GET"});return e.debug(`get content results: ${o.results.length}`),o}async function I(e,t){let r=new URL(`https://cdn.builder.io/api/v1/write/${t.model}`);e.debug(`writing "${t.model}" content:`,r.href),await p({url:r,method:"POST",headers:{Authorization:`Bearer ${t.privateAuthKey}`},body:t.body})}var c="page",$="integration-welcome-screens",U="8d9ee72a33344b4b867918b442ebd0af";async function N(e,t){let r=await h(e,{model:$,publicApiKey:U,id:t.templateContentId});if(!Array.isArray(r?.results)||r.results.length===0||!r.results[0].data?.blocks)throw new Error(`No Builder content found for id ${t.templateContentId}`);let o=JSON.stringify(r.results[0].data.blocks),s=Z(t.publicApiKey,t.pathname,t.title,o);await I(e,{privateAuthKey:t.privateAuthKey,model:c,body:s})}function Z(e,t,r,o){return JSON.stringify({name:r,ownerId:e,published:"published",query:[{property:"urlPath",value:[t],operator:"is"}],data:{title:r,blocksString:o}})}async function F(e,t,r){e.debug(`connect builder with public key: ${t}`),e.publicApiKey=t;let o=e.closeAppServer(),s=await e.setPublicApiKey({publicApiKey:t});e.debug(`set public key: process.env.${s.envKey}=${t}`),process.env[s.envKey]=t;let i=await e.builderPageOptions();e.debug(`builder model: ${c}, path: ${i.pathname}, template: ${i.templateContentId}`);let n=await L(e,{model:c,pageUrl:i.pathname,publicApiKey:t,privateAuthKey:r});if(!n){await N(e,{templateContentId:i.templateContentId,pathname:i.pathname,title:i.title,publicApiKey:t,privateAuthKey:r});let l=5,g=0;for(;!n&&g<l;){await new Promise(q=>setTimeout(q,1e3));let w=await O({model:c,pageUrl:i.pathname,publicApiKey:t,privateAuthKey:r});g++,w&&w.length>0&&(n=!0)}}await o,e.debug("ensure builder setup");let a=await e.ensureBuilderSetup();s.modifiedType&&a.push({filePath:s.file,modifiedType:s.modifiedType}),a.forEach(l=>{l.displayFilePath=e.relative(e.getRootDir(),l.filePath)}),a.sort((l,g)=>l.filePath.localeCompare(g.filePath)),a.length>0?(e.debug(`modified files: ${a.map(l=>l.displayFilePath).join(", ")}`),await e.restartAppServer(),await new Promise(l=>setTimeout(l,500))):e.debug("no modified files");let u={success:!0,pathname:i.localePathname||i.pathname,modifiedFiles:a,platform:e.platform()};return e.debug(`connected builder: ${u.pathname}`),u}async function k(e){let t=await e.builderPageOptions();e.debug(`validateBuilder, pathname: ${t.pathname}, localePathname: ${t.localePathname}, isValid: ${e.isValid}`);let r={isValid:e.isValid,pathname:t.localePathname||t.pathname,platform:e.platform()};if(e.isValid)return r;let o=await e.getPublicApiKey();return o.envValue?(e.debug(`public api key: ${o.envValue}, ${o.file}`),e.publicApiKey=o.envValue,(await h(e,{model:c,publicApiKey:o.envValue})).results.length===0?(e.debug("missing homepage content"),r):(e.debug("builder connection is valid"),r.isValid=!0,e.isValid=!0,r)):(e.debug("missing public api key"),r)}async function M(e,t){let r={type:t.type};switch(t.type){case"getCache":{r.data=await e.getCache();break}case"setCache":{await e.setCache(t.data);break}case"connectBuilder":{r.data=await F(e,t.data.publicApiKey,t.data.privateAuthKey);break}case"enableDevTools":{r.data=te(e,t.data.enabled);break}case"getRegistry":{r.data=await e.getRegistry(t.data);break}case"launchEditor":{r.data=await e.launchEditor(t.data);break}case"validateBuilder":{r.data=await k(e);break}case"loadComponent":{r.data=await e.loadComponent(t.data);break}case"registerComponent":{r.data=await e.registerComponent(t.data),e.serverShouldRestart=!0;break}case"setComponentInfo":{r.data=await e.setRegisteredComponentInfo(t.data),e.serverShouldRestart=!0;break}case"setComponentInput":{r.data=await e.setRegisteredComponentInput(t.data),e.serverShouldRestart=!0;break}case"unregisterComponent":{r.data=await e.unregisterComponent(t.data),e.serverShouldRestart=!0;break}case"getFrameworks":{r.data=e.getFrameworks();break}case"readdir":{C(t.path)?r.data=await e.readdir(t.path,!0):r.errors=[`Invalid file request: ${t.path}`];break}case"readFile":{C(t.path)?r.data=await e.readFile(t.path):r.errors=[`Invalid file request: ${t.path}`];break}case"writeFile":{C(t.path)?await e.writeFile(t.path,t.content):r.errors=[`Invalid file request: ${t.path}`];break}case"ensureFigmaImportPage":{r.data=await e.ensureFigmaImportPage();break}case"transileFile":{r.data=await R(e,t);break}case"transileModule":{r.data=y(e,t);break}case"getPastSyncInfo":{r.data=await e.getPastSyncInfo?.(t.data);break}case"resyncSnippet":{r.data=await e.resyncSnippet?.(t.data);break}default:{r.errors=[`Unknown request type: ${JSON.stringify(t)}`];let o=t}}return r}function C(e){if(!e||e.includes(".."))return!1;e=e.replace(/\\/g,"/");let t=e.split("/"),r=t[t.length-1];if(r.length>0){let o=r.split(".").pop();if(o&&(o=`.${o}`.toLocaleLowerCase(),o=o.split("?")[0],!ee.includes(o)))return!1}return!0}var ee=[".js",".jsx",".ts",".tsx",".json",".css",".scss",".sass",".less",".html",".htm",".xml",".svg",".png",".jpg",".jpeg",".gif",".ico",".webp",".woff",".woff2",".ttf",".eot",".mp4",".webm",".ogg",".md",".txt",".csv",".pdf"];function te(e,t){return!t&&e.serverShouldRestart&&setTimeout(()=>{console.log(`
|
|
8
8
|
Restarting server after Builder Devtools update...
|
|
9
9
|
`),e.restartAppServer()},10),e.enableAppWatch(!t),{enabled:t,platform:e.platform()}}async function x(e){return B(e,`"use strict";(()=>{var Br=Object.defineProperty;var Fr=(t,e)=>{for(var n in e)Br(t,n,{get:e[n],enumerable:!0})};var G=(t,e)=>{Tt(t);let n=t.querySelector("aside");n.dataset.view=e,n.classList.remove("section-ready"),setTimeout(()=>{n.classList.add("section-ready")},200)},pn=t=>{Array.from(t.querySelectorAll(".back-button")).forEach(e=>{e.addEventListener("click",n=>{Tt(t),n.preventDefault(),n.stopPropagation();let r=n.target;G(t,r?.dataset.back||"nav-home")})})},Et=(t,e)=>{Tt(t);let n=t.querySelector("aside"),r=document.createElement("div");r.className="ui-toast",r.innerHTML=e,n.appendChild(r),setTimeout(()=>{r.classList.add("ui-toast-show"),setTimeout(()=>{r.classList.remove("ui-toast-show"),setTimeout(()=>{r.remove()},500)},4e3)},30)},Tt=t=>{let e=t.querySelector("aside");Array.from(e.querySelectorAll(".ui-toast")).forEach(r=>{r.classList.remove("ui-toast-show")})},ke=()=>{let t=fn();return localStorage.getItem(t)!=="true"},bt=t=>{let e=fn();t?localStorage.removeItem(e):localStorage.setItem(e,"true")},fn=()=>Vr("disableEdit"),Vr=t=>\`builder.__LOCAL_APP_ID__.\${t}\`,mn=()=>{let e=document.body.querySelector("[builder-content-id]")?.getAttribute("builder-content-id");return Ee(e)},Ee=(t,e)=>{let n="/content";t&&(n+="/"+t+"/edit");let r=new URL(n,"https://builder.io");t&&e&&r.searchParams.set("selectedBlock",e);let i=new URL(location.pathname,location.href);return r.searchParams.set("overridePreviewUrl",i.href),r.href},Oe="__DEV_TOOLS_URL__",O={components:[],registryPath:"",registryDisplayPath:"",frameworks:[],dependencies:[],publicApiKey:void 0,devToolsVersion:""},X=t=>{O.components=t.components,O.registryPath=t.registryPath,O.registryDisplayPath=t.registryDisplayPath,O.dependencies=t.dependencies,O.publicApiKey=t.publicApiKey};function vn(t){let e=null,n=document.querySelector("builder-dev-tools-menu"),r=()=>{t.hide()},i=u=>{let c=u.target;if(!c){r();return}if(c.closest("builder-dev-tools-edit"))return;let a=c.closest("[builder-content-id]"),l=c.closest("[builder-id]");if(!a||!l){t.hide();return}let d=t.show(a,l);!d||d===e||(n.highlightOpener(),e=d)};document.addEventListener("pointerover",i,{passive:!0}),document.addEventListener("pointerleave",r,{passive:!0}),document.addEventListener("pointercancel",r,{passive:!0}),document.addEventListener("visibilitychange",r,{passive:!0}),window.addEventListener("popstate",r,{passive:!0});let o=history.pushState;history.pushState=function(...u){t.hide(),o.apply(this,u)};let s=history.replaceState;history.replaceState=function(...u){t.hide(),s.apply(this,u)}}var Ue=class extends HTMLElement{constructor(){super();this.openInBuilder=null;this.block=null}connectedCallback(){this.setAttribute("aria-hidden","true");let n=this.attachShadow({mode:"open"});n.innerHTML='<style>*,*:before,*:after{box-sizing:border-box}:host{--background-color: rgba(40, 40, 40, 1);--primary-color: rgba(72, 161, 255, 1);--primary-color-subdued: rgb(72, 161, 255, .6);--primary-color-highlight: rgb(126, 188, 255);--primary-contrast-color: white;--edit-color: #1d74e2;--edit-color-highlight: #1c6bd1;--edit-color-alpha: rgb(72, 161, 255, .15);--error-color: #ff2b55;--text-color: white;--text-color-highlight: white;--border-color: #454545;--button-background-color-hover: rgba(255, 255, 255, .1);--menu-width: 320px;--transition-time: .15s;--font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";font-family:var(--font-family);line-height:1.6}button{cursor:pointer;color:var(--text-color);-webkit-tap-highlight-color:transparent}input,select,button{font-family:var(--font-family)}:host{display:none;position:absolute;top:0;left:0;width:100%;height:100%;z-index:2147483646;user-select:none;pointer-events:none;color:var(--text-color)}#content-highlight,#block{position:absolute}#content-highlight{border:3px solid var(--primary-color);background-color:var(--primary-color-alpha)}a{position:absolute;top:-33px;left:0;display:block;padding:5px 10px 8px;pointer-events:auto;z-index:100;text-decoration:none}a:hover{text-decoration:none}a span{display:block;padding:3px 6px;font-size:10px;font-weight:300;border-radius:3px;text-align:center;text-decoration:none;pointer-events:none;background-color:var(--edit-color);color:var(--text-color);white-space:nowrap}a:hover span{background-color:var(--edit-color-highlight)}a:hover~.outline{border-color:var(--edit-color-highlight)}#open-in-editor{display:none}.outline{position:absolute;top:0;left:0;width:100%;height:100%;border:1px solid var(--edit-color);background-color:var(--edit-color-alpha)}</style><div id="block"> <a id="open-in-builder" target="builder"><span>Open In Builder</span></a> <a id="open-in-editor" href="#open-in-editor"><span>Open In Editor</span></a> <div class="outline"></div> </div>',this.openInBuilder=n.getElementById("open-in-builder"),this.block=n.getElementById("block"),vn(this)}show(n,r){if(!ke())return this.hide(),null;let i=n.getAttribute("builder-content-id"),o=r.getAttribute("builder-id");if(!i||!o)return this.hide(),null;let s=this.block,u=this.openInBuilder,c=r.getBoundingClientRect();s.style.top=c.top+window.scrollY-1+"px",s.style.left=c.left+window.scrollX+"px",s.style.width=c.width+"px",s.style.height=c.height+1+"px";let a=u.getBoundingClientRect();if(a.width>c.width){let l=a.width-c.width;u.style.left=l/2*-1+"px"}else u.style.left="";return u.href=Ee(i,o),this.style.display="block",o}hide(){this.style.display=""}};var gn="preview-url";var hn="_b-uid";var yn="/~builder-connect";var _n="/~builder-dev-tools";var En="https://cdn.builder.io/api/v1/proxy-api?url=https://api2.amplitude.com/2/httpapi";var Tn=()=>z({type:"validateBuilder"}),ve=t=>z({type:"launchEditor",data:t}),bn=t=>z({type:"getRegistry",data:t}),In=t=>z({type:"loadComponent",data:t}),Sn=t=>z({type:"registerComponent",data:t}),xn=t=>z({type:"setComponentInfo",data:t}),Ne=t=>z({type:"setComponentInput",data:t}),wn=t=>z({type:"unregisterComponent",data:t}),Ln=t=>z({type:"enableDevTools",data:{enabled:t}}),z=async t=>{let e=new URL(_n,Oe),n;try{n=await fetch(e,{method:"POST",body:JSON.stringify(t)})}catch(i){throw console.error(\`Devtools Fetch Error, \${e.href}\`,i),new Error("Builder Devtools Fetch Error")}if((n.headers.get("content-type")||"").includes("application/json")){let i=await n.json();if(n.ok)return i.data;if(Array.isArray(i.errors)&&i.errors.length>0)throw i.errors.forEach(o=>console.error(o)),new Error(\`Builder Devtools Fetch Error: \${i.errors[0]}\`)}throw new Error(\`Builder Devtools Fetch Error: \${n.status}, \${await n.text()}\`)};var Pn=[{value:"boolean",text:"boolean"},{value:"color",text:"color (provides a color in hex or rgb)"},{value:"date",text:"date (same format as the Date constructor)"},{value:"email",text:"email"},{value:"file",text:"file (uploads a file and provides a url)"},{value:"list",text:"list (collection of items)"},{value:"longText",text:"longText (multiline text editor)"},{value:"number",text:"number"},{value:"object",text:"object (set of specific names and values)"},{value:"richText",text:"richText (provides value as html)"},{value:"string",text:"string"}],Me=["color","date","email","file","longText","richText","string"],Be=["number"],Fe=["boolean"],Ve=["list"],He=["object"];function qe(t){return Me.includes(t)?"string":Be.includes(t)?"number":Fe.includes(t)?"boolean":Ve.includes(t)?"array":He.includes(t)?"object":"string"}var ji=new Set(["about","accessKey","accessKeyLabel","asChild","autoCapitalize","autoCorrect","autoFocus","autoSave","blur","contentEditable","contextMenu","dangerouslySetInnerHTML","datatype","defaultChecked","defaultValue","dir","draggable","enterKeyHint","focus","form","formAction","formEncType","formMethod","formNoValidate","formTarget","inlist","innerText","inputMode","is","isContentEditable","itemID","itemProp","itemRef","itemScope","itemType","lang","nonce","offsetHeight","offsetLeft","offsetTop","offsetWidth","outerText","prefix","property","radioGroup","rel","resource","results","rev","role","security","slot","spellCheck","suppressContentEditableWarning","suppressHydrationWarning","tabIndex","translate","typeof","unselectable","vocab"].map(t=>t.toLowerCase()));var It=function(t,e){return It=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,r){n.__proto__=r}||function(n,r){for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(n[i]=r[i])},It(t,e)};function V(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");It(t,e);function n(){this.constructor=t}t.prototype=e===null?Object.create(e):(n.prototype=e.prototype,new n)}var v=function(){return v=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},v.apply(this,arguments)};function Te(t,e){var n={};for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&e.indexOf(r)<0&&(n[r]=t[r]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(t);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(t,r[i])&&(n[r[i]]=t[r[i]]);return n}function p(t,e,n,r){function i(o){return o instanceof n?o:new n(function(s){s(o)})}return new(n||(n=Promise))(function(o,s){function u(l){try{a(r.next(l))}catch(d){s(d)}}function c(l){try{a(r.throw(l))}catch(d){s(d)}}function a(l){l.done?o(l.value):i(l.value).then(u,c)}a((r=r.apply(t,e||[])).next())})}function f(t,e){var n={label:0,sent:function(){if(o[0]&1)throw o[1];return o[1]},trys:[],ops:[]},r,i,o,s;return s={next:u(0),throw:u(1),return:u(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function u(a){return function(l){return c([a,l])}}function c(a){if(r)throw new TypeError("Generator is already executing.");for(;s&&(s=0,a[0]&&(n=0)),n;)try{if(r=1,i&&(o=a[0]&2?i.return:a[0]?i.throw||((o=i.return)&&o.call(i),0):i.next)&&!(o=o.call(i,a[1])).done)return o;switch(i=0,o&&(a=[a[0]&2,o.value]),a[0]){case 0:case 1:o=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,i=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(o=n.trys,!(o=o.length>0&&o[o.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!o||a[1]>o[0]&&a[1]<o[3])){n.label=a[1];break}if(a[0]===6&&n.label<o[1]){n.label=o[1],o=a;break}if(o&&n.label<o[2]){n.label=o[2],n.ops.push(a);break}o[2]&&n.ops.pop(),n.trys.pop();continue}a=e.call(t,n)}catch(l){a=[6,l],i=0}finally{r=o=0}if(a[0]&5)throw a[1];return{value:a[0]?a[1]:void 0,done:!0}}}function W(t){var e=typeof Symbol=="function"&&Symbol.iterator,n=e&&t[e],r=0;if(n)return n.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&r>=t.length&&(t=void 0),{value:t&&t[r++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function w(t,e){var n=typeof Symbol=="function"&&t[Symbol.iterator];if(!n)return t;var r=n.call(t),i,o=[],s;try{for(;(e===void 0||e-- >0)&&!(i=r.next()).done;)o.push(i.value)}catch(u){s={error:u}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(s)throw s.error}}return o}function q(t,e,n){if(n||arguments.length===2)for(var r=0,i=e.length,o;r<i;r++)(o||!(r in e))&&(o||(o=Array.prototype.slice.call(e,0,r)),o[r]=e[r]);return t.concat(o||Array.prototype.slice.call(e))}var Cn="Event tracked successfully",Rn="Unexpected error occurred",Dn="Event rejected due to exceeded retry count",An="Event skipped due to optOut config",kn="Event rejected due to missing API key",On="Invalid API key",Un="Client not initialized";var Ge={};Fr(Ge,{IdentifyOperation:()=>L,LogLevel:()=>N,OfflineDisabled:()=>Ke,RevenueProperty:()=>$,ServerZone:()=>je,SpecialEventType:()=>Z,Status:()=>x});var L;(function(t){t.SET="$set",t.SET_ONCE="$setOnce",t.ADD="$add",t.APPEND="$append",t.PREPEND="$prepend",t.REMOVE="$remove",t.PREINSERT="$preInsert",t.POSTINSERT="$postInsert",t.UNSET="$unset",t.CLEAR_ALL="$clearAll"})(L||(L={}));var $;(function(t){t.REVENUE_PRODUCT_ID="$productId",t.REVENUE_QUANTITY="$quantity",t.REVENUE_PRICE="$price",t.REVENUE_TYPE="$revenueType",t.REVENUE="$revenue"})($||($={}));var Z;(function(t){t.IDENTIFY="$identify",t.GROUP_IDENTIFY="$groupidentify",t.REVENUE="revenue_amount"})(Z||(Z={}));var N;(function(t){t[t.None=0]="None",t[t.Error=1]="Error",t[t.Warn=2]="Warn",t[t.Verbose=3]="Verbose",t[t.Debug=4]="Debug"})(N||(N={}));var je;(function(t){t.US="US",t.EU="EU"})(je||(je={}));var x;(function(t){t.Unknown="unknown",t.Skipped="skipped",t.Success="success",t.RateLimit="rate_limit",t.PayloadTooLarge="payload_too_large",t.Invalid="invalid",t.Failed="failed",t.Timeout="Timeout",t.SystemError="SystemError"})(x||(x={}));var Ke=null;var J=function(t,e,n){return e===void 0&&(e=0),n===void 0&&(n=x.Unknown),{event:t,code:e,message:n}};var Y=function(t){return t?(t^Math.random()*16>>t/4).toString(16):(String(1e7)+String(-1e3)+String(-4e3)+String(-8e3)+String(-1e11)).replace(/[018]/g,Y)};var Nn=function(){function t(e){this.client=e,this.queue=[],this.applying=!1,this.plugins=[]}return t.prototype.register=function(e,n){var r,i,o;return p(this,void 0,void 0,function(){return f(this,function(s){switch(s.label){case 0:return e.name=(r=e.name)!==null&&r!==void 0?r:Y(),e.type=(i=e.type)!==null&&i!==void 0?i:"enrichment",[4,(o=e.setup)===null||o===void 0?void 0:o.call(e,n,this.client)];case 1:return s.sent(),this.plugins.push(e),[2]}})})},t.prototype.deregister=function(e){var n;return p(this,void 0,void 0,function(){var r,i;return f(this,function(o){switch(o.label){case 0:return r=this.plugins.findIndex(function(s){return s.name===e}),i=this.plugins[r],this.plugins.splice(r,1),[4,(n=i.teardown)===null||n===void 0?void 0:n.call(i)];case 1:return o.sent(),[2]}})})},t.prototype.reset=function(e){this.applying=!1;var n=this.plugins;n.map(function(r){var i;return(i=r.teardown)===null||i===void 0?void 0:i.call(r)}),this.plugins=[],this.client=e},t.prototype.push=function(e){var n=this;return new Promise(function(r){n.queue.push([e,r]),n.scheduleApply(0)})},t.prototype.scheduleApply=function(e){var n=this;this.applying||(this.applying=!0,setTimeout(function(){n.apply(n.queue.shift()).then(function(){n.applying=!1,n.queue.length>0&&n.scheduleApply(0)})},e))},t.prototype.apply=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c,y,g,a,l,d,m,y,g,T,h,_,U,b,A,F;return f(this,function(I){switch(I.label){case 0:if(!e)return[2];n=w(e,1),r=n[0],i=w(e,2),o=i[1],s=this.plugins.filter(function(S){return S.type==="before"}),I.label=1;case 1:I.trys.push([1,6,7,8]),u=W(s),c=u.next(),I.label=2;case 2:return c.done?[3,5]:(y=c.value,y.execute?[4,y.execute(v({},r))]:[3,4]);case 3:if(g=I.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,I.label=4;case 4:return c=u.next(),[3,2];case 5:return[3,8];case 6:return a=I.sent(),U={error:a},[3,8];case 7:try{c&&!c.done&&(b=u.return)&&b.call(u)}finally{if(U)throw U.error}return[7];case 8:l=this.plugins.filter(function(S){return S.type==="enrichment"||S.type===void 0}),I.label=9;case 9:I.trys.push([9,14,15,16]),d=W(l),m=d.next(),I.label=10;case 10:return m.done?[3,13]:(y=m.value,y.execute?[4,y.execute(v({},r))]:[3,12]);case 11:if(g=I.sent(),g===null)return o({event:r,code:0,message:""}),[2];r=g,I.label=12;case 12:return m=d.next(),[3,10];case 13:return[3,16];case 14:return T=I.sent(),A={error:T},[3,16];case 15:try{m&&!m.done&&(F=d.return)&&F.call(d)}finally{if(A)throw A.error}return[7];case 16:return h=this.plugins.filter(function(S){return S.type==="destination"}),_=h.map(function(S){var k=v({},r);return S.execute(k).catch(function(B){return J(k,0,String(B))})}),Promise.all(_).then(function(S){var k=w(S,1),B=k[0],Q=B||J(r,100,"Event not tracked, no destination plugins on the instance");o(Q)}),[2]}})})},t.prototype.flush=function(){return p(this,void 0,void 0,function(){var e,n,r,i=this;return f(this,function(o){switch(o.label){case 0:return e=this.queue,this.queue=[],[4,Promise.all(e.map(function(s){return i.apply(s)}))];case 1:return o.sent(),n=this.plugins.filter(function(s){return s.type==="destination"}),r=n.map(function(s){return s.flush&&s.flush()}),[4,Promise.all(r)];case 2:return o.sent(),[2]}})})},t}();var St="-",le="AMP",xt="".concat(le,"_unsent"),wt="https://api2.amplitude.com/2/httpapi",Mn="https://api.eu.amplitude.com/2/httpapi",Bn="https://api2.amplitude.com/batch",Fn="https://api.eu.amplitude.com/batch";var Hr=1e3,We=function(t){if(Object.keys(t).length>Hr)return!1;for(var e in t){var n=t[e];if(!Lt(e,n))return!1}return!0},Lt=function(t,e){var n,r;if(typeof t!="string")return!1;if(Array.isArray(e)){var i=!0;try{for(var o=W(e),s=o.next();!s.done;s=o.next()){var u=s.value;if(Array.isArray(u))return!1;if(typeof u=="object")i=i&&We(u);else if(!["number","string"].includes(typeof u))return!1;if(!i)return!1}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}else{if(e==null)return!1;if(typeof e=="object")return We(e);if(!["number","string","boolean"].includes(typeof e))return!1}return!0};var ne=function(){function t(){this._propertySet=new Set,this._properties={}}return t.prototype.getUserProperties=function(){return v({},this._properties)},t.prototype.set=function(e,n){return this._safeSet(L.SET,e,n),this},t.prototype.setOnce=function(e,n){return this._safeSet(L.SET_ONCE,e,n),this},t.prototype.append=function(e,n){return this._safeSet(L.APPEND,e,n),this},t.prototype.prepend=function(e,n){return this._safeSet(L.PREPEND,e,n),this},t.prototype.postInsert=function(e,n){return this._safeSet(L.POSTINSERT,e,n),this},t.prototype.preInsert=function(e,n){return this._safeSet(L.PREINSERT,e,n),this},t.prototype.remove=function(e,n){return this._safeSet(L.REMOVE,e,n),this},t.prototype.add=function(e,n){return this._safeSet(L.ADD,e,n),this},t.prototype.unset=function(e){return this._safeSet(L.UNSET,e,St),this},t.prototype.clearAll=function(){return this._properties={},this._properties[L.CLEAR_ALL]=St,this},t.prototype._safeSet=function(e,n,r){if(this._validate(e,n,r)){var i=this._properties[e];return i===void 0&&(i={},this._properties[e]=i),i[n]=r,this._propertySet.add(n),!0}return!1},t.prototype._validate=function(e,n,r){return this._properties[L.CLEAR_ALL]!==void 0||this._propertySet.has(n)?!1:e===L.ADD?typeof r=="number":e!==L.UNSET&&e!==L.REMOVE?Lt(n,r):!0},t}();var Vn=function(t,e,n){var r=typeof t=="string"?{event_type:t}:t;return v(v(v({},r),n),e&&{event_properties:e})},be=function(t,e){var n=v(v({},e),{event_type:Z.IDENTIFY,user_properties:t.getUserProperties()});return n},Hn=function(t,e,n,r){var i,o=v(v({},r),{event_type:Z.GROUP_IDENTIFY,group_properties:n.getUserProperties(),groups:(i={},i[t]=e,i)});return o},qn=function(t,e,n){var r,i=new ne;i.set(t,e);var o=v(v({},n),{event_type:Z.IDENTIFY,user_properties:i.getUserProperties(),groups:(r={},r[t]=e,r)});return o},jn=function(t,e){return v(v({},e),{event_type:Z.REVENUE,event_properties:t.getEventProperties()})};var H=function(t){return{promise:t||Promise.resolve()}};var Pt=function(){function t(e){e===void 0&&(e="$default"),this.initializing=!1,this.q=[],this.dispatchQ=[],this.logEvent=this.track.bind(this),this.timeline=new Nn(this),this.name=e}return t.prototype._init=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return this.config=e,this.timeline.reset(this),[4,this.runQueuedFunctions("q")];case 1:return n.sent(),[2]}})})},t.prototype.runQueuedFunctions=function(e){return p(this,void 0,void 0,function(){var n,r,i,o,s,u,c;return f(this,function(a){switch(a.label){case 0:n=this[e],this[e]=[],a.label=1;case 1:a.trys.push([1,6,7,8]),r=W(n),i=r.next(),a.label=2;case 2:return i.done?[3,5]:(o=i.value,[4,o()]);case 3:a.sent(),a.label=4;case 4:return i=r.next(),[3,2];case 5:return[3,8];case 6:return s=a.sent(),u={error:s},[3,8];case 7:try{i&&!i.done&&(c=r.return)&&c.call(r)}finally{if(u)throw u.error}return[7];case 8:return[2]}})})},t.prototype.track=function(e,n,r){var i=Vn(e,n,r);return H(this.dispatch(i))},t.prototype.identify=function(e,n){var r=be(e,n);return H(this.dispatch(r))},t.prototype.groupIdentify=function(e,n,r,i){var o=Hn(e,n,r,i);return H(this.dispatch(o))},t.prototype.setGroup=function(e,n,r){var i=qn(e,n,r);return H(this.dispatch(i))},t.prototype.revenue=function(e,n){var r=jn(e,n);return H(this.dispatch(r))},t.prototype.add=function(e){return this.config?H(this.timeline.register(e,this.config)):(this.q.push(this.add.bind(this,e)),H())},t.prototype.remove=function(e){return this.config?H(this.timeline.deregister(e)):(this.q.push(this.remove.bind(this,e)),H())},t.prototype.dispatchWithCallback=function(e,n){if(!this.config)return n(J(e,0,Un));this.process(e).then(n)},t.prototype.dispatch=function(e){return p(this,void 0,void 0,function(){var n=this;return f(this,function(r){return this.config?[2,this.process(e)]:[2,new Promise(function(i){n.dispatchQ.push(n.dispatchWithCallback.bind(n,e,i))})]})})},t.prototype.process=function(e){return p(this,void 0,void 0,function(){var i,n,r,i;return f(this,function(o){switch(o.label){case 0:return o.trys.push([0,2,,3]),this.config.optOut?[2,J(e,0,An)]:[4,this.timeline.push(e)];case 1:return i=o.sent(),i.code===200?this.config.loggerProvider.log(i.message):i.code===100?this.config.loggerProvider.warn(i.message):this.config.loggerProvider.error(i.message),[2,i];case 2:return n=o.sent(),r=String(n),this.config.loggerProvider.error(r),i=J(e,0,r),[2,i];case 3:return[2]}})})},t.prototype.setOptOut=function(e){if(!this.config){this.q.push(this.setOptOut.bind(this,!!e));return}this.config.optOut=!!e},t.prototype.flush=function(){return H(this.timeline.flush())},t}();var Ct=function(){function t(){this.productId="",this.quantity=1,this.price=0}return t.prototype.setProductId=function(e){return this.productId=e,this},t.prototype.setQuantity=function(e){return e>0&&(this.quantity=e),this},t.prototype.setPrice=function(e){return this.price=e,this},t.prototype.setRevenueType=function(e){return this.revenueType=e,this},t.prototype.setRevenue=function(e){return this.revenue=e,this},t.prototype.setEventProperties=function(e){return We(e)&&(this.properties=e),this},t.prototype.getEventProperties=function(){var e=this.properties?v({},this.properties):{};return e[$.REVENUE_PRODUCT_ID]=this.productId,e[$.REVENUE_QUANTITY]=this.quantity,e[$.REVENUE_PRICE]=this.price,e[$.REVENUE_TYPE]=this.revenueType,e[$.REVENUE]=this.revenue,e},t}();var Kn=function(t,e){var n=Math.max(e,1);return t.reduce(function(r,i,o){var s=Math.floor(o/n);return r[s]||(r[s]=[]),r[s].push(i),r},[])};var $e="Amplitude Logger ",Ie=function(){function t(){this.logLevel=N.None}return t.prototype.disable=function(){this.logLevel=N.None},t.prototype.enable=function(e){e===void 0&&(e=N.Warn),this.logLevel=e},t.prototype.log=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Verbose||console.log("".concat($e,"[Log]: ").concat(e.join(" ")))},t.prototype.warn=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Warn||console.warn("".concat($e,"[Warn]: ").concat(e.join(" ")))},t.prototype.error=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Error||console.error("".concat($e,"[Error]: ").concat(e.join(" ")))},t.prototype.debug=function(){for(var e=[],n=0;n<arguments.length;n++)e[n]=arguments[n];this.logLevel<N.Debug||console.log("".concat($e,"[Debug]: ").concat(e.join(" ")))},t}();var Ye=function(){return{flushMaxRetries:12,flushQueueSize:200,flushIntervalMillis:1e4,instanceName:"$default_instance",logLevel:N.Warn,loggerProvider:new Ie,offline:!1,optOut:!1,serverUrl:wt,serverZone:"US",useBatch:!1}},Rt=function(){function t(e){var n,r,i,o;this._optOut=!1;var s=Ye();this.apiKey=e.apiKey,this.flushIntervalMillis=(n=e.flushIntervalMillis)!==null&&n!==void 0?n:s.flushIntervalMillis,this.flushMaxRetries=e.flushMaxRetries||s.flushMaxRetries,this.flushQueueSize=e.flushQueueSize||s.flushQueueSize,this.instanceName=e.instanceName||s.instanceName,this.loggerProvider=e.loggerProvider||s.loggerProvider,this.logLevel=(r=e.logLevel)!==null&&r!==void 0?r:s.logLevel,this.minIdLength=e.minIdLength,this.plan=e.plan,this.ingestionMetadata=e.ingestionMetadata,this.offline=e.offline!==void 0?e.offline:s.offline,this.optOut=(i=e.optOut)!==null&&i!==void 0?i:s.optOut,this.serverUrl=e.serverUrl,this.serverZone=e.serverZone||s.serverZone,this.storageProvider=e.storageProvider,this.transportProvider=e.transportProvider,this.useBatch=(o=e.useBatch)!==null&&o!==void 0?o:s.useBatch,this.loggerProvider.enable(this.logLevel);var u=Dt(e.serverUrl,e.serverZone,e.useBatch);this.serverZone=u.serverZone,this.serverUrl=u.serverUrl}return Object.defineProperty(t.prototype,"optOut",{get:function(){return this._optOut},set:function(e){this._optOut=e},enumerable:!1,configurable:!0}),t}();var qr=function(t,e){return t==="EU"?e?Fn:Mn:e?Bn:wt},Dt=function(t,e,n){if(t===void 0&&(t=""),e===void 0&&(e=Ye().serverZone),n===void 0&&(n=Ye().useBatch),t)return{serverUrl:t,serverZone:void 0};var r=["US","EU"].includes(e)?e:Ye().serverZone;return{serverZone:r,serverUrl:qr(r,n)}};function jr(t){return t instanceof Error?t.message:String(t)}function Qe(t){var e="";try{"body"in t&&(e=JSON.stringify(t.body,null,2))}catch{}return e}var At=function(){function t(){this.name="amplitude",this.type="destination",this.retryTimeout=1e3,this.throttleTimeout=3e4,this.storageKey="",this.scheduled=null,this.queue=[]}return t.prototype.setup=function(e){var n;return p(this,void 0,void 0,function(){var r,i=this;return f(this,function(o){switch(o.label){case 0:return this.config=e,this.storageKey="".concat(xt,"_").concat(this.config.apiKey.substring(0,10)),[4,(n=this.config.storageProvider)===null||n===void 0?void 0:n.get(this.storageKey)];case 1:return r=o.sent(),this.saveEvents(),r&&r.length>0&&Promise.all(r.map(function(s){return i.execute(s)})).catch(),[2,Promise.resolve(void 0)]}})})},t.prototype.execute=function(e){var n=this;return new Promise(function(r){var i={event:e,attempts:0,callback:function(o){return r(o)},timeout:0};n.addToQueue(i)})},t.prototype.addToQueue=function(){for(var e=this,n=[],r=0;r<arguments.length;r++)n[r]=arguments[r];var i=n.filter(function(o){return o.attempts<e.config.flushMaxRetries?(o.attempts+=1,!0):(e.fulfillRequest([o],500,Dn),!1)});i.forEach(function(o){if(e.queue=e.queue.concat(o),o.timeout===0){e.schedule(e.config.flushIntervalMillis);return}setTimeout(function(){o.timeout=0,e.schedule(0)},o.timeout)}),this.saveEvents()},t.prototype.schedule=function(e){var n=this;this.scheduled||this.config.offline||(this.scheduled=setTimeout(function(){n.flush(!0).then(function(){n.queue.length>0&&n.schedule(e)})},e))},t.prototype.flush=function(e){return e===void 0&&(e=!1),p(this,void 0,void 0,function(){var n,r,i,o=this;return f(this,function(s){switch(s.label){case 0:return this.config.offline?(this.config.loggerProvider.debug("Skipping flush while offline."),[2]):(n=[],r=[],this.queue.forEach(function(u){return u.timeout===0?n.push(u):r.push(u)}),this.queue=r,this.scheduled&&(clearTimeout(this.scheduled),this.scheduled=null),i=Kn(n,this.config.flushQueueSize),[4,Promise.all(i.map(function(u){return o.send(u,e)}))]);case 1:return s.sent(),[2]}})})},t.prototype.send=function(e,n){return n===void 0&&(n=!0),p(this,void 0,void 0,function(){var r,i,o,s,u;return f(this,function(c){switch(c.label){case 0:if(!this.config.apiKey)return[2,this.fulfillRequest(e,400,kn)];r={api_key:this.config.apiKey,events:e.map(function(a){var l=a.event,d=l.extra,m=Te(l,["extra"]);return m}),options:{min_id_length:this.config.minIdLength},client_upload_time:new Date().toISOString()},c.label=1;case 1:return c.trys.push([1,3,,4]),i=Dt(this.config.serverUrl,this.config.serverZone,this.config.useBatch).serverUrl,[4,this.config.transportProvider.send(i,r)];case 2:return o=c.sent(),o===null?(this.fulfillRequest(e,0,Rn),[2]):n?(this.handleResponse(o,e),[3,4]):("body"in o?this.fulfillRequest(e,o.statusCode,"".concat(o.status,": ").concat(Qe(o))):this.fulfillRequest(e,o.statusCode,o.status),[2]);case 3:return s=c.sent(),u=jr(s),this.config.loggerProvider.error(u),this.fulfillRequest(e,0,u),[3,4];case 4:return[2]}})})},t.prototype.handleResponse=function(e,n){var r=e.status;switch(r){case x.Success:{this.handleSuccessResponse(e,n);break}case x.Invalid:{this.handleInvalidResponse(e,n);break}case x.PayloadTooLarge:{this.handlePayloadTooLargeResponse(e,n);break}case x.RateLimit:{this.handleRateLimitResponse(e,n);break}default:{this.config.loggerProvider.warn(\`{code: 0, error: "Status '\`.concat(r,"' provided for ").concat(n.length,' events"}')),this.handleOtherResponse(n);break}}},t.prototype.handleSuccessResponse=function(e,n){this.fulfillRequest(n,e.statusCode,Cn)},t.prototype.handleInvalidResponse=function(e,n){var r=this;if(e.body.missingField||e.body.error.startsWith(On)){this.fulfillRequest(n,e.statusCode,e.body.error);return}var i=q(q(q(q([],w(Object.values(e.body.eventsWithInvalidFields)),!1),w(Object.values(e.body.eventsWithMissingFields)),!1),w(Object.values(e.body.eventsWithInvalidIdLengths)),!1),w(e.body.silencedEvents),!1).flat(),o=new Set(i),s=n.filter(function(u,c){if(o.has(c)){r.fulfillRequest([u],e.statusCode,e.body.error);return}return!0});s.length>0&&this.config.loggerProvider.warn(Qe(e)),this.addToQueue.apply(this,q([],w(s),!1))},t.prototype.handlePayloadTooLargeResponse=function(e,n){if(n.length===1){this.fulfillRequest(n,e.statusCode,e.body.error);return}this.config.loggerProvider.warn(Qe(e)),this.config.flushQueueSize/=2,this.addToQueue.apply(this,q([],w(n),!1))},t.prototype.handleRateLimitResponse=function(e,n){var r=this,i=Object.keys(e.body.exceededDailyQuotaUsers),o=Object.keys(e.body.exceededDailyQuotaDevices),s=e.body.throttledEvents,u=new Set(i),c=new Set(o),a=new Set(s),l=n.filter(function(d,m){if(d.event.user_id&&u.has(d.event.user_id)||d.event.device_id&&c.has(d.event.device_id)){r.fulfillRequest([d],e.statusCode,e.body.error);return}return a.has(m)&&(d.timeout=r.throttleTimeout),!0});l.length>0&&this.config.loggerProvider.warn(Qe(e)),this.addToQueue.apply(this,q([],w(l),!1))},t.prototype.handleOtherResponse=function(e){var n=this;this.addToQueue.apply(this,q([],w(e.map(function(r){return r.timeout=r.attempts*n.retryTimeout,r})),!1))},t.prototype.fulfillRequest=function(e,n,r){this.saveEvents(),e.forEach(function(i){return i.callback(J(i.event,n,r))})},t.prototype.saveEvents=function(){if(this.config.storageProvider){var e=Array.from(this.queue.map(function(n){return n.event}));this.config.storageProvider.set(this.storageKey,e)}},t}();var Kr=function(t){t===void 0&&(t=0);var e=new Error().stack||"";return e.split(\`
|
|
10
10
|
\`).slice(2+t).map(function(n){return n.trim()})},P=function(t){return function(){var e=v({},t.config),n=e.loggerProvider,r=e.logLevel;return{logger:n,logLevel:r}}},Gr=function(t,e){var n,r;e=e.replace(/\\[(\\w+)\\]/g,".$1"),e=e.replace(/^\\./,"");try{for(var i=W(e.split(".")),o=i.next();!o.done;o=i.next()){var s=o.value;if(s in t)t=t[s];else return}}catch(u){n={error:u}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(n)throw n.error}}return t},C=function(t,e){return function(){var n,r,i={};try{for(var o=W(e),s=o.next();!s.done;s=o.next()){var u=s.value;i[u]=Gr(t,u)}}catch(c){n={error:c}}finally{try{s&&!s.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}return i}},R=function(t,e,n,r,i){return i===void 0&&(i=null),function(){for(var o=[],s=0;s<arguments.length;s++)o[s]=arguments[s];var u=n(),c=u.logger,a=u.logLevel;if(a&&a<N.Debug||!a||!c)return t.apply(i,o);var l={type:"invoke public method",name:e,args:o,stacktrace:Kr(1),time:{start:new Date().toISOString()},states:{}};r&&l.states&&(l.states.before=r());var d=t.apply(i,o);return d&&d.promise?d.promise.then(function(){r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),c.debug(JSON.stringify(l,null,2))}):(r&&l.states&&(l.states.after=r()),l.time&&(l.time.end=new Date().toISOString()),c.debug(JSON.stringify(l,null,2))),d}};var Xe=function(){function t(){this.memoryStorage=new Map}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2,!0]})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return[2,this.memoryStorage.get(e)]})})},t.prototype.getRaw=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){switch(r.label){case 0:return[4,this.get(e)];case 1:return n=r.sent(),[2,n?JSON.stringify(n):void 0]}})})},t.prototype.set=function(e,n){return p(this,void 0,void 0,function(){return f(this,function(r){return this.memoryStorage.set(e,n),[2]})})},t.prototype.remove=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return this.memoryStorage.delete(e),[2]})})},t.prototype.reset=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return this.memoryStorage.clear(),[2]})})},t}();var de=function(){function t(){}return t.prototype.send=function(e,n){return Promise.resolve(null)},t.prototype.buildResponse=function(e){var n,r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,A,F,I,S;if(typeof e!="object")return null;var k=e.code||0,B=this.buildStatus(k);switch(B){case x.Success:return{status:B,statusCode:k,body:{eventsIngested:(n=e.events_ingested)!==null&&n!==void 0?n:0,payloadSizeBytes:(r=e.payload_size_bytes)!==null&&r!==void 0?r:0,serverUploadTime:(i=e.server_upload_time)!==null&&i!==void 0?i:0}};case x.Invalid:return{status:B,statusCode:k,body:{error:(o=e.error)!==null&&o!==void 0?o:"",missingField:(s=e.missing_field)!==null&&s!==void 0?s:"",eventsWithInvalidFields:(u=e.events_with_invalid_fields)!==null&&u!==void 0?u:{},eventsWithMissingFields:(c=e.events_with_missing_fields)!==null&&c!==void 0?c:{},eventsWithInvalidIdLengths:(a=e.events_with_invalid_id_lengths)!==null&&a!==void 0?a:{},epsThreshold:(l=e.eps_threshold)!==null&&l!==void 0?l:0,exceededDailyQuotaDevices:(d=e.exceeded_daily_quota_devices)!==null&&d!==void 0?d:{},silencedDevices:(m=e.silenced_devices)!==null&&m!==void 0?m:[],silencedEvents:(y=e.silenced_events)!==null&&y!==void 0?y:[],throttledDevices:(g=e.throttled_devices)!==null&&g!==void 0?g:{},throttledEvents:(T=e.throttled_events)!==null&&T!==void 0?T:[]}};case x.PayloadTooLarge:return{status:B,statusCode:k,body:{error:(h=e.error)!==null&&h!==void 0?h:""}};case x.RateLimit:return{status:B,statusCode:k,body:{error:(_=e.error)!==null&&_!==void 0?_:"",epsThreshold:(U=e.eps_threshold)!==null&&U!==void 0?U:0,throttledDevices:(b=e.throttled_devices)!==null&&b!==void 0?b:{},throttledUsers:(A=e.throttled_users)!==null&&A!==void 0?A:{},exceededDailyQuotaDevices:(F=e.exceeded_daily_quota_devices)!==null&&F!==void 0?F:{},exceededDailyQuotaUsers:(I=e.exceeded_daily_quota_users)!==null&&I!==void 0?I:{},throttledEvents:(S=e.throttled_events)!==null&&S!==void 0?S:[]}};case x.Timeout:default:return{status:B,statusCode:k}}},t.prototype.buildStatus=function(e){return e>=200&&e<300?x.Success:e===429?x.RateLimit:e===413?x.PayloadTooLarge:e===408?x.Timeout:e>=400&&e<500?x.Invalid:e>=500?x.Failed:x.Unknown},t}();var M=function(){if(typeof globalThis<"u")return globalThis;if(typeof window<"u")return window;if(typeof self<"u")return self;if(typeof global<"u")return global};var ge=function(){var t,e=M();if(!(!((t=e?.location)===null||t===void 0)&&t.search))return{};var n=e.location.search.substring(1).split("&").filter(Boolean),r=n.reduce(function(i,o){var s=o.split("=",2),u=Gn(s[0]),c=Gn(s[1]);return c&&(i[u]=c),i},{});return r},Gn=function(t){t===void 0&&(t="");try{return decodeURIComponent(t)}catch{return""}};var Wn="utm_campaign",$n="utm_content",Yn="utm_id",Qn="utm_medium",Xn="utm_source",zn="utm_term",kt="dclid",Ot="fbclid",Ut="gbraid",Nt="gclid",Mt="ko_click_id",Bt="li_fat_id",Ft="msclkid",Vt="rtd_cid",Ht="ttclid",qt="twclid",jt="wbraid";var pe={utm_campaign:void 0,utm_content:void 0,utm_id:void 0,utm_medium:void 0,utm_source:void 0,utm_term:void 0,referrer:void 0,referring_domain:void 0,dclid:void 0,gbraid:void 0,gclid:void 0,fbclid:void 0,ko_click_id:void 0,li_fat_id:void 0,msclkid:void 0,rtd_cid:void 0,ttclid:void 0,twclid:void 0,wbraid:void 0};var Se=function(){function t(){}return t.prototype.parse=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2,v(v(v(v({},pe),this.getUtmParam()),this.getReferrer()),this.getClickIds())]})})},t.prototype.getUtmParam=function(){var e=ge(),n=e[Wn],r=e[$n],i=e[Yn],o=e[Qn],s=e[Xn],u=e[zn];return{utm_campaign:n,utm_content:r,utm_id:i,utm_medium:o,utm_source:s,utm_term:u}},t.prototype.getReferrer=function(){var e,n,r={referrer:void 0,referring_domain:void 0};try{r.referrer=document.referrer||void 0,r.referring_domain=(n=(e=r.referrer)===null||e===void 0?void 0:e.split("/")[2])!==null&&n!==void 0?n:void 0}catch{}return r},t.prototype.getClickIds=function(){var e,n=ge();return e={},e[kt]=n[kt],e[Ot]=n[Ot],e[Ut]=n[Ut],e[Nt]=n[Nt],e[Mt]=n[Mt],e[Bt]=n[Bt],e[Ft]=n[Ft],e[Vt]=n[Vt],e[Ht]=n[Ht],e[qt]=n[qt],e[jt]=n[jt],e},t}();var ze=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[le,e,t.substring(0,n)].filter(Boolean).join("_")},Kt=function(t){return"".concat(le.toLowerCase(),"_").concat(t.substring(0,6))};var xe=function(t,e){e===void 0&&(e=Date.now());var n=Date.now(),r=n-e;return r>t};var we=function(){function t(e){this.options=v({},e)}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){var e,n,r,i;return f(this,function(o){switch(o.label){case 0:if(!M())return[2,!1];t.testValue=String(Date.now()),e=new t(this.options),n="AMP_TEST",o.label=1;case 1:return o.trys.push([1,4,5,7]),[4,e.set(n,t.testValue)];case 2:return o.sent(),[4,e.get(n)];case 3:return r=o.sent(),[2,r===t.testValue];case 4:return i=o.sent(),[2,!1];case 5:return[4,e.remove(n)];case 6:return o.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){switch(r.label){case 0:return[4,this.getRaw(e)];case 1:if(n=r.sent(),!n)return[2,void 0];try{try{n=decodeURIComponent(atob(n))}catch{}return[2,JSON.parse(n)]}catch{return[2,void 0]}return[2]}})})},t.prototype.getRaw=function(e){var n,r;return p(this,void 0,void 0,function(){var i,o,s;return f(this,function(u){return i=M(),o=(r=(n=i?.document)===null||n===void 0?void 0:n.cookie.split("; "))!==null&&r!==void 0?r:[],s=o.find(function(c){return c.indexOf(e+"=")===0}),s?[2,s.substring(e.length+1)]:[2,void 0]})})},t.prototype.set=function(e,n){var r;return p(this,void 0,void 0,function(){var i,o,s,u,c,a;return f(this,function(l){try{i=(r=this.options.expirationDays)!==null&&r!==void 0?r:0,o=n!==null?i:-1,s=void 0,o&&(u=new Date,u.setTime(u.getTime()+o*24*60*60*1e3),s=u),c="".concat(e,"=").concat(btoa(encodeURIComponent(JSON.stringify(n)))),s&&(c+="; expires=".concat(s.toUTCString())),c+="; path=/",this.options.domain&&(c+="; domain=".concat(this.options.domain)),this.options.secure&&(c+="; Secure"),this.options.sameSite&&(c+="; SameSite=".concat(this.options.sameSite)),a=M(),a&&(a.document.cookie=c)}catch{}return[2]})})},t.prototype.remove=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){switch(n.label){case 0:return[4,this.set(e,null)];case 1:return n.sent(),[2]}})})},t.prototype.reset=function(){return p(this,void 0,void 0,function(){return f(this,function(e){return[2]})})},t}();var Gt=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i,o,s;return f(this,function(u){switch(u.label){case 0:if(typeof fetch>"u")throw new Error("FetchTransport is not supported");return i={headers:{"Content-Type":"application/json",Accept:"*/*"},body:JSON.stringify(r),method:"POST"},[4,fetch(n,i)];case 1:return o=u.sent(),[4,o.json()];case 2:return s=u.sent(),[2,this.buildResponse(s)]}})})},e}(de);var Wr=function(){function t(){}return t.prototype.getApplicationContext=function(){return{versionName:this.versionName,language:$r(),platform:"Web",os:void 0,deviceModel:void 0}},t}(),$r=function(){return typeof navigator<"u"&&(navigator.languages&&navigator.languages[0]||navigator.language)||""},Yr=function(){function t(){this.queue=[]}return t.prototype.logEvent=function(e){this.receiver?this.receiver(e):this.queue.length<512&&this.queue.push(e)},t.prototype.setEventReceiver=function(e){this.receiver=e,this.queue.length>0&&(this.queue.forEach(function(n){e(n)}),this.queue=[])},t}(),re=function(){return re=Object.assign||function(e){for(var n,r=1,i=arguments.length;r<i;r++){n=arguments[r];for(var o in n)Object.prototype.hasOwnProperty.call(n,o)&&(e[o]=n[o])}return e},re.apply(this,arguments)},Ze=function(t,e){var n=["string","number","boolean","undefined"],r=typeof t,i=typeof e;if(r!==i)return!1;for(var o=0,s=n;o<s.length;o++){var u=s[o];if(u===r)return t===e}if(t==null&&e==null)return!0;if(t==null||e==null||t.length!==e.length)return!1;var c=Array.isArray(t),a=Array.isArray(e);if(c!==a)return!1;if(c&&a){for(var l=0;l<t.length;l++)if(!Ze(t[l],e[l]))return!1}else{var d=Object.keys(t).sort(),m=Object.keys(e).sort();if(!Ze(d,m))return!1;var y=!0;return Object.keys(t).forEach(function(g){Ze(t[g],e[g])||(y=!1)}),y}return!0},Qr="$set",Xr="$unset",zr="$clearAll";Object.entries||(Object.entries=function(t){for(var e=Object.keys(t),n=e.length,r=new Array(n);n--;)r[n]=[e[n],t[e[n]]];return r});var Zr=function(){function t(){this.identity={userProperties:{}},this.listeners=new Set}return t.prototype.editIdentity=function(){var e=this,n=re({},this.identity.userProperties),r=re(re({},this.identity),{userProperties:n});return{setUserId:function(i){return r.userId=i,this},setDeviceId:function(i){return r.deviceId=i,this},setUserProperties:function(i){return r.userProperties=i,this},setOptOut:function(i){return r.optOut=i,this},updateUserProperties:function(i){for(var o=r.userProperties||{},s=0,u=Object.entries(i);s<u.length;s++){var c=u[s],a=c[0],l=c[1];switch(a){case Qr:for(var d=0,m=Object.entries(l);d<m.length;d++){var y=m[d],g=y[0],T=y[1];o[g]=T}break;case Xr:for(var h=0,_=Object.keys(l);h<_.length;h++){var g=_[h];delete o[g]}break;case zr:o={};break}}return r.userProperties=o,this},commit:function(){return e.setIdentity(r),this}}},t.prototype.getIdentity=function(){return re({},this.identity)},t.prototype.setIdentity=function(e){var n=re({},this.identity);this.identity=re({},e),Ze(n,this.identity)||this.listeners.forEach(function(r){r(e)})},t.prototype.addIdentityListener=function(e){this.listeners.add(e)},t.prototype.removeIdentityListener=function(e){this.listeners.delete(e)},t}(),Le=typeof globalThis<"u"?globalThis:typeof global<"u"?global:self,Zn=function(){function t(){this.identityStore=new Zr,this.eventBridge=new Yr,this.applicationContextProvider=new Wr}return t.getInstance=function(e){return Le.analyticsConnectorInstances||(Le.analyticsConnectorInstances={}),Le.analyticsConnectorInstances[e]||(Le.analyticsConnectorInstances[e]=new t),Le.analyticsConnectorInstances[e]},t}();var ie=function(t){return t===void 0&&(t="$default_instance"),Zn.getInstance(t)},Wt=function(t,e){ie(e).identityStore.editIdentity().setUserId(t).commit()},$t=function(t,e){ie(e).identityStore.editIdentity().setDeviceId(t).commit()};var Yt=function(){function t(){this.name="identity",this.type="before",this.identityStore=ie().identityStore}return t.prototype.execute=function(e){return p(this,void 0,void 0,function(){var n;return f(this,function(r){return n=e.user_properties,n&&this.identityStore.editIdentity().updateUserProperties(n).commit(),[2,e]})})},t.prototype.setup=function(e){return p(this,void 0,void 0,function(){return f(this,function(n){return e.instanceName&&(this.identityStore=ie(e.instanceName).identityStore),[2]})})},t}();var Qt=function(){var t,e,n,r;if(typeof navigator>"u")return"";var i=navigator.userLanguage;return(r=(n=(e=(t=navigator.languages)===null||t===void 0?void 0:t[0])!==null&&e!==void 0?e:navigator.language)!==null&&n!==void 0?n:i)!==null&&r!==void 0?r:""};var Pe=function(t,e){return typeof t=="boolean"?t:t?.[e]!==!1},Je=function(t){return Pe(t,"attribution")},Xt=function(t){return Pe(t,"fileDownloads")},zt=function(t){return Pe(t,"formInteractions")},et=function(t){return Pe(t,"pageViews")},Zt=function(t){return Pe(t,"sessions")},Jt=function(t){var e=function(){return!1},n=void 0,r,i=t.pageCounter,o=et(t.defaultTracking);return o&&(e=void 0,r=void 0,t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.pageViews&&typeof t.defaultTracking.pageViews=="object"&&("trackOn"in t.defaultTracking.pageViews&&(e=t.defaultTracking.pageViews.trackOn),"trackHistoryChanges"in t.defaultTracking.pageViews&&(n=t.defaultTracking.pageViews.trackHistoryChanges),"eventType"in t.defaultTracking.pageViews&&t.defaultTracking.pageViews.eventType&&(r=t.defaultTracking.pageViews.eventType))),{trackOn:e,trackHistoryChanges:n,eventType:r,pageCounter:i}},en=function(t){return Je(t.defaultTracking)&&t.defaultTracking&&typeof t.defaultTracking=="object"&&t.defaultTracking.attribution&&typeof t.defaultTracking.attribution=="object"?v({},t.defaultTracking.attribution):{}};var tt=function(t,e){for(var n=0;n<e.length;n++){var r=e[n],i=r.name,o=r.args,s=r.resolve,u=t&&t[i];if(typeof u=="function"){var c=u.apply(t,o);typeof s=="function"&&s(c?.promise)}}return t},nt=function(t){var e=t;return e&&e._q!==void 0};var Jn="2.5.2";var Jr="Web",ei="$remote",er=function(){function t(){this.name="@amplitude/plugin-context-browser",this.type="before",this.library="amplitude-ts/".concat(Jn),typeof navigator<"u"&&(this.userAgent=navigator.userAgent)}return t.prototype.setup=function(e){return this.config=e,Promise.resolve(void 0)},t.prototype.execute=function(e){var n,r;return p(this,void 0,void 0,function(){var i,o,s,u;return f(this,function(c){return i=new Date().getTime(),o=(n=this.config.lastEventId)!==null&&n!==void 0?n:-1,s=(r=e.event_id)!==null&&r!==void 0?r:o+1,this.config.lastEventId=s,e.time||(this.config.lastEventTime=i),u=v(v(v(v(v(v(v(v({user_id:this.config.userId,device_id:this.config.deviceId,session_id:this.config.sessionId,time:i},this.config.appVersion&&{app_version:this.config.appVersion}),this.config.trackingOptions.platform&&{platform:Jr}),this.config.trackingOptions.language&&{language:Qt()}),this.config.trackingOptions.ipAddress&&{ip:ei}),{insert_id:Y(),partner_id:this.config.partnerId,plan:this.config.plan}),this.config.ingestionMetadata&&{ingestion_metadata:{source_name:this.config.ingestionMetadata.sourceName,source_version:this.config.ingestionMetadata.sourceVersion}}),e),{event_id:s,library:this.library,user_agent:this.userAgent}),[2,u]})})},t}();var rt=function(){function t(e){this.storage=e}return t.prototype.isEnabled=function(){return p(this,void 0,void 0,function(){var e,n,r,i,o;return f(this,function(s){switch(s.label){case 0:if(!this.storage)return[2,!1];e=String(Date.now()),n=new t(this.storage),r="AMP_TEST",s.label=1;case 1:return s.trys.push([1,4,5,7]),[4,n.set(r,e)];case 2:return s.sent(),[4,n.get(r)];case 3:return i=s.sent(),[2,i===e];case 4:return o=s.sent(),[2,!1];case 5:return[4,n.remove(r)];case 6:return s.sent(),[7];case 7:return[2]}})})},t.prototype.get=function(e){return p(this,void 0,void 0,function(){var n,r;return f(this,function(i){switch(i.label){case 0:return i.trys.push([0,2,,3]),[4,this.getRaw(e)];case 1:return n=i.sent(),n?[2,JSON.parse(n)]:[2,void 0];case 2:return r=i.sent(),console.error("[Amplitude] Error: Could not get value from storage"),[2,void 0];case 3:return[2]}})})},t.prototype.getRaw=function(e){var n;return p(this,void 0,void 0,function(){return f(this,function(r){return[2,((n=this.storage)===null||n===void 0?void 0:n.getItem(e))||void 0]})})},t.prototype.set=function(e,n){var r;return p(this,void 0,void 0,function(){return f(this,function(i){try{(r=this.storage)===null||r===void 0||r.setItem(e,JSON.stringify(n))}catch{}return[2]})})},t.prototype.remove=function(e){var n;return p(this,void 0,void 0,function(){return f(this,function(r){try{(n=this.storage)===null||n===void 0||n.removeItem(e)}catch{}return[2]})})},t.prototype.reset=function(){var e;return p(this,void 0,void 0,function(){return f(this,function(n){try{(e=this.storage)===null||e===void 0||e.clear()}catch{}return[2]})})},t}();var it=1e3,tn=function(t){V(e,t);function e(n){var r=this,i;return r=t.call(this,(i=M())===null||i===void 0?void 0:i.localStorage)||this,r.loggerProvider=n?.loggerProvider,r}return e.prototype.set=function(n,r){var i;return p(this,void 0,void 0,function(){var o;return f(this,function(s){switch(s.label){case 0:return Array.isArray(r)&&r.length>it?(o=r.length-it,[4,t.prototype.set.call(this,n,r.slice(0,it))]):[3,2];case 1:return s.sent(),(i=this.loggerProvider)===null||i===void 0||i.error("Failed to save ".concat(o," events because the queue length exceeded ").concat(it,".")),[3,4];case 2:return[4,t.prototype.set.call(this,n,r)];case 3:s.sent(),s.label=4;case 4:return[2]}})})},e}(rt);var tr=function(t){V(e,t);function e(){var n;return t.call(this,(n=M())===null||n===void 0?void 0:n.sessionStorage)||this}return e}(rt);var nr=function(t){V(e,t);function e(){var n=t!==null&&t.apply(this,arguments)||this;return n.state={done:4},n}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i=this;return f(this,function(o){return[2,new Promise(function(s,u){typeof XMLHttpRequest>"u"&&u(new Error("XHRTransport is not supported."));var c=new XMLHttpRequest;c.open("POST",n,!0),c.onreadystatechange=function(){if(c.readyState===i.state.done)try{var a=c.responseText,l=JSON.parse(a),d=i.buildResponse(l);s(d)}catch(m){u(m)}},c.setRequestHeader("Content-Type","application/json"),c.setRequestHeader("Accept","*/*"),c.send(JSON.stringify(r))})]})})},e}(de);var rr=function(t){V(e,t);function e(){return t!==null&&t.apply(this,arguments)||this}return e.prototype.send=function(n,r){return p(this,void 0,void 0,function(){var i=this;return f(this,function(o){return[2,new Promise(function(s,u){var c=M();if(!c?.navigator.sendBeacon)throw new Error("SendBeaconTransport is not supported");try{var a=JSON.stringify(r),l=c.navigator.sendBeacon(n,JSON.stringify(r));return s(l?i.buildResponse({code:200,events_ingested:r.events.length,payload_size_bytes:a.length,server_upload_time:Date.now()}):i.buildResponse({code:500}))}catch(d){u(d)}})]})})},e}(de);var ir=function(t,e,n){return n===void 0&&(n=!0),p(void 0,void 0,void 0,function(){var r,i,o,s,u,c,a,l,d;return f(this,function(m){switch(m.label){case 0:return r=Kt(t),[4,e.getRaw(r)];case 1:return i=m.sent(),i?n?[4,e.remove(r)]:[3,3]:[2,{optOut:!1}];case 2:m.sent(),m.label=3;case 3:return o=w(i.split("."),6),s=o[0],u=o[1],c=o[2],a=o[3],l=o[4],d=o[5],[2,{deviceId:s,userId:ti(u),sessionId:nn(a),lastEventId:nn(d),lastEventTime:nn(l),optOut:!!c}]}})})},nn=function(t){var e=parseInt(t,32);if(!isNaN(e))return e},ti=function(t){if(!(!atob||!escape||!t))try{return decodeURIComponent(escape(atob(t)))}catch{return}};var j="[Amplitude]",Ca="".concat(j," Page Viewed"),rn="".concat(j," Form Started"),or="".concat(j," Form Submitted"),sr="".concat(j," File Downloaded"),on="session_start",sn="session_end",ar="".concat(j," File Extension"),ur="".concat(j," File Name"),cr="".concat(j," Link ID"),lr="".concat(j," Link Text"),dr="".concat(j," Link URL"),ot="".concat(j," Form ID"),st="".concat(j," Form Name"),at="".concat(j," Form Destination"),Ce="cookie",pr="US";var ni=function(t){V(e,t);function e(n,r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,A,F,I,S,k,B,Q,ee,ue,te,ce,ye,_e){i===void 0&&(i=new Xe),o===void 0&&(o={domain:"",expiration:365,sameSite:"Lax",secure:!1,upgrade:!0}),c===void 0&&(c=1e3),a===void 0&&(a=5),l===void 0&&(l=30),d===void 0&&(d=Ce),h===void 0&&(h=new Ie),_===void 0&&(_=N.Warn),b===void 0&&(b=!1),A===void 0&&(A=!1),S===void 0&&(S=""),k===void 0&&(k=pr),Q===void 0&&(Q=30*60*1e3),ee===void 0&&(ee=new tn({loggerProvider:h})),ue===void 0&&(ue={ipAddress:!0,language:!0,platform:!0}),te===void 0&&(te="fetch"),ce===void 0&&(ce=!1);var E=t.call(this,{apiKey:n,storageProvider:ee,transportProvider:an(te)})||this;return E.apiKey=n,E.appVersion=r,E.cookieOptions=o,E.defaultTracking=s,E.flushIntervalMillis=c,E.flushMaxRetries=a,E.flushQueueSize=l,E.identityStorage=d,E.ingestionMetadata=m,E.instanceName=y,E.loggerProvider=h,E.logLevel=_,E.minIdLength=U,E.offline=b,E.partnerId=F,E.plan=I,E.serverUrl=S,E.serverZone=k,E.sessionTimeout=Q,E.storageProvider=ee,E.trackingOptions=ue,E.transport=te,E.useBatch=ce,E._optOut=!1,E._cookieStorage=i,E.deviceId=u,E.lastEventId=g,E.lastEventTime=T,E.optOut=A,E.sessionId=B,E.pageCounter=_e,E.userId=ye,E.loggerProvider.enable(E.logLevel),E}return Object.defineProperty(e.prototype,"cookieStorage",{get:function(){return this._cookieStorage},set:function(n){this._cookieStorage!==n&&(this._cookieStorage=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"deviceId",{get:function(){return this._deviceId},set:function(n){this._deviceId!==n&&(this._deviceId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"userId",{get:function(){return this._userId},set:function(n){this._userId!==n&&(this._userId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"sessionId",{get:function(){return this._sessionId},set:function(n){this._sessionId!==n&&(this._sessionId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"optOut",{get:function(){return this._optOut},set:function(n){this._optOut!==n&&(this._optOut=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventTime",{get:function(){return this._lastEventTime},set:function(n){this._lastEventTime!==n&&(this._lastEventTime=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"lastEventId",{get:function(){return this._lastEventId},set:function(n){this._lastEventId!==n&&(this._lastEventId=n,this.updateStorage())},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"pageCounter",{get:function(){return this._pageCounter},set:function(n){this._pageCounter!==n&&(this._pageCounter=n,this.updateStorage())},enumerable:!1,configurable:!0}),e.prototype.updateStorage=function(){var n={deviceId:this._deviceId,userId:this._userId,sessionId:this._sessionId,optOut:this._optOut,lastEventTime:this._lastEventTime,lastEventId:this._lastEventId,pageCounter:this._pageCounter};this.cookieStorage.set(ze(this.apiKey),n)},e}(Rt);var fr=function(t,e,n){return e===void 0&&(e={}),p(void 0,void 0,void 0,function(){var r,i,o,s,u,c,a,l,d,m,y,g,T,h,_,U,b,A,F,I,S,k,B,Q,ee,ue,te,ce,ye,_e,E,dt,pt,ft,mt,vt,gt,ht,yt,_t;return f(this,function(me){switch(me.label){case 0:return r=e.identityStorage||Ce,b={},r===Ce?[3,1]:(o="",[3,5]);case 1:return(F=(A=e.cookieOptions)===null||A===void 0?void 0:A.domain)!==null&&F!==void 0?(s=F,[3,4]):[3,2];case 2:return[4,ii()];case 3:s=me.sent(),me.label=4;case 4:o=s,me.label=5;case 5:return i=v.apply(void 0,[(b.domain=o,b.expiration=365,b.sameSite="Lax",b.secure=!1,b.upgrade=!0,b),e.cookieOptions]),u=ri(e.identityStorage,i),[4,ir(t,u,(S=(I=e.cookieOptions)===null||I===void 0?void 0:I.upgrade)!==null&&S!==void 0?S:!0)];case 6:return c=me.sent(),[4,u.get(ze(t))];case 7:return a=me.sent(),l=ge(),d=(ee=(Q=(B=(k=e.deviceId)!==null&&k!==void 0?k:l.deviceId)!==null&&B!==void 0?B:a?.deviceId)!==null&&Q!==void 0?Q:c.deviceId)!==null&&ee!==void 0?ee:Y(),m=(ue=a?.lastEventId)!==null&&ue!==void 0?ue:c.lastEventId,y=(te=a?.lastEventTime)!==null&&te!==void 0?te:c.lastEventTime,g=(ye=(ce=e.optOut)!==null&&ce!==void 0?ce:a?.optOut)!==null&&ye!==void 0?ye:c.optOut,T=(_e=a?.sessionId)!==null&&_e!==void 0?_e:c.sessionId,h=(dt=(E=e.userId)!==null&&E!==void 0?E:a?.userId)!==null&&dt!==void 0?dt:c.userId,n.previousSessionDeviceId=(pt=a?.deviceId)!==null&&pt!==void 0?pt:c.deviceId,n.previousSessionUserId=(ft=a?.userId)!==null&&ft!==void 0?ft:c.userId,_={ipAddress:(vt=(mt=e.trackingOptions)===null||mt===void 0?void 0:mt.ipAddress)!==null&&vt!==void 0?vt:!0,language:(ht=(gt=e.trackingOptions)===null||gt===void 0?void 0:gt.language)!==null&&ht!==void 0?ht:!0,platform:(_t=(yt=e.trackingOptions)===null||yt===void 0?void 0:yt.platform)!==null&&_t!==void 0?_t:!0},U=a?.pageCounter,[2,new ni(t,e.appVersion,u,i,e.defaultTracking,d,e.flushIntervalMillis,e.flushMaxRetries,e.flushQueueSize,r,e.ingestionMetadata,e.instanceName,m,y,e.loggerProvider,e.logLevel,e.minIdLength,e.offline,g,e.partnerId,e.plan,e.serverUrl,e.serverZone,T,e.sessionTimeout,e.storageProvider,_,e.transport,e.useBatch,h,U)]}})})},ri=function(t,e){switch(t===void 0&&(t=Ce),e===void 0&&(e={}),t){case"localStorage":return new tn;case"sessionStorage":return new tr;case"none":return new Xe;case"cookie":default:return new we(v(v({},e),{expirationDays:e.expiration}))}},an=function(t){return t==="xhr"?new nr:t==="beacon"?new rr:new Gt},ii=function(t){return p(void 0,void 0,void 0,function(){var e,n,r,i,o,o,s,u,c,a;return f(this,function(l){switch(l.label){case 0:return[4,new we().isEnabled()];case 1:if(!l.sent()||!t&&typeof location>"u")return[2,""];for(e=t??location.hostname,n=e.split("."),r=[],i="AMP_TLDTEST",o=n.length-2;o>=0;--o)r.push(n.slice(o).join("."));o=0,l.label=2;case 2:return o<r.length?(s=r[o],u={domain:"."+s},c=new we(u),[4,c.set(i,1)]):[3,7];case 3:return l.sent(),[4,c.get(i)];case 4:return a=l.sent(),a?[4,c.remove(i)]:[3,6];case 5:return l.sent(),[2,"."+s];case 6:return o++,[3,2];case 7:return[2,""]}})})};var vr=function(t,e,n){return e===void 0&&(e=""),n===void 0&&(n=10),[le,e,t.substring(0,n)].filter(Boolean).join("_")},mr=function(t){var e=t.split(".");return e.length<=2?t:e.slice(e.length-2,e.length).join(".")},oi=function(t){return Object.values(t).every(function(e){return!e})},gr=function(t,e,n,r){r===void 0&&(r=!0);var i=t.referrer,o=t.referring_domain,s=Te(t,["referrer","referring_domain"]),u=e||{},c=u.referrer,a=u.referring_domain,l=Te(u,["referrer","referring_domain"]);if(si(n.excludeReferrers,t.referring_domain)||!r&&oi(t)&&e)return!1;var d=JSON.stringify(s)!==JSON.stringify(l),m=mr(o||"")!==mr(a||"");return!e||d||m},si=function(t,e){return t===void 0&&(t=[]),e===void 0&&(e=""),t.some(function(n){return n instanceof RegExp?n.test(e):n===e})},hr=function(t,e){var n=v(v({},pe),t),r=Object.entries(n).reduce(function(i,o){var s,u=w(o,2),c=u[0],a=u[1];return i.setOnce("initial_".concat(c),(s=a??e.initialEmptyValue)!==null&&s!==void 0?s:"EMPTY"),a?i.set(c,a):i.unset(c)},new ne);return be(r)},yr=function(t){var e=t;return e?(e.startsWith(".")&&(e=e.substring(1)),[new RegExp("".concat(e.replace(".","\\\\."),"$"))]):[]};var un=function(t){var e=this;t===void 0&&(t={});var n={name:"@amplitude/plugin-web-attribution-browser",type:"before",setup:function(r,i){var o;return p(this,void 0,void 0,function(){var s,u,c,a,l,d,m,y;return f(this,function(g){switch(g.label){case 0:return s=v({initialEmptyValue:"EMPTY",resetSessionOnNewCampaign:!1,excludeReferrers:yr((o=r.cookieOptions)===null||o===void 0?void 0:o.domain)},t),r.loggerProvider.log("Installing @amplitude/plugin-web-attribution-browser."),u=r.cookieStorage,c=vr(r.apiKey,"MKTG"),[4,Promise.all([new Se().parse(),u.get(c)])];case 1:return a=w.apply(void 0,[g.sent(),2]),l=a[0],d=a[1],m=xe(r.sessionTimeout,r.lastEventTime),gr(l,d,s,m)&&(s.resetSessionOnNewCampaign&&(i.setSessionId(Date.now()),r.loggerProvider.log("Created a new session for new campaign.")),r.loggerProvider.log("Tracking attribution."),y=hr(l,s),i.track(y),u.set(c,l)),[2]}})})},execute:function(r){return p(e,void 0,void 0,function(){return f(this,function(i){return[2,r]})})}};return n};var _r=function(t){var e={};for(var n in t){var r=t[n];r&&(e[n]=r)}return e};var cn=function(t){t===void 0&&(t={});var e,n=M(),r=void 0,i,o,s=function(){return p(void 0,void 0,void 0,function(){var m,y,g;return f(this,function(T){switch(T.label){case 0:return o.pageCounter=o.pageCounter?o.pageCounter+1:1,y={event_type:(g=t.eventType)!==null&&g!==void 0?g:"[Amplitude] Page Viewed"},m=[{}],[4,ai()];case 1:return[2,(y.event_properties=v.apply(void 0,[v.apply(void 0,m.concat([T.sent()])),{"[Amplitude] Page Domain":typeof location<"u"&&location.hostname||"","[Amplitude] Page Location":typeof location<"u"&&location.href||"","[Amplitude] Page Path":typeof location<"u"&&location.pathname||"","[Amplitude] Page Title":typeof document<"u"&&document.title||"","[Amplitude] Page URL":typeof location<"u"&&location.href.split("?")[0]||"","[Amplitude] Page Counter":o.pageCounter}]),y)]}})})},u=function(){return typeof t.trackOn>"u"||typeof t.trackOn=="function"&&t.trackOn()},c=typeof location<"u"?location.href:null,a=function(){return p(void 0,void 0,void 0,function(){var m,y,g,T,h;return f(this,function(_){switch(_.label){case 0:return m=location.href,y=ci(t.trackHistoryChanges,m,c||"")&&u(),c=m,y?(r?.log("Tracking page view event"),e!=null?[3,1]:(g=void 0,[3,3])):[3,4];case 1:return h=(T=e).track,[4,s()];case 2:g=h.apply(T,[_.sent()]),_.label=3;case 3:_.label=4;case 4:return[2]}})})},l=function(){a()},d={name:"@amplitude/plugin-page-view-tracking-browser",type:"enrichment",setup:function(m,y){return p(void 0,void 0,void 0,function(){var g,T;return f(this,function(h){switch(h.label){case 0:return e=y,o=m,r=m.loggerProvider,r.log("Installing @amplitude/plugin-page-view-tracking-browser"),n&&(n.addEventListener("popstate",l),i=n.history.pushState,n.history.pushState=new Proxy(n.history.pushState,{apply:function(_,U,b){var A=w(b,3),F=A[0],I=A[1],S=A[2];_.apply(U,[F,I,S]),a()}})),u()?(r.log("Tracking page view event"),T=(g=e).track,[4,s()]):[3,2];case 1:T.apply(g,[h.sent()]),h.label=2;case 2:return[2]}})})},execute:function(m){return p(void 0,void 0,void 0,function(){var y;return f(this,function(g){switch(g.label){case 0:return t.trackOn==="attribution"&&ui(m)?(r?.log("Enriching campaign event to page view event with campaign parameters"),[4,s()]):[3,2];case 1:y=g.sent(),m.event_type=y.event_type,m.event_properties=v(v({},m.event_properties),y.event_properties),g.label=2;case 2:return[2,m]}})})},teardown:function(){return p(void 0,void 0,void 0,function(){return f(this,function(m){return n&&(n.removeEventListener("popstate",l),i&&(n.history.pushState=i)),[2]})})}};return d},ai=function(){return p(void 0,void 0,void 0,function(){var t;return f(this,function(e){switch(e.label){case 0:return t=_r,[4,new Se().parse()];case 1:return[2,t.apply(void 0,[e.sent()])]}})})},ui=function(t){if(t.event_type==="$identify"&&t.user_properties){var e=t.user_properties,n=e[L.SET]||{},r=e[L.UNSET]||{},i=q(q([],w(Object.keys(n)),!1),w(Object.keys(r)),!1);return Object.keys(pe).every(function(o){return i.includes(o)})}return!1},ci=function(t,e,n){switch(t){case"pathOnly":return e.split("?")[0]!==n.split("?")[0];default:return e!==n}};var Er=function(){var t,e=[],n=function(a,l,d){a.addEventListener(l,d),e.push({element:a,type:l,handler:d})},r=function(){e.forEach(function(a){var l=a.element,d=a.type,m=a.handler;l?.removeEventListener(d,m)}),e=[]},i="@amplitude/plugin-form-interaction-tracking-browser",o="enrichment",s=function(a,l){return p(void 0,void 0,void 0,function(){var d,m;return f(this,function(y){return l?typeof document>"u"?[2]:(d=function(g){var T=!1;n(g,"change",function(){var h;T||l.track(rn,(h={},h[ot]=he(g.id),h[st]=he(g.name),h[at]=g.action,h)),T=!0}),n(g,"submit",function(){var h,_;T||l.track(rn,(h={},h[ot]=he(g.id),h[st]=he(g.name),h[at]=g.action,h)),l.track(or,(_={},_[ot]=he(g.id),_[st]=he(g.name),_[at]=g.action,_)),T=!1})},m=Array.from(document.getElementsByTagName("form")),m.forEach(d),typeof MutationObserver<"u"&&(t=new MutationObserver(function(g){g.forEach(function(T){T.addedNodes.forEach(function(h){h.nodeName==="FORM"&&d(h),"querySelectorAll"in h&&typeof h.querySelectorAll=="function"&&Array.from(h.querySelectorAll("form")).map(d)})})}),t.observe(document.body,{subtree:!0,childList:!0})),[2]):(a.loggerProvider.warn("Form interaction tracking requires a later version of @amplitude/analytics-browser. Form interaction events are not tracked."),[2])})})},u=function(a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return[2,a]})})},c=function(){return p(void 0,void 0,void 0,function(){return f(this,function(a){return t?.disconnect(),r(),[2]})})};return{name:i,type:o,setup:s,execute:u,teardown:c}},he=function(t){if(typeof t=="string")return t};var Tr=function(){var t,e=[],n=function(a,l,d){a.addEventListener(l,d),e.push({element:a,type:l,handler:d})},r=function(){e.forEach(function(a){var l=a.element,d=a.type,m=a.handler;l?.removeEventListener(d,m)}),e=[]},i="@amplitude/plugin-file-download-tracking-browser",o="enrichment",s=function(a,l){return p(void 0,void 0,void 0,function(){var d,m,y;return f(this,function(g){return l?typeof document>"u"?[2]:(d=function(T){var h;try{h=new URL(T.href,window.location.href)}catch{return}var _=m.exec(h.href),U=_?.[1];U&&n(T,"click",function(){var b;U&&l.track(sr,(b={},b[ar]=U,b[ur]=h.pathname,b[cr]=T.id,b[lr]=T.text,b[dr]=T.href,b))})},m=/\\.(pdf|xlsx?|docx?|txt|rtf|csv|exe|key|pp(s|t|tx)|7z|pkg|rar|gz|zip|avi|mov|mp4|mpe?g|wmv|midi?|mp3|wav|wma)$/,y=Array.from(document.getElementsByTagName("a")),y.forEach(d),typeof MutationObserver<"u"&&(t=new MutationObserver(function(T){T.forEach(function(h){h.addedNodes.forEach(function(_){_.nodeName==="A"&&d(_),"querySelectorAll"in _&&typeof _.querySelectorAll=="function"&&Array.from(_.querySelectorAll("a")).map(d)})})}),t.observe(document.body,{subtree:!0,childList:!0})),[2]):(a.loggerProvider.warn("File download tracking requires a later version of @amplitude/analytics-browser. File download events are not tracked."),[2])})})},u=function(a){return p(void 0,void 0,void 0,function(){return f(this,function(l){return[2,a]})})},c=function(){return p(void 0,void 0,void 0,function(){return f(this,function(a){return t?.disconnect(),r(),[2]})})};return{name:i,type:o,setup:s,execute:u,teardown:c}};var br=!1,Ir=function(t){if(!(br||t.defaultTracking!==void 0)){var e=\`\\\`options.defaultTracking\\\` is set to undefined. This implicitly configures your Amplitude instance to track Page Views, Sessions, File Downloads, and Form Interactions. You can suppress this warning by explicitly setting a value to \\\`options.defaultTracking\\\`. The value must either be a boolean, to enable and disable all default events, or an object, for advanced configuration. For example:
|
|
@@ -246,4 +246,4 @@ Visit https://www.docs.developers.amplitude.com/data/sdks/browser-2/#tracking-de
|
|
|
246
246
|
</script>
|
|
247
247
|
</body>
|
|
248
248
|
</html>
|
|
249
|
-
`)}async function B(e,t){let r=await P(e),o=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,r).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,o.length?o[0].name:"")}import{platform as re}from"os";async function V(e,t){let r=new URL("/cli-auth","https://builder.io");r.searchParams.set("client_id",e.getClientId()),r.searchParams.set("host",await e.getDeviceId()),r.searchParams.set("response_type","code"),r.searchParams.set("cli","true");let o=new URL(f,e.devToolsServerUrl);o.searchParams.set(_,re()),o.searchParams.set(D,process.versions.node);let s=e.getFrameworks();return s.length>0&&(r.searchParams.set(T,s[0].name),o.searchParams.set(T,s[0].name)),r.searchParams.set("redirect_url",o.href),r.searchParams.set("preview_url",t),r.href}async function K(e,t,r,o){try{if(!e)return m(r,o,400,"Builder context closed");let s=ae(r);if(s.pathname===b){if(r.method==="POST"){let i=await ie(r);if(i)try{let n=await M(e,JSON.parse(i));return j(r,o,200,n)}catch(n){e.debug("Dev API Error",n.stack||n.message||n);let a={errors:[String(n.message||n)]};return j(r,o,500,a)}}else if(r.method==="OPTIONS"){let i={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version"},n=r.headers.origin;n&&n!=="null"?J(new URL(n))&&(i["Access-Control-Allow-Origin"]=n):i["Access-Control-Allow-Origin"]="*",o.writeHead(200,i),o.end();return}return m(r,o,405,`${b} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(s.pathname===A)return oe(r,o,200,await x(e));if(s.pathname===E){let i=s.searchParams.get(S);return i?se(o,302,await V(e,i)):m(r,o,400,`Missing ${S} querystring`)}return s.pathname===f?ne(r,o,200,await H(e)):s.pathname===d?(e.debug(`Close Dev Tools Server Requested: ${s.href}`),setTimeout(()=>{try{t.close(i=>{e.debug(`Dev Tools Server Closed Error: ${i}`)})}catch(i){e.debug(`Error closing devtools server: ${i}`)}},20),m(r,o,200,"Closing Dev Tools Server")):m(r,o,404,"Not found")}catch(s){return console.error("Dev Server Error",s),m(r,o,500,`Dev Server Error: ${s}`)}}function j(e,t,r,o){v(e,t,r,"application/json",JSON.stringify(o))}function oe(e,t,r,o){v(e,t,r,"application/javascript",o)}function ne(e,t,r,o){v(e,t,r,"text/html",o)}function m(e,t,r,o){v(e,t,r,"text/plain",o)}function v(e,t,r,o,s){let i={"Content-Type":`${o}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.1.12"},n=e.headers.origin;n&&n!=="null"?J(new URL(n))&&(i["Access-Control-Allow-Origin"]=n):i["Access-Control-Allow-Origin"]="*",t.writeHead(r,i),t.end(s)}function J(e){return e.hostname==="localhost"||e.origin
|
|
249
|
+
`)}async function B(e,t){let r=await P(e),o=e.getFrameworks();return t.replace(/__LOCAL_APP_ID__/g,r).replace(/__DEV_TOOLS_URL__/g,e.devToolsServerUrl).replace(/__CLIENT_ID__/g,e.getClientId()).replace(/__FRAMEWORK__/g,o.length?o[0].name:"")}import{platform as re}from"os";async function V(e,t){let r=new URL("/cli-auth","https://builder.io");r.searchParams.set("client_id",e.getClientId()),r.searchParams.set("host",await e.getDeviceId()),r.searchParams.set("response_type","code"),r.searchParams.set("cli","true");let o=new URL(f,e.devToolsServerUrl);o.searchParams.set(_,re()),o.searchParams.set(D,process.versions.node);let s=e.getFrameworks();return s.length>0&&(r.searchParams.set(T,s[0].name),o.searchParams.set(T,s[0].name)),r.searchParams.set("redirect_url",o.href),r.searchParams.set("preview_url",t),r.href}async function K(e,t,r,o){try{if(!e)return m(r,o,400,"Builder context closed");let s=ae(r);if(s.pathname===b){if(r.method==="POST"){let i=await ie(r);if(i)try{let n=await M(e,JSON.parse(i));return j(r,o,200,n)}catch(n){e.debug("Dev API Error",n.stack||n.message||n);let a={errors:[String(n.message||n)]};return j(r,o,500,a)}}else if(r.method==="OPTIONS"){let i={"Access-Control-Allow-Methods":"POST, OPTIONS","Access-Control-Allow-Headers":"Content-Type, Cache-Control, X-Builder-Devtools-Version"},n=r.headers.origin;n&&n!=="null"?J(new URL(n))&&(i["Access-Control-Allow-Origin"]=n):i["Access-Control-Allow-Origin"]="*",o.writeHead(200,i),o.end();return}return m(r,o,405,`${b} is an API endpoint used only during development by the Builder.io Devtools client-side script`)}if(s.pathname===A)return oe(r,o,200,await x(e));if(s.pathname===E){let i=s.searchParams.get(S);return i?se(o,302,await V(e,i)):m(r,o,400,`Missing ${S} querystring`)}return s.pathname===f?ne(r,o,200,await H(e)):s.pathname===d?(e.debug(`Close Dev Tools Server Requested: ${s.href}`),setTimeout(()=>{try{t.close(i=>{e.debug(`Dev Tools Server Closed Error: ${i}`)})}catch(i){e.debug(`Error closing devtools server: ${i}`)}},20),m(r,o,200,"Closing Dev Tools Server")):m(r,o,404,"Not found")}catch(s){return console.error("Dev Server Error",s),m(r,o,500,`Dev Server Error: ${s}`)}}function j(e,t,r,o){v(e,t,r,"application/json",JSON.stringify(o))}function oe(e,t,r,o){v(e,t,r,"application/javascript",o)}function ne(e,t,r,o){v(e,t,r,"text/html",o)}function m(e,t,r,o){v(e,t,r,"text/plain",o)}function v(e,t,r,o,s){let i={"Content-Type":`${o}; charset=utf-8`,"Cache-Control":"no-cache, no-store, must-revalidate","X-Builder-Devtools-Version":"1.1.12"},n=e.headers.origin;n&&n!=="null"?J(new URL(n))&&(i["Access-Control-Allow-Origin"]=n):i["Access-Control-Allow-Origin"]="*",t.writeHead(r,i),t.end(s)}function J(e){return e.hostname==="localhost"||e.origin.endsWith(".builder.io")?!0:e.port===""?!1:e.port!=="80"&&e.port!=="443"}function se(e,t,r){e.writeHead(t,{Location:r}),e.end()}async function ie(e){let t="";for await(let r of e)t+=r;return t}function ae(e){let t=e.url||"/";return new URL(t,`http://${e.headers.host}`)}async function Q(e){if(globalThis.__builderDevToolsServer)return e.debug("reusing existing devtools server"),globalThis.__builderDevToolsServer.setContext(e),globalThis.__builderDevToolsServer;let t=await de(e),r=le((s,i)=>{K(e,r,s,i)}),o=()=>new Promise((s,i)=>{r.listening?(e.debug(`closing devtools server on port ${t}`),r.close(n=>{e=null,n?(e.debug(`error closing devtools server on port ${t}`),i(n)):(e&&e.debug(`closed devtools server on port ${t}`),s())})):(e.debug(`devtools server on port ${t} not listening`),s())});return process.once("SIGTERM",o),process.once("SIGINT",o),process.env.CI!=="true"&&process.stdin.on("end",o),globalThis.__builderDevToolsServer={url:new URL(`http://localhost:${t}`).href,port:t,setContext:s=>{e.debug(`set devtools context on server ${t}`),e=s},close:async()=>{globalThis.__builderDevToolsServer=null,await o()}},new Promise(s=>{r.listen(t,()=>{e.debug(`started devtools server on port ${t}`),s(globalThis.__builderDevToolsServer)})})}function de(e){return new Promise(t=>{let r=e.port;try{ue({hostname:"localhost",port:r,path:d,method:"GET"},s=>{s.on("end",()=>{e.debug(`${d} - Response ended`),t(r)})}).on("error",s=>{e.debug(`${d} - No response ${s}`),t(r)}).end()}catch(o){e.debug(`${d} - Error ${o}`),t(r)}})}async function ce(e){let t={getPastSyncInfo:()=>null,resyncSnippet:()=>null,...e,devToolsServerUrl:"",isValid:!1,publicApiKey:"",serverShouldRestart:!1,port:e.port||5273,ignoreMissingConfig:!1},r=e.getFrameworks().map(i=>i.name).join(", ");t.debug(`create devtools ${W} [${r}]`);let o=await Q(t);return t.devToolsServerUrl=o.url,t.port=o.port,{getUrl:()=>t.devToolsServerUrl}}var W="1.1.12";export{ce as createDevToolsServer,W as version};
|