@lucida-analytics/browser 0.1.6 → 0.1.8

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.
Files changed (90) hide show
  1. package/CHANGELOG.md +55 -0
  2. package/README.md +39 -6
  3. package/dist/autocapture.d.ts +1 -1
  4. package/dist/{banner-7LEREYUH.js → banner-TXLAMTQM.js} +1 -1
  5. package/dist/{static/v0.1.6/chunk-FUE3SDQU.js → chunk-B722OERZ.js} +1 -1
  6. package/dist/chunk-IXDYCBAD.js +1 -0
  7. package/dist/{client-pxkkaWtR.d.ts → client-BBmHQqm1.d.ts} +2 -2
  8. package/dist/consent.d.ts +15 -8
  9. package/dist/consent.js +1 -1
  10. package/dist/core.d.ts +3 -3
  11. package/dist/core.js +3 -3
  12. package/dist/correlate.d.ts +2 -2
  13. package/dist/correlate.js +1 -1
  14. package/dist/early-access.d.ts +1 -1
  15. package/dist/experiments.d.ts +1 -1
  16. package/dist/flags.d.ts +1 -1
  17. package/dist/forms.d.ts +1 -1
  18. package/dist/guides.d.ts +1 -1
  19. package/dist/guides.js +1 -1
  20. package/dist/heatmaps.d.ts +1 -1
  21. package/dist/host-headers.d.ts +1 -1
  22. package/dist/index.d.ts +3 -3
  23. package/dist/index.js +3 -3
  24. package/dist/inspector.d.ts +1 -1
  25. package/dist/lucida.js +2 -2
  26. package/dist/{persistent-SLVINN5A.js → persistent-G2OR2L2N.js} +1 -1
  27. package/dist/recommendations.d.ts +1 -1
  28. package/dist/{recorder-4WIMQCLR.js → recorder-7BHG7KAJ.js} +4 -4
  29. package/dist/replay.d.ts +2 -2
  30. package/dist/replay.js +1 -1
  31. package/dist/static/v0/{banner-7LEREYUH.js → banner-TXLAMTQM.js} +1 -1
  32. package/dist/static/v0/{chunk-FUE3SDQU.js → chunk-B722OERZ.js} +1 -1
  33. package/dist/static/v0/chunk-IXDYCBAD.js +1 -0
  34. package/dist/static/v0/consent.js +1 -1
  35. package/dist/static/v0/core.js +3 -3
  36. package/dist/static/v0/correlate.js +1 -1
  37. package/dist/static/v0/guides.js +1 -1
  38. package/dist/static/v0/index.js +3 -3
  39. package/dist/static/v0/lucida.js +2 -2
  40. package/dist/static/v0/manifest.json +13 -13
  41. package/dist/static/v0/{persistent-SLVINN5A.js → persistent-G2OR2L2N.js} +1 -1
  42. package/dist/static/{v0.1.6/recorder-4WIMQCLR.js → v0/recorder-7BHG7KAJ.js} +4 -4
  43. package/dist/static/v0/replay.js +1 -1
  44. package/dist/static/v0/toolbar.js +4 -4
  45. package/dist/static/v0/{validation-HGJXZ553.js → validation-S6TYVWAI.js} +1 -1
  46. package/dist/static/{v0.1.6/banner-7LEREYUH.js → v0.1.8/banner-TXLAMTQM.js} +1 -1
  47. package/dist/{chunk-FUE3SDQU.js → static/v0.1.8/chunk-B722OERZ.js} +1 -1
  48. package/dist/static/v0.1.8/chunk-IXDYCBAD.js +1 -0
  49. package/dist/static/v0.1.8/consent.js +1 -0
  50. package/dist/static/v0.1.8/core.js +3 -0
  51. package/dist/static/v0.1.8/correlate.js +1 -0
  52. package/dist/static/{v0.1.6 → v0.1.8}/guides.js +1 -1
  53. package/dist/static/v0.1.8/index.js +3 -0
  54. package/dist/static/v0.1.8/lucida.js +3 -0
  55. package/dist/static/v0.1.8/manifest.json +28 -0
  56. package/dist/static/{v0.1.6/persistent-SLVINN5A.js → v0.1.8/persistent-G2OR2L2N.js} +1 -1
  57. package/dist/static/{v0/recorder-4WIMQCLR.js → v0.1.8/recorder-7BHG7KAJ.js} +4 -4
  58. package/dist/static/{v0.1.6 → v0.1.8}/replay.js +1 -1
  59. package/dist/static/{v0.1.6 → v0.1.8}/toolbar.js +4 -4
  60. package/dist/static/{v0.1.6/validation-HGJXZ553.js → v0.1.8/validation-S6TYVWAI.js} +1 -1
  61. package/dist/toolbar.d.ts +1 -1
  62. package/dist/toolbar.js +4 -4
  63. package/dist/{types-QPJGHOv0.d.ts → types-Tl9ypGho.d.ts} +8 -4
  64. package/dist/{validation-HGJXZ553.js → validation-S6TYVWAI.js} +1 -1
  65. package/dist/webmcp.d.ts +1 -1
  66. package/package.json +3 -2
  67. package/storage.json +4 -2
  68. package/dist/chunk-536QABLP.js +0 -1
  69. package/dist/static/v0/chunk-536QABLP.js +0 -1
  70. package/dist/static/v0.1.6/chunk-536QABLP.js +0 -1
  71. package/dist/static/v0.1.6/consent.js +0 -1
  72. package/dist/static/v0.1.6/core.js +0 -3
  73. package/dist/static/v0.1.6/correlate.js +0 -1
  74. package/dist/static/v0.1.6/index.js +0 -3
  75. package/dist/static/v0.1.6/lucida.js +0 -3
  76. package/dist/static/v0.1.6/manifest.json +0 -28
  77. /package/dist/static/{v0.1.6 → v0.1.8}/autocapture.js +0 -0
  78. /package/dist/static/{v0.1.6 → v0.1.8}/chunk-AWIQCFGN.js +0 -0
  79. /package/dist/static/{v0.1.6 → v0.1.8}/chunk-EFNCQJI3.js +0 -0
  80. /package/dist/static/{v0.1.6 → v0.1.8}/chunk-UPPUYIIH.js +0 -0
  81. /package/dist/static/{v0.1.6 → v0.1.8}/early-access.js +0 -0
  82. /package/dist/static/{v0.1.6 → v0.1.8}/experiments.js +0 -0
  83. /package/dist/static/{v0.1.6 → v0.1.8}/flags.js +0 -0
  84. /package/dist/static/{v0.1.6 → v0.1.8}/forms.js +0 -0
  85. /package/dist/static/{v0.1.6 → v0.1.8}/heatmaps.js +0 -0
  86. /package/dist/static/{v0.1.6 → v0.1.8}/host-headers.js +0 -0
  87. /package/dist/static/{v0.1.6 → v0.1.8}/inspector.js +0 -0
  88. /package/dist/static/{v0.1.6 → v0.1.8}/modules-FANMZRDJ.js +0 -0
  89. /package/dist/static/{v0.1.6 → v0.1.8}/recommendations.js +0 -0
  90. /package/dist/static/{v0.1.6 → v0.1.8}/webmcp.js +0 -0
