veo-sdk 0.3.5 → 0.3.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/builder-MIPJRGOD.mjs +5 -0
- package/dist/{builder-FBNBSKCL.mjs.map → builder-MIPJRGOD.mjs.map} +1 -1
- package/dist/builder.cjs +256 -44
- package/dist/builder.cjs.map +1 -1
- package/dist/builder.mjs +4 -4
- package/dist/{chunk-TAZXRQYY.mjs → chunk-A73VSAZP.mjs} +3 -3
- package/dist/{chunk-TAZXRQYY.mjs.map → chunk-A73VSAZP.mjs.map} +1 -1
- package/dist/{chunk-R4E3LIDB.mjs → chunk-B5GO6PTO.mjs} +3 -3
- package/dist/{chunk-R4E3LIDB.mjs.map → chunk-B5GO6PTO.mjs.map} +1 -1
- package/dist/{chunk-GHP7ZJCW.mjs → chunk-FUMGOQJR.mjs} +258 -46
- package/dist/chunk-FUMGOQJR.mjs.map +1 -0
- package/dist/index.cjs +267 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.mjs +5 -5
- package/dist/veo-builder.js +48 -15
- package/dist/veo-builder.js.map +1 -1
- package/dist/veo-guides.js +43 -10
- package/dist/veo-guides.js.map +1 -1
- package/dist/veo.js +2 -2
- package/dist/veo.js.map +1 -1
- package/package.json +1 -1
- package/dist/builder-FBNBSKCL.mjs +0 -5
- package/dist/chunk-GHP7ZJCW.mjs.map +0 -1
package/dist/veo-guides.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var veoGuides=(function(exports){'use strict';function ot(){return typeof window<"u"}function Ae(){return typeof document<"u"}var rt=["http:","https:"],it="data-veo-guide",st="veo:freq:";var at="veo:walkthrough_state:";var ct={shown:1,dismissed:2,completed:2};function dt(n){return n.slice(-16)||"default"}var Te=class{constructor(e){this.storageKey=`${st}${e}`,this.cache=this.load(),this.prune();}shouldFilter(e,t){if(t==="every_visit"||t==="always")return false;let o=this.cache.get(e);return o?t==="once"?true:t==="until_dismissed"?o.status==="dismissed"||o.status==="completed":t==="until_answered"?o.status==="completed":false:false}record(e,t){let o=this.cache.get(e);o&&ct[t]<ct[o.status]||(this.cache.set(e,{guideId:e,status:t,lastInteractionAt:Date.now()}),this.persist());}clear(){this.cache.clear(),this.persist();}snapshot(){return Array.from(this.cache.values())}prune(){let e=Date.now(),t=false;for(let[o,r]of this.cache)e-r.lastInteractionAt>7776e6&&(this.cache.delete(o),t=true);if(this.cache.size>500){let o=Array.from(this.cache.entries()).sort((i,s)=>i[1].lastInteractionAt-s[1].lastInteractionAt),r=this.cache.size-500;for(let i=0;i<r;i++){let s=o[i];s&&this.cache.delete(s[0]);}t=true;}t&&this.persist();}load(){if(typeof localStorage>"u")return new Map;try{let e=localStorage.getItem(this.storageKey);if(!e)return new Map;let t=JSON.parse(e);if(!Array.isArray(t))return new Map;let o=[];for(let r of t)if(r&&typeof r=="object"&&typeof r.guideId=="string"&&typeof r.lastInteractionAt=="number"&&["shown","dismissed","completed"].includes(r.status)){let i=r;o.push([i.guideId,i]);}return new Map(o)}catch{return new Map}}persist(){if(!(typeof localStorage>"u"))try{let e=JSON.stringify(Array.from(this.cache.values()));localStorage.setItem(this.storageKey,e);}catch{}}};var Le=class{constructor(e,t,o=false){this.apiUrl=e;this.apiKey=t;this.debug=o;}async resolve(e,t){let o=new URLSearchParams({endUserId:e,pageUrl:t}),r;try{r=await fetch(`${this.apiUrl}/v1/guides/resolve?${o.toString()}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(i){return this.debug&&console.error("[veo] guides resolve fetch failed:",i),[]}if(!r.ok)return this.debug&&console.warn("[veo] guides resolve HTTP",r.status),[];try{let i=await r.json();return Array.isArray(i.guides)?i.guides:[]}catch(i){return this.debug&&console.error("[veo] guides resolve parse failed:",i),[]}}async fetchById(e){let t;try{t=await fetch(`${this.apiUrl}/v1/guides/${encodeURIComponent(e)}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(o){return this.debug&&console.error("[veo] guides fetchById network failed:",o),null}if(!t.ok)return this.debug&&console.warn("[veo] guides fetchById HTTP",t.status),null;try{let o=await t.json();return typeof o.guideId!="string"||typeof o.guideName!="string"||typeof o.guideType!="string"||!Array.isArray(o.guideSteps)||!o.activationRules||typeof o.displayFrequency!="string"||typeof o.displayPriority!="number"?(this.debug&&console.warn("[veo] guides fetchById: unexpected shape"),null):{guideId:o.guideId,guideName:o.guideName,guideType:o.guideType,guideSteps:o.guideSteps,activationRules:o.activationRules,displayFrequency:o.displayFrequency,displayPriority:o.displayPriority}}catch(o){return this.debug&&console.error("[veo] guides fetchById parse failed:",o),null}}};function ut(n){let e={endUserId:n.endUserId,interactionType:n.action};return n.sessionId&&(e.sessionId=n.sessionId),typeof n.stepIndex=="number"&&(e.stepPosition=n.stepIndex),n.pageUrl&&(e.pageUrl=n.pageUrl),n.pagePath&&(e.pagePath=n.pagePath),e}var Ge=class{constructor(e,t){this.apiUrl=e;this.apiKey=t;}async send(e){let t=this.buildUrl(e.guideId),o=await fetch(t,{method:"POST",headers:{"X-Api-Key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(ut(e.payload)),credentials:"omit"});if(!o.ok)throw new Error(`guide interaction send failed: HTTP ${o.status}`)}sendBeacon(e){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return false;let t=`${this.buildUrl(e.guideId)}?key=${encodeURIComponent(this.apiKey)}`,o=new Blob([JSON.stringify(ut(e.payload))],{type:"application/json"});try{return navigator.sendBeacon(t,o)}catch{return false}}buildUrl(e){return `${this.apiUrl}/v1/guides/${encodeURIComponent(e)}/interactions`}};var Oe=class{constructor(e){this.config=e;this.buffer=[];this.timer=null;this.flushing=false;this.unloadCleanup=null;this.startTimer(),this.installUnloadHandler();}get size(){return this.buffer.length}enqueue(e){this.buffer.push({guideId:e.guideId,payload:e.payload,attempts:0,enqueuedAt:Date.now()}),this.buffer.length>=this.config.batchSize&&this.flush();}async flush(){if(this.flushing||this.buffer.length===0)return;this.flushing=true;let e=this.buffer.splice(0,this.buffer.length),t=await Promise.allSettled(e.map(o=>this.config.client.send({guideId:o.guideId,payload:o.payload})));for(let o=0;o<t.length;o++){let r=t[o],i=e[o];!r||!i||r.status!=="fulfilled"&&(i.attempts+=1,i.attempts<this.config.maxRetries?this.buffer.push(i):this.safeOnError(r.reason,i));}this.flushing=false;}flushBeacon(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);for(let t of e)this.config.client.sendBeacon({guideId:t.guideId,payload:t.payload});}destroy(){this.timer&&clearInterval(this.timer),this.timer=null,this.unloadCleanup?.(),this.unloadCleanup=null;}startTimer(){typeof window>"u"||(this.timer=setInterval(()=>{this.flush();},this.config.flushIntervalMs));}installUnloadHandler(){if(typeof window>"u")return;let e=()=>this.flushBeacon(),t=()=>{document.visibilityState==="hidden"&&this.flushBeacon();};window.addEventListener("pagehide",e),window.addEventListener("visibilitychange",t),this.unloadCleanup=()=>{window.removeEventListener("pagehide",e),window.removeEventListener("visibilitychange",t);};}safeOnError(e,t){if(!this.config.onError)return;let o=e instanceof Error?e:new Error(String(e));try{this.config.onError(o,t);}catch{}}};function F(n,e,t){let o=e.createElement("div");if(o.className="veo-guide-content",typeof n.imageUrl=="string"&&n.imageUrl&&q(n.imageUrl)){let s=e.createElement("img");s.className="veo-guide-image",s.src=n.imageUrl,s.alt=typeof n.title=="string"?n.title:"",o.appendChild(s);}if(typeof n.title=="string"&&n.title){let s=e.createElement("h2");s.className="veo-guide-title",s.textContent=n.title,o.appendChild(s);}if(typeof n.content=="string"&&n.content){let s=e.createElement("p");s.className="veo-guide-text",s.textContent=n.content,o.appendChild(s);}let r=e.createElement("div");if(r.className="veo-guide-actions",typeof n.ctaText=="string"&&n.ctaText){let s=e.createElement("button");s.type="button",s.className="veo-guide-cta",s.textContent=n.ctaText,s.addEventListener("click",()=>{let a=n.ctaAction??"dismiss",c=en(n);t.onCtaClick(a,c);}),r.appendChild(s);}o.appendChild(r);let i=e.createElement("button");return i.type="button",i.className="veo-guide-close",i.setAttribute("aria-label","Cerrar"),i.textContent="\xD7",i.addEventListener("click",()=>t.onDismiss()),o.appendChild(i),o}function q(n){if(typeof n!="string"||n.length===0)return false;try{let e=typeof window<"u"?window.location.href:"http://localhost/",t=new URL(n,e);return rt.includes(t.protocol)}catch{return false}}function en(n){let e=n.style?.ctaUrl;if(typeof e=="string")return q(e)?e:void 0}var tn={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},nn={left:"flex-start",center:"center",right:"flex-end"},pt={none:"none",soft:"0 4px 14px rgba(0, 0, 0, 0.10)",medium:"0 8px 30px rgba(0, 0, 0, 0.18)",strong:"0 24px 60px rgba(0, 0, 0, 0.32)"},ft={center:[.5,.5],top:[.5,0],bottom:[.5,1],left:[0,.5],right:[1,.5],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},ht=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function V(n,e,t){return Math.min(t,Math.max(e,n))}function mt(n,e){if(!e||typeof e!="object")return;let t=e;if(typeof t.accentColor=="string"&&ht.test(t.accentColor.trim())&&n.style.setProperty("--veo-primary",t.accentColor.trim()),t.theme==="dark")for(let[i,s]of Object.entries(tn))n.style.setProperty(i,s);typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-radius",`${V(t.radius,0,48)}px`),typeof t.width=="number"&&Number.isFinite(t.width)&&n.style.setProperty("--veo-width",`${V(t.width,220,720)}px`),(t.align==="left"||t.align==="center"||t.align==="right")&&n.style.setProperty("--veo-actions-justify",nn[t.align]),typeof t.padding=="number"&&Number.isFinite(t.padding)&&n.style.setProperty("--veo-pad",`${V(t.padding,0,64)}px`),typeof t.margin=="number"&&Number.isFinite(t.margin)&&n.style.setProperty("--veo-margin",`${V(t.margin,0,64)}px`),typeof t.borderWidth=="number"&&Number.isFinite(t.borderWidth)&&n.style.setProperty("--veo-border-width",`${V(t.borderWidth,0,16)}px`),typeof t.borderColor=="string"&&ht.test(t.borderColor.trim())&&n.style.setProperty("--veo-border-color",t.borderColor.trim()),typeof t.shadow=="string"&&pt[t.shadow]&&n.style.setProperty("--veo-shadow",pt[t.shadow]);let o,r;typeof t.posX=="number"&&typeof t.posY=="number"?(o=V(t.posX,0,1),r=V(t.posY,0,1)):typeof t.overlayPosition=="string"&&ft[t.overlayPosition]&&([o,r]=ft[t.overlayPosition]),o!==void 0&&r!==void 0&&(n.style.setProperty("--veo-pos-x",`${o*100}%`),n.style.setProperty("--veo-pos-y",`${r*100}%`));}var gt=`
|
|
1
|
+
var veoGuides=(function(exports){'use strict';function dt(){return typeof window<"u"}function Ae(){return typeof document<"u"}var ut=["http:","https:"],pt="data-veo-guide",ft="veo:freq:";var ht="veo:walkthrough_state:";var gt={shown:1,dismissed:2,completed:2};function vt(n){return n.slice(-16)||"default"}var Le=class{constructor(e){this.storageKey=`${ft}${e}`,this.cache=this.load(),this.prune();}shouldFilter(e,t){if(t==="every_visit"||t==="always")return false;let o=this.cache.get(e);return o?t==="once"?true:t==="until_dismissed"?o.status==="dismissed"||o.status==="completed":t==="until_answered"?o.status==="completed":false:false}record(e,t){let o=this.cache.get(e);o&>[t]<gt[o.status]||(this.cache.set(e,{guideId:e,status:t,lastInteractionAt:Date.now()}),this.persist());}clear(){this.cache.clear(),this.persist();}snapshot(){return Array.from(this.cache.values())}prune(){let e=Date.now(),t=false;for(let[o,r]of this.cache)e-r.lastInteractionAt>7776e6&&(this.cache.delete(o),t=true);if(this.cache.size>500){let o=Array.from(this.cache.entries()).sort((i,s)=>i[1].lastInteractionAt-s[1].lastInteractionAt),r=this.cache.size-500;for(let i=0;i<r;i++){let s=o[i];s&&this.cache.delete(s[0]);}t=true;}t&&this.persist();}load(){if(typeof localStorage>"u")return new Map;try{let e=localStorage.getItem(this.storageKey);if(!e)return new Map;let t=JSON.parse(e);if(!Array.isArray(t))return new Map;let o=[];for(let r of t)if(r&&typeof r=="object"&&typeof r.guideId=="string"&&typeof r.lastInteractionAt=="number"&&["shown","dismissed","completed"].includes(r.status)){let i=r;o.push([i.guideId,i]);}return new Map(o)}catch{return new Map}}persist(){if(!(typeof localStorage>"u"))try{let e=JSON.stringify(Array.from(this.cache.values()));localStorage.setItem(this.storageKey,e);}catch{}}};var Ge=class{constructor(e,t,o=false){this.apiUrl=e;this.apiKey=t;this.debug=o;}async resolve(e,t){let o=new URLSearchParams({endUserId:e,pageUrl:t}),r;try{r=await fetch(`${this.apiUrl}/v1/guides/resolve?${o.toString()}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(i){return this.debug&&console.error("[veo] guides resolve fetch failed:",i),[]}if(!r.ok)return this.debug&&console.warn("[veo] guides resolve HTTP",r.status),[];try{let i=await r.json();return Array.isArray(i.guides)?i.guides:[]}catch(i){return this.debug&&console.error("[veo] guides resolve parse failed:",i),[]}}async fetchById(e){let t;try{t=await fetch(`${this.apiUrl}/v1/guides/${encodeURIComponent(e)}`,{method:"GET",headers:{"X-Api-Key":this.apiKey},credentials:"omit"});}catch(o){return this.debug&&console.error("[veo] guides fetchById network failed:",o),null}if(!t.ok)return this.debug&&console.warn("[veo] guides fetchById HTTP",t.status),null;try{let o=await t.json();return typeof o.guideId!="string"||typeof o.guideName!="string"||typeof o.guideType!="string"||!Array.isArray(o.guideSteps)||!o.activationRules||typeof o.displayFrequency!="string"||typeof o.displayPriority!="number"?(this.debug&&console.warn("[veo] guides fetchById: unexpected shape"),null):{guideId:o.guideId,guideName:o.guideName,guideType:o.guideType,guideSteps:o.guideSteps,activationRules:o.activationRules,displayFrequency:o.displayFrequency,displayPriority:o.displayPriority}}catch(o){return this.debug&&console.error("[veo] guides fetchById parse failed:",o),null}}};function yt(n){let e={endUserId:n.endUserId,interactionType:n.action};return n.sessionId&&(e.sessionId=n.sessionId),typeof n.stepIndex=="number"&&(e.stepPosition=n.stepIndex),n.pageUrl&&(e.pageUrl=n.pageUrl),n.pagePath&&(e.pagePath=n.pagePath),e}var Oe=class{constructor(e,t){this.apiUrl=e;this.apiKey=t;}async send(e){let t=this.buildUrl(e.guideId),o=await fetch(t,{method:"POST",headers:{"X-Api-Key":this.apiKey,"Content-Type":"application/json"},body:JSON.stringify(yt(e.payload)),credentials:"omit"});if(!o.ok)throw new Error(`guide interaction send failed: HTTP ${o.status}`)}sendBeacon(e){if(typeof navigator>"u"||typeof navigator.sendBeacon!="function")return false;let t=`${this.buildUrl(e.guideId)}?key=${encodeURIComponent(this.apiKey)}`,o=new Blob([JSON.stringify(yt(e.payload))],{type:"application/json"});try{return navigator.sendBeacon(t,o)}catch{return false}}buildUrl(e){return `${this.apiUrl}/v1/guides/${encodeURIComponent(e)}/interactions`}};var Ne=class{constructor(e){this.config=e;this.buffer=[];this.timer=null;this.flushing=false;this.unloadCleanup=null;this.startTimer(),this.installUnloadHandler();}get size(){return this.buffer.length}enqueue(e){this.buffer.push({guideId:e.guideId,payload:e.payload,attempts:0,enqueuedAt:Date.now()}),this.buffer.length>=this.config.batchSize&&this.flush();}async flush(){if(this.flushing||this.buffer.length===0)return;this.flushing=true;let e=this.buffer.splice(0,this.buffer.length),t=await Promise.allSettled(e.map(o=>this.config.client.send({guideId:o.guideId,payload:o.payload})));for(let o=0;o<t.length;o++){let r=t[o],i=e[o];!r||!i||r.status!=="fulfilled"&&(i.attempts+=1,i.attempts<this.config.maxRetries?this.buffer.push(i):this.safeOnError(r.reason,i));}this.flushing=false;}flushBeacon(){if(this.buffer.length===0)return;let e=this.buffer.splice(0,this.buffer.length);for(let t of e)this.config.client.sendBeacon({guideId:t.guideId,payload:t.payload});}destroy(){this.timer&&clearInterval(this.timer),this.timer=null,this.unloadCleanup?.(),this.unloadCleanup=null;}startTimer(){typeof window>"u"||(this.timer=setInterval(()=>{this.flush();},this.config.flushIntervalMs));}installUnloadHandler(){if(typeof window>"u")return;let e=()=>this.flushBeacon(),t=()=>{document.visibilityState==="hidden"&&this.flushBeacon();};window.addEventListener("pagehide",e),window.addEventListener("visibilitychange",t),this.unloadCleanup=()=>{window.removeEventListener("pagehide",e),window.removeEventListener("visibilitychange",t);};}safeOnError(e,t){if(!this.config.onError)return;let o=e instanceof Error?e:new Error(String(e));try{this.config.onError(o,t);}catch{}}};function $(n,e,t){let o=e.createElement("div");if(o.className="veo-guide-content",typeof n.imageUrl=="string"&&n.imageUrl&&j(n.imageUrl)){let i=e.createElement("img");i.className="veo-guide-image",i.src=n.imageUrl,i.alt=typeof n.title=="string"?n.title:"",o.appendChild(i);}if(typeof n.title=="string"&&n.title){let i=e.createElement("h2");i.className="veo-guide-title",i.textContent=n.title,o.appendChild(i);}if(typeof n.content=="string"&&n.content){let i=e.createElement("p");i.className="veo-guide-text",i.textContent=n.content,o.appendChild(i);}let r=e.createElement("div");if(r.className="veo-guide-actions",typeof n.ctaText=="string"&&n.ctaText){let i=e.createElement("button");i.type="button",i.className="veo-guide-cta",i.textContent=n.ctaText,i.addEventListener("click",()=>{let s=n.ctaAction??"dismiss",a=rn(n);t.onCtaClick(s,a);}),r.appendChild(i);}return o.appendChild(r),o.appendChild(M(e,()=>t.onDismiss())),o}function M(n,e,t="veo-guide-close"){let o=n.createElement("button");return o.type="button",o.className=t,o.setAttribute("aria-label","Cerrar"),o.textContent="\xD7",o.addEventListener("click",e),o}function j(n){if(typeof n!="string"||n.length===0)return false;try{let e=typeof window<"u"?window.location.href:"http://localhost/",t=new URL(n,e);return ut.includes(t.protocol)}catch{return false}}function rn(n){let e=n.style?.ctaUrl;if(typeof e=="string")return j(e)?e:void 0}var sn={"--veo-bg":"#1f2937","--veo-text":"#f9fafb","--veo-text-secondary":"#d1d5db","--veo-shadow":"0 20px 60px rgba(0, 0, 0, 0.55)"},et={left:"flex-start",center:"center",right:"flex-end"},an={left:"flex-start",center:"center",right:"flex-end"},ln={title:"text",text:"text",image:"self"},wt={none:"none",soft:"0 4px 14px rgba(0, 0, 0, 0.10)",medium:"0 8px 30px rgba(0, 0, 0, 0.18)",strong:"0 24px 60px rgba(0, 0, 0, 0.32)"},bt={center:[.5,.5],top:[.5,0],bottom:[.5,1],left:[0,.5],right:[1,.5],"top-left":[0,0],"top-right":[1,0],"bottom-left":[0,1],"bottom-right":[1,1]},nt=/^#[0-9a-f]{3,8}$|^(rgb|rgba|hsl|hsla)\([\d.,%/\sdeg]+\)$|^[a-z]{3,20}$/i;function S(n,e,t){return Math.min(t,Math.max(e,n))}function xt(n,e){if(!e||typeof e!="object")return;let t=e;if(typeof t.accentColor=="string"&&nt.test(t.accentColor.trim())&&n.style.setProperty("--veo-primary",t.accentColor.trim()),t.theme==="dark")for(let[i,s]of Object.entries(sn))n.style.setProperty(i,s);typeof t.radius=="number"&&Number.isFinite(t.radius)&&n.style.setProperty("--veo-radius",`${S(t.radius,0,48)}px`),typeof t.width=="number"&&Number.isFinite(t.width)&&n.style.setProperty("--veo-width",`${S(t.width,220,720)}px`),(t.align==="left"||t.align==="center"||t.align==="right")&&n.style.setProperty("--veo-actions-justify",et[t.align]),typeof t.padding=="number"&&Number.isFinite(t.padding)&&n.style.setProperty("--veo-pad",`${S(t.padding,0,64)}px`),typeof t.margin=="number"&&Number.isFinite(t.margin)&&n.style.setProperty("--veo-margin",`${S(t.margin,0,64)}px`),typeof t.borderWidth=="number"&&Number.isFinite(t.borderWidth)&&n.style.setProperty("--veo-border-width",`${S(t.borderWidth,0,16)}px`),typeof t.borderColor=="string"&&nt.test(t.borderColor.trim())&&n.style.setProperty("--veo-border-color",t.borderColor.trim()),typeof t.shadow=="string"&&wt[t.shadow]&&n.style.setProperty("--veo-shadow",wt[t.shadow]);let o,r;if(typeof t.posX=="number"&&typeof t.posY=="number"?(o=S(t.posX,0,1),r=S(t.posY,0,1)):typeof t.overlayPosition=="string"&&bt[t.overlayPosition]&&([o,r]=bt[t.overlayPosition]),o!==void 0&&r!==void 0&&(n.style.setProperty("--veo-pos-x",`${o*100}%`),n.style.setProperty("--veo-pos-y",`${r*100}%`)),t.elements&&typeof t.elements=="object"){let i=t.elements;tt(n,"title",i.title),tt(n,"text",i.text),tt(n,"image",i.image);let s=i.cta;s&&typeof s.align=="string"&&et[s.align]&&n.style.setProperty("--veo-actions-justify",et[s.align]);}}function tt(n,e,t){if(!t||typeof t!="object")return;let o=t;if(typeof o.align=="string"&&(o.align==="left"||o.align==="center"||o.align==="right")){let i=(ln[e]??"text")==="self"?an[o.align]:o.align;n.style.setProperty(`--veo-${e}-align`,i);}typeof o.color=="string"&&nt.test(o.color.trim())&&n.style.setProperty(`--veo-${e}-color`,o.color.trim()),typeof o.fontSize=="number"&&Number.isFinite(o.fontSize)&&n.style.setProperty(`--veo-${e}-size`,`${S(o.fontSize,8,72)}px`),typeof o.width=="number"&&Number.isFinite(o.width)&&n.style.setProperty(`--veo-${e}-width`,`${S(o.width,10,100)}%`),typeof o.radius=="number"&&Number.isFinite(o.radius)&&n.style.setProperty(`--veo-${e}-radius`,`${S(o.radius,0,48)}px`),typeof o.marginTop=="number"&&Number.isFinite(o.marginTop)&&n.style.setProperty(`--veo-${e}-mt`,`${S(o.marginTop,0,64)}px`),typeof o.marginBottom=="number"&&Number.isFinite(o.marginBottom)&&n.style.setProperty(`--veo-${e}-mb`,`${S(o.marginBottom,0,64)}px`);}var Ct=`
|
|
2
2
|
:host {
|
|
3
3
|
--veo-primary: #4f46e5;
|
|
4
4
|
--veo-text: #1f2937;
|
|
@@ -61,6 +61,15 @@ var veoGuides=(function(exports){'use strict';function ot(){return typeof window
|
|
|
61
61
|
box-shadow: var(--veo-shadow, 0 8px 30px rgba(0, 0, 0, 0.18));
|
|
62
62
|
animation: veo-fade-in 150ms ease-out;
|
|
63
63
|
}
|
|
64
|
+
.veo-tooltip-arrow {
|
|
65
|
+
position: absolute;
|
|
66
|
+
width: 12px;
|
|
67
|
+
height: 12px;
|
|
68
|
+
background: var(--veo-bg);
|
|
69
|
+
border: var(--veo-border-width, 0) solid var(--veo-border-color, transparent);
|
|
70
|
+
transform: rotate(45deg);
|
|
71
|
+
pointer-events: none;
|
|
72
|
+
}
|
|
64
73
|
|
|
65
74
|
.veo-inline {
|
|
66
75
|
background: var(--veo-bg);
|
|
@@ -79,17 +88,25 @@ var veoGuides=(function(exports){'use strict';function ot(){return typeof window
|
|
|
79
88
|
display: flex; flex-direction: column;
|
|
80
89
|
}
|
|
81
90
|
.veo-guide-image {
|
|
82
|
-
display: block;
|
|
83
|
-
|
|
84
|
-
|
|
91
|
+
display: block;
|
|
92
|
+
width: var(--veo-image-width, 100%);
|
|
93
|
+
max-height: 180px;
|
|
94
|
+
object-fit: cover;
|
|
95
|
+
align-self: var(--veo-image-align, stretch);
|
|
96
|
+
border-radius: var(--veo-image-radius, 8px);
|
|
97
|
+
margin: var(--veo-image-mt, 0) 0 var(--veo-image-mb, 12px);
|
|
85
98
|
}
|
|
86
99
|
.veo-guide-title {
|
|
87
|
-
font-size: 18px; font-weight: 600; line-height: 1.3;
|
|
88
|
-
|
|
100
|
+
font-size: var(--veo-title-size, 18px); font-weight: 600; line-height: 1.3;
|
|
101
|
+
text-align: var(--veo-title-align, left);
|
|
102
|
+
margin: var(--veo-title-mt, 0) 0 var(--veo-title-mb, 6px);
|
|
103
|
+
color: var(--veo-title-color, var(--veo-text));
|
|
89
104
|
}
|
|
90
105
|
.veo-guide-text {
|
|
91
|
-
font-size: 14px; line-height: 1.5;
|
|
92
|
-
|
|
106
|
+
font-size: var(--veo-text-size, 14px); line-height: 1.5;
|
|
107
|
+
text-align: var(--veo-text-align, left);
|
|
108
|
+
margin: var(--veo-text-mt, 0) 0 var(--veo-text-mb, 16px);
|
|
109
|
+
color: var(--veo-text-color, var(--veo-text-secondary));
|
|
93
110
|
}
|
|
94
111
|
.veo-guide-actions {
|
|
95
112
|
display: flex; gap: 8px; justify-content: var(--veo-actions-justify);
|
|
@@ -226,6 +243,7 @@ var veoGuides=(function(exports){'use strict';function ot(){return typeof window
|
|
|
226
243
|
}
|
|
227
244
|
.veo-custom-inline {
|
|
228
245
|
display: block;
|
|
246
|
+
position: relative;
|
|
229
247
|
margin: 12px 0;
|
|
230
248
|
}
|
|
231
249
|
.veo-custom-frame {
|
|
@@ -235,6 +253,21 @@ var veoGuides=(function(exports){'use strict';function ot(){return typeof window
|
|
|
235
253
|
background: transparent;
|
|
236
254
|
color-scheme: normal;
|
|
237
255
|
}
|
|
256
|
+
/*
|
|
257
|
+
* X de cerrar de las gu\xEDas custom: el HTML del cliente vive en un iframe
|
|
258
|
+
* sandbox, as\xED que el bot\xF3n lo pone el host POR ENCIMA del iframe. Con fondo
|
|
259
|
+
* propio para ser visible sobre cualquier contenido.
|
|
260
|
+
*/
|
|
261
|
+
.veo-custom-close {
|
|
262
|
+
position: absolute; top: 6px; right: 6px; z-index: 1;
|
|
263
|
+
width: 22px; height: 22px; padding: 0;
|
|
264
|
+
display: flex; align-items: center; justify-content: center;
|
|
265
|
+
font-size: 16px; line-height: 1; color: #6b7280;
|
|
266
|
+
background: rgba(255, 255, 255, 0.92);
|
|
267
|
+
border: 1px solid rgba(0, 0, 0, 0.08); border-radius: 50%;
|
|
268
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.14); cursor: pointer;
|
|
269
|
+
}
|
|
270
|
+
.veo-custom-close:hover { color: #111827; }
|
|
238
271
|
|
|
239
272
|
@keyframes veo-fade-in { from { opacity: 0; } to { opacity: 1; } }
|
|
240
273
|
@keyframes veo-slide-up {
|
|
@@ -245,7 +278,7 @@ var veoGuides=(function(exports){'use strict';function ot(){return typeof window
|
|
|
245
278
|
from { transform: translateY(-10px); opacity: 0; }
|
|
246
279
|
to { transform: translateY(0); opacity: 1; }
|
|
247
280
|
}
|
|
248
|
-
`;var b=class{constructor(){this.host=null;this.shadow=null;this.cleanups=[];}createHost(){let e=document.createElement("div");e.setAttribute(it,"");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=gt,t.appendChild(o);let r=document.createElement("div");return t.appendChild(r),document.body.appendChild(e),this.host=e,this.shadow=t,{host:e,shadow:t,root:r}}applyDesign(e){this.host&&mt(this.host,e);}registerCleanup(e){this.cleanups.push(e);}destroy(){for(let e of this.cleanups)try{e();}catch{}this.cleanups=[],this.host?.parentNode&&this.host.parentNode.removeChild(this.host),this.host=null,this.shadow=null;}};var ee=class extends b{render(e){let t=e.guide.guideSteps[0];if(!t)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=t.style?.position==="bottom"?"bottom":"top",s=r.createElement("div");s.className=`veo-banner veo-banner-${i}`;let a=(l,d)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:l}),d&&window.open(d,"_blank","noopener,noreferrer"),e.onClose();},c=F(t,r,{onCtaClick:(l,d)=>{a("cta_clicked",l==="url"?d:void 0);},onDismiss:()=>a("dismissed")});s.appendChild(c),o.appendChild(s),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var j=Math.min,H=Math.max,Ee=Math.round;var L=n=>({x:n,y:n}),on={left:"right",right:"left",bottom:"top",top:"bottom"};function Ne(n,e,t){return H(n,j(e,t))}function te(n,e){return typeof n=="function"?n(e):n}function $(n){return n.split("-")[0]}function ne(n){return n.split("-")[1]}function Qe(n){return n==="x"?"y":"x"}function De(n){return n==="y"?"height":"width"}function D(n){let e=n[0];return e==="t"||e==="b"?"y":"x"}function We(n){return Qe(D(n))}function wt(n,e,t){t===void 0&&(t=false);let o=ne(n),r=We(n),i=De(r),s=r==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=ke(s)),[s,ke(s)]}function bt(n){let e=ke(n);return [_e(n),e,_e(e)]}function _e(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}var vt=["left","right"],yt=["right","left"],rn=["top","bottom"],sn=["bottom","top"];function an(n,e,t){switch(n){case "top":case "bottom":return t?e?yt:vt:e?vt:yt;case "left":case "right":return e?rn:sn;default:return []}}function xt(n,e,t,o){let r=ne(n),i=an($(n),t==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(_e)))),i}function ke(n){let e=$(n);return on[e]+n.slice(e.length)}function ln(n){return {top:0,right:0,bottom:0,left:0,...n}}function Je(n){return typeof n!="number"?ln(n):{top:n,right:n,bottom:n,left:n}}function Y(n){let{x:e,y:t,width:o,height:r}=n;return {width:o,height:r,top:t,left:e,right:e+o,bottom:t+r,x:e,y:t}}function Ct(n,e,t){let{reference:o,floating:r}=n,i=D(e),s=We(e),a=De(s),c=$(e),l=i==="y",d=o.x+o.width/2-r.width/2,p=o.y+o.height/2-r.height/2,f=o[a]/2-r[a]/2,u;switch(c){case "top":u={x:d,y:o.y-r.height};break;case "bottom":u={x:d,y:o.y+o.height};break;case "right":u={x:o.x+o.width,y:p};break;case "left":u={x:o.x-r.width,y:p};break;default:u={x:o.x,y:o.y};}switch(ne(e)){case "start":u[s]-=f*(t&&l?-1:1);break;case "end":u[s]+=f*(t&&l?-1:1);break}return u}async function kt(n,e){var t;e===void 0&&(e={});let{x:o,y:r,platform:i,rects:s,elements:a,strategy:c}=n,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:p="floating",altBoundary:f=false,padding:u=0}=te(e,n),h=Je(u),g=a[f?p==="floating"?"reference":"floating":p],v=Y(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(g)))==null||t?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),y=p==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,w=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(w))?await(i.getScale==null?void 0:i.getScale(w))||{x:1,y:1}:{x:1,y:1},P=Y(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:w,strategy:c}):y);return {top:(v.top-P.top+h.top)/x.y,bottom:(P.bottom-v.bottom+h.bottom)/x.y,left:(v.left-P.left+h.left)/x.x,right:(P.right-v.right+h.right)/x.x}}var cn=50,Et=async(n,e,t)=>{let{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=t,a=s.detectOverflow?s:{...s,detectOverflow:kt},c=await(s.isRTL==null?void 0:s.isRTL(e)),l=await s.getElementRects({reference:n,floating:e,strategy:r}),{x:d,y:p}=Ct(l,o,c),f=o,u=0,h={};for(let m=0;m<i.length;m++){let g=i[m];if(!g)continue;let{name:v,fn:y}=g,{x:w,y:x,data:P,reset:k}=await y({x:d,y:p,initialPlacement:o,placement:f,strategy:r,middlewareData:h,rects:l,platform:a,elements:{reference:n,floating:e}});d=w??d,p=x??p,h[v]={...h[v],...P},k&&u<cn&&(u++,typeof k=="object"&&(k.placement&&(f=k.placement),k.rects&&(l=k.rects===true?await s.getElementRects({reference:n,floating:e,strategy:r}):k.rects),{x:d,y:p}=Ct(l,f,c)),m=-1);}return {x:d,y:p,placement:f,strategy:r,middlewareData:h}},St=n=>({name:"arrow",options:n,async fn(e){let{x:t,y:o,placement:r,rects:i,platform:s,elements:a,middlewareData:c}=e,{element:l,padding:d=0}=te(n,e)||{};if(l==null)return {};let p=Je(d),f={x:t,y:o},u=We(r),h=De(u),m=await s.getDimensions(l),g=u==="y",v=g?"top":"left",y=g?"bottom":"right",w=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[u]-f[u]-i.floating[h],P=f[u]-i.reference[u],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l)),B=k?k[w]:0;(!B||!await(s.isElement==null?void 0:s.isElement(k)))&&(B=a.floating[w]||i.floating[h]);let we=x/2-P/2,U=B/2-m[h]/2-1,_=j(p[v],U),be=j(p[y],U),z=_,xe=B-m[h]-be,C=B/2-m[h]/2+we,K=Ne(z,C,xe),N=!c.arrow&&ne(r)!=null&&C!==K&&i.reference[h]/2-(C<z?_:be)-m[h]/2<0,A=N?C<z?C-z:C-xe:0;return {[u]:f[u]+A,data:{[u]:K,centerOffset:C-K-A,...N&&{alignmentOffset:A}},reset:N}}});var Rt=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;let{placement:r,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:l}=e,{mainAxis:d=true,crossAxis:p=true,fallbackPlacements:f,fallbackStrategy:u="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=true,...g}=te(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return {};let v=$(r),y=D(a),w=$(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(l.floating)),P=f||(w||!m?[ke(a)]:bt(a)),k=h!=="none";!f&&k&&P.push(...xt(a,m,h,x));let B=[a,...P],we=await c.detectOverflow(e,g),U=[],_=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&U.push(we[v]),p){let C=wt(r,s,x);U.push(we[C[0]],we[C[1]]);}if(_=[..._,{placement:r,overflows:U}],!U.every(C=>C<=0)){var be,z;let C=(((be=i.flip)==null?void 0:be.index)||0)+1,K=B[C];if(K&&(!(p==="alignment"?y!==D(K):false)||_.every(T=>D(T.placement)===y?T.overflows[0]>0:true)))return {data:{index:C,overflows:_},reset:{placement:K}};let N=(z=_.filter(A=>A.overflows[0]<=0).sort((A,T)=>A.overflows[1]-T.overflows[1])[0])==null?void 0:z.placement;if(!N)switch(u){case "bestFit":{var xe;let A=(xe=_.filter(T=>{if(k){let M=D(T.placement);return M===y||M==="y"}return true}).map(T=>[T.placement,T.overflows.filter(M=>M>0).reduce((M,Jt)=>M+Jt,0)]).sort((T,M)=>T[1]-M[1])[0])==null?void 0:xe[0];A&&(N=A);break}case "initialPlacement":N=a;break}if(r!==N)return {reset:{placement:N}}}return {}}}};var dn=new Set(["left","top"]);async function un(n,e){let{placement:t,platform:o,elements:r}=n,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=$(t),a=ne(t),c=D(t)==="y",l=dn.has(s)?-1:1,d=i&&c?-1:1,p=te(e,n),{mainAxis:f,crossAxis:u,alignmentAxis:h}=typeof p=="number"?{mainAxis:p,crossAxis:0,alignmentAxis:null}:{mainAxis:p.mainAxis||0,crossAxis:p.crossAxis||0,alignmentAxis:p.alignmentAxis};return a&&typeof h=="number"&&(u=a==="end"?h*-1:h),c?{x:u*d,y:f*l}:{x:f*l,y:u*d}}var It=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;let{x:r,y:i,placement:s,middlewareData:a}=e,c=await un(e,n);return s===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:s}}}}},Pt=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:o,placement:r,platform:i}=e,{mainAxis:s=true,crossAxis:a=false,limiter:c={fn:v=>{let{x:y,y:w}=v;return {x:y,y:w}}},...l}=te(n,e),d={x:t,y:o},p=await i.detectOverflow(e,l),f=D($(r)),u=Qe(f),h=d[u],m=d[f];if(s){let v=u==="y"?"top":"left",y=u==="y"?"bottom":"right",w=h+p[v],x=h-p[y];h=Ne(w,h,x);}if(a){let v=f==="y"?"top":"left",y=f==="y"?"bottom":"right",w=m+p[v],x=m-p[y];m=Ne(w,m,x);}let g=c.fn({...e,[u]:h,[f]:m});return {...g,data:{x:g.x-t,y:g.y-o,enabled:{[u]:s,[f]:a}}}}}};function Fe(){return typeof window<"u"}function Q(n){return Tt(n)?(n.nodeName||"").toLowerCase():"#document"}function E(n){var e;return (n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function G(n){var e;return (e=(Tt(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Tt(n){return Fe()?n instanceof Node||n instanceof E(n).Node:false}function S(n){return Fe()?n instanceof Element||n instanceof E(n).Element:false}function O(n){return Fe()?n instanceof HTMLElement||n instanceof E(n).HTMLElement:false}function At(n){return !Fe()||typeof ShadowRoot>"u"?false:n instanceof ShadowRoot||n instanceof E(n).ShadowRoot}function oe(n){let{overflow:e,overflowX:t,overflowY:o,display:r}=R(n);return /auto|scroll|overlay|hidden|clip/.test(e+o+t)&&r!=="inline"&&r!=="contents"}function Lt(n){return /^(table|td|th)$/.test(Q(n))}function Se(n){try{if(n.matches(":popover-open"))return !0}catch{}try{return n.matches(":modal")}catch{return false}}var pn=/transform|translate|scale|rotate|perspective|filter/,fn=/paint|layout|strict|content/,X=n=>!!n&&n!=="none",Ze;function He(n){let e=S(n)?R(n):n;return X(e.transform)||X(e.translate)||X(e.scale)||X(e.rotate)||X(e.perspective)||!$e()&&(X(e.backdropFilter)||X(e.filter))||pn.test(e.willChange||"")||fn.test(e.contain||"")}function Gt(n){let e=W(n);for(;O(e)&&!J(e);){if(He(e))return e;if(Se(e))return null;e=W(e);}return null}function $e(){return Ze==null&&(Ze=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),Ze}function J(n){return /^(html|body|#document)$/.test(Q(n))}function R(n){return E(n).getComputedStyle(n)}function Re(n){return S(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function W(n){if(Q(n)==="html")return n;let e=n.assignedSlot||n.parentNode||At(n)&&n.host||G(n);return At(e)?e.host:e}function Ot(n){let e=W(n);return J(e)?n.ownerDocument?n.ownerDocument.body:n.body:O(e)&&oe(e)?e:Ot(e)}function Me(n,e,t){var o;e===void 0&&(e=[]);let r=Ot(n),i=r===((o=n.ownerDocument)==null?void 0:o.body),s=E(r);if(i){Be(s);return e.concat(s,s.visualViewport||[],oe(r)?r:[],[])}else return e.concat(r,Me(r,[]))}function Be(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Wt(n){let e=R(n),t=parseFloat(e.width)||0,o=parseFloat(e.height)||0,r=O(n),i=r?n.offsetWidth:t,s=r?n.offsetHeight:o,a=Ee(t)!==i||Ee(o)!==s;return a&&(t=i,o=s),{width:t,height:o,$:a}}function Mt(n){return S(n)?n:n.contextElement}function re(n){let e=Mt(n);if(!O(e))return L(1);let t=e.getBoundingClientRect(),{width:o,height:r,$:i}=Wt(e),s=(i?Ee(t.width):t.width)/o,a=(i?Ee(t.height):t.height)/r;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var hn=L(0);function Ft(n){let e=E(n);return !$e()||!e.visualViewport?hn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function mn(n,e,t){return e===void 0&&(e=false),!t||e&&t!==E(n)?false:e}function Ie(n,e,t,o){e===void 0&&(e=false),t===void 0&&(t=false);let r=n.getBoundingClientRect(),i=Mt(n),s=L(1);e&&(o?S(o)&&(s=re(o)):s=re(n));let a=mn(i,t,o)?Ft(i):L(0),c=(r.left+a.x)/s.x,l=(r.top+a.y)/s.y,d=r.width/s.x,p=r.height/s.y;if(i){let f=E(i),u=o&&S(o)?E(o):o,h=f,m=Be(h);for(;m&&o&&u!==h;){let g=re(m),v=m.getBoundingClientRect(),y=R(m),w=v.left+(m.clientLeft+parseFloat(y.paddingLeft))*g.x,x=v.top+(m.clientTop+parseFloat(y.paddingTop))*g.y;c*=g.x,l*=g.y,d*=g.x,p*=g.y,c+=w,l+=x,h=E(m),m=Be(h);}}return Y({width:d,height:p,x:c,y:l})}function Ue(n,e){let t=Re(n).scrollLeft;return e?e.left+t:Ie(G(n)).left+t}function Ht(n,e){let t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-Ue(n,t),r=t.top+e.scrollTop;return {x:o,y:r}}function gn(n){let{elements:e,rect:t,offsetParent:o,strategy:r}=n,i=r==="fixed",s=G(o),a=e?Se(e.floating):false;if(o===s||a&&i)return t;let c={scrollLeft:0,scrollTop:0},l=L(1),d=L(0),p=O(o);if((p||!p&&!i)&&((Q(o)!=="body"||oe(s))&&(c=Re(o)),p)){let u=Ie(o);l=re(o),d.x=u.x+o.clientLeft,d.y=u.y+o.clientTop;}let f=s&&!p&&!i?Ht(s,c):L(0);return {width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-c.scrollLeft*l.x+d.x+f.x,y:t.y*l.y-c.scrollTop*l.y+d.y+f.y}}function vn(n){return Array.from(n.getClientRects())}function yn(n){let e=G(n),t=Re(n),o=n.ownerDocument.body,r=H(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=H(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),s=-t.scrollLeft+Ue(n),a=-t.scrollTop;return R(o).direction==="rtl"&&(s+=H(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:a}}var _t=25;function wn(n,e){let t=E(n),o=G(n),r=t.visualViewport,i=o.clientWidth,s=o.clientHeight,a=0,c=0;if(r){i=r.width,s=r.height;let d=$e();(!d||d&&e==="fixed")&&(a=r.offsetLeft,c=r.offsetTop);}let l=Ue(o);if(l<=0){let d=o.ownerDocument,p=d.body,f=getComputedStyle(p),u=d.compatMode==="CSS1Compat"&&parseFloat(f.marginLeft)+parseFloat(f.marginRight)||0,h=Math.abs(o.clientWidth-p.clientWidth-u);h<=_t&&(i-=h);}else l<=_t&&(i+=l);return {width:i,height:s,x:a,y:c}}function bn(n,e){let t=Ie(n,true,e==="fixed"),o=t.top+n.clientTop,r=t.left+n.clientLeft,i=O(n)?re(n):L(1),s=n.clientWidth*i.x,a=n.clientHeight*i.y,c=r*i.x,l=o*i.y;return {width:s,height:a,x:c,y:l}}function Nt(n,e,t){let o;if(e==="viewport")o=wn(n,t);else if(e==="document")o=yn(G(n));else if(S(e))o=bn(e,t);else {let r=Ft(n);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height};}return Y(o)}function $t(n,e){let t=W(n);return t===e||!S(t)||J(t)?false:R(t).position==="fixed"||$t(t,e)}function xn(n,e){let t=e.get(n);if(t)return t;let o=Me(n,[]).filter(a=>S(a)&&Q(a)!=="body"),r=null,i=R(n).position==="fixed",s=i?W(n):n;for(;S(s)&&!J(s);){let a=R(s),c=He(s);!c&&a.position==="fixed"&&(r=null),(i?!c&&!r:!c&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||oe(s)&&!c&&$t(n,s))?o=o.filter(d=>d!==s):r=a,s=W(s);}return e.set(n,o),o}function Cn(n){let{element:e,boundary:t,rootBoundary:o,strategy:r}=n,s=[...t==="clippingAncestors"?Se(e)?[]:xn(e,this._c):[].concat(t),o],a=Nt(e,s[0],r),c=a.top,l=a.right,d=a.bottom,p=a.left;for(let f=1;f<s.length;f++){let u=Nt(e,s[f],r);c=H(u.top,c),l=j(u.right,l),d=j(u.bottom,d),p=H(u.left,p);}return {width:l-p,height:d-c,x:p,y:c}}function kn(n){let{width:e,height:t}=Wt(n);return {width:e,height:t}}function En(n,e,t){let o=O(e),r=G(e),i=t==="fixed",s=Ie(n,true,i,e),a={scrollLeft:0,scrollTop:0},c=L(0);function l(){c.x=Ue(r);}if(o||!o&&!i)if((Q(e)!=="body"||oe(r))&&(a=Re(e)),o){let u=Ie(e,true,i,e);c.x=u.x+e.clientLeft,c.y=u.y+e.clientTop;}else r&&l();i&&!o&&r&&l();let d=r&&!o&&!i?Ht(r,a):L(0),p=s.left+a.scrollLeft-c.x-d.x,f=s.top+a.scrollTop-c.y-d.y;return {x:p,y:f,width:s.width,height:s.height}}function et(n){return R(n).position==="static"}function Dt(n,e){if(!O(n)||R(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return G(n)===t&&(t=t.ownerDocument.body),t}function Bt(n,e){let t=E(n);if(Se(n))return t;if(!O(n)){let r=W(n);for(;r&&!J(r);){if(S(r)&&!et(r))return r;r=W(r);}return t}let o=Dt(n,e);for(;o&&Lt(o)&&et(o);)o=Dt(o,e);return o&&J(o)&&et(o)&&!He(o)?t:o||Gt(n)||t}var Sn=async function(n){let e=this.getOffsetParent||Bt,t=this.getDimensions,o=await t(n.floating);return {reference:En(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Rn(n){return R(n).direction==="rtl"}var In={convertOffsetParentRelativeRectToViewportRelativeRect:gn,getDocumentElement:G,getClippingRect:Cn,getOffsetParent:Bt,getElementRects:Sn,getClientRects:vn,getDimensions:kn,getScale:re,isElement:S,isRTL:Rn};var ie=It;var se=Pt,ae=Rt;var Ut=St;var le=(n,e,t)=>{let o=new Map,r={platform:In,...t},i={...r.platform,_c:o};return Et(n,e,{...r,platform:i})};function I(n,e=5e3){return new Promise(t=>{let o=()=>{try{return document.querySelector(n)}catch{return null}},r=o();if(r){t(r);return}let i=false,s=l=>{i||(i=true,a.disconnect(),clearTimeout(c),t(l));},a=new MutationObserver(()=>{let l=o();l&&s(l);});a.observe(document.body,{childList:true,subtree:true});let c=setTimeout(()=>s(null),e);})}function zt(){let e=Date.now().toString(16).padStart(12,"0"),t=new Uint8Array(10);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[0]=(t[0]??0)&15|112,t[2]=(t[2]??0)&63|128;let o=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return [e.slice(0,8),e.slice(8,12),o.slice(0,4),o.slice(4,8),o.slice(8,20)].join("-")}function ze(n,e,t,o){let r=n.createElement("iframe");r.className="veo-custom-frame",r.setAttribute("sandbox","allow-scripts"),r.setAttribute("title",t.guide.guideName||"Veo"),r.style.width=o.width;let i=o.fixedHeight!==void 0&&o.fixedHeight!==null;i&&(r.style.height=tt(o.fixedHeight));let s=zt();r.srcdoc=An(e.html??"",e.css??"",e.js??"",s);let a=()=>t.onClose(),c=l=>{if(l.source!==r.contentWindow)return;let d=l.data;if(!(!d||typeof d!="object"||d.__veo!==s))switch(d.type){case "dismiss":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"dismissed"}),a();break;case "cta":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"cta_clicked"}),typeof d.url=="string"&&q(d.url)&&window.open(d.url,"_blank","noopener,noreferrer"),d.close!==false&&a();break;case "navigate":typeof d.url=="string"&&q(d.url)&&window.location.assign(d.url);break;case "track":typeof d.name=="string"&&t.onTrack&&t.onTrack(d.name,Pn(d.props)?d.props:void 0);break;case "resize":!i&&typeof d.height=="number"&&d.height>0&&(r.style.height=`${Math.ceil(d.height)}px`);break}};return window.addEventListener("message",c),{iframe:r,cleanup:()=>window.removeEventListener("message",c)}}function tt(n){return typeof n=="number"?`${n}px`:n}function Pn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function An(n,e,t,o){let r=`(function(){var T=${JSON.stringify(o)};function P(m){m.__veo=T;parent.postMessage(m,'*');}window.veo={dismiss:function(){P({type:'dismiss'});},cta:function(u){P({type:'cta',url:u});},track:function(n,p){P({type:'track',name:n,props:p||{}});},navigate:function(u){P({type:'navigate',url:u});}};document.addEventListener('click',function(e){var a=e.target&&e.target.closest?e.target.closest('a[href]'):null;if(!a)return;var h=a.getAttribute('href');if(!h||h.charAt(0)==='#'||/^(javascript|mailto|tel):/i.test(h))return;e.preventDefault();if(a.target==='_blank'){P({type:'cta',url:a.href,close:false});}else{P({type:'navigate',url:h});}},true);function H(){P({type:'resize',height:Math.ceil(document.documentElement.scrollHeight)});}window.addEventListener('load',H);try{if(typeof ResizeObserver!=='undefined'){new ResizeObserver(H).observe(document.documentElement);}}catch(e){}})();`;return `<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;}</style><style>${Kt(e,"style")}</style></head><body>${n}<script>${r}</script>`+(t?`<script>${Kt(t,"script")}</script>`:"")+"</body></html>"}function Kt(n,e){let t=e==="script"?/<\/script/gi:/<\/style/gi;return n.replace(t,`<\\/${e}`)}var Tn={mode:"floating",position:"bottom-right"},qt=16,Ln=360,ce=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let o=t.placement??Tn,r=null;if(o.mode==="anchored"){let d=o.selector??t.selector??e.guide.activationRules.selector;if(typeof d!="string"||d.length===0||(r=await I(d),!r))return}let{root:i}=this.createHost(),s=i.ownerDocument??document,a=s.createElement("div");a.className=o.mode==="anchored"?"veo-custom-anchored":"veo-custom-floating";let{iframe:c,cleanup:l}=ze(s,t,e,{width:tt(o.width??Ln),fixedHeight:o.height??null});this.registerCleanup(l),a.appendChild(c),i.appendChild(a),o.mode==="floating"?Gn(a,o):r&&this.registerCleanup(await this.setupAnchoredPosition(r,a,o)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}async setupAnchoredPosition(e,t,o){let r=o.side??"bottom",i=async()=>{let{x:a,y:c}=await le(e,t,{placement:r,strategy:"fixed",middleware:[ie(o.offsetY??8),ae(),se({padding:8})]});t.style.left=`${a}px`,t.style.top=`${c}px`;};await i();let s=()=>{i();};return window.addEventListener("scroll",s,true),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,true),window.removeEventListener("resize",s);}}};function Gn(n,e){let t=e.position??"bottom-right",o=`${e.offsetX??qt}px`,r=`${e.offsetY??qt}px`,i=n.style;if(t==="center"){i.top="50%",i.left="50%",i.transform="translate(-50%, -50%)";return}let[s,a]=t.split("-");s==="top"?i.top=r:i.bottom=r,a==="left"?i.left=o:a==="right"?i.right=o:(i.left="50%",i.transform="translateX(-50%)");}function Ke(n,e,t){let o=e.guide.guideSteps[0];if(!o)return;let r=o.fields??[],i=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();},s=t.createElement("div");if(s.className="veo-guide-content",o.title){let u=t.createElement("h2");u.className="veo-guide-title",u.textContent=o.title,s.appendChild(u);}if(o.content){let u=t.createElement("p");u.className="veo-guide-text",u.textContent=o.content,s.appendChild(u);}let a=[],c=t.createElement("form");c.className="veo-form",c.noValidate=true;for(let u of r){let{wrapper:h,read:m}=_n(u,t);a.push({field:u,read:m}),c.appendChild(h);}let l=t.createElement("p");l.className="veo-form-error",l.style.display="none",c.appendChild(l);let d=t.createElement("div");d.className="veo-guide-actions";let p=t.createElement("button");p.type="submit",p.className="veo-guide-cta",p.textContent=o.ctaText||"Enviar",d.appendChild(p),c.appendChild(d),c.addEventListener("submit",u=>{u.preventDefault(),l.style.display="none";let h={};for(let{field:g,read:v}of a){let y=v();if(y==null||y===""){if(g.required){l.textContent=`Complet\xE1 "${g.label}"`,l.style.display="block";return}continue}h[g.key]=y;}if(Object.keys(h).length===0){l.textContent="Respond\xE9 al menos un campo",l.style.display="block";return}p.disabled=true,(e.onFormSubmit??(()=>Promise.resolve(true)))(h).then(g=>{if(!g){p.disabled=false,l.textContent="No se pudo enviar. Prob\xE1 de nuevo.",l.style.display="block";return}e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"completed"});let v=e.isPreview?e.previewNote??"Vista previa: la respuesta NO se guard\xF3.":null;On(n,t,v),window.setTimeout(()=>e.onClose(),v?2200:1400);});}),s.appendChild(c);let f=t.createElement("button");f.type="button",f.className="veo-guide-close",f.setAttribute("aria-label","Cerrar"),f.textContent="\xD7",f.addEventListener("click",i),s.appendChild(f),n.appendChild(s);}function On(n,e,t){for(;n.firstChild;)n.removeChild(n.firstChild);let o=e.createElement("div");if(o.className="veo-form-thanks",o.textContent="\u2713 \xA1Gracias por tu respuesta!",n.appendChild(o),t){let r=e.createElement("p");r.className="veo-form-preview-note",r.textContent=t,n.appendChild(r);}}function _n(n,e){let t=e.createElement("div");t.className="veo-form-field";let o=e.createElement("label");switch(o.className="veo-form-label",o.textContent=n.required?`${n.label} *`:n.label,t.appendChild(o),n.type){case "textarea":{let r=e.createElement("textarea");return r.className="veo-form-input",r.rows=3,n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()}}case "number":{let r=e.createElement("input");return r.type="number",r.className="veo-form-input",n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()===""?void 0:Number(r.value)}}case "select":{let r=e.createElement("select");r.className="veo-form-input";let i=e.createElement("option");i.value="",i.textContent=n.placeholder||"Eleg\xED una opci\xF3n\u2026",r.appendChild(i);for(let s of n.options??[]){let a=e.createElement("option");a.value=s,a.textContent=s,r.appendChild(a);}return t.appendChild(r),{wrapper:t,read:()=>r.value||void 0}}case "radio":{let r=e.createElement("div");r.className="veo-form-options";let i=`veo-${n.key}`,s=[];for(let a of n.options??[]){let c=e.createElement("label");c.className="veo-form-option";let l=e.createElement("input");l.type="radio",l.name=i,l.value=a,s.push(l);let d=e.createElement("span");d.textContent=a,c.appendChild(l),c.appendChild(d),r.appendChild(c);}return t.appendChild(r),{wrapper:t,read:()=>s.find(a=>a.checked)?.value}}case "multiselect":{let r=e.createElement("div");r.className="veo-form-options";let i=[];for(let s of n.options??[]){let a=e.createElement("label");a.className="veo-form-option";let c=e.createElement("input");c.type="checkbox",c.value=s,i.push(c);let l=e.createElement("span");l.textContent=s,a.appendChild(c),a.appendChild(l),r.appendChild(a);}return t.appendChild(r),{wrapper:t,read:()=>{let s=i.filter(a=>a.checked).map(a=>a.value);return s.length>0?s:void 0}}}case "checkbox":{let r=e.createElement("label");r.className="veo-form-option";let i=e.createElement("input");i.type="checkbox";let s=e.createElement("span");return s.textContent=n.placeholder||"S\xED",r.appendChild(i),r.appendChild(s),t.appendChild(r),{wrapper:t,read:()=>i.checked?true:n.required?"":false}}case "yesno":{let r=e.createElement("div");r.className="veo-form-options";let i=`veo-${n.key}`,[s,a]=n.options?.length===2?n.options:["S\xED","No"],c=[];for(let{label:l,value:d}of [{label:s,value:true},{label:a,value:false}]){let p=e.createElement("label");p.className="veo-form-option";let f=e.createElement("input");f.type="radio",f.name=i,c.push({input:f,value:d});let u=e.createElement("span");u.textContent=l,p.appendChild(f),p.appendChild(u),r.appendChild(p);}return t.appendChild(r),{wrapper:t,read:()=>c.find(l=>l.input.checked)?.value}}case "nps":return Vt(t,e,0,10,"veo-nps-btn");case "rating":return Vt(t,e,1,5,"veo-rating-btn","\u2605");default:{let r=e.createElement("input");return r.type="text",r.className="veo-form-input",n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()}}}}function Vt(n,e,t,o,r,i){let s=e.createElement("div");s.className="veo-form-scale";let a,c=[];for(let l=t;l<=o;l++){let d=e.createElement("button");d.type="button",d.className=r,d.textContent=i??String(l),d.setAttribute("aria-label",String(l)),d.addEventListener("click",()=>{a=l,c.forEach((p,f)=>{let u=i?f+t<=l:f+t===l;p.classList.toggle("veo-scale-active",u);});}),c.push(d),s.appendChild(d);}return n.appendChild(s),{wrapper:n,read:()=>a}}var de=class extends b{render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=r.createElement("div");i.className="veo-modal-overlay";let s=r.createElement("div");s.className="veo-modal-card",Ke(s,e,r),i.appendChild(s),o.appendChild(i);let a=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();};i.addEventListener("click",l=>{l.target===i&&a();});let c=l=>{l.key==="Escape"&&a();};document.addEventListener("keydown",c),this.registerCleanup(()=>document.removeEventListener("keydown",c)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};function ue(n){let e=n?.inlinePosition;return e==="before"||e==="prepend"||e==="append"?e:"after"}function Z(n,e,t){switch(t){case "before":n.before(e);break;case "after":n.after(e);break;case "prepend":n.prepend(e);break;case "append":n.append(e);break}}function pe(n,e,t){let o=window.setInterval(()=>{if(n.isConnected)return;let r=document.querySelector(e);r&&Z(r,n,t);},1e3);return ()=>window.clearInterval(o)}var fe=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await I(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=ue(t.style);Z(r,i,a),this.registerCleanup(pe(i,o,a));let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-custom-inline";let{iframe:d,cleanup:p}=ze(c,t,e,{width:"100%"});this.registerCleanup(p),l.appendChild(d),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var he=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await I(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=ue(t.style);Z(r,i,a),this.registerCleanup(pe(i,o,a)),this.applyDesign(t.style);let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-inline",Ke(l,e,c),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var me=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await I(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=ue(t.style);Z(r,i,a),this.registerCleanup(pe(i,o,a)),this.applyDesign(t.style);let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-inline";let d=(f,u)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:f}),u&&window.open(u,"_blank","noopener,noreferrer"),e.onClose();},p=F(t,c,{onCtaClick:(f,u)=>d("cta_clicked",f==="url"?u:void 0),onDismiss:()=>d("dismissed")});l.appendChild(p),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var ge=class extends b{render(e){let t=e.guide.guideSteps[0];if(!t)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=r.createElement("div");i.className="veo-modal-overlay";let s=r.createElement("div");s.className="veo-modal-card";let a=(d,p)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:d}),p&&window.open(p,"_blank","noopener,noreferrer"),e.onClose();},c=F(t,r,{onCtaClick:(d,p)=>{a("cta_clicked",d==="url"?p:void 0);},onDismiss:()=>a("dismissed")});s.appendChild(c),i.appendChild(s),o.appendChild(i),i.addEventListener("click",d=>{d.target===i&&a("dismissed");});let l=d=>{d.key==="Escape"&&a("dismissed");};document.addEventListener("keydown",l),this.registerCleanup(()=>document.removeEventListener("keydown",l)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var ve=class extends b{async render(e){let t=e.guide.guideSteps[0];if(!t)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await I(o);if(!r)return;let{root:i}=this.createHost();this.applyDesign(t.style);let s=i.ownerDocument??document,a=s.createElement("div");a.className="veo-tooltip";let c=(f,u)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:f}),u&&window.open(u,"_blank","noopener,noreferrer"),e.onClose();},l=F(t,s,{onCtaClick:(f,u)=>{c("cta_clicked",f==="url"?u:void 0);},onDismiss:()=>c("dismissed")});a.appendChild(l),i.appendChild(a);let d=async()=>{let{x:f,y:u}=await le(r,a,{placement:"bottom",middleware:[ie(8),ae(),se({padding:8})]});a.style.left=`${f}px`,a.style.top=`${u}px`;};await d();let p=()=>{d();};window.addEventListener("scroll",p,true),window.addEventListener("resize",p),this.registerCleanup(()=>{window.removeEventListener("scroll",p,true),window.removeEventListener("resize",p);}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};function jt(n,e,t,o,r){let i=o.createElement("div");i.className="veo-guide-content";let s=o.createElement("div");s.className="veo-walkthrough-counter",s.textContent=`Paso ${e+1} de ${t}`,i.appendChild(s);let a=o.createElement("div");a.className="veo-walkthrough-progress";for(let h=0;h<t;h++){let m=o.createElement("span");m.className="veo-walkthrough-progress-dot",h<e&&m.classList.add("completed"),h===e&&m.classList.add("active"),a.appendChild(m);}if(i.appendChild(a),typeof n.imageUrl=="string"&&n.imageUrl&&q(n.imageUrl)){let h=o.createElement("img");h.className="veo-guide-image",h.src=n.imageUrl,h.alt=typeof n.title=="string"?n.title:"",i.appendChild(h);}if(typeof n.title=="string"&&n.title){let h=o.createElement("h2");h.className="veo-guide-title",h.textContent=n.title,i.appendChild(h);}if(typeof n.content=="string"&&n.content){let h=o.createElement("p");h.className="veo-guide-text",h.textContent=n.content,i.appendChild(h);}let c=o.createElement("div");c.className="veo-walkthrough-actions";let l=o.createElement("button");l.type="button",l.className="veo-walkthrough-skip",l.textContent="Omitir",l.addEventListener("click",()=>r.onSkip()),c.appendChild(l);let d=o.createElement("div");if(d.className="veo-walkthrough-actions-right",e>0){let h=o.createElement("button");h.type="button",h.className="veo-walkthrough-btn-secondary",h.textContent="Atr\xE1s",h.addEventListener("click",()=>r.onBack()),d.appendChild(h);}let p=e===t-1,f=o.createElement("button");f.type="button",f.className="veo-guide-cta";let u=p?"Finalizar":"Siguiente";return f.textContent=typeof n.ctaText=="string"&&n.ctaText?n.ctaText:u,f.addEventListener("click",()=>{p?r.onComplete():r.onNext();}),d.appendChild(f),c.appendChild(d),i.appendChild(c),i}var ye=class extends b{async render(e){let t=e.guide.guideSteps[e.currentStepIndex];if(!t)return false;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return false;let r=await I(o,5e3);if(!r)return false;let{root:i}=this.createHost();this.applyDesign(t.style);let s=i.ownerDocument??document,a=s.createElement("div");a.className="veo-walkthrough";let c=jt(t,e.currentStepIndex,e.guide.guideSteps.length,s,e.callbacks);a.appendChild(c);let l=s.createElement("div");l.className="veo-walkthrough-arrow",a.appendChild(l),i.appendChild(a);let d=async()=>{let{x:f,y:u,placement:h,middlewareData:m}=await le(r,a,{placement:"bottom",middleware:[ie(10),ae(),se({padding:8}),Ut({element:l})]});a.style.left=`${f}px`,a.style.top=`${u}px`,Dn(l,h,m.arrow);};await d();let p=()=>{d();};return window.addEventListener("scroll",p,true),window.addEventListener("resize",p),this.registerCleanup(()=>{window.removeEventListener("scroll",p,true),window.removeEventListener("resize",p);}),true}},Nn={top:"bottom",bottom:"top",left:"right",right:"left"};function Dn(n,e,t){let o=Nn[e.split("-")[0]??"bottom"]??"top";for(let r of ["top","bottom","left","right"])n.style.setProperty(r,"");t?.x!=null&&n.style.setProperty("left",`${t.x}px`),t?.y!=null&&n.style.setProperty("top",`${t.y}px`),n.style.setProperty(o,"-6px");}var qe=class{constructor(e){this.state=null;this.storageKey=`${at}${e}`,this.state=this.load(),this.state&&this.isAbandoned(this.state)&&this.clear();}current(){return this.state?this.isAbandoned(this.state)?(this.clear(),null):this.state:null}hasActive(){return this.current()!==null}start(e,t){let o=Date.now();return this.state={guideId:e,totalSteps:t,currentStepIndex:0,startedAt:o,lastProgressAt:o},this.persist(),this.state}advance(){if(!this.state)return null;let e=this.state.currentStepIndex+1;return e>=this.state.totalSteps?null:(this.state={...this.state,currentStepIndex:e,lastProgressAt:Date.now()},this.persist(),this.state)}back(){return this.state?this.state.currentStepIndex===0?this.state:(this.state={...this.state,currentStepIndex:this.state.currentStepIndex-1,lastProgressAt:Date.now()},this.persist(),this.state):null}clear(){if(this.state=null,!(typeof localStorage>"u"))try{localStorage.removeItem(this.storageKey);}catch{}}isAbandoned(e){return Date.now()-e.lastProgressAt>18e5}load(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(this.storageKey);if(!e)return null;let t=JSON.parse(e);if(!t||typeof t!="object")return null;let o=t;return typeof o.guideId!="string"||typeof o.totalSteps!="number"||typeof o.currentStepIndex!="number"||typeof o.startedAt!="number"||typeof o.lastProgressAt!="number"?null:o}catch{return null}}persist(){if(!(typeof localStorage>"u"||!this.state))try{localStorage.setItem(this.storageKey,JSON.stringify(this.state));}catch{}}};var Mn={shown:"shown",dismissed:"dismissed",cta_clicked:null,step_advanced:null,step_back:null,completed:"completed"},Ve=class{constructor(e,t){this.client=e;this.activeRenderers=new Set;this.activeByGuideId=new Map;this.dispatched=new Set;this.activeWalkthroughRenderer=null;this.activeWalkthroughGuide=null;if(this.debug=t.debug===true,this.apiUrl=t.apiUrl,this.apiKey=t.apiKey,this.resolver=t.resolver??new Le(t.apiUrl,t.apiKey,this.debug),t.trackerQueue)this.trackerQueue=t.trackerQueue;else {let r=new Ge(t.apiUrl,t.apiKey);this.trackerQueue=new Oe({client:r,flushIntervalMs:3e3,batchSize:5,maxRetries:3,onError:(i,s)=>{this.debug&&console.warn(`[veo] dropped guide interaction after retries: guideId=${s.guideId} action=${s.payload.action}`,i);}});}let o=dt(t.apiKey);this.frequencyCache=t.frequencyCache??new Te(o),this.walkthroughState=t.walkthroughState??new qe(o);}get pendingInteractions(){return this.trackerQueue.size}clearFrequencyCache(){this.frequencyCache.clear();}clearWalkthroughState(){this.tearDownWalkthrough();}async checkGuides(e,t){let o=this.client.getEndUserId();if(!o){this.debug&&console.log("[veo] guides: skipped, no endUserId yet");return}if(await this.tryResumeWalkthrough(o,t,e))return;let r;try{r=await this.resolver.resolve(o,e);}catch(i){this.debug&&console.error("[veo] guides resolver threw:",i);return}this.debug&&console.log(`[veo] guides: ${r.length} eligible at ${e}`);for(let i of r){if(this.frequencyCache.shouldFilter(i.guideId,i.displayFrequency)){this.debug&&console.log(`[veo] guides: filtered locally guideId=${i.guideId}`);continue}if(this.activeByGuideId.has(i.guideId)){this.debug&&console.log(`[veo] guides: already shown guideId=${i.guideId}`);continue}if(i.guideType==="walkthrough"&&i.guideSteps.length>1){if(this.walkthroughState.hasActive()){this.debug&&console.log(`[veo] guides: walkthrough ${i.guideId} skipped (another active)`);continue}await this.startWalkthrough(i,o,t,e);continue}this.runSingleStepRender(i,t,e);}}destroy(){for(let e of this.activeRenderers)try{e.destroy();}catch(t){this.debug&&console.error("[veo] renderer destroy failed:",t);}if(this.activeRenderers.clear(),this.activeByGuideId.clear(),this.activeWalkthroughRenderer){try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null;}this.dispatched.clear(),this.trackerQueue.destroy();}runSingleStepRender(e,t,o){let r=this.createSingleStepRenderer(e.guideType);if(!r)return;this.activeByGuideId.set(e.guideId,r);let i=e.activationRules.delayMs??0;window.setTimeout(()=>this.mountSingleStepRenderer(e,r,t,o),i);}mountSingleStepRenderer(e,t,o,r){this.activeRenderers.add(t),this.activeByGuideId.set(e.guideId,t);let i=()=>{t.destroy(),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);},s=l=>{this.handleInteraction(e,o,r,l);},a=(l,d)=>{this.client.track(l,d);},c=l=>this.submitFormResponse(e.guideId,l);try{t.render({guide:e,onInteraction:s,onClose:i,onTrack:a,onFormSubmit:c});}catch(l){this.debug&&console.error("[veo] renderer.render threw:",l),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);}}async tryResumeWalkthrough(e,t,o){let r=this.walkthroughState.current();if(!r)return false;let i=await this.resolver.fetchById(r.guideId);if(!i||i.guideType!=="walkthrough")return this.debug&&console.log(`[veo] guides: walkthrough ${r.guideId} no longer available, cleaning up`),this.tearDownWalkthrough(),true;let s=Math.min(r.currentStepIndex,i.guideSteps.length-1);return await this.renderWalkthroughStep(i,s,e,t,o),true}async startWalkthrough(e,t,o,r){this.walkthroughState.start(e.guideId,e.guideSteps.length),await this.renderWalkthroughStep(e,0,t,o,r)&&(this.enqueueInteractionOnce(e.guideId,t,o,r,"shown",0),this.frequencyCache.record(e.guideId,"shown"));}async renderWalkthroughStep(e,t,o,r,i){this.activeWalkthroughRenderer&&(this.activeWalkthroughRenderer.destroy(),this.activeWalkthroughRenderer=null);let s=new ye;this.activeWalkthroughGuide=e;let a={onNext:()=>this.handleWalkthroughNext(o,r,i),onBack:()=>this.handleWalkthroughBack(o,r,i),onSkip:()=>this.handleWalkthroughSkip(o,r,i),onComplete:()=>this.handleWalkthroughComplete(o,r,i)},c=false;try{c=await s.render({guide:e,currentStepIndex:t,callbacks:a});}catch(l){this.debug&&console.error("[veo] walkthrough renderer threw:",l);}return c?(this.activeWalkthroughRenderer=s,true):(this.debug&&console.warn(`[veo] walkthrough ${e.guideId} step ${t} could not render, cancelling`),this.tearDownWalkthrough(),false)}handleWalkthroughNext(e,t,o){let r=this.activeWalkthroughGuide;if(!r)return;let i=this.walkthroughState.advance();if(!i){this.handleWalkthroughComplete(e,t,o);return}this.enqueueInteraction(r.guideId,e,t,o,"step_advanced",i.currentStepIndex),this.renderWalkthroughStep(r,i.currentStepIndex,e,t,o);}handleWalkthroughBack(e,t,o){let r=this.activeWalkthroughGuide;if(!r)return;let i=this.walkthroughState.current();if(!i||i.currentStepIndex===0)return;let s=this.walkthroughState.back();s&&(this.enqueueInteraction(r.guideId,e,t,o,"step_back",s.currentStepIndex),this.renderWalkthroughStep(r,s.currentStepIndex,e,t,o));}handleWalkthroughSkip(e,t,o){let r=this.activeWalkthroughGuide,i=this.walkthroughState.current();!r||!i||(this.enqueueInteraction(r.guideId,e,t,o,"dismissed",i.currentStepIndex),this.frequencyCache.record(r.guideId,"dismissed"),this.tearDownWalkthrough());}handleWalkthroughComplete(e,t,o){let r=this.activeWalkthroughGuide,i=this.walkthroughState.current();!r||!i||(this.enqueueInteraction(r.guideId,e,t,o,"completed",i.currentStepIndex),this.frequencyCache.record(r.guideId,"completed"),this.tearDownWalkthrough());}tearDownWalkthrough(){if(this.activeWalkthroughRenderer)try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null,this.walkthroughState.clear();}handleInteraction(e,t,o,r){let i=`${e.guideId}:${r.action}`;if(this.dispatched.has(i)){this.debug&&console.log(`[veo] guides: dedup hit ${i}`);return}this.dispatched.add(i);let s=Mn[r.action];s&&this.frequencyCache.record(e.guideId,s);let a=this.client.getEndUserId();if(!a){this.debug&&console.warn("[veo] guides: interaction without endUserId \u2014 skipping enqueue");return}this.trackerQueue.enqueue({guideId:e.guideId,payload:{endUserId:a,sessionId:t,action:r.action,stepIndex:r.stepIndex,pageUrl:o,pagePath:Yt(o)}});}enqueueInteraction(e,t,o,r,i,s){this.trackerQueue.enqueue({guideId:e,payload:{endUserId:t,sessionId:o,action:i,stepIndex:s,pageUrl:r,pagePath:Yt(r)}});}enqueueInteractionOnce(e,t,o,r,i,s){let a=`${e}:${i}:${s}`;this.dispatched.has(a)||(this.dispatched.add(a),this.enqueueInteraction(e,t,o,r,i,s));}createSingleStepRenderer(e){switch(e){case "modal":return new ge;case "banner":return new ee;case "tooltip":return new ve;case "custom":return new ce;case "inline":return new me;case "inline-custom":return new fe;case "form":return new de;case "inline-form":return new he;case "walkthrough":return null}}async submitFormResponse(e,t){let o=this.client.getEndUserId()??this.client.getAnonymousId();try{let r=await fetch(`${this.apiUrl}/v1/guides/${e}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.apiKey},body:JSON.stringify({endUserId:o,answers:t})});return !r.ok&&this.debug&&console.warn("[veo] form-response respondi\xF3",r.status),r.ok}catch(r){return this.debug&&console.warn("[veo] form-response fall\xF3:",r),false}}};function Yt(n){try{return new URL(n).pathname}catch{return "/"}}var Fn="__veo_preview__",nt=class{constructor(){this.singleStep=null;this.walkthrough=null;this.walkthroughGuide=null;this.walkthroughIndex=0;this.input=null;}preview(e){this.close(),this.input=e;let t=Hn(e),o=typeof e.startStepIndex=="number"?e.startStepIndex:0,r=t.guideType==="walkthrough"?this.startWalkthrough(t,o):this.renderSingleStep(t);return {close:()=>this.close(),ready:r}}close(){this.singleStep&&(Pe(this.singleStep),this.singleStep=null),this.walkthrough&&(Pe(this.walkthrough),this.walkthrough=null),this.walkthroughGuide=null,this.walkthroughIndex=0,this.input=null;}async renderSingleStep(e){let t=$n(e.guideType);if(!t)return {rendered:false};this.singleStep=t;let o=false;try{await t.render({guide:e,onInteraction:r=>{r.action==="shown"&&(o=!0);},onClose:()=>this.close(),onTrack:()=>{},onFormSubmit:this.input?.formSubmit??(()=>Promise.resolve(!0)),isPreview:!0,...this.input?.formSubmit&&this.input.formSubmitNote!==void 0?{previewNote:this.input.formSubmitNote}:{}});}catch{return this.close(),{rendered:false}}return this.singleStep!==t?(Pe(t),{rendered:false}):{rendered:o}}async startWalkthrough(e,t=0){if(e.guideSteps.length===0)return {rendered:false};this.walkthroughGuide=e;let o=Math.min(Math.max(0,Math.floor(t)),e.guideSteps.length-1);return this.walkthroughIndex=o,{rendered:await this.renderWalkthroughStep(o)}}async renderWalkthroughStep(e){let t=this.walkthroughGuide;if(!t)return false;this.walkthrough&&(Pe(this.walkthrough),this.walkthrough=null);let o=new ye,r={onNext:()=>{let s=this.walkthroughIndex+1;if(s>=t.guideSteps.length){this.close();return}this.walkthroughIndex=s,this.renderWalkthroughStep(s);},onBack:()=>{let s=this.walkthroughIndex-1;s<0||(this.walkthroughIndex=s,this.renderWalkthroughStep(s));},onSkip:()=>this.close(),onComplete:()=>this.close()},i=false;try{i=await o.render({guide:t,currentStepIndex:e,callbacks:r});}catch{i=false;}return !i||this.walkthroughGuide!==t?(Pe(o),false):(this.walkthrough=o,true)}},je=null;function Ye(n){return Ae()?(je||(je=new nt),je.preview(n)):{close:()=>{},ready:Promise.resolve({rendered:false})}}function Xt(){je?.close();}function Hn(n){let e=n.activationRules?.selector,t={url:n.activationRules?.url??{type:"prefix",pattern:"/"},trigger:"immediate",...e!==void 0?{selector:e}:{}};return {guideId:Fn,guideName:n.guideName??"Preview",guideType:n.guideType,guideSteps:n.guideSteps,activationRules:t,displayFrequency:"always",displayPriority:0}}function $n(n){switch(n){case "modal":return new ge;case "banner":return new ee;case "tooltip":return new ve;case "custom":return new ce;case "inline":return new me;case "inline-custom":return new fe;case "form":return new de;case "inline-form":return new he;case "walkthrough":return null}}function Pe(n){try{n.destroy();}catch{}}var Xe=null;async function Qt(n){if(!Ae())return null;Xe?.teardown();let e=null;try{let a=await fetch(`${n.apiUrl}/v1/guides/preview-resolve`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":n.apiKey},body:JSON.stringify({token:n.token})});a.ok?e=(await a.json()).guide??null:n.debug&&console.warn("[veo] preview-resolve respondi\xF3",a.status);}catch(a){n.debug&&console.warn("[veo] preview-resolve fall\xF3:",a);}let t=async a=>{if(!e)return false;let c=window.veo,l=c?.getEndUserId?.()??c?.getAnonymousId?.()??null;if(!l)return false;try{return (await fetch(`${n.apiUrl}/v1/guides/${e.guideId}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":n.apiKey},body:JSON.stringify({endUserId:l,answers:a})})).ok}catch{return false}},o=null,r=()=>{e&&(o?.close(),o=Ye({guideType:e.guideType,guideSteps:e.guideSteps,activationRules:e.activationRules,guideName:e.guideName,formSubmit:t,formSubmitNote:"Vista previa: guardado en TU usuario para probar el flujo."}));},i=Bn({label:e?`Vista previa: ${e.guideName}`:"Link de preview inv\xE1lido o vencido",error:!e,onReshow:e?r:null,onClose:()=>s.teardown()}),s={teardown(){o?.close(),o=null,i.remove(),Xe===s&&(Xe=null);}};return Xe=s,r(),s}function Bn(n){let e=document.createElement("div");e.setAttribute("data-veo-preview-chip","");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=`
|
|
281
|
+
`;var w=class{constructor(){this.host=null;this.shadow=null;this.cleanups=[];}createHost(){let e=document.createElement("div");e.setAttribute(pt,"");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=Ct,t.appendChild(o);let r=document.createElement("div");return t.appendChild(r),document.body.appendChild(e),this.host=e,this.shadow=t,{host:e,shadow:t,root:r}}applyDesign(e){this.host&&xt(this.host,e);}registerCleanup(e){this.cleanups.push(e);}destroy(){for(let e of this.cleanups)try{e();}catch{}this.cleanups=[],this.host?.parentNode&&this.host.parentNode.removeChild(this.host),this.host=null,this.shadow=null;}};var te=class extends w{render(e){let t=e.guide.guideSteps[0];if(!t)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=t.style?.position==="bottom"?"bottom":"top",s=r.createElement("div");s.className=`veo-banner veo-banner-${i}`;let a=(l,d)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:l}),d&&window.open(d,"_blank","noopener,noreferrer"),e.onClose();},c=$(t,r,{onCtaClick:(l,d)=>{a("cta_clicked",l==="url"?d:void 0);},onDismiss:()=>a("dismissed")});s.appendChild(c),o.appendChild(s),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var Y=Math.min,B=Math.max,Se=Math.round;var G=n=>({x:n,y:n}),cn={left:"right",right:"left",bottom:"top",top:"bottom"};function De(n,e,t){return B(n,Y(e,t))}function ne(n,e){return typeof n=="function"?n(e):n}function U(n){return n.split("-")[0]}function oe(n){return n.split("-")[1]}function ot(n){return n==="x"?"y":"x"}function Me(n){return n==="y"?"height":"width"}function F(n){let e=n[0];return e==="t"||e==="b"?"y":"x"}function Fe(n){return ot(F(n))}function St(n,e,t){t===void 0&&(t=false);let o=oe(n),r=Fe(n),i=Me(r),s=r==="x"?o===(t?"end":"start")?"right":"left":o==="start"?"bottom":"top";return e.reference[i]>e.floating[i]&&(s=Ee(s)),[s,Ee(s)]}function Rt(n){let e=Ee(n);return [_e(n),e,_e(e)]}function _e(n){return n.includes("start")?n.replace("start","end"):n.replace("end","start")}var kt=["left","right"],Et=["right","left"],dn=["top","bottom"],un=["bottom","top"];function pn(n,e,t){switch(n){case "top":case "bottom":return t?e?Et:kt:e?kt:Et;case "left":case "right":return e?dn:un;default:return []}}function It(n,e,t,o){let r=oe(n),i=pn(U(n),t==="start",o);return r&&(i=i.map(s=>s+"-"+r),e&&(i=i.concat(i.map(_e)))),i}function Ee(n){let e=U(n);return cn[e]+n.slice(e.length)}function fn(n){return {top:0,right:0,bottom:0,left:0,...n}}function rt(n){return typeof n!="number"?fn(n):{top:n,right:n,bottom:n,left:n}}function X(n){let{x:e,y:t,width:o,height:r}=n;return {width:o,height:r,top:t,left:e,right:e+o,bottom:t+r,x:e,y:t}}function Pt(n,e,t){let{reference:o,floating:r}=n,i=F(e),s=Fe(e),a=Me(s),c=U(e),l=i==="y",d=o.x+o.width/2-r.width/2,u=o.y+o.height/2-r.height/2,p=o[a]/2-r[a]/2,f;switch(c){case "top":f={x:d,y:o.y-r.height};break;case "bottom":f={x:d,y:o.y+o.height};break;case "right":f={x:o.x+o.width,y:u};break;case "left":f={x:o.x-r.width,y:u};break;default:f={x:o.x,y:o.y};}switch(oe(e)){case "start":f[s]-=p*(t&&l?-1:1);break;case "end":f[s]+=p*(t&&l?-1:1);break}return f}async function Tt(n,e){var t;e===void 0&&(e={});let{x:o,y:r,platform:i,rects:s,elements:a,strategy:c}=n,{boundary:l="clippingAncestors",rootBoundary:d="viewport",elementContext:u="floating",altBoundary:p=false,padding:f=0}=ne(e,n),h=rt(f),g=a[p?u==="floating"?"reference":"floating":u],v=X(await i.getClippingRect({element:(t=await(i.isElement==null?void 0:i.isElement(g)))==null||t?g:g.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(a.floating)),boundary:l,rootBoundary:d,strategy:c})),y=u==="floating"?{x:o,y:r,width:s.floating.width,height:s.floating.height}:s.reference,b=await(i.getOffsetParent==null?void 0:i.getOffsetParent(a.floating)),x=await(i.isElement==null?void 0:i.isElement(b))?await(i.getScale==null?void 0:i.getScale(b))||{x:1,y:1}:{x:1,y:1},T=X(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:y,offsetParent:b,strategy:c}):y);return {top:(v.top-T.top+h.top)/x.y,bottom:(T.bottom-v.bottom+h.bottom)/x.y,left:(v.left-T.left+h.left)/x.x,right:(T.right-v.right+h.right)/x.x}}var hn=50,At=async(n,e,t)=>{let{placement:o="bottom",strategy:r="absolute",middleware:i=[],platform:s}=t,a=s.detectOverflow?s:{...s,detectOverflow:Tt},c=await(s.isRTL==null?void 0:s.isRTL(e)),l=await s.getElementRects({reference:n,floating:e,strategy:r}),{x:d,y:u}=Pt(l,o,c),p=o,f=0,h={};for(let m=0;m<i.length;m++){let g=i[m];if(!g)continue;let{name:v,fn:y}=g,{x:b,y:x,data:T,reset:k}=await y({x:d,y:u,initialPlacement:o,placement:p,strategy:r,middlewareData:h,rects:l,platform:a,elements:{reference:n,floating:e}});d=b??d,u=x??u,h[v]={...h[v],...T},k&&f<hn&&(f++,typeof k=="object"&&(k.placement&&(p=k.placement),k.rects&&(l=k.rects===true?await s.getElementRects({reference:n,floating:e,strategy:r}):k.rects),{x:d,y:u}=Pt(l,p,c)),m=-1);}return {x:d,y:u,placement:p,strategy:r,middlewareData:h}},Lt=n=>({name:"arrow",options:n,async fn(e){let{x:t,y:o,placement:r,rects:i,platform:s,elements:a,middlewareData:c}=e,{element:l,padding:d=0}=ne(n,e)||{};if(l==null)return {};let u=rt(d),p={x:t,y:o},f=Fe(r),h=Me(f),m=await s.getDimensions(l),g=f==="y",v=g?"top":"left",y=g?"bottom":"right",b=g?"clientHeight":"clientWidth",x=i.reference[h]+i.reference[f]-p[f]-i.floating[h],T=p[f]-i.reference[f],k=await(s.getOffsetParent==null?void 0:s.getOffsetParent(l)),z=k?k[b]:0;(!z||!await(s.isElement==null?void 0:s.isElement(k)))&&(z=a.floating[b]||i.floating[h]);let be=x/2-T/2,K=z/2-m[h]/2-1,_=Y(u[v],K),xe=Y(u[y],K),q=_,Ce=z-m[h]-xe,C=z/2-m[h]/2+be,V=De(q,C,Ce),D=!c.arrow&&oe(r)!=null&&C!==V&&i.reference[h]/2-(C<q?_:xe)-m[h]/2<0,A=D?C<q?C-q:C-Ce:0;return {[f]:p[f]+A,data:{[f]:V,centerOffset:C-V-A,...D&&{alignmentOffset:A}},reset:D}}});var Gt=function(n){return n===void 0&&(n={}),{name:"flip",options:n,async fn(e){var t,o;let{placement:r,middlewareData:i,rects:s,initialPlacement:a,platform:c,elements:l}=e,{mainAxis:d=true,crossAxis:u=true,fallbackPlacements:p,fallbackStrategy:f="bestFit",fallbackAxisSideDirection:h="none",flipAlignment:m=true,...g}=ne(n,e);if((t=i.arrow)!=null&&t.alignmentOffset)return {};let v=U(r),y=F(a),b=U(a)===a,x=await(c.isRTL==null?void 0:c.isRTL(l.floating)),T=p||(b||!m?[Ee(a)]:Rt(a)),k=h!=="none";!p&&k&&T.push(...It(a,m,h,x));let z=[a,...T],be=await c.detectOverflow(e,g),K=[],_=((o=i.flip)==null?void 0:o.overflows)||[];if(d&&K.push(be[v]),u){let C=St(r,s,x);K.push(be[C[0]],be[C[1]]);}if(_=[..._,{placement:r,overflows:K}],!K.every(C=>C<=0)){var xe,q;let C=(((xe=i.flip)==null?void 0:xe.index)||0)+1,V=z[C];if(V&&(!(u==="alignment"?y!==F(V):false)||_.every(L=>F(L.placement)===y?L.overflows[0]>0:true)))return {data:{index:C,overflows:_},reset:{placement:V}};let D=(q=_.filter(A=>A.overflows[0]<=0).sort((A,L)=>A.overflows[1]-L.overflows[1])[0])==null?void 0:q.placement;if(!D)switch(f){case "bestFit":{var Ce;let A=(Ce=_.filter(L=>{if(k){let H=F(L.placement);return H===y||H==="y"}return true}).map(L=>[L.placement,L.overflows.filter(H=>H>0).reduce((H,nn)=>H+nn,0)]).sort((L,H)=>L[1]-H[1])[0])==null?void 0:Ce[0];A&&(D=A);break}case "initialPlacement":D=a;break}if(r!==D)return {reset:{placement:D}}}return {}}}};var mn=new Set(["left","top"]);async function gn(n,e){let{placement:t,platform:o,elements:r}=n,i=await(o.isRTL==null?void 0:o.isRTL(r.floating)),s=U(t),a=oe(t),c=F(t)==="y",l=mn.has(s)?-1:1,d=i&&c?-1:1,u=ne(e,n),{mainAxis:p,crossAxis:f,alignmentAxis:h}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof h=="number"&&(f=a==="end"?h*-1:h),c?{x:f*d,y:p*l}:{x:p*l,y:f*d}}var Ot=function(n){return n===void 0&&(n=0),{name:"offset",options:n,async fn(e){var t,o;let{x:r,y:i,placement:s,middlewareData:a}=e,c=await gn(e,n);return s===((t=a.offset)==null?void 0:t.placement)&&(o=a.arrow)!=null&&o.alignmentOffset?{}:{x:r+c.x,y:i+c.y,data:{...c,placement:s}}}}},Nt=function(n){return n===void 0&&(n={}),{name:"shift",options:n,async fn(e){let{x:t,y:o,placement:r,platform:i}=e,{mainAxis:s=true,crossAxis:a=false,limiter:c={fn:v=>{let{x:y,y:b}=v;return {x:y,y:b}}},...l}=ne(n,e),d={x:t,y:o},u=await i.detectOverflow(e,l),p=F(U(r)),f=ot(p),h=d[f],m=d[p];if(s){let v=f==="y"?"top":"left",y=f==="y"?"bottom":"right",b=h+u[v],x=h-u[y];h=De(b,h,x);}if(a){let v=p==="y"?"top":"left",y=p==="y"?"bottom":"right",b=m+u[v],x=m-u[y];m=De(b,m,x);}let g=c.fn({...e,[f]:h,[p]:m});return {...g,data:{x:g.x-t,y:g.y-o,enabled:{[f]:s,[p]:a}}}}}};function He(){return typeof window<"u"}function J(n){return Dt(n)?(n.nodeName||"").toLowerCase():"#document"}function E(n){var e;return (n==null||(e=n.ownerDocument)==null?void 0:e.defaultView)||window}function O(n){var e;return (e=(Dt(n)?n.ownerDocument:n.document)||window.document)==null?void 0:e.documentElement}function Dt(n){return He()?n instanceof Node||n instanceof E(n).Node:false}function R(n){return He()?n instanceof Element||n instanceof E(n).Element:false}function N(n){return He()?n instanceof HTMLElement||n instanceof E(n).HTMLElement:false}function _t(n){return !He()||typeof ShadowRoot>"u"?false:n instanceof ShadowRoot||n instanceof E(n).ShadowRoot}function re(n){let{overflow:e,overflowX:t,overflowY:o,display:r}=I(n);return /auto|scroll|overlay|hidden|clip/.test(e+o+t)&&r!=="inline"&&r!=="contents"}function Mt(n){return /^(table|td|th)$/.test(J(n))}function Re(n){try{if(n.matches(":popover-open"))return !0}catch{}try{return n.matches(":modal")}catch{return false}}var vn=/transform|translate|scale|rotate|perspective|filter/,yn=/paint|layout|strict|content/,Q=n=>!!n&&n!=="none",it;function $e(n){let e=R(n)?I(n):n;return Q(e.transform)||Q(e.translate)||Q(e.scale)||Q(e.rotate)||Q(e.perspective)||!Be()&&(Q(e.backdropFilter)||Q(e.filter))||vn.test(e.willChange||"")||yn.test(e.contain||"")}function Ft(n){let e=W(n);for(;N(e)&&!Z(e);){if($e(e))return e;if(Re(e))return null;e=W(e);}return null}function Be(){return it==null&&(it=typeof CSS<"u"&&CSS.supports&&CSS.supports("-webkit-backdrop-filter","none")),it}function Z(n){return /^(html|body|#document)$/.test(J(n))}function I(n){return E(n).getComputedStyle(n)}function Ie(n){return R(n)?{scrollLeft:n.scrollLeft,scrollTop:n.scrollTop}:{scrollLeft:n.scrollX,scrollTop:n.scrollY}}function W(n){if(J(n)==="html")return n;let e=n.assignedSlot||n.parentNode||_t(n)&&n.host||O(n);return _t(e)?e.host:e}function Wt(n){let e=W(n);return Z(e)?n.ownerDocument?n.ownerDocument.body:n.body:N(e)&&re(e)?e:Wt(e)}function We(n,e,t){var o;e===void 0&&(e=[]);let r=Wt(n),i=r===((o=n.ownerDocument)==null?void 0:o.body),s=E(r);if(i){Ue(s);return e.concat(s,s.visualViewport||[],re(r)?r:[],[])}else return e.concat(r,We(r,[]))}function Ue(n){return n.parent&&Object.getPrototypeOf(n.parent)?n.frameElement:null}function Ut(n){let e=I(n),t=parseFloat(e.width)||0,o=parseFloat(e.height)||0,r=N(n),i=r?n.offsetWidth:t,s=r?n.offsetHeight:o,a=Se(t)!==i||Se(o)!==s;return a&&(t=i,o=s),{width:t,height:o,$:a}}function zt(n){return R(n)?n:n.contextElement}function ie(n){let e=zt(n);if(!N(e))return G(1);let t=e.getBoundingClientRect(),{width:o,height:r,$:i}=Ut(e),s=(i?Se(t.width):t.width)/o,a=(i?Se(t.height):t.height)/r;return (!s||!Number.isFinite(s))&&(s=1),(!a||!Number.isFinite(a))&&(a=1),{x:s,y:a}}var wn=G(0);function Kt(n){let e=E(n);return !Be()||!e.visualViewport?wn:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function bn(n,e,t){return e===void 0&&(e=false),!t||e&&t!==E(n)?false:e}function Pe(n,e,t,o){e===void 0&&(e=false),t===void 0&&(t=false);let r=n.getBoundingClientRect(),i=zt(n),s=G(1);e&&(o?R(o)&&(s=ie(o)):s=ie(n));let a=bn(i,t,o)?Kt(i):G(0),c=(r.left+a.x)/s.x,l=(r.top+a.y)/s.y,d=r.width/s.x,u=r.height/s.y;if(i){let p=E(i),f=o&&R(o)?E(o):o,h=p,m=Ue(h);for(;m&&o&&f!==h;){let g=ie(m),v=m.getBoundingClientRect(),y=I(m),b=v.left+(m.clientLeft+parseFloat(y.paddingLeft))*g.x,x=v.top+(m.clientTop+parseFloat(y.paddingTop))*g.y;c*=g.x,l*=g.y,d*=g.x,u*=g.y,c+=b,l+=x,h=E(m),m=Ue(h);}}return X({width:d,height:u,x:c,y:l})}function ze(n,e){let t=Ie(n).scrollLeft;return e?e.left+t:Pe(O(n)).left+t}function qt(n,e){let t=n.getBoundingClientRect(),o=t.left+e.scrollLeft-ze(n,t),r=t.top+e.scrollTop;return {x:o,y:r}}function xn(n){let{elements:e,rect:t,offsetParent:o,strategy:r}=n,i=r==="fixed",s=O(o),a=e?Re(e.floating):false;if(o===s||a&&i)return t;let c={scrollLeft:0,scrollTop:0},l=G(1),d=G(0),u=N(o);if((u||!u&&!i)&&((J(o)!=="body"||re(s))&&(c=Ie(o)),u)){let f=Pe(o);l=ie(o),d.x=f.x+o.clientLeft,d.y=f.y+o.clientTop;}let p=s&&!u&&!i?qt(s,c):G(0);return {width:t.width*l.x,height:t.height*l.y,x:t.x*l.x-c.scrollLeft*l.x+d.x+p.x,y:t.y*l.y-c.scrollTop*l.y+d.y+p.y}}function Cn(n){return Array.from(n.getClientRects())}function kn(n){let e=O(n),t=Ie(n),o=n.ownerDocument.body,r=B(e.scrollWidth,e.clientWidth,o.scrollWidth,o.clientWidth),i=B(e.scrollHeight,e.clientHeight,o.scrollHeight,o.clientHeight),s=-t.scrollLeft+ze(n),a=-t.scrollTop;return I(o).direction==="rtl"&&(s+=B(e.clientWidth,o.clientWidth)-r),{width:r,height:i,x:s,y:a}}var Ht=25;function En(n,e){let t=E(n),o=O(n),r=t.visualViewport,i=o.clientWidth,s=o.clientHeight,a=0,c=0;if(r){i=r.width,s=r.height;let d=Be();(!d||d&&e==="fixed")&&(a=r.offsetLeft,c=r.offsetTop);}let l=ze(o);if(l<=0){let d=o.ownerDocument,u=d.body,p=getComputedStyle(u),f=d.compatMode==="CSS1Compat"&&parseFloat(p.marginLeft)+parseFloat(p.marginRight)||0,h=Math.abs(o.clientWidth-u.clientWidth-f);h<=Ht&&(i-=h);}else l<=Ht&&(i+=l);return {width:i,height:s,x:a,y:c}}function Sn(n,e){let t=Pe(n,true,e==="fixed"),o=t.top+n.clientTop,r=t.left+n.clientLeft,i=N(n)?ie(n):G(1),s=n.clientWidth*i.x,a=n.clientHeight*i.y,c=r*i.x,l=o*i.y;return {width:s,height:a,x:c,y:l}}function $t(n,e,t){let o;if(e==="viewport")o=En(n,t);else if(e==="document")o=kn(O(n));else if(R(e))o=Sn(e,t);else {let r=Kt(n);o={x:e.x-r.x,y:e.y-r.y,width:e.width,height:e.height};}return X(o)}function Vt(n,e){let t=W(n);return t===e||!R(t)||Z(t)?false:I(t).position==="fixed"||Vt(t,e)}function Rn(n,e){let t=e.get(n);if(t)return t;let o=We(n,[]).filter(a=>R(a)&&J(a)!=="body"),r=null,i=I(n).position==="fixed",s=i?W(n):n;for(;R(s)&&!Z(s);){let a=I(s),c=$e(s);!c&&a.position==="fixed"&&(r=null),(i?!c&&!r:!c&&a.position==="static"&&!!r&&(r.position==="absolute"||r.position==="fixed")||re(s)&&!c&&Vt(n,s))?o=o.filter(d=>d!==s):r=a,s=W(s);}return e.set(n,o),o}function In(n){let{element:e,boundary:t,rootBoundary:o,strategy:r}=n,s=[...t==="clippingAncestors"?Re(e)?[]:Rn(e,this._c):[].concat(t),o],a=$t(e,s[0],r),c=a.top,l=a.right,d=a.bottom,u=a.left;for(let p=1;p<s.length;p++){let f=$t(e,s[p],r);c=B(f.top,c),l=Y(f.right,l),d=Y(f.bottom,d),u=B(f.left,u);}return {width:l-u,height:d-c,x:u,y:c}}function Pn(n){let{width:e,height:t}=Ut(n);return {width:e,height:t}}function Tn(n,e,t){let o=N(e),r=O(e),i=t==="fixed",s=Pe(n,true,i,e),a={scrollLeft:0,scrollTop:0},c=G(0);function l(){c.x=ze(r);}if(o||!o&&!i)if((J(e)!=="body"||re(r))&&(a=Ie(e)),o){let f=Pe(e,true,i,e);c.x=f.x+e.clientLeft,c.y=f.y+e.clientTop;}else r&&l();i&&!o&&r&&l();let d=r&&!o&&!i?qt(r,a):G(0),u=s.left+a.scrollLeft-c.x-d.x,p=s.top+a.scrollTop-c.y-d.y;return {x:u,y:p,width:s.width,height:s.height}}function st(n){return I(n).position==="static"}function Bt(n,e){if(!N(n)||I(n).position==="fixed")return null;if(e)return e(n);let t=n.offsetParent;return O(n)===t&&(t=t.ownerDocument.body),t}function jt(n,e){let t=E(n);if(Re(n))return t;if(!N(n)){let r=W(n);for(;r&&!Z(r);){if(R(r)&&!st(r))return r;r=W(r);}return t}let o=Bt(n,e);for(;o&&Mt(o)&&st(o);)o=Bt(o,e);return o&&Z(o)&&st(o)&&!$e(o)?t:o||Ft(n)||t}var An=async function(n){let e=this.getOffsetParent||jt,t=this.getDimensions,o=await t(n.floating);return {reference:Tn(n.reference,await e(n.floating),n.strategy),floating:{x:0,y:0,width:o.width,height:o.height}}};function Ln(n){return I(n).direction==="rtl"}var Gn={convertOffsetParentRelativeRectToViewportRelativeRect:xn,getDocumentElement:O,getClippingRect:In,getOffsetParent:jt,getElementRects:An,getClientRects:Cn,getDimensions:Pn,getScale:ie,isElement:R,isRTL:Ln};var se=Ot;var ae=Nt,le=Gt;var Ke=Lt;var ce=(n,e,t)=>{let o=new Map,r={platform:Gn,...t},i={...r.platform,_c:o};return At(n,e,{...r,platform:i})};function P(n,e=5e3){return new Promise(t=>{let o=()=>{try{return document.querySelector(n)}catch{return null}},r=o();if(r){t(r);return}let i=false,s=l=>{i||(i=true,a.disconnect(),clearTimeout(c),t(l));},a=new MutationObserver(()=>{let l=o();l&&s(l);});a.observe(document.body,{childList:true,subtree:true});let c=setTimeout(()=>s(null),e);})}function Yt(){let e=Date.now().toString(16).padStart(12,"0"),t=new Uint8Array(10);if(typeof crypto<"u"&&typeof crypto.getRandomValues=="function")crypto.getRandomValues(t);else for(let r=0;r<t.length;r++)t[r]=Math.floor(Math.random()*256);t[0]=(t[0]??0)&15|112,t[2]=(t[2]??0)&63|128;let o=Array.from(t,r=>r.toString(16).padStart(2,"0")).join("");return [e.slice(0,8),e.slice(8,12),o.slice(0,4),o.slice(4,8),o.slice(8,20)].join("-")}function qe(n,e,t,o){let r=n.createElement("iframe");r.className="veo-custom-frame",r.setAttribute("sandbox","allow-scripts"),r.setAttribute("title",t.guide.guideName||"Veo"),r.style.width=o.width;let i=o.fixedHeight!==void 0&&o.fixedHeight!==null;i&&(r.style.height=lt(o.fixedHeight));let s=Yt(),a=e.style?.tailwind===true;r.srcdoc=_n(e.html??"",e.css??"",e.js??"",s,{tokens:On(),tailwind:a});let c=()=>t.onClose(),l=d=>{if(d.source!==r.contentWindow)return;let u=d.data;if(!(!u||typeof u!="object"||u.__veo!==s))switch(u.type){case "dismiss":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"dismissed"}),c();break;case "cta":t.onInteraction({guideId:t.guide.guideId,stepIndex:0,action:"cta_clicked"}),typeof u.url=="string"&&j(u.url)&&window.open(u.url,"_blank","noopener,noreferrer"),u.close!==false&&c();break;case "navigate":typeof u.url=="string"&&j(u.url)&&window.location.assign(u.url);break;case "track":typeof u.name=="string"&&t.onTrack&&t.onTrack(u.name,Nn(u.props)?u.props:void 0);break;case "resize":!i&&typeof u.height=="number"&&u.height>0&&(r.style.height=`${Math.ceil(u.height)}px`);break}};return window.addEventListener("message",l),{iframe:r,cleanup:()=>window.removeEventListener("message",l)}}function lt(n){return typeof n=="number"?`${n}px`:n}function On(){if(typeof window>"u"||typeof document>"u")return "";try{let n=getComputedStyle(document.documentElement),e=[],t=new Set;for(let r=0;r<n.length&&e.length<400;r++){let i=n.item(r);if(!i.startsWith("--")||t.has(i))continue;t.add(i);let s=n.getPropertyValue(i).trim();!s||s.length>200||/[<>{}]/.test(s)||e.push(`${i}:${s}`);}let o=getComputedStyle(document.body).fontFamily;return o&&o.length<=200&&!/[<>{}]/.test(o)&&e.push(`--veo-host-font:${o}`),e.length?`:root{${e.join(";")}}`:""}catch{return ""}}function Nn(n){return typeof n=="object"&&n!==null&&!Array.isArray(n)}function _n(n,e,t,o,r){let i=`(function(){var T=${JSON.stringify(o)};function P(m){m.__veo=T;parent.postMessage(m,'*');}window.veo={dismiss:function(){P({type:'dismiss'});},cta:function(u){P({type:'cta',url:u});},track:function(n,p){P({type:'track',name:n,props:p||{}});},navigate:function(u){P({type:'navigate',url:u});}};document.addEventListener('click',function(e){var a=e.target&&e.target.closest?e.target.closest('a[href]'):null;if(!a)return;var h=a.getAttribute('href');if(!h||h.charAt(0)==='#'||/^(javascript|mailto|tel):/i.test(h))return;e.preventDefault();if(a.target==='_blank'){P({type:'cta',url:a.href,close:false});}else{P({type:'navigate',url:h});}},true);function H(){P({type:'resize',height:Math.ceil(document.documentElement.scrollHeight)});}window.addEventListener('load',H);try{if(typeof ResizeObserver!=='undefined'){new ResizeObserver(H).observe(document.documentElement);}}catch(e){}})();`,s=r.tokens?`<style>${at(r.tokens,"style")}</style>`:"",a=r.tailwind?'<script src="https://cdn.tailwindcss.com"></script>':"";return '<!DOCTYPE html><html><head><meta charset="utf-8"><style>html,body{margin:0;padding:0;background:transparent;font-family:var(--veo-host-font,system-ui,sans-serif);}</style>'+s+a+`<style>${at(e,"style")}</style></head><body>${n}<script>${i}</script>`+(t?`<script>${at(t,"script")}</script>`:"")+"</body></html>"}function at(n,e){let t=e==="script"?/<\/script/gi:/<\/style/gi;return n.replace(t,`<\\/${e}`)}var Dn={mode:"floating",position:"bottom-right"},Xt=16,Mn=360,de=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let o=t.placement??Dn,r=null;if(o.mode==="anchored"){let d=o.selector??t.selector??e.guide.activationRules.selector;if(typeof d!="string"||d.length===0||(r=await P(d),!r))return}let{root:i}=this.createHost(),s=i.ownerDocument??document,a=s.createElement("div");a.className=o.mode==="anchored"?"veo-custom-anchored":"veo-custom-floating";let{iframe:c,cleanup:l}=qe(s,t,e,{width:lt(o.width??Mn),fixedHeight:o.height??null});this.registerCleanup(l),a.appendChild(c),a.appendChild(M(s,()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();},"veo-custom-close")),i.appendChild(a),o.mode==="floating"?Fn(a,o):r&&this.registerCleanup(await this.setupAnchoredPosition(r,a,o)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}async setupAnchoredPosition(e,t,o){let r=o.side??"bottom",i=async()=>{let{x:a,y:c}=await ce(e,t,{placement:r,strategy:"fixed",middleware:[se(o.offsetY??8),le(),ae({padding:8})]});t.style.left=`${a}px`,t.style.top=`${c}px`;};await i();let s=()=>{i();};return window.addEventListener("scroll",s,true),window.addEventListener("resize",s),()=>{window.removeEventListener("scroll",s,true),window.removeEventListener("resize",s);}}};function Fn(n,e){let t=e.position??"bottom-right",o=`${e.offsetX??Xt}px`,r=`${e.offsetY??Xt}px`,i=n.style;if(t==="center"){i.top="50%",i.left="50%",i.transform="translate(-50%, -50%)";return}let[s,a]=t.split("-");s==="top"?i.top=r:i.bottom=r,a==="left"?i.left=o:a==="right"?i.right=o:(i.left="50%",i.transform="translateX(-50%)");}function Ve(n,e,t){let o=e.guide.guideSteps[0];if(!o)return;let r=o.fields??[],i=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();},s=t.createElement("div");if(s.className="veo-guide-content",o.title){let p=t.createElement("h2");p.className="veo-guide-title",p.textContent=o.title,s.appendChild(p);}if(o.content){let p=t.createElement("p");p.className="veo-guide-text",p.textContent=o.content,s.appendChild(p);}let a=[],c=t.createElement("form");c.className="veo-form",c.noValidate=true;for(let p of r){let{wrapper:f,read:h}=Hn(p,t);a.push({field:p,read:h}),c.appendChild(f);}let l=t.createElement("p");l.className="veo-form-error",l.style.display="none",c.appendChild(l);let d=t.createElement("div");d.className="veo-guide-actions";let u=t.createElement("button");u.type="submit",u.className="veo-guide-cta",u.textContent=o.ctaText||"Enviar",d.appendChild(u),c.appendChild(d),c.addEventListener("submit",p=>{p.preventDefault(),l.style.display="none";let f={};for(let{field:m,read:g}of a){let v=g();if(v==null||v===""){if(m.required){l.textContent=`Complet\xE1 "${m.label}"`,l.style.display="block";return}continue}f[m.key]=v;}if(Object.keys(f).length===0){l.textContent="Respond\xE9 al menos un campo",l.style.display="block";return}u.disabled=true,(e.onFormSubmit??(()=>Promise.resolve(true)))(f).then(m=>{if(!m){u.disabled=false,l.textContent="No se pudo enviar. Prob\xE1 de nuevo.",l.style.display="block";return}e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"completed"});let g=e.isPreview?e.previewNote??"Vista previa: la respuesta NO se guard\xF3.":null;Wn(n,t,g),window.setTimeout(()=>e.onClose(),g?2200:1400);});}),s.appendChild(c),s.appendChild(M(t,i)),n.appendChild(s);}function Wn(n,e,t){for(;n.firstChild;)n.removeChild(n.firstChild);let o=e.createElement("div");if(o.className="veo-form-thanks",o.textContent="\u2713 \xA1Gracias por tu respuesta!",n.appendChild(o),t){let r=e.createElement("p");r.className="veo-form-preview-note",r.textContent=t,n.appendChild(r);}}function Hn(n,e){let t=e.createElement("div");t.className="veo-form-field";let o=e.createElement("label");switch(o.className="veo-form-label",o.textContent=n.required?`${n.label} *`:n.label,t.appendChild(o),n.type){case "textarea":{let r=e.createElement("textarea");return r.className="veo-form-input",r.rows=3,n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()}}case "number":{let r=e.createElement("input");return r.type="number",r.className="veo-form-input",n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()===""?void 0:Number(r.value)}}case "select":{let r=e.createElement("select");r.className="veo-form-input";let i=e.createElement("option");i.value="",i.textContent=n.placeholder||"Eleg\xED una opci\xF3n\u2026",r.appendChild(i);for(let s of n.options??[]){let a=e.createElement("option");a.value=s,a.textContent=s,r.appendChild(a);}return t.appendChild(r),{wrapper:t,read:()=>r.value||void 0}}case "radio":{let r=e.createElement("div");r.className="veo-form-options";let i=`veo-${n.key}`,s=[];for(let a of n.options??[]){let c=e.createElement("label");c.className="veo-form-option";let l=e.createElement("input");l.type="radio",l.name=i,l.value=a,s.push(l);let d=e.createElement("span");d.textContent=a,c.appendChild(l),c.appendChild(d),r.appendChild(c);}return t.appendChild(r),{wrapper:t,read:()=>s.find(a=>a.checked)?.value}}case "multiselect":{let r=e.createElement("div");r.className="veo-form-options";let i=[];for(let s of n.options??[]){let a=e.createElement("label");a.className="veo-form-option";let c=e.createElement("input");c.type="checkbox",c.value=s,i.push(c);let l=e.createElement("span");l.textContent=s,a.appendChild(c),a.appendChild(l),r.appendChild(a);}return t.appendChild(r),{wrapper:t,read:()=>{let s=i.filter(a=>a.checked).map(a=>a.value);return s.length>0?s:void 0}}}case "checkbox":{let r=e.createElement("label");r.className="veo-form-option";let i=e.createElement("input");i.type="checkbox";let s=e.createElement("span");return s.textContent=n.placeholder||"S\xED",r.appendChild(i),r.appendChild(s),t.appendChild(r),{wrapper:t,read:()=>i.checked?true:n.required?"":false}}case "yesno":{let r=e.createElement("div");r.className="veo-form-options";let i=`veo-${n.key}`,[s,a]=n.options?.length===2?n.options:["S\xED","No"],c=[];for(let{label:l,value:d}of [{label:s,value:true},{label:a,value:false}]){let u=e.createElement("label");u.className="veo-form-option";let p=e.createElement("input");p.type="radio",p.name=i,c.push({input:p,value:d});let f=e.createElement("span");f.textContent=l,u.appendChild(p),u.appendChild(f),r.appendChild(u);}return t.appendChild(r),{wrapper:t,read:()=>c.find(l=>l.input.checked)?.value}}case "nps":return Qt(t,e,0,10,"veo-nps-btn");case "rating":return Qt(t,e,1,5,"veo-rating-btn","\u2605");default:{let r=e.createElement("input");return r.type="text",r.className="veo-form-input",n.placeholder&&(r.placeholder=n.placeholder),t.appendChild(r),{wrapper:t,read:()=>r.value.trim()}}}}function Qt(n,e,t,o,r,i){let s=e.createElement("div");s.className="veo-form-scale";let a,c=[];for(let l=t;l<=o;l++){let d=e.createElement("button");d.type="button",d.className=r,d.textContent=i??String(l),d.setAttribute("aria-label",String(l)),d.addEventListener("click",()=>{a=l,c.forEach((u,p)=>{let f=i?p+t<=l:p+t===l;u.classList.toggle("veo-scale-active",f);});}),c.push(d),s.appendChild(d);}return n.appendChild(s),{wrapper:n,read:()=>a}}var ue=class extends w{render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=r.createElement("div");i.className="veo-modal-overlay";let s=r.createElement("div");s.className="veo-modal-card",Ve(s,e,r),i.appendChild(s),o.appendChild(i);let a=()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();};i.addEventListener("click",l=>{l.target===i&&a();});let c=l=>{l.key==="Escape"&&a();};document.addEventListener("keydown",c),this.registerCleanup(()=>document.removeEventListener("keydown",c)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};function pe(n){let e=n?.inlinePosition;return e==="before"||e==="prepend"||e==="append"?e:"after"}function ee(n,e,t){switch(t){case "before":n.before(e);break;case "after":n.after(e);break;case "prepend":n.prepend(e);break;case "append":n.append(e);break}}function fe(n,e,t){let o=window.setInterval(()=>{if(n.isConnected)return;let r=document.querySelector(e);r&&ee(r,n,t);},1e3);return ()=>window.clearInterval(o)}var he=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||typeof t.html!="string"||t.html.length===0)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await P(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=pe(t.style);ee(r,i,a),this.registerCleanup(fe(i,o,a));let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-custom-inline";let{iframe:d,cleanup:u}=qe(c,t,e,{width:"100%"});this.registerCleanup(u),l.appendChild(d),l.appendChild(M(c,()=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"dismissed"}),e.onClose();},"veo-custom-close")),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var me=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t||(t.fields??[]).length===0)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await P(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=pe(t.style);ee(r,i,a),this.registerCleanup(fe(i,o,a)),this.applyDesign(t.style);let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-inline",Ve(l,e,c),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var ge=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await P(o);if(!r)return;let{host:i,root:s}=this.createHost();i.style.display="block";let a=pe(t.style);ee(r,i,a),this.registerCleanup(fe(i,o,a)),this.applyDesign(t.style);let c=s.ownerDocument??document,l=c.createElement("div");l.className="veo-inline";let d=(p,f)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:p}),f&&window.open(f,"_blank","noopener,noreferrer"),e.onClose();},u=$(t,c,{onCtaClick:(p,f)=>d("cta_clicked",p==="url"?f:void 0),onDismiss:()=>d("dismissed")});l.appendChild(u),s.appendChild(l),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var ve=class extends w{render(e){let t=e.guide.guideSteps[0];if(!t)return;let{root:o}=this.createHost();this.applyDesign(t.style);let r=o.ownerDocument??document,i=r.createElement("div");i.className="veo-modal-overlay";let s=r.createElement("div");s.className="veo-modal-card";let a=(d,u)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:d}),u&&window.open(u,"_blank","noopener,noreferrer"),e.onClose();},c=$(t,r,{onCtaClick:(d,u)=>{a("cta_clicked",d==="url"?u:void 0);},onDismiss:()=>a("dismissed")});s.appendChild(c),i.appendChild(s),o.appendChild(i),i.addEventListener("click",d=>{d.target===i&&a("dismissed");});let l=d=>{d.key==="Escape"&&a("dismissed");};document.addEventListener("keydown",l),this.registerCleanup(()=>document.removeEventListener("keydown",l)),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};var $n={top:"bottom",bottom:"top",left:"right",right:"left"};function je(n,e,t){let o=$n[e.split("-")[0]??"bottom"]??"top";for(let r of ["top","bottom","left","right"])n.style.setProperty(r,"");t?.x!=null&&n.style.setProperty("left",`${t.x}px`),t?.y!=null&&n.style.setProperty("top",`${t.y}px`),n.style.setProperty(o,"-6px");}var ye=class extends w{async render(e){let t=e.guide.guideSteps[0];if(!t)return;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return;let r=await P(o);if(!r)return;let{root:i}=this.createHost();this.applyDesign(t.style);let s=i.ownerDocument??document,a=s.createElement("div");a.className="veo-tooltip";let c=(f,h)=>{e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:f}),h&&window.open(h,"_blank","noopener,noreferrer"),e.onClose();},l=$(t,s,{onCtaClick:(f,h)=>{c("cta_clicked",f==="url"?h:void 0);},onDismiss:()=>c("dismissed")});a.appendChild(l);let d=s.createElement("div");d.className="veo-tooltip-arrow",a.appendChild(d),i.appendChild(a);let u=async()=>{let{x:f,y:h,placement:m,middlewareData:g}=await ce(r,a,{placement:"bottom",middleware:[se(10),le(),ae({padding:8}),Ke({element:d})]});a.style.left=`${f}px`,a.style.top=`${h}px`,je(d,m,g.arrow);};await u();let p=()=>{u();};window.addEventListener("scroll",p,true),window.addEventListener("resize",p),this.registerCleanup(()=>{window.removeEventListener("scroll",p,true),window.removeEventListener("resize",p);}),e.onInteraction({guideId:e.guide.guideId,stepIndex:0,action:"shown"});}};function Jt(n,e,t,o,r){let i=o.createElement("div");i.className="veo-guide-content";let s=o.createElement("div");s.className="veo-walkthrough-counter",s.textContent=`Paso ${e+1} de ${t}`,i.appendChild(s);let a=o.createElement("div");a.className="veo-walkthrough-progress";for(let h=0;h<t;h++){let m=o.createElement("span");m.className="veo-walkthrough-progress-dot",h<e&&m.classList.add("completed"),h===e&&m.classList.add("active"),a.appendChild(m);}if(i.appendChild(a),typeof n.imageUrl=="string"&&n.imageUrl&&j(n.imageUrl)){let h=o.createElement("img");h.className="veo-guide-image",h.src=n.imageUrl,h.alt=typeof n.title=="string"?n.title:"",i.appendChild(h);}if(typeof n.title=="string"&&n.title){let h=o.createElement("h2");h.className="veo-guide-title",h.textContent=n.title,i.appendChild(h);}if(typeof n.content=="string"&&n.content){let h=o.createElement("p");h.className="veo-guide-text",h.textContent=n.content,i.appendChild(h);}let c=o.createElement("div");c.className="veo-walkthrough-actions";let l=o.createElement("button");l.type="button",l.className="veo-walkthrough-skip",l.textContent="Omitir",l.addEventListener("click",()=>r.onSkip()),c.appendChild(l);let d=o.createElement("div");if(d.className="veo-walkthrough-actions-right",e>0){let h=o.createElement("button");h.type="button",h.className="veo-walkthrough-btn-secondary",h.textContent="Atr\xE1s",h.addEventListener("click",()=>r.onBack()),d.appendChild(h);}let u=e===t-1,p=o.createElement("button");p.type="button",p.className="veo-guide-cta";let f=u?"Finalizar":"Siguiente";return p.textContent=typeof n.ctaText=="string"&&n.ctaText?n.ctaText:f,p.addEventListener("click",()=>{u?r.onComplete():r.onNext();}),d.appendChild(p),c.appendChild(d),i.appendChild(c),i.appendChild(M(o,()=>r.onSkip())),i}var we=class extends w{async render(e){let t=e.guide.guideSteps[e.currentStepIndex];if(!t)return false;let o=t.selector??e.guide.activationRules.selector;if(typeof o!="string"||o.length===0)return false;let r=await P(o,5e3);if(!r)return false;let{root:i}=this.createHost();this.applyDesign(t.style);let s=i.ownerDocument??document,a=s.createElement("div");a.className="veo-walkthrough";let c=Jt(t,e.currentStepIndex,e.guide.guideSteps.length,s,e.callbacks);a.appendChild(c);let l=s.createElement("div");l.className="veo-walkthrough-arrow",a.appendChild(l),i.appendChild(a);let d=async()=>{let{x:p,y:f,placement:h,middlewareData:m}=await ce(r,a,{placement:"bottom",middleware:[se(10),le(),ae({padding:8}),Ke({element:l})]});a.style.left=`${p}px`,a.style.top=`${f}px`,je(l,h,m.arrow);};await d();let u=()=>{d();};return window.addEventListener("scroll",u,true),window.addEventListener("resize",u),this.registerCleanup(()=>{window.removeEventListener("scroll",u,true),window.removeEventListener("resize",u);}),true}};var Ye=class{constructor(e){this.state=null;this.storageKey=`${ht}${e}`,this.state=this.load(),this.state&&this.isAbandoned(this.state)&&this.clear();}current(){return this.state?this.isAbandoned(this.state)?(this.clear(),null):this.state:null}hasActive(){return this.current()!==null}start(e,t){let o=Date.now();return this.state={guideId:e,totalSteps:t,currentStepIndex:0,startedAt:o,lastProgressAt:o},this.persist(),this.state}advance(){if(!this.state)return null;let e=this.state.currentStepIndex+1;return e>=this.state.totalSteps?null:(this.state={...this.state,currentStepIndex:e,lastProgressAt:Date.now()},this.persist(),this.state)}back(){return this.state?this.state.currentStepIndex===0?this.state:(this.state={...this.state,currentStepIndex:this.state.currentStepIndex-1,lastProgressAt:Date.now()},this.persist(),this.state):null}clear(){if(this.state=null,!(typeof localStorage>"u"))try{localStorage.removeItem(this.storageKey);}catch{}}isAbandoned(e){return Date.now()-e.lastProgressAt>18e5}load(){if(typeof localStorage>"u")return null;try{let e=localStorage.getItem(this.storageKey);if(!e)return null;let t=JSON.parse(e);if(!t||typeof t!="object")return null;let o=t;return typeof o.guideId!="string"||typeof o.totalSteps!="number"||typeof o.currentStepIndex!="number"||typeof o.startedAt!="number"||typeof o.lastProgressAt!="number"?null:o}catch{return null}}persist(){if(!(typeof localStorage>"u"||!this.state))try{localStorage.setItem(this.storageKey,JSON.stringify(this.state));}catch{}}};var Un={shown:"shown",dismissed:"dismissed",cta_clicked:null,step_advanced:null,step_back:null,completed:"completed"},Xe=class{constructor(e,t){this.client=e;this.activeRenderers=new Set;this.activeByGuideId=new Map;this.dispatched=new Set;this.activeWalkthroughRenderer=null;this.activeWalkthroughGuide=null;if(this.debug=t.debug===true,this.apiUrl=t.apiUrl,this.apiKey=t.apiKey,this.resolver=t.resolver??new Ge(t.apiUrl,t.apiKey,this.debug),t.trackerQueue)this.trackerQueue=t.trackerQueue;else {let r=new Oe(t.apiUrl,t.apiKey);this.trackerQueue=new Ne({client:r,flushIntervalMs:3e3,batchSize:5,maxRetries:3,onError:(i,s)=>{this.debug&&console.warn(`[veo] dropped guide interaction after retries: guideId=${s.guideId} action=${s.payload.action}`,i);}});}let o=vt(t.apiKey);this.frequencyCache=t.frequencyCache??new Le(o),this.walkthroughState=t.walkthroughState??new Ye(o);}get pendingInteractions(){return this.trackerQueue.size}clearFrequencyCache(){this.frequencyCache.clear();}clearWalkthroughState(){this.tearDownWalkthrough();}async checkGuides(e,t){let o=this.client.getEndUserId();if(!o){this.debug&&console.log("[veo] guides: skipped, no endUserId yet");return}if(await this.tryResumeWalkthrough(o,t,e))return;let r;try{r=await this.resolver.resolve(o,e);}catch(i){this.debug&&console.error("[veo] guides resolver threw:",i);return}this.debug&&console.log(`[veo] guides: ${r.length} eligible at ${e}`);for(let i of r){if(this.frequencyCache.shouldFilter(i.guideId,i.displayFrequency)){this.debug&&console.log(`[veo] guides: filtered locally guideId=${i.guideId}`);continue}if(this.activeByGuideId.has(i.guideId)){this.debug&&console.log(`[veo] guides: already shown guideId=${i.guideId}`);continue}if(i.guideType==="walkthrough"&&i.guideSteps.length>1){if(this.walkthroughState.hasActive()){this.debug&&console.log(`[veo] guides: walkthrough ${i.guideId} skipped (another active)`);continue}await this.startWalkthrough(i,o,t,e);continue}this.runSingleStepRender(i,t,e);}}destroy(){for(let e of this.activeRenderers)try{e.destroy();}catch(t){this.debug&&console.error("[veo] renderer destroy failed:",t);}if(this.activeRenderers.clear(),this.activeByGuideId.clear(),this.activeWalkthroughRenderer){try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null;}this.dispatched.clear(),this.trackerQueue.destroy();}runSingleStepRender(e,t,o){let r=this.createSingleStepRenderer(e.guideType);if(!r)return;this.activeByGuideId.set(e.guideId,r);let i=e.activationRules.delayMs??0;window.setTimeout(()=>this.mountSingleStepRenderer(e,r,t,o),i);}mountSingleStepRenderer(e,t,o,r){this.activeRenderers.add(t),this.activeByGuideId.set(e.guideId,t);let i=()=>{t.destroy(),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);},s=l=>{this.handleInteraction(e,o,r,l);},a=(l,d)=>{this.client.track(l,d);},c=l=>this.submitFormResponse(e.guideId,l);try{t.render({guide:e,onInteraction:s,onClose:i,onTrack:a,onFormSubmit:c});}catch(l){this.debug&&console.error("[veo] renderer.render threw:",l),this.activeRenderers.delete(t),this.activeByGuideId.get(e.guideId)===t&&this.activeByGuideId.delete(e.guideId);}}async tryResumeWalkthrough(e,t,o){let r=this.walkthroughState.current();if(!r)return false;let i=await this.resolver.fetchById(r.guideId);if(!i||i.guideType!=="walkthrough")return this.debug&&console.log(`[veo] guides: walkthrough ${r.guideId} no longer available, cleaning up`),this.tearDownWalkthrough(),true;let s=Math.min(r.currentStepIndex,i.guideSteps.length-1);return await this.renderWalkthroughStep(i,s,e,t,o),true}async startWalkthrough(e,t,o,r){this.walkthroughState.start(e.guideId,e.guideSteps.length),await this.renderWalkthroughStep(e,0,t,o,r)&&(this.enqueueInteractionOnce(e.guideId,t,o,r,"shown",0),this.frequencyCache.record(e.guideId,"shown"));}async renderWalkthroughStep(e,t,o,r,i){this.activeWalkthroughRenderer&&(this.activeWalkthroughRenderer.destroy(),this.activeWalkthroughRenderer=null);let s=new we;this.activeWalkthroughGuide=e;let a={onNext:()=>this.handleWalkthroughNext(o,r,i),onBack:()=>this.handleWalkthroughBack(o,r,i),onSkip:()=>this.handleWalkthroughSkip(o,r,i),onComplete:()=>this.handleWalkthroughComplete(o,r,i)},c=false;try{c=await s.render({guide:e,currentStepIndex:t,callbacks:a});}catch(l){this.debug&&console.error("[veo] walkthrough renderer threw:",l);}return c?(this.activeWalkthroughRenderer=s,true):(this.debug&&console.warn(`[veo] walkthrough ${e.guideId} step ${t} could not render, cancelling`),this.tearDownWalkthrough(),false)}handleWalkthroughNext(e,t,o){let r=this.activeWalkthroughGuide;if(!r)return;let i=this.walkthroughState.advance();if(!i){this.handleWalkthroughComplete(e,t,o);return}this.enqueueInteraction(r.guideId,e,t,o,"step_advanced",i.currentStepIndex),this.renderWalkthroughStep(r,i.currentStepIndex,e,t,o);}handleWalkthroughBack(e,t,o){let r=this.activeWalkthroughGuide;if(!r)return;let i=this.walkthroughState.current();if(!i||i.currentStepIndex===0)return;let s=this.walkthroughState.back();s&&(this.enqueueInteraction(r.guideId,e,t,o,"step_back",s.currentStepIndex),this.renderWalkthroughStep(r,s.currentStepIndex,e,t,o));}handleWalkthroughSkip(e,t,o){let r=this.activeWalkthroughGuide,i=this.walkthroughState.current();!r||!i||(this.enqueueInteraction(r.guideId,e,t,o,"dismissed",i.currentStepIndex),this.frequencyCache.record(r.guideId,"dismissed"),this.tearDownWalkthrough());}handleWalkthroughComplete(e,t,o){let r=this.activeWalkthroughGuide,i=this.walkthroughState.current();!r||!i||(this.enqueueInteraction(r.guideId,e,t,o,"completed",i.currentStepIndex),this.frequencyCache.record(r.guideId,"completed"),this.tearDownWalkthrough());}tearDownWalkthrough(){if(this.activeWalkthroughRenderer)try{this.activeWalkthroughRenderer.destroy();}catch{}this.activeWalkthroughRenderer=null,this.activeWalkthroughGuide=null,this.walkthroughState.clear();}handleInteraction(e,t,o,r){let i=`${e.guideId}:${r.action}`;if(this.dispatched.has(i)){this.debug&&console.log(`[veo] guides: dedup hit ${i}`);return}this.dispatched.add(i);let s=Un[r.action];s&&this.frequencyCache.record(e.guideId,s);let a=this.client.getEndUserId();if(!a){this.debug&&console.warn("[veo] guides: interaction without endUserId \u2014 skipping enqueue");return}this.trackerQueue.enqueue({guideId:e.guideId,payload:{endUserId:a,sessionId:t,action:r.action,stepIndex:r.stepIndex,pageUrl:o,pagePath:Zt(o)}});}enqueueInteraction(e,t,o,r,i,s){this.trackerQueue.enqueue({guideId:e,payload:{endUserId:t,sessionId:o,action:i,stepIndex:s,pageUrl:r,pagePath:Zt(r)}});}enqueueInteractionOnce(e,t,o,r,i,s){let a=`${e}:${i}:${s}`;this.dispatched.has(a)||(this.dispatched.add(a),this.enqueueInteraction(e,t,o,r,i,s));}createSingleStepRenderer(e){switch(e){case "modal":return new ve;case "banner":return new te;case "tooltip":return new ye;case "custom":return new de;case "inline":return new ge;case "inline-custom":return new he;case "form":return new ue;case "inline-form":return new me;case "walkthrough":return null}}async submitFormResponse(e,t){let o=this.client.getEndUserId()??this.client.getAnonymousId();try{let r=await fetch(`${this.apiUrl}/v1/guides/${e}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":this.apiKey},body:JSON.stringify({endUserId:o,answers:t})});return !r.ok&&this.debug&&console.warn("[veo] form-response respondi\xF3",r.status),r.ok}catch(r){return this.debug&&console.warn("[veo] form-response fall\xF3:",r),false}}};function Zt(n){try{return new URL(n).pathname}catch{return "/"}}var zn="__veo_preview__",ct=class{constructor(){this.singleStep=null;this.walkthrough=null;this.walkthroughGuide=null;this.walkthroughIndex=0;this.input=null;}preview(e){this.close(),this.input=e;let t=Kn(e),o=typeof e.startStepIndex=="number"?e.startStepIndex:0,r=t.guideType==="walkthrough"?this.startWalkthrough(t,o):this.renderSingleStep(t);return {close:()=>this.close(),ready:r}}close(){this.singleStep&&(Te(this.singleStep),this.singleStep=null),this.walkthrough&&(Te(this.walkthrough),this.walkthrough=null),this.walkthroughGuide=null,this.walkthroughIndex=0,this.input=null;}async renderSingleStep(e){let t=qn(e.guideType);if(!t)return {rendered:false};this.singleStep=t;let o=false;try{await t.render({guide:e,onInteraction:r=>{r.action==="shown"&&(o=!0);},onClose:()=>this.close(),onTrack:()=>{},onFormSubmit:this.input?.formSubmit??(()=>Promise.resolve(!0)),isPreview:!0,...this.input?.formSubmit&&this.input.formSubmitNote!==void 0?{previewNote:this.input.formSubmitNote}:{}});}catch{return this.close(),{rendered:false}}return this.singleStep!==t?(Te(t),{rendered:false}):{rendered:o}}async startWalkthrough(e,t=0){if(e.guideSteps.length===0)return {rendered:false};this.walkthroughGuide=e;let o=Math.min(Math.max(0,Math.floor(t)),e.guideSteps.length-1);return this.walkthroughIndex=o,{rendered:await this.renderWalkthroughStep(o)}}async renderWalkthroughStep(e){let t=this.walkthroughGuide;if(!t)return false;this.walkthrough&&(Te(this.walkthrough),this.walkthrough=null);let o=new we,r={onNext:()=>{let s=this.walkthroughIndex+1;if(s>=t.guideSteps.length){this.close();return}this.walkthroughIndex=s,this.renderWalkthroughStep(s);},onBack:()=>{let s=this.walkthroughIndex-1;s<0||(this.walkthroughIndex=s,this.renderWalkthroughStep(s));},onSkip:()=>this.close(),onComplete:()=>this.close()},i=false;try{i=await o.render({guide:t,currentStepIndex:e,callbacks:r});}catch{i=false;}return !i||this.walkthroughGuide!==t?(Te(o),false):(this.walkthrough=o,true)}},Qe=null;function Je(n){return Ae()?(Qe||(Qe=new ct),Qe.preview(n)):{close:()=>{},ready:Promise.resolve({rendered:false})}}function en(){Qe?.close();}function Kn(n){let e=n.activationRules?.selector,t={url:n.activationRules?.url??{type:"prefix",pattern:"/"},trigger:"immediate",...e!==void 0?{selector:e}:{}};return {guideId:zn,guideName:n.guideName??"Preview",guideType:n.guideType,guideSteps:n.guideSteps,activationRules:t,displayFrequency:"always",displayPriority:0}}function qn(n){switch(n){case "modal":return new ve;case "banner":return new te;case "tooltip":return new ye;case "custom":return new de;case "inline":return new ge;case "inline-custom":return new he;case "form":return new ue;case "inline-form":return new me;case "walkthrough":return null}}function Te(n){try{n.destroy();}catch{}}var Ze=null;async function tn(n){if(!Ae())return null;Ze?.teardown();let e=null;try{let a=await fetch(`${n.apiUrl}/v1/guides/preview-resolve`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":n.apiKey},body:JSON.stringify({token:n.token})});a.ok?e=(await a.json()).guide??null:n.debug&&console.warn("[veo] preview-resolve respondi\xF3",a.status);}catch(a){n.debug&&console.warn("[veo] preview-resolve fall\xF3:",a);}let t=async a=>{if(!e)return false;let c=window.veo,l=c?.getEndUserId?.()??c?.getAnonymousId?.()??null;if(!l)return false;try{return (await fetch(`${n.apiUrl}/v1/guides/${e.guideId}/form-response`,{method:"POST",headers:{"Content-Type":"application/json","X-Api-Key":n.apiKey},body:JSON.stringify({endUserId:l,answers:a})})).ok}catch{return false}},o=null,r=()=>{e&&(o?.close(),o=Je({guideType:e.guideType,guideSteps:e.guideSteps,activationRules:e.activationRules,guideName:e.guideName,formSubmit:t,formSubmitNote:"Vista previa: guardado en TU usuario para probar el flujo."}));},i=Vn({label:e?`Vista previa: ${e.guideName}`:"Link de preview inv\xE1lido o vencido",error:!e,onReshow:e?r:null,onClose:()=>s.teardown()}),s={teardown(){o?.close(),o=null,i.remove(),Ze===s&&(Ze=null);}};return Ze=s,r(),s}function Vn(n){let e=document.createElement("div");e.setAttribute("data-veo-preview-chip","");let t=e.attachShadow({mode:"open"}),o=document.createElement("style");o.textContent=`
|
|
249
282
|
.chip { position: fixed; bottom: 16px; right: 16px; z-index: 2147483647;
|
|
250
283
|
display: flex; align-items: center; gap: 8px; padding: 8px 12px;
|
|
251
284
|
background: #111827; color: #f9fafb; border-radius: 9999px;
|
|
@@ -255,5 +288,5 @@ var veoGuides=(function(exports){'use strict';function ot(){return typeof window
|
|
|
255
288
|
button { all: unset; cursor: pointer; padding: 2px 6px; border-radius: 9999px;
|
|
256
289
|
font-size: 12px; line-height: 1; }
|
|
257
290
|
button:hover { background: rgba(255,255,255,.15); }
|
|
258
|
-
`,t.appendChild(o);let r=document.createElement("div");r.className=n.error?"chip error":"chip";let i=document.createElement("span");if(i.className="label",i.textContent=n.label,r.appendChild(i),n.onReshow){let a=document.createElement("button");a.textContent="\u21BB",a.title="Volver a mostrar la gu\xEDa",a.addEventListener("click",n.onReshow),r.appendChild(a);}let s=document.createElement("button");return s.textContent="\u2715",s.title="Salir de la vista previa",s.addEventListener("click",n.onClose),r.appendChild(s),t.appendChild(r),document.body.appendChild(e),{remove:()=>e.remove()}}function
|
|
291
|
+
`,t.appendChild(o);let r=document.createElement("div");r.className=n.error?"chip error":"chip";let i=document.createElement("span");if(i.className="label",i.textContent=n.label,r.appendChild(i),n.onReshow){let a=document.createElement("button");a.textContent="\u21BB",a.title="Volver a mostrar la gu\xEDa",a.addEventListener("click",n.onReshow),r.appendChild(a);}let s=document.createElement("button");return s.textContent="\u2715",s.title="Salir de la vista previa",s.addEventListener("click",n.onClose),r.appendChild(s),t.appendChild(r),document.body.appendChild(e),{remove:()=>e.remove()}}function jn(n){return {name:"guides",install(e){if(!dt())return;let t=new Xe(e,n);window.__veoGuides={controller:t},e.on("identify",({sessionId:o})=>{t.checkGuides(window.location.href,o);}),e.on("pageview",({url:o,sessionId:r})=>{t.checkGuides(o,r);}),t.checkGuides(window.location.href,e.getSessionId());}}}exports.closeGuidePreview=en;exports.guidesPlugin=jn;exports.previewGuide=Je;exports.runPreviewMode=tn;return exports;})({});//# sourceMappingURL=veo-guides.js.map
|
|
259
292
|
//# sourceMappingURL=veo-guides.js.map
|