@@ -1,4 +1,4 @@
1
- var yn=Object.defineProperty;var N=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)yn(e,n,{get:t[n],enumerable:!0})};function F(e){let t=[];for(let n=e;n&&t.length<bn;n=n.parentElement){let o=n.tagName.toLowerCase();if(n.id&&Ve.test(n.id)){t.unshift(`${o}#${n.id}`);break}let r=(n.getAttribute("class")??"").split(/\s+/).filter(i=>Ve.test(i)).slice(0,2);t.unshift(o+r.map(i=>`.${i}`).join(""))}return t.join(" ")}var Ve,bn,de=N(()=>{"use strict";Ve=/^[A-Za-z_][\w-]*$/,bn=5});function Xe(e,t){let n=t?.[e.key];if(e.op==="exists")return n!=null;if(n==null)return e.op==="neq";let[o,r]=[String(n),String(e.value??"")];return e.op==="eq"?o===r:e.op==="neq"?o!==r:o.includes(r)}var Ye=N(()=>{"use strict"});function Ze(e,t){let n=()=>typeof e.value=="string"&&t.present?t.present(e.value):xn(e.value);if(e.op==="element_present")return n();if(e.op==="element_absent")return!n();if(e.op==="flag_on"||e.op==="flag_off"){let o=typeof e.value=="string"&&!!t.flag?.(e.value);return e.op==="flag_on"?o:!o}return Xe({key:e.key,op:e.op,value:e.value},t.person)}function xe(e){return e.matches("input[type=password],[data-lc-mask],.lc-mask,[autocomplete^=cc-]")?!0:!!e.closest("[data-lc-mask],.lc-mask")}function Qe(e,t=document){if(!e.selector||e.selector.length>500)return"invalid";let n;try{n=t.querySelector(e.selector)}catch{return"invalid"}if(!n)return"missing";if(xe(n))return"refused";if(e.action==="click")n.click();else if(e.action==="focus")n.focus();else if(e.action==="fill"){if(typeof e.value!="string"||e.value.length>200||!n.matches(kn))return"refused";let o=n instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(o,"value")?.set;r?r.call(n,e.value):n.value=e.value,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}else return"invalid";return"done"}function et(e=["#e5484d","#30a46c","#0090ff","#f5d90a","#8e4ec6"]){if(typeof document>"u"||wn())return;let t=document.createElement("canvas");t.setAttribute("data-lc-ignore",""),t.setAttribute("aria-hidden","true"),t.width=innerWidth,t.height=innerHeight,t.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483001";let n=t.getContext("2d");if(!n)return;document.body.append(t);let o=Array.from({length:120},(s,a)=>({x:innerWidth/2,y:innerHeight/3,vx:(Math.random()-.5)*12,vy:Math.random()*-10-2,color:e[a%e.length]})),r=Date.now()+1500,i=()=>{n.clearRect(0,0,t.width,t.height);for(let s of o)s.x+=s.vx,s.y+=s.vy,s.vy+=.35,n.fillStyle=s.color,n.fillRect(s.x,s.y,6,4);Date.now()<r?requestAnimationFrame(i):t.remove()};requestAnimationFrame(i)}var xn,kn,wn,Oe=N(()=>{"use strict";Ye();xn=e=>{if(typeof e!="string"||!e)return!1;try{return!!document.querySelector(e)}catch{return!1}};kn="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";wn=()=>{try{return matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}});function ee(e,t=ke){for(let n of t){let o=e.getAttribute(n);if(o&&!/["\\]/.test(o))return`[${n}="${o}"]`}return e.id&&En.test(e.id)?`#${e.id}`:F(e)}function we(e,t){let n={...t,id:`s${e.steps.length+1}`};return e.steps.push(n),n}function tt(e){if(!e.name.trim())return"Name the guide";if(!e.steps.length)return"Add at least one step";if(_n.has(e.kind)&&e.steps.length!==1)return`A ${e.kind} has exactly one step`;let t=An[e.kind];if(t&&(e.steps.length<t[0]||e.steps.length>t[1]))return`A ${e.kind} has ${t[0]} to ${t[1]} steps`;for(let[n,o]of e.steps.entries()){if(e.kind==="form_validation"){if(!o.validation?.selector||!o.validation.rules?.length)return`Step ${n+1} needs a field and at least one rule`;continue}if(!o.title?.trim()&&!o.body?.trim())return`Step ${n+1} needs a title or body`;if(Sn.has(e.kind)&&!o.selector)return`Step ${n+1} needs a picked element`;let r=o.automation?Ee(o.automation):null;if(r)return`Step ${n+1}: ${r}`}return null}function nt(e,t){return{name:e.name.trim(),kind:e.kind,steps:e.steps,targeting:e.targeting??{url:t,url_match:"exact"}}}function Ee(e,t=document){if(!e.selector||e.selector.length>500)return"automation needs a selector (max 500 chars)";let n;try{n=[...t.querySelectorAll(e.selector)]}catch{return`invalid selector ${e.selector}`}if(!n.length)return`nothing on this page matches ${e.selector}`;if(n.length>1)return`${e.selector} matches ${n.length} elements; pick a unique one`;let o=n[0];if(xe(o))return"automations never touch password, masked or card fields";if(e.action==="fill"){if(typeof e.value!="string"||!e.value||e.value.length>200)return"fill needs a value (max 200 chars)";if(!o.matches(Cn))return"fill needs a text field"}return null}function Tn(e){if(e.matches("input,textarea,select")||xe(e))return;let t=(e.getAttribute("aria-label")??e.textContent??"").trim().replace(/\s+/g," ");return t?t.slice(0,80):void 0}function rt(e,t=ke,n=30){let o=0,r=i=>{let s=i.target;if(!(s instanceof Element)||i.composedPath().some(d=>d instanceof Element&&d.hasAttribute("data-lc-ignore"))||o>=n)return;o++;let a=s.closest("button,a,[role=button],input,select,textarea,label,[data-lc-id],[data-testid]")??s,u=Tn(a);e({selector:ee(a,t),url:location.pathname,...u?{text:u}:{}})};return document.addEventListener("click",r,!0),()=>document.removeEventListener("click",r,!0)}function it(e){let t={name:"Recorded tour",kind:"tour",steps:[]};for(let n of e)we(t,{title:n.text?`Click "${n.text}"`:"Next step",body:"Continue here.",selector:n.selector,url:n.url,advance:"click"});return t}var ke,En,_n,Sn,An,Cn,He,ot,re=N(()=>{"use strict";de();Oe();ke=["data-lc-id","data-testid","data-test","data-cy","data-qa"],En=/^[A-Za-z_][\w-]*$/,_n=new Set(["tooltip","modal","banner","announcement","hotspot","beacon","badge","slideout","inline"]),Sn=new Set(["tooltip","tour","hotspot","beacon","badge","inline"]),An={carousel:[1,10],form_validation:[1,30]},Cn="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";He=()=>({name:"",kind:"tooltip",steps:[]});ot=e=>({id:e.id??"preview",name:e.name,kind:e.kind,steps:e.steps,conditions:{}})});async function ct(e,t){try{let n=await e.fetch(`${Se(e)}/v1/toolbar/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify({token:t,origin:location.origin})});if(!n.ok)return null;let o=await n.json();return{session_token:o.token,project_id:o.project_id,expires_at:o.expires_at,permissions:o.scopes}}catch{return null}}function dt(e,t){let n=`${Se(e)}/v1/projects/${encodeURIComponent(t.project_id)}`,o=async(i,s={})=>{try{let a=await e.fetch(n+i,{...s,credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":"application/json"}});return a.ok?await a.json():null}catch{return null}},r=(i,s)=>`url=${encodeURIComponent(i)}&viewport=${s}`;return{scopes:t.permissions??[],createAction:i=>o("/actions",{method:"POST",body:JSON.stringify(i)}),updateAction:(i,s)=>o(`/actions/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify(s)}),deleteAction:async i=>{try{return(await e.fetch(`${n}/actions/${encodeURIComponent(i)}`,{method:"DELETE",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`}})).ok}catch{return!1}},putActionScreenshot:async(i,s)=>{try{return(await e.fetch(`${n}/actions/${encodeURIComponent(i)}/screenshot`,{method:"PUT",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":"image/png"},body:s})).ok}catch{return!1}},listActions:()=>o("/actions?limit=200").then(i=>i?.data??[]),flags:()=>o("/flags?limit=200").then(i=>i?.data??[]),heat:(i,s,a)=>o(`/heatmaps?${r(i,s)}&type=${a}`),scroll:(i,s)=>o(`/heatmaps?${r(i,s)}&type=scroll`),confetti:(i,s,a)=>o(`/heatmaps/confetti?${r(i,s)}&breakdown=${encodeURIComponent(a)}`),elements:(i,s,a,u=!1)=>o(`/heatmaps/elements?${r(i,s)}&limit=50${u?"&key=href":""}${a?`&cursor=${encodeURIComponent(a)}`:""}`),listGuides:()=>o("/guides?limit=100").then(i=>i?.data??[]),createGuide:i=>o("/guides",{method:"POST",body:JSON.stringify(i)}),updateGuide:(i,s)=>o(`/guides/${encodeURIComponent(i)}`,{method:"PUT",body:JSON.stringify(s)}),draftGuide:i=>o("/guides/draft",{method:"POST",body:JSON.stringify(i)}),createTheme:i=>o("/guide-themes",{method:"POST",body:JSON.stringify(i)}),experiment:i=>o(`/experiments/${encodeURIComponent(i)}`),saveVariants:(i,s)=>o(`/experiments/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify({variants:s})}),addGoal:(i,s)=>o(`/experiments/${encodeURIComponent(i)}/goals`,{method:"POST",body:JSON.stringify(s)}),uploadAsset:async i=>{try{let s=await e.fetch(`${n}/experiments/assets`,{method:"POST",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":i.type||"application/octet-stream"},body:i});return s.ok?(await s.json()).url:null}catch{return null}}}}function pt(e,t){let n=De();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(ut,JSON.stringify(n))}catch{}}function De(){try{return JSON.parse(localStorage.getItem(ut)??"{}")}catch{return{}}}var _e,Ie,se,ae,Se,ut,ie=N(()=>{"use strict";_e="guides:write",Ie="experiments:write",se="__lc_edit",ae="__lc_toolbar",Se=e=>(e.config.uiHost??e.config.apiHost??"").replace(/\/+$/,"");ut="lc_flag_overrides"});function Ae(e,t){let n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.textContent=e,n}var Ne=N(()=>{"use strict"});function ue(e){let t=e.trim();return t?/^data:/i.test(t)?Gn.test(t):/^(https?:)?\/\//i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t):!1}function Un(e){let t=e.trim();return/^(https?:|mailto:|tel:)/i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Kn(e){for(let{name:t,value:n}of[...e.attributes]){let o=t.toLowerCase();(jn.has(o)||o.startsWith("aria-")||o.startsWith("data-")&&!o.startsWith("data-lc"))&&(o!=="href"||Un(n))&&(o!=="src"||ue(n))&&(o!=="srcset"||Bn(n))&&(o!=="style"||Fn(n))||e.removeAttribute(t)}e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener noreferrer")}function gt(e){for(let t of[...e.childNodes]){if(t.nodeType===3)continue;if(t.nodeType!==1){t.remove();continue}let n=t,o=n.tagName.toUpperCase();if(Dn.has(o)){n.remove();continue}if(gt(n),!Nn.has(o)){n.replaceWith(...n.childNodes);continue}Kn(n)}}function ht(e){let t=document.createElement("template");return t.innerHTML=e,gt(t.content),document.importNode(t.content,!0)}var Dn,Nn,jn,Gn,Bn,Fn,vt=N(()=>{"use strict";Dn=new Set(["SCRIPT","STYLE","IFRAME","FRAME","FRAMESET","OBJECT","EMBED","APPLET","TEMPLATE","NOSCRIPT","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","LINK","META","BASE","AUDIO","VIDEO","PORTAL"]),Nn=new Set(["A","ABBR","B","BLOCKQUOTE","BR","BUTTON","CAPTION","CITE","CODE","DD","DEL","DETAILS","DIV","DL","DT","EM","FIGCAPTION","FIGURE","FOOTER","H1","H2","H3","H4","H5","H6","HEADER","HR","I","IMG","INS","KBD","LABEL","LI","MARK","NAV","OL","P","PICTURE","PRE","Q","S","SECTION","ARTICLE","ASIDE","SMALL","SOURCE","SPAN","STRONG","SUB","SUMMARY","SUP","TABLE","TBODY","TD","TFOOT","TH","THEAD","TIME","TR","U","UL"]),jn=new Set(["class","id","title","alt","href","src","srcset","sizes","width","height","role","target","rel","colspan","rowspan","loading","decoding","lang","dir","style","datetime","media"]),Gn=/^data:image\/(png|jpe?g|gif|webp|avif);/i;Bn=e=>e.split(",").every(t=>ue(t.trim().split(/\s+/)[0]??"")),Fn=e=>!/url\s*\(|expression\s*\(|@import|behavior\s*:|javascript:/i.test(e)});function yt(e){let t=JSON.stringify(e),n=5381;for(let o=0;o<t.length;o++)n=(n<<5)+n+t.charCodeAt(o)|0;return`c${(n>>>0).toString(36)}`}function je(e,t){let n=e?.[pe];return Array.isArray(n)?n.filter(o=>!!o&&typeof o=="object"&&typeof o.type=="string"&&(typeof o.selector=="string"||zn.has(o.type))&&(t===void 0||!o.url||t.includes(o.url))):[]}function Vn(e,t){let n=yt(t),o=(e.getAttribute(Te)??"").split(" ").filter(Boolean);if(o.includes(n)||!Jn.has(t.position)||typeof t.html!="string")return;let r=ht(t.html);for(let i of[...r.children])i.setAttribute(Ce,n);t.position==="before"?e.before(r):t.position==="after"?e.after(r):t.position==="prepend"?e.prepend(r):e.append(r),e.setAttribute(Te,[...o,n].join(" "))}function Yn(e,t){let n=e.tagName.toUpperCase();if(!(typeof t.src!="string"||!ue(t.src))){if(n==="SOURCE"){e.setAttribute("srcset",t.src);return}n==="IMG"&&(e.setAttribute("src",t.src),t.srcset&&Xn(t.srcset)?e.setAttribute("srcset",t.srcset):e.removeAttribute("srcset"),typeof t.alt=="string"&&e.setAttribute("alt",t.alt))}}function Zn(e,t,n){let o=yt(e);if(n.querySelector(`[${Ce}="${o}"]`))return;let r;if(e.type==="css"){if(typeof e.css!="string")return;r=n.importNode(Ae(e.css,t.nonce),!0)}else{if(e.approved!==!0||!t.allowJs||typeof e.js!="string")return;r=n.createElement("script"),t.nonce&&r.setAttribute("nonce",t.nonce),r.textContent=e.js}r.setAttribute(Ce,o),n.head.append(r)}function Qn(e,t){let n=e;switch(t.type){case"text":e.textContent=t.value;break;case"attr":if(Wn.test(t.name)||typeof t.value=="string"&&/^(href|src|action|formaction)$/i.test(t.name)&&qn.test(t.value))break;t.value===null?e.removeAttribute(t.name):e.setAttribute(t.name,t.value);break;case"style":for(let[o,r]of Object.entries(t.styles))n.style.setProperty(o,r);break;case"hide":n.style.setProperty("display","none","important");break;case"insert":Vn(e,t);break;case"image":Yn(e,t);break;case"reorder":{let o=e.parentElement;if(!o)break;let r=[...o.children].filter(s=>s!==e),i=Math.max(0,Math.min(t.index,r.length));o.insertBefore(e,r[i]??null);break}}}function oe(e,t=document,n={}){let o=[];for(let r of e){if(n.requireApproval&&(r.type==="css"||r.type==="js"||r.type==="insert")&&r.approved!==!0)continue;if(r.type==="css"||r.type==="js"){let s=t.nodeType===9?t:t.ownerDocument;s?.head&&Zn(r,n,s);continue}let i;try{i=[...t.querySelectorAll(r.selector)]}catch{continue}i.length||o.push(r);for(let s of i)Qn(s,r)}return o}function bt(e=document){for(let t of[...e.querySelectorAll(`[${Ce}]`)])t.remove();for(let t of[...e.querySelectorAll(`[${Te}]`)])t.removeAttribute(Te)}var pe,Ce,Wn,qn,zn,Jn,Te,Xn,Re=N(()=>{"use strict";Ne();vt();pe="lc_changes",Ce="data-lc-change",Wn=/^on/i,qn=/^\s*(javascript|data|vbscript):/i,zn=new Set(["css","js"]),Jn=new Set(["before","after","prepend","append"]),Te="data-lc-inserted";Xn=e=>e.split(",").every(t=>ue(t.trim().split(/\s+/)[0]??""))});function me(e=[],t=()=>!1,n={}){let o=[...e],r=[],i=[],s=new Map,a=new Set,u=l=>`${l.url??""}|${l.selector??""}|${l.type}|${l.type==="attr"?l.name:""}`,d=l=>{if(!l)return;let p=[];try{p=[...document.querySelectorAll(l)]}catch{return}for(let c of p)s.has(c)||s.set(c,{attrs:[...c.attributes].map(h=>[h.name,h.value]),kids:[...c.childNodes].map(h=>h.cloneNode(!0)),parent:c.parentNode,next:c.nextSibling})},y=()=>{bt();for(let[l,p]of s){for(let c of[...l.attributes])l.removeAttribute(c.name);for(let[c,h]of p.attrs)l.setAttribute(c,h);l.replaceChildren(...p.kids.map(c=>c.cloneNode(!0))),p.parent&&(p.next===null||p.next.parentNode===p.parent)&&p.parent.insertBefore(l,p.next)}oe(o,document,{...n,allowJs:!1});for(let l of a)l()},w=l=>{r.push(o),r.length>eo&&r.shift(),i.length=0,o=l},f=(l,p)=>{d(l);let c={...p,...l?{selector:l}:{},...t()?{url:location.pathname}:{}},h=o.filter(v=>u(v)!==u(c));h.push(c),w(h),oe([c],document,{...n,allowJs:!1});for(let v of a)v()},b=l=>l.parentElement?[...l.parentElement.children].indexOf(l):0;for(let l of e)d(l.selector);return{changes:()=>o,text:(l,p)=>f(F(l),{type:"text",value:p}),attr:(l,p,c)=>f(F(l),{type:"attr",name:p,value:c}),style:(l,p,c)=>{let h=F(l),v=o.find(E=>E.selector===h&&E.type==="style");f(h,{type:"style",styles:{...v?.type==="style"?v.styles:{},[p]:c}})},hide:l=>f(F(l),{type:"hide"}),move:(l,p)=>{let c=Math.max(0,Math.min(b(l)+p,(l.parentElement?.children.length??1)-1));f(F(l),{type:"reorder",index:c})},insert:(l,p,c)=>{d(F(l));let h={type:"insert",position:p,html:c,selector:F(l),...t()?{url:location.pathname}:{}};w([...o,h]),oe([h],document,n);for(let v of a)v()},image:(l,p,c)=>f(F(l),{type:"image",src:p,...c!==void 0?{alt:c}:{}}),css:l=>f(void 0,{type:"css",css:l}),js:l=>f(void 0,{type:"js",js:l}),canUndo:()=>r.length>0,canRedo:()=>i.length>0,undo:()=>{let l=r.pop();l&&(i.push(o),o=l,y())},redo:()=>{let l=i.pop();l&&(r.push(o),o=l,y())},remove:l=>{l<0||l>=o.length||(w(o.filter((p,c)=>c!==l)),y())},onChange:l=>(a.add(l),()=>{a.delete(l)}),toPayload:()=>({[pe]:[...o]})}}function xt(e,t=document){let n=o=>{let r=o.target;if(r&&(r.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(r.tagName))||!(o.ctrlKey||o.metaKey))return;let i=o.key.toLowerCase();if(i==="z"&&!o.shiftKey)e().undo();else if(i==="z"&&o.shiftKey||i==="y")e().redo();else return;o.preventDefault()};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)}var eo,Ge=N(()=>{"use strict";de();Re();eo=100});function ao(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function Fe(e,t){return!!e?.some(n=>{try{return new RegExp(ao(n),"i").test(t)}catch{return!1}})}var Mt=N(()=>{"use strict"});function Ht(e){let t,n,o=()=>{let s=n?.contentDocument;s&&oe([...e()],s,{allowJs:!1})},r=()=>{t?.remove(),t=n=void 0};return{open:s=>{let a=Me[s];if(!a)return r();if(!t){t=document.createElement("div"),t.setAttribute("data-lc-ignore",""),t.setAttribute("role","dialog"),t.setAttribute("aria-label","Device preview"),t.style.cssText="position:fixed;inset:0;z-index:2147483646;background:rgba(15,23,42,.6);display:flex;align-items:center;justify-content:center",n=document.createElement("iframe"),n.title="Variant preview",n.style.cssText="height:90vh;border:0;background:#fff;border-radius:8px;box-shadow:0 8px 32px rgba(0,0,0,.4)",n.onload=o,t.append(n),t.onclick=d=>d.target===t&&r(),document.body.append(t);let u=new URL(location.href);u.hash="lc-device-preview",n.src=u.toString()}n&&(n.style.width=`${a}px`,n.setAttribute("aria-label",`${s} preview, ${a} pixels wide`))},close:r,update:()=>{n?.contentWindow&&n.contentWindow.location.reload()},isOpen:()=>!!t}}var Me,Pt=N(()=>{"use strict";Re();Me={desktop:0,tablet:768,mobile:375}});function It(e=document){let t=[],n=new Set;for(let o of e.querySelectorAll(ho)){if(o.closest("[data-lc-ignore],[data-lc-change]"))continue;let r=ee(o);if(n.has(r))continue;n.add(r);let i=o.tagName.toLowerCase(),s=(i==="img"?o.getAttribute("alt")??"":o.textContent??"").replace(/\s+/g," ").trim().slice(0,160);if(t.push({selector:r,tag:i,text:s}),t.length>=vo)break}return t}var ho,vo,Dt=N(()=>{"use strict";re();ho="h1,h2,h3,button,a,img,[role=button],section[id],header,nav,footer,form label,li",vo=150});var jt={};ye(jt,{experimentEditor:()=>yo,withChanges:()=>Nt});function Nt(e,t,n){return e.variants.map(o=>o.key===t?{...o,payload:{...o.payload,[pe]:n}}:o)}async function yo(e){let t=J("div");t.setAttribute("role","region"),t.setAttribute("aria-label","Experiment visual editor");let n=await e.api.experiment(e.experimentId);if(!n)return t.textContent="Could not load the experiment (check the toolbar scope and project).",t;let o=!!e.scopes?.includes(Ie),r=J("select");for(let x of n.variants)r.append(J("option",{value:x.key,textContent:x.key}));r.value=n.variants[1]?.key??n.variants[0]?.key??"";let i=J("input",{type:"checkbox"}),s=J("ul"),a=Q("Undo",()=>d.undo()),u=Q("Redo",()=>d.redo());a.setAttribute("aria-keyshortcuts","Control+Z Meta+Z"),u.setAttribute("aria-keyshortcuts","Control+Shift+Z Meta+Shift+Z");let d=me(),y=Ht(()=>d.changes()),w=()=>{},f=()=>{let x=n.variants.find(C=>C.key===r.value);w(),d=me(je(x?.payload),()=>i.checked),w=d.onChange(()=>(b(),y.update())),oe(je(x?.payload,location.href)),b()},b=()=>{s.replaceChildren(),d.changes().forEach((x,C)=>{let O=J("li",{textContent:`${x.type} ${x.selector??"(page)"}${x.url?` (on ${x.url})`:""} `});O.append(Q(`Remove change ${C+1}`,()=>d.remove(C))),s.append(O)}),a.disabled=!d.canUndo(),u.disabled=!d.canRedo()},l=xt(()=>d),p=J("select");for(let x of Object.keys(Me))p.append(J("option",{value:x,textContent:x==="desktop"?"Desktop (this window)":`${x} (${Me[x]}px)`}));p.onchange=()=>y.open(p.value);let c=(x,C,O)=>{let H=J("textarea",{rows:4,placeholder:O});H.style.cssText="width:100%;font:12px ui-monospace,monospace";let g=fe(x,H);return g.append(Q(`Set ${x.toLowerCase()}`,()=>H.value.trim()?d[C](H.value):e.note("Write some code first"))),g},h=J("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp"});h.style.display="none",h.onchange=async()=>{let x=e.picked(),C=h.files?.[0];if(h.value="",!x||!C)return;let O=await e.api.uploadAsset(C);O?d.image(x,O):e.note("Upload failed: PNG, JPEG, GIF or WebP up to 2 MiB, with the experiments:write scope")},r.onchange=()=>(e.note("Reload the page to see the other variant without this one's edits"),f());let v=x=>()=>{let C=e.picked();if(!C)return e.note("Inspect an element first");x(C),b()},E=(x,C,O)=>Q(x,v(H=>{let g=window.prompt(C);g!==null&&O(H,g)})),A=J("input",{placeholder:"Goal name"}),S=Q("Save variant",async()=>{let x=await e.api.saveVariants(n.id,Nt(n,r.value,[...d.changes()]));x&&(n.variants=x.variants),e.note(x?`Saved ${d.changes().length} change(s) to ${r.value}`:"Could not save: only draft experiments can change their variants")}),L=Q("Add click goal",v(async x=>{if(!A.value.trim())return e.note("Name the goal first");let C=x.textContent?.trim().slice(0,100),O=await e.api.addGoal(n.id,{name:A.value.trim(),selector:ee(x),...C?{text:C}:{},url:location.pathname});e.note(O?`Goal "${A.value}" added as a secondary metric`:"Could not add the goal")}));if(!o)for(let x of[S,L])x.disabled=!0,x.title=`Requires the ${Ie} toolbar scope`;return t.append(J("b",{textContent:`Experiment: ${n.name} (${n.status})`}),fe("Variant",r),fe("This page only",i),E("Text","New text",(x,C)=>d.text(x,C)),E("Style","CSS as property:value",(x,C)=>{let[O,...H]=C.split(":");O&&H.length&&d.style(x,O.trim(),H.join(":").trim())}),E("Attribute","name=value (empty value removes)",(x,C)=>{let[O,...H]=C.split("=");O&&d.attr(x,O.trim(),H.length&&H.join("=")!==""?H.join("="):null)}),Q("Hide",v(x=>d.hide(x))),Q("Move up",v(x=>d.move(x,-1))),Q("Move down",v(x=>d.move(x,1))),E("Insert HTML","position:html, position = before | after | prepend | append (scripts and handlers are removed)",(x,C)=>{let[O,...H]=C.split(":"),g=O?.trim();["before","after","prepend","append"].includes(g)&&H.length?d.insert(x,g,H.join(":")):e.note("Use position:html, for example after:<p>Free shipping</p>")}),E("Image URL","Image URL (https://...)",(x,C)=>d.image(x,C.trim())),Q("Upload image",v(()=>h.click())),h,c("Page CSS","css",".hero h1 { font-size: 3rem }"),c("Page JS","js","Runs only after approval and when the site sets visualChanges.allowCustomJs"),a,u,fe("Preview width",p),Q("Copy page outline for AI variants",()=>{let x=JSON.stringify(It());navigator.clipboard?.writeText(x).then(()=>e.note("Page outline copied: paste it under Generate variants with AI in the experiment page"),()=>e.note(x))}),s,S,fe("Goal",A),L),new MutationObserver((x,C)=>{t.isConnected?t.dataset.mounted="1":t.dataset.mounted&&(l(),y.close(),w(),C.disconnect())}).observe(document.body,{childList:!0,subtree:!0}),f(),t}var J,Q,fe,Gt=N(()=>{"use strict";Re();ie();Ge();Pt();re();Dt();J=(e,t={})=>Object.assign(document.createElement(e),t),Q=(e,t)=>{let n=J("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n},fe=(e,t)=>{let n=J("label",{textContent:`${e} `});return n.style.display="block",n.append(t),n}});function Bt(e){let t=document.createElement("div"),n=document.createElement("div");n.className="cd",n.setAttribute("role","tablist");for(let i=0;i<e.count;i++){let s=$e("",()=>e.to(i),`Slide ${i+1} of ${e.count}`);s.setAttribute("role","tab"),s.setAttribute("aria-current",String(i===e.index)),n.append(s)}let o=document.createElement("div");o.className="cn";let r=e.index===e.count-1;return o.append(e.index>0?$e("Back",()=>e.to(e.index-1)):$e("Skip",e.dismiss),$e(r?"Done":"Next",()=>r?e.complete():e.to(e.index+1))),t.append(n,o),t}function Ft(e,t){let n,o=s=>{n=s.clientX},r=s=>{if(n===void 0)return;let a=s.clientX-n;n=void 0;let u=t();a<-40&&u.index<u.count-1?u.to(u.index+1):a>40&&u.index>0&&u.to(u.index-1)},i=s=>{let a=t();s.key==="ArrowRight"&&a.index<a.count-1?a.to(a.index+1):s.key==="ArrowLeft"&&a.index>0&&a.to(a.index-1)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",r),e.addEventListener("keydown",i),()=>{e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",r),e.removeEventListener("keydown",i)}}var Ut,$e,Kt=N(()=>{"use strict";Ut=".cd{display:flex;gap:6px;justify-content:center;margin:8px 0}.cd button{width:10px;height:10px;min-width:0;padding:0;margin:0;border-radius:50%;background:#ccc;border:0}.cd button[aria-current=true]{background:var(--a,#111)}.cn{display:flex;justify-content:space-between}",$e=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&o.setAttribute("aria-label",n),o.onclick=t,o}});function ko(e,t=wo()){if(!e?.dark?.tokens)return!1;let n=e.theme_mode??"auto";return n==="dark"||n==="auto"&&t}function wo(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function qt(e,t){let n={...e?.font_family?{font:e.font_family}:{},...e?.tokens};return ko(e,t)?{...n,...e?.dark?.tokens}:n}function zt(e,t){let n=o=>typeof o=="string"&&bo.test(o);n(t?.background)&&(e.style.background=t.background),n(t?.text)&&(e.style.color=t.text),n(t?.accent)&&(e.style.setProperty("--a",t.accent),e.style.setProperty("--at","#fff")),typeof t?.radius=="number"&&t.radius>=0&&t.radius<=32&&(e.style.borderRadius=`${t.radius}px`),typeof t?.font=="string"&&xo.test(t.font)&&(e.style.fontFamily=t.font),t?.shadow&&t.shadow in Wt&&(e.style.boxShadow=Wt[t.shadow]),typeof t?.button_radius=="number"&&t.button_radius>=0&&t.button_radius<=32&&e.style.setProperty("--br",`${t.button_radius}px`),n(t?.secondary)&&e.style.setProperty("--s",t.secondary),n(t?.secondary_text)&&e.style.setProperty("--st",t.secondary_text)}var bo,xo,Wt,Jt=N(()=>{"use strict";bo=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,xo=/^[\w\s,'"-]{1,100}$/,Wt={none:"none",sm:"0 1px 4px rgba(0,0,0,.15)",lg:"0 8px 32px rgba(0,0,0,.3)"}});var Qt={};ye(Qt,{listed:()=>Xt,renderModule:()=>Ao,resetAssist:()=>Eo,searchHref:()=>Yt});function R(e,t){let n=document.createElement(e);return t!==void 0&&(n.textContent=t),n}function Xt(e,t){return e.guide_ids?.length?e.guide_ids.flatMap(n=>t.find(o=>o.id===n)??[]):t.filter(n=>Vt.has(n.kind))}function Yt(e,t){if(!e.search_url||!t.trim())return null;try{let n=new URL(e.search_url.replace("{q}",encodeURIComponent(t.trim())));return n.protocol==="https:"?n.href:null}catch{return null}}function Ao(e,t){let n=R("section");if(n.setAttribute("aria-label",e.title??e.module??"Module"),n.append(R("h2",e.title??"")),e.body&&n.append(R("p",e.body)),e.module==="guides"){let o=R("ul");for(let r of Xt(e,t.library)){let i=R("button",r.name);i.type="button",i.onclick=()=>(t.opened(),t.launch(r.id));let s=R("li");s.append(i),o.append(s)}n.append(o.childElementCount?o:R("p","No guides yet."))}else if(e.module==="announcements"){let o=t.library.filter(i=>So.has(i.kind)&&i.steps[0]).sort((i,s)=>(s.published_at??"").localeCompare(i.published_at??"")),r=R("ul");for(let i of o.slice(0,10)){let s=R("li");s.append(R("strong",i.steps[0].title??i.name)),i.steps[0].body&&s.append(R("p",i.steps[0].body)),r.append(s)}n.append(r.childElementCount?r:R("p","Nothing new."))}else if(e.module==="search"){let o=R("form");o.setAttribute("role","search");let r=R("label","Search help"),i=R("input");i.type="search",r.append(i);let s=R("button","Search");s.type="submit";let a=R("ul");o.append(r,s,a);let u=R("div");u.setAttribute("aria-live","polite"),o.onsubmit=d=>{d.preventDefault(),t.opened();let y=i.value.trim(),w=y.toLowerCase();a.replaceChildren();let f=t.library.filter(l=>Vt.has(l.kind)&&w&&(l.name+" "+l.steps.map(p=>`${p.title??""} ${p.body??""}`).join(" ")).toLowerCase().includes(w)).slice(0,5);for(let l of f)a.append(Zt(l,t));u.replaceChildren(),t.assist&&!We&&y?Co(y,f.length,t,u):t.assist?.searched({query:y,results:f.length,answered:!1});let b=Yt(e,i.value);b&&window.open(b,"_blank","noopener,noreferrer")},o.append(u),n.append(o)}return n}function Zt(e,t){let n=R("button",e.name);n.type="button",n.onclick=()=>t.launch(e.id);let o=R("li");return o.append(n),o}async function Co(e,t,n,o){let r=n.assist;o.textContent="Finding an answer...";let i=await r.ask(e.slice(0,500));if(o.replaceChildren(),i==="unavailable"&&(We=!0),!i||i==="unavailable")return r.searched({query:e,results:t,answered:!1});let s=!!i.answer.trim();if(r.searched({query:e,results:t,answered:s}),!s)return;o.append(R("h3","Answer"),R("p",i.answer));let a=R("ul");for(let w of(i.citations??[]).slice(0,5)){let f=_o(w.url);if(!f)continue;let b=R("a",w.title||f);Object.assign(b,{href:f,target:"_blank",rel:"noopener noreferrer"});let l=R("li");l.append(b),a.append(l)}a.childElementCount&&o.append(R("p","Sources"),a);let u=R("ul");for(let w of(i.guide_ids??[]).slice(0,3)){let f=n.library.find(b=>b.id===w);f&&u.append(Zt(f,n))}u.childElementCount&&o.append(R("p","Suggested guides"),u);let d=R("div"),y=(w,f)=>{let b=R("button",w);return b.type="button",b.onclick=()=>{r.searched({query:e,results:t,answered:s,feedback:f}),d.replaceChildren(R("p","Thanks for the feedback."))},b};d.append(y("Helpful","up"),y("Not helpful","down")),o.append(d)}var We,Eo,_o,Vt,So,en=N(()=>{"use strict";We=!1,Eo=()=>{We=!1},_o=e=>{try{let t=new URL(e);return t.protocol==="https:"?t.href:null}catch{return null}},Vt=new Set(["tour","checklist","modal","slideout"]),So=new Set(["announcement","banner"])});function To(e,t,n=!0,o=!1){if(e==="banner")return[{label:"Dismiss",action:"dismiss"}];let r=n?[]:[{label:"Back",action:"back"}];return o||r.push({label:t?"Done":"Next",action:"next"}),[...r,{label:"Dismiss",action:"dismiss"}]}function Ro(e){for(let t of[e.selector,...e.fallback_selectors??[]])if(t)try{let n=document.querySelector(t);if(n)return n}catch{}return null}function z(e,t,n){let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.className=n),o}function Ho(e){let t;try{t=new URL(e.url)}catch{return null}if(t.protocol!=="https:")return null;if(e.type==="image")return Object.assign(z("img"),{src:t.href,alt:e.alt??"",loading:"lazy"});if(e.type==="video")return Object.assign(z("video"),{src:t.href,controls:!0,preload:"metadata"});if(e.type!=="embed"||!Lo.includes(t.host))return null;let n=Object.assign(z("iframe"),{src:t.href,title:e.alt??"Video",allowFullscreen:!0,referrerPolicy:"no-referrer"});return n.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation"),n}function Po(e,t,n){e.addEventListener("keydown",o=>{if(o.key==="Escape")return n();if(o.key!=="Tab")return;let r=[...e.querySelectorAll(Oo)];if(!r.length)return;let i=r[0],s=r[r.length-1],a=t.activeElement;o.shiftKey&&a===i?(o.preventDefault(),s.focus()):!o.shiftKey&&a===s&&(o.preventDefault(),i.focus())})}function Io(e,t,n="bottom"){let o=t.getBoundingClientRect(),r=e.offsetWidth||280,i=e.offsetHeight||120,s=o.left,a=o.bottom+8;n==="top"?a=o.top-i-8:n==="left"?(s=o.left-r-8,a=o.top):n==="right"&&(s=o.right+8,a=o.top);let u=(d,y)=>Math.max(8,Math.min(d,y-8));e.style.left=`${u(s,window.innerWidth-r)}px`,e.style.top=`${u(a,window.innerHeight-i)}px`}function tn(e,t,n,o={}){let r=document.createElement("div");r.setAttribute("data-lc-ignore","");let i=r.attachShadow({mode:"open"});i.append(Ae($o,o.nonce));let s=document.activeElement,a=Math.min(Math.max(o.start??0,0),e.steps.length-1),u=!1,d,y=[],w=[],f=()=>{for(let m of w)m();w=[]},b=()=>{},l=z("div",void 0,"g"),p=()=>{u||(u=!0,f(),b(),r.remove(),s?.focus?.(),n())},c=m=>{t.dismissed(a,e.steps[a]?.id??"",m),p()},h=()=>c(),v=()=>{t.completed(),p(),e.steps.at(-1)?.confetti&&et()},E=m=>(o.resolveTarget??Ro)(m),A=m=>{let M=m?.goto?void 0:e.steps[a]?.branch?.find(W=>Ze(W,{...o.person?{person:o.person}:{},...o.flag?{flag:o.flag}:{},...o.present?{present:o.present}:{}})),U=m?.goto??M?.goto,$=U==="end"?e.steps.length:U?e.steps.findIndex(W=>W.id===U):-1;y.push(a),a=$>a?$:a+1,S()},S=()=>{let m=e.steps[a];if(!m)return v();if(t.progress?.(m.id),m.url&&!location.href.includes(m.url))return p();j()},L=m=>{m<0||m>=e.steps.length||m===a||(a=m,S())},x=()=>{let m=y.pop();m!==void 0&&(a=m,S())},C=m=>{if(m.action==="next"||m.action==="start_tour")A(m);else if(m.action==="back")x();else if(m.action==="dismiss")h();else if(m.action==="snooze"){let M=Math.min(Math.max(Math.round(m.snooze_hours??24),1),720);t.snoozed?.(e.steps[a]?.id??"",M),c("snooze")}else m.action==="link"&&m.url&&/^https?:\/\//i.test(m.url)?window.open(m.url,"_blank","noopener,noreferrer"):m.action==="event"&&m.event&&t.event(m.event)},O=(m,M)=>{let U=z("div"),$=m.buttons?.length?m.buttons:To(e.kind,M,y.length===0,m.advance==="click"||m.advance==="input");for(let W of $){let X=z("button",W.label);X.type="button",X.onclick=()=>C(W),U.append(X)}return U},H=m=>[...m.title?[z("h2",m.title)]:[],...m.body?[z("p",m.body)]:[],...(m.media??[]).flatMap(M=>Ho(M)??[])],g=new Set(o.checked),G=new Map;function V(m,M,U){let $=G.get(M.id);$&&!$.hasAttribute("data-done")&&($.setAttribute("data-done",""),$.setAttribute("aria-pressed","true"),$.textContent=`\u2713 ${M.title??M.id}`),!(!U||g.has(M.id)&&$?.hasAttribute("data-reported"))&&($?.setAttribute("data-reported",""),g.add(M.id),t.step(m,M.id),g.size>=e.steps.length&&v())}let _=()=>{let m=z("ul");for(let[U,$]of e.steps.entries()){let W=z("li"),X=z("button",`${$.title??$.id}`);if(X.type="button",X.setAttribute("aria-pressed","false"),G.set($.id,X),g.has($.id)&&(V(U,$,!1),X.setAttribute("data-reported","")),X.onclick=()=>{if(e.kind==="checklist")V(U,$,!0);else if(e.kind==="resource_center"){t.step(U,$.id);let K=$.buttons?.find(q=>q.action==="link");K&&C(K)}},$.module){let K={library:o.library??[],launch:q=>(p(),o.launch?.(q)),opened:()=>t.step(U,$.id),...o.assist?{assist:o.assist}:{}};Promise.resolve().then(()=>(en(),Qt)).then(q=>W.append(q.renderModule($,K))),m.append(W);continue}W.append(X),$.body&&W.append(z("p",$.body)),m.append(W)}l.append(z("h2",e.name),m);let M=z("button",e.kind==="resource_center"?"Close":"Dismiss");M.type="button",M.onclick=h,l.append(M)};function j(){f(),l.replaceChildren(),l.style.visibility="";let m=e.steps[a];if(!m)return;let M=e.kind==="carousel";if(e.kind==="checklist"||e.kind==="resource_center")_();else{let K={index:a,count:e.steps.length,to:L,complete:v,dismiss:h};l.append(...H(m),M?Bt(K):O(m,a===e.steps.length-1)),t.step(a,m.id)}l.setAttribute("role",e.kind==="banner"||e.kind==="inline"?"region":"dialog"),l.setAttribute("aria-label",m?.title??e.name),M&&l.setAttribute("aria-roledescription","carousel");let U={modal:"m",carousel:"m",banner:`bn${m.placement==="bottom"?" bb":""}`,slideout:`so${e.appearance?.side==="left"?" sl":""}`,inline:"in"};if(l.className=`g ${U[e.kind]??"p"}`,zt(l,qt(e.appearance)),(e.kind==="modal"||M)&&l.setAttribute("aria-modal","true"),M&&w.push(Ft(l,()=>({index:a,count:e.steps.length,to:L,complete:v,dismiss:h}))),m.auto_close_s&&m.auto_close_s>0){let K=setTimeout(()=>c("auto_close"),Math.min(m.auto_close_s,600)*1e3);w.push(()=>clearTimeout(K))}if(m.automation&&o.automate!==!1){let K=m.automation,q=setTimeout(()=>t.automated?.(m.id,Qe(K)));w.push(()=>clearTimeout(q))}let $=(e.kind==="tooltip"||e.kind==="tour")&&!!(m.selector||m.fallback_selectors?.length),W=K=>{l.style.visibility="",l.classList.remove("p"),Io(l,K,m.placement);let q=m.advance==="click"?"click":m.advance==="input"?"change":null;if(!q)return;let ce=()=>A();K.addEventListener(q,ce,{once:!0}),w.push(()=>K.removeEventListener(q,ce))},X=$?E(m):null;if(X)W(X);else if($){l.style.visibility="hidden";let K=Date.now()+Math.min(Math.max(m.wait_ms??3e3,0),15e3),q=setInterval(()=>{let ce=E(m);ce?(clearInterval(q),W(ce)):Date.now()>=K&&(clearInterval(q),l.style.visibility="",t.targetMissing?.(m.id,m.selector??m.fallback_selectors?.[0]??""))},150);w.push(()=>clearInterval(q))}e.kind!=="inline"&&l.querySelector("button")?.focus()}Po(l,i,h);let D=e.kind==="modal"||e.kind==="carousel",B=e.appearance?.dismiss_on_outside_click??D;if(e.appearance?.overlay??D)d=z("div",void 0,"o"),B&&(d.onclick=h),i.append(d);else if(B&&e.kind!=="inline"){let m=U=>{U.composedPath().includes(r)||h()},M=setTimeout(()=>document.addEventListener("click",m,!0));b=()=>(clearTimeout(M),document.removeEventListener("click",m,!0))}i.append(l);let ne=e.kind==="inline"&&e.steps[0]?.selector?document.querySelector(e.steps[0].selector):null;return ne?ne.after(r):document.body.append(r),t.shown(),j(),Object.assign(p,{markDone(m){let M=e.steps.findIndex(U=>U.id===m);e.kind==="checklist"&&M>=0&&!u&&V(M,e.steps[M],!0)}})}var Mo,$o,Lo,Oo,nn=N(()=>{"use strict";Ne();Kt();Oe();Jt();Mo=".g{position:fixed;z-index:2147483000;background:#fff;color:#111;border:1px solid #ccc;border-radius:8px;padding:14px;font:14px system-ui;max-width:320px;box-shadow:0 4px 16px rgba(0,0,0,.2)}.m{top:50%;left:50%;transform:translate(-50%,-50%)}.bn{top:0;left:0;right:0;max-width:none;border-radius:0}.bb{top:auto;bottom:0}.p{right:16px;bottom:16px}.o{position:fixed;inset:0;z-index:2146999999;background:rgba(0,0,0,.4)}button{margin:2px;padding:4px 10px;cursor:pointer;background:var(--a,buttonface);color:var(--at,buttontext);border:1px solid #bbb;border-radius:var(--br,4px)}button+button{background:var(--s,buttonface);color:var(--st,buttontext)}h2{margin:0 0 6px;font-size:16px}p{margin:0 0 8px}li{margin:4px 0}.so{top:0;bottom:0;right:0;max-width:360px;border-radius:0;overflow:auto;animation:s .2s}.so.sl{right:auto;left:0}@keyframes s{from{transform:translateX(30px);opacity:0}}@media (prefers-reduced-motion:reduce){.so{animation:none}}.in{position:static;box-shadow:none;max-width:none;margin:8px 0}img,video,iframe{display:block;width:100%;max-width:100%;border:0;margin:0 0 8px;border-radius:4px}iframe{aspect-ratio:16/9}",$o=Mo+Ut,Lo=["www.youtube-nocookie.com","www.youtube.com","player.vimeo.com","www.loom.com","fast.wistia.net"],Oo="button,[href],input,textarea,select,[tabindex]:not([tabindex='-1'])"});function ge(e){let t=e.trim().toLowerCase();if(/^#([0-9a-f]{6})$/.test(t))return t;if(/^#([0-9a-f]{3})$/.test(t))return`#${[...t.slice(1)].map(i=>i+i).join("")}`;let n=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,/]+([\d.]+%?))?\s*\)$/.exec(t);if(!n)return null;let o=n[4];return(o===void 0?1:o.endsWith("%")?parseFloat(o)/100:parseFloat(o))<.5?null:`#${[n[1],n[2],n[3]].map(i=>Math.min(255,Number(i)).toString(16).padStart(2,"0")).join("")}`}function No(e){let t=["button[type=submit]","[class*=primary]","button","a[class*=btn]","[role=button]"];for(let n of t)for(let o of e.querySelectorAll(n)){if(o.closest("[data-lc-ignore]"))continue;let r=o.getBoundingClientRect();if(r.width>0&&r.height>0&&ge(getComputedStyle(o).backgroundColor))return o}return null}function on(e=document){let t=getComputedStyle(e.body),n=getComputedStyle(e.documentElement),o={},r=ge(t.backgroundColor)??ge(n.backgroundColor);r&&(o.background=r);let i=ge(t.color);i&&(o.text=i);let s=No(e),a={name:`${e.title||location.hostname} theme`.slice(0,100),tokens:o};if(s){let d=getComputedStyle(s),y=ge(d.backgroundColor);y&&y!==r&&(o.accent=y);let w=Math.round(parseFloat(d.borderTopLeftRadius));Number.isFinite(w)&&w>=0&&(o.radius=Math.min(w,32),a.radius=o.radius)}let u=t.fontFamily.trim();return u&&Do.test(u)&&(a.font_family=u),a}var Do,rn=N(()=>{"use strict";Do=/^[\w\s,'"-]{1,100}$/});async function sn(e,t){let n=await e.draftGuide(t);return n&&Array.isArray(n.steps)?{name:n.name,kind:n.kind,steps:n.steps,...n.targeting?{targeting:n.targeting}:{}}:t.recorded_steps?.length?it(t.recorded_steps):null}function an(e){let t=he("div"),n=()=>{try{return JSON.parse(sessionStorage.getItem(qe)??"null")}catch{return null}},o=f=>{try{f?sessionStorage.setItem(qe,JSON.stringify(f)):sessionStorage.removeItem(qe)}catch{}},r=[],i,s=he("div"),a=f=>{r=f,o(r),i=rt(b=>{if(!t.isConnected)return i?.(),void(i=void 0);r.push(b),o(r),s.textContent=`Recording: ${r.length} step${r.length===1?"":"s"} (${b.selector})`},e.attrs,30-f.length),u.textContent="Stop and draft"},u=ze("Record clicks",async()=>{if(!i)return a([]),e.note("Click through the flow; each click becomes a tour step");if(i(),i=void 0,o(null),u.textContent="Record clicks",!r.length)return e.note("Nothing recorded");e.note("Drafting copy...");let f=await sn(e.api,{recorded_steps:r});f&&(e.load(f),e.note(`Draft with ${f.steps.length} steps loaded; review, then save`))}),d=n();d&&e.canWrite&&a(d);let y=ze("Draft from prompt",async()=>{let f=window.prompt("Describe the guide (who, what, where)");if(!f?.trim())return;e.note("Drafting...");let b=await sn(e.api,{prompt:f.trim().slice(0,2e3)});b?(e.load(b),e.note("Draft loaded; review, then save")):e.note("Could not draft a guide right now")}),w=ze("Derive theme from this page",async()=>{let f=on(),b=JSON.stringify({tokens:f.tokens,font_family:f.font_family});if(!e.canWrite)return e.note(`Derived ${b}. Saving themes requires the guides:write scope.`);let l=window.prompt("Theme name",f.name);if(!l?.trim())return;let p=await e.api.createTheme({name:l.trim().slice(0,100),tokens:f.tokens,...f.font_family?{font_family:f.font_family}:{},...f.radius!==void 0?{radius:f.radius}:{}});e.note(p?`Theme "${p.name}" saved (${p.id}): pick it in a guide's appearance`:`Could not save the theme. Derived ${b}`)});if(!e.canWrite)for(let f of[u,y])f.disabled=!0,f.title="Requires the guides:write toolbar scope";return t.append(he("b",{textContent:"AI and themes"}),he("br"),u,y,w,s),{node:t,teardown:()=>i?.()}}var qe,he,ze,ln=N(()=>{"use strict";re();rn();qe="lc_toolbar_recording",he=(e,t={})=>Object.assign(document.createElement(e),t),ze=(e,t)=>{let n=he("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n}});var cn={};ye(cn,{guideBuilder:()=>Uo});function Uo(e){let t=I("div"),n=He(),o,r=!!e.scopes?.includes(_e),i=an({api:e.api,canWrite:r,note:e.note,load:g=>O(g),...e.attrs?{attrs:e.attrs}:{}}),s=I("input",{placeholder:"Guide name"}),a=I("select");for(let g of jo)a.append(I("option",{value:g,textContent:g}));let u=I("input",{placeholder:"Step title"}),d=I("textarea",{placeholder:"Step body",rows:2}),y=I("input",{placeholder:"Image URL (https, optional)"}),w=I("input",{placeholder:"Image description (alt text)"});for(let g of[s,u,d,y,w])g.setAttribute("aria-label",g.placeholder);let f=I("select");for(let g of["bottom","top","left","right"])f.append(I("option",{value:g,textContent:g}));let b=I("select");for(let g of["","click","focus","fill"])b.append(I("option",{value:g,textContent:g?`Automation: ${g}`:"No automation"}));let l=I("input",{placeholder:"Fill value (constant)"}),p="",c=I("select");for(let g of Go)c.append(I("option",{value:g,textContent:`Rule: ${g}`}));let h=I("input",{placeholder:"Rule value (regex / length)"}),v=I("input",{placeholder:"Message shown on a bad value"});for(let g of[l,h,v])g.setAttribute("aria-label",g.placeholder);let E=I("div"),A=I("div");A.style.whiteSpace="pre-wrap";let S="",L=()=>{E.textContent=S?`Element: ${S}`:"No element picked",A.textContent=n.steps.map((g,G)=>`${G+1}. ${g.title??g.body??g.id}${g.selector?` @ ${g.selector}`:""}`).join(`
2
- `)},x=()=>{n.name=s.value,n.kind=a.value},C=()=>{x(),o?.();let g=ot(n);if(!g.steps.length)return e.note("Add a step first");o=tn(g,{shown(){},step(){},completed(){},dismissed(){},event(){}},()=>o=void 0)},O=g=>{n={...g.id?{id:g.id}:{},name:g.name,kind:g.kind,steps:g.steps,..."targeting"in g&&g.targeting?{targeting:g.targeting}:{}},s.value=g.name,a.value=g.kind,L()},H=te("Save guide",async()=>{x();let g=tt(n);if(g)return e.note(g);let G=nt(n,location.pathname),V=n.id?await e.api.updateGuide(n.id,G):await e.api.createGuide(G);V&&(n.id=V.id),e.note(V?`Guide saved (${V.id}), start it from the app`:"Could not save guide")});return r||(H.disabled=!0,H.title=`Requires the ${_e} toolbar scope`),t.append(I("b",{textContent:"Guide builder"}),I("br"),s,a,te("Pick element",()=>{let g=e.picked();S=g?ee(g,e.attrs):"",L(),g||e.note("Use Inspect element first, then Pick element")}),E,u,d,y,w,f,b,te("Pick automation target",()=>{let g=e.picked();p=g?ee(g,e.attrs):"",e.note(g?`Automation target ${p}`:"Use Inspect element first")}),l,te("Check automation",()=>{let g=b.value;if(!g)return e.note("Choose an automation action first");e.note(Ee({action:g,selector:p,...l.value?{value:l.value}:{}})??"The automation target is valid on this page")}),c,h,v,te("Add step",()=>{x();let g=b.value&&p?{action:b.value,selector:p,...b.value==="fill"?{value:l.value}:{}}:void 0;if(g){let G=Ee(g);if(G)return e.note(G)}if(n.kind==="form_validation"){if(!S||!v.value.trim())return e.note("Pick the field and write the message");let G=c.value==="min_length"||c.value==="max_length"?Number(h.value):h.value;return we(n,{title:u.value||"Field check",validation:{selector:S,rules:[{type:c.value,message:v.value.trim().slice(0,200),...h.value?{value:G}:{}}]}}),S=h.value=v.value=u.value="",L()}we(n,{...g?{automation:g}:{},...u.value?{title:u.value}:{},...d.value?{body:d.value}:{},...S?{selector:S,placement:f.value}:{},...y.value.startsWith("https://")&&w.value.trim()?{media:[{type:"image",url:y.value,alt:w.value.trim()}]}:{}}),u.value=d.value=y.value=w.value=l.value="",S=p="",b.value="",L()}),te("Remove last",()=>(n.steps.pop(),L())),A,te("Preview",C),te("Close preview",()=>o?.()),H,te("Load existing",async()=>{let g=await e.api.listGuides(),G=g.find(V=>V.name===s.value)??g[0];G?O(G):e.note("No guides yet")}),te("New",()=>(n=He(),s.value="",L())),I("div",{textContent:r?"":`Saving requires the ${_e} scope on the toolbar token.`}),i.node),L(),t}var jo,Go,I,te,dn=N(()=>{"use strict";nn();ie();re();ln();jo=["tooltip","modal","banner","tour","checklist","resource_center","announcement","hotspot","beacon","badge","launcher","slideout","inline","carousel","form_validation"],Go=["required","email","url","phone","regex","min_length","max_length","number"],I=(e,t={})=>Object.assign(document.createElement(e),t),te=(e,t)=>{let n=I("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n}});var fn={};ye(fn,{CHECK_MESSAGE:()=>un,CHECK_PARAM:()=>Bo,describeResult:()=>mn,parseCheck:()=>Fo,resolveSteps:()=>pn,runCheck:()=>Wo});function Fo(e){if(!e||e.length>2e4)return null;try{let t=JSON.parse(e),n=typeof t.origin=="string"?new URL(t.origin).origin:"";if(!/^https?:\/\//.test(n)||!Array.isArray(t.steps))return null;let o=t.steps.filter(r=>r&&typeof r.step=="number"&&Array.isArray(r.selectors)).slice(0,50).map(r=>({step:r.step,...typeof r.url=="string"&&r.url?{url:r.url}:{},selectors:r.selectors.filter(i=>typeof i=="string"&&i.trim()).slice(0,10)}));return{origin:n,steps:o}}catch{return null}}function pn(e,t=location.href){return e.steps.map(n=>{let o=[],r=null;for(let i of n.selectors)try{let s=Array.from(document.querySelectorAll(i));s.length&&!r&&(r={selector:i,els:s})}catch{o.push(i)}return{step:n.step,selector:r?.selector??null,matches:r?.els.length??0,visible:!!r?.els.some(Ko),onPage:!n.url||t.includes(n.url),invalid:o}})}async function Wo(e,t,n=1500){t("Checking guide selectors on this page..."),await new Promise(r=>setTimeout(r,n));let o=pn(e);t(o.map(mn).join(`
3
- `)||"The guide has no anchored steps");try{window.opener?.postMessage({type:un,url:location.href,results:o},e.origin)}catch{}return o}var Bo,un,Ko,mn,gn=N(()=>{"use strict";Bo="__lc_check",un="lc:guide-check";Ko=e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0};mn=e=>`Step ${e.step}: ${e.onPage?e.selector?`${e.selector} - ${e.matches} match${e.matches===1?"":"es"}${e.visible?"":" (hidden)"}`:"no selector matched":"on another page"}${e.invalid.length?`; invalid: ${e.invalid.join(", ")}`:""}`});de();var T=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&(o.title=n),o.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",o.onclick=t,o},k=(e,t,n)=>{let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.style.cssText=n),o},P=(e,t)=>{let n=k("label",void 0,"display:block;margin:2px 0");return n.append(`${e} `,t),n},Y=(e="",t="")=>{let n=k("input",void 0,"font:12px system-ui;width:150px");return n.value=e,n.placeholder=t,n},Z=(e,t)=>{let n=k("select",void 0,"font:12px system-ui");for(let[o,r]of e)n.append(Object.assign(k("option",r),{value:o}));return t!==void 0&&(n.value=t),n};function be(e,t,n="#4af"){let o=k("div",void 0,`position:absolute;left:${e.left+scrollX}px;top:${e.top+scrollY}px;width:${e.width}px;height:${e.height}px;border:2px solid ${n};box-sizing:border-box;z-index:2147483646;pointer-events:none`);o.setAttribute("data-lc-ignore","");let r=k("span",t,`position:absolute;left:-2px;top:-18px;background:${n};color:#000;font:bold 11px system-ui;padding:1px 4px;border-radius:3px;white-space:nowrap`);return o.append(r),o}re();function Rn(e){let t=e.cloneNode(!0),n=[e,...e.querySelectorAll("*")],o=[t,...t.querySelectorAll("*")];n.forEach((r,i)=>{let s=o[i];if(!s)return;let a=getComputedStyle(r),u="";for(let d=0;d<a.length;d++){let y=a.item(d);u+=`${y}:${a.getPropertyValue(y)};`}if(s.setAttribute("style",u),(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&(s.removeAttribute("value"),s.textContent=""),s instanceof HTMLSelectElement)for(let d of s.querySelectorAll("option"))d.removeAttribute("selected");s.hasAttribute("data-lc-mask")&&(s.textContent="\u2022\u2022\u2022"),s.removeAttribute("id");for(let d of[...s.attributes])d.name.startsWith("on")&&s.removeAttribute(d.name)});for(let r of t.querySelectorAll("script"))r.remove();return new XMLSerializer().serializeToString(t)}function Mn(e,t,n){return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${e}</div></foreignObject></svg>`}async function st(e){let t=e.getBoundingClientRect(),n=Math.max(1,Math.ceil(t.width)),o=Math.max(1,Math.ceil(t.height)),r=Math.min(1,640/Math.max(n,o));if(typeof URL.createObjectURL!="function")return null;let i=URL.createObjectURL(new Blob([Mn(Rn(e),n,o)],{type:"image/svg+xml"}));try{let s=new Image;await new Promise((d,y)=>{s.onload=()=>d(),s.onerror=()=>y(new Error("render")),s.src=i});let a=document.createElement("canvas");a.width=Math.round(n*r),a.height=Math.round(o*r);let u=a.getContext("2d");return u?(u.drawImage(s,0,0,a.width,a.height),await new Promise(d=>a.toBlob(d,"image/png"))):null}catch{return null}finally{URL.revokeObjectURL(i)}}var $n=100;function Pe(e,t,n=location.pathname){let o=e.textContent?.trim().replace(/\s+/g," ")??"",r=e.closest("a")?.getAttribute("href");return{selector:ee(e,t),...o&&o.length<=$n?{text:o,text_match:"exact"}:{},...r?{href:r,href_match:"exact"}:{},url:n,url_match:"contains"}}var at=(e,t,n="exact")=>t===void 0||e!=null&&(n==="exact"?e.trim()===t:e.includes(t));function Ln(e,t=location.href){if(e.url===void 0)return!0;if(e.url_match==="regex")try{return new RegExp(e.url).test(t)}catch{return!1}return e.url_match==="exact"?t===e.url||new URL(t).pathname===e.url:t.includes(e.url)}function On(e,t=document,n=location.href){if(!Ln(e,n)||!e.selector&&e.text===void 0&&e.href===void 0)return[];let o;try{o=Array.from(t.querySelectorAll(e.selector??(e.href!==void 0?"a":"*")))}catch{return[]}return o.filter(r=>!r.closest("[data-lc-ignore]")&&at(r.textContent,e.text,e.text_match)&&at(r.closest("a")?.getAttribute("href"),e.href,e.href_match))}function lt(e){let t=k("div"),n=Y("","Action name"),o=k("div"),r=[],i,s,a=[],u=k("div"),d=(c,h,v)=>{let E=Y(c[h]??"");return E.oninput=()=>{E.value?c[h]=E.value:delete c[h]},P(v,E)},y=(c,h,v,E)=>{let A=Z(E.map(S=>[S,S]),c[h]??E[0]);return A.onchange=()=>{c[h]=A.value},P(v,A)},w=()=>{o.replaceChildren(...r.map((c,h)=>{let v=k("fieldset",void 0,"border:1px solid #444;margin:4px 0;padding:4px");return v.append(k("legend",h===0?"Element 1":`OR element ${h+1}`),d(c,"selector","Selector"),d(c,"text","Text"),y(c,"text_match","Text match",["exact","contains"]),d(c,"href","Link target"),y(c,"href_match","Link match",["exact","contains"]),d(c,"url","Page URL"),y(c,"url_match","Page match",["contains","exact","regex"]),T("Remove element",()=>(r.splice(h,1),w()))),v}))},f=()=>{r=[],i=void 0,s=void 0,n.value="",w()},b=()=>{for(let c of a)c.remove();a=[]},l=async()=>{b();let c=await e.api.listActions(),h=0;u.replaceChildren(...c.map(v=>{let E=[...new Set((Array.isArray(v.steps)?v.steps:[]).flatMap(S=>On(S)))];for(let S of E){h+=1;let L=be(S.getBoundingClientRect(),`${h} ${v.name}`,"#fc4");document.body.append(L),a.push(L)}let A=k("div",`${v.name} (${E.length} on this page)`,"margin:2px 0");return A.append(T("Edit",()=>{i=v.id,n.value=v.name,r=(v.steps??[]).map(S=>({...S})),w(),e.note(`Editing ${v.name}`)}),T("Delete",async()=>{window.confirm(`Delete action ${v.name}?`)&&(e.note(await e.api.deleteAction(v.id)?`Deleted ${v.name}`:"Could not delete"),l())})),A})),u.prepend(k("b",`${h} matched element${h===1?"":"s"} on this page`))};return t.append(k("b","Actions"),P("Name",n),T("Add picked element",()=>{let c=e.picked();if(!c)return e.note("Inspect an element first");r.push(Pe(c,e.attrs)),s??=c,w()}),o,T("Save action",async()=>{if(!n.value.trim()||!r.length)return e.note("Name the action and add at least one element");let c={name:n.value.trim(),steps:r},h=i?await e.api.updateAction(i,c):await e.api.createAction(c);if(e.note(h?`Action ${h.name??c.name} saved`:"Could not save the action"),h&&s){let v=await st(s);v&&!await e.api.putActionScreenshot(h.id,v)&&e.note(`Action ${h.name??c.name} saved, screenshot not stored`)}h&&f()}),T("New action",f),T("Show existing actions",()=>{l()}),T("Hide action boxes",()=>(b(),u.replaceChildren())),u),{node:t,teardown:b,addStep:c=>{r.push(c),w()}}}ie();var mt=500,Hn=new Set(["$snapshot","$replay_tag","$rageclick","$deadclick","$heatmap_moves","$attention"]),Pn=e=>Hn.has(e)?"replay":e.startsWith("$")?"system":"custom";function In(e){let t=/^\/(.+)\/([a-z]*)$/.exec(e.trim());if(t)try{let o=new RegExp(t[1],t[2]);return r=>o.test(r)}catch{return()=>!1}let n=e.trim().toLowerCase();return o=>!n||o.toLowerCase().includes(n)}function ft(e){let t=k("div"),n=Y("","name, payload or /regex/"),o=Z([["all","All events"],["custom","Custom"],["system","System ($)"],["replay","Replay and heatmap"]]),r=Object.assign(k("input"),{type:"checkbox"}),i=Object.assign(k("input"),{type:"checkbox"}),s=k("div"),a=k("div",void 0,"max-height:240px;overflow:auto"),u=[],d=[],y=!0,w=Date.now(),f=()=>{let l=In(n.value),p=u.filter(c=>c.pinned||(o.value==="all"||Pn(c.e.event)===o.value)&&l(`${c.e.event} ${JSON.stringify(c.e.properties??{})}`)).sort((c,h)=>Number(h.pinned)-Number(c.pinned)||h.at-c.at);s.textContent=`${p.length} of ${u.length} events${d.length?`, ${d.length} held while paused`:""}`,a.replaceChildren(...p.map(c=>{let h=k("details",void 0,"border-top:1px solid #333;padding:2px 0"),v=i.checked?`+${((c.at-w)/1e3).toFixed(1)}s`:new Date(c.at).toLocaleTimeString(),E=k("summary",`${c.pinned?"[pinned] ":""}${v} ${c.e.event}`),A=JSON.stringify(c.e,null,1);return h.append(E,T(c.pinned?"Unpin":"Pin",()=>(c.pinned=!c.pinned,f())),T("Copy",()=>{navigator.clipboard?.writeText(A)}),k("pre",A,"white-space:pre-wrap;max-height:160px;overflow:auto;margin:0")),h}))};e.onCapture(l=>{if(!y)return;let p={e:l,at:Date.now(),pinned:!1};r.checked?d.push(p):u.push(p),u.length>mt&&(u=u.filter((c,h)=>c.pinned||h>=u.length-mt)),f()}),r.onchange=()=>{r.checked||u.push(...d.splice(0)),f()},n.oninput=o.onchange=i.onchange=f;let b=()=>{let l=new Blob([JSON.stringify(u.map(c=>c.e),null,1)],{type:"application/json"}),p=Object.assign(k("a"),{href:URL.createObjectURL(l),download:`lucida-events-${w}.json`});p.click(),URL.revokeObjectURL(p.href)};return t.append(k("b","Event debugger"),P("Search",n),P("Category",o),P("Pause",r),P("Relative time",i),T("Clear",()=>(u=u.filter(l=>l.pinned),d=[],f())),T("Export JSON",b),s,a),f(),{node:t,teardown:()=>{y=!1}}}Ge();ie();var Ue="__default";function to(e,t){let n=e?.variants?.map(r=>r.key)??[],o=n.length?n:typeof t=="string"?[t]:[];return[[Ue,"(no override)"],["true","on"],["false","off"],...o.map(r=>[`v:${r}`,r])]}var no=e=>e===void 0?Ue:typeof e=="boolean"?String(e):`v:${e}`,oo=e=>e===Ue?null:e==="true"?!0:e==="false"?!1:e.slice(2);function kt(e,t){let n=k("div"),o=Y("","Search flags"),r=k("div"),i=k("div"),s={},a=[],u=()=>{let y=De(),w=o.value.trim().toLowerCase(),f=[...new Set([...a.map(b=>b.key),...Object.keys(s)])].filter(b=>!w||b.toLowerCase().includes(w)).sort();r.replaceChildren(...f.map(b=>{let l=Z(to(a.find(c=>c.key===b),y[b]??s[b]),no(y[b]));return l.onchange=()=>{pt(b,oo(l.value)),i.replaceChildren(k("span","Overrides apply on the next page load. "),T("Reload now",()=>location.reload())),u()},P(`${b} = ${String(y[b]??s[b]??"-")}${b in y?" (override)":""}`,l)})),f.length||r.append(k("div",w?"No flag matches":"No flags"))};o.oninput=u;let d=e.client.onFlags(y=>{s=y,u()});return t.flags().then(y=>{a=y,u()}),n.append(k("b","Feature flags (this browser)"),P("Search",o),r,i),{node:n,teardown:d}}re();function wt(e){return e<768?"mobile":e<1024?"tablet":"desktop"}var Et=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#17becf","#bcbd22","#3b4cc0","#f4a582","#006d2c"],_t=(e,t)=>t[e]?.value==="(other)"?"#9e9e9e":Et[e%Et.length]??"#9e9e9e",St=[["","Heat (no breakdown)"],["channel","Channel"],["referrer","Referrer"],["device","Device"],["country","Country"],["browser","Browser"],["os","OS"],["visitor","New vs returning"],["event","Event property"],["person","Person property"]];function At(e,t){return e==="event"||e==="person"?t.trim()?`${e}:${t.trim()}`:"":e}function Be(e,t,n=document.createElement("canvas")){let o=document.documentElement.scrollWidth,r=Math.max(document.documentElement.scrollHeight,...e.dots.map(a=>a[1]+4));n.width=o,n.height=r,n.setAttribute("data-lc-ignore",""),n.setAttribute("role","img"),n.setAttribute("aria-label",`Confetti of ${e.dots.length} clicks`),n.style.cssText=`position:absolute;left:0;top:0;width:${o}px;height:${r}px;pointer-events:none;z-index:2147483645`;let i=n.getContext("2d");if(!i)return n;let s=document.documentElement.clientWidth||o;for(let[a,u,d]of e.dots)t.has(d)||(i.fillStyle=_t(d,e.legend),i.beginPath(),i.arc(a*s,u,3,0,Math.PI*2),i.fill());return n}function Ct(e,t,n){if(e.legend.length===0)return k("div","No clicks in this range.");let o=k("ul",void 0,"list-style:none;margin:4px 0;padding:0");return o.setAttribute("aria-label","Confetti legend"),e.legend.forEach((r,i)=>{let s=Object.assign(k("input"),{type:"checkbox",checked:!t.has(i)});s.onchange=()=>{s.checked?t.delete(i):t.add(i),n()};let a=k("span",void 0,`display:inline-block;width:10px;height:10px;border-radius:5px;margin:0 6px;background:${_t(i,e.legend)}`);a.setAttribute("aria-hidden","true");let u=k("label");u.append(s,a,`${r.value||"(none)"} (${r.clicks})`);let d=k("li");d.append(u),o.append(d)}),o}var Tt=()=>({w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight}),le=(e=location.pathname)=>e.length>1&&e.replace(/\/+$/,"")||"/";function ro(e){let{w:t,h:n}=Tt(),o=document.createElement("canvas");o.width=t,o.height=n,o.setAttribute("data-lc-ignore",""),o.setAttribute("role","img"),o.setAttribute("aria-label",`Heatmap of ${e.total} events`),o.style.cssText=`position:absolute;left:0;top:0;width:${t}px;height:${n}px;pointer-events:none;z-index:2147483645;opacity:.75`;let r=o.getContext("2d");if(!r)return o;let i=(document.documentElement.clientWidth||t)/Math.max(1,e.x_bins);for(let s of e.bins){let a=e.max>0?s.count/e.max:0;r.fillStyle=`hsla(${Math.round((1-a)*55)}, 95%, 52%, ${(.25+.55*a).toFixed(2)})`,r.fillRect(s.x*i,s.y*e.y_bin_px,i,e.y_bin_px)}return o}function io(e){let{h:t}=Tt(),n=k("div",void 0,`position:absolute;left:0;top:0;width:100%;height:${t}px;pointer-events:none;z-index:2147483645`);n.setAttribute("data-lc-ignore","");for(let o of e.reach){let r=e.sessions>0?o.sessions/e.sessions:0,i=k("div",`${Math.round(r*100)}% reached`,`position:absolute;left:0;width:100%;top:${(o.depth_pct-10)/100*t}px;height:${t/10}px;background:hsla(${Math.round(r*120)},80%,50%,.25);font:bold 11px system-ui;color:#000;padding:2px`);n.append(i)}return n}function so(e,t){try{return(t?Array.from(document.querySelectorAll("a[href]")).filter(o=>o.getAttribute("href")===e.selector):Array.from(document.querySelectorAll(e.selector))).filter(o=>!o.closest("[data-lc-ignore]"))}catch{return[]}}function Rt(e){let t=k("div"),n=Z([["click","Clicks"],["rage","Rage clicks"],["dead","Dead clicks"],["move","Mouse movement"],["scroll","Scrollmap"]]),o=Z(St),r=Y("","property key"),i=Object.assign(k("input"),{type:"checkbox"}),s=k("div"),a=k("div",void 0,"white-space:pre-wrap"),u,d=[],y=null,w=[],f=()=>{u?.remove(),u=void 0;for(let v of d)v.remove();d=[],w=[],y=null,a.replaceChildren(),s.replaceChildren()},b=()=>wt(window.innerWidth),l=()=>{for(let v of d)v.remove();d=[],a.replaceChildren(),w.forEach((v,E)=>{let A=`${E+1}: ${v.clicks} clicks${v.rage_clicks?`, ${v.rage_clicks} rage`:""}`,S=so(v,i.checked);for(let x of S){let C=be(x.getBoundingClientRect(),A,v.rage_clicks?"#f55":"#4af");document.body.append(C),d.push(C)}let L=k("div",`${A} ${v.selector}${S.length?"":" (not on this page)"}`);S[0]&&L.append(T("Create action",()=>e.onPick(S[0]))),a.append(L)})},p=async v=>{do{let E=await e.api.elements(le(),b(),y,i.checked);if(!E)return e.note("Could not load elements");w.push(...E.data),y=E.next_cursor}while(v&&y);l(),h.style.display=y?"":"none"},c=async()=>{f();let v=n.value,E=At(o.value,r.value);if(v==="click"&&E){let A=await e.api.confetti(le(),b(),E);if(!A)return e.note("No confetti data");let S=new Set,L=Be(A,S);u=L,s.append(Ct(A,S,()=>{Be(A,S,L)})),e.note(`${A.dots.length} clicks on ${le()} (${b()}) coloured by ${E}`),await p(!1)}else if(v==="scroll"){let A=await e.api.scroll(le(),b());if(!A)return e.note("No scroll data");u=io(A)}else{let A=await e.api.heat(le(),b(),v);if(!A)return e.note("No heatmap data");u=ro(A),e.note(`${A.total} ${v} events on ${le()} (${b()})`),(v==="click"||v==="rage"||v==="dead")&&await p(!1)}document.body.append(u)},h=k("span");return h.style.display="none",h.append(T("Load more",()=>{p(!1)}),T("Load all",()=>{p(!0)})),t.append(k("b","Heatmap"),P("Heatmap type",n),P("Colour by (clicks)",o),P("Property",r),P("Match links by URL",i),T("Show heatmap",()=>{c()}),T("Hide heatmap",f),h,s,a),{node:t,teardown:f}}Mt();var $t=255,lo=new Set(["input","textarea","select","option"]),co="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",uo=new Set(["value","password","autocomplete"]),po=/(?:\d[ -]?){9,}/;function mo(e){if(!e||lo.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(co)}catch{return!1}}function fo(e,t){if(e.source==="attribute"){let o=(e.attribute??"").toLowerCase();if(!o||uo.has(o)||o.startsWith("on"))return;let r=t.getAttribute(o);return r===null?void 0:r.slice(0,$t)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||po.test(n)))return n.slice(0,$t)}function Ke(e,t,n,o=location.href){let r={};for(let i of e){if(!i.events.includes(t)||i.url&&!Fe([i.url],o))continue;let s=null;try{s=i.scope==="target"?t==="click"&&n?n.closest(i.selector):null:document.querySelector(i.selector)}catch{continue}if(!mo(s))continue;let a=fo(i,s);a!==void 0&&(r[i.name]=a)}return r}de();ie();var go=new Set(["input","textarea","select","option"]);function Lt(e,t){if(!e)return"Inspect an element first";if(go.has(e.tagName.toLowerCase()))return"Form fields are never captured: pick a label or container";let n=t.name.trim();if(!n||n.startsWith("$"))return"Give the property a name (no leading $)";let o=[...t.click?["click"]:[],...t.pageview?["pageview"]:[]];if(!o.length)return"Pick click and/or pageview";let r=t.attribute.trim().toLowerCase();if(t.source==="attribute"&&(!r||r==="value"||r.startsWith("on")))return"That attribute cannot be captured";let i=t.scope==="target"&&!t.pageview?"target":"page";return{name:n,selector:F(e),source:t.source==="attribute"?"attribute":"text",...t.source==="attribute"?{attribute:r}:{},events:o,...i==="target"?{scope:i}:{}}}function Ot(e){let t=`${Se(e.host)}/v1/projects/${encodeURIComponent(e.session.project_id)}/snapshot-properties`,n=async(p={})=>{try{let c=await e.host.fetch(t,{...p,credentials:"omit",headers:{Authorization:`Bearer ${e.session.session_token}`,"Content-Type":"application/json"}});return c.ok?await c.json():null}catch{return null}},o=k("div",void 0,"border-top:1px solid #333;margin-top:4px;padding-top:4px"),r=Y("","property name"),i=Z([["text","Visible text"],["attribute","Attribute"]],"text"),s=Y("","data-plan"),a=Z([["page","First match on the page"],["target","Around the clicked element"]],"page"),u=Object.assign(k("input"),{type:"checkbox",checked:!0}),d=Object.assign(k("input"),{type:"checkbox",checked:!1}),y=k("div",void 0,"white-space:pre-wrap;color:#9cf"),w=k("ul",void 0,"margin:4px 0;padding-left:16px"),f=()=>({name:r.value,source:i.value,attribute:s.value,click:u.checked,pageview:d.checked,scope:a.value}),b=p=>{w.replaceChildren(...p.map(c=>k("li",`${c.name}: ${c.source==="attribute"?`[${c.attribute}] of `:""}${c.selector} (${c.events.join(", ")})`)))},l=()=>{let p=Lt(e.picked(),f());if(typeof p=="string")return void(y.textContent=p);let c=Ke([{...p,scope:"page"}],p.events[0]);y.textContent=`${p.selector}
4
- ${p.name} = ${JSON.stringify(c[p.name]??null)}`};for(let p of[r,i,s,a,u,d])p.addEventListener("input",l);return o.append(k("b","Snapshot properties"),T("Use inspected element",l),P("Name",r),P("Read",i),P("Attribute",s),P("Element",a),P("On clicks",u),P("On pageviews",d),y,T("Save snapshot property",async()=>{let p=Lt(e.picked(),f());if(typeof p=="string")return e.note(p);let c=await n({method:"POST",body:JSON.stringify(p)});if(!c)return e.note("Saving failed (needs toolbar write access)");b(c.data),e.note(`Saved snapshot property ${p.name}; SDKs pick it up with the next config refresh`)}),w),n().then(p=>p&&b(p.data)),{node:o,teardown:()=>o.remove()}}ie();var vn="lc_toolbar_session",Le="lc_toolbar_edit",Je="lc_toolbar_check",qo="lc_toolbar_recording",ve="__lc_check";function hn(){try{let e=JSON.parse(sessionStorage.getItem(vn)??"null");return e&&(!e.expires_at||Date.parse(e.expires_at)>Date.now())?e:null}catch{return null}}function zo(){let e=new URL(location.href),t=new URLSearchParams(e.hash.slice(1)),n=e.searchParams.get(ae)??t.get(ae),o=e.searchParams.get(se)??t.get(se),r=e.searchParams.get(ve)??t.get(ve);return o&&sessionStorage.setItem(Le,o),r&&sessionStorage.setItem(Je,r),(n||o||r)&&(e.searchParams.delete(ae),e.searchParams.delete(se),e.searchParams.delete(ve),(t.has(ae)||t.has(se)||t.has(ve))&&(t.delete(ae),t.delete(se),t.delete(ve),e.hash=t.toString()),history.replaceState(history.state,"",e.toString())),n}var Ci=e=>{if(location.hash==="#lc-device-preview")return;let t=zo(),n,o=async r=>{let i=hn();return r&&(i=await ct(e,r),i&&sessionStorage.setItem(vn,JSON.stringify(i))),i?(n?.(),n=Jo(e,i),!0):!1};return e.toolbar={load:r=>o(r)},(t||hn())&&o(t),()=>n?.()};function Jo(e,t){let n=dt(e,t),o=_=>(t.permissions??[]).includes(_),r=e.config.toolbar?.dataAttributes??ke,i=document.createElement("div");i.setAttribute("data-lc-ignore",""),i.style.cssText="position:fixed;bottom:12px;right:12px;z-index:2147483647";let s=i.attachShadow({mode:"open"}),a=k("div",void 0,"background:#111;color:#eee;padding:8px;border-radius:8px;font:12px system-ui;max-width:340px;max-height:70vh;overflow:auto");s.append(a);let u=k("div",void 0,"white-space:pre-wrap"),d=_=>{u.textContent=_},y,w=!1,f,b,l=k("div",void 0,"position:fixed;pointer-events:none;border:2px solid #4af;z-index:2147483646;display:none");l.setAttribute("data-lc-ignore","");let p=_=>{let j=_.target;if(!w||!(j instanceof Element)||j===i)return;let D=j.getBoundingClientRect();Object.assign(l.style,{display:"block",left:`${D.left}px`,top:`${D.top}px`,width:`${D.width}px`,height:`${D.height}px`})},c=_=>{!w||!(_.target instanceof Element)||_.target===i||(_.preventDefault(),_.stopPropagation(),y=_.target,w=!1,l.style.display="none",d(`Selected ${F(y)}`))};document.addEventListener("mousemove",p,!0),document.addEventListener("click",c,!0),document.body.append(l);let h=[],v=(_,j)=>{let D=k("div"),B,ne=T(_,()=>{if(B)B.hidden=!B.hidden;else{let m=j();B=m.node,h.push(m.teardown),D.append(B)}ne.setAttribute("aria-expanded",String(!B.hidden))});return ne.setAttribute("aria-expanded","false"),D.prepend(ne),D},E=o("actions:write")?lt({api:n,attrs:r,picked:()=>y,note:d}):void 0;E&&(E.node.hidden=!0,h.push(E.teardown));let A=E?T("Actions",()=>{E.node.hidden=!E.node.hidden,A?.setAttribute("aria-expanded",String(!E.node.hidden))}):void 0,S=me(),L=_=>()=>y?_(y):d("Inspect an element first"),x=()=>d(JSON.stringify(S.toPayload(),null,1)),C=(_,j,D)=>T(_,L(B=>{let ne=window.prompt(j);ne!==null&&(D(B,ne),x())})),O=()=>e.client.isInternal?"Count my traffic":"Exclude my traffic ($internal)",H=T(O(),()=>{e.client.optOutInternal(!e.client.isInternal),H.textContent=O()}),g=T("Experiment editor",async()=>{if(b)return b.remove(),void(b=void 0);let _=sessionStorage.getItem(Le)??window.prompt("Experiment id");if(!_)return;sessionStorage.setItem(Le,_);let{experimentEditor:j}=await Promise.resolve().then(()=>(Gt(),jt));b=await j({api:n,scopes:t.permissions,experimentId:_,picked:()=>y,note:d}),a.prepend(b)}),G=T("Guide builder",async()=>{if(f)return f.remove(),void(f=void 0);let{guideBuilder:_}=await Promise.resolve().then(()=>(dn(),cn));f=_({api:n,scopes:t.permissions,picked:()=>y,note:d,attrs:r}),a.append(f)});a.append(k("b",`Lucida toolbar${t.user?.email?` - ${t.user.email}`:""}${o("actions:write")?"":" (view only)"}`),k("br"),H,T("Inspect element",()=>(w=!0,d("Click an element"))),...A&&E?[A,E.node]:[],v("Heatmap",()=>Rt({api:n,note:d,onPick:_=>{if(y=_,!E)return d("Creating actions needs toolbar write access");E.addStep(Pe(_,r)),E.node.hidden=!1,d(`Added ${F(_)} to the action`)}})),v("Feature flags",()=>kt(e,n)),v("Event debugger",()=>ft(e)),...o("actions:write")?[v("Snapshot properties",()=>Ot({host:e,session:t,picked:()=>y,note:d}))]:[],G,g,k("hr"),k("b","Visual editor"),k("br"),C("Text","New text",(_,j)=>S.text(_,j)),C("Style","CSS as property:value",(_,j)=>{let[D,...B]=j.split(":");D&&B.length&&S.style(_,D.trim(),B.join(":").trim())}),C("Attribute","name=value (empty value removes)",(_,j)=>{let[D,...B]=j.split("=");D&&S.attr(_,D.trim(),B.length&&B.join("=")!==""?B.join("="):null)}),T("Hide",L(_=>(S.hide(_),x()))),T("Move up",L(_=>(S.move(_,-1),x()))),T("Move down",L(_=>(S.move(_,1),x()))),T("Show changes JSON",x),u),document.body.append(i),sessionStorage.getItem(Le)?g.click():sessionStorage.getItem(qo)&&G.click();let V=sessionStorage.getItem(Je);return V&&(sessionStorage.removeItem(Je),Promise.resolve().then(()=>(gn(),fn)).then(({parseCheck:_,runCheck:j})=>{let D=_(V);D?j(D,d):d("The guide check request is malformed")})),()=>{document.removeEventListener("mousemove",p,!0),document.removeEventListener("click",c,!0);for(let _ of h)_();i.remove(),l.remove()}}export{se as EDIT_PARAM,Ie as EXPERIMENT_SCOPE,_e as GUIDE_SCOPE,ae as TOOLBAR_PARAM,ct as exchangeToken,De as getFlagOverrides,pt as setFlagOverride,Ci as toolbar,dt as toolbarApi,Se as toolbarHost};
1
+ var yn=Object.defineProperty;var N=(e,t)=>()=>(e&&(t=e(e=0)),t);var ye=(e,t)=>{for(var n in t)yn(e,n,{get:t[n],enumerable:!0})};function F(e){let t=[];for(let n=e;n&&t.length<bn;n=n.parentElement){let o=n.tagName.toLowerCase();if(n.id&&Ve.test(n.id)){t.unshift(`${o}#${n.id}`);break}let r=(n.getAttribute("class")??"").split(/\s+/).filter(i=>Ve.test(i)).slice(0,2);t.unshift(o+r.map(i=>`.${i}`).join(""))}return t.join(" ")}var Ve,bn,de=N(()=>{"use strict";Ve=/^[A-Za-z_][\w-]*$/,bn=5});function Xe(e,t){let n=t?.[e.key];if(e.op==="exists")return n!=null;if(n==null)return e.op==="neq";let[o,r]=[String(n),String(e.value??"")];return e.op==="eq"?o===r:e.op==="neq"?o!==r:o.includes(r)}var Ye=N(()=>{"use strict"});function Ze(e,t){let n=()=>typeof e.value=="string"&&t.present?t.present(e.value):xn(e.value);if(e.op==="element_present")return n();if(e.op==="element_absent")return!n();if(e.op==="flag_on"||e.op==="flag_off"){let o=typeof e.value=="string"&&!!t.flag?.(e.value);return e.op==="flag_on"?o:!o}return Xe({key:e.key,op:e.op,value:e.value},t.person)}function xe(e){return e.matches("input[type=password],[data-lc-mask],.lc-mask,[autocomplete^=cc-]")?!0:!!e.closest("[data-lc-mask],.lc-mask")}function Qe(e,t=document){if(!e.selector||e.selector.length>500)return"invalid";let n;try{n=t.querySelector(e.selector)}catch{return"invalid"}if(!n)return"missing";if(xe(n))return"refused";if(e.action==="click")n.click();else if(e.action==="focus")n.focus();else if(e.action==="fill"){if(typeof e.value!="string"||e.value.length>200||!n.matches(kn))return"refused";let o=n instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,r=Object.getOwnPropertyDescriptor(o,"value")?.set;r?r.call(n,e.value):n.value=e.value,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}else return"invalid";return"done"}function et(e=["#e5484d","#30a46c","#0090ff","#f5d90a","#8e4ec6"]){if(typeof document>"u"||wn())return;let t=document.createElement("canvas");t.setAttribute("data-lc-ignore",""),t.setAttribute("aria-hidden","true"),t.width=innerWidth,t.height=innerHeight,t.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483001";let n=t.getContext("2d");if(!n)return;document.body.append(t);let o=Array.from({length:120},(s,a)=>({x:innerWidth/2,y:innerHeight/3,vx:(Math.random()-.5)*12,vy:Math.random()*-10-2,color:e[a%e.length]})),r=Date.now()+1500,i=()=>{n.clearRect(0,0,t.width,t.height);for(let s of o)s.x+=s.vx,s.y+=s.vy,s.vy+=.35,n.fillStyle=s.color,n.fillRect(s.x,s.y,6,4);Date.now()<r?requestAnimationFrame(i):t.remove()};requestAnimationFrame(i)}var xn,kn,wn,Oe=N(()=>{"use strict";Ye();xn=e=>{if(typeof e!="string"||!e)return!1;try{return!!document.querySelector(e)}catch{return!1}};kn="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";wn=()=>{try{return matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}}});function ee(e,t=ke){for(let n of t){let o=e.getAttribute(n);if(o&&!/["\\]/.test(o))return`[${n}="${o}"]`}return e.id&&En.test(e.id)?`#${e.id}`:F(e)}function we(e,t){let n={...t,id:`s${e.steps.length+1}`};return e.steps.push(n),n}function tt(e){if(!e.name.trim())return"Name the guide";if(!e.steps.length)return"Add at least one step";if(_n.has(e.kind)&&e.steps.length!==1)return`A ${e.kind} has exactly one step`;let t=Cn[e.kind];if(t&&(e.steps.length<t[0]||e.steps.length>t[1]))return`A ${e.kind} has ${t[0]} to ${t[1]} steps`;for(let[n,o]of e.steps.entries()){if(e.kind==="form_validation"){if(!o.validation?.selector||!o.validation.rules?.length)return`Step ${n+1} needs a field and at least one rule`;continue}if(!o.title?.trim()&&!o.body?.trim())return`Step ${n+1} needs a title or body`;if(Sn.has(e.kind)&&!o.selector)return`Step ${n+1} needs a picked element`;let r=o.automation?Ee(o.automation):null;if(r)return`Step ${n+1}: ${r}`}return null}function nt(e,t){return{name:e.name.trim(),kind:e.kind,steps:e.steps,targeting:e.targeting??{url:t,url_match:"exact"}}}function Ee(e,t=document){if(!e.selector||e.selector.length>500)return"automation needs a selector (max 500 chars)";let n;try{n=[...t.querySelectorAll(e.selector)]}catch{return`invalid selector ${e.selector}`}if(!n.length)return`nothing on this page matches ${e.selector}`;if(n.length>1)return`${e.selector} matches ${n.length} elements; pick a unique one`;let o=n[0];if(xe(o))return"automations never touch password, masked or card fields";if(e.action==="fill"){if(typeof e.value!="string"||!e.value||e.value.length>200)return"fill needs a value (max 200 chars)";if(!o.matches(An))return"fill needs a text field"}return null}function Tn(e){if(e.matches("input,textarea,select")||xe(e))return;let t=(e.getAttribute("aria-label")??e.textContent??"").trim().replace(/\s+/g," ");return t?t.slice(0,80):void 0}function rt(e,t=ke,n=30){let o=0,r=i=>{let s=i.target;if(!(s instanceof Element)||i.composedPath().some(d=>d instanceof Element&&d.hasAttribute("data-lc-ignore"))||o>=n)return;o++;let a=s.closest("button,a,[role=button],input,select,textarea,label,[data-lc-id],[data-testid]")??s,u=Tn(a);e({selector:ee(a,t),url:location.pathname,...u?{text:u}:{}})};return document.addEventListener("click",r,!0),()=>document.removeEventListener("click",r,!0)}function it(e){let t={name:"Recorded tour",kind:"tour",steps:[]};for(let n of e)we(t,{title:n.text?`Click "${n.text}"`:"Next step",body:"Continue here.",selector:n.selector,url:n.url,advance:"click"});return t}var ke,En,_n,Sn,Cn,An,He,ot,re=N(()=>{"use strict";de();Oe();ke=["data-lc-id","data-testid","data-test","data-cy","data-qa"],En=/^[A-Za-z_][\w-]*$/,_n=new Set(["tooltip","modal","banner","announcement","hotspot","beacon","badge","slideout","inline"]),Sn=new Set(["tooltip","tour","hotspot","beacon","badge","inline"]),Cn={carousel:[1,10],form_validation:[1,30]},An="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";He=()=>({name:"",kind:"tooltip",steps:[]});ot=e=>({id:e.id??"preview",name:e.name,kind:e.kind,steps:e.steps,conditions:{}})});async function ct(e,t){try{let n=await e.fetch(`${Se(e)}/v1/toolbar/exchange`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"omit",body:JSON.stringify({token:t,origin:location.origin})});if(!n.ok)return null;let o=await n.json();return{session_token:o.token,project_id:o.project_id,expires_at:o.expires_at,permissions:o.scopes}}catch{return null}}function dt(e,t){let n=`${Se(e)}/v1/projects/${encodeURIComponent(t.project_id)}`,o=async(i,s={})=>{try{let a=await e.fetch(n+i,{...s,credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":"application/json"}});return a.ok?await a.json():null}catch{return null}},r=(i,s)=>`url=${encodeURIComponent(i)}&viewport=${s}`;return{scopes:t.permissions??[],createAction:i=>o("/actions",{method:"POST",body:JSON.stringify(i)}),updateAction:(i,s)=>o(`/actions/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify(s)}),deleteAction:async i=>{try{return(await e.fetch(`${n}/actions/${encodeURIComponent(i)}`,{method:"DELETE",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`}})).ok}catch{return!1}},putActionScreenshot:async(i,s)=>{try{return(await e.fetch(`${n}/actions/${encodeURIComponent(i)}/screenshot`,{method:"PUT",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":"image/png"},body:s})).ok}catch{return!1}},listActions:()=>o("/actions?limit=200").then(i=>i?.data??[]),flags:()=>o("/flags?limit=200").then(i=>i?.data??[]),heat:(i,s,a)=>o(`/heatmaps?${r(i,s)}&type=${a}`),scroll:(i,s)=>o(`/heatmaps?${r(i,s)}&type=scroll`),confetti:(i,s,a)=>o(`/heatmaps/confetti?${r(i,s)}&breakdown=${encodeURIComponent(a)}`),elements:(i,s,a,u=!1)=>o(`/heatmaps/elements?${r(i,s)}&limit=50${u?"&key=href":""}${a?`&cursor=${encodeURIComponent(a)}`:""}`),listGuides:()=>o("/guides?limit=100").then(i=>i?.data??[]),createGuide:i=>o("/guides",{method:"POST",body:JSON.stringify(i)}),updateGuide:(i,s)=>o(`/guides/${encodeURIComponent(i)}`,{method:"PUT",body:JSON.stringify(s)}),draftGuide:i=>o("/guides/draft",{method:"POST",body:JSON.stringify(i)}),createTheme:i=>o("/guide-themes",{method:"POST",body:JSON.stringify(i)}),experiment:i=>o(`/experiments/${encodeURIComponent(i)}`),saveVariants:(i,s)=>o(`/experiments/${encodeURIComponent(i)}`,{method:"PATCH",body:JSON.stringify({variants:s})}),addGoal:(i,s)=>o(`/experiments/${encodeURIComponent(i)}/goals`,{method:"POST",body:JSON.stringify(s)}),uploadAsset:async i=>{try{let s=await e.fetch(`${n}/experiments/assets`,{method:"POST",credentials:"omit",headers:{Authorization:`Bearer ${t.session_token}`,"Content-Type":i.type||"application/octet-stream"},body:i});return s.ok?(await s.json()).url:null}catch{return null}}}}function pt(e,t){let n=De();t===null?delete n[e]:n[e]=t;try{localStorage.setItem(ut,JSON.stringify(n))}catch{}}function De(){try{return JSON.parse(localStorage.getItem(ut)??"{}")}catch{return{}}}var _e,Ie,se,ae,Se,ut,ie=N(()=>{"use strict";_e="guides:write",Ie="experiments:write",se="__lc_edit",ae="__lc_toolbar",Se=e=>(e.config.uiHost??e.config.apiHost??"").replace(/\/+$/,"");ut="lc_flag_overrides"});function Ce(e,t){let n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.textContent=e,n}var Ne=N(()=>{"use strict"});function ue(e){let t=e.trim();return t?/^data:/i.test(t)?Gn.test(t):/^(https?:)?\/\//i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t):!1}function Un(e){let t=e.trim();return/^(https?:|mailto:|tel:)/i.test(t)||!/^[a-z][a-z0-9+.-]*:/i.test(t)}function Kn(e){for(let{name:t,value:n}of[...e.attributes]){let o=t.toLowerCase();(jn.has(o)||o.startsWith("aria-")||o.startsWith("data-")&&!o.startsWith("data-lc"))&&(o!=="href"||Un(n))&&(o!=="src"||ue(n))&&(o!=="srcset"||Bn(n))&&(o!=="style"||Fn(n))||e.removeAttribute(t)}e.getAttribute("target")==="_blank"&&e.setAttribute("rel","noopener noreferrer")}function gt(e){for(let t of[...e.childNodes]){if(t.nodeType===3)continue;if(t.nodeType!==1){t.remove();continue}let n=t,o=n.tagName.toUpperCase();if(Dn.has(o)){n.remove();continue}if(gt(n),!Nn.has(o)){n.replaceWith(...n.childNodes);continue}Kn(n)}}function ht(e){let t=document.createElement("template");return t.innerHTML=e,gt(t.content),document.importNode(t.content,!0)}var Dn,Nn,jn,Gn,Bn,Fn,vt=N(()=>{"use strict";Dn=new Set(["SCRIPT","STYLE","IFRAME","FRAME","FRAMESET","OBJECT","EMBED","APPLET","TEMPLATE","NOSCRIPT","SVG","MATH","FORM","INPUT","TEXTAREA","SELECT","OPTION","LINK","META","BASE","AUDIO","VIDEO","PORTAL"]),Nn=new Set(["A","ABBR","B","BLOCKQUOTE","BR","BUTTON","CAPTION","CITE","CODE","DD","DEL","DETAILS","DIV","DL","DT","EM","FIGCAPTION","FIGURE","FOOTER","H1","H2","H3","H4","H5","H6","HEADER","HR","I","IMG","INS","KBD","LABEL","LI","MARK","NAV","OL","P","PICTURE","PRE","Q","S","SECTION","ARTICLE","ASIDE","SMALL","SOURCE","SPAN","STRONG","SUB","SUMMARY","SUP","TABLE","TBODY","TD","TFOOT","TH","THEAD","TIME","TR","U","UL"]),jn=new Set(["class","id","title","alt","href","src","srcset","sizes","width","height","role","target","rel","colspan","rowspan","loading","decoding","lang","dir","style","datetime","media"]),Gn=/^data:image\/(png|jpe?g|gif|webp|avif);/i;Bn=e=>e.split(",").every(t=>ue(t.trim().split(/\s+/)[0]??"")),Fn=e=>!/url\s*\(|expression\s*\(|@import|behavior\s*:|javascript:/i.test(e)});function yt(e){let t=JSON.stringify(e),n=5381;for(let o=0;o<t.length;o++)n=(n<<5)+n+t.charCodeAt(o)|0;return`c${(n>>>0).toString(36)}`}function je(e,t){let n=e?.[pe];return Array.isArray(n)?n.filter(o=>!!o&&typeof o=="object"&&typeof o.type=="string"&&(typeof o.selector=="string"||zn.has(o.type))&&(t===void 0||!o.url||t.includes(o.url))):[]}function Vn(e,t){let n=yt(t),o=(e.getAttribute(Te)??"").split(" ").filter(Boolean);if(o.includes(n)||!Jn.has(t.position)||typeof t.html!="string")return;let r=ht(t.html);for(let i of[...r.children])i.setAttribute(Ae,n);t.position==="before"?e.before(r):t.position==="after"?e.after(r):t.position==="prepend"?e.prepend(r):e.append(r),e.setAttribute(Te,[...o,n].join(" "))}function Yn(e,t){let n=e.tagName.toUpperCase();if(!(typeof t.src!="string"||!ue(t.src))){if(n==="SOURCE"){e.setAttribute("srcset",t.src);return}n==="IMG"&&(e.setAttribute("src",t.src),t.srcset&&Xn(t.srcset)?e.setAttribute("srcset",t.srcset):e.removeAttribute("srcset"),typeof t.alt=="string"&&e.setAttribute("alt",t.alt))}}function Zn(e,t,n){let o=yt(e);if(n.querySelector(`[${Ae}="${o}"]`))return;let r;if(e.type==="css"){if(typeof e.css!="string")return;r=n.importNode(Ce(e.css,t.nonce),!0)}else{if(e.approved!==!0||!t.allowJs||typeof e.js!="string")return;r=n.createElement("script"),t.nonce&&r.setAttribute("nonce",t.nonce),r.textContent=e.js}r.setAttribute(Ae,o),n.head.append(r)}function Qn(e,t){let n=e;switch(t.type){case"text":e.textContent=t.value;break;case"attr":if(Wn.test(t.name)||typeof t.value=="string"&&/^(href|src|action|formaction)$/i.test(t.name)&&qn.test(t.value))break;t.value===null?e.removeAttribute(t.name):e.setAttribute(t.name,t.value);break;case"style":for(let[o,r]of Object.entries(t.styles))n.style.setProperty(o,r);break;case"hide":n.style.setProperty("display","none","important");break;case"insert":Vn(e,t);break;case"image":Yn(e,t);break;case"reorder":{let o=e.parentElement;if(!o)break;let r=[...o.children].filter(s=>s!==e),i=Math.max(0,Math.min(t.index,r.length));o.insertBefore(e,r[i]??null);break}}}function oe(e,t=document,n={}){let o=[];for(let r of e){if(n.requireApproval&&(r.type==="css"||r.type==="js"||r.type==="insert")&&r.approved!==!0)continue;if(r.type==="css"||r.type==="js"){let s=t.nodeType===9?t:t.ownerDocument;s?.head&&Zn(r,n,s);continue}let i;try{i=[...t.querySelectorAll(r.selector)]}catch{continue}i.length||o.push(r);for(let s of i)Qn(s,r)}return o}function bt(e=document){for(let t of[...e.querySelectorAll(`[${Ae}]`)])t.remove();for(let t of[...e.querySelectorAll(`[${Te}]`)])t.removeAttribute(Te)}var pe,Ae,Wn,qn,zn,Jn,Te,Xn,Re=N(()=>{"use strict";Ne();vt();pe="lc_changes",Ae="data-lc-change",Wn=/^on/i,qn=/^\s*(javascript|data|vbscript):/i,zn=new Set(["css","js"]),Jn=new Set(["before","after","prepend","append"]),Te="data-lc-inserted";Xn=e=>e.split(",").every(t=>ue(t.trim().split(/\s+/)[0]??""))});function me(e=[],t=()=>!1,n={}){let o=[...e],r=[],i=[],s=new Map,a=new Set,u=l=>`${l.url??""}|${l.selector??""}|${l.type}|${l.type==="attr"?l.name:""}`,d=l=>{if(!l)return;let p=[];try{p=[...document.querySelectorAll(l)]}catch{return}for(let c of p)s.has(c)||s.set(c,{attrs:[...c.attributes].map(h=>[h.name,h.value]),kids:[...c.childNodes].map(h=>h.cloneNode(!0)),parent:c.parentNode,next:c.nextSibling})},y=()=>{bt();for(let[l,p]of s){for(let c of[...l.attributes])l.removeAttribute(c.name);for(let[c,h]of p.attrs)l.setAttribute(c,h);l.replaceChildren(...p.kids.map(c=>c.cloneNode(!0))),p.parent&&(p.next===null||p.next.parentNode===p.parent)&&p.parent.insertBefore(l,p.next)}oe(o,document,{...n,allowJs:!1});for(let l of a)l()},w=l=>{r.push(o),r.length>eo&&r.shift(),i.length=0,o=l},f=(l,p)=>{d(l);let c={...p,...l?{selector:l}:{},...t()?{url:location.pathname}:{}},h=o.filter(v=>u(v)!==u(c));h.push(c),w(h),oe([c],document,{...n,allowJs:!1});for(let v of a)v()},b=l=>l.parentElement?[...l.parentElement.children].indexOf(l):0;for(let l of e)d(l.selector);return{changes:()=>o,text:(l,p)=>f(F(l),{type:"text",value:p}),attr:(l,p,c)=>f(F(l),{type:"attr",name:p,value:c}),style:(l,p,c)=>{let h=F(l),v=o.find(E=>E.selector===h&&E.type==="style");f(h,{type:"style",styles:{...v?.type==="style"?v.styles:{},[p]:c}})},hide:l=>f(F(l),{type:"hide"}),move:(l,p)=>{let c=Math.max(0,Math.min(b(l)+p,(l.parentElement?.children.length??1)-1));f(F(l),{type:"reorder",index:c})},insert:(l,p,c)=>{d(F(l));let h={type:"insert",position:p,html:c,selector:F(l),...t()?{url:location.pathname}:{}};w([...o,h]),oe([h],document,n);for(let v of a)v()},image:(l,p,c)=>f(F(l),{type:"image",src:p,...c!==void 0?{alt:c}:{}}),css:l=>f(void 0,{type:"css",css:l}),js:l=>f(void 0,{type:"js",js:l}),canUndo:()=>r.length>0,canRedo:()=>i.length>0,undo:()=>{let l=r.pop();l&&(i.push(o),o=l,y())},redo:()=>{let l=i.pop();l&&(r.push(o),o=l,y())},remove:l=>{l<0||l>=o.length||(w(o.filter((p,c)=>c!==l)),y())},onChange:l=>(a.add(l),()=>{a.delete(l)}),toPayload:()=>({[pe]:[...o]})}}function xt(e,t=document){let n=o=>{let r=o.target;if(r&&(r.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(r.tagName))||!(o.ctrlKey||o.metaKey))return;let i=o.key.toLowerCase();if(i==="z"&&!o.shiftKey)e().undo();else if(i==="z"&&o.shiftKey||i==="y")e().redo();else return;o.preventDefault()};return t.addEventListener("keydown",n),()=>t.removeEventListener("keydown",n)}var eo,Ge=N(()=>{"use strict";de();Re();eo=100});function ao(e){return e.startsWith("re:")?e.slice(3):e.split("*").map(t=>t.replace(/[.+?^${}()|[\]\\]/g,"\\$&")).join(".*")}function Fe(e,t){return!!e?.some(n=>{try{return new RegExp(ao(n),"i").test(t)}catch{return!1}})}var Mt=N(()=>{"use strict"});function Ht(e){let t,n,o=()=>{let s=n?.contentDocument;s&&oe([...e()],s,{allowJs:!1})},r=()=>{t?.remove(),t=n=void 0};return{open:s=>{let a=Me[s];if(!a)return r();if(!t){t=document.createElement("div"),t.setAttribute("data-lc-ignore",""),t.setAttribute("role","dialog"),t.setAttribute("aria-label","Device preview"),t.style.cssText="position:fixed;inset:0;z-index:2147483646;background:rgba(15,23,42,.6);display:flex;align-items:center;justify-content:center",n=document.createElement("iframe"),n.title="Variant preview",n.style.cssText="height:90vh;border:0;background:#fff;border-radius:8px;box-shadow:0 8px 32px rgba(0,0,0,.4)",n.onload=o,t.append(n),t.onclick=d=>d.target===t&&r(),document.body.append(t);let u=new URL(location.href);u.hash="lc-device-preview",n.src=u.toString()}n&&(n.style.width=`${a}px`,n.setAttribute("aria-label",`${s} preview, ${a} pixels wide`))},close:r,update:()=>{n?.contentWindow&&n.contentWindow.location.reload()},isOpen:()=>!!t}}var Me,Pt=N(()=>{"use strict";Re();Me={desktop:0,tablet:768,mobile:375}});function It(e=document){let t=[],n=new Set;for(let o of e.querySelectorAll(ho)){if(o.closest("[data-lc-ignore],[data-lc-change]"))continue;let r=ee(o);if(n.has(r))continue;n.add(r);let i=o.tagName.toLowerCase(),s=(i==="img"?o.getAttribute("alt")??"":o.textContent??"").replace(/\s+/g," ").trim().slice(0,160);if(t.push({selector:r,tag:i,text:s}),t.length>=vo)break}return t}var ho,vo,Dt=N(()=>{"use strict";re();ho="h1,h2,h3,button,a,img,[role=button],section[id],header,nav,footer,form label,li",vo=150});var jt={};ye(jt,{experimentEditor:()=>yo,withChanges:()=>Nt});function Nt(e,t,n){return e.variants.map(o=>o.key===t?{...o,payload:{...o.payload,[pe]:n}}:o)}async function yo(e){let t=J("div");t.setAttribute("role","region"),t.setAttribute("aria-label","Experiment visual editor");let n=await e.api.experiment(e.experimentId);if(!n)return t.textContent="Could not load the experiment (check the toolbar scope and project).",t;let o=!!e.scopes?.includes(Ie),r=J("select");for(let x of n.variants)r.append(J("option",{value:x.key,textContent:x.key}));r.value=n.variants[1]?.key??n.variants[0]?.key??"";let i=J("input",{type:"checkbox"}),s=J("ul"),a=Q("Undo",()=>d.undo()),u=Q("Redo",()=>d.redo());a.setAttribute("aria-keyshortcuts","Control+Z Meta+Z"),u.setAttribute("aria-keyshortcuts","Control+Shift+Z Meta+Shift+Z");let d=me(),y=Ht(()=>d.changes()),w=()=>{},f=()=>{let x=n.variants.find(A=>A.key===r.value);w(),d=me(je(x?.payload),()=>i.checked),w=d.onChange(()=>(b(),y.update())),oe(je(x?.payload,location.href)),b()},b=()=>{s.replaceChildren(),d.changes().forEach((x,A)=>{let O=J("li",{textContent:`${x.type} ${x.selector??"(page)"}${x.url?` (on ${x.url})`:""} `});O.append(Q(`Remove change ${A+1}`,()=>d.remove(A))),s.append(O)}),a.disabled=!d.canUndo(),u.disabled=!d.canRedo()},l=xt(()=>d),p=J("select");for(let x of Object.keys(Me))p.append(J("option",{value:x,textContent:x==="desktop"?"Desktop (this window)":`${x} (${Me[x]}px)`}));p.onchange=()=>y.open(p.value);let c=(x,A,O)=>{let H=J("textarea",{rows:4,placeholder:O});H.style.cssText="width:100%;font:12px ui-monospace,monospace";let g=fe(x,H);return g.append(Q(`Set ${x.toLowerCase()}`,()=>H.value.trim()?d[A](H.value):e.note("Write some code first"))),g},h=J("input",{type:"file",accept:"image/png,image/jpeg,image/gif,image/webp"});h.style.display="none",h.onchange=async()=>{let x=e.picked(),A=h.files?.[0];if(h.value="",!x||!A)return;let O=await e.api.uploadAsset(A);O?d.image(x,O):e.note("Upload failed: PNG, JPEG, GIF or WebP up to 2 MiB, with the experiments:write scope")},r.onchange=()=>(e.note("Reload the page to see the other variant without this one's edits"),f());let v=x=>()=>{let A=e.picked();if(!A)return e.note("Inspect an element first");x(A),b()},E=(x,A,O)=>Q(x,v(H=>{let g=window.prompt(A);g!==null&&O(H,g)})),C=J("input",{placeholder:"Goal name"}),S=Q("Save variant",async()=>{let x=await e.api.saveVariants(n.id,Nt(n,r.value,[...d.changes()]));x&&(n.variants=x.variants),e.note(x?`Saved ${d.changes().length} change(s) to ${r.value}`:"Could not save: only draft experiments can change their variants")}),L=Q("Add click goal",v(async x=>{if(!C.value.trim())return e.note("Name the goal first");let A=x.textContent?.trim().slice(0,100),O=await e.api.addGoal(n.id,{name:C.value.trim(),selector:ee(x),...A?{text:A}:{},url:location.pathname});e.note(O?`Goal "${C.value}" added as a secondary metric`:"Could not add the goal")}));if(!o)for(let x of[S,L])x.disabled=!0,x.title=`Requires the ${Ie} toolbar scope`;return t.append(J("b",{textContent:`Experiment: ${n.name} (${n.status})`}),fe("Variant",r),fe("This page only",i),E("Text","New text",(x,A)=>d.text(x,A)),E("Style","CSS as property:value",(x,A)=>{let[O,...H]=A.split(":");O&&H.length&&d.style(x,O.trim(),H.join(":").trim())}),E("Attribute","name=value (empty value removes)",(x,A)=>{let[O,...H]=A.split("=");O&&d.attr(x,O.trim(),H.length&&H.join("=")!==""?H.join("="):null)}),Q("Hide",v(x=>d.hide(x))),Q("Move up",v(x=>d.move(x,-1))),Q("Move down",v(x=>d.move(x,1))),E("Insert HTML","position:html, position = before | after | prepend | append (scripts and handlers are removed)",(x,A)=>{let[O,...H]=A.split(":"),g=O?.trim();["before","after","prepend","append"].includes(g)&&H.length?d.insert(x,g,H.join(":")):e.note("Use position:html, for example after:<p>Free shipping</p>")}),E("Image URL","Image URL (https://...)",(x,A)=>d.image(x,A.trim())),Q("Upload image",v(()=>h.click())),h,c("Page CSS","css",".hero h1 { font-size: 3rem }"),c("Page JS","js","Runs only after approval and when the site sets visualChanges.allowCustomJs"),a,u,fe("Preview width",p),Q("Copy page outline for AI variants",()=>{let x=JSON.stringify(It());navigator.clipboard?.writeText(x).then(()=>e.note("Page outline copied: paste it under Generate variants with AI in the experiment page"),()=>e.note(x))}),s,S,fe("Goal",C),L),new MutationObserver((x,A)=>{t.isConnected?t.dataset.mounted="1":t.dataset.mounted&&(l(),y.close(),w(),A.disconnect())}).observe(document.body,{childList:!0,subtree:!0}),f(),t}var J,Q,fe,Gt=N(()=>{"use strict";Re();ie();Ge();Pt();re();Dt();J=(e,t={})=>Object.assign(document.createElement(e),t),Q=(e,t)=>{let n=J("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n},fe=(e,t)=>{let n=J("label",{textContent:`${e} `});return n.style.display="block",n.append(t),n}});function Bt(e){let t=document.createElement("div"),n=document.createElement("div");n.className="cd",n.setAttribute("role","tablist");for(let i=0;i<e.count;i++){let s=$e("",()=>e.to(i),`Slide ${i+1} of ${e.count}`);s.setAttribute("role","tab"),s.setAttribute("aria-current",String(i===e.index)),n.append(s)}let o=document.createElement("div");o.className="cn";let r=e.index===e.count-1;return o.append(e.index>0?$e("Back",()=>e.to(e.index-1)):$e("Skip",e.dismiss),$e(r?"Done":"Next",()=>r?e.complete():e.to(e.index+1))),t.append(n,o),t}function Ft(e,t){let n,o=s=>{n=s.clientX},r=s=>{if(n===void 0)return;let a=s.clientX-n;n=void 0;let u=t();a<-40&&u.index<u.count-1?u.to(u.index+1):a>40&&u.index>0&&u.to(u.index-1)},i=s=>{let a=t();s.key==="ArrowRight"&&a.index<a.count-1?a.to(a.index+1):s.key==="ArrowLeft"&&a.index>0&&a.to(a.index-1)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",r),e.addEventListener("keydown",i),()=>{e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",r),e.removeEventListener("keydown",i)}}var Ut,$e,Kt=N(()=>{"use strict";Ut=".cd{display:flex;gap:6px;justify-content:center;margin:8px 0}.cd button{width:10px;height:10px;min-width:0;padding:0;margin:0;border-radius:50%;background:#ccc;border:0}.cd button[aria-current=true]{background:var(--a,#111)}.cn{display:flex;justify-content:space-between}",$e=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&o.setAttribute("aria-label",n),o.onclick=t,o}});function ko(e,t=wo()){if(!e?.dark?.tokens)return!1;let n=e.theme_mode??"auto";return n==="dark"||n==="auto"&&t}function wo(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function qt(e,t){let n={...e?.font_family?{font:e.font_family}:{},...e?.tokens};return ko(e,t)?{...n,...e?.dark?.tokens}:n}function zt(e,t){let n=o=>typeof o=="string"&&bo.test(o);n(t?.background)&&(e.style.background=t.background),n(t?.text)&&(e.style.color=t.text),n(t?.accent)&&(e.style.setProperty("--a",t.accent),e.style.setProperty("--at","#fff")),typeof t?.radius=="number"&&t.radius>=0&&t.radius<=32&&(e.style.borderRadius=`${t.radius}px`),typeof t?.font=="string"&&xo.test(t.font)&&(e.style.fontFamily=t.font),t?.shadow&&t.shadow in Wt&&(e.style.boxShadow=Wt[t.shadow]),typeof t?.button_radius=="number"&&t.button_radius>=0&&t.button_radius<=32&&e.style.setProperty("--br",`${t.button_radius}px`),n(t?.secondary)&&e.style.setProperty("--s",t.secondary),n(t?.secondary_text)&&e.style.setProperty("--st",t.secondary_text)}var bo,xo,Wt,Jt=N(()=>{"use strict";bo=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,xo=/^[\w\s,'"-]{1,100}$/,Wt={none:"none",sm:"0 1px 4px rgba(0,0,0,.15)",lg:"0 8px 32px rgba(0,0,0,.3)"}});var Qt={};ye(Qt,{listed:()=>Xt,renderModule:()=>Co,resetAssist:()=>Eo,searchHref:()=>Yt});function R(e,t){let n=document.createElement(e);return t!==void 0&&(n.textContent=t),n}function Xt(e,t){return e.guide_ids?.length?e.guide_ids.flatMap(n=>t.find(o=>o.id===n)??[]):t.filter(n=>Vt.has(n.kind))}function Yt(e,t){if(!e.search_url||!t.trim())return null;try{let n=new URL(e.search_url.replace("{q}",encodeURIComponent(t.trim())));return n.protocol==="https:"?n.href:null}catch{return null}}function Co(e,t){let n=R("section");if(n.setAttribute("aria-label",e.title??e.module??"Module"),n.append(R("h2",e.title??"")),e.body&&n.append(R("p",e.body)),e.module==="guides"){let o=R("ul");for(let r of Xt(e,t.library)){let i=R("button",r.name);i.type="button",i.onclick=()=>(t.opened(),t.launch(r.id));let s=R("li");s.append(i),o.append(s)}n.append(o.childElementCount?o:R("p","No guides yet."))}else if(e.module==="announcements"){let o=t.library.filter(i=>So.has(i.kind)&&i.steps[0]).sort((i,s)=>(s.published_at??"").localeCompare(i.published_at??"")),r=R("ul");for(let i of o.slice(0,10)){let s=R("li");s.append(R("strong",i.steps[0].title??i.name)),i.steps[0].body&&s.append(R("p",i.steps[0].body)),r.append(s)}n.append(r.childElementCount?r:R("p","Nothing new."))}else if(e.module==="search"){let o=R("form");o.setAttribute("role","search");let r=R("label","Search help"),i=R("input");i.type="search",r.append(i);let s=R("button","Search");s.type="submit";let a=R("ul");o.append(r,s,a);let u=R("div");u.setAttribute("aria-live","polite"),o.onsubmit=d=>{d.preventDefault(),t.opened();let y=i.value.trim(),w=y.toLowerCase();a.replaceChildren();let f=t.library.filter(l=>Vt.has(l.kind)&&w&&(l.name+" "+l.steps.map(p=>`${p.title??""} ${p.body??""}`).join(" ")).toLowerCase().includes(w)).slice(0,5);for(let l of f)a.append(Zt(l,t));u.replaceChildren(),t.assist&&!We&&y?Ao(y,f.length,t,u):t.assist?.searched({query:y,results:f.length,answered:!1});let b=Yt(e,i.value);b&&window.open(b,"_blank","noopener,noreferrer")},o.append(u),n.append(o)}return n}function Zt(e,t){let n=R("button",e.name);n.type="button",n.onclick=()=>t.launch(e.id);let o=R("li");return o.append(n),o}async function Ao(e,t,n,o){let r=n.assist;o.textContent="Finding an answer...";let i=await r.ask(e.slice(0,500));if(o.replaceChildren(),i==="unavailable"&&(We=!0),!i||i==="unavailable")return r.searched({query:e,results:t,answered:!1});let s=!!i.answer.trim();if(r.searched({query:e,results:t,answered:s}),!s)return;o.append(R("h3","Answer"),R("p",i.answer));let a=R("ul");for(let w of(i.citations??[]).slice(0,5)){let f=_o(w.url);if(!f)continue;let b=R("a",w.title||f);Object.assign(b,{href:f,target:"_blank",rel:"noopener noreferrer"});let l=R("li");l.append(b),a.append(l)}a.childElementCount&&o.append(R("p","Sources"),a);let u=R("ul");for(let w of(i.guide_ids??[]).slice(0,3)){let f=n.library.find(b=>b.id===w);f&&u.append(Zt(f,n))}u.childElementCount&&o.append(R("p","Suggested guides"),u);let d=R("div"),y=(w,f)=>{let b=R("button",w);return b.type="button",b.onclick=()=>{r.searched({query:e,results:t,answered:s,feedback:f}),d.replaceChildren(R("p","Thanks for the feedback."))},b};d.append(y("Helpful","up"),y("Not helpful","down")),o.append(d)}var We,Eo,_o,Vt,So,en=N(()=>{"use strict";We=!1,Eo=()=>{We=!1},_o=e=>{try{let t=new URL(e);return t.protocol==="https:"?t.href:null}catch{return null}},Vt=new Set(["tour","checklist","modal","slideout"]),So=new Set(["announcement","banner"])});function To(e,t,n=!0,o=!1){if(e==="banner")return[{label:"Dismiss",action:"dismiss"}];let r=n?[]:[{label:"Back",action:"back"}];return o||r.push({label:t?"Done":"Next",action:"next"}),[...r,{label:"Dismiss",action:"dismiss"}]}function Ro(e){for(let t of[e.selector,...e.fallback_selectors??[]])if(t)try{let n=document.querySelector(t);if(n)return n}catch{}return null}function z(e,t,n){let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.className=n),o}function Ho(e){let t;try{t=new URL(e.url)}catch{return null}if(t.protocol!=="https:")return null;if(e.type==="image")return Object.assign(z("img"),{src:t.href,alt:e.alt??"",loading:"lazy"});if(e.type==="video")return Object.assign(z("video"),{src:t.href,controls:!0,preload:"metadata"});if(e.type!=="embed"||!Lo.includes(t.host))return null;let n=Object.assign(z("iframe"),{src:t.href,title:e.alt??"Video",allowFullscreen:!0,referrerPolicy:"no-referrer"});return n.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation"),n}function Po(e,t,n){e.addEventListener("keydown",o=>{if(o.key==="Escape")return n();if(o.key!=="Tab")return;let r=[...e.querySelectorAll(Oo)];if(!r.length)return;let i=r[0],s=r[r.length-1],a=t.activeElement;o.shiftKey&&a===i?(o.preventDefault(),s.focus()):!o.shiftKey&&a===s&&(o.preventDefault(),i.focus())})}function Io(e,t,n="bottom"){let o=t.getBoundingClientRect(),r=e.offsetWidth||280,i=e.offsetHeight||120,s=o.left,a=o.bottom+8;n==="top"?a=o.top-i-8:n==="left"?(s=o.left-r-8,a=o.top):n==="right"&&(s=o.right+8,a=o.top);let u=(d,y)=>Math.max(8,Math.min(d,y-8));e.style.left=`${u(s,window.innerWidth-r)}px`,e.style.top=`${u(a,window.innerHeight-i)}px`}function tn(e,t,n,o={}){let r=document.createElement("div");r.setAttribute("data-lc-ignore","");let i=r.attachShadow({mode:"open"});i.append(Ce($o,o.nonce));let s=document.activeElement,a=Math.min(Math.max(o.start??0,0),e.steps.length-1),u=!1,d,y=[],w=[],f=()=>{for(let m of w)m();w=[]},b=()=>{},l=z("div",void 0,"g"),p=()=>{u||(u=!0,f(),b(),r.remove(),s?.focus?.(),n())},c=m=>{t.dismissed(a,e.steps[a]?.id??"",m),p()},h=()=>c(),v=()=>{t.completed(),p(),e.steps.at(-1)?.confetti&&et()},E=m=>(o.resolveTarget??Ro)(m),C=m=>{let M=m?.goto?void 0:e.steps[a]?.branch?.find(W=>Ze(W,{...o.person?{person:o.person}:{},...o.flag?{flag:o.flag}:{},...o.present?{present:o.present}:{}})),U=m?.goto??M?.goto,$=U==="end"?e.steps.length:U?e.steps.findIndex(W=>W.id===U):-1;y.push(a),a=$>a?$:a+1,S()},S=()=>{let m=e.steps[a];if(!m)return v();if(t.progress?.(m.id),m.url&&!location.href.includes(m.url))return p();j()},L=m=>{m<0||m>=e.steps.length||m===a||(a=m,S())},x=()=>{let m=y.pop();m!==void 0&&(a=m,S())},A=m=>{if(m.action==="next"||m.action==="start_tour")C(m);else if(m.action==="back")x();else if(m.action==="dismiss")h();else if(m.action==="snooze"){let M=Math.min(Math.max(Math.round(m.snooze_hours??24),1),720);t.snoozed?.(e.steps[a]?.id??"",M),c("snooze")}else m.action==="link"&&m.url&&/^https?:\/\//i.test(m.url)?window.open(m.url,"_blank","noopener,noreferrer"):m.action==="event"&&m.event&&t.event(m.event)},O=(m,M)=>{let U=z("div"),$=m.buttons?.length?m.buttons:To(e.kind,M,y.length===0,m.advance==="click"||m.advance==="input");for(let W of $){let X=z("button",W.label);X.type="button",X.onclick=()=>A(W),U.append(X)}return U},H=m=>[...m.title?[z("h2",m.title)]:[],...m.body?[z("p",m.body)]:[],...(m.media??[]).flatMap(M=>Ho(M)??[])],g=new Set(o.checked),G=new Map;function V(m,M,U){let $=G.get(M.id);$&&!$.hasAttribute("data-done")&&($.setAttribute("data-done",""),$.setAttribute("aria-pressed","true"),$.textContent=`\u2713 ${M.title??M.id}`),!(!U||g.has(M.id)&&$?.hasAttribute("data-reported"))&&($?.setAttribute("data-reported",""),g.add(M.id),t.step(m,M.id),g.size>=e.steps.length&&v())}let _=()=>{let m=z("ul");for(let[U,$]of e.steps.entries()){let W=z("li"),X=z("button",`${$.title??$.id}`);if(X.type="button",X.setAttribute("aria-pressed","false"),G.set($.id,X),g.has($.id)&&(V(U,$,!1),X.setAttribute("data-reported","")),X.onclick=()=>{if(e.kind==="checklist")V(U,$,!0);else if(e.kind==="resource_center"){t.step(U,$.id);let K=$.buttons?.find(q=>q.action==="link");K&&A(K)}},$.module){let K={library:o.library??[],launch:q=>(p(),o.launch?.(q)),opened:()=>t.step(U,$.id),...o.assist?{assist:o.assist}:{}};Promise.resolve().then(()=>(en(),Qt)).then(q=>W.append(q.renderModule($,K))),m.append(W);continue}W.append(X),$.body&&W.append(z("p",$.body)),m.append(W)}l.append(z("h2",e.name),m);let M=z("button",e.kind==="resource_center"?"Close":"Dismiss");M.type="button",M.onclick=h,l.append(M)};function j(){f(),l.replaceChildren(),l.style.visibility="";let m=e.steps[a];if(!m)return;let M=e.kind==="carousel";if(e.kind==="checklist"||e.kind==="resource_center")_();else{let K={index:a,count:e.steps.length,to:L,complete:v,dismiss:h};l.append(...H(m),M?Bt(K):O(m,a===e.steps.length-1)),t.step(a,m.id)}l.setAttribute("role",e.kind==="banner"||e.kind==="inline"?"region":"dialog"),l.setAttribute("aria-label",m?.title??e.name),M&&l.setAttribute("aria-roledescription","carousel");let U={modal:"m",carousel:"m",banner:`bn${m.placement==="bottom"?" bb":""}`,slideout:`so${e.appearance?.side==="left"?" sl":""}`,inline:"in"};if(l.className=`g ${U[e.kind]??"p"}`,zt(l,qt(e.appearance)),(e.kind==="modal"||M)&&l.setAttribute("aria-modal","true"),M&&w.push(Ft(l,()=>({index:a,count:e.steps.length,to:L,complete:v,dismiss:h}))),m.auto_close_s&&m.auto_close_s>0){let K=setTimeout(()=>c("auto_close"),Math.min(m.auto_close_s,600)*1e3);w.push(()=>clearTimeout(K))}if(m.automation&&o.automate!==!1){let K=m.automation,q=setTimeout(()=>t.automated?.(m.id,Qe(K)));w.push(()=>clearTimeout(q))}let $=(e.kind==="tooltip"||e.kind==="tour")&&!!(m.selector||m.fallback_selectors?.length),W=K=>{l.style.visibility="",l.classList.remove("p"),Io(l,K,m.placement);let q=m.advance==="click"?"click":m.advance==="input"?"change":null;if(!q)return;let ce=()=>C();K.addEventListener(q,ce,{once:!0}),w.push(()=>K.removeEventListener(q,ce))},X=$?E(m):null;if(X)W(X);else if($){l.style.visibility="hidden";let K=Date.now()+Math.min(Math.max(m.wait_ms??3e3,0),15e3),q=setInterval(()=>{let ce=E(m);ce?(clearInterval(q),W(ce)):Date.now()>=K&&(clearInterval(q),l.style.visibility="",t.targetMissing?.(m.id,m.selector??m.fallback_selectors?.[0]??""))},150);w.push(()=>clearInterval(q))}e.kind!=="inline"&&l.querySelector("button")?.focus()}Po(l,i,h);let D=e.kind==="modal"||e.kind==="carousel",B=e.appearance?.dismiss_on_outside_click??D;if(e.appearance?.overlay??D)d=z("div",void 0,"o"),B&&(d.onclick=h),i.append(d);else if(B&&e.kind!=="inline"){let m=U=>{U.composedPath().includes(r)||h()},M=setTimeout(()=>document.addEventListener("click",m,!0));b=()=>(clearTimeout(M),document.removeEventListener("click",m,!0))}i.append(l);let ne=e.kind==="inline"&&e.steps[0]?.selector?document.querySelector(e.steps[0].selector):null;return ne?ne.after(r):document.body.append(r),t.shown(),j(),Object.assign(p,{markDone(m){let M=e.steps.findIndex(U=>U.id===m);e.kind==="checklist"&&M>=0&&!u&&V(M,e.steps[M],!0)}})}var Mo,$o,Lo,Oo,nn=N(()=>{"use strict";Ne();Kt();Oe();Jt();Mo=".g{position:fixed;z-index:2147483000;background:#fff;color:#111;border:1px solid #ccc;border-radius:8px;padding:14px;font:14px system-ui;max-width:320px;box-shadow:0 4px 16px rgba(0,0,0,.2)}.m{top:50%;left:50%;transform:translate(-50%,-50%)}.bn{top:0;left:0;right:0;max-width:none;border-radius:0}.bb{top:auto;bottom:0}.p{right:16px;bottom:16px}.o{position:fixed;inset:0;z-index:2146999999;background:rgba(0,0,0,.4)}button{margin:2px;padding:4px 10px;cursor:pointer;background:var(--a,buttonface);color:var(--at,buttontext);border:1px solid #bbb;border-radius:var(--br,4px)}button+button{background:var(--s,buttonface);color:var(--st,buttontext)}h2{margin:0 0 6px;font-size:16px}p{margin:0 0 8px}li{margin:4px 0}.so{top:0;bottom:0;right:0;max-width:360px;border-radius:0;overflow:auto;animation:s .2s}.so.sl{right:auto;left:0}@keyframes s{from{transform:translateX(30px);opacity:0}}@media (prefers-reduced-motion:reduce){.so{animation:none}}.in{position:static;box-shadow:none;max-width:none;margin:8px 0}img,video,iframe{display:block;width:100%;max-width:100%;border:0;margin:0 0 8px;border-radius:4px}iframe{aspect-ratio:16/9}",$o=Mo+Ut,Lo=["www.youtube-nocookie.com","www.youtube.com","player.vimeo.com","www.loom.com","fast.wistia.net"],Oo="button,[href],input,textarea,select,[tabindex]:not([tabindex='-1'])"});function ge(e){let t=e.trim().toLowerCase();if(/^#([0-9a-f]{6})$/.test(t))return t;if(/^#([0-9a-f]{3})$/.test(t))return`#${[...t.slice(1)].map(i=>i+i).join("")}`;let n=/^rgba?\(\s*(\d+)[\s,]+(\d+)[\s,]+(\d+)(?:[\s,/]+([\d.]+%?))?\s*\)$/.exec(t);if(!n)return null;let o=n[4];return(o===void 0?1:o.endsWith("%")?parseFloat(o)/100:parseFloat(o))<.5?null:`#${[n[1],n[2],n[3]].map(i=>Math.min(255,Number(i)).toString(16).padStart(2,"0")).join("")}`}function No(e){let t=["button[type=submit]","[class*=primary]","button","a[class*=btn]","[role=button]"];for(let n of t)for(let o of e.querySelectorAll(n)){if(o.closest("[data-lc-ignore]"))continue;let r=o.getBoundingClientRect();if(r.width>0&&r.height>0&&ge(getComputedStyle(o).backgroundColor))return o}return null}function on(e=document){let t=getComputedStyle(e.body),n=getComputedStyle(e.documentElement),o={},r=ge(t.backgroundColor)??ge(n.backgroundColor);r&&(o.background=r);let i=ge(t.color);i&&(o.text=i);let s=No(e),a={name:`${e.title||location.hostname} theme`.slice(0,100),tokens:o};if(s){let d=getComputedStyle(s),y=ge(d.backgroundColor);y&&y!==r&&(o.accent=y);let w=Math.round(parseFloat(d.borderTopLeftRadius));Number.isFinite(w)&&w>=0&&(o.radius=Math.min(w,32),a.radius=o.radius)}let u=t.fontFamily.trim();return u&&Do.test(u)&&(a.font_family=u),a}var Do,rn=N(()=>{"use strict";Do=/^[\w\s,'"-]{1,100}$/});async function sn(e,t){let n=await e.draftGuide(t);return n&&Array.isArray(n.steps)?{name:n.name,kind:n.kind,steps:n.steps,...n.targeting?{targeting:n.targeting}:{}}:t.recorded_steps?.length?it(t.recorded_steps):null}function an(e){let t=he("div"),n=()=>{try{return JSON.parse(sessionStorage.getItem(qe)??"null")}catch{return null}},o=f=>{try{f?sessionStorage.setItem(qe,JSON.stringify(f)):sessionStorage.removeItem(qe)}catch{}},r=[],i,s=he("div"),a=f=>{r=f,o(r),i=rt(b=>{if(!t.isConnected)return i?.(),void(i=void 0);r.push(b),o(r),s.textContent=`Recording: ${r.length} step${r.length===1?"":"s"} (${b.selector})`},e.attrs,30-f.length),u.textContent="Stop and draft"},u=ze("Record clicks",async()=>{if(!i)return a([]),e.note("Click through the flow; each click becomes a tour step");if(i(),i=void 0,o(null),u.textContent="Record clicks",!r.length)return e.note("Nothing recorded");e.note("Drafting copy...");let f=await sn(e.api,{recorded_steps:r});f&&(e.load(f),e.note(`Draft with ${f.steps.length} steps loaded; review, then save`))}),d=n();d&&e.canWrite&&a(d);let y=ze("Draft from prompt",async()=>{let f=window.prompt("Describe the guide (who, what, where)");if(!f?.trim())return;e.note("Drafting...");let b=await sn(e.api,{prompt:f.trim().slice(0,2e3)});b?(e.load(b),e.note("Draft loaded; review, then save")):e.note("Could not draft a guide right now")}),w=ze("Derive theme from this page",async()=>{let f=on(),b=JSON.stringify({tokens:f.tokens,font_family:f.font_family});if(!e.canWrite)return e.note(`Derived ${b}. Saving themes requires the guides:write scope.`);let l=window.prompt("Theme name",f.name);if(!l?.trim())return;let p=await e.api.createTheme({name:l.trim().slice(0,100),tokens:f.tokens,...f.font_family?{font_family:f.font_family}:{},...f.radius!==void 0?{radius:f.radius}:{}});e.note(p?`Theme "${p.name}" saved (${p.id}): pick it in a guide's appearance`:`Could not save the theme. Derived ${b}`)});if(!e.canWrite)for(let f of[u,y])f.disabled=!0,f.title="Requires the guides:write toolbar scope";return t.append(he("b",{textContent:"AI and themes"}),he("br"),u,y,w,s),{node:t,teardown:()=>i?.()}}var qe,he,ze,ln=N(()=>{"use strict";re();rn();qe="lc_toolbar_recording",he=(e,t={})=>Object.assign(document.createElement(e),t),ze=(e,t)=>{let n=he("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n}});var cn={};ye(cn,{guideBuilder:()=>Uo});function Uo(e){let t=I("div"),n=He(),o,r=!!e.scopes?.includes(_e),i=an({api:e.api,canWrite:r,note:e.note,load:g=>O(g),...e.attrs?{attrs:e.attrs}:{}}),s=I("input",{placeholder:"Guide name"}),a=I("select");for(let g of jo)a.append(I("option",{value:g,textContent:g}));let u=I("input",{placeholder:"Step title"}),d=I("textarea",{placeholder:"Step body",rows:2}),y=I("input",{placeholder:"Image URL (https, optional)"}),w=I("input",{placeholder:"Image description (alt text)"});for(let g of[s,u,d,y,w])g.setAttribute("aria-label",g.placeholder);let f=I("select");for(let g of["bottom","top","left","right"])f.append(I("option",{value:g,textContent:g}));let b=I("select");for(let g of["","click","focus","fill"])b.append(I("option",{value:g,textContent:g?`Automation: ${g}`:"No automation"}));let l=I("input",{placeholder:"Fill value (constant)"}),p="",c=I("select");for(let g of Go)c.append(I("option",{value:g,textContent:`Rule: ${g}`}));let h=I("input",{placeholder:"Rule value (regex / length)"}),v=I("input",{placeholder:"Message shown on a bad value"});for(let g of[l,h,v])g.setAttribute("aria-label",g.placeholder);let E=I("div"),C=I("div");C.style.whiteSpace="pre-wrap";let S="",L=()=>{E.textContent=S?`Element: ${S}`:"No element picked",C.textContent=n.steps.map((g,G)=>`${G+1}. ${g.title??g.body??g.id}${g.selector?` @ ${g.selector}`:""}`).join(`
2
+ `)},x=()=>{n.name=s.value,n.kind=a.value},A=()=>{x(),o?.();let g=ot(n);if(!g.steps.length)return e.note("Add a step first");o=tn(g,{shown(){},step(){},completed(){},dismissed(){},event(){}},()=>o=void 0)},O=g=>{n={...g.id?{id:g.id}:{},name:g.name,kind:g.kind,steps:g.steps,..."targeting"in g&&g.targeting?{targeting:g.targeting}:{}},s.value=g.name,a.value=g.kind,L()},H=te("Save guide",async()=>{x();let g=tt(n);if(g)return e.note(g);let G=nt(n,location.pathname),V=n.id?await e.api.updateGuide(n.id,G):await e.api.createGuide(G);V&&(n.id=V.id),e.note(V?`Guide saved (${V.id}), start it from the app`:"Could not save guide")});return r||(H.disabled=!0,H.title=`Requires the ${_e} toolbar scope`),t.append(I("b",{textContent:"Guide builder"}),I("br"),s,a,te("Pick element",()=>{let g=e.picked();S=g?ee(g,e.attrs):"",L(),g||e.note("Use Inspect element first, then Pick element")}),E,u,d,y,w,f,b,te("Pick automation target",()=>{let g=e.picked();p=g?ee(g,e.attrs):"",e.note(g?`Automation target ${p}`:"Use Inspect element first")}),l,te("Check automation",()=>{let g=b.value;if(!g)return e.note("Choose an automation action first");e.note(Ee({action:g,selector:p,...l.value?{value:l.value}:{}})??"The automation target is valid on this page")}),c,h,v,te("Add step",()=>{x();let g=b.value&&p?{action:b.value,selector:p,...b.value==="fill"?{value:l.value}:{}}:void 0;if(g){let G=Ee(g);if(G)return e.note(G)}if(n.kind==="form_validation"){if(!S||!v.value.trim())return e.note("Pick the field and write the message");let G=c.value==="min_length"||c.value==="max_length"?Number(h.value):h.value;return we(n,{title:u.value||"Field check",validation:{selector:S,rules:[{type:c.value,message:v.value.trim().slice(0,200),...h.value?{value:G}:{}}]}}),S=h.value=v.value=u.value="",L()}we(n,{...g?{automation:g}:{},...u.value?{title:u.value}:{},...d.value?{body:d.value}:{},...S?{selector:S,placement:f.value}:{},...y.value.startsWith("https://")&&w.value.trim()?{media:[{type:"image",url:y.value,alt:w.value.trim()}]}:{}}),u.value=d.value=y.value=w.value=l.value="",S=p="",b.value="",L()}),te("Remove last",()=>(n.steps.pop(),L())),C,te("Preview",A),te("Close preview",()=>o?.()),H,te("Load existing",async()=>{let g=await e.api.listGuides(),G=g.find(V=>V.name===s.value)??g[0];G?O(G):e.note("No guides yet")}),te("New",()=>(n=He(),s.value="",L())),I("div",{textContent:r?"":`Saving requires the ${_e} scope on the toolbar token.`}),i.node),L(),t}var jo,Go,I,te,dn=N(()=>{"use strict";nn();ie();re();ln();jo=["tooltip","modal","banner","tour","checklist","resource_center","announcement","hotspot","beacon","badge","launcher","slideout","inline","carousel","form_validation"],Go=["required","email","url","phone","regex","min_length","max_length","number"],I=(e,t={})=>Object.assign(document.createElement(e),t),te=(e,t)=>{let n=I("button",{textContent:e,type:"button"});return n.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",n.onclick=t,n}});var fn={};ye(fn,{CHECK_MESSAGE:()=>un,CHECK_PARAM:()=>Bo,describeResult:()=>mn,parseCheck:()=>Fo,resolveSteps:()=>pn,runCheck:()=>Wo});function Fo(e){if(!e||e.length>2e4)return null;try{let t=JSON.parse(e),n=typeof t.origin=="string"?new URL(t.origin).origin:"";if(!/^https?:\/\//.test(n)||!Array.isArray(t.steps))return null;let o=t.steps.filter(r=>r&&typeof r.step=="number"&&Array.isArray(r.selectors)).slice(0,50).map(r=>({step:r.step,...typeof r.url=="string"&&r.url?{url:r.url}:{},selectors:r.selectors.filter(i=>typeof i=="string"&&i.trim()).slice(0,10)}));return{origin:n,steps:o}}catch{return null}}function pn(e,t=location.href){return e.steps.map(n=>{let o=[],r=null;for(let i of n.selectors)try{let s=Array.from(document.querySelectorAll(i));s.length&&!r&&(r={selector:i,els:s})}catch{o.push(i)}return{step:n.step,selector:r?.selector??null,matches:r?.els.length??0,visible:!!r?.els.some(Ko),onPage:!n.url||t.includes(n.url),invalid:o}})}async function Wo(e,t,n=1500){t("Checking guide selectors on this page..."),await new Promise(r=>setTimeout(r,n));let o=pn(e);t(o.map(mn).join(`
3
+ `)||"The guide has no anchored steps");try{window.opener?.postMessage({type:un,url:location.href,results:o},e.origin)}catch{}return o}var Bo,un,Ko,mn,gn=N(()=>{"use strict";Bo="__lc_check",un="lc:guide-check";Ko=e=>{let t=e.getBoundingClientRect();return t.width>0&&t.height>0};mn=e=>`Step ${e.step}: ${e.onPage?e.selector?`${e.selector} - ${e.matches} match${e.matches===1?"":"es"}${e.visible?"":" (hidden)"}`:"no selector matched":"on another page"}${e.invalid.length?`; invalid: ${e.invalid.join(", ")}`:""}`});de();var T=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&(o.title=n),o.style.cssText="margin:2px;padding:4px 8px;font:12px system-ui;cursor:pointer",o.onclick=t,o},k=(e,t,n)=>{let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.style.cssText=n),o},P=(e,t)=>{let n=k("label",void 0,"display:block;margin:2px 0");return n.append(`${e} `,t),n},Y=(e="",t="")=>{let n=k("input",void 0,"font:12px system-ui;width:150px");return n.value=e,n.placeholder=t,n},Z=(e,t)=>{let n=k("select",void 0,"font:12px system-ui");for(let[o,r]of e)n.append(Object.assign(k("option",r),{value:o}));return t!==void 0&&(n.value=t),n};function be(e,t,n="#4af"){let o=k("div",void 0,`position:absolute;left:${e.left+scrollX}px;top:${e.top+scrollY}px;width:${e.width}px;height:${e.height}px;border:2px solid ${n};box-sizing:border-box;z-index:2147483646;pointer-events:none`);o.setAttribute("data-lc-ignore","");let r=k("span",t,`position:absolute;left:-2px;top:-18px;background:${n};color:#000;font:bold 11px system-ui;padding:1px 4px;border-radius:3px;white-space:nowrap`);return o.append(r),o}re();function Rn(e){let t=e.cloneNode(!0),n=[e,...e.querySelectorAll("*")],o=[t,...t.querySelectorAll("*")];n.forEach((r,i)=>{let s=o[i];if(!s)return;let a=getComputedStyle(r),u="";for(let d=0;d<a.length;d++){let y=a.item(d);u+=`${y}:${a.getPropertyValue(y)};`}if(s.setAttribute("style",u),(s instanceof HTMLInputElement||s instanceof HTMLTextAreaElement)&&(s.removeAttribute("value"),s.textContent=""),s instanceof HTMLSelectElement)for(let d of s.querySelectorAll("option"))d.removeAttribute("selected");s.hasAttribute("data-lc-mask")&&(s.textContent="\u2022\u2022\u2022"),s.removeAttribute("id");for(let d of[...s.attributes])d.name.startsWith("on")&&s.removeAttribute(d.name)});for(let r of t.querySelectorAll("script"))r.remove();return new XMLSerializer().serializeToString(t)}function Mn(e,t,n){return`<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${n}"><foreignObject width="100%" height="100%"><div xmlns="http://www.w3.org/1999/xhtml">${e}</div></foreignObject></svg>`}async function st(e){let t=e.getBoundingClientRect(),n=Math.max(1,Math.ceil(t.width)),o=Math.max(1,Math.ceil(t.height)),r=Math.min(1,640/Math.max(n,o));if(typeof URL.createObjectURL!="function")return null;let i=URL.createObjectURL(new Blob([Mn(Rn(e),n,o)],{type:"image/svg+xml"}));try{let s=new Image;await new Promise((d,y)=>{s.onload=()=>d(),s.onerror=()=>y(new Error("render")),s.src=i});let a=document.createElement("canvas");a.width=Math.round(n*r),a.height=Math.round(o*r);let u=a.getContext("2d");return u?(u.drawImage(s,0,0,a.width,a.height),await new Promise(d=>a.toBlob(d,"image/png"))):null}catch{return null}finally{URL.revokeObjectURL(i)}}var $n=100;function Pe(e,t,n=location.pathname){let o=e.textContent?.trim().replace(/\s+/g," ")??"",r=e.closest("a")?.getAttribute("href");return{selector:ee(e,t),...o&&o.length<=$n?{text:o,text_match:"exact"}:{},...r?{href:r,href_match:"exact"}:{},url:n,url_match:"contains"}}var at=(e,t,n="exact")=>t===void 0||e!=null&&(n==="exact"?e.trim()===t:e.includes(t));function Ln(e,t=location.href){if(e.url===void 0)return!0;if(e.url_match==="regex")try{return new RegExp(e.url).test(t)}catch{return!1}return e.url_match==="exact"?t===e.url||new URL(t).pathname===e.url:t.includes(e.url)}function On(e,t=document,n=location.href){if(!Ln(e,n)||!e.selector&&e.text===void 0&&e.href===void 0)return[];let o;try{o=Array.from(t.querySelectorAll(e.selector??(e.href!==void 0?"a":"*")))}catch{return[]}return o.filter(r=>!r.closest("[data-lc-ignore]")&&at(r.textContent,e.text,e.text_match)&&at(r.closest("a")?.getAttribute("href"),e.href,e.href_match))}function lt(e){let t=k("div"),n=Y("","Action name"),o=k("div"),r=[],i,s,a=[],u=k("div"),d=(c,h,v)=>{let E=Y(c[h]??"");return E.oninput=()=>{E.value?c[h]=E.value:delete c[h]},P(v,E)},y=(c,h,v,E)=>{let C=Z(E.map(S=>[S,S]),c[h]??E[0]);return C.onchange=()=>{c[h]=C.value},P(v,C)},w=()=>{o.replaceChildren(...r.map((c,h)=>{let v=k("fieldset",void 0,"border:1px solid #444;margin:4px 0;padding:4px");return v.append(k("legend",h===0?"Element 1":`OR element ${h+1}`),d(c,"selector","Selector"),d(c,"text","Text"),y(c,"text_match","Text match",["exact","contains"]),d(c,"href","Link target"),y(c,"href_match","Link match",["exact","contains"]),d(c,"url","Page URL"),y(c,"url_match","Page match",["contains","exact","regex"]),T("Remove element",()=>(r.splice(h,1),w()))),v}))},f=()=>{r=[],i=void 0,s=void 0,n.value="",w()},b=()=>{for(let c of a)c.remove();a=[]},l=async()=>{b();let c=await e.api.listActions(),h=0;u.replaceChildren(...c.map(v=>{let E=[...new Set((Array.isArray(v.steps)?v.steps:[]).flatMap(S=>On(S)))];for(let S of E){h+=1;let L=be(S.getBoundingClientRect(),`${h} ${v.name}`,"#fc4");document.body.append(L),a.push(L)}let C=k("div",`${v.name} (${E.length} on this page)`,"margin:2px 0");return C.append(T("Edit",()=>{i=v.id,n.value=v.name,r=(v.steps??[]).map(S=>({...S})),w(),e.note(`Editing ${v.name}`)}),T("Delete",async()=>{window.confirm(`Delete action ${v.name}?`)&&(e.note(await e.api.deleteAction(v.id)?`Deleted ${v.name}`:"Could not delete"),l())})),C})),u.prepend(k("b",`${h} matched element${h===1?"":"s"} on this page`))};return t.append(k("b","Actions"),P("Name",n),T("Add picked element",()=>{let c=e.picked();if(!c)return e.note("Inspect an element first");r.push(Pe(c,e.attrs)),s??=c,w()}),o,T("Save action",async()=>{if(!n.value.trim()||!r.length)return e.note("Name the action and add at least one element");let c={name:n.value.trim(),steps:r},h=i?await e.api.updateAction(i,c):await e.api.createAction(c);if(e.note(h?`Action ${h.name??c.name} saved`:"Could not save the action"),h&&s){let v=await st(s);v&&!await e.api.putActionScreenshot(h.id,v)&&e.note(`Action ${h.name??c.name} saved, screenshot not stored`)}h&&f()}),T("New action",f),T("Show existing actions",()=>{l()}),T("Hide action boxes",()=>(b(),u.replaceChildren())),u),{node:t,teardown:b,addStep:c=>{r.push(c),w()}}}ie();var mt=500,Hn=new Set(["$snapshot","$replay_tag","$rageclick","$deadclick","$heatmap_moves","$attention"]),Pn=e=>Hn.has(e)?"replay":e.startsWith("$")?"system":"custom";function In(e){let t=/^\/(.+)\/([a-z]*)$/.exec(e.trim());if(t)try{let o=new RegExp(t[1],t[2]);return r=>o.test(r)}catch{return()=>!1}let n=e.trim().toLowerCase();return o=>!n||o.toLowerCase().includes(n)}function ft(e){let t=k("div"),n=Y("","name, payload or /regex/"),o=Z([["all","All events"],["custom","Custom"],["system","System ($)"],["replay","Replay and heatmap"]]),r=Object.assign(k("input"),{type:"checkbox"}),i=Object.assign(k("input"),{type:"checkbox"}),s=k("div"),a=k("div",void 0,"max-height:240px;overflow:auto"),u=[],d=[],y=!0,w=Date.now(),f=()=>{let l=In(n.value),p=u.filter(c=>c.pinned||(o.value==="all"||Pn(c.e.event)===o.value)&&l(`${c.e.event} ${JSON.stringify(c.e.properties??{})}`)).sort((c,h)=>Number(h.pinned)-Number(c.pinned)||h.at-c.at);s.textContent=`${p.length} of ${u.length} events${d.length?`, ${d.length} held while paused`:""}`,a.replaceChildren(...p.map(c=>{let h=k("details",void 0,"border-top:1px solid #333;padding:2px 0"),v=i.checked?`+${((c.at-w)/1e3).toFixed(1)}s`:new Date(c.at).toLocaleTimeString(),E=k("summary",`${c.pinned?"[pinned] ":""}${v} ${c.e.event}`),C=JSON.stringify(c.e,null,1);return h.append(E,T(c.pinned?"Unpin":"Pin",()=>(c.pinned=!c.pinned,f())),T("Copy",()=>{navigator.clipboard?.writeText(C)}),k("pre",C,"white-space:pre-wrap;max-height:160px;overflow:auto;margin:0")),h}))};e.onCapture(l=>{if(!y)return;let p={e:l,at:Date.now(),pinned:!1};r.checked?d.push(p):u.push(p),u.length>mt&&(u=u.filter((c,h)=>c.pinned||h>=u.length-mt)),f()}),r.onchange=()=>{r.checked||u.push(...d.splice(0)),f()},n.oninput=o.onchange=i.onchange=f;let b=()=>{let l=new Blob([JSON.stringify(u.map(c=>c.e),null,1)],{type:"application/json"}),p=Object.assign(k("a"),{href:URL.createObjectURL(l),download:`lucida-events-${w}.json`});p.click(),URL.revokeObjectURL(p.href)};return t.append(k("b","Event debugger"),P("Search",n),P("Category",o),P("Pause",r),P("Relative time",i),T("Clear",()=>(u=u.filter(l=>l.pinned),d=[],f())),T("Export JSON",b),s,a),f(),{node:t,teardown:()=>{y=!1}}}Ge();ie();var Ue="__default";function to(e,t){let n=e?.variants?.map(r=>r.key)??[],o=n.length?n:typeof t=="string"?[t]:[];return[[Ue,"(no override)"],["true","on"],["false","off"],...o.map(r=>[`v:${r}`,r])]}var no=e=>e===void 0?Ue:typeof e=="boolean"?String(e):`v:${e}`,oo=e=>e===Ue?null:e==="true"?!0:e==="false"?!1:e.slice(2);function kt(e,t){let n=k("div"),o=Y("","Search flags"),r=k("div"),i=k("div"),s={},a=[],u=()=>{let y=De(),w=o.value.trim().toLowerCase(),f=[...new Set([...a.map(b=>b.key),...Object.keys(s)])].filter(b=>!w||b.toLowerCase().includes(w)).sort();r.replaceChildren(...f.map(b=>{let l=Z(to(a.find(c=>c.key===b),y[b]??s[b]),no(y[b]));return l.onchange=()=>{pt(b,oo(l.value)),i.replaceChildren(k("span","Overrides apply on the next page load. "),T("Reload now",()=>location.reload())),u()},P(`${b} = ${String(y[b]??s[b]??"-")}${b in y?" (override)":""}`,l)})),f.length||r.append(k("div",w?"No flag matches":"No flags"))};o.oninput=u;let d=e.client.onFlags(y=>{s=y,u()});return t.flags().then(y=>{a=y,u()}),n.append(k("b","Feature flags (this browser)"),P("Search",o),r,i),{node:n,teardown:d}}re();function wt(e){return e<768?"mobile":e<1024?"tablet":"desktop"}var Et=["#1f77b4","#ff7f0e","#2ca02c","#d62728","#9467bd","#8c564b","#e377c2","#17becf","#bcbd22","#3b4cc0","#f4a582","#006d2c"],_t=(e,t)=>t[e]?.value==="(other)"?"#9e9e9e":Et[e%Et.length]??"#9e9e9e",St=[["","Heat (no breakdown)"],["channel","Channel"],["referrer","Referrer"],["device","Device"],["country","Country"],["browser","Browser"],["os","OS"],["visitor","New vs returning"],["event","Event property"],["person","Person property"]];function Ct(e,t){return e==="event"||e==="person"?t.trim()?`${e}:${t.trim()}`:"":e}function Be(e,t,n=document.createElement("canvas")){let o=document.documentElement.scrollWidth,r=Math.max(document.documentElement.scrollHeight,...e.dots.map(a=>a[1]+4));n.width=o,n.height=r,n.setAttribute("data-lc-ignore",""),n.setAttribute("role","img"),n.setAttribute("aria-label",`Confetti of ${e.dots.length} clicks`),n.style.cssText=`position:absolute;left:0;top:0;width:${o}px;height:${r}px;pointer-events:none;z-index:2147483645`;let i=n.getContext("2d");if(!i)return n;let s=document.documentElement.clientWidth||o;for(let[a,u,d]of e.dots)t.has(d)||(i.fillStyle=_t(d,e.legend),i.beginPath(),i.arc(a*s,u,3,0,Math.PI*2),i.fill());return n}function At(e,t,n){if(e.legend.length===0)return k("div","No clicks in this range.");let o=k("ul",void 0,"list-style:none;margin:4px 0;padding:0");return o.setAttribute("aria-label","Confetti legend"),e.legend.forEach((r,i)=>{let s=Object.assign(k("input"),{type:"checkbox",checked:!t.has(i)});s.onchange=()=>{s.checked?t.delete(i):t.add(i),n()};let a=k("span",void 0,`display:inline-block;width:10px;height:10px;border-radius:5px;margin:0 6px;background:${_t(i,e.legend)}`);a.setAttribute("aria-hidden","true");let u=k("label");u.append(s,a,`${r.value||"(none)"} (${r.clicks})`);let d=k("li");d.append(u),o.append(d)}),o}var Tt=()=>({w:document.documentElement.scrollWidth,h:document.documentElement.scrollHeight}),le=(e=location.pathname)=>e.length>1&&e.replace(/\/+$/,"")||"/";function ro(e){let{w:t,h:n}=Tt(),o=document.createElement("canvas");o.width=t,o.height=n,o.setAttribute("data-lc-ignore",""),o.setAttribute("role","img"),o.setAttribute("aria-label",`Heatmap of ${e.total} events`),o.style.cssText=`position:absolute;left:0;top:0;width:${t}px;height:${n}px;pointer-events:none;z-index:2147483645;opacity:.75`;let r=o.getContext("2d");if(!r)return o;let i=(document.documentElement.clientWidth||t)/Math.max(1,e.x_bins);for(let s of e.bins){let a=e.max>0?s.count/e.max:0;r.fillStyle=`hsla(${Math.round((1-a)*55)}, 95%, 52%, ${(.25+.55*a).toFixed(2)})`,r.fillRect(s.x*i,s.y*e.y_bin_px,i,e.y_bin_px)}return o}function io(e){let{h:t}=Tt(),n=k("div",void 0,`position:absolute;left:0;top:0;width:100%;height:${t}px;pointer-events:none;z-index:2147483645`);n.setAttribute("data-lc-ignore","");for(let o of e.reach){let r=e.sessions>0?o.sessions/e.sessions:0,i=k("div",`${Math.round(r*100)}% reached`,`position:absolute;left:0;width:100%;top:${(o.depth_pct-10)/100*t}px;height:${t/10}px;background:hsla(${Math.round(r*120)},80%,50%,.25);font:bold 11px system-ui;color:#000;padding:2px`);n.append(i)}return n}function so(e,t){try{return(t?Array.from(document.querySelectorAll("a[href]")).filter(o=>o.getAttribute("href")===e.selector):Array.from(document.querySelectorAll(e.selector))).filter(o=>!o.closest("[data-lc-ignore]"))}catch{return[]}}function Rt(e){let t=k("div"),n=Z([["click","Clicks"],["rage","Rage clicks"],["dead","Dead clicks"],["move","Mouse movement"],["scroll","Scrollmap"]]),o=Z(St),r=Y("","property key"),i=Object.assign(k("input"),{type:"checkbox"}),s=k("div"),a=k("div",void 0,"white-space:pre-wrap"),u,d=[],y=null,w=[],f=()=>{u?.remove(),u=void 0;for(let v of d)v.remove();d=[],w=[],y=null,a.replaceChildren(),s.replaceChildren()},b=()=>wt(window.innerWidth),l=()=>{for(let v of d)v.remove();d=[],a.replaceChildren(),w.forEach((v,E)=>{let C=`${E+1}: ${v.clicks} clicks${v.rage_clicks?`, ${v.rage_clicks} rage`:""}`,S=so(v,i.checked);for(let x of S){let A=be(x.getBoundingClientRect(),C,v.rage_clicks?"#f55":"#4af");document.body.append(A),d.push(A)}let L=k("div",`${C} ${v.selector}${S.length?"":" (not on this page)"}`);S[0]&&L.append(T("Create action",()=>e.onPick(S[0]))),a.append(L)})},p=async v=>{do{let E=await e.api.elements(le(),b(),y,i.checked);if(!E)return e.note("Could not load elements");w.push(...E.data),y=E.next_cursor}while(v&&y);l(),h.style.display=y?"":"none"},c=async()=>{f();let v=n.value,E=Ct(o.value,r.value);if(v==="click"&&E){let C=await e.api.confetti(le(),b(),E);if(!C)return e.note("No confetti data");let S=new Set,L=Be(C,S);u=L,s.append(At(C,S,()=>{Be(C,S,L)})),e.note(`${C.dots.length} clicks on ${le()} (${b()}) coloured by ${E}`),await p(!1)}else if(v==="scroll"){let C=await e.api.scroll(le(),b());if(!C)return e.note("No scroll data");u=io(C)}else{let C=await e.api.heat(le(),b(),v);if(!C)return e.note("No heatmap data");u=ro(C),e.note(`${C.total} ${v} events on ${le()} (${b()})`),(v==="click"||v==="rage"||v==="dead")&&await p(!1)}document.body.append(u)},h=k("span");return h.style.display="none",h.append(T("Load more",()=>{p(!1)}),T("Load all",()=>{p(!0)})),t.append(k("b","Heatmap"),P("Heatmap type",n),P("Colour by (clicks)",o),P("Property",r),P("Match links by URL",i),T("Show heatmap",()=>{c()}),T("Hide heatmap",f),h,s,a),{node:t,teardown:f}}Mt();var $t=255,lo=new Set(["input","textarea","select","option"]),co="[data-lc-mask],.lc-mask,[data-lc-no-capture],.lc-no-capture,[data-lc-block]",uo=new Set(["value","password","autocomplete"]),po=/(?:\d[ -]?){9,}/;function mo(e){if(!e||lo.has(e.tagName.toLowerCase())||e.isContentEditable)return!1;try{return!e.closest(co)}catch{return!1}}function fo(e,t){if(e.source==="attribute"){let o=(e.attribute??"").toLowerCase();if(!o||uo.has(o)||o.startsWith("on"))return;let r=t.getAttribute(o);return r===null?void 0:r.slice(0,$t)}let n=(t.textContent??"").replace(/\s+/g," ").trim();if(!(!n||po.test(n)))return n.slice(0,$t)}function Ke(e,t,n,o=location.href){let r={};for(let i of e){if(!i.events.includes(t)||i.url&&!Fe([i.url],o))continue;let s=null;try{s=i.scope==="target"?t==="click"&&n?n.closest(i.selector):null:document.querySelector(i.selector)}catch{continue}if(!mo(s))continue;let a=fo(i,s);a!==void 0&&(r[i.name]=a)}return r}de();ie();var go=new Set(["input","textarea","select","option"]);function Lt(e,t){if(!e)return"Inspect an element first";if(go.has(e.tagName.toLowerCase()))return"Form fields are never captured: pick a label or container";let n=t.name.trim();if(!n||n.startsWith("$"))return"Give the property a name (no leading $)";let o=[...t.click?["click"]:[],...t.pageview?["pageview"]:[]];if(!o.length)return"Pick click and/or pageview";let r=t.attribute.trim().toLowerCase();if(t.source==="attribute"&&(!r||r==="value"||r.startsWith("on")))return"That attribute cannot be captured";let i=t.scope==="target"&&!t.pageview?"target":"page";return{name:n,selector:F(e),source:t.source==="attribute"?"attribute":"text",...t.source==="attribute"?{attribute:r}:{},events:o,...i==="target"?{scope:i}:{}}}function Ot(e){let t=`${Se(e.host)}/v1/projects/${encodeURIComponent(e.session.project_id)}/snapshot-properties`,n=async(p={})=>{try{let c=await e.host.fetch(t,{...p,credentials:"omit",headers:{Authorization:`Bearer ${e.session.session_token}`,"Content-Type":"application/json"}});return c.ok?await c.json():null}catch{return null}},o=k("div",void 0,"border-top:1px solid #333;margin-top:4px;padding-top:4px"),r=Y("","property name"),i=Z([["text","Visible text"],["attribute","Attribute"]],"text"),s=Y("","data-plan"),a=Z([["page","First match on the page"],["target","Around the clicked element"]],"page"),u=Object.assign(k("input"),{type:"checkbox",checked:!0}),d=Object.assign(k("input"),{type:"checkbox",checked:!1}),y=k("div",void 0,"white-space:pre-wrap;color:#9cf"),w=k("ul",void 0,"margin:4px 0;padding-left:16px"),f=()=>({name:r.value,source:i.value,attribute:s.value,click:u.checked,pageview:d.checked,scope:a.value}),b=p=>{w.replaceChildren(...p.map(c=>k("li",`${c.name}: ${c.source==="attribute"?`[${c.attribute}] of `:""}${c.selector} (${c.events.join(", ")})`)))},l=()=>{let p=Lt(e.picked(),f());if(typeof p=="string")return void(y.textContent=p);let c=Ke([{...p,scope:"page"}],p.events[0]);y.textContent=`${p.selector}
4
+ ${p.name} = ${JSON.stringify(c[p.name]??null)}`};for(let p of[r,i,s,a,u,d])p.addEventListener("input",l);return o.append(k("b","Snapshot properties"),T("Use inspected element",l),P("Name",r),P("Read",i),P("Attribute",s),P("Element",a),P("On clicks",u),P("On pageviews",d),y,T("Save snapshot property",async()=>{let p=Lt(e.picked(),f());if(typeof p=="string")return e.note(p);let c=await n({method:"POST",body:JSON.stringify(p)});if(!c)return e.note("Saving failed (needs toolbar write access)");b(c.data),e.note(`Saved snapshot property ${p.name}; SDKs pick it up with the next config refresh`)}),w),n().then(p=>p&&b(p.data)),{node:o,teardown:()=>o.remove()}}ie();var vn="lc_toolbar_session",Le="lc_toolbar_edit",Je="lc_toolbar_check",qo="lc_toolbar_recording",ve="__lc_check";function hn(){try{let e=JSON.parse(sessionStorage.getItem(vn)??"null");return e&&(!e.expires_at||Date.parse(e.expires_at)>Date.now())?e:null}catch{return null}}function zo(){let e=new URL(location.href),t=new URLSearchParams(e.hash.slice(1)),n=e.searchParams.get(ae)??t.get(ae),o=e.searchParams.get(se)??t.get(se),r=e.searchParams.get(ve)??t.get(ve);return o&&sessionStorage.setItem(Le,o),r&&sessionStorage.setItem(Je,r),(n||o||r)&&(e.searchParams.delete(ae),e.searchParams.delete(se),e.searchParams.delete(ve),(t.has(ae)||t.has(se)||t.has(ve))&&(t.delete(ae),t.delete(se),t.delete(ve),e.hash=t.toString()),history.replaceState(history.state,"",e.toString())),n}var Ai=e=>{if(location.hash==="#lc-device-preview")return;let t=zo(),n,o=async r=>{let i=hn();return r&&(i=await ct(e,r),i&&sessionStorage.setItem(vn,JSON.stringify(i))),i?(n?.(),n=Jo(e,i),!0):!1};return e.toolbar={load:r=>o(r)},(t||hn())&&o(t),()=>n?.()};function Jo(e,t){let n=dt(e,t),o=_=>(t.permissions??[]).includes(_),r=e.config.toolbar?.dataAttributes??ke,i=document.createElement("div");i.setAttribute("data-lc-ignore",""),i.style.cssText="position:fixed;bottom:12px;right:12px;z-index:2147483647";let s=i.attachShadow({mode:"open"}),a=k("div",void 0,"background:#111;color:#eee;padding:8px;border-radius:8px;font:12px system-ui;max-width:340px;max-height:70vh;overflow:auto");s.append(a);let u=k("div",void 0,"white-space:pre-wrap"),d=_=>{u.textContent=_},y,w=!1,f,b,l=k("div",void 0,"position:fixed;pointer-events:none;border:2px solid #4af;z-index:2147483646;display:none");l.setAttribute("data-lc-ignore","");let p=_=>{let j=_.target;if(!w||!(j instanceof Element)||j===i)return;let D=j.getBoundingClientRect();Object.assign(l.style,{display:"block",left:`${D.left}px`,top:`${D.top}px`,width:`${D.width}px`,height:`${D.height}px`})},c=_=>{!w||!(_.target instanceof Element)||_.target===i||(_.preventDefault(),_.stopPropagation(),y=_.target,w=!1,l.style.display="none",d(`Selected ${F(y)}`))};document.addEventListener("mousemove",p,!0),document.addEventListener("click",c,!0),document.body.append(l);let h=[],v=(_,j)=>{let D=k("div"),B,ne=T(_,()=>{if(B)B.hidden=!B.hidden;else{let m=j();B=m.node,h.push(m.teardown),D.append(B)}ne.setAttribute("aria-expanded",String(!B.hidden))});return ne.setAttribute("aria-expanded","false"),D.prepend(ne),D},E=o("actions:write")?lt({api:n,attrs:r,picked:()=>y,note:d}):void 0;E&&(E.node.hidden=!0,h.push(E.teardown));let C=E?T("Actions",()=>{E.node.hidden=!E.node.hidden,C?.setAttribute("aria-expanded",String(!E.node.hidden))}):void 0,S=me(),L=_=>()=>y?_(y):d("Inspect an element first"),x=()=>d(JSON.stringify(S.toPayload(),null,1)),A=(_,j,D)=>T(_,L(B=>{let ne=window.prompt(j);ne!==null&&(D(B,ne),x())})),O=()=>e.client.isInternal?"Count my traffic":"Exclude my traffic ($internal)",H=T(O(),()=>{e.client.optOutInternal(!e.client.isInternal),H.textContent=O()}),g=T("Experiment editor",async()=>{if(b)return b.remove(),void(b=void 0);let _=sessionStorage.getItem(Le)??window.prompt("Experiment id");if(!_)return;sessionStorage.setItem(Le,_);let{experimentEditor:j}=await Promise.resolve().then(()=>(Gt(),jt));b=await j({api:n,scopes:t.permissions,experimentId:_,picked:()=>y,note:d}),a.prepend(b)}),G=T("Guide builder",async()=>{if(f)return f.remove(),void(f=void 0);let{guideBuilder:_}=await Promise.resolve().then(()=>(dn(),cn));f=_({api:n,scopes:t.permissions,picked:()=>y,note:d,attrs:r}),a.append(f)});a.append(k("b",`Lucida toolbar${t.user?.email?` - ${t.user.email}`:""}${o("actions:write")?"":" (view only)"}`),k("br"),H,T("Inspect element",()=>(w=!0,d("Click an element"))),...C&&E?[C,E.node]:[],v("Heatmap",()=>Rt({api:n,note:d,onPick:_=>{if(y=_,!E)return d("Creating actions needs toolbar write access");E.addStep(Pe(_,r)),E.node.hidden=!1,d(`Added ${F(_)} to the action`)}})),v("Feature flags",()=>kt(e,n)),v("Event debugger",()=>ft(e)),...o("actions:write")?[v("Snapshot properties",()=>Ot({host:e,session:t,picked:()=>y,note:d}))]:[],G,g,k("hr"),k("b","Visual editor"),k("br"),A("Text","New text",(_,j)=>S.text(_,j)),A("Style","CSS as property:value",(_,j)=>{let[D,...B]=j.split(":");D&&B.length&&S.style(_,D.trim(),B.join(":").trim())}),A("Attribute","name=value (empty value removes)",(_,j)=>{let[D,...B]=j.split("=");D&&S.attr(_,D.trim(),B.length&&B.join("=")!==""?B.join("="):null)}),T("Hide",L(_=>(S.hide(_),x()))),T("Move up",L(_=>(S.move(_,-1),x()))),T("Move down",L(_=>(S.move(_,1),x()))),T("Show changes JSON",x),u),document.body.append(i),sessionStorage.getItem(Le)?g.click():sessionStorage.getItem(qo)&&G.click();let V=sessionStorage.getItem(Je);return V&&(sessionStorage.removeItem(Je),Promise.resolve().then(()=>(gn(),fn)).then(({parseCheck:_,runCheck:j})=>{let D=_(V);D?j(D,d):d("The guide check request is malformed")})),()=>{document.removeEventListener("mousemove",p,!0),document.removeEventListener("click",c,!0);for(let _ of h)_();i.remove(),l.remove()}}export{se as EDIT_PARAM,Ie as EXPERIMENT_SCOPE,_e as GUIDE_SCOPE,ae as TOOLBAR_PARAM,ct as exchangeToken,De as getFlagOverrides,pt as setFlagOverride,Ai as toolbar,dt as toolbarApi,Se as toolbarHost};
@@ -1 +1 @@
1
- import{b as x,f as E,g as L,j as w}from"./chunk-FUE3SDQU.js";var k=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,A=/^\+?[\d\s().-]{7,20}$/,G=".v{position:fixed;z-index:2147483000;background:#fff;color:#b42318;border:1px solid #f04438;border-radius:6px;padding:6px 10px;font:13px system-ui;max-width:280px;box-shadow:0 2px 8px rgba(0,0,0,.15)}";function H(t,l){let n=t.trim();for(let e of l){if(e.type==="required"){if(!n)return e;continue}if(!n)continue;let u=typeof e.value=="number"?e.value:Number(e.value);if(e.type==="email"&&!k.test(n)||e.type==="url"&&!N(n)||e.type==="phone"&&!(A.test(n)&&n.replace(/\D/g,"").length>=7)||e.type==="regex"&&!T(n,e.value)||e.type==="min_length"&&Number.isFinite(u)&&n.length<u||e.type==="max_length"&&Number.isFinite(u)&&n.length>u||e.type==="number"&&!Number.isFinite(Number(n)))return e}return null}function N(t){try{return/^https?:$/.test(new URL(t).protocol)}catch{return!1}}function T(t,l){if(typeof l!="string"||l.length>500)return!0;try{return new RegExp(l).test(t)}catch{return!0}}var M=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:null;function $(t,l,n,e={}){let u=document.createElement("div");u.setAttribute("data-lc-ignore","");let p=u.attachShadow({mode:"open"});p.append(x(G,e.nonce)),document.body.append(u);let v=new WeakSet,m=new Map,f=[],b=!1,g=(r,i,d)=>{let s=M(i);if(s===null)return!0;let a=H(s,d);if(m.get(r)?.remove(),m.delete(r),i.removeAttribute("aria-invalid"),!a)return!0;let o=document.createElement("div");o.className="v",o.setAttribute("role","alert"),o.textContent=a.message;let c=E(t.appearance);return delete c.background,delete c.text,L(o,c),p.append(o),w(o,i,"bottom"),m.set(r,o),i.setAttribute("aria-invalid","true"),l.validationFailed?.(r,a.type),!1},y=()=>{for(let r of t.steps){let i=r.validation;if(!i?.selector||!i.rules?.length)continue;let d;try{d=[...document.querySelectorAll(i.selector)]}catch{continue}for(let s of d){if(v.has(s))continue;v.add(s);let a=()=>{g(r.id,s,i.rules)};s.addEventListener("blur",a),f.push(()=>s.removeEventListener("blur",a));let o=s.closest("form");if(!o)continue;let c=h=>{g(r.id,s,i.rules)||(h.preventDefault(),h.stopPropagation())};o.addEventListener("submit",c,!0),f.push(()=>o.removeEventListener("submit",c,!0))}}},R=setInterval(y,500);return y(),l.shown(),()=>{if(!b){b=!0,clearInterval(R);for(let r of f)r();u.remove(),n()}}}export{H as failedRule,$ as renderValidation};
1
+ import{b as x,f as E,g as L,j as w}from"./chunk-B722OERZ.js";var k=/^[^\s@]+@[^\s@]+\.[^\s@]{2,}$/,A=/^\+?[\d\s().-]{7,20}$/,G=".v{position:fixed;z-index:2147483000;background:#fff;color:#b42318;border:1px solid #f04438;border-radius:6px;padding:6px 10px;font:13px system-ui;max-width:280px;box-shadow:0 2px 8px rgba(0,0,0,.15)}";function H(t,l){let n=t.trim();for(let e of l){if(e.type==="required"){if(!n)return e;continue}if(!n)continue;let u=typeof e.value=="number"?e.value:Number(e.value);if(e.type==="email"&&!k.test(n)||e.type==="url"&&!N(n)||e.type==="phone"&&!(A.test(n)&&n.replace(/\D/g,"").length>=7)||e.type==="regex"&&!T(n,e.value)||e.type==="min_length"&&Number.isFinite(u)&&n.length<u||e.type==="max_length"&&Number.isFinite(u)&&n.length>u||e.type==="number"&&!Number.isFinite(Number(n)))return e}return null}function N(t){try{return/^https?:$/.test(new URL(t).protocol)}catch{return!1}}function T(t,l){if(typeof l!="string"||l.length>500)return!0;try{return new RegExp(l).test(t)}catch{return!0}}var M=t=>t instanceof HTMLInputElement||t instanceof HTMLTextAreaElement||t instanceof HTMLSelectElement?t.value:null;function $(t,l,n,e={}){let u=document.createElement("div");u.setAttribute("data-lc-ignore","");let p=u.attachShadow({mode:"open"});p.append(x(G,e.nonce)),document.body.append(u);let v=new WeakSet,m=new Map,f=[],b=!1,g=(r,i,d)=>{let s=M(i);if(s===null)return!0;let a=H(s,d);if(m.get(r)?.remove(),m.delete(r),i.removeAttribute("aria-invalid"),!a)return!0;let o=document.createElement("div");o.className="v",o.setAttribute("role","alert"),o.textContent=a.message;let c=E(t.appearance);return delete c.background,delete c.text,L(o,c),p.append(o),w(o,i,"bottom"),m.set(r,o),i.setAttribute("aria-invalid","true"),l.validationFailed?.(r,a.type),!1},y=()=>{for(let r of t.steps){let i=r.validation;if(!i?.selector||!i.rules?.length)continue;let d;try{d=[...document.querySelectorAll(i.selector)]}catch{continue}for(let s of d){if(v.has(s))continue;v.add(s);let a=()=>{g(r.id,s,i.rules)};s.addEventListener("blur",a),f.push(()=>s.removeEventListener("blur",a));let o=s.closest("form");if(!o)continue;let c=h=>{g(r.id,s,i.rules)||(h.preventDefault(),h.stopPropagation())};o.addEventListener("submit",c,!0),f.push(()=>o.removeEventListener("submit",c,!0))}}},R=setInterval(y,500);return y(),l.shown(),()=>{if(!b){b=!0,clearInterval(R);for(let r of f)r();u.remove(),n()}}}export{H as failedRule,$ as renderValidation};
@@ -1 +1 @@
1
- import{b as A}from"./chunk-536QABLP.js";import"./chunk-EFNCQJI3.js";var C={title:"Your privacy",body:"We use cookies and similar technologies to measure and improve this site. Choose what you allow.",acceptAll:"Accept all",rejectAll:"Reject all",save:"Save choices",categories:{analytics:"Analytics",replay:"Session replay",marketing:"Marketing"}},j=["analytics","replay","marketing"],O="button, input, [href], [tabindex]:not([tabindex='-1'])",w={bottom:{left:"0",right:"0",bottom:"0"},top:{left:"0",right:"0",top:"0"},center:{top:"50%",left:"50%",transform:"translate(-50%,-50%)","max-width":"28rem"},"bottom-left":{left:"1rem",bottom:"1rem","max-width":"24rem"},"bottom-right":{right:"1rem",bottom:"1rem","max-width":"24rem"}},l=(e,t={},...s)=>{let c=Object.assign(document.createElement(e),t);return c.append(...s),c},h;function P(){h?.close()}function S(e){if(!e)return{};let t=(e.categories??[]).filter(a=>!a.required&&j.includes(a.id)),s=Object.fromEntries(t.map(a=>[a.id,a.label])),c={title:e.title,body:e.body,acceptAll:e.accept_label,rejectAll:e.decline_label,save:e.customize_label,categories:s},d=e.position?.replace("_","-");return{texts:Object.fromEntries(Object.entries(c).filter(([,a])=>a!==void 0)),...t.length?{categories:t.map(a=>a.id)}:{},...d&&d in w?{position:d}:{}}}async function H(e){try{let t=await e.fetch(`${e.config.apiHost}/v1/config?api_key=${encodeURIComponent(e.apiKey)}`,{credentials:"omit"});return t.ok?S((await t.json()).consent_banner):{}}catch{return{}}}async function _(e,t={}){if(!t.remote)return B(e,t);let s=await H(e);return B(e,{...s,...t,texts:{...s.texts,...t.texts,categories:{...s.texts?.categories,...t.texts?.categories}}})}function B(e,t){P();let s={...C,...t.texts,categories:{...C.categories,...t.texts?.categories}},c=t.categories??j,d=e.core.getConsent(),a=t.position??"bottom",m=`lc-consent-${Math.random().toString(36).slice(2,8)}`,L=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,M=document.activeElement,v=c.map(o=>{let i=l("input",{type:"checkbox",id:`${m}-${o}`,checked:d[o]});return{c:o,input:i,row:l("label",{htmlFor:i.id},i,document.createTextNode(` ${s.categories[o]}`))}}),p=(o,i)=>{let u=l("button",{type:"button",textContent:o});return u.style.cssText=`padding:.5rem 1rem;margin:.25rem .5rem .25rem 0;border:1px solid #1f2937;border-radius:.375rem;cursor:pointer;font:inherit;background:${i?"#1f2937":"#fff"};color:${i?"#fff":"#1f2937"}`,u},g=p(s.acceptAll,!0),k=p(s.rejectAll,!0),T=p(s.save,!1),n=l("div",{role:"dialog",id:m},l("h2",{id:`${m}-t`,textContent:s.title}),l("p",{id:`${m}-d`,textContent:s.body}),...c.length>1?v.map(o=>o.row):[],l("div",{},g,k,...c.length>1?[T]:[]));n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",`${m}-t`),n.setAttribute("aria-describedby",`${m}-d`),n.setAttribute("data-lc-ignore",""),n.style.cssText="position:fixed;z-index:2147483000;box-sizing:border-box;padding:1rem 1.25rem;background:#fff;color:#111827;font:14px/1.4 system-ui,sans-serif;box-shadow:0 0 .75rem rgba(0,0,0,.3);display:block";for(let[o,i]of Object.entries(w[a]))n.style.setProperty(o,i);for(let o of n.querySelectorAll("h2"))o.style.cssText="margin:0 0 .5rem;font-size:1.1rem";for(let o of n.querySelectorAll("label"))o.style.cssText="display:block;margin:.25rem 0";return L||(n.style.opacity="0",n.style.transition="opacity .2s",requestAnimationFrame(()=>n.style.opacity="1")),new Promise(o=>{let i=r=>{document.removeEventListener("keydown",E,!0),n.remove(),h=void 0,M?.focus?.(),r&&A(e,r,"banner",t.version?{version:t.version}:{}),o(r?e.core.getConsent():null)},u=r=>Object.fromEntries(c.map(f=>[f,r])),E=r=>{if(r.key==="Escape")return void i(null);if(r.key!=="Tab")return;let f=[...n.querySelectorAll(O)],y=f[0],b=f[f.length-1],x=document.activeElement;if(!n.contains(x))(r.shiftKey?b:y).focus();else if(r.shiftKey&&x===y)b.focus();else if(!r.shiftKey&&x===b)y.focus();else return;r.preventDefault()};g.onclick=()=>i(u(!0)),k.onclick=()=>i(u(!1)),T.onclick=()=>i(Object.fromEntries(v.map(r=>[r.c,r.input.checked]))),document.addEventListener("keydown",E,!0),document.body.append(n),h={root:n,close:()=>i(null)},g.focus()})}export{S as fromRemote,P as hideBanner,_ as showBanner};
1
+ import{b as A}from"./chunk-IXDYCBAD.js";import"./chunk-EFNCQJI3.js";var C={title:"Your privacy",body:"We use cookies and similar technologies to measure and improve this site. Choose what you allow.",acceptAll:"Accept all",rejectAll:"Reject all",save:"Save choices",categories:{analytics:"Analytics",replay:"Session replay",marketing:"Marketing"}},j=["analytics","replay","marketing"],O="button, input, [href], [tabindex]:not([tabindex='-1'])",w={bottom:{left:"0",right:"0",bottom:"0"},top:{left:"0",right:"0",top:"0"},center:{top:"50%",left:"50%",transform:"translate(-50%,-50%)","max-width":"28rem"},"bottom-left":{left:"1rem",bottom:"1rem","max-width":"24rem"},"bottom-right":{right:"1rem",bottom:"1rem","max-width":"24rem"}},l=(e,t={},...s)=>{let c=Object.assign(document.createElement(e),t);return c.append(...s),c},h;function P(){h?.close()}function S(e){if(!e)return{};let t=(e.categories??[]).filter(a=>!a.required&&j.includes(a.id)),s=Object.fromEntries(t.map(a=>[a.id,a.label])),c={title:e.title,body:e.body,acceptAll:e.accept_label,rejectAll:e.decline_label,save:e.customize_label,categories:s},d=e.position?.replace("_","-");return{texts:Object.fromEntries(Object.entries(c).filter(([,a])=>a!==void 0)),...t.length?{categories:t.map(a=>a.id)}:{},...d&&d in w?{position:d}:{}}}async function H(e){try{let t=await e.fetch(`${e.config.apiHost}/v1/config?api_key=${encodeURIComponent(e.apiKey)}`,{credentials:"omit"});return t.ok?S((await t.json()).consent_banner):{}}catch{return{}}}async function _(e,t={}){if(!t.remote)return B(e,t);let s=await H(e);return B(e,{...s,...t,texts:{...s.texts,...t.texts,categories:{...s.texts?.categories,...t.texts?.categories}}})}function B(e,t){P();let s={...C,...t.texts,categories:{...C.categories,...t.texts?.categories}},c=t.categories??j,d=e.core.getConsent(),a=t.position??"bottom",m=`lc-consent-${Math.random().toString(36).slice(2,8)}`,L=typeof matchMedia=="function"&&matchMedia("(prefers-reduced-motion: reduce)").matches,M=document.activeElement,v=c.map(o=>{let i=l("input",{type:"checkbox",id:`${m}-${o}`,checked:d[o]});return{c:o,input:i,row:l("label",{htmlFor:i.id},i,document.createTextNode(` ${s.categories[o]}`))}}),p=(o,i)=>{let u=l("button",{type:"button",textContent:o});return u.style.cssText=`padding:.5rem 1rem;margin:.25rem .5rem .25rem 0;border:1px solid #1f2937;border-radius:.375rem;cursor:pointer;font:inherit;background:${i?"#1f2937":"#fff"};color:${i?"#fff":"#1f2937"}`,u},g=p(s.acceptAll,!0),k=p(s.rejectAll,!0),T=p(s.save,!1),n=l("div",{role:"dialog",id:m},l("h2",{id:`${m}-t`,textContent:s.title}),l("p",{id:`${m}-d`,textContent:s.body}),...c.length>1?v.map(o=>o.row):[],l("div",{},g,k,...c.length>1?[T]:[]));n.setAttribute("aria-modal","true"),n.setAttribute("aria-labelledby",`${m}-t`),n.setAttribute("aria-describedby",`${m}-d`),n.setAttribute("data-lc-ignore",""),n.style.cssText="position:fixed;z-index:2147483000;box-sizing:border-box;padding:1rem 1.25rem;background:#fff;color:#111827;font:14px/1.4 system-ui,sans-serif;box-shadow:0 0 .75rem rgba(0,0,0,.3);display:block";for(let[o,i]of Object.entries(w[a]))n.style.setProperty(o,i);for(let o of n.querySelectorAll("h2"))o.style.cssText="margin:0 0 .5rem;font-size:1.1rem";for(let o of n.querySelectorAll("label"))o.style.cssText="display:block;margin:.25rem 0";return L||(n.style.opacity="0",n.style.transition="opacity .2s",requestAnimationFrame(()=>n.style.opacity="1")),new Promise(o=>{let i=r=>{document.removeEventListener("keydown",E,!0),n.remove(),h=void 0,M?.focus?.(),r&&A(e,r,"banner",t.version?{version:t.version}:{}),o(r?e.core.getConsent():null)},u=r=>Object.fromEntries(c.map(f=>[f,r])),E=r=>{if(r.key==="Escape")return void i(null);if(r.key!=="Tab")return;let f=[...n.querySelectorAll(O)],y=f[0],b=f[f.length-1],x=document.activeElement;if(!n.contains(x))(r.shiftKey?b:y).focus();else if(r.shiftKey&&x===y)b.focus();else if(!r.shiftKey&&x===b)y.focus();else return;r.preventDefault()};g.onclick=()=>i(u(!0)),k.onclick=()=>i(u(!1)),T.onclick=()=>i(Object.fromEntries(v.map(r=>[r.c,r.input.checked]))),document.addEventListener("keydown",E,!0),document.body.append(n),h={root:n,close:()=>i(null)},g.focus()})}export{S as fromRemote,P as hideBanner,_ as showBanner};
@@ -1 +1 @@
1
- function oe(e,t){if(!e.url)return!0;if(e.url_match==="exact")return t===e.url;if(e.url_match==="regex")try{return new RegExp(e.url).test(t)}catch{return!1}return t.includes(e.url)}function S(e,t){let n=t?.[e.key];if(e.op==="exists")return n!=null;if(n==null)return e.op==="neq";let[o,s]=[String(n),String(e.value??"")];return e.op==="eq"?o===s:e.op==="neq"?o!==s:o.includes(s)}var ie=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function re(e,t){try{let n=new Intl.DateTimeFormat("en-US",{timeZone:t,weekday:"short",hour:"numeric",hourCycle:"h23"}).formatToParts(e),o=s=>n.find(u=>u.type===s)?.value??"";return{day:ie.indexOf(o("weekday")),h:Number(o("hour"))%24}}catch{return{day:new Date(e).getDay(),h:new Date(e).getHours()}}}function se(e,t){if(e.start&&t<Date.parse(e.start)||e.end&&t>=Date.parse(e.end))return!1;let{day:n,h:o}=e.timezone?re(t,e.timezone):{day:new Date(t).getDay(),h:new Date(t).getHours()};return e.days?.length&&!e.days.includes(n)?!1:!e.hours||o>=(e.hours.from??0)&&o<(e.hours.to??24)}function ae(e,t,n){let o=e.per_days?n-e.per_days*864e5:0;return t.filter(s=>s>=o).length<(e.max_views??1)}function le(e,t){let n=e.split("*").map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp("^"+n+"$").test(t)}function ce(e,t){if(!e||!t?.length)return!1;let n=e;try{n=new URL(e).pathname||e}catch{}return t.some(o=>typeof o=="string"&&o!==""&&le(o,o.startsWith("/")?n:e))}function Se(e,t){let n=e.conditions;return!(ce(t.url,n.exclude_url_patterns)||!oe(n,t.url)||n.flag_key&&!t.flags(n.flag_key)||n.flag_key&&n.flag_variant&&String(t.flagValue?.(n.flag_key))!==n.flag_variant||n.wait_days&&t.lastShownMs!==void 0&&t.nowMs-t.lastShownMs<n.wait_days*864e5||n.devices?.length&&t.device&&!n.devices.includes(t.device)||n.person_filters?.some(o=>!S(o,t.person))||n.group_filters?.some(o=>!S(o,t.groups?.[o.group_type??""]))||n.seen_guides?.some(o=>!t.seen?.(o))||n.not_seen_guides?.some(o=>t.seen?.(o))||n.schedule&&!se(n.schedule,t.nowMs)||n.frequency&&!ae(n.frequency,t.views??[],t.nowMs)||n.sample_pct!==void 0&&n.sample_pct>0&&n.sample_pct<100&&t.random()*100>=n.sample_pct)}function j(e,t){let n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.textContent=e,n}var ue=e=>{if(typeof e!="string"||!e)return!1;try{return!!document.querySelector(e)}catch{return!1}};function F(e,t){let n=()=>typeof e.value=="string"&&t.present?t.present(e.value):ue(e.value);if(e.op==="element_present")return n();if(e.op==="element_absent")return!n();if(e.op==="flag_on"||e.op==="flag_off"){let o=typeof e.value=="string"&&!!t.flag?.(e.value);return e.op==="flag_on"?o:!o}return S({key:e.key,op:e.op,value:e.value},t.person)}function de(e){return e.matches("input[type=password],[data-lc-mask],.lc-mask,[autocomplete^=cc-]")?!0:!!e.closest("[data-lc-mask],.lc-mask")}var pe="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";function U(e,t=document){if(!e.selector||e.selector.length>500)return"invalid";let n;try{n=t.querySelector(e.selector)}catch{return"invalid"}if(!n)return"missing";if(de(n))return"refused";if(e.action==="click")n.click();else if(e.action==="focus")n.focus();else if(e.action==="fill"){if(typeof e.value!="string"||e.value.length>200||!n.matches(pe))return"refused";let o=n instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(o,"value")?.set;s?s.call(n,e.value):n.value=e.value,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}else return"invalid";return"done"}var fe=()=>{try{return matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}};function K(e=["#e5484d","#30a46c","#0090ff","#f5d90a","#8e4ec6"]){if(typeof document>"u"||fe())return;let t=document.createElement("canvas");t.setAttribute("data-lc-ignore",""),t.setAttribute("aria-hidden","true"),t.width=innerWidth,t.height=innerHeight,t.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483001";let n=t.getContext("2d");if(!n)return;document.body.append(t);let o=Array.from({length:120},(a,r)=>({x:innerWidth/2,y:innerHeight/3,vx:(Math.random()-.5)*12,vy:Math.random()*-10-2,color:e[r%e.length]})),s=Date.now()+1500,u=()=>{n.clearRect(0,0,t.width,t.height);for(let a of o)a.x+=a.vx,a.y+=a.vy,a.vy+=.35,n.fillStyle=a.color,n.fillRect(a.x,a.y,6,4);Date.now()<s?requestAnimationFrame(u):t.remove()};requestAnimationFrame(u)}var me=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,be=/^[\w\s,'"-]{1,100}$/,W={none:"none",sm:"0 1px 4px rgba(0,0,0,.15)",lg:"0 8px 32px rgba(0,0,0,.3)"};function ve(e,t=ye()){if(!e?.dark?.tokens)return!1;let n=e.theme_mode??"auto";return n==="dark"||n==="auto"&&t}function ye(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function V(e,t){let n={...e?.font_family?{font:e.font_family}:{},...e?.tokens};return ve(e,t)?{...n,...e?.dark?.tokens}:n}function X(e,t){let n=o=>typeof o=="string"&&me.test(o);n(t?.background)&&(e.style.background=t.background),n(t?.text)&&(e.style.color=t.text),n(t?.accent)&&(e.style.setProperty("--a",t.accent),e.style.setProperty("--at","#fff")),typeof t?.radius=="number"&&t.radius>=0&&t.radius<=32&&(e.style.borderRadius=`${t.radius}px`),typeof t?.font=="string"&&be.test(t.font)&&(e.style.fontFamily=t.font),t?.shadow&&t.shadow in W&&(e.style.boxShadow=W[t.shadow]),typeof t?.button_radius=="number"&&t.button_radius>=0&&t.button_radius<=32&&e.style.setProperty("--br",`${t.button_radius}px`),n(t?.secondary)&&e.style.setProperty("--s",t.secondary),n(t?.secondary_text)&&e.style.setProperty("--st",t.secondary_text)}var Y=".cd{display:flex;gap:6px;justify-content:center;margin:8px 0}.cd button{width:10px;height:10px;min-width:0;padding:0;margin:0;border-radius:50%;background:#ccc;border:0}.cd button[aria-current=true]{background:var(--a,#111)}.cn{display:flex;justify-content:space-between}",A=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&o.setAttribute("aria-label",n),o.onclick=t,o};function J(e){let t=document.createElement("div"),n=document.createElement("div");n.className="cd",n.setAttribute("role","tablist");for(let u=0;u<e.count;u++){let a=A("",()=>e.to(u),`Slide ${u+1} of ${e.count}`);a.setAttribute("role","tab"),a.setAttribute("aria-current",String(u===e.index)),n.append(a)}let o=document.createElement("div");o.className="cn";let s=e.index===e.count-1;return o.append(e.index>0?A("Back",()=>e.to(e.index-1)):A("Skip",e.dismiss),A(s?"Done":"Next",()=>s?e.complete():e.to(e.index+1))),t.append(n,o),t}function Q(e,t){let n,o=a=>{n=a.clientX},s=a=>{if(n===void 0)return;let r=a.clientX-n;n=void 0;let y=t();r<-40&&y.index<y.count-1?y.to(y.index+1):r>40&&y.index>0&&y.to(y.index-1)},u=a=>{let r=t();a.key==="ArrowRight"&&r.index<r.count-1?r.to(r.index+1):a.key==="ArrowLeft"&&r.index>0&&r.to(r.index-1)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",s),e.addEventListener("keydown",u),()=>{e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",s),e.removeEventListener("keydown",u)}}function ge(e,t,n=!0,o=!1){if(e==="banner")return[{label:"Dismiss",action:"dismiss"}];let s=n?[]:[{label:"Back",action:"back"}];return o||s.push({label:t?"Done":"Next",action:"next"}),[...s,{label:"Dismiss",action:"dismiss"}]}function he(e){for(let t of[e.selector,...e.fallback_selectors??[]])if(t)try{let n=document.querySelector(t);if(n)return n}catch{}return null}var ke=".g{position:fixed;z-index:2147483000;background:#fff;color:#111;border:1px solid #ccc;border-radius:8px;padding:14px;font:14px system-ui;max-width:320px;box-shadow:0 4px 16px rgba(0,0,0,.2)}.m{top:50%;left:50%;transform:translate(-50%,-50%)}.bn{top:0;left:0;right:0;max-width:none;border-radius:0}.bb{top:auto;bottom:0}.p{right:16px;bottom:16px}.o{position:fixed;inset:0;z-index:2146999999;background:rgba(0,0,0,.4)}button{margin:2px;padding:4px 10px;cursor:pointer;background:var(--a,buttonface);color:var(--at,buttontext);border:1px solid #bbb;border-radius:var(--br,4px)}button+button{background:var(--s,buttonface);color:var(--st,buttontext)}h2{margin:0 0 6px;font-size:16px}p{margin:0 0 8px}li{margin:4px 0}.so{top:0;bottom:0;right:0;max-width:360px;border-radius:0;overflow:auto;animation:s .2s}.so.sl{right:auto;left:0}@keyframes s{from{transform:translateX(30px);opacity:0}}@media (prefers-reduced-motion:reduce){.so{animation:none}}.in{position:static;box-shadow:none;max-width:none;margin:8px 0}img,video,iframe{display:block;width:100%;max-width:100%;border:0;margin:0 0 8px;border-radius:4px}iframe{aspect-ratio:16/9}",xe=ke+Y,we=["www.youtube-nocookie.com","www.youtube.com","player.vimeo.com","www.loom.com","fast.wistia.net"],_e="button,[href],input,textarea,select,[tabindex]:not([tabindex='-1'])";function v(e,t,n){let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.className=n),o}function Ee(e){let t;try{t=new URL(e.url)}catch{return null}if(t.protocol!=="https:")return null;if(e.type==="image")return Object.assign(v("img"),{src:t.href,alt:e.alt??"",loading:"lazy"});if(e.type==="video")return Object.assign(v("video"),{src:t.href,controls:!0,preload:"metadata"});if(e.type!=="embed"||!we.includes(t.host))return null;let n=Object.assign(v("iframe"),{src:t.href,title:e.alt??"Video",allowFullscreen:!0,referrerPolicy:"no-referrer"});return n.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation"),n}function Me(e,t,n){e.addEventListener("keydown",o=>{if(o.key==="Escape")return n();if(o.key!=="Tab")return;let s=[...e.querySelectorAll(_e)];if(!s.length)return;let u=s[0],a=s[s.length-1],r=t.activeElement;o.shiftKey&&r===u?(o.preventDefault(),a.focus()):!o.shiftKey&&r===a&&(o.preventDefault(),u.focus())})}function Te(e,t,n="bottom"){let o=t.getBoundingClientRect(),s=e.offsetWidth||280,u=e.offsetHeight||120,a=o.left,r=o.bottom+8;n==="top"?r=o.top-u-8:n==="left"?(a=o.left-s-8,r=o.top):n==="right"&&(a=o.right+8,r=o.top);let y=(x,w)=>Math.max(8,Math.min(x,w-8));e.style.left=`${y(a,window.innerWidth-s)}px`,e.style.top=`${y(r,window.innerHeight-u)}px`}function Ne(e,t,n,o={}){let s=document.createElement("div");s.setAttribute("data-lc-ignore","");let u=s.attachShadow({mode:"open"});u.append(j(xe,o.nonce));let a=document.activeElement,r=Math.min(Math.max(o.start??0,0),e.steps.length-1),y=!1,x,w=[],h=[],H=()=>{for(let i of h)i();h=[]},D=()=>{},d=v("div",void 0,"g"),_=()=>{y||(y=!0,H(),D(),s.remove(),a?.focus?.(),n())},L=i=>{t.dismissed(r,e.steps[r]?.id??"",i),_()},k=()=>L(),M=()=>{t.completed(),_(),e.steps.at(-1)?.confetti&&K()},R=i=>(o.resolveTarget??he)(i),$=i=>{let l=i?.goto?void 0:e.steps[r]?.branch?.find(m=>F(m,{...o.person?{person:o.person}:{},...o.flag?{flag:o.flag}:{},...o.present?{present:o.present}:{}})),p=i?.goto??l?.goto,c=p==="end"?e.steps.length:p?e.steps.findIndex(m=>m.id===p):-1;w.push(r),r=c>r?c:r+1,C()},C=()=>{let i=e.steps[r];if(!i)return M();if(t.progress?.(i.id),i.url&&!location.href.includes(i.url))return _();I()},O=i=>{i<0||i>=e.steps.length||i===r||(r=i,C())},Z=()=>{let i=w.pop();i!==void 0&&(r=i,C())},P=i=>{if(i.action==="next"||i.action==="start_tour")$(i);else if(i.action==="back")Z();else if(i.action==="dismiss")k();else if(i.action==="snooze"){let l=Math.min(Math.max(Math.round(i.snooze_hours??24),1),720);t.snoozed?.(e.steps[r]?.id??"",l),L("snooze")}else i.action==="link"&&i.url&&/^https?:\/\//i.test(i.url)?window.open(i.url,"_blank","noopener,noreferrer"):i.action==="event"&&i.event&&t.event(i.event)},ee=(i,l)=>{let p=v("div"),c=i.buttons?.length?i.buttons:ge(e.kind,l,w.length===0,i.advance==="click"||i.advance==="input");for(let m of c){let g=v("button",m.label);g.type="button",g.onclick=()=>P(m),p.append(g)}return p},te=i=>[...i.title?[v("h2",i.title)]:[],...i.body?[v("p",i.body)]:[],...(i.media??[]).flatMap(l=>Ee(l)??[])],T=new Set(o.checked),N=new Map;function G(i,l,p){let c=N.get(l.id);c&&!c.hasAttribute("data-done")&&(c.setAttribute("data-done",""),c.setAttribute("aria-pressed","true"),c.textContent=`\u2713 ${l.title??l.id}`),!(!p||T.has(l.id)&&c?.hasAttribute("data-reported"))&&(c?.setAttribute("data-reported",""),T.add(l.id),t.step(i,l.id),T.size>=e.steps.length&&M())}let ne=()=>{let i=v("ul");for(let[p,c]of e.steps.entries()){let m=v("li"),g=v("button",`${c.title??c.id}`);if(g.type="button",g.setAttribute("aria-pressed","false"),N.set(c.id,g),T.has(c.id)&&(G(p,c,!1),g.setAttribute("data-reported","")),g.onclick=()=>{if(e.kind==="checklist")G(p,c,!0);else if(e.kind==="resource_center"){t.step(p,c.id);let f=c.buttons?.find(b=>b.action==="link");f&&P(f)}},c.module){let f={library:o.library??[],launch:b=>(_(),o.launch?.(b)),opened:()=>t.step(p,c.id),...o.assist?{assist:o.assist}:{}};import("./modules-FANMZRDJ.js").then(b=>m.append(b.renderModule(c,f))),i.append(m);continue}m.append(g),c.body&&m.append(v("p",c.body)),i.append(m)}d.append(v("h2",e.name),i);let l=v("button",e.kind==="resource_center"?"Close":"Dismiss");l.type="button",l.onclick=k,d.append(l)};function I(){H(),d.replaceChildren(),d.style.visibility="";let i=e.steps[r];if(!i)return;let l=e.kind==="carousel";if(e.kind==="checklist"||e.kind==="resource_center")ne();else{let f={index:r,count:e.steps.length,to:O,complete:M,dismiss:k};d.append(...te(i),l?J(f):ee(i,r===e.steps.length-1)),t.step(r,i.id)}d.setAttribute("role",e.kind==="banner"||e.kind==="inline"?"region":"dialog"),d.setAttribute("aria-label",i?.title??e.name),l&&d.setAttribute("aria-roledescription","carousel");let p={modal:"m",carousel:"m",banner:`bn${i.placement==="bottom"?" bb":""}`,slideout:`so${e.appearance?.side==="left"?" sl":""}`,inline:"in"};if(d.className=`g ${p[e.kind]??"p"}`,X(d,V(e.appearance)),(e.kind==="modal"||l)&&d.setAttribute("aria-modal","true"),l&&h.push(Q(d,()=>({index:r,count:e.steps.length,to:O,complete:M,dismiss:k}))),i.auto_close_s&&i.auto_close_s>0){let f=setTimeout(()=>L("auto_close"),Math.min(i.auto_close_s,600)*1e3);h.push(()=>clearTimeout(f))}if(i.automation&&o.automate!==!1){let f=i.automation,b=setTimeout(()=>t.automated?.(i.id,U(f)));h.push(()=>clearTimeout(b))}let c=(e.kind==="tooltip"||e.kind==="tour")&&!!(i.selector||i.fallback_selectors?.length),m=f=>{d.style.visibility="",d.classList.remove("p"),Te(d,f,i.placement);let b=i.advance==="click"?"click":i.advance==="input"?"change":null;if(!b)return;let E=()=>$();f.addEventListener(b,E,{once:!0}),h.push(()=>f.removeEventListener(b,E))},g=c?R(i):null;if(g)m(g);else if(c){d.style.visibility="hidden";let f=Date.now()+Math.min(Math.max(i.wait_ms??3e3,0),15e3),b=setInterval(()=>{let E=R(i);E?(clearInterval(b),m(E)):Date.now()>=f&&(clearInterval(b),d.style.visibility="",t.targetMissing?.(i.id,i.selector??i.fallback_selectors?.[0]??""))},150);h.push(()=>clearInterval(b))}e.kind!=="inline"&&d.querySelector("button")?.focus()}Me(d,u,k);let B=e.kind==="modal"||e.kind==="carousel",q=e.appearance?.dismiss_on_outside_click??B;if(e.appearance?.overlay??B)x=v("div",void 0,"o"),q&&(x.onclick=k),u.append(x);else if(q&&e.kind!=="inline"){let i=p=>{p.composedPath().includes(s)||k()},l=setTimeout(()=>document.addEventListener("click",i,!0));D=()=>(clearTimeout(l),document.removeEventListener("click",i,!0))}u.append(d);let z=e.kind==="inline"&&e.steps[0]?.selector?document.querySelector(e.steps[0].selector):null;return z?z.after(s):document.body.append(s),t.shown(),I(),Object.assign(_,{markDone(i){let l=e.steps.findIndex(p=>p.id===i);e.kind==="checklist"&&l>=0&&!y&&G(l,e.steps[l],!0)}})}export{Se as a,j as b,F as c,de as d,U as e,V as f,X as g,ge as h,he as i,Te as j,Ne as k};
1
+ function oe(e,t){if(!e.url)return!0;if(e.url_match==="exact")return t===e.url;if(e.url_match==="regex")try{return new RegExp(e.url).test(t)}catch{return!1}return t.includes(e.url)}function S(e,t){let n=t?.[e.key];if(e.op==="exists")return n!=null;if(n==null)return e.op==="neq";let[o,s]=[String(n),String(e.value??"")];return e.op==="eq"?o===s:e.op==="neq"?o!==s:o.includes(s)}var ie=["Sun","Mon","Tue","Wed","Thu","Fri","Sat"];function re(e,t){try{let n=new Intl.DateTimeFormat("en-US",{timeZone:t,weekday:"short",hour:"numeric",hourCycle:"h23"}).formatToParts(e),o=s=>n.find(u=>u.type===s)?.value??"";return{day:ie.indexOf(o("weekday")),h:Number(o("hour"))%24}}catch{return{day:new Date(e).getDay(),h:new Date(e).getHours()}}}function se(e,t){if(e.start&&t<Date.parse(e.start)||e.end&&t>=Date.parse(e.end))return!1;let{day:n,h:o}=e.timezone?re(t,e.timezone):{day:new Date(t).getDay(),h:new Date(t).getHours()};return e.days?.length&&!e.days.includes(n)?!1:!e.hours||o>=(e.hours.from??0)&&o<(e.hours.to??24)}function ae(e,t,n){let o=e.per_days?n-e.per_days*864e5:0;return t.filter(s=>s>=o).length<(e.max_views??1)}function le(e,t){let n=e.split("*").map(o=>o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")).join(".*");return new RegExp("^"+n+"$").test(t)}function ce(e,t){if(!e||!t?.length)return!1;let n=e;try{n=new URL(e).pathname||e}catch{}return t.some(o=>typeof o=="string"&&o!==""&&le(o,o.startsWith("/")?n:e))}function Se(e,t){let n=e.conditions;return!(ce(t.url,n.exclude_url_patterns)||!oe(n,t.url)||n.flag_key&&!t.flags(n.flag_key)||n.flag_key&&n.flag_variant&&String(t.flagValue?.(n.flag_key))!==n.flag_variant||n.wait_days&&t.lastShownMs!==void 0&&t.nowMs-t.lastShownMs<n.wait_days*864e5||n.devices?.length&&t.device&&!n.devices.includes(t.device)||n.person_filters?.some(o=>!S(o,t.person))||n.group_filters?.some(o=>!S(o,t.groups?.[o.group_type??""]))||n.seen_guides?.some(o=>!t.seen?.(o))||n.not_seen_guides?.some(o=>t.seen?.(o))||n.schedule&&!se(n.schedule,t.nowMs)||n.frequency&&!ae(n.frequency,t.views??[],t.nowMs)||n.sample_pct!==void 0&&n.sample_pct>0&&n.sample_pct<100&&t.random()*100>=n.sample_pct)}function j(e,t){let n=document.createElement("style");return t&&n.setAttribute("nonce",t),n.textContent=e,n}var ue=e=>{if(typeof e!="string"||!e)return!1;try{return!!document.querySelector(e)}catch{return!1}};function F(e,t){let n=()=>typeof e.value=="string"&&t.present?t.present(e.value):ue(e.value);if(e.op==="element_present")return n();if(e.op==="element_absent")return!n();if(e.op==="flag_on"||e.op==="flag_off"){let o=typeof e.value=="string"&&!!t.flag?.(e.value);return e.op==="flag_on"?o:!o}return S({key:e.key,op:e.op,value:e.value},t.person)}function de(e){return e.matches("input[type=password],[data-lc-mask],.lc-mask,[autocomplete^=cc-]")?!0:!!e.closest("[data-lc-mask],.lc-mask")}var pe="input:not([type=checkbox]):not([type=radio]):not([type=file]):not([type=hidden]),textarea";function U(e,t=document){if(!e.selector||e.selector.length>500)return"invalid";let n;try{n=t.querySelector(e.selector)}catch{return"invalid"}if(!n)return"missing";if(de(n))return"refused";if(e.action==="click")n.click();else if(e.action==="focus")n.focus();else if(e.action==="fill"){if(typeof e.value!="string"||e.value.length>200||!n.matches(pe))return"refused";let o=n instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,s=Object.getOwnPropertyDescriptor(o,"value")?.set;s?s.call(n,e.value):n.value=e.value,n.dispatchEvent(new Event("input",{bubbles:!0})),n.dispatchEvent(new Event("change",{bubbles:!0}))}else return"invalid";return"done"}var fe=()=>{try{return matchMedia("(prefers-reduced-motion: reduce)").matches}catch{return!1}};function K(e=["#e5484d","#30a46c","#0090ff","#f5d90a","#8e4ec6"]){if(typeof document>"u"||fe())return;let t=document.createElement("canvas");t.setAttribute("data-lc-ignore",""),t.setAttribute("aria-hidden","true"),t.width=innerWidth,t.height=innerHeight,t.style.cssText="position:fixed;inset:0;pointer-events:none;z-index:2147483001";let n=t.getContext("2d");if(!n)return;document.body.append(t);let o=Array.from({length:120},(a,r)=>({x:innerWidth/2,y:innerHeight/3,vx:(Math.random()-.5)*12,vy:Math.random()*-10-2,color:e[r%e.length]})),s=Date.now()+1500,u=()=>{n.clearRect(0,0,t.width,t.height);for(let a of o)a.x+=a.vx,a.y+=a.vy,a.vy+=.35,n.fillStyle=a.color,n.fillRect(a.x,a.y,6,4);Date.now()<s?requestAnimationFrame(u):t.remove()};requestAnimationFrame(u)}var me=/^#([0-9a-f]{3}|[0-9a-f]{6})$/i,be=/^[\w\s,'"-]{1,100}$/,W={none:"none",sm:"0 1px 4px rgba(0,0,0,.15)",lg:"0 8px 32px rgba(0,0,0,.3)"};function ye(e,t=ve()){if(!e?.dark?.tokens)return!1;let n=e.theme_mode??"auto";return n==="dark"||n==="auto"&&t}function ve(){try{return typeof matchMedia=="function"&&matchMedia("(prefers-color-scheme: dark)").matches}catch{return!1}}function V(e,t){let n={...e?.font_family?{font:e.font_family}:{},...e?.tokens};return ye(e,t)?{...n,...e?.dark?.tokens}:n}function X(e,t){let n=o=>typeof o=="string"&&me.test(o);n(t?.background)&&(e.style.background=t.background),n(t?.text)&&(e.style.color=t.text),n(t?.accent)&&(e.style.setProperty("--a",t.accent),e.style.setProperty("--at","#fff")),typeof t?.radius=="number"&&t.radius>=0&&t.radius<=32&&(e.style.borderRadius=`${t.radius}px`),typeof t?.font=="string"&&be.test(t.font)&&(e.style.fontFamily=t.font),t?.shadow&&t.shadow in W&&(e.style.boxShadow=W[t.shadow]),typeof t?.button_radius=="number"&&t.button_radius>=0&&t.button_radius<=32&&e.style.setProperty("--br",`${t.button_radius}px`),n(t?.secondary)&&e.style.setProperty("--s",t.secondary),n(t?.secondary_text)&&e.style.setProperty("--st",t.secondary_text)}var Y=".cd{display:flex;gap:6px;justify-content:center;margin:8px 0}.cd button{width:10px;height:10px;min-width:0;padding:0;margin:0;border-radius:50%;background:#ccc;border:0}.cd button[aria-current=true]{background:var(--a,#111)}.cn{display:flex;justify-content:space-between}",A=(e,t,n)=>{let o=document.createElement("button");return o.type="button",o.textContent=e,n&&o.setAttribute("aria-label",n),o.onclick=t,o};function J(e){let t=document.createElement("div"),n=document.createElement("div");n.className="cd",n.setAttribute("role","tablist");for(let u=0;u<e.count;u++){let a=A("",()=>e.to(u),`Slide ${u+1} of ${e.count}`);a.setAttribute("role","tab"),a.setAttribute("aria-current",String(u===e.index)),n.append(a)}let o=document.createElement("div");o.className="cn";let s=e.index===e.count-1;return o.append(e.index>0?A("Back",()=>e.to(e.index-1)):A("Skip",e.dismiss),A(s?"Done":"Next",()=>s?e.complete():e.to(e.index+1))),t.append(n,o),t}function Q(e,t){let n,o=a=>{n=a.clientX},s=a=>{if(n===void 0)return;let r=a.clientX-n;n=void 0;let v=t();r<-40&&v.index<v.count-1?v.to(v.index+1):r>40&&v.index>0&&v.to(v.index-1)},u=a=>{let r=t();a.key==="ArrowRight"&&r.index<r.count-1?r.to(r.index+1):a.key==="ArrowLeft"&&r.index>0&&r.to(r.index-1)};return e.addEventListener("pointerdown",o),e.addEventListener("pointerup",s),e.addEventListener("keydown",u),()=>{e.removeEventListener("pointerdown",o),e.removeEventListener("pointerup",s),e.removeEventListener("keydown",u)}}function ge(e,t,n=!0,o=!1){if(e==="banner")return[{label:"Dismiss",action:"dismiss"}];let s=n?[]:[{label:"Back",action:"back"}];return o||s.push({label:t?"Done":"Next",action:"next"}),[...s,{label:"Dismiss",action:"dismiss"}]}function he(e){for(let t of[e.selector,...e.fallback_selectors??[]])if(t)try{let n=document.querySelector(t);if(n)return n}catch{}return null}var ke=".g{position:fixed;z-index:2147483000;background:#fff;color:#111;border:1px solid #ccc;border-radius:8px;padding:14px;font:14px system-ui;max-width:320px;box-shadow:0 4px 16px rgba(0,0,0,.2)}.m{top:50%;left:50%;transform:translate(-50%,-50%)}.bn{top:0;left:0;right:0;max-width:none;border-radius:0}.bb{top:auto;bottom:0}.p{right:16px;bottom:16px}.o{position:fixed;inset:0;z-index:2146999999;background:rgba(0,0,0,.4)}button{margin:2px;padding:4px 10px;cursor:pointer;background:var(--a,buttonface);color:var(--at,buttontext);border:1px solid #bbb;border-radius:var(--br,4px)}button+button{background:var(--s,buttonface);color:var(--st,buttontext)}h2{margin:0 0 6px;font-size:16px}p{margin:0 0 8px}li{margin:4px 0}.so{top:0;bottom:0;right:0;max-width:360px;border-radius:0;overflow:auto;animation:s .2s}.so.sl{right:auto;left:0}@keyframes s{from{transform:translateX(30px);opacity:0}}@media (prefers-reduced-motion:reduce){.so{animation:none}}.in{position:static;box-shadow:none;max-width:none;margin:8px 0}img,video,iframe{display:block;width:100%;max-width:100%;border:0;margin:0 0 8px;border-radius:4px}iframe{aspect-ratio:16/9}",xe=ke+Y,we=["www.youtube-nocookie.com","www.youtube.com","player.vimeo.com","www.loom.com","fast.wistia.net"],_e="button,[href],input,textarea,select,[tabindex]:not([tabindex='-1'])";function y(e,t,n){let o=document.createElement(e);return t!==void 0&&(o.textContent=t),n&&(o.className=n),o}function Ee(e){let t;try{t=new URL(e.url)}catch{return null}if(t.protocol!=="https:")return null;if(e.type==="image")return Object.assign(y("img"),{src:t.href,alt:e.alt??"",loading:"lazy"});if(e.type==="video")return Object.assign(y("video"),{src:t.href,controls:!0,preload:"metadata"});if(e.type!=="embed"||!we.includes(t.host))return null;let n=Object.assign(y("iframe"),{src:t.href,title:e.alt??"Video",allowFullscreen:!0,referrerPolicy:"no-referrer"});return n.setAttribute("sandbox","allow-scripts allow-same-origin allow-presentation"),n}function Me(e,t,n){e.addEventListener("keydown",o=>{if(o.key==="Escape")return n();if(o.key!=="Tab")return;let s=[...e.querySelectorAll(_e)];if(!s.length)return;let u=s[0],a=s[s.length-1],r=t.activeElement;o.shiftKey&&r===u?(o.preventDefault(),a.focus()):!o.shiftKey&&r===a&&(o.preventDefault(),u.focus())})}function Te(e,t,n="bottom"){let o=t.getBoundingClientRect(),s=e.offsetWidth||280,u=e.offsetHeight||120,a=o.left,r=o.bottom+8;n==="top"?r=o.top-u-8:n==="left"?(a=o.left-s-8,r=o.top):n==="right"&&(a=o.right+8,r=o.top);let v=(x,w)=>Math.max(8,Math.min(x,w-8));e.style.left=`${v(a,window.innerWidth-s)}px`,e.style.top=`${v(r,window.innerHeight-u)}px`}function Ne(e,t,n,o={}){let s=document.createElement("div");s.setAttribute("data-lc-ignore","");let u=s.attachShadow({mode:"open"});u.append(j(xe,o.nonce));let a=document.activeElement,r=Math.min(Math.max(o.start??0,0),e.steps.length-1),v=!1,x,w=[],h=[],H=()=>{for(let i of h)i();h=[]},D=()=>{},d=y("div",void 0,"g"),_=()=>{v||(v=!0,H(),D(),s.remove(),a?.focus?.(),n())},L=i=>{t.dismissed(r,e.steps[r]?.id??"",i),_()},k=()=>L(),M=()=>{t.completed(),_(),e.steps.at(-1)?.confetti&&K()},R=i=>(o.resolveTarget??he)(i),$=i=>{let l=i?.goto?void 0:e.steps[r]?.branch?.find(m=>F(m,{...o.person?{person:o.person}:{},...o.flag?{flag:o.flag}:{},...o.present?{present:o.present}:{}})),p=i?.goto??l?.goto,c=p==="end"?e.steps.length:p?e.steps.findIndex(m=>m.id===p):-1;w.push(r),r=c>r?c:r+1,C()},C=()=>{let i=e.steps[r];if(!i)return M();if(t.progress?.(i.id),i.url&&!location.href.includes(i.url))return _();I()},O=i=>{i<0||i>=e.steps.length||i===r||(r=i,C())},Z=()=>{let i=w.pop();i!==void 0&&(r=i,C())},P=i=>{if(i.action==="next"||i.action==="start_tour")$(i);else if(i.action==="back")Z();else if(i.action==="dismiss")k();else if(i.action==="snooze"){let l=Math.min(Math.max(Math.round(i.snooze_hours??24),1),720);t.snoozed?.(e.steps[r]?.id??"",l),L("snooze")}else i.action==="link"&&i.url&&/^https?:\/\//i.test(i.url)?window.open(i.url,"_blank","noopener,noreferrer"):i.action==="event"&&i.event&&t.event(i.event)},ee=(i,l)=>{let p=y("div"),c=i.buttons?.length?i.buttons:ge(e.kind,l,w.length===0,i.advance==="click"||i.advance==="input");for(let m of c){let g=y("button",m.label);g.type="button",g.onclick=()=>P(m),p.append(g)}return p},te=i=>[...i.title?[y("h2",i.title)]:[],...i.body?[y("p",i.body)]:[],...(i.media??[]).flatMap(l=>Ee(l)??[])],T=new Set(o.checked),N=new Map;function G(i,l,p){let c=N.get(l.id);c&&!c.hasAttribute("data-done")&&(c.setAttribute("data-done",""),c.setAttribute("aria-pressed","true"),c.textContent=`\u2713 ${l.title??l.id}`),!(!p||T.has(l.id)&&c?.hasAttribute("data-reported"))&&(c?.setAttribute("data-reported",""),T.add(l.id),t.step(i,l.id),T.size>=e.steps.length&&M())}let ne=()=>{let i=y("ul");for(let[p,c]of e.steps.entries()){let m=y("li"),g=y("button",`${c.title??c.id}`);if(g.type="button",g.setAttribute("aria-pressed","false"),N.set(c.id,g),T.has(c.id)&&(G(p,c,!1),g.setAttribute("data-reported","")),g.onclick=()=>{if(e.kind==="checklist")G(p,c,!0);else if(e.kind==="resource_center"){t.step(p,c.id);let f=c.buttons?.find(b=>b.action==="link");f&&P(f)}},c.module){let f={library:o.library??[],launch:b=>(_(),o.launch?.(b)),opened:()=>t.step(p,c.id),...o.assist?{assist:o.assist}:{}};import("./modules-FANMZRDJ.js").then(b=>m.append(b.renderModule(c,f))),i.append(m);continue}m.append(g),c.body&&m.append(y("p",c.body)),i.append(m)}d.append(y("h2",e.name),i);let l=y("button",e.kind==="resource_center"?"Close":"Dismiss");l.type="button",l.onclick=k,d.append(l)};function I(){H(),d.replaceChildren(),d.style.visibility="";let i=e.steps[r];if(!i)return;let l=e.kind==="carousel";if(e.kind==="checklist"||e.kind==="resource_center")ne();else{let f={index:r,count:e.steps.length,to:O,complete:M,dismiss:k};d.append(...te(i),l?J(f):ee(i,r===e.steps.length-1)),t.step(r,i.id)}d.setAttribute("role",e.kind==="banner"||e.kind==="inline"?"region":"dialog"),d.setAttribute("aria-label",i?.title??e.name),l&&d.setAttribute("aria-roledescription","carousel");let p={modal:"m",carousel:"m",banner:`bn${i.placement==="bottom"?" bb":""}`,slideout:`so${e.appearance?.side==="left"?" sl":""}`,inline:"in"};if(d.className=`g ${p[e.kind]??"p"}`,X(d,V(e.appearance)),(e.kind==="modal"||l)&&d.setAttribute("aria-modal","true"),l&&h.push(Q(d,()=>({index:r,count:e.steps.length,to:O,complete:M,dismiss:k}))),i.auto_close_s&&i.auto_close_s>0){let f=setTimeout(()=>L("auto_close"),Math.min(i.auto_close_s,600)*1e3);h.push(()=>clearTimeout(f))}if(i.automation&&o.automate!==!1){let f=i.automation,b=setTimeout(()=>t.automated?.(i.id,U(f)));h.push(()=>clearTimeout(b))}let c=(e.kind==="tooltip"||e.kind==="tour")&&!!(i.selector||i.fallback_selectors?.length),m=f=>{d.style.visibility="",d.classList.remove("p"),Te(d,f,i.placement);let b=i.advance==="click"?"click":i.advance==="input"?"change":null;if(!b)return;let E=()=>$();f.addEventListener(b,E,{once:!0}),h.push(()=>f.removeEventListener(b,E))},g=c?R(i):null;if(g)m(g);else if(c){d.style.visibility="hidden";let f=Date.now()+Math.min(Math.max(i.wait_ms??3e3,0),15e3),b=setInterval(()=>{let E=R(i);E?(clearInterval(b),m(E)):Date.now()>=f&&(clearInterval(b),d.style.visibility="",t.targetMissing?.(i.id,i.selector??i.fallback_selectors?.[0]??""))},150);h.push(()=>clearInterval(b))}e.kind!=="inline"&&d.querySelector("button")?.focus()}Me(d,u,k);let B=e.kind==="modal"||e.kind==="carousel",q=e.appearance?.dismiss_on_outside_click??B;if(e.appearance?.overlay??B)x=y("div",void 0,"o"),q&&(x.onclick=k),u.append(x);else if(q&&e.kind!=="inline"){let i=p=>{p.composedPath().includes(s)||k()},l=setTimeout(()=>document.addEventListener("click",i,!0));D=()=>(clearTimeout(l),document.removeEventListener("click",i,!0))}u.append(d);let z=e.kind==="inline"&&e.steps[0]?.selector?document.querySelector(e.steps[0].selector):null;return z?z.after(s):document.body.append(s),t.shown(),I(),Object.assign(_,{markDone(i){let l=e.steps.findIndex(p=>p.id===i);e.kind==="checklist"&&l>=0&&!v&&G(l,e.steps[l],!0)}})}export{Se as a,j as b,F as c,de as d,U as e,V as f,X as g,ge as h,he as i,Te as j,Ne as k};
@@ -0,0 +1 @@
1
+ import{a as r}from"./chunk-EFNCQJI3.js";var a="$consent_updated",l="lc_consent",s="lc_distinct_id";function f(e,o){try{let t=`; Path=/; SameSite=Lax${location.protocol==="https:"?"; Secure":""}`;document.cookie=`${l}=${e?"granted":"denied"}; Max-Age=31536000${t}`,e&&o?document.cookie=`${s}=${encodeURIComponent(o)}; Max-Age=31536000${t}`:e||(document.cookie=`${s}=; Max-Age=0${t}`)}catch{}}function u(e,o,t,n={}){let d=JSON.stringify(e.core.getConsent());e.client.setConsent(o);let i=e.core.getConsent();if(n.cookie&&f(i.analytics,e.core.identity.isIdentified?void 0:e.core.distinctId),n.onlyIfChanged&&JSON.stringify(i)===d)return;let c={categories:i,source:t,version:n.version??e.config.consent?.policyVersion??"1",...n.receiptId?{consent_receipt_id:n.receiptId}:{}};if(e.core.hasConsent("analytics"))e.client.capture(a,c);else if(e.config.consent?.logBeacon&&!e.config.disabled){let p=JSON.stringify({api_key:e.apiKey,batch:[{uuid:r(Date.now()),event:a,timestamp:new Date().toISOString(),properties:{...c,$lib:"lucida-browser"}}],sent_at:new Date().toISOString()});e.fetch(`${e.config.apiHost}/v1/batch`,{method:"POST",body:p,keepalive:!0,credentials:"omit",headers:{"Content-Type":"text/plain"}}).catch(()=>{})}}export{a,u as b};
@@ -0,0 +1 @@
1
+ import{a as I,b as c}from"./chunk-IXDYCBAD.js";import"./chunk-EFNCQJI3.js";var a={onlyIfChanged:!0,cookie:!0};function m(n){if(n.gdprApplies===!1)return;let e=n.purpose?.consents??{},t=!!e[1]&&!!e[7];return{analytics:t,replay:t&&!!e[8],marketing:!!e[1]&&!!e[4]}}function g(n){let e=i=>i in n?n[i]==="granted":void 0,t={},s=e("analytics_storage");s!==void 0&&(t.analytics=t.replay=s);let o=e("ad_storage"),r=e("ad_user_data");return o!==void 0&&(t.marketing=o&&r!==!1),t}function v(n){let e=typeof n=="string"?n.split(","):n,t=e.includes("C0002");return{analytics:t,replay:t,marketing:e.includes("C0004")}}function y(n){return{analytics:!!n.statistics,replay:!!n.statistics,marketing:!!n.marketing}}function w(n,e){return{analytics:!!n.statistics,replay:e?!!n[e]:!!n.statistics,marketing:!!n.marketing}}var M=n=>{let e,s=u(()=>{let o=window.__tcfapi;return typeof o!="function"?!1:(o("addEventListener",2,(r,i)=>{if(!i||r.eventStatus!=="tcloaded"&&r.eventStatus!=="useractioncomplete")return;e=r.listenerId;let d=m(r);d&&c(n,d,"tcf",a)}),!0)});return()=>{s();let o=window.__tcfapi;e!==void 0&&typeof o=="function"&&o("removeEventListener",2,()=>{},e)}},O=n=>{let e=window,t=e.dataLayer??=[],s=r=>{let i=r;i&&typeof i=="object"&&i[0]==="consent"&&(i[1]==="default"||i[1]==="update")&&i[2]&&typeof i[2]=="object"&&c(n,g(i[2]),"gcm",a)};t.forEach(s);let o=t.push;return t.push=function(...r){return r.forEach(s),o.apply(this,r)},()=>{t.push=o}},U=n=>{let e=o=>{(typeof o=="string"||Array.isArray(o))&&c(n,v(o),"onetrust",a)},t=window,s=o=>e(o.detail??t.OnetrustActiveGroups);return window.addEventListener("OneTrustGroupsUpdated",s),e(t.OnetrustActiveGroups),()=>window.removeEventListener("OneTrustGroupsUpdated",s)},x=n=>{let e=window,t=()=>{let o=e.Cookiebot;o?.consent&&o.hasResponse!==!1&&c(n,y(o.consent),"cookiebot",a)},s=["CookiebotOnConsentReady","CookiebotOnAccept","CookiebotOnDecline"];for(let o of s)window.addEventListener(o,t);return t(),()=>s.forEach(o=>window.removeEventListener(o,t))};function k(n){let e=n.ANALYTICS==="ACCEPT";return{analytics:e,replay:e,marketing:n.MARKETING==="ACCEPT"}}function u(n){if(n())return()=>{};let e=0,t=setInterval(()=>(n()||++e>40)&&clearInterval(t),250);return()=>clearInterval(t)}var f=["osano-cm-initialized","osano-cm-consent-saved","osano-cm-consent-changed"],_=n=>{let e,t=o=>{let r=o&&typeof o=="object"&&Object.keys(o).length?o:e?.getConsent?.();r&&Object.keys(r).length&&c(n,k(r),"osano",a)},s=u(()=>{if(e=window.Osano?.cm,!e)return!1;for(let o of f)e.addEventListener?.(o,t);return t(e.getConsent?.()),!0});return()=>{s();for(let o of f)e?.removeEventListener?.(o,t)}};function b(n,e="Lucida"){let t=n.find(r=>r.name.toLowerCase()===e.toLowerCase());if(!t)return;let s=t.consent?.status===!0,o=n.filter(r=>r.categorySlug==="marketing");return{analytics:s,replay:s,marketing:o.length>0&&o.every(r=>r.consent?.status===!0)}}var l=["UC_UI_INITIALIZED","UC_UI_CMP_EVENT","ucEvent","UC_CONSENT"];function h(n="Lucida"){return e=>{let t=()=>{let i=window.UC_UI?.getServicesBaseInfo?.();if(!i)return!1;let d=b(i,n);return d?c(e,d,"usercentrics",a):e.log(`usercentrics: no service named "${n}"; consent left unchanged`),!0},s=()=>{t()};for(let r of l)window.addEventListener(r,s);let o=u(t);return()=>{o();for(let r of l)window.removeEventListener(r,s)}}}var L=h(),C=["CookieMunchOnConsentReady","CookieMunchOnChange"];function S(n,e){let t=e?.detail??{};for(let s of[t.receiptId,t.consentReceiptId,t.consentId,t.ledgerId,n.receiptId,n.consentReceiptId,n.consentId,n.ledgerId])if(typeof s=="string"&&s)return s.slice(0,128)}function E(n={}){return e=>{let t=s=>{let o=window.CookieMunch;if(!o?.consent||o.hasResponse!==!0)return;let r=S(o,s);c(e,w(o.consent,n.replayCategory),"cookiemunch",{...a,...r?{receiptId:r}:{}})};for(let s of C)window.addEventListener(s,t);return t(),()=>C.forEach(s=>window.removeEventListener(s,t))}}var p=E();var T=n=>{n.consentUi={showBanner:async e=>(await import("./banner-TXLAMTQM.js")).showBanner(n,e),hideBanner:()=>{import("./banner-TXLAMTQM.js").then(e=>e.hideBanner())}}};var j=n=>(T(n),p(n));export{I as CONSENT_EVENT,c as applyConsent,T as consentBanner,j as consentModule,E as cookieMunchBridge,p as cookieMunchConsent,w as cookieMunchToConsent,x as cookiebotConsent,y as cookiebotToConsent,O as gcmConsent,g as gcmToConsent,U as oneTrustConsent,v as oneTrustToConsent,_ as osanoConsent,k as osanoToConsent,M as tcfConsent,m as tcfToConsent,h as usercentricsBridge,L as usercentricsConsent,b as usercentricsToConsent};